/*mlink*/
( function ( $ ) {
	"use strict";
	var WidgetMarketinLinkHandler = function ($scope, $) {
		var container    = $scope.find( '.ec-marketing-link' ),
			containerD   = $scope.find( '.ec-marketing-link.ml-default' ),
			containerMBP = $scope.find( '.ec-marketing-link.ml-mbp' );

		if (container.length) {
			container.on(
				"click",
				function (e) {
					e.preventDefault();
					var $this = $( this ),
					settings  = $this.data( 'settings' );
					if (containerD.length) {
						for (var i = 0, len = settings.length; i < len; ++i) {
							var url = settings[i];
							if (i == 0 && url != '') {
								window.open( url );
							}
							if (i == 1) {
								setTimeout(
									function () {
										window.location.href = url;
									},
									150
								);
							}
						}
					}
					if (containerMBP.length) {
						for (var i = 0, len = settings.length; i < len; ++i) {
							var url = settings[i];
							window.open( url );
						}
					}
				}
			);
		}
	};
	$( window ).on(
		'elementor/frontend/init',
		function () {
			elementorFrontend.hooks.addAction( 'frontend/element_ready/ecafe-marketing-link.default', WidgetMarketinLinkHandler );
		}
	);
})( jQuery );