(function ($) {
        "use strict";
            var WidgetScrollSequenceHandler = function($scope, $) { 
                let is_editable = elementorFrontend?.isEditMode();
                let btn  = $scope[0].querySelector('.w-toggle-menu-btn');
let cnt  = $scope[0].querySelector('.w-toggle-menu-cnt');
let cntInr  = cnt.querySelector('.toggle-menu-cnt-inner');
let sutterBtn  = cnt.querySelector('.toggle-sutter-up-down');
let isAnimating = false;

let getMain =$scope[0].querySelector('.wkit-toggle-menu')
var unid = Math.random().toString(32).slice(2);
if(getMain.getAttribute('data-unique')){
    return;
}else{
    getMain.setAttribute('data-unique', unid)
}


let cntHeight = cnt.offsetHeight;
cnt.style.height = '0px';

btn.addEventListener('click',(e)=>{
    e.stopImmediatePropagation();
    tglMenuFun(e.currentTarget)
});
sutterBtn.addEventListener('click',(e)=>{
    tglMenuFun(btn)
});

function tglMenuFun(e) {
    if (isAnimating) return; 
    isAnimating = true;

    if (e.classList.contains('active')) {
        setTimeout(() => {
            e.classList.remove('active');
        }, 800);
    } else {
        e.classList.add('active');
    }

    if (cnt.classList.contains('active')) {
        cntInr.classList.remove('active');
        setTimeout(() => {
            cnt.style.height = '0px';
        }, 300);
        setTimeout(() => {
            cnt.classList.remove('active');
            isAnimating = false; 
        }, 900);
    } else {
        cnt.classList.add('active');
        cnt.style.height = cntInr.scrollHeight + 'px';
        setTimeout(() => {
            cntInr.classList.add('active');
        }, 600);
        setTimeout(() => {
            isAnimating = false; 
        }, 900);
    }
}



let getCrtUrl = window.location.href;
let navLink = cnt.querySelectorAll('.navigation-menu-link');
navLink.forEach((el)=>{
    let getlink = el.getAttribute('href');
    if(getlink){
        if(getCrtUrl.includes(getlink) && getlink!='#'){
            el.classList.add('active')
        }
    }
})  
            };	
        $(window).on('elementor/frontend/init', function () {
          elementorFrontend.hooks.addAction('frontend/element_ready/wb-kmrd6l24.default', WidgetScrollSequenceHandler);
        });
    })(jQuery);