(function($) {
	
	"use strict";
    
var UIheaderLg = document.querySelector('.header-lg');
var UIheaderMd = document.querySelector('.header-md');
window.addEventListener('scroll', function () {
  if (window.scrollY >= 10) {
    setTimeout(function () {
      UIheaderMd.classList.add('toggle-header-md');
      UIheaderLg.classList.add('toggle-header-lg');
    }, 50);
  } else {
    setTimeout(function () {
      UIheaderMd.classList.remove('toggle-header-md');
      UIheaderLg.classList.remove('toggle-header-lg');
    }, 50);
  }
}); // Handle Header Lg

var UIheaderLgULDiv = document.querySelector('.header-lg-ul-div');
document.querySelector('.header-lg .header-lg-ul-div').appendChild(document.querySelector('.header-md .main-header-md-ul').cloneNode(true));
var headerLgClonedUl = document.querySelector('.header-lg .main-header-md-ul');
var headerLgDropLis = document.querySelectorAll('.header-lg .main-header-md-ul .drop-li');
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;

try {
  for (var _iterator = headerLgDropLis[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
    var dropLi = _step.value;
    dropLi.querySelector(':scope > .drop-a > i').className = 'fontello icon-left-open'; // dropLi.querySelector(':scope > .drop-a i').className = 'ion-chevron-left';
  }
} catch (err) {
  _didIteratorError = true;
  _iteratorError = err;
} finally {
  try {
    if (!_iteratorNormalCompletion && _iterator.return != null) {
      _iterator.return();
    }
  } finally {
    if (_didIteratorError) {
      throw _iteratorError;
    }
  }
}

var UImainLiDrops = headerLgClonedUl.querySelectorAll(':scope > .drop-li');
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;

try {
  for (var _iterator2 = UImainLiDrops[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
    var i = _step2.value;
    var UImainAdropIcon = i.querySelector(':scope > .drop-a > i');
    UImainAdropIcon.className = 'fas fa-chevron-down';
  } // handle headerlg dropdown links
  // const UIdropLgIcons = document.querySelectorAll(".header-lg .drop-a > i");
  // new HandleDrops(UIdropLgIcons);
  // handle header md

} catch (err) {
  _didIteratorError2 = true;
  _iteratorError2 = err;
} finally {
  try {
    if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
      _iterator2.return();
    }
  } finally {
    if (_didIteratorError2) {
      throw _iteratorError2;
    }
  }
}

var UIlines = document.querySelector('.header-md .lines');
var UIverticalMore = document.querySelector('.header-md .home-menu');
var UIuserLink = document.querySelector('.header-md .user-drop-link');
var UImainHeaderMdUlDiv = document.querySelector('.header-md .main-header-md-ul-div');
var UIhomeHeaderMdUlDiv = document.querySelector('.header-md .home-header-md-ul-div');
var UIuserHeaderMdUlDiv = document.querySelector('.header-md .user-header-md-ul-div'); // main drop

UIlines.addEventListener('click', function (e) {
  // UIlines.classList.toggle('is-active');
  UImainHeaderMdUlDiv.classList.toggle('toggle-main-header-md-ul-div');
  document.querySelector('body').classList.add('toggle-body-overflowY');
});
document.addEventListener('click', function (e) {
  if (e.target.classList.contains('main-header-md-ul-div')) {
    // UIlines.classList.remove('is-active');
    UImainHeaderMdUlDiv.classList.remove('toggle-main-header-md-ul-div');
    document.querySelector('body').classList.remove('toggle-body-overflowY');
  }
}); // home drop
// handle main sidebar drop links

var UIdropMdIcons = document.querySelectorAll('.header-md .drop-a > i');
new HandleDrops(UIdropMdIcons);

function HandleDrops(dropIcons) {
  var _this = this;

  this.dropIcons = dropIcons;
  var _iteratorNormalCompletion3 = true;
  var _didIteratorError3 = false;
  var _iteratorError3 = undefined;

  try {
    var _loop = function _loop() {
      var dropI = _step3.value;
      dropI.addEventListener('click', function (e) {
        var calcHeight = 0;
        var calcParentHeight = 0;
        var calcGrandParentHeight = 0;
        var _iteratorNormalCompletion4 = true;
        var _didIteratorError4 = false;
        var _iteratorError4 = undefined;

        try {
          for (var _iterator4 = dropI.parentElement.nextElementSibling.children[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
            var ele = _step4.value;
            calcHeight += ele.children[0].offsetHeight;
          }
        } catch (err) {
          _didIteratorError4 = true;
          _iteratorError4 = err;
        } finally {
          try {
            if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
              _iterator4.return();
            }
          } finally {
            if (_didIteratorError4) {
              throw _iteratorError4;
            }
          }
        }

        if (dropI.parentElement.nextElementSibling.offsetHeight === 0) {
          var _iteratorNormalCompletion5 = true;
          var _didIteratorError5 = false;
          var _iteratorError5 = undefined;

          try {
            for (var _iterator5 = _this.dropIcons[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
              var n = _step5.value;
              n.parentElement.nextElementSibling.style.height = 0 + 'px';
              n.parentElement.classList.remove('toggle-drop-a');
            }
          } catch (err) {
            _didIteratorError5 = true;
            _iteratorError5 = err;
          } finally {
            try {
              if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
                _iterator5.return();
              }
            } finally {
              if (_didIteratorError5) {
                throw _iteratorError5;
              }
            }
          }

          dropI.parentElement.nextElementSibling.style.height = calcHeight + 'px';
          dropI.parentElement.classList.add('toggle-drop-a');

          if (dropI.parentElement.parentElement.parentElement.classList.contains('dropped-ul')) {
            var _iteratorNormalCompletion6 = true;
            var _didIteratorError6 = false;
            var _iteratorError6 = undefined;

            try {
              for (var _iterator6 = dropI.parentElement.parentElement.parentElement.children[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
                var parentLi = _step6.value;
                calcParentHeight += parentLi.children[0].offsetHeight;
              } // if the grand parent element has a dropped-ul class
              // then set the garnd parent height to the dropped ul plus the grand parent direct children height

            } catch (err) {
              _didIteratorError6 = true;
              _iteratorError6 = err;
            } finally {
              try {
                if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
                  _iterator6.return();
                }
              } finally {
                if (_didIteratorError6) {
                  throw _iteratorError6;
                }
              }
            }

            dropI.parentElement.parentElement.parentElement.style.height = calcParentHeight + calcHeight + 'px'; // dropI.parentElement.parentElement.parentElement.parentElement.classList.add('toggle-drop-a');

            dropI.parentElement.parentElement.parentElement.parentElement.children[0].classList.add('toggle-drop-a');
          }

          if (dropI.parentElement.parentElement.parentElement.parentElement.parentElement.classList.contains('dropped-ul')) {
            var _iteratorNormalCompletion7 = true;
            var _didIteratorError7 = false;
            var _iteratorError7 = undefined;

            try {
              for (var _iterator7 = dropI.parentElement.parentElement.parentElement.parentElement.parentElement.children[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
                var grandLi = _step7.value;
                calcGrandParentHeight += grandLi.children[0].offsetHeight;
              }
            } catch (err) {
              _didIteratorError7 = true;
              _iteratorError7 = err;
            } finally {
              try {
                if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
                  _iterator7.return();
                }
              } finally {
                if (_didIteratorError7) {
                  throw _iteratorError7;
                }
              }
            }

            dropI.parentElement.parentElement.parentElement.parentElement.parentElement.style.height = calcGrandParentHeight + calcParentHeight + calcHeight + 'px';
            dropI.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].classList.add('toggle-drop-a');
          }
        } else {
          dropI.parentElement.nextElementSibling.style.height = 0 + 'px';
          dropI.parentElement.classList.remove('toggle-drop-a');

          if (dropI.parentElement.parentElement.parentElement.classList.contains('dropped-ul')) {
            // if the garnd element has a dropped-ul class
            // then set the grand parent height to its direct children height only
            var _iteratorNormalCompletion8 = true;
            var _didIteratorError8 = false;
            var _iteratorError8 = undefined;

            try {
              for (var _iterator8 = dropI.parentElement.parentElement.parentElement.children[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
                var _parentLi = _step8.value;
                calcParentHeight += _parentLi.children[0].offsetHeight;
              }
            } catch (err) {
              _didIteratorError8 = true;
              _iteratorError8 = err;
            } finally {
              try {
                if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
                  _iterator8.return();
                }
              } finally {
                if (_didIteratorError8) {
                  throw _iteratorError8;
                }
              }
            }

            dropI.parentElement.parentElement.parentElement.style.height = calcParentHeight + 'px';
            dropI.parentElement.parentElement.parentElement.parentElement.children[0].classList.add('toggle-drop-a');
          }

          if (dropI.parentElement.parentElement.parentElement.parentElement.parentElement.classList.contains('dropped-ul')) {
            var _iteratorNormalCompletion9 = true;
            var _didIteratorError9 = false;
            var _iteratorError9 = undefined;

            try {
              for (var _iterator9 = dropI.parentElement.parentElement.parentElement.parentElement.parentElement.children[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
                var _grandLi = _step9.value;
                calcGrandParentHeight += _grandLi.children[0].offsetHeight;
              }
            } catch (err) {
              _didIteratorError9 = true;
              _iteratorError9 = err;
            } finally {
              try {
                if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
                  _iterator9.return();
                }
              } finally {
                if (_didIteratorError9) {
                  throw _iteratorError9;
                }
              }
            }

            dropI.parentElement.parentElement.parentElement.parentElement.parentElement.style.height = calcGrandParentHeight + 'px';
            dropI.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].classList.add('toggle-drop-a');
          }
        }

        e.preventDefault();
      });
    };

    for (var _iterator3 = this.dropIcons[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
      _loop();
    }
  } catch (err) {
    _didIteratorError3 = true;
    _iteratorError3 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
        _iterator3.return();
      }
    } finally {
      if (_didIteratorError3) {
        throw _iteratorError3;
      }
    }
  }
} 
// HERO SLIDER
var menu = [];


const interleaveOffset = 0.75;

 /*Downloaded from https://www.codeseek.co/ezra_siton/mixitup-fancybox3-JydYqm */
    // 1. querySelector
    var containerEl = document.querySelector(".portfolio-item");
    // 2. Passing the configuration object inline
    //https://www.kunkalabs.com/mixitup/docs/configuration-object/
    var mixer = mixitup(containerEl, {
      animation: {
        effects: "fade translateZ(-100px)",
        effectsIn: "fade translateY(-100%)",
        easing: "cubic-bezier(0.645, 0.045, 0.355, 1)"
      }
    });
    // fancybox insilaze & options //
    $("[data-fancybox]").fancybox({
      loop: true,
      hash: true,
      transitionEffect: "slide",
      /* zoom VS next////////////////////
      clickContent - i modify the deafult - now when you click on the image you go to the next image - i more like this approach than zoom on desktop (This idea was in the classic/first lightbox) */
      clickContent: function(current, event) {
        return current.type === "image" ? "next" : false;
      }
    });
// script.js
// document.addEventListener("DOMContentLoaded", function () {
//   const sections = document.querySelectorAll(".fade-slide");

//   sections.forEach((section, index) => {
//       setTimeout(() => {
//           section.classList.add("fade-slide-show");
//       }, index * 500); // Delay each section's animation by 500ms
//   });
// });
function reveal() {
  var reveals = document.querySelectorAll(".reveal");

  for (var i = 0; i < reveals.length; i++) {
    var windowHeight = window.innerHeight;
    var elementTop = reveals[i].getBoundingClientRect().top;
    var elementVisible = 150;

    if (elementTop < windowHeight - elementVisible) {
      reveals[i].classList.add("active");
    } else {
      reveals[i].classList.remove("active");
    }
  }
}

window.addEventListener("scroll", reveal);
// home main slider

var mainHomeSLider = new Swiper('.home-main-slider', {
  spaceBetween: 0,
  centeredSlides: false,
  speed: 3000,
  effect: 'fade',
  fadeEffect: {
    crossFade: true
  },
  loop: true,
  autoplay: {
     delay: 3000,
     disableOnInteraction: false,
  },
  navigation: {
    nextEl: '.home-main-slider-next',
    prevEl: '.home-main-slider-prev',
  },
  pagination: {
    el: '.home-main-slider-pagination',
    clickable: true
  },
});


})(window.jQuery);
