(function ($) {
  "use strict";
  //Loading AOS animation with css class

  //fade animation
  $(".storemate-fade-up").attr({
    "data-aos": "fade-up",
  });
  $(".storemate-fade-down").attr({
    "data-aos": "fade-down",
  });
  $(".storemate-fade-left").attr({
    "data-aos": "fade-left",
  });
  $(".storemate-fade-right").attr({
    "data-aos": "fade-right",
  });
  $(".storemate-fade-up-right").attr({
    "data-aos": "fade-up-right",
  });
  $(".storemate-fade-up-left").attr({
    "data-aos": "fade-up-left",
  });
  $(".storemate-fade-down-right").attr({
    "data-aos": "fade-down-right",
  });
  $(".storemate-fade-down-left").attr({
    "data-aos": "fade-down-left",
  });

  //slide animation
  $(".storemate-slide-left").attr({
    "data-aos": "slide-left",
  });
  $(".storemate-slide-right").attr({
    "data-aos": "slide-right",
  });
  $(".storemate-slide-up").attr({
    "data-aos": "slide-up",
  });
  $(".storemate-slide-down").attr({
    "data-aos": "slide-down",
  });

  //zoom animation
  $(".storemate-zoom-in").attr({
    "data-aos": "zoom-in",
  });
  $(".storemate-zoom-in-up").attr({
    "data-aos": "zoom-in-up",
  });
  $(".storemate-zoom-in-down").attr({
    "data-aos": "zoom-in-down",
  });
  $(".storemate-zoom-in-left").attr({
    "data-aos": "zoom-in-left",
  });
  $(".storemate-zoom-in-right").attr({
    "data-aos": "zoom-in-right",
  });
  $(".storemate-zoom-out").attr({
    "data-aos": "zoom-out",
  });
  $(".storemate-zoom-out-up").attr({
    "data-aos": "zoom-out-up",
  });
  $(".storemate-zoom-out-down").attr({
    "data-aos": "zoom-out-down",
  });
  $(".storemate-zoom-out-left").attr({
    "data-aos": "zoom-out-left",
  });
  $(".storemate-zoom-out-right").attr({
    "data-aos": "zoom-out-right",
  });

  //flip animation
  $(".storemate-flip-up").attr({
    "data-aos": "flip-up",
  });
  $(".storemate-flip-down").attr({
    "data-aos": "flip-down",
  });
  $(".storemate-flip-left").attr({
    "data-aos": "flip-left",
  });
  $(".storemate-flip-right").attr({
    "data-aos": "flip-right",
  });

  //animation ease attributes
  $(".storemate-linear").attr({
    "data-aos-easing": "linear",
  });
  $(".storemate-ease").attr({
    "data-aos-easing": "ease",
  });
  $(".storemate-ease-in").attr({
    "data-aos-easing": "ease-in",
  });
  $(".storemate-ease-in-back").attr({
    "data-aos-easing": "ease-in-back",
  });
  $(".storemate-ease-out").attr({
    "data-aos-easing": "ease-out",
  });
  $(".storemate-ease-out-back").attr({
    "data-aos-easing": "ease-out-back",
  });
  $(".storemate-ease-in-out-back").attr({
    "data-aos-easing": "ease-in-out-back",
  });
  $(".storemate-ease-in-shine").attr({
    "data-aos-easing": "ease-in-shine",
  });
  $(".storemate-ease-out-shine").attr({
    "data-aos-easing": "ease-out-shine",
  });
  $(".storemate-ease-in-out-shine").attr({
    "data-aos-easing": "ease-in-out-shine",
  });
  $(".storemate-ease-in-quad").attr({
    "data-aos-easing": "ease-in-quad",
  });
  $(".storemate-ease-out-quad").attr({
    "data-aos-easing": "ease-out-quad",
  });
  $(".storemate-ease-in-out-quad").attr({
    "data-aos-easing": "ease-in-out-quad",
  });
  $(".storemate-ease-in-cubic").attr({
    "data-aos-easing": "ease-in-cubic",
  });
  $(".storemate-ease-out-cubic").attr({
    "data-aos-easing": "ease-out-cubic",
  });
  $(".storemate-ease-in-out-cubic").attr({
    "data-aos-easing": "ease-in-out-cubic",
  });
  $(".storemate-ease-in-quart").attr({
    "data-aos-easing": "ease-in-quart",
  });
  $(".storemate-ease-out-quart").attr({
    "data-aos-easing": "ease-out-quart",
  });
  $(".storemate-ease-in-out-quart").attr({
    "data-aos-easing": "ease-in-out-quart",
  });

  setTimeout(function () {
    AOS.init({
      once: true,
      duration: 1200,
    });
  }, 100);

  var storemateBrands = document.querySelector(".storemate-brands");
  if (storemateBrands) {
    var storemateCloneBrands = storemateBrands.cloneNode(true);
    document.querySelector(".storemate-brand-showcase").appendChild(storemateCloneBrands);
  }

  $(window).scroll(function () {
    var scrollTop = $(this).scrollTop();
    var storemateStickyMenu = $(".storemate-sticky-menu");
    var storemateStickyNavigation = $(".storemate-sticky-navigation");

    if (storemateStickyMenu.length && scrollTop > 0) {
      storemateStickyMenu.addClass("sticky-menu-enabled storemate-zoom-in-up");
    } else {
      storemateStickyMenu.removeClass("sticky-menu-enabled");
    }
  });
  jQuery(window).scroll(function () {
    if (jQuery(this).scrollTop() > 100) {
      jQuery(".storemate-scrollto-top a").fadeIn();
    } else {
      jQuery(".storemate-scrollto-top a").fadeOut();
    }
  });
  jQuery(".storemate-scrollto-top a").click(function () {
    jQuery("html, body").animate({ scrollTop: 0 }, 600);
    return false;
  });
})(jQuery);
