/**mo.js*** */
/*
var items = [].slice.call(document.querySelectorAll('.navbar-nav > .nav-item > a'));
var el1 = items[6], 
    el1span = el1.querySelector('span');
    //el1.classList.add('rally');
var scaleCurve5 = mojs.easing.path('M0,100 L25,99.9999983 C26.2328835,75.0708847 19.7847843,0 100,0');
var timeline = new mojs.Timeline();
var tween1 = new mojs.Burst({
    parent: el1,
    count: 15,
    radius: {20:50},
    angle: { 0: 140, easing: mojs.easing.bezier(0.1, 1, 0.3, 1) },
    children: {
        //fill: '#f79322',
        fill: '#f5e503',
        radius: 20,
        opacity: 0.6,
        duration: 1500,
        easing: mojs.easing.bezier(0.1, 1, 0.3, 1)
    }
});
var tween2 = new mojs.Tween({
    duration: 800,
    easing: mojs.easing.bezier(0.1, 1, 0.3, 1),
    onUpdate: function(progress) {
        var scaleProgress = scaleCurve5(progress);
        el1span.style.WebkitTransform = el1span.style.transform = 'scale3d(' + progress + ',' + progress + ',1)';
    }
});
timeline.add(tween1, tween2);
let intervalID = setInterval(function(){timeline.replay();}, 3000); 
//timeline.replay();
*/
/**quotes slider */
//$(document).ready(function(){
let quotesSwiper;
//});


function citySearch() {
    return {
        search: '',
        searchPlaceholder: '',
        cities: [],
        country: '',
        noResultMessage: false,
        showCounryList: false,
        //toggleIcon: true,
        filteredCities() {
            let tmpCities = [],
                cities = this.cities,
                search = this.search;
            Object.keys(this.cities).forEach(function(countryID){
                let resultSity = [],
                    resultCountry = [];
                if(cities[countryID]['REGIONS'] != undefined){
                    resultSity = cities[countryID]['REGIONS'].filter(
                        city => city.NAME.toLowerCase().includes(search.toLowerCase())
                    );
                }
                //если в стране найдены города
                if(resultSity.length){
                    resultSity['NO_PARENTS'] = cities[countryID]['REGIONS'] == undefined;
                    resultSity['COUNTRY_NAME'] = cities[countryID].NAME;
                    resultSity['COUNTRY_CODE'] = cities[countryID].CODE;
                    resultSity['NEWS_REGION_ID'] = cities[countryID].NEWS_REGION_ID;
                    resultSity['ID'] = cities[countryID].ID;
                    tmpCities.push(resultSity);
                } 
                else if(cities[countryID]['REGIONS'] == undefined){
                    //если города не найдены, поищем в названиях стран
                    if(cities[countryID]['NAME'].toLowerCase().includes(search.toLowerCase())){
                        //resultcountry = cities[countryID];
                        let resultcountry = [];
                        resultcountry['NO_PARENTS'] = cities[countryID]['REGIONS'] == undefined;
                        resultcountry['COUNTRY_NAME'] = cities[countryID].NAME;
                        resultcountry['COUNTRY_CODE'] = cities[countryID].CODE;
                        resultcountry['NEWS_REGION_ID'] = cities[countryID].NEWS_REGION_ID;
                        resultcountry['ID'] = cities[countryID].ID;
                        tmpCities.push(resultcountry);
                    }
                }
            });
            return tmpCities;
        },
        /*
        countryToggle(id){
            //id++;
            let name = 'c-1-' + id;
            let e = document.getElementById(name);
            let regionList = e.getElementsByClassName('city-region-list');
            Array.from(regionList).forEach((el) => {
                el.classList.toggle('hide');
            });
            let iconList = e.getElementsByClassName('icon-rotated-right');
            Array.from(iconList).forEach((el) => {
                el.classList.toggle('hide');
            });
            iconList = e.getElementsByClassName('icon-rotated-down');
            Array.from(iconList).forEach((el) => {
                el.classList.toggle('hide');
            });
        },
        */
        showCountry(){
            return Object.keys(this.country).length != 0;
        },
        citiesInit(){
            this.cities = this.$store.regions.arRegions;
            this.searchPlaceholder = this.cities[0].NAME;
            //this.showCounryList = true;
            //this.$nextTick(() => {
            //	this.countryToggle(0);
            //});
            //this.$watch('country', value => console.log(value))
        }
    }
}