// source --> https://www.entreprises-montrouge.net/wp-content/plugins/popup-builder/public/js/PopupBuilder.js?ver=4.4.4 
function sgAddEvent(element, eventName, fn)
{
	if (element.addEventListener)
		element.addEventListener(eventName, fn, false);
	else if (element.attachEvent)
		element.attachEvent('on' + eventName, fn);
}
/*Popup order count*/
window.SGPB_ORDER = 0;

function SGPBPopup()
{
	this.id = null;
	this.eventName = '';
	this.popupData = null;
	this.additionalPopupData = {};
	this.popupConfig = {};
	this.popupObj = null;
	this.onceListener();
	this.initialsListeners();
	this.countPopupOpen = true;
	this.closeButtonDefaultPositions = {};
	this.closeButtonDefaultPositions[1] = {
		'left': 9,
		'right': 9,
		'bottom': 9
	};
	this.closeButtonDefaultPositions[2] = {
		'left': 0,
		'right': 0,
		'top': parseInt('-20'),
		'bottom': parseInt('-20')
	};
	this.closeButtonDefaultPositions[3] = {
		'right': 4,
		'bottom': 4,
		'left': 4,
		'top': 4
	};
	this.closeButtonDefaultPositions[4] = {
		'left': 12,
		'right': 12,
		'bottom': 9
	};
	this.closeButtonDefaultPositions[5] = {
		'left': 8,
		'right': 8,
		'bottom': 8
	};
	this.closeButtonDefaultPositions[6] = {
		'left': parseInt('-18.5'),
		'right': parseInt('-18.5'),
		'bottom': parseInt('-18.5'),
		'top': parseInt('-18.5')
	};
}

SGPBPopup.htmlCustomButton = function()
{
	var buttons = jQuery('.sgpb-html-custom-button');
	var buttonActionBehaviors = function(button, settings)
	{
		button.bind('click', function() {
			var behavior = settings['sgpb-custom-button'];

			if (behavior === 'redirectToURL') {
				if (settings['sgpb-custom-button-redirect-new-tab']) {
					window.open(settings['sgpb-custom-button-redirect-URL']);
				}
				else {
					window.location.href = settings['sgpb-custom-button-redirect-URL'];
				}
			}
			if (behavior === 'hidePopup') {
				SGPBPopup.closePopup();
			}
			if (behavior === 'copyToClipBoard') {
				var tempInputId = 1;
				var value = settings['sgpb-custom-button-copy-to-clipboard-text'];
				var tempInput = document.createElement("input");
				tempInput.id = tempInputId;
				tempInput.value = value;
				tempInput.style = 'position: absolute; right: -10000px';
				if (!document.getElementById(tempInputId)) {
					document.body.appendChild(tempInput);
				}
				tempInput.select();
				document.execCommand("copy");

				if (settings['sgpb-copy-to-clipboard-close-popup']) {
					SGPBPopup.closePopup();
				}

				if (settings['sgpb-custom-button-copy-to-clipboard-alert']) {
					alert(settings['sgpb-custom-button-copy-to-clipboard-message']);
				}
			}
		});
	};

	buttons.each(function() {
		var settings = jQuery.parseJSON(decodeURIComponent(jQuery(this).attr('data-options')));
		buttonActionBehaviors(jQuery(this), settings);
	});
};

SGPBPopup.listeners = function () {
	var that = this;

	sgAddEvent(window, 'sgpbPopupBuilderAdditionalDimensionSettings', function(e) {
		SGPBPopup.mobileSafariAdditionalSettings(e);
	});

	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		/*for mobile landscape issue*/
		if (typeof (Event) === 'function') {
			var event = new CustomEvent('resize', {
				bubbles: true,
				cancelable: true
			});
		}
		else {
			if (SGPBPopup.isIE()) {
				var event = document.createEvent('Event');
				event.initEvent('resize', true, true);
			}
			else {
				var event = new CustomEvent('resize', {
					bubbles: true,
					cancelable: true
				});
			}
		}
		window.dispatchEvent(event);

		SGPBPopup.mobileSafariAdditionalSettings(e);
		var args = e.detail;
		var popupOptions = args.popupData;

		var obj = e.detail.currentObj.sgpbPopupObj;

		/* if no analytics extension */
		if (typeof SGPB_ANALYTICS_PARAMS === 'undefined') {
			if (obj.getCountPopupOpen()) {
				obj.addToCounter(popupOptions);
			}
		}

		if (popupOptions['sgpb-show-popup-same-user']) {
			obj.setPopupLimitationCookie(popupOptions);
		}
		SGPBPopup.htmlCustomButton();
	});

	setInterval(function() {
		var openedPopups = window.sgpbOpenedPopup || {};
		if (!Object.keys(openedPopups).length) {
			return false;
		}
		var params = {};
		params.popupsIdCollection = window.sgpbOpenedPopup;

		var data = {
			action: 'sgpb_send_to_open_counter',
			nonce: SGPB_JS_PARAMS.nonce,
			params: params
		};


		window.sgpbOpenedPopup = {};
		jQuery.post(SGPB_JS_PARAMS.ajaxUrl, data, function(res) {

		});
	}, 600);
};

SGPBPopup.mobileSafariAdditionalSettings = function(e)
{
	if (typeof e === 'undefined') {
		var args = SGPBPopup.prototype.getAdditionalPopupData();
		if (typeof args === 'undefined') {
			return false;
		}
		var popupOptions = args.popupData;
		var popupId = parseInt(args.popupId);
	}
	else {
		var args = e.detail;
		var alreadySavedArgs = SGPBPopup.prototype.getAdditionalPopupData();
		if (jQuery.isEmptyObject(alreadySavedArgs)) {
			SGPBPopup.prototype.setAdditionalPopupData(args);
		}
		var popupOptions = args.popupData;
		var popupId = parseInt(args.popupId);
	}
	var userAgent = window.navigator.userAgent;
	if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
		if (typeof popupOptions['sgpb-popup-dimension-mode'] !== 'undefined' && popupOptions['sgpb-popup-dimension-mode'] === 'responsiveMode') {
			var openedPopupWidth = parseInt(window.innerHeight-100);
			if (e.detail.popupData['sgpb-type'] === 'iframe' || e.detail.popupData['sgpb-type'] === 'video') {
				if (jQuery('.sgpb-popup-builder-content-'+popupId +' iframe').length) {
					jQuery('.sgpb-popup-builder-content-'+popupId).attr('style', 'height:'+openedPopupWidth+'px !important;');
				}
			}
		}
	}
};

SGPBPopup.prototype.setAdditionalPopupData = function(additionalPopupData)
{
	this.additionalPopupData = additionalPopupData;
};

SGPBPopup.prototype.getAdditionalPopupData = function()
{
	return this.additionalPopupData;
};

SGPBPopup.prototype.setCountPopupOpen = function(countPopupOpen)
{
	this.countPopupOpen = countPopupOpen;
};

SGPBPopup.prototype.getCountPopupOpen = function()
{
	return this.countPopupOpen;
};

SGPBPopup.playMusic = function(e) {
	var args = e.detail;
	var popupId = parseInt(args.popupId);
	var options = SGPBPopup.getPopupOptionsById(popupId);
	var soundUrl = options['sgpb-sound-url'];
	var soundStatus = options['sgpb-open-sound'];	
	if (soundStatus && soundUrl ) {
		var audio = new Audio(soundUrl);		
		audio.play();		
		window.SGPB_SOUND[popupId] = audio;
	}
};

SGPBPopup.floatingButton = function (e) {
	SGPBPopup.showFloatingButton(e);

	jQuery(window).on('sgpbFormSuccess', function (e){
		SGPBPopup.hideFloatingButton();
	});
};

SGPBPopup.showFloatingButton = function (e) {
	var popupObj = e || {};
	var popupId = 0;
	var shouldShowFloatingButton = true;

	/* if argument e is event reference the popup object is wrapped inside e.detail.currentObj.sgpbPopupObj  */
	if (e.hasOwnProperty('sgpbPopupObj')) {
		popupObj = e.detail.currentObj.sgpbPopupObj;
	}

	if (popupObj instanceof SGPBPopup) {
		popupId = parseInt(popupObj.id);
		shouldShowFloatingButton = popupObj.forceCheckCurrentPopupType(popupObj);
	}

	/* If there is no cookie which will prevent popup opening we will show floating button */
	if (shouldShowFloatingButton) {
		/* if we have popup id we detect exact button */
		if (popupId) {
			jQuery('.sgpb-floating-button.sg-popup-id-' + popupId).show();
		} else {
			jQuery('.sgpb-floating-button').show();
		}
	}
};

SGPBPopup.hideFloatingButton = function (popupId) {
	/* if we have popup id we detect exact button */
	if (popupId) {
		jQuery('.sgpb-floating-button.sg-popup-id-' + popupId).fadeOut();
	} else {
		jQuery('.sgpb-floating-button').fadeOut();
	}
};

SGPBPopup.prototype.initialsListeners = function()
{
	/* one time calling events (sgpbDidOpen, sgpbDidClose ...) */
	var that = this;
	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		jQuery('.sg-popup-close').unbind('click').bind('click',function(){
			var currentPopupId = jQuery(this).parents('.sg-popup-builder-content').attr('data-id');
			SGPBPopup.closePopupById(currentPopupId);
		});
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		var args = e.detail;
		var popupId = parseInt(args.popupId);
		that.htmlIframeFilterForOpen(popupId, 'close');
	});
};

SGPBPopup.prototype.onceListener = function()
{
	var that = this;

	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		document.onkeydown = function(e) {
			e = e || window.event;

			if (e.keyCode === 27) { /*esc pressed*/
				var currentPopup = that.getPopupIdForNextEsc();
				if (!currentPopup) {
					return false;
				}
				var lastPopupId = parseInt(currentPopup['popupId']);
				SGPBPopup.closePopupById(lastPopupId);
			}
		};
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		if (window.sgPopupBuilder.length !== 0) {
			var popups = [].concat(window.sgPopupBuilder).reverse();
			for (var i in popups) {
				var nextIndex = ++i;
				var nextObj = popups[nextIndex];

				if (typeof nextObj === 'undefined') {
					jQuery('html').removeClass('sgpb-overflow-hidden');
					jQuery('body').removeClass('sgpb-overflow-hidden-body');
					break;
				}

				if (nextObj.isOpen === false) {
					continue;
				}
				var options = SGPBPopup.getPopupOptionsById(nextObj.popupId);
				if (typeof options['sgpb-disable-page-scrolling'] === 'undefined') {
					jQuery('html').removeClass('sgpb-overflow-hidden');
					jQuery('body').removeClass('sgpb-overflow-hidden-body');
				}
				else {
					jQuery('html').addClass('sgpb-overflow-hidden');
					jQuery('body').addClass('sgpb-overflow-hidden-body');
				}
				break;
			}
		}
		else {
			jQuery('html').addClass('sgpb-overflow-hidden');
			jQuery('body').addClass('sgpb-overflow-hidden-body');
		}
	});
};

SGPBPopup.prototype.getPopupIdForNextEsc = function()
{
	var popups = window.sgPopupBuilder;
	var popup = false;

	if (!popups.length) {
		return popup;
	}

	var searchPopups = [].concat(popups).reverse();

	for (var i in searchPopups) {
		var popupData = searchPopups[i];

		if (popupData.isOpen) {
			var popupId = parseInt(popupData['popupId']);
			var popupOptions = SGPBPopup.getPopupOptionsById(popupId);

			if (!popupOptions['sgpb-disable-popup-closing'] && popupOptions['sgpb-esc-key']) {
				popup = popupData;
				break;
			}
		}
	}

	return popup;
};

SGPBPopup.prototype.setPopupId = function(popupId)
{
	this.id = parseInt(popupId);
};

SGPBPopup.prototype.getPopupId = function()
{
	return this.id;
};

SGPBPopup.prototype.setPopupObj = function(popupObj)
{
	this.popupObj = popupObj;
};

SGPBPopup.prototype.getPopupObj = function()
{
	return this.popupObj;
};

SGPBPopup.prototype.setPopupData = function(popupData)
{
	if (typeof popupData == 'string') {
		var popupData = SGPBPopup.JSONParse(popupData);
	}

	this.popupData = popupData;
};

SGPBPopup.prototype.getPopupData = function()
{
	return this.popupData;
};

SGPBPopup.prototype.setPopupConfig = function(config)
{
	this.popupConfig = config;
};

SGPBPopup.prototype.getPopupConfig = function()
{
	return this.popupConfig;
};

SGPBPopup.prototype.setUpPopupConfig = function()
{
	var popupConfig = new PopupConfig();
	this.setPopupConfig(popupConfig);
};

SGPBPopup.createPopupObjById = function(popupId)
{
	var options = SGPBPopup.getPopupOptionsById(popupId);

	if (!options) {
		return false;
	}
	var popupObj = new SGPBPopup();
	popupObj.setPopupId(popupId);
	popupObj.setPopupData(options);

	return popupObj;
};


SGPBPopup.getPopupOptionsById = function(popupId)
{
	var popupDataDiv = jQuery('#sg-popup-content-wrapper-'+popupId);

	if (!popupDataDiv.length) {
		return false;
	}
	var options = popupDataDiv.attr('data-options');

	return SGPBPopup.JSONParse(options);
};

SGPBPopup.prototype.getCompatibleZiIndex = function(popupZIndex)
{
	/*2147483647 it's maximal z index value*/
	if (popupZIndex > 2147483647) {
		return 2147483627;
	}

	return popupZIndex;
};

SGPBPopup.prototype.prepareOpen = function()
{
	var popupId = this.getPopupId();
	var popupData = this.getPopupData();
	var popupZIndex = this.getCompatibleZiIndex(popupData['sgpb-popup-z-index']);
	var popupType = this.popupData['sgpb-type'];
	this.setUpPopupConfig();
	var that = this;
	var popupConfig = this.getPopupConfig();

	function decodeEntities(encodedString)
	{
		if (typeof encodedString == 'undefined') {
			return '';
		}
		var suspiciousStrings = ['document.createElement', 'createElement', 'String.fromCharCode', 'fromCharCode'];
		for (var i in suspiciousStrings) {
			if (encodedString.indexOf(suspiciousStrings[i]) > 0) {
				return '';
			}
		}
		var textArea = document.createElement('textarea');
		textArea.innerHTML = encodedString;

		return textArea.value;
	}

	popupConfig.customShouldOpen = function()
	{
		var instructions = popupData['sgpb-ShouldOpen'];
		instructions = decodeEntities(instructions);
		var F = new Function (instructions);

		return(F());
	};

	popupConfig.customShouldClose = function()
	{
		var instructions = popupData['sgpb-ShouldClose'];
		instructions = decodeEntities(instructions);
		var F = new Function (instructions);

		return(F());
	};

	this.setPopupDimensions();

	if (popupData['sgpb-disable-popup-closing'] == 'on') {
		popupData['sgpb-enable-close-button'] = '';
		popupData['sgpb-esc-key'] = '';
		popupData['sgpb-overlay-click'] = '';
	}
	/*used in the analytics*/
	popupData['eventName'] = this.eventName;

	if (SGPBPopup.varToBool(popupData['sgpb-enable-close-button'])) {
		popupConfig.magicCall('setCloseButtonDelay', parseInt(popupData['sgpb-close-button-delay']));
	}

	popupConfig.magicCall('setShowButton', SGPBPopup.varToBool(popupData['sgpb-enable-close-button']));
	/* Convert seconds to micro seconds */
	var openAnimationSpeed = parseFloat(popupData['sgpb-open-animation-speed'])*1000;
	var closeAnimationSpeed = parseFloat(popupData['sgpb-close-animation-speed'])*1000;
	popupConfig.magicCall('setOpenAnimationEffect', popupData['sgpb-open-animation-effect']);
	popupConfig.magicCall('setCloseAnimationEffect', popupData['sgpb-close-animation-effect']);
	popupConfig.magicCall('setOpenAnimationSpeed', openAnimationSpeed);
	popupConfig.magicCall('setCloseAnimationSpeed', closeAnimationSpeed);
	popupConfig.magicCall('setOpenAnimationStatus', popupData['sgpb-open-animation']);
	popupConfig.magicCall('setCloseAnimationStatus', popupData['sgpb-close-animation']);
	popupConfig.magicCall('setContentPadding', popupData['sgpb-content-padding']);
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupType == SgpbRecentSalesPopupType) {
			/* set max z index for recent sales popup */
			popupZIndex = 2147483647;
			popupConfig.magicCall('setCloseAnimationEffect', 'fade');
			popupConfig.magicCall('setCloseAnimationSpeed', 1000);
			popupConfig.magicCall('setCloseAnimationStatus', 'on');
		}
	}

	popupConfig.magicCall('setZIndex', popupZIndex);
	popupConfig.magicCall('setCloseButtonWidth', popupData['sgpb-button-image-width']);
	popupConfig.magicCall('setCloseButtonHeight', popupData['sgpb-button-image-height']);
	popupConfig.magicCall('setPopupId', popupId);
	popupConfig.magicCall('setPopupData', popupData);
	popupConfig.magicCall('setAllowed', !SGPBPopup.varToBool(popupData['sgpb-disable-popup-closing']));
	if (popupData['sgpb-type'] == SGPB_POPUP_PARAMS.popupTypeAgeRestriction) {
		popupConfig.magicCall('setAllowed', false);
	}
	popupConfig.magicCall('setEscShouldClose', SGPBPopup.varToBool(popupData['sgpb-esc-key']));
	popupConfig.magicCall('setOverlayShouldClose', SGPBPopup.varToBool(popupData['sgpb-overlay-click']));

	popupConfig.magicCall('setScrollingEnabled', SGPBPopup.varToBool(popupData['sgpb-enable-content-scrolling']));

	if (SGPBPopup.varToBool(popupData['sgpb-content-click'])) {
		this.contentCloseBehavior();
	}
	sgAddEvent(window, 'sgpbWillOpen', function(e) {
		if (popupId != e.detail.popupId || e.detail.popupData['sgpb-content-click'] == 'undefined') {
			return false;
		}
		/* triggering any popup content click (analytics) */
		that.popupContentClick(e);
	});
	if (SGPBPopup.varToBool(popupData['sgpb-popup-fixed'])) {
		this.addFixedPosition();
	}
	/*ThemeCreator*/
	this.themeCreator();
	this.themeCustomizations();

	popupConfig.magicCall('setContents', document.getElementById('sg-popup-content-wrapper-'+popupId));
	popupConfig.magicCall('setPopupType', popupType);
	this.setPopupConfig(popupConfig);
	this.popupTriggeringListeners();

	/* check popup type, then check if popup can be opened by popup type */
	var allowToOpen = this.checkCurrentPopupType();
	if (allowToOpen) {
		this.open();
	}
};

SGPBPopup.prototype.popupContentClick = function(e)
{
	var args = e.detail;
	var popupId = parseInt(args['popupId']);
	jQuery('.sgpb-content-' + popupId).on('click', function(event) {
		var settings = {
			popupId: popupId,
			eventName: 'sgpbPopupContentclick'
		};
		jQuery(window).trigger('sgpbPopupContentclick', settings);
	});
};

SGPBPopup.prototype.forceCheckCurrentPopupType = function(popupObj)
{
	var allowToOpen = true;
	var popupConfig = new PopupConfig();
	var className = popupObj.popupData['sgpb-type'];
	if (typeof className == 'undefined' || className == 'undefined') {
		return false;
	}

	if (typeof SGPB_POPUP_PARAMS.conditionalJsClasses != 'undefined' && SGPB_POPUP_PARAMS.conditionalJsClasses.length) {
		var isAllowConditions = this.forceIsAllowJsConditions(popupObj);

		if (!isAllowConditions) {
			return false;
		}
	}

	var popupConfig = new PopupConfig();
	var className = this.popupData['sgpb-type'];
	/* make the first letter of a string uppercase, then concat prefix (uppercase all prefix string) */
	className = popupConfig.prefix.toUpperCase() + PopupConfig.firstToUpperCase(className);
	/* hasOwnProperty returns boolean value */
	if (window.hasOwnProperty(className)) {
		className = eval(className);
		/* create current popup type object */
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.allowToOpen === 'function') {
			allowToOpen = obj.allowToOpen(this.id);
			if (!allowToOpen) {
				isAllow = allowToOpen;
			}
		}
	}

	var allowToOpen = this.checkCurrentPopupType();
	if (!allowToOpen) {
		return false;
	}

	return allowToOpen;
};

SGPBPopup.prototype.checkCurrentPopupType = function()
{
	var allowToOpen = true;
	var popupConfig = new PopupConfig();

	var isPreview = parseInt(this.popupData['sgpb-is-preview']);
	if (!isNaN(isPreview) && isPreview == 1) {
		return allowToOpen;
	}

	var popupHasLimit = this.isSatistfyForShowingLimitation(this.popupData);
	if (!popupHasLimit) {
		return false;
	}

	var dontShowPopupCookieName = 'sgDontShowPopup' + this.popupData['sgpb-post-id'];
	var dontShowPopup = SGPopup.getCookie(dontShowPopupCookieName);
	if (dontShowPopup != '') {
		return false;
	}

	var className = this.popupData['sgpb-type'];
	if (typeof className == 'undefined' || className == 'undefined') {
		return false;
	}

	if (typeof SGPB_POPUP_PARAMS.conditionalJsClasses != 'undefined' && SGPB_POPUP_PARAMS.conditionalJsClasses.length) {
		var isAllowConditions = this.isAllowJsConditions();

		if (!isAllowConditions) {
			return false;
		}
	}

	/* make the first letter of a string uppercase, then concat prefix (uppercase all prefix string) */
	className = popupConfig.prefix.toUpperCase() + PopupConfig.firstToUpperCase(className);
	/* hasOwnProperty returns boolean value */
	if (window.hasOwnProperty(className)) {
		className = eval(className);
		/* create current popup type object */
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.allowToOpen === 'function') {
			allowToOpen = obj.allowToOpen(this.id);
		}
	}

	return allowToOpen;
};

SGPBPopup.prototype.forceIsAllowJsConditions = function(popupObj) {
	var conditions = SGPB_POPUP_PARAMS.conditionalJsClasses;

	var isAllow = true;

	for (var i in conditions) {
		if (!conditions.hasOwnProperty(i)) {
			break;
		}

		try {
			var className = eval(conditions[i]);
		}
		catch (e) {
			continue;
		}
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.forceAllowToOpen === 'function') {
			var popupData = this.getPopupData();
			var allowToOpen = obj.forceAllowToOpen(popupObj.id, popupObj);

			if (!allowToOpen) {
				isAllow = allowToOpen;
				break;
			}
		}
	}

	return isAllow;
};

SGPBPopup.prototype.isAllowJsConditions = function() {
	var conditions = SGPB_POPUP_PARAMS.conditionalJsClasses;
	var isAllow = true;

	for (var i in conditions) {
		if (!conditions.hasOwnProperty(i)) {
			break;
		}

		try {
			var className = eval(conditions[i]);
		}
		catch (e) {
			continue;
		}
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.allowToOpen === 'function') {
			var allowToOpen = obj.allowToOpen(this.id, this);
			if (!allowToOpen) {
				isAllow = allowToOpen;
				break;
			}
		}
	}

	return isAllow;
};

SGPBPopup.prototype.setPopupLimitationCookie = function(popupData)
{
	var cookieData = this.getPopupShowLimitationCookie(popupData);
	var cookie = cookieData.cookie || {};
	var openingCount = cookie.openingCount || 0;
	var currentUrl = window.location.href;

	if (!popupData['sgpb-show-popup-same-user-page-level']) {
		currentUrl = '';
	}
	cookie.openingCount = openingCount + 1;
	cookie.openingPage = currentUrl;
	var popupShowingLimitExpiry = parseInt(popupData['sgpb-show-popup-same-user-expiry']);

	SGPBPopup.setCookie(cookieData.cookieName, JSON.stringify(cookie), popupShowingLimitExpiry, currentUrl);
};

SGPBPopup.prototype.isSatistfyForShowingLimitation = function(popupData)
{
	/*enable||disable*/
	var popupLimitation = popupData['sgpb-show-popup-same-user'];

	/*if this option unchecked popup must be show*/
	if (!popupLimitation) {
		return true;
	}
	var cookieData = this.getPopupShowLimitationCookie(popupData);

	/*when there is not*/
	if (!cookieData.cookie) {
		return true;
	}

	return popupData['sgpb-show-popup-same-user-count'] > cookieData.cookie.openingCount;
};

SGPBPopup.prototype.getPopupShowLimitationCookie = function(popupData)
{
	var savedCookie = this.getPopupShowLimitationCookieDetails(popupData);
	var savedCookie = this.filterPopupLimitationCookie(savedCookie);

	return savedCookie;
};

SGPBPopup.prototype.filterPopupLimitationCookie = function(cookie)
{
	var result = {};
	result.cookie = '';
	if (cookie.isPageLevel) {

		result.cookieName = cookie.pageLevelCookieName;
		if (cookie.pageLevelCookie) {
			result.cookie = jQuery.parseJSON(cookie.pageLevelCookie);
		}

		SGPBPopup.deleteCookie(cookie.domainLevelCookieName);

		return result;
	}
	result.cookieName = cookie.domainLevelCookieName;
	if (cookie.domainLevelCookie) {
		result.cookie = jQuery.parseJSON(cookie.domainLevelCookie);
	}
	var currentUrl = window.location.href;

	SGPBPopup.deleteCookie(cookie.pageLevelCookieName, currentUrl);

	return result;
};

SGPBPopup.prototype.getPopupShowLimitationCookieDetails = function(popupData)
{
	var result = false;
	var currentUrl = window.location.href;
	var currentPopupId = popupData['sgpb-post-id'];

	/*Cookie names*/
	var popupLimitationCookieHomePageLevelName = 'SGPBShowingLimitationHomePage' + currentPopupId;
	var popupLimitationCookiePageLevelName = 'SGPBShowingLimitationPage' + currentPopupId;
	var popupLimitationCookieDomainName = 'SGPBShowingLimitationDomain' + currentPopupId;

	var pageLevelCookie = popupData['sgpb-show-popup-same-user-page-level'] || false;

	/*check if current url is home page*/
	if (currentUrl == SGPB_POPUP_PARAMS.homePageUrl) {
		popupLimitationCookiePageLevelName = popupLimitationCookieHomePageLevelName;
	}
	var popupLimitationPageLevelCookie = SGPopup.getCookie(popupLimitationCookiePageLevelName);
	var popupLimitationDomainCookie = SGPopup.getCookie(popupLimitationCookieDomainName);

	result = {
		'pageLevelCookieName': popupLimitationCookiePageLevelName,
		'domainLevelCookieName': popupLimitationCookieDomainName,
		'pageLevelCookie': popupLimitationPageLevelCookie,
		'domainLevelCookie': popupLimitationDomainCookie,
		'isPageLevel': pageLevelCookie
	};

	return result;
};

SGPBPopup.prototype.themeCreator = function()
{
	var noPositionSelected = false;
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();
	var popupConfig = this.getPopupConfig();
	var forceRtlClass = '';
	var forceRtl = SGPBPopup.varToBool(popupData['sgpb-force-rtl']);
	var popupTheme = popupData['sgpb-popup-themes'];
	var popupType = popupData['sgpb-type'];
	var closeButtonWidth = popupData['sgpb-button-image-width'];
	var closeButtonHeight = popupData['sgpb-button-image-height'];
	var contentPadding = parseInt(popupData['sgpb-content-padding']);
	/* close button position */
	var top = parseInt(popupData['sgpb-button-position-top']);
	var right = parseInt(popupData['sgpb-button-position-right']);
	var bottom = parseInt(popupData['sgpb-button-position-bottom']);
	var left = parseInt(popupData['sgpb-button-position-left']);

	var contentClass = popupData['sgpb-content-custom-class'];
	/* for the 2-nd and 3-rd themes only */
	var popupBorder = SGPBPopup.varToBool(popupData['sgpb-disable-border']);
	var closeButtonImage = popupConfig.closeButtonImage;
	var themeNumber = 1;
	var backgroundColor = 'black';
	var borderColor = 'inherit';
	var recentSalesPopup = false;
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupType == SgpbRecentSalesPopupType) {
			recentSalesPopup = true;
			popupTheme = 'sgpb-theme-2';
			closeButtonPosition = 'topRight';
			backgroundColor = 'white';
			borderColor = '#ececec';
			top = '-10';
			right = '-10';
			popupConfig.magicCall('setShadowSpread', 1);
			popupConfig.magicCall('setContentShadowBlur', 5);
			popupConfig.magicCall('setOverlayVisible', false);
			popupConfig.magicCall('setContentShadowColor', '#000000b3');
			popupConfig.magicCall('setContentBorderRadius', '5px');
		}
	}
	var themeIndexNum = popupTheme[popupTheme.length -1];

	if (isNaN(top)) {
		top = this.closeButtonDefaultPositions[themeIndexNum].top;
	}
	if (isNaN(right)) {
		right = this.closeButtonDefaultPositions[themeIndexNum].right;
	}
	if (isNaN(bottom)) {
		bottom = this.closeButtonDefaultPositions[themeIndexNum].bottom;
	}
	if (isNaN(left)) {
		left = this.closeButtonDefaultPositions[themeIndexNum].left;
	}
	if (forceRtl) {
		forceRtlClass = ' sgpb-popup-content-direction-right';
	}
	if (popupData['sgpb-type'] == 'countdown') {
		popupConfig.magicCall('setMinWidth', 300);
	}
	popupConfig.magicCall('setContentPadding', contentPadding);
	popupConfig.magicCall('setOverlayAddClass', popupTheme+'-overlay sgpb-popup-overlay-' + popupId);
	popupConfig.magicCall('setContentAddClass', 'sgpb-content sgpb-content-'+popupId+' ' + popupTheme+'-content ' + contentClass + forceRtlClass);

	if (typeof popupData['sgpb-close-button-position'] == 'undefined' || popupData['sgpb-close-button-position'] == '') {
		/*
		 * in the old version we don't have close button position option
		 * and if noPositionSelected is true, the popup was not edited
		 */
		var noPositionSelected = true;
	}
	else {
		var closeButtonPosition = popupData['sgpb-close-button-position'];
		popupConfig.magicCall('setButtonPosition', closeButtonPosition);
	}

	if (popupTheme == 'sgpb-theme-1') {
		themeNumber = 1;
		popupConfig.magicCall('setShadowSpread', 14);
		/* 9px theme default close button position for all cases */
		if (noPositionSelected || closeButtonPosition == 'bottomRight') {
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
		else {
			popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
	}
	else if (popupTheme == 'sgpb-theme-2') {
		themeNumber = 2;
		popupConfig.magicCall('setButtonInside', false);
		popupConfig.magicCall('setContentBorderWidth', 1);
		popupConfig.magicCall('setContentBackgroundColor', backgroundColor);
		popupConfig.magicCall('setContentBorderColor', borderColor);
		popupConfig.magicCall('setOverlayColor', 'white');
		var rightPosition = '0';
		var topPosition = '-' + closeButtonHeight + 'px';
		if (recentSalesPopup) {
			rightPosition = '-' + (closeButtonWidth / 2) + 'px';
			topPosition = '-' + (closeButtonHeight / 2) + 'px';
			themeNumber = 6;
		}
		if (noPositionSelected || closeButtonPosition == 'topRight') {
			/* this theme has 1px border */
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
		}
		else {
			if (closeButtonPosition == 'topLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
			}
			else if (closeButtonPosition == 'bottomRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
			else if (closeButtonPosition == 'bottomLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
		}

		if (popupBorder) {
			popupConfig.magicCall('setContentBorderWidth', 0);
		}
	}
	else if (popupTheme == 'sgpb-theme-3') {
		themeNumber = 3;
		popupConfig.magicCall('setContentBorderWidth', 5);
		popupConfig.magicCall('setContentBorderRadius', popupData['sgpb-border-radius']);
		popupConfig.magicCall('setContentBorderRadiusType', popupData['sgpb-border-radius-type']);
		popupConfig.magicCall('setContentBorderColor', popupData['sgpb-border-color']);
		var closeButtonPositionPx = '4px';
		if (popupBorder) {
			popupConfig.magicCall('setContentBorderWidth', 0);
			closeButtonPositionPx = '0px';
		}
		if (noPositionSelected) {
			popupConfig.magicCall('setCloseButtonWidth', 38);
			popupConfig.magicCall('setCloseButtonHeight', 19);
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
		}
		else {
			if (closeButtonPosition == 'topRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
			}
			else if (closeButtonPosition == 'topLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
			}
			else if (closeButtonPosition == 'bottomRight') {
				popupConfig.magicCall('setCloseButtonPositionLeft', right+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
			else if (closeButtonPosition == 'bottomLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
		}
	}
	else if (popupTheme == 'sgpb-theme-4') {
		/* in theme-4 close button type is button,not image,
		 * then set type to button, default is image and
		 * set text
		 */
		themeNumber = 4;
		popupConfig.magicCall('setButtonImage', popupData['sgpb-button-text']);
		popupConfig.magicCall('setCloseButtonType', 'button');
		popupConfig.magicCall('setCloseButtonText', popupData['sgpb-button-text']);
		popupConfig.magicCall('setContentBorderWidth', 0);
		popupConfig.magicCall('setContentBackgroundColor', 'white');
		popupConfig.magicCall('setContentBorderColor', 'white');
		popupConfig.magicCall('setOverlayColor', 'white');
		popupConfig.magicCall('setShadowSpread', 4);
		popupConfig.magicCall('setContentShadowBlur', 8);
		/* 8px/12px theme default close button position for all cases */
		if (noPositionSelected || closeButtonPosition == 'bottomRight') {
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
		else {
			popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
	}
	else if (popupTheme == 'sgpb-theme-5') {
		themeNumber = 5;
		popupConfig.magicCall('setBoxBorderWidth', 10);
		popupConfig.magicCall('setContentBorderColor', '#4B4B4B');
		if (noPositionSelected || closeButtonPosition == 'bottomRight') {
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
		else {
			popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
	}
	else if (popupTheme == 'sgpb-theme-6') {
		themeNumber = 6;
		popupConfig.magicCall('setButtonInside', false);
		popupConfig.magicCall('setContentBorderRadius', 7);
		popupConfig.magicCall('setContentBorderRadiusType', 'px');
		if (noPositionSelected) {
			popupConfig.magicCall('setCloseButtonWidth', 37);
			popupConfig.magicCall('setCloseButtonHeight', 37);
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
		}
		else {
			if (typeof popupData['sgpb-button-position-right'] == 'undefined') {
				right = '-' + (closeButtonWidth / 2);
				top = '-' + (closeButtonHeight / 2);
				left = '-' + (closeButtonWidth / 2);
				bottom = '-' + (closeButtonHeight / 2);
			}
			if (closeButtonPosition == 'topRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right + 'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top + 'px');
			}
			else if (closeButtonPosition == 'topLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left + 'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top + 'px');
			}
			else if (closeButtonPosition == 'bottomRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right + 'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom + 'px');
			}
			else if (closeButtonPosition == 'bottomLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left + 'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom + 'px');
			}
		}
	}

	popupConfig.magicCall('setPopupTheme', themeNumber);
	if (!popupData['sgpb-button-image']) {
		closeButtonImage = SGPB_POPUP_PARAMS.defaultThemeImages[themeNumber];
		if (typeof closeButtonImage  != 'undefined') {
			popupConfig.magicCall('setButtonImage', closeButtonImage);
		}
	}
	else {
		popupConfig.magicCall('setButtonImage', 'data:image/png;base64,'+popupData['sgpb-button-image-data']);
		if (popupData['sgpb-button-image-data'] == '' || popupData['sgpb-button-image-data'].indexOf('http') != -1) {
			popupConfig.magicCall('setButtonImage', popupData['sgpb-button-image']);
		}
	}

};

SGPBPopup.prototype.themeCustomizations = function()
{
	var popupId = this.getPopupId();
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();

	var contentOpacity = popupData['sgpb-content-opacity'];
	var contentBgColor = popupData['sgpb-background-color'];
	if (popupData['sgpb-background-image-data']) {
		var contentBgImage = 'data:image/png;base64,'+popupData['sgpb-background-image-data'];
	}
	else {
		var contentBgImage = popupData['sgpb-background-image'];
	}
	var showContentBackground = popupData['sgpb-show-background'];
	var contentBgImageMode = popupData['sgpb-background-image-mode'];
	var overlayColor = popupData['sgpb-overlay-color'];
	var popupTheme = popupData['sgpb-popup-themes'];
	var popupType = popupData['sgpb-type'];
	if (typeof popupData['sgpb-overlay-custom-class'] == 'undefined') {
		popupData['sgpb-overlay-custom-class'] = 'sgpb-popup-overlay';
	}
	if (typeof popupData['sgpb-popup-themes'] == 'undefined') {
		popupTheme = 'sgpb-theme-2';
	}

	if (typeof showContentBackground == 'undefined') {
		contentBgColor = '';
		contentBgImage = '';
		contentBgImageMode = '';
	}
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupType == SgpbRecentSalesPopupType) {
			showContentBackground = 'on';
			contentBgColor = popupData['sgpb-background-color'];
			contentOpacity = popupData['sgpb-content-opacity'];
		}
	}

	if (contentOpacity) {
		popupConfig.magicCall('setContentBackgroundOpacity', contentOpacity);
	}
	if (contentBgImageMode) {
		popupConfig.magicCall('setContentBackgroundMode', contentBgImageMode);
	}
	if (contentBgImage) {
		popupConfig.magicCall('setContentBackgroundImage', contentBgImage);
	}
	if (contentBgColor) {
		contentBgColor = SGPBPopup.hexToRgba(contentBgColor, contentOpacity);
		popupConfig.magicCall('setContentBackgroundColor', contentBgColor);
	}
	if (overlayColor) {
		popupConfig.magicCall('setOverlayColor', overlayColor);
	}

	var overlayClasses = popupTheme+'-overlay sgpb-popup-overlay-'+popupId;
	if (SGPB_JS_PACKAGES.extensions['advanced-closing']) {
		if (typeof popupData['sgpb-enable-popup-overlay'] != 'undefined' && popupData['sgpb-enable-popup-overlay'] == 'on') {
			popupData['sgpb-enable-popup-overlay'] = true;
		}
		else if (typeof popupData['sgpb-enable-popup-overlay'] == 'undefined') {
			popupData['sgpb-enable-popup-overlay'] = false;
		}
	}
	else {
		popupData['sgpb-enable-popup-overlay'] = true;
	}

	popupConfig.magicCall('setOverlayVisible', SGPBPopup.varToBool(popupData['sgpb-enable-popup-overlay']));
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		popupConfig.magicCall('setOverlayVisible', false);
	}
	if (SGPBPopup.varToBool(popupData['sgpb-enable-popup-overlay'])) {
		popupConfig.magicCall('setOverlayAddClass', overlayClasses + ' ' + popupData['sgpb-overlay-custom-class']);
		var overlayOpacity = popupData['sgpb-overlay-opacity'] || 0.8;
		popupConfig.magicCall('setOverlayOpacity', overlayOpacity * 100);
	}
};

SGPBPopup.prototype.formSubmissionDetection = function(args)
{
	if (args.length) {
		return false;
	}
	var popupId = args.popupId;
	var options = SGPBPopup.getPopupOptionsById(popupId);

	if (!options['sgpb-reopen-after-form-submission']) {
		return false;
	}

	jQuery('.sgpb-popup-builder-content-' + popupId + ' form').submit(function() {
		SGPBPopup.setCookie('SGPBSubmissionReloadPopup', popupId);
	});
};

SGPBPopup.prototype.htmlIframeFilterForOpen = function(popupId, popupEventName)
{
	var popupContent = jQuery('.sgpb-content-' + popupId);

	if (!popupContent.length) {
		return false;
	}

	popupContent.find('iframe').each(function() {

		if (popupEventName != 'open') {
			/* for do not affect facebook type buttons iframe only */
			if (jQuery(this).closest('.fb_iframe_widget').length) {
				return true;
			}

			/*close*/
			if (typeof jQuery(this).attr('data-attr-src') == 'undefined') {
				var src = jQuery(this).attr('src');
				if (src != '') {
					jQuery(this).attr('data-attr-src', src);
					jQuery(this).attr('src', '');
				}
				return true;
			}
			else {
				var src = jQuery(this).attr('src');
				if (src != '') {
					jQuery(this).attr('data-attr-src', src);
					jQuery(this).attr('src', '');
				}
				return true;
			}
		}
		else {
			/*open*/
			if (typeof jQuery(this).attr('data-attr-src') == 'undefined') {
				var src = jQuery(this).attr('src');
				if (src != '') {
					jQuery(this).attr('data-attr-src', src);
				}

				return true;
			}
			else {
				var src = jQuery(this).attr('data-attr-src');
				if (src != '') {
					jQuery(this).attr('src', src);
					jQuery(this).attr('data-attr-src', src);
				}
				return true;
			}
		}
	});
};

SGPBPopup.prototype.iframeSizesInHtml = function(args)
{
	var popupId = args['popupId'];
	var popupOptions = args.popupData;
	var popupContent = jQuery('.sgpb-content-' + popupId);

	if (!popupContent.length) {
		return false;
	}
	popupContent.find('iframe').each(function() {
		if (typeof jQuery(this) == 'undefined') {
			return false;
		}
		if (popupOptions['sgpb-popup-dimension-mode'] == 'customMode') {
			if (typeof jQuery(this).attr('width') == 'undefined' && typeof popupContent.attr('height') == 'undefined') {
				jQuery(this).css({'width': popupOptions['sgpb-width'], 'height': popupOptions['sgpb-height']});
			}
		}
	});
};

SGPBPopup.prototype.getSearchDataFromContent = function(content)
{
	var pattern = /\[(\[?)(pbvariable)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]\*+(?:\[(?!\/\2\])[^\[]\*+)\*+)\[\/\2\])?)(\]?)/gi;
	var match;
	var collectedData = [];

	while (match = pattern.exec(content)) {
		var currentSearchData = [];
		var attributes;
		var attributesKeyValue = [];
		var parseAttributes = /\s(\w+?)="(.+?)"/g;
		currentSearchData['replaceString'] = this.htmlDecode(match[0]);

		while (attributes = parseAttributes.exec(match[3])) {
			attributesKeyValue[attributes[1]] = this.htmlDecode(attributes[2]);
		}

		currentSearchData['searchData'] = attributesKeyValue;
		collectedData.push(currentSearchData);
	}

	return collectedData;
};

SGPBPopup.prototype.replaceWithCustomShortcode = function(popupId)
{
	var currentHtmlContent = jQuery('.sgpb-content-'+popupId).html();
	var searchData = this.getSearchDataFromContent(currentHtmlContent);
	var that = this;

	if (!searchData.length) {
		return false;
	}

	for (var index in searchData) {
		var currentSearchData = searchData[index];
		var searchAttributes = currentSearchData['searchData'];

		if (typeof searchAttributes['selector'] == 'undefined' || typeof searchAttributes['attribute'] == 'undefined') {
			that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
			continue;
		}

		try {
			if (!jQuery(searchAttributes['selector']).length) {
				that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
				continue;
			}
		}
		catch (e) {
			that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
			continue;
		}

		if (searchAttributes['attribute'] == 'text') {
			var replaceName = jQuery(searchAttributes['selector']).text();
		}
		else {
			var replaceName = jQuery(searchAttributes['selector']).attr(searchAttributes['attribute']);
		}

		if (typeof replaceName == 'undefined') {
			that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
			continue;
		}

		that.replaceShortCode(currentSearchData['replaceString'], replaceName, popupId);
	}
};

SGPBPopup.prototype.replaceShortCode = function(shortCode, replaceText, popupId)
{
	var popupId = parseInt(popupId);

	if (!popupId) {
		return false;
	}

	var popupContentWrapper = jQuery('.sgpb-content-' + popupId);

	if (!popupContentWrapper.length) {
		return false;
	}

	popupContentWrapper.find('div').each(function() {
		var currentHtmlContent = jQuery(this).contents();

		if (!currentHtmlContent.length) {
			return false;
		}

		currentHtmlContent.html(function(i, v) {
			if (typeof v != 'undefined') {
				return v.replace(shortCode, replaceText);
			}
		});
	});

	return true;
};

SGPBPopup.prototype.popupTriggeringListeners = function()
{
	var that = this;
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();

	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		var args = e.detail;
		that.iframeSizesInHtml(args);
		that.formSubmissionDetection(args);
		var popupOptions = args.popupData;

		var closeButtonDelay = parseInt(popupOptions['sgpb-close-button-delay']);
		if (closeButtonDelay) {
			that.closeButtonDisplay(popupOptions['sgpb-post-id'], 'show', closeButtonDelay);
		}
		var disablePageScrolling = popupOptions['sgpb-disable-page-scrolling'];
		if (popupOptions['sgpb-overlay-color']) {
			jQuery('.sgpb-theme-1-overlay').css({'background-image': 'none'});
		}
		if (SGPBPopup.varToBool(disablePageScrolling)) {
			jQuery('html').addClass('sgpb-overflow-hidden');
			jQuery('body').addClass('sgpb-overflow-hidden-body');
		}
	});

	sgAddEvent(window, 'sgpbWillOpen', function(e) {
		var args = e.detail;
		var popupId = parseInt(args['popupId']);
		that.htmlIframeFilterForOpen(args.popupId, 'open');
		that.replaceWithCustomShortcode(popupId);
		that.sgpbDontShowPopup(popupId);

		var closeButtonDelay = parseInt(popupData['sgpb-close-button-delay']);
		if (closeButtonDelay) {
			that.closeButtonDisplay(popupData['sgpb-post-id'], 'hide');
		}
		/* extra checker for analytics */
		var settings = {
			popupId: popupData['sgpb-post-id'],
			disabledAnalytics: popupData['sgpb-popup-counting-disabled'],
			disabledInGeneral: SGPB_POPUP_PARAMS.disableAnalyticsGeneral
		};
		jQuery(window).trigger('sgpbDisableAnalytics', settings);
	});

	sgAddEvent(window, 'sgpbShouldClose', function(e) {

	});

	sgAddEvent(window, 'sgpbWillClose', function(e) {
		var args = e.detail;
		SGPBPopup.offPopup(e.detail.currentObj);
	});
};

SGPBPopup.prototype.sgpbDontShowPopup = function(popupId)
{
	var dontShowPopup = jQuery('.sgpb-content-' + popupId).parent().find('[class*="sg-popup-dont-show"]');
	if (!dontShowPopup.length) {
		return false;
	}

	dontShowPopup.each(function() {
		jQuery(this).bind('click', function(e) {
			e.preventDefault();
			var expireTime = SGPB_POPUP_PARAMS.dontShowPopupExpireTime;
			var cookieName = 'sgDontShowPopup' + popupId;
			var classNameSearch = jQuery(this).attr('class').match(/sg-popup-dont-show/);
			var className = classNameSearch['input'];
			var customExpireTime = className.match(/sg-popup-dont-show-(\d+$)/);

			if (customExpireTime) {
				expireTime = parseInt(customExpireTime[1]);
			}

			SGPBPopup.setCookie(cookieName, expireTime, expireTime);
			SGPBPopup.closePopupById(popupId);
		});
	});
};

SGPBPopup.prototype.addToCounter = function(popupOptions)
{
	if (SGPB_POPUP_PARAMS.isPreview || (typeof popupOptions['sgpb-popup-counting-disabled'] != 'undefined')) {
		return false;
	}
	var that = this;
	var openedPopups = window.sgpbOpenedPopup || {};


	var popupId = parseInt(popupOptions['sgpb-post-id']);

	if (typeof openedPopups[popupId] == 'undefined') {
		openedPopups[popupId] = 1;
	}
	else {
		openedPopups[popupId] += 1;
	}
	window.sgpbOpenedPopup = openedPopups;
};

/*
 * closeButtonDisplay()
 * close or hide close button
 * @param popupId
 * @param display
 * @param delay
 */

SGPBPopup.prototype.closeButtonDisplay = function(popupId, display, delay)
{
	if (display == 'show') {
		setTimeout(function() {
				jQuery('.sgpb-content-' + popupId).prev().show();
			},
			delay * 1000 /* received values covert to milliseconds */
		);
	}
	else if (display == 'hide') {
		jQuery('.sgpb-content-' + popupId).prev().hide();
	}
};

SGPBPopup.prototype.open = function(args)
{
	var customEvent = this.customEvent;
	var config = this.getPopupConfig();
	var popupId = this.getPopupId();
	var eventName = this.eventName;

	if (typeof window.sgPopupBuilder == 'undefined') {
		window.sgPopupBuilder = [];
	}
	var popupData = SGPBPopup.getPopupWindowDataById(popupId);

	if (!popupData) {
		window.SGPB_ORDER += 1;
		var currentObj = {
			'eventName': eventName,
			'popupId': popupId,
			'order': window.SGPB_ORDER,
			'isOpen': true,
			'sgpbPopupObj': this
		};
		config.currentObj = currentObj;
		var popupConfig = config.combineConfigObj();
		var popup = new SGPopup(popupConfig);
		currentObj.popup = popup;
		window.sgPopupBuilder.push(currentObj);
	}
	else {
		popup = popupData['popup'];
		popupData['isOpen'] = true;
	}

	if (typeof args != 'undefined' && !args['countPopupOpen']) {
		/* don't allow to count popup opening */
		this.setCountPopupOpen(false);
	}
	popup.customEvent = customEvent;
	popup.open();
	this.setPopupObj(popup);

	/* contact form 7 form submission
	 * TODO: this must be moved to a better place in the future
	 * I'm leaving it here for now, since sgpbDidOpen() gets called way too much!
	 */
	var options = SGPBPopup.getPopupOptionsById(popupId);
	SgpbEventListener.CF7EventListener(popupId, options);
	if (typeof options['sgpb-behavior-after-special-events'] != 'undefined') {
		if (options['sgpb-behavior-after-special-events'].length) {
			options = options['sgpb-behavior-after-special-events'][0][0];
			if (options['param'] == 'contact-form-7') {
				SgpbEventListener.processCF7MailSent(popupId, options);
			}
		}
	}
};

SGPBPopup.varToBool = function(optionName)
{
	var returnValue = optionName ? true : false;

	return returnValue;
};

SGPBPopup.hexToRgba = function(hex, opacity)
{
	var c;
	if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){
		c = hex.substring(1).split('');

		if (c.length == 3){
			c= [c[0], c[0], c[1], c[1], c[2], c[2]];
		}
		c = '0x'+c.join('');
		return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+','+opacity+')';
	}
	throw new Error('Bad Hex');
};

SGPBPopup.prototype.contentCopyToClick = function()
{
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();

	var tempInputId = 'content-copy-to-click-'+popupId;
	var value = this.htmlDecode(popupData['sgpb-copy-to-clipboard-text']);
	var tempInput = document.createElement("input");
	tempInput.id = tempInputId;
	tempInput.value = value;
	tempInput.style = 'position: absolute; right: -10000px';
	if (!document.getElementById(tempInputId)) {
		document.body.appendChild(tempInput);
	}
	tempInput.select();
	document.execCommand("copy");
	document.body.removeChild(tempInput);
};

SGPBPopup.prototype.htmlDecode = function(value)
{
	return jQuery('<textarea/>').html(value).text();
};

SGPBPopup.prototype.findTargetInsideExceptionsList = function(targetName, exceptionList)
{
	var status = false;
	var popupContentMainDiv = document.getElementById('sgpb-popup-dialog-main-div');

	while (targetName.parentNode) {
		targetName = targetName.parentNode;
		if (typeof targetName.tagName == 'undefined') {
			continue;
		}
		var tagName = targetName.tagName.toLowerCase();
		if (targetName === popupContentMainDiv) {
			break;
		}
		if (exceptionList.indexOf(tagName) != -1) {
			status =  true;
			break;
		}
	}

	return status;
};

SGPBPopup.prototype.contentCloseBehavior = function()
{
	var that = this;
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();
	var redirectUrl = popupData['sgpb-click-redirect-to-url'];
	var contentClickBehavior = popupData['sgpb-content-click-behavior'];
	var redirectToNewTab = SGPBPopup.varToBool(popupData['sgpb-redirect-to-new-tab']);
	var closePopupAfterCopy = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-close-popup']);
	var clipboardAlert = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-alert']);

	var separators = ['&amp;', '/&/g'];
	for (var i in separators) {
		redirectUrl = redirectUrl.split(separators[i]).join('&');
	}

	sgAddEvent(window, 'sgpbDidOpen', function(e) {

	});
	sgAddEvent(window, 'sgpbWillOpen', function(e) {
		if (popupId != e.detail.popupId || e.detail.popupData['sgpb-content-click'] == 'undefined') {
			return false;
		}
		if (contentClickBehavior == 'redirect') {
			jQuery('.sgpb-content-'+popupId).addClass('sgpb-cursor-pointer');
		}
		jQuery('.sgpb-content-'+e.detail.popupId).on('click', function(event) {
			/* we need this settings in analytics */
			var settings = {
				popupId: popupId,
				eventName: 'sgpbPopupContentClick'
			};
			jQuery(window).trigger('sgpbPopupContentClick', settings);

			if (contentClickBehavior == 'redirect') {
				if (redirectToNewTab) {
					window.open(redirectUrl);
					SGPBPopup.closePopupById(that.getPopupId());
					return;
				}
				window.location = redirectUrl;
				SGPBPopup.closePopupById(that.getPopupId());
			}
			else if (contentClickBehavior == 'copy') {
				var exceptionList = ['input', 'textarea', 'select', 'button', 'a'];
				var targetName = event.target.tagName.toLowerCase();
				var parentTagName = event.target.parentNode.tagName.toLowerCase();
				var parentsIsInExceptionsList = that.findTargetInsideExceptionsList(event.target, exceptionList);

				/*for do not copy when user click to any input element*/
				if (exceptionList.indexOf(targetName) == -1 && !parentsIsInExceptionsList) {
					that.contentCopyToClick();

					if (closePopupAfterCopy) {
						SGPBPopup.closePopupById(that.getPopupId());
					}
					if (clipboardAlert) {
						alert(popupData['sgpb-copy-to-clipboard-message'])
					}
				}
			}
			else if (popupData['sgpb-disable-popup-closing'] != 'on') {
				SGPBPopup.closePopupById(that.getPopupId());
			}
		});
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {

	});
};

SGPBPopup.prototype.addFixedPosition = function()
{
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();
	var popupConfig = this.getPopupConfig();

	var fixedPosition = popupData['sgpb-popup-fixed-position'];
	var positionRight = '';
	var positionTop = '';
	var positionBottom = '';
	var positionLeft = '';

	if (fixedPosition == 1) {
		positionTop = 40;
		positionLeft = 20;
	}
	else if (fixedPosition == 2) {
		positionLeft = 'center';
		positionTop = 40;
	}
	else if (fixedPosition == 3) {
		positionTop = 40;
		positionRight = 20;
	}
	else if (fixedPosition == 4) {
		positionTop = 'center';
		positionLeft = 20;
	}
	else if (fixedPosition == 6) {
		positionTop = 'center';
		positionRight = 20;
	}
	else if (fixedPosition == 7) {
		positionLeft = 20;
		positionBottom = 2;
	}
	else if (fixedPosition == 8) {
		positionLeft = 'center';
		positionBottom = 2;
	}
	else if (fixedPosition == 9) {
		positionRight = 20;
		positionBottom = 2;
	}

	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupData['sgpb-type'] == SgpbRecentSalesPopupType) {
			if (positionTop != '') {
				positionTop = parseInt(positionTop+10);
			}
			else if (positionBottom != '') {
				positionBottom = parseInt(positionBottom+10);
			}
		}
	}
	popupConfig.magicCall('setPositionTop', positionTop);
	popupConfig.magicCall('setPositionRight', positionRight);
	popupConfig.magicCall('setPositionBottom', positionBottom);
	popupConfig.magicCall('setPositionLeft', positionLeft);
};

SGPBPopup.prototype.setPopupDimensions = function()
{
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();
	var popupId = this.getPopupId();
	var dimensionData = popupData['sgpb-popup-dimension-mode'];
	var maxWidth = popupData['sgpb-max-width'];
	var maxHeight = popupData['sgpb-max-height'];
	var minWidth = popupData['sgpb-min-width'];
	var minHeight = popupData['sgpb-min-height'];
	var contentPadding = popupData['sgpb-content-padding'];
	var popupType = popupData['sgpb-type'];

	popupConfig.magicCall('setMaxWidth', maxWidth);
	popupConfig.magicCall('setMaxHeight', maxHeight);
	popupConfig.magicCall('setMinWidth', minWidth);
	popupConfig.magicCall('setMinHeight', minHeight);

	if (popupType == 'image') {
		popupConfig.magicCall('setContentBackgroundImage', popupData['sgpb-image-url']);
		popupConfig.magicCall('setContentBackgroundMode', 'contain');
		if (dimensionData == 'customMode') {
			popupConfig.magicCall('setContentBackgroundPosition', 'center center');
		}
	}
	if (dimensionData == 'responsiveMode') {
		var dimensionMeasure = popupData['sgpb-responsive-dimension-measure'];
		/* for image popup type and responsive mode, set background image to fit */
		if (popupType == 'image' && dimensionMeasure != 'fullScreen') {
			popupConfig.magicCall('setContentBackgroundMode', 'fit');
			this.setMaxWidthForResponsiveImage();
		}

		var popupConfig = this.getPopupConfig();
		if (dimensionMeasure != 'auto') {
			popupConfig.magicCall('setWidth', dimensionMeasure+'%');

			popupConfig.magicCall('setContentBackgroundPosition', 'center');
		}
		else {
			var widthToSet = jQuery('.sgpb-popup-builder-content-'+popupId).width() + (contentPadding*2);

			if (isNaN(widthToSet)) {
				widthToSet = 'auto';
			}
			else {
				popupConfig.magicCall('setContentBackgroundPosition', 'center center');
				widthToSet += 'px';
			}

			popupConfig.magicCall('setWidth', widthToSet);
			if (dimensionMeasure == 'fullScreen') {
				popupConfig.magicCall('setHeight', widthToSet);
			}
		}

		return popupConfig;
	}

	var popupWidth = popupData['sgpb-width'];
	var popupHeight = popupData['sgpb-height'];

	popupConfig.magicCall('setWidth', popupWidth);
	popupConfig.magicCall('setHeight', popupHeight);

	return popupConfig;
};

SGPBPopup.prototype.setMaxWidthForResponsiveImage = function()
{
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();
	var dimensionMeasure = popupData['sgpb-responsive-dimension-measure'];

	if (dimensionMeasure != 'auto') {
		var maxWidth = popupData['sgpb-max-width'];
		if (maxWidth == '') {
			popupConfig.magicCall('setMaxWidth', dimensionMeasure+'%');
			return true;
		}
		popupConfig.magicCall('setMaxWidth', dimensionMeasure+'%');
		if (maxWidth.indexOf('%') != '-1') {
			if (parseInt(maxWidth) < dimensionMeasure) {
				popupConfig.magicCall('setMaxWidth', maxWidth);
			}
		}
		else {
			var responsiveMeasureInPx = (dimensionMeasure*window.innerWidth)/100;
			if (maxWidth < responsiveMeasureInPx) {
				popupConfig.magicCall('setMaxWidth', maxWidth);
			}
		}
	}
};
SGPBPopup.JSONParse = function(data){
	return JSON.parse(atob(data, true));
};

// unused function!
SGPBPopup.b64DecodeUnicode = function(str)
{
	var Base64 = {

		/* private property */
		_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

		/* public method for decoding */
		decode : function (input) {
			var output = "";
			var chr1, chr2, chr3;
			var enc1, enc2, enc3, enc4;
			var i = 0;

			input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

			while (i < input.length) {
				enc1 = this._keyStr.indexOf(input.charAt(i++));
				enc2 = this._keyStr.indexOf(input.charAt(i++));
				enc3 = this._keyStr.indexOf(input.charAt(i++));
				enc4 = this._keyStr.indexOf(input.charAt(i++));

				chr1 = (enc1 << 2) | (enc2 >> 4);
				chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
				chr3 = ((enc3 & 3) << 6) | enc4;

				output += String.fromCharCode(chr1);

				if (enc3 != 64) {
					output += String.fromCharCode(chr2);
				}
				if (enc4 != 64) {
					output += String.fromCharCode(chr3);
				}

			}

			output = Base64._utf8_decode(output);

			return output;

		},

		/* private method for UTF-8 decoding */
		_utf8_decode : function (utftext) {
			var string = "";
			var i = 0;
			var c = c1 = c2 = 0;

			while (i < utftext.length) {

				c = utftext.charCodeAt(i);

				if (c < 128) {
					string += String.fromCharCode(c);
					i++;
				}
				else if ((c > 191) && (c < 224)) {
					c2 = utftext.charCodeAt(i+1);
					string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
					i += 2;
				}
				else {
					c2 = utftext.charCodeAt(i+1);
					c3 = utftext.charCodeAt(i+2);
					string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
					i += 3;
				}
			}

			return string;
		}
	};

	return Base64.decode(str);
};

// unused function!
SGPBPopup.unserialize_old = function(data)
{
	data = SGPBPopup.b64DecodeUnicode(data);

	var $global = (typeof window !== 'undefined' ? window : global);

	var utf8Overhead = function(str) {
		var s = str.length;
		for (var i = str.length - 1; i >= 0; i--) {
			var code = str.charCodeAt(i);
			if (code > 0x7f && code <= 0x7ff) {
				s++;
			}
			else if (code > 0x7ff && code <= 0xffff) {
				s += 2;
			}
			/* trail surrogate */
			if (code >= 0xDC00 && code <= 0xDFFF) {
				i--;
			}
		}
		return s - 1;
	};

	var error = function(type, msg, filename, line) {
		throw new $global[type](msg, filename, line);
	};
	var readUntil = function(data, offset, stopchr) {
		var i = 2;
		var buf = [];
		var chr = data.slice(offset, offset + 1);

		while (chr !== stopchr) {
			if ((i + offset) > data.length) {
				error('Error', 'Invalid');
			}
			buf.push(chr);
			chr = data.slice(offset + (i - 1), offset + i);
			i += 1;
		}
		return [buf.length, buf.join('')];
	};
	var readChrs = function(data, offset, length) {
		var i, chr, buf;

		buf = [];
		for (i = 0; i < length; i++) {
			chr = data.slice(offset + (i - 1), offset + i);
			buf.push(chr);
			length -= utf8Overhead(chr);
		}
		return [buf.length, buf.join('')];
	};
	function _unserialize(data, offset) {
		var dtype;
		var dataoffset;
		var keyandchrs;
		var keys;
		var contig;
		var length;
		var array;
		var readdata;
		var readData;
		var ccount;
		var stringlength;
		var i;
		var key;
		var kprops;
		var kchrs;
		var vprops;
		var vchrs;
		var value;
		var chrs = 0;
		var typeconvert = function(x) {
			return x
		};

		if (!offset) {
			offset = 0
		}
		dtype = (data.slice(offset, offset + 1)).toLowerCase();

		dataoffset = offset + 2;

		switch (dtype) {
			case 'i':
				typeconvert = function(x) {
					return parseInt(x, 10);
				};
				readData = readUntil(data, dataoffset, ';');
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 1;
				break;
			case 'b':
				typeconvert = function(x) {
					return parseInt(x, 10) !== 0;
				};
				readData = readUntil(data, dataoffset, ';');
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 1;
				break;
			case 'd':
				typeconvert = function(x) {
					return parseFloat(x);
				};
				readData = readUntil(data, dataoffset, ';');
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 1;
				break;
			case 'n':
				readdata = null;
				break;
			case 's':
				ccount = readUntil(data, dataoffset, ':');
				chrs = ccount[0];
				stringlength = ccount[1];
				dataoffset += chrs + 2;

				readData = readChrs(data, dataoffset + 1, parseInt(stringlength, 10));
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 2;
				if (chrs !== parseInt(stringlength, 10) && chrs !== readdata.length) {
					error('SyntaxError', 'String length mismatch')
				}
				break;
			case 'a':
				readdata = {};

				keyandchrs = readUntil(data, dataoffset, ':');
				chrs = keyandchrs[0];
				keys = keyandchrs[1];
				dataoffset += chrs + 2;

				length = parseInt(keys, 10);
				contig = true;

				for (i = 0; i < length; i++) {
					kprops = _unserialize(data, dataoffset);
					kchrs = kprops[1];
					key = kprops[2];
					dataoffset += kchrs;

					vprops = _unserialize(data, dataoffset);
					vchrs = vprops[1];
					value = vprops[2];
					dataoffset += vchrs;

					if (key !== i) {
						contig = false;
					}

					readdata[key] = value;
				}

				if (contig) {
					array = new Array(length);
					for (i = 0; i < length; i++) {
						array[i] = readdata[i];
					}
					readdata = array;
				}

				dataoffset += 1;
				break;
			default:
				error('SyntaxError', 'Unknown / Unhandled data type(s): ' + dtype);
				break;
		}

		return [dtype, dataoffset - offset, typeconvert(readdata)]
	}

	return _unserialize((data + ''), 0)[2];
};

SGPBPopup.closePopup = function()
{
	var popupObjs = window.sgPopupBuilder;
	var lastPopupObj = this.getLastPopup();

	if (typeof lastPopupObj == 'undefined') {
		return false;
	}

	var popupId = lastPopupObj.popupId;

	SGPBPopup.closePopupById(popupId);
};

SGPBPopup.closePopupById = function(popupId)
{
	var popupObjs = window.sgPopupBuilder;
	if (!popupObjs.length) {
		return;
	}

	for (var i in popupObjs) {

		var currentObj = popupObjs[i];

		if (currentObj.popupId == popupId) {
			var popupObj = popupObjs[i]['popup'];
			if (popupObj) {
				/*Send true argument to don’t count disable popup option*/
				popupObj.close(true);
			}
		}
	}
};

SGPBPopup.getPopupWindowDataById = function(popupId)
{
	var popups = window.sgPopupBuilder;
	var popup = false;

	if (typeof popups == 'undefined' || !popups.length) {
		return popup;
	}

	for (var i in popups) {
		var popupData = popups[i];

		if (popupData.popupId == popupId) {
			popup = popupData;
			break;
		}
	}

	return popup;
};

SGPBPopup.findPopupObjById = function(popupId)
{
	var popup = false;
	var popupData = SGPBPopup.getPopupWindowDataById(popupId);

	if (popupData) {
		popup = popupData['popup'];
	}

	return popup;
};

SGPBPopup.getLastPopup = function()
{
	var popups = window.sgPopupBuilder;
	var popup = false;

	if (!popups.length) {
		return popup;
	}

	var searchPopups = [].concat(popups);

	for (var i in searchPopups) {
		var popupData = searchPopups[i];

		if (popupData.isOpen) {
			popup = popupData;
			break;
		}
	}

	return popup;
};

SGPBPopup.offPopup = function(currentPopup)
{
	var popups = window.sgPopupBuilder;

	if (!popups.length) {
		return false;
	}

	for (var i in popups) {
		var popupData = popups[i];

		if (popupData.order == currentPopup.order && popupData.eventName == currentPopup.eventName) {
			popups[i]['isOpen'] = false;
			break;
		}
	}

	return true;
};

SGPBPopup.capitalizeFirstLetter = function(string)
{
	return string.charAt(0).toUpperCase() + string.slice(1);
};

SGPBPopup.getParamFromUrl = function(param)
{
	var url = window.location.href;
	param = param.replace(/[\[\]]/g, "\\$&");
	var regex = new RegExp("[?&]" + param + "(=([^&#]*)|&|#|$)"),
		results = regex.exec(url);
	if (!results) {
		return null;
	}
	if (!results[2]) {
		return '';
	}
	return decodeURIComponent(results[2].replace(/\+/g, " "));
};

/*
 *
 * SGPBPopup Cookies' settings
 *
 */
SGPBPopup.setCookie = function(cName, cValue, exDays, cPageLevel)
{
	var sameSite = 'Lax';
	var isPreview = SGPBPopup.getParamFromUrl('preview');
	if (isPreview) {
		return false;
	}
	var expirationDate = new Date();
	var cookiePageLevel = '';
	var cookieExpirationData = 1;
	if (!exDays || isNaN(exDays)) {
		if (!exDays && exDays === 0) {
			exDays = 'session';
		}
		else {
			exDays = 365*50;
		}
	}

	if (!Boolean(cPageLevel)) {
		cookiePageLevel = 'path=/;';
	}

	if (exDays == 'session') {
		cookieExpirationData = 0;
	}
	else {
		expirationDate.setDate(parseInt(expirationDate.getDate() + parseInt(exDays)));
		cookieExpirationData = expirationDate.toUTCString();
	}
	var expires = 'expires='+cookieExpirationData;
	if (exDays == -1) {
		expires = '';
	}

	if (!cookieExpirationData) {
		expires = '';
	}

	/* in IE there is no need to specify the path */
	if (SGPBPopup.isIE()) {
		cookiePageLevel = '';
	}

	var value = cValue+((exDays == null) ? ';' : '; '+expires+';'+cookiePageLevel+'; SameSite=' + sameSite);
	document.cookie = cName + '=' + value;
};

SGPBPopup.isIE = function()
{
	ua = navigator.userAgent;
	/* MSIE used to detect old browsers and Trident used to newer ones*/
	var isIe = ua.indexOf('MSIE ') > -1 || ua.indexOf('Trident/') > -1;

	return isIe;
};

SGPBPopup.getCookie = function(cName)
{
	var name = cName + '=';
	var ca = document.cookie.split(';');
	for (var i = 0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == ' ') {
			c = c.substring(1);
		}
		if (c.indexOf(name) == 0) {
			return c.substring(name.length, c.length);
		}
	}

	return '';
};

/*
 *
 * Delete the cookie by expiring it
 *
 */

SGPBPopup.deleteCookie = function(cName, cPath)
{
	if (!cPath) {
		cPath = 'path=/;';
	}

	document.cookie = cName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;' + cPath;
};

/**
 *
 * @SgpbEventListener listen Events and call corresponding events
 *
 */

function SgpbEventListener()
{
	this.evenets = null;
	this.popupObj = {};
}

SgpbEventListener.inactivityIdicator = 0;

SgpbEventListener.prototype.setEvents = function(events)
{
	this.evenets = events;
};

SgpbEventListener.prototype.getEvents = function()
{
	return this.evenets;
};

SgpbEventListener.prototype.setPopupObj = function(popupObj)
{
	this.popupObj = popupObj;
};

SgpbEventListener.prototype.getPopupObj = function()
{
	return this.popupObj;
};

SgpbEventListener.eventsListenerAfterDocumentReady = function()
{
	window.SGPB_SOUND = [];

	sgAddEvent(window, 'sgpbDidOpen', function(e) {

		//Modern browsers block autoplay with sound unless the user has interacted with the page
		//SGPBPopup.playMusic(e);

		const pbsgsoundnotification = document.querySelector("#pbsgsoundnotification");
		if (pbsgsoundnotification) {
	       pbsgsoundnotification.addEventListener("click", () => {
	            SGPBPopup.playMusic(e);
	            pbsgsoundnotification.classList.add("fade");
	        });
	    }
	});

	

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		var args = e.detail;
		var popupId = parseInt(args.popupId);
		if (typeof window.SGPB_SOUND[popupId] && window.SGPB_SOUND[popupId]) {
			window.SGPB_SOUND[popupId].pause();
			delete window.SGPB_SOUND[popupId];
		}
	});
};

SgpbEventListener.init = function()
{
	SgpbEventListener.eventsListenerAfterDocumentReady();
	var popupsData = jQuery('.sg-popup-builder-content');

	if (!popupsData) {
		return '';
	}

	var that = this;

	popupsData.each(function() {
		var popupObj = that.popupObjCreator(jQuery(this));
		SGPBPopup.floatingButton(popupObj);
	});
};

SgpbEventListener.popupObjCreator = function(currentData)
{
	var popupId = currentData.data('id');
	var popupData = currentData.data('options');

	var events = currentData.attr('data-events');
	events = jQuery.parseJSON(events);

	SgpbEventListener.reopenAfterFormSubmission(popupData);

	var popupObj = new SGPBPopup();
	popupObj.setPopupId(popupId);
	popupObj.setPopupData(popupData);

	for (var i in events) {
		var obj = new this;
		obj.setPopupObj(popupObj);
		obj.eventListener(events[i]);
	}

	return popupObj;
};

SgpbEventListener.prototype.eventListener = function(eventData)
{
	if (eventData == null) {
		return '';
	}
	var event = '';
	if (typeof eventData == 'string') {
		event = eventData;
	}
	else if (typeof eventData.param != 'undefined') {
		event = eventData.param;
	}

	if (!event) {
		return false;
	}

	var popupObj = this.getPopupObj();
	var popupData = popupObj.getPopupData();

	if (eventData.value == '') {
		eventData.value = popupData['sgpb-popup-delay'];
	}

	var eventName = SGPBPopup.capitalizeFirstLetter(event);

	eventName = 'sgpb'+eventName;
	popupObj.eventName = eventName;

	var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);

	if (!allowToOpen) {
		return false;
	}
	try {
		eval('this.'+eventName)(this, eventData);
	}
	catch (err) {
		console.log(err)
	}

};

SgpbEventListener.reopenAfterFormSubmission = function(eventData)
{
	var popupId = SGPBPopup.getCookie('SGPBSubmissionReloadPopup');
	popupId = parseInt(popupId);

	if (!popupId) {
		return false;
	}
	var popupObj = SGPBPopup.createPopupObjById(popupId);
	if (!popupObj) {
		return false;
	}
	var options = popupObj.getPopupData();

	if (!options['sgpb-reopen-after-form-submission']) {
		return false;
	}

	popupObj.prepareOpen();
	SGPBPopup.deleteCookie('SGPBSubmissionReloadPopup');
};

SgpbEventListener.prototype.sgpbLoad = function(listenerObj, eventData)
{
	var timeout = parseInt(eventData.value);
	var popupObj = listenerObj.getPopupObj();
	var popupOptions = popupObj.getPopupData();
	timeout *= 1000;
	var timerId,
		repetitiveTimeout = null;


	/* same as checkCurrentPopupType(), but it fires ignoring any delay (etc. onload delay) */
	popupObj.forceCheckCurrentPopupType(popupObj);


	var openOnLoadPopup = function() {
		setTimeout(function() {
			jQuery(window).trigger('sgpbLoadEvent', popupOptions);
			popupObj.prepareOpen();
		}, timeout);
	};
	sgAddEvent(window, 'load', openOnLoadPopup(timeout, popupObj));
	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		var args = e.detail;
		clearInterval(repetitiveTimeout);
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		var args = e.detail;
		var options = popupObj.getPopupData();
		if (SGPBPopup.varToBool(eventData['repetitive'])) {
			var intervalTime = parseInt(eventData['value'])*1000;
			repetitiveTimeout = setInterval(function() {
				popupObj.prepareOpen();
			}, intervalTime);
		}
	});
};

SgpbEventListener.prototype.timerIncrement = function(listenerObj , idleInterval)
{
	var lastActivity = SgpbEventListener.inactivityIdicator;

	if (lastActivity == 0) {
		clearInterval(idleInterval);
		listenerObj.getPopupObj().prepareOpen();
	}
	SgpbEventListener.inactivityIdicator = 0;
};

SgpbEventListener.prototype.sgpbInsideclick = function(listenerObj, eventData)
{
	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		var args = e.detail;
		var that = listenerObj;
		var popupObj = that.getPopupObj();
		var popupId = parseInt(popupObj.id);
		var targetClick = jQuery('.sgpb-content .sgpb-popup-id-'+popupId);

		if (!targetClick.length) {
			return false;
		}

		targetClick.each(function() {
			jQuery(this).unbind('click').bind('click', function() {
				var dontCloseCurrentPopup = jQuery(this).attr('dontCloseCurrentPopup');
				if (typeof dontCloseCurrentPopup == 'undefined' || dontCloseCurrentPopup != 'on') {
					SGPBPopup.closePopup();
				}
				popupObj.prepareOpen();
			});
		});
	});
};

SgpbEventListener.prototype.sgpbClick = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupIds = [];
	var popupObj = that.getPopupObj();
	var popupOptions = popupObj.getPopupData();
	var popupId = parseInt(popupObj.id);
	popupIds.push(popupId);
	var mapId = listenerObj.filterPopupId(popupId);
	popupIds.push(mapId);
	if (jQuery.inArray(mapId, popupIds) === -1) {
		popupIds.push(mapId);
	}

	for(var key in popupIds) {
		var popupId = popupIds[key];
		if (!popupIds.hasOwnProperty(key)) {
			return false;
		}
		var targetClick = jQuery('a[href*="#sg-popup-id-' + popupId + '"], .sg-popup-id-' + popupId + ', .sgpb-popup-id-' + popupId);

		if (typeof eventData.operator != 'undefined' && eventData.operator == 'clickActionCustomClass') {
			targetClick = jQuery('a[href*="#sg-popup-id-' + popupId + '"], .sg-popup-id-' + popupId + ', .sgpb-popup-id-' + popupId+', .'+eventData.value);
		}
		if (!targetClick.length) {
			continue;
		}
		var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;
		var clickCount = 1;
		targetClick.each(function() {

			if (!jQuery(this).attr('data-popup-id')) {
				jQuery(this).attr('data-popup-id', popupId);
			}
			var currentTarget = jQuery(this);
			currentTarget.bind('swipe', function(e) {
				return false;
			});
			currentTarget.bind('click', function(e) {
				if (clickCount > 1) {
					return true;
				}

				var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);
				if (!allowToOpen) {
					return true;
				}
				++clickCount;
				jQuery(window).trigger('sgpbClickEvent', popupOptions);
				var popupId = jQuery(this).data('popup-id');
				setTimeout(function() {

					var popupObj = SGPBPopup.createPopupObjById(popupId);
					if (!popupObj) {
						var mapId = listenerObj.filterPopupId(popupId);
						popupObj = SGPBPopup.createPopupObjById(mapId);
					}
					popupObj.customEvent = 'Click';
					popupObj.prepareOpen();
					clickCount = 1;
				}, delay);

				return false;
			});
		});
	}
};

SgpbEventListener.prototype.sgpbHover = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupObj = that.getPopupObj();

	if (!popupObj) {
		return false;
	}
	var popupIds = [];
	var popupOptions = popupObj.getPopupData();
	var popupId = parseInt(popupObj.id);
	popupIds.push(popupId);
	var mapId = listenerObj.filterPopupId(popupId);
	if (jQuery.inArray(mapId, popupIds) === -1) {
		popupIds.push(mapId);
	}

	for(var key in popupIds) {
		var popupId = popupIds[key];
		if (!popupIds.hasOwnProperty(key)) {
			return false;
		}

		var hoverSelector = jQuery('.sg-popup-hover-' + popupId + ', .sgpb-popup-id-' + popupId + '[data-popup-event="hover"]');

		if (typeof eventData.operator != 'undefined' && eventData.operator == 'hoverActionCustomClass') {
			hoverSelector = jQuery('.sg-popup-hover-' + popupId + ', .sgpb-popup-id-' + popupId + '[data-popup-event="hover"]'+', .'+eventData.value);
		}

		if (!hoverSelector) {
			return false;
		}
		var hoverCount = 1;
		var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;

		hoverSelector.each(function () {
			if (!jQuery(this).attr('data-popup-id')) {
				jQuery(this).attr('data-popup-id', popupId);
			}
			jQuery(this).bind('mouseenter', function() {
				if (hoverCount > 1) {
					return false;
				}
				++hoverCount;
				var popupId = jQuery(this).data('popup-id');
				jQuery(window).trigger('sgpbHoverEvent', popupOptions);
				setTimeout(function() {
					var popupObj = SGPBPopup.createPopupObjById(popupId);
					if (!popupObj) {
						var mapId = listenerObj.filterPopupId(popupId);
						popupObj = SGPBPopup.createPopupObjById(mapId);
					}
					popupObj.customEvent = 'Hover';
					popupObj.prepareOpen();
					hoverCount = 1;
				}, delay);
			});
		});
	}
};

SgpbEventListener.prototype.sgpbConfirm = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupObj = that.getPopupObj();

	if (!popupObj) {
		return false;
	}
	var popupIds = [];
	var popupOptions = popupObj.getPopupData();
	var popupId = parseInt(popupObj.id);
	popupIds.push(popupId);
	var mapId = listenerObj.filterPopupId(popupId);
	popupIds.push(mapId);

	for(var key in popupIds) {
		var popupId = popupIds[key];
		if (!popupIds.hasOwnProperty(key)) {
			return false;
		}

		var confirmSelector = jQuery('.sg-confirm-popup-' + popupId);

		if (!confirmSelector) {
			return false;
		}
		var confirmCount = 1;

		confirmSelector.bind('click', function(e) {
			if (confirmCount > 1) {
				return false;
			}
			++confirmCount;
			var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);

			if (!allowToOpen) {
				return true;
			}
			jQuery(window).trigger('sgpbConfirmEvent', popupOptions);
			var target = jQuery(this).attr('target');

			if (typeof target == 'undefined') {
				target = 'self';
			}
			var href = jQuery(this).attr('href');
			var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;
			setTimeout(function() {
				if (typeof href != 'undefined') {
					popupOptions['sgpb-confirm-' + popupId] = {'target' : target, 'href' : href};
					popupObj.setPopupData(popupOptions);
				}
				popupObj.prepareOpen();
				confirmCount = 1;
			}, delay);

			return false;
		});

		sgAddEvent(window, 'sgpbDidClose', function(e) {
			var args = e.detail;
			var popupId = parseInt(args.popupId);
			var popupOptions = args.popupData;

			if (typeof popupOptions['sgpb-confirm-' + popupId] != 'undefined') {
				var confirmAgrs = popupOptions['sgpb-confirm-' + popupId];

				if (confirmAgrs['target'] == '_blank') {
					window.open(confirmAgrs['href']);
				}
				else {
					window.location.href = confirmAgrs['href'];
				}

				delete popupOptions['sgpb-confirm-' + popupId];
				popupObj.setPopupData(popupOptions);
			}
		});
	}
};

SgpbEventListener.prototype.sgpbAttronload = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupObj = that.getPopupObj();
	var popupId = parseInt(popupObj.id);
	popupId = listenerObj.filterPopupId(popupId);
	var popupOptions = popupObj.getPopupData();
	var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;
	jQuery(window).trigger('sgpbAttronloadEvent', popupOptions);

	setTimeout(function() {
		popupObj.prepareOpen();
	}, delay);
};

/*for the old popups*/
SgpbEventListener.prototype.filterPopupId = function(popupId)
{
	var convertedIds = SGPB_POPUP_PARAMS.convertedIdsReverse;
	var popupNewId = popupId;
	if (convertedIds[popupId]) {
		return convertedIds[popupId];
	}
	else {
		for(var i in convertedIds) {
			if (popupId == convertedIds[i]) {
				popupNewId = parseInt(i);
				break;
			}
		}
	}

	return popupNewId;
};

SgpbEventListener.findCF7InPopup = function(popupId)
{
	return document.querySelector('#sg-popup-content-wrapper-'+popupId+' .wpcf7');
};

SgpbEventListener.CF7EventListener = function(popupId, options)
{
	var wpcf7Elm = SgpbEventListener.findCF7InPopup(popupId);

	if (wpcf7Elm) {
		wpcf7Elm.addEventListener('wpcf7mailsent', function(event) {
			var settings = {
				popupId: popupId,
				eventName: 'sgpbCF7Success'
			};
			jQuery(window).trigger('sgpbCF7Success', settings);
		});
	}
};

SgpbEventListener.processCF7MailSent = function(popupId, options)
{
	var wpcf7Elm = SgpbEventListener.findCF7InPopup(popupId);

	if (wpcf7Elm) {
		wpcf7Elm.addEventListener('wpcf7mailsent', function(event) {
			if (typeof options['operator'] == 'undefined') {
				return;
			}
			if (options['operator'] == 'close-popup') {
				setTimeout(function() {
					SGPBPopup.closePopupById(popupId);
				}, parseInt(options['value'])*1000);
			}
			else if (options['operator'] == 'redirect-url') {
				window.location.href = options['value'];
			}
			else if (options['operator'] == 'open-popup') {
				SGPBPopup.closePopupById(popupId);
				var popupObj = SGPBPopup.createPopupObjById(Object.keys(options['value'])[0]);
				popupObj.prepareOpen();
			}
		}, false);
	}
};

jQuery(document).ready(function(e) {
	setTimeout(function(){
		SgpbEventListener.init();
		SGPBPopup.listeners();
	}, 1);
});
// source --> https://www.entreprises-montrouge.net/wp-content/themes/Kose-child/bootstrap/js/bootstrap.min.js?ver=7.0 
/*!
  * Bootstrap v5.3.1 (https://getbootstrap.com/)
  * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e(t.Popper)}(this,(function(t){"use strict";function e(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const i=e(t),s=new Map,n={set(t,e,i){s.has(t)||s.set(t,new Map);const n=s.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>s.has(t)&&s.get(t).get(e)||null,remove(t,e){if(!s.has(t))return;const i=s.get(t);i.delete(e),0===i.size&&s.delete(t)}},o="transitionend",r=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,((t,e)=>`#${CSS.escape(e)}`))),t),a=t=>{t.dispatchEvent(new Event(o))},l=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),c=t=>l(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(r(t)):null,h=t=>{if(!l(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},d=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),u=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?u(t.parentNode):null},_=()=>{},g=t=>{t.offsetHeight},f=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,m=[],p=()=>"rtl"===document.documentElement.dir,b=t=>{var e;e=()=>{const e=f();if(e){const i=t.NAME,s=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=s,t.jQueryInterface)}},"loading"===document.readyState?(m.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of m)t()})),m.push(e)):e()},v=(t,e=[],i=t)=>"function"==typeof t?t(...e):i,y=(t,e,i=!0)=>{if(!i)return void v(t);const s=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const s=Number.parseFloat(e),n=Number.parseFloat(i);return s||n?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(e)+5;let n=!1;const r=({target:i})=>{i===e&&(n=!0,e.removeEventListener(o,r),v(t))};e.addEventListener(o,r),setTimeout((()=>{n||a(e)}),s)},w=(t,e,i,s)=>{const n=t.length;let o=t.indexOf(e);return-1===o?!i&&s?t[n-1]:t[0]:(o+=i?1:-1,s&&(o=(o+n)%n),t[Math.max(0,Math.min(o,n-1))])},A=/[^.]*(?=\..*)\.|.*/,E=/\..*/,C=/::\d+$/,T={};let k=1;const $={mouseenter:"mouseover",mouseleave:"mouseout"},S=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function L(t,e){return e&&`${e}::${k++}`||t.uidEvent||k++}function O(t){const e=L(t);return t.uidEvent=e,T[e]=T[e]||{},T[e]}function I(t,e,i=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===i))}function D(t,e,i){const s="string"==typeof e,n=s?i:e||i;let o=M(t);return S.has(o)||(o=t),[s,n,o]}function N(t,e,i,s,n){if("string"!=typeof e||!t)return;let[o,r,a]=D(e,i,s);if(e in $){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=O(t),c=l[a]||(l[a]={}),h=I(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&n);const d=L(r,e.replace(A,"")),u=o?function(t,e,i){return function s(n){const o=t.querySelectorAll(e);for(let{target:r}=n;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return F(n,{delegateTarget:r}),s.oneOff&&j.off(t,n.type,e,i),i.apply(r,[n])}}(t,i,r):function(t,e){return function i(s){return F(s,{delegateTarget:t}),i.oneOff&&j.off(t,s.type,e),e.apply(t,[s])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=n,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function P(t,e,i,s,n){const o=I(e[i],s,n);o&&(t.removeEventListener(i,o,Boolean(n)),delete e[i][o.uidEvent])}function x(t,e,i,s){const n=e[i]||{};for(const[o,r]of Object.entries(n))o.includes(s)&&P(t,e,i,r.callable,r.delegationSelector)}function M(t){return t=t.replace(E,""),$[t]||t}const j={on(t,e,i,s){N(t,e,i,s,!1)},one(t,e,i,s){N(t,e,i,s,!0)},off(t,e,i,s){if("string"!=typeof e||!t)return;const[n,o,r]=D(e,i,s),a=r!==e,l=O(t),c=l[r]||{},h=e.startsWith(".");if(void 0===o){if(h)for(const i of Object.keys(l))x(t,l,i,e.slice(1));for(const[i,s]of Object.entries(c)){const n=i.replace(C,"");a&&!e.includes(n)||P(t,l,r,s.callable,s.delegationSelector)}}else{if(!Object.keys(c).length)return;P(t,l,r,o,n?i:null)}},trigger(t,e,i){if("string"!=typeof e||!t)return null;const s=f();let n=null,o=!0,r=!0,a=!1;e!==M(e)&&s&&(n=s.Event(e,i),s(t).trigger(n),o=!n.isPropagationStopped(),r=!n.isImmediatePropagationStopped(),a=n.isDefaultPrevented());const l=F(new Event(e,{bubbles:o,cancelable:!0}),i);return a&&l.preventDefault(),r&&t.dispatchEvent(l),l.defaultPrevented&&n&&n.preventDefault(),l}};function F(t,e={}){for(const[i,s]of Object.entries(e))try{t[i]=s}catch(e){Object.defineProperty(t,i,{configurable:!0,get:()=>s})}return t}function z(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function H(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}const B={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${H(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${H(e)}`)},getDataAttributes(t){if(!t)return{};const e={},i=Object.keys(t.dataset).filter((t=>t.startsWith("bs")&&!t.startsWith("bsConfig")));for(const s of i){let i=s.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1,i.length),e[i]=z(t.dataset[s])}return e},getDataAttribute:(t,e)=>z(t.getAttribute(`data-bs-${H(e)}`))};class q{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const i=l(e)?B.getDataAttribute(e,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...l(e)?B.getDataAttributes(e):{},..."object"==typeof t?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const[s,n]of Object.entries(e)){const e=t[s],o=l(e)?"element":null==(i=e)?`${i}`:Object.prototype.toString.call(i).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(n).test(o))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${s}" provided type "${o}" but expected type "${n}".`)}var i}}class W extends q{constructor(t,e){super(),(t=c(t))&&(this._element=t,this._config=this._getConfig(e),n.set(this._element,this.constructor.DATA_KEY,this))}dispose(){n.remove(this._element,this.constructor.DATA_KEY),j.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,i=!0){y(t,e,i)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(t){return n.get(c(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.3.1"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}const R=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return r(e)},K={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let s=t.parentNode.closest(e);for(;s;)i.push(s),s=s.parentNode.closest(e);return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(",");return this.find(e,t).filter((t=>!d(t)&&h(t)))},getSelectorFromElement(t){const e=R(t);return e&&K.findOne(e)?e:null},getElementFromSelector(t){const e=R(t);return e?K.findOne(e):null},getMultipleElementsFromSelector(t){const e=R(t);return e?K.find(e):[]}},V=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;j.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),d(this))return;const n=K.getElementFromSelector(this)||this.closest(`.${s}`);t.getOrCreateInstance(n)[e]()}))},Q=".bs.alert",X=`close${Q}`,Y=`closed${Q}`;class U extends W{static get NAME(){return"alert"}close(){if(j.trigger(this._element,X).defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),j.trigger(this._element,Y),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=U.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}V(U,"close"),b(U);const G='[data-bs-toggle="button"]';class J extends W{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){const e=J.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}j.on(document,"click.bs.button.data-api",G,(t=>{t.preventDefault();const e=t.target.closest(G);J.getOrCreateInstance(e).toggle()})),b(J);const Z=".bs.swipe",tt=`touchstart${Z}`,et=`touchmove${Z}`,it=`touchend${Z}`,st=`pointerdown${Z}`,nt=`pointerup${Z}`,ot={endCallback:null,leftCallback:null,rightCallback:null},rt={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class at extends q{constructor(t,e){super(),this._element=t,t&&at.isSupported()&&(this._config=this._getConfig(e),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return ot}static get DefaultType(){return rt}static get NAME(){return"swipe"}dispose(){j.off(this._element,Z)}_start(t){this._supportPointerEvents?this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX):this._deltaX=t.touches[0].clientX}_end(t){this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX-this._deltaX),this._handleSwipe(),v(this._config.endCallback)}_move(t){this._deltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this._deltaX}_handleSwipe(){const t=Math.abs(this._deltaX);if(t<=40)return;const e=t/this._deltaX;this._deltaX=0,e&&v(e>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(j.on(this._element,st,(t=>this._start(t))),j.on(this._element,nt,(t=>this._end(t))),this._element.classList.add("pointer-event")):(j.on(this._element,tt,(t=>this._start(t))),j.on(this._element,et,(t=>this._move(t))),j.on(this._element,it,(t=>this._end(t))))}_eventIsPointerPenTouch(t){return this._supportPointerEvents&&("pen"===t.pointerType||"touch"===t.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const lt=".bs.carousel",ct=".data-api",ht="next",dt="prev",ut="left",_t="right",gt=`slide${lt}`,ft=`slid${lt}`,mt=`keydown${lt}`,pt=`mouseenter${lt}`,bt=`mouseleave${lt}`,vt=`dragstart${lt}`,yt=`load${lt}${ct}`,wt=`click${lt}${ct}`,At="carousel",Et="active",Ct=".active",Tt=".carousel-item",kt=Ct+Tt,$t={ArrowLeft:_t,ArrowRight:ut},St={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},Lt={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class Ot extends W{constructor(t,e){super(t,e),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=K.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===At&&this.cycle()}static get Default(){return St}static get DefaultType(){return Lt}static get NAME(){return"carousel"}next(){this._slide(ht)}nextWhenVisible(){!document.hidden&&h(this._element)&&this.next()}prev(){this._slide(dt)}pause(){this._isSliding&&a(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?j.one(this._element,ft,(()=>this.cycle())):this.cycle())}to(t){const e=this._getItems();if(t>e.length-1||t<0)return;if(this._isSliding)return void j.one(this._element,ft,(()=>this.to(t)));const i=this._getItemIndex(this._getActive());if(i===t)return;const s=t>i?ht:dt;this._slide(s,e[t])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(t){return t.defaultInterval=t.interval,t}_addEventListeners(){this._config.keyboard&&j.on(this._element,mt,(t=>this._keydown(t))),"hover"===this._config.pause&&(j.on(this._element,pt,(()=>this.pause())),j.on(this._element,bt,(()=>this._maybeEnableCycle()))),this._config.touch&&at.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const t of K.find(".carousel-item img",this._element))j.on(t,vt,(t=>t.preventDefault()));const t={leftCallback:()=>this._slide(this._directionToOrder(ut)),rightCallback:()=>this._slide(this._directionToOrder(_t)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),500+this._config.interval))}};this._swipeHelper=new at(this._element,t)}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=$t[t.key];e&&(t.preventDefault(),this._slide(this._directionToOrder(e)))}_getItemIndex(t){return this._getItems().indexOf(t)}_setActiveIndicatorElement(t){if(!this._indicatorsElement)return;const e=K.findOne(Ct,this._indicatorsElement);e.classList.remove(Et),e.removeAttribute("aria-current");const i=K.findOne(`[data-bs-slide-to="${t}"]`,this._indicatorsElement);i&&(i.classList.add(Et),i.setAttribute("aria-current","true"))}_updateInterval(){const t=this._activeElement||this._getActive();if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);this._config.interval=e||this._config.defaultInterval}_slide(t,e=null){if(this._isSliding)return;const i=this._getActive(),s=t===ht,n=e||w(this._getItems(),i,s,this._config.wrap);if(n===i)return;const o=this._getItemIndex(n),r=e=>j.trigger(this._element,e,{relatedTarget:n,direction:this._orderToDirection(t),from:this._getItemIndex(i),to:o});if(r(gt).defaultPrevented)return;if(!i||!n)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=n;const l=s?"carousel-item-start":"carousel-item-end",c=s?"carousel-item-next":"carousel-item-prev";n.classList.add(c),g(n),i.classList.add(l),n.classList.add(l),this._queueCallback((()=>{n.classList.remove(l,c),n.classList.add(Et),i.classList.remove(Et,c,l),this._isSliding=!1,r(ft)}),i,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return K.findOne(kt,this._element)}_getItems(){return K.find(Tt,this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(t){return p()?t===ut?dt:ht:t===ut?ht:dt}_orderToDirection(t){return p()?t===dt?ut:_t:t===dt?_t:ut}static jQueryInterface(t){return this.each((function(){const e=Ot.getOrCreateInstance(this,t);if("number"!=typeof t){if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}else e.to(t)}))}}j.on(document,wt,"[data-bs-slide], [data-bs-slide-to]",(function(t){const e=K.getElementFromSelector(this);if(!e||!e.classList.contains(At))return;t.preventDefault();const i=Ot.getOrCreateInstance(e),s=this.getAttribute("data-bs-slide-to");return s?(i.to(s),void i._maybeEnableCycle()):"next"===B.getDataAttribute(this,"slide")?(i.next(),void i._maybeEnableCycle()):(i.prev(),void i._maybeEnableCycle())})),j.on(window,yt,(()=>{const t=K.find('[data-bs-ride="carousel"]');for(const e of t)Ot.getOrCreateInstance(e)})),b(Ot);const It=".bs.collapse",Dt=`show${It}`,Nt=`shown${It}`,Pt=`hide${It}`,xt=`hidden${It}`,Mt=`click${It}.data-api`,jt="show",Ft="collapse",zt="collapsing",Ht=`:scope .${Ft} .${Ft}`,Bt='[data-bs-toggle="collapse"]',qt={parent:null,toggle:!0},Wt={parent:"(null|element)",toggle:"boolean"};class Rt extends W{constructor(t,e){super(t,e),this._isTransitioning=!1,this._triggerArray=[];const i=K.find(Bt);for(const t of i){const e=K.getSelectorFromElement(t),i=K.find(e).filter((t=>t===this._element));null!==e&&i.length&&this._triggerArray.push(t)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return qt}static get DefaultType(){return Wt}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((t=>t!==this._element)).map((t=>Rt.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(j.trigger(this._element,Dt).defaultPrevented)return;for(const e of t)e.hide();const e=this._getDimension();this._element.classList.remove(Ft),this._element.classList.add(zt),this._element.style[e]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${e[0].toUpperCase()+e.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(zt),this._element.classList.add(Ft,jt),this._element.style[e]="",j.trigger(this._element,Nt)}),this._element,!0),this._element.style[e]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(j.trigger(this._element,Pt).defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,g(this._element),this._element.classList.add(zt),this._element.classList.remove(Ft,jt);for(const t of this._triggerArray){const e=K.getElementFromSelector(t);e&&!this._isShown(e)&&this._addAriaAndCollapsedClass([t],!1)}this._isTransitioning=!0,this._element.style[t]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(zt),this._element.classList.add(Ft),j.trigger(this._element,xt)}),this._element,!0)}_isShown(t=this._element){return t.classList.contains(jt)}_configAfterMerge(t){return t.toggle=Boolean(t.toggle),t.parent=c(t.parent),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=this._getFirstLevelChildren(Bt);for(const e of t){const t=K.getElementFromSelector(e);t&&this._addAriaAndCollapsedClass([e],this._isShown(t))}}_getFirstLevelChildren(t){const e=K.find(Ht,this._config.parent);return K.find(t,this._config.parent).filter((t=>!e.includes(t)))}_addAriaAndCollapsedClass(t,e){if(t.length)for(const i of t)i.classList.toggle("collapsed",!e),i.setAttribute("aria-expanded",e)}static jQueryInterface(t){const e={};return"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1),this.each((function(){const i=Rt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}}j.on(document,Mt,Bt,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();for(const t of K.getMultipleElementsFromSelector(this))Rt.getOrCreateInstance(t,{toggle:!1}).toggle()})),b(Rt);const Kt="dropdown",Vt=".bs.dropdown",Qt=".data-api",Xt="ArrowUp",Yt="ArrowDown",Ut=`hide${Vt}`,Gt=`hidden${Vt}`,Jt=`show${Vt}`,Zt=`shown${Vt}`,te=`click${Vt}${Qt}`,ee=`keydown${Vt}${Qt}`,ie=`keyup${Vt}${Qt}`,se="show",ne='[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)',oe=`${ne}.${se}`,re=".dropdown-menu",ae=p()?"top-end":"top-start",le=p()?"top-start":"top-end",ce=p()?"bottom-end":"bottom-start",he=p()?"bottom-start":"bottom-end",de=p()?"left-start":"right-start",ue=p()?"right-start":"left-start",_e={autoClose:!0,boundary:"clippingParents",display:"dynamic",offset:[0,2],popperConfig:null,reference:"toggle"},ge={autoClose:"(boolean|string)",boundary:"(string|element)",display:"string",offset:"(array|string|function)",popperConfig:"(null|object|function)",reference:"(string|element|object)"};class fe extends W{constructor(t,e){super(t,e),this._popper=null,this._parent=this._element.parentNode,this._menu=K.next(this._element,re)[0]||K.prev(this._element,re)[0]||K.findOne(re,this._parent),this._inNavbar=this._detectNavbar()}static get Default(){return _e}static get DefaultType(){return ge}static get NAME(){return Kt}toggle(){return this._isShown()?this.hide():this.show()}show(){if(d(this._element)||this._isShown())return;const t={relatedTarget:this._element};if(!j.trigger(this._element,Jt,t).defaultPrevented){if(this._createPopper(),"ontouchstart"in document.documentElement&&!this._parent.closest(".navbar-nav"))for(const t of[].concat(...document.body.children))j.on(t,"mouseover",_);this._element.focus(),this._element.setAttribute("aria-expanded",!0),this._menu.classList.add(se),this._element.classList.add(se),j.trigger(this._element,Zt,t)}}hide(){if(d(this._element)||!this._isShown())return;const t={relatedTarget:this._element};this._completeHide(t)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}update(){this._inNavbar=this._detectNavbar(),this._popper&&this._popper.update()}_completeHide(t){if(!j.trigger(this._element,Ut,t).defaultPrevented){if("ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))j.off(t,"mouseover",_);this._popper&&this._popper.destroy(),this._menu.classList.remove(se),this._element.classList.remove(se),this._element.setAttribute("aria-expanded","false"),B.removeDataAttribute(this._menu,"popper"),j.trigger(this._element,Gt,t)}}_getConfig(t){if("object"==typeof(t=super._getConfig(t)).reference&&!l(t.reference)&&"function"!=typeof t.reference.getBoundingClientRect)throw new TypeError(`${Kt.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);return t}_createPopper(){if(void 0===i)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");let t=this._element;"parent"===this._config.reference?t=this._parent:l(this._config.reference)?t=c(this._config.reference):"object"==typeof this._config.reference&&(t=this._config.reference);const e=this._getPopperConfig();this._popper=i.createPopper(t,this._menu,e)}_isShown(){return this._menu.classList.contains(se)}_getPlacement(){const t=this._parent;if(t.classList.contains("dropend"))return de;if(t.classList.contains("dropstart"))return ue;if(t.classList.contains("dropup-center"))return"top";if(t.classList.contains("dropdown-center"))return"bottom";const e="end"===getComputedStyle(this._menu).getPropertyValue("--bs-position").trim();return t.classList.contains("dropup")?e?le:ae:e?he:ce}_detectNavbar(){return null!==this._element.closest(".navbar")}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(B.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,...v(this._config.popperConfig,[t])}}_selectMenuItem({key:t,target:e}){const i=K.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter((t=>h(t)));i.length&&w(i,e,t===Yt,!i.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=fe.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;const e=K.find(oe);for(const i of e){const e=fe.getInstance(i);if(!e||!1===e._config.autoClose)continue;const s=t.composedPath(),n=s.includes(e._menu);if(s.includes(e._element)||"inside"===e._config.autoClose&&!n||"outside"===e._config.autoClose&&n)continue;if(e._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const o={relatedTarget:e._element};"click"===t.type&&(o.clickEvent=t),e._completeHide(o)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),i="Escape"===t.key,s=[Xt,Yt].includes(t.key);if(!s&&!i)return;if(e&&!i)return;t.preventDefault();const n=this.matches(ne)?this:K.prev(this,ne)[0]||K.next(this,ne)[0]||K.findOne(ne,t.delegateTarget.parentNode),o=fe.getOrCreateInstance(n);if(s)return t.stopPropagation(),o.show(),void o._selectMenuItem(t);o._isShown()&&(t.stopPropagation(),o.hide(),n.focus())}}j.on(document,ee,ne,fe.dataApiKeydownHandler),j.on(document,ee,re,fe.dataApiKeydownHandler),j.on(document,te,fe.clearMenus),j.on(document,ie,fe.clearMenus),j.on(document,te,ne,(function(t){t.preventDefault(),fe.getOrCreateInstance(this).toggle()})),b(fe);const me="backdrop",pe="show",be=`mousedown.bs.${me}`,ve={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},ye={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class we extends q{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return ve}static get DefaultType(){return ye}static get NAME(){return me}show(t){if(!this._config.isVisible)return void v(t);this._append();const e=this._getElement();this._config.isAnimated&&g(e),e.classList.add(pe),this._emulateAnimation((()=>{v(t)}))}hide(t){this._config.isVisible?(this._getElement().classList.remove(pe),this._emulateAnimation((()=>{this.dispose(),v(t)}))):v(t)}dispose(){this._isAppended&&(j.off(this._element,be),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=c(t.rootElement),t}_append(){if(this._isAppended)return;const t=this._getElement();this._config.rootElement.append(t),j.on(t,be,(()=>{v(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(t){y(t,this._getElement(),this._config.isAnimated)}}const Ae=".bs.focustrap",Ee=`focusin${Ae}`,Ce=`keydown.tab${Ae}`,Te="backward",ke={autofocus:!0,trapElement:null},$e={autofocus:"boolean",trapElement:"element"};class Se extends q{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return ke}static get DefaultType(){return $e}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),j.off(document,Ae),j.on(document,Ee,(t=>this._handleFocusin(t))),j.on(document,Ce,(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,j.off(document,Ae))}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target))return;const i=K.focusableChildren(e);0===i.length?e.focus():this._lastTabNavDirection===Te?i[i.length-1].focus():i[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Te:"forward")}}const Le=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",Oe=".sticky-top",Ie="padding-right",De="margin-right";class Ne{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,Ie,(e=>e+t)),this._setElementAttributes(Le,Ie,(e=>e+t)),this._setElementAttributes(Oe,De,(e=>e-t))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,Ie),this._resetElementAttributes(Le,Ie),this._resetElementAttributes(Oe,De)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const s=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+s)return;this._saveInitialAttribute(t,e);const n=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${i(Number.parseFloat(n))}px`)}))}_saveInitialAttribute(t,e){const i=t.style.getPropertyValue(e);i&&B.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=B.getDataAttribute(t,e);null!==i?(B.removeDataAttribute(t,e),t.style.setProperty(e,i)):t.style.removeProperty(e)}))}_applyManipulationCallback(t,e){if(l(t))e(t);else for(const i of K.find(t,this._element))e(i)}}const Pe=".bs.modal",xe=`hide${Pe}`,Me=`hidePrevented${Pe}`,je=`hidden${Pe}`,Fe=`show${Pe}`,ze=`shown${Pe}`,He=`resize${Pe}`,Be=`click.dismiss${Pe}`,qe=`mousedown.dismiss${Pe}`,We=`keydown.dismiss${Pe}`,Re=`click${Pe}.data-api`,Ke="modal-open",Ve="show",Qe="modal-static",Xe={backdrop:!0,focus:!0,keyboard:!0},Ye={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class Ue extends W{constructor(t,e){super(t,e),this._dialog=K.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new Ne,this._addEventListeners()}static get Default(){return Xe}static get DefaultType(){return Ye}static get NAME(){return"modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||j.trigger(this._element,Fe,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(Ke),this._adjustDialog(),this._backdrop.show((()=>this._showElement(t))))}hide(){this._isShown&&!this._isTransitioning&&(j.trigger(this._element,xe).defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(Ve),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated())))}dispose(){j.off(window,Pe),j.off(this._dialog,Pe),this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new we({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Se({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const e=K.findOne(".modal-body",this._dialog);e&&(e.scrollTop=0),g(this._element),this._element.classList.add(Ve),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,j.trigger(this._element,ze,{relatedTarget:t})}),this._dialog,this._isAnimated())}_addEventListeners(){j.on(this._element,We,(t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():this._triggerBackdropTransition())})),j.on(window,He,(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),j.on(this._element,qe,(t=>{j.one(this._element,Be,(e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(Ke),this._resetAdjustments(),this._scrollBar.reset(),j.trigger(this._element,je)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(j.trigger(this._element,Me).defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._element.style.overflowY;"hidden"===e||this._element.classList.contains(Qe)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(Qe),this._queueCallback((()=>{this._element.classList.remove(Qe),this._queueCallback((()=>{this._element.style.overflowY=e}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;if(i&&!t){const t=p()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!i&&t){const t=p()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=Ue.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}j.on(document,Re,'[data-bs-toggle="modal"]',(function(t){const e=K.getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),j.one(e,Fe,(t=>{t.defaultPrevented||j.one(e,je,(()=>{h(this)&&this.focus()}))}));const i=K.findOne(".modal.show");i&&Ue.getInstance(i).hide(),Ue.getOrCreateInstance(e).toggle(this)})),V(Ue),b(Ue);const Ge=".bs.offcanvas",Je=".data-api",Ze=`load${Ge}${Je}`,ti="show",ei="showing",ii="hiding",si=".offcanvas.show",ni=`show${Ge}`,oi=`shown${Ge}`,ri=`hide${Ge}`,ai=`hidePrevented${Ge}`,li=`hidden${Ge}`,ci=`resize${Ge}`,hi=`click${Ge}${Je}`,di=`keydown.dismiss${Ge}`,ui={backdrop:!0,keyboard:!0,scroll:!1},_i={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class gi extends W{constructor(t,e){super(t,e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return ui}static get DefaultType(){return _i}static get NAME(){return"offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||j.trigger(this._element,ni,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._backdrop.show(),this._config.scroll||(new Ne).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(ei),this._queueCallback((()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(ti),this._element.classList.remove(ei),j.trigger(this._element,oi,{relatedTarget:t})}),this._element,!0))}hide(){this._isShown&&(j.trigger(this._element,ri).defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(ii),this._backdrop.hide(),this._queueCallback((()=>{this._element.classList.remove(ti,ii),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new Ne).reset(),j.trigger(this._element,li)}),this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const t=Boolean(this._config.backdrop);return new we({className:"offcanvas-backdrop",isVisible:t,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:t?()=>{"static"!==this._config.backdrop?this.hide():j.trigger(this._element,ai)}:null})}_initializeFocusTrap(){return new Se({trapElement:this._element})}_addEventListeners(){j.on(this._element,di,(t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():j.trigger(this._element,ai))}))}static jQueryInterface(t){return this.each((function(){const e=gi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}j.on(document,hi,'[data-bs-toggle="offcanvas"]',(function(t){const e=K.getElementFromSelector(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),d(this))return;j.one(e,li,(()=>{h(this)&&this.focus()}));const i=K.findOne(si);i&&i!==e&&gi.getInstance(i).hide(),gi.getOrCreateInstance(e).toggle(this)})),j.on(window,Ze,(()=>{for(const t of K.find(si))gi.getOrCreateInstance(t).show()})),j.on(window,ci,(()=>{for(const t of K.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(t).position&&gi.getOrCreateInstance(t).hide()})),V(gi),b(gi);const fi={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},mi=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),pi=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,bi=(t,e)=>{const i=t.nodeName.toLowerCase();return e.includes(i)?!mi.has(i)||Boolean(pi.test(t.nodeValue)):e.filter((t=>t instanceof RegExp)).some((t=>t.test(i)))},vi={allowList:fi,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"<div></div>"},yi={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},wi={entry:"(string|element|function|null)",selector:"(string|element)"};class Ai extends q{constructor(t){super(),this._config=this._getConfig(t)}static get Default(){return vi}static get DefaultType(){return yi}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map((t=>this._resolvePossibleFunction(t))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(t){return this._checkContent(t),this._config.content={...this._config.content,...t},this}toHtml(){const t=document.createElement("div");t.innerHTML=this._maybeSanitize(this._config.template);for(const[e,i]of Object.entries(this._config.content))this._setContent(t,i,e);const e=t.children[0],i=this._resolvePossibleFunction(this._config.extraClass);return i&&e.classList.add(...i.split(" ")),e}_typeCheckConfig(t){super._typeCheckConfig(t),this._checkContent(t.content)}_checkContent(t){for(const[e,i]of Object.entries(t))super._typeCheckConfig({selector:e,entry:i},wi)}_setContent(t,e,i){const s=K.findOne(i,t);s&&((e=this._resolvePossibleFunction(e))?l(e)?this._putElementInTemplate(c(e),s):this._config.html?s.innerHTML=this._maybeSanitize(e):s.textContent=e:s.remove())}_maybeSanitize(t){return this._config.sanitize?function(t,e,i){if(!t.length)return t;if(i&&"function"==typeof i)return i(t);const s=(new window.DOMParser).parseFromString(t,"text/html"),n=[].concat(...s.body.querySelectorAll("*"));for(const t of n){const i=t.nodeName.toLowerCase();if(!Object.keys(e).includes(i)){t.remove();continue}const s=[].concat(...t.attributes),n=[].concat(e["*"]||[],e[i]||[]);for(const e of s)bi(e,n)||t.removeAttribute(e.nodeName)}return s.body.innerHTML}(t,this._config.allowList,this._config.sanitizeFn):t}_resolvePossibleFunction(t){return v(t,[this])}_putElementInTemplate(t,e){if(this._config.html)return e.innerHTML="",void e.append(t);e.textContent=t.textContent}}const Ei=new Set(["sanitize","allowList","sanitizeFn"]),Ci="fade",Ti="show",ki=".modal",$i="hide.bs.modal",Si="hover",Li="focus",Oi={AUTO:"auto",TOP:"top",RIGHT:p()?"left":"right",BOTTOM:"bottom",LEFT:p()?"right":"left"},Ii={allowList:fi,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,6],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',title:"",trigger:"hover focus"},Di={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class Ni extends W{constructor(t,e){if(void 0===i)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t,e),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return Ii}static get DefaultType(){return Di}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),j.off(this._element.closest(ki),$i,this._hideModalHandler),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const t=j.trigger(this._element,this.constructor.eventName("show")),e=(u(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(t.defaultPrevented||!e)return;this._disposePopper();const i=this._getTipElement();this._element.setAttribute("aria-describedby",i.getAttribute("id"));const{container:s}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(s.append(i),j.trigger(this._element,this.constructor.eventName("inserted"))),this._popper=this._createPopper(i),i.classList.add(Ti),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))j.on(t,"mouseover",_);this._queueCallback((()=>{j.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1}),this.tip,this._isAnimated())}hide(){if(this._isShown()&&!j.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented){if(this._getTipElement().classList.remove(Ti),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))j.off(t,"mouseover",_);this._activeTrigger.click=!1,this._activeTrigger[Li]=!1,this._activeTrigger[Si]=!1,this._isHovered=null,this._queueCallback((()=>{this._isWithActiveTrigger()||(this._isHovered||this._disposePopper(),this._element.removeAttribute("aria-describedby"),j.trigger(this._element,this.constructor.eventName("hidden")))}),this.tip,this._isAnimated())}}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(t){const e=this._getTemplateFactory(t).toHtml();if(!e)return null;e.classList.remove(Ci,Ti),e.classList.add(`bs-${this.constructor.NAME}-auto`);const i=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME).toString();return e.setAttribute("id",i),this._isAnimated()&&e.classList.add(Ci),e}setContent(t){this._newContent=t,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(t){return this._templateFactory?this._templateFactory.changeContent(t):this._templateFactory=new Ai({...this._config,content:t,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{".tooltip-inner":this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(t){return this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(Ci)}_isShown(){return this.tip&&this.tip.classList.contains(Ti)}_createPopper(t){const e=v(this._config.placement,[this,t,this._element]),s=Oi[e.toUpperCase()];return i.createPopper(this._element,t,this._getPopperConfig(s))}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return v(t,[this._element])}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:t=>{this._getTipElement().setAttribute("data-popper-placement",t.state.placement)}}]};return{...e,...v(this._config.popperConfig,[e])}}_setListeners(){const t=this._config.trigger.split(" ");for(const e of t)if("click"===e)j.on(this._element,this.constructor.eventName("click"),this._config.selector,(t=>{this._initializeOnDelegatedTarget(t).toggle()}));else if("manual"!==e){const t=e===Si?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),i=e===Si?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");j.on(this._element,t,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusin"===t.type?Li:Si]=!0,e._enter()})),j.on(this._element,i,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusout"===t.type?Li:Si]=e._element.contains(t.relatedTarget),e._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},j.on(this._element.closest(ki),$i,this._hideModalHandler)}_fixTitle(){const t=this._element.getAttribute("title");t&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",t),this._element.setAttribute("data-bs-original-title",t),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(t,e){clearTimeout(this._timeout),this._timeout=setTimeout(t,e)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(t){const e=B.getDataAttributes(this._element);for(const t of Object.keys(e))Ei.has(t)&&delete e[t];return t={...e,..."object"==typeof t&&t?t:{}},t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t.container=!1===t.container?document.body:c(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),t}_getDelegateConfig(){const t={};for(const[e,i]of Object.entries(this._config))this.constructor.Default[e]!==i&&(t[e]=i);return t.selector=!1,t.trigger="manual",t}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null),this.tip&&(this.tip.remove(),this.tip=null)}static jQueryInterface(t){return this.each((function(){const e=Ni.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}b(Ni);const Pi={...Ni.Default,content:"",offset:[0,8],placement:"right",template:'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>',trigger:"click"},xi={...Ni.DefaultType,content:"(null|string|element|function)"};class Mi extends Ni{static get Default(){return Pi}static get DefaultType(){return xi}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{".popover-header":this._getTitle(),".popover-body":this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(t){return this.each((function(){const e=Mi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}b(Mi);const ji=".bs.scrollspy",Fi=`activate${ji}`,zi=`click${ji}`,Hi=`load${ji}.data-api`,Bi="active",qi="[href]",Wi=".nav-link",Ri=`${Wi}, .nav-item > ${Wi}, .list-group-item`,Ki={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},Vi={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class Qi extends W{constructor(t,e){super(t,e),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return Ki}static get DefaultType(){return Vi}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const t of this._observableSections.values())this._observer.observe(t)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(t){return t.target=c(t.target)||document.body,t.rootMargin=t.offset?`${t.offset}px 0px -30%`:t.rootMargin,"string"==typeof t.threshold&&(t.threshold=t.threshold.split(",").map((t=>Number.parseFloat(t)))),t}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(j.off(this._config.target,zi),j.on(this._config.target,zi,qi,(t=>{const e=this._observableSections.get(t.target.hash);if(e){t.preventDefault();const i=this._rootElement||window,s=e.offsetTop-this._element.offsetTop;if(i.scrollTo)return void i.scrollTo({top:s,behavior:"smooth"});i.scrollTop=s}})))}_getNewObserver(){const t={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((t=>this._observerCallback(t)),t)}_observerCallback(t){const e=t=>this._targetLinks.get(`#${t.target.id}`),i=t=>{this._previousScrollData.visibleEntryTop=t.target.offsetTop,this._process(e(t))},s=(this._rootElement||document.documentElement).scrollTop,n=s>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=s;for(const o of t){if(!o.isIntersecting){this._activeTarget=null,this._clearActiveClass(e(o));continue}const t=o.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(n&&t){if(i(o),!s)return}else n||t||i(o)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const t=K.find(qi,this._config.target);for(const e of t){if(!e.hash||d(e))continue;const t=K.findOne(decodeURI(e.hash),this._element);h(t)&&(this._targetLinks.set(decodeURI(e.hash),e),this._observableSections.set(e.hash,t))}}_process(t){this._activeTarget!==t&&(this._clearActiveClass(this._config.target),this._activeTarget=t,t.classList.add(Bi),this._activateParents(t),j.trigger(this._element,Fi,{relatedTarget:t}))}_activateParents(t){if(t.classList.contains("dropdown-item"))K.findOne(".dropdown-toggle",t.closest(".dropdown")).classList.add(Bi);else for(const e of K.parents(t,".nav, .list-group"))for(const t of K.prev(e,Ri))t.classList.add(Bi)}_clearActiveClass(t){t.classList.remove(Bi);const e=K.find(`${qi}.${Bi}`,t);for(const t of e)t.classList.remove(Bi)}static jQueryInterface(t){return this.each((function(){const e=Qi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}j.on(window,Hi,(()=>{for(const t of K.find('[data-bs-spy="scroll"]'))Qi.getOrCreateInstance(t)})),b(Qi);const Xi=".bs.tab",Yi=`hide${Xi}`,Ui=`hidden${Xi}`,Gi=`show${Xi}`,Ji=`shown${Xi}`,Zi=`click${Xi}`,ts=`keydown${Xi}`,es=`load${Xi}`,is="ArrowLeft",ss="ArrowRight",ns="ArrowUp",os="ArrowDown",rs="Home",as="End",ls="active",cs="fade",hs="show",ds=":not(.dropdown-toggle)",us='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',_s=`.nav-link${ds}, .list-group-item${ds}, [role="tab"]${ds}, ${us}`,gs=`.${ls}[data-bs-toggle="tab"], .${ls}[data-bs-toggle="pill"], .${ls}[data-bs-toggle="list"]`;class fs extends W{constructor(t){super(t),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),j.on(this._element,ts,(t=>this._keydown(t))))}static get NAME(){return"tab"}show(){const t=this._element;if(this._elemIsActive(t))return;const e=this._getActiveElem(),i=e?j.trigger(e,Yi,{relatedTarget:t}):null;j.trigger(t,Gi,{relatedTarget:e}).defaultPrevented||i&&i.defaultPrevented||(this._deactivate(e,t),this._activate(t,e))}_activate(t,e){t&&(t.classList.add(ls),this._activate(K.getElementFromSelector(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected",!0),this._toggleDropDown(t,!0),j.trigger(t,Ji,{relatedTarget:e})):t.classList.add(hs)}),t,t.classList.contains(cs)))}_deactivate(t,e){t&&(t.classList.remove(ls),t.blur(),this._deactivate(K.getElementFromSelector(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.setAttribute("aria-selected",!1),t.setAttribute("tabindex","-1"),this._toggleDropDown(t,!1),j.trigger(t,Ui,{relatedTarget:e})):t.classList.remove(hs)}),t,t.classList.contains(cs)))}_keydown(t){if(![is,ss,ns,os,rs,as].includes(t.key))return;t.stopPropagation(),t.preventDefault();const e=this._getChildren().filter((t=>!d(t)));let i;if([rs,as].includes(t.key))i=e[t.key===rs?0:e.length-1];else{const s=[ss,os].includes(t.key);i=w(e,t.target,s,!0)}i&&(i.focus({preventScroll:!0}),fs.getOrCreateInstance(i).show())}_getChildren(){return K.find(_s,this._parent)}_getActiveElem(){return this._getChildren().find((t=>this._elemIsActive(t)))||null}_setInitialAttributes(t,e){this._setAttributeIfNotExists(t,"role","tablist");for(const t of e)this._setInitialAttributesOnChild(t)}_setInitialAttributesOnChild(t){t=this._getInnerElement(t);const e=this._elemIsActive(t),i=this._getOuterElement(t);t.setAttribute("aria-selected",e),i!==t&&this._setAttributeIfNotExists(i,"role","presentation"),e||t.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(t,"role","tab"),this._setInitialAttributesOnTargetPanel(t)}_setInitialAttributesOnTargetPanel(t){const e=K.getElementFromSelector(t);e&&(this._setAttributeIfNotExists(e,"role","tabpanel"),t.id&&this._setAttributeIfNotExists(e,"aria-labelledby",`${t.id}`))}_toggleDropDown(t,e){const i=this._getOuterElement(t);if(!i.classList.contains("dropdown"))return;const s=(t,s)=>{const n=K.findOne(t,i);n&&n.classList.toggle(s,e)};s(".dropdown-toggle",ls),s(".dropdown-menu",hs),i.setAttribute("aria-expanded",e)}_setAttributeIfNotExists(t,e,i){t.hasAttribute(e)||t.setAttribute(e,i)}_elemIsActive(t){return t.classList.contains(ls)}_getInnerElement(t){return t.matches(_s)?t:K.findOne(_s,t)}_getOuterElement(t){return t.closest(".nav-item, .list-group-item")||t}static jQueryInterface(t){return this.each((function(){const e=fs.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}j.on(document,Zi,us,(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),d(this)||fs.getOrCreateInstance(this).show()})),j.on(window,es,(()=>{for(const t of K.find(gs))fs.getOrCreateInstance(t)})),b(fs);const ms=".bs.toast",ps=`mouseover${ms}`,bs=`mouseout${ms}`,vs=`focusin${ms}`,ys=`focusout${ms}`,ws=`hide${ms}`,As=`hidden${ms}`,Es=`show${ms}`,Cs=`shown${ms}`,Ts="hide",ks="show",$s="showing",Ss={animation:"boolean",autohide:"boolean",delay:"number"},Ls={animation:!0,autohide:!0,delay:5e3};class Os extends W{constructor(t,e){super(t,e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Ls}static get DefaultType(){return Ss}static get NAME(){return"toast"}show(){j.trigger(this._element,Es).defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(Ts),g(this._element),this._element.classList.add(ks,$s),this._queueCallback((()=>{this._element.classList.remove($s),j.trigger(this._element,Cs),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this.isShown()&&(j.trigger(this._element,ws).defaultPrevented||(this._element.classList.add($s),this._queueCallback((()=>{this._element.classList.add(Ts),this._element.classList.remove($s,ks),j.trigger(this._element,As)}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(ks),super.dispose()}isShown(){return this._element.classList.contains(ks)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){j.on(this._element,ps,(t=>this._onInteraction(t,!0))),j.on(this._element,bs,(t=>this._onInteraction(t,!1))),j.on(this._element,vs,(t=>this._onInteraction(t,!0))),j.on(this._element,ys,(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=Os.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return V(Os),b(Os),{Alert:U,Button:J,Carousel:Ot,Collapse:Rt,Dropdown:fe,Modal:Ue,Offcanvas:gi,Popover:Mi,ScrollSpy:Qi,Tab:fs,Toast:Os,Tooltip:Ni}}));
//# sourceMappingURL=bootstrap.min.js.map;
// source --> https://www.entreprises-montrouge.net/wp-content/themes/Kose-child/js/myscripts.js?ver=7.0 
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


jQuery(function ($) {

    // Layout HomePage : positionner les 3 encadrés en bas
    // Ajouter un ID
    $('.home #content-wrapper .vc_row:eq(1)').attr('id', 'element-bas');
});
// source --> https://www.entreprises-montrouge.net/wp-content/themes/Kose/js/custom.modernizr.js 
/*!
 * modernizr v3.6.0
 * Build https://modernizr.com/download?-mq-setclasses-dontmin
 *
 * Copyright (c)
 *  Faruk Ates
 *  Paul Irish
 *  Alex Sexton
 *  Ryan Seddon
 *  Patrick Kettner
 *  Stu Cox
 *  Richard Herrera

 * MIT License
 */

/*
 * Modernizr tests which native CSS3 and HTML5 features are available in the
 * current UA and makes the results available to you in two ways: as properties on
 * a global `Modernizr` object, and as classes on the `<html>` element. This
 * information allows you to progressively enhance your pages with a granular level
 * of control over the experience.
*/

;(function(window, document, undefined){
  var classes = [];
  

  var tests = [];
  

  /**
   *
   * ModernizrProto is the constructor for Modernizr
   *
   * @class
   * @access public
   */

  var ModernizrProto = {
    // The current version, dummy
    _version: '3.6.0',

    // Any settings that don't work as separate modules
    // can go in here as configuration.
    _config: {
      'classPrefix': '',
      'enableClasses': true,
      'enableJSClass': true,
      'usePrefixes': true
    },

    // Queue of tests
    _q: [],

    // Stub these for people who are listening
    on: function(test, cb) {
      // I don't really think people should do this, but we can
      // safe guard it a bit.
      // -- NOTE:: this gets WAY overridden in src/addTest for actual async tests.
      // This is in case people listen to synchronous tests. I would leave it out,
      // but the code to *disallow* sync tests in the real version of this
      // function is actually larger than this.
      var self = this;
      setTimeout(function() {
        cb(self[test]);
      }, 0);
    },

    addTest: function(name, fn, options) {
      tests.push({name: name, fn: fn, options: options});
    },

    addAsyncTest: function(fn) {
      tests.push({name: null, fn: fn});
    }
  };

  

  // Fake some of Object.create so we can force non test results to be non "own" properties.
  var Modernizr = function() {};
  Modernizr.prototype = ModernizrProto;

  // Leak modernizr globally when you `require` it rather than force it here.
  // Overwrite name so constructor name is nicer :D
  Modernizr = new Modernizr();

  

  /**
   * is returns a boolean if the typeof an obj is exactly type.
   *
   * @access private
   * @function is
   * @param {*} obj - A thing we want to check the type of
   * @param {string} type - A string to compare the typeof against
   * @returns {boolean}
   */

  function is(obj, type) {
    return typeof obj === type;
  }
  ;

  /**
   * Run through all tests and detect their support in the current UA.
   *
   * @access private
   */

  function testRunner() {
    var featureNames;
    var feature;
    var aliasIdx;
    var result;
    var nameIdx;
    var featureName;
    var featureNameSplit;

    for (var featureIdx in tests) {
      if (tests.hasOwnProperty(featureIdx)) {
        featureNames = [];
        feature = tests[featureIdx];
        // run the test, throw the return value into the Modernizr,
        // then based on that boolean, define an appropriate className
        // and push it into an array of classes we'll join later.
        //
        // If there is no name, it's an 'async' test that is run,
        // but not directly added to the object. That should
        // be done with a post-run addTest call.
        if (feature.name) {
          featureNames.push(feature.name.toLowerCase());

          if (feature.options && feature.options.aliases && feature.options.aliases.length) {
            // Add all the aliases into the names list
            for (aliasIdx = 0; aliasIdx < feature.options.aliases.length; aliasIdx++) {
              featureNames.push(feature.options.aliases[aliasIdx].toLowerCase());
            }
          }
        }

        // Run the test, or use the raw value if it's not a function
        result = is(feature.fn, 'function') ? feature.fn() : feature.fn;


        // Set each of the names on the Modernizr object
        for (nameIdx = 0; nameIdx < featureNames.length; nameIdx++) {
          featureName = featureNames[nameIdx];
          // Support dot properties as sub tests. We don't do checking to make sure
          // that the implied parent tests have been added. You must call them in
          // order (either in the test, or make the parent test a dependency).
          //
          // Cap it to TWO to make the logic simple and because who needs that kind of subtesting
          // hashtag famous last words
          featureNameSplit = featureName.split('.');

          if (featureNameSplit.length === 1) {
            Modernizr[featureNameSplit[0]] = result;
          } else {
            // cast to a Boolean, if not one already
            if (Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
              Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
            }

            Modernizr[featureNameSplit[0]][featureNameSplit[1]] = result;
          }

          classes.push((result ? '' : 'no-') + featureNameSplit.join('-'));
        }
      }
    }
  }
  ;

  /**
   * docElement is a convenience wrapper to grab the root element of the document
   *
   * @access private
   * @returns {HTMLElement|SVGElement} The root element of the document
   */

  var docElement = document.documentElement;
  

  /**
   * A convenience helper to check if the document we are running in is an SVG document
   *
   * @access private
   * @returns {boolean}
   */

  var isSVG = docElement.nodeName.toLowerCase() === 'svg';
  

  /**
   * setClasses takes an array of class names and adds them to the root element
   *
   * @access private
   * @function setClasses
   * @param {string[]} classes - Array of class names
   */

  // Pass in an and array of class names, e.g.:
  //  ['no-webp', 'borderradius', ...]
  function setClasses(classes) {
    var className = docElement.className;
    var classPrefix = Modernizr._config.classPrefix || '';

    if (isSVG) {
      className = className.baseVal;
    }

    // Change `no-js` to `js` (independently of the `enableClasses` option)
    // Handle classPrefix on this too
    if (Modernizr._config.enableJSClass) {
      var reJS = new RegExp('(^|\\s)' + classPrefix + 'no-js(\\s|$)');
      className = className.replace(reJS, '$1' + classPrefix + 'js$2');
    }

    if (Modernizr._config.enableClasses) {
      // Add the new classes
      className += ' ' + classPrefix + classes.join(' ' + classPrefix);
      if (isSVG) {
        docElement.className.baseVal = className;
      } else {
        docElement.className = className;
      }
    }

  }

  ;

  /**
   * createElement is a convenience wrapper around document.createElement. Since we
   * use createElement all over the place, this allows for (slightly) smaller code
   * as well as abstracting away issues with creating elements in contexts other than
   * HTML documents (e.g. SVG documents).
   *
   * @access private
   * @function createElement
   * @returns {HTMLElement|SVGElement} An HTML or SVG element
   */

  function createElement() {
    if (typeof document.createElement !== 'function') {
      // This is the case in IE7, where the type of createElement is "object".
      // For this reason, we cannot call apply() as Object is not a Function.
      return document.createElement(arguments[0]);
    } else if (isSVG) {
      return document.createElementNS.call(document, 'http://www.w3.org/2000/svg', arguments[0]);
    } else {
      return document.createElement.apply(document, arguments);
    }
  }

  ;

  /**
   * getBody returns the body of a document, or an element that can stand in for
   * the body if a real body does not exist
   *
   * @access private
   * @function getBody
   * @returns {HTMLElement|SVGElement} Returns the real body of a document, or an
   * artificially created element that stands in for the body
   */

  function getBody() {
    // After page load injecting a fake body doesn't work so check if body exists
    var body = document.body;

    if (!body) {
      // Can't use the real body create a fake one.
      body = createElement(isSVG ? 'svg' : 'body');
      body.fake = true;
    }

    return body;
  }

  ;

  /**
   * injectElementWithStyles injects an element with style element and some CSS rules
   *
   * @access private
   * @function injectElementWithStyles
   * @param {string} rule - String representing a css rule
   * @param {function} callback - A function that is used to test the injected element
   * @param {number} [nodes] - An integer representing the number of additional nodes you want injected
   * @param {string[]} [testnames] - An array of strings that are used as ids for the additional nodes
   * @returns {boolean}
   */

  function injectElementWithStyles(rule, callback, nodes, testnames) {
    var mod = 'modernizr';
    var style;
    var ret;
    var node;
    var docOverflow;
    var div = createElement('div');
    var body = getBody();

    if (parseInt(nodes, 10)) {
      // In order not to give false positives we create a node for each test
      // This also allows the method to scale for unspecified uses
      while (nodes--) {
        node = createElement('div');
        node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
        div.appendChild(node);
      }
    }

    style = createElement('style');
    style.type = 'text/css';
    style.id = 's' + mod;

    // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.
    // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
    (!body.fake ? div : body).appendChild(style);
    body.appendChild(div);

    if (style.styleSheet) {
      style.styleSheet.cssText = rule;
    } else {
      style.appendChild(document.createTextNode(rule));
    }
    div.id = mod;

    if (body.fake) {
      //avoid crashing IE8, if background image is used
      body.style.background = '';
      //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
      body.style.overflow = 'hidden';
      docOverflow = docElement.style.overflow;
      docElement.style.overflow = 'hidden';
      docElement.appendChild(body);
    }

    ret = callback(div, rule);
    // If this is done after page load we don't want to remove the body so check if body exists
    if (body.fake) {
      body.parentNode.removeChild(body);
      docElement.style.overflow = docOverflow;
      // Trigger layout so kinetic scrolling isn't disabled in iOS6+
      // eslint-disable-next-line
      docElement.offsetHeight;
    } else {
      div.parentNode.removeChild(div);
    }

    return !!ret;

  }

  ;

  /**
   * Modernizr.mq tests a given media query, live against the current state of the window
   * adapted from matchMedia polyfill by Scott Jehl and Paul Irish
   * gist.github.com/786768
   *
   * @memberof Modernizr
   * @name Modernizr.mq
   * @optionName Modernizr.mq()
   * @optionProp mq
   * @access public
   * @function mq
   * @param {string} mq - String of the media query we want to test
   * @returns {boolean}
   * @example
   * Modernizr.mq allows for you to programmatically check if the current browser
   * window state matches a media query.
   *
   * ```js
   *  var query = Modernizr.mq('(min-width: 900px)');
   *
   *  if (query) {
   *    // the browser window is larger than 900px
   *  }
   * ```
   *
   * Only valid media queries are supported, therefore you must always include values
   * with your media query
   *
   * ```js
   * // good
   *  Modernizr.mq('(min-width: 900px)');
   *
   * // bad
   *  Modernizr.mq('min-width');
   * ```
   *
   * If you would just like to test that media queries are supported in general, use
   *
   * ```js
   *  Modernizr.mq('only all'); // true if MQ are supported, false if not
   * ```
   *
   *
   * Note that if the browser does not support media queries (e.g. old IE) mq will
   * always return false.
   */

  var mq = (function() {
    var matchMedia = window.matchMedia || window.msMatchMedia;
    if (matchMedia) {
      return function(mq) {
        var mql = matchMedia(mq);
        return mql && mql.matches || false;
      };
    }

    return function(mq) {
      var bool = false;

      injectElementWithStyles('@media ' + mq + ' { #modernizr { position: absolute; } }', function(node) {
        bool = (window.getComputedStyle ?
                window.getComputedStyle(node, null) :
                node.currentStyle).position == 'absolute';
      });

      return bool;
    };
  })();


  ModernizrProto.mq = mq;

  

  // Run each test
  testRunner();

  // Remove the "no-js" class if it exists
  setClasses(classes);

  delete ModernizrProto.addTest;
  delete ModernizrProto.addAsyncTest;

  // Run the things that are supposed to run after the tests
  for (var i = 0; i < Modernizr._q.length; i++) {
    Modernizr._q[i]();
  }

  // Leak Modernizr namespace
  window.Modernizr = Modernizr;


;

})(window, document);