PageSourceSearch

https://marcovanbeers.com/wp-content/themes/uncode/library/js/app.js?ver=1115347979

js marcovanbeers.com collected 2026-10-10 00:05:36 UTC 631,887 bytes, 19,726 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55function uncodeVisibilityChange() {
56	if (document.hidden) {
57		window.dispatchEvent(new CustomEvent('is-blur'));
58	} else {
59		window.dispatchEvent(new CustomEvent('is-focus'));
60	}
61  }
62document.addEventListener('visibilitychange', uncodeVisibilityChange, false);
63
64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
65	window.lenis = new Lenis({
66		duration: 1
67	})
68
69	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71
72	function raf(time) {
73		window.lenis.raf(time)
74		requestAnimationFrame(raf)
75		window.dispatchEvent(new CustomEvent('lenis-scroll'));
76
77		if ( SiteParameters.uncode_smooth_scroll_safe ) {
78			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
79				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
80			
81			if ( UNCODE.hDoc !== newHdoc ) {
82				UNCODE.hDoc = newHdoc;
83				window.lenis.resize();
84				//window.dispatchEvent(new CustomEvent('boxResized'));
85			}
86		}
87	}
88
89	requestAnimationFrame(raf)
90
91	$(window).on('unmodal-open uncode-sidecart-open', function(){
92		window.lenis.stop();
93	});
94
95	$(window).on('uncode-sidecart-closed', function(){
96		window.lenis.start();
97	});
98
99	$(document).on('unmodal-close', function(){
100		window.lenis.start();
101	});
102
103}
104
105/**
106 * iOS / mobile: Safari fires a window "resize" every time the address bar /
107 */
108if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null && typeof ScrollTrigger.config === 'function' ) {
109	ScrollTrigger.config({ ignoreMobileResize: true });
110}
111
112var checkScrollTriggerRefresh;
113
114$(function(){
115	$(document).on('uncode-scrolltrigger-refresh', function(){
116		clearRequestTimeout(checkScrollTriggerRefresh);
117		checkScrollTriggerRefresh = requestTimeout(function(){
118			ScrollTrigger.refresh();
119			$('.scroll-refresh-hidden').removeClass('opacity_0');
120		}, 500);
121	});
122});
123
124UNCODE.checkImgLoad = function( src, cb, err, el ) {
125	var img = new Image();
126	img.onload = function () {
127		var result = (img.width > 0) && (img.height > 0);
128		cb(el);
129	};
130	img.onerror = function () {
131		err();
132	};
133	img.src = src
134};
135
136UNCODE.betterResize = function() {
137	var setResize,
138		doubleResize = true,
139		oldW = UNCODE.wwidth,
140		oldH = UNCODE.wheight,
141		setCTA;
142	$(window).on( 'resize orientationchange', function(){
143		if ( oldW === UNCODE.wwidth ) {
144			return;
145		} else {
146			oldW = UNCODE.wwidth;
147			$(window).trigger('wwResize');
148		}
149
150		if ( oldH === UNCODE.wheight ) {
151			return;
152		} else {
153			oldH = UNCODE.wheight;
154			$(window).trigger('whResize');
155		}
156	});
157
158	$(window).on( 'resize orientationchange', function(){
159		clearRequestTimeout(setCTA);
160		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
161	});
162};
163
164UNCODE.shuffle = function(array) {
165	var currentIndex = array.length,
166		randomIndex;
167  
168	while (currentIndex > 0) {
169		randomIndex = Math.floor(Math.random() * currentIndex);
170		currentIndex--;
171		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
172	}
173  
174	return array;
175};
176
177Number.isInteger = Number.isInteger || function(value) {
178    return typeof value === "number" &&
179           isFinite(value) &&
180           Math.floor(value) === value;
181};
182
183UNCODE.utils = function() {
184	$(document).on('mouseover', 'a', function () {
185		if (!$(this).hasClass('star')) {
186			$(this).attr('data-title', $(this).attr('title'));
187			$(this).removeAttr('title');
188		}
189	});
190	$(document).on('mouseout', 'a', function () {
191		if (!$(this).hasClass('star')) {
192			$(this).attr('title', $(this).attr('data-title'));
193			$(this).removeAttr('data-title');
194		}
195	});
196
197	this.get_scroll_offset = function(e) {
198
199		var scroll_offset = 0,
200			target,
201			trigger;
202
203		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
204			target = e.target;
205			trigger = e.currentTarget;
206		}
207
208		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
209			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
210				UNCODE.hideMenu(100);
211			}
212		}
213
214		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
215			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
216			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
217				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile && ! $('.menu-mobile-transparent').length ) ) {
218					if ( !$('.menu-hided').length ) {
219						if ( $('body').hasClass('hmenu-center') ) {
220							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
221						} else {
222							scroll_offset += ~~$('.logo-container:visible').outerHeight();
223						}
224					}
225				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && UNCODE.wwidth > UNCODE.mediaQuery ) {
226					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
227					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
228				} else {
229					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
230						scroll_offset += UNCODE.menuMobileHeight;
231					} else {
232						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
233							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
234						} else {
235							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
236								scroll_offset += UNCODE.menuMobileHeight;
237							}
238						}
239					}
240				}
241			}
242
243		}
244
245		scroll_offset += UNCODE.bodyBorder;
246
247		return scroll_offset;
248	}
249
250	if ( !UNCODE.isFullPage ) {
251		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
252
253			var hash = (e.currentTarget).hash,
254			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
255			anchor = '';
256			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
257			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
258				e.preventDefault();
259				if (!$('#tab-reviews').is(':visible')) {
260					$('a[href="#tab-reviews"]').trigger('click');
261				}
262				var calc_scroll = $('.wootabs .tab-content').offset().top;
263				calc_scroll -= UNCODE.get_scroll_offset(e);
264
265				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
266					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
267
268					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
269						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
270					}
271				}
272
273				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
274					delta = bodyTop - calc_scroll,
275					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
276				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
277
278				requestTimeout(function(){
279					if (scrollSpeed == 0) {
280						$('html, body').scrollTop(calc_scroll);
281						UNCODE.scrolling = false;
282					} else {
283   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
284							$(this).stop();
285						}).animate({
286								scrollTop: calc_scroll
287							}, scrollSpeed, 'easeInOutCubic', function() {
288								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
289								UNCODE.scrolling = false;
290							}
291						);
292					}
293				}, 200);
294				return;
295			}
296			if (hash != undefined) {
297				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
298				var anchor = this.hash.slice(1);
299				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
300			  		if ( !specialFormat.test(hash) ) {
301			  			if ( $(hash).length )
302			  				anchor = $(hash);
303			  		}
304				}
305			}
306
307			if (is_scrolltop || anchor != '') {
308				if (is_scrolltop) {
309					e.preventDefault();
310					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
311					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
312					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
313
314					if (scrollSpeed == 0) {
315						$('html, body').scrollTop(0);
316						UNCODE.scrolling = false;
317					} else {
318   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
319							$(this).stop();
320						}).animate({
321							scrollTop: 0
322						}, scrollSpeed, 'easeInOutCubic', function() {
323							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
324							UNCODE.scrolling = false;
325						});
326					}
327				} else {
328					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
329					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a, #uncode-mobile-menu-block .menu-item > a'), function(index, val) {
330						var get_href = $(val).attr('href');
331						if (get_href != undefined) {
332							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
333							else $(val).parent().removeClass('active');
334						}
335					});
336					if (scrollSection.length) {
337						if ( $('body').hasClass('uncode-scroll-no-history') ) {
338							e.preventDefault();
339						}
340
341						if (UNCODE.menuOpened) {
342							if (UNCODE.wwidth < UNCODE.mediaQuery) {
343								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
344							} else {
345								$('.mmb-container-overlay .overlay-close').trigger('click');
346								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
347							}
348						}
349
350						var calc_scroll = scrollSection.offset().top,
351							getOffset = UNCODE.get_scroll_offset(e),
352							$logo = $('.logo-container:visible'),
353							logoH,
354							$menu = $('#masthead .menu-container'),
355							menuH;
356
357						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
358
359						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
360							delta = bodyTop - calc_scroll,
361							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
362						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
363
364						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
365							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
366								logoH = $logo.outerHeight(),
367								menuH = $menu.outerHeight();
368								if ( calc_scroll < ( logoH + menuH ) ) {
369									calc_scroll = 0;
370								}
371							}
372						}
373
374						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
375							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
376						}
377
378						if (scrollSpeed == 0) {
379							$('html, body').scrollTop(calc_scroll);
380							UNCODE.scrolling = false;
381						} else {
382	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
383								$(this).stop();
384							}).animate({
385								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
386							}, scrollSpeed, 'easeInOutCubic', function() {
387								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
388								UNCODE.scrolling = false;
389								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
390								||
391								$('.menu-hided').length ) {
392									calc_scroll = scrollSection.offset().top;
393									getOffset = UNCODE.get_scroll_offset(e);
394									calc_scroll -= getOffset;
395									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
396										$(this).stop();
397									}).animate({
398										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
399										}, scrollSpeed, 'easeInOutCubic', function() {
400											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
401											UNCODE.scrolling = false;
402										}
403									);
404								}
405							});
406						}
407					}
408				}
409			}
410		});
411		$('.header-scrolldown').on('click', function(event) {
412
413			event.preventDefault();
414
415			var pageHeader = $(event.target).closest('#page-header'),
416				pageHeaderTop = pageHeader.offset().top,
417				pageHeaderHeight = pageHeader.outerHeight(),
418				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
419			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
420
421			var calc_scroll = pageHeaderTop + pageHeaderHeight,
422			getOffset = UNCODE.get_scroll_offset(event);
423			calc_scroll -= getOffset;
424
425			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
426				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
427
428				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
429					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
430				}
431			}
432
433			if (scrollSpeed == 0) {
434				$('html, body').scrollTop(calc_scroll);
435				UNCODE.scrolling = false;
436			} else {
437					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
438						$(this).stop();
439					}).animate({
440						scrollTop: calc_scroll
441					}, scrollSpeed, 'easeInOutCubic', function() {
442						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
443						UNCODE.scrolling = false;
444						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
445							calc_scroll = pageHeaderTop + pageHeaderHeight;
446							getOffset = UNCODE.get_scroll_offset(event);
447							calc_scroll -= getOffset;
448								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
449									$(this).stop();
450								}).animate({
451									scrollTop: calc_scroll
452								}, scrollSpeed, 'easeInOutCubic', function() {
453									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
454									UNCODE.scrolling = false;
455								}
456							);
457						}
458					}
459				);
460			}
461		});
462	}
463
464	// Colomun hover effect
465	// =================
466	$(document).on('mouseenter', '.col-link', function(e) {
467		var uncol = $(e.target).prev('.uncol'),
468		el = uncol.find('.column-background');
469		if (el) {
470			$('.btn-container .btn', uncol).addClass('active');
471			var elOverlay = $(el[0]).find('.block-bg-overlay');
472			if (elOverlay.length) {
473				var getOpacity = $(elOverlay).css('opacity');
474				if (getOpacity != 1) {
475					getOpacity = Math.round(getOpacity * 100) / 100;
476					var newOpacity = getOpacity + .1;
477					$(elOverlay).data('data-opacity', getOpacity);
478					$(elOverlay).css('opacity', newOpacity);
479				}
480			}
481		}
482	}).on('mouseleave', '.col-link', function(e) {
483		var uncol = $(e.target).prev('.uncol'),
484		el = uncol.find('.column-background');
485		$('.btn-container .btn', uncol).removeClass('active');
486		if (el) {
487			var elOverlay = $(el[0]).find('.block-bg-overlay');
488			if (elOverlay.length) {
489				var getOpacity = $(elOverlay).data('data-opacity');
490				$(elOverlay).css('opacity', getOpacity);
491			}
492		}
493	});
494
495	// Admin bar
496	// ============
497	var fixAdminBar = function() {
498		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
499			var getAdminBar = $('#wpadminbar');
500			if (getAdminBar.length) {
501				if (getAdminBar.css('position') !== 'hidden') {
502					var getAdminBarHeight = getAdminBar.height();
503					if (getAdminBar.css('position') === 'fixed') {
504						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
505						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
506					} else {
507						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
508						$('.body-borders .top-border').css({'margin-top':'0px'});
509					}
510				}
511			}
512		}
513	};
514	window.addEventListener('load', fixAdminBar);
515	window.addEventListener('resize', fixAdminBar);
516	// Print
517	// ===========
518	var beforePrint = function() {
519		window.dispatchEvent(new CustomEvent('resize'));
520		window.dispatchEvent(UNCODE.boxEvent);
521	};
522
523	if (window.matchMedia) {
524		var mediaQueryList = window.matchMedia('print');
525		mediaQueryList.addListener(function(mql) {
526			if (mql.matches) {
527				beforePrint();
528			}
529		});
530	}
531
532	window.onbeforeprint = beforePrint;
533
534	// Safari srcset
535	var safariSrcSet = function(){
536		if ( !SiteParameters.is_frontend_editor ) {
537			$('html.safari img[sizes]').each(function(){
538				var $img = $(this),
539					sizeImg = parseInt($img.attr('sizes'));
540				if ( typeof(sizeImg) === 'number' ) {
541					$img.attr('sizes', (sizeImg) + 'px');
542				}
543			});
544		}
545	};
546	window.addEventListener('load', safariSrcSet);
547}
548
549UNCODE.lettering = function() {
550
551	var setCTA;
552	var highlightStill = function(){
553
554		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
555
556		$.each($heading_texts, function(key, el) {
557			var $heading = $(el);
558
559			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
560				return;
561			}
562
563			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
564				return;
565			}
566
567			var waypoint = new Waypoint({
568				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
569				element: el,
570				handler: function() {
571					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
572						anims_l = $anims.length;
573					$anims.each(function(_key_, _el_){
574						var $anim = $(_el_);
575
576						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
577							$anim.addClass('heading-text-highlight-animated');
578
579							if ( $heading.data('animate') === true ) {
580								$anim.css({
581									'-webkit-transition-duration': '0ms',
582									'-moz-transition-duration': '0ms',
583									'-o-transition-duration': '0ms',
584									'transition-duration': '0ms',
585								});
586							} else {
587								$anim.css({
588									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
589									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
590									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
591									'transition-delay': ((_key_ + 2) * 200) + 'ms',
592								});
593							}
594						}
595
596					});
597					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
598						$heading.data('animate', true);
599					});
600					$anims.removeAttr('data-animated');
601				},
602				offset: '100%'
603			});
604
605		});
606
607		Waypoint.refreshAll();
608		$( document.body ).trigger('uncode_waypoints');
609		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
610			$(document).trigger('uncode-scrolltrigger-refresh');
611		}
612
613	}
614
615	requestTimeout(function(){
616		highlightStill();
617		$(window).on( 'wwResize', function(){
618			clearRequestTimeout(setCTA);
619			setCTA = requestTimeout( highlightStill, 100 );
620		});
621	}, 400);
622
623};
624
625UNCODE.isUnmodalOpen = false;
626
627var manageVideoSize = function(){
628
629	var setVideoFit;
630	$('.wp-block-embed').each(function(){
631
632		var $this = $(this);
633
634		if ( $('iframe', $this).length ) {
635
636			var $iframe = $('> iframe, > a > iframe', $this),
637				w = parseFloat($iframe.attr('width')),
638				h = parseFloat($iframe.attr('height')),
639				url = $iframe.attr('src'),
640				ratio, frW;
641
642			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
643
644				ratio = h / w;
645				var setResizeiFto,
646					resizeiFrame = function(){
647					frW = $iframe.width();
648					$iframe.css({
649						height: frW * ratio
650					});
651				};
652				resizeiFrame();
653				$(window).on( 'wwResize load', function(){
654					clearRequestTimeout(setResizeiFto);
655					setResizeiFto = requestTimeout( function() {
656						resizeiFrame();
657					}, 10 );
658				});
659
660			}
661
662		}
663
664	});
665
666};
667
668manageVideoSize();
669
670UNCODE.vivus = function(icon, time, delay, file) {
671	if (typeof Vivus !== 'undefined') {
672		var icon_options = {
673			type: 'delayed',
674			pathTimingFunction: Vivus.EASE_OUT,
675			animTimingFunction: Vivus.LINEAR,
676			duration: time,
677		}
678
679		if (delay) {
680			icon_options.delayStart = delay;
681		}
682
683		if (file) {
684			icon_options.file = file;
685		}
686
687		new Vivus(icon, icon_options);
688	}
689};
690
691UNCODE.lastURL = '';
692
693UNCODE.getURLParams = function(current_location, is_string) {
694	var params = {};
695	if (is_string) {
696		var url = current_location.split('?')[1];
697	} else {
698		var url = current_location.search;
699		url = url.substring(1);
700	}
701	if (url) {
702		var parts = url.split('&');
703		for (var i = 0; i < parts.length; i++) {
704			var nv = parts[i].split('=');
705			if (!nv[0]) {
706				continue;
707			}
708			params[nv[0]] = nv[1] || true;
709		}
710	}
711	return params;
712}
713
714UNCODE.hasEqualURLParams = function(obj1, obj2) {
715	for (var i in obj1) {
716		if (obj1.hasOwnProperty(i)) {
717			if (!obj2.hasOwnProperty(i)) {
718				return false;
719			}
720			if (obj1[i] != obj2[i]) {
721				return false;
722			}
723		}
724	}
725	for (var i in obj2) {
726		if (obj2.hasOwnProperty(i)) {
727			if (!obj1.hasOwnProperty(i)) {
728				return false;
729			}
730			if (obj1[i] != obj2[i]) {
731				return false;
732			}
733		}
734	}
735    return true;
736}
737
738UNCODE.magnetic = function(){
739	
740	$(document).on('mousemove', '.un-magnetic-zone', function(e){
741
742		var $zone = $(this),
743			zoneOff = $zone.offset(),
744			$mgntcEl = $('.un-magnetic-el', this),
745			elBound = this.getBoundingClientRect(),
746			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
747
748		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
749	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
750	  
751		$mgntcEl.each(function(key, val){
752			var magneticValue = $(val).attr('data-mgntc') || 0.5;
753		
754			val.animate({
755				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
756			},{
757				duration: 500,
758				fill: 'forwards',
759			})
760	  	});
761	})
762	
763	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
764		var $mgntcEl = $('.un-magnetic-el', this);
765
766		$mgntcEl.each(function(key, val){
767			val.animate({
768		  		transform: 'translate(0)',
769			},{
770		  		duration: 500,
771		  		fill: 'forwards',
772			})
773	  	});
774	})
775};
776
777
778UNCODE.rowParallax = function(){
779
780	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
781		return;
782	}
783
784	var $rows = $('.parallax-move'),
785		stableHeight = UNCODE.wheight;
786	$rows.each(function(){
787		var $row = $(this),
788			_row = $row[0],
789			dataMove = $row.attr('data-parallax-move'),
790			dataSafe = $row.attr('data-parallax-safe'),
791            rowInViewport = false,
792			trans;
793
794		if ( $row.find('.parallax-move').length ) {
795			return;
796		}
797
798		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
799		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
800        dataMove = dataMove / 10;
801
802        if ( 'IntersectionObserver' in window ) {
803			var observer = new IntersectionObserver(function(entries) {
804	
805				entries.forEach(function(entry){
806					if ( entry.isIntersecting ) {
807						rowInViewport = true;
808					} else {
809						rowInViewport = false;
810					}
811				});
812	
813			}, { 
814				root: document,
815			});
816	
817			observer.observe(_row);
818		} else {
819            rowInViewport = true;
820		}
821
822		var loopRAF = function() {
823			if( rowInViewport ) {
824				var bound = _row.getBoundingClientRect(),
825					bound_top = bound.top,
826					bound_height = bound.height,
827					move = true,
828					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
829					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
830						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
831					fromBottom = docH - (scrolled + bound_top + bound_height);
832
833                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
834                    $row.find('>div').css({
835                        'transform':'none'
836                    });
837                    move = false;
838				}
839
840				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
841					$row.find('>div').css({
842						'transform':'none'
843					});
844					move = false;
845				}
846
847				if ( move ) {
848
849					if ( fromBottom < stableHeight ) {
850						//maybe Footer
851						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
852                    } else if ( scrolled + bound_top < stableHeight ) {
853						//maybe Header
854						trans = scrolled*(dataMove);
855					} else {
856						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
857					}
858
859                    $row.find('>div').css({
860                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
861                    });
862                }
863			}
864	
865			requestAnimationFrame(loopRAF);
866		};
867		
868		requestAnimationFrame(loopRAF);
869
870	});
871
872	$(window).on( 'load resize', function(e) {
873		if ( ! UNCODE.isMobile ) {
874			stableHeight = UNCODE.wheight;
875		}
876	});
877
878	$(window).on( 'load wwResize', function(e) {
879		if ( UNCODE.isMobile ) {
880			stableHeight = UNCODE.wheight;
881		}
882	});
883
884}
885
886UNCODE.changeSkinOnScroll = function(){
887	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
888		return;
889	}
890	var $masthead = $('#masthead'),
891		transDesktop,
892		transMobile,
893		changeSkin,
894
895	checkTransparencyAndChange = function( $col ){
896		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
897		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
898		changeSkin = $masthead.hasClass('menu-change-skin');
899
900		if ( ! transDesktop && ! transMobile ) {
901			return false;
902		}
903
904		if ( ! changeSkin ) {
905			return false;
906		}
907
908		if ( $col.hasClass('style-light') ){
909			$masthead.removeClass('style-dark-override').addClass('style-light-override');
910			return false;
911		} else if ( $col.hasClass('style-dark') ) {
912			$masthead.removeClass('style-light-override').addClass('style-dark-override');
913			return false;
914		}
915	};
916
917	var prev_row = 'normal',
918		odd = true,
919		$rows = $('.vc_row[data-parent]:visible:not(.overlay-menu *):not(#uncode-mobile-menu-block *):not(.block-wrapper-parent *)');
920	$.each($rows, function(index, row){
921		var $row = $(row),
922			$col = $('.uncol', $row).first(),
923			$slider = $('.uncode-slider', $row);
924
925		if ( $row.closest('li.menu-item').length ) {
926			return;
927		}
928
929		var wayDown = new Waypoint({
930			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
931			element: row,
932			handler: function(direction) {
933				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
934					if ( $slider.length ) {
935						$col = $('.owl-item.index-active .uncol', $slider).first();
936					}
937					checkTransparencyAndChange($col);
938				}
939				if ( odd === false ) {
940					if ( row.hasAttribute('data-bg-changer') ) {
941						prev_row = 'bg-changer';
942					} else {
943						prev_row = 'normal';
944					}
945					odd = true;
946				} else {
947					odd = false;
948				}
949			},
950			offset: function() {
951				return UNCODE.menuHeight / 2
952			}
953		});
954		var wayUp = new Waypoint({
955			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
956			element: row,
957			handler: function(direction) {
958				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
959					if ( $slider.length ) {
960						$col = $('.owl-item.index-active .uncol', $slider).first();
961					}
962					checkTransparencyAndChange($col);
963				}
964				if ( odd === false ) {
965					if ( row.hasAttribute('data-bg-changer') ) {
966						prev_row = 'bg-changer';
967					} else {
968						prev_row = 'normal';
969					}
970					odd = true;
971				} else {
972					odd = false;
973				}
974			},
975			offset: function() {
976				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
977			}
978		});
979	});
980
981};
982
983UNCODE.share = function() {
984	if (typeof Share !== 'undefined') {
985		var share_button_element = $('.share-button');
986		var share_button_url = share_button_element.data('url');
987
988		var share_button_config = {
989			ui: {
990				flyout: "top center",
991				button_font: false,
992				button_text: '',
993				icon_font: false
994			}
995		};
996
997		if (share_button_url) {
998			share_button_config.url = share_button_url.replace("&", "%26");
999		}
1000
1001		var share_button_top = new Share('.share-button', share_button_config);
1002
1003		$('li[data-network]', share_button_element).each(function(){
1004			var label = SiteParameters.uncode_share_label,
1005				network = $(this).attr('data-network');
1006			label = label.replace("%", network);
1007			$(this).attr('aria-label', label);
1008		});
1009	}
1010};
1011
1012UNCODE.tooltip = function() {
1013	if (typeof jQuery.fn.tooltip !== 'undefined') {
1014		$('.btn-tooltip').tooltip();
1015	}
1016};
1017
1018UNCODE.counters = function() {
1019	var $counters = $('.uncode-counter:not(.counter-init)');
1020	$counters.each(function(){
1021		var $counter = $(this).addClass('counter-init');
1022		if ( SiteParameters.is_frontend_editor ) {
1023			$counter.addClass('started');
1024		}
1025		if ( $counter.closest( '.owl-carousel' ).length ) {
1026			return;
1027		}
1028		$counter.addClass('started').counterUp({
1029			delay: 10,
1030			time: 1500
1031		});
1032	});
1033};
1034
1035UNCODE.countdowns = function() {
1036	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1037	$countdowns.each(function() {
1038		var $this = $(this).addClass('counter-init'),
1039			finalDate = $(this).data('uncode-countdown');
1040		$this.countdown(finalDate, function(event) {
1041			$this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>'));
1042		});
1043	});
1044};
1045
1046UNCODE.tabs = function() {
1047
1048	var tabSwitcher = function($el){
1049		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1049ical):not(.tab-switch)', $el).each(function(key, value){
1050			var $navs = $(value),
1051				$active = $('li.active', $navs),
1052				$active_a = $('> a', $active),
1053				$active_span = $('> span', $active_a),
1054				vertical = $navs.closest('.vertical-tab-menu').length;
1055			
1056			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1057				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1058			}
1059
1060			var $cursor = $('.switcher-cursor', $navs),
1061				active_w = $('a', $active).outerWidth(),
1062				span_w = $active_span.outerWidth(),
1063				active_pos = $active.position(),
1064				active_a_pos = $active_a.position(),
1065				span_pos = $active_span.position(),
1066				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1067				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1068
1069			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1070
1071			if ( ! vertical ) {
1072				$cursor.css({
1073					left: cursor_left,
1074					width: cursor_w
1075				});
1076			}
1077
1078			$navs.addClass('switch-init');
1079		});
1080	};
1081
1082	var $body = $('body');
1083	tabSwitcher($body);
1084
1085	var tabHoverIntent = function(){
1086		var setHover;
1087		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1088			.on('mouseover', function(e){
1089				var $this = $(e.target);
1090				setHover = requestTimeout(function() {
1091					$this.trigger('hover-int');
1092				}, 50);
1093			})
1094			.on('mouseout', function(){
1095				clearRequestTimeout(setHover);
1096			});
1097	};
1098	tabHoverIntent();
1099
1100	var tabInit = function(){
1101		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1102			e.preventDefault()
1103			var $el = $(this);
1104			$el.tab('show');
1105			var $container = $el.closest('.uncode-tabs');
1106			tabSwitcher($container);
1107			requestTimeout(function() {
1108				window.dispatchEvent(UNCODE.boxEvent);
1109				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1110
1111				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1112					window.dispatchEvent(new CustomEvent('boxResized'));
1113				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1114					window.dispatchEvent(new Event('resize'));
1115					$(window).trigger('uncode.re-layout');
1116				} 
1117
1118				var $active_panel = $('.tab-pane.active', $tabs);
1119
1120				$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1121					var element = $(val),
1122						delayAttr = element.attr('data-delay');
1123					if (delayAttr == undefined) delayAttr = 0;
1124					requestTimeout(function() {
1125						element.addClass('start_animation');
1126					}, delayAttr);
1127				});
1128
1129			}, 300);
1130
1131			var $tabs = $(e.currentTarget).closest('.uncode-tabs'),
1132				$non_active_panel = $('.tab-pane:not(.active)', $tabs);
1133			$.each($('.start_animation:not(.t-inside):not(.drop-image-separator)', $non_active_panel), function(index, val) {
1134				var element = $(val);
1135				element.removeClass('start_animation');
1136			});
1137
1138			var $li = $el.closest('li'),
1139				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1140			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1141			$('.tab-pane', $li).slideDown(250);
1142			var completeSlideDown = requestTimeout(function(){
1143				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1144					var pos = $el.offset(),
1145						rect = $el[0].getBoundingClientRect(),
1146						$masthead = $('#masthead > .menu-container'),
1147						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1148
1149					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1150						$('html, body').animate({
1151							scrollTop: ( pos.top ) - considerMenu
1152						},{
1153							easing: 'easeInOutQuad',
1154							duration: 250
1155						});
1156					}
1157				}
1158			}, 260);
1159		});
1160	}
1161	tabInit();
1162
1163	var tabResponsive = function(){
1164		if ( SiteParameters.is_frontend_editor ) {
1165			return true;
1166		}
1167		var $tabContainers = $('.tab-container.tabs-breakpoint');
1168		$tabContainers.each(function(){
1169			var $tabContainer = $(this),
1170				$tabContent = $('.tab-content', $tabContainer),
1171				$nav = $('.nav-tabs', $tabContainer),
1172				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1173
1174			$('> li', $nav).each(function(){
1175				var $li = $(this),
1176					dataID = $li.attr('data-tab-id');
1177
1178				if ( UNCODE.wwidth <= mQuery ) {
1179					if ( ! $('.tab-pane', $li ).length ) {
1180						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1181						$tabContainer.addClass('tabs-appended');
1182						$li.append($append_pane);
1183					}
1184
1185					if ( $li.hasClass('active') ) {
1186						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1187					}
1188				} else {
1189					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1190						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1191						$tabContainer.removeClass('tabs-appended');
1192						$tabContent.prepend($append_pane.removeAttr('style'));
1193					}
1194				}
1195			});
1196		});
1197
1198	}
1199	tabResponsive();
1200
1201	$(window).on('wwResize', function(){
1202		tabHoverIntent();
1203		tabSwitcher($body);
1204	});
1205
1206	var setCTA;
1207	$(window).on( 'resize', function(){
1208		clearRequestTimeout(setCTA);
1209		setCTA = requestTimeout( tabResponsive, 100 );
1210	});
1211
1212	$('.nav-tabs').each(function(){
1213		var $nav = $(this),
1214			$lis = $('> li:not(.active)', $nav),
1215			$links = $('.tab-excerpt-link', $nav);
1216		$('.tab-excerpt', $lis).slideUp(400, function(){
1217			$(this).addClass('init');
1218		});
1219
1220		$links.each(function(){
1221			var $link = $(this),
1222				$par_a = $link.closest('a'),
1223				href = $link.attr('data-href'),
1224				target = $link.attr('data-target');
1225			$par_a.addClass('inner-link');
1226			$link.on('click', function(){
1227				var _link = document.createElement('a');
1228				_link.href = href;
1229				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1230				_link.click();
1231			});
1232		});
1233		$nav.addClass('tab-init');
1234	});
1235
1236	$('.uncode-tabs.tabs-no-lazy').each(function(){
1237		var $tabs = $(this),
1238			$panes = $('.tab-pane:not(.active)', $tabs);
1239		$panes.each(function(){
1240			var $pane = $(this),
1241				$imgs = $('img[loading="lazy"]', $pane);
1242			$imgs.removeAttr('loading');
1243			$imgs.removeAttr('decoding');
1244		});
1245	});
1246
1247};
1248UNCODE.collapse = function() {
1249	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1250		var $this = $(this),
1251			href
1252		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1253		var $target = $(target)
1254		var parent = $this.attr('data-parent')
1255		var $parent = parent && $(parent)
1256		var $title = $(this).parent()
1257		var $accordion = $(e.target).closest('.uncode-accordion')
1258		var $group = $this.closest('.group')
1259		var $panel_group = $this.closest('.panel-group')
1260		if ($parent) {
1261			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1262			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1263				$title.removeClass('active');
1264				$group.removeClass('active-group');
1265			} else {
1266				if ( $panel_group.attr('data-no-toggle') != true ) {
1267					$parent.find('.panel-title').removeClass('active')
1268					$parent.find('.group').removeClass('active-group')
1269				}
1270				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1271				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1272			}
1273		}
1274		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1275		requestTimeout(function() {
1276			var $accordion = $(e.target).closest('.uncode-accordion');
1277			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1278			  window.dispatchEvent(new CustomEvent('boxResized'));
1279			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1280				window.dispatchEvent(new Event('resize'));
1281				$(window).trigger('uncode.re-layout');
1282			} 
1283
1284			var $active_panel = $('.panel.active-group', $parent);
1285
1286			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1287				var element = $(val),
1288					delayAttr = element.attr('data-delay');
1289				if (delayAttr == undefined) delayAttr = 0;
1290				requestTimeout(function() {
1291					element.addClass('start_animation');
1292				}, delayAttr);
1293			});
1294
1295		}, 500);
1296
1297		$group.find('.panel-title:not(.active) > a').trigger('blur');
1298
1299	});
1300
1301	$('.uncode-accordion.tabs-no-lazy').each(function(){
1302		var $accordion = $(this),
1303			$panes = $('.panel:not(.active-group)', $accordion);
1304		$panes.each(function(){
1305			var $pane = $(this),
1306				$imgs = $('img[loading="lazy"]', $pane);
1307			$imgs.removeAttr('loading');
1308			$imgs.removeAttr('decoding');
1309		});
1310	});
1311};
1312
1313UNCODE.accessibility = function() {
1314    if ( ! SiteParameters.uncode_is_accessible ) {
1315        return;
1316    }
1317
1318    //
1319
1320};
1321UNCODE.bigText = function(el) {
1322	var bigTextLaunch = function(){
1323		if (el == undefined) {
1324			el = $('body');
1325		}
1326		$.each($('.bigtext', el), function(index, val) {
1327			$(val).bigtext({
1328				minfontsize: 24
1329			});
1330			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1331				opacity: 1
1332			});
1333			requestTimeout(function() {
1334				if ($(val).find('.animate_when_almost_visible').length != 0) {
1335					$(val).css({opacity: 1});
1336				}
1337			}, 400);
1338		});
1339	};
1340
1341	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1342		bigTextLaunch();
1343	}
1344	$(window).on( 'load', bigTextLaunch );
1345};
1346
1347UNCODE.process_shortpixel_image = function(image) {
1348	var data = {
1349		action: 'shortpixel_manual_optimization',
1350		image_id: image,
1351		cleanup: true
1352	};
1353
1354	$.get(SiteParameters.ajax_url, data);
1355};
1356
1357UNCODE.animateSubInside = function( _this, remove ){
1358	if ( typeof remove !== 'undefined' && remove === true ) {
1359		$(document).trigger('sub-menu-slide-up');
1360		$('.animate_when_almost_visible, .translate_when_almost_visible', _this).each(function(){
1361			$(this).removeClass('start_animation').css({ 'animation-delay': '0s', 'transition-delay': '0s'});
1362		});
1363	} else {
1364		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', _this), function(index, val) {
1365			var element = $(val),
1366				delayAttr = element.attr('data-delay');
1367			if (delayAttr == undefined) delayAttr = 0;
1368			element.css({ 'animation-delay': delayAttr + 'ms', 'transition-delay': delayAttr + 'ms'});
1369			element.addClass('start_animation');
1370		});
1371		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1372	}
1373};
1374
1375
1376UNCODE.menuToggleAnimation = function() {
1377	var $block = $('body'),
1378		$menuBlocks = $('.menu.unmenu-block', $block),
1379		$allSeqs = $('[data-delay-seq]', $block);
1380
1381	$allSeqs.each(function(key, seq){
1382		$(seq).removeAttr('data-delay');
1383	});
1384
1385	$menuBlocks.each(function(key, menu){
1386
1387		var $animatesHidden = $('.translate_when_almost_visible', menu).filter(':hidden');
1388		$animatesHidden.each(function(key_, seq){
1389			$(seq).removeClass('translate_when_almost_visible').addClass('not_translate_when_almost_visible');
1390		});
1391
1392		var $animatesVisibile = $('.not_translate_when_almost_visible', menu).filter(':visible');
1393		$animatesVisibile.each(function(key_, seq){
1394			$(seq).removeClass('not_translate_when_almost_visible').addClass('translate_when_almost_visible');
1395		});
1396
1397		var $delaySequentials = $('[data-delay-seq]', menu).filter(':visible'),
1398			delay = parseFloat( $delaySequentials.first().attr('data-delay-seq') ),
1399			interval = parseFloat( $delaySequentials.first().attr('data-interval') );
1400		$delaySequentials.each(function(_key, seq){
1401			$(seq).attr('data-delay', delay + (interval*_key));
1402		});
1403	});
1404};
1405
1406// Registrato al caricamento dello script (prima di UNCODE.init → unBlockMenu),
1407// così il trigger sincrono 'unblock-toggles-init' trova già il listener attivo.
1408$(document).on('unblock-toggles-init', UNCODE.menuToggleAnimation);
1409
1410UNCODE.menuSystem = function() {
1411
1412	function menuMobile() {
1413		var $body = $('body'),
1414			scrolltop,
1415			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1416			$masthead = $('#masthead'),
1417			$menuBlock = $('#uncode-mobile-menu-block'),
1418			$box,
1419			$el,
1420			$el_transp,
1421			elHeight,
1422			offCanvasAnim,
1423			check,
1424			animating = false,
1425			stickyMobile = false,
1426			menuClose = new CustomEvent('menuMobileClose'),
1427			menuOpen = new CustomEvent('menuMobileOpen');
1428		UNCODE.menuOpened = false;
1429		$mobileToggleButton.on('click', function(event) {
1430			event.stopPropagation();
1431			var btn = this;
1432			if ($(btn).hasClass('overlay-close')) return;
1433			event.preventDefault();
1434			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1435			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1436				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1437				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1438				$el_transp = $('.menu-absolute.menu-transparent');
1439				if (UNCODE.isMobile) {
1440					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) {
1441						stickyMobile = true;
1442						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1443					} else {
1444						elHeight = 0;
1445						$.each($box.find('> div'), function(index, val) {
1446							elHeight += $(val).outerHeight();
1447						});
1448					}
1449				} else {
1450					elHeight = 0;
1451					$.each($el, function(index, val) {
1452						elHeight += $(val).outerHeight();
1453					});
1454				}
1455				var open = function() {
1456					clearTimeout(offCanvasAnim);
1457					if (!animating) {
1458						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1459						scrolltop = $(window).scrollTop();
1460						window.dispatchEvent(menuOpen);
1461						animating = true;
1462						UNCODE.menuOpened = true;
1463						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1464							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1465								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1466							}
1467							if ($('body.menu-offcanvas').length) {
1468								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1469								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1469UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1470							} else {
1471								if ( $('.menu-hide, .menu-sticky').length ) {
1472									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1473										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1474									}
1475								}
1476							}
1477						}
1478						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1479							//$("#masthead")[0].scrollIntoView();
1480							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1481						}
1482						$box.addClass('open-items');
1483						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1484							$el_transp.addClass('is_mobile_open');
1485						}
1486						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1487							btn.classList.add('close');
1488							$box.animate({
1489								height: elHeight
1490							}, 600, "easeInOutCirc", function() {
1491								animating = false;
1492								if (!stickyMobile) $box.css('height', 'auto');
1493							});
1494						} else {
1495							animating = false;
1496						}
1497
1498						if ( $menuBlock.length ) {
1499							UNCODE.animateSubInside($menuBlock);
1500						}
1501					}
1502				};
1503
1504				var close = function() {
1505					clearTimeout(offCanvasAnim);
1506					if (!animating) {
1507						window.dispatchEvent(menuClose);
1508						animating = true;
1509						UNCODE.menuOpened = false;
1510						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1511							btn.classList.remove('close');
1512							btn.classList.add('closing');
1513						}
1514						$box.addClass('close');
1515						requestTimeout(function() {
1516							$box.removeClass('close');
1517							$box.removeClass('open-items');
1518							btn.classList.remove('closing');
1519							if ($el_transp.length) {
1520								$el_transp.removeClass('is_mobile_open');
1521							}
1522						}, 500);
1523						$body.removeClass('opening-overlay-menu');
1524						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1525							$box.animate({
1526								height: 0
1527							}, {
1528								duration: 600,
1529								easing: "easeInOutCirc",
1530								complete: function(elements) {
1531									$(elements).css('height', '');
1532									animating = false;
1533									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1534										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1535									}
1536									$body.removeClass('open-overlay-menu');
1537									if ( $menuBlock.length ) {
1538										UNCODE.animateSubInside($menuBlock, true);
1539									}
1540								}
1541							});
1542						} else {
1543							animating = false;
1544							offCanvasAnim = setTimeout(function(){
1545								$body.removeClass('open-overlay-menu');
1546								if ( $menuBlock.length ) {
1547									UNCODE.animateSubInside($menuBlock, true);
1548								}
1549							}, 1000);
1550						}
1551					}
1552				};
1553				check = (!UNCODE.menuOpened) ? open() : close();
1554			}
1555		});
1556
1557		$('html').on('click', function(event){
1558			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1559				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1560			}
1561		});
1562
1563		window.addEventListener('menuMobileTrigged', function(e) {
1564			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1565		});
1566		window.addEventListener('orientationchange', function(e) {
1567			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1568		});
1569		window.addEventListener("resize", function() {
1570			if ($(window).width() < UNCODE.mediaQuery) {
1571				if (UNCODE.isMobile) {
1572					var $box = $('.box-container .main-menu-container'),
1573						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1574					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1575						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1576							elHeight = 0;
1577							$.each($el, function(index, val) {
1578								elHeight += $(val).outerHeight();
1579							});
1580							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
1581							$($box).css('height', elHeight + 'px');
1582						}
1583					}
1584				}
1585			} else {
1586				$('.menu-hide-vertical').removeAttr('style');
1587				$('.menu-container-mobile').removeAttr('style');
1588				$('.vmenu-container.menu-container').removeAttr('style');
1589
1590				if ( UNCODE.menuOpened ) {
1591					$('.open-items').removeClass('open-items');
1592					$('.is_mobile_open').removeClass('is_mobile_open');
1593					$('.open-overlay-menu').removeClass('open-overlay-menu');
1594					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1595				}
1596			}
1597		});
1598
1599		$(window).on('scroll', function(){
1600			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1601				$(window).scrollTop(scrolltop);
1602				return false;
1603			}
1604		});
1605
1606	};
1607
1608	function menuOffCanvas() {
1609		var menuClose = new CustomEvent('menuCanvasClose'),
1610			menuOpen = new CustomEvent('menuCanvasOpen');
1611		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1612			if ($(window).width() > UNCODE.mediaQuery) {
1613				if ( $('body.vmenu-offcanvas-overlay').length ) {
1614					if ($(event.currentTarget).hasClass('off-close')) {
1615						$(event.currentTarget).removeClass('off-close');
1616						requestTimeout(function() {
1617							window.dispatchEvent(menuClose);
1618						}, 500);
1619
1620					} else {
1621						$(event.currentTarget).addClass('off-close');
1622						window.dispatchEvent(menuOpen);
1623					}
1624				} else {
1625					if ($(event.currentTarget).hasClass('close')) {
1626						$(event.currentTarget).removeClass('close');
1627						$(event.currentTarget).addClass('closing');
1628						requestTimeout(function() {
1629							$(event.currentTarget).removeClass('closing');
1630							window.dispatchEvent(menuClose);
1631						}, 500);
1632
1633					} else {
1634						$(event.currentTarget).addClass('close');
1635						window.dispatchEvent(menuOpen);
1636					}
1637				}
1638			}
1639
1640			$('body').toggleClass('off-opened');
1641		});
1642
1643		$('body').on('click.menu-off-canvas-mobile', function(e){
1644			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1645				var $vMenuCont = $('#masthead .vmenu-container'),
1646					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1647
1648					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1649					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1650					vmenu_off = $vMenuCont.offset(),
1651					vmenu_l = parseFloat(vmenu_off.left),
1652					vmenu_t = parseFloat(vmenu_off.top),
1653					vmenu_r = vmenu_l + vmenu_w,
1654					vmenu_b = vmenu_t + vmenu_h,
1655
1656					close_h = parseFloat( $close_menu.outerHeight() ),
1657					close_w = parseFloat( $close_menu.outerWidth() ),
1658					close_off = $close_menu.offset(),
1659					close_l = parseFloat(close_off.left),
1660					close_t = parseFloat(close_off.top),
1661					close_r = close_l + close_w,
1662					close_b = close_t + close_h;
1663				if (
1664					!(
1665						e.clientX > vmenu_l &&
1666						e.clientX < vmenu_r
1667					)
1668					||
1669					(
1670						e.clientX > close_l &&
1671						e.clientX < close_r
1672					)
1673				) {
1674					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1675				}
1676			}
1677		});
1678	};
1679
1680	function menuOverlay() {
1681		if ( $('.overlay').length ) {
1682			$('.overlay').removeClass('hidden');
1683		}
1684		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1685			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) {
1686				var transDelay = (index / 20) + 0.1;
1687				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1688					transDelay = transDelay + 0.3;
1689				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
1690			});
1691		}
1692	};
1693
1694	// menuToggleAnimation è definita a livello globale (vedi UNCODE.menuToggleAnimation
1695	// più in alto) e il listener 'unblock-toggles-init' viene registrato una sola volta
1696	// al caricamento dello script, così è già attivo quando UNCODE.unBlockMenu() lo lancia.
1697
1698	var $secondary_parent;
1699	function menuAppend() {
1700
1701		var $menuBlock = $('#uncode-mobile-menu-block').length;
1702		if ( $menuBlock ) {
1703			return;
1704		}
1705		var $body = $('body'),
1706			$menuCont = $('.menu-container:not(.vmenu-container)'),
1707			$vMenuCont = $('.menu-container.vmenu-container'),
1708			$cta = $('.navbar-cta'),
1709			$socials = $('.navbar-social:not(.appended-navbar)'),
1710			$ul = $('.navbar-main ul.menu-primary-inner'),
1711			$ulCta,
1712			$ulSocials,
1713			$navLast,
1714			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1715			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1716			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1717			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1718			$ulFirst = $('> ul', $firstNav),
1719			setCTA,
1720			appendCTA = function(){
1721				return true;
1722			},
1723			appendSocials = function(){
1724				return true;
1725			},
1726			appendSplit = function(){
1727				return true;
1728			};
1729
1730		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1731			$ulCta = $('> ul', $cta);
1732			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1733
1734			appendCTA = function(){
1735				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1736					$ul.after($ulCta);
1737				} else {
1738					$cta.append($ulCta);
1739				}
1740			}
1741		}
1742
1743		if ( ! $body.hasClass('cta-not-appended') ) {
1744			appendCTA();
1745		}
1746
1747		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1748		$smartSocial.each(function(){
1749			var $_smartSocial = $(this);
1750			$('> li', $_smartSocial).each(function(){
1751				var $li = $(this);
1752				if ( $li.hasClass('mobile-hidden') ) {
1753					$_smartSocial.addClass('mobile-hidden');
1754				} else {
1755					$_smartSocial.removeClass('mobile-hidden');
1756					return false;
1757				}
1758			});
1759
1760			$('> li', $_smartSocial).each(function(){
1761				var $li = $(this);
1762				if ( $li.hasClass('tablet-hidden') ) {
1763					$_smartSocial.addClass('tablet-hidden');
1764				} else {
1765					$_smartSocial.removeClass('tablet-hidden');
1766					return false;
1767				}
1768			});
1769		});
1770
1771		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1772			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1773			if ( $body.hasClass('hmenu-center-split') ) {
1774				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1775			} else {
1776				$navLast = $('.navbar-nav-last', $vMenuCont);
1777			}
1778
1779			if ( ! $navLast.length ) {
1780				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1781				if ( $body.hasClass('hmenu-center-split') ) {
1782					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1783					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1784				} else {
1785					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1786					$navLast = $('.navbar-nav-last', $vMenuCont);
1787				}
1788			}
1789
1790			appendSocials = function(){
1791				if ( !$body.hasClass('menu-overlay-center') ) {
1792				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1793				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1794				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1795				// 		$ulSocials.each(function(){
1796				// 			var $li_social = $(this);
1797				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1798				// 		});
1799				// 	}
1800				// } else {
1801					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1802						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1803						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1804							$('> ul.menu-smart-social li', $socials).remove();
1805						}
1806						$navLast.append($ulSocials);
1807					} else {
1808						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1809							$('> ul.menu-smart-social li', $navLast).remove();
1810						}
1811						$socials.append($ulSocials);
1812					}
1813				}
1814			}
1815			appendSocials();
1816		}
1817
1818		if ( $vMenuCont.length ) {
1819			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1820		} else {
1821			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1822		}
1823		if ( $accordion_secondary.length ) {
1824			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1825			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1826				if ( !$accordion_secondary_ph.length ) {
1827					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1828				}
1829				if ( $vMenuCont.length ) {
1830					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1831				} else {
1832					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1833						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1834					} else {
1835						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1836					}
1837				}
1838			} else {
1839				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1840					$accordion_secondary_ph.before($accordion_secondary);
1841				}
1842			}
1843		}
1844
1845		if ( $vMenuCont.length ) {
1846			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1847		} else {
1848			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1849		}
1850
1851		if ( $extra_icons.length ) {
1852			if ( $vMenuCont.length ) {
1853				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1854					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1855						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1856							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1857						$not_social.each(function(){
1858							if ( ! $primary_after.length ) {
1859								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1860								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1861								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1862							}
1863							var $extra_li = $(this);
1864							$primary_after.find('> ul').append($extra_li);
1865						});
1866					} else {
1867						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1868							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1869						$not_social.each(function(){
1870							var $extra_li = $(this);
1871							$extra_icons.find('> ul').append($extra_li);
1872						});
1873					}
1874				} /*else {
1875					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1876					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1877						if ( !$extra_icons_ph.length ) {
1878							$extra_icons.after('<span class="extra-icons-ph" />');
1879						}
1880						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1881							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1882						} else {
1883							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1884						}
1885					} else {
1886						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1887							$extra_icons_ph.before($extra_icons);
1888						}
1889					}
1890				}*/
1891			} else {
1892				if ( ! $body.hasClass('hmenu-center-double') ) {
1893					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1894						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1895							$primary_after = $('.nav.navbar-main-after', $menuCont);
1896
1897						if ( ! $primary_after.length && $not_social.length ) {
1898							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1899								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1900							} else {
1901								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1902							}
1903							$primary_after = $('.nav.navbar-main-after', $menuCont);
1904							$primary_after.append('<ul class="menu-smart sm menu-smart-social" />');
1905						}
1906						var tablet_hidden = true,
1907							mobile_hidden = true;
1908						$not_social.each(function(){
1909							var $extra_li = $(this);
1910							$primary_after.find('> ul').append($extra_li);
1911							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1912								tablet_hidden = false;
1913							}
1914							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1915								mobile_hidden = false;
1916							}
1917						});
1918						if ( tablet_hidden === true && $not_social.length ) {
1919							$primary_after.addClass('tablet-hidden');
1920						}
1921						if ( mobile_hidden === true && $not_social.length ) {
1922							$primary_after.addClass('mobile-hidden');
1923						}
1924					} else {
1925						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1926
1927						if ( $primary_after.length ) {
1928							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1929							$not_social.each(function(){
1930								var $extra_li = $(this);
1931								$extra_icons.find('> ul').append($extra_li);
1932							});
1933							$primary_after.remove();
1934						}
1935					}
1936				}
1937			}
1938		}
1939
1940		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1941			appendSplit = function(){
1942				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1943					if ( $extra_icons.length ) {
1944						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1945							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1946								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1947							$not_social.each(function(){
1948								var $extra_li = $(this);
1949								$append_ul.append($extra_li);
1950							});
1951							if ( $secondNav.length ) {
1952								$secondNav.append($append_ul);
1953							} else {
1954								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1955							}
1956						}
1957					}
1958					if ( $secondNav.length ) {
1959						$secondNav.prepend($ulFirst);
1960					} else {
1961						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1962					}
1963					$firstMenu.hide();
1964				} else {
1965					$firstNav.append($ulFirst);
1966					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1967					if ( $append_ul.length ) {
1968						var $not_social = $('> li:not(.social-icon)', $append_ul);
1969						$not_social.each(function(){
1970							var $extra_li = $(this);
1971							$extra_icons.find('> ul').append($extra_li);
1972						});
1973					}
1974					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1975					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1976					$firstMenu.css({
1977						'display': 'table-cell'
1978					});
1979				}
1980			}
1981		}
1982		appendSplit();
1983
1984		$(window).on( 'wwResize', function(){
1985			clearRequestTimeout(setCTA);
1986			setCTA = requestTimeout( function() {
1987				appendCTA();
1988				appendSocials();
1989				appendSplit();
1990			}, 10 );
1991		});
1992	}
1993	//menuMobileButton();
1994	menuMobile();
1995	menuOffCanvas();
1996	menuAppend();
1997	menuOverlay();
1998
1999	var stickyDropdownSearch = function(){
2000		var $masthead = $('#masthead'),
2001			$ddSearch = $('.overlay.overlay-search', $masthead),
2002			$styles = $('#stickyDropdownSearch').remove();
2003		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
2004			var $menuWrapper = $('.menu-wrapper'),
2005				$navbar = $('.menu-container-mobile', $menuWrapper),
2006				navbarH = $navbar.outerHeight(),
2007				//$topbar = $('.top-menu', $menuWrapper),
2008				//topbarH = $topbar.outerHeight(),
2009				_css;
2010
2011			_css = '<style id="stickyDropdownSearch">';
2012			_css += '@media (max-width: 959px) {';
2013			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
2014			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
2015			_css += '}';
2016			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
2017			_css += 'position: fixed;';
2018			_css += 'top: 0;';
2019			_css += '}';
2020			_css += '</style>';
2021
2022			$(_css).appendTo($('head'));
2023		}
2024	}
2025	stickyDropdownSearch();
2026
2027	var setMenuOverlay;
2028	$(window).on( 'wwResize', function(){
2029		if ( $('.overlay').length && $(window).width() > 1024 ) {
2030			$('.overlay').addClass('hidden');
2031		}
2032		clearRequestTimeout(setMenuOverlay);
2033		setMenuOverlay = requestTimeout( function(){
2034			menuOverlay();
2035			menuAppend();
2036			stickyDropdownSearch();
2037		}, 150 );
2038	});
2039	UNCODE.menuMegaBlock();
2040	UNCODE.menuSmartInit();
2041	$(window).on('wwResize', function(){
2042		UNCODE.menuSmartInit();
2043	});
2044
2045	$(window).on('menuOpen', function(){
2046		var $overlay = $('.overlay.overlay-unblock');
2047		if ( $overlay.length ) {
2048			UNCODE.animateSubInside($overlay);
2049		}
2050	});
2051
2052	$(window).on('menuClosed', function(){
2053		var $overlay = $('.overlay.overlay-unblock');
2054		if ( $overlay.length ) {
2055			UNCODE.animateSubInside($overlay, true);
2056			var $smartMenus = $overlay.find('.menu-smart');
2057			$smartMenus.each(function(key, smartMenu){
2058				$(smartMenu).smartmenus('menuHideAll');
2059			});
2060		}
2061	});
2062};
2063
2064UNCODE.menuSmartInit = function() {
2065	var $menusmart = $('[class*="menu-smart"]'),
2066		$masthead = $('#masthead'),
2067		$hMenu = $('.menu-horizontal-inner', $masthead),
2068		$focus = $('.overlay-menu-focus'),
2069		$uls_anim = $('> li> ul.un-submenu', $menusmart),
2070		showTimeout = 50,
2071		hideTimeout = 50,
2072		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2073
2074	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2075		var menu_anim = $masthead.attr('data-menu-anim');
2076		if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
2077			$uls_anim.each(function(){
2078				var $ul_anim = $(this);
2079				if ( !$('> li[data-block]', $ul_anim).length ) {
2080					$ul_anim.addClass('animate_when_almost_visible');
2081					$ul_anim.addClass(menu_anim);
2082				} else {
2083					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2084					if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2085						$ul_anim.addClass('animate_when_almost_visible');
2086						$ul_anim.addClass(dataB);
2087					}
2088				}
2089			});
2090		} else {
2091			$uls_anim.each(function(){
2092				var $ul_anim = $(this);
2093				if ( !$('> li[data-block]', $ul_anim).length ) {
2094					$ul_anim.removeClass('animate_when_almost_visible');
2095					$ul_anim.removeClass(menu_anim);
2096				} else {
2097					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2098					$ul_anim.removeClass('animate_when_almost_visible');
2099					$ul_anim.removeClass(dataB);
2100				}
2101			});
2102		}
2103	}
2104
2105	$('> li.menu-item-has-children', $menusmart).hover(function(){
2106		$(this).data('hover', true);
2107	}, function(){
2108		$(this).data('hover', false);
2109	});
2110
2111	$('> li.menu-item-has-children', $menusmart).each(function(){
2112		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2113	});
2114
2115	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2116		e.preventDefault();
2117	});
2118
2119	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2120			
2121		var $notLis = $('> .nav > ul > li a', $hMenu),
2122			$menuA = $('a', $masthead).not($notLis),
2123			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2124			showFuncCond = function() { return true };
2125
2126		if ( $('body').hasClass('focus-megamenu') ) {
2127			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2128			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2129		} else if ( $('body').hasClass('focus-links') ) {
2130			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2131		}
2132
2133		$hoverSelector.hover(function(){
2134			clearRequestTimeout(hideTimeoutFunc);
2135			showTimeoutFunc = requestTimeout(function(){
2136				$('body').addClass('navbar-hover');
2137			}, showTimeout*2);
2138		}, function(){
2139			hideTimeoutFunc = requestTimeout(function(){
2140				if ( ! $('.overlay-search.open', $masthead).length ) {
2141					$('body').removeClass('navbar-hover');
2142				}
2143			}, hideTimeout*2);
2144		});
2145	} else {
2146		showFuncCond = function() { return false };
2147	}
2148
2149	if ($menusmart.length > 0) {
2150		var objShowTimeout;
2151		$menusmart.smartmenus({
2152			subIndicators: false,
2153			subIndicatorsPos: 'append',
2154			//subMenusMinWidth: '13em',
2155			showOnClick: SiteParameters.menuShowOnClick,
2156			subIndicatorsText: '',
2157			showTimeout: showTimeout,
2158			hideTimeout: hideTimeout,
2159			scrollStep: 8,
2160			showFunction: function($ul, complete) {
2161				$(document).trigger('un-menu-show', $ul);
2162				clearRequestTimeout(showTimeoutFunc);
2163				$ul.fadeIn(0, 'linear', function(){
2164					complete();
2165					if ( $ul.hasClass('vc_row') ) {
2166						$ul.css({
2167							'display': 'table'
2168						});
2169					}
2170					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2171						$('body').addClass('open-megamenu');
2172					}
2173					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2174						$('body').addClass('navbar-hover');
2175					}
2176					var showed = 0;
2177					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(index, val){
2178						var $element = $(this),
2179							delayAttr = $element.attr('data-delay');
2180						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2181							if (delayAttr == undefined) delayAttr = 0;
2182							requestTimeout(function() {
2183								$element.addClass('start_animation');
2184							}, delayAttr);
2185						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2186							var grid = $element.closest('.cssgrid-animate-sequential');
2187
2188							var delay = index,
2189								delayAttr = parseInt($element.attr('data-delay'));
2190							if (isNaN(delayAttr)) delayAttr = 100;
2191							delay -= showed;
2192							objShowTimeout = requestTimeout(function() {
2193								$element.removeClass('zoom-reverse').addClass('start_animation');
2194								showed = index;
2195							}, delay * delayAttr);
2196						}
2197					});
2198					if ( $ul.is('.animate_when_almost_visible') ) {
2199						$ul.addClass('start_animation');
2200					}
2201				}).addClass('open-animated');
2202			},
2203			hideFunction: function($ul, complete) {
2204				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2205					$('body').removeClass('open-megamenu');
2206				}
2207				var fixIE = $('html.ie').length;
2208				if (fixIE) {
2209					var $rowParent = $($ul).closest('.main-menu-container');
2210					$rowParent.height('auto');
2211				}
2212				$ul.fadeOut(0, 'linear', function(){
2213					complete();
2214					$ul.removeClass('open-animated');
2215					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2216						$('body').removeClass('open-submenu');
2217					}
2218					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(){
2219						$(this).removeClass('start_animation');
2220					});
2221					if ( $ul.is('.animate_when_almost_visible') ) {
2222						$ul.removeClass('start_animation');
2223					}
2224				});
2225				$ul.find('.start_animation').each(function(index, val) {
2226					clearRequestTimeout(subMenuRT);
2227					$(val).removeClass('start_animation');
2228				});
2229				$(document).trigger('un-menu-hide', $ul);
2230				clearRequestTimeout(objShowTimeout);
2231			},
2232			collapsibleShowFunction: function($ul, complete) {
2233				$ul.slideDown(400, 'easeInOutCirc', function(){
2234					UNCODE.animateSubInside($ul);
2235					complete();
2236				});
2237			},
2238			collapsibleHideFunction: function($ul, complete) {
2239				$ul.slideUp(200, 'easeInOutCirc', function(){
2240					complete();
2241				});
2242				$(document).trigger('sub-menu-slide-up');
2243			},
2244			hideOnClick: SiteParameters.menuHideOnClick,
2245		});
2246
2247		if ( $('body').hasClass('menu-accordion-active') ) {
2248			$menusmart.each(function(key, menu){
2249				$(menu).addClass('menu-smart-init');
2250				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2251			});
2252		}
2253
2254		$menusmart.each(function(key, menu){
2255			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2256				if ( $('> .trigger-window-resize', $sub).length ) {
2257					window.dispatchEvent(new Event('resize'));
2258					$(window).trigger('uncode.re-layout');
2259				} else if ( $('> .trigger-box-resize', $sub).length ) {
2260					window.dispatchEvent(new CustomEvent('boxResized'));
2261				}
2262				return false;
2263			});
2264		});
2265		
2266		$(document).on( 'uncode.smartmenu-appended', function(){
2267			requestTimeout(function(){
2268				$menusmart.smartmenus( 'refresh' );
2269			}, 1000);
2270		});
2271
2272	}
2273
2274	$('.main-menu-container').each(function(){
2275		var $main_cont = $(this),
2276			$uls = $('ul:not(.nav-tabs)', $main_cont);
2277
2278		$uls.each(function(){
2279			var $ul = $(this),
2280				mobile_hidden = true,
2281				tablet_hidden = true;
2282			$('> li:not(.hidden)', $ul).each(function(){
2283				if ( !$(this).hasClass('mobile-hidden') ) {
2284					mobile_hidden = false;
2285					return false;
2286				}
2287			});
2288			$('> li:not(.hidden)', $ul).each(function(){
2289				if ( !$(this).hasClass('tablet-hidden') ) {
2290					tablet_hidden = false;
2291					return false;
2292				}
2293			});
2294			if ( mobile_hidden ) {
2295				$ul.addClass('mobile-hidden');
2296			}
2297			if ( tablet_hidden ) {
2298				$ul.addClass('tablet-hidden');
2299			}
2300		});
2301
2302		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2303
2304		$divUlsMB.each(function(){
2305			var $divUlMB = $(this),
2306				div_mobile_hidden = true,
2307				div_tablet_hidden = true;
2308
2309			$('> ul:not(.hidden)', $divUlMB).each(function(){
2310				if ( !$(this).hasClass('mobile-hidden') ) {
2311					div_mobile_hidden = false;
2312					return false;
2313				}
2314			});
2315			$('> ul:not(.hidden)', $divUlMB).each(function(){
2316				if ( !$(this).hasClass('tablet-hidden') ) {
2317					div_tablet_hidden = false;
2318					return false;
2319				}
2320			});
2321			if ( div_mobile_hidden ) {
2322				$divUlMB.addClass('mobile-hidden');
2323			}
2324			if ( div_tablet_hidden ) {
2325				$divUlMB.addClass('tablet-hidden');
2326			}
2327		});
2328	});
2329
2330	var overlaySearchButton = function(){
2331		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2332
2333		$search_wrap.each(function(){
2334			var $form = $('form', this),
2335				$icon = $('i', $form);
2336
2337			$icon.on('click', function(){
2338				$form.submit();
2339			});
2340		});
2341	};
2342	overlaySearchButton();
2343}
2344
2345UNCODE.menuMegaBlock = function() {
2346	var $megaBlocks = $('.megamenu-block-wrapper');
2347	if ( ! $megaBlocks.length ) {
2348		return;
2349	}
2350
2351	$megaBlocks.each(function(){
2352		var $megaLi = $(this),
2353			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2354			dataLi = $megaLi.attr('data-block'),
2355			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2356			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2357		$megaUl.addClass(dataLi);
2358		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2359		$('img', $megaLi).removeAttr('loading');
2360	});
2361}
2362
2363UNCODE.unBlockMenu = function(){
2364	//Menu block
2365	var $unBlockMenus = $('.menu.unmenu-block');
2366
2367	$unBlockMenus.each(function(){
2368		var $unBlockMenu = $(this),
2369			$lastOnes;
2370
2371		if ( !$unBlockMenu.hasClass('first-grid') ) {
2372			$lastOnes = $('ul', $unBlockMenu).last();
2373			$lastOnes.each(function(){
2374                var _cols = $(this).css('grid-template-columns');
2375				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2376					$unBlockMenu.addClass('has-last-ones');
2377					$(this).addClass('last-one');
2378				} else {
2379					var $parentLi = $(this).closest('li'),
2380						$siblingLi = $parentLi.next();
2381					if ( !$siblingLi.length ) {
2382						$unBlockMenu.addClass('has-last-ones');
2383						$(this).addClass('last-one');
2384					}
2385				}
2386			});
2387		} else {
2388			var checkGrids = function(){
2389				$unBlockMenu.find('.last-ul').removeClass('last-one');
2390				var _cols = $unBlockMenu.css('grid-template-columns'),
2391                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2392					$lis = $('> li', $unBlockMenu),
2393					totLi = $lis.length,
2394					lastRowCount = totLi - (totLi % cols || cols),
2395					$lastLis = $lis.slice(cols).addClass('last-lis'),
2396    				$lastRowLis = $lis.slice(lastRowCount);
2397				$lastRowLis.each(function(){
2398					var $lastRowLi = $(this);
2399					$lastRowLi.find('ul').last().addClass('last-one');
2400				});
2401			}
2402			$(window).on('wwResize', checkGrids);
2403			checkGrids();
2404
2405		}
2406
2407	});
2408
2409	//Accordion
2410
2411	var $tgglBlocks = $('.unmenu-collapse');
2412	$tgglBlocks.each(function(key, val){
2413		var $acc = $(val),
2414			$titles = $('.menu-item-has-children > *:first-child', $acc),
2415			run = true;
2416
2417		var checkRun = function(){
2418			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2419				run = false;
2420			} else {
2421				run = true;
2422			}
2423
2424			if ( $titles.length ) {
2425				$titles.each(function(_key, _val){
2426					var $title = $(_val),
2427						$sub = $title.closest('li').find('> ul.un-submenu');
2428
2429					$sub.each(function(key, val){
2430						if ( run ) {
2431
2432							var total = $sub.length;
2433							var completed = 0;
2434				
2435							$(val).slideUp({
2436								duration: 1,
2437								complete: function() {
2438									$(this).addClass('toggle-init');
2439
2440									completed++;
2441
2442									if ( completed === total ) {
2443										$(document).trigger('unblock-toggles-init');
2444										$( document.body ).trigger( 'uncode_waypoints' );
2445									}
2446								}
2447							});
2448						} else {
2449							$(val).show();
2450						}
2451					});
2452				});
2453			} else {
2454				$(document).trigger('unblock-toggles-init');
2455				console.log('check');
2456				$( document.body ).trigger( 'uncode_waypoints' );
2457			}
2458		}
2459		checkRun();
2460
2461		$(window).on('wwResize menuClosed', checkRun);
2462
2463		if ( $titles.length ) {
2464			$titles.each(function(_key, _val){
2465				var $title = $(_val),
2466					$sub = $title.closest('li').find('> ul.un-submenu'),
2467					$menu = $sub.closest('.menu.unmenu-block'),
2468					$ulS;
2469
2470				$title.off('click').on('click', function(e){
2471					e.preventDefault();
2472					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2473					if ( run ) {
2474						if ( $sub.is(':visible') ) {
2475							$sub.slideUp(200, 'easeInOutCirc', function(){
2476								$.each($('.start_animation', $sub), function(index, val) {
2477									var element = $(val);
2478									element.removeClass('start_animation');
2479
2480								});
2481								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2482								$(document).trigger('sub-menu-slide-up');
2483							});
2484						} else {
2485							$ulS.slideUp({
2486								duration: 200,
2487								easing: 'easeInOutCirc',
2488								start: function(){
2489									var _this = $(this);
2490									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2491									$(document).trigger('sub-menu-slide-up');
2492								}
2493							});
2494
2495							$sub.slideDown({
2496								duration: 400,
2497								easing: 'easeInOutCirc',
2498								start: function() {
2499									var _this = $(this);
2500									_this.css('height', 0);
2501									if ( _this.hasClass('is-grid') ) {
2502										_this.css('display','grid');
2503									}
2504
2505									UNCODE.animateSubInside(_this)
2506									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2507								}
2508							});
2509						}
2510
2511					}
2512				});
2513			});
2514
2515			if ( $acc.closest('#masthead').length ) {
2516				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2517					if ( !run ) return;
2518					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2519				});
2520			}
2521		}
2522
2523	});
2524	
2525};
2526
2527UNCODE.mobileMenuBlockSkins = function(){
2528	var $mobileBlock = $('#uncode-mobile-menu-block'),
2529		$parentDark = $mobileBlock.closest('.submenu-dark'),
2530		$parentLight = $mobileBlock.closest('.submenu-light');
2531
2532
2533	if ( $parentDark.length ) {
2534		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2535		$cols.each(function(key, val){
2536			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2537		});
2538	}
2539
2540	if ( $parentLight.length ) {
2541		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2542		$cols.each(function(key, val){
2543			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2544		});
2545	}
2546};
2547UNCODE.okvideo = function(ev) {
2548	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2549	$.okvideo = function(options) {
2550		// if the option var was just a string, turn it into an object
2551		if (typeof options !== 'object') options = {
2552			'video': options
2553		};
2554		var base = this;
2555		// kick things off
2556		base.init = function() {
2557			base.options = $.extend({}, $.okvideo.options, options);
2558			// support older versions of okvideo
2559			if (base.options.video === null) base.options.video = base.options.source;
2560			base.setOptions();
2561			var target = base.options.target || $('body');
2562			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2563			var zIndex = base.options.controls === 3 ? -999 : "auto";
2564			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2565				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
2566				if (OKEvents.utils.isMobile()) {
2567					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2568				} else {
2569					if (base.options.controls === 3) {
2570						target.append(mask)
2571					}
2572					if (base.options.adproof === 1) {
2573						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
2574					} else {
2575						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2576					}
2577				}
2578				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2579				if (base.options.playlist.list === null) {
2580					if (base.options.video.provider === 'youtube') {
2581						base.loadYouTubeAPI();
2582					} else if (base.options.video.provider === 'vimeo') {
2583						base.options.volume /= 100;
2584						base.loadVimeoAPI();
2585					}
2586				} else {
2587					base.loadYouTubeAPI();
2588				}
2589			}
2590		};
2591		// clean the options
2592		base.setOptions = function() {
2593			// exchange 'true' for '1' and 'false' for 3
2594			for (var key in this.options) {
2595				if (this.options[key] === true) this.options[key] = 1;
2596				if (this.options[key] === false) this.options[key] = 3;
2597			}
2598			if (base.options.playlist.list === null) {
2599				base.options.video = base.determineProvider();
2600			}
2601			// pass options to the window
2602			$(window).data('okoptions-' + base.options.id, base.options);
2603		};
2604		// insert js into the head and exectue a callback function
2605		base.insertJS = function(src, callback, provider){
2606			var tag;
2607			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2608				delete UNCODE.insertedSripts[src];
2609				var tags = document.getElementsByTagName('script');
2610				for (var i = tags.length; i >= 0; i--){
2611					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2612						tags[i].parentNode.removeChild(tags[i]);
2613					}
2614				}
2615			} else {
2616				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2617					tag = UNCODE.insertedSripts[src];
2618					if (callback){
2619						if (tag.readyState){  //IE
2620							tag.onreadystatechange = function(){
2621								if (tag.readyState === "loaded" ||
2622									tag.readyState === "complete"){
2623									tag.onreadystatechange = null;
2624									callback();
2625								}
2626							};
2627						} else {
2628							$(tag).on('load', callback);
2629						}
2630					}
2631					return;
2632				}
2633			}
2634			tag = document.createElement('script');
2635			if (callback){
2636				if (tag.readyState){  //IE
2637					tag.onreadystatechange = function(){
2638						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2639							tag.onreadystatechange = null;
2640							callback();
2641						}
2642					};
2643				} else {
2644					tag.onload = function() {
2645						callback();
2646					};
2647				}
2648			}
2649			tag.src = src;
2650			var firstScriptTag = document.getElementsByTagName('script')[0];
2651			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2652			if ( ! UNCODE.insertedSripts ) {
2653				UNCODE.insertedSripts = [];
2654			}
2655			UNCODE.insertedSripts[src] = tag;
2656		};
2657		// load the youtube api
2658		base.loadYouTubeAPI = function(callback) {
2659			if ( ev === 'uncode-more-items-loaded' ) {
2660				onYouTubeIframeAPIReady();
2661			} else {
2662				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2663			}
2664		};
2665		base.loadYouTubePlaylist = function() {
2666			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2667		};
2668		// load the vimeo api by replacing the div with an iframe and loading js
2669		base.loadVimeoAPI = function() {
2670			var source = '//player.vimeo.com/video/' + base.options.video.id + '?controls=0&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0',
2671			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2672			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2673			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2674			base.insertJS('//player.vimeo.com/api/player.js', function() {
2675				vimeoPlayerReady(base.options.id);
2676			}, 'vimeo');
2677		};
2678		// is it from youtube or vimeo?
2679		base.determineProvider = function() {
2680			var a = document.createElement('a');
2681			a.href = base.options.video;
2682			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2683				var videoid = a.href.split('/')[3].toString();
2684				var query = videoid.substring(videoid.indexOf('?') + 1);
2685				if (query != '') {
2686					var vars = query.split('&');
2687					for (var i = 0; i < vars.length; i++) {
2688						var pair = vars[i].split('=');
2689						if (pair[0] == 'v') {
2690							videoid = pair[1];
2691						}
2692					}
2693				}
2694				return {
2695					"provider": "youtube",
2696					"id": videoid
2697				};
2698			} else if (/vimeo.com/.test(base.options.video)) {
2699				return {
2700					"provider": "vimeo",
2701					"id": (a.href.split('/')[3].toString()).split('#')[0],
2702				};
2703			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2704				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2705				if (id.length == 11) {
2706					return {
2707						"provider": "youtube",
2708						"id": id.toString()
2709					};
2710				} else {
2711					for (var i = 0; i < base.options.video.length; i++) {
2712						if (typeof parseInt(base.options.video[i]) !== "number") {
2713							throw 'not vimeo but thought it was for a sec';
2714						}
2715					}
2716					return {
2717						"provider": "vimeo",
2718						"id": base.options.video
2719					};
2720				}
2721			} else {
2722				throw "OKVideo: Invalid video source";
2723			}
2724		};
2725		base.init();
2726	};
2727
2728	var checkResize,
2729		newW = UNCODE.wwidth;
2730
2731	$.okvideo.options = {
2732		id: null,
2733		source: null, // Deprecate dis l8r
2734		video: null,
2735		playlist: { // eat ur heart out @brokyo
2736			list: null,
2737			index: 0,
2738			startSeconds: 0,
2739			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2740		},
2741		disableKeyControl: 1,
2742		captions: 0,
2743		loop: 1,
2744		hd: 1,
2745		volume: 0,
2746		adproof: false,
2747		unstarted: null,
2748		onFinished: null,
2749		onReady: null,
2750		onPlay: null,
2751		onPause: null,
2752		buffering: null,
2753		controls: false,
2754		autoplay: true,
2755		annotations: true,
2756		cued: null
2757	};
2758	$.fn.okvideo = function(options) {
2759		options.target = this;
2760		return this.each(function() {
2761			(new $.okvideo(options));
2762		});
2763	};
2764
2765	var checkForVideos = function(){
2766		$(".uncode-video-container.video").each(function(index, el) {
2767			var $this = $(this),
2768				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2769				url = $this.attr('data-video'),
2770				id = $this.attr('data-id'),
2771				cloned = $this.closest('.owl-item');
2772
2773			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2774				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2775					$this.okvideo({
2776						id: id,
2777						source: url.split('#')[0],
2778						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2779						autoplay: 1,
2780						controls: 0,
2781						volume: 0,
2782						adproof: 0,
2783						caller: $this,
2784						hd: 1,
2785						onReady: function(player) {
2786							var getPlayer = player.c || player.h || player,
2787							$iframe,
2788							getContainer = $(getPlayer).closest('.background-element');
2789							if (getContainer.length) {
2790								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2791							}
2792
2793							if ( $this.hasClass('drop-move') ) {
2794
2795								var $iframe = $(getPlayer),
2796									w = parseFloat($iframe.attr('width')),
2797									h = parseFloat($iframe.attr('height')),
2798									ratio = h / w,
2799									setResizeiFto,
2800								resizeiFrame = function(){
2801									var dataW = $this.attr('data-w'),
2802										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2803										newH = newW * ratio;
2804									$iframe.css({
2805										width: newW,
2806										height: newH
2807									});
2808								};
2809								resizeiFrame();
2810								$(window).on( 'load', resizeiFrame );
2811								$(window).on( 'resize', function(){
2812									clearRequestTimeout(setResizeiFto);
2813									setResizeiFto = requestTimeout( function() {
2814										resizeiFrame();
2815									}, 10 );
2816								});
2817
2818							}
2819
2820						}
2821					});
2822				}
2823			}
2824		});
2825	};
2826
2827	checkForVideos();
2828
2829	$(window).on('load', function(){
2830		$('.mejs-fullscreen-button button').on('click', function(){
2831			var $button = $(this),
2832				$stuck = $button.closest('.is_stucked');
2833
2834			if ( $stuck.length ) {
2835				$stuck = $(this).trigger("sticky_kit:detach");
2836				window.scrollTo(0, 0);
2837			}
2838		});
2839	});
2840
2841	var checkVideoResize = function(){
2842		clearRequestTimeout(checkResize);
2843		checkResize = requestTimeout(function(){
2844			if ( newW !== UNCODE.wwidth ) {
2845				newW = UNCODE.wwidth;
2846				checkForVideos();
2847			}
2848		}, 1000);
2849	};
2850
2851	$(window).off('resize', checkVideoResize)
2852	.on( 'resize', checkVideoResize);
2853
2854};
2855
2856$(document).on('uncode-ajax-filtered.videos', function(){
2857	UNCODE.okvideo("uncode-more-items-loaded");
2858});
2859UNCODE.backgroundSelfVideos = function( $ctx ) {
2860
2861	var backgroundSelfVideosInit = function( $ctx ) {
2862		if ( SiteParameters.block_mobile_videos === true ) {
2863			return false;
2864		}
2865		if (typeof MediaElement === "function") {
2866			if ( typeof $ctx === 'undefined' ) {
2867				$ctx = document;
2868			}
2869		
2870			$(".background-video-shortcode", $ctx).each(function(index, el) {
2871				if ( $(this).closest('mediaelementwrapper').length ) {
2872					return true;
2873				}
2874				var $video_el = $(this),
2875					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2876					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2877					video_id = $video_el.attr('id');
2878
2879				if ( SiteParameters.is_frontend_editor ) {
2880					video_id = video_id + '_' + index;
2881					$video_el.attr('id', video_id);
2882				}
2883
2884				var media = new MediaElement(video_id, {
2885					startVolume: 0,
2886					loop: true,
2887					success: function(mediaElement, domObject) {
2888						domObject.volume = 0;
2889						$(mediaElement).data('started', false);
2890						mediaElement.addEventListener('timeupdate', function(e) {
2891							if (!$(e.target).data('started')) {
2892								$(mediaElement).data('started', true);
2893							}
2894						});
2895						mediaElement.addEventListener('loadedmetadata', function(e) {
2896							$('body').removeClass('video-not-supported');
2897							mediaElement.play();
2898						});
2899						if (!UNCODE.isMobile) {
2900							requestTimeout(function() {
2901								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2902							}, 100);
2903						}
2904						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2905							mediaElement.play();
2906						}
2907
2908						if ( $parent_drop_move.length ) {
2909							var setResizeMEto,
2910								resizeMediaElement = function(){
2911								var dataW = $parent_drop_move.attr('data-w'),
2912									videoW = domObject.width,
2913									videoH = domObject.height,
2914									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2915									newH = newW / ( videoW / videoH );
2916
2917								$(domObject).css({
2918									'height': newH,
2919									'width': newW
2920								});
2921							};
2922							$(window).on( 'resize load', function(){
2923								clearRequestTimeout(setResizeMEto);
2924								setResizeMEto = requestTimeout( function() {
2925									resizeMediaElement();
2926								}, 10 );
2927							});
2928						}
2929
2930						mediaElement.addEventListener('play', function() {
2931							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2932							$(mediaElement).closest('#page-header').addClass('video-started');
2933							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2934						}, true);
2935
2936					},
2937					// fires when a problem is detected
2938					error: function() {}
2939				});
2940			});
2941		} else {
2942
2943			if ( typeof $ctx === 'undefined' ) {
2944				$ctx = document;
2945			}
2946		
2947			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2948			Array.from(videos).forEach(function(video_el) {
2949				video_el.addEventListener('loadedmetadata', function(e) {
2950					$('body').removeClass('video-not-supported');
2951					video_el.play();
2952				});
2953				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2954					video_el.muted = true;
2955					video_el.loop = true;
2956					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2957					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2958					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2959					$('body').removeClass('video-not-supported');
2960					video_el.play();
2961				} else {
2962					requestTimeout(function(){
2963                         backgroundSelfVideosInit( $ctx );
2964					}, 1000);
2965				}
2966			});
2967		}
2968	};
2969
2970	backgroundSelfVideosInit( $ctx );
2971
2972	$(document).on('un-menu-show', function(){
2973		setTimeout(function(){
2974			UNCODE.initVideoComponent(document.body, '.un-submenu .uncode-video-container.video:not(.drop-move):not(.fluid-object), .un-submenu .uncode-video-container.self-video:not(.drop-move)');
2975		}, 1);
2976	});
2977
2978
2979	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2980		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2981			var $el = model.view.$el,
2982				shortcode = model.attributes.shortcode;
2983
2984			if (typeof MediaElement === "function") {
2985				backgroundSelfVideosInit( $el );
2986			} else {
2987				backgroundSelfVideosInit( $el[0] );
2988			}
2989		});
2990	}
2991};
2992
2993UNCODE.is_scrolling = false;
2994
2995UNCODE.disableHoverScroll = function() {
2996
2997	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2998		var body = document.body,
2999		timer;
3000
3001		window.addEventListener('scroll', function() {
3002			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
3003			clearRequestTimeout(timer);
3004			if ( body.classList && !body.classList.contains('disable-hover') ) {
3005				body.classList.add('disable-hover');
3006				window.dispatchEvent(new CustomEvent('disable-hover'));
3007			}
3008			UNCODE.is_scrolling = true;
3009
3010			timer = requestTimeout(function() {
3011				if ( body.classList ) {
3012					body.classList.remove('disable-hover');
3013					window.dispatchEvent(new CustomEvent('enable-hover'));
3014				}
3015				UNCODE.is_scrolling = false;
3016			}, delay);
3017		}, false);
3018	}
3019};
3020
3021UNCODE.isotopeLayout = function() {
3022	if ($('.isotope-layout').length > 0) {
3023		var isotopeContainersArray = [],
3024			typeGridArray = [],
3025			layoutGridArray = [],
3026			screenLgArray = [],
3027			screenMdArray = [],
3028			screenSmArray = [],
3029			transitionDuration = [],
3030			$filterItems = [],
3031			$filters = $('.isotope-system .isotope-filters'),
3032			$itemSelector = '.tmb-iso',
3033			$items,
3034			itemMargin,
3035			correctionFactor = 0,
3036			firstLoad = true,
3037			isOriginLeft = $('body').hasClass('rtl') ? false : true;
3038		$('[class*="isotope-container"]').each(function(index) {
3039			var _this = $(this);
3040			var isoData = _this.data(),
3041			$data_lg,
3042			$data_md,
3043			$data_sm;
3044			_this.children('.tmb').addClass('tmb-iso');
3045			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
3046			else $data_lg = '1000';
3047			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
3048			else $data_md = '600';
3049			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
3050			else $data_sm = '480';
3051			screenLgArray.push($data_lg);
3052			screenMdArray.push($data_md);
3053			screenSmArray.push($data_sm);
3054			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
3055			if (isoData.type == 'metro') typeGridArray.push(true);
3056			else typeGridArray.push(false);
3057			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
3058			else layoutGridArray.push('masonry');
3059			isotopeContainersArray.push(_this);
3060			_this.attr('data-iso-index', index);
3061		});
3062		var colWidth = function(index) {
3063				$(isotopeContainersArray[index]).width('');
3064				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
3065					widthAvailable = $(isotopeContainersArray[index]).width(),
3066					columnNum = 12,
3067					columnWidth = 0,
3068					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
3069					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
3070					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
3071					$rowContainer,
3072					paddingRow,
3073					$colContainer,
3074					paddingCol;
3075
3076				if ( consider_menu )
3077					winHeight = winHeight - UNCODE.menuHeight;
3078
3079				if ( data_vp_height === '1' ) {
3080					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3081					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3082					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3083					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3084					winHeight = winHeight - ( paddingRow + paddingCol );
3085				}
3086
3087				if (isPx) {
3088					columnWidth = Math.ceil(widthAvailable / columnNum);
3089					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3090				} else {
3091					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3092				}
3093				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3094				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3095				for (var i = 0, len = $items.length; i < len; i++) {
3096					var $item = $($items[i]),
3097						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3098						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3099						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3100
3101
3102					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3103						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3104					}
3105
3106					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3107						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3108					}
3109
3110					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3111						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3112							switch (parseInt(multiplier_w[1])) {
3113								case (5):
3114								case (4):
3115								case (3):
3116									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3117									multiplier_w[1] = 6;
3118									break;
3119								case (2):
3120								case (1):
3121									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3122									multiplier_w[1] = 3;
3123									break;
3124								default:
3125									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3126									multiplier_w[1] = 12;
3127									break;
3128							}
3129
3130							if (multiplier_w[1] == 2.4) { // 5 columns
3131								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3132								multiplier_w[1] = 6;
3133							}
3134						}
3135					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3136						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3137							switch (parseInt(multiplier_w[1])) {
3138								case (5):
3139								case (4):
3140								case (3):
3141								case (2):
3142								case (1):
3143									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3144									multiplier_w[1] = 6;
3145									break;
3146								default:
3147									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3148									multiplier_w[1] = 12;
3149									break;
3150							}
3151
3152							if (multiplier_w[1] == 2.4) { // 5 columns
3153								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3154								multiplier_w[1] = 6;
3155							}
3156						}
3157					} else if (widthAvailable < screenSmArray[index]) {
3158						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3159							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3160							multiplier_w[1] = 12;
3161							if (typeGridArray[index]) multiplier_h[1] = 12;
3162						}
3163					}
3164					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3165						height;
3166
3167					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3168						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3169						if ( widthAvailable < screenSmArray[index] ) {
3170							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3171						}
3172					} else {
3173						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3174					}
3175
3176					if (width >= widthAvailable) {
3177						$item.css({
3178							width: widthAvailable
3179						});
3180						if (typeGridArray[index]) {
3181							$item.children().add($item.find('.backimg')).css({
3182								height: height
3183							});
3184						}
3185					} else {
3186						$item.css({
3187							width: width
3188						});
3189						if (typeGridArray[index]) {
3190							$item.children().add($item.find('.backimg')).css({
3191								height: height
3192							});
3193						}
3194					}
3195				}
3196				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3197					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3198				} else {
3199					return columnWidth;
3200				}
3201			},
3202			init_isotope = function() {
3203				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3204					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3205						isotopeId = isotopeSystem.attr('id'),
3206						$layoutMode = layoutGridArray[i],
3207						setIsotopeFirstRowTimeOut,
3208					setIsotopeFirstRow = function(items){
3209						var firstRow = true;
3210						$(items).each(function(index, val){
3211							var el = items[index].element,
3212								el_top = items[index].position.y,
3213								$el = $(el);
3214							if ( index > 0 && el_top > 0 && firstRow ) {
3215								firstRow = false;
3216							} else if ( index == 0 && el_top == 0 ) {
3217								firstRow = true;
3218							}
3219							if ( firstRow ) {
3220								$el.removeClass('tmb-isotope-further-row');
3221							} else {
3222								$el.addClass('tmb-isotope-further-row');
3223							}
3224						});
3225					};
3226					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3227						//resizable: true,
3228						itemSelector: $itemSelector,
3229						layoutMode: $layoutMode,
3230						transitionDuration: transitionDuration[i],
3231						masonry: {
3232							columnWidth: colWidth(i)
3233						},
3234						vertical: {
3235							horizontalAlignment: 0.5,
3236						},
3237						sortBy: 'original-order',
3238						isOriginLeft: isOriginLeft
3239					})
3240					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3241					.on('layoutComplete', function( event, items ){
3242						if ( typeof items[0] !== 'undefined' ) {
3243							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3244								setIsotopeFirstRow(items);
3245							}
3246						}
3247					})
3248					.on('arrangeComplete', function( event, items ){
3249						if ( typeof items[0] !== 'undefined' ) {
3250							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3251								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3252								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3253									setIsotopeFirstRow(items);
3254								}, 100);
3255							}
3256						}
3257					});
3258					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3259						$(isotopeContainersArray[i]).infinitescroll({
3260								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3261								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3262								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3263								animate: false,
3264								behavior: 'local',
3265								debug: false,
3266								loading: {
3267									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3268									speed: 0,
3269									finished: undefined,
3270									msg: $('#' + isotopeId + ' .loadmore-button'),
3271								},
3272								errorCallback: function() {
3273									var isotope_system = $(this).closest('.isotope-system');
3274									$('.loading-button', isotope_system).hide();
3275									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3276								}
3277							},
3278							// append the new items to isotope on the infinitescroll callback function.
3279							function(newElements, opts) {
3280								var $isotope = $(this),
3281									isotope_system = $isotope.closest('.isotope-system'),
3282									isotopeId = isotope_system.attr('id'),
3283									filters = new Array(),
3284									$loading_button = isotope_system.find('.loading-button'),
3285									$infinite_button = isotope_system.find('.loadmore-button'),
3286									$numPages = $('a', $infinite_button).data('pages'),
3287									$woo_results,
3288									delay = 300;
3289								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3290								if ($isotope.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
3291									$infinite_button.show();
3292								} else {
3293									$infinite_button.hide();
3294								}
3295								$loading_button.hide();
3296								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3297								$('> li', $isotope).remove();
3298								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3299								$.each($(newElements), function (index, val) {
3300									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3301										$woo_results = $(val);
3302										delete newElements[index];
3303									} else {
3304										$(val).addClass('tmb-iso');
3305										if ($(val).is("li")) {
3306											filters.push($(val)[0]);
3307										}
3308									}
3309									$(val).addClass('uncode-appended');
3310								});
3311								newElements = newElements.filter(function(x) {
3312									return filters.indexOf(x) < 0
3313								});
3314								$.each($(filters), function(index, val) {
3315									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3316								});
3317								if ($woo_results && $woo_results.length > 0) {
3318									var old_count = isotope_system.find('.woocommerce-result-count').text();
3319									var new_count = $woo_results.find('.woocommerce-result-count').text();
3320									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3321									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3322									function replaceMatch(match, p1, p2) {
3323        								return old_start + '–' + new_end;
3324									}
3325									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3326									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3327								}
3328								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3329								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3330									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3331									if (typeof getLightbox === 'object') {
3332										getLightbox.refresh();
3333									} else {
3334										UNCODE.lightbox();
3335									}
3336								}
3337								if ( typeof twttr !== 'undefined' )
3338									twttr.widgets.load(isotopeContainersArray[i]);
3339
3340								requestTimeout(function() {
3341									Waypoint.refreshAll();
3342									$isotope.trigger('more-items-loaded');
3343									$(window).trigger('more-items-loaded');
3344									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3345									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3346										$(document).trigger('uncode-scrolltrigger-refresh');
3347									}
3348									fillIfNotScrollable($isotope);
3349								}, 1000);
3350
3351							});
3352						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3353							var $infinite_isotope = $(isotopeContainersArray[i]),
3354								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3355							$infinite_isotope.infinitescroll('pause');
3356							$infinite_button.on('click', function(event) {
3357								event.preventDefault();
3358								var $infinite_system = $(event.target).closest('.isotope-system'),
3359								$infinite_isotope = $infinite_system.find('.isotope-container'),
3360								isotopeId = $infinite_system.attr('id');
3361								$(event.currentTarget).html(SiteParameters.loading);
3362								$infinite_isotope.infinitescroll('resume');
3363								$infinite_isotope.infinitescroll('retrieve');
3364								$infinite_isotope.infinitescroll('pause');
3365							});
3366						}
3367						(function ($c) {
3368							requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
3369						})($(isotopeContainersArray[i]));
3370					}
3371				}
3372			},
3373			fillIfNotScrollable = function ($container) {
3374				if ($container.hasClass('isotope-infinite-button')) {
3375					return
3376				};
3377				if (!$container.hasClass('isotope-infinite')) {
3378					return
3379				};
3380				var infData = $container.data('infinitescroll');
3381				if (!infData || !infData.options || !infData.options.state) {
3382					return
3383				};
3384				var state = infData.options.state;
3385				if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPau
3385sed) {
3386					return
3387				};
3388				var $loadMoreA = $container.closest('.isotope-system').find('.loadmore-button a');
3389				var numPages = parseInt($loadMoreA.data('pages'), 10);
3390				if (!numPages || state.currPage >= numPages) {
3391					return
3392				};
3393				if (document.documentElement.scrollHeight > window.innerHeight + 1) {
3394					return
3395				};
3396				console.log('fillIfNotScrollable');
3397				$container.infinitescroll('retrieve');
3398			},
3399			onLayout = function(isotopeObj, startIndex, needsReload) {
3400				var needsReload = needsReload ? true : false;
3401
3402				if (typeof UNCODE.bigText !== 'undefined') {
3403					UNCODE.bigText();
3404				}
3405				isotopeObj.css('opacity', 1);
3406				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3407
3408				requestTimeout(function() {
3409					if (startIndex > 0) {
3410						reloadIsotope(isotopeObj);
3411						if (SiteParameters.dynamic_srcset_active === '1') {
3412							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3413							UNCODE.adaptive_srcset(isotopeObj);
3414						}
3415						// window.dispatchEvent(UNCODE.boxEvent);
3416					} else if (needsReload) {
3417						reloadIsotope(isotopeObj);
3418					}
3419
3420					UNCODE.adaptive();
3421					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3422						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3423					}
3424					if (typeof MediaElement === "function") {
3425						$(isotopeObj).find('audio,video').each(function() {
3426							$(this).mediaelementplayer({
3427	 							pauseOtherPlayers: false,
3428							});
3429						});
3430					}
3431					if ($(isotopeObj).find('.nested-carousel').length) {
3432						if (typeof UNCODE.carousel !== 'undefined') {
3433							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3434						}
3435						requestTimeout(function() {
3436							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3437						}, 200);
3438					} else {
3439						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3440					}
3441					isotopeObj.trigger('isotope-layout-complete');
3442
3443				}, 100);
3444
3445			},
3446			boxAnimation = function(items, startIndex, sequential, container) {
3447				var $allItems = items.length - startIndex,
3448					showed = 0,
3449					index = 0;
3450				if (container.closest('.owl-item').length == 1) return false;
3451				$.each(items, function(index, val) {
3452					var $this = $(val),
3453						elInner = $('> .t-inside', val);
3454					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3455						return;
3456					}
3457					if (val[0]) val = val[0];
3458					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3459						new Waypoint({
3460							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3461							element: val,
3462							handler: function() {
3463								var element = $('> .t-inside', this.element),
3464									parent = $(this.element),
3465									currentIndex = parent.index();
3466								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3467									delayAttr = parseInt(element.attr('data-delay'));
3468								if (isNaN(delayAttr)) delayAttr = 100;
3469								delay -= showed;
3470								var objTimeout = requestTimeout(function() {
3471									element.removeClass('zoom-reverse').addClass('start_animation');
3472									showed = parent.index();
3473									if ( container.data('isotope') ) {
3474										container.isotope('layout');
3475									}
3476								}, delay * delayAttr)
3477								parent.data('objTimeout', objTimeout);
3478								if (!UNCODE.isUnmodalOpen) {
3479									this.destroy();
3480								}
3481							},
3482							offset: '100%'
3483						})
3484					} else {
3485						if (elInner.hasClass('force-anim')) {
3486							elInner.addClass('start_animation');
3487						} else {
3488							elInner.css('opacity', 1);
3489						}
3490						container.isotope('layout');
3491					}
3492
3493					index++;
3494				});
3495			},
3496			reloadIsotope = function(isotopeObj) {
3497				var isoIndex = $(isotopeObj).attr('data-iso-index');
3498				var $layoutMode = ($(isotopeObj).data('layout'));
3499				if ($layoutMode === undefined) {
3500					$layoutMode = 'masonry';
3501				}
3502				if (isotopeObj.data('isotope')) {
3503					isotopeObj.isotope({
3504						itemSelector: $itemSelector,
3505						layoutMode: $layoutMode,
3506						transitionDuration: transitionDuration[isoIndex],
3507						masonry: {
3508							columnWidth: colWidth(isoIndex)
3509						},
3510						vertical: {
3511							horizontalAlignment: 0.5,
3512						},
3513						sortBy: 'original-order',
3514						isOriginLeft: isOriginLeft
3515					});
3516				}
3517			}
3518			;
3519		if ($('.isotope-pagination').length > 0) {
3520			$('.isotope-system').on('click', '.pagination a', function(evt) {
3521				evt.preventDefault();
3522
3523				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3524					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3525						container = $(this).closest('.isotope-system'),
3526						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3527						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3528					calc_scroll -= UNCODE.get_scroll_offset();
3529
3530					if ( pagination_disable_scroll !== 'disabled' ) {
3531						var menu_container = $('.menu-sticky');
3532						var menu = menu_container.find('.menu-container');
3533
3534						if (menu_container.length > 0 && menu.length > 0) {
3535							calc_scroll = calc_scroll - menu.outerHeight();
3536						}
3537
3538						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3539							delta = bodyTop - calc_scroll,
3540							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3541						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3542
3543						if (!UNCODE.isFullPage) {
3544							if (scrollSpeed == 0) {
3545								$('html, body').scrollTop(calc_scroll);
3546							} else {
3547								$('html, body').animate({
3548									scrollTop: calc_scroll
3549								}, {
3550									easing: 'easeInOutQuad',
3551									duration: scrollSpeed,
3552									complete: function () {
3553										UNCODE.scrolling = false;
3554									}
3555								});
3556							}
3557						}
3558					}
3559				}
3560
3561				loadIsotope($(this), true);
3562			});
3563		}
3564		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3565			if ($(this).hasClass('no-isotope-filter')) {
3566				return;
3567			}
3568			var $filter = $(this),
3569				filterContainer = $filter.closest('.isotope-filters'),
3570				filterValue = $filter.attr('data-filter'),
3571				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3572				transitionDuration = container.data().isotope.options.transitionDuration,
3573				delay = 300,
3574				filterItems = [];
3575
3576			var filter_items = function(){
3577				if (filterValue !== undefined) {
3578					container.addClass('grid-filtering');
3579					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3580						var parent = $(val).parent(),
3581							objTimeout = parent.data('objTimeout');
3582						if (objTimeout) {
3583							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3584							clearRequestTimeout(objTimeout);
3585						}
3586						if (transitionDuration == 0) {
3587							if ($(val).hasClass('animate_when_almost_visible')) {
3588								$(val).addClass('zoom-reverse').removeClass('start_animation');
3589							} else {
3590								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3591							}
3592						}
3593					});
3594					requestTimeout(function(){
3595						if ( filterValue == '*' ) {
3596							container.removeClass('isotope-filtered');
3597						} else {
3598							container.addClass('isotope-filtered');
3599						}
3600						container.isotope({
3601							filter: function() {
3602								var block = $(this),
3603								filterable = (filterValue == '*') || block.hasClass(filterValue),
3604								lightboxElements = $('[data-lbox^=ilightbox]', block);
3605								if (filterable) {
3606									if (lightboxElements.length) {
3607										lightboxElements.removeClass('lb-disabled');
3608										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3609									}
3610									filterItems.push(block);
3611								} else {
3612									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3613								}
3614								container.trigger('more-items-loaded');
3615								$(window).trigger('more-items-loaded');
3616								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3617								return filterable;
3618							}
3619						});
3620						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3621
3622					}, delay);
3623
3624					/** once filtered - start **/
3625					container.isotope('once', 'arrangeComplete', function() {
3626						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3627							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3628							if (typeof getLightbox === 'object') {
3629								getLightbox.refresh();
3630							} else {
3631								UNCODE.lightbox();
3632							}
3633						}
3634						if (transitionDuration == 0) {
3635							requestTimeout(function() {
3636								boxAnimation(filterItems, 0, false, container);
3637							}, 100);
3638						}
3639						requestTimeout(function() {
3640							Waypoint.refreshAll();
3641							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3642								$(document).trigger('uncode-scrolltrigger-refresh');
3643							}
3644							container.removeClass('grid-filtering');
3645						}, 2000);
3646						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
3647					});
3648					/** once filtered - end **/
3649				} else {
3650					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3651						$.each(UNCODE.lightboxArray, function(index, val) {
3652							UNCODE.lightboxArray[index].destroy();
3653						});
3654					}
3655					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3656						var parent = $(val).parent(),
3657							objTimeout = parent.data('objTimeout');
3658						if (objTimeout) {
3659							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3660							clearRequestTimeout(objTimeout);
3661						}
3662						if (transitionDuration == 0) {
3663							if ($(val).hasClass('animate_when_almost_visible')) {
3664								$(val).addClass('zoom-reverse').removeClass('start_animation');
3665							} else {
3666								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3667							}
3668						}
3669					});
3670					container.parent().addClass('grid-loading');
3671					loadIsotope($filter);
3672				}
3673			};
3674
3675			if (!$filter.hasClass('active')) {
3676				/** Scroll top with filtering */
3677				if (filterContainer.hasClass('filter-scroll')) {
3678                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3679                    calc_scroll -= UNCODE.get_scroll_offset();
3680
3681					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3682						delta = bodyTop - calc_scroll,
3683						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3684						filterTolerance = false,
3685						filter_timeout;
3686					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3687
3688					if ( !UNCODE.isFullPage ) {
3689						if (scrollSpeed == 0) {
3690							$('html, body').scrollTop(calc_scroll);
3691							UNCODE.scrolling = false;
3692							filter_items();
3693						} else {
3694
3695							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3696								filter_items();
3697								filterTolerance = true;
3698							}
3699
3700							$('html, body').animate({
3701								scrollTop: calc_scroll
3702							},{
3703								easing: 'easeInOutQuad',
3704								duration: scrollSpeed,
3705								complete: function(){
3706									UNCODE.scrolling = false;
3707									if ( !filterTolerance ) {
3708										filter_timeout = setTimeout(function(){
3709											clearTimeout(filter_timeout);
3710											filter_items();
3711										}, 200);
3712									}
3713								}
3714							});
3715						}
3716					}
3717				} else {
3718					filter_items();
3719				}
3720			}
3721			evt.preventDefault();
3722		});
3723
3724		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3725			var params = UNCODE.getURLParams(window.location);
3726			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3727
3728			UNCODE.lastURL = window.location.href;
3729
3730			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3731				return;
3732			}
3733
3734			if (params.id === undefined) {
3735				$.each($('.isotope-system'), function(index, val) {
3736					loadIsotope($(val));
3737				});
3738			} else {
3739				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3740					loadIsotope($('#' + params.id));
3741				}
3742			}
3743		});
3744
3745		var loadIsotope = function($href, $paginating) {
3746			var is_paginating = false;
3747
3748			if (undefined !== $paginating && $paginating) {
3749				var is_paginating = $paginating;
3750			}
3751
3752			var href = ($href.is("a") ? $href.attr('href') : location),
3753				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3754				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3755				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3756				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3757				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3758				isotopeId = isotopeSystem.attr('id');
3759			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3760				UNCODE.lastURL = href;
3761				history.pushState({
3762					myIsotope: true
3763				}, document.title, href);
3764			}
3765			if (is_paginating) {
3766				isotopeWrapper.addClass('grid-filtering');
3767			}
3768			$.ajax({
3769				url: href
3770			}).done(function(data) {
3771				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3772					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3773					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3774				isotopeWrapper.addClass('isotope-reloaded');
3775				requestTimeout(function() {
3776					isotopeWrapper.removeClass('grid-loading');
3777					isotopeWrapper.removeClass('isotope-reloaded');
3778					isotopeWrapper.removeClass('grid-filtering');
3779				}, 500);
3780				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3781					var parent = $(val).parent(),
3782						objTimeout = parent.data('objTimeout');
3783					if (objTimeout) {
3784						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3785						clearRequestTimeout(objTimeout);
3786					}
3787					if ($(val).hasClass('animate_when_almost_visible')) {
3788						$(val).addClass('zoom-reverse').removeClass('start_animation');
3789					} else {
3790						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3791					}
3792				});
3793				requestTimeout(function() {
3794					if (isotopeContainer.data('isotope')) {
3795						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3796						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3797						UNCODE.adaptive();
3798						if (SiteParameters.dynamic_srcset_active === '1') {
3799							UNCODE.adaptive_srcset(isotopeContainer);
3800						}
3801						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3802							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3803							if (typeof getLightbox === 'object') {
3804								getLightbox.refresh();
3805							} else {
3806								UNCODE.lightbox();
3807							}
3808						}
3809					}
3810					isotopeContainer.trigger('more-items-loaded');
3811					$(window).trigger('more-items-loaded');
3812					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3813				}, 300);
3814				$('.pagination', isotopeFooter).remove();
3815				isotopeFooter.append($resultPagination);
3816
3817				if (isotopeResultCount.length > 0) {
3818					$('.woocommerce-result-count', isotopeResultCount).remove();
3819					isotopeResultCount.append($resultCount);
3820				}
3821			});
3822		};
3823		$filters.each(function(i, buttonGroup) {
3824			var $buttonGroup = $(buttonGroup);
3825			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3826				$buttonGroup.find('.active').removeClass('active');
3827				$(this).addClass('active');
3828
3829			});
3830
3831			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3832				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3833				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3834			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3835				e.preventDefault();
3836				$cats_filters.slideToggle(400, 'easeInOutCirc');
3837			});
3838
3839		});
3840		window.addEventListener('boxResized', function(e) {
3841			if (UNCODE.printDialogOpen !== false) {
3842				return false;
3843			}
3844			$.each($('.isotope-layout'), function(index, val) {
3845				var $layoutMode = ($(this).data('layout'));
3846				if ($layoutMode === undefined) $layoutMode = 'masonry';
3847				if ($(this).data('isotope')) {
3848					$(this).isotope({
3849						itemSelector: $itemSelector,
3850						layoutMode: $layoutMode,
3851						transitionDuration: transitionDuration[index],
3852						masonry: {
3853							columnWidth: colWidth(index)
3854						},
3855						vertical: {
3856							horizontalAlignment: 0.5,
3857						},
3858						sortBy: 'original-order',
3859						isOriginLeft: isOriginLeft
3860					});
3861					$(this).isotope('unbindResize');
3862					if (SiteParameters.dynamic_srcset_active === '1') {
3863						UNCODE.refresh_dynamic_srcset_size($(this));
3864					}
3865				}
3866				$(this).find('.mejs-video,.mejs-audio').each(function() {
3867					$(this).trigger('resize');
3868				});
3869			});
3870		}, false);
3871
3872		init_isotope();
3873	};
3874}
3875
3876UNCODE.lightbox = function() {
3877	if ( SiteParameters.lbox_enhanced ) {
3878		return true;
3879	}
3880	UNCODE.lightboxArray = {};
3881	requestTimeout(function() {
3882		var groupsArr = {};
3883		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3884			var group = this.getAttribute("data-lbox"),
3885				values = $(this).data();
3886			$(this).attr('data-lbox-init','true')
3887			groupsArr[group] = values;
3888		});
3889		for (var i in groupsArr) {
3890			var skin = groupsArr[i].skin || 'black',
3891				path = groupsArr[i].dir || 'horizontal',
3892				thumbs = !groupsArr[i].notmb || false,
3893				arrows = !groupsArr[i].noarr || false,
3894				social = groupsArr[i].social || false,
3895				deeplink = groupsArr[i].deep || false,
3896				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3897				counter = $els.length,
3898				dataAlbum = $els.attr('data-album');
3899			if (social) social = {
3900				facebook: true,
3901				twitter: true,
3902				reddit: true,
3903				digg: true
3904			};
3905			UNCODE.lightboxArray[i] = $els.iLightBox({
3906				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3907				skin: skin,
3908				path: path,
3909				linkId: deeplink,
3910				infinite: false,
3911				//fullViewPort: 'fit',
3912				smartRecognition: false,
3913				fullAlone: true,
3914				maxScale: 1,
3915				minScale: .02,
3916				//fullStretchTypes: 'flash, video',
3917				overlay: {
3918					opacity: .94
3919				},
3920				controls: {
3921					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3922					fullscreen: true,
3923					thumbnail: thumbs,
3924					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3925				},
3926				show: {
3927					speed: 200
3928				},
3929				hide: {
3930					speed: 200
3931				},
3932				social: {
3933					start: false,
3934					buttons: social
3935				},
3936				caption: {
3937					start: false
3938				},
3939				styles: {
3940					nextOpacity: 1,
3941					nextScale: 1,
3942					prevOpacity: 1,
3943					prevScale: 1
3944				},
3945				effects: {
3946					switchSpeed: 400
3947				},
3948				slideshow: {
3949					pauseTime: 5000
3950				},
3951				thumbnails: {
3952					maxWidth: 60,
3953					maxHeight: 60,
3954					activeOpacity: .2
3955				},
3956				html5video: {
3957					preload: true
3958				},
3959				callback: {
3960					onOpen: function(){
3961						$(window).trigger('uncode-custom-cursor');
3962						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3963							iNoBounce.enable();
3964						}
3965					},
3966					onHide: function(){
3967						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3968							iNoBounce.disable()
3969						}
3970					},
3971				}
3972			});
3973
3974			$(document).on('infinite-loaded', function(){
3975				UNCODE.lightboxArray[i].refresh();
3976			});
3977
3978			$(window).on('gdprOpen', function(){
3979				UNCODE.lightboxArray[i].close();
3980			});
3981		};
3982	}, 100);
3983
3984	$(document).on('click', '.lb-disabled', function(e){
3985		e.preventDefault();
3986	});
3987};
3988
3989UNCODE.lightgallery = function( $el ) {
3990	if (!document._uncodeMarqueeGalleryBind) {
3991		document._uncodeMarqueeGalleryBind = true;
3992
3993		$(document).on('uncode-marquee-updated', function(e, data){
3994			if (!data || !data.context) return;
3995
3996			var $context = $(data.context);
3997
3998			var $targets = $context.find('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel')
3999				.add($context.filter('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel'));
4000
4001			if (!$targets.length) {
4002				$targets = $context.closest('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel');
4003			}
4004
4005			if (!$targets.length) return;
4006
4007			$targets.each(function(){
4008				$(this).removeAttr('data-lbox-init');
4009				$(this).find('[data-lbox-init]').removeAttr('data-lbox-init');
4010			});
4011
4012			UNCODE.lightgallery($targets);
4013		});
4014	}
4015
4016	var createSelectors = function(){
4017		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
4018			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4019				$(this).addClass('lbox-trigger-item');
4020			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4021				$(this).addClass('lbox-nested-item');
4022			} else {
4023				$(this).removeClass('lbox-trigger-item');
4024				$(this).removeClass('lbox-nested-item');
4025			}
4026		});
4027	};
4028
4029	createSelectors();
4030
4031	var galleries = [],
4032		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4033			return !$(this).closest('.nested-carousel').length;
4034		}),
4035		$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .linear-container:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box .icon-box-icon:not([data-lbox-init]), .icon-box .icon-box-content:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container:not([data-lbox-init])' + SiteParameters.uncode_lb_add_galleries).has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *, .linear-container *'), 
4036		$galleries = $_galleries.filter(function( index ) {
4037			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4038		}),
4039		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
4040
4041	if ( typeof $el === 'undefined' ) {
4042		$el = $galleries.add( $nested );
4043	}
4044
4045	var $disabled = $('a.lb-disabled');
4046	$disabled.on('click', function(e){
4047		e.preventDefault();
4048	});
4049
4050	var beforeSlide = function(event) {
4051		var detail = event.detail,
4052			info = detail.info,
4053			item = detail.item,
4054			$slide = $(detail.currentSlide.selector),
4055			$video = $('video', $slide),
4056			$previous = $(detail.previousSlide.selector),
4057			$prevVideo = $('video', $previous),
4058			isAudio = false;
4059
4060		if ( typeof info.src !== 'undefined' ) {
4061			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
4062		}
4063
4064		if ( ! $video.length && ( info.video || isAudio ) ) {
4065			if ( info.video ) {
4066				if ( typeof info.video === 'object' ) {
4067					var infoJson = info.video;
4068				} else {
4069					var infoJson = JSON.parse(info.video);
4070				}
4071				var src = infoJson.source[0].src,
4072					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
4073					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
4074					loop = $(item).attr('data-loop');
4075
4076			} else if ( isAudio ) {
4077				var src = info.src,
4078					autoplay = true,
4079					loop = false;
4080			}
4081			if ( typeof src !== 'undefined' ) {
4082				$slide.addClass('has-html5');
4083				var video = document.createElement('video');
4084				video.src = src;
4085				video.preload = 'auto';
4086				video.controls = 'controls';
4087				video.controlsList = 'nodownload';
4088				if ( autoplay ) {
4089					video.autoplay = 'autoplay';
4090				}
4091				if ( muted ) {
4092					video.muted = 'muted';
4093				}
4094				if ( loop ) {
4095					video.loop = 'loop';
4096				}
4097				$(video).appendTo($slide);
4098			}
4099		} else {
4100			var $video = $('video', $slide);
4101			if ( $video.length ) {
4102				$video[0].currentTime = 0;
4103				if ( $video[0].autoplay ) {
4104					$video[0].play();
4105				}
4106			}
4107		}
4108		if ( $prevVideo.length ) {
4109			$prevVideo[0].currentTime = 0;
4110			$prevVideo[0].pause();
4111		}
4112	};
4113
4114	var beforeOpen = function(event) {
4115		var detail = event.detail,
4116			items = detail.items,
4117			galleryItems = detail.galleryItems,
4118			outer = detail.outer.selector,
4119			i, ii;
4120		for ( i = 0; i < galleryItems.length; i++ ) {
4121			var item = galleryItems[i];
4122			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
4123				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
4124			}
4125		}
4126		for ( ii = 0; ii < items.length; ii++ ) {
4127			var item = items[ii];
4128			if ( $(item).attr('data-icon') === 'video' ) {
4129				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
4130			}
4131		}
4132
4133	};
4134
4135	//caption builder
4136	var captionBuilder = function($el){
4137		$el.each( function( index, val ) {
4138			var $gallery = $(this).attr('data-lbox-init','true'),
4139				$_a = '.lbox-trigger-item',
4140				$_nested_a = '.lbox-nested-item';
4141
4142			$gallery.find($_a).add($_nested_a).each(function(){
4143				var $a = $(this),
4144					$img = $('img', $a).first(),
4145					imgw = $img.attr('data-width'),
4146					imgh = $img.attr('data-height'),
4147					caption = $a.attr('data-caption'),
4148					title = $a.attr('data-title');
4149
4150				if ( $img.length && $img.attr('data-crop') != true ) {
4151					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4152						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4153					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4154						$a.attr('data-external-thumb-image', $img[0].src);
4155					}
4156				}
4157
4158				if ( typeof title !== 'undefined' && title !== '' ) {
4159					title = '<h6>' + title + '</h6>';
4160				} else {
4161					title = '';
4162				}
4163
4164				if ( typeof caption !== 'undefined' && caption !== '' ) {
4165					caption = '<p>' + caption + '</p>';
4166					title += caption;
4167				}
4168
4169				if ( title !== '' ) {
4170					$a.attr( 'title', title );
4171				}
4172
4173				if ( $img.attr('data-crop') != true && typeof imgw !== 'undefined' && typeof imgh !== 'undefined' && imgw !== '' && imgh !== '' && ( typeof $a.attr('data-lg-size') === 'undefined' || !$a.attr('data-lg-size') ) ) {
4174					$a.attr('data-lg-size', imgw + '-' + imgh);
4175				}
4176			});
4177		});
4178	};
4179	captionBuilder($el);
4180
4181	//regular galleries
4182	$el.each( function( index, val ) {
4183		var $gallery = $(this),
4184			$_a = '.lbox-trigger-item',
4185			$_nested_a = '.lbox-nested-item',
4186			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4187			galleryID = $_first.attr('data-lbox'),
4188			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4189			tmb = $_first.attr('data-notmb'),
4190			social = $_first.attr('data-social'),
4191			deep = $_first.attr('data-deep'),
4192			zoom = $_first.attr('data-zoom-origin'),
4193			actual = $_first.attr('data-actual-size'),
4194			download = $_first.attr('data-download'),
4195			controls = $_first.attr('data-arrows') !== 'no',
4196			fullScreen = $_first.attr('data-full'),
4197			counter = $_first.attr('data-counter'),
4198			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4199			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4200			connect = $_first.attr('data-connect'),
4201			lgPlugins = [lgVideo],
4202			itemsLoadedTimeOut;
4203
4204		if ( typeof galleryID === 'undefined' ) {
4205			galleryID = $gallery.attr('id');
4206		}
4207
4208		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4209		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4210
4211		if ( typeof tmb == 'undefined' || !tmb ) {
4212			lgPlugins.push(lgThumbnail);
4213		}
4214		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4215			lgPlugins.push(lgZoom);
4216		}
4217		if ( typeof deep != 'undefined' && deep != '' ) {
4218			lgPlugins.push(lgHash);
4219		}
4220		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4221			lgPlugins.push(lgFullscreen);
4222		}
4223		if ( social ) {
4224			lgPlugins.push(lgShare);
4225		}
4226
4227		if ( galleries.indexOf( galleryID ) !== -1 ) {
4228			return true;
4229		}
4230
4231		galleries.push( galleryID );
4232		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4233			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4234		var gallery = lightGallery( $triggerGal[0], {
4235			addClass: containerClass,
4236			plugins: lgPlugins,
4237			mode: transition,
4238			selector: $selector,
4239			galleryId: galleryID,
4240			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4241			iframeWidth: '848px',
4242			iframeMaxWidth: '90%',
4243			iframeMaxHeight: '90%',
4244			exThumbImage: 'data-external-thumb-image',
4245			loadYouTubeThumbnail: false,
4246			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' || $gallery.closest('[data-lb-autoplay=yes]').length ),
4247			// autoplayFirstVideo: false,
4248			pager: false,
4249			startClass: 'lg-start-opacity',
4250			zoomFromOrigin: zoom,
4251			controls: controls,
4252			download: ( typeof download != 'undefined' && download != '' ),
4253			thumbWidth: 50,
4254			thumbHeight: '50px',
4255			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4256			loadYouTubePoster: false,
4257			enableDrag: $triggerGal.find($selector).length > 1,
4258			mobileSettings: {
4259				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4260			},
4261		});
4262
4263		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4264			e.preventDefault();
4265			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4266			gallery.openGallery(index-1);
4267		});
4268
4269		$gallery.on('uncode-gallery-trigger', function(){
4270			gallery.openGallery(0);
4271		});
4272
4273		$triggerGal.on('more-items-loaded', function(e, items) {
4274			clearRequestTimeout(itemsLoadedTimeOut);
4275			itemsLoadedTimeOut = requestTimeout(function(){
4276				createSelectors();
4277				captionBuilder($triggerGal);
4278				gallery.refresh();
4279			}, 100);
4280		});
4281
4282		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4283			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4284				$el = model.view.$el;
4285				if ( $el.find($triggerGal).length ) {
4286					gallery.destroy();
4287				}
4288			});
4289		}
4290
4291		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4292		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4293		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4294			$(window).trigger('uncode-custom-cursor');
4295		});
4296
4297	});
4298
4299	if ( typeof $el !== 'undefined' ) {
4300
4301		//album galleries
4302		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4303			var album = val,
4304				galleryID = index,
4305				$album = $(album),
4306				params = $album.attr('data-album'),
4307				tmb = $(val).attr('data-notmb'),
4308				social = $(val).attr('data-social'),
4309				deep = $(val).attr('data-deep'),
4310				actual = $(val).attr('data-actual-size'),
4311				download = $(val).attr('data-download'),
4312				controls = $(val).attr('data-arrows') !== 'no',
4313				fullScreen = $(val).attr('data-full'),
4314				counter = $(val).attr('data-counter'),
4315				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4316				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4317				lgPlugins = [lgVideo];
4318
4319			$(val).attr('data-lbox-init','true');
4320
4321			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4322			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4323
4324			if ( typeof tmb == 'undefined' || !tmb ) {
4325				lgPlugins.push(lgThumbnail);
4326			}
4327			if ( typeof actual != 'undefined' && actual != '' ) {
4328				lgPlugins.push(lgZoom);
4329			}
4330			if ( typeof deep != 'undefined' && deep != '' ) {
4331				lgPlugins.push(lgHash);
4332			}
4333			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4334				lgPlugins.push(lgFullscreen);
4335			}
4336			if ( social ) {
4337				lgPlugins.push(lgShare);
4338			}
4339
4340			var gallery = window.lightGallery(album, {
4341				dynamic: true,
4342				plugins: lgPlugins,
4343				dynamicEl: JSON.parse(params),
4344				galleryId: galleryID,
4345				addClass: containerClass,
4346				mode: transition,
4347				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4348				iframeWidth: '848px',
4349				iframeMaxWidth: '90%',
4350				iframeMaxHeight: '90%',
4351				loadYouTubeThumbnail: false,
4352				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4353				// autoplayFirstVideo: false,
4354				pager: false,
4355				startClass: 'lg-start-opacity',
4356				zoomFromOrigin: false,
4357				controls: controls,
4358				download: ( typeof download != 'undefined' && download != '' ),
4359				thumbWidth: 50,
4360				thumbHeight: '50px',
4361				loadYouTubePoster: false,
4362				counter: counter,
4363				exThumbImage: 'data-external-thumb-image',
4364				loadYouTubePoster: false,
4365				mobileSettings: {
4366					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4367				},
4368			});
4369
4370			$album.on('click', function(){
4371				gallery.openGallery(0);
4372			});
4373
4374			album.addEventListener('lgBeforeSlide', beforeSlide);
4375			album.addEventListener('lgBeforeOpen', beforeOpen);
4376			album.addEventListener('lgAfterOpen', function(){
4377				$(window).trigger('uncode-custom-cursor');
4378			});
4379
4380			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4381				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4382					$el = model.view.$el;
4383					if ( $el.find($album).length ) {
4384						gallery.destroy();
4385					}
4386				});
4387			}
4388
4389		});
4390
4391		//single images
4392		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4393			var gallery = lightGallery( $('.page-wrapper')[0], {
4394				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4395				iframeWidth: '848px',
4396				iframeMaxWidth: '90%',
4397				iframeMaxHeight: '90%',
4398				loadYouTubeThumbnail: false,
4399				// autoplayFirstVideo: false,
4400				startClass: 'lg-start-opacity',
4401				thumbWidth: 50,
4402				thumbHeight: '50px',
4403				download: false,
4404				loadYouTubePoster: false,
4405				counter: false
4406			});
4407
4408			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4409			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4410		});
4411	}
4412
4413	var galleryButtons = function(){
4414		var $buttons = $('.btn-gallery-trigger');
4415		$buttons.each(function(key, val){
4416			var $button = $(val),
4417				target = $button.attr('data-target'),
4418				$gallery = $('.un-media-gallery').first(),
4419				$row = $button.closest('.vc_row[data-parent]');
4420			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4421				$gallery = $('.un-media-gallery#' + target);
4422			} else if ( $('.un-media-gallery', $row).length ) {
4423				$gallery = $('.un-media-gallery', $row).first();
4424			}
4425			
4426			$button.on('click', 'a', function(e){
4427				e.preventDefault();
4428				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4429			});
4430		});
4431	};
4432	galleryButtons();
4433};
4434
4435UNCODE.carousel = function(container) {
4436	var $owlContainers = $('.owl-carousel-container', container);
4437	$owlContainers.each(function() {
4438		var $owlContainer = $(this),
4439			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4440			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4441			values = {},
4442			tempTimeStamp,
4443			newWidth = UNCODE.wwidth,
4444			$owlInsideEqual = [];
4445		$owlSelector.each(function() {
4446			var itemID = $(this).attr('id'),
4447				$elSelector = $(('#' + itemID).toString());
4448			values['id'] = itemID;
4449			values['items'] = 1;
4450			values['columns'] = 3;
4451			values['fade'] = false;
4452			values['nav'] = false;
4453			values['navmobile'] = false;
4454			values['navskin'] = 'light';
4455			values['navspeed'] = 400;
4456			values['dots'] = false;
4457			values['dotsmobile'] = false;
4458			values['loop'] = false;
4459			values['autoplay'] = false;
4460			values['timeout'] = 3000;
4461			values['autoheight'] = false;
4462			values['stagepadding'] = 0;
4463			values['margin'] = 0;
4464			values['lg'] = 1;
4465			values['md'] = 1;
4466			values['sm'] = 1;
4467			$.each($(this).data(), function(i, v) {
4468				values[i] = v;
4469			});
4470
4471			if ($(this).closest('.uncode-slider').length) {
4472				values['navskin'] = '';
4473				values['navmobile'] = false;
4474				//values['dotsmobile'] = true;
4475			} else {
4476				values['navskin'] = ' style-'+values['navskin']+' style-override';
4477			}
4478
4479			var setIndexActive = function(event, init){
4480				var init = typeof init === 'undefined' ? false : init,
4481					thiis = $(event.currentTarget);
4482				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4483					var scrolltop = $(document).scrollTop(),
4484						size = event.page.size,
4485						i;
4486					var setIndex = requestTimeout(function() {
4487						for ( i = 0; i < size; i++ ) {
4488							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4489							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4490							if (thiis.closest('.row-slider').length) {
4491								if (currentItem == undefined) {
4492									currentItem = thiis.children()[i];
4493								}
4494								if ($(currentItem).closest('#page-header').length) {
4495									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4496										UNCODE.switchColorsMenu(scrolltop, 'dark');
4497									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4498										UNCODE.switchColorsMenu(scrolltop, 'light');
4499									}
4500								}
4501								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4502								if (owlCustomNav.length) {
4503									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4504										owlCustomNav.addClass('style-dark').removeClass('style-light');
4505									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4506										owlCustomNav.addClass('style-light').removeClass('style-dark');
4507									}
4508								}
4509							}
4510							var itendIndex = $(currentItem).attr('data-index');
4511							if ( isNaN(itendIndex) ) {
4512								itendIndex = 1;
4513							}
4514							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4515							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4516							if ($.fn.counterUp) {
4517								if (size <= 1) {
4518									$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4519										var $counter = $(this);
4520										$counter.addClass('started').counterUp({
4521											delay: 10,
4522											time: 1500
4523										});
4524									});
4525								} else {
4526									$('.owl-item', $elSelector).eq(itemCont).find('.uncode-counter:not(.started)').addClass('started').counterUp({
4527										delay: 10,
4528										time: 1500
4529									});
4530								}
4531							}
4532						}
4533						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4534					}, 200);					
4535				}
4536				tempTimeStamp = event.timeStamp;
4537			}
4538
4539			/** Initialize */
4540			$elSelector.on('initialize.owl.carousel', function(event) {
4541				if (typeof UNCODE.owlNav !== 'undefined') {
4542					UNCODE.owlNav(itemID, event);
4543				}
4544
4545				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4546					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4547						var shortcode = model.attributes.shortcode,
4548							$el = model.view.$el,
4549							$row_wrap = $el.closest('.row');
4550						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4551							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4552						}
4553					});
4554					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4555						var shortcode = model.attributes.shortcode;
4556						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4557							tempTimeStamp = Math.floor(Date.now() / 1000);
4558						}
4559					});
4560					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4561						var shortcode = model.attributes.shortcode;
4562						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4563							UNCODE.owlNav(itemID, event);
4564							$elSelector.trigger('refresh.owl.carousel');
4565						}
4566					});
4567				}
4568				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4569				// 	$elSelector.closest('.mega-menu-inner').css({
4570				// 		visibility: 'hidden',
4571				// 		display: 'block'
4572				// 	});
4573				// 	$elSelector.data('owl.carousel');
4574				// 	$elSelector.trigger('refresh.owl.carousel');
4575				// 	$elSelector.closest('.mega-menu-inner').css({
4576				// 		display: 'none',
4577				// 		visibility: '',
4578				// 	});
4579				// }
4580				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4581				// 	$elSelector.trigger("to.owl.carousel", 0);
4582				// });
4583			});
4584
4585			/** Initialized */
4586			$elSelector.on('initialized.owl.navigation', function(event) {
4587				$('.owl-dot', event.currentTarget).each(function(key, val){
4588					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4589				});
4590			});
4591
4592			$elSelector.on('initialized.owl.carousel', function(event) {
4593
4594				if ( $('.isotope-container', event.currentTarget).length ) {
4595					window.dispatchEvent(UNCODE.boxEvent);
4596				}
4597
4598				$('.owl-dot.active', $elSelector).on('click', function(){
4599					return false;
4600				});
4601
4602				var thiis = $(event.currentTarget),
4603					// get the time from the data method
4604					time = thiis.data("timer-id"),
4605					rowParent = thiis.closest('.row-parent');
4606
4607				if ( typeof rowParent[0] !== 'undefined' ) {
4608					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4609				}
4610
4611				if (time) {
4612					clearRequestTimeout(time);
4613				}
4614
4615				thiis.addClass('showControls');
4616				var new_time = requestTimeout(function() {
4617					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4618					if (thiis.hasClass('owl-height-viewport'))
4619						setItemsRelHeight(thiis);
4620					if (thiis.hasClass('owl-height-equal') || thiis.closest('.uncode-wrapper').length) {
4621						setItemsHeight(thiis);
4622					}
4623					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4624					if (thiis.closest('.unequal, .unexpand').length) {
4625						UNCODE.setRowHeight(rowParent[0], true);
4626					}
4627					if (SiteParameters.dynamic_srcset_active === '1') {
4628						UNCODE.refresh_dynamic_srcset_size(thiis);
4629					}
4630				}, 350);
4631				// save the new time
4632				thiis.data("timer-id", new_time);
4633
4634				var scrolltop = $(document).scrollTop();
4635				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4636
4637				//if (!UNCODE.isMobile) {
4638					/** fix autoplay when visible **/
4639				$(window).on('load', function(){
4640					if (thiis.data('autoplay')) {
4641						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) {
4642							thiis.trigger('stop.owl.autoplay');
4643						} else {
4644							thiis.trigger('play.owl.autoplay');
4645						}
4646					}
4647					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4648						return;
4649					}
4650					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) {
4651						var carouselInView = new Waypoint.Inview({
4652							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4653							element: thiis[0],
4654							exited: function() {
4655								var el = $(this.element);
4656								if (el.data('autoplay') ) {
4657									el.trigger('stop.owl.autoplay');
4658									el.data('stopped','true');
4659								}
4660							},
4661							enter: function(direction) {
4662								var el = $(this.element);
4663								requestTimeout(function() {
4664									if (el.data('autoplay')) {
4665										el.trigger('play.owl.autoplay');
4666										el.data('stopped','false');
4667									}
4668								}, 100);
4669							}
4670						});
4671					}
4672					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4673						setTimeout(function(){
4674							window.lenis.resize();
4675						}, 1000);
4676					}
4677			  	
4678				});
4679				//}
4680
4681				// $(window).on('frontend:carousel_updated', function(){
4682				// 	Waypoint.refreshAll();
4683				// });
4684
4685				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) {
4686					requestTimeout(function() {
4687						animate_thumb($('.t-inside', el), event);
4688					}, 400);
4689				} 
4690				if (thiis.closest('.isotope-system').length ) {
4691					requestTimeout(function() {
4692						thiis.closest('.isotope-container').isotope('layout');
4693					}, 400);
4694				}
4695				if (thiis.closest('.megamenu-block-wrapper').length ) {
4696					$(document).on('un-menu-show', function(e, $ul){
4697						if ( thiis.closest($ul).length ) {
4698							animate_thumb($('.t-inside', el), event);
4699						}
4700					});
4701				}
4702				if (thiis.closest('.overlay').length ) {
4703					$(window).on('menuOpen', function(e, $ul){
4704						animate_thumb($('.t-inside', el), event);
4705					});
4706				}
4707
4708				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4709				currentIndex = $(currentItem).attr('data-index');
4710
4711				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4712					if ($(val).closest('.uncode-slider').length) {
4713						$(val).removeClass('start_animation');
4714					}
4715				});
4716				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4717					if ($(val).closest('.uncode-slider').length) {
4718						$(val).removeClass('already-animated');
4719					}
4720				});
4721
4722				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4723					if ($(val).closest('.uncode-slider').length) {
4724						$(val).removeAttr('data-animated');
4725					}
4726				});
4727
4728				$.each($('.owl-item.cloned', thiis), function(index, val) {
4729					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4730				});
4731
4732				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4733					if ($(val).attr('data-index') != currentIndex) {
4734						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4735						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4736					}
4737					if ($(val).attr('data-index') != currentIndex) {
4738						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4739					}
4740					if ($(val).attr('data-index') == currentIndex) {
4741						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4742					}
4743				});
4744
4745				if (thiis.closest('.uncode-slider').length) {
4746					var el = thiis.closest('.row-parent')[0],
4747						section = thiis.closest('.vc_section');
4748					if ( section.length ) {
4749						el = $('> .row-parent', section)[0];
4750					}
4751					if ($(el).data('imgready')) {
4752						firstLoaded(el, event);
4753					} else {
4754						el.addEventListener("imgLoaded", function(el) {
4755							firstLoaded(el.target, event);
4756						}, false);
4757					}
4758					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4759					if (transHeight != null) {
4760						requestTimeout(function() {
4761							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4762						}, 100);
4763					}
4764				} else {
4765					var el = thiis;
4766					el.closest('.uncode-slider').addClass('slider-loaded');
4767				}
4768
4769				requestTimeout(function() {
4770					if (typeof UNCODE.bigText !== 'undefined') {
4771						UNCODE.bigText(thiis);
4772					}
4773					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4774						if (thiis.data('autoplay')) pauseOnHover(thiis);
4775					}
4776				}, 500);
4777
4778				if (thiis.closest('.unequal').length) {
4779					$owlInsideEqual.push(thiis.closest('.row-parent'));
4780				}
4781
4782				var containerClasses = '',
4783					containerStyle = '';
4784				if ( $('.owl-dots-classes', $owlContainer).length ) {
4785					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4786					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4787					$('.owl-dots-classes', $owlContainer).remove();
4788				}
4789
4790				if ( containerClasses !== '' ) {
4791					requestTimeout(function() {
4792						if ( containerClasses !== '' )
4793							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4794						if ( containerStyle !== '' )
4795							$('.owl-dots', $owlContainer).addClass(containerClasses);
4796					}, 100);
4797				}
4798
4799				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4800					$(val).closest('.row-inner').css({
4801						'margin-top': '-1px'
4802					});
4803				});
4804
4805				if ($.fn.isotope) {
4806					if ( thiis.closest('.isotope-container').length ) {
4807						if (thiis.closest('.isotope-container').data('isotope')) {
4808							requestTimeout(function(){
4809								thiis.closest('.isotope-container').isotope('layout');
4810							}, 300);
4811						}
4812						$(window).on('load', function(){
4813							if (thiis.closest('.isotope-container').data('isotope')) {
4814								thiis.closest('.isotope-container').isotope('layout');
4815							}
4816						});
4817					}
4818				}
4819
4820				if (thiis.data('autoplay')) {
4821					$(window).on('menuOpen', function(){
4822						if ( thiis.closest('.overlay').length ) {
4823							thiis.trigger('play.owl.autoplay');
4824							thiis.data('stopped','false');
4825						} else {
4826							thiis.trigger('stop.owl.autoplay');
4827							thiis.data('stopped','true');
4828						}
4829					});
4830					$(window).on('menuClose', function(){
4831						if ( thiis.closest('.overlay').length ) {
4832							thiis.trigger('stop.owl.autoplay');
4833							thiis.data('stopped','true');
4834						} else {
4835							thiis.trigger('play.owl.autoplay');
4836							thiis.data('stopped','false');
4837						}
4838					});
4839				}
4840
4841				setIndexActive(event, true);
4842
4843				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4844						return !$(this).closest('.nested-carousel').length;
4845					}),
4846					$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init])', thiis).has(nested_a),
4847					$galleries = $_galleries.filter(function( index ) {
4848						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4849					});
4850
4851				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4852					UNCODE.lightgallery( $galleries );
4853				}
4854
4855				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4856					$(document).trigger('uncode-scrolltrigger-refresh');
4857				}
4858
4859				if (thiis.closest('.overlay').length && thiis.data('autoplay')) {
4860					thiis.trigger('stop.owl.autoplay');
4861					thiis.data('stopped','true');
4862				}
4863
4864				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4865					thiis.trigger('stop.owl.autoplay');
4866					thiis.data('stopped','false');
4867					$(document).on('un-menu-show', function(){
4868						thiis.trigger('play.owl.autoplay');
4869						thiis.data('stopped','false');
4870					}).on('un-menu-hide', function(){
4871						thiis.trigger('stop.owl.autoplay');
4872						thiis.data('stopped','true');
4873					});
4874				}
4875			});
4876
4877			$elSelector.on('resized.owl.carousel', function(event) {
4878				$('.owl-dot', event.currentTarget).each(function(key, val){
4879					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4880				});
4881			});
4882
4883			$elSelector.on('resized.owl.carousel', function(event) {
4884				var thiis = $(event.currentTarget);
4885				// if ($(this).closest('.nested-carousel').length) {
4886				// 	requestTimeout(function() {
4887				// 		window.dispatchEvent(UNCODE.boxEvent);
4888				// 	}, 200);
4889				// }
4890				if ( thiis.hasClass('owl-height-equal') )
4891					setItemsHeight(thiis);
4892
4893				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4894					newWidth = UNCODE.wwidth;
4895					setItemsRelHeight($elSelector);
4896				}
4897
4898				setIndexActive(event);
4899
4900				if (SiteParameters.dynamic_srcset_active === '1') {
4901					UNCODE.refresh_dynamic_srcset_size(thiis);
4902				}
4903
4904				if ($.fn.isotope) {
4905					$(window).on('load', function(){
4906						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4907							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4908						}
4909					});
4910				}
4911
4912				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4913					setTimeout(function(){
4914						window.lenis.resize();
4915					}, 1000);
4916				}
4917				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4918					$(document).trigger('uncode-scrolltrigger-refresh');
4919				}
4920			});
4921
4922			$elSelector.on('refreshed.owl.carousel', function(event) {
4923				setIndexActive(event);
4924			});
4925
4926			/** detect resize window for fluid height layout */
4927			var setFluidResize;
4928			function manageFluidCarouseHeight() {
4929				clearRequestTimeout(setFluidResize);
4930				setFluidResize = requestTimeout(function(){
4931					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4932						newWidth = UNCODE.wwidth;
4933						setItemsRelHeight($elSelector);
4934					}
4935				}, 100);
4936			}
4937			window.addEventListener('resize', manageFluidCarouseHeight);
4938
4939			/** Change */
4940			$elSelector.on('change.owl.carousel', function(event) {
4941				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4942			});
4943
4944			/** Changed */
4945			$elSelector.on('changed.owl.carousel', function(event) {
4946				var $row = $elSelector.parents('.row')[0];
4947				if ( typeof $row !== 'undefined' ) {
4948					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4949				}
4950				setIndexActive(event);
4951			});
4952
4953			var checkDrag = function(e) {
4954				$elSelector.addClass('owl-dragging');
4955			};
4956			$elSelector.on('drag.owl.carousel', function(event) {
4957				document.addEventListener("mousemove", checkDrag);
4958			});
4959
4960			$elSelector.on('dragged.owl.carousel', function(event) {
4961				$elSelector.removeClass('owl-dragging');
4962				document.removeEventListener("mousemove", checkDrag);
4963			});
4964
4965			$elSelector.on('translate.owl.carousel', function(event) {
4966				if (UNCODE.isMobile) {
4967					$(event.currentTarget).addClass('owl-translating');
4968				}
4969			});
4970
4971			/** Translated */
4972			$elSelector.on('translated.owl.carousel', function(event) {
4973
4974				var thiis = $(event.currentTarget),
4975					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4976					currentIndex = $(currentItem).attr('data-index'),
4977					stagePadding = thiis.data('stagepadding');
4978
4979				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4980
4981				if (!UNCODE.isMobile) {
4982					UNCODE.owlPlayVideo(thiis);
4983				}
4984
4985				requestTimeout(function(){
4986					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4987					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4988					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4989						if (lastDelayElems == undefined) lastDelayElems = 0;
4990						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4991						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4992						thiis.trigger('stop.owl.autoplay');
4993						requestTimeout(function() {
4994							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4995						}, maxDelay);
4996					}
4997				}, 200);
4998
4999				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
5000					if ($(val).closest('.uncode-slider').length) {
5001						$(val).removeClass('start_animation');
5002					}
5003				});
5004
5005				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
5006					if ($(val).closest('.uncode-slider').length) {
5007						$(val).removeClass('already-animated');
5008					}
5009				});
5010
5011				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
5012					if ($(val).closest('.uncode-slider').length) {
5013						$(val).removeAttr('data-animated');
5014					}
5015				});
5016
5017				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
5018					if ($(val).attr('data-index') != currentIndex) {
5019						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
5020						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
5021					}
5022					if ($(val).attr('data-index') != currentIndex) {
5023						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
5024					}
5025					if ($(val).attr('data-index') == currentIndex) {
5026						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
5027					}
5028				});
5029
5030				if (UNCODE.isMobile) {
5031					thiis.removeClass('owl-translating');
5032				}
5033
5034				setIndexActive(event);
5035			});
5036
5037			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
5038
5039			/** Init carousel */
5040			$elSelector.not('.showControls').owlCarousel({
5041				items: values['items'],
5042				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
5043				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
5044				nav: values['nav'],
5045				dots: values['dots'],
5046				loop: values['loop'],
5047				stagePadding: values['stagepadding'],
5048				margin: 0,
5049				video: true,
5050				autoWidth: false,
5051				autoplay: false,
5052				autoplayTimeout: values['timeout'],
5053				autoplaySpeed: values['navspeed'],
5054				autoplayHoverPause: $(this).closest('.uncode-slider:not(.uncode-wrapper)').length || $(this).closest('.carousel-no-hover').length ? false : true,
5055				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
5056				itemSelector: SiteParameters.uncode_carousel_itemSelector,
5057				rtl: $('body').hasClass('rtl') ? true : false,
5058				fluidSpeed: true,
5059				navSpeed: values['navspeed'],
5060				dotsSpeed: values['navspeed'] / values['items'],
5061				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
5062				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
5063				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg" tabindex="0"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg" aria-label="' + SiteParameters.uncode_next_label + '" tabindex="0"><i class="fa fa-fw fa-angle-right"></i></div>'],
5064				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
5065				responsiveClass: true,
5066				responsiveBaseElement: '.box-container',
5067				responsive: {
5068					0: {
5069						items: values['sm'],
5070						nav: values['navmobile'],
5071						dots: values['dotsmobile'],
5072						dotsSpeed: values['navspeed'] / values['sm'],
5073					},
5074					480: {
5075						items: values['sm'],
5076						nav: values['navmobile'],
5077						dots: values['dotsmobile'],
5078						dotsSpeed: values['navspeed'] / values['sm'],
5079					},
5080					570: {
5081						items: values['md'],
5082						nav: values['navmobile'],
5083						dots: values['dotsmobile'],
5084						dotsSpeed: values['navspeed'] / values['md'],
5085					},
5086					960: {
5087						items: values['lg'],
5088						dotsSpeed: values['navspeed'] / values['lg'],
5089					}
5090				}
5091			});
5092
5093			var transDuration = parseFloat(values['navspeed']) * 0.3;
5094			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
5095
5096			$('.owl-item .tmb', $elSelector).css({
5097				'-webkit-transition-delay': transDuration + 'ms',
5098				'-moz-transition-delay': transDuration + 'ms',
5099				'-o-transition-delay': transDuration + 'ms',
5100				'transition-delay': transDuration + 'ms',
5101				'-webkit-transition-duration': transDuration2 + 'ms',
5102				'-moz-transition-duration': transDuration2 + 'ms',
5103				'-o-transition-duration': transDuration2 + 'ms',
5104				'transition-duration': transDuration2 + 'ms',
5105			});
5106
5107			requestTimeout(function() {
5108				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5109					UNCODE.setRowHeight($owlInsideEqual[i]);
5110				};
5111			}, 300);
5112
5113			$(window).on('load', function(){
5114				var $elCarousel = $elSelector.data('owl.carousel');
5115				if ( typeof $elCarousel !== 'undefined' ) {
5116					$elCarousel.trigger('refreshed');
5117					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5118						UNCODE.setRowHeight($owlInsideEqual[i]);
5119					};
5120				}
5121			});
5122
5123			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
5124				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5125					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
5126					$('#' + carousel_id).find('.owl-item').each( function() {
5127						var $item = $(this),
5128							index = ( $item.index() + 1 );
5129						$item.attr('data-index', index);
5130					});
5131				}
5132			});
5133
5134			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5135				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
5136					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5137						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
5138						$('#' + carousel_id).find('.owl-item').each( function() {
5139							var $item = $(this),
5140								index = ( $item.index() + 1 );
5141							$item.attr('data-index', index);
5142						});
5143					}
5144				});
5145			}
5146
5147		});
5148
5149		function firstLoaded(el, event) {
5150			var el = $(el),
5151			uncode_slider = el.find('.uncode-slider');
5152			el.find('.owl-carousel').css('opacity', 1);
5153			uncode_slider.addClass('slider-loaded');
5154			if (typeof UNCODE.bigText !== 'undefined') {
5155				UNCODE.bigText(el.find('.owl-item.active'));
5156			}
5157			//if (!UNCODE.isMobile) {
5158				requestTimeout(function() {
5159					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
5160					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
5161					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
5162						if (lastDelayElems == undefined) lastDelayElems = 0;
5163						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5164						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5165						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5166						requestTimeout(function() {
5167							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5168						}, maxDelay);
5169					}
5170				}, 500);
5171
5172			//}
5173		}
5174
5175		function navHover(el) {
5176			var $owlCont = el,
5177				$owlPrev = $owlCont.find('.owl-prev'),
5178				$owlNext = $owlCont.find('.owl-next'),
5179				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5180				$owlPagination = $owlCont.next(),
5181				owlPrevW = $owlPrev.outerWidth(),
5182				owlNextW = $owlNext.outerWidth(),
5183				owlDotsH = $owlDots.innerHeight(),
5184				owlTime = 400,
5185				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5186			if ( $('body').hasClass('rtl') ) {
5187				$owlPrev.css("margin-right", -owlPrevW);
5188				$owlNext.css("margin-left", -owlNextW);
5189			} else {
5190				$owlPrev.css("margin-left", -owlPrevW);
5191				$owlNext.css("margin-right", -owlNextW);
5192			}
5193			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5194			$owlCont.mouseenter(function() {
5195				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5196				$owlPrev.add($owlNext).css({
5197					marginLeft: 0,
5198					marginRight: 0
5199				});
5200				if (!owlNested) {
5201					$owlDots.css({
5202						opacity: 1,
5203						bottom: 0
5204					});
5205				}
5206			}).mouseleave(function() {
5207				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5208				if ( $('body').hasClass('rtl') ) {
5209					$owlPrev.css("margin-right", -owlPrevW);
5210					$owlNext.css("margin-left", -owlNextW);
5211				} else {
5212					$owlPrev.css("margin-left", -owlPrevW);
5213					$owlNext.css("margin-right", -owlNextW);
5214				}
5215				if (!owlNested) {
5216					$owlDots.css({
5217						opacity: 1,
5218						bottom: -owlDotsH
5219					});
5220				}
5221			});
5222		};
5223
5224		function animate_elems($this) {
5225			var lastDelay;
5226			$.each($('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside), .animate_when_parent_almost_visible:not(.t-inside)', $this), function(index, val) {
5227				var element = $(val),
5228					delayAttr = element.attr('data-delay'),
5229					$first_item = element.closest('.owl-item[data-index="1"]');
5230
5231				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5232					return false;
5233				}
5234
5235				if (delayAttr == undefined) delayAttr = 0;
5236				requestTimeout(function() {
5237					element.addClass('start_animation');
5238				}, delayAttr);
5239				lastDelay = delayAttr;
5240			});
5241			return lastDelay;
5242		}
5243
5244		function animate_thumb(items, event) {
5245			var lastDelay,
5246				itemIndex,
5247				thiis = $(event.currentTarget),
5248				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5249				numActives = $('.owl-item.active', thiis).length,
5250				stagePadding = thiis.data('stagepadding');
5251
5252			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5253
5254			thiis.data('tempIndex', event.item.index);
5255				$.each(items, function(index, val) {
5256					var parent = $(val).closest('.owl-item');
5257					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5258						return;
5259					}
5260					if (!$(val).hasClass('start_animation')) {
5261						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5262							var thumbInView = new Waypoint.Inview({
5263							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5264							  element: val,
5265							  enter: function(direction) {
5266								var element = $(this.element),
5267										delayAttr = parseInt(element.attr('data-delay')),
5268										itemIndex = element.closest('.owl-item').index() + 1,
5269										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5270										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5271									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5272										diffItem = menuIndex;
5273									} else {
5274										if (itemIndex > tempIndex) {
5275											thiis.data('tempIndex', itemIndex);
5276										}
5277									}
5278									if (isNaN(delayAttr)) delayAttr = 100;
5279									if (stagePadding) {
5280										var objTimeout = requestTimeout(function() {
5281											if ( !element.closest('.overlay:not(.open)').length ) {
5282												element.addClass('start_animation');
5283											}
5284										}, index * delayAttr);
5285										lastDelay = index * delayAttr;
5286									} else {
5287										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5288										var objTimeout = requestTimeout(function() {
5289											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5290										}, diffItem * delayAttr);
5291										lastDelay = diffItem * delayAttr;
5292									}
5293									parent.data('objTimeout', objTimeout);
5294									if (!UNCODE.isUnmodalOpen) {
5295										this.destroy();
5296									}
5297								}
5298							});
5299						}
5300					}
5301				});
5302				return lastDelay;
5303			}
5304
5305		function setItemsHeight(item) {
5306			$.each($('.owl-item', item), function(index, val) {
5307				var availableThumbHeight = $('.t-inside', $(val)).height(),
5308				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5309				difference = availableThumbHeight - innerThumbHeight;
5310				if ($('.tmb-content-under', val).length) {
5311					var visualPart = $('.t-entry-visual', val);
5312					if (visualPart.length) {
5313						difference -= $('.t-entry-visual', val).height();
5314					}
5315				}
5316				if (! $('.tmb-content-lateral', val).length)
5317					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5318			});
5319		}
5320
5321		function setItemsRelHeight(item) {
5322			$.each($('.owl-item', item), function(index, val) {
5323				var $rowContainer = $(item).parents('.row-parent').eq(0),
5324					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5325					$colContainer = $(item).parents('.uncell').eq(0),
5326					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5327					winHeight = UNCODE.wheight,
5328					multiplier_h = parseInt($(item).attr('data-vp-height')),
5329					data_viewport_h,
5330					consider_menu = $(item).data('vp-menu');
5331
5332				if ( consider_menu ) {
5333					winHeight = winHeight - UNCODE.menuHeight;
5334				}
5335
5336				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5337				$('.t-inside', val).css( 'height', data_viewport_h );
5338			});
5339		}
5340
5341		function pauseOnHover(slider) {
5342			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5343			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5344				mouseenter: function () {
5345					$(slider).addClass('owl-mouseenter');
5346					$(slider).trigger('stop.owl.autoplay');
5347				},
5348				mouseleave: function () {
5349					$(slider).removeClass('owl-mouseenter');
5350					$(slider).trigger('play.owl.autoplay');
5351				}
5352			});
5353		}
5354	});
5355};
5356
5357UNCODE.owlPlayVideo = function(carousel) {
5358	var player, iframe;
5359	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5360		var content = $(val).html();
5361		if (content == '') {
5362			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5363			$(val).append(getCloned);
5364		}
5365		if ($(this).attr('data-provider') == 'vimeo') {
5366			iframe = $(this).find('iframe');
5367			player = new Vimeo.Player(iframe[0]);
5368			player.play();
5369		} else if ($(this).attr('data-provider') == 'youtube') {
5370			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5371		} else {
5372			var player = $(this).find('video');
5373			if (player.length) {
5374				$(this).find('video')[0].volume = 0;
5375				$(this).find('video')[0].play();
5376				$(val).css('opacity', 1);
5377			}
5378		}
5379	});
5380};
5381
5382UNCODE.owlStopVideo = function(carousel) {
5383	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5384		var player, iframe;
5385		if ($(this).attr('data-provider') == 'vimeo') {
5386			iframe = $(this).find('iframe');
5387			player = new Vimeo.Player(iframe[0]);
5388			player.pause();
5389		} else if ($(this).attr('data-provider') == 'youtube') {
5390			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5391		} else {
5392			var player = $(this).find('video');
5393			if (player.length) {
5394				$(this).find('video')[0].volume = 0;
5395				$(this).find('video')[0].play();
5396			}
5397		}
5398	});
5399};
5400
5401UNCODE.animations = function() {
5402
5403	var runWaypoints_TO,
5404		runWaypoints_carousel_TO,
5405		runWaypoints_delay = 0,
5406	highlightComplexFunc = function($wrap, ev){
5407
5408		var $lines = $('.heading-line-wrap', $wrap),
5409			not_animate = false;
5410
5411		if ( $wrap.data('animate') === true ) {
5412			not_animate = true;
5413		}
5414
5415		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5416		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5417			return;
5418		}
5419
5420		$lines.each(function(_key, _value){
5421			var $line = $(_value),
5422				$inners = $('.split-word-inner', $line),
5423				$highlights = $('.heading-text-highlight-inner', $line);
5424
5425			var highlitInnerFunc = function(ev){
5426				var delay = 0;
5427				$highlights.each(function(h_key, high){
5428					var $highlight = $(high),
5429						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5430						$nextSplit = $split.nextUntil(),
5431						$next = $('.heading-text-highlight-inner', $nextSplit),
5432						countCh = $split.text().length;
5433
5434					$highlight.css({
5435						'-webkit-transition-duration': (30 * countCh) + 'ms',
5436						'-moz-transition-duration': (30 * countCh) + 'ms',
5437						'-o-transition-duration': (30 * countCh) + 'ms',
5438						'transition-duration': (30 * countCh) + 'ms',
5439					});
5440
5441					delay += (30 * countCh);
5442
5443					$next.css({
5444						'-webkit-transition-delay': delay + 'ms',
5445						'-moz-transition-delay': delay + 'ms',
5446						'-o-transition-delay': delay + 'ms',
5447						'transition-delay': delay + 'ms',
5448					});
5449				});
5450				$highlights.removeAttr('data-animated');
5451				if ( _key+1 === $lines.length ) {
5452					$wrap.data('animate', true);
5453				}
5454			};
5455
5456			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5457				if ( not_animate ) {
5458					$highlights.each(function(h_key, high){
5459						var $highlight = $(high);
5460						$highlight.css({
5461							'-webkit-transition-duration': '0ms',
5462							'-moz-transition-duration': '0ms',
5463							'-o-transition-duration': '0ms',
5464							'transition-duration': '0ms',
5465						});
5466					});
5467					$highlights.removeAttr('data-animated');
5468				} else {
5469					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5470						highlitInnerFunc();
5471					} else {
5472						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5473					}
5474				}
5475			}
5476		});
5477	};
5478
5479	$.each($('.header-content-inner'), function(index, val) {
5480		var element = $(val),
5481			transition = '';
5482		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5483		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5484		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5485		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5486		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5487		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5488		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5489		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5490		if (transition != '') {
5491			$(val).removeClass(transition);
5492			var container = element,
5493				containerDelay = container.attr('data-delay'),
5494				containerSpeed = container.attr('data-speed'),
5495				items = $('.header-title > *, .post-info', container);
5496			$.each(items, function(index, val) {
5497				var element = $(val),
5498					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5499					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5500				if (!element.hasClass('animate_when_almost_visible') && !element.hasClass('translate_when_almost_visible')) {
5501					delayAttr = Number(delayAttr) + (400 * index);
5502					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5503					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5504				}
5505			});
5506			container.css('opacity', 1);
5507		}
5508	});
5509
5510	function animate_css_grids_on_load() {
5511		$('.cssgrid-system').each(function() {
5512			var grid = $(this);
5513			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5514			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5515		});
5516	}
5517
5518	var delayAdd = 0;
5519
5520	window.waypoint_animation = function(ev) {
5521		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)').filter(function(){
5522				var $el = $(this);
5523				if (!$el.is('[data-delay-seq]')) return true;
5524				return $el.is('[data-delay]');
5525			}), function(index, val) {
5526			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length || $(val).closest('.un-submenu').length || $(val).closest('#uncode-mobile-menu-block').length || $(val).closest('.has-unblock').length ) && !SiteParameters.is_frontend_editor ) ) {
5527				return true;
5528			}
5529			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5530				return;
5531			}
5532			var run = true,
5533				$carousel = $(val).closest('.owl-carousel'),
5534				marquee = $(val).closest('.tmb-linear').length;
5535			if ( $carousel.length ) {
5536				run = false;
5537			}
5538			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5539				run = false;
5540			}
5541			if (run) {
5542				new Waypoint({
5543					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5544					element: val,
5545					handler: function() {
5546						var element = $(this.element),
5547							index = element.index(),
5548							delayAttr = element.attr('data-delay');
5549						if (delayAttr == undefined) delayAttr = 0;
5550						// delayAttr = parseFloat(delayAttr) + delayAdd;
5551						// if ( marquee ) {
5552						// 	delayAdd += 50;
5553						// } else {
5554						// 	delayAdd = 0;
5555						// }
5556						requestTimeout(function() {
5557							element.addClass('start_animation');
5558						}, delayAttr);
5559						if (!UNCODE.isUnmodalOpen) {
5560							this.destroy();
5561						}
5562					},
5563					offset: UNCODE.isFullPage ? '100%' : '90%'
5564				});
5565			}
5566		});
5567		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5568			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5569				return;
5570			}
5571			var run = true,
5572				$carousel = $(val).closest('.owl-carousel');
5573			if ( $carousel.length ) {
5574				run = false;
5575			}
5576			if (run) {
5577				new Waypoint({
5578					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5579					element: val,
5580					handler: function() {
5581						var $element = $(this.element),
5582							$childs = $('.animate_when_parent_almost_visible', $element);
5583						$childs.each(function(key,el){
5584							var $child = $(el),
5585								delaySpeed = $child.attr('data-speed'),
5586								delayAttr = $child.attr('data-delay'),
5587								intervalAttr = $child.attr('data-interval');
5588							if (delayAttr == undefined) {
5589								delayAttr = 50*key;
5590							}
5591							requestTimeout(function() {
5592								$child.addClass('start_animation');
5593								if ( $child.hasClass('anim-line-checker') ) {
5594									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5595										var $line = $child.closest('.heading-line-wrap');
5596									});
5597								}
5598								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5599								highlightComplexFunc($wrapText, ev);
5600								if ( $child.hasClass('anim-tot-checker') ) {
5601									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5602										if ( $child.hasClass('anim-tot-checker') ) {
5603											$wrapText.addClass('already-animated');
5604											$element.trigger('already-animated');
5605										}
5606									});
5607								}
5608							}, delayAttr );
5609						});
5610						$element.addClass('start_animation');
5611						if (!UNCODE.isUnmodalOpen) {
5612							this.destroy();
5613						}
5614					},
5615					offset: UNCODE.isFullPage ? '100%' : '90%'
5616				});
5617			}
5618		});
5619	}
5620	window.waypoint_carousel_animation = function(ev) {
5621		$.each($('.owl-carousel').find('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
5622			if ( $(val).hasClass('el-text-split') ) {
5623				return true;
5624			}
5625			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5626				return;
5627			}
5628			var run = true,
5629				$carousel = $(val).closest('.owl-carousel'),
5630				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5631				$all_first = $('.owl-item[data-index="1"]', $carousel);
5632			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5633				run = false;
5634			}
5635			if (run) {
5636				new Waypoint({
5637					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5638					element: val,
5639					handler: function() {
5640						var element = $(this.element),
5641							index = element.index(),
5642							delayAttr = element.attr('data-delay');
5643						if (delayAttr == undefined) delayAttr = 0;
5644						requestTimeout(function() {
5645							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5646								$all_first.attr('data-already-reached', 'true');
5647							}
5648							element.addClass('start_animation');
5649						}, delayAttr);
5650						if (!UNCODE.isUnmodalOpen) {
5651							this.destroy();
5652						}
5653					},
5654					offset: UNCODE.isFullPage ? '100%' : '90%'
5655				});
5656			}
5657		});
5658		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5659			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5660				return;
5661			}
5662			var run = true,
5663				$carousel = $(val).closest('.owl-carousel'),
5664				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5665				$all_first = $('.owl-item[data-index="1"]', $carousel);
5666			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5667				run = false;
5668			}
5669			if (run) {
5670				new Waypoint({
5671					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5672					element: val,
5673					handler: function() {
5674						var $element = $(this.element),
5675							$childs = $('.animate_when_parent_almost_visible', $element);
5676						$childs.each(function(key,el){
5677							var $child = $(el),
5678								delaySpeed = $child.attr('data-speed'),
5679								delayAttr = $child.attr('data-delay'),
5680								intervalAttr = $child.attr('data-interval');
5681							if (delayAttr == undefined) {
5682								delayAttr = 50*key;
5683							}
5684							requestTimeout(function() {
5685								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5686									$all_first.attr('data-already-reached', 'true');
5687								}
5688								$child.addClass('start_animation');
5689								if ( $child.hasClass('anim-line-checker') ) {
5690									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5691										var $line = $child.closest('.heading-line-wrap');
5692									});
5693								}
5694								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5695								highlightComplexFunc($wrapText, ev);
5696								if ( $child.hasClass('anim-tot-checker') ) {
5697									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5698										if ( $child.hasClass('anim-tot-checker') ) {
5699											$wrapText.addClass('already-animated');
5700										}
5701									});
5702								}
5703							}, delayAttr );
5704						});
5705						$element.addClass('start_animation');
5706						if (!UNCODE.isUnmodalOpen) {
5707							this.destroy();
5708						}
5709					},
5710					offset: UNCODE.isFullPage ? '100%' : '90%'
5711				});
5712			}
5713		});
5714	}
5715
5716	var runWaypoints = function(ev){
5717		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5718			runWaypoints_delay = 400;
5719		}
5720		clearRequestTimeout(runWaypoints_TO);
5721		runWaypoints_TO = requestTimeout(function() {
5722			window.waypoint_animation(ev);
5723		}, runWaypoints_delay);
5724
5725		clearRequestTimeout(runWaypoints_carousel_TO);
5726		runWaypoints_carousel_TO = requestTimeout(function() {
5727			window.waypoint_carousel_animation(ev);
5728		}, 400);
5729	};
5730	runWaypoints();
5731	animate_css_grids_on_load();
5732
5733	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5734		runWaypoints(ev);
5735	});
5736	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5737		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5738		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5739	}
5740};
5741
5742UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5743	var $allItems = elements.length - startIndex,
5744		showed = 0,
5745		index = 0,
5746		use_index = false
5747		;
5748
5749	if (filtering) {
5750		if (sequential) {
5751			use_index = true;
5752		}
5753		sequential = false;
5754	}
5755
5756	$.each(elements, function(index, val) {
5757		var $this = $(val),
5758			elInner = $('> .t-inside', val);
5759
5760		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5761			return;
5762		}
5763		if (val[0]) val = val[0];
5764
5765		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5766			new Waypoint({
5767				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5768				element: val,
5769				handler: function() {
5770					var element = $('> .t-inside', this.element),
5771						parent = $(this.element);
5772					var _index = use_index? index : 0;
5773
5774					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5775						delayAttr = parseInt(element.attr('data-delay'));
5776					if (isNaN(delayAttr)) delayAttr = 100;
5777					if (sequential || use_index) {
5778						delay -= showed;
5779					}
5780					var objTimeout = requestTimeout(function() {
5781						element.removeClass('zoom-reverse').addClass('start_animation');
5782						showed = index;
5783					}, delay * delayAttr);
5784					parent.data('objTimeout', objTimeout);
5785					if (!UNCODE.isUnmodalOpen) {
5786						this.destroy();
5787					}
5788				},
5789				offset: UNCODE.isFullPage ? '100%' : '90%'
5790			});
5791		}
5792
5793		index++;
5794	});
5795};
5796
5797UNCODE.tapHover = function() {
5798
5799	var isTouch = (
5800		'ontouchstart' in window ||
5801		navigator.maxTouchPoints > 0 ||
5802		navigator.msMaxTouchPoints > 0
5803	);
5804
5805	if (isTouch) {
5806		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5807			elClass = "hover";
5808
5809		$(window).on('click', function() {
5810			$el.removeClass(elClass);
5811		});
5812
5813		$el.on('click', function(e) {
5814			e.stopPropagation();
5815			var link = $(this);
5816			if ( ! link.hasClass(elClass)) {
5817				e.preventDefault();
5818				link.addClass("hover");
5819				$el.not(this).removeClass(elClass);
5820				return false;
5821			}
5822		});
5823	}
5824};
5825
5826UNCODE.onePage = function(isMobile) {
5827	var current = 0,
5828		last = 0,
5829		lastScrollTop = 0,
5830		forceScroll = false,
5831		lastScrolled = 0,
5832		isSectionscroller = ($('.main-onepage').length) ? true : false,
5833		isOnePage = false,
5834		getOffset = function () {
5835			var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container').outerHeight() : 0);
5836			return calculateOffset;
5837		}
5838
5839	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5840
5841	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5842	// 	return false;
5843
5844	function init_onepage() {
5845		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5846			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5847		}
5848		last = $('.onepage-pagination li').last().find('a').data('index');
5849		$.each($('div[data-parent="true"]'), function(index, val) {
5850			$(this).attr('data-section', index);
5851			if (isMobile) return;
5852			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5853				return;
5854			}
5855			var sectionDown = new Waypoint({
5856				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5857				element: val,
5858				handler: function(direction) {
5859					if (direction == 'down') {
5860						changeMenuActive(this.element, index);
5861					}
5862				},
5863				offset: function() {
5864					return 5 + getOffset()
5865				}
5866			});
5867			var sectionUp = new Waypoint({
5868				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5869				element: val,
5870				handler: function(direction) {
5871					if (direction == 'up') {
5872						changeMenuActive(this.element, index);
5873					}
5874				},
5875				offset: function() {
5876					return -5 - getOffset()
5877				}
5878			});
5879
5880			if (isSectionscroller) {
5881				var label;
5882				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5883				else label = '';
5884				var getName = $(this).attr('data-name');
5885				if (getName == undefined) getName = index;
5886				if (label != '') {
5887					isOnePage = true;
5888					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5889					$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
5890				}
5891			}
5892		});
5893
5894		if (isSectionscroller) {
5895			$.each($('ul.onepage-pagination li'), function(index, val) {
5896				var $this = $(val),
5897					$a = ('a', $this);
5898				$a.on('click', function(evt) {
5899					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5900						return false;
5901					}
5902					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5903						evt.preventDefault();
5904					}
5905					Waypoint.refreshAll();
5906					var el = $('a', evt.currentTarget);
5907					current = lastScrolled = parseInt(el.attr('data-index'));
5908					lastScrolled += 1;
5909					scrollBody(current);
5910				});
5911			});
5912		}
5913
5914		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5915		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5916			goToSection = String(window.location.hash).replace(/^#/, "");
5917			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5918		}
5919
5920		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5921			current = lastScrolled = goToSection;
5922			$(window).on('load', function(){
5923				if ( $('.owl-carousel').length ) {
5924					requestTimeout(function(){
5925						scrollBody(goToSection);
5926					}, 400);
5927				} else {
5928					scrollBody(goToSection);
5929				}
5930			});
5931		}
5932
5933	}
5934
5935	function changeMenuActive(section, index) {
5936		current = lastScrolled = parseInt($(section).attr('data-section'));
5937		if (isOnePage) {
5938			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5939			if (newSection.length) {
5940				$('ul.onepage-pagination li a').removeClass('is-selected');
5941				newSection.addClass('is-selected');
5942			}
5943			var getName = $('[data-section="' + index + '"]').attr('data-name');
5944			if (getName != undefined && getName !== '') {
5945				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5946					var get_href = $(val).attr('href');
5947					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5948						$(val).closest('.menu-smart').find('.active').removeClass('active');
5949						$(val).parent().addClass('active');
5950					}
5951				});
5952			}
5953		}
5954	}
5955
5956	if (isOnePage) {
5957		$(window).on('scroll', function() {
5958			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5959			if (bodyTop == 0) {
5960				$('ul.onepage-pagination li a').removeClass('is-selected');
5961				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5962				var getName = $('[data-section=0]').attr('data-name');
5963				if (getName != undefined && getName !== '') {
5964					$.each($('.menu-container .menu-item > a'), function(i, val) {
5965						var get_href = $(val).attr('href');
5966						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5967							$(val).closest('ul').find('.active').removeClass('active');
5968							$(val).parent().addClass('active');
5969						}
5970					});
5971				}
5972			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5973				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5974				if (lastSection.length) {
5975					$('ul.onepage-pagination li a').removeClass('is-selected');
5976					lastSection.addClass('is-selected');
5977				}
5978			}
5979		});
5980	}
5981
5982	var scrollBody = function(index) {
5983		$('ul.onepage-pagination li a').removeClass('is-selected');
5984		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5985
5986		var getSection = $('[data-section=' + index + ']'),
5987			scrollTo;
5988
5989		if (getSection == undefined) return;
5990
5991		var body = $("html, body"),
5992			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5993			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5994			getOffset = UNCODE.get_scroll_offset(index);
5995		if ( typeof getSection.offset() === 'undefined' )
5996			return;
5997		scrollTo = getSection.offset().top;
5998
5999		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
6000		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
6001			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
6002			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
6003				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
6004			}
6005
6006			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
6007				if ( index === 0 ) {
6008					scrollTo = 0;
6009				} else {
6010					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
6011				}
6012			} else {
6013				scrollTo -= getOffset;
6014			}
6015		}
6016
6017		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6018		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6019
6020		if (index != 0) {
6021			UNCODE.scrolling = true;
6022		}
6023
6024		if (scrollSpeed == 0) {
6025			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6026			UNCODE.scrolling = false;
6027		} else {
6028			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6029				$(this).stop();
6030			}).animate({
6031				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6032			}, scrollSpeed, 'easeInOutCubic', function() {
6033				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6034				UNCODE.scrolling = false;
6035				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
6036				||
6037				$('.menu-hided').length ) {
6038					scrollTo = getSection.offset().top;
6039					getOffset = UNCODE.get_scroll_offset(index);
6040					scrollTo -= getOffset;
6041					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6042						$(this).stop();
6043					}).animate({
6044						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6045						}, scrollSpeed, 'easeInOutCubic', function() {
6046							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6047							UNCODE.scrolling = false;
6048						}
6049					);
6050				}
6051			});
6052		}
6053
6054	};
6055
6056	init_onepage();
6057};
6058
6059UNCODE.stickyElements = function() {
6060	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
6061	if (!isMobile_wide ) {
6062
6063		var $pageHeader = $('#page-header'),
6064			$headerRow = $('.vc_row', $pageHeader),
6065			$headerSection = $headerRow.closest('section[data-parent]'),
6066			startSticky = false;
6067
6068		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
6069			$headerRow.removeClass('sticky-element');
6070			$pageHeader.addClass('sticky-element');
6071			startSticky = true;
6072		}
6073
6074		var calculateOffset = function(el) {
6075			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
6076				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
6077				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
6078				elTop = window.pageYOffset + el.getBoundingClientRect().top;
6079
6080			sideOffset += UNCODE.bodyBorder;
6081
6082			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
6083			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
6084				if ($('.menu-shrink').length) {
6085					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
6086				} else {
6087					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
6088				}
6089			}
6090
6091			return sideOffset;
6092
6093		},
6094
6095		initStickyElement = function($els) {
6096			if ( $('body').hasClass('vc-safe-mode') ) {
6097				return true;
6098			}
6099			if ( typeof $els === 'undefined' ) {
6100				$els = $('.sticky-element');
6101			}
6102			$.each($els, function(index, element) {
6103				if ($(element).closest('.tab-pane').length) {
6104					var $paneParent = $(element).closest('.tab-pane');
6105					if ( !$paneParent.hasClass('active') ) {
6106						return true;
6107					}
6108				}
6109				$(element).stick_in_parent({
6110					sticky_class: 'is_stucked',
6111					offset_top: calculateOffset(element),
6112					bottoming: true,
6113					inner_scrolling: SiteParameters.sticky_elements === 'on'
6114				});
6115			});
6116		};
6117
6118		var oldW = UNCODE.wwidth,
6119			oldH = UNCODE.wHeight;
6120
6121		requestTimeout(function() {
6122			if ($('.sticky-element').length) {
6123
6124				if ($(window).width() > UNCODE.mediaQuery) {
6125					initStickyElement();
6126
6127					if ( startSticky === true ) {
6128						$('#page-header').trigger('sticky_kit:recalc');
6129					}
6130				}
6131
6132				$(window).on('resize lateral_resize', function(event) {
6133					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
6134						$(".sticky-element").trigger("sticky_kit:detach");
6135						if ($(window).width() > UNCODE.mediaQuery) {
6136							initStickyElement();
6137						}
6138						oldW = UNCODE.wwidth;
6139						oldH = UNCODE.wHeight;
6140					}
6141				});
6142			}
6143		}, 1000);
6144
6145		if ($('.sticky-element').length) {
6146			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
6147				requestTimeout(function() {
6148					$(document.body).trigger("sticky_kit:recalc");
6149				}, 100);
6150			});
6151		}
6152
6153		var $panels = $('.panel-collapse');
6154		if ( $panels.length ) {
6155			$panels.each(function(){
6156				var $panel = $(this);
6157				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
6158					$(document.body).trigger("sticky_kit:recalc");
6159				});
6160			});
6161		}
6162
6163		$('.nav-tabs a').on('shown.bs.tab', function(e){
6164			var $tabs = $(e.target).closest('.tab-container'),
6165				$panel = $('.tab-pane.active', $tabs),
6166				$els = $(e.target).nextAll(".sticky-element");
6167
6168			$els.trigger("sticky_kit:detach");
6169			initStickyElement($els);
6170		});
6171
6172		$(window).on('vc-safe-mode-on', function(){
6173			$(".sticky-element").trigger("sticky_kit:detach");
6174		});
6175
6176		$(window).on('vc-safe-mode-off', function(){
6177			initStickyElement();
6178		});
6179	}
6180};
6181
6182UNCODE.twentytwenty = function() {
6183
6184  if (!$('.twentytwenty-container').length) return;
6185
6186// DOM.event.move
6187//
6188// 2.0.0
6189//
6190// Stephen Band
6191//
6192// Triggers 'movestart', 'move' and 'moveend' events after
6193// mousemoves following a mousedown cross a distance threshold,
6194// similar to the native 'dragstart', 'drag' and 'dragend' events.
6195// Move events are throttled to animation frames. Move event objects
6196// have the properties:
6197//
6198// pageX:
6199// pageY:     Page coordinates of pointer.
6200// startX:
6201// startY:    Page coordinates of pointer at movestart.
6202// distX:
6203// distY:     Distance the pointer has moved since movestart.
6204// deltaX:
6205// deltaY:    Distance the finger has moved since last event.
6206// velocityX:
6207// velocityY: Average velocity over last few events.
6208
6209
6210(function(fn) {
6211	if (typeof define === 'function' && define.amd) {
6212        define([], fn);
6213    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6214        module.exports = fn;
6215	} else {
6216		fn();
6217	}
6218})(function(){
6219	var assign = Object.assign || window.jQuery && jQuery.extend;
6220
6221	// Number of pixels a pressed pointer travels before movestart
6222	// event is fired.
6223	var threshold = 8;
6224
6225	// Shim for requestAnimationFrame, falling back to timer. See:
6226	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6227	var requestFrame = (function(){
6228		return (
6229			window.requestAnimationFrame ||
6230			window.webkitRequestAnimationFrame ||
6231			window.mozRequestAnimationFrame ||
6232			window.oRequestAnimationFrame ||
6233			window.msRequestAnimationFrame ||
6234			function(fn, element){
6235				return window.setTimeout(function(){
6236					fn();
6237				}, 25);
6238			}
6239		);
6240	})();
6241
6242	// Shim for customEvent
6243	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6244	(function () {
6245		if ( typeof window.CustomEvent === "function" ) return false;
6246		function CustomEvent ( event, params ) {
6247			params = params || { bubbles: false, cancelable: false, detail: undefined };
6248			var evt = document.createEvent( 'CustomEvent' );
6249			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6250			return evt;
6251		}
6252
6253		CustomEvent.prototype = window.Event.prototype;
6254		window.CustomEvent = CustomEvent;
6255	})();
6256
6257	var ignoreTags = {
6258			textarea: true,
6259			input: true,
6260			select: true,
6261			button: true
6262		};
6263
6264	var mouseevents = {
6265		move:   'mousemove',
6266		cancel: 'mouseup dragstart',
6267		end:    'mouseup'
6268	};
6269
6270	var touchevents = {
6271		move:   'touchmove',
6272		cancel: 'touchend',
6273		end:    'touchend'
6274	};
6275
6276	var rspaces = /\s+/;
6277
6278
6279	// DOM Events
6280
6281	var eventOptions = { bubbles: true, cancelable: true };
6282
6283	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6284
6285	function createEvent(type) {
6286		return new CustomEvent(type, eventOptions);
6287	}
6288
6289	function getEvents(node) {
6290		return node[eventsSymbol] || (node[eventsSymbol] = {});
6291	}
6292
6293	function on(node, types, fn, data, selector) {
6294		types = types.split(rspaces);
6295
6296		var events = getEvents(node);
6297		var i = types.length;
6298		var handlers, type;
6299
6300		function handler(e) { fn(e, data); }
6301
6302		while (i--) {
6303			type = types[i];
6304			handlers = events[type] || (events[type] = []);
6305			handlers.push([fn, handler]);
6306			node.addEventListener(type, handler);
6307		}
6308	}
6309
6310	function off(node, types, fn, selector) {
6311		types = types.split(rspaces);
6312
6313		var events = getEvents(node);
6314		var i = types.length;
6315		var type, handlers, k;
6316
6317		if (!events) { return; }
6318
6319		while (i--) {
6320			type = types[i];
6321			handlers = events[type];
6322			if (!handlers) { continue; }
6323			k = handlers.length;
6324			while (k--) {
6325				if (handlers[k][0] === fn) {
6326					node.removeEventListener(type, handlers[k][1]);
6327					handlers.splice(k, 1);
6328				}
6329			}
6330		}
6331	}
6332
6333	function trigger(node, type, properties) {
6334		// Don't cache events. It prevents you from triggering an event of a
6335		// given type from inside the handler of another event of that type.
6336		var event = createEvent(type);
6337		if (properties) { assign(event, properties); }
6338		node.dispatchEvent(event);
6339	}
6340
6341
6342	// Constructors
6343
6344	function Timer(fn){
6345		var callback = fn,
6346		    active = false,
6347		    running = false;
6348
6349		function trigger(time) {
6350			if (active){
6351				callback();
6352				requestFrame(trigger);
6353				running = true;
6354				active = false;
6355			}
6356			else {
6357				running = false;
6358			}
6359		}
6360
6361		this.kick = function(fn) {
6362			active = true;
6363			if (!running) { trigger(); }
6364		};
6365
6366		this.end = function(fn) {
6367			var cb = callback;
6368
6369			if (!fn) { return; }
6370
6371			// If the timer is not running, simply call the end callback.
6372			if (!running) {
6373				fn();
6374			}
6375			// If the timer is running, and has been kicked lately, then
6376			// queue up the current callback and the end callback, otherwise
6377			// just the end callback.
6378			else {
6379				callback = active ?
6380					function(){ cb(); fn(); } :
6381					fn ;
6382
6383				active = true;
6384			}
6385		};
6386	}
6387
6388
6389	// Functions
6390
6391	function noop() {}
6392
6393	function preventDefault(e) {
6394		e.preventDefault();
6395	}
6396
6397	function isIgnoreTag(e) {
6398		return !!ignoreTags[e.target.tagName.toLowerCase()];
6399	}
6400
6401	function isPrimaryButton(e) {
6402		// Ignore mousedowns on any button other than the left (or primary)
6403		// mouse button, or when a modifier key is pressed.
6404		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6405	}
6406
6407	function identifiedTouch(touchList, id) {
6408		var i, l;
6409
6410		if (touchList.identifiedTouch) {
6411			return touchList.identifiedTouch(id);
6412		}
6413
6414		// touchList.identifiedTouch() does not exist in
6415		// webkit yet… we must do the search ourselves...
6416
6417		i = -1;
6418		l = touchList.length;
6419
6420		while (++i < l) {
6421			if (touchList[i].identifier === id) {
6422				return touchList[i];
6423			}
6424		}
6425	}
6426
6427	function changedTouch(e, data) {
6428		var touch = identifiedTouch(e.changedTouches, data.identifier);
6429
6430		// This isn't the touch you're looking for.
6431		if (!touch) { return; }
6432
6433		// Chrome Android (at least) includes touches that have not
6434		// changed in e.changedTouches. That's a bit annoying. Check
6435		// that this touch has changed.
6436		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6437
6438		return touch;
6439	}
6440
6441
6442	// Handlers that decide when the first movestart is triggered
6443
6444	function mousedown(e){
6445		// Ignore non-primary buttons
6446		if (!isPrimaryButton(e)) { return; }
6447
6448		// Ignore form and interactive elements
6449		if (isIgnoreTag(e)) { return; }
6450
6451		on(document, mouseevents.move, mousemove, e);
6452		on(document, mouseevents.cancel, mouseend, e);
6453	}
6454
6455	function mousemove(e, data){
6456		checkThreshold(e, data, e, removeMouse);
6457	}
6458
6459	function mouseend(e, data) {
6460		removeMouse();
6461	}
6462
6463	function removeMouse() {
6464		off(document, mouseevents.move, mousemove);
6465		off(document, mouseevents.cancel, mouseend);
6466	}
6467
6468	function touchstart(e) {
6469		// Don't get in the way of interaction with form elements
6470		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6471
6472		var touch = e.changedTouches[0];
6473
6474		// iOS live updates the touch objects whereas Android gives us copies.
6475		// That means we can't trust the touchstart object to stay the same,
6476		// so we must copy the data. This object acts as a template for
6477		// movestart, move and moveend event objects.
6478		var data = {
6479			target:     touch.target,
6480			pageX:      touch.pageX,
6481			pageY:      touch.pageY,
6482			identifier: touch.identifier,
6483
6484			// The only way to make handlers individually unbindable is by
6485			// making them unique.
6486			touchmove:  function(e, data) { touchmove(e, data); },
6487			touchend:   function(e, data) { touchend(e, data); }
6488		};
6489
6490		on(document, touchevents.move, data.touchmove, data);
6491		on(document, touchevents.cancel, data.touchend, data);
6492	}
6493
6494	function touchmove(e, data) {
6495		var touch = changedTouch(e, data);
6496		if (!touch) { return; }
6497		checkThreshold(e, data, touch, removeTouch);
6498	}
6499
6500	function touchend(e, data) {
6501		var touch = identifiedTouch(e.changedTouches, data.identifier);
6502		if (!touch) { return; }
6503		removeTouch(data);
6504	}
6505
6506	function removeTouch(data) {
6507		off(document, touchevents.move, data.touchmove);
6508		off(document, touchevents.cancel, data.touchend);
6509	}
6510
6511	function checkThreshold(e, data, touch, fn) {
6512		var distX = touch.pageX - data.pageX;
6513		var distY = touch.pageY - data.pageY;
6514
6515		// Do nothing if the threshold has not been crossed.
6516		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6517
6518		triggerStart(e, data, touch, distX, distY, fn);
6519	}
6520
6521	function triggerStart(e, data, touch, distX, distY, fn) {
6522		var touches = e.targetTouches;
6523		var time = e.timeStamp - data.timeStamp;
6524
6525		// Create a movestart object with some special properties that
6526		// are passed only to the movestart handlers.
6527		var template = {
6528			altKey:     e.altKey,
6529			ctrlKey:    e.ctrlKey,
6530			shiftKey:   e.shiftKey,
6531			startX:     data.pageX,
6532			startY:     data.pageY,
6533			distX:      distX,
6534			distY:      distY,
6535			deltaX:     distX,
6536			deltaY:     distY,
6537			pageX:      touch.pageX,
6538			pageY:      touch.pageY,
6539			velocityX:  distX / time,
6540			velocityY:  distY / time,
6541			identifier: data.identifier,
6542			targetTouches: touches,
6543			finger: touches ? touches.length : 1,
6544			enableMove: function() {
6545				this.moveEnabled = true;
6546				this.enableMove = noop;
6547				e.preventDefault();
6548			}
6549		};
6550
6551		// Trigger the movestart event.
6552		trigger(data.target, 'movestart', template);
6553
6554		// Unbind handlers that tracked the touch or mouse up till now.
6555		fn(data);
6556	}
6557
6558
6559	// Handlers that control what happens following a movestart
6560
6561	function activeMousemove(e, data) {
6562		var timer  = data.timer;
6563
6564		data.touch = e;
6565		data.timeStamp = e.timeStamp;
6566		timer.kick();
6567	}
6568
6569	function activeMouseend(e, data) {
6570		var target = data.target;
6571		var event  = data.event;
6572		var timer  = data.timer;
6573
6574		removeActiveMouse();
6575
6576		endEvent(target, event, timer, function() {
6577			// Unbind the click suppressor, waiting until after mouseup
6578			// has been handled.
6579			setTimeout(function(){
6580				off(target, 'click', preventDefault);
6581			}, 0);
6582		});
6583	}
6584
6585	function removeActiveMouse() {
6586		off(document, mouseevents.move, activeMousemove);
6587		off(document, mouseevents.end, activeMouseend);
6588	}
6589
6590	function activeTouchmove(e, data) {
6591		var event = data.event;
6592		var timer = data.timer;
6593		var touch = changedTouch(e, event);
6594
6595		if (!touch) { return; }
6596
6597		// Stop the interface from gesturing
6598		e.preventDefault();
6599
6600		event.targetTouches = e.targetTouches;
6601		data.touch = touch;
6602		data.timeStamp = e.timeStamp;
6603
6604		timer.kick();
6605	}
6606
6607	function activeTouchend(e, data) {
6608		var target = data.target;
6609		var event  = data.event;
6610		var timer  = data.timer;
6611		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6612
6613		// This isn't the touch you're looking for.
6614		if (!touch) { return; }
6615
6616		removeActiveTouch(data);
6617		endEvent(target, event, timer);
6618	}
6619
6620	function removeActiveTouch(data) {
6621		off(document, touchevents.move, data.activeTouchmove);
6622		off(document, touchevents.end, data.activeTouchend);
6623	}
6624
6625
6626	// Logic for triggering move and moveend events
6627
6628	function updateEvent(event, touch, timeStamp) {
6629		var time = timeStamp - event.timeStamp;
6630
6631		event.distX =  touch.pageX - event.startX;
6632		event.distY =  touch.pageY - event.startY;
6633		event.deltaX = touch.pageX - event.pageX;
6634		event.deltaY = touch.pageY - event.pageY;
6635
6636		// Average the velocity of the last few events using a decay
6637		// curve to even out spurious jumps in values.
6638		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6639		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6640		event.pageX =  touch.pageX;
6641		event.pageY =  touch.pageY;
6642	}
6643
6644	function endEvent(target, event, timer, fn) {
6645		timer.end(function(){
6646			trigger(target, 'moveend', event);
6647			return fn && fn();
6648		});
6649	}
6650
6651
6652	// Set up the DOM
6653
6654	function movestart(e) {
6655		if (e.defaultPrevented) { return; }
6656		if (!e.moveEnabled) { return; }
6657
6658		var event = {
6659			startX:        e.startX,
6660			startY:        e.startY,
6661			pageX:         e.pageX,
6662			pageY:         e.pageY,
6663			distX:         e.distX,
6664			distY:         e.distY,
6665			deltaX:        e.deltaX,
6666			deltaY:        e.deltaY,
6667			velocityX:     e.velocityX,
6668			velocityY:     e.velocityY,
6669			identifier:    e.identifier,
6670			targetTouches: e.targetTouches,
6671			finger:        e.finger
6672		};
6673
6674		var data = {
6675			target:    e.target,
6676			event:     event,
6677			timer:     new Timer(update),
6678			touch:     undefined,
6679			timeStamp: e.timeStamp
6680		};
6681
6682		function update(time) {
6683			updateEvent(event, data.touch, data.timeStamp);
6684			trigger(data.target, 'move', event);
6685		}
6686
6687		if (e.identifier === undefined) {
6688			// We're dealing with a mouse event.
6689			// Stop clicks from propagating during a move
6690			on(e.target, 'click', preventDefault);
6691			on(document, mouseevents.move, activeMousemove, data);
6692			on(document, mouseevents.end, activeMouseend, data);
6693		}
6694		else {
6695			// In order to unbind correct handlers they have to be unique
6696			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6697			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6698
6699			// We're dealing with a touch.
6700			on(document, touchevents.move, data.activeTouchmove, data);
6701			on(document, touchevents.end, data.activeTouchend, data);
6702		}
6703	}
6704
6705	on(document, 'mousedown', mousedown);
6706	on(document, 'touchstart', touchstart);
6707	on(document, 'movestart', movestart);
6708
6709
6710	// jQuery special events
6711	//
6712	// jQuery event objects are copies of DOM event objects. They need
6713	// a little help copying the move properties across.
6714
6715	if (!window.jQuery) { return; }
6716
6717	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6718
6719	function enableMove1(e) { e.enableMove(); }
6720	function enableMove2(e) { e.enableMove(); }
6721	function enableMove3(e) { e.enableMove(); }
6722
6723	function add(handleObj) {
6724		var handler = handleObj.handler;
6725
6726		handleObj.handler = function(e) {
6727			// Copy move properties across from originalEvent
6728			var i = properties.length;
6729			var property;
6730
6731			while(i--) {
6732				property = properties[i];
6733				e[property] = e.originalEvent[property];
6734			}
6735
6736			handler.apply(this, arguments);
6737		};
6738	}
6739
6740	jQuery.event.special.movestart = {
6741		setup: function() {
6742			// Movestart must be enabled to allow other move events
6743			on(this, 'movestart', enableMove1);
6744
6745			// Do listen to DOM events
6746			return false;
6747		},
6748
6749		teardown: function() {
6750			off(this, 'movestart', enableMove1);
6751			return false;
6752		},
6753
6754		add: add
6755	};
6756
6757	jQuery.event.special.move = {
6758		setup: function() {
6759			on(this, 'movestart', enableMove2);
6760			return false;
6761		},
6762
6763		teardown: function() {
6764			off(this, 'movestart', enableMove2);
6765			return false;
6766		},
6767
6768		add: add
6769	};
6770
6771	jQuery.event.special.moveend = {
6772		setup: function() {
6773			on(this, 'movestart', enableMove3);
6774			return false;
6775		},
6776
6777		teardown: function() {
6778			off(this, 'movestart', enableMove3);
6779			return false;
6780		},
6781
6782		add: add
6783	};
6784});
6785
6786  $.fn.twentytwenty = function(options) {
6787    var options = $.extend({
6788      default_offset_pct: 0.5,
6789      orientation: 'horizontal',
6790      before_label: 'Before',
6791      after_label: 'After',
6792      no_overlay: false,
6793      move_slider_on_hover: false,
6794      move_with_handle_only: true,
6795      click_to_move: false
6796    }, options);
6797
6798    return this.each(function() {
6799
6800      var sliderPct = options.default_offset_pct;
6801      var container = $(this);
6802      var sliderOrientation = options.orientation;
6803      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6804      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6805
6806
6807      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6808      if(!options.no_overlay) {
6809        container.append("<div class='twentytwenty-overlay'></div>");
6810        var overlay = container.find(".twentytwenty-overlay");
6811        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6812        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6813      }
6814      var beforeImg = container.find("img:first");
6815      var afterImg = container.find("img:last");
6816      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6817      var slider = container.find(".twentytwenty-handle");
6818      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6819      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6820      container.addClass("twentytwenty-container");
6821      beforeImg.addClass("twentytwenty-before");
6822      afterImg.addClass("twentytwenty-after");
6823
6824      var calcOffset = function(dimensionPct) {
6825        var w = beforeImg.width();
6826        var h = beforeImg.height();
6827        return {
6828          w: w+"px",
6829          h: h+"px",
6830          cw: (dimensionPct*w)+"px",
6831          ch: (dimensionPct*h)+"px"
6832        };
6833      };
6834
6835      var adjustContainer = function(offset) {
6836      	if (sliderOrientation === 'vertical') {
6837          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6838          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6839      	}
6840      	else {
6841          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6842          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6843    	}
6844        container.css("height", offset.h);
6845      };
6846
6847      var adjustSlider = function(pct) {
6848        var offset = calcOffset(pct);
6849        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6850        adjustContainer(offset);
6851      };
6852
6853      // Return the number specified or the min/max number if it outside the range given.
6854      var minMaxNumber = function(num, min, max) {
6855        return Math.max(min, Math.min(max, num));
6856      };
6857
6858      // Calculate the slider percentage based on the position.
6859      var getSliderPercentage = function(positionX, positionY) {
6860        var sliderPercentage = (sliderOrientation === 'vertical') ?
6861          (positionY-offsetY)/imgHeight :
6862          (positionX-offsetX)/imgWidth;
6863
6864        return minMaxNumber(sliderPercentage, 0, 1);
6865      };
6866
6867
6868      $(window).on("resize.twentytwenty", function(e) {
6869        adjustSlider(sliderPct);
6870      });
6871
6872      var offsetX = 0;
6873      var offsetY = 0;
6874      var imgWidth = 0;
6875      var imgHeight = 0;
6876      var onMoveStart = function(e) {
6877        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6878          e.preventDefault();
6879        }
6880        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6881          e.preventDefault();
6882        }
6883        container.addClass("active");
6884        offsetX = container.offset().left;
6885        offsetY = container.offset().top;
6886        imgWidth = beforeImg.width();
6887        imgHeight = beforeImg.height();
6888      };
6889      var onMove = function(e) {
6890        if (container.hasClass("active")) {
6891          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6892          adjustSlider(sliderPct);
6893        }
6894      };
6895      var onMoveEnd = function() {
6896          container.removeClass("active");
6897      };
6898
6899      var moveTarget = options.move_with_handle_only ? slider : container;
6900      moveTarget.on("movestart",onMoveStart);
6901      moveTarget.on("move",onMove);
6902      moveTarget.on("moveend",onMoveEnd);
6903
6904      if (options.move_slider_on_hover) {
6905        container.on("mouseenter", onMoveStart);
6906        container.on("mousemove", onMove);
6907        container.on("mouseleave", onMoveEnd);
6908      }
6909
6910      slider.on("touchmove", function(e) {
6911        e.preventDefault();
6912      });
6913
6914      container.find("img").on("mousedown", function(event) {
6915        event.preventDefault();
6916      });
6917
6918      if (options.click_to_move) {
6919        container.on('click', function(e) {
6920          offsetX = container.offset().left;
6921          offsetY = container.offset().top;
6922          imgWidth = beforeImg.width();
6923          imgHeight = beforeImg.height();
6924
6925          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6926          adjustSlider(sliderPct);
6927        });
6928      }
6929
6930      $(window).trigger("resize.twentytwenty");
6931    });
6932  };
6933
6934
6935  $(window).on("load", function(e) {
6936  	$('.twentytwenty-container').each(function(){
6937  		var $container = $(this);
6938  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6939  			$container.twentytwenty();
6940  		}
6941  		$('img', $container).on('async-done', function(){
6942	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6943	  			$container.twentytwenty();
6944	  		}
6945	    });
6946  	});
6947  });
6948}
6949
6950UNCODE.justifiedGallery = function() {
6951
6952	var breakPointMe = function( val ) {
6953		val = parseInt( val );
6954		if ( isNaN(val) ) {
6955			return false;
6956		}
6957		if ( val >= 1500 ) {
6958			return 1;
6959		} else if ( val < 1500 && val >= 960 ) {
6960			return 2;
6961		} else if ( val < 960 && val >= 570 ) {
6962			return 3;
6963		} else if ( val < 570 ) {
6964			return 4;
6965		}
6966	}
6967
6968	var gutterByBreakpoint = function( bp, gutter ) {
6969		var ret;
6970		switch(gutter) {
6971		    case 'no-gutter':
6972		    	ret = 0;
6973		        break;
6974		    case 'px-gutter':
6975		    	ret = 1;
6976		        break;
6977		    case 'half-gutter':
6978		    	ret = 18;
6979		        break;
6980		    case 'double-gutter':
6981				switch(bp) {
6982				    case 3:
6983				    case 4:
6984				    	ret = 36;
6985				        break;
6986				    default:
6987				    	ret = 72;
6988				        break;
6989				}
6990		        break;
6991		    case 'triple-gutter':
6992				switch(bp) {
6993				    case 3:
6994				    case 4:
6995				    	ret = 36;
6996				        break;
6997				    default:
6998				    	ret = 108;
6999				        break;
7000				}
7001		        break;
7002		    case 'quad-gutter':
7003				switch(bp) {
7004				    case 2:
7005				    	ret = 108;
7006				        break;
7007				    case 3:
7008				    	ret = 72;
7009				        break;
7010				    case 4:
7011				    	ret = 36;
7012				        break;
7013				    default:
7014				    	ret = 144;
7015				        break;
7016				}
7017		        break;
7018		    default:
7019		    	ret = 36;//single-gutter
7020		}
7021		return ret;
7022	}
7023
7024	if ($('.justified-layout').length > 0) {
7025		var justifiedContainersArray = [],
7026			typeGridArray = [],
7027			layoutGridArray = [],
7028			transitionDuration = [],
7029			$filterItems = [],
7030			$filters = $('.justified-system .isotope-filters'),
7031			$itemSelector = '.tmb',
7032			$items,
7033			itemMargin,
7034			correctionFactor = 0,
7035			firstLoad = true,
7036			isOriginLeft = $('body').hasClass('rtl') ? false : true,
7037			prevW = breakPointMe(UNCODE.wwidth);
7038		$('[class*="justified-container"]').each(function() {
7039			var isoData = $(this).data();
7040			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7041			if (isoData.type == 'metro') typeGridArray.push(true);
7042			else typeGridArray.push(false);
7043			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
7044			else layoutGridArray.push('justified');
7045			justifiedContainersArray.push($(this));
7046		});
7047		var init_justifiedGallery = function() {
7048			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
7049				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
7050					justifiedId = justifiedSystem.attr('id'),
7051					$layoutMode = layoutGridArray[i],
7052					gutter = $(justifiedContainersArray[i]).data('gutter'),
7053					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
7054					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
7055					lastRow = $(justifiedContainersArray[i]).data('last-row'),
7056					margins;
7057
7058				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
7059				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
7060				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7061
7062				margins = gutterByBreakpoint(prevW, gutter);
7063
7064				$(justifiedContainersArray[i]).justifiedGallery({
7065					rowHeight: rowHeight,
7066					maxRowHeight: maxRowHeight,
7067					margins: margins,
7068					cssAnimation: true,
7069					lastRow: lastRow,
7070					waitThumbnailsLoad: false
7071				}).one('jg.complete', function(){ onLayout($(this), 0); } );
7072
7073				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
7074					$(justifiedContainersArray[i]).infinitescroll({
7075							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
7076							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7077							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
7078							animate: false,
7079							behavior: 'local',
7080							debug: false,
7081							loading: {
7082								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
7083								speed: 0,
7084								finished: undefined,
7085								msg: $('#' + justifiedId + ' .loadmore-button'),
7086							},
7087							errorCallback: function() {
7088								var justified_system = $(this).closest('.justified-system');
7089								$('.loading-button', justified_system).hide();
7090								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
7091							}
7092						},
7093						// append the new items to galleryJustified on the infinitescroll callback function.
7094						function(newElements, opts) {
7095							var $galleryJustified = $(this),
7096								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
7097								filters = new Array(),
7098								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
7099								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
7100								$numPages = $('a', $infinite_button).data('pages'),
7101								delay = 300;
7102							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7103							if ($galleryJustified.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
7104								$infinite_button.show();
7105							} else {
7106								$infinite_button.hide();
7107							}
7108							$loading_button.hide();
7109							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7110							$('> li', $galleryJustified).remove();
7111							$.each($(newElements), function(index, val) {
7112								$(val).addClass('tmb-iso');
7113								if ($(val).is("li")) {
7114									filters.push($(val)[0]);
7115								}
7116								$(val).addClass('uncode-appended');
7117							});
7118							newElements = newElements.filter(function(x) {
7119								return filters.indexOf(x) < 0
7120							});
7121							$.each($(filters), function(index, val) {
7122								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
7123							});
7124							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
7125							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7126								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
7127								if (typeof getLightbox === 'object') {
7128									getLightbox.refresh();
7129								} else {
7130									UNCODE.lightbox();
7131								}
7132							}
7133							if ( typeof twttr !== 'undefined' )
7134								twttr.widgets.load(justifiedContainersArray[i]);
7135
7136							requestTimeout(function() {
7137								$galleryJustified.trigger('more-items-loaded');
7138								$(window).trigger('more-items-loaded');
7139								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7140								fillIfNotScrollable($galleryJustified);
7141							}, 1000);
7142						});
7143					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
7144						var $infinite_justified = $(justifiedContainersArray[i]),
7145							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
7146						$infinite_justified.infinitescroll('pause');
7147						$infinite_button.on('click', function(event) {
7148							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7149								$.each(UNCODE.lightboxArray, function(index, val) {
7150									UNCODE.lightboxArray[index].destroy();
7151								});
7152							}
7153							event.preventDefault();
7154							var $justified_system = $(event.target).closest('.justified-system'),
7155							$infinite_justified = $justified_system.find('.justified-container'),
7156							justifiedId = $justified_system.attr('id');
7157							$(event.currentTarget).html(SiteParameters.loading);
7158							$infinite_justified.infinitescroll('resume');
7159							$infinite_justified.infinitescroll('retrieve');
7160							$infinite_justified.infinitescroll('pause');
7161							$infinite_justified.trigger('more-items-loaded');
7162							$(window).trigger('more-items-loaded');
7163							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7164						});
7165					}
7166					(function ($c) {
7167						requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
7168					})($(justifiedContainersArray[i]));
7169				}
7170			}
7171		},
7172		fillIfNotScrollable = function ($container) {
7173			if ($container.hasClass('isotope-infinite-button')) return;
7174			if (!$container.hasClass('isotope-infinite')) return;
7175			var infData = $container.data('infinitescroll');
7176			if (!infData || !infData.options || !infData.options.state) return;
7177			var state = infData.options.state;
7178			if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPaused) return;
7179			var $loadMoreA = $container.closest('.justified-system').find('.loadmore-button a');
7180			var numPages = parseInt($loadMoreA.data('pages'), 10);
7181			if (!numPages || state.currPage >= numPages) return;
7182			if (document.documentElement.scrollHeight > window.innerHeight + 1) return;
7183			$container.infinitescroll('retrieve');
7184		},
7185		onLayout = function(justifiedObj, startIndex) {
7186			justifiedObj.css('opacity', 1);
7187			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
7188			$('.tmb', justifiedObj).addClass('justified-object-loaded');
7189
7190			requestTimeout(function() {
7191				// window.dispatchEvent(UNCODE.boxEvent);
7192				UNCODE.adaptive();
7193				if (SiteParameters.dynamic_srcset_active === '1') {
7194					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7195				}
7196				if (typeof MediaElement === "function") {
7197					$(justifiedObj).find('audio,video').each(function() {
7198						$(this).mediaelementplayer({
7199								pauseOtherPlayers: false,
7200						});
7201					});
7202				}
7203				if ($(justifiedObj).find('.nested-carousel').length) {
7204					if (typeof UNCODE.carousel !== 'undefined') {
7205						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7206					}
7207					requestTimeout(function() {
7208						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7209						justifiedObj.addClass('justified-gallery-finished')
7210						Waypoint.refreshAll();
7211					}, 200);
7212				} else {
7213					requestTimeout(function() {
7214						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7215						justifiedObj.addClass('justified-gallery-finished')
7216						Waypoint.refreshAll();
7217					}, 300);
7218				}
7219			}, 100);
7220
7221		},
7222		boxAnimation = function(items, startIndex, sequential, container) {
7223			var $allItems = items.length - startIndex,
7224				showed = 0,
7225				index = 0;
7226			if (container.closest('.owl-item').length == 1) return false;
7227			$.each(items, function(index, val) {
7228				var elInner = $('> .t-inside', val);
7229				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7230					return;
7231				}
7232				if (val[0]) val = val[0];
7233				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7234					new Waypoint({
7235						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7236						element: val,
7237						handler: function() {
7238							var element = $('> .t-inside', this.element),
7239								parent = $(this.element),
7240								currentIndex = parent.index();
7241							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7242								delayAttr = parseInt(element.attr('data-delay'));
7243							if (isNaN(delayAttr)) delayAttr = 100;
7244							delay -= showed;
7245							var objTimeout = requestTimeout(function() {
7246								element.removeClass('zoom-reverse').addClass('start_animation');
7247								showed = parent.index();
7248							}, delay * delayAttr);
7249							parent.data('objTimeout', objTimeout);
7250							if (!UNCODE.isUnmodalOpen) {
7251								this.destroy();
7252							}
7253						},
7254						offset: '100%'
7255					})
7256				} else {
7257					elInner.removeClass('animate_when_almost_visible');
7258					$(val).addClass('no-waypoint-animation');
7259					/*if (elInner.hasClass('force-anim')) {
7260						elInner.addClass('start_animation');
7261					} else {
7262						elInner.css('opacity', 1);
7263					}*/
7264				}
7265				index++;
7266			});
7267		};
7268		$filters.on('click', 'a[data-filter]', function(evt) {
7269			var $filter = $(this),
7270				filterContainer = $filter.closest('.isotope-filters'),
7271				filterValue = $filter.attr('data-filter'),
7272				container = $filter.closest('.justified-system').find($('.justified-layout')),
7273				lastRow = container.data('last-row'),
7274				transitionDuration = 0,
7275				delay = 300,
7276				filterItems = [];
7277
7278			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7279
7280			var filter_items = function(){
7281				if (filterValue !== undefined) {
7282					$.each($('> .tmb > .t-inside', container), function(index, val) {
7283						var parent = $(val).parent(),
7284							objTimeout = parent.data('objTimeout');
7285						if (objTimeout) {
7286							$(val).removeClass('zoom-reverse');
7287							clearRequestTimeout(objTimeout);
7288						}
7289						if (transitionDuration == 0) {
7290							if ($(val).hasClass('animate_when_almost_visible')) {
7291								$(val).addClass('zoom-reverse').removeClass('start_animation');
7292							} else {
7293								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7294							}
7295						}
7296					});
7297
7298					requestTimeout(function() {
7299						var $block,
7300							selector,
7301							lightboxElements,
7302							$boxes;
7303
7304						if ( filterValue !== '' && filterValue !== '*' ) {
7305							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7306							selector = '.' + filterValue;
7307							$.each($(selector, container), function(index, block) {
7308								lightboxElements = $('[data-lbox^=ilightbox]', block);
7309								if (lightboxElements.length) {
7310									lightboxElements.removeClass('lb-disabled');
7311									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7312								}
7313								filterItems.push(block);
7314							});
7315							container.justifiedGallery({
7316								filter: selector,
7317								lastRow: 'nojustify'
7318							});
7319						} else {
7320							container.justifiedGallery({
7321								filter: false,
7322								lastRow: lastRow
7323							});
7324							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7325							filterItems = $('> .tmb', container);
7326						}
7327						container.trigger('more-items-loaded');
7328						$(window).trigger('more-items-loaded');
7329						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7330
7331						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7332						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7333							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7334							if (typeof getLightbox === 'object') {
7335								getLightbox.refresh();
7336							} else {
7337								UNCODE.lightbox();
7338							}
7339						}
7340
7341						if (transitionDuration == 0) {
7342							requestTimeout(function() {
7343								boxAnimation(filterItems, 0, false, container);
7344							}, 100);
7345						}
7346						requestTimeout(function() {
7347							Waypoint.refreshAll();
7348							container.trigger('more-items-loaded');
7349							$(window).trigger('more-items-loaded');
7350							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7351							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7352								$(document).trigger('uncode-scrolltrigger-refresh');
7353							}
7354						}, 2000);
7355						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
7356
7357					}, delay);
7358				} else {
7359					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7360						$.each(UNCODE.lightboxArray, function(index, val) {
7361							UNCODE.lightboxArray[index].destroy();
7362						});
7363					}
7364					$.each($('> .tmb > .t-inside', container), function(index, val) {
7365						var parent = $(val).parent(),
7366							objTimeout = parent.data('objTimeout');
7367						if (objTimeout) {
7368							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7369							clearRequestTimeout(objTimeout);
7370						}
7371						if (transitionDuration == 0) {
7372							if ($(val).hasClass('animate_when_almost_visible')) {
7373								$(val).addClass('zoom-reverse').removeClass('start_animation');
7374							} else {
7375								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7376							}
7377						}
7378					});
7379					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7380						UNCODE.lightbox();
7381					}
7382					container.parent().addClass('justified-loading');
7383					container.trigger('more-items-loaded');
7384					$(window).trigger('more-items-loaded');
7385					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7386				}
7387			};
7388
7389			if (!$filter.hasClass('active')) {
7390				/** Scroll top with filtering */
7391				if (filterContainer.hasClass('filter-scroll')) {
7392                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7393                    calc_scroll -= UNCODE.get_scroll_offset();
7394
7395					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7396						delta = bodyTop - calc_scroll,
7397						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7398						filterTolerance = false,
7399						filter_timeout;
7400					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7401
7402					if ( !UNCODE.isFullPage ) {
7403						if (scrollSpeed == 0) {
7404							$('html, body').scrollTop(calc_scroll);
7405							UNCODE.scrolling = false;
7406							filter_items();
7407						} else {
7408
7409							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7410								filter_items();
7411								filterTolerance = true;
7412							}
7413
7414							$('html, body').animate({
7415								scrollTop: calc_scroll
7416							},{
7417								easing: 'easeInOutQuad',
7418								duration: scrollSpeed,
7419								complete: function(){
7420									UNCODE.scrolling = false;
7421									if ( !filterTolerance ) {
7422										filter_timeout = setTimeout(function(){
7423											clearTimeout(filter_timeout);
7424											filter_items();
7425										}, 200);
7426									}
7427								}
7428							});
7429						}
7430					}
7431				} else {
7432					filter_items();
7433				}
7434			}
7435			evt.preventDefault();
7436		});
7437
7438		$filters.each(function(i, buttonGroup) {
7439			var $buttonGroup = $(buttonGroup);
7440			$buttonGroup.on('click', 'a', function() {
7441				$buttonGroup.find('.active').removeClass('active');
7442				$(this).addClass('active');
7443			});
7444
7445			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7446				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7447				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7448			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7449				e.preventDefault();
7450				$cats_filters.slideToggle(400, 'easeInOutCirc');
7451			});
7452		});
7453		window.addEventListener('boxResized', function(e) {
7454			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7455				prevW = breakPointMe(UNCODE.wwidth);
7456				$.each($('.justified-layout'), function(index, val) {
7457					var gutter = $(this).data('gutter'),
7458						margins = gutterByBreakpoint( prevW, gutter);
7459					$(this).justifiedGallery({
7460						margins: margins
7461					});
7462					$(this).find('.mejs-video,.mejs-audio').each(function() {
7463						$(this).trigger('resize');
7464					});
7465				});
7466			}
7467		}, false);
7468
7469		init_justifiedGallery();
7470	};
7471};
7472
7473UNCODE.cssGrid = function() {
7474	if ($('.cssgrid-layout').length > 0) {
7475		var cssGridContainersArray = [];
7476		var transitionDuration = [];
7477		var $filters = $('.cssgrid-system .cssgrid-filters');
7478
7479		$('[class*="cssgrid-container"]').each(function() {
7480			cssGridContainersArray.push($(this));
7481			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7482		});
7483
7484		var init_cssGridAjax = function() {
7485			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7486				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7487					cssGridId = cssGridSystem.attr('id');
7488
7489				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7490
7491				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7492					$(cssGridContainersArray[i]).infinitescroll({
7493						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7494						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7495						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7496						animate: false,
7497						behavior: 'local',
7498						debug: false,
7499						loading: {
7500							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7501							speed: 0,
7502							finished: undefined,
7503							msg: $('#' + cssGridId + ' .loadmore-button'),
7504						},
7505						errorCallback: function() {
7506							var cssgrid_system = $(this).closest('.cssgrid-system');
7507							$('.loading-button', cssgrid_system).hide();
7508							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7509						}
7510					},
7511					// append the new items to cssGrid on the infinitescroll callback function.
7512					function(newElements, opts) {
7513						var $cssGrid = $(this),
7514							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7515							cssGridId = cssGridSystemCont.attr('id'),
7516							filters = new Array(),
7517							$loading_button = cssGridSystemCont.find('.loading-button'),
7518							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7519							$numPages = $('a', $infinite_button).data('pages'),
7520							$woo_results,
7521							delay = 300;
7522						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7523						$infinite_button.show();
7524						$loading_button.hide();
7525						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7526						$('> li', $cssGrid).remove();
7527						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7528						$.each($(newElements), function (index, val) {
7529							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7530								$woo_results = $(val);
7531								delete newElements[index];
7532							} else {
7533								$(val).addClass('tmb-grid');
7534								if ($(val).is("li")) {
7535									filters.push($(val)[0]);
7536								}
7537							}
7538							$(val).addClass('uncode-appended');
7539						});
7540						newElements = newElements.filter(function(x) {
7541							return filters.indexOf(x) < 0
7542						});
7543						$.each($(filters), function(index, val) {
7544							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7545						});
7546						if ($woo_results && $woo_results.length > 0) {
7547							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7548							var new_count = $woo_results.find('.woocommerce-result-count').text();
7549							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7550							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7551							function replaceMatch(match, p1, p2) {
7552        						return old_start + '–' + new_end;
7553							}
7554							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7555							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7556						}
7557
7558						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7559						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7560						if (filterValue !== undefined && filterValue != '*') {
7561							$(newElements).hide();
7562							var els_to_show = $();
7563							$(newElements).each(function() {
7564								var el = $(this);
7565								if (el.hasClass(filterValue)) {
7566									els_to_show = els_to_show.add(el);
7567									el.show();
7568								}
7569							});
7570							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7571						} else {
7572							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7573						}
7574
7575						UNCODE.adaptive();
7576						if (SiteParameters.dynamic_srcset_active === '1') {
7577							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7578						}
7579						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7580							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7581							if (typeof getLightbox === 'object') {
7582								getLightbox.refresh();
7583							} else {
7584								UNCODE.lightbox();
7585							}
7586						}
7587						if ( typeof twttr !== 'undefined' ) {
7588							twttr.widgets.load(cssGridContainersArray[i]);
7589						}
7590
7591						UNCODE.carousel($(newElements));
7592						requestTimeout(function() {
7593							$cssGrid.trigger('more-items-loaded');
7594							$(window).trigger('more-items-loaded');
7595							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7596						}, 1000);
7597
7598					});
7599					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7600						var $cssgrid_el = $(cssGridContainersArray[i]),
7601							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7602						$cssgrid_el.infinitescroll('pause');
7603						$infinite_button.on('click', function(event) {
7604							event.preventDefault();
7605							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7606							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7607							cssGridId = $cssgrid_system.attr('id');
7608							$(event.currentTarget).html(SiteParameters.loading);
7609							$cssgrid_el.infinitescroll('resume');
7610							$cssgrid_el.infinitescroll('retrieve');
7611							$cssgrid_el.infinitescroll('pause');
7612						});
7613					}
7614				}
7615			}
7616		};
7617
7618		init_cssGridAjax();
7619
7620		if ($('.cssgrid-pagination').length > 0) {
7621			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7622				evt.preventDefault();
7623
7624				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7625					var container = $(this).closest('.cssgrid-system'),
7626						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7627						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7628
7629					if ( pagination_disable_scroll !== 'disabled' ) {
7630						calc_scroll -= UNCODE.get_scroll_offset();
7631
7632						var menu_container = $('.menu-sticky');
7633						var menu = menu_container.find('.menu-container');
7634
7635						if (menu_container.length > 0 && menu.length > 0) {
7636							calc_scroll = calc_scroll - menu.outerHeight();
7637						}
7638
7639						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7640							delta = bodyTop - calc_scroll,
7641							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7642						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7643
7644						if ( !UNCODE.isFullPage ) {
7645							if (scrollSpeed == 0) {
7646								$('html, body').scrollTop(calc_scroll);
7647							} else {
7648								$('html, body').animate({
7649									scrollTop: calc_scroll
7650								},{
7651									easing: 'easeInOutQuad',
7652									duration: scrollSpeed,
7653									complete: function(){
7654										UNCODE.scrolling = false;
7655									}
7656								});
7657							}
7658						}
7659					}
7660				}
7661
7662				loadCssGrid($(this), true);
7663			});
7664		}
7665
7666		$filters.on('click', 'a.grid-nav-link', function(evt) {
7667			if ($(this).hasClass('no-grid-filter')) {
7668				return;
7669			}
7670			var $filter = $(this),
7671				filterContainer = $filter.closest('.cssgrid-filters'),
7672				filterValue = $filter.attr('data-filter'),
7673				containerSystem = $filter.closest('.cssgrid-system'),
7674				container = containerSystem.find($('.cssgrid-layout')),
7675				transitionDuration = containerSystem.data('transitionDuration'),
7676				delay = 300,
7677				filterItems = [],
7678				all_thumbs = container.find('.tmb-grid');
7679
7680			var filter_items = function(){
7681				if (filterValue !== undefined) {
7682					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7683						var parent = $(val).parent(),
7684							objTimeout = parent.data('objTimeout');
7685						if (objTimeout) {
7686							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7687							clearRequestTimeout(objTimeout);
7688						}
7689						if (transitionDuration == 0) {
7690							if ($(val).hasClass('animate_when_almost_visible')) {
7691								$(val).addClass('zoom-reverse').removeClass('start_animation');
7692							} else {
7693								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7694							}
7695						}
7696					});
7697					requestTimeout(function(){
7698						if ( filterValue == '*' ) {
7699							all_thumbs.show();
7700							all_thumbs.each(function(index, val) {
7701								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7702								filterItems.push($(this));
7703							});
7704						} else {
7705							all_thumbs.each(function() {
7706								var _tmb = $(this);
7707								if (_tmb.hasClass(filterValue)) {
7708									_tmb.show();
7709									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7710									filterItems.push(_tmb);
7711								} else {
7712									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7713									_tmb.hide();
7714								}
7715							});
7716						}
7717
7718						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7719
7720						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7721						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7722						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7723						if (lightboxElements.length) {
7724							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7725							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7726								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7727								if (typeof getLightbox === 'object') {
7728									getLightbox.refresh();
7729								} else {
7730									UNCODE.lightbox();
7731								}
7732							}
7733						}
7734						container.trigger('more-items-loaded');
7735						$(window).trigger('more-items-loaded');
7736						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7737					}, delay);
7738				} else {
7739					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7740						var parent = $(val).parent(),
7741							objTimeout = parent.data('objTimeout');
7742						if (objTimeout) {
7743							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7744							clearRequestTimeout(objTimeout);
7745						}
7746						if (transitionDuration == 0) {
7747							if ($(val).hasClass('animate_when_almost_visible')) {
7748								$(val).addClass('zoom-reverse').removeClass('start_animation');
7749							} else {
7750								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7751							}
7752						}
7753					});
7754					loadCssGrid($filter);
7755				}
7756			};
7757
7758			if (!$filter.hasClass('active')) {
7759				/** Scroll top with filtering */
7760				if (filterContainer.hasClass('filter-scroll')) {
7761                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7762                    calc_scroll -= UNCODE.get_scroll_offset();
7763
7764					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7765						delta = bodyTop - calc_scroll,
7766						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7767						filterTolerance = false,
7768						filter_timeout;
7769					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7770
7771					if ( !UNCODE.isFullPage ) {
7772						if (scrollSpeed == 0) {
7773							$('html, body').scrollTop(calc_scroll);
7774							UNCODE.scrolling = false;
7775							filter_items();
7776						} else {
7777
7778							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7779								filter_items();
7780								filterTolerance = true;
7781							}
7782
7783							$('html, body').animate({
7784								scrollTop: calc_scroll
7785							},{
7786								easing: 'easeInOutQuad',
7787								duration: scrollSpeed,
7788								complete: function(){
7789									UNCODE.scrolling = false;
7790									if ( !filterTolerance ) {
7791										filter_timeout = setTimeout(function(){
7792											clearTimeout(filter_timeout);
7793											filter_items();
7794										}, 200);
7795									}
7796								}
7797							});
7798						}
7799					}
7800				} else {
7801					filter_items();
7802				}
7803			}
7804			evt.preventDefault();
7805		});
7806
7807		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7808			var params = UNCODE.getURLParams(window.location);
7809			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7810
7811			UNCODE.lastURL = window.location.href;
7812
7813			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7814				return;
7815			}
7816
7817			if (params.id === undefined) {
7818				$.each($('.cssgrid-system'), function(index, val) {
7819					loadCssGrid($(val));
7820				});
7821			} else {
7822				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7823					loadCssGrid($('#' + params.id));
7824				}
7825			}
7826		});
7827
7828		var loadCssGrid = function($href, $paginating) {
7829			var is_paginating = false;
7830
7831			if (undefined !== $paginating && $paginating) {
7832				var is_paginating = $paginating;
7833			}
7834
7835			var href = ($href.is("a") ? $href.attr('href') : location),
7836				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7837				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7838				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7839				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7840				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7841				cssgridId = cssgridSystem.attr('id');
7842			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7843				UNCODE.lastURL = href;
7844				history.pushState({
7845					myCSSgrid: true
7846				}, document.title, href);
7847			}
7848			cssgridWrapper.addClass('cssgrid-loading');
7849			if (is_paginating) {
7850				cssgridWrapper.addClass('grid-filtering');
7851			}
7852			$.ajax({
7853				url: href
7854			}).done(function(data) {
7855				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7856					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7857					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7858				requestTimeout(function() {
7859					cssgridContainer.html($resultItems);
7860					cssgridWrapper.removeClass('cssgrid-loading');
7861					cssgridWrapper.removeClass('grid-filtering');
7862					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7863					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7864					UNCODE.adaptive();
7865					if (SiteParameters.dynamic_srcset_active === '1') {
7866						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7867					}
7868					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7869						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7870						if (typeof getLightbox === 'object') {
7871							getLightbox.refresh();
7872						} else {
7873							UNCODE.lightbox();
7874						}
7875					}
7876					cssgridContainer.trigger('more-items-loaded');
7877					$(window).trigger('more-items-loaded');
7878					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7879				}, 300);
7880
7881				$('.pagination', cssgridFooter).remove();
7882				cssgridFooter.append($resultPagination);
7883
7884				if (cssgridResultCount.length > 0) {
7885					$('.woocommerce-result-count', cssgridResultCount).remove();
7886					cssgridResultCount.append($resultCount);
7887				}
7888			});
7889		};
7890
7891		$filters.each(function(i, buttonGroup) {
7892			var $buttonGroup = $(buttonGroup);
7893			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7894				$buttonGroup.find('.active').removeClass('active');
7895				$(this).addClass('active');
7896
7897			});
7898
7899			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7900				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7901				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7902			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7903				e.preventDefault();
7904				$cats_filters.slideToggle(400, 'easeInOutCirc');
7905			});
7906
7907		});
7908	};
7909};
7910
7911UNCODE.linearGrid = function(){
7912	$('.linear-wrapper').each(function(){
7913		var $wrap = $(this),
7914			$system = $wrap.closest('.linear-system'),
7915			$dragger = $('[data-dragger]', $system),
7916			$row = $wrap.closest('.vc_row[data-parent]'),
7917			_row = $row[0],
7918			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7919			vertical = $cont.hasClass('linear-or-vertical'),
7920			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7921			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7922			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7923			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7924			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7925			isInViewport = false,
7926			isHover = false,
7927			init = false,
7928			stableHeight = UNCODE.wheight,
7929			wCont, hCont, docH, marqueeTL;
7930
7931		if ( ! $('.tmb', $cont).length ) {
7932			return;
7933		}
7934
7935		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7936		var dataX = dataSpeed;
7937
7938		dataSpeed += 5;
7939
7940		var checkLinearGridSize = function(){
7941			if ( !$wrap.is(':visible') )  {
7942				return;
7943			}
7944			$wrap.find('.cont-appended').remove();
7945
7946			if ( vertical ) {
7947				if ( ! SiteParameters.is_frontend_editor ) {
7948					hCont = $cont.outerHeight();
7949					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7950					if ( hCont < docH ) {
7951						var res = docH - hCont * 3,
7952							times = 2 * Math.round((res/hCont+1) / 2);
7953					}
7954					for ( var i = 0; i < times; i++ ) {
7955						var $cloneCont = $cont.clone(),
7956							$cloneCont2 = $cont.clone(),
7957							trans = ( (i+2) ) * 100;
7958						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7959						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7960						$cloneCont.find('a[data-lbox]').each(function(){
7961							var dataLbox = $(this).attr('data-lbox');
7962							$(this).attr('data-lbox', dataLbox + '_' + i);
7963						});
7964						$cloneCont.find('.wp-video-shortcode').each(function(){
7965							var thisID = $(this).attr('id');
7966							$(this).attr('id', thisID + '_' + i);
7967						});
7968						$cloneCont2.find('a[data-lbox]').each(function(){
7969							var dataLbox = $(this).attr('data-lbox');
7970							$(this).attr('data-lbox', dataLbox + '_2' + i);
7971						});
7972						$cloneCont2.find('.wp-video-shortcode').each(function(){
7973							var thisID = $(this).attr('id');
7974							$(this).attr('id', thisID + '__' + i);
7975						});
7976						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7977							UNCODE.lightgallery($cloneCont);
7978							UNCODE.lightgallery($cloneCont2);
7979						}
7980					}
7981                }
7982			} else {
7983				wCont = $cont.outerWidth();
7984				if ( (wCont) < UNCODE.wwidth*2 ) {
7985					var res = UNCODE.wwidth*2 - (wCont),
7986						times = 2 * Math.round((res/wCont+1) / 2);
7987				}
7988				for ( var i = 0; i < times; i++ ) {
7989					var $cloneCont = $cont.clone(),
7990						$cloneCont2 = $cont.clone(),
7991						trans = ( (i+2) ) * 100;
7992					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7993					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7994					$cloneCont.find('a[data-lbox]').each(function(){
7995						var dataLbox = $(this).attr('data-lbox');
7996						$(this).attr('data-lbox', dataLbox + '_' + i);
7997					});
7998					$cloneCont.find('[id]').each(function(){
7999						var thisID = $(this).attr('id');
8000						$(this).attr('id', thisID + '_' + i);
8001					});
8002					$cloneCont2.find('a[data-lbox]').each(function(){
8003						var dataLbox = $(this).attr('data-lbox');
8004						$(this).attr('data-lbox', dataLbox + '_2' + i);
8005					});
8006					$cloneCont2.find('[id]').each(function(){
8007						var thisID = $(this).attr('id');
8008						$(this).attr('id', thisID + '__' + i);
8009					});
8010                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
8011                        UNCODE.lightgallery($cloneCont);
8012                        UNCODE.lightgallery($cloneCont2);
8013                    }
8014                }
8015			}
8016		};
8017		if ( clone ) {
8018			checkLinearGridSize();
8019			$(window).on('resize.linearGrid', function(){
8020				checkLinearGridSize();
8021			});
8022		}
8023
8024		var continuousLinearMarquee = function(_xStrt){
8025			if ( !$wrap.is(':visible') )  {
8026				return;
8027			}
8028			var ease = 'none';
8029			wCont = $cont.outerWidth();
8030			hCont = $cont.outerHeight();
8031
8032			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
8033				xEnd = vertical ? hCont : wCont,
8034				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8035				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
8036				speedSlow = (xEnd + xStrt) / 45,
8037				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8038
8039			marqueeTL = new TimelineMax({paused:true, reversed:true});
8040
8041			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
8042				marqueeTL.play();
8043
8044				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
8045					var $column = $wrap.closest('.wpb_column'),
8046						$col_link = $('.col-link', $column),
8047						$hover_sel = $wrap;
8048
8049					if ( $col_link.length ) {
8050						$hover_sel = $wrap.add($column);
8051					}
8052
8053					$hover_sel.on('mouseover', function(){
8054						if ( $wrap.attr('data-hover') === 'yes' ) {
8055							//speed = ( 10 - dataSpeed ) * 5;
8056							ease = 'power2.out';
8057							marqueeTL.duration( speedSlow );
8058						} else {
8059							marqueeTL.pause();
8060						}
8061						isHover = true;
8062					}).on('mouseout', function(){
8063						if ( $wrap.attr('data-hover') === 'yes' ) {
8064							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
8065							ease = 'power2.in';
8066							marqueeTL.duration( speed );
8067						} else {
8068							marqueeTL.play();
8069						}
8070						isHover = false;
8071					});
8072				}
8073
8074				$(document).on('sub-menu-slide-up', function(){
8075					if ( isInMenu ) {
8076						marqueeTL.pause();
8077					}
8078				});
8079
8080			}
8081	
8082			gsap.killTweensOf($wrap);
8083			if ( vertical ) {
8084				marqueeTL.fromTo( $wrap, {
8085					y: xStrt * direction
8086				},
8087				{
8088					duration: speed,
8089					y: xEnd * direction * -1,
8090					onComplete: function(){
8091						continuousLinearMarquee();
8092					},
8093					ease: ease,
8094					paused: freezed
8095				});
8096			} else {
8097				marqueeTL.fromTo( $wrap, {
8098					x: xStrt * direction
8099				},
8100				{
8101					duration: speed,
8102					x: xEnd * direction * -1,
8103					onComplete: function(){
8104						continuousLinearMarquee();
8105					},
8106					ease: ease,
8107					paused: freezed
8108				});
8109			}
8110		};
8111
8112		var dragLinearContinuous = function(){
8113			if ( !$wrap.is(':visible') )  {
8114				return;
8115			}
8116			var matrix, _x, _y,
8117				dragAction = false;
8118			Draggable.create($wrap[0], {
8119				type: vertical ? "y" : "x",
8120				bounds: document.getElementById("container"),
8121				inertia: false,
8122				onPress: function (e) {
8123				},
8124				onRelease: function (e) {
8125					if ( dragAction === true ) {
8126						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8127						_x = matrix[12] || matrix[4];
8128						_y = matrix[13] || matrix[5];
8129						if ( vertical ) {
8130							continuousLinearMarquee(_y * -1);
8131						} else {
8132							continuousLinearMarquee(_x * -1);
8133						}
8134						$wrap.removeClass('linear-dragging');
8135					}
8136				},
8137				onDrag: function (e) {
8138					dragAction = true;
8139					$wrap.addClass('linear-dragging');
8140				},
8141				onDragEnd: function (e) {
8142					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8143					_x = matrix[12] || matrix[4];
8144					_y = matrix[13] || matrix[5];
8145					wCont = $cont.outerWidth();
8146					hCont = $cont.outerHeight();
8147					if ( vertical ) {
8148						if ( Math.abs(_y) > hCont ) {
8149							if ( _y < 0 ) {
8150								_y = hCont + parseFloat( _y );
8151							} else {
8152								_y = parseFloat( _y ) - hCont;
8153							}
8154						}
8155						continuousLinearMarquee(_y * -1);
8156					} else {
8157						if ( Math.abs(_x) > wCont ) {
8158							if ( _x < 0 ) {
8159								_x = wCont + parseFloat( _x );
8160							} else {
8161								_x = parseFloat( _x ) - wCont;
8162							}
8163						}
8164						continuousLinearMarquee(_x * -1);
8165					}
8166					$wrap.removeClass('linear-dragging');
8167					dragAction = false;
8168				},
8169			});
8170		};
8171
8172		var runScrollLinear = function(){
8173			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8174			if ( (!$wrap.is(':visible') || freezed) )  {
8175				return;
8176			}
8177			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8178				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
8179			
8180			var linearGridScroll = function(){
8181				if ( isInViewport ) {
8182					var bound = _row.getBoundingClientRect();
8183
8184					var bound_top = bound.top,
8185						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
8186
8187					if ( vertical ) {
8188						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8189					} else {
8190						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8191					}
8192					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8193						requestAnimationFrame(linearGridScroll);
8194					}
8195				}
8196				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8197					window.addEventListener("scroll", linearGridScroll);
8198				}
8199			};
8200
8201			$(window).on( 'load wwResize', function(e) {
8202				stableHeight = UNCODE.wheight;
8203				linearGridScroll();
8204			});
8205			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8206				requestAnimationFrame(linearGridScroll);
8207			}
8208		};
8209		
8210		var dragLinear = function(){
8211			if ( !$wrap.is(':visible') )  {
8212				return;
8213			}
8214			var matrix, _x, _y;
8215			Draggable.create($dragger[0], {
8216				type: vertical ? "y" : "x",
8217				bounds: document.getElementById("container"),
8218				inertia: false,
8219				onPress: function (e) {
8220				},
8221				onRelease: function (e) {
8222				},
8223				onDrag: function (e) {
8224					$wrap.addClass('linear-dragging');
8225				},
8226				onDragEnd: function (e) {
8227					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8228					_x = matrix[12] || matrix[4];
8229					_y = matrix[13] || matrix[5];
8230					wCont = $cont.outerWidth();
8231					hCont = $cont.outerHeight();
8232					if ( vertical ) {
8233						if ( Math.abs(_y) > hCont ) {
8234							if ( _y < 0 ) {
8235								_y = hCont + parseFloat( _y );
8236							} else {
8237								_y = parseFloat( _y ) - hCont;
8238							}
8239							gsap.to( $dragger[0], {
8240								duration: 0,
8241								y: _y,
8242							});
8243						}
8244					} else {
8245						if ( Math.abs(_x) > wCont ) {
8246							if ( _x < 0 ) {
8247								_x = wCont + parseFloat( _x );
8248							} else {
8249								_x = parseFloat( _x ) - wCont;
8250							}
8251							gsap.to( $dragger[0], {
8252								duration: 0,
8253								x: _x,
8254							});
8255						}
8256					}
8257					$wrap.removeClass('linear-dragging');
8258				},
8259			});
8260		};
8261
8262		if ( ! $('body').hasClass('compose-mode') ) {
8263			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8264				continuousLinearMarquee();
8265				$(window).on( 'wwResize', function(e) {
8266					continuousLinearMarquee();
8267				});	
8268				$(document).on('sub-menu-slide-down', function(){
8269					if ( isInMenu ) {
8270						continuousLinearMarquee();
8271					}
8272				});
8273				if ( $wrap.attr('data-draggable') === 'yes' ) {
8274					dragLinearContinuous();
8275				}
8276			}
8277
8278			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8279				runScrollLinear();
8280				if ( $wrap.attr('data-draggable') === 'yes' ) {
8281					dragLinear();
8282				}
8283			}
8284
8285			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8286				var observer = new IntersectionObserver(function(entries) {
8287						
8288					entries.forEach(function(entry){
8289						if ( entry.isIntersecting ) {
8290							isInViewport = true;
8291							if ( !init ) {
8292								init = true;
8293								continuousLinearMarquee();
8294							} else {
8295								if ( typeof marqueeTL !== 'undefined' ) {
8296									marqueeTL.play();
8297								}
8298							}
8299							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8300								requestAnimFrame(runScrollLinear);
8301							}
8302						} else {
8303							isInViewport = false;
8304							if ( typeof marqueeTL !== 'undefined' ) {
8305								marqueeTL.pause();
8306							}
8307						}
8308					});
8309				}, { 
8310					root: document,
8311				});
8312
8313				observer.observe(_row);
8314
8315			} else {
8316
8317				var checkVisible = function( el, off ) {
8318					if (typeof jQuery === "function" && el instanceof jQuery) {
8319						el = el[0];
8320					}
8321			
8322					off = typeof off=='undefined' ? 50 : off;
8323			
8324					var rect = el.getBoundingClientRect();
8325			
8326					return (
8327						(
8328							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8329							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8330							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8331						)
8332					);
8333				};
8334				
8335				var checkVisibility = function(){
8336
8337					if ( checkVisible($row) ) {
8338						isInViewport = true;
8339						if ( typeof marqueeTL !== 'undefined' ) {
8340							marqueeTL.play();
8341						}
8342					} else {
8343						isInViewport = false;
8344						if ( typeof marqueeTL !== 'undefined' ) {
8345							marqueeTL.pause();
8346						}
8347					}
8348				}
8349
8350				window.addEventListener("scroll", checkVisibility);
8351				checkVisibility();
8352
8353			}
8354		}
8355	});
8356};
8357UNCODE.wrapperMarquee = function () {
8358
8359	function createMarquee(opts) {
8360		if (!opts) return;
8361
8362		var parent = opts.parent;
8363		var originals = opts.originals;
8364
8365		if (!parent || !originals) return;
8366		if (parent.getAttribute('data-marquee-init') === '1') return;
8367		parent.setAttribute('data-marquee-init', '1');
8368
8369		function raf(cb) {
8370			return (window.requestAnimationFrame ||
8371				window.webkitRequestAnimationFrame ||
8372				window.mozRequestAnimationFrame ||
8373				function (fn) { return window.setTimeout(fn, 16); }
8374			)(cb);
8375		}
8376
8377		function caf(id) {
8378			return (window.cancelAnimationFrame ||
8379				window.webkitCancelAnimationFrame ||
8380				window.mozCancelAnimationFrame ||
8381				function (tid) { window.clearTimeout(tid); }
8382			)(id);
8383		}
8384
8385		function getWidth(el) {
8386			if (!el) return 0;
8387			if (el.getBoundingClientRect) return el.getBoundingClientRect().width;
8388			return el.offsetWidth || 0;
8389		}
8390
8391		function getPointX(e) {
8392			if (e.touches && e.touches.length) return e.touches[0].clientX;
8393			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientX;
8394			return e.clientX;
8395		}
8396
8397		function getPointY(e) {
8398			if (e.touches && e.touches.length) return e.touches[0].clientY;
8399			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientY;
8400			return e.clientY;
8401		}
8402
8403		function getPageY() {
8404			if (typeof window.pageYOffset === 'number') return window.pageYOffset;
8405			return (document.documentElement ? document.documentElement.scrollTop : 0);
8406		}
8407
8408		function getViewportW() {
8409			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
8410		}
8411
8412		var baseSpeed = (typeof opts.speed === 'number') ? opts.speed : 50;
8413		var direction = (typeof opts.direction === 'number') ? opts.direction : -1;
8414		var maxReps = (typeof opts.maxReps === 'number') ? opts.maxReps : 12;
8415
8416		var scrollDriven = (opts.scrollDriven === true);
8417		var scrollFactor = (typeof opts.scrollFactor === 'number') ? opts.scrollFactor : 0.6;
8418		var isScrollControlled = (opts.isScrollControlled === true);
8419
8420		var inViewOnly = (opts.inViewOnly !== false);
8421		var viewMargin = (typeof opts.viewMargin === 'number') ? opts.viewMargin : 80;
8422
8423		var hoverSpeed = (typeof opts.hoverSpeed === 'number') ? opts.hoverSpeed : null;
8424		var isHover = false;
8425
8426		var infinite = (opts.infinite === true) && !SiteParameters.is_frontend_editor;
8427		var draggable = (opts.draggable === true);
8428
8429		var freezeMode = (typeof opts.freeze === 'string') ? opts.freeze : null;
8430		var freezeBp = (typeof opts.freezeBp === 'number') ? opts.freezeBp : 960;
8431
8432		function isFrozenNow() {
8433			if (!freezeMode) return false;
8434
8435			var w = getViewportW();
8436			if (freezeMode === 'always') return true;
8437			if (freezeMode === 'desktop') return w >= freezeBp;
8438			if (freezeMode === 'mobile') return w < freezeBp;
8439
8440			return false;
8441		}
8442
8443		function closestRowParent(el) {
8444			if (!el || !el.closest) return null;
8445			return el.closest('[data-parent="true"]') || null;
8446		}
8447
8448		function ensureId(el, prefix) {
8449			if (!el) return null;
8450			if (el.id && el.id.length) return el.id;
8451
8452			var p = prefix || 'uncode-row';
8453			var rnd = (Math.random().toString(36).slice(2) + Date.now().toString(36)).slice(0, 12);
8454			el.id = p + '-' + rnd;
8455			return el.id;
8456		}
8457
8458		function dispatchClonesEvent(payload) {
8459			try {
8460				parent.dispatchEvent(new CustomEvent('uncode:marquee:clones-built', {
8461					bubbles: true,
8462					detail: payload
8463				}));
8464			} catch (e) {}
8465		}
8466
8467		var clonesEventRaf = 0;
8468		function dispatchClonesEventDebounced(payload) {
8469			if (clonesEventRaf) return;
8470			clonesEventRaf = raf(function () {
8471				clonesEventRaf = 0;
8472				dispatchClonesEvent(payload);
8473			});
8474		}
8475
8476		var base = [];
8477		var i;
8478		for (i = 0; i < originals.length; i++) base.push(originals[i]);
8479		if (!base.length) return;
8480
8481		var track = document.createElement('div');
8482		track.className = (opts.trackClassName ? opts.trackClassName : 'cs-track');
8483
8484		gsap.set(track, {
8485			x: 0,
8486			force3D: true,
8487			willChange: 'transform'
8488		});
8489
8490		var baseWrap = document.createElement('div');
8491		baseWrap.className = 'cs-base';
8492
8493		var leftWrap = null;
8494		var rightWrap = null;
8495
8496		parent.insertBefore(track, parent.firstChild);
8497
8498		if (infinite) {
8499			leftWrap = document.createElement('div');
8500			leftWrap.className = 'cs-clones cs-clones--left';
8501
8502			rightWrap = document.createElement('div');
8503			rightWrap.className = 'cs-clones cs-clones--right';
8504
8505			track.appendChild(leftWrap);
8506			track.appendChild(baseWrap);
8507			track.appendChild(rightWrap);
8508		} else {
8509			track.appendChild(baseWrap);
8510		}
8511
8512		var sourceWrap = document.createElement('div');
8513		sourceWrap.className = 'cs-source';
8514		sourceWrap.style.display = 'none';
8515
8516		track.parentNode.insertBefore(sourceWrap, track);
8517
8518		for (i = 0; i < base.length; i++) {
8519			sourceWrap.appendChild(base[i]);
8520		}
8521
8522		function fillBaseWrapFromSource() {
8523			baseWrap.innerHTML = '';
8524
8525			var fragBase = document.createDocumentFragment();
8526			var k, clone;
8527
8528			for (k = 0; k < base.length; k++) {
8529				clone = base[k].cloneNode(true);
8530				clone.setAttribute('data-marquee-clone', '1');
8531				clone.setAttribute('data-marquee-origin-index', k);
8532				clone.setAttribute('aria-hidden', 'true');
8533				fragBase.appendChild(clone);
8534			}
8535
8536			baseWrap.appendChild(fragBase);
8537		}
8538
8539		fillBaseWrapFromSource();
8540
8541		var cycleW = 1;
8542
8543		function clearClones() {
8544			if (!infinite) return;
8545			leftWrap.innerHTML = '';
8546			rightWrap.innerHTML = '';
8547		}
8548
8549		function measureCycle() {
8550			cycleW = baseWrap.scrollWidth || 0;
8551			if (!cycleW || cycleW < 1) cycleW = 1;
8552
8553			track.style.width = cycleW + 'px';
8554		}
8555
8556		function buildClones() {
8557			fillBaseWrapFromSource();
8558			
8559			measureCycle();
8560
8561			if (!infinite) {
8562				var rowP0 = closestRowParent(parent);
8563				var rowId0 = ensureId(rowP0, 'uncode-row');
8564
8565				dispatchClonesEventDebounced({
8566					type: 'measured-only',
8567					parent: parent,
8568					track: track,
8569					baseWrap: baseWrap,
8570					leftWrap: leftWrap,
8571					rightWrap: rightWrap,
8572					rowParent: rowP0,
8573					rowParentId: rowId0,
8574					infinite: false,
8575					cycleW: cycleW,
8576					reps: 0
8577				});
8578
8579				triggerMarqueeRefreshDebounced(baseWrap);
8580				dispatchMarqueeReady();
8581				return true;
8582			}
8583
8584			clearClones();
8585
8586			var parentW = getWidth(parent);
8587			if (!cycleW || !parentW) return false;
8588
8589			var reps = Math.ceil((parentW * 2) / cycleW) + 1;
8590			if (reps < 1) reps = 1;
8591			if (reps > maxReps) reps = maxReps;
8592
8593			var fragL = document.createDocumentFragment();
8594			var fragR = document.createDocumentFragment();
8595			var r, k, clone;
8596
8597			for (r = 0; r < reps; r++) {
8598				for (k = 0; k < base.length; k++) {
8599					clone = base[k].cloneNode(true);
8600					clone.setAttribute('data-marquee-clone', '1');
8601					clone.setAttribute('data-marquee-origin-index', k);
8602					clone.setAttribute('aria-hidden', 'true');
8603					fragL.appendChild(clone);
8604				}
8605			}
8606
8607			for (r = 0; r < reps; r++) {
8608				for (k = 0; k < base.length; k++) {
8609					clone = base[k].cloneNode(true);
8610					clone.setAttribute('data-marquee-clone', '1');
8611					clone.setAttribute('data-marquee-origin-index', k);
8612					clone.setAttribute('aria-hidden', 'true');
8613					fragR.appendChild(clone);
8614				}
8615			}
8616
8617			leftWrap.appendChild(fragL);
8618			rightWrap.appendChild(fragR);
8619
8620			measureCycle();
8621
8622			var rowP = closestRowParent(parent);
8623			var rowId = ensureId(rowP, 'uncode-row');
8624
8625			dispatchClonesEventDebounced({
8626				type: 'clones-built',
8627				parent: parent,
8628				track: track,
8629				baseWrap: baseWrap,
8630				leftWrap: leftWrap,
8631				rightWrap: rightWrap,
8632				rowParent: rowP,
8633				rowParentId: rowId,
8634				infinite: true,
8635				cycleW: cycleW,
8636				reps: reps
8637			});
8638
8639			triggerMarqueeRefreshDebounced(baseWrap);
8640			dispatchMarqueeReady();
8641
8642			return true;
8643		}
8644
8645		function findClosestClone(node) {
8646			while (node && node !== parent) {
8647				if (node.getAttribute && node.getAttribute('data-marquee-clone') === '1') {
8648					return node;
8649				}
8650				node = node.parentNode;
8651			}
8652			return null;
8653		}
8654
8655		function findClickableInsideClone(node, cloneRoot) {
8656			while (node && node !== cloneRoot) {
8657				if (node.matches && node.matches('a[href], [data-lbox], [data-lightbox], .uncode-lbox')) {
8658					return node;
8659				}
8660				node = node.parentNode;
8661			}
8662			return null;
8663		}
8664
8665		function findMatchingOriginalClickable(originalRoot, clickedEl) {
8666			if (!originalRoot || !clickedEl) return null;
8667
8668			var all = originalRoot.querySelectorAll('a[href], [data-lbox], [data-lightbox], .uncode-lbox');
8669			if (!all.length) return null;
8670
8671			var href = clickedEl.getAttribute && clickedEl.getAttribute('href');
8672			var dataLbox = clickedEl.getAttribute && clickedEl.getAttribute('data-lbox');
8673
8674			var i, el;
8675			for (i = 0; i < all.length; i++) {
8676				el = all[i];
8677
8678				if (dataLbox && el.getAttribute('data-lbox') === dataLbox) return el;
8679				if (href && el.getAttribute('href') === href) return el;
8680			}
8681
8682			return all[0];
8683		}
8684
8685		function onCloneDelegatedClick(e) {
8686			var cloneRoot = findClosestClone(e.target);
8687			if (!cloneRoot) return;
8688
8689			var clickedEl = findClickableInsideClone(e.target, cloneRoot);
8690			if (!clickedEl) return;
8691
8692			var idx = parseInt(cloneRoot.getAttribute('data-marquee-origin-index'), 10);
8693			if (isNaN(idx) || !base[idx]) return;
8694
8695			var originalClickable = findMatchingOriginalClickable(base[idx], clickedEl);
8696			if (!originalClickable) return;
8697
8698			if (e.preventDefault) e.preventDefault();
8699			if (e.stopPropagation) e.stopPropagation();
8700			e.cancelBubble = true;
8701
8702			originalClickable.dispatchEvent(new MouseEvent('click', {
8703				bubbles: true,
8704				cancelable: true,
8705				view: window
8706			}));
8707
8708			return false;
8709		}
8710
8711		var xRaw = 0;
8712		var manualOffset = 0;
8713		var lastTs = 0;
8714		var frameId = 0;
8715		var isActive = true;
8716
8717		var lastVisibilityCheck = 0;
8718		var visibilityCheckEvery = 120;
8719
8720		var isDragging = false;
8721		var isTouchDragging = false;
8722		var touchDirectionLocked = null;
8723		var dragStartX = 0;
8724		var dragStartY = 0;
8725		var dragStartOffset = 0;
8726		var hasDragged = false;
8727		var dragThreshold = 6;
8728		var touchDirectionThreshold = 8;
8729
8730		var throwV = 0;
8731		var lastDragX = 0;
8732		var lastDragT = 0;
8733
8734		var lastPageY = getPageY();
8735		var scrollVelocity = 0;
8736
8737		var io = new IntersectionObserver(function(entries) {
8738			isActive = entries[0].isIntersecting;
8739		}, { rootMargin: viewMargin + 'px' });
8740
8741		io.observe(parent);
8742
8743		function updateInView() {
8744			if (!inViewOnly) isActive = true;
8745		}
8746
8747		function getEffectiveSpeed() {
8748			if (hoverSpeed !== null && isHover) return hoverSpeed;
8749			return baseSpeed;
8750		}
8751
8752		function dispatchMarqueeReady() {
8753			if ( SiteParameters.is_frontend_editor ) return;
8754			requestTimeout(function() {
8755
8756				var rowP = closestRowParent(parent);
8757				var rowId = ensureId(rowP, 'uncode-row');
8758
8759				document.dispatchEvent(new CustomEvent('uncode:marquee:ready', {
8760					bubbles: true,
8761					detail: {
8762						parent: parent,
8763						baseWrap: baseWrap,
8764						leftWrap: leftWrap,
8765						rightWrap: rightWrap,
8766						infinite: infinite,
8767						rowParent: rowP,
8768						rowParentId: rowId,
8769					}
8770				}));
8771			}, 0);
8772		}
8773
8774		function triggerMarqueeReinit(contextEl) {
8775			try {
8776				$(document).trigger('uncode-marquee-updated', {
8777					parent: parent,
8778					context: contextEl || baseWrap,
8779					baseWrap: baseWrap,
8780					leftWrap: leftWrap,
8781					rightWrap: rightWrap
8782				});
8783			} catch (e) {}
8784		}
8785
8786		var marqueeRefreshT = 0;
8787		function triggerMarqueeRefreshDebounced(contextEl) {
8788			if (marqueeRefreshT) {
8789				window.clearTimeout(marqueeRefreshT);
8790			}
8791			marqueeRefreshT = window.setTimeout(function() {
8792				triggerMarqueeReinit(contextEl || baseWrap);
8793				marqueeRefreshT = 0;
8794			}, 60);
8795		}
8796		
8797		function render() {
8798			var x;
8799			var totalX = xRaw + manualOffset;
8800
8801			if (infinite) {
8802				var m = totalX % cycleW;
8803				if (m > 0) m -= cycleW;
8804				x = m;
8805			} else {
8806				x = totalX;
8807			}
8808
8809			gsap.set(track, {
8810				x: x,
8811				force3D: true
8812			});
8813		}
8814
8815		function tick(ts) {
8816			if (!lastTs) lastTs = ts;
8817			var dt = (ts - lastTs) / 1000;
8818			lastTs = ts;
8819
8820			if (dt > 0.05) dt = 0.05;
8821
8822			updateInView();
8823
8824			if (!isActive) {
8825				frameId = raf(tick);
8826				return;
8827			}
8828
8829			if (!isDragging) {
8830
8831				if (isFrozenNow()) {
8832					throwV = 0;
8833					frameId = raf(tick);
8834					return;
8835				}
8836
8837				if (isScrolling) {
8838					frameId = raf(tick);
8839					return;
8840				}
8841
8842				if (!scrollDriven) {
8843					var s = getEffectiveSpeed();
8844					if (s) xRaw += (direction * s * dt);
8845				}
8846
8847				if (throwV) {
8848					xRaw += (throwV * dt);
8849					throwV *= Math.pow(0.04, dt);
8850					if (throwV < 8 && throwV > -8) throwV = 0;
8851				}
8852
8853				render();
8854			}
8855
8856			frameId = raf(tick);
8857		}
8858
8859		function start() {
8860			if (!buildClones()) {
8861				window.setTimeout(start, 50);
8862				return;
8863			}
8864
8865			lastTs = 0;
8866
8867			if (isScrollControlled) {
8868				render();
8869				return;
8870			}
8871
8872			if (frameId) caf(frameId);
8873			frameId = raf(tick);
8874			render();
8875		}
8876
8877		function stop() {
8878			if (frameId) caf(frameId);
8879			frameId = 0;
8880		}
8881
8882		function onDown(e) {
8883			if (e.type === 'mousedown' && e.button !== 0) return;
8884			if (isFrozenNow()) return;
8885
8886			dragStartX = getPointX(e);
8887			dragStartY = getPointY(e);
8888			dragStartOffset = manualOffset;
8889			hasDragged = false;
8890
8891			throwV = 0;
8892			lastDragX = dragStartX;
8893			lastDragT = (new Date()).getTime();
8894
8895			isTouchDragging = e.type === 'touchstart';
8896			touchDirectionLocked = null;
8897
8898			if (!isTouchDragging) {
8899				isDragging = true;
8900
8901				if (e.preventDefault) e.preventDefault();
8902				if (e.stopPropagation) e.stopPropagation();
8903			} else {
8904				isDragging = false;
8905			}
8906
8907			bindMoveUp(true);
8908		}
8909
8910		function onMove(e) {
8911			var nowX = getPointX(e);
8912			var nowY = getPointY(e);
8913			var dx = nowX - dragStartX;
8914			var dy = nowY - dragStartY;
8915
8916			if (isTouchDragging && touchDirectionLocked === null) {
8917				if (Math.abs(dx) < touchDirectionThreshold && Math.abs(dy) < touchDirectionThreshold) {
8918					return;
8919				}
8920
8921				if (Math.abs(dy) > Math.abs(dx)) {
8922					touchDirectionLocked = 'vertical';
8923					isDragging = false;
8924					bindMoveUp(false);
8925					return;
8926				}
8927
8928				touchDirectionLocked = 'horizontal';
8929				isDragging = true;
8930			}
8931
8932			if (!isDragging) return;
8933
8934			if (!hasDragged && (dx < -dragThreshold || dx > dragThreshold)) hasDragged = true;
8935
8936			manualOffset = dragStartOffset + dx;
8937			render();
8938
8939			var nowT = (new Date()).getTime();
8940			var dtMs = nowT - lastDragT;
8941			if (dtMs > 0) {
8942				var vx = (nowX - lastDragX) / (dtMs / 1000);
8943				if (vx > 2500) vx = 2500;
8944				if (vx < -2500) vx = -2500;
8945				throwV = vx * 0.5;
8946			}
8947
8948			lastDragX = nowX;
8949			lastDragT = nowT;
8950
8951			if (e.preventDefault) e.preventDefault();
8952		}
8953
8954		function onUp(e) {
8955			if (!isDragging && !isTouchDragging) return;
8956
8957			isDragging = false;
8958			isTouchDragging = false;
8959			touchDirectionLocked = null;
8960
8961			lastTs = 0;
8962			lastPageY = getPageY();
8963
8964			render();
8965			bindMoveUp(false);
8966
8967			if (e && hasDragged && e.preventDefault) e.preventDefault();
8968
8969			setTimeout(function () { hasDragged = false; }, 0);
8970		}
8971
8972		function bindMoveUp(bind) {
8973			if (bind) {
8974				document.addEventListener('mousemove', onMove, false);
8975				document.addEventListener('mouseup', onUp, false);
8976				document.addEventListener('touchmove', onTouchMoveDetect, { passive: true });
8977				document.addEventListener('touchend', onUp, false);
8978				document.addEventListener('touchcancel', onUp, false);
8979			} else {
8980				document.removeEventListener('mousemove', onMove, false);
8981				document.removeEventListener('mouseup', onUp, false);
8982				document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8983				document.removeEventListener('touchmove', onMove, { passive: false });
8984				document.removeEventListener('touchend', onUp, false);
8985				document.removeEventListener('touchcancel', onUp, false);
8986			}
8987		}
8988
8989		function onTouchMoveDetect(e) {
8990			var dx = Math.abs(getPointX(e) - dragStartX);
8991			var dy = Math.abs(getPointY(e) - dragStartY);
8992			if (dx < touchDirectionThreshold && dy < touchDirectionThreshold) return;
8993
8994			document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8995
8996			if (dy > dx) {
8997				isDragging = false;
8998				touchDirectionLocked = 'vertical';
8999				bindMoveUp(false);
9000			} else {
9001				touchDirectionLocked = 'horizontal';
9002				isDragging = true;
9003				document.addEventListener('touchmove', onMove, { passive: false });
9004			}
9005		}
9006
9007		if (parent.addEventListener) {
9008			if (draggable) {
9009				parent.addEventListener('mousedown', onDown, false);
9010				parent.addEventListener('touchstart', onDown, { passive: true });
9011			}
9012
9013			if (hoverSpeed !== null) {
9014				parent.addEventListener('mouseenter', function () { isHover = true; }, false);
9015				parent.addEventListener('mouseleave', function () { isHover = false; }, false);
9016			}
9017
9018			parent.addEventListener('click', onCloneDelegatedClick, false);
9019
9020		} else {
9021			if (draggable) {
9022				parent.onmousedown = onDown;
9023				parent.ontouchstart = onDown;
9024			}
9025		}
9026
9027		function onClickCapture(e) {
9028			if (hasDragged) {
9029				if (e.preventDefault) e.preventDefault();
9030				if (e.stopPropagation) e.stopPropagation();
9031				e.cancelBubble = true;
9032				return false;
9033			}
9034		}
9035
9036		if (draggable) {
9037			if (parent.addEventListener) parent.addEventListener('click', onClickCapture, true);
9038			else parent.onclick = onClickCapture;
9039		}
9040
9041		var resizeTimer = 0;
9042		var lastResizeW = getViewportW();
9043
9044		function onResize() {
9045			var currentW = getViewportW();
9046
9047			if (Math.abs(currentW - lastResizeW) < 2) {
9048				return;
9049			}
9050
9051			lastResizeW = currentW;
9052
9053			if (resizeTimer) window.clearTimeout(resizeTimer);
9054
9055			resizeTimer = window.setTimeout(function () {
9056				buildClones();
9057				render();
9058			}, 150);
9059		}
9060
9061		if (window.addEventListener) window.addEventListener('resize', onResize, false);
9062		else window.onresize = onResize;
9063
9064		var isScrolling = false;
9065		var scrollEndTimer = 0;
9066
9067		function onWindowScroll() {
9068			isScrolling = true;
9069			if (scrollEndTimer) clearTimeout(scrollEndTimer);
9070			scrollEndTimer = setTimeout(function () {
9071				isScrolling = false;
9072				lastTs = 0; // evita spike dt alla ripresa
9073			}, 80);
9074		}
9075
9076		if (scrollDriven) {
9077			if (window.addEventListener) window.addEventListener('scroll', onWindowScroll, { passive: true });
9078			else window.onscroll = onWindowScroll;
9079		}
9080
9081		start();
9082
9083		window.setTimeout(function () {
9084			buildClones();
9085			render();
9086			triggerMarqueeRefreshDebounced(baseWrap);
9087		}, 500);
9088
9089		return {
9090			start: start,
9091			stop: stop,
9092			setX: function (value) { xRaw = value; render(); },
9093			addX: function (delta) { xRaw += delta; render(); },
9094			setManualOffset: function (value) { manualOffset = value; render(); },
9095			getManualOffset: function () { return manualOffset; },
9096			resetManualOffset: function () { manualOffset = 0; render(); },
9097			getCycleW: function () { return cycleW; },
9098			update: function () {
9099				buildClones();
9100				render();
9101			},
9102			isFrozen: function () { return isFrozenNow(); }
9103		};
9104	}
9105
9106	function initMarqueesOnce() {
9107		if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') {
9108			return false;
9109		}
9110		gsap.registerPlugin(ScrollTrigger);
9111		function getViewportW() {
9112			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9113		}
9114		var wrappers = document.querySelectorAll('.cs-wrapper-marquee, .cs-wrapper');
9115
9116		if (!wrappers || !wrappers.length) wrappers = document.getElementsByClassName('cs-wrapper');
9117
9118		var itemClass = 'cs-container';
9119
9120		if (!wrappers || !wrappers.length) {
9121			return false;
9122		}
9123
9124		function isScrollMode(wrapper) {
9125			var mode = wrapper.getAttribute('data-mode');
9126			return mode === 'marquee-scroll' || mode === 'marquee-scroll-opposite';
9127		}
9128
9129		function getDirection(wrapper) {
9130			var mode = wrapper.getAttribute('data-mode');
9131			if (mode === 'marquee-opposite' || mode === 'marquee-scroll-opposite') return 1;
9132			return -1;
9133		}
9134
9135		function clamp(v, a, b) { return v < a ? a : (v > b ? b : v); }
9136
9137		function readStep(wrapper) {
9138			var v = parseFloat(wrapper.getAttribute('data-speed'));
9139			if (isNaN(v)) v = 0;
9140			return clamp(v, -4, 4);
9141		}
9142
9143		function stepToPxPerSec(step, baseDefault) {
9144			return (baseDefault / 5) * (step + 5);
9145		}
9146
9147		function readFreeze(wrapper) {
9148			var f = wrapper.getAttribute('data-freeze');
9149			if (f !== 'always' && f !== 'desktop' && f !== 'mobile') return null;
9150			return f;
9151		}
9152
9153		function isFrozenByAttr(freezeMode, bp) {
9154			if (!freezeMode) return false;
9155			var w = window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9156			if (freezeMode === 'always') return true;
9157			if (freezeMode === 'desktop') return w >= bp;
9158			if (freezeMode === 'mobile') return w < bp;
9159			return false;
9160		}
9161
9162		var baseDefault = 50;
9163		var autoFactor = 5;
9164		var freezeBp = 960;
9165
9166		var inited = 0;
9167
9168		for (var i = 0; i < wrappers.length; i++) {
9169			(function (wrapper) {
9170
9171				if (wrapper.getAttribute('data-anim') !== 'uncode_slider_marquee') {
9172					return;
9173				}
9174
9175				var items = wrapper.getElementsByClassName(itemClass);
9176				if (!items || !items.length) {
9177					return;
9178				}
9179
9180				var scrollMode = isScrollMode(wrapper);
9181				var dir = getDirection(wrapper);
9182
9183				var step = readStep(wrapper);
9184				var pxPerSec = stepToPxPerSec(step, baseDefault);
9185				var autoplayPxPerSec = pxPerSec * autoFactor;
9186
9187				var needHover = wrapper.getAttribute('data-hover');
9188				var hoverSpeed;
9189				if (needHover === 'yes') hoverSpeed = autoplayPxPerSec * 0.2;
9190				else if (needHover === 'pause') hoverSpeed = 0;
9191				else hoverSpeed = autoplayPxPerSec;
9192
9193				var freeze = readFreeze(wrapper);
9194
9195				var marquee = createMarquee({
9196					parent: wrapper,
9197					originals: items,
9198					infinite: wrapper.getAttribute('data-infinite') === 'yes' && !SiteParameters.is_frontend_editor,
9199					speed: scrollMode ? 0 : autoplayPxPerSec,
9200					draggable: wrapper.getAttribute('data-draggable') === 'yes' || SiteParameters.is_frontend_editor,
9201					scrollDriven: false,
9202					isScrollControlled: scrollMode,
9203					inViewOnly: true,
9204					viewMargin: 300,
9205					maxReps: getViewportW() < 570 ? 4 : 8,
9206					direction: dir,
9207					hoverSpeed: scrollMode || SiteParameters.is_frontend_editor ? 0 : hoverSpeed,
9208					freeze: freeze && !SiteParameters.is_frontend_editor,
9209					freezeBp: freezeBp
9210				});
9211
9212				if (!marquee) {
9213					return;
9214				}
9215
9216				wrapper._uncodeMarqueeApi = marquee;
9217	
9218				inited++;
9219
9220				if (!scrollMode || SiteParameters.is_frontend_editor) {
9221					ScrollTrigger.create({
9222						trigger: wrapper,
9223						start: 'top bottom',
9224						end: 'bottom top',
9225						invalidateOnRefresh: true,
9226						refreshPriority: -1,
9227						onEnter: function () {
9228							if (isFrozenByAttr(freeze, freezeBp)) return;
9229							marquee.start();
9230						},
9231						onEnterBack: function () {
9232							if (isFrozenByAttr(freeze, freezeBp)) return;
9233							marquee.start();
9234						},
9235						onLeave: function () { marquee.stop(); },
9236						onLeaveBack: function () { marquee.stop(); }
9237					});
9238				} else {
9239					ScrollTrigger.create({
9240						trigger: wrapper,
9241						start: 'top bottom',
9242						end: 'bottom top',
9243						scrub: true,
9244						invalidateOnRefresh: true,
9245						refreshPriority: -1,
9246						onUpdate: function (self) {
9247							if (isFrozenByAttr(freeze, freezeBp)) return;
9248
9249							var w = marquee.getCycleW();
9250							if (!w) return;
9251
9252							var cycles = pxPerSec / baseDefault;
9253
9254							if (getViewportW() < 570) {
9255								cycles *= 0.55;
9256							}
9257
9258							marquee.setX(dir * self.progress * cycles * w);
9259						}
9260					});
9261				}
9262
9263			})(wrappers[i]);
9264		}
9265
9266		if (typeof ResizeObserver !== 'undefined' && typeof ScrollTrigger !== 'undefined') {
9267			var t = 0;
9268			function refreshST() {
9269				if (t) window.clearTimeout(t);
9270				t = window.setTimeout(function () {
9271					ScrollTrigger.refresh();
9272				}, 150);
9273			}
9274
9275			var ro = new ResizeObserver(function () {
9276				refreshST();
9277			});
9278
9279			if (getViewportW() >= 960) {
9280				ro.observe(document.body);
9281			}
9282		}
9283
9284		window.setTimeout(function () {
9285			if (typeof ScrollTrigger !== 'undefined') {
9286				ScrollTrigger.sort();
9287				ScrollTrigger.refresh();
9288			}
9289		}, 0);
9290		
9291		return true;
9292	}
9293
9294	(function retryInit() {
9295		var tries = 0;
9296		var maxTries = 40;
9297		function go() {
9298			tries++;
9299			var ok = initMarqueesOnce();
9300			if (ok) return;
9301			if (tries >= maxTries) {
9302				return;
9303			}
9304			window.setTimeout(go, 100);
9305		}
9306		go();
9307	})();
9308};
9309UNCODE.wrapperSticky = function(){
9310    (function () {
9311        if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') return;
9312        gsap.registerPlugin(ScrollTrigger);
9313
9314        var wrappers = document.getElementsByClassName('cs-wrapper-sticky');
9315        var i;
9316
9317        function ensureTrack(wrapper) {
9318            var track = wrapper.querySelector('.cs-track');
9319            if (track) return track;
9320
9321            track = document.createElement('div');
9322            track.className = 'cs-track';
9323
9324            var items = wrapper.getElementsByClassName('cs-container');
9325            var list = [];
9326            var k;
9327            for (k = 0; k < items.length; k++) list.push(items[k]);
9328
9329            wrapper.insertBefore(track, wrapper.firstChild);
9330            for (k = 0; k < list.length; k++) track.appendChild(list[k]);
9331
9332            return track;
9333        }
9334
9335        function setupHorizontalPin(wrapper) {
9336            var track = ensureTrack(wrapper);
9337            var tween = null;
9338            var st = null;
9339
9340            function getTriggerElement() {
9341                if (wrapper.closest) {
9342                    return wrapper.closest('.vc_row[data-parent]') || wrapper;
9343                }
9344                return wrapper;
9345            }
9346
9347            function isStickyDisabled() {
9348                var w = window.innerWidth || document.documentElement.clientWidth;
9349
9350                if (wrapper.getAttribute('data-disable-sticky-mobile') === 'yes' && w < 570) {
9351                    return true;
9352                }
9353
9354                if (wrapper.getAttribute('data-disable-sticky-tablet') === 'yes' && w < 960) {
9355                    return true;
9356                }
9357
9358                return false;
9359            }
9360
9361            function getDirection() {
9362                var d = wrapper.getAttribute('data-direction');
9363                if (d === 'reverse' || d === 'rtl' || d === 'right') return 1;
9364                return -1;
9365            }
9366
9367            function getStartPosition() {
9368                var align = wrapper.getAttribute('data-align');
9369                return align ? align : 'top top';
9370            }
9371
9372            function getDistance() {
9373                var wrapperW = wrapper.getBoundingClientRect
9374                    ? wrapper.getBoundingClientRect().width
9375                    : wrapper.offsetWidth;
9376
9377                var dist = track.scrollWidth - wrapperW;
9378                if (dist < 0) dist = 0;
9379                return dist;
9380            }
9381
9382            function destroy() {
9383                if (st) {
9384                    st.kill();
9385                    st = null;
9386                }
9387
9388                if (tween) {
9389                    tween.kill();
9390                    tween = null;
9391                }
9392
9393                gsap.set(track, { clearProps: 'transform' });
9394            }
9395
9396            function make() {
9397                destroy();
9398
9399                if (isStickyDisabled()) {
9400                    return;
9401                }
9402
9403                var dist = getDistance();
9404                if (!dist) return;
9405
9406                var dir = getDirection();
9407                var startPos = getStartPosition();
9408                var triggerEl = getTriggerElement();
9409
9410                gsap.set(track, { x: 0 });
9411
9412                tween = gsap.to(track, {
9413                    x: dist * dir,
9414                    ease: 'none',
9415                    scrollTrigger: {
9416                        trigger: triggerEl,
9417                        start: startPos,
9418                        end: function () { return '+=' + dist; },
9419                        scrub: true,
9420                        pin: triggerEl,
9421                        anticipatePin: 1,
9422                        invalidateOnRefresh: true
9423                    }
9424                });
9425
9426                st = tween.scrollTrigger;
9427            }
9428
9429            make();
9430
9431            ScrollTrigger.addEventListener('refreshInit', function () {
9432                if (!isStickyDisabled()) {
9433                    gsap.set(track, { x: 0 });
9434                }
9435            });
9436
9437            var resizeT = 0;
9438            var lastResizeW = window.innerWidth || document.documentElement.clientWidth;
9439
9440            window.addEventListener('resize', function () {
9441                var currentW = window.innerWidth || document.documentElement.clientWidth;
9442
9443                if (Math.abs(currentW - lastResizeW) < 2) {
9444                    return;
9445                }
9446
9447                lastResizeW = currentW;
9448
9449                if (resizeT) window.clearTimeout(resizeT);
9450
9451                resizeT = window.setTimeout(function () {
9452                    make();
9453                    ScrollTrigger.refresh();
9454                }, 150);
9455            }, false);
9456
9457            setTimeout(function () {
9458                ScrollTrigger.refresh();
9459            }, 500);
9460        }
9461
9462        for (i = 0; i < wrappers.length; i++) {
9463            setupHorizontalPin(wrappers[i]);
9464        }
9465    })();
9466
9467};
9468UNCODE.mouseTrail = (function () {
9469
9470	"use strict";
9471
9472	var __globalDestroy = null;
9473
9474	return function () {
9475
9476		if (typeof __globalDestroy === "function") {
9477			try { __globalDestroy(); } catch (e) {}
9478			__globalDestroy = null;
9479		}
9480
9481		function initImageTrail(options) {
9482
9483			options = options || {};
9484
9485			var area = options.area;
9486			var hoverArea = options.hoverArea;
9487
9488			var images       = options.images || [];
9489			var size         = options.size != null ? options.size : 120;
9490
9491			var minWidth = (options.minWidth != null) ? options.minWidth : null;
9492			var maxWidth = (options.maxWidth != null) ? options.maxWidth : null;
9493
9494			var life         = options.life != null ? options.life : 1.6;
9495			var spawnEvery   = options.spawnEvery != null ? options.spawnEvery : 60;
9496			var touchSpawnEvery = options.touchSpawnEvery != null
9497				? options.touchSpawnEvery
9498				: spawnEvery * 2;
9499			var minDistance  = options.minDistance != null ? options.minDistance : 18;
9500			var rotateRange  = options.rotateRange != null ? options.rotateRange : 10;
9501			var scaleRange   = options.scaleRange || [0.9, 1.05];
9502			var zIndex       = options.zIndex != null ? options.zIndex : 10;
9503			var inOpacity    = options.inOpacity != null ? options.inOpacity : 0;
9504			var midOpacity   = options.midOpacity != null ? options.midOpacity : 1;
9505			var outOpacity   = options.outOpacity != null ? options.outOpacity : 0;
9506			var drift        = options.drift != null ? options.drift : true;
9507
9508			var poolSize     = options.poolSize != null ? options.poolSize : 16;
9509
9510			var inScale      = options.inScale != null ? options.inScale : 0.6;
9511			var outScale     = options.outScale != null ? options.outScale : 0.6;
9512			var inDuration   = options.inDuration != null ? options.inDuration : 0.2;
9513			var outDuration  = options.outDuration != null ? options.outDuration : 0.35;
9514			var inEase       = options.inEase || "power3.out";
9515			var outEase      = options.outEase || "power3.in";
9516
9517			var scrollOn     = options.scrollOn != null ? options.scrollOn : true;
9518
9519			if (!area || !hoverArea) return null;
9520
9521			var areaStyle = window.getComputedStyle(area);
9522			if (areaStyle.position === "static") area.style.position = "relative";
9523
9524			var lastTime = 0;
9525			var lastX = null;
9526			var lastY = null;
9527
9528			var pointerX = null;
9529			var pointerY = null;
9530
9531			var scrollLastTime = 0;
9532			var scrollLastPageY = null;
9533			var scrollSpawnEvery = options.scrollSpawnEvery != null ? options.scrollSpawnEvery : 220;
9534			var scrollMinDistance = options.scrollMinDistance != null ? options.scrollMinDistance : 40;
9535
9536			var touchViewportOn = options.touchViewportOn !== false;
9537			var desktopAutoOn = options.desktopAutoOn === true;
9538
9539			var safeW = options.safeW != null ? options.safeW : 0;
9540			var safeH = options.safeH != null ? options.safeH : 0;
9541			var safeMode = options.safeMode || "avoid";
9542			var particleSafeAreaOn = options.particleSafeAreaOn === true;
9543
9544			var isTouchDevice = (
9545				("ontouchstart" in window) ||
9546				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
9547				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
9548			) && !window.matchMedia("(pointer: fine)").matches;
9549
9550			var useAutoViewportTrail = isTouchDevice
9551				? touchViewportOn
9552				: desktopAutoOn;
9553
9554			var autoSpawnEvery = isTouchDevice
9555				? touchSpawnEvery
9556				: spawnEvery;
9557
9558			var autoTimer = null;
9559			var autoRunning = false;
9560			var rafWatch = 0;
9561			var watchActive = true;
9562
9563			var i = 0;
9564
9565			for (var p = 0; p < images.length; p++) {
9566				var preload = new Image();
9567				preload.src = images[p];
9568			}
9569
9570			var pool = [];
9571			var poolIndex = 0;
9572
9573			function rectVisible(rect, vh) {
9574				return rect.bottom > 0 && rect.top < vh && rect.height > 0;
9575			}
9576
9577			function buildSafeRect(rect) {
9578				if (!particleSafeAreaOn || !safeW || !safeH) return null;
9579
9580				var w = rect.width * (safeW / 100);
9581				var h = rect.height * (safeH / 100);
9582
9583				if (!w || !h) return null;
9584
9585				return {
9586					left: rect.left + (rect.width - w) / 2,
9587					top: rect.top + (rect.height - h) / 2,
9588					right: rect.left + (rect.width + w) / 2,
9589					bottom: rect.top + (rect.height + h) / 2,
9590					width: w,
9591					height: h
9592				};
9593			}
9594
9595			function pointInSafeRect(x, y, safeRect) {
9596				if (!safeRect) return false;
9597				return (
9598					x >= safeRect.left &&
9599					x <= safeRect.right &&
9600					y >= safeRect.top &&
9601					y <= safeRect.bottom
9602				);
9603			}
9604
9605			function randomPointInRect(rect) {
9606				var safeRect = buildSafeRect(rect);
9607
9608				if (!safeRect) {
9609					return {
9610						x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9611						y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9612					};
9613				}
9614
9615				if (safeMode === "soft") {
9616					var best = null;
9617					var cx = safeRect.left + safeRect.width / 2;
9618					var cy = safeRect.top + safeRect.height / 2;
9619
9620					for (var i = 0; i < 40; i++) {
9621						var x = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9622						var y = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9623
9624						var dx = x - cx;
9625						var dy = y - cy;
9626						var dist = Math.sqrt(dx * dx + dy * dy);
9627
9628						if (pointInSafeRect(x, y, safeRect)) {
9629							dist -= 99999;
9630						}
9631
9632						if (!best || dist > best.score) {
9633							best = {
9634								x: x,
9635								y: y,
9636								score: dist
9637							};
9638						}
9639					}
9640
9641					return {
9642						x: best.x,
9643						y: best.y
9644					};
9645				}
9646
9647				for (var j = 0; j < 40; j++) {
9648					var px = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9649					var py = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9650
9651					if (!pointInSafeRect(px, py, safeRect)) {
9652						return {
9653							x: px,
9654							y: py
9655						};
9656					}
9657				}
9658
9659				return {
9660					x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9661					y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9662				};
9663			}
9664
9665			function spawnRandomInViewportArea() {
9666				var rect = hoverArea.getBoundingClientRect();
9667				var vh = window.innerHeight || document.documentElement.clientHeight;
9668
9669				if (!rectVisible(rect, vh)) return;
9670
9671				var p = randomPointInRect(rect);
9672
9673				lastX = null;
9674				lastY = null;
9675
9676				spawn(p.x, p.y);
9677			}
9678
9679			function startAutoViewportTrail() {
9680				if (!useAutoViewportTrail || autoRunning) return;
9681
9682				autoRunning = true;
9683
9684				function loop() {
9685					if (!autoRunning) return;
9686					spawnRandomInViewportArea();
9687					autoTimer = setTimeout(loop, autoSpawnEvery);
9688				}
9689
9690				loop();
9691			}
9692
9693			function stopAutoViewportTrail() {
9694				autoRunning = false;
9695				if (autoTimer) {
9696					clearTimeout(autoTimer);
9697					autoTimer = null;
9698				}
9699			}
9700
9701			function resetPool() {
9702				for (var ii = 0; ii < pool.length; ii++) {
9703					var img = pool[ii];
9704					if (!img) continue;
9705
9706					img.__trailToken = (img.__trailToken || 0) + 1;
9707					gsap.killTweensOf(img);
9708
9709					gsap.set(img, {
9710						x: -9999,
9711						y: -9999,
9712						opacity: 0,
9713						scale: inScale,
9714						rotation: 0
9715					});
9716				}
9717			}
9718
9719			function onVisibilityChange() {
9720				if (document.visibilityState === "hidden") {
9721					stopAutoViewportTrail();
9722					resetPool();
9723					lastX = null;
9724					lastY = null;
9725					scrollLastPageY = null;
9726					pointerX = null;
9727					pointerY = null;
9728					lastTime = 0;
9729					scrollLastTime = 0;
9730					if (rafWatch) {
9731						cancelAnimationFrame(rafWatch);
9732						rafWatch = 0;
9733					}
9734				} else {
9735					resetPool();
9736					if (useAutoViewportTrail) {
9737						watchViewportAutoState();
9738					}
9739				}
9740			}
9741
9742			function watchViewportAutoState() {
9743				if (!watchActive || rafWatch) return;
9744
9745				function tick() {
9746					if (!watchActive) {
9747						rafWatch = 0;
9748						return;
9749					}
9750
9751					if (useAutoViewportTrail) {
9752						var rect = hoverArea.getBoundingClientRect();
9753						var vh = window.innerHeight || document.documentElement.clientHeight;
9754
9755						if (rectVisible(rect, vh)) startAutoViewportTrail();
9756						else stopAutoViewportTrail();
9757					}
9758
9759					rafWatch = requestAnimationFrame(tick);
9760				}
9761
9762				rafWatch = requestAnimationFrame(tick);
9763			}
9764
9765			function endsWith(str, suffix) {
9766				str = String(str);
9767				suffix = String(suffix);
9768				return str.indexOf(suffix, str.length - suffix.length) !== -1;
9769			}
9770
9771			function cssSizeToPx(value, referenceEl) {
9772				if (value == null) return null;
9773				if (typeof value === "number") return value;
9774
9775				value = String(value).trim();
9776
9777				if (endsWith(value, "px")) return parseFloat(value);
9778				if (endsWith(value, "vw")) return window.innerWidth * parseFloat(value) / 100;
9779				if (endsWith(value, "vh")) return window.innerHeight * parseFloat(value) / 100;
9780
9781				if (endsWith(value, "%")) {
9782					var rect = referenceEl.getBoundingClientRect();
9783					return rect.width * parseFloat(value) / 100;
9784				}
9785
9786				if (!isNaN(value)) return parseFloat(value);
9787
9788				return null;
9789			}
9790
9791			function getRandomWidthPx() {
9792
9793				if (minWidth == null && maxWidth == null) return null;
9794
9795				var minPx = cssSizeToPx(minWidth, area);
9796				var maxPx = cssSizeToPx(maxWidth, area);
9797
9798				if (minPx == null && maxPx == null) return null;
9799
9800				if (minPx == null) minPx = maxPx;
9801				if (maxPx == null) maxPx = minPx;
9802
9803				if (maxPx < minPx) {
9804					var t = minPx;
9805					minPx = maxPx;
9806					maxPx = t;
9807				}
9808
9809				return gsap.utils.random(minPx, maxPx, 1);
9810			}
9811
9812			function applySizing(el) {
9813				el.style.minWidth = "";
9814				el.style.maxWidth = "";
9815
9816				if (size !== "auto" && size != null) {
9817					el.style.width = (typeof size === "number") ? (size + "px") : String(size);
9818					el.style.height = "auto";
9819					return;
9820				}
9821
9822				el.style.width = "";
9823				el.style.height = "auto";
9824
9825				if (minWidth != null && minWidth !== "") el.style.minWidth = String(minWidth);
9826				if (maxWidth != null && maxWidth !== "") el.style.maxWidth = String(maxWidth);
9827			}
9828
9829			for (var k = 0; k < poolSize; k++) {
9830				var el = document.createElement("img");
9831				el.className = "trail-img";
9832
9833				applySizing(el);
9834
9835				el.style.zIndex = zIndex;
9836				el.style.position = "absolute";
9837				el.style.left = "0";
9838				el.style.top = "0";
9839				el.style.pointerEvents = "none";
9840				el.style.userSelect = "none";
9841				el.style.willChange = "transform,opacity";
9842
9843				el.__trailToken = 0;
9844
9845				area.appendChild(el);
9846
9847				gsap.set(el, {
9848					x: -9999,
9849					y: -9999,
9850					opacity: 0,
9851					scale: inScale,
9852					rotation: 0,
9853					transformOrigin: "50% 50%"
9854				});
9855
9856				pool.push(el);
9857			}
9858
9859			function whenDecoded(img, cb) {
9860				if (img && img.decode) {
9861					img.decode().then(function () { cb(); }).catch(function () { cb(); });
9862				} else {
9863					cb();
9864				}
9865			}
9866
9867			function spawn(clientX, clientY) {
9868
9869				if (!images.length) return;
9870
9871				var src = images[i % images.length];
9872				i++;
9873
9874				var img = pool[poolIndex % pool.length];
9875				poolIndex++;
9876
9877				if (img.parentNode !== area) area.appendChild(img);
9878
9879				img.__trailToken = (img.__trailToken || 0) + 1;
9880				var token = img.__trailToken;
9881
9882				gsap.killTweensOf(img);
9883
9884				applySizing(img);
9885
9886				if (img.getAttribute("src") !== src) {
9887					img.setAttribute("src", src);
9888				}
9889
9890				var rect = area.getBoundingClientRect();
9891				var localX = clientX - rect.left;
9892				var localY = clientY - rect.top;
9893
9894				var rot = gsap.utils.random(-rotateRange, rotateRange, 0.1);
9895				var scl = gsap.utils.random(scaleRange[0], scaleRange[1], 0.01);
9896
9897				var randomWidth = getRandomWidthPx();
9898				if (randomWidth) {
9899					img.style.width = randomWidth + "px";
9900					img.style.height = "auto";
9901				}
9902
9903				gsap.set(img, {
9904					x: localX,
9905					y: localY,
9906					xPercent: -50,
9907					yPercent: -50,
9908					rotation: rot,
9909					scale: inScale,
9910					opacity: inOpacity,
9911					transformOrigin: "50% 50%"
9912				});
9913
9914				whenDecoded(img, function () {
9915
9916					if (img.__trailToken !== token) return;
9917
9918					var tl = gsap.timeline({
9919						onComplete: function () {
9920							if (img.__trailToken !== token) return;
9921							gsap.set(img, { x: -9999, y: -9999, opacity: 0, scale: inScale, rotation: 0 });
9922						}
9923					});
9924
9925					tl.to(img, {
9926						opacity: midOpacity,
9927						scale: scl,
9928						duration: inDuration,
9929						ease: inEase
9930					}, 0);
9931
9932					if (drift) {
9933						tl.to(img, {
9934							x: "+=" + gsap.utils.random(-12, 12, 1),
9935							y: "+=" + gsap.utils.random(-18, 18, 1),
9936							rotation: rot + gsap.utils.random(-6, 6, 0.1),
9937							duration: life,
9938							ease: inEase
9939						}, 0);
9940					}
9941
9942					tl.to(img, {
9943						opacity: outOpacity,
9944						scale: outScale,
9945						duration: outDuration,
9946						ease: outEase
9947					}, Math.max(0, life - outDuration));
9948
9949				});
9950			}
9951
9952			function onMove(e) {
9953
9954				pointerX = e.clientX;
9955				pointerY = e.clientY;
9956
9957				var now = Date.now();
9958				if (now - lastTime < spawnEvery) return;
9959
9960				var x = e.clientX;
9961				var y = e.clientY;
9962
9963				if (lastX !== null) {
9964					var dx = x - lastX;
9965					var dy = y - lastY;
9966					var dist = Math.sqrt(dx * dx + dy * dy);
9967					if (dist < minDistance) return;
9968				}
9969
9970				lastTime = now;
9971				lastX = x;
9972				lastY = y;
9973
9974				spawn(x, y);
9975			}
9976
9977			function onLeave() {
9978				lastX = null;
9979				lastY = null;
9980				scrollLastPageY = null;
9981			}
9982
9983			function onPointerMove(e) {
9984				pointerX = e.clientX;
9985				pointerY = e.clientY;
9986			}
9987
9988			function pointInRect(x, y, rect) {
9989				return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
9990			}
9991
9992			function onScroll() {
9993
9994				if (pointerX === null || pointerY === null) return;
9995
9996				var now = Date.now();
9997				if (now - scrollLastTime < scrollSpawnEvery) return;
9998
9999				var rect = hoverArea.getBoundingClientRect();
10000				if (!pointInRect(pointerX, pointerY, rect)) return;
10001
10002				var pageY = window.pageYOffset || document.documentElement.scrollTop || 0;
10003
10004				if (scrollLastPageY !== null) {
10005					var scrollDelta = Math.abs(pageY - scrollLastPageY);
10006					if (scrollDelta < scrollMinDistance) return;
10007				}
10008
10009				var x = Math.min(Math.max(pointerX, rect.left + 1), rect.right - 1);
10010				var y = Math.min(Math.max(pointerY, rect.top + 1), rect.bottom - 1);
10011
10012				scrollLastTime = now;
10013				scrollLastPageY = pageY;
10014
10015				spawn(x, y);
10016			}
10017
10018			if (!useAutoViewportTrail) {
10019				hoverArea.addEventListener("mousemove", onMove);
10020				hoverArea.addEventListener("mouseleave", onLeave);
10021
10022				if (scrollOn) {
10023					window.addEventListener("mousemove", onPointerMove, { passive: true });
10024					window.addEventListener("scroll", onScroll, { passive: true });
10025				}
10026			} else {
10027				watchViewportAutoState();
10028			}
10029
10030			document.addEventListener("visibilitychange", onVisibilityChange);
10031
10032			return function () {
10033
10034				document.removeEventListener("visibilitychange", onVisibilityChange);
10035
10036				if (!useAutoViewportTrail) {
10037					hoverArea.removeEventListener("mousemove", onMove);
10038					hoverArea.removeEventListener("mouseleave", onLeave);
10039
10040					if (scrollOn) {
10041						window.removeEventListener("mousemove", onPointerMove);
10042						window.removeEventListener("scroll", onScroll);
10043					}
10044				}
10045
10046				stopAutoViewportTrail();
10047
10048				watchActive = false;
10049				if (rafWatch) {
10050					cancelAnimationFrame(rafWatch);
10051					rafWatch = 0;
10052				}
10053
10054				for (var ii = 0; ii < pool.length; ii++) {
10055					if (pool[ii] && pool[ii].parentNode) {
10056						gsap.killTweensOf(pool[ii]);
10057						pool[ii].parentNode.removeChild(pool[ii]);
10058					}
10059				}
10060				pool.length = 0;
10061			};
10062
10063		}
10064
10065		function getTrailImagesFromArea(area, useParticleImages) {
10066			var node = null;
10067
10068			if (useParticleImages) {
10069				node = area.querySelector(".particle-images");
10070				if (!node) node = area.querySelector(".trail-images");
10071			} else {
10072				node = area.querySelector(".trail-images");
10073				if (!node) node = area.querySelector(".particle-images");
10074			}
10075
10076			if (!node) return [];
10077
10078			var json = node.textContent || node.innerText || "[]";
10079			try {
10080				return JSON.parse(json);
10081			} catch (e) {
10082				return [];
10083			}
10084		}
10085
10086		function closestPolyfill(el, selector) {
10087			while (el && el.nodeType === 1) {
10088				if (matchesSelector(el, selector)) return el;
10089				el = el.parentNode;
10090			}
10091			return null;
10092		}
10093
10094		function matchesSelector(el, selector) {
10095			var p = Element.prototype;
10096			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10097			if (!fn) return false;
10098			return fn.call(el, selector);
10099		}
10100
10101		function getDataFromArea(area, key, fallback) {
10102			if (!area || !key) return fallback;
10103
10104			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10105			var raw = area.getAttribute(attr);
10106			if (raw == null) return fallback;
10107
10108			raw = String(raw).trim();
10109
10110			if (raw === "true") return true;
10111			if (raw === "false") return false;
10112			if (raw === "null") return null;
10113
10114			var num = raw.replace(",", ".");
10115			if (num !== "" && isFinite(num)) return parseFloat(num);
10116
10117			if (
10118				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10119				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10120			) {
10121				try { return JSON.parse(raw); } catch (e) {}
10122			}
10123
10124			return raw;
10125		}
10126
10127		var destroyers = [];
10128
10129		var areas = document.querySelectorAll(".uncode-bg-trail");
10130		for (var n = 0; n < areas.length; n++) {
10131
10132			var renderArea = areas[n];
10133
10134			if (renderArea.__trailDestroy && typeof renderArea.__trailDestroy === "function") {
10135				try { renderArea.__trailDestroy(); } catch (e) {}
10136				renderArea.__trailDestroy = null;
10137			}
10138
10139			var hoverArea = renderArea.closest
10140				? renderArea.closest('.vc_row[data-parent="true"]')
10141				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10142
10143			if (!hoverArea) continue;
10144
10145			var isTouchDevice = (
10146				("ontouchstart" in window) ||
10147				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
10148				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
10149			) && !window.matchMedia("(pointer: fine)").matches;
10150
10151			var desktopAutoOn = String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes";
10152			var mobileAutoOn = String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes";
10153
10154			var useParticleImages = isTouchDevice ? mobileAutoOn : desktopAutoOn;
10155
10156			var images = getTrailImagesFromArea(renderArea, useParticleImages);
10157
10158			renderArea.__trailDestroy = initImageTrail({
10159				area: renderArea,
10160				hoverArea: hoverArea,
10161				images: images,
10162				size: "auto",
10163
10164				minWidth: getDataFromArea(renderArea, "min-width", null),
10165				maxWidth: getDataFromArea(renderArea, "max-width", null),
10166
10167				life: (getDataFromArea(renderArea, "life", 1) +
10168					getDataFromArea(renderArea, "in-duration", 0.25) +
10169					getDataFromArea(renderArea, "out-duration", 0.3)),
10170
10171				spawnEvery: getDataFromArea(renderArea, "interval", 100),
10172				minDistance: getDataFromArea(renderArea, "distance", 150),
10173				scrollSpawnEvery: Math.max(180, getDataFromArea(renderArea, "interval", 100) * 2),
10174				scrollMinDistance: 30,
10175
10176				poolSize: getDataFromArea(renderArea, "count", 16),
10177
10178				inScale: 0,
10179				outScale: 0,
10180				inDuration: getDataFromArea(renderArea, "in-duration", 0.25),
10181				outDuration: getDataFromArea(renderArea, "out-duration", 0.3),
10182
10183				rotateRange: getDataFromArea(renderArea, "rotate", 10),
10184
10185				inOpacity: 0,
10186				midOpacity: 1,
10187				outOpacity: 0,
10188				drift: getDataFromArea(renderArea, "drift", false),
10189				scrollOn: getDataFromArea(renderArea, "scroll", false),
10190
10191				touchViewportOn: String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes",
10192				touchSpawnEvery: getDataFromArea(renderArea, "mobile-interval", 1750),
10193				desktopAutoOn: String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes",
10194
10195				particleSafeAreaOn: useParticleImages,
10196				safeW: getDataFromArea(renderArea, "safe-w", 0),
10197				safeH: getDataFromArea(renderArea, "safe-h", 0),
10198				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10199
10200				inEase: "power3.out",
10201				outEase: "power3.in"
10202			}) || null;
10203
10204			if (renderArea.__trailDestroy) {
10205				destroyers.push(renderArea.__trailDestroy);
10206			}
10207		}
10208
10209		__globalDestroy = function () {
10210			for (var i = 0; i < destroyers.length; i++) {
10211				try { destroyers[i](); } catch (e) {}
10212			}
10213			destroyers.length = 0;
10214		};
10215
10216	};
10217
10218})();
10219UNCODE.magneticPattern = (function () {
10220
10221	"use strict";
10222
10223	var __globalDestroy = null;
10224
10225	return function () {
10226
10227		if (typeof __globalDestroy === "function") {
10228			try { __globalDestroy(); } catch (e) {}
10229			__globalDestroy = null;
10230		}
10231
10232		function getMagneticImagesFromArea(area) {
10233			var node = area.querySelector(".magnetic-images");
10234			if (!node) return [];
10235			var json = node.textContent || node.innerText || "[]";
10236			try { return JSON.parse(json); } catch (e) { return []; }
10237		}
10238
10239		function closestPolyfill(el, selector) {
10240			while (el && el.nodeType === 1) {
10241				if (matchesSelector(el, selector)) return el;
10242				el = el.parentNode;
10243			}
10244			return null;
10245		}
10246
10247		function matchesSelector(el, selector) {
10248			var p = Element.prototype;
10249			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10250			if (!fn) return false;
10251			return fn.call(el, selector);
10252		}
10253
10254		function clamp01(v) {
10255			if (v < 0) return 0;
10256			if (v > 1) return 1;
10257			return v;
10258		}
10259
10260		function toNumber(value, fallback) {
10261			if (value == null) return fallback;
10262			var s = String(value).trim();
10263			if (!s) return fallback;
10264			s = s.replace(",", ".");
10265			var m = s.match(/-?\d+(\.\d+)?/);
10266			if (!m) return fallback;
10267			var n = parseFloat(m[0]);
10268			return isFinite(n) ? n : fallback;
10269		}
10270
10271		function getDataFromArea(area, key, fallback) {
10272			if (!area || !key) return fallback;
10273
10274			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10275			var raw = area.getAttribute(attr);
10276			if (raw == null) return fallback;
10277
10278			raw = String(raw).trim();
10279
10280			if (raw === "true") return true;
10281			if (raw === "false") return false;
10282			if (raw === "null") return null;
10283
10284			var num = raw.replace(",", ".");
10285			if (num !== "" && isFinite(num)) return parseFloat(num);
10286
10287			if (
10288				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10289				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10290			) {
10291				try { return JSON.parse(raw); } catch (e) {}
10292			}
10293
10294			return raw;
10295		}
10296
10297		function dedupeImages(list) {
10298			var uniq = [];
10299			var seen = {};
10300			for (var i = 0; i < list.length; i++) {
10301				var src = list[i];
10302				if (src == null) continue;
10303				src = String(src);
10304				if (!seen[src]) {
10305					seen[src] = true;
10306					uniq.push(src);
10307				}
10308			}
10309			return uniq;
10310		}
10311
10312		function rectsOverlap(a, b) {
10313			return !(
10314				a.x + a.w <= b.x ||
10315				b.x + b.w <= a.x ||
10316				a.y + a.h <= b.y ||
10317				b.y + b.h <= a.y
10318			);
10319		}
10320
10321		function initMagneticPattern(options) {
10322
10323			options = options || {};
10324
10325			var renderArea = options.area;
10326			var hoverArea  = options.hoverArea;
10327			var images     = options.images || [];
10328
10329			if (!renderArea || !hoverArea || !images.length) return null;
10330
10331			var count      = (options.count != null) ? options.count : 12;
10332			var padding    = (options.padding != null) ? options.padding : 24;
10333			var jitter     = (options.jitter != null) ? options.jitter : 0.35;
10334
10335			var rawMoveX   = (options.moveX != null) ? options.moveX : 200;
10336			var rawMoveY   = (options.moveY != null) ? options.moveY : 150;
10337			var rawSpillX  = (options.spillX != null) ? options.spillX : 0;
10338			var rawSpillY  = (options.spillY != null) ? options.spillY : 0;
10339
10340			var moveX      = cssLengthToPx(rawMoveX, hoverArea, 200);
10341			var moveY      = cssLengthToPx(rawMoveY, hoverArea, 150);
10342			var spillX     = cssLengthToPx(rawSpillX, renderArea, 0);
10343			var spillY     = cssLengthToPx(rawSpillY, renderArea, 0);
10344
10345			var easeDur    = (options.easeDur != null) ? options.easeDur : 0.6;
10346			var easeLeave  = (options.easeLeave != null) ? options.easeLeave : 1.2;
10347			var ease       = options.ease || "power3.out";
10348
10349			var opacityMin = (options.opacityMin != null) ? options.opacityMin : 0.25;
10350			var opacityMax = (options.opacityMax != null) ? options.opacityMax : 0.9;
10351
10352			var enableBlur = options.enableBlur === true;
10353			var blurMin    = (options.blurMin != null) ? options.blurMin : 0;
10354			var blurMax    = (options.blurMax != null) ? options.blurMax : 6;
10355
10356			var scaleMin   = (options.scaleMin != null) ? options.scaleMin : 0.6;
10357			var scaleMax   = (options.scaleMax != null) ? options.scaleMax : 1;
10358
10359			var depthMin   = (options.depthMin != null) ? options.depthMin : 0.3;
10360			var depthMax   = (options.depthMax != null) ? options.depthMax : 1;
10361
10362			var unique     = options.unique === true;
10363
10364			var zIndexBase     = (options.zIndexBase != null) ? options.zIndexBase : 1;
10365			var zIndexRange    = (options.zIndexRange != null) ? options.zIndexRange : 30;
10366			var enableRotation = options.enableRotation !== false;
10367			var rotationRange  = (options.rotationRange != null) ? options.rotationRange : 8;
10368
10369			var noOverlap = options.noOverlap === true;
10370			var attempts  = (options.attempts != null) ? options.attempts : 120;
10371			var gap       = (options.gap != null) ? options.gap : 8;
10372
10373			var baseWidth = (options.baseWidth != null) ? options.baseWidth : 300;
10374
10375			var depthEnabled = options.flatDepth !== true;
10376
10377			var enableScrollMotion = options.scrollMotion !== false;
10378
10379			var safeW = (options.safeW != null) ? options.safeW : 0;
10380			var safeH = (options.safeH != null) ? options.safeH : 0;
10381			var safeMode = options.safeMode || "avoid";
10382
10383			var items = [];
10384
10385			function cssLengthToPx(value, el, fallback) {
10386				if (value == null) return fallback;
10387
10388				if (typeof value === "number") return isFinite(value) ? value : fallback;
10389
10390				var s = String(value).trim();
10391				if (!s) return fallback;
10392
10393				var n = parseFloat(s.replace(",", "."));
10394				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10395
10396				var probe = document.createElement("div");
10397				probe.style.position = "absolute";
10398				probe.style.visibility = "hidden";
10399				probe.style.pointerEvents = "none";
10400				probe.style.width = s;
10401				probe.style.height = "0";
10402
10403				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10404				parent.appendChild(probe);
10405
10406				var px = probe.getBoundingClientRect().width;
10407				parent.removeChild(probe);
10408
10409				return (px && isFinite(px)) ? px : fallback;
10410			}
10411
10412			if (window.getComputedStyle(renderArea).position === "static") {
10413				renderArea.style.position = "relative";
10414			}
10415
10416			function lerp(a, b, t) {
10417				return a + (b - a) * t;
10418			}
10419
10420			function clearAll() {
10421				var nodes = renderArea.querySelectorAll(".pattern-img");
10422				for (var i = nodes.length - 1; i >= 0; i--) {
10423					if (nodes[i] && nodes[i].parentNode) nodes[i].parentNode.removeChild(nodes[i]);
10424				}
10425				items.length = 0;
10426			}
10427
10428			function buildSafeRect(virtualW, virtualH, originX, originY) {
10429				if (!safeW || !safeH) return null;
10430
10431				var szW = (safeW / 100) * virtualW;
10432				var szH = (safeH / 100) * virtualH;
10433
10434				if (!szW || !szH) return null;
10435
10436				return {
10437					x: originX + (virtualW - szW) / 2,
10438					y: originY + (virtualH - szH) / 2,
10439					w: szW,
10440					h: szH
10441				};
10442			}
10443
10444			var rafWatch = 0;
10445			var lastTop = null;
10446			var lastHeight = null;
10447			var watchActive = true;
10448
10449			function watchPosition() {
10450				if (!watchActive) return;
10451
10452				var rect = hoverArea.getBoundingClientRect();
10453				var top = Math.round(rect.top);
10454				var height = Math.round(rect.height);
10455
10456				var movedEnough =
10457					lastTop === null ||
10458					Math.abs(top - lastTop) > 1 ||
10459					Math.abs(height - lastHeight) > 1;
10460
10461				if (movedEnough) {
10462					lastTop = top;
10463					lastHeight = height;
10464					onScroll();
10465				}
10466
10467				rafWatch = requestAnimationFrame(watchPosition);
10468			}
10469			
10470			function buildLayout() {
10471
10472				clearAll();
10473
10474				var rect = renderArea.getBoundingClientRect();
10475
10476				var width  = rect.width  + spillX * 2;
10477				var height = rect.height + spillY * 2;
10478
10479				var originX = -spillX;
10480				var originY = -spillY;
10481
10482				var safeRect = buildSafeRect(width, height, originX, originY);
10483
10484				var imgs = unique ? dedupeImages(images) : images;
10485				var effectiveCount = unique ? Math.min(count, imgs.length) : count;
10486
10487				var cols = Math.ceil(Math.sqrt(effectiveCount));
10488				var rows = Math.ceil(effectiveCount / cols);
10489
10490				var cellW = (width  - padding * 2) / cols;
10491				var cellH = (height - padding * 2) / rows;
10492
10493				var frag = document.createDocumentFragment();
10494				var placed = [];
10495
10496				for (var i = 0; i < effectiveCount; i++) {
10497
10498					var src = imgs[i % imgs.length];
10499
10500					var el = document.createElement("img");
10501					el.className = "pattern-img";
10502					el.src = src;
10503
10504					el.style.position = "absolute";
10505					el.style.left = "0";
10506					el.style.top = "0";
10507					el.style.pointerEvents = "none";
10508					el.style.userSelect = "none";
10509					el.style.willChange = "transform,opacity,filter";
10510
10511					el.style.width = baseWidth + "px";
10512					el.style.height = "auto";
10513
10514					var col = i % cols;
10515					var row = Math.floor(i / cols);
10516
10517					var baseCellX = originX + padding + col * cellW;
10518					var baseCellY = originY + padding + row * cellH;
10519
10520					var baseX = baseCellX + cellW / 2 + (Math.random() - 0.5) * cellW * jitter;
10521					var baseY = baseCellY + cellH / 2 + (Math.random() - 0.5) * cellH * jitter;
10522
10523					var placedOk = true;
10524
10525					function isBadCandidate(x, y) {
10526						var cand = { x: x, y: y, w: baseWidth + gap, h: baseWidth + gap };
10527
10528						if (safeRect && rectsOverlap(cand, safeRect)) {
10529							if (safeMode === "avoid") return true;
10530						}
10531
10532						if (noOverlap) {
10533							for (var p = 0; p < placed.length; p++) {
10534								if (rectsOverlap(cand, placed[p])) return true;
10535							}
10536						}
10537
10538						return false;
10539					}
10540
10541					if (safeRect && safeMode === "soft") {
10542						var best = { x: baseX, y: baseY, score: -999999 };
10543						var softTries = Math.max(20, Math.min(120, attempts));
10544
10545						for (var st = 0; st < softTries; st++) {
10546							var rxS = baseCellX + (Math.random() * cellW);
10547							var ryS = baseCellY + (Math.random() * cellH);
10548
10549							var candS = { x: rxS, y: ryS, w: baseWidth + gap, h: baseWidth + gap };
10550
10551							var score = 0;
10552
10553							if (noOverlap) {
10554								for (var pp = 0; pp < placed.length; pp++) {
10555									if (rectsOverlap(candS, placed[pp])) { score -= 1000; break; }
10556								}
10557							}
10558
10559							if (rectsOverlap(candS, safeRect)) score -= 500;
10560
10561							var sx = safeRect.x + safeRect.w / 2;
10562							var sy = safeRect.y + safeRect.h / 2;
10563							var dxs = (rxS - sx);
10564							var dys = (ryS - sy);
10565							score += Math.sqrt(dxs * dxs + dys * dys);
10566
10567							if (score > best.score) best = { x: rxS, y: ryS, score: score };
10568						}
10569
10570						baseX = best.x;
10571						baseY = best.y;
10572
10573						if (noOverlap) {
10574							if (isBadCandidate(baseX, baseY)) {
10575								placedOk = false;
10576							}
10577						}
10578
10579					} else {
10580						if (noOverlap || safeRect) {
10581							placedOk = false;
10582
10583							for (var a = 0; a < attempts; a++) {
10584								var rx = baseCellX + (Math.random() * cellW);
10585								var ry = baseCellY + (Math.random() * cellH);
10586
10587								if (safeRect && safeMode === "avoid") {
10588									var cx = rx + (baseWidth / 2);
10589									var cy = ry + (baseWidth / 2);
10590									if (cx >= safeRect.x && cx <= safeRect.x + safeRect.w &&
10591										cy >= safeRect.y && cy <= safeRect.y + safeRect.h) {
10592										continue;
10593									}
10594								}
10595
10596								var cand = { x: rx, y: ry, w: baseWidth + gap, h: baseWidth + gap };
10597
10598								var collides = false;
10599								if (noOverlap) {
10600									for (var p = 0; p < placed.length; p++) {
10601										if (rectsOverlap(cand, placed[p])) { collides = true; break; }
10602									}
10603								}
10604
10605								if (!collides) {
10606									baseX = rx;
10607									baseY = ry;
10608									placed.push(cand);
10609									placedOk = true;
10610									break;
10611								}
10612							}
10613
10614							if (!placedOk) continue;
10615						}
10616					}
10617
10618					if (noOverlap && placedOk) {
10619						placed.push({ x: baseX, y: baseY, w: baseWidth + gap, h: baseWidth + gap });
10620					}
10621
10622					var rnd = Math.random();
10623					var tDepth = depthEnabled ? rnd : 0;
10624
10625					var tScale = depthEnabled ? (1 - tDepth) : Math.random();
10626					tScale = clamp01(tScale);
10627
10628					var scale = lerp(scaleMin, scaleMax, tScale);
10629
10630					var moveFactor = depthEnabled ? lerp(1, 0.25, tDepth) : 1;
10631
10632					var opacity = depthEnabled
10633						? lerp(opacityMax, opacityMin, tDepth)
10634						: lerp(opacityMin, opacityMax, Math.random());
10635
10636					var blur = 0;
10637					if (enableBlur) {
10638						blur = depthEnabled
10639							? lerp(blurMin, blurMax, tDepth)
10640							: lerp(blurMin, blurMax, Math.random());
10641					}
10642
10643					var tZ = depthEnabled
10644						? (1 - tDepth)
10645						: ((scaleMax === scaleMin) ? 1 : (scale - scaleMin) / (scaleMax - scaleMin));
10646					tZ = clamp01(tZ);
10647
10648					el.style.zIndex = zIndexBase + Math.round(zIndexRange * tZ);
10649
10650					var rot = 0;
10651					if (enableRotation) {
10652						rot = gsap.utils.random(-rotationRange, rotationRange, 0.1);
10653					}
10654
10655					gsap.set(el, {
10656						x: baseX,
10657						y: baseY,
10658						scale: scale,
10659						rotation: rot,
10660						opacity: opacity,
10661						filter: enableBlur ? "blur(" + blur.toFixed(2) + "px)" : "none"
10662					});
10663
10664					items.push({
10665						el: el,
10666						baseX: baseX,
10667						baseY: baseY,
10668						moveFactor: moveFactor
10669					});
10670
10671					frag.appendChild(el);
10672				}
10673
10674				renderArea.appendChild(frag);
10675			}
10676
10677			buildLayout();
10678
10679			function onMove(e) {
10680
10681				var rect = hoverArea.getBoundingClientRect();
10682				if (!rect.width || !rect.height) return;
10683
10684				var nx = (e.clientX - rect.left - rect.width / 2) / (rect.width / 2);
10685				var ny = (e.clientY - rect.top  - rect.height / 2) / (rect.height / 2);
10686
10687				for (var i = 0; i < items.length; i++) {
10688					var it = items[i];
10689
10690					var dx = -nx * moveX * it.moveFactor;
10691					var dy = -ny * moveY * it.moveFactor;
10692
10693					gsap.to(it.el, {
10694						x: it.baseX + dx,
10695						y: it.baseY + dy,
10696						duration: easeDur,
10697						ease: ease,
10698						overwrite: true
10699					});
10700				}
10701			}
10702
10703			function onScroll() {
10704
10705				if (!enableScrollMotion) return;
10706
10707				var rect = hoverArea.getBoundingClientRect();
10708				var vh = window.innerHeight || document.documentElement.clientHeight;
10709
10710				if (!rect.height) return;
10711
10712				// completamente fuori
10713				if (rect.bottom <= 0 || rect.top >= vh) {
10714					for (var k = 0; k < items.length; k++) {
10715						var it0 = items[k];
10716						gsap.to(it0.el, {
10717							x: it0.baseX,
10718							y: it0.baseY,
10719							duration: easeLeave,
10720							ease: ease,
10721							overwrite: true
10722						});
10723					}
10724					return;
10725				}
10726
10727				var travel = vh + rect.height;
10728				var progress = (vh - rect.top) / travel;
10729
10730				if (progress < 0) progress = 0;
10731				if (progress > 1) progress = 1;
10732
10733				var ny = progress * 2 - 1;
10734				var nx = ny * 0.35;
10735
10736				for (var i = 0; i < items.length; i++) {
10737					var it = items[i];
10738
10739					var dx = -nx * moveX * 0.35 * it.moveFactor;
10740					var dy = -ny * moveY * 0.35 * it.moveFactor;
10741
10742					gsap.to(it.el, {
10743						x: it.baseX + dx,
10744						y: it.baseY + dy,
10745						duration: easeDur,
10746						ease: ease,
10747						overwrite: true
10748					});
10749				}
10750			}
10751
10752			function onLeave() {
10753				for (var i = 0; i < items.length; i++) {
10754					var it = items[i];
10755					gsap.to(it.el, {
10756						x: it.baseX,
10757						y: it.baseY,
10758						duration: easeLeave,
10759						ease: ease,
10760						overwrite: true
10761					});
10762				}
10763			}
10764
10765			var sizeObserver = null;
10766			var lastLayoutW = 0;
10767			var lastLayoutH = 0;
10768
10769			function updateLayoutSizeCache() {
10770				var r = renderArea.getBoundingClientRect();
10771				lastLayoutW = Math.round(r.width);
10772				lastLayoutH = Math.round(r.height);
10773			}
10774
10775			function shouldRebuildLayout() {
10776				var r = renderArea.getBoundingClientRect();
10777				var newW = Math.round(r.width);
10778				var newH = Math.round(r.height);
10779
10780				var dw = Math.abs(newW - lastLayoutW);
10781				var dh = Math.abs(newH - lastLayoutH);
10782
10783				// rebuild sempre se cambia la larghezza
10784				// sull'altezza, tollera micro-variazioni tipiche del browser mobile durante lo scroll
10785				var mustRebuild = dw > 1 || dh > 80;
10786
10787				if (mustRebuild) {
10788					lastLayoutW = newW;
10789					lastLayoutH = newH;
10790				}
10791
10792				return mustRebuild;
10793			}
10794
10795			updateLayoutSizeCache();
10796
10797			if ("ResizeObserver" in window) {
10798				sizeObserver = new ResizeObserver(function () {
10799					if (shouldRebuildLayout()) {
10800						buildLayout();
10801					}
10802					onScroll();
10803				});
10804				sizeObserver.observe(renderArea);
10805			}
10806
10807			hoverArea.addEventListener("mousemove", onMove);
10808			hoverArea.addEventListener("mouseleave", onLeave);
10809
10810			function onWindowResize() {
10811				if (shouldRebuildLayout()) {
10812					buildLayout();
10813				}
10814				onScroll();
10815			}
10816
10817			window.addEventListener("resize", onWindowResize);
10818			window.addEventListener("scroll", onScroll, { passive: true });
10819			onScroll();
10820			watchPosition();
10821
10822			return function () {
10823				hoverArea.removeEventListener("mousemove", onMove);
10824				hoverArea.removeEventListener("mouseleave", onLeave);
10825				window.removeEventListener("resize", onWindowResize);
10826				window.removeEventListener("scroll", onScroll);
10827
10828				if (sizeObserver) {
10829					sizeObserver.disconnect();
10830					sizeObserver = null;
10831				}
10832
10833				watchActive = false;
10834				if (rafWatch) {
10835					cancelAnimationFrame(rafWatch);
10836					rafWatch = 0;
10837				}
10838				
10839				clearAll();
10840			};
10841
10842		}
10843
10844		var destroyers = [];
10845
10846		var areas = document.querySelectorAll(".uncode-bg-magnetic");
10847		for (var n = 0; n < areas.length; n++) {
10848			var renderArea = areas[n];
10849
10850			if (renderArea.__magneticDestroy && typeof renderArea.__magneticDestroy === "function") {
10851				try { renderArea.__magneticDestroy(); } catch (e) {}
10852				renderArea.__magneticDestroy = null;
10853			}
10854
10855			var hoverArea = renderArea.closest
10856				? renderArea.closest('.vc_row[data-parent="true"]')
10857				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10858
10859			if (!hoverArea) continue;
10860
10861			var images = getMagneticImagesFromArea(renderArea);
10862			if (!images.length) continue;
10863
10864			function cssLengthToPx(value, el, fallback) {
10865				if (value == null) return fallback;
10866
10867				if (typeof value === "number") return isFinite(value) ? value : fallback;
10868
10869				var s = String(value).trim();
10870				if (!s) return fallback;
10871
10872				var n = parseFloat(s.replace(",", "."));
10873				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10874
10875				var probe = document.createElement("div");
10876				probe.style.position = "absolute";
10877				probe.style.visibility = "hidden";
10878				probe.style.pointerEvents = "none";
10879				probe.style.width = s;
10880				probe.style.height = "0";
10881
10882				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10883				parent.appendChild(probe);
10884
10885				var px = probe.getBoundingClientRect().width;
10886				parent.removeChild(probe);
10887
10888				return (px && isFinite(px)) ? px : fallback;
10889			}
10890
10891			var rawMin = getDataFromArea(renderArea, "min-width", "100px");
10892			var rawMax = getDataFromArea(renderArea, "max-width", "300px");
10893
10894			var minW = cssLengthToPx(rawMin, renderArea, 100);
10895			var maxW = cssLengthToPx(rawMax, renderArea, 300);
10896			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
10897
10898			var scaleMin = (maxW > 0) ? (minW / maxW) : 1;
10899
10900			var rawMoveX = getDataFromArea(renderArea, "move-x", "400px");
10901			var rawMoveY = getDataFromArea(renderArea, "move-y", "300px");
10902			var rawSpillX = getDataFromArea(renderArea, "spill-x", null);
10903			var rawSpillY = getDataFromArea(renderArea, "spill-y", null);
10904
10905			if (rawSpillX == null || rawSpillX === "") {
10906				if (typeof rawMoveX === "number") rawSpillX = rawMoveX / 2;
10907				else rawSpillX = "calc((" + rawMoveX + ") / 2)";
10908			}
10909
10910			if (rawSpillY == null || rawSpillY === "") {
10911				if (typeof rawMoveY === "number") rawSpillY = rawMoveY / 2;
10912				else rawSpillY = "calc((" + rawMoveY + ") / 2)";
10913			}
10914
10915			renderArea.__magneticDestroy = initMagneticPattern({
10916				area: renderArea,
10917				hoverArea: hoverArea,
10918				images: images,
10919
10920				count: toNumber(getDataFromArea(renderArea, "count", 16), 16),
10921
10922				padding: 27,
10923				jitter: 0.35,
10924
10925				moveX: rawMoveX,
10926				moveY: rawMoveY,
10927				spillX: rawSpillX,
10928				spillY: rawSpillY,
10929
10930				easeDur: 0.7,
10931				easeLeave: 1.7,
10932				ease: "power3.out",
10933
10934				opacityMin: toNumber(getDataFromArea(renderArea, "min-opacity", 0.25), 0.25),
10935				opacityMax: toNumber(getDataFromArea(renderArea, "max-opacity", 1), 1),
10936
10937				zIndexBase: 1,
10938				zIndexRange: 30,
10939
10940				enableRotation: false,
10941				rotationRange: 8,
10942
10943				enableBlur: String(getDataFromArea(renderArea, "blur", "no")) === "yes",
10944				blurMin: 0,
10945				blurMax: 1.5,
10946
10947				baseWidth: maxW,
10948				scaleMin: scaleMin,
10949				scaleMax: 1,
10950
10951				flatDepth: String(getDataFromArea(renderArea, "depth", "no")) !== "yes",
10952
10953				noOverlap: String(getDataFromArea(renderArea, "no-overlap", "no")) === "yes",
10954				attempts: toNumber(getDataFromArea(renderArea, "attempts", 120), 120),
10955				gap: toNumber(getDataFromArea(renderArea, "gap", 8), 8),
10956
10957				depthMin: 0.25,
10958				depthMax: 1.0,
10959
10960				unique: String(getDataFromArea(renderArea, "unique", "no")) === "yes",
10961
10962				safeW: toNumber(getDataFromArea(renderArea, "safe-w", 0), 0),
10963				safeH: toNumber(getDataFromArea(renderArea, "safe-h", 0), 0),
10964				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10965
10966				scrollMotion: String(getDataFromArea(renderArea, "stop-scroll", "no")) !== "yes",
10967			}) || null;
10968
10969			if (renderArea.__magneticDestroy) {
10970				destroyers.push(renderArea.__magneticDestroy);
10971			}
10972		}
10973
10974		__globalDestroy = function () {
10975			for (var i = 0; i < destroyers.length; i++) {
10976				try { destroyers[i](); } catch (e) {}
10977			}
10978			destroyers.length = 0;
10979		};
10980
10981	};
10982
10983})();
10984UNCODE.thumbDrop = (function () {
10985
10986	"use strict";
10987
10988	var __globalDestroy = null;
10989
10990	return function () {
10991
10992		if (!window.Matter) return;
10993
10994		if (typeof __globalDestroy === "function") {
10995			try { __globalDestroy(); } catch (e) {}
10996			__globalDestroy = null;
10997		}
10998
10999		var Engine = Matter.Engine;
11000		var World  = Matter.World;
11001		var Bodies = Matter.Bodies;
11002		var Body   = Matter.Body;
11003		var Mouse  = Matter.Mouse;
11004		var MouseConstraint = Matter.MouseConstraint;
11005
11006		function getDropImagesFromArea(area) {
11007			var node = area.querySelector("script.drop-images");
11008			if (!node) return [];
11009			var json = node.textContent || node.innerText || "[]";
11010			try { return JSON.parse(json); } catch (e) { return []; }
11011		}
11012
11013		function matchesSelector(el, selector) {
11014			var p = Element.prototype;
11015			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
11016			if (!fn) return false;
11017			return fn.call(el, selector);
11018		}
11019
11020		function closestPolyfill(el, selector) {
11021			while (el && el.nodeType === 1) {
11022				if (matchesSelector(el, selector)) return el;
11023				el = el.parentNode;
11024			}
11025			return null;
11026		}
11027
11028		function debounce(fn, wait) {
11029			var t = null;
11030			return function () {
11031				var ctx = this;
11032				var args = arguments;
11033				clearTimeout(t);
11034				t = setTimeout(function () { fn.apply(ctx, args); }, wait);
11035			};
11036		}
11037
11038		function clamp(v, a, b) {
11039			return v < a ? a : (v > b ? b : v);
11040		}
11041
11042		function toNumber(value, fallback) {
11043			if (value == null) return fallback;
11044			var s = String(value).trim();
11045			if (!s) return fallback;
11046			s = s.replace(",", ".");
11047			var m = s.match(/-?\d+(\.\d+)?/);
11048			if (!m) return fallback;
11049			var n = parseFloat(m[0]);
11050			return isFinite(n) ? n : fallback;
11051		}
11052
11053		function cssLengthToPx(value, el, fallback) {
11054			if (value == null) return fallback;
11055
11056			if (typeof value === "number") return isFinite(value) ? value : fallback;
11057
11058			var s = String(value).trim();
11059			if (!s) return fallback;
11060
11061			var n = parseFloat(s.replace(",", "."));
11062			if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
11063
11064			var probe = document.createElement("div");
11065			probe.style.position = "absolute";
11066			probe.style.visibility = "hidden";
11067			probe.style.pointerEvents = "none";
11068			probe.style.width = "0";
11069			probe.style.height = "0";
11070
11071			var parent = (el && el.parentNode) ? el.parentNode : document.body;
11072			parent.appendChild(probe);
11073
11074			probe.style.width = s;
11075			var px = probe.getBoundingClientRect().width;
11076
11077			parent.removeChild(probe);
11078
11079			if (!px || !isFinite(px)) return fallback;
11080			return px;
11081		}
11082
11083		function getDataFromArea(area, key, fallback) {
11084			if (!area || !key) return fallback;
11085
11086			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
11087			var raw = area.getAttribute(attr);
11088			if (raw == null) return fallback;
11089
11090			raw = String(raw).trim();
11091
11092			if (raw === "true") return true;
11093			if (raw === "false") return false;
11094			if (raw === "null") return null;
11095
11096			var num = raw.replace(",", ".");
11097			if (num !== "" && isFinite(num)) return parseFloat(num);
11098
11099			if (
11100				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
11101				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
11102			) {
11103				try { return JSON.parse(raw); } catch (e) {}
11104			}
11105
11106			return raw;
11107		}
11108
11109		function raf2(cb) {
11110			requestAnimationFrame(function () {
11111				requestAnimationFrame(function () {
11112					cb();
11113				});
11114			});
11115		}
11116
11117		function normalizeDragMode(v) {
11118			if (v == null) return "";
11119			if (v === true) return "drag";
11120			var s = String(v).trim().toLowerCase();
11121			if (!s) return "";
11122			if (s === "1" || s === "yes" || s === "true") return "drag";
11123			if (s === "drag" || s === "hover") return s;
11124			return "";
11125		}
11126
11127		function initMatterDrop(options) {
11128			options = options || {};
11129
11130			var area    = options.area;
11131			var surface = options.surface;
11132			var images  = options.images || [];
11133
11134			var maxAvailable = images.length;
11135			var duplicateImages = options.duplicateImages !== false;
11136			var count = options.count != null ? options.count : Math.min(18, maxAvailable);
11137
11138			if (!duplicateImages && count > maxAvailable) {
11139				count = maxAvailable;
11140			}
11141
11142			var sizeMin    = options.sizeMin != null ? options.sizeMin : 140;
11143			var sizeMax    = options.sizeMax != null ? options.sizeMax : 260;
11144			var spawnEvery = options.spawnEvery != null ? options.spawnEvery : 160;
11145			var startDelay = options.startDelay != null ? options.startDelay : 0;
11146
11147			var gravityY    = options.gravityY != null ? options.gravityY : 1.25;
11148			var restitution = options.restitution != null ? options.restitution : 0.35;
11149			var frictionAir = options.frictionAir != null ? options.frictionAir : 0.02;
11150			var friction    = options.friction != null ? options.friction : 0.25;
11151			var density     = options.density != null ? options.density : 0.001;
11152
11153			var wallThickness = options.wallThickness != null ? options.wallThickness : 80;
11154			var floorPadding  = options.floorPadding != null ? options.floorPadding : 0;
11155
11156			var rotateRange = options.rotateRange != null ? options.rotateRange : 18;
11157
11158			var once       = options.once !== false;
11159			var threshold  = options.threshold != null ? options.threshold : 0.25;
11160			var rootMargin = options.rootMargin || "0px 0px -10% 0px";
11161
11162			var dragMode = normalizeDragMode(options.enableDrag);
11163			var enableDrag = dragMode === "drag";
11164			var enableHoverRepel = dragMode === "hover";
11165
11166			var dragStiffness = options.dragStiffness != null ? options.dragStiffness : 0.18;
11167			var dragDamping   = options.dragDamping != null ? options.dragDamping : 0.06;
11168
11169			var hoverRadius = options.hoverRadius != null ? options.hoverRadius : 260;
11170			var spawnXMode = String(options.spawnXMode || "random").toLowerCase();
11171			var spawnXFixed = options.spawnXFixed != null ? options.spawnXFixed : 50;
11172			var spawnXJitter = options.spawnXJitter != null ? options.spawnXJitter : 0;	
11173
11174			if (!area || !surface || !images.length) return null;
11175
11176			var cs = window.getComputedStyle(area);
11177			if (cs.position === "static") area.style.position = "absolute";
11178			if (!area.style.left) area.style.left = "0";
11179			if (!area.style.top) area.style.top = "0";
11180			if (!area.style.width) area.style.width = "100%";
11181			if (!area.style.height) area.style.height = "100%";
11182
11183			area.style.pointerEvents = enableDrag ? "auto" : "none";
11184
11185			var engine = Engine.create();
11186			engine.enableSleeping = false;
11187			engine.gravity.y = gravityY;
11188
11189			var alive = true;
11190			var started = false;
11191
11192			var bounds = { w: 0, h: 0 };
11193			var walls = null;
11194			var items = [];
11195
11196			var spawnTimer = null;
11197			var spawned = 0;
11198
11199			var ro = null;
11200			var pollTimer = null;
11201			var lastW = 0;
11202			var lastH = 0;
11203
11204			var mouseConstraint = null;
11205
11206			var rafId = 0;
11207			var io = null;
11208			var scrollHandler = null;
11209			var dragMousemoveHandler = null;
11210
11211			var hoverMoveHandler = null;
11212			var hoverLeaveHandler = null;
11213			var hoverX = null;
11214			var hoverY = null;
11215			var hoverActive = false;
11216
11217			function updateRects() {
11218				bounds.w = area.offsetWidth;
11219				bounds.h = area.offsetHeight;
11220			}
11221
11222			function removeWalls() {
11223				if (!walls) return;
11224				World.remove(engine.world, walls.floor);
11225				World.remove(engine.world, walls.left);
11226				World.remove(engine.world, walls.right);
11227				walls = null;
11228			}
11229
11230			function createWalls() {
11231				updateRects();
11232
11233				var w = bounds.w;
11234				var h = bounds.h;
11235				if (!w || !h) return false;
11236
11237				var t = wallThickness;
11238				var floorY = h + t * 0.5 + floorPadding;
11239
11240				var floor = Bodies.rectangle(w * 0.5, floorY, w + t * 2, t, { isStatic: true, restitution: 0, friction: 1 });
11241				var left  = Bodies.rectangle(-t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11242				var right = Bodies.rectangle(w + t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11243
11244				walls = { floor: floor, left: left, right: right };
11245				World.add(engine.world, [floor, left, right]);
11246
11247				return true;
11248			}
11249
11250			function setTransform(el, x, y, a) {
11251				el.style.transform = "translate3d(" + x + "px," + y + "px,0) rotate(" + a + "deg)";
11252			}
11253
11254			function preloadAll(list) {
11255				for (var i = 0; i < list.length; i++) {
11256					var im = new Image();
11257					im.src = list[i];
11258				}
11259			}
11260
11261			function recalcSpawnSizes() {
11262				if (!options.rawMin && !options.rawMax) return;
11263
11264				var newMin = cssLengthToPx(options.rawMin, area, sizeMin);
11265				var newMax = cssLengthToPx(options.rawMax, area, sizeMax);
11266
11267				if (newMax < newMin) { var t = newMin; newMin = newMax; newMax = t; }
11268
11269				sizeMin = newMin;
11270				sizeMax = newMax;
11271			}
11272
11273			function setupDrag() {
11274				if (!enableDrag || !Mouse || !MouseConstraint) return;
11275
11276				var mouse = Mouse.create(area);
11277				mouse.pixelRatio = 1;
11278
11279				mouseConstraint = MouseConstraint.create(engine, {
11280					mouse: mouse,
11281					constraint: {
11282						stiffness: dragStiffness,
11283						damping: dragDamping,
11284						render: { visible: false }
11285					}
11286				});
11287
11288				World.add(engine.world, mouseConstraint);
11289
11290				dragMousemoveHandler = function () {
11291					mouse.offset.x = 0;
11292					mouse.offset.y = 0;
11293				};
11294				area.addEventListener("mousemove", dragMousemoveHandler);
11295
11296				area.style.userSelect = "none";
11297				area.style.webkitUserSelect = "none";
11298			}
11299
11300			function setupHoverRepel() {
11301				if (!enableHoverRepel) return;
11302
11303				area.style.pointerEvents = "auto";
11304
11305				hoverMoveHandler = function (e) {
11306					var r = area.getBoundingClientRect();
11307					hoverX = e.clientX - r.left;
11308					hoverY = e.clientY - r.top;
11309
11310					hoverActive = true;
11311				};
11312
11313				hoverLeaveHandler = function () {
11314					hoverActive = false;
11315					hoverX = null;
11316					hoverY = null;
11317				};
11318
11319				area.addEventListener("mousemove", hoverMoveHandler);
11320				area.addEventListener("mouseleave", hoverLeaveHandler);
11321			}
11322
11323			function getSpawnX(w) {
11324				var minX = w * 0.5;
11325				var maxX = Math.max(minX, bounds.w - w * 0.5);
11326
11327				if (spawnXMode === "fixed") {
11328					var pct = clamp(spawnXFixed, 0, 100) / 100;
11329					var baseX = minX + (maxX - minX) * pct;
11330
11331					if (spawnXJitter > 0) {
11332						var jitterPx = (bounds.w * spawnXJitter / 100) * (Math.random() - 0.5);
11333						baseX += jitterPx;
11334					}
11335
11336					return clamp(baseX, minX, maxX);
11337				}
11338
11339				if (spawnXMode === "sequence") {
11340					var total = Math.max(1, count);
11341
11342					if (total === 1) {
11343						return (minX + maxX) * 0.5;
11344					}
11345
11346					var progress = duplicateImages
11347						? ((spawned % total) / (total - 1))
11348						: (spawned / Math.max(1, total - 1));
11349
11350					return minX + (maxX - minX) * progress;
11351				}
11352
11353				return minX + Math.random() * Math.max(0, maxX - minX);
11354			}
11355
11356			function spawnOne() {
11357				if (!alive) return;
11358				if (spawned >= count) return;
11359
11360				updateRects();
11361				if (!bounds.w || !bounds.h) return;
11362
11363				if (!duplicateImages && spawned >= images.length) return;
11364
11365				var src = duplicateImages
11366					? images[spawned % images.length]
11367					: images[spawned];
11368
11369				var w = Math.round(Matter.Common.random(sizeMin, sizeMax));
11370				var x = getSpawnX(w);
11371
11372				var img = new Image();
11373				img.onload = function () {
11374					if (!alive) return;
11375
11376					var css = getComputedStyle(area);
11377					var ratioVar = (css.getPropertyValue("--bgm-ratio") || "").trim();
11378					var ratio = null;
11379
11380					if (ratioVar) {
11381						var parts = ratioVar.split("/");
11382						if (parts.length === 2) {
11383							var rw = parseFloat(parts[0]);
11384							var rh = parseFloat(parts[1]);
11385							if (rw > 0 && rh > 0) ratio = rh / rw;
11386						}
11387					}
11388
11389					var r = ratio;
11390					if (!r) {
11391						if (img.naturalWidth && img.naturalHeight) r = img.naturalHeight / img.naturalWidth;
11392						else r = 1;
11393					}
11394
11395					var h = Math.max(20, Math.round(w * r));
11396
11397					var startY = -(h + 300);
11398
11399					var el = document.createElement("img");
11400					el.className = "drop-img";
11401					el.setAttribute("src", src);
11402					el.style.width = w + "px";
11403					el.style.height = h + "px";
11404					el.style.position = "absolute";
11405					el.style.left = "0";
11406					el.style.top = "0";
11407					el.style.willChange = "transform";
11408					el.style.pointerEvents = "none";
11409					el.style.userSelect = "none";
11410
11411					el.style.opacity = "0";
11412
11413					setTransform(el, x - w * 0.5, startY - h * 0.5, 0);
11414
11415					area.appendChild(el);
11416
11417					var body = Bodies.rectangle(x, startY, w, h, {
11418						restitution: restitution,
11419						frictionAir: frictionAir,
11420						friction: friction,
11421						density: density
11422					});
11423
11424					Body.setVelocity(body, {
11425						x: (Math.random() - 0.5) * 4,
11426						y: Math.random() * 2
11427					});
11428
11429					World.add(engine.world, body);
11430					items.push({ el: el, body: body, w: w, h: h });
11431
11432					requestAnimationFrame(function () {
11433						el.style.opacity = "1";
11434					});
11435
11436					setTransform(el, body.position.x - w * 0.5, body.position.y - h * 0.5, body.angle * 180 / Math.PI);
11437				};
11438				img.onerror = function () {};
11439				img.src = src;
11440
11441				spawned++;
11442			}
11443
11444			function applyHoverRepel() {
11445
11446				if (!enableHoverRepel) return;
11447				if (!hoverActive || hoverX == null || hoverY == null) return;
11448
11449				var radius = hoverRadius;
11450				var r2 = radius * radius;
11451
11452				for (var i = 0; i < items.length; i++) {
11453
11454					var b = items[i].body;
11455
11456					var dx = b.position.x - hoverX;
11457					var dy = b.position.y - hoverY;
11458
11459					var d2 = dx * dx + dy * dy;
11460					if (d2 > r2 || d2 < 0.001) continue;
11461
11462					var d = Math.sqrt(d2);
11463
11464					var nx = dx / d;
11465					var ny = dy / d;
11466
11467					var strength = (1 - d / radius) * 25;
11468
11469					Body.setVelocity(b, {
11470						x: b.velocity.x + nx * strength,
11471						y: b.velocity.y + ny * strength - strength * 0.6
11472					});
11473
11474					for (var j = 0; j < items.length; j++) {
11475
11476						if (i === j) continue;
11477
11478						var nb = items[j].body;
11479
11480						var ddx = nb.position.x - b.position.x;
11481						var ddy = nb.position.y - b.position.y;
11482
11483						var dist = Math.sqrt(ddx * ddx + ddy * ddy);
11484
11485						if (dist < 120 && dist > 0.001) {
11486
11487							var nnx = ddx / dist;
11488							var nny = ddy / dist;
11489
11490							Body.setVelocity(nb, {
11491								x: nb.velocity.x + nnx * 2,
11492								y: nb.velocity.y + nny * 2
11493							});
11494
11495						}
11496					}
11497				}
11498			}
11499
11500			function tick() {
11501				if (!alive) return;
11502
11503				applyHoverRepel();
11504
11505				if (mouseConstraint && mouseConstraint.body) {
11506					var dragged = mouseConstraint.body;
11507
11508					for (var di = 0; di < items.length; di++) {
11509						if (items[di].body === dragged) {
11510							var halfW = items[di].w * 0.5;
11511							var halfH = items[di].h * 0.5;
11512
11513							var clampedX = clamp(dragged.position.x, halfW + 2, bounds.w - halfW - 2);
11514							var clampedY = clamp(dragged.position.y, halfH + 2, bounds.h - halfH - 2);
11515
11516							if (clampedX !== dragged.position.x || clampedY !== dragged.position.y) {
11517								Body.setPosition(dragged, { x: clampedX, y: clampedY });
11518								Body.setVelocity(dragged, { x: 0, y: 0 });
11519							}
11520							break;
11521						}
11522					}
11523				}
11524	
11525				Engine.update(engine, 1000 / 60);
11526
11527				var sideLimit = Math.max(120, wallThickness * 1.5);
11528				var bottomLimit = bounds.h + Math.max(160, wallThickness * 1.5);
11529
11530				for (var i = 0; i < items.length; i++) {
11531					var it0 = items[i];
11532					var b0 = it0.body;
11533
11534					var halfW = it0.w * 0.5;
11535					var halfH = it0.h * 0.5;
11536
11537					var minX = halfW + 2;
11538					var maxX = bounds.w - halfW - 2;
11539					var rescueY = Math.max(halfH + 2, 20);
11540					var floorY = bounds.h - halfH - 2;
11541
11542					var outLeft = b0.position.x < -sideLimit;
11543					var outRight = b0.position.x > bounds.w + sideLimit;
11544					var outBottom = b0.position.y > bottomLimit;
11545
11546					if (outLeft || outRight || outBottom) {
11547						var safeX = clamp(b0.position.x, minX, maxX);
11548						var safeY = clamp(b0.position.y, rescueY, floorY);
11549
11550						if (outBottom) safeY = floorY;
11551
11552						Body.setPosition(b0, { x: safeX, y: safeY });
11553						Body.setVelocity(b0, { x: 0, y: 0 });
11554						Body.setAngularVelocity(b0, 0);
11555					}
11556				}
11557
11558				for (var j = 0; j < items.length; j++) {
11559					var it = items[j];
11560					var b = it.body;
11561					setTransform(it.el, b.position.x - it.w * 0.5, b.position.y - it.h * 0.5, b.angle * 180 / Math.PI);
11562				}
11563
11564				rafId = requestAnimationFrame(tick);
11565			}
11566
11567			function resetToNewSize() {
11568				if (!started) return;
11569
11570				removeWalls();
11571				if (!createWalls()) return;
11572
11573				updateRects();
11574
11575				var w = bounds.w;
11576				var h = bounds.h;
11577
11578				for (var i = 0; i < items.length; i++) {
11579					var it = items[i];
11580					var bw = it.w;
11581					var bh = it.h;
11582
11583					var px = clamp(it.body.position.x, bw * 0.5 + 2, w - bw * 0.5 - 2);
11584					var py = clamp(it.body.position.y, -2000, h - bh * 0.5 - 2);
11585					Body.setPosition(it.body, { x: px, y: py });
11586				}
11587			}
11588
11589			function startSizeObserver() {
11590				updateRects();
11591				lastW = bounds.w;
11592				lastH = bounds.h;
11593
11594				if ("ResizeObserver" in window) {
11595					ro = new ResizeObserver(function () {
11596						raf2(function () {
11597							updateRects();
11598							if (bounds.w !== lastW || bounds.h !== lastH) {
11599								lastW = bounds.w;
11600								lastH = bounds.h;
11601								resetToNewSize();
11602							}
11603						});
11604					});
11605					ro.observe(area);
11606					return;
11607				}
11608
11609				pollTimer = setInterval(function () {
11610					updateRects();
11611					if (bounds.w !== lastW || bounds.h !== lastH) {
11612						lastW = bounds.w;
11613						lastH = bounds.h;
11614						resetToNewSize();
11615					}
11616				}, 200);
11617			}
11618
11619			function stopSizeObserver() {
11620				if (ro) { ro.disconnect(); ro = null; }
11621				if (pollTimer) { clearInterval(pollTimer); pollTimer = null; }
11622			}
11623
11624			function startSpawning() {
11625				if (!alive) return;
11626				if (started) return;
11627
11628				var tries = 0;
11629				var stable = 0;
11630				var prevW = 0;
11631				var prevH = 0;
11632
11633				function check() {
11634					if (!alive) return;
11635
11636					updateRects();
11637
11638					if (!bounds.w || !bounds.h) {
11639						tries++;
11640						if (tries < 40) setTimeout(check, 150);
11641						return;
11642					}
11643
11644					if (bounds.w === prevW && bounds.h === prevH) stable++;
11645					else {
11646						stable = 0;
11647						prevW = bounds.w;
11648						prevH = bounds.h;
11649					}
11650
11651					if (stable < 2) {
11652						setTimeout(check, 150);
11653						return;
11654					}
11655
11656					started = true;
11657
11658					removeWalls();
11659					if (!createWalls()) {
11660						started = false;
11661						setTimeout(check, 200);
11662						return;
11663					}
11664
11665					setupDrag();
11666					setupHoverRepel();
11667					tick();
11668
11669					var start = function () {
11670						spawnOne();
11671						spawnTimer = setInterval(function () {
11672							if (!alive) return;
11673							if (spawned >= count) {
11674								clearInterval(spawnTimer);
11675								spawnTimer = null;
11676								return;
11677							}
11678							spawnOne();
11679						}, spawnEvery);
11680					};
11681
11682					if (startDelay > 0) setTimeout(start, startDelay);
11683					else start();
11684				}
11685
11686				check();
11687			}
11688
11689			function setupViewportTrigger() {
11690				if ("IntersectionObserver" in window) {
11691					io = new IntersectionObserver(function (entries) {
11692						for (var i = 0; i < entries.length; i++) {
11693							if (entries[i].isIntersecting) {
11694								startSpawning();
11695								if (once && io) { io.disconnect(); io = null; }
11696								break;
11697							}
11698						}
11699					}, { root: null, rootMargin: rootMargin, threshold: threshold });
11700
11701					io.observe(surface);
11702					return;
11703				}
11704
11705				scrollHandler = debounce(function () {
11706					var r = surface.getBoundingClientRect();
11707					var vh = window.innerHeight || document.documentElement.clientHeight;
11708					if (r.top < vh * 0.9 && r.bottom > vh * 0.1) {
11709						startSpawning();
11710						if (once && scrollHandler) {
11711							window.removeEventListener("scroll", scrollHandler);
11712							scrollHandler = null;
11713						}
11714					}
11715				}, 100);
11716
11717				window.addEventListener("scroll", scrollHandler);
11718				scrollHandler();
11719			}
11720
11721			recalcSpawnSizes();
11722			preloadAll(images);
11723			startSizeObserver();
11724			setupViewportTrigger();
11725
11726			return function destroy() {
11727				alive = false;
11728
11729				if (rafId) { cancelAnimationFrame(rafId); rafId = 0; }
11730
11731				stopSizeObserver();
11732
11733				if (io) { try { io.disconnect(); } catch (e) {} io = null; }
11734
11735				if (scrollHandler) {
11736					window.removeEventListener("scroll", scrollHandler);
11737					scrollHandler = null;
11738				}
11739
11740				if (spawnTimer) { clearInterval(spawnTimer); spawnTimer = null; }
11741
11742				if (dragMousemoveHandler) {
11743					area.removeEventListener("mousemove", dragMousemoveHandler);
11744					dragMousemoveHandler = null;
11745				}
11746
11747				if (hoverMoveHandler) {
11748					area.removeEventListener("mousemove", hoverMoveHandler);
11749					hoverMoveHandler = null;
11750				}
11751				if (hoverLeaveHandler) {
11752					area.removeEventListener("mouseleave", hoverLeaveHandler);
11753					hoverLeaveHandler = null;
11754				}
11755
11756				removeWalls();
11757
11758				if (mouseConstraint) {
11759					World.remove(engine.world, mouseConstraint);
11760					mouseConstraint = null;
11761				}
11762
11763				for (var i = 0; i < items.length; i++) {
11764					try { World.remove(engine.world, items[i].body); } catch (e) {}
11765					if (items[i].el && items[i].el.parentNode) items[i].el.parentNode.removeChild(items[i].el);
11766				}
11767				items.length = 0;
11768
11769				var nodes = area.querySelectorAll(".drop-img");
11770				for (var n = nodes.length - 1; n >= 0; n--) {
11771					if (nodes[n] && nodes[n].parentNode) nodes[n].parentNode.removeChild(nodes[n]);
11772				}
11773			};
11774		}
11775
11776		var destroyers = [];
11777
11778		var areas = document.querySelectorAll(".uncode-bg-drop");
11779		for (var n = 0; n < areas.length; n++) {
11780
11781			var renderArea = areas[n];
11782
11783			if (renderArea.__thumbDropDestroy && typeof renderArea.__thumbDropDestroy === "function") {
11784				try { renderArea.__thumbDropDestroy(); } catch (e) {}
11785				renderArea.__thumbDropDestroy = null;
11786			}
11787
11788			var surface = renderArea.closest
11789				? renderArea.closest('.vc_row[data-parent="true"]')
11790				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
11791
11792			if (!surface) continue;
11793
11794			var images = getDropImagesFromArea(renderArea);
11795			if (!images.length) continue;
11796
11797			var rawMin = getDataFromArea(renderArea, "min-width", "140px");
11798			var rawMax = getDataFromArea(renderArea, "max-width", "260px");
11799
11800			var minW = cssLengthToPx(rawMin, renderArea, 140);
11801			var maxW = cssLengthToPx(rawMax, renderArea, 260);
11802			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
11803
11804			renderArea.__thumbDropDestroy = initMatterDrop({
11805				area: renderArea,
11806				surface: surface,
11807				images: images,
11808
11809				rawMin: rawMin,
11810				rawMax: rawMax,
11811
11812				count: toNumber(getDataFromArea(renderArea, "count", 14), 14),
11813				duplicateImages: String(getDataFromArea(renderArea, "unique", "no")) !== "yes",
11814				sizeMin: minW,
11815				sizeMax: maxW,
11816
11817				spawnEvery: toNumber(getDataFromArea(renderArea, "interval", 160), 160),
11818				startDelay: toNumber(getDataFromArea(renderArea, "delay", 0), 0
11818),
11819
11820				gravityY: toNumber(getDataFromArea(renderArea, "gravity", 1.25), 1.25),
11821				restitution: toNumber(getDataFromArea(renderArea, "restitution", 0.35), 0.35),
11822				frictionAir: toNumber(getDataFromArea(renderArea, "friction-air", 0.02), 0.02),
11823				friction: toNumber(getDataFromArea(renderArea, "friction", 0.25), 0.25),
11824				density: toNumber(getDataFromArea(renderArea, "density", 0.001), 0.001),
11825
11826				wallThickness: toNumber(getDataFromArea(renderArea, "wall", 80), 80),
11827				floorPadding: toNumber(getDataFromArea(renderArea, "floor", 0), 0),
11828
11829				rotateRange: toNumber(getDataFromArea(renderArea, "rotate", 18), 18),
11830
11831				once: String(getDataFromArea(renderArea, "once", "yes")) !== "no",
11832				threshold: toNumber(getDataFromArea(renderArea, "threshold", 0.25), 0.25),
11833				rootMargin: String(getDataFromArea(renderArea, "root-margin", "0px 0px -10% 0px")),
11834
11835				enableDrag: String(getDataFromArea(renderArea, "interactive", "")),
11836
11837				dragStiffness: toNumber(getDataFromArea(renderArea, "drag-stiffness", 0.18), 0.18),
11838				dragDamping: toNumber(getDataFromArea(renderArea, "drag-damping", 0.06), 0.06),
11839
11840				hoverRadius: toNumber(getDataFromArea(renderArea, "hover-radius", 50), 50),
11841
11842				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11843				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11844				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11845				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11846				spawnXJitter: toNumber(getDataFromArea(renderArea, "spawn-x-jitter", 13), 13),
11847
11848			}) || null;
11849
11850			if (renderArea.__thumbDropDestroy) {
11851				destroyers.push(renderArea.__thumbDropDestroy);
11852			}
11853		}
11854
11855		__globalDestroy = function () {
11856			for (var i = 0; i < destroyers.length; i++) {
11857				try { destroyers[i](); } catch (e) {}
11858			}
11859			destroyers.length = 0;
11860		};
11861
11862	};
11863
11864})();
11865UNCODE.preventDoubleTransition = function() {
11866	$('.sticky-element .animate_when_almost_visible').each(function(){
11867		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
11868			$el.addClass('do_not_reanimate');
11869		});
11870	});
11871};
11872
11873UNCODE.checkScrollForTabs = function(){
11874	var goToSection = window.location.hash.replace('#', ''),
11875		$index;
11876
11877	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
11878	goToSection = encodeURIComponent(goToSection);
11879	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
11880
11881	$index.attr('data-parent', 'parent-' + goToSection);
11882
11883	if (window.location.hash != undefined && window.location.hash != '') {
11884		requestTimeout(function() {
11885			scrollBody('parent-' + goToSection);
11886		}, 500);
11887	}
11888
11889	$('.page-body a[href^="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
11890		var hash = (e.currentTarget).hash;
11891		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
11892			$('a[href="' + hash + '"][data-tab-history]').click();
11893			scrollBody(hash);
11894		}
11895	});
11896
11897	var scrollBody = function(index) {
11898
11899		var getSection = $('a[href="' + index + '"][data-tab-history]'),
11900			scrollTo,
11901			safeGap = 27;
11902
11903		if ( ! getSection.length ) {
11904			getSection = $('div[data-parent="' + index + '"]');
11905
11906			if ( getSection.attr('data-target') == 'row' ) {
11907				getSection = getSection.closest('.vc_row');
11908				safeGap = 0;
11909			}
11910		}
11911
11912		if (typeof getSection === 'undefined' || ! getSection.length ) {
11913			return;
11914		}
11915
11916		var body = $("html, body"),
11917		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
11918		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
11919		getOffset = UNCODE.get_scroll_offset();
11920		if ( typeof getSection.offset() === 'undefined' )
11921			return;
11922		scrollTo = getSection.offset().top - safeGap;
11923		scrollTo -= getOffset;
11924
11925		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
11926		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
11927
11928		if (index != 0) {
11929			UNCODE.scrolling = true;
11930		}
11931
11932		if (scrollSpeed == 0) {
11933			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
11934			UNCODE.scrolling = false;
11935		} else {
11936			body.animate({
11937				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
11938			}, scrollSpeed, 'easeInOutQuad', function() {
11939				requestTimeout(function() {
11940					UNCODE.scrolling = false;
11941					if (getOffset != UNCODE.get_scroll_offset()) {
11942						scrollBody(index);
11943					}
11944				}, 100);
11945			});
11946		}
11947
11948	};
11949};
11950
11951UNCODE.printScreen = function() {
11952	var inlineMediaStyle = null,
11953		setResize;
11954
11955    function changeMediaStyle() {
11956		clearRequestTimeout(setResize);
11957		setResize = requestTimeout(function(){
11958	        var $head = document.getElementsByTagName('head')[0],
11959	        	$newStyle = document.createElement('style'),
11960	        	winW = window.innerWidth,
11961	        	printH = window.innerHeight;
11962
11963	        $newStyle.setAttribute('type', 'text/css');
11964	        $newStyle.setAttribute('media', 'print');
11965	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
11966
11967	        if (inlineMediaStyle != null) {
11968	            $head.replaceChild($newStyle, inlineMediaStyle)
11969	        } else {
11970	            $head.appendChild($newStyle);
11971	        }
11972	        inlineMediaStyle = $newStyle;
11973	    }, 1000);
11974    }
11975
11976    changeMediaStyle();
11977    window.addEventListener('resize', changeMediaStyle);
11978};
11979
11980UNCODE.fullPage = function() {
11981	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
11982		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
11983		return false;
11984	} else {
11985		requestTimeout(function() {
11986			window.scrollTo(0, 0);
11987		}, 10);
11988	}
11989
11990	var $masthead = $('#masthead'),
11991		$logo = $('#logo-container-mobile'),
11992		$logolink = $('[data-minheight]', $logo),
11993		logoMinScale = $logolink.data('minheight'),
11994		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
11995		$container = $('.main-container .post-content'),
11996		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
11997		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
11998		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
11999		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
12000		headerWithOpacity = $('.header-scroll-opacity', $header).length,
12001		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
12002		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
12003		scrollBar = true,
12004		effect,
12005		animationEndTimeOut,
12006		fp_anim_time = 900,
12007		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
12008		is_scrolling = false,
12009		dataNames = [],
12010		is_first = true,
12011		no_history = $('body').hasClass('uncode-scroll-no-history'),
12012		theres_footer = true;
12013
12014	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
12015		$('> div', $footer).each(function(index, el){
12016			if ( $(el).outerHeight() < 2 )
12017				theres_footer = false;
12018			else
12019				theres_footer = true;
12020		});
12021	}
12022
12023	if ( !$footer.length )
12024		theres_footer = false;
12025
12026	if ( !UNCODE.isFullPageSnap ) {
12027
12028		if ( $('body').hasClass('uncode-fullpage-zoom') )
12029			effect = 'scaleDown';
12030		else if ( $('body').hasClass('uncode-fullpage-parallax') )
12031			effect = 'moveparallax';
12032		else
12033			effect = 'movecurtain';
12034	}
12035
12036	if ( $('body').hasClass('uncode-fullpage-trid') )
12037		fp_anim_time = fp_anim_time*2;
12038
12039	if ( $header.length ) {
12040		if ( headerName !== '' )
12041			$header.attr('data-name', headerName);
12042		if ( headerLabel !== '' )
12043			$header.attr('data-label', headerLabel);
12044		$container.prepend($header);
12045	}
12046	if ( theres_footer ) {
12047		$container.append($footer);
12048		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
12049		$('aside.widget ul', $footer).addClass('no-list');
12050	}
12051
12052	var $all = $rows.add($header);
12053
12054	if ( theres_footer )
12055		$all = $all.add($footer);
12056
12057	$all.each(function(index, row) {
12058		if( index === 0 )
12059			$(row).addClass('uncode-scroll-active');
12060	});
12061
12062    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
12063
12064	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
12065		$("<ul class='onepage-pagination'></ul>").prependTo("body");
12066	}
12067
12068	$all.each(function(index, val) {
12069		var getName = $(val).data('name'),
12070			label;
12071
12072		if (typeof getName == 'undefined' || getName == 'undefined')
12073			getName = SiteParameters.slide_name + '-' + index;
12074
12075		//if ( dataNames.includes(getName) ) {
12076		if ( dataNames.indexOf(getName) > 0 ) {
12077			getName += '_' + index;
12078			$(val).data('name', getName);
12079		}
12080
12081		dataNames.push(getName);
12082
12083		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
12084
12085		if (typeof $(val).attr('data-label') !== 'undefined')
12086			label = $(val).attr('data-label');
12087		else label = '';
12088
12089		if ( $(val).is($footer) )
12090			return;
12091
12092		if (label != '' ) {
12093			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
12094			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
12095		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
12096			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + SiteParameters.uncode_one_dot_label + " " + index + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
12097		}
12098	});
12099
12100	var checkVisible = function( el, off ) {
12101		if (typeof jQuery === "function" && el instanceof jQuery) {
12102			el = el[0];
12103		}
12104
12105		off = typeof off=='undefined' ? 50 : off;
12106
12107		var rect = el.getBoundingClientRect();
12108
12109		return (
12110			(
12111				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12112				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12113				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
12114			)
12115		);
12116	};
12117
12118	var animationEndAction = function( index, nextIndex ) {
12119		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12120			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12121			player, iframe;
12122
12123		if ( !$nextSlide.is($footer) ) {
12124			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
12125		}
12126
12127		if ( !UNCODE.isFullPageSnap ) {
12128			activateKBurns( nextIndex );
12129		}
12130
12131		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12132			if ($(this).attr('data-provider') == 'vimeo') {
12133				iframe = $(this).find('iframe');
12134				player = new Vimeo.Player(iframe[0]);
12135				player.pause();
12136			} else if ($(this).attr('data-provider') == 'youtube') {
12137				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12138			} else {
12139				if ($(this).is('video')) {
12140					$(this)[0].volume = 0;
12141					$(this)[0].pause();
12142				}
12143			}
12144		});
12145
12146		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12147			if ( $nextSlide.is($header) )
12148				$header.removeClass('header-scrolled');
12149		}
12150
12151		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
12152		$otherEl.each(function(){
12153			var $otherThis = $(this),
12154				$bgwrapperOther = $('.background-inner', $otherThis);
12155			if ( !checkVisible($otherThis) )
12156				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
12157
12158		});
12159
12160		if ( !checkVisible($currentSlide) ) {
12161			$currentSlide.removeClass('uncode-scroll-visible');
12162			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
12163			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
12164				currentScroll.scrollTo(0, 0, 0);
12165		}
12166
12167		clearRequestTimeout(animationEndTimeOut);
12168		animationEndTimeOut = requestTimeout(function(){
12169			Waypoint.refreshAll();
12170			$( document.body ).trigger('uncode_waypoints');
12171			var eventFP = new CustomEvent('fp-slide-changed');
12172			window.dispatchEvent(eventFP);
12173			is_scrolling = false;
12174
12175			if ( is_first ) {
12176				$('ul.onepage-pagination a').removeClass('is-selected');
12177				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12178				is_first = false;
12179			}
12180
12181		}, 500);
12182	};
12183
12184	var postLeaveActions = function( nextIndex ){
12185		if ( menuHidden && ! UNCODE.isMobile )
12186			return false;
12187
12188		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12189			$cols = $('.uncol', $el),
12190			anchor = $el.data('anchor');
12191
12192		if ( ! UNCODE.isFullPageSnap ) {
12193			$.each($cols, function(index, val){
12194				if ( $(val).hasClass('style-light') ){
12195					$masthead.removeClass('style-dark-override').addClass('style-light-override');
12196					return false;
12197				} else if ( $(val).hasClass('style-dark') ) {
12198					$masthead.removeClass('style-light-override').addClass('style-dark-override');
12199					return false;
12200				}
12201			});
12202		}
12203
12204		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
12205			$('.menu-item' ).removeClass('active');
12206			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12207		}
12208
12209		if ( !UNCODE.isFullPageSnap ) {
12210			activateBackWash( nextIndex );
12211		}
12212	};
12213
12214	var activateBackWash = function( nextIndex ){
12215		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12216			$bgwrapper;
12217
12218		if ( $el.length ) {
12219			if ( $el.hasClass('with-zoomout') ) {
12220				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12221			} else if ( $('.with-zoomout', $el).length ) {
12222				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
12223			} else {
12224				return false;
12225			}
12226		} else {
12227			return false;
12228		}
12229
12230		$bgwrapper.addClass('uncode-zoomout');
12231
12232	};
12233
12234	var activateKBurns = function( nextIndex ){
12235		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12236			$bgwrapper;
12237
12238		if ( $el.length ) {
12239			if ( $el.hasClass('with-kburns') ) {
12240				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12241			} else if ( $('.with-kburns', $el).length ) {
12242				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
12243			} else {
12244				return false;
12245			}
12246		} else {
12247			return false;
12248		}
12249
12250		$bgwrapper.addClass('uncode-kburns');
12251
12252	};
12253
12254	var activateParallax = function( nextIndex, direction ){
12255
12256		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12257			$cell = $('.fp-tableCell', $el),
12258			animationEnd = 'webkitAnimationEnd animationend',
12259			cellAnim;
12260
12261		switch( direction ) {
12262			case 'up':
12263				cellAnim = 'moveFromTopInner';
12264				break;
12265			default:
12266				cellAnim = 'moveFromBottomInner';
12267		}
12268
12269		$cell.css({
12270			'animation-name': cellAnim,
12271			'animation-duration': fp_anim_time + 'ms',
12272			'animation-delay': '',
12273			'animation-timing-function': fp_easing,
12274			'animation-fill-mode': 'both',
12275		}).off(animationEnd)
12276		.on(animationEnd, function(event) {
12277			if ( event.originalEvent.animationName === cellAnim ) {
12278				$cell
12279					.css({
12280						'animation-name': '',
12281						'animation-duration': '',
12282						'animation-delay': '',
12283						'animation-timing-function': '',
12284						'animation-fill-mode': '',
12285					});
12286			}
12287		});
12288	};
12289
12290	var scrollHashes = function(){
12291		var hash = window.location.hash.replace('#', '').split('/'),
12292			hashInd;
12293		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
12294			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
12295				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
12296				$.fn.fullpage.moveTo(hashInd+1);
12297			}
12298		} else if( hash[0] === '' ) {
12299			$.fn.fullpage.moveTo(1);
12300		}
12301	};
12302
12303	var hideMenu = function( index, nextIndex ){
12304		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
12305			return false;
12306
12307		var hMenu = UNCODE.menuHeight,
12308			transTime = hMenu * 2;
12309
12310		if ( index === 1 && nextIndex > 1 ) {
12311			hMenu = hMenu * -1;
12312		} else if  ( index !== 1 && nextIndex === 1 ) {
12313			hMenu = 0;
12314		} else {
12315			return false;
12316		}
12317
12318		$masthead.css({
12319			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12320			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12321			'-webkit-transition': 'transform 0.5s ease-in-out',
12322			'transition': 'transform 0.5s ease-in-out'
12323		});
12324	};
12325
12326	var shrinkMenu = function( index, nextIndex ){
12327		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
12328			return false;
12329
12330		if ( index === 1 && nextIndex > 1 ) {
12331			$logo.addClass('shrinked');
12332			$('div', $logo).each(function(index, val){
12333				$(val).css({
12334					'height': logoMinScale,
12335					'line-height': logoMinScale
12336				});
12337				if ($(val).hasClass('text-logo')) {
12338					$(val).css({
12339						'font-size': logoMinScale + 'px'
12340					});
12341				}
12342			});
12343			requestTimeout(function() {
12344				UNCODE.menuMobileHeight = $masthead.outerHeight();
12345			}, 300);
12346		} else if ( index !== 1 && nextIndex === 1 ) {
12347			$logo.removeClass('shrinked');
12348			$('div', $logo).each(function(index, val){
12349				$(val).css({
12350					'height': logoMaxScale,
12351					'line-height': logoMaxScale
12352				});
12353				if ($(val).hasClass('text-logo')) {
12354					$(val).css({
12355						'font-size': logoMaxScale + 'px'
12356					});
12357				}
12358			});
12359			requestTimeout(function() {
12360				UNCODE.menuMobileHeight = $masthead.outerHeight();
12361			}, 300);
12362		} else {
12363			return false;
12364		}
12365
12366	};
12367
12368	var anchorLink = function(){
12369
12370		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
12371			var $this = $(e.currentTarget),
12372				hash = e.currentTarget.href.split('#'),
12373				current = window.location.href.split('#'),
12374				ind,
12375				currentMenuOpened = UNCODE.menuOpened,
12376				go = false;
12377
12378			var hash_url = hash[0].replace(/\/?$/, '/'),
12379				current_url = current[0].replace(/\/?$/, '/');
12380
12381			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
12382				hash = '#'+hash[1];
12383				e.preventDefault();
12384				go = true;
12385			}
12386
12387			if ( go ) {
12388
12389				if ( $(hash).length ) {
12390					ind = $(hash).closest('.fp-section').index();
12391				} else {
12392					hash = hash.slice(1);
12393					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
12394				}
12395
12396				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
12397					ind = $this.closest('.fp-section').index();
12398
12399				UNCODE.menuOpened = false;
12400
12401				$.fn.fullpage.moveTo(ind+1);
12402
12403				UNCODE.menuOpened = currentMenuOpened;
12404				if (UNCODE.menuOpened) {
12405					if (UNCODE.wwidth < UNCODE.mediaQuery) {
12406						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
12407					} else {
12408						$('.mmb-container-overlay .overlay-close').trigger('click');
12409						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
12410					}
12411				}
12412
12413			}
12414
12415		});
12416
12417		$('.header-scrolldown').on('click', function(event) {
12418			event.preventDefault();
12419			var scrollDown = $(this),
12420				ind = scrollDown.closest('.fp-section').index();
12421
12422			$.fn.fullpage.moveTo(ind+2);
12423		});
12424
12425		var anchor = $('.fp-section.active').data('anchor');
12426
12427		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
12428			$('.menu-item').removeClass('active');
12429			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12430		}
12431
12432	};
12433
12434	var slideLeave = function( index, nextIndex, direction ) {
12435		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12436			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12437			animationEnd = 'webkitAnimationEnd animationend',
12438			transitionEnd = 'webkitTransitionEnd transitionend',
12439			animOut = effect != 'scaleDown' ? effect + direction : effect,
12440			animIn,
12441			isFooter = false,
12442			isFooterNext = false,
12443			footerH = $footer.outerHeight(),
12444			timeout,
12445			player, iframe,
12446			footerCoeff;
12447		switch( direction ) {
12448			case 'up':
12449				animIn = 'moveFromTop';
12450				break;
12451			default:
12452				animIn = 'moveFromBottom';
12453		}
12454
12455		if ( $('body').hasClass('uncode-fullpage-trid') ) {
12456			animOut = animIn + 'trid';
12457			animIn = animOut + 'In';
12458		} else if ( UNCODE.isFullPageSnap ) {
12459			animIn = animOut = 'none';
12460		}
12461
12462		hideMenu(index, nextIndex);
12463		shrinkMenu(index, nextIndex);
12464
12465		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12466			if ($(this).attr('data-provider') == 'vimeo') {
12467				iframe = $(this).find('iframe');
12468				player = new Vimeo.Player(iframe[0]);
12469				player.pause();
12470			} else if ($(this).attr('data-provider') == 'youtube') {
12471				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12472			} else {
12473				if ($(this).is('video')) {
12474					$(this)[0].volume = 0;
12475					$(this)[0].pause();
12476				}
12477			}
12478		});
12479
12480		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
12481			if ($(this).attr('data-provider') == 'vimeo') {
12482				iframe = $(this).find('iframe');
12483				iframe.on('load', function(){
12484					player = new Vimeo.Player(iframe);
12485					player.setVolume(0);
12486					player.play();
12487				});
12488				player = new Vimeo.Player(iframe);
12489				player.setVolume(0);
12490				player.play();
12491			} else if ($(this).attr('data-provider') == 'youtube') {
12492				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
12493			} else {
12494				if ($(this).is('video')) {
12495					$(this)[0].volume = 0;
12496					$(this)[0].play();
12497				}
12498			}
12499		});
12500
12501		if ( $currentSlide.is($footer) )
12502			isFooter = true;
12503
12504		if ( $nextSlide.is($footer) )
12505			isFooterNext = true;
12506
12507		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12508			if ( $currentSlide.is($header) )
12509				$header.addClass('header-scrolled');
12510		}
12511
12512		footerCoeff = footerH;
12513
12514		if ( UNCODE.isFullPageSnap ) {
12515			postLeaveActions( nextIndex );
12516			activateBackWash( nextIndex );
12517			activateKBurns( nextIndex );
12518			requestTimeout(function(){
12519				animationEndAction( index, nextIndex );
12520			}, fp_anim_time+150);
12521		} else {
12522			if ( isFooterNext ) {
12523
12524				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
12525				$iscrollWrapper.addClass('no-scrolloverflow');
12526
12527				$nextSlide
12528				.add($currentSlide)
12529				.addClass('uncode-scroll-front')
12530				.addClass('uncode-scroll-active')
12531				.addClass('uncode-scroll-visible');
12532				$container.css({
12533					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12534					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12535					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12536					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12537				}).off(transitionEnd)
12538				.one(transitionEnd, function(){
12539					animationEndAction( index, nextIndex );
12540				});
12541
12542			} else if ( isFooter ) {
12543
12544				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
12545				.add($currentSlide)
12546				.addClass('uncode-scroll-front')
12547				.addClass('uncode-scroll-active')
12548				.addClass('uncode-scroll-visible');
12549				$container.css({
12550					'-webkit-transform': 'translate3d(0, 0, 0)',
12551					'transform': 'translate3d(0, 0, 0)',
12552					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12553					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12554				})
12555				.one(transitionEnd, function(){
12556					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
12557						clearRequestTimeout(timeout);
12558						timeout = requestTimeout(function(){
12559							$.fn.fullpage.moveTo(nextIndex);
12560							slideLeave( index-1, nextIndex, 'up' );
12561							$container.off(transitionEnd);
12562						}, 50);
12563					}
12564					animationEndAction( index, nextIndex );
12565				});
12566
12567			} else {
12568
12569				postLeaveActions( nextIndex );
12570
12571				if ( !$('body').hasClass('uncode-fullpage-trid') )
12572					activateParallax( nextIndex, direction );
12573
12574				var $outBg = $('.background-wrapper', $currentSlide);
12575
12576				$nextSlide
12577				.addClass('uncode-scroll-front')
12578				.addClass('uncode-scroll-active')
12579				.addClass('uncode-scroll-visible')
12580				.addClass('uncode-scroll-animating-in')
12581				.css({
12582					'z-index':4,
12583					'animation-name': animIn,
12584					'animation-duration': fp_anim_time + 'ms',
12585					'animation-delay': '',
12586					'animation-timing-function': fp_easing,
12587					'animation-fill-mode': 'both',
12588					'transition': 'initial',
12589				}).off(animationEnd)
12590				.on(animationEnd, function(event) {
12591					if ( event.originalEvent.animationName === animIn ) {
12592						$(this)
12593							.addClass('uncode-scroll-already')
12594							.removeClass('uncode-scroll-front')
12595							.removeClass('uncode-scroll-animating-in')
12596							.css({
12597								'animation-name': '',
12598								'animation-duration': '',
12599								'animation-delay': '',
12600								'animation-timing-function': '',
12601								'animation-fill-mode': '',
12602								'transition': 'initial',
12603							});
12604
12605						$currentSlide
12606							.removeClass('uncode-scroll-active')
12607							.add($outBg)
12608							.css({
12609								'animation-name': '',
12610								'animation-duration': '',
12611								'animation-delay': '',
12612								'animation-timing-function': '',
12613								'animation-fill-mode': '',
12614								'transition': 'initial',
12615							});
12616
12617						animationEndAction( index, nextIndex );
12618
12619					}
12620
12621					if ( nextIndex > 1 )
12622						$('body').addClass('window-scrolled');
12623					else
12624						$('body').removeClass('window-scrolled');
12625				});
12626
12627				$currentSlide
12628					.addClass('uncode-scroll-animating-out')
12629					.removeClass('uncode-scroll-front')
12630					.css({
12631						'z-index':'1',
12632						'animation-name': animOut,
12633						'animation-duration': fp_anim_time + 'ms',
12634						'animation-delay': '',
12635						'animation-timing-function': fp_easing,
12636						'animation-fill-mode': 'both',
12637						'transition': 'initial',
12638						'will-change': 'auto'
12639					}).off(animationEnd)
12640					.on(animationEnd, function(event) {
12641						if ( event.originalEvent.animationName === animOut ) {
12642							$currentSlide.removeClass('uncode-scroll-animating-out');
12643						}
12644					});
12645
12646				if ( $('body').hasClass('uncode-fp-opacity') ) {
12647					$currentSlide.find('> div').css({
12648						'animation-name': 'opacityout',
12649						'animation-duration': fp_anim_time + 'ms',
12650						'animation-delay': '',
12651						'animation-timing-function': fp_easing,
12652						'animation-fill-mode': 'both',
12653						'transition': 'initial',
12654					}).off(animationEnd)
12655					.on(animationEnd, function(event) {
12656						if ( event.originalEvent.animationName === 'opacityout' ) {
12657							$(event.currentTarget).css({
12658								'animation-name': '',
12659								'animation-duration': '',
12660								'animation-delay': '',
12661								'animation-timing-function': '',
12662								'animation-fill-mode': '',
12663								'transition': '',
12664							});
12665						}
12666					});
12667				}
12668			}
12669		}
12670
12671		$('.scroll-top').on('click', function(e){
12672			$.fn.fullpage.moveTo(1);
12673			return false;
12674		});
12675
12676	};
12677
12678	var init_fullPage = function(mode){
12679
12680		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
12681		// 	scrollBar = false;
12682		// }
12683
12684		var checkFPeffects;
12685
12686		$container.fullpage({
12687			sectionSelector: '.uncode-scroll-lock',
12688			scrollOverflow: true,
12689			scrollOverflowOptions: {
12690				click: false,
12691				preventDefaultException: { tagName:/.*/ }
12692			},
12693			normalScrollElements: ".masthead-vertical",
12694			navigation: false,
12695			scrollBar: scrollBar,
12696			scrollingSpeed: fp_anim_time,
12697			verticalCentered: true,
12698			anchors: no_history ? false : dataNames,
12699			recordHistory: !no_history,
12700			afterRender: function(){
12701				$('body').removeClass('fp-waiting');
12702				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
12703					var $invisible = $(this).addClass('hidden-scroll');//,
12704				});
12705				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
12706					var $visible = $(this).addClass('uncode-scroll-visible'),
12707						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
12708					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
12709				});
12710
12711				$('ul.onepage-pagination a').on('click', function(e){
12712					e.preventDefault();
12713					var $a = $(this),
12714						toIndex = $a.data('index');
12715
12716					$.fn.fullpage.moveTo(toIndex+1);
12717				});
12718
12719				requestTimeout(function(){
12720					scrollHashes();
12721				}, 1000);
12722
12723				$(window).on('hashchange', function(e){
12724					requestTimeout(function(){
12725						scrollHashes();
12726					}, 500);
12727				});
12728
12729				anchorLink();
12730
12731				if ( $('body').hasClass('uncode-fp-opacity') ) {
12732					$all.each(function(index, row) {
12733						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
12734							classBg;
12735
12736						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
12737							classBg = testmatch[0];
12738							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
12739						}
12740					});
12741				}
12742
12743				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
12744					$(window).on('menuOpen gdprOpen', function(){
12745						$.fn.fullpage.setAutoScrolling(false);
12746					}).on('menuClose gdprClose', function(){
12747						$.fn.fullpage.setAutoScrolling(true);
12748					});
12749				}
12750
12751				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
12752					requestTimeout(function(){
12753						$.fn.fullpage.setAutoScrolling(false);
12754					}, 1000);
12755				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
12756					$.fn.fullpage.setAutoScrolling(true);
12757				});
12758
12759				if ( !UNCODE.isFullPageSnap ) {
12760					clearRequestTimeout(checkFPeffects);
12761					checkFPeffects = requestTimeout(function(){
12762						activateBackWash( 1 );
12763						activateKBurns( 1 );
12764					}, 100);
12765				}
12766
12767			},
12768			onLeave: function( index, nextIndex, direction ){
12769
12770				if ( UNCODE.menuOpened || is_scrolling )
12771					return false;
12772
12773				is_scrolling = true;
12774
12775				var event = new CustomEvent('fp-slide-leave');
12776				window.dispatchEvent(event);
12777
12778				slideLeave( index, nextIndex, direction );
12779
12780				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
12781					if ( direction === 'up' ) {
12782						$.fn.fullpage.moveTo(nextIndex-1);
12783					} else {
12784						$.fn.fullpage.moveTo(nextIndex+1);
12785					}
12786					return false;
12787				}
12788
12789				$('ul.onepage-pagination a').removeClass('is-selected');
12790				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12791
12792			}
12793		});
12794	};
12795
12796	init_fullPage();
12797	$(window).on('load', function(){
12798		requestTimeout(function(){
12799			$.fn.fullpage.reBuild();
12800		}, 3000);
12801	});
12802
12803	var addScrollingClass,
12804		removeScrollingClass;
12805
12806	window.addEventListener("fp-slide-scroll", function(){
12807		addScrollingClass = requestTimeout( function(){
12808			$('body').addClass('fp-slide-scrolling');
12809		}, 10 );
12810
12811		clearRequestTimeout(removeScrollingClass);
12812		removeScrollingClass = requestTimeout( function(){
12813			$('body').removeClass('fp-slide-scrolling');
12814		}, 150 );
12815
12816		Waypoint.refreshAll();
12817	}, false);
12818
12819	var setFPheight = function(){
12820		var $body = document.body,
12821			$footer = document.getElementById('colophon'),
12822			$maincontainer = document.querySelector('.main-wrapper'),
12823			$boxcontainer = document.querySelector('.box-container'),
12824			$sections = document.querySelectorAll('.fp-section'),
12825			rect = $maincontainer.getBoundingClientRect(),
12826			rect2 = $boxcontainer.getBoundingClientRect(),
12827			$masthead = document.getElementById('masthead'),
12828			_hideMenu = false,
12829			menuHeight = UNCODE.menuHeight;
12830		$body.style.height = UNCODE.wheight + 'px';
12831
12832		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
12833			_hideMenu = true;
12834		}
12835		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
12836			menuHeight = 0
12837		}
12838
12839
12840		if ( theres_footer )
12841			$footer.style.top = (rect.height || rect2.height) + 'px';
12842
12843		for (var i = 0; i < $sections.length; i++) {
12844			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
12845		}
12846	};
12847
12848	setFPheight();
12849
12850	window.addEventListener('resize', setFPheight, false);
12851	window.addEventListener('orientationchange', setFPheight, false);
12852
12853};
12854
12855UNCODE.particles = function() {
12856	$(".vc-particles-background").each(function() {
12857		var $particle = $(this);
12858		var $parent = $particle.closest('[data-parent]');
12859
12860		$parent.prepend($particle);
12861		// $(window).trigger('resize');
12862	})
12863};
12864
12865
12866UNCODE.readMoreCol = function( $el ){
12867	if ( typeof $el === 'undefined' || $el === null ) {
12868		$el = $('body');
12869	}
12870	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
12871	$readMoreCols.each(function(){
12872		var $uncont = $(this),
12873			$row = $uncont.closest('.row-container'),
12874			max_h = $uncont.attr('data-ov-height'),
12875			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
12876			actual_max_h = $uncont.outerHeight(),
12877			inner_h,
12878			$read_more = $('+ .btn-more-wrap', $uncont),
12879			read_more_resize = $read_more.hasClass('trigger-resize'),
12880			marginClosedBtn = $uncont.attr('data-margin-closed'),
12881			marginClosed = 0,
12882			marginOpenBtn = $uncont.attr('data-margin-open'),
12883			marginOpen = 0,
12884			anim_t = 250,
12885			resized = false;
12886
12887		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
12888
12889		switch (marginClosedBtn) {
12890			case 'sm':
12891				marginClosed = 18
12892				break;
12893				
12894			case 'std':
12895				marginClosed = 36
12896				break;
12897				
12898			case 'lg':
12899				marginClosed = 72
12900				break;
12901				
12902			case '':
12903			default:
12904				marginClosed = 0
12905				break;
12906				
12907		}
12908
12909		switch (marginOpenBtn) {
12910			case 'sm':
12911				marginOpen = 18
12912				break;
12913				
12914			case 'std':
12915				marginOpen = 36
12916				break;
12917				
12918			case 'lg':
12919				marginOpen = 72
12920				break;
12921				
12922			case 'no':
12923				marginOpen = 0
12924				break;
12925				
12926		}
12927
12928		var checkToggleMobile = function(){
12929			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
12930				resized = true;
12931				if ( $read_more.hasClass('state-closed') ) {
12932					$uncont[0].style.height = '';
12933					$uncont[0].style.maxHeight = max_h_mobile;
12934				}
12935			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
12936				if ( $read_more.hasClass('state-closed') ) {
12937					$uncont[0].style.height = '';
12938					$uncont[0].style.maxHeight = max_h;
12939				}
12940				resized = false;
12941			}
12942		}
12943		checkToggleMobile();
12944		$(window).on('resize', function() {
12945			checkToggleMobile();
12946		});
12947
12948		$('a', $read_more).on('click', function(e){
12949			e.preventDefault();
12950
12951			var $a = $(this);
12952
12953			if ( $read_more.hasClass('state-closed') ) {
12954
12955				$read_more
12956					.removeClass('state-closed')
12957					.addClass('state-open');
12958
12959				$uncont.css({
12960					'max-height': 'none',
12961					'height': 'auto',
12962				});
12963	
12964				inner_h = parseFloat( $uncont.outerHeight() );
12965
12966				$uncont.css({
12967					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
12968				});
12969		
12970				anim_t = inner_h - actual_max_h;
12971				if ( anim_t < 250 ) {
12972					anim_t = 250;
12973				} else if ( anim_t > 1000 ) {
12974					anim_t = 1000;
12975				}
12976
12977				$uncont.css({
12978					'transition-duration' : anim_t + 'ms'
12979				}).addClass('overflow-mask-animation').animate({
12980					'height': inner_h
12981				}, anim_t, 'easeInOutCubic', function(){
12982					$uncont.css({
12983						'height' : 'auto'
12984					}).removeClass('overflow-mask');
12985					if ( read_more_resize === true ) {
12986						window.dispatchEvent(new Event('resize'));
12987						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12988							ScrollTrigger.refresh(true);
12989						}
12990					}
12991				});
12992
12993				if ( marginOpen != '' ) {
12994					$read_more.animate({
12995						'margin-top' : marginOpen
12996					}, anim_t, 'easeInOutCubic');
12997				}
12998
12999			} else {
13000				$read_more
13001					.removeClass('state-open')
13002					.addClass('state-closed');
13003
13004				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
13005					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
13006				}, anim_t, 'easeInOutCubic', function(){
13007					if ( read_more_resize === true ) {
13008						window.dispatchEvent(new Event('resize'));
13009						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
13010							ScrollTrigger.refresh(true);
13011						}
13012					}
13013				});
13014
13015				if ( marginClosed !== '' ) {
13016					$read_more.animate({
13017						'margin-top' : marginClosed
13018					}, anim_t, 'easeInOutCubic');
13019				}
13020
13021				if ( $a.hasClass('toggle-scroll') ) {
13022                    var $masthead = $('#masthead > div:first-child'),
13023                        headH = $masthead.outerHeight(),
13024						rectTop = $row[0].getBoundingClientRect().top,
13025						checkNavBar = $a.hasClass('toggle-navbar'),
13026						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
13027                        offCont = ( $row.offset().top );
13028
13029					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13030						checkNavBar = checkNavBarMobile;
13031					}
13032
13033					if ( checkNavBar ) {
13034						offCont = offCont - headH;
13035					}
13036			
13037					if ( rectTop < headH ) {
13038						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
13039							$(this).stop();
13040						}).animate({
13041							scrollTop: offCont
13042						}, anim_t, 'easeInOutCubic');
13043					}
13044				}
13045
13046			}
13047		});
13048	});
13049}
13050UNCODE.filters = function() {
13051	var $systems = $('.isotope-system, .cssgrid-system');
13052
13053	$systems.each(function(index, val){
13054		var $system = $(this),
13055			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
13056			$widgets = $('.widgetized-cb-wrapper', $system),
13057			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
13058			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
13059			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
13060			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
13061
13062		if ($system.hasClass('isotope-processed')) {
13063			return;
13064		}
13065
13066		$cats_trigger.on('click', function(e) {
13067			if ( ! $('html').hasClass('screen-sm') ) {
13068				// $widgets.add($sorting_dd).slideUp(400);
13069				e.preventDefault();
13070				$widgets.slideUp(400, 'easeInOutCirc');
13071			}
13072		});
13073
13074		$('.filters-toggle-trigger', $system).on('click', function(e) {
13075			e.preventDefault();
13076			var $filters = $('.isotope-filters .menu-horizontal', $system);
13077			$filters.slideToggle(400, 'easeInOutCirc');
13078			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13079		});
13080
13081		$widget_trgr.on('click', function(e) {
13082			e.preventDefault();
13083			$widgets.slideToggle(400, 'easeInOutCirc');
13084			if (!$('html').hasClass('screen-sm')) {
13085				$cats_filters.slideUp(400, 'easeInOutCirc');
13086			}
13087			window.dispatchEvent(new CustomEvent('boxResized'));
13088		});
13089
13090		$sorting_trgr.on('click', function(e) {
13091			e.preventDefault();
13092			if (!$('html').hasClass('screen-sm')) {
13093				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13094			}
13095		});
13096
13097		$system.addClass('isotope-processed');
13098	});
13099
13100};
13101
13102UNCODE.widgets = function() {
13103	var widget_collapses = $('.widget-collapse');
13104
13105	widget_collapses.each(function(){
13106		var widget_collapse = $(this),
13107			widget_title = widget_collapse.find('.widget-title'),
13108			widget = widget_title.closest('.widget'),
13109			content = widget.children().not('.widget-title'),
13110			setCTA;
13111
13112		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13113			widget_title.toggleClass('open');
13114		}
13115
13116		widget_title.each(function() {
13117			var _this = $(this);
13118			var content = _this.closest('.widget').find('.widget-collapse-content');
13119
13120			$(window).on('load resize', function(){
13121				clearRequestTimeout(setCTA);
13122				setCTA = requestTimeout( function() {
13123					if ( content.is(':visible') ) {
13124						_this.addClass( 'open' );
13125					} else {
13126						_this.removeClass( 'open' );
13127					}
13128				}, 10 );
13129			})
13130
13131			_this.on( 'click', function(){
13132
13133				// Get content of :after element (+ icon) to check the visibility
13134				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
13135
13136				if (icon_content === 'none' || !icon_content) {
13137					return false;
13138				}
13139
13140				_this.toggleClass('open');
13141				var isOpen = _this.hasClass('open'),
13142					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
13143				content.animate({
13144					height: 'toggle',
13145					padding: 'toggle',
13146					opacity: 'toggle',
13147					top: isOpen ? 0 : hasBorder
13148				}, {
13149					duration: 400,
13150					easing: "easeInOutCirc",
13151				});
13152
13153				return false;
13154
13155			});
13156		});
13157	});
13158
13159	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
13160};
13161
13162UNCODE.unmodal = function() {
13163	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
13164		$('.unmodal-overlay').fadeIn();
13165		$('.unmodal-overlay').addClass('loading');
13166		$('body').addClass('uncode-unmodal-overlay-visible');
13167		$(window).trigger('unmodal-open');
13168	});
13169
13170	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
13171		$('.unmodal-overlay').fadeOut();
13172		$('.unmodal').fadeOut();
13173		$('body').removeClass('uncode-unmodal-overlay-visible');
13174		$('body').removeClass('uncode-unmodal-open');
13175		$('html').removeClass('uncode-unmodal-body-disable-scroll');
13176		$(document).trigger('unmodal-close');
13177		UNCODE.isUnmodalOpen = false;
13178	});
13179
13180	$(document).on('uncode-unmodal-show-content', function() {
13181		$('.unmodal-overlay').removeClass('loading');
13182		$('.unmodal').show();
13183		$('.unmodal').addClass('show-unmodal-with-animation');
13184		$('.unmodal-content')[0].scrollTop = 0;
13185		$('body').addClass('uncode-unmodal-open');
13186		UNCODE.isUnmodalOpen = true;
13187
13188		if ($('body').hasClass('qw-body-scroll-disabled')) {
13189			$('html').addClass('uncode-unmodal-body-disable-scroll');
13190		}
13191
13192		if ($('.unmodal').hasClass('auto-height')) {
13193			set_modal_height();
13194		}
13195	});
13196
13197	var set_modal_height = function() {
13198		var modal = $('.unmodal').css({height: 'auto'});
13199		var window_height = $(window).outerHeight();
13200		var modal_height = modal.outerHeight();
13201
13202		modal.css('height', 'auto');
13203
13204		if (modal_height > window_height) {
13205			modal.outerHeight(window_height);
13206		}
13207	}
13208
13209	if ($('.unmodal').hasClass('auto-height')) {
13210		var setCTA;
13211
13212		$(window).on('resize', function() {
13213			clearRequestTimeout(setCTA);
13214			setCTA = requestTimeout(function() {
13215				set_modal_height();
13216			}, 100);
13217		});
13218	}
13219};
13220
13221UNCODE.bgChanger = function() {
13222	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
13223		$bg_first = $('.vc_row[data-bg-remove]'),
13224		bg_remove = $bg_first.attr('data-bg-remove'),
13225		$first = $bg_changers.first(),
13226		$last = $bg_changers.last(),
13227		$bg_wrapper = $('#changer-back-color'),
13228		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
13229		setCTA, localH = UNCODE.wheight,
13230		isScrolling;
13231
13232	$bg_first.removeClass(bg_remove);
13233
13234	var bgChange = function($col, bgColor, skin, tmbskin){
13235		$bg_wrapper.attr( 'class', bgColor );
13236		var menuskin;
13237		if ( typeof skin !== 'undefined' ) {
13238			menuskin = skin.replace('style', 'menu')
13239		}
13240
13241		if ( $col.length ) {
13242			$('.uncol[data-skin-change]').each(function(){
13243				var $isoFooter = $('.isotope-footer', this);
13244				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
13245				if ( menuskin !== '' ) {
13246					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
13247				}
13248			});
13249
13250			$('.tmb[data-skin-change]').each(function(){
13251				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
13252			});
13253		}
13254	};
13255
13256	var $masthead = $('#masthead'),
13257		transDesktop,
13258		transMobile,
13259		changeSkin,
13260
13261	checkTransparencyAndChange = function( skin ){
13262		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
13263		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
13264		changeSkin = $masthead.hasClass('menu-change-skin');
13265
13266		if ( ! transDesktop && ! transMobile ) {
13267			return false;
13268		}
13269
13270		if ( ! changeSkin ) {
13271			return false;
13272		}
13273
13274		if ( skin === 'style-light' ){
13275			$masthead.removeClass('style-dark-override').addClass('style-light-override');
13276			return false;
13277		} else if ( skin === 'style-dark' ) {
13278			$masthead.removeClass('style-light-override').addClass('style-dark-override');
13279			return false;
13280		}
13281	};
13282
13283	var bg_waypoints = function(){
13284		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
13285
13286			$.each($bg_changers, function(index, row) {
13287
13288				var $row = $(row),
13289					$col = $('.uncol[data-skin-change]', $row).eq(0),
13290					skin,
13291					$tmbs,
13292					tmbskin,
13293					bgColor = $row.attr('data-bg-color');
13294
13295				if ( ! $row.is(':visible') ) {
13296					return false;
13297				}
13298
13299				if ( $col.length ) {
13300					skin = $col.attr('data-skin-change');
13301					$tmbs = $('.tmb[data-skin-change]', $row);
13302					tmbskin = skin.replace('style', 'tmb');
13303				}
13304
13305				if ( ! $row.hasClass('unscroll-horizontal') ) {
13306					$row.waypoint(function( dir ) {
13307						if ( dir === 'down' ) {
13308							bgChange($col, bgColor, skin, tmbskin);
13309							checkTransparencyAndChange(skin);
13310						} else {
13311							return;
13312						}
13313					}, {
13314						offset: '50%'
13315		  			});
13316
13317					$row.waypoint(function( dir ) {
13318						if ( dir === 'up' ) {
13319							bgChange($col, bgColor, skin, tmbskin);
13320							checkTransparencyAndChange(skin);
13321						} else {
13322							return;
13323						}
13324					}, {
13325						offset: function() {
13326							var clH = this.element.clientHeight,
13327								wH = window.innerHeight,
13328								ret = clH > 200 ? -100 : clH * -0.5;
13329							return ( wH / 2 ) - clH;
13330						}
13331					});
13332				}
13333
13334			});
13335
13336			$('body').addClass('bg-changer-init');
13337
13338		}
13339	};
13340
13341	var body = document.body,
13342	edges = false;
13343
13344	var throttle = function(fn, wait) {
13345		var time = Date.now();
13346		return function() {
13347			if ((time + wait - Date.now()) < 0) {
13348				fn();
13349				time = Date.now();
13350			}
13351		}
13352	}
13353
13354	var $wrapper = document.querySelector(".main-wrapper"),
13355		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
13356
13357	var $title = document.querySelector('#rotating');
13358	if ( $title !== null ) {
13359		$title.style.whiteSpace = 'nowrap';
13360		$title.style.transition = 'transform 200ms linear';
13361	}
13362
13363	window.addEventListener( 'scroll', throttle( function() {
13364		window.clearRequestTimeout( isScrolling );
13365
13366		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
13367
13368			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
13369				body = document.body,
13370				html = document.documentElement,
13371				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13372				$row = false,
13373				firstOff,
13374				lastOff;
13375
13376			if ( scrolled < 100 && $first.length ) {
13377				firstOff = $first.offset().top;
13378				if ( firstOff < 100 ) {
13379					var $row = $first;
13380				}
13381			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
13382				lastOff = $last.offset().top + $last.outerHeight();
13383				if ( lastOff > ( docH - 100 ) ) {
13384					var $row = $last;
13385				}
13386			}
13387
13388			if ( $row.length ) {
13389				var $col = $('.uncol[data-skin-change]', $row).eq(0),
13390					skin,
13391					$tmbs,
13392					tmbskin,
13393					bgColor = $row.attr('data-bg-color');
13394
13395				if ( $col.length ) {
13396					skin = $col.attr('data-skin-change');
13397					$tmbs = $('.tmb[data-skin-change]', $row);
13398					tmbskin = skin.replace('style', 'tmb');
13399				}
13400
13401				bgChange($col, bgColor, skin, tmbskin);
13402				checkTransparencyAndChange(skin);
13403				edges = true;
13404			}
13405
13406		}, 150);
13407
13408		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
13409			bg_waypoints();
13410			Waypoint.refreshAll();
13411			edges = false;
13412		}
13413
13414	}, 100), false);
13415
13416	$(window).on('resize', function() {
13417		clearRequestTimeout(setCTA);
13418		setCTA = requestTimeout(function() {
13419			if ( localH != UNCODE.wheight ) {
13420				localH = UNCODE.wheight;
13421				bg_waypoints();
13422				Waypoint.refreshAll();
13423			}
13424		}, 100);
13425	});
13426
13427	bg_waypoints();
13428
13429};
13430
13431UNCODE.skewIt = function() {
13432
13433	if ( $('body').hasClass('compose-mode') ) {
13434		return;
13435	}
13436
13437	var justscrolled = false;
13438
13439	var loadSkewIt = function(){
13440
13441		var $pageHeader = $('#page-header'),
13442			$page_body = $('.page-body'),
13443			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
13444
13445		if ( $header_skew.length ) {
13446			$pageHeader.addClass('uncode-skew').css({
13447				position: 'relative',
13448				zIndex: 1
13449			});
13450			$header_skew.removeClass('uncode-skew');
13451			$page_body.css({
13452				position: 'relative',
13453				zIndex: 0
13454			});
13455		}
13456
13457		var $skew = $('.uncode-skew'),
13458			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
13459			horizontal = $horizontal.length,
13460			stopSkewing,
13461			lastOffset = 0,
13462			lastDate = Date.now();
13463
13464		if ( ! $skew.length ) {
13465			return;
13466		}
13467
13468		var dropSkew = function(){
13469			if ( UNCODE.wwidth < UNCODE.mediaQuery )
13470				return;
13471
13472			$skew.each(function(){
13473				var $this = $(this),
13474					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13475
13476				if ( $drop.length ) {
13477					$this.css({
13478						'transform': 'skew(0)'
13479					});
13480					var bound = $this[0].getBoundingClientRect();
13481					$drop.css({
13482						left: bound.x * -1,
13483						top: bound.y * -1,
13484					});
13485				}
13486			});
13487		};
13488		dropSkew();
13489
13490		$(window).on('resize', dropSkew);
13491
13492		window.addEventListener( 'scroll', function() {
13493
13494			if ( justscrolled !== true ) {
13495				justscrolled = true;
13496				return;
13497			}
13498
13499			window.clearRequestTimeout( stopSkewing );
13500
13501			var now = Date.now(),
13502				delayInMs = now - lastDate,
13503				offset = window.pageYOffset || window.document.documentElement.scrollTop,
13504				newOffset = offset - lastOffset,
13505				speed = Math.pow((newOffset / delayInMs), 3) * -1,
13506				body = document.body,
13507				html = document.documentElement,
13508				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13509				wait = 50,
13510				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
13511
13512			if ((lastDate + wait - now) < 0) {
13513
13514				lastDate = now;
13515				lastOffset = offset;
13516
13517				if ( speed > 6 ) {
13518					speed = 6;
13519				} else if ( speed < -6 ) {
13520					speed = -6;
13521				}
13522
13523				if ( speed > 2 && offset < UNCODE.wheight ) {
13524					speed = 2;
13525				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
13526					speed = -2;
13527				}
13528
13529				var speedY = speed,
13530					speedX = speed * 1.25;
13531
13532				if ( horizontal ) {
13533					speedY = 0;
13534					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13535						speedX = 0;
13536						return;
13537					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13538						speedX = 0;
13539						return;
13540					}
13541				} else {
13542					speedX = 0;
13543				}
13544
13545				if ( ! $skew.closest('.enter-st').length ) {
13546					speedX = 0;
13547				}
13548
13549				gsap.killTweensOf($skew);
13550				gsap.to( $skew, {
13551					duration: 0.2,
13552					skewY: (speedY * maxSpeed) + "deg",
13553					skewX: (speedX * maxSpeed) + "deg",
13554					ease: Power0.easeNone,
13555					transformOrigin: 'center',
13556				});
13557
13558			}
13559
13560			stopSkewing = requestTimeout(function() {
13561				gsap.killTweensOf($skew);
13562				gsap.to( $skew, {
13563					duration: 0.5,
13564					skewY: "0deg",
13565					skewX: "0deg",
13566					transformOrigin: 'center',
13567					ease: Expo.easeOut,
13568				});
13569
13570				$skew.each(function(){
13571					var $this = $(this),
13572						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13573
13574					if ( $drop.length ) {
13575						var bound = $this[0].getBoundingClientRect()
13576						$drop.css({
13577							left: bound.x * -1,
13578							top: bound.y * -1,
13579						});
13580					}
13581				});
13582
13583			}, 200);
13584
13585		}, false);
13586
13587	};
13588
13589	$(window).on('load', loadSkewIt);
13590
13591};
13592
13593UNCODE.rotateIt = function() {
13594
13595	if ( $('body').hasClass('compose-mode') ) {
13596		return;
13597	}
13598
13599	var frameRotate = false;
13600	var loadRotateIt = function(){
13601
13602		var $toRotate = $('.uncode-rotate');
13603
13604		$toRotate.each(function(){
13605			var $rotate = $(this),
13606				deg = 0,
13607				dir = true,
13608				coeff = 1,
13609				lastOffset = 0,
13610				lastDate = Date.now();
13611
13612			var checkScroll = function($rotate){
13613				// if ( ! $rotate.length ) {
13614				// 	return;
13615				// }
13616
13617				var now = Date.now(),
13618					delayInMs = now - lastDate,
13619					offset = window.pageYOffset || window.document.documentElement.scrollTop,
13620					newOffset = offset - lastOffset,
13621					speed = (newOffset / delayInMs) * 5,
13622					body = document.body,
13623					html = document.documentElement,
13624					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
13625
13626				lastDate = now;
13627				lastOffset = offset;
13628
13629				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
13630					deg = 0;
13631				}
13632
13633				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
13634					deg = parseFloat(deg) + parseFloat(speed);
13635				}
13636
13637				if ( $rotate.hasClass('uncode-rotate-hover') ) {
13638					$rotate.hover(function(){
13639						coeff = 1.75;
13640					}, function(){
13641						coeff = 1;
13642					});
13643				}
13644
13645				// if ( speed > 0 ) {
13646				// 	dir = true
13647				// } else if ( speed < 0 ) {
13648				// 	dir = false
13649				// }
13650
13651				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
13652					deg = deg+coeff;
13653					// if ( dir ) {
13654					// 	deg = deg+coeff;
13655					// } else {
13656					// 	deg = deg-coeff;
13657					// }
13658				}
13659
13660				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13661					return false;
13662				}
13663				
13664				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
13665					var undeg = deg*-1;
13666					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
13667				} else {
13668					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
13669				}
13670
13671				requestAnimationFrame(function() {
13672					if ( frameRotate === true ) {
13673						frameRotate = false;
13674						return;
13675					}
13676					checkScroll($rotate);
13677				});
13678			};
13679
13680			checkScroll($rotate);
13681
13682		});
13683
13684	};
13685
13686	$(window).on('load', loadRotateIt);
13687
13688	var checkRotate;
13689	var resizeRotate = function(){
13690		var $inlineRotates = $('.inline-rotate');
13691		$inlineRotates.each(function(){
13692			$(this).addClass('inline-rotate-standby');
13693		});
13694		clearTimeout(checkRotate);
13695		checkRotate = setTimeout(function(){
13696			$('.inline-rotate').each(function(){
13697				$(this).removeClass('inline-rotate-standby');
13698				frameRotate = true;
13699			});
13700			loadRotateIt();
13701		}, 500);
13702	};
13703
13704	$(window).off('resize.inline-rotate', resizeRotate)
13705	.on('resize.inline-rotate', resizeRotate);
13706
13707};
13708
13709var marqueeCheckResize,
13710	initMarquee;
13711
13712UNCODE.textMarquee = function( $titles ) {
13713
13714	var isInitMarque = false;
13715	var lastMarqueeDocH = Math.round($(document).height());
13716
13717	var initTextMarquee = function( $titles ){
13718
13719		if ( typeof $titles == 'undefined' ) {
13720			$titles = $('.un-text-marquee');
13721		}
13722
13723		if ( ! $titles.length ) {
13724			return;
13725		}
13726
13727		isInitMarque = true;
13728
13729		var stableHeight = UNCODE.wheight;
13730
13731		$titles.each(function(){
13732			var $title = $(this),
13733				marqueeNS = '.textMarquee-' + Math.random().toString(36).slice(2),
13734				$span = $('> span, > i > span', $title),
13735				txt,
13736				first = true,
13737				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
13738				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
13739				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
13740				hasSticky = false,
13741				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
13742				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
13743				newW = UNCODE.wwidth,
13744				marqueeTL, inview,
13745				isInMenu = $title.closest('.megamenu-block-wrapper').length;
13746
13747
13748			var getStickyBound = function() {
13749				var $sticky = $title.closest('.sticky-trigger, .sticky-element');
13750
13751				if ( $sticky.length ) {
13752					var $pinSpacer = $sticky.closest('.pin-spacer');
13753					return $pinSpacer.length ? $pinSpacer : $sticky;
13754				}
13755
13756				var $pinSpacerOnly = $title.closest('.pin-spacer');
13757
13758				if ( $pinSpacerOnly.length ) {
13759					return $pinSpacerOnly;
13760				}
13761
13762				return $title.closest('.vc_row');
13763			};
13764
13765			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
13766				hasSticky = true;
13767				dataTrigger = 'row';
13768			}
13769
13770			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13771				dataNavBar = dataNavBarMobile;
13772			}
13773
13774			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
13775			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
13776			var dataX = dataSpeed;
13777
13778			dataSpeed += 5;
13779
13780			$('.marquee-clone-wrap', $title).remove();
13781
13782			txt = $span.html();
13783
13784			if ( ! $('.marquee-original-core', $span).length ) {
13785				txt = $span.html();
13786				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
13787			} else {
13788				txt = $('.marquee-original-core', $span).html();
13789			}
13790
13791			var spanW,
13792				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
13793				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
13794				speed = 10 - dataSpeed;
13795
13796			$span.prepend($prepended);
13797			$span.append($appended);
13798
13799			var continuousTextMarquee = function () {
13800				var bound = $title
13801						.css({
13802							transform: "none",
13803							opacity: 0,
13804						})
13805						.offset(),
13806					ease = "none";
13807
13808				var xStrt =
13809						first || $title.hasClass("un-marquee-infinite")
13810							? 0
13811							: UNCODE.wwidth - bound.left,
13812					xEnd = $title.hasClass("un-marquee-infinite")
13813						? spanW
13814						: spanW + bound.left,
13815					xSpeed =
13816						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
13817						dataSpeed,
13818					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
13819					speedSlow = (xEnd + xStrt) / 45,
13820					transFormVal,
13821					translX;
13822
13823				if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
13824					marqueeTL.kill();
13825				}
13826
13827				marqueeTL = new TimelineMax({ paused: true, reversed: true });
13828				marqueeTL.play();
13829
13830				var inViewElement =
13831						dataTrigger === "row" ? ( hasSticky ? getStickyBound()[0] : $title.closest(".vc_row")[0] ) : $title[0],
13832					wayOff =
13833						dataTrigger === "row" && dataNavBar === "yes"
13834							? UNCODE.menuHeight
13835							: 0;
13836
13837				if ( isInMenu ) {
13838					$(document).on('un-menu-show.marquee', function(e, $ul){
13839						marqueeTL.restart();
13840					});
13841					$(document).on('un-menu-hide.marquee', function(e, $ul){
13842						marqueeTL.pause();
13843					});
13844				} else {
13845					inview = new Waypoint.Inview({
13846						element: inViewElement,
13847						offset: wayOff,
13848						enter: function (direction) {
13849							marqueeTL.play();
13850						},
13851						exited: function (direction) {
13852							if (!$title.closest(".pin-spacer").length) {
13853								marqueeTL.pause();
13854							}
13855						},
13856					});
13857				}
13858
13859				if ($title.hasClass("un-marquee-hover")) {
13860					var $column = $title.closest(".wpb_column"),
13861						$col_link = $(".col-link", $column),
13862						$hover_sel = $title;
13863
13864					if ($col_link.length) {
13865						$hover_sel = $title.add($column);
13866					}
13867					$hover_sel
13868						.on("mouseover", function () {
13869							ease = "power2.out";
13870							transFormVal = $title.css("transform").split(/[()]/)[1];
13871							translX = transFormVal.split(",")[4];
13872							speedSlow = (xEnd + (xStrt - translX)) / 45;
13873							marqueeTL.duration(speedSlow);
13874						})
13875						.on("mouseout", function () {
13876							ease = "power2.in";
13877							transFormVal = $title.css("transform").split(/[()]/)[1];
13878							translX = transFormVal.split(",")[4];
13879							speedSlow =
13880								((xEnd + (xStrt - translX)) /
13881									(dataSpeed * dataSpeed * dataSpeed) /
13882									5) *
13883								dataSpeed;
13884							marqueeTL.duration(speedSlow);
13885						});
13886				}
13887		
13888				gsap.killTweensOf($title);
13889				marqueeTL.fromTo( $title, {
13890					opacity: 1,
13891					x: xStrt * direction * -1
13892				},
13893				{
13894					duration: xSpeed,
13895					x: xEnd * direction,
13896					onComplete: function(){
13897						first = false;
13898						if ( isInMenu ) {
13899							marqueeTL.restart();
13900						} else {
13901							continuousTextMarquee();
13902						}
13903					},
13904					onUpdate: function(){
13905						if ( ! $title[0].isConnected ) {
13906							marqueeTL.kill();
13907							initTextMarquee();
13908						}
13909					},
13910					ease: ease
13911				});
13912		
13913			};
13914			
13915			var runTextMarquee = function(){
13916				var $row = $title.closest('.vc_row');
13917				if ( hasSticky ) {
13918					$row = getStickyBound();
13919				}
13920				var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
13921
13922				if ( !$bound.length ) {
13923					return;
13924				}
13925
13926				if ( $title.data('marqueeScrollActive') ) {
13927					return;
13928				}
13929
13930				var boundEl = $bound[0],
13931					titleEl = $title[0],
13932					direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
13933					dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
13934
13935				$title.data('marqueeScrollActive', true);
13936
13937				var loop = function(){
13938					if ( ! titleEl.isConnected ) {
13939						$title.data('marqueeScrollActive', false);
13940						initTextMarquee();
13941						return;
13942					}
13943
13944					var bound = boundEl.getBoundingClientRect(),
13945						bound_top = bound.top,
13946						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
13947
13948					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
13949						if ( dataTrigger === 'row-middle' ) {
13950							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5);
13951						}
13952						if ( dataNavBar === 'yes' ) {
13953							bound_top = bound_top - UNCODE.menuHeight;
13954						}
13955						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
13956					}
13957
13958					titleEl.style.transform = 'translate3d(' + gsap_calc + 'px, 0, 0)';
13959
13960					requestAnimationFrame( loop );
13961				};
13962
13963				requestAnimationFrame( loop );
13964			};
13965
13966			var cloneSpan = function($_title, cntnt){
13967
13968				if ( $_title.hasClass('un-marquee-infinite') ) {
13969					$('> span.marquee-clone-wrap', $_title).text('');
13970				}
13971
13972				gsap.to( $_title, {
13973					duration: 0,
13974					x: 0
13975				});
13976
13977				spanW = $span.outerWidth();
13978
13979
13980				if ( !spanW ) {
13981					return;
13982				}
13983
13984				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
13985					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
13986
13987				if ( $_title.hasClass('un-marquee-infinite') ) {
13988
13989					for ( var i = 0; i < part; i++ ) {
13990						$prepended.append(cntnt + spaceSpan);
13991						$appended.append(cntnt + spaceSpan);
13992					}
13993				}
13994
13995				if ( $('body').hasClass('compose-mode') ) {
13996					$('.uncode_fe_safe').remove();
13997					return;
13998				}
13999
14000				if ( $title.closest('.marquee-freezed').length ) {
14001					return;
14002				}
14003
14004				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
14005					continuousTextMarquee();
14006				}
14007
14008				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
14009					runTextMarquee();
14010				}
14011
14012			};
14013
14014			var marqueeResize = function(e){
14015				if ( isInMenu ) {
14016					return;
14017				}
14018				var tOut = 1000;
14019				if ( isInMenu ) {
14020						gsap.killTweensOf($title);
14021						if ( typeof inview !== 'undefined' && inview !== null ) {
14022							inview.destroy();
14023						}
14024						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14025							marqueeTL.kill();
14026						}
14027						first = true;
14028						$(window).off(marqueeNS);
14029						$(document).off(marqueeNS);
14030						initTextMarquee();
14031				} else {
14032					clearRequestTimeout(marqueeCheckResize);
14033					marqueeCheckResize = requestTimeout(function(){
14034						if ( newW !== UNCODE.wwidth ) {
14035							gsap.killTweensOf($title);
14036							if ( typeof inview !== 'undefined' && inview !== null ) {
14037								inview.destroy();
14038							}
14039							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14040								marqueeTL.kill();
14041							}
14042							first = true;
14043							$(window).off(marqueeNS);
14044							$(document).off(marqueeNS);
14045							initTextMarquee();
14046							newW = UNCODE.wwidth;
14047						}
14048					}, tOut);
14049				}
14050			};
14051
14052			$(window).off('resize', marqueeResize)
14053			.on( 'resize', marqueeResize);
14054			$(window).off('uncode.re-layout', marqueeResize)
14055			.on( 'uncode.re-layout', marqueeResize);
14056
14057			cloneSpan($title, txt);
14058
14059			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14060				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
14061					var $_titles = $('.un-text-marquee',e.view.$el);
14062					clearRequestTimeout(marqueeCheckResize);
14063					marqueeCheckResize = requestTimeout(function(){
14064						initTextMarquee($_titles);
14065					}, 1000);
14066				});
14067			}
14068		});
14069
14070		$(window).on( 'load wwResize', function(e) {
14071			stableHeight = UNCODE.wheight;
14072		});
14073
14074	};
14075
14076	document.addEventListener("DOMContentLoaded", function() {
14077		if ( isInitMarque !== true ) {
14078			initTextMarquee();
14079		}
14080	});
14081
14082	if ( document.fonts && document.fonts.ready && typeof document.fonts.ready.then === 'function' ) {
14083		document.fonts.ready.then(function(){
14084			initTextMarquee();
14085		});
14086	}
14087
14088	$(window).on('focus load resize',function(){
14089		clearTimeout(initMarquee);
14090		initMarquee = setTimeout(function(){
14091			if ( isInitMarque !== true ) {
14092				initTextMarquee();
14093			}
14094		}, 500);
14095	});
14096	
14097	$(document).on('pumAfterOpen pumAfterClose', function(args){
14098		initTextMarquee();
14099	});
14100
14101	$(document).on('uncode-scrolltrigger-refresh', function(args){
14102		var nextDocH = Math.round($(document).height());
14103
14104		if ( Math.abs(nextDocH - lastMarqueeDocH) <= 2 ) {
14105			return;
14106		}
14107
14108		lastMarqueeDocH = nextDocH;
14109
14110		clearRequestTimeout(marqueeCheckResize);
14111
14112		marqueeCheckResize = requestTimeout(function(){
14113			initTextMarquee();
14114		}, 250);
14115	});
14116};
14117UNCODE.parallax = function() {
14118	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
14119		if ($('.parallax-el').length > 0) {
14120			var parallax_elements = new Rellax('.parallax-el');
14121			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
14122			window.addEventListener('boxResized', function(e) {
14123				parallax_elements.refresh();
14124			}, false);
14125			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
14126				requestTimeout(function() {
14127					parallax_elements.refresh();
14128				}, 100);
14129			});
14130
14131			if ( typeof UNCODE.hDoc === 'undefined' ) {
14132				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14133					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14134			}
14135		
14136			function paralraf(time) {
14137				requestAnimationFrame(paralraf)
14138		
14139				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14140					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14141				
14142				if ( UNCODE.hDoc !== newHdoc ) {
14143					UNCODE.hDoc = newHdoc;
14144					parallax_elements.refresh();
14145				}
14146			}
14147		
14148			requestAnimationFrame(paralraf)
14149		
14150		}
14151	}
14152};
14153
14154UNCODE.magicCursor = function(){
14155	var $customCursor = $('#uncode-custom-cursor'),
14156		$customPilot = $('#uncode-custom-cursor-pilot'),
14157		$tooltip = $('.title-tooltip', $customCursor),
14158		$cursorSpan = $('> span', $tooltip),
14159		currentBg = false,
14160		fromTitle = false,
14161		setTime,
14162		mouseEvent;
14163
14164		var spanW, spanH,
14165		maxW = false;
14166
14167	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
14168		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
14169			$tooltip.css({opacity: 0});
14170			delayt_time += 400;
14171		}
14172		clearRequestTimeout(setTime);
14173		setTime = requestTimeout(function() {
14174
14175			$tooltip.css({opacity: ''});
14176
14177			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
14178
14179			if ( cursorTitle !== '' ) {
14180				if ( fromTitle && dataTitle === 'boing' ) {
14181					setTimeout(function(){
14182						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
14183					}, 5);
14184				}
14185				$cursorSpan.attr('class', fontClass).html( cursorTitle );
14186			} else {
14187				if ( cursorType !== 'auto' ) {
14188					$cursorSpan.html('');
14189				}
14190			}
14191
14192			$cursorSpan.addClass('in-tooltip');
14193
14194			$customCursor.attr('data-cursor', cursorType);
14195
14196			if ( fromTitle ) {
14197				$customCursor.addClass('from-tooltip-title');
14198			} else {
14199				$customCursor.removeClass('from-tooltip-title');
14200			}
14201
14202			if ( cursorBg !== false ) {
14203				$customCursor.attr('data-bg', 'transparent');
14204			} else {
14205				$customCursor.removeAttr('data-bg');
14206			}
14207
14208			currentBg = cursorBg;
14209
14210			if ( cursorTitle !== '' ) {
14211				fromTitle = true;
14212				$customCursor.attr('data-cursor', cursorType);
14213				$customCursor.attr('data-title', 'true');
14214				$cursorSpan.css({width: ''});
14215			} else {
14216				fromTitle = false;
14217				$customCursor.removeAttr('data-title');
14218			}
14219			spanW = $cursorSpan.outerWidth();
14220			
14221			if ( spanW >= maxW && maxW !== false ) {
14222				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
14223				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
14224					width: maxW
14225				});
14226				spanW = maxW;
14227			} else {
14228				$customCursor.find('> span:first-child').removeClass('max-width');
14229			}
14230			spanH = $cursorSpan.outerHeight();
14231			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
14232				$customCursor.find('> span:first-child').add($tooltip).css({
14233					width: spanW,
14234					height: spanH
14235				});
14236			} else {
14237				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
14238			}
14239			if ( $customPilot.length ) {
14240				$customPilot.attr('data-cursor', cursorType);
14241			}
14242		}, delayt_time);
14243	}
14244
14245	function changeCursor($wrap){
14246		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14247		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
14248			$href = $wrap.find(href),
14249			cursorType,
14250			cursorTitle = '',
14251			tooltip_class = '',
14252			cursorBg = false;
14253
14254		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
14255			var $this = $(this).addClass("cursor-init"),
14256				$tmb = $this.closest('.tmb'),
14257				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
14258				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
14259				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
14260				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
14261				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
14262				$title = $('.t-entry-title', $tmb),
14263				is_frontend_editor = $this.closest('.vc_controls').length,
14264				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
14265				$parent_cursor = $this.closest('[class*="custom-cursor"]');
14266
14267			if ( is_frontend_editor ) {
14268				cursorType = 'auto';
14269			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
14270				cursorType = data_cursor;
14271			} else if ( $parent_cursor.length ) {
14272				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
14273					cursorType = 'icon-light';
14274				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
14275					cursorType = 'icon-diff';
14276				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
14277					cursorType = 'icon-accent';
14278				} else {
14279					cursorType = 'icon-dark';
14280				}
14281			} else {
14282				cursorType = 'pointer';
14283			}
14284
14285			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
14286				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
14287					cursorTitle = custom_text;
14288				} else {
14289					cursorTitle = $title.clone();
14290					$('a', cursorTitle).replaceWith(function() {
14291						return this.childNodes;
14292					});
14293					$('*', cursorTitle).replaceWith(function(){
14294						return $(this).removeAttr('class');
14295					});
14296					cursorTitle = cursorTitle.html();
14297				}
14298			} else {
14299				cursorTitle = '';
14300			}
14301
14302			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
14303				tooltip_class = data_class;
14304			} else {
14305				tooltip_class = '';
14306			}
14307
14308			if ( cursor_bg == 'true' ) {
14309				cursorBg = true;
14310			} else {
14311				cursorBg = false;
14312			}
14313
14314			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
14315		}).on("mouseleave.cursor", href, function(e) {
14316			var outTime = 150;
14317			if ( currentBg !== false && cursorBg === false ) {
14318				outTime = 0;
14319			}
14320			delayChangeCursor('auto', '', false, outTime, false, '');
14321		});
14322
14323		$(window).on('disable-hover', function(event) {
14324			document.addEventListener("mousemove", function(e) {
14325				mouseEvent = e;
14326			});
14327			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
14328		});
14329
14330		$(window).on('enable-hover', function(event) {
14331			if ( typeof mouseEvent !== 'undefined' ) {
14332				var x = mouseEvent.clientX,
14333					y = mouseEvent.clientY;
14334
14335				var elements = document.elementsFromPoint(x, y),
14336					$element = $(elements[0]);
14337
14338				$element.closest(href).trigger('mouseenter');
14339			}
14340		});
14341
14342	}
14343
14344	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14345		changeCursor();
14346	});
14347
14348	$(document).ajaxComplete(function( event, xhr, settings ) {
14349		changeCursor();
14350	});
14351
14352	$('.isotope-container').on('isotope-layout-complete', function() {
14353		var $this = $(this);
14354		changeCursor($this);
14355	});
14356
14357};
14358
14359UNCODE.magneticCursor = function(){
14360	function magneticCursor($wrap){
14361		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14362		var $magnetics = $wrap.find('.tmb-image-anim-magnetic .t-entry-visual').has('img:not(.avatar), .t-background-cover, .dummy.secondary-dummy-image, .t-secondary-background-cover').add($('.magnetic').has('.background-inner, .header-bg'));
14363
14364		$magnetics.on('mousemove', function(e){
14365			var $this = $(this),
14366				$el,
14367				bound = e.currentTarget.getBoundingClientRect(),
14368				coeff = 30,
14369				hor = (bound.width / 2) - (e.clientX - bound.left),
14370				ver = (bound.height / 2) - (e.clientY - bound.top),
14371				toX = hor / bound.width * coeff,
14372				toY = ver / bound.height * coeff,
14373				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
14374				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
14375				toScale = Math.max(scaleX, scaleY);
14376
14377			if ( $this.hasClass('magnetic') ) {
14378				$el = $('.background-inner, .header-bg', $this);
14379			} else {
14380				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14381			}
14382
14383			gsap.killTweensOf($el);
14384			gsap.to( $el, {
14385				duration: 0.75,
14386				x: toX,
14387				y: toY,
14388				scale: toScale,
14389				ease: Power1.easeOut,
14390				transformPerspective: 900,
14391				transformOrigin: 'center',
14392				force3D: true
14393			});
14394		}).on('mouseout', function(e){
14395			var $this = $(this),
14396				$el
14397			if ( $this.hasClass('magnetic') ) {
14398				$el = $('.background-inner, .header-bg', $this);
14399			} else {
14400				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14401			}
14402			gsap.killTweensOf($el);
14403			gsap.to( $el, {
14404				duration: 0.6,
14405				y: 0,
14406				x: 0,
14407				scale: 1,
14408				ease: Power1.easeOut,
14409				transformPerspective: 900,
14410				transformOrigin: 'center',
14411				force3D: true
14412			});
14413		});
14414	};
14415
14416	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14417		magneticCursor();
14418	});
14419
14420	$(document).ajaxComplete(function( event, xhr, settings ) {
14421		magneticCursor();
14422	});
14423
14424	$('.isotope-container').on('isotope-layout-complete', function() {
14425		var $this = $(this);
14426		magneticCursor($this);
14427	});
14428
14429};
14430
14431UNCODE.dropImage = function() {
14432
14433	/****************************
14434	 * Image hover *
14435	****************************/
14436	function imageHover(){
14437		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14438			return;
14439		}
14440
14441		var $postLists = $('.uncode-post-titles');
14442		$postLists.each(function(){
14443			var $list = $(this),
14444				timing = parseFloat( $list.attr('data-timing') ),
14445				default_image = $list.hasClass('uncode-post-titles-default-image'),
14446				default_title = $list.hasClass('uncode-post-titles-default-title'),
14447				$tmbs = $('.tmb', $list),
14448				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
14449				clientX,
14450				clientY,
14451				$row_parent = $list.closest('.vc_row'),
14452				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
14453				$col_parent = $list.closest('.uncell'),
14454				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
14455				stoppedScrolling = true,
14456				setCTA;
14457
14458			timing *= 0.001;
14459
14460			var drop_bgs = function(){
14461				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
14462					var $drop = $(this),
14463						srcset = $drop.attr('data-bgset'),
14464						setArr = srcset.split(","),
14465						setArrOrder = [],
14466						biggest = 0,
14467						checkBg = false,
14468						desktopBG = $drop.data('[data-background-image]'),
14469						mobileBG = $drop.data('[data-mobile-background-image]');
14470
14471					if ( $drop.hasClass('srcset-bg-async') ) {
14472
14473						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
14474							return;
14475						}
14476						
14477					}
14478
14479					if ( SiteParameters.uncode_adaptive == true ) {
14480						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
14481							$drop.css({
14482								'background-image' : 'url(' + setArr[0] + ')'
14483							});
14484						}
14485					} else {
14486						for ( var i = 0; i < setArr.length; i++ ) {
14487							var setLoop = setArr[i].trim().split(" ");
14488							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
14489								var parseSet = parseFloat(setLoop[1]);
14490								if ( biggest < parseSet ) {
14491									biggest = parseSet;
14492								}
14493								setArrOrder[parseSet] = setLoop[0];
14494								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
14495									checkBg = true;
14496									$drop.css({
14497										'background-image' : 'url(' + setLoop[0] + ')'
14498									});
14499								}
14500							}
14501						}
14502
14503						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
14504							$drop.css({
14505								'background-image' : 'url(' + setArrOrder[biggest] + ')'
14506							});
14507						}
14508					}
14509
14510				});
14511			};
14512
14513			drop_bgs();
14514
14515			var dropMovesSize = function(){
14516				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
14517					return;
14518				}
14519				$drop_moves.each(function(){
14520					var $drop_move = $(this),
14521						dataW = $drop_move.attr('data-w'),
14522						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
14523					if ( typeof dataW !== 'undefined' && dataW !== null ) {
14524						dataW = screenInfo.width / 12 * parseFloat( dataW );
14525					}
14526					$drop_moves.css({
14527						width: dataW
14528					});
14529
14530					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14531						$anim_parent.on('animationend', function(){
14532							var bound = $anim_parent[0].getBoundingClientRect();
14533							$drop_move.css({
14534								left: bound.x * -1,
14535								top: bound.y * -1,
14536							});
14537						});
14538					}
14539				});
14540
14541
14542			};
14543
14544			dropMovesSize();
14545
14546			$(window).on( 'resize', function(){
14547				clearRequestTimeout(setCTA);
14548				setCTA = requestTimeout( function() {
14549					drop_bgs();
14550					dropMovesSize();
14551				}, 100 );
14552			});
14553
14554			if ( $drop_row_parents.length ) {
14555				$row_parent.addClass( 'drop-added' );
14556			}
14557
14558			$drop_row_parents.each(function(index, val){
14559				var $drop = $(val);
14560				$row_parent.prepend($drop);
14561				manageVideos($drop, false);
14562				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14563					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14564				}
14565				if ( default_image && index == 0 ) {
14566					manageVideos($drop, true);
14567					var bgStyle = $drop.css('background-image');
14568					var match = bgStyle && bgStyle.match(/url\(["']?([^"')]+)["']?\)/);
14569					var bg_img = match ? match[1] : null;
14570					var image_ph = new Image();
14571
14572					if (bg_img) {
14573						image_ph.onload = function() {
14574							$drop.addClass('active');
14575							if (default_title) {
14576								$list.addClass('drop-hover');
14577								$tmbs.first().addClass('drop-active');
14578							}
14579						};
14580						image_ph.src = bg_img;
14581					}
14582					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14583						image_ph.onload = function() {
14584							$drop.addClass('active');
14585							if ( default_title ) {
14586								$list.addClass('drop-hover');
14587								$tmbs.first().addClass('drop-active');
14588							}
14589						};
14590						image_ph.src = bg_img;
14591					}
14592				}
14593			});
14594
14595			if ( $drop_col_parents.length ) {
14596				$col_parent.addClass( 'drop-added' );
14597			}
14598
14599			$drop_col_parents.each(function(index, val){
14600				var $drop = $(this);
14601				$col_parent.prepend($drop);
14602				manageVideos($drop, false);
14603				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14604					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14605				}
14606				if ( default_image && index == 0 ) {
14607					manageVideos($drop, true);
14608					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
14609						image_ph = new Image();
14610					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14611						image_ph.onload = function() {
14612							$drop.addClass('active');
14613							if ( default_title ) {
14614								$list.addClass('drop-hover');
14615								$tmbs.first().addClass('drop-active');
14616							}
14617						};
14618						image_ph.src = bg_img;
14619					}
14620				}
14621			});
14622
14623			function manageVideos( $el, start ) {
14624				var videoElem = $('video', $el),
14625					$iframe = $('iframe', $el),
14626					iframeID = $iframe.attr('id');
14627				if ( videoElem.length ) {
14628					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
14629						if ( start ) {
14630							videoElem[0].setCurrentTime(0);
14631							videoElem[0].play();
14632						} else {
14633							videoElem[0].pause();
14634							videoElem[0].setCurrentTime(0);
14635						}
14636					} else {
14637						if ( start ) {
14638							videoElem[0].currentTime = 0;
14639							videoElem[0].play();
14640						} else {
14641							videoElem[0].pause();
14642							videoElem[0].currentTime = 0;
14643						}
14644					}
14645				}
14646
14647				$el.data('active', start);
14648
14649				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
14650					var iframeIDv = iframeID.replace('okplayer-', ''),
14651						optionsV = $(window).data('okoptions-' + iframeIDv),
14652						vimeo = $iframe[0],
14653						playerV = new Vimeo.Player(vimeo),
14654						timeV = 0;
14655
14656					if (optionsV.time != null) {
14657						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
14658						for ( var i = 0; i < timeArr.length; i++ ) {
14659							if ( timeArr[i] === 'h' ) {
14660								timeV += parseFloat(timeArr[i-1]) * 3600;
14661							} else if ( timeArr[i] === 'm' ) {
14662								timeV += parseFloat(timeArr[i-1]) * 60;
14663							} else if ( timeArr[i] === 's' ) {
14664								timeV += parseFloat(timeArr[i-1]);
14665							}
14666						}
14667					}
14668					playerV.setCurrentTime(timeV);
14669					if ( start ) {
14670						playerV.setVolume(0);
14671						playerV.play();
14672					} else {
14673						playerV.pause();
14674					}
14675				} else if ( $el.attr('data-provider') === 'youtube' ) {
14676					if ( start ) {
14677						$el.trigger('uncode-resume');
14678					} else {
14679						$el.trigger('uncode-pause');
14680					}
14681				}
14682
14683			}
14684
14685			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
14686
14687				document.addEventListener("mousemove", function(e) {
14688					$drop_moves.each(function(){
14689						var $drop_move = $(this),
14690							duration = 0.4;
14691
14692						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
14693							duration = 0.8;
14694						}
14695
14696						clientX = e.clientX;
14697						clientY = e.clientY;
14698
14699						gsap.to( $drop_move, {
14700							duration: duration,
14701							x: clientX,
14702							y: clientY,
14703							ease: Power1.easeOut,
14704						});
14705					});
14706				});
14707
14708			} else {
14709
14710				$(window).on("touchend scroll", function(e) {
14711					$list.removeClass('drop-hover');
14712					$drop_moves.removeClass('active');
14713					$tmbs.removeClass('drop-active');
14714				});
14715
14716				$drop_moves.each(function(){
14717					var $drop_move = $(this),
14718						$tmb = $drop_move.closest('.tmb'),
14719						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
14720
14721					if ( $anim_parent.hasClass('uncode-skew') ) {
14722						$anim_parent.css({
14723							'transform': 'skew(0)'
14724						});
14725					}
14726
14727					$tmb.on('touchend', function(e){
14728						e.stopPropagation();
14729
14730						$drop_moves.removeClass('active');
14731						$tmbs.removeClass('drop-active');
14732
14733						$list.addClass('drop-hover');
14734						$tmb.addClass('drop-active');
14735						$drop_move.addClass('active');
14736						manageVideos($drop_move, true);
14737						clientX = e.changedTouches[0].clientX;
14738						clientY = e.changedTouches[0].clientY;
14739
14740						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14741							var bound = $anim_parent[0].getBoundingClientRect();
14742							clientX = clientX - bound.x;
14743							clientY = clientY - bound.y;
14744						}
14745
14746						$drop_move.css({
14747							left: clientX,
14748							top: clientY
14749						});
14750					});
14751				});
14752
14753			}
14754
14755			$tmbs.each(function(e){
14756				var $tmb = $(this),
14757					// $trgr = $('a', $tmb),
14758					$trgr = $tmb,
14759					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
14760					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
14760(.t-inside), .parallax-el'),
14761					$video = $('video', $tmb),
14762					$iframe = $('iframe', $tmb),
14763					$entryTxt = $('.t-entry-text', $tmb),
14764					stopBounding;
14765
14766				$entryTxt.add($drop_move).css({
14767					'transition-duration': timing + 's'
14768				});
14769
14770				if ( $video.length ) {
14771					var vidH = $video[0].videoHeight,
14772						vidW = $video[0].videoWidth;
14773					$video.css({
14774						'height': vidH,
14775						'width': vidW
14776					});
14777				}
14778
14779				if ( $iframe.length ) {
14780					var vidH = $drop_move.attr('data-height'),
14781						vidW = $drop_move.attr('data-width');
14782					$iframe.css({
14783						'height': vidH,
14784						'width': vidW
14785					});
14786				}
14787
14788				$iframe.each(function(){
14789					var $video = $(this),
14790						vidH = $video[0].videoHeight,
14791						vidW = $video[0].videoWidth;
14792					$video.css({
14793						'height': vidH,
14794						'width': vidW
14795					});
14796				});
14797
14798				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
14799					$trgr.on('mouseenter',function(e){
14800
14801						$list.addClass('drop-hover');
14802						$tmbs.removeClass('drop-active');
14803						$tmb.addClass('drop-active');
14804						$drop_move.addClass('active');
14805						manageVideos($drop_move, true);
14806
14807						var clientX = e.clientX,
14808							clientY = e.clientY;
14809						$drop_move.css({
14810							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
14811						});
14812
14813					})
14814					.on('mouseleave', function(e){
14815						$list.removeClass('drop-hover');
14816						$drop_move.css({
14817							'transition-duration': ( timing*1.25 ) + 's'
14818						});
14819						$drop_move.removeClass('active');
14820						$tmb.removeClass('drop-active');
14821						$drop_move.on('transitionend', function(e){
14822							$drop_move.off('transitionend');
14823							$drop_move.css({
14824								'transition-duration': timing + 's'
14825							});
14826							manageVideos($drop_move,false);
14827						});
14828					});
14829
14830					document.addEventListener('visibilitychange', function(){
14831						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
14832							$drop_move.css({
14833								'transition-duration': '0s'
14834							});
14835							$drop_move.removeClass('active');
14836							manageVideos($drop_move, false);
14837						}
14838					});
14839
14840					document.addEventListener('scroll', function(){
14841						window.clearRequestTimeout( stopBounding );
14842						if ( stoppedScrolling ) {
14843							stoppedScrolling = false;
14844							if ( $drop_move.hasClass('active') ) {
14845								$list.removeClass('drop-hover');
14846								$tmbs.removeClass('drop-active');
14847								$drop_move.removeClass('active');
14848								$drop_move.on('transitionend', function(e){
14849									$drop_move.off('transitionend');
14850									$drop_move.css({
14851										'transition-duration': timing + 's'
14852									});
14853									manageVideos($drop_move,false);
14854								});
14855							}
14856						}
14857
14858						stopBounding = requestTimeout(function() {
14859							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14860								var bound = $anim_parent[0].getBoundingClientRect();
14861								$drop_move.css({
14862									left: bound.x * -1,
14863									top: bound.y * -1,
14864								});
14865							}
14866							stoppedScrolling = true;
14867						}, 500);
14868					});
14869				}
14870
14871				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
14872					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
14873
14874				$drop.css({
14875					'transition-duration': timing + 's'
14876				});
14877
14878				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
14879					$trgr.on('mouseenter',function(e){
14880						$row_parent.add($col_parent).addClass('drop-list-loaded');
14881						$list.addClass('drop-hover');
14882
14883						if ( !$tmb.hasClass('drop-active') ) {
14884							$tmbs.removeClass('drop-active');
14885							$tmb.addClass('drop-active');
14886							if ( default_image && !$drop.hasClass('active') ) {
14887								var $prev = $('[data-drop].active', $row_parent);
14888								$prev.css({
14889									'transition-duration': (timing*1.5) + 's'
14890								});
14891								$prev.removeClass('active');
14892								$prev.on('transitionend', function(e){
14893									$prev.off('transitionend');
14894									manageVideos($prev,false);
14895								});
14896							}
14897							$drop.css({
14898								'transition-duration': timing + 's'
14899							});
14900							$drop.off('transitionend');
14901							$drop.addClass('active');
14902							manageVideos($drop, true);
14903						}
14904					})
14905					.on('mouseleave', function(e){
14906						if ( ( default_image && !default_title ) || !default_image ) {
14907							$list.removeClass('drop-hover');
14908							$tmb.removeClass('drop-active');
14909						}
14910						if ( ! default_image ) {
14911							$drop.css({
14912								'transition-duration': (timing*1.5) + 's'
14913							});
14914							$drop.removeClass('active');
14915
14916							$drop.on('transitionend', function(e){
14917								$drop.off('transitionend');
14918								manageVideos($drop,false);
14919							});
14920						}
14921					});
14922
14923					document.addEventListener('visibilitychange', function(){
14924						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
14925							$drop.css({
14926								'transition-duration': '0s'
14927							});
14928							$drop.removeClass('active');
14929							manageVideos($drop, false);
14930						}
14931					});
14932				}
14933			});
14934
14935		});
14936	};
14937
14938	$(window).on('load', function(event) {
14939		imageHover();
14940	});
14941
14942	var drop_wp_animation = function() {
14943		var $postLists = $('.uncode-post-titles');
14944		$postLists.each(function(){
14945			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
14946				new Waypoint({
14947					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
14948					element: val,
14949					handler: function() {
14950						var element = $(this.element),
14951							parent = element.closest('.tmb'),
14952							currentIndex = parent.index(),
14953							delay = currentIndex,
14954							delayAttr = parseInt(element.attr('data-delay'));
14955						if (isNaN(delayAttr)) delayAttr = 100;
14956						var objTimeout = requestTimeout(function() {
14957							element.addClass('start_animation');
14958
14959							var nextTimeout = requestTimeout(function() {
14960								$('.drop-image-separator', parent).addClass('start_animation');
14961							}, 50);
14962
14963						}, delay * delayAttr);
14964						if (!UNCODE.isUnmodalOpen) {
14965							this.destroy();
14966						}
14967					},
14968					offset: UNCODE.isFullPage ? '100%' : '90%'
14969				})
14970			});
14971		});
14972	}
14973
14974	var runWaypoints_TO,
14975		runWaypoints_delay = 0;
14976
14977	var runWaypoints = function(){
14978		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
14979			runWaypoints_delay = 400;
14980		}
14981		clearRequestTimeout(runWaypoints_TO);
14982		runWaypoints_TO = requestTimeout(function() {
14983			drop_wp_animation();
14984		}, runWaypoints_delay);
14985	};
14986	runWaypoints();
14987	$( document.body ).on( 'uncode_waypoints', runWaypoints );
14988	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14989		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
14990			// imageHover();
14991			runWaypoints();
14992		});
14993	}
14994};
14995
14996UNCODE.postTable = function() {
14997
14998	var clickRow = function(){
14999		var $postLists = $('.uncode-post-table');
15000
15001		$postLists.each(function(){
15002			var $postList = $(this),
15003				$tmbClicks = $('.tmb.tmb-click-row', $postList);
15004
15005			$tmbClicks.each(function(){
15006				var $tmb = $(this),
15007					$click = $('.table-click-row', $tmb);
15008				$('*:not(.table-click-row)', $tmb).on('click', function(e){
15009					e.preventDefault();
15010					e.stopPropagation();
15011					$click[0].click();
15012					return false;
15013				});
15014			});
15015
15016		})
15017	};
15018
15019	clickRow();
15020
15021	var hoverRow = function(){
15022		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
15023
15024		$postLists.on('mouseenter', function(){
15025			$(this).addClass('post-table-hover');
15026		});
15027		$postLists.on('mouseleave', function(){
15028			$(this).removeClass('post-table-hover');
15029		});
15030	}
15031
15032	hoverRow();
15033
15034	var drop_wp_animation = function() {
15035		var $postLists = $('.uncode-post-table');
15036		$postLists.each(function(){
15037			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
15038				new Waypoint({
15039					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15040					element: val,
15041					handler: function() {
15042						var element = $(this.element),
15043							parent = element.closest('.tmb'),
15044							currentIndex = parent.index(),
15045							delay = currentIndex,
15046							delayAttr = parseInt(element.attr('data-delay'));
15047						if (isNaN(delayAttr)) delayAttr = 100;
15048						var objTimeout = requestTimeout(function() {
15049							element.addClass('start_animation');
15050						}, delay * delayAttr);
15051						if (!UNCODE.isUnmodalOpen) {
15052							this.destroy();
15053						}
15054					},
15055					offset: UNCODE.isFullPage ? '100%' : '90%'
15056				})
15057			});
15058		});
15059	}
15060
15061	var runWaypoints_TO,
15062		runWaypoints_delay = 0;
15063
15064	var runWaypoints = function(){
15065		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
15066			runWaypoints_delay = 400;
15067		}
15068		clearRequestTimeout(runWaypoints_TO);
15069		runWaypoints_TO = requestTimeout(function() {
15070			drop_wp_animation();
15071		}, runWaypoints_delay);
15072	};
15073	runWaypoints();
15074	$( document.body ).on( 'uncode_waypoints', runWaypoints );
15075	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15076		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
15077			runWaypoints();
15078			// clickRow();
15079		});
15080	}
15081};
15082
15083UNCODE.rotatingTxt = function($ctxt) {
15084
15085	if ( $('body').hasClass('compose-mode') ) {
15086		return;
15087	}
15088
15089	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
15090	var setCTA;
15091
15092	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
15093		var $heading = $(this),
15094			// debug = 0,
15095			cycle = 0,
15096			$trgt,
15097			$toMove,
15098			$highl,
15099			$col = $heading.closest('.uncont'),
15100			txt,
15101			arrTxt,
15102			textFadeIn, textFadeOut,
15103			removeWraps;
15104
15105		var defineObjs = function() {
15106			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
15107				var $rtx = $(this),
15108					fx = $rtx.attr('data-fx'),
15109					wait = $rtx.attr('data-wait'),
15110					$prev = $(this).prev().addClass('prev-rotating-start'),
15111					splitToMove = [],
15112					splitArray = [],
15113					lineArray = [],
15114					lineIndex = 0,
15115					lineStart = true,
15116					lineEnd = false,
15117					startSplit = false,
15118					$line_wrap = $rtx.closest('.heading-line-wrap'),
15119					same_line = true,
15120					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
15121					indexRtx = $splits.index($rtx);
15122
15123				fx = typeof fx === 'undefined' ? '' : fx;
15124				wait = typeof wait === 'undefined' ? '' : wait;
15125
15126				$splits.each(function(key, val){
15127					var $split = $(this),
15128						$new_line_wrap = $split.closest('.heading-line-wrap');
15129
15130					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
15131						splitArray.push( $split );
15132					}
15133
15134					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15135						startSplit = false;
15136					}
15137
15138					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15139						splitArray.push( $split );
15140
15141						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
15142							same_line = true;
15143						} else {
15144							same_line = false;
15145						}
15146					}
15147
15148					if ( key == indexRtx ) {
15149						if ( /\S/.test($split.text()) ) {
15150							startSplit = true;
15151							$line_wrap = $split.closest('.heading-line-wrap');
15152							splitArray.push( $split );
15153						} else {
15154							indexRtx++;
15155						}
15156					}
15157
15158					$line_wrap = $new_line_wrap;
15159				});
15160
15161				$toMove = $($.map(splitToMove, function(el){return el.get();}));
15162				$trgt = $($.map(splitArray, function(el){return el.get();}));
15163
15164				if ( same_line ) {
15165					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
15166					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
15167				}
15168
15169				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
15170					$prev.addClass('empty-span-hidden');
15171				}
15172
15173				$highl = $('.heading-text-highlight-inner', $trgt);
15174
15175				$rtx.attr('data-animated', 'true');
15176				if ( cycle == 0 ) {
15177					$( document.body ).trigger('defer-highlights');
15178					cycle++;
15179					defineObjs();
15180					return;
15181				}
15182				cycle++;
15183
15184				txt = $rtx.attr('data-text');
15185				arrTxt = txt.split("|");
15186
15187				textFadeOut($trgt);
15188
15189			});
15190		};
15191
15192		removeWraps = function(){
15193
15194			// if ( debug == 1 ) return;
15195			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
15196			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
15197
15198
15199				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
15200					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
15201
15202				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
15203
15204				$splitFlow.each(function(){
15205					$(this).append($temp_highl);
15206				});
15207
15208				var $line_wrap = $wraps[wrap_k];
15209				var $parent_wrap = $line_wrap.parentNode;
15210				if ( $parent_wrap !== null ) {
15211					while ( $line_wrap.firstChild ) {
15212						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
15213					}
15214					$parent_wrap.removeChild($line_wrap);
15215				}
15216			}
15217			// debug++;
15218			defineObjs();
15219		};
15220
15221		var loop = 0;
15222		textFadeIn = function($trgt){
15223			var word = arrTxt[loop].split(" "),
15224				worsSpan = '',
15225				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15226				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15227				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
15228
15229			for (var w = 0; w < word.length; w++) {
15230				var highl;
15231				if ( $highl.length ) {
15232					highl = $highl[0].outerHTML;
15233				} else {
15234					highl = '';
15235				}
15236
15237				if ( w > 0 ) {
15238					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
15239				}
15240				var charachters = word[w].split('');
15241				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
15242				if ( ! SiteParameters.uncode_has_ligatures ) {
15243					for (var c = 0; c < charachters.length; c++) {
15244						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
15245					}
15246				} else {
15247					worsSpan += word[w];
15248				}
15249				worsSpan += '</span>' + highl + '</span></span>';
15250			}
15251
15252			if ( $wrap.length && $wrap_inner.length ) {
15253				var words_w = $wrap_inner.outerWidth();
15254				$wrap.css({
15255					width: words_w
15256				});
15257
15258				$highl = $('.heading-text-highlight-inner', $wrap);
15259				$highl.prependTo($wrap);
15260
15261				$wrap_inner.css({
15262					opacity: 0
15263				});
15264
15265				$wrap_inner.html(worsSpan);
15266				$('.heading-text-highlight-inner', $wrap_inner).remove();
15267				words_w = $wrap_inner.innerWidth();
15268
15269				var duration = 0.45;
15270
15271				$heading.removeClass('auto-width');
15272				if ( words_w > $col.width() ) {
15273					$heading.addClass('auto-width');
15274					words_w = 'auto';
15275					duration = 0;
15276				}
15277
15278				$wrap.css({
15279					'width': words_w,
15280					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
15281				});
15282
15283				var $word_inner = $('.split-word-inner', $wrap_inner),
15284					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
15285
15286				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15287
15288				if ( !$target_fx.length ) {
15289					return;
15290				}
15291
15292				gsap.killTweensOf($target_fx);
15293
15294				if ( fx !== 'zoom' ) {
15295					gsap.fromTo( $target_fx, {
15296						y: fx === 'opacity' ? '0%' : '-10%'
15297					},{
15298						delay: duration,
15299						duration: 0.25,
15300						y: '0%',
15301						ease: Circ.easeOut,
15302					});
15303
15304					if ( !$wrap_inner.length ) {
15305						return;
15306					}
15307
15308					gsap.fromTo( $wrap_inner, {
15309						opacity: 0,
15310					},{
15311						delay: duration,
15312						duration: 0.25,
15313						opacity: 1,
15314						ease: Circ.easeOut,
15315						onComplete: function(){
15316							$('> .heading-text-highlight-inner', $wrap).remove();
15317							$wrap_inner.html(worsSpan);
15318							removeWraps();
15319						}
15320					})
15321
15322				} else {
15323					gsap.fromTo( $target_fx, {
15324						transformOrigin: '50%',
15325						opacity: 0,
15326						scale: 0.875,
15327					},{
15328						opacity: 1,
15329						delay: duration,
15330						duration: 0.25,
15331						scale: 1,
15332						ease: Circ.easeOut,
15333						onComplete: function(){
15334							$('> .heading-text-highlight-inner', $wrap).remove();
15335							$wrap_inner.html(worsSpan);
15336							removeWraps();
15337						}
15338					});
15339				}
15340
15341			} else {
15342
15343				if ( !$wrap_inner.length ) {
15344					return;
15345				}
15346
15347				gsap.to( $wrap_inner, {
15348					duration: 0.4,
15349					opacity: 0,
15350					ease: Power1.easeOut,
15351					onComplete: function(){
15352						$wrap_inner.html(worsSpan);
15353						words_w = $wrap_inner.innerWidth();
15354
15355						gsap.to( $wrap_inner, {
15356							duration: 0.2,
15357							opacity: 1,
15358							ease: Power1.easeOut,
15359							onComplete: function(){
15360								$('> .heading-text-highlight-inner', $wrap).remove();
15361								$wrap_inner.html(worsSpan);
15362								removeWraps();
15363							}
15364						})
15365					}
15366				});
15367			}
15368
15369			if ( loop < arrTxt.length-1 ) {
15370				loop++;
15371			} else {
15372				loop = 0;
15373			}
15374
15375		};
15376
15377		textFadeOut = function($trgt){
15378			var $word_inner = $('.split-word-inner', $trgt),
15379				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15380				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15381				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
15382				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
15383
15384			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
15385
15386			var gsap_param = {
15387					delay: wait,
15388					duration: 0.25,
15389					y: fx === '' ? '10%' : '0%',
15390					opacity: 0,
15391					ease: Circ.easeOut,
15392					onStart: function(){
15393						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
15394							$highl = $('.heading-text-highlight-inner', $wrap);
15395							$highl.prependTo($wrap);
15396						}
15397					},
15398					onComplete: textFadeIn,
15399					onCompleteParams: [$trgt]
15400				};
15401
15402			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15403
15404			if ( fx === '' ) {
15405				gsap_param.y = '10%';
15406			} else if ( fx === 'zoom' ) {
15407				gsap_param.scale = '1.045';
15408			}
15409
15410			if ( !$target_fx.length ) {
15411				return;
15412			}
15413
15414			if ( $heading.data('waypoint') !== true ) {
15415				var textInView = new Waypoint.Inview({
15416					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15417					element: $heading[0],
15418					enter: function(direction) {
15419						$heading.data('waypoint',true);
15420						gsap.fromTo( $target_fx, {
15421							transformOrigin: '50%'
15422						}, gsap_param );
15423					}
15424				});
15425			} else {
15426				gsap.fromTo( $target_fx, {
15427					transformOrigin: '50%'
15428				}, gsap_param );
15429			}
15430		};
15431
15432		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15433			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
15434				var $el = model.view.$el,
15435					shortcode = model.attributes.shortcode;
15436
15437				UNCODE.rotatingTxt($el);
15438			});
15439		} else {
15440			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
15441				$heading.on('already-animated', function(){
15442					removeWraps();
15443					window.addEventListener('removeOldLines', function(){
15444						clearRequestTimeout(setCTA);
15445						setCTA = requestTimeout( removeWraps, 150 );
15446					});
15447				});
15448			} else {
15449				$(window).on('load', function(){
15450					removeWraps();
15451					window.addEventListener('removeOldLines', function(){
15452						clearRequestTimeout(setCTA);
15453						setCTA = requestTimeout( removeWraps, 150 );
15454					});
15455				});
15456			}
15457		}
15458	});
15459
15460};
15461
15462UNCODE.verticalText = function() {
15463	$(window).on('menuCanvasOpen', function(){
15464		$('.vertical-text--fixed').fadeOut(500);
15465		$('.horizontal-text--fixed').fadeOut(500);
15466	}).on('menuCanvasClose', function(){
15467		$('.vertical-text--fixed').fadeIn(500);
15468		$('.horizontal-text--fixed').fadeIn(500);
15469	});
15470
15471	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
15472	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
15473	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
15474	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
15475
15476	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
15477		window.addEventListener('scroll', function(e) {
15478			var totalPageHeight = document.body.scrollHeight;
15479			var scrollPoint = window.scrollY + window.innerHeight;
15480
15481			if (window.scrollY > 0) {
15482				showOnTopVerticalTexts.fadeOut();
15483				showOnTopHorizontalTexts.fadeOut();
15484			} else {
15485				showOnTopVerticalTexts.fadeIn();
15486				showOnTopHorizontalTexts.fadeIn();
15487			}
15488
15489			if (scrollPoint >= totalPageHeight) {
15490				hideOnBottomVerticalTexts.fadeOut();
15491				hideOnBottomHorizontalTexts.fadeOut();
15492			} else {
15493				hideOnBottomVerticalTexts.fadeIn();
15494				hideOnBottomHorizontalTexts.fadeIn();
15495			}
15496		}, false);
15497	}
15498};
15499
15500UNCODE.stickyScroll = function( $el ) {
15501	if ( typeof $el === 'undefined' || $el === null ) {
15502		$el = $('body');
15503	}
15504	var checkVisible = function( el, dir ) {
15505		if (typeof jQuery === "function" && el instanceof jQuery) {
15506			el = el[0];
15507		}
15508
15509		var off = 50;
15510		dir = typeof dir=='undefined' ? 'right' : dir;
15511		var rect = el.getBoundingClientRect();
15512
15513		return (
15514			(
15515				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15516				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15517				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
15518			) &&
15519			(
15520				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15521				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15522				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
15523				( rect.right <= window.innerWidth && rect.left >= 0 )
15524			)
15525		);
15526	};
15527
15528	var setItemsRelHeight = function(reset) {
15529		var $_el = $el;
15530		if ( $el.is('.index-scroll') ) {
15531			var $_el = $el.closest('.uncont');
15532		}
15533		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
15534		// 	$.each($('.tmb', item), function(index, val) {
15535		// 		if ( reset === true ) {
15536		// 			$(val).css( 'visibility', 'hidden' );
15537		// 		} else {
15538		// 			$(val).css( 'visibility', 'visible' );
15539		// 		}
15540		// 	});
15541		// });
15542		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
15543			$.each($('.tmb', item), function(index, val) {
15544				if ( reset === true ) {
15545					$(val).css( 'visibility', 'hidden' );
15546					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
15547				} else {
15548					var $rowParent = $(item).closest('.row-parent'),
15549						rowRatio = $rowParent.attr('data-height-ratio'),
15550						$rowInner = $(item).closest('.row-child'),
15551						rowRatioInner = $rowInner.attr('data-height'),
15552						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15553						$colContainer = $(item).closest('.uncell'),
15554						$uncont = $(item).closest('.uncont'),
15555						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
15556						safe_heigth = $(item).data('safe-height'),
15557						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
15558						offSet = $(item).offset().top - $uncont.offset().top,
15559						multiplier_h,
15560						data_viewport_h,
15561						body_border = $('.body-borders .top-border').outerHeight() * 2,
15562						remove_menu = $(item).data('vp-menu');
15563
15564					if ( rowRatio === 'full' || rowRatio === '' ) {
15565						rowRatio = 1;
15566					} else {
15567						rowRatio = rowRatio / 100;
15568					}
15569
15570					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
15571						rowRatio = rowRatio;
15572					} else {
15573						rowRatio = rowRatio * rowRatioInner / 100;
15574					}
15575
15576					winHeight = winHeight * rowRatio;
15577
15578					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
15579						multiplier_h = parseInt($(item).attr('data-vp-height'));
15580					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
15581						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
15582					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
15583						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
15584					}
15585
15586					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
15587						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
15588						if ( remove_menu === true ) {
15589							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
15590						}
15591						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
15592					} else {
15593						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
15594					}
15595
15596				}
15597			});
15598		});
15599		$('.index-scroll', $_el).each(function(i, item){
15600			var $uncoltable = $(item).closest('.uncoltable'),
15601				$rowParent = $(item).closest('.row-parent'),
15602				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15603				body_border = $('.body-borders .top-border').outerHeight() * 2,
15604				$index_row = $('.index-row', item),
15605				safe_heigth = $index_row.data('safe-height'),
15606				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
15607			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
15608				var data_viewport_h = winHeight - ( paddingRow + body_border );
15609				$uncoltable.css({
15610					'min-height': data_viewport_h
15611				});
15612			} else {
15613				$uncoltable.css({
15614					'min-height': 'auto'
15615				});
15616			}
15617		});
15618
15619	}
15620	setItemsRelHeight();
15621
15622	var $index_scrolls = $('.index-scroll', $el);
15623
15624	$index_scrolls.each(function(key, value){
15625		var $index = $(this),
15626			$parent_row = $index.closest('.vc_row[data-parent]'),
15627			$index_row = $('.index-row', $index),
15628			dir = $index_row.attr('data-direction');
15629		dir = typeof dir === 'undefined' ? 'right' : dir;
15630
15631		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
15632
15633		if ( $('.animate_when_almost_visible', $index).length ) {
15634			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
15635		}
15636
15637	});
15638
15639	var $horScrolls = $('.unscroll-horizontal', $el);
15640
15641	if ( $horScrolls.length ) {
15642
15643		$('body').addClass('scrolling-trigger');
15644
15645		$horScrolls.each(function(key, value){
15646			var $section = $(this),
15647				$index_scroll = $('.index-scroll', $section),
15648				$index_row = $('.index-row', $index_scroll),
15649				dir = $section.attr('data-direction'),
15650				wrap = $index_row.attr('data-wrap'),
15651				$pinWrap,
15652				$pinTrigger;
15653
15654			dir = typeof dir === 'undefined' ? 'right' : dir;
15655			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
15656			$pinWrap = $('<div class="pin-wrap" />');
15657			if ( SiteParameters.is_frontend_editor ) {
15658				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
15659				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
15660			} else {
15661				if ( wrap === 'column' ) {
15662					$index_scroll.wrapInner( $pinWrap );
15663				} else {
15664					$('> .row', $section).wrap( $pinWrap );
15665				}
15666				$section.wrapInner( $pinTrigger );
15667			}
15668
15669		});
15670
15671		var $pinWraps = $('.pin-wrap', $el);
15672
15673		var horScrollSizes = function(){
15674
15675			$pinWraps.each(function(key, val){
15676				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
15677					$pinTrigger = $pinWrap.closest('.pin-trigger'),
15678					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
15679					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
15680					$boxContainer = $('.box-container'),
15681					box_m = $boxContainer.css('margin-left'),
15682					st_active = true;
15683
15684				var setHorW,
15685				horWidth = function(){
15686					$index_scroll.each(function(){
15687						var $this = $(this),
15688							$index_row = $('.index-row', $this),
15689							$rowContainer = $index_row.closest('.vc_row'),
15690							$rowInner = $index_row.closest('.wpb_row'),
15691							$rowParent = $index_row.closest('.row-parent'),
15692							$tmbs = $('.tmb', $index_row),
15693							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
15694							$uncont = $index_row.closest('.uncont'),
15695							$parent_col = $index_row.closest('.wpb_column'),
15696							col_w = $uncont.width(),
15697							data_lg = parseFloat( $index_row.attr('data-lg') ),
15698							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
15699							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
15700							tmb_w;
15701
15702						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
15703						tmb_w = ( col_w + padding_tmb ) / data_lg;
15704
15705						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
15706							tmb_w = ( col_w + padding_tmb ) / data_sm;
15707						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
15708							tmb_w = ( col_w + padding_tmb ) / data_md;
15709						}
15710
15711						if ( !isNaN(tmb_w) ) {
15712							$tmbs.css({
15713								'width': tmb_w
15714							});
15715						}
15716
15717						$tmbs.css({
15718							'visibility': 'visible'
15719						});
15720
15721					});
15722				};
15723
15724				horWidth();
15725				clearRequestTimeout(setHorW);
15726				setHorW = requestTimeout( function(){
15727					setItemsRelHeight();
15728					horWidth();
15729				}, 100 );
15730
15731				if ( SiteParameters.is_frontend_editor ) {
15732					return;
15733				}
15734
15735				var $vmenu = $('body.vmenu .vmenu-container'),
15736					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
15737					winWidth = window.innerWidth - vmenuW,
15738					$tmb = $('.tmb', $index_scroll).eq(0),
15739					paddingRight = parseFloat( $tmb.css('padding-right') ),
15740					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
15740scroll.width() + paddingRight ) ),
15741					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
15742					scroll_anim;
15743
15744				if ( $('body').hasClass('rtl') ) {
15745					if ( dir === 'left' ) {
15746						scroll_anim = gsap.fromTo( $pinWrap, {
15747							x: stickyScrollLength
15748						},{
15749							x: 0,
15750							ease: "none"
15751						});
15752					} else {
15753						scroll_anim = gsap.fromTo( $pinWrap, {
15754							x: 0
15755						},{
15756							x: stickyScrollLength,
15757							ease: "none"
15758						});
15759					}
15760				} else {
15761					if ( dir === 'left' ) {
15762						scroll_anim = gsap.fromTo( $pinWrap, {
15763							x: -stickyScrollLength
15764						},{
15765							x: 0,
15766							ease: "none"
15767						});
15768					} else {
15769						scroll_anim = gsap.fromTo( $pinWrap, {
15770							x: 0
15771						},{
15772							x: -stickyScrollLength,
15773							ease: "none"
15774						});
15775					}
15776				}
15777
15778				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
15779					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
15780				}
15781
15782				var animationIncrease;
15783
15784				var checkForAnimations = function(){
15785					animationIncrease = 0
15786					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15787						var _this = this;
15788						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
15789							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15790							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15791							requestTimeout(function() {
15792								$(_this).addClass('start_animation');
15793							}, delayAttr + animationIncrease);
15794							animationIncrease += 150;
15795						}
15796						$(_this).on([
15797							'webkitAnimationEnd',
15798							'mozAnimationEnd',
15799							'MSAnimationEnd',
15800							'oanimationend',
15801							'animationend'
15802						].join(' '), function(e) {
15803							$(e.currentTarget).removeClass('animate_when_almost_visible');
15804						});
15805					});
15806
15807					var batchTime = 0;
15808
15809					var resetBatch = function(){
15810						batchTime = 0;
15811					}
15812
15813					if (ScrollTrigger.isScrolling()) {
15814						resetBatch();
15815					}
15816					
15817					$('.tmb-mask-reveal', $pinTrigger).each(function(){
15818						var _this = this,
15819							$this = $(_this),
15820							$inside = $('.t-inside', $this),
15821							delay = parseFloat( $inside.attr('data-delay') ),
15822							speed = parseFloat( $inside.attr('data-speed') ),
15823							easing = $inside.attr('data-easing'),
15824							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
15825
15826						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
15827						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
15828						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
15829						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
15830
15831						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
15832							$this.addClass('tmb-mask-init');
15833							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
15834								gsap.to($('.t-entry-visual-tc', $this), speed, {
15835									clipPath: 'inset(0% 0% 0% 0%)',
15836									delay: delay + batchTime,
15837									ease: easing,
15838								});
15839								gsap.to($('.t-entry-visual-cont', $this), speed, {
15840									clipPath: 'inset(0% 0% 0% 0%)',
15841									scale: 1,
15842									delay: delay + batchTime + (speed*bgDelay),
15843									ease: easing,
15844									onComplete: resetBatch,
15845								});
15846							} else {
15847								gsap.to($('.t-entry-visual-cont', $this), speed, {
15848									clipPath: 'inset(0% 0% 0% 0%)',
15849									scale: 1,
15850									delay: delay + batchTime,
15851									ease: easing,
15852									onComplete: resetBatch,
15853								});
15854							}
15855							batchTime += 0.1;
15856						}
15857					});
15858				
15859				};
15860				checkForAnimations();
15861
15862				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
15863				var start = 0;
15864
15865				var horST = ScrollTrigger.create({
15866					id: "stickySectionScrolling" + key,
15867					scrub: true,
15868					trigger: $pinTrigger[0],
15869					pin: true,
15870					anticipatePin: 1,
15871					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
15872					end: function() { return "+="+stickyScrollLength; },
15873					animation: scroll_anim,
15874					ease: Sine.easeOut,
15875					onUpdate: checkForAnimations,
15876					invalidateOnRefresh: true,
15877					onEnter: function(){
15878						$pinTrigger.addClass('enter-st');
15879					},
15880					onEnterBack: function(){
15881						$pinTrigger.addClass('enter-st');
15882					},
15883					onLeave: function(){
15884						$pinTrigger.removeClass('enter-st');
15885					},
15886					onLeaveBack: function(){
15887						$pinTrigger.removeClass('enter-st');
15888					}
15889				});
15890
15891				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
15892				window.dispatchEvent(new CustomEvent('boxResized'));
15893
15894				var testSecondTrigger = function(){
15895					animationIncrease = 0
15896					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15897						var _this = this;
15898						if ( checkVisible(_this) ) {
15899							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15900							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15901							requestTimeout(function() {
15902								$(_this).addClass('start_animation');
15903							}, delayAttr + animationIncrease);
15904							animationIncrease += 150;
15905						}
15906					});
15907
15908				};
15909
15910				var verST = ScrollTrigger.create({
15911					id: "verticalSectionScrolling" + key,
15912					trigger: $pinTrigger[0],
15913					start: "top center",
15914					end: function() { return "+="+UNCODE.wheight; },
15915					onUpdate: testSecondTrigger,
15916					invalidateOnRefresh: true
15917				});
15918
15919				var setCTA,
15920
15921				dis_enable_ST = function(){
15922					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
15923						horST.kill();
15924						verST.kill();
15925						$pinTrigger.addClass('disabled');
15926						st_active = false;
15927					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15928						horST.kill();
15929						verST.kill();
15930						$pinTrigger.addClass('disabled');
15931						st_active = false;
15932					}
15933				};
15934
15935				$(window).on('resize load', function() {
15936					clearRequestTimeout(setCTA);
15937					setCTA = requestTimeout(function() {
15938						dis_enable_ST();
15939						checkForAnimations();
15940					}, 500);
15941				});
15942
15943			});
15944		};
15945
15946		$(window).on( 'load', function(){
15947			horScrollSizes();
15948		});
15949		var setResize,
15950			setReLayout,
15951			doubleResize = true;
15952		$(window).on( 'load', function(){
15953			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
15954				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
15955				Array.prototype.forEach.call($row_inners, function(el) {
15956					el.style.height = '';
15957					el.style.marginBottom = '';
15958				});
15959				setItemsRelHeight();
15960				horScrollSizes();
15961				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15962					$(document).trigger('uncode-scrolltrigger-refresh');
15963				}
15964			}
15965			var carousel = document.querySelector(".owl-carousel"),
15966				grid = document.querySelector(".isotope-container"),
15967				stickyAll = document.querySelectorAll(".index-scroll");
15968
15969			if ( stickyAll.length ) {
15970				var sticky = stickyAll[(stickyAll.length-1)];
15971			}
15972
15973			if ( typeof sticky !== "undefined" ) {
15974
15975				if ( typeof carousel !== "undefined" && carousel !== null ) {
15976					var carousel_position = sticky.compareDocumentPosition(carousel);
15977				}
15978				if ( typeof grid !== "undefined" && grid !== null ) {
15979					var grid_position = sticky.compareDocumentPosition(grid);
15980				}
15981
15982				if ( carousel_position === 2 || grid_position === 2 ) {
15983					setTimeout(function(){
15984						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15985							$(document).trigger('uncode-scrolltrigger-refresh');
15986						}
15987					}, 500);
15988				}
15989
15990			}
15991			
15992		});
15993        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
15994            android = /Android/.test(navigator.userAgent) && !window.MSStream;
15995		$(window).on( 'resize orientationchange', function(e){
15996			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
15997				return;
15998			}
15999			setItemsRelHeight(true);
16000			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
16001			Array.prototype.forEach.call($row_inners, function(el) {
16002				el.style.height = '';
16003				el.style.marginBottom = '';
16004			});
16005			clearRequestTimeout(setResize);
16006			setResize = requestTimeout( function(){
16007				setItemsRelHeight();
16008				horScrollSizes();
16009				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16010					$(document).trigger('uncode-scrolltrigger-refresh');
16011				}
16012				if ( doubleResize === true ) {
16013					window.dispatchEvent(new Event('resize'));
16014					doubleResize = false;
16015				} else {
16016					doubleResize = true;
16017				}
16018				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
16019			}, 100 );
16020		});
16021
16022		var show_pins = function(){
16023			$('.index-scroll').css({'opacity':'1'});
16024		};
16025		ScrollTrigger.addEventListener("refresh", show_pins);
16026		$(window).on( 'uncode.re-layout', function(){
16027			//$('.index-scroll').css({'opacity':'0'});
16028			$('.pin-spacer').each(function(){
16029				var space_h = $(this).outerHeight(),
16030					$row = $(this).closest('.row-container');
16031				$row.css({
16032					'height': space_h,
16033					'overflow': 'hidden'
16034				});
16035			});
16036			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16037				ScrollTrigger.refresh(true);
16038			}
16039			clearRequestTimeout(setReLayout);
16040			setReLayout = requestTimeout( function(){
16041				$('.row-container').each(function(){
16042					$(this).css({
16043						'height': '',
16044						'overflow': ''
16045					});
16046				});
16047			}, 1000);
16048		});
16049	}
16050
16051};
16052
16053UNCODE.stickyTrigger = function($el) {
16054	if (SiteParameters.is_frontend_editor) {
16055		return false;
16056	}
16057
16058	var resizeTimer;
16059	var oldW = UNCODE.wwidth;
16060	var stickyObservers = [];
16061	var stickyInstances = [];
16062	var isRefreshing = false;
16063	var pendingRefresh = false;
16064	var lastStickyMetrics = {
16065		rowH: 0,
16066		uncontH: 0
16067	};
16068
16069	function clearStickyInstances() {
16070		stickyInstances.forEach(function(st) {
16071			if (st && st.kill) {
16072				st.kill();
16073			}
16074		});
16075		stickyInstances = [];
16076	}
16077
16078	function clearStickyObservers() {
16079		stickyObservers.forEach(function(observer) {
16080			try {
16081				observer.disconnect();
16082			} catch (e) {}
16083		});
16084		stickyObservers = [];
16085	}
16086
16087	function getStickyMetrics() {
16088		var $firstSticky = $('.sticky-trigger').first();
16089		if (!$firstSticky.length) {
16090			return {
16091				rowH: 0,
16092				uncontH: 0
16093			};
16094		}
16095
16096		var $row = $firstSticky.closest('.vc_row');
16097		var $uncont = $firstSticky.closest('.uncont');
16098
16099		return {
16100			rowH: $row.length ? Math.round($row.outerHeight()) : 0,
16101			uncontH: $uncont.length ? Math.round($uncont.outerHeight()) : 0
16102		};
16103	}
16104
16105	function metricsChanged(nextMetrics) {
16106		return (
16107			Math.abs(nextMetrics.rowH - lastStickyMetrics.rowH) > 1 ||
16108			Math.abs(nextMetrics.uncontH - lastStickyMetrics.uncontH) > 1
16109		);
16110	}
16111
16112	function buildSticky() {
16113		clearStickyInstances();
16114		clearStickyObservers();
16115
16116		$('.sticky-trigger').each(function() {
16117			var $sticky = $(this);
16118			var $inside = $sticky.children('div').first();
16119			var $row = $sticky.closest('.vc_row');
16120			var $uncont = $sticky.closest('.uncont');
16121
16122			if (!$inside.length || !$row.length || !$uncont.length) {
16123				return;
16124			}
16125
16126			var st = ScrollTrigger.create({
16127				trigger: $sticky[0],
16128				start: function() {
16129					var insideH = $inside.outerHeight() || 0;
16130					return 'top center-=' + (insideH / 2);
16131				},
16132				endTrigger: $row[0],
16133				end: function() {
16134					var insideH = $inside.outerHeight() || 0;
16135					var rowBottom = $row.offset().top + $row.outerHeight();
16136					var uncontBottom = $uncont.offset().top + $uncont.outerHeight();
16137					var diffBottom = rowBottom - uncontBottom;
16138
16139					return 'bottom center+=' + (insideH / 2 + diffBottom);
16140				},
16141				anticipatePin: true,
16142				pin: true,
16143				pinSpacing: false,
16144				scrub: true,
16145				invalidateOnRefresh: true
16146			});
16147
16148			stickyInstances.push(st);
16149
16150			if (typeof ResizeObserver !== 'undefined') {
16151				var ro = new ResizeObserver(function() {
16152					if (isRefreshing) {
16153						pendingRefresh = true;
16154						return;
16155					}
16156
16157					var nextMetrics = getStickyMetrics();
16158
16159					if (!metricsChanged(nextMetrics)) {
16160						return;
16161					}
16162
16163					refreshSticky(true);
16164				});
16165
16166				try {
16167					// NON osservare $inside: tende a creare loop continui
16168					ro.observe($row[0]);
16169					ro.observe($uncont[0]);
16170					stickyObservers.push(ro);
16171				} catch (e) {}
16172			}
16173		});
16174
16175		lastStickyMetrics = getStickyMetrics();
16176	}
16177
16178	function refreshSticky(fromObserver) {
16179		clearRequestTimeout(resizeTimer);
16180
16181		resizeTimer = requestTimeout(function() {
16182			if (isRefreshing) {
16183				pendingRefresh = true;
16184				return;
16185			}
16186
16187			isRefreshing = true;
16188			pendingRefresh = false;
16189
16190			if (!fromObserver) {
16191				buildSticky();
16192			}
16193
16194			requestTimeout(function() {
16195				isRefreshing = false;
16196
16197				lastStickyMetrics = getStickyMetrics();
16198
16199				if (!fromObserver) {
16200					$(document).trigger('uncode-scrolltrigger-refresh');
16201				} else {
16202					$(document).trigger('uncode-scrolltrigger-refresh');
16203				}
16204
16205				if (pendingRefresh) {
16206					pendingRefresh = false;
16207					refreshSticky(true);
16208				}
16209			}, 120);
16210		}, fromObserver ? 160 : 100);
16211	}
16212
16213	function maybeDelayedRefresh() {
16214		var carousel = document.querySelector('.owl-carousel');
16215		var grid = document.querySelector('.isotope-container');
16216		var stickyAll = document.querySelectorAll('.sticky-trigger');
16217		var sticky = stickyAll.length ? stickyAll[stickyAll.length - 1] : null;
16218		var carousel_position;
16219		var grid_position;
16220
16221		if (!sticky) {
16222			return;
16223		}
16224
16225		if (carousel) {
16226			carousel_position = sticky.compareDocumentPosition(carousel);
16227		}
16228		if (grid) {
16229			grid_position = sticky.compareDocumentPosition(grid);
16230		}
16231
16232		if (carousel_position === 2 || grid_position === 2) {
16233			setTimeout(function() {
16234				refreshSticky(false);
16235			}, 500);
16236		}
16237	}
16238
16239	$(window).on('load', function() {
16240		buildSticky();
16241		maybeDelayedRefresh();
16242	});
16243
16244	$(window).on('resize uncode.re-layout', function(e) {
16245		if (e.type === 'resize' && oldW === UNCODE.wwidth) {
16246			return;
16247		}
16248
16249		oldW = UNCODE.wwidth;
16250		refreshSticky(false);
16251	});
16252
16253	$(document).on('uncode-sticky-refresh uncode-toggle-change', function() {
16254		refreshSticky(false);
16255	});
16256};
16257UNCODE.areaTextReveal = function() {
16258    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
16259        return;
16260    }
16261	if ( ! SiteParameters.is_frontend_editor ) {
16262        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
16263            android = /Android/.test(navigator.userAgent) && !window.MSStream,
16264            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16265            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16266                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16267            firstObs = true,
16268            isMobileUsing = false;
16269
16270        var observer = new ResizeObserver(function(){
16271            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16272                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16273                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16274                set = false;
16275            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
16276                set = true;
16277                prevW = newW;
16278            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16279                set = true;
16280                prevH = newH;
16281            }
16282            if ( set || firstObs ) {
16283                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
16284                firstObs = false;
16285            }
16286        }).observe(document.body);
16287
16288        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16289            window.scrollTo = function() {
16290                return;
16291            };
16292            isMobileUsing = true;
16293
16294            $('html, body').css({
16295                'overscroll-behavior': 'none'
16296            });
16297        }
16298
16299        var setTriggerObserve;
16300
16301        ScrollTrigger.observe({
16302            trigger: 'body',
16303            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
16304            onUp: function() { ScrollTrigger.update(); },
16305        });
16306    }
16307
16308    var textReveal = function(){
16309
16310        if ( SiteParameters.is_frontend_editor ) {
16311            return;
16312        }
16313
16314        var setTxtReveal,
16315            txtTrggrStart = false;
16316
16317        function headingReveal($sel){
16318            txtTrggrStart = true;
16319            $('.text-reveal', $sel).each(function(val, key){
16320                var $txtReveal = $(this).attr('data-init-reveal', true),
16321                    $trigger = $txtReveal,
16322                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
16323                    hReveal = $txtReveal.outerHeight(),
16324                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
16325                    $sticky = $txtReveal.closest('.sticky-element'),
16326                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16327                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16328                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
16329                    $lines = $('.heading-line-wrap', $txtReveal),
16330                    $words = $('.split-word-inner', $txtReveal),
16331                    $chars = $('.split-char', $txtReveal),
16332                    $elToReveal = $words;
16333
16334                if ( $pin.length ) {
16335                    return;
16336                } else if ( $sticky.length ) {
16337                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
16338                    $trigger = $sticky.parent();
16339                }
16340
16341                if ( dataReveal === 'chars' ) {
16342                    $elToReveal = $chars;
16343                } else if ( dataReveal === 'lines' ) {
16344                    $elToReveal = $lines;
16345                }
16346                
16347                var tl = gsap.timeline({
16348                    scrollTrigger: {
16349                        trigger: $trigger,
16350                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
16351                        end: "+=" + hReveal + "px",
16352                        id: "txt_reveal_" + key,
16353                        scrub: true,
16354                    }
16355                });
16356                gsap.set(
16357                    $elToReveal, {
16358                        opacity: dataRevealOpacity,
16359                    }
16360                )
16361                tl.fromTo($elToReveal, {
16362                    opacity: dataRevealOpacity,
16363                    duration: 1,
16364                }, {
16365                    opacity: 1,
16366                    stagger: 0.05,
16367                    duration: 1,
16368
16369                });
16370                $(window).on('uncode.tl-refresh', function(){
16371                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
16372                        tl.scrollTrigger.refresh();
16373                    }
16374                });
16375
16376                $rowParent.one( 'uncodeWordLines', function(){
16377                    clearRequestTimeout(setTxtReveal);
16378                    setTxtReveal = requestTimeout( function(){
16379                        gsap.set($elToReveal, {clearProps: true});
16380                        tl.kill(true);
16381                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
16382                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
16383                        }
16384                        headingReveal($sel)
16385                    }, 100);
16386                });
16387
16388            });
16389        };
16390
16391        window.addEventListener("load", function (e) {
16392            if (!txtTrggrStart) {
16393                headingReveal($("body"));
16394                $(window).trigger("resize");
16395            }
16396        });
16397
16398        $('.row-container[data-parent]').each(function(){
16399            if (!txtTrggrStart) {
16400                var $this = $(this);
16401                $this.on('uncodeWordLines', function(){
16402                    headingReveal($this);
16403                });
16404            }
16405        });
16406
16407        $(window).on('uncode-sticky-trigger-observe', function(e){
16408            clearRequestTimeout(setTriggerObserve);
16409            setTriggerObserve = requestTimeout( function(){
16410                $(window).trigger('uncode.tl-refresh');
16411            }, 2000 );
16412        });
16413    
16414    };
16415    textReveal();
16416
16417    var areaReveal = function(){
16418        if ( SiteParameters.is_frontend_editor ) {
16419            return;
16420        }
16421
16422        $('.scroll-trigger-el').each(function(){
16423            var $scrollTrgrEl = $(this),
16424                $row = $('> .row', $scrollTrgrEl),
16425                $row_in = $('> .row-inner', $row),
16426                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
16427                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
16428                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
16429                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
16430                $animateTrgrEl = $scrollTrgrEl,
16431                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
16432                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
16433                els = $scrollTrgrEl.attr('data-anim-els'),
16434                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
16435                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
16436                state = $scrollTrgrEl.attr('data-anim-state'),
16437                target = $scrollTrgrEl.attr('data-anim-target'),
16438                origin = $scrollTrgrEl.attr('data-anim-origin'),
16439                mask = $scrollTrgrEl.attr('data-anim-mask'),
16440                _scale = $scrollTrgrEl.attr('data-anim-scale'),
16441                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
16442                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
16443                radius = $scrollTrgrEl.attr('data-anim-radius'),
16444                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
16445                clip_path = $scrollTrgrEl.attr('data-clip-path'),
16446                animation_x = $scrollTrgrEl.attr('data-anim-x'),
16447                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
16448                animation_y = $scrollTrgrEl.attr('data-anim-y'),
16449                blur = $scrollTrgrEl.attr('data-anim-blur'),
16450                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
16451                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
16452                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
16453                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
16454                offTop = $scrollTrgrEl.attr('data-anim-top'),
16455                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
16456                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
16457                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
16458                mobile_rows_start = $scrollTrgrEl.attr('data-mobile-start-point'),
16459                mobile_start_add = $scrollTrgrEl.attr('data-mobile-start-point-add'),
16460                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
16461                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
16462                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
16463                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
16464                setTxtReveal,
16465                txtTrggrStart = false,
16466                alreadyareaAnimateScrollTl = false;
16467    
16468            _scale = _scale === '' ? 0 : parseFloat( _scale );
16469            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
16470            offTop = offTop === '' ? 0 : parseFloat( offTop );
16471            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
16472            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
16473
16474            function areaAnimateScrollTl($el, id, last) {
16475                alreadyareaAnimateScrollTl = true;
16476
16477                var pTop = parseFloat( $row.css('padding-top') ),
16478                    innerGap = pTop + offSetCard * id,
16479                    scale = _scale,
16480                    rows_start = animation_rows_start;
16481                    
16482                if ( isMobileUsing && typeof mobile_rows_start !== 'undefined' ) {
16483                    rows_start = mobile_rows_start;
16484                    innerGap = 0 + parseFloat(mobile_start_add);
16485                }
16486
16487                if ( stepScale ) {
16488                    if ( _scale < 100 ) {
16489                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
16490                    }
16491                }
16492
16493                if ( els === 'content' ) {
16494                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
16495                } else if ( els === 'bg' ) {
16496                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
16497                } else {
16498                    $animateTrgrEl = $el;
16499                }
16500
16501                if ( rotate_alt === 'yes') {
16502                    rotate *= -1;
16503                    perspective *= -1;
16504                }
16505                
16506                if ( animation_x_alt === 'yes') {
16507                    animation_x *= -1;
16508                }
16509
16510                var $parentDiv = $el.closest('div[data-sticky]');
16511
16512                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
16513
16514                var scrllTrggr = {
16515                    trigger: $parentDiv,
16516                    end: function(){
16517                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
16518                    },
16519                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
16520                    pin: sticky === 'yes' || stickyCards ? true : false,
16521                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
16522                    scrub: true,
16523                    id: 'sticky_' + id,
16524                    anticipatePin: 1,
16525                    invalidateOnRefresh: true,
16526                    // markers: {
16527                    //     indent: 150 * id
16528                    // },
16529                    onToggle: function(){
16530                        $scrollTrgrEl.attr('data-revealed', true);
16531                    },
16532                };
16533
16534
16535                if ( !stickyLast && state === 'end' ) {
16536                    last = false;
16537                } 
16538
16539                if ( stickyCards ) {
16540                    if ( state !== 'end' ) {
16541                        if ( rows_start === 'center' ) {
16542                            scrllTrggr.start = "center center";
16543                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
16544                        } else if ( rows_start === 'bottom' ) {
16545                            if ( stickyOpts !== 'no' ) {
16546                                scrllTrggr.start = "bottom bottom-=" + (innerGap-1)
16547                                scrllTrggr.end = "bottom bottom";
16548                            }
16549                        } else {
16550                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
16551                        } 
16552                        if ( stickyOpts === 'no' ) {
16553                            scrllTrggr.endTrigger = $el;
16554                            scrllTrggr.end = "+=100%";
16555                        } else {
16556                            scrllTrggr.endTrigger = $row;
16557                        }
16558                    } else {
16559                        if ( rows_start === 'center' ) {
16560                            scrllTrggr.start = "center center";
16561                        } else if ( rows_start === 'bottom' ) {
16562                            scrllTrggr.start = "bottom bottom";
16563                        } 
16564                        if ( stickyOpts !== 'no' ) {
16565                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
16566                            scrllTrggr.endTrigger = $lastEl;
16567                        } else {
16568                            scrllTrggr.end = "bottom bottom";
16569                        }
16570                    }
16571                }
16572                
16573                var tl = gsap.timeline({
16574                    scrollTrigger: scrllTrggr
16575                });
16576
16577                // var mark = last ? {
16578                //         startColor:"blue",
16579                //         endColor:"orange",
16580                //     } : false;
16581
16582                if ( !stickyCards ) {
16583                    var tlConds = tl;
16584                } else {
16585                    var scrllTrggrConds = {
16586                        trigger: $parentDiv,
16587                        end: function(){
16588                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
16589                        }, 
16590                        pin: (state === 'end' && last),
16591                        pinSpacing: false,
16592                        scrub: true,
16593                        id: 'card_' + id,
16594                        invalidateOnRefresh: true,
16595                        // markers: true,
16596                    };
16597
16598                    if ( stickyCards ) {
16599                        if ( state !== 'end' ) {
16600                            if ( stickyOpts === '' ) {
16601                                scrllTrggrConds.end = "bottom bottom-=100%";
16602                                scrllTrggrConds.endTrigger = $row_in;
16603                            }
16604
16605                            if ( rows_start === 'bottom' ) {
16606                                if ( stickyOpts !== 'no') {
16607                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
16608                                    scrllTrggrConds.end = "bottom bottom";
16609                                }
16610                            } else if ( rows_start === 'center' ) {
16611                                scrllTrggrConds.start =  "center center";
16612                            } else {
16613                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16614                            }
16615                            
16616                        } else {
16617                            if ( stickyOpts === '' ) {
16618                                if ( animLast ) {
16619                                    scrllTrggrConds.end = "bottom bottom-=100%";
16620                                } else {
16621                                    scrllTrggrConds.end = "bottom bottom";
16622                                }
16623                                scrllTrggrConds.endTrigger = $lastEl;
16624                            }
16625
16626                            if ( rows_start === 'bottom' && stickyOpts !== 'no' ) {
16627                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16628                                    scrllTrggrConds.start = "bottom bottom";
16629                                } else {
16630                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
16631                                }
16632                            } else if ( rows_start === 'center' ) {
16633                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16634                                    scrllTrggrConds.start =  "center center";
16635                                } else {
16636                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
16636+ window.innerHeight/2;
16637                                }
16638                            } else {
16639                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16640                                    scrllTrggrConds.start = "top top";
16641                                } else {
16642                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16643                                }
16644                            }
16645
16646                        }
16647
16648                    } else {
16649                        scrllTrggrConds.start =  start_topBottom;
16650                    }
16651
16652                    var tlConds = gsap.timeline({
16653                        scrollTrigger: scrllTrggrConds
16654                    });
16655                }
16656
16657                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
16658                    if ( target === 'mask' ) {
16659                        if ( state !== 'end' ) {
16660                            if ( mask === 'auto' ) {
16661                                gsap.set(
16662                                    $animateTrgrEl, {
16663                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16664                                        opacity: parseFloat(opacity)/100,
16665                                        filter: 'blur(' + blur + 'px)',
16666                                        visibility: 'visible',
16667                                    }
16668                                )
16669                                tlConds.fromTo($animateTrgrEl, {
16670                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16671                                    opacity: parseFloat(opacity)/100,
16672                                    filter: 'blur(' + blur + 'px)',
16673                                    duration: 1,
16674                                }, {
16675                                    opacity: 1,
16676                                    clipPath: 'inset(0% 0px round 0' + radiu
16676s_unit + ')',
16677                                    filter: 'blur(0px)',
16678                                    duration: 1,
16679                                    ease: easeOut,
16680                                    //delay: 0.1
16681                                });	
16682                            } else {
16683                                tlConds.fromTo($animateTrgrEl, {
16684                                    opacity: parseFloat(opacity)/100,
16685                                    clipPath: clip_path,
16686                                    filter: 'blur(' + blur + 'px)',
16687                                    duration: 1,
16688                                }, {
16689                                    opacity: 1,
16690                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16691                                    filter: 'blur(0px)',
16692                                    duration: 1,
16693                                    ease: easeOut,
16694                                    //delay: 0.1
16695                                });	
16696                            }
16697                        } else {
16698                            if ( mask === 'auto' ) {
16699                                tlConds.fromTo($animateTrgrEl, {
16700                                    opacity: 1,
16701                                    clipPath: 'inset(0% 0px round 0' + radiu
16701s_unit + ')',
16702                                    filter: 'blur(0px)',
16703                                    duration: 1,
16704                                },{
16705                                    opacity: parseFloat(opacity)/100,
16706                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16707                                    filter: 'blur(' + blur + 'px)',
16708                                    ease: easeOut,
16709                                    duration: 1,
16710                                    //delay: 0.1
16711                                });	
16712                            } else {
16713                                tlConds.fromTo($animateTrgrEl, {
16714                                    opacity: 1,
16715                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16716                                    filter: 'blur(0px)',
16717                                    duration: 1,
16718                                },{
16719                                    opacity: parseFloat(opacity)/100,
16720                                    clipPath: clip_path,
16721                                    filter: 'blur(' + blur + 'px)',
16722                                    duration: 1,
16723                                    ease: easeOut,
16724                                    //delay: 0.1
16725                                });	
16726                            }
16727                        }
16728                    } else {
16729                        if ( state !== 'end' ) {
16730                            if ( scale === 'auto' ) {
16731                                if ( radius ) {
16732                                    gsap.set(
16733                                        $animateTrgrEl, {
16734                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16735                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16736                                            x: animation_x + 'vw',
16737                                            y: animation_y + 'vh',
16738                                            filter: 'blur(' + blur + 'px)',
16739                                            rotation: rotate,
16740                                            rotationX: rotate == 0 ? perspective : 0,
16741                                            transformPerspective: '100vw',
16742                                            opacity: parseFloat(opacity)/100,
16743                                            transformOrigin: origin,
16744                                            borderRadius: radius + radius_unit,
16745                                            visibility: 'visible',
16746                                        }
16747                                    )
16748                                    tlConds.fromTo($animateTrgrEl, {
16749                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16750                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16751                                        x: animation_x + 'vw',
16752                                        y: animation_y + 'vh',
16753                                        filter: 'blur(' + blur + 'px)',
16754                                        rotation: rotate,
16755                                        rotationX: rotate == 0 ? perspective : 0,
16756                                        transformPerspective: '100vw',
16757                                        opacity: parseFloat(opacity)/100,
16758                                        borderRadius: radius + radius_unit,
16759                                        transformOrigin: origin,
16760                                        duration: 1,
16761                                    }, {
16762                                        scaleX: 1,
16763                                        scaleY: 1,
16764                                        x: 0,
16765                                        y: 0,
16766                                        filter: 'blur(0px)',
16767                                        rotation: 0,
16768                                        rotationX: 0,
16769                                        opacity: 1,
16770                                        borderRadius: 0 + radius_unit,
16771                                        transformOrigin: origin,
16772                                        duration: 1,
16773                                        ease: easeOut,
16774                                        //delay: 0.1
16775                                    });	
16776                                } else {
16777                                    gsap.set(
16778                                        $animateTrgrEl, {
16779                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16780                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16781                                            x: animation_x + 'vw',
16782                                            y: animation_y + 'vh',
16783                                            filter: 'blur(' + blur + 'px)',
16784                                            rotation: rotate,
16785                                            rotationX: rotate == 0 ? perspective : 0,
16786                                            transformPerspective: '100vw',
16787                                            opacity: parseFloat(opacity)/100,
16788                                            transformOrigin: origin,
16789                                            visibility: 'visible',
16790                                        }
16791                                    )
16792                                    tlConds.fromTo($animateTrgrEl, {
16793                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16794                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16795                                        x: animation_x + 'vw',
16796                                        y: animation_y + 'vh',
16797                                        filter: 'blur(' + blur + 'px)',
16798                                        rotation: rotate,
16799                                        rotationX: rotate == 0 ? perspective : 0,
16800                                        transformPerspective: '100vw',
16801                                        opacity: parseFloat(opacity)/100,
16802                                        transformOrigin: origin,
16803                                        duration: 1,
16804                                    }, {
16805                                        scaleX: 1,
16806                                        scaleY: 1,
16807                                        x: 0,
16808                                        y: 0,
16809                                        filter: 'blur(0px)',
16810                                        rotation: 0,
16811                                        rotationX: 0,
16812                                        opacity: 1,
16813                                        transformOrigin: origin,
16814                                        duration: 1,
16815                                        ease: easeOut,
16816                                        //delay: 0.1
16817                                    });	
16818                                }
16819                            } else {
16820                                if ( radius ) {
16821                                    gsap.set(
16822                                        $animateTrgrEl, {
16823                                            scaleX: parseFloat( scale ) / 100,
16824                                            scaleY: parseFloat( scale ) / 100,
16825                                            opacity: parseFloat(opacity)/100,
16826                                            x: animation_x + 'vw',
16827                                            y: animation_y + 'vh',
16828                                            filter: 'blur(' + blur + 'px)',
16829                                            rotation: rotate,
16830                                            rotationX: rotate == 0 ? perspective : 0,
16831                                            transformPerspective: '100vw',
16832                                            transformOrigin: origin,
16833                                            borderRadius: radius + radius_unit,
16834                                            visibility: 'visible',
16835                                        }
16836                                    )
16837                                    tlConds.fromTo($animateTrgrEl, {
16838                                        scaleX: parseFloat( scale ) / 100,
16839                                        scaleY: parseFloat( scale ) / 100,
16840                                        opacity: parseFloat(opacity)/100,
16841                                        x: animation_x + 'vw',
16842                                        y: animation_y + 'vh',
16843                                        filter: 'blur(' + blur + 'px)',
16844                                        rotation: rotate,
16845                                        rotationX: rotate == 0 ? perspective : 0,
16846                                        transformPerspective: '100vw',
16847                                        borderRadius: radius + radius_unit,
16848                                        transformOrigin: origin,
16849                                        duration: 1,
16850                                    }, {
16851                                        scaleX: 1,
16852                                        scaleY: 1,
16853                                        opacity: 1,
16854                                        x: 0,
16855                                        y: 0,
16856                                        filter: 'blur(0px)',
16857                                        rotation: 0,
16858                                        rotationX: 0,
16859                                        transformOrigin: origin,
16860                                        ease: easeOut,
16861                                        duration: 1,
16862                                        borderRadius: 0 + radius_unit,
16863                                        //delay: 0.1
16864                                    });	
16865                                } else {
16866                                    gsap.set(
16867                                        $animateTrgrEl, {
16868                                            scaleX: parseFloat( scale ) / 100,
16869                                            scaleY: parseFloat( scale ) / 100,
16870                                            opacity: parseFloat(opacity)/100,
16871                                            x: animation_x + 'vw',
16872                                            y: animation_y + 'vh',
16873                                            filter: 'blur(' + blur + 'px)',
16874                                            rotation: rotate,
16875                                            rotationX: rotate == 0 ? perspective : 0,
16876                                            transformPerspective: '100vw',
16877                                            transformOrigin: origin,
16878                                            visibility: 'visible',
16879                                        }
16880                                    )
16881                                    tlConds.fromTo($animateTrgrEl, {
16882                                        scaleX: parseFloat( scale ) / 100,
16883                                        scaleY: parseFloat( scale ) / 100,
16884                                        opacity: parseFloat(opacity)/100,
16885                                        x: animation_x + 'vw',
16886                                        y: animation_y + 'vh',
16887                                        filter: 'blur(' + blur + 'px)',
16888                                        rotation: rotate,
16889                                        rotationX: rotate == 0 ? perspective : 0,
16890                                        transformPerspective: '100vw',
16891                                        transformOrigin: origin,
16892                                        duration: 1,
16893                                    }, {
16894                                        scaleX: 1,
16895                                        scaleY: 1,
16896                                        opacity: 1,
16897                                        x: 0,
16898                                        y: 0,
16899                                        filter: 'blur(0px)',
16900                                        rotation: 0,
16901                                        rotationX: 0,
16902                                        transformOrigin: origin,
16903                                        duration: 1,
16904                                        ease: easeOut,
16905                                        //delay: 0.1
16906                                    });
16907                                }
16908                            }
16909                        } else {
16910                            if ( scale === 'auto' ) {
16911                                tlConds.fromTo($animateTrgrEl, {
16912                                    scaleX: 1,
16913                                    scaleY: 1,
16914                                    opacity: 1,
16915                                    x: 0,
16916                                    y: 0,
16917                                    filter: 'blur(0px)',
16918                                    rotation: 0,
16919                                    rotationX: 0,
16920                                    transformOrigin: origin,
16921                                    duration: 1,
16922                                }, {
16923                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16924                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16925                                    opacity: parseFloat(opacity)/100,
16926                                    x: animation_x + 'vw',
16927                                    y: animation_y + 'vh',
16928                                    filter: 'blur(' + blur + 'px)',
16929                                    rotation: rotate,
16930                                    rotationX: rotate == 0 ? perspective : 0,
16931                                    transformPerspective: '100vw',
16932                                    transformOrigin: origin,
16933                                    duration: 1,
16934                                    ease: easeOut,
16935                                    //delay: 0.1
16936                                })
16937                            } else {
16938                                tlConds.fromTo($animateTrgrEl, {
16939                                    scaleX: 1,
16940                                    scaleY: 1,
16941                                    opacity: 1,
16942                                    x: 0,
16943                                    y: 0,
16944                                    filter: 'blur(0px)',
16945                                    rotation: 0,
16946                                    rotationX: 0,
16947                                    transformPerspective: '100vw',
16948                                    transformOrigin: origin,
16949                                    borderRadius: 0 + radius_unit,
16950                                    duration: 1,
16951                                }, {
16952                                    scaleX: parseFloat( scale ) / 100,
16953                                    scaleY: parseFloat( scale ) / 100,
16954                                    opacity: parseFloat(opacity)/100,
16955                                    x: animation_x + 'vw',
16956                                    y: animation_y + 'vh',
16957                                    filter: 'blur(' + blur + 'px)',
16958                                    rotation: rotate,
16959                                    rotationX: rotate == 0 ? perspective : 0,
16960                                    transformPerspective: '100vw',
16961                                    transformOrigin: origin,
16962                                    borderRadius: radius + radius_unit,
16963                                    duration: 1,
16964                                    ease: easeOut,
16965                                    //delay: 0.1
16966                                })
16967                            }
16968                        }
16969                    }
16970                }
16971
16972                function headingReveal($el){
16973                    txtTrggrStart = true;
16974                    $('.text-reveal', $el).each(function(_key, _val){
16975                        var $txtReveal = $(_val),
16976                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16977                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16978                            $lines = $('.heading-line-wrap', $txtReveal),
16979                            $words = $('.split-word-inner', $txtReveal),
16980                            $chars = $('.split-char', $txtReveal),
16981                            _setTxtReveal,
16982                            $elToReveal = $words;
16983
16984                        if ( !(sticky === 'yes' || stickyCards) ) {
16985                            return;
16986                        }
16987            
16988                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
16989
16990                        if ( dataReveal === 'chars' ) {
16991                            $elToReveal = $chars;
16992                        } else if ( dataReveal === 'lines' ) {
16993                            $elToReveal = $lines;
16994                        }
16995
16996                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
16997                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
16998                        scrllTrggrTxt.pin = false;
16999
17000                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
17001                        var _tl = gsap.timeline({
17002                            scrollTrigger: scrllTrggrTxt
17003                        });
17004                        _tl.fromTo($elToReveal, {
17005                            opacity: dataRevealOpacity,
17006                        }, {
17007                            opacity: 1,
17008                            stagger: 0.05
17009                        });
17010
17011                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
17012                            clearRequestTimeout(_setTxtReveal);
17013                            _setTxtReveal = requestTimeout( function(){
17014                                gsap.set($elToReveal, {clearProps: true});
17015                                _tl.kill(true);
17016                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
17017                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
17018                                }
17019                                headingReveal($el)
17020                            }, 100);
17021                        });
17022
17023                    });
17024                };
17025
17026                if (!txtTrggrStart) {
17027                    headingReveal($el);
17028                }
17029
17030                $scrollTrgrEl.one( 'uncodeWordLines', function(){
17031                    if (!txtTrggrStart) {
17032                        headingReveal($el);
17033                    }
17034                });
17035                
17036                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
17037                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
17038                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
17039                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
17040                    
17041                $(window).on('uncode-sticky-trigger-observe', function(e){
17042                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17043                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
17044                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
17045                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
17046                    if ( stickyCards ) {
17047                        $('.tmb', $scrollTrgrEl).removeAttr('style');
17048                    }
17049                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
17050                    clearRequestTimeout(setTxtReveal);
17051                    setTxtReveal = requestTimeout( function(){
17052                        $(document).trigger('uncode-scrolltrigger-refresh');
17053                        if ( isMobileUsing ) {
17054                            if ( typeof tl !== 'undefined' ) {
17055                                tl.scrollTrigger.refresh();
17056                            }
17057                            if ( typeof tlConds !== 'undefined' ) {
17058                                tlConds.scrollTrigger.refresh();
17059                            }
17060                            $(window).trigger('scroll');
17061                            _width = __width;
17062                        } else if ( _width !== __width && ( isMobileUsing ) ) {
17063                            window.dispatchEvent(new CustomEvent('vc-resize'));
17064                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
17065                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
17066                                    if ( typeof tl !== 'undefined' ) {
17067                                        tl.scrollTrigger.refresh();
17068                                    }
17069                                    if ( typeof tlConds !== 'undefined' ) {
17070                                        tlConds.scrollTrigger.refresh();
17071                                    }
17072                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
17073                                }});
17074                            } else {
17075                                if ( typeof tl !== 'undefined' ) {
17076                                    tl.scrollTrigger.refresh();
17077                                }
17078                                if ( typeof tlConds !== 'undefined' ) {
17079                                    tlConds.scrollTrigger.refresh();
17080                                }
17081                                $(window).trigger('scroll');
17082                            }
17083                            _height = __height;
17084                        }
17085                    }, 500);
17086                });
17087
17088
17089                $(window).on('load ', function(e){
17090                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17091                    if ( _height !== ___height ) {
17092                        $scrollTrgrEl.attr('data-toggled', true);
17093                        $(window).trigger('resize');
17094                        if ( typeof tl !== 'undefined' ) {
17095                            tl.scrollTrigger.refresh();
17096                        }
17097                        if ( typeof tlConds !== 'undefined' ) {
17098                            tlConds.scrollTrigger.refresh();
17099                        }
17100                        _height = ___height;
17101                    }
17102
17103                    
17104                    
17105                    $(document).trigger('uncode-scrolltrigger-refresh');
17106
17107                });
17108
17109            };
17110
17111            var callAreaAnimateScrollTl = function() {
17112                if ( stickyCards ) {
17113                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
17114                        if ( key+1 < cardL || animLast || state !== 'end' ) {
17115                            var $this = $(val),
17116                                last = key+1===cardL;
17117                            areaAnimateScrollTl($this, key, last);
17118                        }
17119                    });
17120                } else {
17121                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
17122                }    
17123            };
17124
17125            $(window).on('wwResize', function(){
17126                if ( !alreadyareaAnimateScrollTl ) {
17127                    if ( noMobile ) {
17128                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17129                            return;
17130                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17131                            return;
17132                        }
17133                    }
17134                    
17135                    callAreaAnimateScrollTl();
17136                }
17137            })
17138
17139            if ( noMobile ) {
17140                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17141                    return;
17142                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17143                    return;
17144                }
17145            }
17146
17147            callAreaAnimateScrollTl();
17148
17149        });
17150
17151    };
17152
17153    areaReveal();
17154
17155};
17156UNCODE.thumbsReveal = function() {
17157
17158    var recalc = false,
17159        thumbsRevealResizeTO;
17160
17161    var isTouchDevice = function() {
17162        return (
17163            'ontouchstart' in window ||
17164            navigator.maxTouchPoints > 0 ||
17165            navigator.msMaxTouchPoints > 0
17166        );
17167    };
17168
17169    var resetThumbsReveal = function() {
17170        $('.tmb-mask-init').each(function(){
17171            var el = this;
17172
17173            if ( el._thumbsRevealST ) {
17174                el._thumbsRevealST.kill();
17175                el._thumbsRevealST = null;
17176            }
17177
17178            if ( el._thumbsRevealIO ) {
17179                el._thumbsRevealIO.disconnect();
17180                el._thumbsRevealIO = null;
17181            }
17182
17183            gsap.set($('img, video, .fluid-object', el), {
17184                clearProps: 'transform'
17185            });
17186
17187            $(el).removeClass('tmb-mask-init');
17188        });
17189
17190        revealThumbs();
17191    };
17192
17193    var revealThumbs = function( $el ){
17194        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
17195            $el = $('body');
17196        }
17197
17198        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
17199            var $container = $(this),
17200                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
17201                isContainer = false;
17202
17203            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
17204                $stickys.each(function(){
17205                    var $sticky = $(this).addClass('tmb-mask-init'),
17206                        $rellax = $sticky.closest('.parallax-el'),
17207                        $inside = $('.t-inside', $sticky),
17208                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
17209                        val = parseFloat( $inside.attr('data-scroll-val') ),
17210                        no_device = $inside.attr('data-anim-no-mobile') === 'yes';
17211
17212                    if ( no_device && isTouchDevice() ) {
17213                        gsap.set($media, {
17214                            clearProps: 'transform'
17215                        });
17216
17217                        return;
17218                    }
17219
17220                    if ( $rellax.length ) {
17221                        recalc = true;
17222                    }
17223
17224                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
17225                    
17226                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
17227
17228                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
17229                            ? val * 0.05 : 0;
17230
17231                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17232                            ? val * 4 : 0;
17233
17234                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17235                            ? parax * 0.01 : 0;
17236
17237                        var isThumbVisible = false;
17238                        var lastProgress = 0;
17239
17240                        var io = null;
17241
17242                        if (typeof IntersectionObserver !== 'undefined') {
17243                            io = new IntersectionObserver(function(entries){
17244                                var entry = entries[0];
17245
17246                                isThumbVisible = !!(
17247                                    entry &&
17248                                    entry.isIntersecting &&
17249                                    entry.intersectionRect &&
17250                                    entry.intersectionRect.width > 0 &&
17251                                    entry.intersectionRect.height > 0
17252                                );
17253
17254                                if (!isThumbVisible) {
17255                                    gsap.set($media, {
17256                                        yPercent: 0,
17257                                        scale: 1 + extra
17258                                    });
17259                                }
17260                            }, {
17261                                root: null,
17262                                threshold: 0.01
17263                            });
17264
17265                            io.observe($sticky[0]);
17266
17267                            $sticky[0]._thumbsRevealIO = io;
17268                        }
17269
17270                        var st = ScrollTrigger.create({
17271                            trigger: $sticky[0],
17272                            scrub: true,
17273                            start: 'top bottom',
17274                            end: 'bottom top',
17275                            onUpdate: function(self) {
17276                                lastProgress = self.progress;
17277
17278                                if (!isThumbVisible) return;
17279
17280                                var currentY = gsap.utils.interpolate(-parax, parax, lastProgress);
17281                                var currentScale = gsap.utils.interpolate(1 + zoom + extra, 1 + extra, lastProgress);
17282
17283                                gsap.set($media, {
17284                                    yPercent: currentY,
17285                                    scale: currentScale
17286                                });
17287                            }
17288                        });
17289
17290                        $sticky[0]._thumbsRevealST = st;
17291
17292                        if ( recalc ) {
17293                            $(window).on('uncode-thumbsreveal-refresh', function(){
17294                                if ( st ) {
17295                                    st.refresh();
17296                                }
17297                            });
17298                        }
17299                    }
17300                });
17301            }
17302
17303            if ( $container.has('.tmb-mask-reveal') ) {
17304                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
17305                    staggerTime = 0.1;
17306
17307                $('.t-inside', $container).each(function(){
17308                    var checkEasing = $(this).attr('data-easing');
17309
17310                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
17311                        gsap.registerPlugin(CustomEase);
17312                        return false;
17313                    }
17314                });
17315
17316                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
17317                    $markTrigger = $container;
17318                    isContainer = true;
17319                    staggerTime = 0;
17320                }
17321
17322                ScrollTrigger.batch( $markTrigger, {
17323                    start: function( el ){
17324                        return "top 96%";
17325                    },
17326                    onEnter: function(batch){
17327                        var $inside = $(batch).closest('.t-inside');
17328
17329                        if ( isContainer ) {
17330                            $inside = $(batch).find('.t-inside').first();
17331                        }
17332
17333                        var delay = parseFloat( $inside.attr('data-delay') ),
17334                            speed = parseFloat( $inside.attr('data-speed') ),
17335                            easing = $inside.attr('data-easing'),
17336                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
17337
17338                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay / 1000;
17339                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed / 1000;
17340                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
17341                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
17342
17343                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
17344                            gsap.to($('.t-entry-visual-tc', batch), speed, {
17345                                clipPath: 'inset(0% 0% 0% 0%)',
17346                                stagger: staggerTime,
17347                                delay: delay,
17348                                ease: easing
17349                            });
17350
17351                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17352                                clipPath: 'inset(0% 0% 0% 0%)',
17353                                stagger: staggerTime,
17354                                scale: 1,
17355                                delay: delay + (speed * bgDelay),
17356                                ease: easing
17357                            });
17358                        } else {
17359                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17360                                clipPath: 'inset(0% 0% 0% 0%)',
17361                                stagger: staggerTime,
17362                                scale: 1,
17363                                delay: delay,
17364                                ease: easing
17365                            });
17366                        }
17367                    }
17368                });
17369            }
17370        });
17371
17372        function raf(time) {
17373            requestAnimationFrame(raf);
17374            $(window).trigger('uncode-thumbsreveal-refresh');
17375        }
17376
17377        if ( recalc ) {
17378            requestAnimationFrame(raf);
17379        }
17380    };
17381
17382    $(window).on( 'load more-items-loaded', function(){
17383        revealThumbs();
17384    });
17385
17386    $(document).on('uncode-ajax-filtered', function(){
17387        revealThumbs();
17388    });
17389
17390    $(window).on('resize orientationchange', function(){
17391        clearTimeout(thumbsRevealResizeTO);
17392
17393        thumbsRevealResizeTO = setTimeout(function(){
17394            resetThumbsReveal();
17395        }, 150);
17396    });
17397
17398    document.addEventListener('uncode:marquee:ready', function(e) {
17399        if (!e || !e.detail || !e.detail.baseWrap) return;
17400
17401        var parent = e.detail.parent || e.detail.baseWrap;
17402        var $marquee = $(e.detail.baseWrap);
17403
17404        if (e.detail.leftWrap) {
17405            $marquee = $marquee.add(e.detail.leftWrap);
17406        }
17407
17408        if (e.detail.rightWrap) {
17409            $marquee = $marquee.add(e.detail.rightWrap);
17410        }
17411
17412        if (parent._uncodeThumbsRevealT) {
17413            clearRequestTimeout(parent._uncodeThumbsRevealT);
17414        }
17415
17416        parent._uncodeThumbsRevealT = requestTimeout(function() {
17417            $('.tmb-mask-init', $marquee).removeClass('tmb-mask-init');
17418            revealThumbs($marquee);
17419            parent._uncodeThumbsRevealT = null;
17420        }, 20);
17421    }, false);
17422    
17423    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
17424        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
17425            var $el = model.view.$el,
17426                shortcode = model.attributes.shortcode;
17427
17428            if ( $el.is('.custom-grid-container') ) {
17429                $el = $el.parent();
17430            }
17431
17432            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
17433                revealThumbs($el);
17434            }
17435        });
17436    }
17437
17438};
17439UNCODE.revslider = function() {
17440	var revSlider6In = function(){
17441		$('rs-module').each(function(){
17442			var $slider = $(this);
17443
17444			$slider.on('revolution.slide.onloaded', function(e, data){
17445				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17446					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
17447						scrolltop = $(document).scrollTop();
17448					if ( style != undefined ) {
17449						UNCODE.switchColorsMenu(scrolltop, style);
17450					}
17451				}
17452			});
17453
17454			$slider.on('revolution.slide.onchange', function(e, data){
17455				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17456					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
17457						scrolltop = $(document).scrollTop();
17458					if ( style != undefined ) {
17459						UNCODE.switchColorsMenu(scrolltop, style);
17460					}
17461				}
17462			});
17463
17464		});
17465
17466	};
17467	revSlider6In();
17468	$(window).on("load", revSlider6In );
17469
17470	document.addEventListener("sr.module.ready", function(e) { 
17471		var $slider = $('#'+e.id),
17472			settings = SR7.JSON[e.id];
17473
17474		if ( typeof settings !== 'undefined' && settings !== null ) {
17475			if ( $slider.closest(".header-revslider").length ) {
17476				var style = settings.slides[1].slide.attr.data,
17477					scrolltop = $(document).scrollTop();
17478				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17479				style = style[1];
17480				if ( style[1] != undefined ) {
17481					UNCODE.switchColorsMenu(scrolltop, style);
17482				}
17483			}
17484		}
17485	});
17486
17487	document.addEventListener("sr.slide.afterChange", function(e) {
17488		var $slider = $('#'+e.id),
17489			settings = SR7.JSON[e.id];
17490
17491		if ( typeof settings !== 'undefined' && settings !== null ) {
17492			if ( $slider.closest(".header-revslider").length ) {
17493				var style = settings.slides[e.current.id].slide.attr.data,
17494					scrolltop = $(document).scrollTop();
17495				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17496				style = style[1];
17497				if ( style != undefined ) {
17498					UNCODE.switchColorsMenu(scrolltop, style);
17499				}
17500			}
17501		}
17502	});
17503
17504};
17505UNCODE.layerslider = function() {
17506	$(window).on("load", function() {
17507
17508		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
17509
17510			var slideData = slider.slides.current.data,
17511				scrolltop = $(document).scrollTop();
17512			if( slideData && slideData.skin ) {
17513
17514				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
17515
17516			}
17517		});
17518
17519	});
17520};
17521
17522UNCODE.ajax_filters = function () {
17523	var isAjaxing = false;
17524
17525/*************************
17526 *
17527 * Filters Menu and Widgets Area
17528 *
17529 ************************/
17530
17531 	var clear_clicked = false;
17532
17533 	var init_ajax_grid = function(){
17534
17535		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
17536		$grids.each(function(index, val){
17537			var $body = $('body'),
17538				$grid = $(val).addClass('init-ajax-grid'),
17539				starting_point = $grid.attr('data-toggle'),
17540				$trigger = $('.uncode-toggle-ajax-filters', $grid),
17541				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
17542				$isotope_wrapper = $('.isotope-wrapper', $grid),
17543				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
17544				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
17545				$footprint = $('.ajax-filter-footprint', $grid),
17546				sidebar_w,
17547				data_w = parseFloat( $sidebar.attr('data-max-width') ),
17548				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
17549				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
17550				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
17551				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17552				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
17553				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
17554				sidew,
17555				$inside_row = $('> .row-parent', $vc_row),
17556				bg_row,
17557				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
17558				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
17559				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
17560				sidebar_overlay = false,
17561				sidebar_hover = false,
17562				switchMobile = false,
17563				scrollTop;
17564
17565			if ( $vc_row.attr('class') ) {
17566				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
17567			}
17568
17569			if ( bg_row != null ) {
17570				$side_header.add($side_footer).addClass(bg_row[0]);
17571			}
17572
17573			$trigger.add($apply_filters).on('click', function(e){
17574				e.preventDefault();
17575				e.stopPropagation();
17576				$grid = $('.ajax-grid-system').eq(0);
17577				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17578				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17579				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17580				sidebar_w = $sidebar_wrapper.width();
17581				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17582				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
17583					$(this).trigger('uncode-ajax-clear-filters');
17584				}
17585				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17586					$grid.toggleClass('ajax-hide-filters-blanks');
17587					$sidebar.slideToggle({
17588						duration: 400,
17589						easing: 'easeOutQuad',
17590					});
17591				} else {
17592					$grid.removeClass('ajax-hide-filters-blanks');
17593					$grid.toggleClass('ajax-hide-filters');
17594					if ( $grid.hasClass('ajax-hide-filters') ) {
17595						$body.addClass('ajax-hide-filters');
17596					} else {
17597						scrollTop = $('html, body').scrollTop();
17598						$body.removeClass('ajax-hide-filters');
17599					}
17600				}
17601				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17602					$('html, body').scrollTop(scrollTop);
17603				}
17604				return false;
17605			});
17606
17607			$close_btn.on('click', function(e){
17608				e.preventDefault();
17609				$grid = $('.ajax-grid-system').eq(0);
17610				$grid.addClass('ajax-hide-filters');
17611				if ( $grid.hasClass('ajax-hide-filters') ) {
17612					$body.addClass('ajax-hide-filters');
17613				} else {
17614					scrollTop = $('html, body').scrollTop();
17615					$body.removeClass('ajax-hide-filters');
17616				}
17617				$('html, body').scrollTop(scrollTop);
17618			});
17619
17620			$sidebar_wrapper.on('mouseover',function(){
17621				sidebar_hover = true;
17622			}).on('mouseout', function(){
17623				sidebar_hover = false;
17624			});
17625
17626			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
17627				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
17628					return;
17629				}
17630				if (undefined !== from && from === 'select_active_attributes') {
17631					return;
17632				}
17633				if ($(e.target).closest('.select2-container--open').length ) {
17634					return;
17635				}
17636				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
17637					$grid.add($body).addClass('ajax-hide-filters');
17638				}
17639			});
17640
17641			$sorting_trgr.on('click', function(e) {
17642				e.preventDefault();
17643			});
17644
17645			var inside_width = function(){
17646				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17647				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17648				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17649				$inside_row = $('> .row-parent', $vc_row);
17650				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
17651					sidew = $sidebar.width();
17652					$inside_row.css({
17653						width: sidew
17654					});
17655				} else {
17656					$inside_row.css({
17657						width: ''
17658					});
17659				}
17660			};
17661			inside_width();
17662
17663			var ajax_sidebar_position = function(e, f_editor){
17664				$grid = $('.ajax-grid-system').eq(0);
17665				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17666				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17667				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17668				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17669				$inside_row = $('> .row-parent', $vc_row);
17670				scrollTop = $('html, body').scrollTop();
17671				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery) || overlay_desktop ) ) {
17672					if ( switchMobile !== true ) {
17673						$grid.add($body).addClass('ajax-hide-filters');
17674						$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
17675						$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
17676						sidebar_overlay = true;
17677						$body.addClass('ajax-filter-sidebar-overlay');
17678						$sidebar_wrapper.addClass(skin);
17679						var sideHeadH = $side_header.outerHeight(),
17680							sideFooterH = $side_footer.outerHeight();
17681						if ( data_w !== '' && data_w > 0 ) {
17682							if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
17683								$sidebar.css({
17684									'max-width': data_w
17685								});
17686							} else {
17687								$sidebar.css({
17688									'max-width':'none'
17689								});
17690							}
17691						}
17692						$vc_row.css({
17693							'padding-top':sideHeadH,
17694							'padding-bottom':sideFooterH
17695						}).attr('data-lenis-prevent', true);
17696						var sidew = $sidebar.width();
17697						$inside_row.css({
17698							width: sidew
17699						});
17700						switchMobile = true;
17701					}
17702				} else {
17703					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
17704						scrollTop = $('html, body').scrollTop();
17705						$grid.add($body).removeClass('ajax-hide-filters');
17706					}
17707					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
17708						$grid.addClass('ajax-hide-filters-blanks');
17709						$sidebar.hide();
17710					}
17711					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
17712					$('.ajax-sidebar-placeholder', $grid).remove();
17713					sidebar_overlay = false;
17714					$body.removeClass('ajax-filter-sidebar-overlay');
17715					$sidebar_wrapper.removeClass(skin);
17716					if ( data_w !== '' && data_w > 0 ) {
17717						$sidebar.css({
17718							'max-width':'none'
17719						});
17720					}
17721					$vc_row.css({
17722						'padding-top':0,
17723						'padding-bottom':0,
17724					}).removeAttr('data-lenis-prevent');
17725
17726					$inside_row.css({
17727						width: ''
17728					});
17729
17730					if ( f_editor === true ) {
17731						UNCODE.ajax_filters();
17732					}
17733
17734					switchMobile = false;
17735				}
17736				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17737					$('html, body').scrollTop(scrollTop);
17738				}
17739			};
17740
17741			var sidebar_width = function(){
17742				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17743					sidebar_w = $footprint.width();
17744					$sidebar.css({ width: sidebar_w });
17745				} else {
17746					$sidebar.css({ width: '' });
17747				}
17748			};
17749			sidebar_width();
17750
17751			if ( SiteParameters.is_frontend_editor ) {
17752				ajax_sidebar_position();
17753			}
17754
17755			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
17756				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
17757					ajax_sidebar_position(e);
17758				}
17759				sidebar_width();
17760			});
17761
17762			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
17763				ajax_sidebar_position(e, true);
17764			});
17765
17766			$isotope_wrapper.on('transitionend', function(e){
17767				if ( $(e.target).hasClass('isotope-wrapper') ) {
17768					window.dispatchEvent(new CustomEvent('boxResized'));
17769				}
17770				return false;
17771			});
17772
17773			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
17774				var $grid = $('.ajax-grid-system').eq(0);
17775				$grid.addClass('ajax-hide-filters');
17776			}
17777
17778		});
17779	};
17780
17781	init_ajax_grid();
17782	$(document).on('uncode-ajax-filtered', init_ajax_grid);
17783
17784/*************************
17785 *
17786 * Hover hack
17787 *
17788 ************************/
17789 	var widget_hover_hack = function() {
17790 		$('.widget, .uncode_widget').each(function(){
17791			var $widget = $(this),
17792				class_w = $widget.attr('class'),
17793				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
17794				$footer = $widget.closest('#colophon');
17795
17796			if ( class_w.indexOf('widget_yith') > 0 ) {
17797				return true;
17798			}
17799
17800			$lis.each(function(){
17801 				var $li = $(this),
17802 					$a = $('a', $li),
17803 					$label = $a.closest('label');
17804
17805				if ( !$footer.length ) {
17806					$li.addClass('no-evts');
17807				}
17808
17809				if ( ! $('span', $a).length ) {
17810 					$li.addClass( 'li-hover' );
17811 				}
17812
17813 				$('li', $li).hover(function(e){
17814 					$(e.target).parents('li').each(function(){
17815 						$(this).addClass( 'parent-li-hover' );
17816 					});
17817					}, function (e) {
17818 					$(e.target).parents('li').each(function(key, val){
17819 						if ( key === 0) {
17820	 						$(val).removeClass( 'parent-li-hover' );
17821	 					}
17822 					});
17823 				});
17824
17825				$li.off('mouseup').on('mouseup', function (e) {
17826					if (e.which !== 3) {
17827						e.stopPropagation();
17828						var $a = $('a', this).first();
17829						$a[0].click();
17830					}
17831	 			});
17832 			});
17833 		});
17834	  }
17835
17836	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
17837
17838	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
17839		widget_hover_hack();
17840		$(document).on('uncode-ajax-filtered', widget_hover_hack);
17841	}
17842
17843/*************************
17844 *
17845 * Init Filters
17846 *
17847 ************************/
17848
17849	function init_filters() {
17850		$(document).on('click', '.term-filter-link', function(e) {
17851			var _this = $(this);
17852			var widget = _this.closest('.uncode_widget');
17853			var container = get_filters_container();
17854
17855			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17856				return true;
17857			}
17858
17859			e.preventDefault();
17860
17861			if (widget.hasClass('widget-ajax-filters--checkbox')) {
17862				_this.parent().find('input[type="checkbox"]').trigger('click');
17863			} else {
17864				if (_this.hasClass('term-filter-link--active')) {
17865					_this.removeClass('term-filter-link--active');
17866				} else {
17867					_this.addClass('term-filter-link--active');
17868
17869					if (widget.hasClass('widget-ajax-filters--single')) {
17870						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
17871					}
17872				}
17873
17874				if (!ajax_filters_button_mode) {
17875					var url = _this.attr('href');
17876
17877					reload_items(container, url, true);
17878				}
17879			}
17880		});
17881
17882		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
17883			var _this = $(this);
17884			var widget = _this.closest('.uncode_widget');
17885			var link = _this.closest('.term-filter').find('.term-filter-link');
17886			var url = link.attr('href');
17887			var container = get_filters_container();
17888
17889			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
17890				window.location = url;
17891				return;
17892			}
17893
17894			if (widget.hasClass('widget-ajax-filters--single')) {
17895				widget.find('input[type="checkbox"]').each(function() {
17896					if (_this.attr('id') !== $(this).attr('id')) {
17897						$(this).prop('checked', false);
17898						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
17899					}
17900				});
17901			}
17902
17903			if (_this.prop('checked')) {
17904				link.addClass('term-filter-link--active');
17905			} else {
17906				link.removeClass('term-filter-link--active');
17907			}
17908
17909			if (!ajax_filters_button_mode) {
17910				reload_items(container, url, true);
17911			}
17912		});
17913
17914		$(document).on('change', 'select.select--term-filters', function(e) {
17915			var _this = $(this);
17916			var selected = _this.find('option:selected');
17917			var option = $(selected);
17918			var url = option.attr('data-term-filter-url');
17919			var container = get_filters_container();
17920			var widget = _this.closest('.uncode_widget');
17921
17922			if (!ajax_filters_button_mode) {
17923				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17924					window.location = url;
17925				} else {
17926					reload_items(container, url, true);
17927				}
17928			}
17929		});
17930
17931		$(document).on('click', '.filter-list__link', function(e) {
17932			if (SiteParameters.is_frontend_editor) {
17933				return false;
17934			}
17935
17936			e.preventDefault();
17937
17938			var _this = $(this);
17939			var container = get_filters_container();
17940			var url = _this.attr('href');
17941			reload_items(container, url, true);
17942		});
17943
17944		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
17945			var _this = $(this);
17946			var container = get_filters_container();
17947			var url = _this.attr('href');
17948			reload_items(container, url, true);
17949		});
17950
17951		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
17952
17953			var _this = $(this);
17954			var container = get_filters_container();
17955			var url = _this.attr('href');
17956
17957			if ( container.length ) {
17958				e.preventDefault();
17959				reload_items(container, url, true);
17960			}
17961		});
17962
17963		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
17964			var _this = $(this);
17965			var container = get_filters_container();
17966
17967			if (container.length > 0) {
17968				e.preventDefault();
17969
17970				var min_price = $('#min_price').val();
17971				var max_price = $('#max_price').val();
17972				var location = window.location;
17973				var url = location.href;
17974				var page_uri = location.origin + location.pathname;
17975				var is_filtered = page_uri !== url;
17976
17977				if (is_filtered) {
17978					url = remove_parameter_from_url(url, 'min_price');
17979					url = remove_parameter_from_url(url, 'max_price');
17980				}
17981
17982				var concat = page_uri === url ? '?' : '&';
17983				var params = {'min_price': min_price, 'max_price': max_price};
17984
17985				url = url + concat + $.param(params);
17986
17987				reload_items(container, url, true);
17988			}
17989		});
17990
17991		if (!ajax_filters_button_mode && !window._uncode_search_bound) {
17992			window._uncode_search_bound = true;
17993			var search_timeout = parseInt(SiteParameters.ajax_filter_search_timeout, 10);
17994
17995			$(document).on('input', '.term-filters-search-input', function () {
17996				var _this = $(this);
17997				var container = get_filters_container();
17998				var value = _this.val();
17999
18000				if (window._uncode_search_timer) {
18001					clearTimeout(window._uncode_search_timer);
18002				}
18003
18004				window._uncode_search_timer = setTimeout(function () {
18005					update_search_url(container, value);
18006				}, search_timeout);
18007			});
18008		}
18009
18010		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
18011			var container = get_filters_container();
18012
18013			if (container.length) {
18014				e.preventDefault();
18015				var paramMap = {};
18016
18017				$('.term-filter-link--active').each(function () {
18018					collect_from_query(paramMap, this.href.split('?')[1] || '');
18019				});
18020
18021				$('.select--term-filters').each(function () {
18022					var select = $(this);
18023					var val = select.val();
18024
18025					if (!val) {
18026						return
18027					};
18028
18029					var selected_option = select.find('option:selected');
18030					var qUrl = selected_option.data('term-filter-url') || '';
18031
18032					collect_from_query(paramMap, qUrl.split('?')[1] || '');
18033				});
18034
18035				var search = $('.term-filters-search-input');
18036
18037				if (search.length > 0) {
18038					var search_value = search.val().trim();
18039					if (search_value) {
18040						paramMap[SiteParameters.ajax_filter_key_search] = {};
18041						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
18042					}
18043				}
18044
18045				var qsParts = [];
18046				$.each(paramMap, function (key, valSet) {
18047					var vals = Object.keys(valSet);
18048					qsParts.push(key + '=' + vals.join(','));
18049				});
18050
18051				var final_url = window.location.origin + window.location.pathname;
18052
18053				if (qsParts.length > 0) {
18054					qsParts.push('unfilter=1');
18055
18056					var qs = qsParts.join('&');
18057					final_url = '?' + qs;
18058				}
18059
18060				reload_items(container, final_url, true);
18061			}
18062		});
18063	}
18064
18065	function collect_from_query(paramMap, query) {
18066		$.each(query.split('&'), function (_, pair) {
18067			if (!pair) {
18068				return
18069			};
18070
18071			var kv  = pair.split('=');
18072			var key = kv[0];
18073			var val = kv[1] || '';
18074
18075			if (key === 'unfilter') {
18076				return;
18077			}
18078			if (!paramMap[key]) {
18079				paramMap[key] = {}
18080			};
18081
18082			paramMap[key][val] = 1;
18083		});
18084	}
18085
18086	function update_search_url(container, search_value) {
18087		var location = window.location;
18088		var url = location.href;
18089		var page_uri = location.origin + location.pathname;
18090		var is_filtered = page_uri !== url;
18091		var key_search = SiteParameters.ajax_filter_key_search;
18092		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
18093
18094		if (is_filtered) {
18095			url = remove_parameter_from_url(url, key_search);
18096			url = remove_parameter_from_url(url, key_unfilter);
18097		}
18098
18099		if (search_value) {
18100			var concat = page_uri === url ? '?' : '&';
18101			var params = {};
18102
18103			params[key_search] = search_value;
18104			params[key_unfilter] = 1;
18105			url = url + concat + $.param(params);
18106		} else {
18107			url = remove_parameter_from_url(url, key_search);
18108		}
18109
18110		reload_items(container, url, true);
18111	}
18112
18113	function remove_parameter_from_url(url, parameter) {
18114		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
18115	}
18116
18117	function get_filters_container() {
18118		var container = $('.ajax-grid-system');
18119
18120		if (container.length == 0) {
18121			container = $('.ajax-filters-target');
18122		}
18123
18124		return container;
18125	}
18126
18127	function update_widgets_state(widgets_states, container) {
18128		for (var i = widgets_states.length - 1; i >= 0; i--) {
18129			var state = widgets_states[i];
18130
18131			if (!state.collapse) {
18132				continue;
18133			}
18134
18135			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
18136
18137			if (state.open) {
18138				new_widget.find('.widget-title').addClass('open');
18139				if (state.css) {
18140					new_widget.find('.widget-collapse-content').attr('style', state.css);
18141				}
18142			} else {
18143				new_widget.find('.widget-title').removeClass('open');
18144				if (state.css) {
18145					new_widget.find('.widget-collapse-content').attr('style', state.css);
18146				}
18147			}
18148		}
18149	}
18150
18151	// Find filters container
18152	function find_filters_container(context) {
18153		const widget = context.find('.widget-ajax-filters').first();
18154		if (!widget.length) return $();
18155
18156		const sidebar = widget.closest('.ajax-filters-sidebar');
18157		if (sidebar.length) {
18158			return sidebar.find('.uncol').last();
18159		}
18160
18161		const col = widget.closest('.uncol');
18162		if (col.length) {
18163			return col;
18164		}
18165
18166		return $();
18167	}
18168
18169	// Reload items via AJAX
18170	function reload_items(container, url, push) {
18171		if (isAjaxing) {
18172			return
18173		};
18174
18175		isAjaxing = true;
18176
18177		container.addClass('grid-filtering');
18178
18179		$.ajax({
18180			url     : url,
18181			success : function(response) {
18182				if (!response) {
18183					return;
18184				}
18185
18186				$(document).trigger('uncode-ajax-pre-filtered');
18187
18188				var container_id = container.attr('id');
18189				var pagination = $('.row-navigation');
18190				var filters_container;
18191
18192				var isTargetFilterMode = container.hasClass('ajax-filters-target');
18193
18194				if (isTargetFilterMode) {
18195					filters_container = find_filters_container($(document));
18196				}
18197
18198				if (container_id) {
18199					var container_to_append = $(response).find('#' + container_id);
18200					var pagination_to_append = $(response).find('.row-navigation');
18201					var filters_to_append;
18202					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18203
18204					if (isTargetFilterMode) {
18205						filters_to_append = find_filters_container($(response));
18206					}
18207
18208					// Remember open/closed widgets
18209					var widgets = $('.uncode_widget');
18210					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
18211					var widgets_states = [];
18212
18213					widgets.each(function() {
18214						var widget = $(this);
18215						var id = widget.attr('data-id');
18216						var state = {
18217							'id': id,
18218							'collapse': false,
18219							'open': false,
18220							'css': false,
18221						};
18222
18223						var collapse_wrapper = widget.find('.widget-collapse-content');
18224
18225						if (collapse_wrapper.length > 0) {
18226							state.collapse = true;
18227
18228							var collapse_wrapper_css = collapse_wrapper.attr('style');
18229							var title = widget.find('.widget-title');
18230
18231							state.css = collapse_wrapper_css;
18232
18233							if (title.hasClass('open')) {
18234								state.open = true;
18235							} else {
18236								state.open = false;
18237							}
18238						}
18239
18240						widgets_states.push(state);
18241					});
18242
18243					// Update widgets state when it is not in target mode
18244					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
18245						update_widgets_state(widgets_states, container_to_append);
18246					}
18247
18248					// Update default sidebar state
18249					if (!container.hasClass('ajax-hide-filters')) {
18250						container_to_append.removeClass('ajax-hide-filters');
18251					}
18252
18253					// Update horizontal sidebar
18254					if (!container.hasClass('ajax-hide-filters-blanks')) {
18255						container_to_append.removeClass('ajax-hide-filters-blanks');
18256					}
18257					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
18258					if (horizontal_sidebar_wrapper.length > 0) {
18259						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
18260						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
18261						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
18262						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
18263
18264						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
18265						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
18266					}
18267
18268					// Append container
18269					container.replaceWith(container_to_append);
18270
18271					// Hide first thumbnail until the new srcset is loaded
18272					if (SiteParameters.dynamic_srcset_active === '1') {
18273						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
18274					}
18275
18276					// Remove loading attribute to images
18277					container_to_append.find('img').attr('loading', '');
18278
18279					// Append pagination
18280					if (pagination.length > 0) {
18281						if (pagination_to_append.length > 0) {
18282							pagination.html(pagination_to_append.html());
18283						} else {
18284							pagination.html('');
18285						}
18286					} else {
18287						if (pagination_to_append.length > 0) {
18288							$('.post-wrapper').append(pagination_to_append);
18289						}
18290					}
18291
18292					// Append filters
18293					if (isTargetFilterMode && filters_container.length > 0) {
18294						filters_container.html(filters_to_append.html());
18295					}
18296
18297					// Update widgets state when it is in target mode
18298					if (isTargetFilterMode && filters_container.length > 0) {
18299						update_widgets_state(widgets_states, filters_container);
18300					}
18301
18302					// Update off canvas sidebar (mobile and overlay)
18303					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18304
18305					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
18306						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
18307						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
18308						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
18309						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
18310
18311						// Update widgets state
18312						update_widgets_state(widgets_states, sidebar_to_append);
18313
18314						// Update sidebar
18315						sidebar_container.html(sidebar_to_append.html());
18316					}
18317
18318					if (push) {
18319						UNCODE.lastURL = url;
18320						window.history.pushState(
18321							{ pageTitle: document.title },
18322							'',
18323							url
18324						);
18325					}
18326
18327					if (typeof UNCODE.isotopeLayout !== 'undefined') {
18328						UNCODE.isotopeLayout();
18329					}
18330					if (typeof UNCODE.justifiedGallery !== 'undefined') {
18331						UNCODE.justifiedGallery();
18332					}
18333					if (typeof UNCODE.cssGrid !== 'undefined') {
18334						UNCODE.cssGrid();
18335					}
18336					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
18337						UNCODE.lightbox();
18338					}
18339					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
18340						UNCODE.lightgallery();
18341					}
18342					if (typeof UNCODE.carousel !== 'undefined') {
18343						UNCODE.carousel($('body'));
18344					}
18345					UNCODE.animations();
18346					if (typeof UNCODE.filters !== 'undefined') {
18347						UNCODE.filters();
18348					}
18349					if (typeof UNCODE.widgets !== 'undefined' && !(isTargetFilterMode && filters_container.length > 0)) {
18350						UNCODE.widgets();
18351					}
18352
18353					if (SiteParameters.dynamic_srcset_active === '1') {
18354						UNCODE.refresh_dynamic_srcset_size();
18355					}
18356
18357					if (typeof UNCODE.menuSmartInit !== 'undefined') {
18358						UNCODE.menuSmartInit();
18359					}
18360
18361					if (typeof UNCODE.parallax !== 'undefined') {
18362						UNCODE.parallax();
18363					}
18364
18365					maybe_scroll_to_top();
18366
18367					var woo_select2_cats = $('.dropdown_product_cat');
18368
18369					if (woo_select2_cats.length > 0) {
18370						woo_select2_cats.on( 'change', function() {
18371							if ( $(this).val() != '' ) {
18372								var this_page = '';
18373								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
18374								if ( home_url.indexOf( '?' ) > 0 ) {
18375									this_page = home_url + '&product_cat=' + $(this).val();
18376								} else {
18377									this_page = home_url + '?product_cat=' + $(this).val();
18378								}
18379								location.href = this_page;
18380							} else {
18381								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
18382							}
18383						});
18384
18385						if ( $().selectWoo ) {
18386							var wc_product_cat_select = function() {
18387								woo_select2_cats.selectWoo( {
18388									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
18389									minimumResultsForSearch: 5,
18390									width: '100%',
18391									allowClear: true,
18392									language: {
18393										noResults: function() {
18394											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
18395										}
18396									}
18397								} );
18398							};
18399							wc_product_cat_select();
18400						}
18401					}
18402
18403					$(document).trigger('uncode-ajax-filtered');
18404					$(document.body).trigger('init_price_filter');
18405					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
18406					window.document.dispatchEvent(new Event("DOMContentLoaded", {
18407						bubbles: true,
18408						cancelable: true
18409					}));
18410
18411					isAjaxing = false;
18412				}
18413			},
18414			error: function() {
18415				container.removeClass('grid-filtering');
18416
18417				isAjaxing = false;
18418
18419				if (SiteParameters.enable_debug == true) {
18420					// This console log is disabled by default
18421					// So nothing is printed in a typical installation
18422					//
18423					// It can be enabled for debugging purposes setting
18424					// the 'uncode_enable_debug_on_js_scripts' filter to true
18425					console.log('There was an error retrieving the products');
18426				}
18427			}
18428		});
18429	}
18430
18431	// Scroll to top after filtering
18432	function maybe_scroll_to_top() {
18433		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18434
18435		if (offcanvas_sidebar_wrapper.length > 0) {
18436			return;
18437		}
18438
18439		var container = get_filters_container();
18440		var bound = container[0].getBoundingClientRect();
18441
18442		if (bound.y < 0) {
18443			$(window).scrollTop(container.offset().top);
18444		}
18445	}
18446
18447	// Back/forward browser buttons
18448	$(window).on("popstate.ajaxfilters", function(e) {
18449		var location = window.location;
18450		var url = location.href;
18451		var params = UNCODE.getURLParams(window.location);
18452		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
18453
18454		UNCODE.lastURL = url;
18455
18456		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
18457			return;
18458		}
18459
18460		var container = get_filters_container();
18461
18462		reload_items(container, url, false);
18463	});
18464
18465	// Destroy load more before to init a new one
18466	$(window).on('uncode-ajax-pre-filtered', function() {
18467		if ($.fn.infinitescroll) {
18468			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
18469		}
18470	});
18471
18472	init_filters();
18473};
18474
18475UNCODE.videoThumbs = function() {
18476	var checkResize,
18477		newW = UNCODE.wwidth;
18478	var checkForVideos = function(){
18479
18480		$(window).on('okevents.y.change', function(e, y){
18481			var $video = $(y.target.g),
18482				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18483				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18484				restart = !$video_wrap.hasClass('play-pause'),
18485				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18486				setTime;
18487			if ( newW >= UNCODE.mediaQuery ) {
18488
18489				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
18490					$video_wrap.data('hovered', true);
18491					$video_wrap.addClass('played-on');
18492					y.target.pauseVideo();
18493					$tmb.on('mouseenter', function(){
18494						if ( restart ) {
18495							y.target.seekTo(0);
18496						}
18497						y.target.playVideo();
18498					}).on('mouseleave', function(){
18499						clearTimeout(setTime);
18500						setTime = setTimeout(function(){
18501							y.target.pauseVideo();
18502						}, 300);
18503					});
18504				}
18505
18506			} else {
18507				if( $mobile_video_wrap.length ) {
18508					$video_wrap.addClass('played-on');
18509					y.target.playVideo();
18510				}
18511			}
18512
18513		});
18514
18515		$(window).on('okevents.v.loaded', function(e, playerV){
18516			var $video = $(playerV.element),
18517				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18518				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18519				restart = !$video_wrap.hasClass('play-pause'),
18520				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
18520: $video.closest('.t-entry-visual, .un-inline-image'),
18521				setTime;
18522
18523			if ( newW >= UNCODE.mediaQuery ) {
18524				
18525				if( $video_wrap.length ) {
18526
18527					var playPromise = playerV.play();
18528					if (playPromise !== undefined) {
18529						playPromise.then(function( value ) {
18530							playerV.pause();
18531						});
18532					}
18533					$video_wrap.addClass('played-on');
18534					$tmb.on('mouseenter', function(){
18535						if ( restart ) {
18536							playerV.setCurrentTime(0)
18537						}
18538						playerV.play();
18539					}).on('mouseleave', function(){
18540						clearTimeout(setTime);
18541						setTime = setTimeout(function(){
18542							playerV.pause();
18543						}, 300);
18544					});
18545				}
18546
18547			} else {
18548
18549				if( $mobile_video_wrap.length ) {
18550					var playPromise = playerV.play();
18551					if (playPromise !== undefined) {
18552						playPromise.then(function( value ) {
18553							playerV.play();
18554						});
18555					}
18556					$video_wrap.addClass('played-on');
18557				}
18558			}
18559		});
18560
18561		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
18562			var $video = $(video),
18563				$noscript = $('noscript', $video),
18564				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18565				restart = !$video_wrap.hasClass('play-pause'),
18566				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18567				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18568				setTime,
18569			manageVideo = function(){
18570				video.currentTime = 0;
18571				video.pause();
18572				if ( newW >= UNCODE.mediaQuery ) {
18573					if ( $video_wrap.length ) {
18574						$video_wrap.addClass('played-on');
18575						$tmb.on('mouseenter', function(){
18576							if ( restart ) {
18577								video.currentTime = 0;
18578							}
18579							video.play();
18580						}).on('mouseleave', function(){
18581							clearTimeout(setTime);
18582							setTime = setTimeout(function(){
18583								video.pause();
18584							}, 300);
18585						});
18586					} else {
18587						video.play();
18588					}
18589				} else {
18590					if ( $mobile_video_wrap.length ) {
18591						$mobile_video_wrap.addClass('played-on');
18592						video.play();
18593					}
18594				}
18595
18596			};
18597			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
18598				$noscript.each(function(key, val){
18599					$noscript.after(val.textContent || val.innerText || val.innerHTML);
18600					$noscript.remove();
18601				});
18602			}
18603
18604			if (typeof MediaElement === "function") {
18605				$video.has('source[src]').mediaelementplayer({
18606					pauseOtherPlayers: false,
18607				});
18608			}
18609			if (video.readyState > 0) {
18610				manageVideo();
18611			} else {
18612				window.addEventListener("pageshow", function (event) {
18613					if (event.persisted) {
18614						manageVideo();
18615					}
18616				});				
18617				$video.on("loadedmetadata", function(_event) {
18618					manageVideo();
18619				});
18620			};
18621		});
18622	
18623	};
18624	
18625	checkForVideos();
18626
18627	var checkVideoResize = function(){
18628		clearRequestTimeout(checkResize);
18629		checkResize = requestTimeout(function(){
18630			if ( newW !== UNCODE.wwidth ) {
18631				checkForVideos();
18632				newW = UNCODE.wwidth;
18633			}
18634		}, 1000);
18635	};
18636
18637	$(window).off('resize.videos', checkVideoResize)
18638	.on( 'resize.videos', checkVideoResize);
18639
18640	$(window).off('more-items-loaded.videos', checkForVideos)
18641	.on('more-items-loaded.videos', checkForVideos);
18642
18643	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
18644	.on('uncode-ajax-filtered.videos', checkForVideos);
18645
18646};
18647UNCODE.inlineImgs = function() {
18648    var linkInlineImgs = function(){
18649        $('.un-inline-image').each(function(){
18650            var $img = $(this),
18651                href = $(this).attr('data-link-href'),
18652                dataImg = $img.data();
18653			if ( dataImg != '' && href != null && href !== '' ) {
18654                var class_stra_a = 'unline-image-link';
18655                if ( $(this).hasClass('un-inline-space-over') ) {
18656                    class_stra_a += ' un-inline-space-over';
18657                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
18658                    class_stra_a += ' un-inline-space-gutter';
18659                }
18660                var str_a = '<a class="' + class_stra_a + '" ';
18661                for (var key in dataImg) {
18662                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
18663                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
18664                    }
18665                }
18666                str_a += ' />';
18667                $img.wrap(str_a);
18668			}
18669        });
18670    };
18671    $(window).on('load', linkInlineImgs );
18672};
18673UNCODE.lottie = function() {
18674    if ( SiteParameters.is_frontend_editor ) {
18675        var $lottie_wraps = $('div.uncode-lottie-wrap');
18676        $lottie_wraps.each(function(){
18677            var $lottie_wrap = $(this),
18678                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
18679                $player_clone = $div_player.clone(),
18680                player_id = $div_player.attr('data-id'),
18681                $lottie_players = $('lottie-player', $lottie_wrap).remove();
18682            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
18683                if ( $('#'+player_id).length ) {
18684                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
18685                }
18686                $player_clone.attr('id', player_id);
18687                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
18688                $div_player.after($player_clone);
18689                $div_player.attr('data-init',true);
18690            }
18691        });
18692    }
18693    var $players = $('.uncode-lottie-wrap lottie-player');
18694    $players.each(function(){
18695        var player = this,
18696            this_id = $(player).attr('id'),
18697            _player = document.getElementById(this_id),
18698            trigger = $(player).attr('data-trigger'),
18699            pFrames = $(player).attr('data-frames').split(','),
18700            srcPlayer = $(player).attr('src');
18701
18702        _player.load(srcPlayer);
18703
18704        _player.addEventListener("ready", function() {
18705
18706            var $_shadow = _player.shadowRoot;
18707            $($_shadow).find('.error').remove();
18708
18709            var tFrames = _player.getLottie().totalFrames / 100,
18710                pFrame_from = Math.round(tFrames * pFrames[0]),
18711                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
18712                loop = $(player).attr('loop'),
18713                mode,
18714                actions;
18715
18716            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
18717                if ( trigger === 'scroll' ) {
18718                    mode = 'scroll';
18719                    actions = [
18720                        {
18721                            visibility:[0, 1.0],
18722                            type: "seek",
18723                            frames: [pFrame_from, pFrame_to],
18724                        }
18725                    ];
18726                } else if ( trigger === 'viewport') {
18727                    mode = 'scroll';
18728                    actions = [
18729                        {
18730                            visibility: [0.20, 1.0],
18731                            frames: [pFrame_from, pFrame_to],
18732                            type: loop ? "loop" : "play"
18733                        }
18734                    ];
18735                } else if ( trigger === 'hover') {
18736                    $(player).on('mouseenter', function(){
18737                        _player.play();
18738                    }).on('mouseleave', function(){
18739                        _player.pause();
18740                    });
18741                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
18742                        _player.seek(pFrame_from);
18743                        _player.addEventListener("frame", function(){
18744                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
18745                                _player.seek(pFrame_from);
18746                            }
18747                        });
18748                    }
18749                }
18750                LottieInteractivity.create({
18751                    player: '#' + this_id,
18752                    mode: mode,
18753                    actions: actions
18754                });
18755            } else {
18756                if ( pFrame_from > 0 && pFrame_from < 99 ) {
18757                    _player.seek(pFrame_from);
18758                    _player.addEventListener("frame", function(){
18759                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
18760                            _player.seek(pFrame_from);
18761                        }
18762                    });
18763                }
18764            }
18765        });
18766
18767        $(window).on('unlottie-destroy', function(){
18768            _player.destroy();
18769        });
18770    });
18771};
18772
18773UNCODE.animatedBgGradient = function( _el ) {
18774
18775    var ev;
18776
18777	if ( typeof _el === 'undefined' || _el === null ) {
18778        _el = document;
18779        ev = false;
18780	} else {
18781        _el = _el[0];
18782        ev = 'shortcode:update';
18783    }
18784
18785    var simplex = new SimplexNoise();
18786
18787    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
18788		this.block = blockOverlay;
18789		this.wrap = canvasWrap;
18790		this.config();
18791		this.checker();
18792		this.loopRAF();
18793        this.animLoader();
18794    };
18795
18796    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
18797
18798    AnimGradient.config = function() {
18799        this.canvas = document.createElement('canvas');
18800        this.wrap.appendChild(this.canvas);
18801        this.ctx = this.canvas.getContext('2d');
18802        this.count = 0;        
18803        this.isOrientationChanged = false;
18804        this.res = UNCODE.isMobile ? 90 : 110;
18805        this.resPercent = 100/this.res;
18806        this.resAround = this.resPercent/100;
18807        this.size = typeof this.block.getAttribute('data-bg-noise-size') !== 'undefined' && this.block.getAttribute('data-bg-noise-size') !== null && this.block.getAttribute('data-bg-noise-size') !== '' ? this.block.getAttribute('data-bg-noise-size') : 1;
18808
18809        this.canvas.classList.add('uncode-bg-animated-gradient');
18810        this.canvas.setAttribute('height', this.res);
18811        this.canvas.setAttribute('width', this.res);
18812        this.canvas.style = 'height: 100%; position: relative; width:100%;';
18813
18814        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
18815
18816        this.cx = this.canvas.width/2;
18817        this.cy = this.canvas.height/2;
18818        this.data = this.imgdata.data;
18819
18820        this.opts = {
18821            col_1st: typeof this.block.getAttribute('data-bg-noise-1') !== 'undefined' && this.block.getAttribute('data-bg-noise-1') !== null && this.block.getAttribute('data-bg-noise-1') !== '' ? this.block.getAttribute('data-bg-noise-1') : false,
18822            col_2nd: typeof this.block.getAttribute('data-bg-noise-2') !== 'undefined' && this.block.getAttribute('data-bg-noise-2') !== null && this.block.getAttribute('data-bg-noise-2') !== '' ? this.block.getAttribute('data-bg-noise-2') : false,
18823            time: typeof this.block.getAttribute('data-bg-noise-speed') !== 'undefined' && this.block.getAttribute('data-bg-noise-speed') !== null && this.block.getAttribute('data-bg-noise-speed') !== '' ? parseFloat(this.block.getAttribute('data-bg-noise-speed')) : 250,//100,250,1500
18824        };
18825
18826        this.lavaTime = 1;
18827        this.bg_colors = [];
18828
18829        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
18830            return;
18831        }
18832
18833        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
18834            this.singleColor = true;
18835        }
18836
18837        if( this.opts.col_1st ) {
18838
18839            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
18840
18841            this.bg_colors.push({
18842                r: rgbColor1.r,
18843                g: rgbColor1.g,
18844                b: rgbColor1.b
18845            });
18846        }
18847
18848        if( this.opts.col_2nd ) {
18849
18850            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
18851
18852            this.bg_colors.push({
18853                r: rgbColor2.r,
18854                g: rgbColor2.g,
18855                b: rgbColor2.b
18856            });
18857        }
18858
18859    };
18860
18861    AnimGradient.checker = function() {
18862        var scope = this;
18863        this.checkInViewPort();
18864      
18865        window.addEventListener('resize', function() {
18866            if(UNCODE.isMobile && !scope.isOrientationChanged) {
18867                return;
18868            }
18869            scope.ratioCalc();
18870        });
18871
18872        window.addEventListener("orientationchange", function() {
18873            scope.isOrientationChanged = true;
18874        });
18875
18876        this.ratioCalc();
18877    }; 
18878
18879    AnimGradient.ratioCalc = function() {
18880      
18881        var blockW = this.block.clientWidth,
18882            blockH = this.block.clientHeight;
18883
18884        if ( blockH == 0 || blockW == 0 )
18885            return;
18886
18887        var blockRatio = blockH/blockW;
18888
18889        if(blockRatio < 1) {
18890            this.ratioParam = {
18891                x: 1.4,
18892                y: blockRatio*1.4
18893            }
18894        } else {
18895            this.ratioParam = {
18896                x: blockRatio/3,
18897                y: 1
18898            }
18899        }
18900         
18901    };
18902
18903    AnimGradient.checkInViewPort = function() {
18904        var scope = this;
18905        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
18906            scope.isInViewport = true;
18907        } else if( 'IntersectionObserver' in window ) {
18908		    var observer = new IntersectionObserver(function(entries) {
18909  
18910                entries.forEach(function(entry){
18911                    if ( entry.isIntersecting ) {
18912                        scope.isInViewport = true;
18913                    } else {
18914                        scope.isInViewport = false;
18915                    }
18916                });
18917  
18918		    }, { 
18919			root: document,
18920		  });
18921  
18922		  observer.observe(scope.block);
18923		}
18924	};
18925	
18926    AnimGradient.hexToRGB = function(hexval) {
18927        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
18928        if (!hexecuted) {
18929            return false;
18930        }
18931        return {
18932            r: parseInt(hexecuted[1], 16),
18933            g: parseInt(hexecuted[2], 16),
18934            b: parseInt(hexecuted[3], 16)
18935        }
18936    };
18937
18938    AnimGradient.factor = function(val_1, val_2, lava) { 
18939        return val_1 * (1 - lava) + val_2 * lava;
18940    };
18941
18942    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
18943        if (this.singleColor) {
18944            return this.bg_colors[0][wave_l];
18945        }
18946        return this.factor(this.bg_colors[0][wave_l], this.bg_colors[1][wave_l], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*3.5)*noise/2 );
18947        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
18948    };
18949
18950    AnimGradient.lava = function(x, y, grade) {
18951        var radians = (Math.PI / 180) * grade,
18952        cos = Math.cos(radians),
18953        sin = Math.sin(radians),
18954        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
18955        return nx;
18956    };
18957    
18958    AnimGradient.loopRAF = function() {
18959
18960      var scope = this;
18961
18962        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
18963            for (var x = 0; x < this.res; x++) {
18964                for (var y = 0; y < this.res; y++) {
18965                    
18966                    var noise = simplex.noise3D((x / this.res * this.ratioParam.x)*this.size, (y / this.res * this.ratioParam.y)*this.size, this.count/this.opts.time); //original
18967        
18968                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
18969                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
18970                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
18971                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
18972                  
18973                }
18974            }
18975   
18976            this.count++;
18977          
18978            this.ctx.putImageData(this.imgdata, 0, 0);
18979         
18980        }
18981
18982        requestAnimationFrame(function() {
18983            scope.loopRAF();
18984        });
18985    };
18986
18987    AnimGradient.animLoader = function() {
18988        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
18989    };
18990
18991    var anim_init = function() {
18992        var bgs = _el.querySelectorAll('.block-bg-overlay');
18993      
18994        bgs.forEach(function(blockOverlay) {
18995            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
18996            if( !blockOverlay || !canvasWrap ) {
18997                return;
18998            }
18999            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
19000        });
19001    }
19002
19003    $(window).on('load', function(){
19004        anim_init();
19005    });
19006
19007    if ( ev === 'shortcode:update' ) {
19008        anim_init();
19009    }
19010
19011};
19012UNCODE.multibg = function(){
19013	var $bgsWraps = $('.uncode-multi-bgs'),
19014		$body = $('body');
19015	$bgsWraps.each(function(){
19016		var $bgWrap = $(this),
19017			transition = $bgWrap.attr('data-transition'),
19018			transitionTime = $bgWrap.attr('data-transition-time'),
19019			dataPace = $bgWrap.attr('data-transition-pace'),
19020			dataThreshold = $bgWrap.attr('data-transition-threshold'),
19021			dataTime = $bgWrap.attr('data-carousel-time'),
19022			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
19023			random = $bgWrap.attr('data-multi-random'),
19024			_bgWrap = $bgWrap[0],
19025			$multiBgs = $('.multi-background', $bgWrap),
19026			imgFirst,
19027			bgAmount = $multiBgs.length,
19028			isInViewport = false,
19029			lastScrollTop = 0,
19030			counter = 0,
19031			totMove = 0,
19032			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
19033			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
19034			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
19035			offX, offY,
19036			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
19037			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
19038			requestCarousel,
19039			is_header = $bgWrap.closest('#page-header').length,
19040			startTime = new Date();
19041
19042		transition = typeof transition === 'undefined' ? '' : transition;
19043
19044		if ( random === 'true' ) {
19045			UNCODE.shuffle($multiBgs);
19046		}
19047
19048		$multiBgs.find('.background-inner').attr('data-active','false');
19049
19050		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
19051
19052		var loadFirst = function(){
19053			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
19054				opacity: 1
19055			}, 250, 'easeInQuad').css({
19056				zIndex: 1
19057			});	
19058		}
19059
19060		var loadError = function(){
19061			console.log('Multi BG loading error');
19062		}
19063
19064		if ( imgFirst && imgFirst !== 'none' ) {
19065			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
19066		} else {
19067			loadFirst();
19068		}
19069
19070		var loadSlides = function( $thisBg ){
19071			$thisBg.attr('data-load', 'loaded');	
19072		}
19073
19074		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
19075			var $thisBg = $(val);
19076
19077			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
19078
19079				var _imgBg = $(val).find('.background-inner').css('background-image');
19080
19081				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
19082					$thisBg.attr('data-load', 'loaded');
19083				} else {
19084					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
19085					if ( typeof _imgBg !== 'undefined' ) {
19086						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
19087					}
19088				}
19089			}
19090		});
19091					
19092		var multiCarousel = function(e) {
19093
19094			clearRequestTimeout(requestCarousel);
19095
19096			var checkTime = new Date();
19097			if ( checkTime - startTime >= carouselTime && isInViewport ) {
19098				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
19099
19100				if ( $checkEl.attr('data-load') !== 'loaded' ) {
19101					requestTimeout(function(){
19102						multiCarousel();
19103					}, 100);
19104					return;
19105				}
19106
19107				counter++;
19108
19109				$multiBgs.each(function(ind, val){
19110					if ( ind === counter%bgAmount ) {
19111						$(val).stop(true,false).animate({
19112							opacity: 1
19113						}, wait, 'easeInQuad').css({
19114							zIndex: 1
19115						}).find('.background-inner').attr('data-active','true');
19116					} else {
19117						$(val).stop(true,false).animate({
19118							opacity: 0
19119						}, wait, 'easeInQuad', function(){
19120							$(val).find('.background-inner').attr('data-active','false');
19121						}).css({
19122							zIndex: 0
19123						});
19124					}
19125				});
19126
19127			}
19128
19129			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
19130				requestCarousel = requestTimeout(multiCarousel, carouselTime);
19131			}
19132	
19133		};
19134
19135		var multiMove = function(e) {
19136			if ( $body.hasClass('navbar-hover') ) {
19137				return;
19138			}
19139			var checkTime = new Date(),
19140                bound = $bgWrap[0].getBoundingClientRect(),
19141                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
19142			if (offX) {
19143				totMove += Math.sqrt(
19144					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
19145				);
19146			}
19147			if (
19148                totMove >= pace && 
19149                checkTime - startTime >= wait &&
19150                e.clientX <= (bound.left + bound.width) &&
19151                e.clientX >= bound.left &&
19152                e.clientY <= (bound.top + bound.height) &&
19153                e.clientY >= bound.top
19154            ) {
19155				counter++;
19156				startTime = checkTime;
19157				$multiBgs.each(function(ind, val){
19158					if ( ind === counter%bgAmount ) {
19159						$(val).stop(true,false).animate({
19160							opacity: 1
19161						}, wait, 'easeInQuad').css({
19162							zIndex: 1
19163						}).find('.background-inner').attr('data-active','true');
19164					} else {
19165						$(val).stop(true,false).animate({
19166							opacity: 0
19167						}, wait, 'easeInQuad', function(){
19168							$(val).find('.background-inner').attr('data-active','false');
19169						}).css({
19170							zIndex: 0
19171						});
19172					}
19173				});
19174
19175				totMove = 0;
19176			}
19177			
19178			offX = e.clientX;
19179			offY = e.clientY;
19180			
19181		};
19182
19183		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19184			document.addEventListener("mousemove", multiMove);
19185		}
19186
19187		window.addEventListener('resize', function() {
19188			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19189				document.removeEventListener("mousemove", multiMove);
19190				document.addEventListener("mousemove", multiMove);
19191			}
19192		});
19193
19194		var lightLoopRAF = function() {
19195
19196			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
19197				checkTime = new Date(),
19198				bound = $bgWrap[0].getBoundingClientRect(),
19199				thresholdHeader = is_header ? 100 : threshold,
19200				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
19201			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
19202				counter++;
19203				lastScrollTop = scrollTop;
19204				startTime = checkTime;
19205
19206				$multiBgs.each(function(ind, val){
19207					if ( ind === counter%bgAmount ) {
19208						$(val).stop(true,false).animate({
19209							opacity: 1
19210						}, wait, 'easeInQuad').css({
19211							zIndex: 1
19212						}).find('.background-inner').attr('data-active','true');
19213					} else {
19214						$(val).stop(true,false).animate({
19215							opacity: 0
19216						}, wait, 'easeInQuad', function(){
19217							$(val).find('.background-inner').attr('data-active','false');
19218						}).css({
19219							zIndex: 0
19220						});
19221					}
19222				});
19223
19224			}
19225
19226			requestAnimationFrame(function() {
19227				if ( isInViewport ) {
19228					lightLoopRAF();
19229				}
19230			});
19231		};
19232
19233		var currentInd = 0;
19234
19235		var loopRAF = function() {
19236
19237			var multiBgRotate = function(slideInd){
19238				currentInd = slideInd;
19239				$multiBgs.each(function(ind, val){
19240					if ( ind === slideInd ) {
19241						$(val).stop(true,false).animate({
19242							opacity: 1
19243						}, wait, 'easeInQuad').css({
19244							zIndex: 1
19245						}).find('.background-inner').attr('data-active','true');
19246					} else {
19247						$(val).stop(true,false).animate({
19248							opacity: 0
19249						}, wait, 'easeInQuad', function(){
19250							$(val).find('.background-inner').attr('data-active','false');
19251						}).css({
19252							zIndex: 0
19253						});
19254					}
19255				});
19256			};
19257			var bound = $bgWrap[0].getBoundingClientRect(),
19258				thresholdPX = UNCODE.wheight * threshold / 100,
19259				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
19260				movePX = totMove / bgAmount,
19261				moving = UNCODE.wheight - (bound.top + thresholdPX),
19262				slideInd = 0;
19263
19264			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
19265				multiBgRotate(0);
19266			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
19267				multiBgRotate(bgAmount-1);
19268			} else {
19269				slideInd = Math.ceil(moving/movePX) - 1;
19270				if ( slideInd < 0 ) {
19271					slideInd = 0;
19272				} else if ( slideInd >= bgAmount ) {
19273					slideInd = bgAmount-1;
19274				}
19275				if ( slideInd !== currentInd ) {
19276					multiBgRotate(slideInd);
19277				}
19278			}
19279
19280			requestAnimationFrame(function() {
19281				if ( isInViewport ) {
19282					loopRAF();
19283				}
19284			});
19285		};
19286
19287		if( 'IntersectionObserver' in window ) {
19288		    var observer = new IntersectionObserver(function(entries) {
19289  
19290                entries.forEach(function(entry){
19291                    if ( entry.isIntersecting ) {
19292                        isInViewport = true;
19293						if ( transition === 'scroll' ) {
19294							if ( autoScroll ) {
19295								loopRAF();
19296							} else {
19297								lightLoopRAF();
19298							}
19299						} else {
19300							multiCarousel();
19301						}
19302                    } else {
19303                        isInViewport = false;
19304                   }
19305                });
19306  
19307		    }, { 
19308				root: document,
19309				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
19310		  	});
19311
19312			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19313		  		observer.observe(_bgWrap);
19314			}
19315
19316			window.addEventListener('resize', function() {
19317				observer.unobserve(_bgWrap);
19318				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19319					observer.observe(_bgWrap);
19320				}
19321			});
19322	
19323		}
19324
19325	});
19326}
19327
19328UNCODE.owlNav = function(target, ev) {
19329    target = target.replace(/#\S+/g, '');
19330    var $carousel = $('#'+target),
19331        $slider = $carousel.closest('.uncode-slider'),
19332        $checkNavs = $('.uncode-owl-nav');
19333    if ( !$checkNavs.length ) {
19334        return;
19335    }
19336
19337    if ( $slider.length ){
19338        target = $slider.attr('id');
19339    }
19340
19341    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
19342        $row;
19343
19344    if ( ! $navs.length ) {
19345        $row = $carousel.closest('.vc_row.row-container');
19346        $navs = $('.uncode-owl-nav:not([data-target])', $row);
19347    }
19348        
19349    if ( ! $navs.length ) {
19350        return;
19351    }
19352
19353    $navs.each(function(){
19354        var $nav = $(this),
19355            $outer = $nav.closest('.uncode-owl-nav-out'),
19356            $inner = $nav.find('.uncode-owl-nav-in'),
19357            $navDots = $('.uncode-nav-dots', $nav),
19358            $navCounter = $('.uncode-nav-counter', $nav),
19359            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
19360            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
19361            skinInherit = $nav.hasClass('skin-inherit'),
19362            digit = parseFloat($nav.attr('data-digit')),
19363            counterDigit = parseFloat($nav.attr('data-counter-digit')),
19364            navSpeed = parseFloat($carousel.attr('data-navspeed'));
19365        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
19366
19367        if ( $nav.hasClass('pos-abs') ){
19368            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
19369                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
19370            }
19371            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
19372        } 
19373
19374        $carousel.on('refreshed.owl.carousel', counter);
19375        $carousel.on('resized.owl.carousel', counter);
19376        $carousel.on('changed.owl.carousel', counter);
19377
19378        if ( $carousel.closest('.un-submenu').length ) {
19379            $carousel.on('initialized.owl.carousel', counter);
19380        }
19381
19382        var totalSlides = 0;
19383
19384        function counter(event) {
19385            if (!event.namespace) {
19386                return;
19387            }
19388            var slides = event.relatedTarget,
19389                current = slides._current,
19390                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
19391                item = event.item,
19392                page = event.page,
19393                countPages = Math.ceil(item.count / page.size),
19394                $currentSlide = $carousel.find('.owl-item').eq(current),
19395                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
19396                activeSlide = Math.ceil(itemIndex / page.size),
19397                $prev = $nav.find('.uncode-nav-prev'),
19398                $next = $nav.find('.uncode-nav-next'),
19399                $col = $currentSlide.find('.uncol').first();
19400
19401            if ( totalSlides != countPages ) {
19402                totalSlides = countPages;
19403                $navDots.html('');
19404                var nav_html = '';
19405                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
19406                    var padN = sl_ind+1;
19407                    if ( digit && digit > 1 ) {
19408                        padN = String(padN).padStart(digit, '0');
19409                    }
19410                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
19411                }
19412                $navDots.html(nav_html);
19413
19414                var totalSlidesDigit = totalSlides;
19415
19416                if ( counterDigit && counterDigit > 1 ) {
19417                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
19418                }
19419                $counterTotal.html(totalSlidesDigit);
19420            }
19421
19422            if ( loop !== true ) {
19423                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
19424                if ( itemIndex === 1 ) {
19425                    $prev.addClass('uncode-nav-disabled');
19426                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
19427                    $next.addClass('uncode-nav-disabled');
19428                    activeSlide = Math.ceil(item.count / page.size);
19429                }
19430            }
19431
19432            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
19433            var activeSlideDigit = activeSlide;
19434
19435            if ( counterDigit && counterDigit > 1 ) {
19436                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
19437            }
19438            $counterIndex.html(activeSlideDigit);
19439
19440            if ( skinInherit ) {
19441                if ( $col.hasClass('style-light') ){
19442                    $nav.removeClass('style-dark').addClass('style-light');
19443                } else if ( $col.hasClass('style-dark') ) {
19444                    $nav.removeClass('style-light').addClass('style-dark');
19445                }
19446            }
19447
19448            $inner.removeClass('uncode-owl-nav-waiting');
19449
19450            if ( $nav.hasClass('outer-width') ) {
19451                var navW = $nav.outerWidth(),
19452                    nexW = $next.outerWidth(),
19453                    prevW = $prev.outerWidth(),
19454                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
19455
19456                if ( $nav.hasClass('h-align-justify') ) {
19457                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
19458                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
19459                        $inner.css({'margin': 'auto'});
19460                    } else {
19461                        $inner.css({'margin': ''});
19462                    }
19463                } else {
19464                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
19465                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
19466                        $inner.css({'margin': 'auto'});
19467                    } else {
19468                        $inner.css({'margin': ''});
19469                    }
19470                }
19471            }
19472        }
19473
19474        $nav.on('click', '.uncode-nav-index', function(){
19475            var $bullet = $(this),
19476                slide_index = parseFloat( $bullet.attr('data-key') );
19477            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
19478        });
19479        $nav.on('click', '.uncode-nav-prev', function(){
19480            $carousel.trigger('prev.owl.carousel', [navSpeed]);
19481        });
19482        $nav.on('click', '.uncode-nav-next', function(){
19483            $carousel.trigger('next.owl.carousel', [navSpeed]);
19484        });
19485
19486        if ( $nav.hasClass('animated-arrows') ) {
19487            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
19488                $(this).addClass("hover"); 
19489            }).on('animationend', function(){
19490                $(this).removeClass("hover");  
19491            });
19492        }
19493
19494        var positionNav = function(){
19495            if ( $nav.hasClass('window-width') ) {
19496                var navOff = parseFloat( $nav.offset().left ) * -1;
19497                if ( navOff > 0 ) {
19498                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
19499                } else {
19500                    $inner.css({ transform: 'none' });
19501                }
19502            }
19503        }
19504        positionNav();
19505        $(window).on('resize', positionNav);
19506        $(document).on('un-menu-show', positionNav);
19507    });
19508
19509    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
19510};
19511
19512	UNCODE.init = function() {
19513		var wfl_check = false, wfl_request, waypoint_request;
19514		UNCODE.preventDoubleTransition();
19515		UNCODE.betterResize();
19516		UNCODE.utils();
19517		UNCODE.unBlockMenu();
19518		UNCODE.mobileMenuBlockSkins();
19519		UNCODE.magnetic();
19520		if (typeof UNCODE.accessibility !== 'undefined') {
19521			UNCODE.accessibility();
19522		}
19523		if (typeof UNCODE.rowParallax !== 'undefined') {
19524			UNCODE.rowParallax();
19525		}
19526		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
19527			UNCODE.changeSkinOnScroll();
19528		}
19529		if (typeof UNCODE.share !== 'undefined') {
19530			UNCODE.share();
19531		}
19532		if (typeof UNCODE.tooltip !== 'undefined') {
19533			UNCODE.tooltip();
19534		}
19535		if (typeof UNCODE.counters !== 'undefined') {
19536			UNCODE.counters();
19537		}
19538		if (typeof UNCODE.countdowns !== 'undefined') {
19539			UNCODE.countdowns();
19540		}
19541		if (typeof UNCODE.tabs !== 'undefined') {
19542			UNCODE.tabs();
19543		}
19544		if (typeof UNCODE.collapse !== 'undefined') {
19545			UNCODE.collapse();
19546		}
19547		if (typeof UNCODE.bigText !== 'undefined') {
19548			UNCODE.bigText();
19549		}
19550		UNCODE.menuSystem();
19551		if (typeof UNCODE.bgChanger !== 'undefined') {
19552			UNCODE.bgChanger();
19553		}
19554		if (typeof UNCODE.magicCursor !== 'undefined') {
19555			UNCODE.magicCursor();
19556		}
19557		if (typeof UNCODE.magneticCursor !== 'undefined') {
19558			UNCODE.magneticCursor();
19559		}
19560		if (typeof UNCODE.dropImage !== 'undefined') {
19561			UNCODE.dropImage();
19562		}
19563		if (typeof UNCODE.postTable !== 'undefined') {
19564			UNCODE.postTable();
19565		}
19566		if (typeof UNCODE.rotatingTxt !== 'undefined') {
19567			UNCODE.rotatingTxt();
19568		}
19569		if (typeof UNCODE.okvideo !== 'undefined') {
19570			UNCODE.okvideo();
19571			window.addEventListener( "uncode-more-items-loaded", function() {
19572				UNCODE.okvideo("uncode-more-items-loaded");
19573			});
19574		}
19575		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
19576			UNCODE.backgroundSelfVideos();
19577		}
19578		UNCODE.tapHover();
19579		if (typeof UNCODE.isotopeLayout !== 'undefined') {
19580			UNCODE.isotopeLayout();
19581		}
19582		if (typeof UNCODE.justifiedGallery !== 'undefined') {
19583			UNCODE.justifiedGallery();
19584		}
19585		if (typeof UNCODE.cssGrid !== 'undefined') {
19586			UNCODE.cssGrid();
19587		}
19588		if (typeof UNCODE.linearGrid !== 'undefined') {
19589			UNCODE.linearGrid();
19590		}
19591		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
19592			UNCODE.lightbox();
19593		}
19594		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
19595			$(window).on('load more-items-loaded',function(){
19596				UNCODE.lightgallery();
19597			});
19598		}
19599		if (typeof UNCODE.carousel !== 'undefined') {
19600			UNCODE.carousel($('body'));
19601		}
19602		if (typeof UNCODE.lettering !== 'undefined') {
19603			UNCODE.lettering();
19604		}
19605		UNCODE.animations();
19606		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
19607			UNCODE.stickyElements();
19608		}
19609		if (typeof UNCODE.twentytwenty !== 'undefined') {
19610			UNCODE.twentytwenty();
19611		}
19612		UNCODE.disableHoverScroll();
19613		UNCODE.printScreen();
19614		if (typeof UNCODE.particles !== 'undefined') {
19615			UNCODE.particles();
19616		}
19617		if (typeof UNCODE.filters !== 'undefined') {
19618			UNCODE.filters();
19619		}
19620		if (typeof UNCODE.ajax_filters !== 'undefined') {
19621			UNCODE.ajax_filters();
19622		}
19623		if (typeof UNCODE.widgets !== 'undefined') {
19624			UNCODE.widgets();
19625		}
19626		if (typeof UNCODE.unmodal !== 'undefined') {
19627			UNCODE.unmodal();
19628		}
19629		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
19630			if ( !UNCODE.isFullPage ) {
19631				UNCODE.checkScrollForTabs();
19632			}
19633		}
19634		if (typeof UNCODE.onePage !== 'undefined') {
19635			UNCODE.onePage(UNCODE.isMobile);
19636		}
19637		if (typeof UNCODE.fullPage !== 'undefined') {
19638			$(document).ready(function(){
19639				UNCODE.fullPage();
19640			});
19641		}
19642		if (typeof UNCODE.skewIt !== 'undefined') {
19643			UNCODE.skewIt();
19644		}
19645		if (typeof UNCODE.rotateIt !== 'undefined') {
19646			UNCODE.rotateIt();
19647		}
19648		if (typeof UNCODE.textMarquee !== 'undefined') {
19649			UNCODE.textMarquee();
19650		}
19651		if (typeof UNCODE.stickyScroll !== 'undefined') {
19652			UNCODE.stickyScroll();
19653		}
19654		if (typeof UNCODE.stickyTrigger !== 'undefined') {
19655			UNCODE.stickyTrigger();
19656		}
19657		if (typeof UNCODE.areaTextReveal !== 'undefined') {
19658			UNCODE.areaTextReveal();
19659		}
19660		if (typeof UNCODE.thumbsReveal !== 'undefined') {
19661			UNCODE.thumbsReveal();
19662		}
19663		if (typeof UNCODE.verticalText !== 'undefined') {
19664			UNCODE.verticalText();
19665		}
19666		if (typeof UNCODE.videoThumbs !== 'undefined') {
19667			UNCODE.videoThumbs();
19668		}
19669		if (typeof UNCODE.revslider !== 'undefined') {
19670			UNCODE.revslider();
19671		}
19672		if (typeof UNCODE.layerslider !== 'undefined') {
19673			UNCODE.layerslider();
19674		}
19675		if (typeof UNCODE.lottie !== 'undefined') {
19676			UNCODE.lottie();
19677		}
19678		if (typeof UNCODE.inlineImgs !== 'undefined') {
19679			UNCODE.inlineImgs();
19680		}
19681		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
19682			UNCODE.animatedBgGradient();
19683		}
19684		if (typeof UNCODE.readMoreCol !== 'undefined') {
19685			UNCODE.readMoreCol();
19686		}
19687		if (typeof UNCODE.multibg !== 'undefined') {
19688			UNCODE.multibg();
19689		}
19690		if (typeof UNCODE.flexEqual !== 'undefined') {
19691			UNCODE.flexEqual();
19692		}
19693		if (typeof UNCODE.wrapperMarquee !== 'undefined') {
19694			UNCODE.wrapperMarquee();
19695		}
19696		if (typeof UNCODE.wrapperSticky !== 'undefined') {
19697			UNCODE.wrapperSticky();
19698		}
19699		if (typeof UNCODE.mouseTrail !== 'undefined') {
19700			UNCODE.mouseTrail();
19701		}
19702		if (typeof UNCODE.magneticPattern !== 'undefined') {
19703			UNCODE.magneticPattern();
19704		}
19705		if (typeof UNCODE.thumbDrop !== 'undefined') {
19706			UNCODE.thumbDrop();
19707		}
19708		$(window).on('load',function(){
19709			clearRequestTimeout(waypoint_request);
19710			waypoint_request = requestTimeout( function(){
19711				Waypoint.refreshAll();
19712			}, 1000);
19713		});
19714		$(window).one('load',function(){
19715			if (typeof UNCODE.parallax !== 'undefined') {
19716				UNCODE.parallax();
19717			}
19718		});
19719	}
19720
19721	if ( ! SiteParameters.is_frontend_editor ) {
19722		UNCODE.init();
19723	}
19724
19725
19726})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.