(function($) {
	"use strict"


var base_url = $('#base_url').attr('href');
var csrf_value = $('#csrf_value').attr('href');
var get_rtl = $('#rtl').data('id');

if(get_rtl=='rtl'){
  var rtl = true;
}else{
  var get_rtl = false;
}
$(function () {
    $('[data-toggle="tooltip"]').tooltip();
  });
AOS.init({
  // Global settings:
  disable: 'phone', // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
  startEvent: 'DOMContentLoaded', 
  initClassName: 'aos-init', 
  animatedClassName: 'aos-animate', 
  useClassNames: false, 
  disableMutationObserver: false,
  debounceDelay: 50, 
  throttleDelay: 99, 
  delay: 800, 
  duration: 1000, 
  easing: 'ease',  
  once: false, 
  mirror: false, 
  anchorPlacement: 'top-bottom', 
});


$(document).ready(function ()
{
    $('.mop-grid').NewWaterfall({
        width: 370,
        delay: 50,
    });
});

var day = $('.off_days').data('day');
$(".datetimepicker").flatpickr({
    enableTime: true,
    dateFormat: "Y-m-d H:i",
    minDate: "today",
    time_24hr: true,
     "disable": [
        function(date){
          var events=''; //{}
          var d =date.getDay();
            $.each(day,function(i,v){
            if(v==d){
              events = true;
            }
          })
          return events;
        },
    ],
    "onChange": [function(selectedDates, dateStr, instance){
      var currentDate = new Date(dateStr);
      var dayId= currentDate.getDay();
      var userID = $('.off_days').data('id');
        var url =`${base_url}profile/get_time_by_date/${dayId}/${userID}`;
         $.get(url, {'csrf_test_name': csrf_value }, function(json){
          instance.set('maxTime',json.end_time);
          instance.set('minTime', json.start_time);
       },'json');

      return false;


      
    }],
  

});

// active fancybox
$('[data-fancybox="images"]').fancybox({
  arrows: false,
  buttons : [
    "zoom",
    'download',
    "thumbs",
    'close',
  ]
});


$('.nav-link').on('click', function(){
    $('.navbar-collapse').removeClass('show');
});


$('a.back').on("click",function(){
    parent.history.back();
});



if ($(window).width() <= 991){
  $(".wow").removeClass("wow");
}else{

/**
  ** nice scroll
**/
    $("html").niceScroll({
      styler:"fb",
      cursorcolor:"#037fff",
      horizrailenabled: false,
  });
}



$(function(){
	$(document).on('click', '.navBtn', function(e) {
		e.preventDefault();
		$('.navArea').toggleClass('isVisible');

	});
})


//sticky for theme6

$(window).on('scroll', function (event) {
    var scroll = $(window).scrollTop();
    if (scroll < 20) {
        $(".navbar-area").removeClass("sticky");
    } else {
        $(".navbar-area").addClass("sticky");
    }
});


$(window).on('scroll', function (event) {
    var scroll = $(window).scrollTop();
    if (scroll < 20) {
        $(".homeMenu").removeClass("sticky");
    } else {
        $(".homeMenu").addClass("sticky");
    }
});


/**
  ***  ACTIVE SLICK SLIDER
**/ 



$(function(){
	$('.testimonial').slick({
		slidesToShow:2,
		slidesToScroll: 1,
    rtl: rtl,
		autoplay: false,
		autoplaySpeed: 2000,
		dots: false,
		arrows: true,
		focusOnSelect:true,
    prevArrow: '<div class="slick-prev"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
    nextArrow: '<div class="slick-next"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
		responsive: [
		{
			breakpoint: 1024,
			settings: {
				slidesToShow: 2,
				slidesToScroll: 1,
			}
		},
		{
			breakpoint: 600,
			settings: {
				slidesToShow: 2,
				slidesToScroll: 2
			}
		},
		{
			breakpoint: 480,
			settings: {
				slidesToShow: 1,
				slidesToScroll: 1
			}
		}
		]
	});
})


$(function(){
  $('.service_slider').slick({
    slidesToShow:2,
    slidesToScroll: 1,
    rtl: rtl,
    autoplay: false,
    autoplaySpeed: 2000,
    dots: false,
    arrows: true,
    focusOnSelect:false,
    prevArrow: '<div class="slick-prev"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
    nextArrow: '<div class="slick-next"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
    responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 1,
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    ]
  });
})


$(function(){
  $('.team_slider').slick({
    slidesToShow:3,
    slidesToScroll: 1,
    rtl: rtl,
    autoplay: false,
    prevArrow: '<div class="slick-prev"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
    nextArrow: '<div class="slick-next"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
    autoplaySpeed: 2000,
    dots: false,
    arrows: true,
    focusOnSelect:true,
    responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 1,
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    ]
  });
});



$(function(){
  $('.theme_slider').slick({
    slidesToShow:3,
    slidesToScroll: 1,
    rtl: rtl,
    autoplay: true,
    prevArrow: '<div class="slick-prev"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
    nextArrow: '<div class="slick-next"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
    autoplaySpeed: 2000,
    dots: true,
    arrows: false,
    infinite: true,
    focusOnSelect:true,
    responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 1,
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    ]
  });
});


$(function(){
  $('.vCard_slider').slick({
    slidesToShow:5,
    slidesToScroll: 1,
    rtl: rtl,
    autoplay: false,
    prevArrow: '<div class="slick-prev"><i class="fa fa-angle-left" aria-hidden="true"></i></div>',
    nextArrow: '<div class="slick-next"><i class="fa fa-angle-right" aria-hidden="true"></i></div>',
    autoplaySpeed: 2000,
    dots: false,
    arrows: true,
    infinite: true,
    focusOnSelect:true,
    responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 1,
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    ]
  });
});



$(function(){
  $('.theme_slider-2').slick({
    slidesToShow:1,
    slidesToScroll: 1,
    rtl: rtl,
    autoplay: true,
    autoplaySpeed: 2000,
    dots: false,
    arrows: false,
    infinite: true,
    focusOnSelect:true,
    responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1,
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    ]
  });
});


$(function(){
	var progressBar = $('.progress-bar');
	progressBar.appear(function() {
		progressBar.each(function(){
			var progressBarWidth = $(this).data('present');
			/*-- Skill Animation --*/
			$(this).css({'width': progressBarWidth+'%', 'opacity': '1' });
		});
	});
});




$(function(){
	$(document).on('click', '.create_profile', function() {
       $('html, body').animate({
		    scrollTop: $(".pricing_area").offset().top
		}, 1000);
    });
})

$(function(){
  $(document).on('keyup','#username',function(){
      var val = $(this).val();
      if(val==''){
        return;
      }

      if(val.match(/\s/g)){
        $(".alert_msg").html('No space allowed').addClass('error');
         var newName = val.replace(/\s/g,'');
        $(this).val(newName);
        return;
      }else{
        $(".alert_msg").html('').removeClass('error');
      }

      if(val.match(/[^A-Za-z0-9]/)){
        $(".alert_msg").html('English letter only').addClass('error');
         var newName = val.replace(/[^A-Za-z0-9]/g,'');
        $(this).val(newName);
        return;
      }else{
        $(".alert_msg").html('').removeClass('error');
      }

  		$('.register_loader').slideDown();
    	var value = encodeURIComponent(val);
        var url =`${base_url}admin/home/check_username/${value}`;
         $.get(url, {'csrf_test_name': csrf_value }, function(json){
          if(json.st == 1){
          	setTimeout(function(){ 
          		$('.register_loader').slideUp();
            	$('.alert_msg').html(json.msg).removeClass('error').addClass('success');
            	$('.reg_btn').prop('disabled', false);
          	}, 2000);
          }else{
          	setTimeout(function(){ 
          		$('.register_loader').slideUp();
            	$('.alert_msg').html(json.msg).removeClass('succes').addClass('error');
            	$('.reg_btn').prop('disabled', true);
          	}, 2000);
          }
       },'json');

      return false;
  });
});



// Registration form
$(function(){
	$(document).on('submit', '#user_insert_form', function(event) {
    	$(".reg_msg").slideUp(); 
    	send_btn_loader(true);
        var url = $(this).attr('action');
        $.post(url, $(this).serialize(), function(json){
            if (json.st == 1) {
                $(".reg_msg").html(json.msg).slideDown(); 
                send_btn_loader(false);
                $("#user_insert_form")[0].reset(); 

                //if email verify is off
                  setTimeout(function(){ 
                	 window.location.href = `${base_url}login`;
                  }, 800);
                
            }else{
                $(".reg_msg").html(json.msg).slideDown();
                send_btn_loader(false);
            }
        },'json');
        return false;
    });
 });

// home page contact mail
$(function(){
	$(document).on('submit', '#home_contact', function(event) {
    	send_btn_loader(true);
        var url = $(this).attr('action');
        $.post(url, $(this).serialize(), function(json){
            if (json.st == 1) {
                $(".reg_msg").html(json.msg).slideDown(); 
                  send_btn_loader(false);
                $("#home_contact")[0].reset(); 
                
            }else{
                $(".reg_msg").html(json.msg).slideDown();
                send_btn_loader(false);
            }
        },'json');
        return false;
    });
 });


$(function(){
    $(document).on('submit', '#user_contact', function(event) {
    
        send_btn_loader(true);
        var url = $(this).attr('action');
        $.post(url, $(this).serialize(), function(json){
            if (json.st == 1) {
                $(".reg_msg").html(json.msg).slideDown(); 
                  send_btn_loader(false);
                $("#user_contact")[0].reset(); 
                
            }else{
                $(".reg_msg").html(json.msg).slideDown();
                send_btn_loader(false);
            }
        },'json');
        return false;
    });
 });




function send_btn_loader(type){
	var $this = $('.mail_send_btn');
	if(type==true){
    	 $this.addClass('btn-spinner');
    	 $this.attr('disabled', true);
       setTimeout(function(){ $(".reg_msg").slideUp() }, 3000);
    }else{
    	$this.removeClass('btn-spinner');
        $this.prop('disabled', false);
        setTimeout(function(){ $(".reg_msg").slideUp() }, 3000);
    }
}

$(function(){
    $(document).on('submit', '#appointment_form', function(event) {
        send_btn_loader_2(true);
        var url = $(this).attr('action');
        $.post(url, $(this).serialize(), function(json){
            if (json.st == 1) {
                $(".reg_msg").html(json.msg).slideDown(); 
                  send_btn_loader_2(false);
                $("#appointment_form")[0].reset(); 
                
            }else{
                $(".reg_msg").html(json.msg).slideDown();
                send_btn_loader_2(false);
            }
        },'json');
        return false;
    });
 });


function send_btn_loader_2(type){
    var $this = $('.mail_send_btn_2');
    if(type==true){
         $this.addClass('btn-spinner');
         $this.attr('disabled', true);
       setTimeout(function(){ $(".reg_msg").slideUp() }, 3000);
    }else{
        $this.removeClass('btn-spinner');
        $this.prop('disabled', false);
        setTimeout(function(){ $(".reg_msg").slideUp() }, 3000);
    }
}


jQuery(document).ready(function($) {
	$('.scroll-line').css('width', '0%');
});


$(function(){
	$(window).on('scroll', function() {
		var wintop = $(this).scrollTop(), docheight = 
		$(document).height(), winheight = $(window).height();
		var scrolled = (wintop/(docheight-winheight))*100;
		$('.scroll-line').css('width', (scrolled + '%'));
	});
})

$(document).on('click','preview_pdf', function() {
		var url = $(this).attr('href');
      window.open(url, "windowName", windowOptions);
});

/**
  *** active Circle progressbar
**/ 
$('.circlechart').circlechart();

$(function(){
  
    function navbarFixed() {
        if($('.sticky_header_area').length) {
          var nav_offset_top=$('.stickyMenu').offset().top;
            $(window).scroll(function() {
                var scroll=$(window).scrollTop();
                if(scroll>=nav_offset_top) {
                    $('.sticky_header_area').addClass('navbar_fixed');
                }
                else {
                    $('.sticky_header_area').removeClass('navbar_fixed');
                }
            }
            );
        }
    }
    navbarFixed();
});


  
// ISOTOPE PORTFOLIO WITH FILTER
$(window).on('load', function(){
 
      var $container = $('.grid');
      $container.isotope({
        filter: '*',
        animationOptions: {
          duration: 750,
          easing: 'linear',
          queue: false
        }
      });
     
      $('.gallery_sort li button').click(function(){
        $('.gallery_sort li button.active').removeClass('active');
        $(this).addClass('active');
     
        var selector = $(this).attr('data-filter');
        $container.isotope({
          filter: selector,
          animationOptions: {
            duration: 750,
            easing: 'linear',
            queue: false
          }
         });
         return false;
      }); 
  
  });


/**
  ** layout 5 scroll effect
**/

$(function(){
  $(window).on('scroll', function() {
    var wintop = $(this).scrollTop(), docheight = 
    $(document).height(), winheight = $(window).height();
    var scrolled = (wintop/(docheight-winheight))*100;
    $('.left_height_line').css('height', (scrolled + '%'));

  });
});


/**
  ** layout 5 left menu
**/
$(function(){
  $(document).on('click', '.hideNav', function(event) {
    $('.leftMenu_bar').animate({"left": '-260px'});
  });


  $(document).on('click', '.topMenu_bar a', function(event) {
    $('.leftMenu_bar').animate({"left": '0'});
  });
})


$(function(){
  $('.scroll-top').fadeOut();
    $(window).scroll(function() {
        var scroll=$(window).scrollTop();
        if(scroll>=500) {
            $('.scroll-top').fadeIn();
        }
        else {
            $('.scroll-top').fadeOut();
        }
    });

  $('.scroll-top a').on('click', function(event) {
     $("html, body").animate({ scrollTop: 0 }, 1000);
  });
});


$(function(){
    $(".accordions").on("click", ".page_accordion_header", function() {
        $(this).toggleClass("active").next().slideToggle(300);
        $(this).toggleClass('arrow_up').toggleClass('arrow_down');
    });
});


$('.fact_item_section').appear(function() {
   $('.count').each(function () {
      $(this).prop('Counter',0).animate({
        Counter: $(this).text()
        }, {
        duration: 5000,
        easing: 'swing',
        step: function (now) {
          $(this).text(Math.ceil(now));
        }
      });
    });
  });

/*======================================
   Typing Text
   ======================================*/
  $(".cd-words-wrapper b:first-child").addClass("is-visible");


  if (document.getElementById("particles-1")) particlesJS("particles-1", {
        "particles": {
            "number": {
                "value": 40,
                "density": {
                    "enable": !0,
                    "value_area": 4000
                }
            },
            "color": {
                "value": ["#FFFFFF", "#FFFFFF", "#FFFFFF"]
            },
            "shape": {
                "type": "circle",
                "stroke": {
                    "width": 0,
                    "color": "#fff"
                },
                "polygon": {
                    "nb_sides": 5
                },
                "image": {
                    "src": "img/github.svg",
                    "width": 33,
                    "height": 33
                }
            },
            "opacity": {
                "value": 0.15,
                "random": !0,
                "anim": {
                    "enable": !0,
                    "speed": 0.2,
                    "opacity_min": 0.15,
                    "sync": !1
                }
            },
            "size": {
                "value": 50,
                "random": !0,
                "anim": {
                    "enable": !0,
                    "speed": 2,
                    "size_min": 5,
                    "sync": !1
                }
            },
            "line_linked": {
                "enable": !1,
                "distance": 150,
                "color": "#ffffff",
                "opacity": 0.4,
                "width": 1
            },
            "move": {
                "enable": !0,
                "speed": 1,
                "direction": "top",
                "random": !0,
                "straight": !1,
                "out_mode": "out",
                "bounce": !1,
                "attract": {
                    "enable": !1,
                    "rotateX": 600,
                    "rotateY": 600
                }
            }
        },
        "interactivity": {
            "detect_on": "canvas",
            "events": {
                "onhover": {
                    "enable": !1,
                    "mode": "bubble"
                },
                "onclick": {
                    "enable": !1,
                    "mode": "repulse"
                },
                "resize": !0
            },
            "modes": {
                "grab": {
                    "distance": 400,
                    "line_linked": {
                        "opacity": 1,
                    }
                },
                "bubble": {
                    "distance": 250,
                    "size": 0,
                    "duration": 2,
                    "opacity": 0,
                    "speed": 3
                },
                "repulse": {
                    "distance": 400,
                    "duration": 0.4
                },
                "push": {
                    "particles_nb": 4
                },
                "remove": {
                    "particles_nb": 2
                }
            }
        },
        "retina_detect": !0
    });


$(function(){

  $('.copy').click(function (e) {
   e.preventDefault();
   var copyText = $(this).data('link');
   var id = $(this).data('id');

   document.addEventListener('copy', function(e) {
      e.clipboardData.setData('text/plain', copyText);
      e.preventDefault();
   }, true);

   document.execCommand('copy');  

     var url = `${base_url}/profile/count_copy/${id}`;
    $.get(url, {'csrf_test_name': csrf_value }, function(json){
        if (json.st == 1) {
          $(this).addClass('d_bg');
          $('.copy_alert').slideDown();
        }
    },'json');
     

  setTimeout(function(){ $('.copy_alert').slideUp(); $('.copy').removeClass('d_bg');}, 2000);

   console.log('copied text');
 });

})





$(function(){
    $(document).on('click','.shareBtn',function(){
      $('.shareCard.share').toggleClass('active');
      $('.Qrcode').removeClass('active');
  })
});


$(function(){
    $(document).on('click','.base',function(){
      $('.Qrcode').toggleClass('active');
      $('.shareCard.share').removeClass('active');
  })
});


$(function(){
    $(document).on('change','.usersFilter',function(){
      $('.usersFilter_form').submit();
  })
});


$(function(){
    $(document).on('click','.closeAbout',function(){
      $('.aboutArea').addClass('hideAbout');
    })

    $(document).on('click','.showAbout',function(){
      $('.aboutArea').toggleClass('hideAbout');
    })
});



$(function(){
    $(document).on('click','.vcard-menu',function(){
        var id = $(this).data("id");
      $('.qrcodeShare').toggleClass(id);
  })
});




$(function(){
    $(document).on('click','.cardBottomDetails span',function(){
      $('.cardBottomDetails, .CardImage, .plusminus').toggleClass('active');
      $('.vcardCenterBody').slideToggle();
  })
});



})(jQuery);
if (!localStorage.getItem("cookieBannerDisplayed")) {
  const cookieContainer = document.querySelector(".cookie-container");
  const cookieButton = document.querySelector(".cookie-btn");

  cookieButton.addEventListener("click", () => {
    cookieContainer.classList.remove("active");
    localStorage.setItem("cookieBannerDisplayed", "true");
  });

  setTimeout(() => {
    if (!localStorage.getItem("cookieBannerDisplayed")) {
      cookieContainer.classList.add("active");
    }
  }, 2000);
}