(function ($) {
        "use strict";
            var WidgetScrollSequenceHandler = function($scope, $) { 
                let is_editable = elementorFrontend?.isEditMode();
                let slider_main = $scope[0].querySelector('.wkit-slider');

let getCntWrap = $scope[0].querySelectorAll('.w-slider-wrap');
getCntWrap.forEach((cntw) =>{
    let getCntBtn = cntw.querySelector('.wkit-btn-slide');
    if(getCntBtn.innerHTML == ''){
        getCntBtn.style.display = 'none';
    }
}); 

let all_btn_get = slider_main.querySelectorAll(".wkit-btn-slider-inner");
  
var slider = $scope.find(".wkit-slider-items");
let button_overlay = slider_main.querySelectorAll(".wkit-slider-button");
all_btn_get.forEach(function (btn, index) {
let clickBtn = slider_main.querySelectorAll('.wkit-slider-button');

 button_overlay.forEach((e, index) =>{
     if(index == 0){
          e.classList.add("active"); 
     }
});
   clickBtn.forEach((el,index) => {
        el.addEventListener("click", function (e) {
            button_overlay.forEach((e) =>{
               e.classList.remove("active"); 
            });
            e.currentTarget.classList.add("active"); 
          
            slideChange(index);
           
        });
    });
});
function slideChange(index) {
    slider.slick("slickGoTo",index);
}


slider.on('beforeChange', function(event, slick, currentSlide, nextSlide){
    button_overlay.forEach((e) =>{
        e.classList.remove("active"); 
    });
    button_overlay[nextSlide].classList.add('active');
});

slider.slick({
  slidesToShow: 1,
  slidesToScroll: 1,
  autoplay: false,
  autoplaySpeed: 2000,
  infinite: true,
  arrows: false
});
  
            };	
        $(window).on('elementor/frontend/init', function () {
          elementorFrontend.hooks.addAction('frontend/element_ready/wb-d3pmhe24.default', WidgetScrollSequenceHandler);
        });
    })(jQuery);