/**
 * @package     productive-forms
 * @author      productiveminds.com
 * @copyright   productiveminds.com
 */

let swiper_var_elementor_enabled_productive_forms                = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_enabled;
let swiper_var_elementor_slidesPerView_productive_forms          = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_slidesPerView;
let swiper_var_elementor_slidesBreakPoints_productive_forms      = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_slidesBreakPoints;
let swiper_var_elementor_effect_productive_forms                 = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_effect;
let swiper_var_elementor_loop_productive_forms                   = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_loop;
let swiper_var_elementor_direction_productive_forms              = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_direction;
let swiper_var_elementor_lazyLoading_productive_forms            = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_lazyLoading;
let swiper_var_elementor_autoplay_productive_forms               = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_autoplay;
let swiper_var_elementor_delay_productive_forms                  = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_delay;
let swiper_var_elementor_pauseOnMouseEnter_productive_forms      = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_pauseOnMouseEnter;
let swiper_var_elementor_scrollbar_productive_forms              = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_scrollbar;
let swiper_var_elementor_simulateTouch_productive_forms          = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_simulateTouch;
let swiper_var_elementor_grabCursor_productive_forms             = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_grabCursor;
let swiper_var_elementor_slides_margin_productive_forms          = productiveminds_lib_elementor_productive_forms_js_name.swiper_var_slides_margin;


const global_elementor_slidesPerViewValue_productive_forms = swiper_var_elementor_slidesPerView_productive_forms.split(",");

/* Start:: productive_elementor_widget_cpt_google_map */
class Productive_Elementor_Widget_Google_Maps extends elementorModules.frontend.handlers.Base {
    update_Productive_Elementor_Widget_Google_Maps_Content() {
        let google_map_map_magnification = this.getElementSettings( 'google_map_map_magnification' );
        if( (undefined !== google_map_map_magnification && null !== google_map_map_magnification) ) {
            productiveminds_plugin_execute_google_maps_scripts_elementor();
        }
    }
    onInit() {
        this.update_Productive_Elementor_Widget_Google_Maps_Content();
    }
    onElementChange( propertyName ) {
        if ( 'google_map_map_magnification' === propertyName ) {
            this.update_Productive_Elementor_Widget_Google_Maps_Content();
        }
    }
};
window.addEventListener( 'elementor/frontend/init', () => {
    const addHandler = ( $element ) => {
        elementorFrontend.elementsHandler.addHandler( Productive_Elementor_Widget_Google_Maps, { $element } );
    };
    elementorFrontend.hooks.addAction( 'frontend/element_ready/productive_elementor_widget_cpt_google_map.default', addHandler );
} );



function productive_forms_init_the_slider( elementSettings, slider_slides_per_view, the_slide_container ) {
    
    /* Start with desktop breakpoint */
    /* parseFloat( global_elementor_slidesPerViewValue_productive_forms[4] ); */
    let slider_slides_per_view_desktop =  parseFloat( global_elementor_slidesPerViewValue_productive_forms[4] );
    if( undefined !== slider_slides_per_view ) {
        slider_slides_per_view_desktop     = slider_slides_per_view;
    }
    
    /* parseFloat( global_elementor_slidesPerViewValue_productive_forms[5] ); */
    let slider_slides_per_view_widescreen = slider_slides_per_view_desktop;
    if( undefined !== elementSettings( 'slider_slides_per_view_widescreen' ) ) {
        slider_slides_per_view_widescreen       = elementSettings( 'slider_slides_per_view_widescreen' );
    }
    
    /* parseFloat( global_elementor_slidesPerViewValue_productive_forms[3] ); */
    let slider_slides_per_view_tablet_extra =  slider_slides_per_view;
    if( undefined !== elementSettings( 'slider_slides_per_view_tablet_extra' ) ) {
        slider_slides_per_view_tablet_extra     = elementSettings( 'slider_slides_per_view_tablet_extra' );
    }

    /* parseFloat( global_elementor_slidesPerViewValue_productive_forms[2] ); */
    let slider_slides_per_view_tablet =  parseFloat( global_elementor_slidesPerViewValue_productive_forms[2] );
    if( undefined !== elementSettings( 'slider_slides_per_view_tablet' ) ) {
        slider_slides_per_view_tablet     = elementSettings( 'slider_slides_per_view_tablet' );
    }

    /* parseFloat( global_elementor_slidesPerViewValue_productive_forms[1] ); */
    let slider_slides_per_view_mobile_extra =  slider_slides_per_view_tablet;
    if( undefined !== elementSettings( 'slider_slides_per_view_mobile_extra' ) ) {
        slider_slides_per_view_mobile_extra     = elementSettings( 'slider_slides_per_view_mobile_extra' );
    }

    let slider_slides_per_view_mobile =  parseFloat( global_elementor_slidesPerViewValue_productive_forms[0] );
    if( undefined !== elementSettings( 'slider_slides_per_view_mobile' ) ) {
        slider_slides_per_view_mobile     = elementSettings( 'slider_slides_per_view_mobile' );
    }
    
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_effect' ) ) {
        swiper_var_elementor_effect_productive_forms     = elementSettings( 'section_slider_settings_swiper_var_effect' );
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_direction' ) ) {
        swiper_var_elementor_direction_productive_forms     = elementSettings( 'section_slider_settings_swiper_var_direction' );
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_autoplay' ) ) {
        swiper_var_elementor_autoplay_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_autoplay' ) ) {
            swiper_var_elementor_autoplay_productive_forms     = true;
        }
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_simulateTouch' ) ) {
        swiper_var_elementor_simulateTouch_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_simulateTouch' ) ) {
            swiper_var_elementor_simulateTouch_productive_forms     = true;
        }
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_delay' ) ) {
        swiper_var_elementor_delay_productive_forms     = elementSettings( 'section_slider_settings_swiper_var_delay' );
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_loop' ) ) {
        swiper_var_elementor_loop_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_loop' ) ) {
            swiper_var_elementor_loop_productive_forms     = true;
        }
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_pauseOnMouseEnter' ) ) {
        swiper_var_elementor_pauseOnMouseEnter_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_pauseOnMouseEnter' ) ) {
            swiper_var_elementor_pauseOnMouseEnter_productive_forms     = true;
        }
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_lazyLoading' ) ) {
        swiper_var_elementor_lazyLoading_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_lazyLoading' ) ) {
            swiper_var_elementor_lazyLoading_productive_forms     = true;
        }
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_grabCursor' ) ) {
        swiper_var_elementor_grabCursor_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_grabCursor' ) ) {
            swiper_var_elementor_grabCursor_productive_forms     = true;
        }
    }
    if( undefined !== elementSettings( 'section_slider_settings_swiper_var_scrollbar' ) ) {
        swiper_var_elementor_scrollbar_productive_forms     = false;
        if( 'true' === elementSettings( 'section_slider_settings_swiper_var_scrollbar' ) ) {
            swiper_var_elementor_scrollbar_productive_forms     = true;
        }
    }
    
    let swiper_var_elementor_slides_margin_productive_forms_col_gap = swiper_var_elementor_slides_margin_productive_forms;
    if( undefined !== elementSettings( 'section_style_each_item_col_gap' ) ) {
        swiper_var_elementor_slides_margin_productive_forms_col_gap = productive_Common_Js_Each_Slider_Item_Col_Gap( elementSettings( 'section_style_each_item_col_gap' ) );
    }
    
    if( null === swiper_var_elementor_slides_margin_productive_forms_col_gap || undefined === swiper_var_elementor_slides_margin_productive_forms_col_gap || swiper_var_elementor_slides_margin_productive_forms_col_gap.includes('NaN') ) {
        swiper_var_elementor_slides_margin_productive_forms_col_gap = swiper_var_elementor_slides_margin_productive_forms;
    }
    
    let swiper_var_elementor_slidesPerView_productive_forms = slider_slides_per_view_mobile+", "+slider_slides_per_view_mobile_extra+", "+slider_slides_per_view_tablet+", "+slider_slides_per_view_tablet_extra+", "+slider_slides_per_view_desktop+", "+slider_slides_per_view_widescreen;
    productive_Common_Js_Slider(the_slide_container, swiper_var_elementor_enabled_productive_forms, swiper_var_elementor_slidesPerView_productive_forms, swiper_var_elementor_slidesBreakPoints_productive_forms, swiper_var_elementor_effect_productive_forms, swiper_var_elementor_loop_productive_forms, swiper_var_elementor_direction_productive_forms, swiper_var_elementor_lazyLoading_productive_forms, swiper_var_elementor_autoplay_productive_forms, swiper_var_elementor_delay_productive_forms, swiper_var_elementor_pauseOnMouseEnter_productive_forms, swiper_var_elementor_scrollbar_productive_forms, swiper_var_elementor_simulateTouch_productive_forms, swiper_var_elementor_grabCursor_productive_forms, swiper_var_elementor_slides_margin_productive_forms_col_gap );

}
