(function ($) {
        "use strict";
            var WidgetScrollSequenceHandler = function($scope, $) { 
                let is_editable = elementorFrontend?.isEditMode();
                let mainEl = $scope[0].querySelector('.wkit-img-accrod-main-wrap');

let allItems = $scope[0].querySelectorAll('.wkit-img-accord-item');

jQuery(".custom-carousel").owlCarousel({
  autoWidth: true,
  loop: true,
  center: true,
  onInitialized: function(event) {
    let mainEl = $scope[0].querySelector('.wkit-img-accrod-main-wrap');
    let allItems = $scope[0].querySelectorAll('.wkit-img-accord-item');

    allItems.forEach((aia, index) => {
      if(index === 0){
          aia.classList.add('wkit-item-active'); 
      }
    });

    allItems.forEach((ai) => {
      ai.addEventListener('click', (ev) => {
        let activeItem = mainEl.querySelectorAll('.wkit-item-active');

        if(ev.currentTarget.classList.contains('wkit-item-active')){
            ev.currentTarget.classList.remove('wkit-item-active');
        } else {
            ev.currentTarget.classList.add('wkit-item-active');
            if(activeItem){
                activeItem.forEach((aia)=>{
                    aia.classList.remove('wkit-item-active');
                });
            }
        }
      });
    });
  }
});
  
            };	
        $(window).on('elementor/frontend/init', function () {
          elementorFrontend.hooks.addAction('frontend/element_ready/wb-r5jdxg23.default', WidgetScrollSequenceHandler);
        });
    })(jQuery);