(function(window){"use strict";var site=window.$ite={window:window,doc:window.document,body:window.document.body,params:{debug:false,trusted:false,sid:0,vid:0,aid:0,stid:0,lang:"en",domain:""},utils:{onLoad:function(callback){document.addEventListener("DOMContentLoaded",callback)},loadScript:function(src,options){options=options||{};if(!src){return}var script=document.createElement('script');script.src=src;script.type='text/javascript';script.async=true;document.head.appendChild(script);if(options["onload"]){script.onload=options["onload"]}if(options["onerror"]){script.onerror=options["onerror"]}site.debug("Load script "+src)},addEvent:function(elem,evType,fn){if(elem.addEventListener){elem.addEventListener(evType,fn,false)}else if(elem.attachEvent){elem.attachEvent('on'+evType,fn)}}},start:function(params){this.params=params;if(!!site.window["site_debug"]||window.document.location.search.indexOf("profiling=")!==-1){this.params["debug"]=true}site.debug("Init site");for(var k in site){if(typeof site[k]==="object"&&site[k]["start"]&&typeof site[k]["start"]==="function"){try{site[k].start.call(site[k])}catch(e){site.error("Site start error:",e)}}}},hasParam:function(name){return!!this.params[name]},getParam:function(name){return this.params[name]||null},debug:function(){if(!!this.params["debug"]){var args=Array.from(arguments);args.unshift("<>");window.console.log.apply(site.window,args)}},error:function(){var args=Array.from(arguments);args.unshift("<>");window.console.error.apply(site.window,args)}}})(window);(function(site){"use strict";const STATUS_NOT_LOADED=0;const STATUS_LOADING=1;const STATUS_LOADED=2;const RECAPTCHA_OWN=2;const RECAPTCHA_GENERAL=3;const SMART_CAPTCHA=4;const captcha=site.captcha={activeType:null,badge:'badge-captcha',badgeAttrId:'captcha-widget-id',isRendered:false,jqueryVersion:'',unsubscribe:null,initEvents:['click','focus','touchstart','touchmove','scroll'],scripts:{recaptcha:"https://www.google.com/recaptcha/api.js?onload=onReCaptchaLoad&render=explicit",smart_captcha:'https://smartcaptcha.yandexcloud.net/captcha.js?onload=onSmartCaptchaLoad&render=onload',jquery:"/g/libs/jquery/3.2.1/jquery.min.js"},variants:{recaptcha:'recaptcha',smart_captcha:'smart_captcha',},tokenName:{recaptcha:'g-recaptcha-response',smart_captcha:'smart-token'},queue:{recaptcha:[],smart_captcha:[]},status:{recaptcha:STATUS_NOT_LOADED,smart_captcha:STATUS_NOT_LOADED},token:{_value:'',expired:null,listener:function(value){},get value(){return this._value},set value(val){this._value=val;this.expired=Date.now();this.listener(val)},registerListener(listener){this.listener=listener}},start(){site.debug('Start captcha');if(!site.window["$"]){site.utils.loadScript(this.scripts.jquery,{onload:this.load})}else{this.load()}},load(){site.debug('Captcha load begin');if(site.params.captcha===RECAPTCHA_OWN||site.params.captcha===RECAPTCHA_GENERAL){this.activeType=this.variants.recaptcha;this.initEvents.forEach((event)=>{site.doc.addEventListener(event,this.handleReCaptchaClick.bind(this),true)})}else{this.activeType=this.variants.smart_captcha;captcha.initEvents.forEach((event)=>{site.doc.addEventListener(event,this.handleSmartCaptchaClick.bind(this),true)})}const config={attributes:false,childList:true,subtree:true};const observer=new MutationObserver(this.observe.bind(this));observer.observe(site.doc.body,config);this.checker(site.doc.body)},refreshToken(){switch(this.activeType){case this.variants.recaptcha:this.refreshReCaptchaToken();break;case this.variants.smart_captcha:this.refreshSmartCaptchaToken();break}},refreshReCaptchaToken(){if(!this.isRendered){this.handleReCaptchaClick();return}if(typeof grecaptcha==='undefined'){return}if(site.doc.querySelector('[data-name=captcha-page]')){return}if(this.token.expired&&Date.now()-this.token.expired<100000){return}grecaptcha.execute($(this.getBadge()).data(this.badgeAttrId)).then((token)=>{this.token.value=token})},refreshSmartCaptchaToken(){if(!this.isRendered){this.handleSmartCaptchaClick();return}if(typeof window.smartCaptcha==='undefined'){return}if(site.doc.querySelector('[data-name=captcha-page]')){return}if(this.token.expired&&Date.now()-this.token.expired<280000){return}this.unsubscribe=window.smartCaptcha.subscribe($(this.getBadge()).data(this.badgeAttrId),'success',(token)=>{this.token.value=token});window.smartCaptcha.execute($(this.getBadge()).data(this.badgeAttrId))},observe(mutationList){for(const mutation of mutationList){for(const node of mutation.addedNodes){if(!node||node.nodeType!==1){continue}setTimeout(()=>{this.checker(node)},0)}}},checker(root){$(root).find(`[data-captcha=${this.activeType}]`).each((k,container)=>{const $form=$(container).parents('form:first');if(!$form){site.debug('Not find parent form for ',$(container));container.remove();return}site.debug('Init '+captcha.activeType+' by default for ',$(container));container.removeAttribute('data-captcha');this.add(container)});if(this.queue[this.activeType].length){if(site.doc.querySelector('[data-name=captcha-page]')&&this.status[this.activeType]===STATUS_NOT_LOADED){site.doc.querySelector('[data-name=captcha-page]').click()}}},add(container){if(this.status[this.activeType]!==STATUS_LOADED){this.queue[this.activeType].push(container);return}try{const data={sitekey:container.dataset.sitekey,type:container.dataset.type,size:container.dataset.rsize,theme:container.dataset.theme,invisible:container.dataset.invisible};const $container=$(container);const $form=$container.parents('form:first');const _form=$form.get(0);const $formAction=$form.attr('action')?$form.attr('action'):'';const $isPost=$form.attr('method')&&$form.attr('method').toLowerCase()==='post';const $isMosaic=$form.hasClass('mosaic-form__form')||$form.closest('[data-do-tt_form]').length||$form.closest('[data-do-tt_payment_form]').length||$form.closest('[data-do-form]').length;const $isProduct=$formAction.indexOf('action=add')!==-1;const $isMaliver=$formAction.indexOf('cp.maliver.ru')!==-1;const $isInit=$form.data('captcha-init')===1;const $isCart=$formAction.indexOf('mode=cart')!==-1;const $isAnketa=!!$form.find('[name^="d\["]').length;const $dataUriParent=$container.parents('[data-uri]:first');const $isAnketa2Ajax=$dataUriParent.length&&$dataUriParent.attr('data-uri').indexOf('method=form2/')!==-1;const $isS3Anketa=$form.attr('data-s3-anketa-id')&&container.dataset.name==='_cn';let $isAnketa2Api=false;if($isAnketa2Ajax||$isS3Anketa){$isAnketa2Api=true}if(!$isProduct&&!$isCart&&!$isInit&&!$isMaliver&&($isPost||($isAnketa||$isAnketa2Api)&&!$isMosaic)){site.debug('Draw captcha in container',container);if(container.dataset.name==='captcha-page'){data['callback']=function(){try{site.debug('form submit for event');$form.submit()}catch(e){site.debug('form js submit - no event',e);_form.submit()}};if(this.activeType===this.variants.recaptcha){data['size']=4;$container.data(this.badgeAttrId,grecaptcha.render(container,data))}else if(this.activeType===this.variants.smart_captcha){data['invisible']=false;$container.data(this.badgeAttrId,window.smartCaptcha.render(container,data))}}else{site.utils.addEvent(_form,'submit',()=>{this.toggleVisibleBadge();if(this.activeType===this.variants.smart_captcha){this.unsubscribe();window.smartCaptcha.reset($(this.getBadge()).data(captcha.badgeAttrId))}});site.utils.addEvent(_form,'focusin',this.onFocus.bind(this));site.utils.addEvent(_form,'focusout',this.onFocusout.bind(this));this.appendTextarea(_form);$container.remove()}$form.data('captcha-init',1)}else if(!$isMosaic){$container.remove()}}catch(e){site.error(this.activeType+' error: ',e)}},init(callback){const badge=document.createElement('div');badge.id=this.badge;if(this.activeType===this.variants.recaptcha){badge.style.visibility='hidden'}site.doc.body.appendChild(badge);if(callback&&typeof callback==='function'){callback()}},renderReCaptcha(){const config={sitekey:this.queue.recaptcha[0].dataset.sitekey,type:this.queue.recaptcha[0].dataset.type,size:this.queue.recaptcha[0].dataset.rsize,theme:this.queue.recaptcha[0].dataset.theme,};$(this.getBadge()).data(this.badgeAttrId,grecaptcha.render(this.badge,config));this.isRendered=true},renderSmartCaptcha(){const config={sitekey:this.queue.smart_captcha[0].dataset.sitekey,invisible:this.queue.smart_captcha[0].dataset.invisible,shieldPosition:'bottom-right',};$(this.getBadge()).data(this.badgeAttrId,window.smartCaptcha.render(this.badge,config));const interval=setInterval(function(){let shield=$('.SmartCaptcha-Shield');if(shield.length){shield.css('visibility','hidden');clearTimeout(interval)}},10);this.isRendered=true},getBadge(){return site.doc.querySelector(`#${this.badge}`)},setToken(){site.doc.querySelectorAll(`[name=${captcha.tokenName[this.activeType]}]`).forEach((textarea)=>{textarea.innerHTML=this.token.value})},appendTextarea(form){const textarea=site.doc.createElement('textarea');textarea.name=this.tokenName[this.activeType];textarea.style.cssText='display: none !important';textarea.innerHTML=this.token.value;form.appendChild(textarea)},handleReCaptchaClick(){if(this.queue.recaptcha.length&&this.status.recaptcha===STATUS_NOT_LOADED){site.utils.loadScript(this.scripts.recaptcha+'&hl='+site.getParam('lang'),{onerror:function(e){site.error('recaptcha load error: ',e)}});this.status.recaptcha=STATUS_LOADING}},handleSmartCaptchaClick(){if(this.queue.smart_captcha.length&&this.status.smart_captcha===STATUS_NOT_LOADED){site.utils.loadScript(this.scripts.smart_captcha+'&hl='+site.getParam('lang'),{onerror:function(e){site.error('SmartCaptcha load error: ',e)}});this.status.smart_captcha=STATUS_LOADING}},onFocus(){this.refreshToken();this.toggleVisibleBadge(true)},onFocusout(){this.toggleVisibleBadge()},toggleVisibleBadge(flag=false){if(!this.getBadge()){return}if(this.activeType===this.variants.recaptcha){this.getBadge().style.visibility=flag?'visible':'hidden'}else{document.querySelector('.SmartCaptcha-Shield').style.visibility=flag?'visible':'hidden'}}};site.window.onReCaptchaLoad=function(){site.window.dispatchEvent(new Event('ReCaptchaLoaded'));captcha.status.recaptcha=STATUS_LOADED;site.debug('recaptcha loaded');captcha.initEvents.forEach((event)=>{site.doc.removeEventListener(event,captcha.handleReCaptchaClick)});captcha.init(()=>{captcha.renderReCaptcha()});captcha.queue.recaptcha.forEach(function(container){captcha.add(container)});captcha.token.registerListener(function(){captcha.setToken()});site.captcha.queue.recaptcha=[]};site.window.onSmartCaptchaLoad=function(){site.window.dispatchEvent(new Event('SmartCaptchaLoaded'));captcha.status.smart_captcha=STATUS_LOADED;site.debug('Smart Captcha loaded');captcha.initEvents.forEach((event)=>{site.doc.removeEventListener(event,captcha.handleSmartCaptchaClick)});captcha.init(()=>{captcha.renderSmartCaptcha()});captcha.queue.smart_captcha.forEach(function(container){captcha.add(container)});captcha.token.registerListener(function(){captcha.setToken()});site.captcha.queue.smart_captcha=[]}})(window.$ite);(function(site){"use strict";site.hotkeys={start:function(){if(site.getParam("trusted")){site.utils.addEvent(window.document,"keydown",function(e){if(e['altKey']&&e.keyCode===80){if(location.search.indexOf("profiling")===-1){if(location.search.indexOf("?")===-1){location.search+="?profiling="+Math.round(Math.random()*100000)}else{location.search+="&profiling="+Math.round(Math.random()*100000)}}}if(e['altKey']&&e.keyCode===79&&site.hasParam("domain")&&site.hasParam("vid")&&site.hasParam("aid")){site.window.open(window.atob("aHR0cHM6Ly8=")+site.getParam("domain")+window.atob("Ly0vY21zL3YxL2RlZmF1bHQvP21jYT0=")+site.getParam("aid")+window.atob("Jm1jcz0xJnZlcl9pZD0=")+site.getParam("vid"))}})}}}})(window.$ite);(function(site){"use strict";var feedback=site.feedback={factory:null,start:function(){if(site.params.stid===27){return}site.utils.loadScript("/shared/feedback/feedback.factory.js",{onload:function(){feedback.factory=site.window.FeedbackFactory;site.feedback.factoryStart()}})},factoryStart:function(){feedback.factory.setOption('sources','/shared/feedback');feedback.factory.setOption('url',site.window.atob('Ly0veC1hcGkvdjEvcHVibGljLz9tZXRob2Q9c3lzdGVtL2ZlZWRiYWNr'));feedback.factory.setData('instance_id',site.getParam('aid'));feedback.factory.addScript(site.window.atob("aHR0cHM6Ly9jYWJpbmV0Lm1lZ2Fncm91cC5ydS9jbGllbnQuanNvbnA/Y2FsbGJhY2s9")+"setFeedbackUserId")}};site.window.setFeedbackUserId=function(data){if(data.id){feedback.factory.setData('user_id',data.id)}}})(window.$ite);(function(site){"use strict";let STATUS_NOT_LOADED=0;let STATUS_LOADING=2;let STATUS_LOADED=1;let login=site.login={STATUS_NOT_LOADED:STATUS_NOT_LOADED,STATUS_LOADING:STATUS_LOADING,STATUS_LOADED:STATUS_LOADED,scripts:{vk:"/shared/vk-id/sdk/2.1.0/index.js"},status:{vk:STATUS_NOT_LOADED,},type:{vkontakte:'vk',},start:function(){login.load()},addScript:function(type){if(login.status[type]===STATUS_NOT_LOADED){if(document.querySelectorAll('script[src="'+login.scripts[type]+'"]').length===0){site.utils.loadScript(login.scripts[type],{onerror:function(e){site.error(type+" load error: ",e)}})}login.status[type]=STATUS_LOADING}},checker:function(type){if(type===login.type.vkontakte){return window.VKIDSDK!==undefined}return true},load:function(){if(site.params.ql!==undefined&&login.type[site.params.ql.provider]!==undefined){let type=login.type[site.params.ql.provider];if(type===login.type.vkontakte){login.addScript(type);let interval=setInterval(function(){try{if(login.checker(type)){login.init(type);clearInterval(interval)}}catch(e){site.error("Login checker:",e)}},300)}else{site.debug('Not init quick login, unknown provider: '+site.params.ql.provider)}}else{site.debug('Not init quick login, params quick login not found')}},init:function(type){if(type===login.type.vkontakte){const langs={'en':'ENG','fr':'FRA','de':'GERMAN','kz':'KAZ','ru':'RUS','es':'SPA','tr':'TURKEY','ua':'UKR','uz':'UZB',};let lang='ENG';if(langs.hasOwnProperty(site.params.lang)){lang=langs[site.params.lang]}const VKID=window.VKIDSDK;VKID.Config.init({app:Number.parseInt(site.params.ql.provider_id),redirectUrl:'https://'+site.params.domain+'/users/hauth/done/vkontakte?return_url='+encodeURIComponent(document.location.href.replace(document.location.origin,'')),codeVerifier:site.params.ql.code_verifier,mode:VKID.ConfigAuthMode.Redirect,scope:'email phone'});const floatingOneTap=new VKID.FloatingOneTap();floatingOneTap.render({appName:site.params.ql.app_name,lang:VKID.Languages[lang]});login.status[type]=STATUS_LOADED;site.debug('Init quick login vk')}},}})(window.$ite);(function(site){"use strict";let STATUS_NOT_LOADED=0;let STATUS_LOADING=2;let STATUS_LOADED=1;let onetap=site.onetap={STATUS_NOT_LOADED:STATUS_NOT_LOADED,STATUS_LOADING:STATUS_LOADING,STATUS_LOADED:STATUS_LOADED,scripts:{vk:"/shared/vk-id/sdk/2.1.0/index.js"},status:{vk:STATUS_NOT_LOADED,},type:{vkontakte:'vk',},start:function(){onetap.load()},addScript:function(type){if(onetap.status[type]===STATUS_NOT_LOADED){if(document.querySelectorAll('script[src="'+onetap.scripts[type]+'"]').length===0){site.utils.loadScript(onetap.scripts[type],{onerror:function(e){site.error(type+" load error: ",e)}})}onetap.status[type]=STATUS_LOADING}},checker:function(type){if(type===onetap.type.vkontakte){return window.VKIDSDK!==undefined}return true},load:function(){if(site.params.onetap!==undefined){site.params.onetap.forEach(function(data){if(onetap.type[data.provider]!==undefined){let type=onetap.type[data.provider];if(type===onetap.type.vkontakte){onetap.addScript(type);let interval=setInterval(function(){try{if(onetap.checker(type)){onetap.init(type,data);clearInterval(interval)}}catch(e){site.error("onetap checker:",e)}},300)}else{site.debug('Not init onetap, unknown provider: '+data.provider)}}})}else{site.debug('Not init onetap, params onetap not found')}},init:function(type,data){if(type===onetap.type.vkontakte){const langs={'en':'ENG','fr':'FRA','de':'GERMAN','kz':'KAZ','ru':'RUS','es':'SPA','tr':'TURKEY','ua':'UKR','uz':'UZB',};let lang='ENG';if(langs.hasOwnProperty(site.params.lang)){lang=langs[site.params.lang]}const VKID=window.VKIDSDK;VKID.Config.init({app:Number.parseInt(data.provider_id),redirectUrl:'https://'+site.params.domain+'/users/hauth/done/vkontakte?return_url='+encodeURIComponent(document.location.href.replace(document.location.origin,'')),codeVerifier:data.code_verifier,mode:VKID.ConfigAuthMode.Redirect,scope:'email phone'});const elements=[...document.querySelectorAll('.g-social__item--vk-large')];let i=0;for(const el of elements){i++;const oneTap=new VKID.OneTap();const container=document.createElement('div');const styles={width:220,height:54,borderRadius:4};container.setAttribute('id',`VkIdSdkOneTap-${i}`);styles.width=el.parentNode.offsetWidth;if(el.parentNode.offsetWidth<220){styles.width=0;styles.height=44}else if(el.parentNode.offsetWidth>=220){if(el.parentNode.offsetWidth<=400){styles.width=el.parentNode.offsetWidth}else{styles.width=400}}el.parentNode.replaceChild(container,el);oneTap.render({container:container,styles:styles,lang:VKID.Languages[lang]})}site.debug('Init onetap vk')}},}})(window.$ite);