(function(w,d){'use strict';if(!d.querySelectorAll){alert('Ваш браузер устарел, пожалуйста, обновите браузер чтобы продолжить работу с сайтом');return}function getPrefix(a){const c=a.split('-'),g=['Moz','Webkit','Ms'],gl=g.length;let f='';if(c.length>0)for(let i=0;i<c.length;++i)f+=c[i].substring(0,1).toUpperCase()+c[i].substring(1).toLowerCase();let h=d.createElement('div'),b=f.substring(0,1).toLowerCase()+f.substring(1),s,m;for(let i=0;i<gl;++i){s=g[i]+f;m=g[i]+b;if(typeof h.style[m]!='undefined'){h.remove();return m}else if(typeof h.style[s]!='undefined'){h.remove();return s}}return b}function getFadeIn(a){const b=getPrefix('opacity'),f=getComputedStyle(a);if(a.style[b]=='1')return;a.style[b]='0';if(f.display=='none')a.style.display='block';let c=requestAnimationFrame(animate);function animate(){if(a.style[b]>1){a.style[b]=1;cancelAnimationFrame(c)}else{a.style[b]=+a.style[b]+0.05;cancelAnimationFrame(c);c=requestAnimationFrame(animate)}}return true}function getFadeOut(a){const b=getPrefix('opacity'),f=getComputedStyle(a);if(f.display=='none'||a.style[b]=='0')return;let c=requestAnimationFrame(animate);function animate(){if(a.style[b]<0){a.style.display='none';a.style[b]=0;cancelAnimationFrame(c)}else{a.style[b]=+a.style[b]-0.05;cancelAnimationFrame(c);c=requestAnimationFrame(animate)}}return true}let scrolling={scrollTo:function(a,b){let f=0,e=event||w.event,c;do{f+=a.offsetTop;a=a.offsetParent}while(a);f=f>=0?f:1;e.preventDefault();e.returnValue=false;this.animateScroll(f,b,c);return false},animateScroll:function(a,b,c){c=c||d.documentElement||d.body;b=b||1000;let f=c.scrollTop,g=a-f,h=0,i=20;(d.documentElement==c?d.documentElement:c).scrollTop=w.scrollY+1;let j=()=>{h+=i;c.scrollTop=Math.easeInOutQuad(h,f,g,b);if(h<b)setTimeout(j,i)};j()}};Math.easeInOutQuad=(t,b,c,d)=>{t/=d/2;if(t<1)return c/2*t*t+b;--t;return-c/2*(t*(t-2)-1)+b};class App{constructor(a,b){this.string=a||null;this.isString=typeof this.string=='string';this.isObject=this.string=='object';if(this.isString&&/<[a-z]+><\/[a-z]+>/.test(a)){b=a.match(/[a-z]+/);if(b.length<1)return;this.element=d.createElement(b[0]);this.string=this.element;this.isString=null;this.isObject=true}else{this.element=this.isString?(a.charAt(0)=='['?d.getElementsByName(a.substr(1).slice(0,-1)):d.querySelectorAll(this.string)):(this.string||null)}if(!this.element)return null}addClass(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].classList.add(a)}else{this.element.classList.add(a)}return this}after(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].appendChild(a)}else{this.element.appendChild(a)}return this}append(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].innerHTML+=a}else{this.element.innerHTML+=a}return this}attr(a,b){b=b||null;if(this.isString||this.isObject){if(b){for(let i=0;i<this.element.length;++i)this.element[i].setAttribute(a,b);return this}return this.element[0].getAttribute(a)}else{return b?(this.element.setAttribute(a,b),this):this.element.getAttribute(a)}}before(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].insertBefore(a,this.element[i].firstChild)}else{this.element.insertBefore(a,this.element.firstChild)}return this}blur(){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].blur()}else{this.element.blur()}return this}changeClass(a,b){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i){this.element[i].classList.remove(a);this.element[i].classList.add(b)}}else{this.element.classList.remove(a);this.element.classList.add(b)}return this}checked(){return(this.isString||this.isObject)?(this.element[0].getAttribute('checked')=='checked'?true:false):(this.element.getAttribute('checked')=='checked'?true:false)}child(a){let b=[];if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i){let c=a?this.element[i].querySelectorAll(a):this.element[i].children;for(let j=0;j<c.length;++j)b.push(c[i])}}else{let c=a?this.element.querySelectorAll(a):this.element.children;for(let j=0;j<c.length;++j)b.push(c[i])}this.isString=null;this.isObject=true;this.element=b;return this}css(a){a=a||{};for(let b in a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].style[getPrefix(b)]=a[b]}else{this.element.style[getPrefix(b)]=a[b]}}return this}data(a){return this.isString||this.isObject?this.element[0].getAttribute('data-'+a):this.element.getAttribute('data-'+a)}each(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)a.apply(this.element[i],arguments)}else{a.apply(this.element,arguments)}return this}empty(){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].innerHTML=''}else{this.element.innerHTML=''}return this}fadeIn(){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)getFadeIn(this.element[i])}else{getFadeIn(this.element)}return this}fadeOut(){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)getFadeOut(this.element[i])}else{getFadeOut(this.element)}return this}files(){let a=[];if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)for(let j=0;j<this.element[i].files.length;++j)a.push(this.element[i].files[j]);return a}else{for(let i=0;i<this.element.files;++i)a.push(this.element.files[i]);return a}}focus(){if(this.isString||this.isObject){this.element[0].focus()}else{this.element.focus()}return this}hasClass(a,b){b=b||0;return(this.isString||this.isObject)?this.element[b].classList.contains(a):this.element.classList.contains(a)}height(a){a=a||null;if(this.string==w||this.string==d){return this.string.innerHeight}else if(this.isString||this.isObject){if(a){for(let i=0;i<this.element.length;++i)this.element[i].style.height=a;return this}else{return this.element[0].scrollHeight}}else{return a?(this.element.style.height=a,this):this.element.scrollHeight}}hide(){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].style.display='none'}else{this.element.style.display='none'}return this}html(a){a=a||null;if(this.isString||this.isObject){if(a){for(let i=0;i<this.element.length;++i)this.element[i].innerHTML=typeof a=='function'?a():a;return this}else{return this.element[0].innerHTML}}else{if(a){this.element.innerHTML=typeof a=='function'?a():a;return this}else{return this.element.innerHTML}}}insertBefore(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].parentNode.insertBefore(a,firstChild)}else{this.element.parentNode.insertBefore(a,firstChild)}return this}insertAfter(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].parentNode.appendChild(a)}else{this.element.parentNode.appendChild(a)}return this}next(a){let b=[];if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i){if(a){let c=this.element[i].parentNode.querySelectorAll(a);for(let j=0;j<c.length;++j)if(c[j]==this.element[i].nextElementSibling)b.push(this.element[i].nextElementSibling)}else{b.push(this.element[i].nextElementSibling)}}}else{if(a){let c=this.element.parentNode.querySelectorAll(a);for(let j=0;j<c.length;++j)if(c[j]==this.element.nextElementSibling)b.push(this.element.nextElementSibling)}else{b.push(this.element.nextElementSibling)}}this.element=b;return this}off(a,b){b=typeof b=='function'?b:()=>{};if(this.isString||this.isObject){let i=0,j=this,t=w.setInterval(()=>{if(i<j.element.length){j.element[i].removeEventListener(a,b);++i}else{w.clearInterval(t)}},20)}else{this.element.removeEventListener(a,b)}return this}offset(){return(this.isString||this.isObject)?this.element[0].getBoundingClientRect():this.element.getBoundingClientRect()}on(a,b,c){if(typeof c=='function'){d.addEventListener(a,function(e){let elem=d.querySelectorAll(b);for(let i=0;i<elem.length;++i)if(e.target==elem[i])return c.apply(e.target,arguments)},false)}else if(this.isString){let i=0,self=this,tmr=setInterval(()=>{if(i<self.element.length){self.element[i].addEventListener(a,function(e){return b.apply(e.target,arguments)},false);++i}else{clearInterval(tmr)}},20)}else{this.string.addEventListener(a,function(e){return b.apply(e.target,arguments)},false)}}outerHtml(a){a=a||null;if(this.isString||this.isObject){if(a){for(let i=0;i<this.element.length;++i)this.element[i].outerHTML=typeof a=='function'?a():a;return this}else{return this.element[0].outerHTML}}else{if(a){this.element.outerHTML=typeof a=='function'?a():a;return this}else{return this.element.outerHTML}}}parent(a,b,c,f){b=[];if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i){f=this.element[i].parentNode;if(a){c=f.parentNode.querySelectorAll(a);for(let j=0;j<c.length;++j)if(c[j]==f)b.push(f)}else{b.push(f)}}}else{f=this.element.parentNode;if(a){c=f.parentNode.querySelectorAll(a);for(let j=0;j<c.length;++j)if(c[j]==f)b.push(f)}else{b.push(f)}}this.element=b;this.isString=false;this.isObject=true;return this}prepend(a){if(this.isString){for(let i=0;i<this.element.length;++i)this.element[i].innerHTML=a+this.element[i].innerHTML}else{this.element.innerHTML=a+this.element.innerHTML}return this}prev(a){let b=[];if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i){if(a){let c=this.element[i].parentNode.querySelectorAll(a);for(let j=0;j<c.length;++j)if(c[j]==this.element[i].previousElementSibling)b.push(this.element[i].previousElementSibling)}else{b.push(this.element[i].previousElementSibling)}}}else{if(a){let c=this.element.parentNode.querySelectorAll(a);for(let j=0;j<c.length;++j)if(c[j]==this.element.previousElementSibling)b.push(this.element.previousElementSibling)}else{b.push(this.element.previousElementSibling)}}this.element=b;this.isString=false;this.isObject=true;return this}ready(fn){if(this.string!=d||!fn)return;d.addEventListener('DOMContentLoaded',fn,false);return true}remove(){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].remove()}else{this.element.remove()}return this}removeAttr(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].removeAttribute(a)}else{this.element.removeAttribute(a)}return this}removeClass(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].classList.remove(a)}else{this.element.classList.remove(a)}return this}scrollTo(a,b,fn){typeof a=='number'?scrolling.animateScroll(a,b):scrolling.scrollTo(d.querySelector(a),b);return typeof fn=='function'?fn():this}serialized(){let a=(this.element[0]||this.element).querySelectorAll('input,select,textarea'),b={};for(let i=0;i<a.length;++i){if(a[i].type=='file'){for(let j=0;j<a[i].files.length;++j)b[a[i].getAttribute('name')+j]=a[i].files[j]}else{b[a[i].getAttribute('name')]=a[i].value}}return b}show(a){a=a||'block';if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].style.display=a}else{this.element.style.display=a}return this}top(){return this.string==w?w.scrollY:null}toggleClass(a){if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].classList.toggle(a)}else{this.element.classList.toggle(a)}return this}trigger(a,b){if(typeof a=='undefined')return;if(this.string==w||this.string==d){this.string.dispatchEvent(new Event(a))}else if(this.isString||this.isObject){for(let i=0;i<this.element.length;++i)this.element[i].dispatchEvent(new Event(a))}else{this.element.dispatchEvent(new Event(a))}if(typeof b=='function')b();return this}val(a){a=a||null;if(this.isString||this.isObject){if(a||a===''){for(let i=0;i<this.element.length;++i)this.element[i].value=a;return true}else{return this.element[0].value}}else{return a||a===''?(this.element.value=a,true):this.element.value}}validated(fn){let b=(this.element[0]||this.element).querySelectorAll('input,select,textarea'),c=0;for(let key in b){if(isFinite(key)){let k=b[key],valid=k.validity,error=k.getAttribute('error');if(k.required){if(k.tagName==='INPUT'){if(k.type==='number'){if(k.min&&valid.rangeUnderflow){error=error||'Минимальное значение поля '+k.min;++c}if(k.max&&valid.rangeOverflow){error=error||'Максимальное значение поля '+k.max;++c}}else if(k.type==='tel'){let kv=k.value,kvl=kv.length;if((kvl>7&&(kvl<11||kvl>12))||(kvl===11&&!/^8[8|9]{1}[\d]{2}[\d]{7}$/.test(kv))||(kvl===12&&!/^\+79[\d]{2}[\d]{7}$/.test(kv))){error=error||'Некорректный номер телефона<br>пример: +79123456789, 89123456789, 88001234567 или 642531';++c}}else if(k.type==='email'){if(valid.typeDismatch){error=error||'Некорректный ввод email<br>пример: [email protected]';++c}}if(k.pattern&&valid.patternMismatch){error=error||'Проверьте правильность заполнения полей';++c}if(valid.typeDismatch){error=error||'Некорректное значение "'+k.value+'"';++c}}if(valid.valueMissing){error=error||'Обязательные поля не заполнены';++c}if(c>0){if(typeof fn=='function')fn();return{error:error,valid:false}}}}}return{error:false,valid:true}}}class Set{ajax(a){let c=new XMLHttpRequest(),b={type:'POST',url:null,success:null,json:true,error:null,files:null,before:null,callback:null,asinc:true,data:null};for(let f in b)if(typeof a[f]!='undefined')b[f]=a[f];a=null;if(typeof b.before=='function')b.before();c.open(b.type,b.url,b.asinc);c.onreadystatechange=function(){try{if(this.readyState!==4||this.status!==200)return;if(b.success)if(b.json){b.success(JSON.parse(this.responseText))}else{b.success(this.responseText)}}catch(e){if(b.error)b.error(e)}};if(b.files){c.send(this.formFiles(b.data))}else{c.send(this.form(b.data))}return typeof b.callback=='function'?b.callback():this}bgImage(a,b){if(b.type.match(/image.*/)){let reader=new FileReader();reader.onload=function(e){$(a).css({'background-image':'url('+e.target.result+')'})};reader.readAsDataURL(b)}}copy(a){if(!a||a=='undefined')return false;let b,c=d.createElement('input');c.value=a;d.body.append(c);c.select();if(d.execCommand('copy')){b=true}else{b=false}w.getSelection().removeAllRanges();c.remove();localStorage.setItem('clip',a);return b}countPlus(a){let f=a.dataset,g={count:100,duration:1000,delay:100,start:0};for(let h in g)if(typeof f[h]!='undefined')g[h]=f[h];f=null;let step=parseFloat(g.count/100);setTimeout(function(){let interval=setInterval(function(){if(g.start+step>=parseFloat(g.count)){a.innerHTML=g.count;clearInterval(interval)}g.start+=step;a.innerHTML=parseInt(g.start)},g.duration/100)},g.delay)}form(a,b){b=b||new FormData();for(let key in a)if(a.hasOwnProperty(key))b.append(key,a[key]);return b}formFiles(a,b){b=b||new FormData();for(let i=0;i<a.length;++i)b.append(i,a[i]);return b}image(a,b){if(b.type.match(/image.*/)){let reader=new FileReader();reader.onload=function(e){let img=d.createElement('img');img.src=e.target.result;$(a).after(img)};reader.readAsDataURL(b)}}imgPreview(a,b,c){let f=a.files;if(f.length){$(c).empty();[].forEach.call(f,function(file){if(file.type.match(/image.*/)){let reader=new FileReader();reader.onload=function(e){var img=d.createElement('img');img.src=e.target.result;$(c).after(img)};reader.readAsDataURL(file)}});$(b).html(f.length==1?f[0].name+' ('+(f[0].size/1024).toFixed(2)+' Кб)':'Добавлено '+f.length+' файлов')}else{h.innerHTML('Выберите файл');$(c).html('Предпросмотр')}return this}json(a){return JSON.parse(a)}string(a){return JSON.stringify(a)}log(){for(let i=0;i<arguments.length;++i)console.info(arguments[i]);return this}modal(a){let b={action:'open',class:'.modal',over:'.modal_overlay',box:null,old:null,new:null,close:null,before:null,callback:null};for(let c in b)if(typeof a[c]!='undefined')b[c]=a[c];a=null;if(typeof b.before=='function')b.before();if(b.action=='open'){if(!b.box)return;if(b.over)$(b.over).fadeIn();$(b.box).fadeIn();if(b.close){setTimeout(()=>{if(b.over)$(b.over).fadeOut();$(b.box).fadeOut()},b.close*1000)}}else if(b.action=='close'){$(b.over).fadeOut();$(b.class).each(function(){if(this.style.display=='block')$(this).fadeOut()})}else if(b.action=='change'){if(!b.old||!b.new)return;$(b.old).fadeOut();$(b.new).fadeIn()}return typeof b.callback=='function'?b.callback():this}sleep(a,fn){setTimeout(fn||function(){},a);return this}translite(a,b){let c=typeof b!='undefined'?{}:{'а':'a','б':'b','в':'v','г':'g','д':'d','е':'e','ж':'g','з':'z','и':'i','й':'y','к':'k','л':'l','м':'m','н':'n','о':'o','п':'p','р':'r','с':'s','т':'t','у':'u','ф':'f','ы':'i','э':'e','А':'A','Б':'B','В':'V','Г':'G','Д':'D','Е':'E','Ж':'G','З':'Z','И':'I','Й':'Y','К':'K','Л':'L','М':'M','Н':'N','О':'O','П':'P','Р':'R','С':'S','Т':'T','У':'U','Ф':'F','Ы':'I','Э':'E','ё':'yo','х':'h','ц':'ts','ч':'ch','ш':'sh','щ':'shch','ъ':'','ь':'','ю':'yu','я':'ya','Ё':'YO','Х':'H','Ц':'TS','Ч':'CH','Ш':'SH','Щ':'SHCH','Ъ':'','Ь':'','Ю':'YU','Я':'YA',' ':'_',' ':'_','.':'_','..':'_',',':'_','?':'_','??':'_','!':'_','!!':'_','-':'_','--':'_','=':'_','+':'_','__':'_'};return a.replace(/[\s\S]/g,(x)=>{if(c.hasOwnProperty(x))return c[x];return x})}window(a){let b={width:w.screen.width,height:w.screen.height,url:null,x:w.screen.width/2,y:w.screen.height/2,before:null,callback:null,full:0,tool:0,status:0,menu:0,resize:0,focus:true};for(let c in b)if(typeof a[c]!='undefined')b[c]=a[c];if(typeof b.before=='function')b.before();let e=w.open('/','White..','fullscreen='+b.full+',toolbar='+b.tool+',status='+b.status+',menubar='+b.menu+',resizable='+b.resize+',width='+b.width+',height='+b.height);e.blur();if(b.url)e.location.href=b.url;e.moveTo(b.x,b.y);if(b.focus)e.focus();if(typeof b.callback=='function')b.callback();return e}}class Slider{constructor(a){this.string=a||null;this.box=typeof this.string=='string'?d.querySelectorAll(this.string):(this.string||null)}init(a){if(!this.box.length)return;a=a||{};let b={delay:2000,dots:true,dots_list:[],autoplay:true,currentSlide:0,interval:null,before:null,callback:null},self=this;for(let c in b)this[c]=typeof a[c]!='undefined'?a[c]:b[c];this.slides=d.querySelector(this.string).children;this.length=this.slides.length;if(!this.length)return;if(this.dots===true){let br=d.createElement('ul');br.className='slider_dots';for(let i=0;i<this.length;++i){let brs=d.createElement('li');brs.setAttribute('data-slide',i);brs.className='slider_dot';br.appendChild(brs)}d.querySelector(this.string).parentNode.appendChild(br);this.dots_list=d.querySelector('.slider_dots').children}this.slides[this.currentSlide].classList.add('slide_active');if(this.dots)this.dots_list[this.currentSlide].classList.add('dot_active');if(this.autoplay===true)this.start();return this}start(){if(!this.box.length||!this.length)return;this.interval=w.setInterval(()=>this.next(),this.delay)}stop(){w.clearInterval(this.interval);this.interval=null}prev(){if(!this.box.length||!this.length)return;this.go(this.currentSlide-1)}next(){if(!this.box.length||!this.length)return;this.go(this.currentSlide+1)}go(n){if(!this.box.length||!this.length)return;if(typeof this.before=='function')this.before();this.slides[this.currentSlide].classList.remove('slide_active');if(this.dots)this.dots_list[this.currentSlide].classList.remove('dot_active');this.currentSlide=parseInt((n+this.length)%this.length);this.slides[this.currentSlide].classList.add('slide_active');if(this.dots)this.dots_list[this.currentSlide].classList.add('dot_active');return typeof this.callback=='function'?this.callback():this}}if(typeof $!='undefined'){w.jCool=(a)=>new App(a)}else{w.$=(a)=>new App(a)}w.fn=new Set();w.sl=(a)=>new Slider(a)})(window,document);