window.storeModules=window.storeModules||{};window.storeModules.filtratorStore={namespaced:!0,state:{list:[],categories:[],Skip:0,skipStep:9,page:1,url:""},mutations:{init:function(n,t){n.skipStep=t.skipStep;n.url=t.url;n.categoriesUrl=t.categoriesUrl},setSkip:function(n){n.Skip+=n.skipStep;n.page++},resetSkip:function(n){n.Skip=0},dataObtained:function(n,t){n.list=t},pushMore:function(n,t){!t||!t.length>0||t.forEach(function(t){n.list.push(t)})},categoriesObtained:function(n,t){n.categories=t},error:function(){}},actions:{getDefault:function(n,t){n.commit("resetSkip");t.Skip=n.state.Skip;window.axios.get(n.state.url,{params:t}).then(function(t){n.commit("dataObtained",t.data)}).catch(function(t){n.commit("error",t)})},getMore:function(n,t){n.state.list.length===n.state.skipStep*n.state.page&&(n.commit("setSkip"),t.Skip=n.state.Skip,window.axios.get(n.state.url,{params:t}).then(function(t){n.commit("pushMore",t.data)}).catch(function(t){n.commit("error",t)}))},getCategories:function(n){window.axios.get(n.state.categoriesUrl).then(function(t){n.commit("categoriesObtained",t.data)})}}};window.storeModules=window.storeModules||{};window.storeModules.visuallyImpairedStore={namespaced:!0,state:{changeStateUrl:""},mutations:{setChangeStateUrl:function(n,t){n.changeStateUrl=t}},actions:{setState:function(n,t){window.axios.post(n.state.changeStateUrl,t)}}};window.storeModules=window.storeModules||{};window.storeModules.searchStore={namespaced:!0,state:{list:[],url:""},mutations:{init:function(n,t){n.url=t.url},dataObtained:function(n,t){n.list=t},error:function(){}},actions:{find:function(n,t){console.log(n.state.url);console.log(t);window.axios.get(n.state.url,{params:t}).then(function(t){n.commit("dataObtained",t.data)}).catch(function(t){n.commit("error",t)})}}};window.storeModules=window.storeModules||{};window.storeModules.correctionStore={namespaced:!0,state:{selection:""},mutations:{setSelection:function(n){n.selection=window.getSelection().toString()}}};window.storeModules=window.storeModules||{};window.storeModules.quizStore={namespaced:!0,state:{model:{},getUrl:"",sendUrl:""},mutations:{init:function(n,t){console.log(t);n.getUrl=t.getUrl;n.sendUrl=t.sendUrl},dataObtained:function(n,t){n.model=t;console.log(n.model)}},actions:{get:function(n,t){window.axios.get(n.state.getUrl,{params:t.model}).then(function(i){n.commit("dataObtained",i.data);t.callback&&t.callback()})},send:function(n,t){console.log(t);window.axios.post(n.state.sendUrl,t.model).then(function(n){n.data.Msg&&(window.notification.notify(n.data.Msg,n.data.IsError),n.data.IsError===!1&&t.callback&&t.callback())}).catch(window.notification.serverError)}}};window.store=new Vuex.Store({modules:{filtratorStore:window.storeModules.filtratorStore,visuallyImpairedStore:window.storeModules.visuallyImpairedStore,searchStore:window.storeModules.searchStore,correctionStore:window.storeModules.correctionStore,quizStore:window.storeModules.quizStore}});window.app=window.app||{};window.app.Filtrator=function(n){var t={el:"",url:"",categoriesUrl:null,skipStep:0};n&&Object.assign(t,n);var i="filtratorStore",r={getDefaultAction:i+"/getDefault",getMoreAction:i+"/getMore",getCategoriesAction:i+"/getCategories"},u=new Vue({el:t.el,store,data:{model:{begin:null,end:null,categoryID:null,currentID:null},beginModal:!1,endModal:!1,requestSended:!1},beforeMount:function(){store.commit(i+"/init",{skipStep:t.skipStep,url:t.url,categoriesUrl:t.categoriesUrl});t.categoriesUrl!==null&&store.dispatch(r.getCategoriesAction,t.categoriesUrl);store.dispatch(r.getDefaultAction,this.model)},computed:{list:function(){return store.state[i].list},categories:function(){return store.state[i].categories},page:function(){return store.state[i].page}},watch:{"model.begin":function(){this.model.currentID=null;this.sendRequest()},"model.end":function(){this.model.currentID=null;this.sendRequest()},"model.categoryID":function(){this.sendRequest()},"model.currentID":function(){this.sendRequest()}},methods:{loadable:function(){return this.list.length>=t.skipStep*this.page},getLocale:function(){var t=location.href.match("/([aA-zZ]{2})/")[1],n;return t?(n=t.toLowerCase(),n+"-"+n):"ru-ru"},getMoreClick:function(){store.dispatch(r.getMoreAction,this.model)},sendRequest:function(){if(!this.requestSended){this.requestSended=!0;var n=this;window.utils.debounce(function(){store.dispatch(r.getDefaultAction,n.model);n.requestSended=!1},1500)}},getLocalizedUrl:function(n,t){return(console.log(n,t),!t)?"#":n+"/"+(t[0]==="/"?t.substring(1):t)},getNext:function(){this.list.Next&&(this.model.currentID=this.list.Next.ID)},getPrevious:function(){this.list.Previous&&(this.model.currentID=this.list.Previous.ID)},formatDate:function(n){return moment(n).format("DD.MM.YYYY")}}})};Vue.component("captcha",{props:["placeholder"],model:{event:"change"},data:function(){return{captcha:{Src:"",Code:""}}},template:'<div class="captcha"><div><img  alt="Captcha Image" :src="captcha.Src" @click="get"><\/div><div><input class="captcha__field" type="text" @input="$emit(\'change\', {UserInput: $event.target.value, Code: captcha.Code})" :placeholder="placeholder" /><\/div><\/div>',beforeMount:function(){this.get()},methods:{get:function(){var n=this;window.axios.get("/directApi/api/captcha/get").then(function(t){n.captcha=t.data})}}})