// source --> https://www.sedlmeir-trachtenhof.de/wp-content/plugins/media-library-assistant/js/mla-terms-search-scripts.js?ver=3.39 
/* global ajaxurl */

/*
 * This script requires the global "mla" object to be defined and include the following:
 *
 * properties:
 *     mla.settings.useSpinnerClass
 */

var jQuery, wpAjax, ajaxurl,
	mla_terms_search_vars,
	mlaTaxonomy = {
		// Properties
		settings: {},

		// Utility functions
		utility: {
		},

		// Components
		termsSearch: null
	};

( function( $ ) {
	/**
	 * Localized settings and strings
	 */
	mlaTaxonomy.settings = typeof mla_terms_search_vars === 'undefined' ? {} : mla_terms_search_vars;
	mla_terms_search_vars = void 0; // delete won't work on Globals

	/**
	 * termsSearch displays a popup modal window with text box, options and taxonomy list.
	 * termsSearch.open is called from an "onclick" attribute in the Media/Assistant submenu table.
	 */
	mlaTaxonomy.termsSearch = {
		init: function() {
			// Suppress form "submit" action for the "Terms Search" button
			$( '#mla-terms-search-open' ).on( 'click', function( event ) {
				event.preventDefault();
			});

			$( '#mla-terms-search-submit' ).on( 'click', function() {
				mlaTaxonomy.termsSearch.close();
			});

			// Close the termsSearch pop-up
			$( '#mla-terms-search-close-div' ).on( 'click', mlaTaxonomy.termsSearch.close );

		},

		open: function() {
			var overlay = $( '#mla-terms-search-overlay' );

			if ( overlay.length === 0 ) {
				$( 'body' ).append( '<div id="mla-terms-search-overlay"></div>' );
				mlaTaxonomy.termsSearch.overlay();
			}

			overlay.show();

			if ( mlaTaxonomy.settings.useDashicons ) {
				$( '#mla-terms-search-close-div' ).addClass("mla-terms-search-close-div-dashicons");
			} else {
				$( '#mla-terms-search-close-div' ).html( 'x' );
			}

			$( '#mla-terms-search-div' ).show();

			$( '#mla-terms-search-input ' ).focus().on( 'keyup', function( event ){
				if ( 27 === event.which ) {
					mlaTaxonomy.termsSearch.close();
				} // close on Escape

				if ( 13 === event.which ) {
					event.preventDefault();
					$( '#mla-terms-search-form' ).trigger('submit');
				}
			});

			return false;
		},

		close: function() {
			$( '#mla-terms-search-response-div' ).html('');
			$( '#mla-terms-search-div' ).hide();
			$( '#mla-terms-search-overlay' ).hide();
		},

		overlay: function() {
			$( '#mla-terms-search-overlay' ).on( 'click', function () {
				mlaTaxonomy.termsSearch.close();
			});
		},

		send: function() {
			var post = {
					ps: $( '#mla-terms-search-input' ).val(),
					action: 'find_posts',
					_ajax_nonce: $('#mla-terms-search-ajax-nonce').val()
				},
				spinner = $( '#mla-terms-search-search-div .spinner' ),
				ajaxResponse = null;

			if ( mla.settings.useSpinnerClass ) {
				spinner.addClass("is-active");
			} else {
				spinner.show();
			}

			$.ajax( ajaxurl, {
				type: 'POST',
				data: post,
				dataType: mlaTaxonomy.settings.termsSearchDataType
			}).always( function() {
				if ( mla.settings.useSpinnerClass ) {
					spinner.removeClass("is-active");
				} else {
					spinner.hide();
				}
			}).done( function( response ) {
				var responseData = 'no response.data', id = 0;

				if ( 'xml' === mlaTaxonomy.settings.termsSearchDataType ) {
					if ( 'string' === typeof( response ) ) {
						response = { 'success': false, data: response };
					} else {
						ajaxResponse = wpAjax.parseAjaxResponse( response );

						if ( ajaxResponse.errors ) {
							response = { 'success': false, data: wpAjax.broken };
						} else {
							response = { 'success': true, data: ajaxResponse.responses[0].data };
						}
					}
				}

				if ( ! response.success ) {
					if ( response.responseData ) {
						responseData = response.data;
					}

					$( '#mla-terms-search-response-div' ).text( mlaTaxonomy.settings.ajaxDoneError + ' (' + responseData + ')' );
				} else {
					/*
					 * Add the (Unattached) row, then the post/page list
					 */
					$( '#mla-terms-search-response-div' ).html( response.data );
					$( '#mla-terms-search-response-div table tbody tr:eq(0)' ).before( $( '#found-0-row' ).clone() );

					/*
					 * See if we can "check" the current parent
					 */
					id = $( '#mla-terms-search-parent' ).val();
					$( '#mla-terms-search-response-div #found-' + id ).each(function(){
						$( this ).prop( 'checked', true );
					});
				}
			}).fail( function( jqXHR, status ) {
				if ( 200 == jqXHR.status ) {
					$( '#mla-terms-search-response-div' ).text( '(' + status + ') ' + jqXHR.responseText );
				} else {
					$( '#mla-terms-search-response-div' ).text( mlaTaxonomy.settings.ajaxFailError + ' (' + status + '), jqXHR( ' + jqXHR.status + ', ' + jqXHR.statusText + ', ' + jqXHR.responseText + ')' );
				}
			});
		}
	}; // mlaTaxonomy.termsSearch

	$( document ).ready( function() {
		mlaTaxonomy.termsSearch.init();
	});
})( jQuery );
// source --> https://www.sedlmeir-trachtenhof.de/wp-content/plugins/woocommerce-pdf-vouchers/includes/meta-boxes/js/datetimepicker/jquery-ui-slider-Access.js?ver=5.2.3 
/*
 * jQuery UI Slider Access
 * By: Trent Richardson [http://trentrichardson.com]
 * Version 0.3
 * Last Modified: 10/20/2012
 * 
 * Copyright 2011 Trent Richardson
 * Dual licensed under the MIT and GPL licenses.
 * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
 * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
 * 
 */
 (function($){

	$.fn.extend({
		sliderAccess: function(options){
			options = options || {};
			options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device

			if(options.touchonly === true && !("ontouchend" in document)){
				return $(this);
			}
				
			return $(this).each(function(i,obj){
						var $t = $(this),
							o = $.extend({},{ 
											where: 'after',
											step: $t.slider('option','step'), 
											upIcon: 'ui-icon-plus', 
											downIcon: 'ui-icon-minus',
											text: false,
											upText: '+',
											downText: '-',
											buttonset: true,
											buttonsetTag: 'span',
											isRTL: false
										}, options),
							$buttons = $('<'+ o.buttonsetTag +' class="ui-slider-access">'+
											'<button data-icon="'+ o.downIcon +'" data-step="'+ (o.isRTL? o.step : o.step*-1) +'">'+ o.downText +'</button>'+
											'<button data-icon="'+ o.upIcon +'" data-step="'+ (o.isRTL? o.step*-1 : o.step) +'">'+ o.upText +'</button>'+
										'</'+ o.buttonsetTag +'>');

						$buttons.children('button').each(function(j, jobj){
							var $jt = $(this);
							$jt.button({ 
											text: o.text, 
											icons: { primary: $jt.data('icon') }
										})
								.click(function(e){
											var step = $jt.data('step'),
												curr = $t.slider('value'),
												newval = curr += step*1,
												minval = $t.slider('option','min'),
												maxval = $t.slider('option','max'),
												slidee = $t.slider("option", "slide") || function(){},
												stope = $t.slider("option", "stop") || function(){};

											e.preventDefault();
											
											if(newval < minval || newval > maxval){
												return;
											}
											
											$t.slider('value', newval);

											slidee.call($t, null, { value: newval });
											stope.call($t, null, { value: newval });
										});
						});
						
						// before or after					
						$t[o.where]($buttons);

						if(o.buttonset){
							$buttons.removeClass('ui-corner-right').removeClass('ui-corner-left').buttonset();
							$buttons.eq(0).addClass('ui-corner-left');
							$buttons.eq(1).addClass('ui-corner-right');
						}

						// adjust the width so we don't break the original layout
						var bOuterWidth = $buttons.css({
									marginLeft: ((o.where === 'after' && !o.isRTL) || (o.where === 'before' && o.isRTL)? 10:0), 
									marginRight: ((o.where === 'before' && !o.isRTL) || (o.where === 'after' && o.isRTL)? 10:0)
								}).outerWidth(true) + 5;
						var tOuterWidth = $t.outerWidth(true);
						$t.css('display','inline-block').width(tOuterWidth-bOuterWidth);
					});		
		}
	});

})(jQuery);
// source --> https://www.sedlmeir-trachtenhof.de/wp-content/themes/enfold/js/avia-js.js?ver=7.1.6 
/**
 * Contains plain js basic and helpers classes
 *
 * @since 5.6
 */

/**
 * Global namespace
 *
 * @since 5.6
 */
var aviaJS = aviaJS || {};

(function()
{
	"use strict";

	if( ! aviaJS.aviaJSHelpers )
	{
		class aviaJSHelpers
		{
			constructor()
			{
				this.wpHooks();
			}

			//	based on _.js debounce()
			debounce( callback, wait, immediate )
			{
				var timeout;

				return function()
				{
					var context = this,
						args = arguments;

					var later = function()
					{
						timeout = null;
						if( ! immediate )
						{
							callback.apply(context, args);
						}
					};

					var callNow = immediate && ! timeout;

					clearTimeout( timeout );
					timeout = setTimeout( later, wait );
					if( callNow )
					{
						callback.apply( context, args );
					}
				};
			}

			wpHooks()
			{
				//	to avoid checking for wp.hooks calling filters or actions we create dummy functions here
				if( window['wp'] && wp.hooks )
				{
					return;
				}

				if( ! window['wp'] )
				{
					window['wp'] = { hooks: {} };
				}
				else
				{
					window['wp'].hooks = {};
				}

				let obj = window['wp'].hooks;

				obj.applyFilters = this.wpHooks_applyFilters;
				obj.doAction = this.wpHooks_applyFilters;
				obj.hasFilter = this.wpHooks_hasFilters;
				obj.hasAction = this.wpHooks_hasFilters;
			}

			wpHooks_applyFilters( handle, value )
			{
				return value;
			}

			wpHooks_hasFilters( handle, namespace )
			{
				return false;
			}
		}

		aviaJS.aviaJSHelpers = new aviaJSHelpers();
	}

	if( ! aviaJS.aviaPlugins )
	{
		class aviaPlugins
		{
			plugins = [];
			defaultPlugin = {
				classFactory:	null,
				selector:		''
			};

			constructor()
			{
				this.plugins = [];
			}

			register( classFactory, selector )
			{
				if( 'function' != typeof classFactory )
				{
					return false;
				}

				let newPlugin = Object.assign( {}, this.defaultPlugin );

				if( 'string' != typeof selector )
				{
					selector = 'body';
				}

				newPlugin.classFactory = classFactory;
				newPlugin.selector = selector;

				this.plugins.push( newPlugin );

				this.check_bind();
			}

			check_bind()
			{
				if( document.readyState === 'complete' )
				{
					// The page is already fully loaded
					this.bind_plugins();
				}
				else
				{
					document.addEventListener( 'readystatechange', this.bind_plugins.bind( this ) );
				}
			}

			bind_plugins( e )
			{
				if( document.readyState !== 'complete' )
				{
					return;
				}

				let plugins = this.plugins;
				this.plugins = [];

				for( let plugin of plugins )
				{
					let elements = document.querySelectorAll( plugin.selector );

					for( let element of elements )
					{
						plugin.classFactory( element );
					}
				}
			}
		}

		aviaJS.aviaPlugins = new aviaPlugins();
	}

})();
// source --> https://www.sedlmeir-trachtenhof.de/wp-content/themes/enfold/js/avia-compat.js?ver=7.1.6 
/*
	this prevents dom flickering for elements hidden with js, needs to be outside of dom.ready event.also adds several extra classes for better browser support
	this is a separate file that needs to be loaded at the top of the page. other js functions are loaded before the closing body tag to make the site render faster
*/
"use strict";

var avia_is_mobile = false;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement)
{
	avia_is_mobile = true;
	document.documentElement.className += ' avia_mobile ';
}
else
{
	document.documentElement.className += ' avia_desktop ';
}

document.documentElement.className += ' js_active ';

(function()
{
	//set transform property
	var prefix = [ '-webkit-', '-moz-', '-ms-', '' ],
		transform = '',
		transform2d = false,
		transform3d = false;

	for( var i in prefix )
	{
		// http://artsy.github.io/blog/2012/10/18/so-you-want-to-do-a-css3-3d-transform/
		if( prefix[i] + 'transform' in document.documentElement.style )
		{
			transform2d = true;
			transform = prefix[i] + 'transform';
		}

		if( prefix[i] + 'perspective' in document.documentElement.style )
		{
			transform3d = true;
		}
	}

	if( transform2d )
	{
		document.documentElement.className += ' avia_transform ';
	}

	if( transform3d )
	{
		document.documentElement.className += ' avia_transform3d ';
	}

	//set parallax position to prevent jump at pageload
	if( typeof document.getElementsByClassName == 'function' && typeof document.documentElement.getBoundingClientRect == "function" && avia_is_mobile == false )
	{
		if( transform && window.innerHeight > 0 )
		{
			setTimeout( function()
			{
				var y = 0,
					offsets = {},
					transY = 0,
					parallax = document.getElementsByClassName( "av-parallax" ),
					winTop = window.pageYOffset || document.documentElement.scrollTop;

				for( y = 0; y < parallax.length; y++ )
				{
					parallax[y].style.top = "0px";
					offsets	= parallax[y].getBoundingClientRect();
					transY	= Math.ceil( (window.innerHeight + winTop - offsets.top) * 0.3 );
					parallax[y].style[transform] = "translate(0px, " + transY + "px)";
					parallax[y].style.top = "auto";
					parallax[y].className += ' enabled-parallax ';
				}
			}, 50);
		}
	}
})();