jQuery(document).ready(function(){
//Disable select option
jQuery('#_customize-input-top_store_woo_product_animation option[value="swap"],#_customize-input-top_store_pagination option[value="scroll"],#_customize-input-top_store_pagination option[value="click"],#_customize-input-top_store_main_header_option option[value="button"],#_customize-input-top_store_main_header_option option[value="widget"], #_customize-input-top_store_blog_post_pagination option[value="click"], #_customize-input-top_store_blog_post_pagination option[value="scroll"]').attr("disabled", true);
//Disable Hrader Layout
jQuery('input[id=top_store_top_slide_layout-slide-layout-1], input[id=top_store_top_slide_layout-slide-layout-2], input[id=top_store_top_slide_layout-slide-layout-3],input[id=top_store_top_slide_layout-slide-layout-4],input[id=top_store_bottom_footer_widget_layout-ft-wgt-one],input[id=top_store_bottom_footer_widget_layout-ft-wgt-two],input[id=top_store_bottom_footer_widget_layout-ft-wgt-three],input[id=top_store_bottom_footer_widget_layout-ft-wgt-five],input[id=top_store_bottom_footer_widget_layout-ft-wgt-six],input[id=top_store_bottom_footer_widget_layout-ft-wgt-seven],input[id=top_store_bottom_footer_widget_layout-ft-wgt-eight],input[id=top_store_main_header_layout-mhdrfive],input[id=top_store_main_header_layout-mhdrsix],input[id=top_store_main_header_layout-mhdrseven],input[id=top_store_cat_slide_layout-cat-layout-2],input[id=top_store_cat_slide_layout-cat-layout-3],input[id=top_store_banner_layout-bnr-one],input[id=top_store_banner_layout-bnr-three],input[id=top_store_banner_layout-bnr-four],input[id=top_store_banner_layout-bnr-five],input[id=top_store_above_header_layout-abv-three],input[id=top_store_above_footer_layout-ft-abv-one],input[id=top_store_above_footer_layout-ft-abv-three]').attr("disabled",true);    

//redirect
//above-header
jQuery( '.focus-customizer-menu-redirect-col1,.focus-customizer-menu-redirect-col2,.focus-customizer-menu-redirect-col3' ).on( 'click', function (e){
            e.preventDefault();
            wp.customize.panel('nav_menus').focus();
} );
jQuery( '.focus-customizer-widget-redirect-col1,.focus-customizer-widget-redirect-col2,.focus-customizer-widget-redirect-col3,.focus-customizer-widget-redirect' ).on( 'click', function (e){
            e.preventDefault();
            wp.customize.panel( 'widgets' ).focus();
} );
jQuery( '.focus-customizer-social_media-redirect-col1,.focus-customizer-social_media-redirect-col2,.focus-customizer-social_media-redirect-col3' ).on( 'click', function (e){
            e.preventDefault();
            wp.customize.section( 'top-store-social-icon' ).focus();
} ); 

/* === Checkbox Multiple Control === */
    jQuery( '.customize-control-checkbox-multiple input[type="checkbox"]' ).on(
        'change',
        function() {
   // alert('');
            checkbox_values = jQuery( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map(
                function() {
                    return this.value;
                }
            ).get().join( ',' );

            jQuery( this ).parents( '.customize-control' ).find( 'input[type="hidden"]' ).val( checkbox_values ).trigger( 'change' );
        }
    );

// section sorting
      jQuery( "#sortable" ).sortable({
        placeholder: "ui-sortable-placeholder", 
        cursor: 'move',
        opacity: 0.65,
        stop: function ( event, ui){
        var data = jQuery(this).sortable('toArray');
            //  console.log(data); // This should print array of IDs, but returns empty string/array      
            jQuery( this ).parents( '.customize-control').find( 'input[type="hidden"]' ).val( data ).trigger( 'change' );
        }
    });


 //hide show option
 wp.customize('top_store_top_slide_layout', function( value ) {
        var filter_type = value.bind( function( to ) {
        if(to=='slide-layout-1'){
            jQuery( '.customizer-repeater-logo-image-control' ).css('display','block' ); 
            }else{
             jQuery( '.customizer-repeater-logo-image-control' ).css('display','none' );     
            }
        } );
        if(filter_type()=='slide-layout-1'){
              jQuery( '.customizer-repeater-logo-image-control' ).css('display','block' );
                
            }  else{
             jQuery( '.customizer-repeater-logo-image-control' ).css('display','none' );     
            }

    } );    

   
jQuery('#customize-control-top_store_sticky_sidebar input,#customize-control-top_store_disable_top_slider_sec input,#customize-control-top_store_top_slider_optn input,#customize-control-top_store_disable_ribbon_sec input,#customize-control-top_store_cat_slider_optn input,#customize-control-top_store_disable_cat_sec input,#customize-control-top_store_disable_category_slide_sec input,#customize-control-top_store_category_slider_optn input,#customize-control-top_store_disable_product_slide_sec input,#customize-control-top_store_product_slider_optn input,#customize-control-top_store_disable_banner_sec input,#customize-control-top_store_disable_product_list_sec input,#customize-control-top_store_product_list_slide_optn input,#customize-control-top_store_disable_brand_sec input,#customize-control-top_store_brand_slider_optn input').attr("disabled",true);


jQuery('#customize-control-top_store_top_slide_lay5_content .button.add_field,#customize-control-top_store_brand_content .button.add_field').remove();


jQuery('#customize-control-top_store_top_slide_lay5_content,#customize-control-top_store_brand_content').append("<h4>(To Add More Slides Feature Available In Pro Version)</h4>");



}); 

( function( $ ) {
    wp.customize.bind( 'ready', function() {
        $('#customize-control-top_store_col1_widget_redirect .menu-shortcut').on('click', function() {
            // This opens the Widgets panel and focuses on your specific sidebar section
            wp.customize.section('sidebar-widgets-top-header-widget-col1').expand();
        });
    });

     wp.customize.bind( 'ready', function() {
        $('#customize-control-top_store_col2_widget_redirect .menu-shortcut').on('click', function() {
            // This opens the Widgets panel and focuses on your specific sidebar section
            wp.customize.section('sidebar-widgets-top-header-widget-col2').expand();
        });
    });

      //footer top
      wp.customize.bind( 'ready', function() {
        $('#customize-control-top_store_footer_col1_widget_redirect .menu-shortcut').on('click', function() {
            // This opens the Widgets panel and focuses on your specific sidebar section
            wp.customize.section('sidebar-widgets-footer-top-first').expand();
        });
    });

     wp.customize.bind( 'ready', function() {
        $('#customize-control-top_store_above_footer_col2_widget_redirect .menu-shortcut').on('click', function() {
            // This opens the Widgets panel and focuses on your specific sidebar section
            wp.customize.section('sidebar-widgets-footer-top-second').expand();
        });
    });

     wp.customize.bind( 'ready', function() {
        $('#customize-control-top_store_bottom_footer_widget_redirect .menu-shortcut').on('click', function() {
            // This opens the Widgets panel and focuses on your specific sidebar section
            wp.customize.section('sidebar-widgets-footer-1').expand();
        });
    });


})( jQuery );