PageSourceSearch

https://www.stellantisapprenticeships.com/wp-content/themes/uncode/library/js/app.js?ver=21171255

js stellantisapprenticeships.com collected 2026-10-10 01:23:44 UTC 631,773 bytes, 19,723 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
105var checkScrollTriggerRefresh;
106
107$(function(){
108	$(document).on('uncode-scrolltrigger-refresh', function(){
109		clearRequestTimeout(checkScrollTriggerRefresh);
110		checkScrollTriggerRefresh = requestTimeout(function(){
111			ScrollTrigger.refresh();
112			$('.scroll-refresh-hidden').removeClass('opacity_0');
113		}, 500);
114	});
115});
116
117UNCODE.checkImgLoad = function( src, cb, err, el ) {
118	var img = new Image();
119	img.onload = function () {
120		var result = (img.width > 0) && (img.height > 0);
121		cb(el);
122	};
123	img.onerror = function () {
124		err();
125	};
126	img.src = src
127};
128
129UNCODE.betterResize = function() {
130	var setResize,
131		doubleResize = true,
132		oldW = UNCODE.wwidth,
133		oldH = UNCODE.wheight,
134		setCTA;
135	$(window).on( 'resize orientationchange', function(){
136		if ( oldW === UNCODE.wwidth ) {
137			return;
138		} else {
139			oldW = UNCODE.wwidth;
140			$(window).trigger('wwResize');
141		}
142
143		if ( oldH === UNCODE.wheight ) {
144			return;
145		} else {
146			oldH = UNCODE.wheight;
147			$(window).trigger('whResize');
148		}
149	});
150
151	$(window).on( 'resize orientationchange', function(){
152		clearRequestTimeout(setCTA);
153		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
154	});
155};
156
157UNCODE.shuffle = function(array) {
158	var currentIndex = array.length,
159		randomIndex;
160  
161	while (currentIndex > 0) {
162		randomIndex = Math.floor(Math.random() * currentIndex);
163		currentIndex--;
164		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
165	}
166  
167	return array;
168};
169
170Number.isInteger = Number.isInteger || function(value) {
171    return typeof value === "number" &&
172           isFinite(value) &&
173           Math.floor(value) === value;
174};
175
176UNCODE.utils = function() {
177	$(document).on('mouseover', 'a', function () {
178		if (!$(this).hasClass('star')) {
179			$(this).attr('data-title', $(this).attr('title'));
180			$(this).removeAttr('title');
181		}
182	});
183	$(document).on('mouseout', 'a', function () {
184		if (!$(this).hasClass('star')) {
185			$(this).attr('title', $(this).attr('data-title'));
186			$(this).removeAttr('data-title');
187		}
188	});
189
190	this.get_scroll_offset = function(e) {
191
192		var scroll_offset = 0,
193			target,
194			trigger;
195
196		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
197			target = e.target;
198			trigger = e.currentTarget;
199		}
200
201		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
202			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
203				UNCODE.hideMenu(100);
204			}
205		}
206
207		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
208			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
209			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
210				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile && ! $('.menu-mobile-transparent').length ) ) {
211					if ( !$('.menu-hided').length ) {
212						if ( $('body').hasClass('hmenu-center') ) {
213							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
214						} else {
215							scroll_offset += ~~$('.logo-container:visible').outerHeight();
216						}
217					}
218				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && UNCODE.wwidth > UNCODE.mediaQuery ) {
219					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
220					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
221				} else {
222					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
223						scroll_offset += UNCODE.menuMobileHeight;
224					} else {
225						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 ) {
226							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
227						} else {
228							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
229								scroll_offset += UNCODE.menuMobileHeight;
230							}
231						}
232					}
233				}
234			}
235
236		}
237
238		scroll_offset += UNCODE.bodyBorder;
239
240		return scroll_offset;
241	}
242
243	if ( !UNCODE.isFullPage ) {
244		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
245
246			var hash = (e.currentTarget).hash,
247			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
248			anchor = '';
249			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
250			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
251				e.preventDefault();
252				if (!$('#tab-reviews').is(':visible')) {
253					$('a[href="#tab-reviews"]').trigger('click');
254				}
255				var calc_scroll = $('.wootabs .tab-content').offset().top;
256				calc_scroll -= UNCODE.get_scroll_offset(e);
257
258				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
259					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
260
261					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
262						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
263					}
264				}
265
266				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
267					delta = bodyTop - calc_scroll,
268					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
269				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
270
271				requestTimeout(function(){
272					if (scrollSpeed == 0) {
273						$('html, body').scrollTop(calc_scroll);
274						UNCODE.scrolling = false;
275					} else {
276   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
277							$(this).stop();
278						}).animate({
279								scrollTop: calc_scroll
280							}, scrollSpeed, 'easeInOutCubic', function() {
281								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
282								UNCODE.scrolling = false;
283							}
284						);
285					}
286				}, 200);
287				return;
288			}
289			if (hash != undefined) {
290				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
291				var anchor = this.hash.slice(1);
292				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
293			  		if ( !specialFormat.test(hash) ) {
294			  			if ( $(hash).length )
295			  				anchor = $(hash);
296			  		}
297				}
298			}
299
300			if (is_scrolltop || anchor != '') {
301				if (is_scrolltop) {
302					e.preventDefault();
303					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
304					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
305					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
306
307					if (scrollSpeed == 0) {
308						$('html, body').scrollTop(0);
309						UNCODE.scrolling = false;
310					} else {
311   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
312							$(this).stop();
313						}).animate({
314							scrollTop: 0
315						}, scrollSpeed, 'easeInOutCubic', function() {
316							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
317							UNCODE.scrolling = false;
318						});
319					}
320				} else {
321					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
322					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a, #uncode-mobile-menu-block .menu-item > a'), function(index, val) {
323						var get_href = $(val).attr('href');
324						if (get_href != undefined) {
325							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
326							else $(val).parent().removeClass('active');
327						}
328					});
329					if (scrollSection.length) {
330						if ( $('body').hasClass('uncode-scroll-no-history') ) {
331							e.preventDefault();
332						}
333
334						if (UNCODE.menuOpened) {
335							if (UNCODE.wwidth < UNCODE.mediaQuery) {
336								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
337							} else {
338								$('.mmb-container-overlay .overlay-close').trigger('click');
339								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
340							}
341						}
342
343						var calc_scroll = scrollSection.offset().top,
344							getOffset = UNCODE.get_scroll_offset(e),
345							$logo = $('.logo-container:visible'),
346							logoH,
347							$menu = $('#masthead .menu-container'),
348							menuH;
349
350						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
351
352						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
353							delta = bodyTop - calc_scroll,
354							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
355						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
356
357						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
358							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
359								logoH = $logo.outerHeight(),
360								menuH = $menu.outerHeight();
361								if ( calc_scroll < ( logoH + menuH ) ) {
362									calc_scroll = 0;
363								}
364							}
365						}
366
367						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
368							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
369						}
370
371						if (scrollSpeed == 0) {
372							$('html, body').scrollTop(calc_scroll);
373							UNCODE.scrolling = false;
374						} else {
375	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
376								$(this).stop();
377							}).animate({
378								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
379							}, scrollSpeed, 'easeInOutCubic', function() {
380								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
381								UNCODE.scrolling = false;
382								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
383								||
384								$('.menu-hided').length ) {
385									calc_scroll = scrollSection.offset().top;
386									getOffset = UNCODE.get_scroll_offset(e);
387									calc_scroll -= getOffset;
388									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
389										$(this).stop();
390									}).animate({
391										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
392										}, scrollSpeed, 'easeInOutCubic', function() {
393											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
394											UNCODE.scrolling = false;
395										}
396									);
397								}
398							});
399						}
400					}
401				}
402			}
403		});
404		$('.header-scrolldown').on('click', function(event) {
405
406			event.preventDefault();
407
408			var pageHeader = $(event.target).closest('#page-header'),
409				pageHeaderTop = pageHeader.offset().top,
410				pageHeaderHeight = pageHeader.outerHeight(),
411				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
412			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
413
414			var calc_scroll = pageHeaderTop + pageHeaderHeight,
415			getOffset = UNCODE.get_scroll_offset(event);
416			calc_scroll -= getOffset;
417
418			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
419				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
420
421				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
422					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
423				}
424			}
425
426			if (scrollSpeed == 0) {
427				$('html, body').scrollTop(calc_scroll);
428				UNCODE.scrolling = false;
429			} else {
430					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
431						$(this).stop();
432					}).animate({
433						scrollTop: calc_scroll
434					}, scrollSpeed, 'easeInOutCubic', function() {
435						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
436						UNCODE.scrolling = false;
437						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
438							calc_scroll = pageHeaderTop + pageHeaderHeight;
439							getOffset = UNCODE.get_scroll_offset(event);
440							calc_scroll -= getOffset;
441								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
442									$(this).stop();
443								}).animate({
444									scrollTop: calc_scroll
445								}, scrollSpeed, 'easeInOutCubic', function() {
446									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
447									UNCODE.scrolling = false;
448								}
449							);
450						}
451					}
452				);
453			}
454		});
455	}
456
457	// Colomun hover effect
458	// =================
459	$(document).on('mouseenter', '.col-link', function(e) {
460		var uncol = $(e.target).prev('.uncol'),
461		el = uncol.find('.column-background');
462		if (el) {
463			$('.btn-container .btn', uncol).addClass('active');
464			var elOverlay = $(el[0]).find('.block-bg-overlay');
465			if (elOverlay.length) {
466				var getOpacity = $(elOverlay).css('opacity');
467				if (getOpacity != 1) {
468					getOpacity = Math.round(getOpacity * 100) / 100;
469					var newOpacity = getOpacity + .1;
470					$(elOverlay).data('data-opacity', getOpacity);
471					$(elOverlay).css('opacity', newOpacity);
472				}
473			}
474		}
475	}).on('mouseleave', '.col-link', function(e) {
476		var uncol = $(e.target).prev('.uncol'),
477		el = uncol.find('.column-background');
478		$('.btn-container .btn', uncol).removeClass('active');
479		if (el) {
480			var elOverlay = $(el[0]).find('.block-bg-overlay');
481			if (elOverlay.length) {
482				var getOpacity = $(elOverlay).data('data-opacity');
483				$(elOverlay).css('opacity', getOpacity);
484			}
485		}
486	});
487
488	// Admin bar
489	// ============
490	var fixAdminBar = function() {
491		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
492			var getAdminBar = $('#wpadminbar');
493			if (getAdminBar.length) {
494				if (getAdminBar.css('position') !== 'hidden') {
495					var getAdminBarHeight = getAdminBar.height();
496					if (getAdminBar.css('position') === 'fixed') {
497						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
498						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
499					} else {
500						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
501						$('.body-borders .top-border').css({'margin-top':'0px'});
502					}
503				}
504			}
505		}
506	};
507	window.addEventListener('load', fixAdminBar);
508	window.addEventListener('resize', fixAdminBar);
509	// Print
510	// ===========
511	var beforePrint = function() {
512		window.dispatchEvent(new CustomEvent('resize'));
513		window.dispatchEvent(UNCODE.boxEvent);
514	};
515
516	if (window.matchMedia) {
517		var mediaQueryList = window.matchMedia('print');
518		mediaQueryList.addListener(function(mql) {
519			if (mql.matches) {
520				beforePrint();
521			}
522		});
523	}
524
525	window.onbeforeprint = beforePrint;
526
527	// Safari srcset
528	var safariSrcSet = function(){
529		if ( !SiteParameters.is_frontend_editor ) {
530			$('html.safari img[sizes]').each(function(){
531				var $img = $(this),
532					sizeImg = parseInt($img.attr('sizes'));
533				if ( typeof(sizeImg) === 'number' ) {
534					$img.attr('sizes', (sizeImg) + 'px');
535				}
536			});
537		}
538	};
539	window.addEventListener('load', safariSrcSet);
540}
541
542UNCODE.lettering = function() {
543
544	var setCTA;
545	var highlightStill = function(){
546
547		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
548
549		$.each($heading_texts, function(key, el) {
550			var $heading = $(el);
551
552			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
553				return;
554			}
555
556			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
557				return;
558			}
559
560			var waypoint = new Waypoint({
561				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
562				element: el,
563				handler: function() {
564					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
565						anims_l = $anims.length;
566					$anims.each(function(_key_, _el_){
567						var $anim = $(_el_);
568
569						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
570							$anim.addClass('heading-text-highlight-animated');
571
572							if ( $heading.data('animate') === true ) {
573								$anim.css({
574									'-webkit-transition-duration': '0ms',
575									'-moz-transition-duration': '0ms',
576									'-o-transition-duration': '0ms',
577									'transition-duration': '0ms',
578								});
579							} else {
580								$anim.css({
581									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
582									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
583									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
584									'transition-delay': ((_key_ + 2) * 200) + 'ms',
585								});
586							}
587						}
588
589					});
590					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
591						$heading.data('animate', true);
592					});
593					$anims.removeAttr('data-animated');
594				},
595				offset: '100%'
596			});
597
598		});
599
600		Waypoint.refreshAll();
601		$( document.body ).trigger('uncode_waypoints');
602		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
603			$(document).trigger('uncode-scrolltrigger-refresh');
604		}
605
606	}
607
608	requestTimeout(function(){
609		highlightStill();
610		$(window).on( 'wwResize', function(){
611			clearRequestTimeout(setCTA);
612			setCTA = requestTimeout( highlightStill, 100 );
613		});
614	}, 400);
615
616};
617
618UNCODE.isUnmodalOpen = false;
619
620var manageVideoSize = function(){
621
622	var setVideoFit;
623	$('.wp-block-embed').each(function(){
624
625		var $this = $(this);
626
627		if ( $('iframe', $this).length ) {
628
629			var $iframe = $('> iframe, > a > iframe', $this),
630				w = parseFloat($iframe.attr('width')),
631				h = parseFloat($iframe.attr('height')),
632				url = $iframe.attr('src'),
633				ratio, frW;
634
635			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
636
637				ratio = h / w;
638				var setResizeiFto,
639					resizeiFrame = function(){
640					frW = $iframe.width();
641					$iframe.css({
642						height: frW * ratio
643					});
644				};
645				resizeiFrame();
646				$(window).on( 'wwResize load', function(){
647					clearRequestTimeout(setResizeiFto);
648					setResizeiFto = requestTimeout( function() {
649						resizeiFrame();
650					}, 10 );
651				});
652
653			}
654
655		}
656
657	});
658
659};
660
661manageVideoSize();
662
663UNCODE.vivus = function(icon, time, delay, file) {
664	if (typeof Vivus !== 'undefined') {
665		var icon_options = {
666			type: 'delayed',
667			pathTimingFunction: Vivus.EASE_OUT,
668			animTimingFunction: Vivus.LINEAR,
669			duration: time,
670		}
671
672		if (delay) {
673			icon_options.delayStart = delay;
674		}
675
676		if (file) {
677			icon_options.file = file;
678		}
679
680		new Vivus(icon, icon_options);
681	}
682};
683
684UNCODE.lastURL = '';
685
686UNCODE.getURLParams = function(current_location, is_string) {
687	var params = {};
688	if (is_string) {
689		var url = current_location.split('?')[1];
690	} else {
691		var url = current_location.search;
692		url = url.substring(1);
693	}
694	if (url) {
695		var parts = url.split('&');
696		for (var i = 0; i < parts.length; i++) {
697			var nv = parts[i].split('=');
698			if (!nv[0]) {
699				continue;
700			}
701			params[nv[0]] = nv[1] || true;
702		}
703	}
704	return params;
705}
706
707UNCODE.hasEqualURLParams = function(obj1, obj2) {
708	for (var i in obj1) {
709		if (obj1.hasOwnProperty(i)) {
710			if (!obj2.hasOwnProperty(i)) {
711				return false;
712			}
713			if (obj1[i] != obj2[i]) {
714				return false;
715			}
716		}
717	}
718	for (var i in obj2) {
719		if (obj2.hasOwnProperty(i)) {
720			if (!obj1.hasOwnProperty(i)) {
721				return false;
722			}
723			if (obj1[i] != obj2[i]) {
724				return false;
725			}
726		}
727	}
728    return true;
729}
730
731UNCODE.magnetic = function(){
732	
733	$(document).on('mousemove', '.un-magnetic-zone', function(e){
734
735		var $zone = $(this),
736			zoneOff = $zone.offset(),
737			$mgntcEl = $('.un-magnetic-el', this),
738			elBound = this.getBoundingClientRect(),
739			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
740
741		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
742	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
743	  
744		$mgntcEl.each(function(key, val){
745			var magneticValue = $(val).attr('data-mgntc') || 0.5;
746		
747			val.animate({
748				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
749			},{
750				duration: 500,
751				fill: 'forwards',
752			})
753	  	});
754	})
755	
756	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
757		var $mgntcEl = $('.un-magnetic-el', this);
758
759		$mgntcEl.each(function(key, val){
760			val.animate({
761		  		transform: 'translate(0)',
762			},{
763		  		duration: 500,
764		  		fill: 'forwards',
765			})
766	  	});
767	})
768};
769
770
771UNCODE.rowParallax = function(){
772
773	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
774		return;
775	}
776
777	var $rows = $('.parallax-move'),
778		stableHeight = UNCODE.wheight;
779	$rows.each(function(){
780		var $row = $(this),
781			_row = $row[0],
782			dataMove = $row.attr('data-parallax-move'),
783			dataSafe = $row.attr('data-parallax-safe'),
784            rowInViewport = false,
785			trans;
786
787		if ( $row.find('.parallax-move').length ) {
788			return;
789		}
790
791		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
792		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
793        dataMove = dataMove / 10;
794
795        if ( 'IntersectionObserver' in window ) {
796			var observer = new IntersectionObserver(function(entries) {
797	
798				entries.forEach(function(entry){
799					if ( entry.isIntersecting ) {
800						rowInViewport = true;
801					} else {
802						rowInViewport = false;
803					}
804				});
805	
806			}, { 
807				root: document,
808			});
809	
810			observer.observe(_row);
811		} else {
812            rowInViewport = true;
813		}
814
815		var loopRAF = function() {
816			if( rowInViewport ) {
817				var bound = _row.getBoundingClientRect(),
818					bound_top = bound.top,
819					bound_height = bound.height,
820					move = true,
821					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
822					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
823						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
824					fromBottom = docH - (scrolled + bound_top + bound_height);
825
826                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
827                    $row.find('>div').css({
828                        'transform':'none'
829                    });
830                    move = false;
831				}
832
833				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
834					$row.find('>div').css({
835						'transform':'none'
836					});
837					move = false;
838				}
839
840				if ( move ) {
841
842					if ( fromBottom < stableHeight ) {
843						//maybe Footer
844						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
845                    } else if ( scrolled + bound_top < stableHeight ) {
846						//maybe Header
847						trans = scrolled*(dataMove);
848					} else {
849						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
850					}
851
852                    $row.find('>div').css({
853                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
854                    });
855                }
856			}
857	
858			requestAnimationFrame(loopRAF);
859		};
860		
861		requestAnimationFrame(loopRAF);
862
863	});
864
865	$(window).on( 'load resize', function(e) {
866		if ( ! UNCODE.isMobile ) {
867			stableHeight = UNCODE.wheight;
868		}
869	});
870
871	$(window).on( 'load wwResize', function(e) {
872		if ( UNCODE.isMobile ) {
873			stableHeight = UNCODE.wheight;
874		}
875	});
876
877}
878
879UNCODE.changeSkinOnScroll = function(){
880	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
881		return;
882	}
883	var $masthead = $('#masthead'),
884		transDesktop,
885		transMobile,
886		changeSkin,
887
888	checkTransparencyAndChange = function( $col ){
889		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
890		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
891		changeSkin = $masthead.hasClass('menu-change-skin');
892
893		if ( ! transDesktop && ! transMobile ) {
894			return false;
895		}
896
897		if ( ! changeSkin ) {
898			return false;
899		}
900
901		if ( $col.hasClass('style-light') ){
902			$masthead.removeClass('style-dark-override').addClass('style-light-override');
903			return false;
904		} else if ( $col.hasClass('style-dark') ) {
905			$masthead.removeClass('style-light-override').addClass('style-dark-override');
906			return false;
907		}
908	};
909
910	var prev_row = 'normal',
911		odd = true,
912		$rows = $('.vc_row[data-parent]:visible:not(.overlay-menu *):not(#uncode-mobile-menu-block *):not(.block-wrapper-parent *)');
913	$.each($rows, function(index, row){
914		var $row = $(row),
915			$col = $('.uncol', $row).first(),
916			$slider = $('.uncode-slider', $row);
917
918		if ( $row.closest('li.menu-item').length ) {
919			return;
920		}
921
922		var wayDown = new Waypoint({
923			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
924			element: row,
925			handler: function(direction) {
926				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
927					if ( $slider.length ) {
928						$col = $('.owl-item.index-active .uncol', $slider).first();
929					}
930					checkTransparencyAndChange($col);
931				}
932				if ( odd === false ) {
933					if ( row.hasAttribute('data-bg-changer') ) {
934						prev_row = 'bg-changer';
935					} else {
936						prev_row = 'normal';
937					}
938					odd = true;
939				} else {
940					odd = false;
941				}
942			},
943			offset: function() {
944				return UNCODE.menuHeight / 2
945			}
946		});
947		var wayUp = new Waypoint({
948			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
949			element: row,
950			handler: function(direction) {
951				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
952					if ( $slider.length ) {
953						$col = $('.owl-item.index-active .uncol', $slider).first();
954					}
955					checkTransparencyAndChange($col);
956				}
957				if ( odd === false ) {
958					if ( row.hasAttribute('data-bg-changer') ) {
959						prev_row = 'bg-changer';
960					} else {
961						prev_row = 'normal';
962					}
963					odd = true;
964				} else {
965					odd = false;
966				}
967			},
968			offset: function() {
969				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
970			}
971		});
972	});
973
974};
975
976UNCODE.share = function() {
977	if (typeof Share !== 'undefined') {
978		var share_button_element = $('.share-button');
979		var share_button_url = share_button_element.data('url');
980
981		var share_button_config = {
982			ui: {
983				flyout: "top center",
984				button_font: false,
985				button_text: '',
986				icon_font: false
987			}
988		};
989
990		if (share_button_url) {
991			share_button_config.url = share_button_url.replace("&", "%26");
992		}
993
994		var share_button_top = new Share('.share-button', share_button_config);
995
996		$('li[data-network]', share_button_element).each(function(){
997			var label = SiteParameters.uncode_share_label,
998				network = $(this).attr('data-network');
999			label = label.replace("%", network);
1000			$(this).attr('aria-label', label);
1001		});
1002	}
1003};
1004
1005UNCODE.tooltip = function() {
1006	if (typeof jQuery.fn.tooltip !== 'undefined') {
1007		$('.btn-tooltip').tooltip();
1008	}
1009};
1010
1011UNCODE.counters = function() {
1012	var $counters = $('.uncode-counter:not(.counter-init)');
1013	$counters.each(function(){
1014		var $counter = $(this).addClass('counter-init');
1015		if ( SiteParameters.is_frontend_editor ) {
1016			$counter.addClass('started');
1017		}
1018		if ( $counter.closest( '.owl-carousel' ).length ) {
1019			return;
1020		}
1021		$counter.addClass('started').counterUp({
1022			delay: 10,
1023			time: 1500
1024		});
1025	});
1026};
1027
1028UNCODE.countdowns = function() {
1029	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1030	$countdowns.each(function() {
1031		var $this = $(this).addClass('counter-init'),
1032			finalDate = $(this).data('uncode-countdown');
1033		$this.countdown(finalDate, function(event) {
1034			$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>'));
1035		});
1036	});
1037};
1038
1039UNCODE.tabs = function() {
1040
1041	var tabSwitcher = function($el){
1042		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1042ical):not(.tab-switch)', $el).each(function(key, value){
1043			var $navs = $(value),
1044				$active = $('li.active', $navs),
1045				$active_a = $('> a', $active),
1046				$active_span = $('> span', $active_a),
1047				vertical = $navs.closest('.vertical-tab-menu').length;
1048			
1049			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1050				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1051			}
1052
1053			var $cursor = $('.switcher-cursor', $navs),
1054				active_w = $('a', $active).outerWidth(),
1055				span_w = $active_span.outerWidth(),
1056				active_pos = $active.position(),
1057				active_a_pos = $active_a.position(),
1058				span_pos = $active_span.position(),
1059				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1060				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1061
1062			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1063
1064			if ( ! vertical ) {
1065				$cursor.css({
1066					left: cursor_left,
1067					width: cursor_w
1068				});
1069			}
1070
1071			$navs.addClass('switch-init');
1072		});
1073	};
1074
1075	var $body = $('body');
1076	tabSwitcher($body);
1077
1078	var tabHoverIntent = function(){
1079		var setHover;
1080		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1081			.on('mouseover', function(e){
1082				var $this = $(e.target);
1083				setHover = requestTimeout(function() {
1084					$this.trigger('hover-int');
1085				}, 50);
1086			})
1087			.on('mouseout', function(){
1088				clearRequestTimeout(setHover);
1089			});
1090	};
1091	tabHoverIntent();
1092
1093	var tabInit = function(){
1094		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1095			e.preventDefault()
1096			var $el = $(this);
1097			$el.tab('show');
1098			var $container = $el.closest('.uncode-tabs');
1099			tabSwitcher($container);
1100			requestTimeout(function() {
1101				window.dispatchEvent(UNCODE.boxEvent);
1102				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1103
1104				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1105					window.dispatchEvent(new CustomEvent('boxResized'));
1106				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1107					window.dispatchEvent(new Event('resize'));
1108					$(window).trigger('uncode.re-layout');
1109				} 
1110
1111				var $active_panel = $('.tab-pane.active', $tabs);
1112
1113				$.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) {
1114					var element = $(val),
1115						delayAttr = element.attr('data-delay');
1116					if (delayAttr == undefined) delayAttr = 0;
1117					requestTimeout(function() {
1118						element.addClass('start_animation');
1119					}, delayAttr);
1120				});
1121
1122			}, 300);
1123
1124			var $tabs = $(e.currentTarget).closest('.uncode-tabs'),
1125				$non_active_panel = $('.tab-pane:not(.active)', $tabs);
1126			$.each($('.start_animation:not(.t-inside):not(.drop-image-separator)', $non_active_panel), function(index, val) {
1127				var element = $(val);
1128				element.removeClass('start_animation');
1129			});
1130
1131			var $li = $el.closest('li'),
1132				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1133			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1134			$('.tab-pane', $li).slideDown(250);
1135			var completeSlideDown = requestTimeout(function(){
1136				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1137					var pos = $el.offset(),
1138						rect = $el[0].getBoundingClientRect(),
1139						$masthead = $('#masthead > .menu-container'),
1140						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1141
1142					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1143						$('html, body').animate({
1144							scrollTop: ( pos.top ) - considerMenu
1145						},{
1146							easing: 'easeInOutQuad',
1147							duration: 250
1148						});
1149					}
1150				}
1151			}, 260);
1152		});
1153	}
1154	tabInit();
1155
1156	var tabResponsive = function(){
1157		if ( SiteParameters.is_frontend_editor ) {
1158			return true;
1159		}
1160		var $tabContainers = $('.tab-container.tabs-breakpoint');
1161		$tabContainers.each(function(){
1162			var $tabContainer = $(this),
1163				$tabContent = $('.tab-content', $tabContainer),
1164				$nav = $('.nav-tabs', $tabContainer),
1165				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1166
1167			$('> li', $nav).each(function(){
1168				var $li = $(this),
1169					dataID = $li.attr('data-tab-id');
1170
1171				if ( UNCODE.wwidth <= mQuery ) {
1172					if ( ! $('.tab-pane', $li ).length ) {
1173						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1174						$tabContainer.addClass('tabs-appended');
1175						$li.append($append_pane);
1176					}
1177
1178					if ( $li.hasClass('active') ) {
1179						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1180					}
1181				} else {
1182					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1183						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1184						$tabContainer.removeClass('tabs-appended');
1185						$tabContent.prepend($append_pane.removeAttr('style'));
1186					}
1187				}
1188			});
1189		});
1190
1191	}
1192	tabResponsive();
1193
1194	$(window).on('wwResize', function(){
1195		tabHoverIntent();
1196		tabSwitcher($body);
1197	});
1198
1199	var setCTA;
1200	$(window).on( 'resize', function(){
1201		clearRequestTimeout(setCTA);
1202		setCTA = requestTimeout( tabResponsive, 100 );
1203	});
1204
1205	$('.nav-tabs').each(function(){
1206		var $nav = $(this),
1207			$lis = $('> li:not(.active)', $nav),
1208			$links = $('.tab-excerpt-link', $nav);
1209		$('.tab-excerpt', $lis).slideUp(400, function(){
1210			$(this).addClass('init');
1211		});
1212
1213		$links.each(function(){
1214			var $link = $(this),
1215				$par_a = $link.closest('a'),
1216				href = $link.attr('data-href'),
1217				target = $link.attr('data-target');
1218			$par_a.addClass('inner-link');
1219			$link.on('click', function(){
1220				var _link = document.createElement('a');
1221				_link.href = href;
1222				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1223				_link.click();
1224			});
1225		});
1226		$nav.addClass('tab-init');
1227	});
1228
1229	$('.uncode-tabs.tabs-no-lazy').each(function(){
1230		var $tabs = $(this),
1231			$panes = $('.tab-pane:not(.active)', $tabs);
1232		$panes.each(function(){
1233			var $pane = $(this),
1234				$imgs = $('img[loading="lazy"]', $pane);
1235			$imgs.removeAttr('loading');
1236			$imgs.removeAttr('decoding');
1237		});
1238	});
1239
1240};
1241UNCODE.collapse = function() {
1242	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1243		var $this = $(this),
1244			href
1245		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1246		var $target = $(target)
1247		var parent = $this.attr('data-parent')
1248		var $parent = parent && $(parent)
1249		var $title = $(this).parent()
1250		var $accordion = $(e.target).closest('.uncode-accordion')
1251		var $group = $this.closest('.group')
1252		var $panel_group = $this.closest('.panel-group')
1253		if ($parent) {
1254			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1255			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1256				$title.removeClass('active');
1257				$group.removeClass('active-group');
1258			} else {
1259				if ( $panel_group.attr('data-no-toggle') != true ) {
1260					$parent.find('.panel-title').removeClass('active')
1261					$parent.find('.group').removeClass('active-group')
1262				}
1263				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1264				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1265			}
1266		}
1267		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1268		requestTimeout(function() {
1269			var $accordion = $(e.target).closest('.uncode-accordion');
1270			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1271			  window.dispatchEvent(new CustomEvent('boxResized'));
1272			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1273				window.dispatchEvent(new Event('resize'));
1274				$(window).trigger('uncode.re-layout');
1275			} 
1276
1277			var $active_panel = $('.panel.active-group', $parent);
1278
1279			$.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) {
1280				var element = $(val),
1281					delayAttr = element.attr('data-delay');
1282				if (delayAttr == undefined) delayAttr = 0;
1283				requestTimeout(function() {
1284					element.addClass('start_animation');
1285				}, delayAttr);
1286			});
1287
1288		}, 500);
1289
1290		$group.find('.panel-title:not(.active) > a').trigger('blur');
1291
1292	});
1293
1294	$('.uncode-accordion.tabs-no-lazy').each(function(){
1295		var $accordion = $(this),
1296			$panes = $('.panel:not(.active-group)', $accordion);
1297		$panes.each(function(){
1298			var $pane = $(this),
1299				$imgs = $('img[loading="lazy"]', $pane);
1300			$imgs.removeAttr('loading');
1301			$imgs.removeAttr('decoding');
1302		});
1303	});
1304};
1305
1306UNCODE.accessibility = function() {
1307    if ( ! SiteParameters.uncode_is_accessible ) {
1308        return;
1309    }
1310
1311    //
1312
1313};
1314UNCODE.bigText = function(el) {
1315	var bigTextLaunch = function(){
1316		if (el == undefined) {
1317			el = $('body');
1318		}
1319		$.each($('.bigtext', el), function(index, val) {
1320			$(val).bigtext({
1321				minfontsize: 24
1322			});
1323			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1324				opacity: 1
1325			});
1326			requestTimeout(function() {
1327				if ($(val).find('.animate_when_almost_visible').length != 0) {
1328					$(val).css({opacity: 1});
1329				}
1330			}, 400);
1331		});
1332	};
1333
1334	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1335		bigTextLaunch();
1336	}
1337	$(window).on( 'load', bigTextLaunch );
1338};
1339
1340UNCODE.process_shortpixel_image = function(image) {
1341	var data = {
1342		action: 'shortpixel_manual_optimization',
1343		image_id: image,
1344		cleanup: true
1345	};
1346
1347	$.get(SiteParameters.ajax_url, data);
1348};
1349
1350UNCODE.animateSubInside = function( _this, remove ){
1351	if ( typeof remove !== 'undefined' && remove === true ) {
1352		$(document).trigger('sub-menu-slide-up');
1353		$('.animate_when_almost_visible, .translate_when_almost_visible', _this).each(function(){
1354			$(this).removeClass('start_animation').css({ 'animation-delay': '0s', 'transition-delay': '0s'});
1355		});
1356	} else {
1357		$.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) {
1358			var element = $(val),
1359				delayAttr = element.attr('data-delay');
1360			if (delayAttr == undefined) delayAttr = 0;
1361			element.css({ 'animation-delay': delayAttr + 'ms', 'transition-delay': delayAttr + 'ms'});
1362			element.addClass('start_animation');
1363		});
1364		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1365	}
1366};
1367
1368
1369UNCODE.menuToggleAnimation = function() {
1370	var $block = $('body'),
1371		$menuBlocks = $('.menu.unmenu-block', $block),
1372		$allSeqs = $('[data-delay-seq]', $block);
1373
1374	$allSeqs.each(function(key, seq){
1375		$(seq).removeAttr('data-delay');
1376	});
1377
1378	$menuBlocks.each(function(key, menu){
1379
1380		var $animatesHidden = $('.translate_when_almost_visible', menu).filter(':hidden');
1381		$animatesHidden.each(function(key_, seq){
1382			$(seq).removeClass('translate_when_almost_visible').addClass('not_translate_when_almost_visible');
1383		});
1384
1385		var $animatesVisibile = $('.not_translate_when_almost_visible', menu).filter(':visible');
1386		$animatesVisibile.each(function(key_, seq){
1387			$(seq).removeClass('not_translate_when_almost_visible').addClass('translate_when_almost_visible');
1388		});
1389
1390		var $delaySequentials = $('[data-delay-seq]', menu).filter(':visible'),
1391			delay = parseFloat( $delaySequentials.first().attr('data-delay-seq') ),
1392			interval = parseFloat( $delaySequentials.first().attr('data-interval') );
1393		$delaySequentials.each(function(_key, seq){
1394			$(seq).attr('data-delay', delay + (interval*_key));
1395		});
1396	});
1397};
1398
1399// Registrato al caricamento dello script (prima di UNCODE.init → unBlockMenu),
1400// così il trigger sincrono 'unblock-toggles-init' trova già il listener attivo.
1401$(document).on('unblock-toggles-init', UNCODE.menuToggleAnimation);
1402
1403UNCODE.menuSystem = function() {
1404
1405	function menuMobile() {
1406		var $body = $('body'),
1407			scrolltop,
1408			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1409			$masthead = $('#masthead'),
1410			$menuBlock = $('#uncode-mobile-menu-block'),
1411			$box,
1412			$el,
1413			$el_transp,
1414			elHeight,
1415			offCanvasAnim,
1416			check,
1417			animating = false,
1418			stickyMobile = false,
1419			menuClose = new CustomEvent('menuMobileClose'),
1420			menuOpen = new CustomEvent('menuMobileOpen');
1421		UNCODE.menuOpened = false;
1422		$mobileToggleButton.on('click', function(event) {
1423			event.stopPropagation();
1424			var btn = this;
1425			if ($(btn).hasClass('overlay-close')) return;
1426			event.preventDefault();
1427			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1428			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1429				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1430				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1431				$el_transp = $('.menu-absolute.menu-transparent');
1432				if (UNCODE.isMobile) {
1433					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 ) {
1434						stickyMobile = true;
1435						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1436					} else {
1437						elHeight = 0;
1438						$.each($box.find('> div'), function(index, val) {
1439							elHeight += $(val).outerHeight();
1440						});
1441					}
1442				} else {
1443					elHeight = 0;
1444					$.each($el, function(index, val) {
1445						elHeight += $(val).outerHeight();
1446					});
1447				}
1448				var open = function() {
1449					clearTimeout(offCanvasAnim);
1450					if (!animating) {
1451						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1452						scrolltop = $(window).scrollTop();
1453						window.dispatchEvent(menuOpen);
1454						animating = true;
1455						UNCODE.menuOpened = true;
1456						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1457							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1458								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1459							}
1460							if ($('body.menu-offcanvas').length) {
1461								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1462								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1462UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1463							} else {
1464								if ( $('.menu-hide, .menu-sticky').length ) {
1465									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1466										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1467									}
1468								}
1469							}
1470						}
1471						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1472							//$("#masthead")[0].scrollIntoView();
1473							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1474						}
1475						$box.addClass('open-items');
1476						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1477							$el_transp.addClass('is_mobile_open');
1478						}
1479						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1480							btn.classList.add('close');
1481							$box.animate({
1482								height: elHeight
1483							}, 600, "easeInOutCirc", function() {
1484								animating = false;
1485								if (!stickyMobile) $box.css('height', 'auto');
1486							});
1487						} else {
1488							animating = false;
1489						}
1490
1491						if ( $menuBlock.length ) {
1492							UNCODE.animateSubInside($menuBlock);
1493						}
1494					}
1495				};
1496
1497				var close = function() {
1498					clearTimeout(offCanvasAnim);
1499					if (!animating) {
1500						window.dispatchEvent(menuClose);
1501						animating = true;
1502						UNCODE.menuOpened = false;
1503						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1504							btn.classList.remove('close');
1505							btn.classList.add('closing');
1506						}
1507						$box.addClass('close');
1508						requestTimeout(function() {
1509							$box.removeClass('close');
1510							$box.removeClass('open-items');
1511							btn.classList.remove('closing');
1512							if ($el_transp.length) {
1513								$el_transp.removeClass('is_mobile_open');
1514							}
1515						}, 500);
1516						$body.removeClass('opening-overlay-menu');
1517						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1518							$box.animate({
1519								height: 0
1520							}, {
1521								duration: 600,
1522								easing: "easeInOutCirc",
1523								complete: function(elements) {
1524									$(elements).css('height', '');
1525									animating = false;
1526									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1527										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1528									}
1529									$body.removeClass('open-overlay-menu');
1530									if ( $menuBlock.length ) {
1531										UNCODE.animateSubInside($menuBlock, true);
1532									}
1533								}
1534							});
1535						} else {
1536							animating = false;
1537							offCanvasAnim = setTimeout(function(){
1538								$body.removeClass('open-overlay-menu');
1539								if ( $menuBlock.length ) {
1540									UNCODE.animateSubInside($menuBlock, true);
1541								}
1542							}, 1000);
1543						}
1544					}
1545				};
1546				check = (!UNCODE.menuOpened) ? open() : close();
1547			}
1548		});
1549
1550		$('html').on('click', function(event){
1551			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1552				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1553			}
1554		});
1555
1556		window.addEventListener('menuMobileTrigged', function(e) {
1557			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1558		});
1559		window.addEventListener('orientationchange', function(e) {
1560			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1561		});
1562		window.addEventListener("resize", function() {
1563			if ($(window).width() < UNCODE.mediaQuery) {
1564				if (UNCODE.isMobile) {
1565					var $box = $('.box-container .main-menu-container'),
1566						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1567					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1568						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1569							elHeight = 0;
1570							$.each($el, function(index, val) {
1571								elHeight += $(val).outerHeight();
1572							});
1573							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;
1574							$($box).css('height', elHeight + 'px');
1575						}
1576					}
1577				}
1578			} else {
1579				$('.menu-hide-vertical').removeAttr('style');
1580				$('.menu-container-mobile').removeAttr('style');
1581				$('.vmenu-container.menu-container').removeAttr('style');
1582
1583				if ( UNCODE.menuOpened ) {
1584					$('.open-items').removeClass('open-items');
1585					$('.is_mobile_open').removeClass('is_mobile_open');
1586					$('.open-overlay-menu').removeClass('open-overlay-menu');
1587					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1588				}
1589			}
1590		});
1591
1592		$(window).on('scroll', function(){
1593			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1594				$(window).scrollTop(scrolltop);
1595				return false;
1596			}
1597		});
1598
1599	};
1600
1601	function menuOffCanvas() {
1602		var menuClose = new CustomEvent('menuCanvasClose'),
1603			menuOpen = new CustomEvent('menuCanvasOpen');
1604		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1605			if ($(window).width() > UNCODE.mediaQuery) {
1606				if ( $('body.vmenu-offcanvas-overlay').length ) {
1607					if ($(event.currentTarget).hasClass('off-close')) {
1608						$(event.currentTarget).removeClass('off-close');
1609						requestTimeout(function() {
1610							window.dispatchEvent(menuClose);
1611						}, 500);
1612
1613					} else {
1614						$(event.currentTarget).addClass('off-close');
1615						window.dispatchEvent(menuOpen);
1616					}
1617				} else {
1618					if ($(event.currentTarget).hasClass('close')) {
1619						$(event.currentTarget).removeClass('close');
1620						$(event.currentTarget).addClass('closing');
1621						requestTimeout(function() {
1622							$(event.currentTarget).removeClass('closing');
1623							window.dispatchEvent(menuClose);
1624						}, 500);
1625
1626					} else {
1627						$(event.currentTarget).addClass('close');
1628						window.dispatchEvent(menuOpen);
1629					}
1630				}
1631			}
1632
1633			$('body').toggleClass('off-opened');
1634		});
1635
1636		$('body').on('click.menu-off-canvas-mobile', function(e){
1637			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1638				var $vMenuCont = $('#masthead .vmenu-container'),
1639					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1640
1641					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1642					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1643					vmenu_off = $vMenuCont.offset(),
1644					vmenu_l = parseFloat(vmenu_off.left),
1645					vmenu_t = parseFloat(vmenu_off.top),
1646					vmenu_r = vmenu_l + vmenu_w,
1647					vmenu_b = vmenu_t + vmenu_h,
1648
1649					close_h = parseFloat( $close_menu.outerHeight() ),
1650					close_w = parseFloat( $close_menu.outerWidth() ),
1651					close_off = $close_menu.offset(),
1652					close_l = parseFloat(close_off.left),
1653					close_t = parseFloat(close_off.top),
1654					close_r = close_l + close_w,
1655					close_b = close_t + close_h;
1656				if (
1657					!(
1658						e.clientX > vmenu_l &&
1659						e.clientX < vmenu_r
1660					)
1661					||
1662					(
1663						e.clientX > close_l &&
1664						e.clientX < close_r
1665					)
1666				) {
1667					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1668				}
1669			}
1670		});
1671	};
1672
1673	function menuOverlay() {
1674		if ( $('.overlay').length ) {
1675			$('.overlay').removeClass('hidden');
1676		}
1677		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1678			$('.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) {
1679				var transDelay = (index / 20) + 0.1;
1680				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1681					transDelay = transDelay + 0.3;
1682				$(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');
1683			});
1684		}
1685	};
1686
1687	// menuToggleAnimation è definita a livello globale (vedi UNCODE.menuToggleAnimation
1688	// più in alto) e il listener 'unblock-toggles-init' viene registrato una sola volta
1689	// al caricamento dello script, così è già attivo quando UNCODE.unBlockMenu() lo lancia.
1690
1691	var $secondary_parent;
1692	function menuAppend() {
1693
1694		var $menuBlock = $('#uncode-mobile-menu-block').length;
1695		if ( $menuBlock ) {
1696			return;
1697		}
1698		var $body = $('body'),
1699			$menuCont = $('.menu-container:not(.vmenu-container)'),
1700			$vMenuCont = $('.menu-container.vmenu-container'),
1701			$cta = $('.navbar-cta'),
1702			$socials = $('.navbar-social:not(.appended-navbar)'),
1703			$ul = $('.navbar-main ul.menu-primary-inner'),
1704			$ulCta,
1705			$ulSocials,
1706			$navLast,
1707			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1708			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1709			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1710			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1711			$ulFirst = $('> ul', $firstNav),
1712			setCTA,
1713			appendCTA = function(){
1714				return true;
1715			},
1716			appendSocials = function(){
1717				return true;
1718			},
1719			appendSplit = function(){
1720				return true;
1721			};
1722
1723		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1724			$ulCta = $('> ul', $cta);
1725			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1726
1727			appendCTA = function(){
1728				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1729					$ul.after($ulCta);
1730				} else {
1731					$cta.append($ulCta);
1732				}
1733			}
1734		}
1735
1736		if ( ! $body.hasClass('cta-not-appended') ) {
1737			appendCTA();
1738		}
1739
1740		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1741		$smartSocial.each(function(){
1742			var $_smartSocial = $(this);
1743			$('> li', $_smartSocial).each(function(){
1744				var $li = $(this);
1745				if ( $li.hasClass('mobile-hidden') ) {
1746					$_smartSocial.addClass('mobile-hidden');
1747				} else {
1748					$_smartSocial.removeClass('mobile-hidden');
1749					return false;
1750				}
1751			});
1752
1753			$('> li', $_smartSocial).each(function(){
1754				var $li = $(this);
1755				if ( $li.hasClass('tablet-hidden') ) {
1756					$_smartSocial.addClass('tablet-hidden');
1757				} else {
1758					$_smartSocial.removeClass('tablet-hidden');
1759					return false;
1760				}
1761			});
1762		});
1763
1764		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1765			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1766			if ( $body.hasClass('hmenu-center-split') ) {
1767				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1768			} else {
1769				$navLast = $('.navbar-nav-last', $vMenuCont);
1770			}
1771
1772			if ( ! $navLast.length ) {
1773				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1774				if ( $body.hasClass('hmenu-center-split') ) {
1775					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1776					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1777				} else {
1778					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1779					$navLast = $('.navbar-nav-last', $vMenuCont);
1780				}
1781			}
1782
1783			appendSocials = function(){
1784				if ( !$body.hasClass('menu-overlay-center') ) {
1785				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1786				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1787				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1788				// 		$ulSocials.each(function(){
1789				// 			var $li_social = $(this);
1790				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1791				// 		});
1792				// 	}
1793				// } else {
1794					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1795						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1796						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1797							$('> ul.menu-smart-social li', $socials).remove();
1798						}
1799						$navLast.append($ulSocials);
1800					} else {
1801						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1802							$('> ul.menu-smart-social li', $navLast).remove();
1803						}
1804						$socials.append($ulSocials);
1805					}
1806				}
1807			}
1808			appendSocials();
1809		}
1810
1811		if ( $vMenuCont.length ) {
1812			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1813		} else {
1814			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1815		}
1816		if ( $accordion_secondary.length ) {
1817			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1818			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1819				if ( !$accordion_secondary_ph.length ) {
1820					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1821				}
1822				if ( $vMenuCont.length ) {
1823					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1824				} else {
1825					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1826						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1827					} else {
1828						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1829					}
1830				}
1831			} else {
1832				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1833					$accordion_secondary_ph.before($accordion_secondary);
1834				}
1835			}
1836		}
1837
1838		if ( $vMenuCont.length ) {
1839			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1840		} else {
1841			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1842		}
1843
1844		if ( $extra_icons.length ) {
1845			if ( $vMenuCont.length ) {
1846				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1847					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1848						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1849							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1850						$not_social.each(function(){
1851							if ( ! $primary_after.length ) {
1852								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1853								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1854								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1855							}
1856							var $extra_li = $(this);
1857							$primary_after.find('> ul').append($extra_li);
1858						});
1859					} else {
1860						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1861							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1862						$not_social.each(function(){
1863							var $extra_li = $(this);
1864							$extra_icons.find('> ul').append($extra_li);
1865						});
1866					}
1867				} /*else {
1868					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1869					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1870						if ( !$extra_icons_ph.length ) {
1871							$extra_icons.after('<span class="extra-icons-ph" />');
1872						}
1873						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1874							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1875						} else {
1876							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1877						}
1878					} else {
1879						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1880							$extra_icons_ph.before($extra_icons);
1881						}
1882					}
1883				}*/
1884			} else {
1885				if ( ! $body.hasClass('hmenu-center-double') ) {
1886					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1887						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1888							$primary_after = $('.nav.navbar-main-after', $menuCont);
1889
1890						if ( ! $primary_after.length && $not_social.length ) {
1891							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1892								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1893							} else {
1894								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1895							}
1896							$primary_after = $('.nav.navbar-main-after', $menuCont);
1897							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1898						}
1899						var tablet_hidden = true,
1900							mobile_hidden = true;
1901						$not_social.each(function(){
1902							var $extra_li = $(this);
1903							$primary_after.find('> ul').append($extra_li);
1904							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1905								tablet_hidden = false;
1906							}
1907							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1908								mobile_hidden = false;
1909							}
1910						});
1911						if ( tablet_hidden === true && $not_social.length ) {
1912							$primary_after.addClass('tablet-hidden');
1913						}
1914						if ( mobile_hidden === true && $not_social.length ) {
1915							$primary_after.addClass('mobile-hidden');
1916						}
1917					} else {
1918						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1919
1920						if ( $primary_after.length ) {
1921							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1922							$not_social.each(function(){
1923								var $extra_li = $(this);
1924								$extra_icons.find('> ul').append($extra_li);
1925							});
1926							$primary_after.remove();
1927						}
1928					}
1929				}
1930			}
1931		}
1932
1933		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1934			appendSplit = function(){
1935				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1936					if ( $extra_icons.length ) {
1937						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1938							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1939								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1940							$not_social.each(function(){
1941								var $extra_li = $(this);
1942								$append_ul.append($extra_li);
1943							});
1944							if ( $secondNav.length ) {
1945								$secondNav.append($append_ul);
1946							} else {
1947								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1948							}
1949						}
1950					}
1951					if ( $secondNav.length ) {
1952						$secondNav.prepend($ulFirst);
1953					} else {
1954						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1955					}
1956					$firstMenu.hide();
1957				} else {
1958					$firstNav.append($ulFirst);
1959					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1960					if ( $append_ul.length ) {
1961						var $not_social = $('> li:not(.social-icon)', $append_ul);
1962						$not_social.each(function(){
1963							var $extra_li = $(this);
1964							$extra_icons.find('> ul').append($extra_li);
1965						});
1966					}
1967					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1968					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1969					$firstMenu.css({
1970						'display': 'table-cell'
1971					});
1972				}
1973			}
1974		}
1975		appendSplit();
1976
1977		$(window).on( 'wwResize', function(){
1978			clearRequestTimeout(setCTA);
1979			setCTA = requestTimeout( function() {
1980				appendCTA();
1981				appendSocials();
1982				appendSplit();
1983			}, 10 );
1984		});
1985	}
1986	//menuMobileButton();
1987	menuMobile();
1988	menuOffCanvas();
1989	menuAppend();
1990	menuOverlay();
1991
1992	var stickyDropdownSearch = function(){
1993		var $masthead = $('#masthead'),
1994			$ddSearch = $('.overlay.overlay-search', $masthead),
1995			$styles = $('#stickyDropdownSearch').remove();
1996		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1997			var $menuWrapper = $('.menu-wrapper'),
1998				$navbar = $('.menu-container-mobile', $menuWrapper),
1999				navbarH = $navbar.outerHeight(),
2000				//$topbar = $('.top-menu', $menuWrapper),
2001				//topbarH = $topbar.outerHeight(),
2002				_css;
2003
2004			_css = '<style id="stickyDropdownSearch">';
2005			_css += '@media (max-width: 959px) {';
2006			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
2007			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
2008			_css += '}';
2009			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
2010			_css += 'position: fixed;';
2011			_css += 'top: 0;';
2012			_css += '}';
2013			_css += '</style>';
2014
2015			$(_css).appendTo($('head'));
2016		}
2017	}
2018	stickyDropdownSearch();
2019
2020	var setMenuOverlay;
2021	$(window).on( 'wwResize', function(){
2022		if ( $('.overlay').length && $(window).width() > 1024 ) {
2023			$('.overlay').addClass('hidden');
2024		}
2025		clearRequestTimeout(setMenuOverlay);
2026		setMenuOverlay = requestTimeout( function(){
2027			menuOverlay();
2028			menuAppend();
2029			stickyDropdownSearch();
2030		}, 150 );
2031	});
2032	UNCODE.menuMegaBlock();
2033	UNCODE.menuSmartInit();
2034	$(window).on('wwResize', function(){
2035		UNCODE.menuSmartInit();
2036	});
2037
2038	$(window).on('menuOpen', function(){
2039		var $overlay = $('.overlay.overlay-unblock');
2040		if ( $overlay.length ) {
2041			UNCODE.animateSubInside($overlay);
2042		}
2043	});
2044
2045	$(window).on('menuClosed', function(){
2046		var $overlay = $('.overlay.overlay-unblock');
2047		if ( $overlay.length ) {
2048			UNCODE.animateSubInside($overlay, true);
2049			var $smartMenus = $overlay.find('.menu-smart');
2050			$smartMenus.each(function(key, smartMenu){
2051				$(smartMenu).smartmenus('menuHideAll');
2052			});
2053		}
2054	});
2055};
2056
2057UNCODE.menuSmartInit = function() {
2058	var $menusmart = $('[class*="menu-smart"]'),
2059		$masthead = $('#masthead'),
2060		$hMenu = $('.menu-horizontal-inner', $masthead),
2061		$focus = $('.overlay-menu-focus'),
2062		$uls_anim = $('> li> ul[role="menu"]', $menusmart),
2063		showTimeout = 50,
2064		hideTimeout = 50,
2065		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2066
2067	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2068		var menu_anim = $masthead.attr('data-menu-anim');
2069		if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
2070			$uls_anim.each(function(){
2071				var $ul_anim = $(this);
2072				if ( !$('> li[data-block]', $ul_anim).length ) {
2073					$ul_anim.addClass('animate_when_almost_visible');
2074					$ul_anim.addClass(menu_anim);
2075				} else {
2076					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2077					if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2078						$ul_anim.addClass('animate_when_almost_visible');
2079						$ul_anim.addClass(dataB);
2080					}
2081				}
2082			});
2083		} else {
2084			$uls_anim.each(function(){
2085				var $ul_anim = $(this);
2086				if ( !$('> li[data-block]', $ul_anim).length ) {
2087					$ul_anim.removeClass('animate_when_almost_visible');
2088					$ul_anim.removeClass(menu_anim);
2089				} else {
2090					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2091					$ul_anim.removeClass('animate_when_almost_visible');
2092					$ul_anim.removeClass(dataB);
2093				}
2094			});
2095		}
2096	}
2097
2098	$('> li.menu-item-has-children', $menusmart).hover(function(){
2099		$(this).data('hover', true);
2100	}, function(){
2101		$(this).data('hover', false);
2102	});
2103
2104	$('> li.menu-item-has-children', $menusmart).each(function(){
2105		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2106	});
2107
2108	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2109		e.preventDefault();
2110	});
2111
2112	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2113			
2114		var $notLis = $('> .nav > ul > li a', $hMenu),
2115			$menuA = $('a', $masthead).not($notLis),
2116			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2117			showFuncCond = function() { return true };
2118
2119		if ( $('body').hasClass('focus-megamenu') ) {
2120			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2121			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2122		} else if ( $('body').hasClass('focus-links') ) {
2123			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2124		}
2125
2126		$hoverSelector.hover(function(){
2127			clearRequestTimeout(hideTimeoutFunc);
2128			showTimeoutFunc = requestTimeout(function(){
2129				$('body').addClass('navbar-hover');
2130			}, showTimeout*2);
2131		}, function(){
2132			hideTimeoutFunc = requestTimeout(function(){
2133				if ( ! $('.overlay-search.open', $masthead).length ) {
2134					$('body').removeClass('navbar-hover');
2135				}
2136			}, hideTimeout*2);
2137		});
2138	} else {
2139		showFuncCond = function() { return false };
2140	}
2141
2142	if ($menusmart.length > 0) {
2143		var objShowTimeout;
2144		$menusmart.smartmenus({
2145			subIndicators: false,
2146			subIndicatorsPos: 'append',
2147			//subMenusMinWidth: '13em',
2148			showOnClick: SiteParameters.menuShowOnClick,
2149			subIndicatorsText: '',
2150			showTimeout: showTimeout,
2151			hideTimeout: hideTimeout,
2152			scrollStep: 8,
2153			showFunction: function($ul, complete) {
2154				$(document).trigger('un-menu-show', $ul);
2155				clearRequestTimeout(showTimeoutFunc);
2156				$ul.fadeIn(0, 'linear', function(){
2157					complete();
2158					if ( $ul.hasClass('vc_row') ) {
2159						$ul.css({
2160							'display': 'table'
2161						});
2162					}
2163					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2164						$('body').addClass('open-megamenu');
2165					}
2166					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2167						$('body').addClass('navbar-hover');
2168					}
2169					var showed = 0;
2170					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(index, val){
2171						var $element = $(this),
2172							delayAttr = $element.attr('data-delay');
2173						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2174							if (delayAttr == undefined) delayAttr = 0;
2175							requestTimeout(function() {
2176								$element.addClass('start_animation');
2177							}, delayAttr);
2178						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2179							var grid = $element.closest('.cssgrid-animate-sequential');
2180
2181							var delay = index,
2182								delayAttr = parseInt($element.attr('data-delay'));
2183							if (isNaN(delayAttr)) delayAttr = 100;
2184							delay -= showed;
2185							objShowTimeout = requestTimeout(function() {
2186								$element.removeClass('zoom-reverse').addClass('start_animation');
2187								showed = index;
2188							}, delay * delayAttr);
2189						}
2190					});
2191					if ( $ul.is('.animate_when_almost_visible') ) {
2192						$ul.addClass('start_animation');
2193					}
2194				}).addClass('open-animated');
2195			},
2196			hideFunction: function($ul, complete) {
2197				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2198					$('body').removeClass('open-megamenu');
2199				}
2200				var fixIE = $('html.ie').length;
2201				if (fixIE) {
2202					var $rowParent = $($ul).closest('.main-menu-container');
2203					$rowParent.height('auto');
2204				}
2205				$ul.fadeOut(0, 'linear', function(){
2206					complete();
2207					$ul.removeClass('open-animated');
2208					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2209						$('body').removeClass('open-submenu');
2210					}
2211					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(){
2212						$(this).removeClass('start_animation');
2213					});
2214					if ( $ul.is('.animate_when_almost_visible') ) {
2215						$ul.removeClass('start_animation');
2216					}
2217				});
2218				$ul.find('.start_animation').each(function(index, val) {
2219					clearRequestTimeout(subMenuRT);
2220					$(val).removeClass('start_animation');
2221				});
2222				$(document).trigger('un-menu-hide', $ul);
2223				clearRequestTimeout(objShowTimeout);
2224			},
2225			collapsibleShowFunction: function($ul, complete) {
2226				$ul.slideDown(400, 'easeInOutCirc', function(){
2227					UNCODE.animateSubInside($ul);
2228					complete();
2229				});
2230			},
2231			collapsibleHideFunction: function($ul, complete) {
2232				$ul.slideUp(200, 'easeInOutCirc', function(){
2233					complete();
2234				});
2235				$(document).trigger('sub-menu-slide-up');
2236			},
2237			hideOnClick: SiteParameters.menuHideOnClick,
2238		});
2239
2240		if ( $('body').hasClass('menu-accordion-active') ) {
2241			$menusmart.each(function(key, menu){
2242				$(menu).addClass('menu-smart-init');
2243				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2244			});
2245		}
2246
2247		$menusmart.each(function(key, menu){
2248			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2249				if ( $('> .trigger-window-resize', $sub).length ) {
2250					window.dispatchEvent(new Event('resize'));
2251					$(window).trigger('uncode.re-layout');
2252				} else if ( $('> .trigger-box-resize', $sub).length ) {
2253					window.dispatchEvent(new CustomEvent('boxResized'));
2254				}
2255				return false;
2256			});
2257		});
2258		
2259		$(document).on( 'uncode.smartmenu-appended', function(){
2260			requestTimeout(function(){
2261				$menusmart.smartmenus( 'refresh' );
2262			}, 1000);
2263		});
2264
2265	}
2266
2267	$('.main-menu-container').each(function(){
2268		var $main_cont = $(this),
2269			$uls = $('ul:not(.nav-tabs)', $main_cont);
2270
2271		$uls.each(function(){
2272			var $ul = $(this),
2273				mobile_hidden = true,
2274				tablet_hidden = true;
2275			$('> li:not(.hidden)', $ul).each(function(){
2276				if ( !$(this).hasClass('mobile-hidden') ) {
2277					mobile_hidden = false;
2278					return false;
2279				}
2280			});
2281			$('> li:not(.hidden)', $ul).each(function(){
2282				if ( !$(this).hasClass('tablet-hidden') ) {
2283					tablet_hidden = false;
2284					return false;
2285				}
2286			});
2287			if ( mobile_hidden ) {
2288				$ul.addClass('mobile-hidden');
2289			}
2290			if ( tablet_hidden ) {
2291				$ul.addClass('tablet-hidden');
2292			}
2293		});
2294
2295		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2296
2297		$divUlsMB.each(function(){
2298			var $divUlMB = $(this),
2299				div_mobile_hidden = true,
2300				div_tablet_hidden = true;
2301
2302			$('> ul:not(.hidden)', $divUlMB).each(function(){
2303				if ( !$(this).hasClass('mobile-hidden') ) {
2304					div_mobile_hidden = false;
2305					return false;
2306				}
2307			});
2308			$('> ul:not(.hidden)', $divUlMB).each(function(){
2309				if ( !$(this).hasClass('tablet-hidden') ) {
2310					div_tablet_hidden = false;
2311					return false;
2312				}
2313			});
2314			if ( div_mobile_hidden ) {
2315				$divUlMB.addClass('mobile-hidden');
2316			}
2317			if ( div_tablet_hidden ) {
2318				$divUlMB.addClass('tablet-hidden');
2319			}
2320		});
2321	});
2322
2323	var overlaySearchButton = function(){
2324		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2325
2326		$search_wrap.each(function(){
2327			var $form = $('form', this),
2328				$icon = $('i', $form);
2329
2330			$icon.on('click', function(){
2331				$form.submit();
2332			});
2333		});
2334	};
2335	overlaySearchButton();
2336}
2337
2338UNCODE.menuMegaBlock = function() {
2339	var $megaBlocks = $('.megamenu-block-wrapper');
2340	if ( ! $megaBlocks.length ) {
2341		return;
2342	}
2343
2344	$megaBlocks.each(function(){
2345		var $megaLi = $(this),
2346			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2347			dataLi = $megaLi.attr('data-block'),
2348			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2349			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2350		$megaUl.addClass(dataLi);
2351		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2352		$('img', $megaLi).removeAttr('loading');
2353	});
2354}
2355
2356UNCODE.unBlockMenu = function(){
2357	//Menu block
2358	var $unBlockMenus = $('.menu.unmenu-block');
2359
2360	$unBlockMenus.each(function(){
2361		var $unBlockMenu = $(this),
2362			$lastOnes;
2363
2364		if ( !$unBlockMenu.hasClass('first-grid') ) {
2365			$lastOnes = $('ul', $unBlockMenu).last();
2366			$lastOnes.each(function(){
2367                var _cols = $(this).css('grid-template-columns');
2368				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2369					$unBlockMenu.addClass('has-last-ones');
2370					$(this).addClass('last-one');
2371				} else {
2372					var $parentLi = $(this).closest('li'),
2373						$siblingLi = $parentLi.next();
2374					if ( !$siblingLi.length ) {
2375						$unBlockMenu.addClass('has-last-ones');
2376						$(this).addClass('last-one');
2377					}
2378				}
2379			});
2380		} else {
2381			var checkGrids = function(){
2382				$unBlockMenu.find('.last-ul').removeClass('last-one');
2383				var _cols = $unBlockMenu.css('grid-template-columns'),
2384                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2385					$lis = $('> li', $unBlockMenu),
2386					totLi = $lis.length,
2387					lastRowCount = totLi - (totLi % cols || cols),
2388					$lastLis = $lis.slice(cols).addClass('last-lis'),
2389    				$lastRowLis = $lis.slice(lastRowCount);
2390				$lastRowLis.each(function(){
2391					var $lastRowLi = $(this);
2392					$lastRowLi.find('ul').last().addClass('last-one');
2393				});
2394			}
2395			$(window).on('wwResize', checkGrids);
2396			checkGrids();
2397
2398		}
2399
2400	});
2401
2402	//Accordion
2403
2404	var $tgglBlocks = $('.unmenu-collapse');
2405	$tgglBlocks.each(function(key, val){
2406		var $acc = $(val),
2407			$titles = $('.menu-item-has-children > *:first-child', $acc),
2408			run = true;
2409
2410		var checkRun = function(){
2411			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2412				run = false;
2413			} else {
2414				run = true;
2415			}
2416
2417			if ( $titles.length ) {
2418				$titles.each(function(_key, _val){
2419					var $title = $(_val),
2420						$sub = $title.closest('li').find('> ul.un-submenu');
2421
2422					$sub.each(function(key, val){
2423						if ( run ) {
2424
2425							var total = $sub.length;
2426							var completed = 0;
2427				
2428							$(val).slideUp({
2429								duration: 1,
2430								complete: function() {
2431									$(this).addClass('toggle-init');
2432
2433									completed++;
2434
2435									if ( completed === total ) {
2436										$(document).trigger('unblock-toggles-init');
2437										$( document.body ).trigger( 'uncode_waypoints' );
2438									}
2439								}
2440							});
2441						} else {
2442							$(val).show();
2443						}
2444					});
2445				});
2446			} else {
2447				$(document).trigger('unblock-toggles-init');
2448				console.log('check');
2449				$( document.body ).trigger( 'uncode_waypoints' );
2450			}
2451		}
2452		checkRun();
2453
2454		$(window).on('wwResize menuClosed', checkRun);
2455
2456		if ( $titles.length ) {
2457			$titles.each(function(_key, _val){
2458				var $title = $(_val),
2459					$sub = $title.closest('li').find('> ul.un-submenu'),
2460					$menu = $sub.closest('.menu.unmenu-block'),
2461					$ulS;
2462
2463				$title.off('click').on('click', function(e){
2464					e.preventDefault();
2465					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2466					if ( run ) {
2467						if ( $sub.is(':visible') ) {
2468							$sub.slideUp(200, 'easeInOutCirc', function(){
2469								$.each($('.start_animation', $sub), function(index, val) {
2470									var element = $(val);
2471									element.removeClass('start_animation');
2472
2473								});
2474								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2475								$(document).trigger('sub-menu-slide-up');
2476							});
2477						} else {
2478							$ulS.slideUp({
2479								duration: 200,
2480								easing: 'easeInOutCirc',
2481								start: function(){
2482									var _this = $(this);
2483									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2484									$(document).trigger('sub-menu-slide-up');
2485								}
2486							});
2487
2488							$sub.slideDown({
2489								duration: 400,
2490								easing: 'easeInOutCirc',
2491								start: function() {
2492									var _this = $(this);
2493									_this.css('height', 0);
2494									if ( _this.hasClass('is-grid') ) {
2495										_this.css('display','grid');
2496									}
2497
2498									UNCODE.animateSubInside(_this)
2499									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2500								}
2501							});
2502						}
2503
2504					}
2505				});
2506			});
2507
2508			if ( $acc.closest('#masthead').length ) {
2509				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2510					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2511				});
2512			}
2513		}
2514
2515	});
2516	
2517};
2518
2519UNCODE.mobileMenuBlockSkins = function(){
2520	var $mobileBlock = $('#uncode-mobile-menu-block'),
2521		$parentDark = $mobileBlock.closest('.submenu-dark'),
2522		$parentLight = $mobileBlock.closest('.submenu-light');
2523
2524
2525	if ( $parentDark.length ) {
2526		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2527		$cols.each(function(key, val){
2528			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2529		});
2530	}
2531
2532	if ( $parentLight.length ) {
2533		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2534		$cols.each(function(key, val){
2535			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2536		});
2537	}
2538};
2539UNCODE.okvideo = function(ev) {
2540	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2541	$.okvideo = function(options) {
2542		// if the option var was just a string, turn it into an object
2543		if (typeof options !== 'object') options = {
2544			'video': options
2545		};
2546		var base = this;
2547		// kick things off
2548		base.init = function() {
2549			base.options = $.extend({}, $.okvideo.options, options);
2550			// support older versions of okvideo
2551			if (base.options.video === null) base.options.video = base.options.source;
2552			base.setOptions();
2553			var target = base.options.target || $('body');
2554			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2555			var zIndex = base.options.controls === 3 ? -999 : "auto";
2556			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2557				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>';
2558				if (OKEvents.utils.isMobile()) {
2559					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>');
2560				} else {
2561					if (base.options.controls === 3) {
2562						target.append(mask)
2563					}
2564					if (base.options.adproof === 1) {
2565						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>');
2566					} else {
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					}
2569				}
2570				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2571				if (base.options.playlist.list === null) {
2572					if (base.options.video.provider === 'youtube') {
2573						base.loadYouTubeAPI();
2574					} else if (base.options.video.provider === 'vimeo') {
2575						base.options.volume /= 100;
2576						base.loadVimeoAPI();
2577					}
2578				} else {
2579					base.loadYouTubeAPI();
2580				}
2581			}
2582		};
2583		// clean the options
2584		base.setOptions = function() {
2585			// exchange 'true' for '1' and 'false' for 3
2586			for (var key in this.options) {
2587				if (this.options[key] === true) this.options[key] = 1;
2588				if (this.options[key] === false) this.options[key] = 3;
2589			}
2590			if (base.options.playlist.list === null) {
2591				base.options.video = base.determineProvider();
2592			}
2593			// pass options to the window
2594			$(window).data('okoptions-' + base.options.id, base.options);
2595		};
2596		// insert js into the head and exectue a callback function
2597		base.insertJS = function(src, callback, provider){
2598			var tag;
2599			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2600				delete UNCODE.insertedSripts[src];
2601				var tags = document.getElementsByTagName('script');
2602				for (var i = tags.length; i >= 0; i--){
2603					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2604						tags[i].parentNode.removeChild(tags[i]);
2605					}
2606				}
2607			} else {
2608				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2609					tag = UNCODE.insertedSripts[src];
2610					if (callback){
2611						if (tag.readyState){  //IE
2612							tag.onreadystatechange = function(){
2613								if (tag.readyState === "loaded" ||
2614									tag.readyState === "complete"){
2615									tag.onreadystatechange = null;
2616									callback();
2617								}
2618							};
2619						} else {
2620							$(tag).on('load', callback);
2621						}
2622					}
2623					return;
2624				}
2625			}
2626			tag = document.createElement('script');
2627			if (callback){
2628				if (tag.readyState){  //IE
2629					tag.onreadystatechange = function(){
2630						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2631							tag.onreadystatechange = null;
2632							callback();
2633						}
2634					};
2635				} else {
2636					tag.onload = function() {
2637						callback();
2638					};
2639				}
2640			}
2641			tag.src = src;
2642			var firstScriptTag = document.getElementsByTagName('script')[0];
2643			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2644			if ( ! UNCODE.insertedSripts ) {
2645				UNCODE.insertedSripts = [];
2646			}
2647			UNCODE.insertedSripts[src] = tag;
2648		};
2649		// load the youtube api
2650		base.loadYouTubeAPI = function(callback) {
2651			if ( ev === 'uncode-more-items-loaded' ) {
2652				onYouTubeIframeAPIReady();
2653			} else {
2654				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2655			}
2656		};
2657		base.loadYouTubePlaylist = function() {
2658			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2659		};
2660		// load the vimeo api by replacing the div with an iframe and loading js
2661		base.loadVimeoAPI = function() {
2662			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',
2663			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2664			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2665			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2666			base.insertJS('//player.vimeo.com/api/player.js', function() {
2667				vimeoPlayerReady(base.options.id);
2668			}, 'vimeo');
2669		};
2670		// is it from youtube or vimeo?
2671		base.determineProvider = function() {
2672			var a = document.createElement('a');
2673			a.href = base.options.video;
2674			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2675				var videoid = a.href.split('/')[3].toString();
2676				var query = videoid.substring(videoid.indexOf('?') + 1);
2677				if (query != '') {
2678					var vars = query.split('&');
2679					for (var i = 0; i < vars.length; i++) {
2680						var pair = vars[i].split('=');
2681						if (pair[0] == 'v') {
2682							videoid = pair[1];
2683						}
2684					}
2685				}
2686				return {
2687					"provider": "youtube",
2688					"id": videoid
2689				};
2690			} else if (/vimeo.com/.test(base.options.video)) {
2691				return {
2692					"provider": "vimeo",
2693					"id": (a.href.split('/')[3].toString()).split('#')[0],
2694				};
2695			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2696				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2697				if (id.length == 11) {
2698					return {
2699						"provider": "youtube",
2700						"id": id.toString()
2701					};
2702				} else {
2703					for (var i = 0; i < base.options.video.length; i++) {
2704						if (typeof parseInt(base.options.video[i]) !== "number") {
2705							throw 'not vimeo but thought it was for a sec';
2706						}
2707					}
2708					return {
2709						"provider": "vimeo",
2710						"id": base.options.video
2711					};
2712				}
2713			} else {
2714				throw "OKVideo: Invalid video source";
2715			}
2716		};
2717		base.init();
2718	};
2719
2720	var checkResize,
2721		newW = UNCODE.wwidth;
2722
2723	$.okvideo.options = {
2724		id: null,
2725		source: null, // Deprecate dis l8r
2726		video: null,
2727		playlist: { // eat ur heart out @brokyo
2728			list: null,
2729			index: 0,
2730			startSeconds: 0,
2731			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2732		},
2733		disableKeyControl: 1,
2734		captions: 0,
2735		loop: 1,
2736		hd: 1,
2737		volume: 0,
2738		adproof: false,
2739		unstarted: null,
2740		onFinished: null,
2741		onReady: null,
2742		onPlay: null,
2743		onPause: null,
2744		buffering: null,
2745		controls: false,
2746		autoplay: true,
2747		annotations: true,
2748		cued: null
2749	};
2750	$.fn.okvideo = function(options) {
2751		options.target = this;
2752		return this.each(function() {
2753			(new $.okvideo(options));
2754		});
2755	};
2756
2757	var checkForVideos = function(){
2758		$(".uncode-video-container.video").each(function(index, el) {
2759			var $this = $(this),
2760				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2761				url = $this.attr('data-video'),
2762				id = $this.attr('data-id'),
2763				cloned = $this.closest('.owl-item');
2764
2765			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2766				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2767					$this.okvideo({
2768						id: id,
2769						source: url.split('#')[0],
2770						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2771						autoplay: 1,
2772						controls: 0,
2773						volume: 0,
2774						adproof: 0,
2775						caller: $this,
2776						hd: 1,
2777						onReady: function(player) {
2778							var getPlayer = player.c || player.h || player,
2779							$iframe,
2780							getContainer = $(getPlayer).closest('.background-element');
2781							if (getContainer.length) {
2782								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2783							}
2784
2785							if ( $this.hasClass('drop-move') ) {
2786
2787								var $iframe = $(getPlayer),
2788									w = parseFloat($iframe.attr('width')),
2789									h = parseFloat($iframe.attr('height')),
2790									ratio = h / w,
2791									setResizeiFto,
2792								resizeiFrame = function(){
2793									var dataW = $this.attr('data-w'),
2794										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2795										newH = newW * ratio;
2796									$iframe.css({
2797										width: newW,
2798										height: newH
2799									});
2800								};
2801								resizeiFrame();
2802								$(window).on( 'load', resizeiFrame );
2803								$(window).on( 'resize', function(){
2804									clearRequestTimeout(setResizeiFto);
2805									setResizeiFto = requestTimeout( function() {
2806										resizeiFrame();
2807									}, 10 );
2808								});
2809
2810							}
2811
2812						}
2813					});
2814				}
2815			}
2816		});
2817	};
2818
2819	checkForVideos();
2820
2821	$(window).on('load', function(){
2822		$('.mejs-fullscreen-button button').on('click', function(){
2823			var $button = $(this),
2824				$stuck = $button.closest('.is_stucked');
2825
2826			if ( $stuck.length ) {
2827				$stuck = $(this).trigger("sticky_kit:detach");
2828				window.scrollTo(0, 0);
2829			}
2830		});
2831	});
2832
2833	var checkVideoResize = function(){
2834		clearRequestTimeout(checkResize);
2835		checkResize = requestTimeout(function(){
2836			if ( newW !== UNCODE.wwidth ) {
2837				newW = UNCODE.wwidth;
2838				checkForVideos();
2839			}
2840		}, 1000);
2841	};
2842
2843	$(window).off('resize', checkVideoResize)
2844	.on( 'resize', checkVideoResize);
2845
2846};
2847
2848$(document).on('uncode-ajax-filtered.videos', function(){
2849	UNCODE.okvideo("uncode-more-items-loaded");
2850});
2851UNCODE.backgroundSelfVideos = function( $ctx ) {
2852
2853	var backgroundSelfVideosInit = function( $ctx ) {
2854		if ( SiteParameters.block_mobile_videos === true ) {
2855			return false;
2856		}
2857		if (typeof MediaElement === "function") {
2858			if ( typeof $ctx === 'undefined' ) {
2859				$ctx = document;
2860			}
2861		
2862			$(".background-video-shortcode", $ctx).each(function(index, el) {
2863				if ( $(this).closest('mediaelementwrapper').length ) {
2864					return true;
2865				}
2866				var $video_el = $(this),
2867					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2868					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2869					video_id = $video_el.attr('id');
2870
2871				if ( SiteParameters.is_frontend_editor ) {
2872					video_id = video_id + '_' + index;
2873					$video_el.attr('id', video_id);
2874				}
2875
2876				var media = new MediaElement(video_id, {
2877					startVolume: 0,
2878					loop: true,
2879					success: function(mediaElement, domObject) {
2880						domObject.volume = 0;
2881						$(mediaElement).data('started', false);
2882						mediaElement.addEventListener('timeupdate', function(e) {
2883							if (!$(e.target).data('started')) {
2884								$(mediaElement).data('started', true);
2885							}
2886						});
2887						mediaElement.addEventListener('loadedmetadata', function(e) {
2888							$('body').removeClass('video-not-supported');
2889							mediaElement.play();
2890						});
2891						if (!UNCODE.isMobile) {
2892							requestTimeout(function() {
2893								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2894							}, 100);
2895						}
2896						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2897							mediaElement.play();
2898						}
2899
2900						if ( $parent_drop_move.length ) {
2901							var setResizeMEto,
2902								resizeMediaElement = function(){
2903								var dataW = $parent_drop_move.attr('data-w'),
2904									videoW = domObject.width,
2905									videoH = domObject.height,
2906									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2907									newH = newW / ( videoW / videoH );
2908
2909								$(domObject).css({
2910									'height': newH,
2911									'width': newW
2912								});
2913							};
2914							$(window).on( 'resize load', function(){
2915								clearRequestTimeout(setResizeMEto);
2916								setResizeMEto = requestTimeout( function() {
2917									resizeMediaElement();
2918								}, 10 );
2919							});
2920						}
2921
2922						mediaElement.addEventListener('play', function() {
2923							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2924							$(mediaElement).closest('#page-header').addClass('video-started');
2925							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2926						}, true);
2927
2928					},
2929					// fires when a problem is detected
2930					error: function() {}
2931				});
2932			});
2933		} else {
2934
2935			if ( typeof $ctx === 'undefined' ) {
2936				$ctx = document;
2937			}
2938		
2939			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2940			Array.from(videos).forEach(function(video_el) {
2941				video_el.addEventListener('loadedmetadata', function(e) {
2942					$('body').removeClass('video-not-supported');
2943					video_el.play();
2944				});
2945				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2946					video_el.muted = true;
2947					video_el.loop = true;
2948					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2949					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2950					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2951					$('body').removeClass('video-not-supported');
2952					video_el.play();
2953				} else {
2954					requestTimeout(function(){
2955                         backgroundSelfVideosInit( $ctx );
2956					}, 1000);
2957				}
2958			});
2959		}
2960	};
2961
2962	backgroundSelfVideosInit( $ctx );
2963
2964	$(document).on('un-menu-show', function(){
2965		setTimeout(function(){
2966			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)');
2967		}, 1);
2968	});
2969
2970
2971	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2972		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2973			var $el = model.view.$el,
2974				shortcode = model.attributes.shortcode;
2975
2976			if (typeof MediaElement === "function") {
2977				backgroundSelfVideosInit( $el );
2978			} else {
2979				backgroundSelfVideosInit( $el[0] );
2980			}
2981		});
2982	}
2983};
2984
2985UNCODE.is_scrolling = false;
2986
2987UNCODE.disableHoverScroll = function() {
2988
2989	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2990		var body = document.body,
2991		timer;
2992
2993		window.addEventListener('scroll', function() {
2994			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2995			clearRequestTimeout(timer);
2996			if ( body.classList && !body.classList.contains('disable-hover') ) {
2997				body.classList.add('disable-hover');
2998				window.dispatchEvent(new CustomEvent('disable-hover'));
2999			}
3000			UNCODE.is_scrolling = true;
3001
3002			timer = requestTimeout(function() {
3003				if ( body.classList ) {
3004					body.classList.remove('disable-hover');
3005					window.dispatchEvent(new CustomEvent('enable-hover'));
3006				}
3007				UNCODE.is_scrolling = false;
3008			}, delay);
3009		}, false);
3010	}
3011};
3012
3013UNCODE.isotopeLayout = function() {
3014	if ($('.isotope-layout').length > 0) {
3015		var isotopeContainersArray = [],
3016			typeGridArray = [],
3017			layoutGridArray = [],
3018			screenLgArray = [],
3019			screenMdArray = [],
3020			screenSmArray = [],
3021			transitionDuration = [],
3022			$filterItems = [],
3023			$filters = $('.isotope-system .isotope-filters'),
3024			$itemSelector = '.tmb-iso',
3025			$items,
3026			itemMargin,
3027			correctionFactor = 0,
3028			firstLoad = true,
3029			isOriginLeft = $('body').hasClass('rtl') ? false : true;
3030		$('[class*="isotope-container"]').each(function(index) {
3031			var _this = $(this);
3032			var isoData = _this.data(),
3033			$data_lg,
3034			$data_md,
3035			$data_sm;
3036			_this.children('.tmb').addClass('tmb-iso');
3037			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
3038			else $data_lg = '1000';
3039			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
3040			else $data_md = '600';
3041			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
3042			else $data_sm = '480';
3043			screenLgArray.push($data_lg);
3044			screenMdArray.push($data_md);
3045			screenSmArray.push($data_sm);
3046			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
3047			if (isoData.type == 'metro') typeGridArray.push(true);
3048			else typeGridArray.push(false);
3049			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
3050			else layoutGridArray.push('masonry');
3051			isotopeContainersArray.push(_this);
3052			_this.attr('data-iso-index', index);
3053		});
3054		var colWidth = function(index) {
3055				$(isotopeContainersArray[index]).width('');
3056				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
3057					widthAvailable = $(isotopeContainersArray[index]).width(),
3058					columnNum = 12,
3059					columnWidth = 0,
3060					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
3061					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
3062					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
3063					$rowContainer,
3064					paddingRow,
3065					$colContainer,
3066					paddingCol;
3067
3068				if ( consider_menu )
3069					winHeight = winHeight - UNCODE.menuHeight;
3070
3071				if ( data_vp_height === '1' ) {
3072					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3073					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3074					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3075					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3076					winHeight = winHeight - ( paddingRow + paddingCol );
3077				}
3078
3079				if (isPx) {
3080					columnWidth = Math.ceil(widthAvailable / columnNum);
3081					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3082				} else {
3083					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3084				}
3085				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3086				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3087				for (var i = 0, len = $items.length; i < len; i++) {
3088					var $item = $($items[i]),
3089						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3090						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3091						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3092
3093
3094					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3095						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3096					}
3097
3098					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3099						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3100					}
3101
3102					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3103						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3104							switch (parseInt(multiplier_w[1])) {
3105								case (5):
3106								case (4):
3107								case (3):
3108									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3109									multiplier_w[1] = 6;
3110									break;
3111								case (2):
3112								case (1):
3113									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3114									multiplier_w[1] = 3;
3115									break;
3116								default:
3117									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3118									multiplier_w[1] = 12;
3119									break;
3120							}
3121
3122							if (multiplier_w[1] == 2.4) { // 5 columns
3123								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3124								multiplier_w[1] = 6;
3125							}
3126						}
3127					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3128						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3129							switch (parseInt(multiplier_w[1])) {
3130								case (5):
3131								case (4):
3132								case (3):
3133								case (2):
3134								case (1):
3135									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3136									multiplier_w[1] = 6;
3137									break;
3138								default:
3139									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3140									multiplier_w[1] = 12;
3141									break;
3142							}
3143
3144							if (multiplier_w[1] == 2.4) { // 5 columns
3145								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3146								multiplier_w[1] = 6;
3147							}
3148						}
3149					} else if (widthAvailable < screenSmArray[index]) {
3150						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3151							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3152							multiplier_w[1] = 12;
3153							if (typeGridArray[index]) multiplier_h[1] = 12;
3154						}
3155					}
3156					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3157						height;
3158
3159					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3160						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3161						if ( widthAvailable < screenSmArray[index] ) {
3162							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3163						}
3164					} else {
3165						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3166					}
3167
3168					if (width >= widthAvailable) {
3169						$item.css({
3170							width: widthAvailable
3171						});
3172						if (typeGridArray[index]) {
3173							$item.children().add($item.find('.backimg')).css({
3174								height: height
3175							});
3176						}
3177					} else {
3178						$item.css({
3179							width: width
3180						});
3181						if (typeGridArray[index]) {
3182							$item.children().add($item.find('.backimg')).css({
3183								height: height
3184							});
3185						}
3186					}
3187				}
3188				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3189					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3190				} else {
3191					return columnWidth;
3192				}
3193			},
3194			init_isotope = function() {
3195				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3196					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3197						isotopeId = isotopeSystem.attr('id'),
3198						$layoutMode = layoutGridArray[i],
3199						setIsotopeFirstRowTimeOut,
3200					setIsotopeFirstRow = function(items){
3201						var firstRow = true;
3202						$(items).each(function(index, val){
3203							var el = items[index].element,
3204								el_top = items[index].position.y,
3205								$el = $(el);
3206							if ( index > 0 && el_top > 0 && firstRow ) {
3207								firstRow = false;
3208							} else if ( index == 0 && el_top == 0 ) {
3209								firstRow = true;
3210							}
3211							if ( firstRow ) {
3212								$el.removeClass('tmb-isotope-further-row');
3213							} else {
3214								$el.addClass('tmb-isotope-further-row');
3215							}
3216						});
3217					};
3218					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3219						//resizable: true,
3220						itemSelector: $itemSelector,
3221						layoutMode: $layoutMode,
3222						transitionDuration: transitionDuration[i],
3223						masonry: {
3224							columnWidth: colWidth(i)
3225						},
3226						vertical: {
3227							horizontalAlignment: 0.5,
3228						},
3229						sortBy: 'original-order',
3230						isOriginLeft: isOriginLeft
3231					})
3232					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3233					.on('layoutComplete', function( event, items ){
3234						if ( typeof items[0] !== 'undefined' ) {
3235							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3236								setIsotopeFirstRow(items);
3237							}
3238						}
3239					})
3240					.on('arrangeComplete', function( event, items ){
3241						if ( typeof items[0] !== 'undefined' ) {
3242							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3243								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3244								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3245									setIsotopeFirstRow(items);
3246								}, 100);
3247							}
3248						}
3249					});
3250					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3251						$(isotopeContainersArray[i]).infinitescroll({
3252								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3253								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3254								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3255								animate: false,
3256								behavior: 'local',
3257								debug: false,
3258								loading: {
3259									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3260									speed: 0,
3261									finished: undefined,
3262									msg: $('#' + isotopeId + ' .loadmore-button'),
3263								},
3264								errorCallback: function() {
3265									var isotope_system = $(this).closest('.isotope-system');
3266									$('.loading-button', isotope_system).hide();
3267									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3268								}
3269							},
3270							// append the new items to isotope on the infinitescroll callback function.
3271							function(newElements, opts) {
3272								var $isotope = $(this),
3273									isotope_system = $isotope.closest('.isotope-system'),
3274									isotopeId = isotope_system.attr('id'),
3275									filters = new Array(),
3276									$loading_button = isotope_system.find('.loading-button'),
3277									$infinite_button = isotope_system.find('.loadmore-button'),
3278									$numPages = $('a', $infinite_button).data('pages'),
3279									$woo_results,
3280									delay = 300;
3281								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3282								if ($isotope.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
3283									$infinite_button.show();
3284								} else {
3285									$infinite_button.hide();
3286								}
3287								$loading_button.hide();
3288								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3289								$('> li', $isotope).remove();
3290								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3291								$.each($(newElements), function (index, val) {
3292									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3293										$woo_results = $(val);
3294										delete newElements[index];
3295									} else {
3296										$(val).addClass('tmb-iso');
3297										if ($(val).is("li")) {
3298											filters.push($(val)[0]);
3299										}
3300									}
3301									$(val).addClass('uncode-appended');
3302								});
3303								newElements = newElements.filter(function(x) {
3304									return filters.indexOf(x) < 0
3305								});
3306								$.each($(filters), function(index, val) {
3307									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3308								});
3309								if ($woo_results && $woo_results.length > 0) {
3310									var old_count = isotope_system.find('.woocommerce-result-count').text();
3311									var new_count = $woo_results.find('.woocommerce-result-count').text();
3312									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3313									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3314									function replaceMatch(match, p1, p2) {
3315        								return old_start + '–' + new_end;
3316									}
3317									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3318									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3319								}
3320								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3321								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3322									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3323									if (typeof getLightbox === 'object') {
3324										getLightbox.refresh();
3325									} else {
3326										UNCODE.lightbox();
3327									}
3328								}
3329								if ( typeof twttr !== 'undefined' )
3330									twttr.widgets.load(isotopeContainersArray[i]);
3331
3332								requestTimeout(function() {
3333									Waypoint.refreshAll();
3334									$isotope.trigger('more-items-loaded');
3335									$(window).trigger('more-items-loaded');
3336									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3337									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3338										$(document).trigger('uncode-scrolltrigger-refresh');
3339									}
3340									fillIfNotScrollable($isotope);
3341								}, 1000);
3342
3343							});
3344						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3345							var $infinite_isotope = $(isotopeContainersArray[i]),
3346								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3347							$infinite_isotope.infinitescroll('pause');
3348							$infinite_button.on('click', function(event) {
3349								event.preventDefault();
3350								var $infinite_system = $(event.target).closest('.isotope-system'),
3351								$infinite_isotope = $infinite_system.find('.isotope-container'),
3352								isotopeId = $infinite_system.attr('id');
3353								$(event.currentTarget).html(SiteParameters.loading);
3354								$infinite_isotope.infinitescroll('resume');
3355								$infinite_isotope.infinitescroll('retrieve');
3356								$infinite_isotope.infinitescroll('pause');
3357							});
3358						}
3359						(function ($c) {
3360							requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
3361						})($(isotopeContainersArray[i]));
3362					}
3363				}
3364			},
3365			fillIfNotScrollable = function ($container) {
3366				if ($container.hasClass('isotope-infinite-button')) {
3367					return
3368				};
3369				if (!$container.hasClass('isotope-infinite')) {
3370					return
3371				};
3372				var infData = $container.data('infinitescroll');
3373				if (!infData || !infData.options || !infData.options.state) {
3374					return
3375				};
3376				var state = infData.options.state;
3377				if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPau
3377sed) {
3378					return
3379				};
3380				var $loadMoreA = $container.closest('.isotope-system').find('.loadmore-button a');
3381				var numPages = parseInt($loadMoreA.data('pages'), 10);
3382				if (!numPages || state.currPage >= numPages) {
3383					return
3384				};
3385				if (document.documentElement.scrollHeight > window.innerHeight + 1) {
3386					return
3387				};
3388				console.log('fillIfNotScrollable');
3389				$container.infinitescroll('retrieve');
3390			},
3391			onLayout = function(isotopeObj, startIndex, needsReload) {
3392				var needsReload = needsReload ? true : false;
3393
3394				if (typeof UNCODE.bigText !== 'undefined') {
3395					UNCODE.bigText();
3396				}
3397				isotopeObj.css('opacity', 1);
3398				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3399
3400				requestTimeout(function() {
3401					if (startIndex > 0) {
3402						reloadIsotope(isotopeObj);
3403						if (SiteParameters.dynamic_srcset_active === '1') {
3404							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3405							UNCODE.adaptive_srcset(isotopeObj);
3406						}
3407						// window.dispatchEvent(UNCODE.boxEvent);
3408					} else if (needsReload) {
3409						reloadIsotope(isotopeObj);
3410					}
3411
3412					UNCODE.adaptive();
3413					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3414						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3415					}
3416					if (typeof MediaElement === "function") {
3417						$(isotopeObj).find('audio,video').each(function() {
3418							$(this).mediaelementplayer({
3419	 							pauseOtherPlayers: false,
3420							});
3421						});
3422					}
3423					if ($(isotopeObj).find('.nested-carousel').length) {
3424						if (typeof UNCODE.carousel !== 'undefined') {
3425							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3426						}
3427						requestTimeout(function() {
3428							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3429						}, 200);
3430					} else {
3431						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3432					}
3433					isotopeObj.trigger('isotope-layout-complete');
3434
3435				}, 100);
3436
3437			},
3438			boxAnimation = function(items, startIndex, sequential, container) {
3439				var $allItems = items.length - startIndex,
3440					showed = 0,
3441					index = 0;
3442				if (container.closest('.owl-item').length == 1) return false;
3443				$.each(items, function(index, val) {
3444					var $this = $(val),
3445						elInner = $('> .t-inside', val);
3446					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3447						return;
3448					}
3449					if (val[0]) val = val[0];
3450					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3451						new Waypoint({
3452							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3453							element: val,
3454							handler: function() {
3455								var element = $('> .t-inside', this.element),
3456									parent = $(this.element),
3457									currentIndex = parent.index();
3458								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3459									delayAttr = parseInt(element.attr('data-delay'));
3460								if (isNaN(delayAttr)) delayAttr = 100;
3461								delay -= showed;
3462								var objTimeout = requestTimeout(function() {
3463									element.removeClass('zoom-reverse').addClass('start_animation');
3464									showed = parent.index();
3465									if ( container.data('isotope') ) {
3466										container.isotope('layout');
3467									}
3468								}, delay * delayAttr)
3469								parent.data('objTimeout', objTimeout);
3470								if (!UNCODE.isUnmodalOpen) {
3471									this.destroy();
3472								}
3473							},
3474							offset: '100%'
3475						})
3476					} else {
3477						if (elInner.hasClass('force-anim')) {
3478							elInner.addClass('start_animation');
3479						} else {
3480							elInner.css('opacity', 1);
3481						}
3482						container.isotope('layout');
3483					}
3484
3485					index++;
3486				});
3487			},
3488			reloadIsotope = function(isotopeObj) {
3489				var isoIndex = $(isotopeObj).attr('data-iso-index');
3490				var $layoutMode = ($(isotopeObj).data('layout'));
3491				if ($layoutMode === undefined) {
3492					$layoutMode = 'masonry';
3493				}
3494				if (isotopeObj.data('isotope')) {
3495					isotopeObj.isotope({
3496						itemSelector: $itemSelector,
3497						layoutMode: $layoutMode,
3498						transitionDuration: transitionDuration[isoIndex],
3499						masonry: {
3500							columnWidth: colWidth(isoIndex)
3501						},
3502						vertical: {
3503							horizontalAlignment: 0.5,
3504						},
3505						sortBy: 'original-order',
3506						isOriginLeft: isOriginLeft
3507					});
3508				}
3509			}
3510			;
3511		if ($('.isotope-pagination').length > 0) {
3512			$('.isotope-system').on('click', '.pagination a', function(evt) {
3513				evt.preventDefault();
3514
3515				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3516					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3517						container = $(this).closest('.isotope-system'),
3518						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3519						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3520					calc_scroll -= UNCODE.get_scroll_offset();
3521
3522					if ( pagination_disable_scroll !== 'disabled' ) {
3523						var menu_container = $('.menu-sticky');
3524						var menu = menu_container.find('.menu-container');
3525
3526						if (menu_container.length > 0 && menu.length > 0) {
3527							calc_scroll = calc_scroll - menu.outerHeight();
3528						}
3529
3530						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3531							delta = bodyTop - calc_scroll,
3532							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3533						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3534
3535						if (!UNCODE.isFullPage) {
3536							if (scrollSpeed == 0) {
3537								$('html, body').scrollTop(calc_scroll);
3538							} else {
3539								$('html, body').animate({
3540									scrollTop: calc_scroll
3541								}, {
3542									easing: 'easeInOutQuad',
3543									duration: scrollSpeed,
3544									complete: function () {
3545										UNCODE.scrolling = false;
3546									}
3547								});
3548							}
3549						}
3550					}
3551				}
3552
3553				loadIsotope($(this), true);
3554			});
3555		}
3556		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3557			if ($(this).hasClass('no-isotope-filter')) {
3558				return;
3559			}
3560			var $filter = $(this),
3561				filterContainer = $filter.closest('.isotope-filters'),
3562				filterValue = $filter.attr('data-filter'),
3563				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3564				transitionDuration = container.data().isotope.options.transitionDuration,
3565				delay = 300,
3566				filterItems = [];
3567
3568			var filter_items = function(){
3569				if (filterValue !== undefined) {
3570					container.addClass('grid-filtering');
3571					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3572						var parent = $(val).parent(),
3573							objTimeout = parent.data('objTimeout');
3574						if (objTimeout) {
3575							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3576							clearRequestTimeout(objTimeout);
3577						}
3578						if (transitionDuration == 0) {
3579							if ($(val).hasClass('animate_when_almost_visible')) {
3580								$(val).addClass('zoom-reverse').removeClass('start_animation');
3581							} else {
3582								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3583							}
3584						}
3585					});
3586					requestTimeout(function(){
3587						if ( filterValue == '*' ) {
3588							container.removeClass('isotope-filtered');
3589						} else {
3590							container.addClass('isotope-filtered');
3591						}
3592						container.isotope({
3593							filter: function() {
3594								var block = $(this),
3595								filterable = (filterValue == '*') || block.hasClass(filterValue),
3596								lightboxElements = $('[data-lbox^=ilightbox]', block);
3597								if (filterable) {
3598									if (lightboxElements.length) {
3599										lightboxElements.removeClass('lb-disabled');
3600										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3601									}
3602									filterItems.push(block);
3603								} else {
3604									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3605								}
3606								container.trigger('more-items-loaded');
3607								$(window).trigger('more-items-loaded');
3608								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3609								return filterable;
3610							}
3611						});
3612						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3613
3614					}, delay);
3615
3616					/** once filtered - start **/
3617					container.isotope('once', 'arrangeComplete', function() {
3618						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3619							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3620							if (typeof getLightbox === 'object') {
3621								getLightbox.refresh();
3622							} else {
3623								UNCODE.lightbox();
3624							}
3625						}
3626						if (transitionDuration == 0) {
3627							requestTimeout(function() {
3628								boxAnimation(filterItems, 0, false, container);
3629							}, 100);
3630						}
3631						requestTimeout(function() {
3632							Waypoint.refreshAll();
3633							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3634								$(document).trigger('uncode-scrolltrigger-refresh');
3635							}
3636							container.removeClass('grid-filtering');
3637						}, 2000);
3638						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
3639					});
3640					/** once filtered - end **/
3641				} else {
3642					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3643						$.each(UNCODE.lightboxArray, function(index, val) {
3644							UNCODE.lightboxArray[index].destroy();
3645						});
3646					}
3647					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3648						var parent = $(val).parent(),
3649							objTimeout = parent.data('objTimeout');
3650						if (objTimeout) {
3651							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3652							clearRequestTimeout(objTimeout);
3653						}
3654						if (transitionDuration == 0) {
3655							if ($(val).hasClass('animate_when_almost_visible')) {
3656								$(val).addClass('zoom-reverse').removeClass('start_animation');
3657							} else {
3658								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3659							}
3660						}
3661					});
3662					container.parent().addClass('grid-loading');
3663					loadIsotope($filter);
3664				}
3665			};
3666
3667			if (!$filter.hasClass('active')) {
3668				/** Scroll top with filtering */
3669				if (filterContainer.hasClass('filter-scroll')) {
3670                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3671                    calc_scroll -= UNCODE.get_scroll_offset();
3672
3673					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3674						delta = bodyTop - calc_scroll,
3675						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3676						filterTolerance = false,
3677						filter_timeout;
3678					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3679
3680					if ( !UNCODE.isFullPage ) {
3681						if (scrollSpeed == 0) {
3682							$('html, body').scrollTop(calc_scroll);
3683							UNCODE.scrolling = false;
3684							filter_items();
3685						} else {
3686
3687							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3688								filter_items();
3689								filterTolerance = true;
3690							}
3691
3692							$('html, body').animate({
3693								scrollTop: calc_scroll
3694							},{
3695								easing: 'easeInOutQuad',
3696								duration: scrollSpeed,
3697								complete: function(){
3698									UNCODE.scrolling = false;
3699									if ( !filterTolerance ) {
3700										filter_timeout = setTimeout(function(){
3701											clearTimeout(filter_timeout);
3702											filter_items();
3703										}, 200);
3704									}
3705								}
3706							});
3707						}
3708					}
3709				} else {
3710					filter_items();
3711				}
3712			}
3713			evt.preventDefault();
3714		});
3715
3716		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3717			var params = UNCODE.getURLParams(window.location);
3718			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3719
3720			UNCODE.lastURL = window.location.href;
3721
3722			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3723				return;
3724			}
3725
3726			if (params.id === undefined) {
3727				$.each($('.isotope-system'), function(index, val) {
3728					loadIsotope($(val));
3729				});
3730			} else {
3731				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3732					loadIsotope($('#' + params.id));
3733				}
3734			}
3735		});
3736
3737		var loadIsotope = function($href, $paginating) {
3738			var is_paginating = false;
3739
3740			if (undefined !== $paginating && $paginating) {
3741				var is_paginating = $paginating;
3742			}
3743
3744			var href = ($href.is("a") ? $href.attr('href') : location),
3745				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3746				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3747				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3748				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3749				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3750				isotopeId = isotopeSystem.attr('id');
3751			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3752				UNCODE.lastURL = href;
3753				history.pushState({
3754					myIsotope: true
3755				}, document.title, href);
3756			}
3757			if (is_paginating) {
3758				isotopeWrapper.addClass('grid-filtering');
3759			}
3760			$.ajax({
3761				url: href
3762			}).done(function(data) {
3763				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3764					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3765					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3766				isotopeWrapper.addClass('isotope-reloaded');
3767				requestTimeout(function() {
3768					isotopeWrapper.removeClass('grid-loading');
3769					isotopeWrapper.removeClass('isotope-reloaded');
3770					isotopeWrapper.removeClass('grid-filtering');
3771				}, 500);
3772				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3773					var parent = $(val).parent(),
3774						objTimeout = parent.data('objTimeout');
3775					if (objTimeout) {
3776						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3777						clearRequestTimeout(objTimeout);
3778					}
3779					if ($(val).hasClass('animate_when_almost_visible')) {
3780						$(val).addClass('zoom-reverse').removeClass('start_animation');
3781					} else {
3782						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3783					}
3784				});
3785				requestTimeout(function() {
3786					if (isotopeContainer.data('isotope')) {
3787						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3788						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3789						UNCODE.adaptive();
3790						if (SiteParameters.dynamic_srcset_active === '1') {
3791							UNCODE.adaptive_srcset(isotopeContainer);
3792						}
3793						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3794							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3795							if (typeof getLightbox === 'object') {
3796								getLightbox.refresh();
3797							} else {
3798								UNCODE.lightbox();
3799							}
3800						}
3801					}
3802					isotopeContainer.trigger('more-items-loaded');
3803					$(window).trigger('more-items-loaded');
3804					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3805				}, 300);
3806				$('.pagination', isotopeFooter).remove();
3807				isotopeFooter.append($resultPagination);
3808
3809				if (isotopeResultCount.length > 0) {
3810					$('.woocommerce-result-count', isotopeResultCount).remove();
3811					isotopeResultCount.append($resultCount);
3812				}
3813			});
3814		};
3815		$filters.each(function(i, buttonGroup) {
3816			var $buttonGroup = $(buttonGroup);
3817			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3818				$buttonGroup.find('.active').removeClass('active');
3819				$(this).addClass('active');
3820
3821			});
3822
3823			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3824				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3825				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3826			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3827				e.preventDefault();
3828				$cats_filters.slideToggle(400, 'easeInOutCirc');
3829			});
3830
3831		});
3832		window.addEventListener('boxResized', function(e) {
3833			if (UNCODE.printDialogOpen !== false) {
3834				return false;
3835			}
3836			$.each($('.isotope-layout'), function(index, val) {
3837				var $layoutMode = ($(this).data('layout'));
3838				if ($layoutMode === undefined) $layoutMode = 'masonry';
3839				if ($(this).data('isotope')) {
3840					$(this).isotope({
3841						itemSelector: $itemSelector,
3842						layoutMode: $layoutMode,
3843						transitionDuration: transitionDuration[index],
3844						masonry: {
3845							columnWidth: colWidth(index)
3846						},
3847						vertical: {
3848							horizontalAlignment: 0.5,
3849						},
3850						sortBy: 'original-order',
3851						isOriginLeft: isOriginLeft
3852					});
3853					$(this).isotope('unbindResize');
3854					if (SiteParameters.dynamic_srcset_active === '1') {
3855						UNCODE.refresh_dynamic_srcset_size($(this));
3856					}
3857				}
3858				$(this).find('.mejs-video,.mejs-audio').each(function() {
3859					$(this).trigger('resize');
3860				});
3861			});
3862		}, false);
3863
3864		init_isotope();
3865	};
3866}
3867
3868UNCODE.lightbox = function() {
3869	if ( SiteParameters.lbox_enhanced ) {
3870		return true;
3871	}
3872	UNCODE.lightboxArray = {};
3873	requestTimeout(function() {
3874		var groupsArr = {};
3875		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3876			var group = this.getAttribute("data-lbox"),
3877				values = $(this).data();
3878			$(this).attr('data-lbox-init','true')
3879			groupsArr[group] = values;
3880		});
3881		for (var i in groupsArr) {
3882			var skin = groupsArr[i].skin || 'black',
3883				path = groupsArr[i].dir || 'horizontal',
3884				thumbs = !groupsArr[i].notmb || false,
3885				arrows = !groupsArr[i].noarr || false,
3886				social = groupsArr[i].social || false,
3887				deeplink = groupsArr[i].deep || false,
3888				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3889				counter = $els.length,
3890				dataAlbum = $els.attr('data-album');
3891			if (social) social = {
3892				facebook: true,
3893				twitter: true,
3894				reddit: true,
3895				digg: true
3896			};
3897			UNCODE.lightboxArray[i] = $els.iLightBox({
3898				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3899				skin: skin,
3900				path: path,
3901				linkId: deeplink,
3902				infinite: false,
3903				//fullViewPort: 'fit',
3904				smartRecognition: false,
3905				fullAlone: true,
3906				maxScale: 1,
3907				minScale: .02,
3908				//fullStretchTypes: 'flash, video',
3909				overlay: {
3910					opacity: .94
3911				},
3912				controls: {
3913					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3914					fullscreen: true,
3915					thumbnail: thumbs,
3916					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3917				},
3918				show: {
3919					speed: 200
3920				},
3921				hide: {
3922					speed: 200
3923				},
3924				social: {
3925					start: false,
3926					buttons: social
3927				},
3928				caption: {
3929					start: false
3930				},
3931				styles: {
3932					nextOpacity: 1,
3933					nextScale: 1,
3934					prevOpacity: 1,
3935					prevScale: 1
3936				},
3937				effects: {
3938					switchSpeed: 400
3939				},
3940				slideshow: {
3941					pauseTime: 5000
3942				},
3943				thumbnails: {
3944					maxWidth: 60,
3945					maxHeight: 60,
3946					activeOpacity: .2
3947				},
3948				html5video: {
3949					preload: true
3950				},
3951				callback: {
3952					onOpen: function(){
3953						$(window).trigger('uncode-custom-cursor');
3954						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3955							iNoBounce.enable();
3956						}
3957					},
3958					onHide: function(){
3959						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3960							iNoBounce.disable()
3961						}
3962					},
3963				}
3964			});
3965
3966			$(document).on('infinite-loaded', function(){
3967				UNCODE.lightboxArray[i].refresh();
3968			});
3969
3970			$(window).on('gdprOpen', function(){
3971				UNCODE.lightboxArray[i].close();
3972			});
3973		};
3974	}, 100);
3975
3976	$(document).on('click', '.lb-disabled', function(e){
3977		e.preventDefault();
3978	});
3979};
3980
3981UNCODE.lightgallery = function( $el ) {
3982	if (!document._uncodeMarqueeGalleryBind) {
3983		document._uncodeMarqueeGalleryBind = true;
3984
3985		$(document).on('uncode-marquee-updated', function(e, data){
3986			if (!data || !data.context) return;
3987
3988			var $context = $(data.context);
3989
3990			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')
3991				.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'));
3992
3993			if (!$targets.length) {
3994				$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');
3995			}
3996
3997			if (!$targets.length) return;
3998
3999			$targets.each(function(){
4000				$(this).removeAttr('data-lbox-init');
4001				$(this).find('[data-lbox-init]').removeAttr('data-lbox-init');
4002			});
4003
4004			UNCODE.lightgallery($targets);
4005		});
4006	}
4007
4008	var createSelectors = function(){
4009		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
4010			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4011				$(this).addClass('lbox-trigger-item');
4012			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4013				$(this).addClass('lbox-nested-item');
4014			} else {
4015				$(this).removeClass('lbox-trigger-item');
4016				$(this).removeClass('lbox-nested-item');
4017			}
4018		});
4019	};
4020
4021	createSelectors();
4022
4023	var galleries = [],
4024		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4025			return !$(this).closest('.nested-carousel').length;
4026		}),
4027		$_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 *'), 
4028		$galleries = $_galleries.filter(function( index ) {
4029			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4030		}),
4031		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
4032
4033	if ( typeof $el === 'undefined' ) {
4034		$el = $galleries.add( $nested );
4035	}
4036
4037	var $disabled = $('a.lb-disabled');
4038	$disabled.on('click', function(e){
4039		e.preventDefault();
4040	});
4041
4042	var beforeSlide = function(event) {
4043		var detail = event.detail,
4044			info = detail.info,
4045			item = detail.item,
4046			$slide = $(detail.currentSlide.selector),
4047			$video = $('video', $slide),
4048			$previous = $(detail.previousSlide.selector),
4049			$prevVideo = $('video', $previous),
4050			isAudio = false;
4051
4052		if ( typeof info.src !== 'undefined' ) {
4053			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
4054		}
4055
4056		if ( ! $video.length && ( info.video || isAudio ) ) {
4057			if ( info.video ) {
4058				if ( typeof info.video === 'object' ) {
4059					var infoJson = info.video;
4060				} else {
4061					var infoJson = JSON.parse(info.video);
4062				}
4063				var src = infoJson.source[0].src,
4064					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
4065					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
4066					loop = $(item).attr('data-loop');
4067
4068			} else if ( isAudio ) {
4069				var src = info.src,
4070					autoplay = true,
4071					loop = false;
4072			}
4073			if ( typeof src !== 'undefined' ) {
4074				$slide.addClass('has-html5');
4075				var video = document.createElement('video');
4076				video.src = src;
4077				video.preload = 'auto';
4078				video.controls = 'controls';
4079				video.controlsList = 'nodownload';
4080				if ( autoplay ) {
4081					video.autoplay = 'autoplay';
4082				}
4083				if ( muted ) {
4084					video.muted = 'muted';
4085				}
4086				if ( loop ) {
4087					video.loop = 'loop';
4088				}
4089				$(video).appendTo($slide);
4090			}
4091		} else {
4092			var $video = $('video', $slide);
4093			if ( $video.length ) {
4094				$video[0].currentTime = 0;
4095				if ( $video[0].autoplay ) {
4096					$video[0].play();
4097				}
4098			}
4099		}
4100		if ( $prevVideo.length ) {
4101			$prevVideo[0].currentTime = 0;
4102			$prevVideo[0].pause();
4103		}
4104	};
4105
4106	var beforeOpen = function(event) {
4107		var detail = event.detail,
4108			items = detail.items,
4109			galleryItems = detail.galleryItems,
4110			outer = detail.outer.selector,
4111			i, ii;
4112		for ( i = 0; i < galleryItems.length; i++ ) {
4113			var item = galleryItems[i];
4114			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
4115				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
4116			}
4117		}
4118		for ( ii = 0; ii < items.length; ii++ ) {
4119			var item = items[ii];
4120			if ( $(item).attr('data-icon') === 'video' ) {
4121				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
4122			}
4123		}
4124
4125	};
4126
4127	//caption builder
4128	var captionBuilder = function($el){
4129		$el.each( function( index, val ) {
4130			var $gallery = $(this).attr('data-lbox-init','true'),
4131				$_a = '.lbox-trigger-item',
4132				$_nested_a = '.lbox-nested-item';
4133
4134			$gallery.find($_a).add($_nested_a).each(function(){
4135				var $a = $(this),
4136					$img = $('img', $a).first(),
4137					imgw = $img.attr('data-width'),
4138					imgh = $img.attr('data-height'),
4139					caption = $a.attr('data-caption'),
4140					title = $a.attr('data-title');
4141
4142				if ( $img.length && $img.attr('data-crop') != true ) {
4143					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4144						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4145					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4146						$a.attr('data-external-thumb-image', $img[0].src);
4147					}
4148				}
4149
4150				if ( typeof title !== 'undefined' && title !== '' ) {
4151					title = '<h6>' + title + '</h6>';
4152				} else {
4153					title = '';
4154				}
4155
4156				if ( typeof caption !== 'undefined' && caption !== '' ) {
4157					caption = '<p>' + caption + '</p>';
4158					title += caption;
4159				}
4160
4161				if ( title !== '' ) {
4162					$a.attr( 'title', title );
4163				}
4164
4165				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') ) ) {
4166					$a.attr('data-lg-size', imgw + '-' + imgh);
4167				}
4168			});
4169		});
4170	};
4171	captionBuilder($el);
4172
4173	//regular galleries
4174	$el.each( function( index, val ) {
4175		var $gallery = $(this),
4176			$_a = '.lbox-trigger-item',
4177			$_nested_a = '.lbox-nested-item',
4178			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4179			galleryID = $_first.attr('data-lbox'),
4180			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4181			tmb = $_first.attr('data-notmb'),
4182			social = $_first.attr('data-social'),
4183			deep = $_first.attr('data-deep'),
4184			zoom = $_first.attr('data-zoom-origin'),
4185			actual = $_first.attr('data-actual-size'),
4186			download = $_first.attr('data-download'),
4187			controls = $_first.attr('data-arrows') !== 'no',
4188			fullScreen = $_first.attr('data-full'),
4189			counter = $_first.attr('data-counter'),
4190			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4191			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4192			connect = $_first.attr('data-connect'),
4193			lgPlugins = [lgVideo],
4194			itemsLoadedTimeOut;
4195
4196		if ( typeof galleryID === 'undefined' ) {
4197			galleryID = $gallery.attr('id');
4198		}
4199
4200		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4201		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4202
4203		if ( typeof tmb == 'undefined' || !tmb ) {
4204			lgPlugins.push(lgThumbnail);
4205		}
4206		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4207			lgPlugins.push(lgZoom);
4208		}
4209		if ( typeof deep != 'undefined' && deep != '' ) {
4210			lgPlugins.push(lgHash);
4211		}
4212		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4213			lgPlugins.push(lgFullscreen);
4214		}
4215		if ( social ) {
4216			lgPlugins.push(lgShare);
4217		}
4218
4219		if ( galleries.indexOf( galleryID ) !== -1 ) {
4220			return true;
4221		}
4222
4223		galleries.push( galleryID );
4224		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4225			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4226		var gallery = lightGallery( $triggerGal[0], {
4227			addClass: containerClass,
4228			plugins: lgPlugins,
4229			mode: transition,
4230			selector: $selector,
4231			galleryId: galleryID,
4232			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4233			iframeWidth: '848px',
4234			iframeMaxWidth: '90%',
4235			iframeMaxHeight: '90%',
4236			exThumbImage: 'data-external-thumb-image',
4237			loadYouTubeThumbnail: false,
4238			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' || $gallery.closest('[data-lb-autoplay=yes]').length ),
4239			// autoplayFirstVideo: false,
4240			pager: false,
4241			startClass: 'lg-start-opacity',
4242			zoomFromOrigin: zoom,
4243			controls: controls,
4244			download: ( typeof download != 'undefined' && download != '' ),
4245			thumbWidth: 50,
4246			thumbHeight: '50px',
4247			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4248			loadYouTubePoster: false,
4249			enableDrag: $triggerGal.find($selector).length > 1,
4250			mobileSettings: {
4251				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4252			},
4253		});
4254
4255		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4256			e.preventDefault();
4257			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4258			gallery.openGallery(index-1);
4259		});
4260
4261		$gallery.on('uncode-gallery-trigger', function(){
4262			gallery.openGallery(0);
4263		});
4264
4265		$triggerGal.on('more-items-loaded', function(e, items) {
4266			clearRequestTimeout(itemsLoadedTimeOut);
4267			itemsLoadedTimeOut = requestTimeout(function(){
4268				createSelectors();
4269				captionBuilder($triggerGal);
4270				gallery.refresh();
4271			}, 100);
4272		});
4273
4274		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4275			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4276				$el = model.view.$el;
4277				if ( $el.find($triggerGal).length ) {
4278					gallery.destroy();
4279				}
4280			});
4281		}
4282
4283		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4284		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4285		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4286			$(window).trigger('uncode-custom-cursor');
4287		});
4288
4289	});
4290
4291	if ( typeof $el !== 'undefined' ) {
4292
4293		//album galleries
4294		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4295			var album = val,
4296				galleryID = index,
4297				$album = $(album),
4298				params = $album.attr('data-album'),
4299				tmb = $(val).attr('data-notmb'),
4300				social = $(val).attr('data-social'),
4301				deep = $(val).attr('data-deep'),
4302				actual = $(val).attr('data-actual-size'),
4303				download = $(val).attr('data-download'),
4304				controls = $(val).attr('data-arrows') !== 'no',
4305				fullScreen = $(val).attr('data-full'),
4306				counter = $(val).attr('data-counter'),
4307				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4308				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4309				lgPlugins = [lgVideo];
4310
4311			$(val).attr('data-lbox-init','true');
4312
4313			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4314			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4315
4316			if ( typeof tmb == 'undefined' || !tmb ) {
4317				lgPlugins.push(lgThumbnail);
4318			}
4319			if ( typeof actual != 'undefined' && actual != '' ) {
4320				lgPlugins.push(lgZoom);
4321			}
4322			if ( typeof deep != 'undefined' && deep != '' ) {
4323				lgPlugins.push(lgHash);
4324			}
4325			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4326				lgPlugins.push(lgFullscreen);
4327			}
4328			if ( social ) {
4329				lgPlugins.push(lgShare);
4330			}
4331
4332			var gallery = window.lightGallery(album, {
4333				dynamic: true,
4334				plugins: lgPlugins,
4335				dynamicEl: JSON.parse(params),
4336				galleryId: galleryID,
4337				addClass: containerClass,
4338				mode: transition,
4339				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4340				iframeWidth: '848px',
4341				iframeMaxWidth: '90%',
4342				iframeMaxHeight: '90%',
4343				loadYouTubeThumbnail: false,
4344				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4345				// autoplayFirstVideo: false,
4346				pager: false,
4347				startClass: 'lg-start-opacity',
4348				zoomFromOrigin: false,
4349				controls: controls,
4350				download: ( typeof download != 'undefined' && download != '' ),
4351				thumbWidth: 50,
4352				thumbHeight: '50px',
4353				loadYouTubePoster: false,
4354				counter: counter,
4355				exThumbImage: 'data-external-thumb-image',
4356				loadYouTubePoster: false,
4357				mobileSettings: {
4358					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4359				},
4360			});
4361
4362			$album.on('click', function(){
4363				gallery.openGallery(0);
4364			});
4365
4366			album.addEventListener('lgBeforeSlide', beforeSlide);
4367			album.addEventListener('lgBeforeOpen', beforeOpen);
4368			album.addEventListener('lgAfterOpen', function(){
4369				$(window).trigger('uncode-custom-cursor');
4370			});
4371
4372			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4373				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4374					$el = model.view.$el;
4375					if ( $el.find($album).length ) {
4376						gallery.destroy();
4377					}
4378				});
4379			}
4380
4381		});
4382
4383		//single images
4384		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4385			var gallery = lightGallery( $('.page-wrapper')[0], {
4386				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4387				iframeWidth: '848px',
4388				iframeMaxWidth: '90%',
4389				iframeMaxHeight: '90%',
4390				loadYouTubeThumbnail: false,
4391				// autoplayFirstVideo: false,
4392				startClass: 'lg-start-opacity',
4393				thumbWidth: 50,
4394				thumbHeight: '50px',
4395				download: false,
4396				loadYouTubePoster: false,
4397				counter: false
4398			});
4399
4400			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4401			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4402		});
4403	}
4404
4405	var galleryButtons = function(){
4406		var $buttons = $('.btn-gallery-trigger');
4407		$buttons.each(function(key, val){
4408			var $button = $(val),
4409				target = $button.attr('data-target'),
4410				$gallery = $('.un-media-gallery').first(),
4411				$row = $button.closest('.vc_row[data-parent]');
4412			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4413				$gallery = $('.un-media-gallery#' + target);
4414			} else if ( $('.un-media-gallery', $row).length ) {
4415				$gallery = $('.un-media-gallery', $row).first();
4416			}
4417			
4418			$button.on('click', 'a', function(e){
4419				e.preventDefault();
4420				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4421			});
4422		});
4423	};
4424	galleryButtons();
4425};
4426
4427UNCODE.carousel = function(container) {
4428	var $owlContainers = $('.owl-carousel-container', container);
4429	$owlContainers.each(function() {
4430		var $owlContainer = $(this),
4431			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4432			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4433			values = {},
4434			tempTimeStamp,
4435			newWidth = UNCODE.wwidth,
4436			$owlInsideEqual = [];
4437		$owlSelector.each(function() {
4438			var itemID = $(this).attr('id'),
4439				$elSelector = $(('#' + itemID).toString());
4440			values['id'] = itemID;
4441			values['items'] = 1;
4442			values['columns'] = 3;
4443			values['fade'] = false;
4444			values['nav'] = false;
4445			values['navmobile'] = false;
4446			values['navskin'] = 'light';
4447			values['navspeed'] = 400;
4448			values['dots'] = false;
4449			values['dotsmobile'] = false;
4450			values['loop'] = false;
4451			values['autoplay'] = false;
4452			values['timeout'] = 3000;
4453			values['autoheight'] = false;
4454			values['stagepadding'] = 0;
4455			values['margin'] = 0;
4456			values['lg'] = 1;
4457			values['md'] = 1;
4458			values['sm'] = 1;
4459			$.each($(this).data(), function(i, v) {
4460				values[i] = v;
4461			});
4462
4463			if ($(this).closest('.uncode-slider').length) {
4464				values['navskin'] = '';
4465				values['navmobile'] = false;
4466				//values['dotsmobile'] = true;
4467			} else {
4468				values['navskin'] = ' style-'+values['navskin']+' style-override';
4469			}
4470
4471			var setIndexActive = function(event, init){
4472				var init = typeof init === 'undefined' ? false : init,
4473					thiis = $(event.currentTarget);
4474				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4475					var scrolltop = $(document).scrollTop(),
4476						size = event.page.size,
4477						i;
4478					var setIndex = requestTimeout(function() {
4479						for ( i = 0; i < size; i++ ) {
4480							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4481							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4482							if (thiis.closest('.row-slider').length) {
4483								if (currentItem == undefined) {
4484									currentItem = thiis.children()[i];
4485								}
4486								if ($(currentItem).closest('#page-header').length) {
4487									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4488										UNCODE.switchColorsMenu(scrolltop, 'dark');
4489									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4490										UNCODE.switchColorsMenu(scrolltop, 'light');
4491									}
4492								}
4493								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4494								if (owlCustomNav.length) {
4495									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4496										owlCustomNav.addClass('style-dark').removeClass('style-light');
4497									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4498										owlCustomNav.addClass('style-light').removeClass('style-dark');
4499									}
4500								}
4501							}
4502							var itendIndex = $(currentItem).attr('data-index');
4503							if ( isNaN(itendIndex) ) {
4504								itendIndex = 1;
4505							}
4506							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4507							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4508							if ($.fn.counterUp) {
4509								if (size <= 1) {
4510									$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4511										var $counter = $(this);
4512										$counter.addClass('started').counterUp({
4513											delay: 10,
4514											time: 1500
4515										});
4516									});
4517								} else {
4518									$('.owl-item', $elSelector).eq(itemCont).find('.uncode-counter:not(.started)').addClass('started').counterUp({
4519										delay: 10,
4520										time: 1500
4521									});
4522								}
4523							}
4524						}
4525						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4526					}, 200);					
4527				}
4528				tempTimeStamp = event.timeStamp;
4529			}
4530
4531			/** Initialize */
4532			$elSelector.on('initialize.owl.carousel', function(event) {
4533				if (typeof UNCODE.owlNav !== 'undefined') {
4534					UNCODE.owlNav(itemID, event);
4535				}
4536
4537				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4538					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4539						var shortcode = model.attributes.shortcode,
4540							$el = model.view.$el,
4541							$row_wrap = $el.closest('.row');
4542						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4543							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4544						}
4545					});
4546					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4547						var shortcode = model.attributes.shortcode;
4548						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4549							tempTimeStamp = Math.floor(Date.now() / 1000);
4550						}
4551					});
4552					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4553						var shortcode = model.attributes.shortcode;
4554						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4555							UNCODE.owlNav(itemID, event);
4556							$elSelector.trigger('refresh.owl.carousel');
4557						}
4558					});
4559				}
4560				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4561				// 	$elSelector.closest('.mega-menu-inner').css({
4562				// 		visibility: 'hidden',
4563				// 		display: 'block'
4564				// 	});
4565				// 	$elSelector.data('owl.carousel');
4566				// 	$elSelector.trigger('refresh.owl.carousel');
4567				// 	$elSelector.closest('.mega-menu-inner').css({
4568				// 		display: 'none',
4569				// 		visibility: '',
4570				// 	});
4571				// }
4572				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4573				// 	$elSelector.trigger("to.owl.carousel", 0);
4574				// });
4575			});
4576
4577			/** Initialized */
4578			$elSelector.on('initialized.owl.navigation', function(event) {
4579				$('.owl-dot', event.currentTarget).each(function(key, val){
4580					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4581				});
4582			});
4583
4584			$elSelector.on('initialized.owl.carousel', function(event) {
4585
4586				if ( $('.isotope-container', event.currentTarget).length ) {
4587					window.dispatchEvent(UNCODE.boxEvent);
4588				}
4589
4590				$('.owl-dot.active', $elSelector).on('click', function(){
4591					return false;
4592				});
4593
4594				var thiis = $(event.currentTarget),
4595					// get the time from the data method
4596					time = thiis.data("timer-id"),
4597					rowParent = thiis.closest('.row-parent');
4598
4599				if ( typeof rowParent[0] !== 'undefined' ) {
4600					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4601				}
4602
4603				if (time) {
4604					clearRequestTimeout(time);
4605				}
4606
4607				thiis.addClass('showControls');
4608				var new_time = requestTimeout(function() {
4609					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4610					if (thiis.hasClass('owl-height-viewport'))
4611						setItemsRelHeight(thiis);
4612					if (thiis.hasClass('owl-height-equal') || thiis.closest('.uncode-wrapper').length) {
4613						setItemsHeight(thiis);
4614					}
4615					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4616					if (thiis.closest('.unequal, .unexpand').length) {
4617						UNCODE.setRowHeight(rowParent[0], true);
4618					}
4619					if (SiteParameters.dynamic_srcset_active === '1') {
4620						UNCODE.refresh_dynamic_srcset_size(thiis);
4621					}
4622				}, 350);
4623				// save the new time
4624				thiis.data("timer-id", new_time);
4625
4626				var scrolltop = $(document).scrollTop();
4627				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4628
4629				//if (!UNCODE.isMobile) {
4630					/** fix autoplay when visible **/
4631				$(window).on('load', function(){
4632					if (thiis.data('autoplay')) {
4633						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) {
4634							thiis.trigger('stop.owl.autoplay');
4635						} else {
4636							thiis.trigger('play.owl.autoplay');
4637						}
4638					}
4639					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4640						return;
4641					}
4642					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) {
4643						var carouselInView = new Waypoint.Inview({
4644							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4645							element: thiis[0],
4646							exited: function() {
4647								var el = $(this.element);
4648								if (el.data('autoplay') ) {
4649									el.trigger('stop.owl.autoplay');
4650									el.data('stopped','true');
4651								}
4652							},
4653							enter: function(direction) {
4654								var el = $(this.element);
4655								requestTimeout(function() {
4656									if (el.data('autoplay')) {
4657										el.trigger('play.owl.autoplay');
4658										el.data('stopped','false');
4659									}
4660								}, 100);
4661							}
4662						});
4663					}
4664					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4665						setTimeout(function(){
4666							window.lenis.resize();
4667						}, 1000);
4668					}
4669			  	
4670				});
4671				//}
4672
4673				// $(window).on('frontend:carousel_updated', function(){
4674				// 	Waypoint.refreshAll();
4675				// });
4676
4677				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) {
4678					requestTimeout(function() {
4679						animate_thumb($('.t-inside', el), event);
4680					}, 400);
4681				} 
4682				if (thiis.closest('.isotope-system').length ) {
4683					requestTimeout(function() {
4684						thiis.closest('.isotope-container').isotope('layout');
4685					}, 400);
4686				}
4687				if (thiis.closest('.megamenu-block-wrapper').length ) {
4688					$(document).on('un-menu-show', function(e, $ul){
4689						if ( thiis.closest($ul).length ) {
4690							animate_thumb($('.t-inside', el), event);
4691						}
4692					});
4693				}
4694				if (thiis.closest('.overlay').length ) {
4695					$(window).on('menuOpen', function(e, $ul){
4696						animate_thumb($('.t-inside', el), event);
4697					});
4698				}
4699
4700				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4701				currentIndex = $(currentItem).attr('data-index');
4702
4703				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4704					if ($(val).closest('.uncode-slider').length) {
4705						$(val).removeClass('start_animation');
4706					}
4707				});
4708				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4709					if ($(val).closest('.uncode-slider').length) {
4710						$(val).removeClass('already-animated');
4711					}
4712				});
4713
4714				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4715					if ($(val).closest('.uncode-slider').length) {
4716						$(val).removeAttr('data-animated');
4717					}
4718				});
4719
4720				$.each($('.owl-item.cloned', thiis), function(index, val) {
4721					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4722				});
4723
4724				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4725					if ($(val).attr('data-index') != currentIndex) {
4726						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4727						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4728					}
4729					if ($(val).attr('data-index') != currentIndex) {
4730						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4731					}
4732					if ($(val).attr('data-index') == currentIndex) {
4733						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4734					}
4735				});
4736
4737				if (thiis.closest('.uncode-slider').length) {
4738					var el = thiis.closest('.row-parent')[0],
4739						section = thiis.closest('.vc_section');
4740					if ( section.length ) {
4741						el = $('> .row-parent', section)[0];
4742					}
4743					if ($(el).data('imgready')) {
4744						firstLoaded(el, event);
4745					} else {
4746						el.addEventListener("imgLoaded", function(el) {
4747							firstLoaded(el.target, event);
4748						}, false);
4749					}
4750					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4751					if (transHeight != null) {
4752						requestTimeout(function() {
4753							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4754						}, 100);
4755					}
4756				} else {
4757					var el = thiis;
4758					el.closest('.uncode-slider').addClass('slider-loaded');
4759				}
4760
4761				requestTimeout(function() {
4762					if (typeof UNCODE.bigText !== 'undefined') {
4763						UNCODE.bigText(thiis);
4764					}
4765					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4766						if (thiis.data('autoplay')) pauseOnHover(thiis);
4767					}
4768				}, 500);
4769
4770				if (thiis.closest('.unequal').length) {
4771					$owlInsideEqual.push(thiis.closest('.row-parent'));
4772				}
4773
4774				var containerClasses = '',
4775					containerStyle = '';
4776				if ( $('.owl-dots-classes', $owlContainer).length ) {
4777					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4778					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4779					$('.owl-dots-classes', $owlContainer).remove();
4780				}
4781
4782				if ( containerClasses !== '' ) {
4783					requestTimeout(function() {
4784						if ( containerClasses !== '' )
4785							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4786						if ( containerStyle !== '' )
4787							$('.owl-dots', $owlContainer).addClass(containerClasses);
4788					}, 100);
4789				}
4790
4791				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4792					$(val).closest('.row-inner').css({
4793						'margin-top': '-1px'
4794					});
4795				});
4796
4797				if ($.fn.isotope) {
4798					if ( thiis.closest('.isotope-container').length ) {
4799						if (thiis.closest('.isotope-container').data('isotope')) {
4800							requestTimeout(function(){
4801								thiis.closest('.isotope-container').isotope('layout');
4802							}, 300);
4803						}
4804						$(window).on('load', function(){
4805							if (thiis.closest('.isotope-container').data('isotope')) {
4806								thiis.closest('.isotope-container').isotope('layout');
4807							}
4808						});
4809					}
4810				}
4811
4812				if (thiis.data('autoplay')) {
4813					$(window).on('menuOpen', function(){
4814						if ( thiis.closest('.overlay').length ) {
4815							thiis.trigger('play.owl.autoplay');
4816							thiis.data('stopped','false');
4817						} else {
4818							thiis.trigger('stop.owl.autoplay');
4819							thiis.data('stopped','true');
4820						}
4821					});
4822					$(window).on('menuClose', function(){
4823						if ( thiis.closest('.overlay').length ) {
4824							thiis.trigger('stop.owl.autoplay');
4825							thiis.data('stopped','true');
4826						} else {
4827							thiis.trigger('play.owl.autoplay');
4828							thiis.data('stopped','false');
4829						}
4830					});
4831				}
4832
4833				setIndexActive(event, true);
4834
4835				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4836						return !$(this).closest('.nested-carousel').length;
4837					}),
4838					$_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),
4839					$galleries = $_galleries.filter(function( index ) {
4840						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4841					});
4842
4843				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4844					UNCODE.lightgallery( $galleries );
4845				}
4846
4847				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4848					$(document).trigger('uncode-scrolltrigger-refresh');
4849				}
4850
4851				if (thiis.closest('.overlay').length && thiis.data('autoplay')) {
4852					thiis.trigger('stop.owl.autoplay');
4853					thiis.data('stopped','true');
4854				}
4855
4856				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4857					thiis.trigger('stop.owl.autoplay');
4858					thiis.data('stopped','false');
4859					$(document).on('un-menu-show', function(){
4860						thiis.trigger('play.owl.autoplay');
4861						thiis.data('stopped','false');
4862					}).on('un-menu-hide', function(){
4863						thiis.trigger('stop.owl.autoplay');
4864						thiis.data('stopped','true');
4865					});
4866				}
4867			});
4868
4869			$elSelector.on('resized.owl.carousel', function(event) {
4870				$('.owl-dot', event.currentTarget).each(function(key, val){
4871					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4872				});
4873			});
4874
4875			$elSelector.on('resized.owl.carousel', function(event) {
4876				var thiis = $(event.currentTarget);
4877				// if ($(this).closest('.nested-carousel').length) {
4878				// 	requestTimeout(function() {
4879				// 		window.dispatchEvent(UNCODE.boxEvent);
4880				// 	}, 200);
4881				// }
4882				if ( thiis.hasClass('owl-height-equal') )
4883					setItemsHeight(thiis);
4884
4885				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4886					newWidth = UNCODE.wwidth;
4887					setItemsRelHeight($elSelector);
4888				}
4889
4890				setIndexActive(event);
4891
4892				if (SiteParameters.dynamic_srcset_active === '1') {
4893					UNCODE.refresh_dynamic_srcset_size(thiis);
4894				}
4895
4896				if ($.fn.isotope) {
4897					$(window).on('load', function(){
4898						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4899							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4900						}
4901					});
4902				}
4903
4904				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4905					setTimeout(function(){
4906						window.lenis.resize();
4907					}, 1000);
4908				}
4909				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4910					$(document).trigger('uncode-scrolltrigger-refresh');
4911				}
4912			});
4913
4914			$elSelector.on('refreshed.owl.carousel', function(event) {
4915				setIndexActive(event);
4916			});
4917
4918			/** detect resize window for fluid height layout */
4919			var setFluidResize;
4920			function manageFluidCarouseHeight() {
4921				clearRequestTimeout(setFluidResize);
4922				setFluidResize = requestTimeout(function(){
4923					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4924						newWidth = UNCODE.wwidth;
4925						setItemsRelHeight($elSelector);
4926					}
4927				}, 100);
4928			}
4929			window.addEventListener('resize', manageFluidCarouseHeight);
4930
4931			/** Change */
4932			$elSelector.on('change.owl.carousel', function(event) {
4933				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4934			});
4935
4936			/** Changed */
4937			$elSelector.on('changed.owl.carousel', function(event) {
4938				var $row = $elSelector.parents('.row')[0];
4939				if ( typeof $row !== 'undefined' ) {
4940					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4941				}
4942				setIndexActive(event);
4943			});
4944
4945			var checkDrag = function(e) {
4946				$elSelector.addClass('owl-dragging');
4947			};
4948			$elSelector.on('drag.owl.carousel', function(event) {
4949				document.addEventListener("mousemove", checkDrag);
4950			});
4951
4952			$elSelector.on('dragged.owl.carousel', function(event) {
4953				$elSelector.removeClass('owl-dragging');
4954				document.removeEventListener("mousemove", checkDrag);
4955			});
4956
4957			$elSelector.on('translate.owl.carousel', function(event) {
4958				if (UNCODE.isMobile) {
4959					$(event.currentTarget).addClass('owl-translating');
4960				}
4961			});
4962
4963			/** Translated */
4964			$elSelector.on('translated.owl.carousel', function(event) {
4965
4966				var thiis = $(event.currentTarget),
4967					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4968					currentIndex = $(currentItem).attr('data-index'),
4969					stagePadding = thiis.data('stagepadding');
4970
4971				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4972
4973				if (!UNCODE.isMobile) {
4974					UNCODE.owlPlayVideo(thiis);
4975				}
4976
4977				requestTimeout(function(){
4978					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4979					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4980					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4981						if (lastDelayElems == undefined) lastDelayElems = 0;
4982						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4983						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4984						thiis.trigger('stop.owl.autoplay');
4985						requestTimeout(function() {
4986							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4987						}, maxDelay);
4988					}
4989				}, 200);
4990
4991				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4992					if ($(val).closest('.uncode-slider').length) {
4993						$(val).removeClass('start_animation');
4994					}
4995				});
4996
4997				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4998					if ($(val).closest('.uncode-slider').length) {
4999						$(val).removeClass('already-animated');
5000					}
5001				});
5002
5003				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
5004					if ($(val).closest('.uncode-slider').length) {
5005						$(val).removeAttr('data-animated');
5006					}
5007				});
5008
5009				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
5010					if ($(val).attr('data-index') != currentIndex) {
5011						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
5012						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
5013					}
5014					if ($(val).attr('data-index') != currentIndex) {
5015						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
5016					}
5017					if ($(val).attr('data-index') == currentIndex) {
5018						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
5019					}
5020				});
5021
5022				if (UNCODE.isMobile) {
5023					thiis.removeClass('owl-translating');
5024				}
5025
5026				setIndexActive(event);
5027			});
5028
5029			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
5030
5031			/** Init carousel */
5032			$elSelector.not('.showControls').owlCarousel({
5033				items: values['items'],
5034				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
5035				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
5036				nav: values['nav'],
5037				dots: values['dots'],
5038				loop: values['loop'],
5039				stagePadding: values['stagepadding'],
5040				margin: 0,
5041				video: true,
5042				autoWidth: false,
5043				autoplay: false,
5044				autoplayTimeout: values['timeout'],
5045				autoplaySpeed: values['navspeed'],
5046				autoplayHoverPause: $(this).closest('.uncode-slider:not(.uncode-wrapper)').length || $(this).closest('.carousel-no-hover').length ? false : true,
5047				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
5048				itemSelector: SiteParameters.uncode_carousel_itemSelector,
5049				rtl: $('body').hasClass('rtl') ? true : false,
5050				fluidSpeed: true,
5051				navSpeed: values['navspeed'],
5052				dotsSpeed: values['navspeed'] / values['items'],
5053				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
5054				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
5055				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>'],
5056				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
5057				responsiveClass: true,
5058				responsiveBaseElement: '.box-container',
5059				responsive: {
5060					0: {
5061						items: values['sm'],
5062						nav: values['navmobile'],
5063						dots: values['dotsmobile'],
5064						dotsSpeed: values['navspeed'] / values['sm'],
5065					},
5066					480: {
5067						items: values['sm'],
5068						nav: values['navmobile'],
5069						dots: values['dotsmobile'],
5070						dotsSpeed: values['navspeed'] / values['sm'],
5071					},
5072					570: {
5073						items: values['md'],
5074						nav: values['navmobile'],
5075						dots: values['dotsmobile'],
5076						dotsSpeed: values['navspeed'] / values['md'],
5077					},
5078					960: {
5079						items: values['lg'],
5080						dotsSpeed: values['navspeed'] / values['lg'],
5081					}
5082				}
5083			});
5084
5085			var transDuration = parseFloat(values['navspeed']) * 0.3;
5086			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
5087
5088			$('.owl-item .tmb', $elSelector).css({
5089				'-webkit-transition-delay': transDuration + 'ms',
5090				'-moz-transition-delay': transDuration + 'ms',
5091				'-o-transition-delay': transDuration + 'ms',
5092				'transition-delay': transDuration + 'ms',
5093				'-webkit-transition-duration': transDuration2 + 'ms',
5094				'-moz-transition-duration': transDuration2 + 'ms',
5095				'-o-transition-duration': transDuration2 + 'ms',
5096				'transition-duration': transDuration2 + 'ms',
5097			});
5098
5099			requestTimeout(function() {
5100				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5101					UNCODE.setRowHeight($owlInsideEqual[i]);
5102				};
5103			}, 300);
5104
5105			$(window).on('load', function(){
5106				var $elCarousel = $elSelector.data('owl.carousel');
5107				if ( typeof $elCarousel !== 'undefined' ) {
5108					$elCarousel.trigger('refreshed');
5109					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5110						UNCODE.setRowHeight($owlInsideEqual[i]);
5111					};
5112				}
5113			});
5114
5115			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
5116				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5117					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
5118					$('#' + carousel_id).find('.owl-item').each( function() {
5119						var $item = $(this),
5120							index = ( $item.index() + 1 );
5121						$item.attr('data-index', index);
5122					});
5123				}
5124			});
5125
5126			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5127				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
5128					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5129						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
5130						$('#' + carousel_id).find('.owl-item').each( function() {
5131							var $item = $(this),
5132								index = ( $item.index() + 1 );
5133							$item.attr('data-index', index);
5134						});
5135					}
5136				});
5137			}
5138
5139		});
5140
5141		function firstLoaded(el, event) {
5142			var el = $(el),
5143			uncode_slider = el.find('.uncode-slider');
5144			el.find('.owl-carousel').css('opacity', 1);
5145			uncode_slider.addClass('slider-loaded');
5146			if (typeof UNCODE.bigText !== 'undefined') {
5147				UNCODE.bigText(el.find('.owl-item.active'));
5148			}
5149			//if (!UNCODE.isMobile) {
5150				requestTimeout(function() {
5151					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
5152					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
5153					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
5154						if (lastDelayElems == undefined) lastDelayElems = 0;
5155						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5156						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5157						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5158						requestTimeout(function() {
5159							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5160						}, maxDelay);
5161					}
5162				}, 500);
5163
5164			//}
5165		}
5166
5167		function navHover(el) {
5168			var $owlCont = el,
5169				$owlPrev = $owlCont.find('.owl-prev'),
5170				$owlNext = $owlCont.find('.owl-next'),
5171				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5172				$owlPagination = $owlCont.next(),
5173				owlPrevW = $owlPrev.outerWidth(),
5174				owlNextW = $owlNext.outerWidth(),
5175				owlDotsH = $owlDots.innerHeight(),
5176				owlTime = 400,
5177				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5178			if ( $('body').hasClass('rtl') ) {
5179				$owlPrev.css("margin-right", -owlPrevW);
5180				$owlNext.css("margin-left", -owlNextW);
5181			} else {
5182				$owlPrev.css("margin-left", -owlPrevW);
5183				$owlNext.css("margin-right", -owlNextW);
5184			}
5185			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5186			$owlCont.mouseenter(function() {
5187				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5188				$owlPrev.add($owlNext).css({
5189					marginLeft: 0,
5190					marginRight: 0
5191				});
5192				if (!owlNested) {
5193					$owlDots.css({
5194						opacity: 1,
5195						bottom: 0
5196					});
5197				}
5198			}).mouseleave(function() {
5199				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5200				if ( $('body').hasClass('rtl') ) {
5201					$owlPrev.css("margin-right", -owlPrevW);
5202					$owlNext.css("margin-left", -owlNextW);
5203				} else {
5204					$owlPrev.css("margin-left", -owlPrevW);
5205					$owlNext.css("margin-right", -owlNextW);
5206				}
5207				if (!owlNested) {
5208					$owlDots.css({
5209						opacity: 1,
5210						bottom: -owlDotsH
5211					});
5212				}
5213			});
5214		};
5215
5216		function animate_elems($this) {
5217			var lastDelay;
5218			$.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) {
5219				var element = $(val),
5220					delayAttr = element.attr('data-delay'),
5221					$first_item = element.closest('.owl-item[data-index="1"]');
5222
5223				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5224					return false;
5225				}
5226
5227				if (delayAttr == undefined) delayAttr = 0;
5228				requestTimeout(function() {
5229					element.addClass('start_animation');
5230				}, delayAttr);
5231				lastDelay = delayAttr;
5232			});
5233			return lastDelay;
5234		}
5235
5236		function animate_thumb(items, event) {
5237			var lastDelay,
5238				itemIndex,
5239				thiis = $(event.currentTarget),
5240				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5241				numActives = $('.owl-item.active', thiis).length,
5242				stagePadding = thiis.data('stagepadding');
5243
5244			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5245
5246			thiis.data('tempIndex', event.item.index);
5247				$.each(items, function(index, val) {
5248					var parent = $(val).closest('.owl-item');
5249					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5250						return;
5251					}
5252					if (!$(val).hasClass('start_animation')) {
5253						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5254							var thumbInView = new Waypoint.Inview({
5255							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5256							  element: val,
5257							  enter: function(direction) {
5258								var element = $(this.element),
5259										delayAttr = parseInt(element.attr('data-delay')),
5260										itemIndex = element.closest('.owl-item').index() + 1,
5261										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5262										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5263									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5264										diffItem = menuIndex;
5265									} else {
5266										if (itemIndex > tempIndex) {
5267											thiis.data('tempIndex', itemIndex);
5268										}
5269									}
5270									if (isNaN(delayAttr)) delayAttr = 100;
5271									if (stagePadding) {
5272										var objTimeout = requestTimeout(function() {
5273											if ( !element.closest('.overlay:not(.open)').length ) {
5274												element.addClass('start_animation');
5275											}
5276										}, index * delayAttr);
5277										lastDelay = index * delayAttr;
5278									} else {
5279										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5280										var objTimeout = requestTimeout(function() {
5281											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5282										}, diffItem * delayAttr);
5283										lastDelay = diffItem * delayAttr;
5284									}
5285									parent.data('objTimeout', objTimeout);
5286									if (!UNCODE.isUnmodalOpen) {
5287										this.destroy();
5288									}
5289								}
5290							});
5291						}
5292					}
5293				});
5294				return lastDelay;
5295			}
5296
5297		function setItemsHeight(item) {
5298			$.each($('.owl-item', item), function(index, val) {
5299				var availableThumbHeight = $('.t-inside', $(val)).height(),
5300				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5301				difference = availableThumbHeight - innerThumbHeight;
5302				if ($('.tmb-content-under', val).length) {
5303					var visualPart = $('.t-entry-visual', val);
5304					if (visualPart.length) {
5305						difference -= $('.t-entry-visual', val).height();
5306					}
5307				}
5308				if (! $('.tmb-content-lateral', val).length)
5309					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5310			});
5311		}
5312
5313		function setItemsRelHeight(item) {
5314			$.each($('.owl-item', item), function(index, val) {
5315				var $rowContainer = $(item).parents('.row-parent').eq(0),
5316					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5317					$colContainer = $(item).parents('.uncell').eq(0),
5318					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5319					winHeight = UNCODE.wheight,
5320					multiplier_h = parseInt($(item).attr('data-vp-height')),
5321					data_viewport_h,
5322					consider_menu = $(item).data('vp-menu');
5323
5324				if ( consider_menu ) {
5325					winHeight = winHeight - UNCODE.menuHeight;
5326				}
5327
5328				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5329				$('.t-inside', val).css( 'height', data_viewport_h );
5330			});
5331		}
5332
5333		function pauseOnHover(slider) {
5334			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5335			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5336				mouseenter: function () {
5337					$(slider).addClass('owl-mouseenter');
5338					$(slider).trigger('stop.owl.autoplay');
5339				},
5340				mouseleave: function () {
5341					$(slider).removeClass('owl-mouseenter');
5342					$(slider).trigger('play.owl.autoplay');
5343				}
5344			});
5345		}
5346	});
5347};
5348
5349UNCODE.owlPlayVideo = function(carousel) {
5350	var player, iframe;
5351	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5352		var content = $(val).html();
5353		if (content == '') {
5354			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5355			$(val).append(getCloned);
5356		}
5357		if ($(this).attr('data-provider') == 'vimeo') {
5358			iframe = $(this).find('iframe');
5359			player = new Vimeo.Player(iframe[0]);
5360			player.play();
5361		} else if ($(this).attr('data-provider') == 'youtube') {
5362			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5363		} else {
5364			var player = $(this).find('video');
5365			if (player.length) {
5366				$(this).find('video')[0].volume = 0;
5367				$(this).find('video')[0].play();
5368				$(val).css('opacity', 1);
5369			}
5370		}
5371	});
5372};
5373
5374UNCODE.owlStopVideo = function(carousel) {
5375	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5376		var player, iframe;
5377		if ($(this).attr('data-provider') == 'vimeo') {
5378			iframe = $(this).find('iframe');
5379			player = new Vimeo.Player(iframe[0]);
5380			player.pause();
5381		} else if ($(this).attr('data-provider') == 'youtube') {
5382			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5383		} else {
5384			var player = $(this).find('video');
5385			if (player.length) {
5386				$(this).find('video')[0].volume = 0;
5387				$(this).find('video')[0].play();
5388			}
5389		}
5390	});
5391};
5392
5393UNCODE.animations = function() {
5394
5395	var runWaypoints_TO,
5396		runWaypoints_carousel_TO,
5397		runWaypoints_delay = 0,
5398	highlightComplexFunc = function($wrap, ev){
5399
5400		var $lines = $('.heading-line-wrap', $wrap),
5401			not_animate = false;
5402
5403		if ( $wrap.data('animate') === true ) {
5404			not_animate = true;
5405		}
5406
5407		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5408		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5409			return;
5410		}
5411
5412		$lines.each(function(_key, _value){
5413			var $line = $(_value),
5414				$inners = $('.split-word-inner', $line),
5415				$highlights = $('.heading-text-highlight-inner', $line);
5416
5417			var highlitInnerFunc = function(ev){
5418				var delay = 0;
5419				$highlights.each(function(h_key, high){
5420					var $highlight = $(high),
5421						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5422						$nextSplit = $split.nextUntil(),
5423						$next = $('.heading-text-highlight-inner', $nextSplit),
5424						countCh = $split.text().length;
5425
5426					$highlight.css({
5427						'-webkit-transition-duration': (30 * countCh) + 'ms',
5428						'-moz-transition-duration': (30 * countCh) + 'ms',
5429						'-o-transition-duration': (30 * countCh) + 'ms',
5430						'transition-duration': (30 * countCh) + 'ms',
5431					});
5432
5433					delay += (30 * countCh);
5434
5435					$next.css({
5436						'-webkit-transition-delay': delay + 'ms',
5437						'-moz-transition-delay': delay + 'ms',
5438						'-o-transition-delay': delay + 'ms',
5439						'transition-delay': delay + 'ms',
5440					});
5441				});
5442				$highlights.removeAttr('data-animated');
5443				if ( _key+1 === $lines.length ) {
5444					$wrap.data('animate', true);
5445				}
5446			};
5447
5448			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5449				if ( not_animate ) {
5450					$highlights.each(function(h_key, high){
5451						var $highlight = $(high);
5452						$highlight.css({
5453							'-webkit-transition-duration': '0ms',
5454							'-moz-transition-duration': '0ms',
5455							'-o-transition-duration': '0ms',
5456							'transition-duration': '0ms',
5457						});
5458					});
5459					$highlights.removeAttr('data-animated');
5460				} else {
5461					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5462						highlitInnerFunc();
5463					} else {
5464						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5465					}
5466				}
5467			}
5468		});
5469	};
5470
5471	$.each($('.header-content-inner'), function(index, val) {
5472		var element = $(val),
5473			transition = '';
5474		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5475		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5476		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5477		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5478		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5479		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5480		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5481		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5482		if (transition != '') {
5483			$(val).removeClass(transition);
5484			var container = element,
5485				containerDelay = container.attr('data-delay'),
5486				containerSpeed = container.attr('data-speed'),
5487				items = $('.header-title > *, .post-info', container);
5488			$.each(items, function(index, val) {
5489				var element = $(val),
5490					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5491					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5492				if (!element.hasClass('animate_when_almost_visible') && !element.hasClass('translate_when_almost_visible')) {
5493					delayAttr = Number(delayAttr) + (400 * index);
5494					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5495					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5496				}
5497			});
5498			container.css('opacity', 1);
5499		}
5500	});
5501
5502	function animate_css_grids_on_load() {
5503		$('.cssgrid-system').each(function() {
5504			var grid = $(this);
5505			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5506			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5507		});
5508	}
5509
5510	var delayAdd = 0;
5511
5512	window.waypoint_animation = function(ev) {
5513		$.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(){
5514				var $el = $(this);
5515				if (!$el.is('[data-delay-seq]')) return true;
5516				return $el.is('[data-delay]');
5517			}), function(index, val) {
5518			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 ) ) {
5519				return true;
5520			}
5521			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5522				return;
5523			}
5524			var run = true,
5525				$carousel = $(val).closest('.owl-carousel'),
5526				marquee = $(val).closest('.tmb-linear').length;
5527			if ( $carousel.length ) {
5528				run = false;
5529			}
5530			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5531				run = false;
5532			}
5533			if (run) {
5534				new Waypoint({
5535					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5536					element: val,
5537					handler: function() {
5538						var element = $(this.element),
5539							index = element.index(),
5540							delayAttr = element.attr('data-delay');
5541						if (delayAttr == undefined) delayAttr = 0;
5542						// delayAttr = parseFloat(delayAttr) + delayAdd;
5543						// if ( marquee ) {
5544						// 	delayAdd += 50;
5545						// } else {
5546						// 	delayAdd = 0;
5547						// }
5548						requestTimeout(function() {
5549							element.addClass('start_animation');
5550						}, delayAttr);
5551						if (!UNCODE.isUnmodalOpen) {
5552							this.destroy();
5553						}
5554					},
5555					offset: UNCODE.isFullPage ? '100%' : '90%'
5556				});
5557			}
5558		});
5559		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5560			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5561				return;
5562			}
5563			var run = true,
5564				$carousel = $(val).closest('.owl-carousel');
5565			if ( $carousel.length ) {
5566				run = false;
5567			}
5568			if (run) {
5569				new Waypoint({
5570					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5571					element: val,
5572					handler: function() {
5573						var $element = $(this.element),
5574							$childs = $('.animate_when_parent_almost_visible', $element);
5575						$childs.each(function(key,el){
5576							var $child = $(el),
5577								delaySpeed = $child.attr('data-speed'),
5578								delayAttr = $child.attr('data-delay'),
5579								intervalAttr = $child.attr('data-interval');
5580							if (delayAttr == undefined) {
5581								delayAttr = 50*key;
5582							}
5583							requestTimeout(function() {
5584								$child.addClass('start_animation');
5585								if ( $child.hasClass('anim-line-checker') ) {
5586									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5587										var $line = $child.closest('.heading-line-wrap');
5588									});
5589								}
5590								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5591								highlightComplexFunc($wrapText, ev);
5592								if ( $child.hasClass('anim-tot-checker') ) {
5593									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5594										if ( $child.hasClass('anim-tot-checker') ) {
5595											$wrapText.addClass('already-animated');
5596											$element.trigger('already-animated');
5597										}
5598									});
5599								}
5600							}, delayAttr );
5601						});
5602						$element.addClass('start_animation');
5603						if (!UNCODE.isUnmodalOpen) {
5604							this.destroy();
5605						}
5606					},
5607					offset: UNCODE.isFullPage ? '100%' : '90%'
5608				});
5609			}
5610		});
5611	}
5612	window.waypoint_carousel_animation = function(ev) {
5613		$.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) {
5614			if ( $(val).hasClass('el-text-split') ) {
5615				return true;
5616			}
5617			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5618				return;
5619			}
5620			var run = true,
5621				$carousel = $(val).closest('.owl-carousel'),
5622				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5623				$all_first = $('.owl-item[data-index="1"]', $carousel);
5624			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5625				run = false;
5626			}
5627			if (run) {
5628				new Waypoint({
5629					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5630					element: val,
5631					handler: function() {
5632						var element = $(this.element),
5633							index = element.index(),
5634							delayAttr = element.attr('data-delay');
5635						if (delayAttr == undefined) delayAttr = 0;
5636						requestTimeout(function() {
5637							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5638								$all_first.attr('data-already-reached', 'true');
5639							}
5640							element.addClass('start_animation');
5641						}, delayAttr);
5642						if (!UNCODE.isUnmodalOpen) {
5643							this.destroy();
5644						}
5645					},
5646					offset: UNCODE.isFullPage ? '100%' : '90%'
5647				});
5648			}
5649		});
5650		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5651			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5652				return;
5653			}
5654			var run = true,
5655				$carousel = $(val).closest('.owl-carousel'),
5656				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5657				$all_first = $('.owl-item[data-index="1"]', $carousel);
5658			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5659				run = false;
5660			}
5661			if (run) {
5662				new Waypoint({
5663					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5664					element: val,
5665					handler: function() {
5666						var $element = $(this.element),
5667							$childs = $('.animate_when_parent_almost_visible', $element);
5668						$childs.each(function(key,el){
5669							var $child = $(el),
5670								delaySpeed = $child.attr('data-speed'),
5671								delayAttr = $child.attr('data-delay'),
5672								intervalAttr = $child.attr('data-interval');
5673							if (delayAttr == undefined) {
5674								delayAttr = 50*key;
5675							}
5676							requestTimeout(function() {
5677								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5678									$all_first.attr('data-already-reached', 'true');
5679								}
5680								$child.addClass('start_animation');
5681								if ( $child.hasClass('anim-line-checker') ) {
5682									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5683										var $line = $child.closest('.heading-line-wrap');
5684									});
5685								}
5686								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5687								highlightComplexFunc($wrapText, ev);
5688								if ( $child.hasClass('anim-tot-checker') ) {
5689									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5690										if ( $child.hasClass('anim-tot-checker') ) {
5691											$wrapText.addClass('already-animated');
5692										}
5693									});
5694								}
5695							}, delayAttr );
5696						});
5697						$element.addClass('start_animation');
5698						if (!UNCODE.isUnmodalOpen) {
5699							this.destroy();
5700						}
5701					},
5702					offset: UNCODE.isFullPage ? '100%' : '90%'
5703				});
5704			}
5705		});
5706	}
5707
5708	var runWaypoints = function(ev){
5709		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5710			runWaypoints_delay = 400;
5711		}
5712		clearRequestTimeout(runWaypoints_TO);
5713		runWaypoints_TO = requestTimeout(function() {
5714			window.waypoint_animation(ev);
5715		}, runWaypoints_delay);
5716
5717		clearRequestTimeout(runWaypoints_carousel_TO);
5718		runWaypoints_carousel_TO = requestTimeout(function() {
5719			window.waypoint_carousel_animation(ev);
5720		}, 400);
5721	};
5722	runWaypoints();
5723	animate_css_grids_on_load();
5724
5725	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5726		runWaypoints(ev);
5727	});
5728	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5729		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5730		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5731	}
5732};
5733
5734UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5735	var $allItems = elements.length - startIndex,
5736		showed = 0,
5737		index = 0,
5738		use_index = false
5739		;
5740
5741	if (filtering) {
5742		if (sequential) {
5743			use_index = true;
5744		}
5745		sequential = false;
5746	}
5747
5748	$.each(elements, function(index, val) {
5749		var $this = $(val),
5750			elInner = $('> .t-inside', val);
5751
5752		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5753			return;
5754		}
5755		if (val[0]) val = val[0];
5756
5757		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5758			new Waypoint({
5759				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5760				element: val,
5761				handler: function() {
5762					var element = $('> .t-inside', this.element),
5763						parent = $(this.element);
5764					var _index = use_index? index : 0;
5765
5766					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5767						delayAttr = parseInt(element.attr('data-delay'));
5768					if (isNaN(delayAttr)) delayAttr = 100;
5769					if (sequential || use_index) {
5770						delay -= showed;
5771					}
5772					var objTimeout = requestTimeout(function() {
5773						element.removeClass('zoom-reverse').addClass('start_animation');
5774						showed = index;
5775					}, delay * delayAttr);
5776					parent.data('objTimeout', objTimeout);
5777					if (!UNCODE.isUnmodalOpen) {
5778						this.destroy();
5779					}
5780				},
5781				offset: UNCODE.isFullPage ? '100%' : '90%'
5782			});
5783		}
5784
5785		index++;
5786	});
5787};
5788
5789UNCODE.tapHover = function() {
5790
5791	var isTouch = (
5792		'ontouchstart' in window ||
5793		navigator.maxTouchPoints > 0 ||
5794		navigator.msMaxTouchPoints > 0
5795	);
5796
5797	if (isTouch) {
5798		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5799			elClass = "hover";
5800
5801		$(window).on('click', function() {
5802			$el.removeClass(elClass);
5803		});
5804
5805		$el.on('click', function(e) {
5806			e.stopPropagation();
5807			var link = $(this);
5808			if ( ! link.hasClass(elClass)) {
5809				e.preventDefault();
5810				link.addClass("hover");
5811				$el.not(this).removeClass(elClass);
5812				return false;
5813			}
5814		});
5815	}
5816};
5817
5818UNCODE.onePage = function(isMobile) {
5819	var current = 0,
5820		last = 0,
5821		lastScrollTop = 0,
5822		forceScroll = false,
5823		lastScrolled = 0,
5824		isSectionscroller = ($('.main-onepage').length) ? true : false,
5825		isOnePage = false,
5826		getOffset = function () {
5827			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);
5828			return calculateOffset;
5829		}
5830
5831	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5832
5833	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5834	// 	return false;
5835
5836	function init_onepage() {
5837		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5838			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5839		}
5840		last = $('.onepage-pagination li').last().find('a').data('index');
5841		$.each($('div[data-parent="true"]'), function(index, val) {
5842			$(this).attr('data-section', index);
5843			if (isMobile) return;
5844			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5845				return;
5846			}
5847			var sectionDown = new Waypoint({
5848				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5849				element: val,
5850				handler: function(direction) {
5851					if (direction == 'down') {
5852						changeMenuActive(this.element, index);
5853					}
5854				},
5855				offset: function() {
5856					return 5 + getOffset()
5857				}
5858			});
5859			var sectionUp = new Waypoint({
5860				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5861				element: val,
5862				handler: function(direction) {
5863					if (direction == 'up') {
5864						changeMenuActive(this.element, index);
5865					}
5866				},
5867				offset: function() {
5868					return -5 - getOffset()
5869				}
5870			});
5871
5872			if (isSectionscroller) {
5873				var label;
5874				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5875				else label = '';
5876				var getName = $(this).attr('data-name');
5877				if (getName == undefined) getName = index;
5878				if (label != '') {
5879					isOnePage = true;
5880					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5881					$('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>");
5882				}
5883			}
5884		});
5885
5886		if (isSectionscroller) {
5887			$.each($('ul.onepage-pagination li'), function(index, val) {
5888				var $this = $(val),
5889					$a = ('a', $this);
5890				$a.on('click', function(evt) {
5891					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5892						return false;
5893					}
5894					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5895						evt.preventDefault();
5896					}
5897					Waypoint.refreshAll();
5898					var el = $('a', evt.currentTarget);
5899					current = lastScrolled = parseInt(el.attr('data-index'));
5900					lastScrolled += 1;
5901					scrollBody(current);
5902				});
5903			});
5904		}
5905
5906		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5907		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5908			goToSection = String(window.location.hash).replace(/^#/, "");
5909			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5910		}
5911
5912		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5913			current = lastScrolled = goToSection;
5914			$(window).on('load', function(){
5915				if ( $('.owl-carousel').length ) {
5916					requestTimeout(function(){
5917						scrollBody(goToSection);
5918					}, 400);
5919				} else {
5920					scrollBody(goToSection);
5921				}
5922			});
5923		}
5924
5925	}
5926
5927	function changeMenuActive(section, index) {
5928		current = lastScrolled = parseInt($(section).attr('data-section'));
5929		if (isOnePage) {
5930			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5931			if (newSection.length) {
5932				$('ul.onepage-pagination li a').removeClass('is-selected');
5933				newSection.addClass('is-selected');
5934			}
5935			var getName = $('[data-section="' + index + '"]').attr('data-name');
5936			if (getName != undefined && getName !== '') {
5937				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5938					var get_href = $(val).attr('href');
5939					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5940						$(val).closest('.menu-smart').find('.active').removeClass('active');
5941						$(val).parent().addClass('active');
5942					}
5943				});
5944			}
5945		}
5946	}
5947
5948	if (isOnePage) {
5949		$(window).on('scroll', function() {
5950			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5951			if (bodyTop == 0) {
5952				$('ul.onepage-pagination li a').removeClass('is-selected');
5953				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5954				var getName = $('[data-section=0]').attr('data-name');
5955				if (getName != undefined && getName !== '') {
5956					$.each($('.menu-container .menu-item > a'), function(i, val) {
5957						var get_href = $(val).attr('href');
5958						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5959							$(val).closest('ul').find('.active').removeClass('active');
5960							$(val).parent().addClass('active');
5961						}
5962					});
5963				}
5964			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5965				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5966				if (lastSection.length) {
5967					$('ul.onepage-pagination li a').removeClass('is-selected');
5968					lastSection.addClass('is-selected');
5969				}
5970			}
5971		});
5972	}
5973
5974	var scrollBody = function(index) {
5975		$('ul.onepage-pagination li a').removeClass('is-selected');
5976		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5977
5978		var getSection = $('[data-section=' + index + ']'),
5979			scrollTo;
5980
5981		if (getSection == undefined) return;
5982
5983		var body = $("html, body"),
5984			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5985			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5986			getOffset = UNCODE.get_scroll_offset(index);
5987		if ( typeof getSection.offset() === 'undefined' )
5988			return;
5989		scrollTo = getSection.offset().top;
5990
5991		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5992		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5993			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5994			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5995				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5996			}
5997
5998			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5999				if ( index === 0 ) {
6000					scrollTo = 0;
6001				} else {
6002					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
6003				}
6004			} else {
6005				scrollTo -= getOffset;
6006			}
6007		}
6008
6009		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6010		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6011
6012		if (index != 0) {
6013			UNCODE.scrolling = true;
6014		}
6015
6016		if (scrollSpeed == 0) {
6017			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6018			UNCODE.scrolling = false;
6019		} else {
6020			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6021				$(this).stop();
6022			}).animate({
6023				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6024			}, scrollSpeed, 'easeInOutCubic', function() {
6025				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6026				UNCODE.scrolling = false;
6027				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
6028				||
6029				$('.menu-hided').length ) {
6030					scrollTo = getSection.offset().top;
6031					getOffset = UNCODE.get_scroll_offset(index);
6032					scrollTo -= getOffset;
6033					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6034						$(this).stop();
6035					}).animate({
6036						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6037						}, scrollSpeed, 'easeInOutCubic', function() {
6038							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6039							UNCODE.scrolling = false;
6040						}
6041					);
6042				}
6043			});
6044		}
6045
6046	};
6047
6048	init_onepage();
6049};
6050
6051UNCODE.stickyElements = function() {
6052	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
6053	if (!isMobile_wide ) {
6054
6055		var $pageHeader = $('#page-header'),
6056			$headerRow = $('.vc_row', $pageHeader),
6057			$headerSection = $headerRow.closest('section[data-parent]'),
6058			startSticky = false;
6059
6060		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
6061			$headerRow.removeClass('sticky-element');
6062			$pageHeader.addClass('sticky-element');
6063			startSticky = true;
6064		}
6065
6066		var calculateOffset = function(el) {
6067			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
6068				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
6069				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
6070				elTop = window.pageYOffset + el.getBoundingClientRect().top;
6071
6072			sideOffset += UNCODE.bodyBorder;
6073
6074			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
6075			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
6076				if ($('.menu-shrink').length) {
6077					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
6078				} else {
6079					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
6080				}
6081			}
6082
6083			return sideOffset;
6084
6085		},
6086
6087		initStickyElement = function($els) {
6088			if ( $('body').hasClass('vc-safe-mode') ) {
6089				return true;
6090			}
6091			if ( typeof $els === 'undefined' ) {
6092				$els = $('.sticky-element');
6093			}
6094			$.each($els, function(index, element) {
6095				if ($(element).closest('.tab-pane').length) {
6096					var $paneParent = $(element).closest('.tab-pane');
6097					if ( !$paneParent.hasClass('active') ) {
6098						return true;
6099					}
6100				}
6101				$(element).stick_in_parent({
6102					sticky_class: 'is_stucked',
6103					offset_top: calculateOffset(element),
6104					bottoming: true,
6105					inner_scrolling: SiteParameters.sticky_elements === 'on'
6106				});
6107			});
6108		};
6109
6110		var oldW = UNCODE.wwidth,
6111			oldH = UNCODE.wHeight;
6112
6113		requestTimeout(function() {
6114			if ($('.sticky-element').length) {
6115
6116				if ($(window).width() > UNCODE.mediaQuery) {
6117					initStickyElement();
6118
6119					if ( startSticky === true ) {
6120						$('#page-header').trigger('sticky_kit:recalc');
6121					}
6122				}
6123
6124				$(window).on('resize lateral_resize', function(event) {
6125					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
6126						$(".sticky-element").trigger("sticky_kit:detach");
6127						if ($(window).width() > UNCODE.mediaQuery) {
6128							initStickyElement();
6129						}
6130						oldW = UNCODE.wwidth;
6131						oldH = UNCODE.wHeight;
6132					}
6133				});
6134			}
6135		}, 1000);
6136
6137		if ($('.sticky-element').length) {
6138			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
6139				requestTimeout(function() {
6140					$(document.body).trigger("sticky_kit:recalc");
6141				}, 100);
6142			});
6143		}
6144
6145		var $panels = $('.panel-collapse');
6146		if ( $panels.length ) {
6147			$panels.each(function(){
6148				var $panel = $(this);
6149				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
6150					$(document.body).trigger("sticky_kit:recalc");
6151				});
6152			});
6153		}
6154
6155		$('.nav-tabs a').on('shown.bs.tab', function(e){
6156			var $tabs = $(e.target).closest('.tab-container'),
6157				$panel = $('.tab-pane.active', $tabs),
6158				$els = $(e.target).nextAll(".sticky-element");
6159
6160			$els.trigger("sticky_kit:detach");
6161			initStickyElement($els);
6162		});
6163
6164		$(window).on('vc-safe-mode-on', function(){
6165			$(".sticky-element").trigger("sticky_kit:detach");
6166		});
6167
6168		$(window).on('vc-safe-mode-off', function(){
6169			initStickyElement();
6170		});
6171	}
6172};
6173
6174UNCODE.twentytwenty = function() {
6175
6176  if (!$('.twentytwenty-container').length) return;
6177
6178// DOM.event.move
6179//
6180// 2.0.0
6181//
6182// Stephen Band
6183//
6184// Triggers 'movestart', 'move' and 'moveend' events after
6185// mousemoves following a mousedown cross a distance threshold,
6186// similar to the native 'dragstart', 'drag' and 'dragend' events.
6187// Move events are throttled to animation frames. Move event objects
6188// have the properties:
6189//
6190// pageX:
6191// pageY:     Page coordinates of pointer.
6192// startX:
6193// startY:    Page coordinates of pointer at movestart.
6194// distX:
6195// distY:     Distance the pointer has moved since movestart.
6196// deltaX:
6197// deltaY:    Distance the finger has moved since last event.
6198// velocityX:
6199// velocityY: Average velocity over last few events.
6200
6201
6202(function(fn) {
6203	if (typeof define === 'function' && define.amd) {
6204        define([], fn);
6205    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6206        module.exports = fn;
6207	} else {
6208		fn();
6209	}
6210})(function(){
6211	var assign = Object.assign || window.jQuery && jQuery.extend;
6212
6213	// Number of pixels a pressed pointer travels before movestart
6214	// event is fired.
6215	var threshold = 8;
6216
6217	// Shim for requestAnimationFrame, falling back to timer. See:
6218	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6219	var requestFrame = (function(){
6220		return (
6221			window.requestAnimationFrame ||
6222			window.webkitRequestAnimationFrame ||
6223			window.mozRequestAnimationFrame ||
6224			window.oRequestAnimationFrame ||
6225			window.msRequestAnimationFrame ||
6226			function(fn, element){
6227				return window.setTimeout(function(){
6228					fn();
6229				}, 25);
6230			}
6231		);
6232	})();
6233
6234	// Shim for customEvent
6235	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6236	(function () {
6237		if ( typeof window.CustomEvent === "function" ) return false;
6238		function CustomEvent ( event, params ) {
6239			params = params || { bubbles: false, cancelable: false, detail: undefined };
6240			var evt = document.createEvent( 'CustomEvent' );
6241			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6242			return evt;
6243		}
6244
6245		CustomEvent.prototype = window.Event.prototype;
6246		window.CustomEvent = CustomEvent;
6247	})();
6248
6249	var ignoreTags = {
6250			textarea: true,
6251			input: true,
6252			select: true,
6253			button: true
6254		};
6255
6256	var mouseevents = {
6257		move:   'mousemove',
6258		cancel: 'mouseup dragstart',
6259		end:    'mouseup'
6260	};
6261
6262	var touchevents = {
6263		move:   'touchmove',
6264		cancel: 'touchend',
6265		end:    'touchend'
6266	};
6267
6268	var rspaces = /\s+/;
6269
6270
6271	// DOM Events
6272
6273	var eventOptions = { bubbles: true, cancelable: true };
6274
6275	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6276
6277	function createEvent(type) {
6278		return new CustomEvent(type, eventOptions);
6279	}
6280
6281	function getEvents(node) {
6282		return node[eventsSymbol] || (node[eventsSymbol] = {});
6283	}
6284
6285	function on(node, types, fn, data, selector) {
6286		types = types.split(rspaces);
6287
6288		var events = getEvents(node);
6289		var i = types.length;
6290		var handlers, type;
6291
6292		function handler(e) { fn(e, data); }
6293
6294		while (i--) {
6295			type = types[i];
6296			handlers = events[type] || (events[type] = []);
6297			handlers.push([fn, handler]);
6298			node.addEventListener(type, handler);
6299		}
6300	}
6301
6302	function off(node, types, fn, selector) {
6303		types = types.split(rspaces);
6304
6305		var events = getEvents(node);
6306		var i = types.length;
6307		var type, handlers, k;
6308
6309		if (!events) { return; }
6310
6311		while (i--) {
6312			type = types[i];
6313			handlers = events[type];
6314			if (!handlers) { continue; }
6315			k = handlers.length;
6316			while (k--) {
6317				if (handlers[k][0] === fn) {
6318					node.removeEventListener(type, handlers[k][1]);
6319					handlers.splice(k, 1);
6320				}
6321			}
6322		}
6323	}
6324
6325	function trigger(node, type, properties) {
6326		// Don't cache events. It prevents you from triggering an event of a
6327		// given type from inside the handler of another event of that type.
6328		var event = createEvent(type);
6329		if (properties) { assign(event, properties); }
6330		node.dispatchEvent(event);
6331	}
6332
6333
6334	// Constructors
6335
6336	function Timer(fn){
6337		var callback = fn,
6338		    active = false,
6339		    running = false;
6340
6341		function trigger(time) {
6342			if (active){
6343				callback();
6344				requestFrame(trigger);
6345				running = true;
6346				active = false;
6347			}
6348			else {
6349				running = false;
6350			}
6351		}
6352
6353		this.kick = function(fn) {
6354			active = true;
6355			if (!running) { trigger(); }
6356		};
6357
6358		this.end = function(fn) {
6359			var cb = callback;
6360
6361			if (!fn) { return; }
6362
6363			// If the timer is not running, simply call the end callback.
6364			if (!running) {
6365				fn();
6366			}
6367			// If the timer is running, and has been kicked lately, then
6368			// queue up the current callback and the end callback, otherwise
6369			// just the end callback.
6370			else {
6371				callback = active ?
6372					function(){ cb(); fn(); } :
6373					fn ;
6374
6375				active = true;
6376			}
6377		};
6378	}
6379
6380
6381	// Functions
6382
6383	function noop() {}
6384
6385	function preventDefault(e) {
6386		e.preventDefault();
6387	}
6388
6389	function isIgnoreTag(e) {
6390		return !!ignoreTags[e.target.tagName.toLowerCase()];
6391	}
6392
6393	function isPrimaryButton(e) {
6394		// Ignore mousedowns on any button other than the left (or primary)
6395		// mouse button, or when a modifier key is pressed.
6396		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6397	}
6398
6399	function identifiedTouch(touchList, id) {
6400		var i, l;
6401
6402		if (touchList.identifiedTouch) {
6403			return touchList.identifiedTouch(id);
6404		}
6405
6406		// touchList.identifiedTouch() does not exist in
6407		// webkit yet… we must do the search ourselves...
6408
6409		i = -1;
6410		l = touchList.length;
6411
6412		while (++i < l) {
6413			if (touchList[i].identifier === id) {
6414				return touchList[i];
6415			}
6416		}
6417	}
6418
6419	function changedTouch(e, data) {
6420		var touch = identifiedTouch(e.changedTouches, data.identifier);
6421
6422		// This isn't the touch you're looking for.
6423		if (!touch) { return; }
6424
6425		// Chrome Android (at least) includes touches that have not
6426		// changed in e.changedTouches. That's a bit annoying. Check
6427		// that this touch has changed.
6428		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6429
6430		return touch;
6431	}
6432
6433
6434	// Handlers that decide when the first movestart is triggered
6435
6436	function mousedown(e){
6437		// Ignore non-primary buttons
6438		if (!isPrimaryButton(e)) { return; }
6439
6440		// Ignore form and interactive elements
6441		if (isIgnoreTag(e)) { return; }
6442
6443		on(document, mouseevents.move, mousemove, e);
6444		on(document, mouseevents.cancel, mouseend, e);
6445	}
6446
6447	function mousemove(e, data){
6448		checkThreshold(e, data, e, removeMouse);
6449	}
6450
6451	function mouseend(e, data) {
6452		removeMouse();
6453	}
6454
6455	function removeMouse() {
6456		off(document, mouseevents.move, mousemove);
6457		off(document, mouseevents.cancel, mouseend);
6458	}
6459
6460	function touchstart(e) {
6461		// Don't get in the way of interaction with form elements
6462		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6463
6464		var touch = e.changedTouches[0];
6465
6466		// iOS live updates the touch objects whereas Android gives us copies.
6467		// That means we can't trust the touchstart object to stay the same,
6468		// so we must copy the data. This object acts as a template for
6469		// movestart, move and moveend event objects.
6470		var data = {
6471			target:     touch.target,
6472			pageX:      touch.pageX,
6473			pageY:      touch.pageY,
6474			identifier: touch.identifier,
6475
6476			// The only way to make handlers individually unbindable is by
6477			// making them unique.
6478			touchmove:  function(e, data) { touchmove(e, data); },
6479			touchend:   function(e, data) { touchend(e, data); }
6480		};
6481
6482		on(document, touchevents.move, data.touchmove, data);
6483		on(document, touchevents.cancel, data.touchend, data);
6484	}
6485
6486	function touchmove(e, data) {
6487		var touch = changedTouch(e, data);
6488		if (!touch) { return; }
6489		checkThreshold(e, data, touch, removeTouch);
6490	}
6491
6492	function touchend(e, data) {
6493		var touch = identifiedTouch(e.changedTouches, data.identifier);
6494		if (!touch) { return; }
6495		removeTouch(data);
6496	}
6497
6498	function removeTouch(data) {
6499		off(document, touchevents.move, data.touchmove);
6500		off(document, touchevents.cancel, data.touchend);
6501	}
6502
6503	function checkThreshold(e, data, touch, fn) {
6504		var distX = touch.pageX - data.pageX;
6505		var distY = touch.pageY - data.pageY;
6506
6507		// Do nothing if the threshold has not been crossed.
6508		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6509
6510		triggerStart(e, data, touch, distX, distY, fn);
6511	}
6512
6513	function triggerStart(e, data, touch, distX, distY, fn) {
6514		var touches = e.targetTouches;
6515		var time = e.timeStamp - data.timeStamp;
6516
6517		// Create a movestart object with some special properties that
6518		// are passed only to the movestart handlers.
6519		var template = {
6520			altKey:     e.altKey,
6521			ctrlKey:    e.ctrlKey,
6522			shiftKey:   e.shiftKey,
6523			startX:     data.pageX,
6524			startY:     data.pageY,
6525			distX:      distX,
6526			distY:      distY,
6527			deltaX:     distX,
6528			deltaY:     distY,
6529			pageX:      touch.pageX,
6530			pageY:      touch.pageY,
6531			velocityX:  distX / time,
6532			velocityY:  distY / time,
6533			identifier: data.identifier,
6534			targetTouches: touches,
6535			finger: touches ? touches.length : 1,
6536			enableMove: function() {
6537				this.moveEnabled = true;
6538				this.enableMove = noop;
6539				e.preventDefault();
6540			}
6541		};
6542
6543		// Trigger the movestart event.
6544		trigger(data.target, 'movestart', template);
6545
6546		// Unbind handlers that tracked the touch or mouse up till now.
6547		fn(data);
6548	}
6549
6550
6551	// Handlers that control what happens following a movestart
6552
6553	function activeMousemove(e, data) {
6554		var timer  = data.timer;
6555
6556		data.touch = e;
6557		data.timeStamp = e.timeStamp;
6558		timer.kick();
6559	}
6560
6561	function activeMouseend(e, data) {
6562		var target = data.target;
6563		var event  = data.event;
6564		var timer  = data.timer;
6565
6566		removeActiveMouse();
6567
6568		endEvent(target, event, timer, function() {
6569			// Unbind the click suppressor, waiting until after mouseup
6570			// has been handled.
6571			setTimeout(function(){
6572				off(target, 'click', preventDefault);
6573			}, 0);
6574		});
6575	}
6576
6577	function removeActiveMouse() {
6578		off(document, mouseevents.move, activeMousemove);
6579		off(document, mouseevents.end, activeMouseend);
6580	}
6581
6582	function activeTouchmove(e, data) {
6583		var event = data.event;
6584		var timer = data.timer;
6585		var touch = changedTouch(e, event);
6586
6587		if (!touch) { return; }
6588
6589		// Stop the interface from gesturing
6590		e.preventDefault();
6591
6592		event.targetTouches = e.targetTouches;
6593		data.touch = touch;
6594		data.timeStamp = e.timeStamp;
6595
6596		timer.kick();
6597	}
6598
6599	function activeTouchend(e, data) {
6600		var target = data.target;
6601		var event  = data.event;
6602		var timer  = data.timer;
6603		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6604
6605		// This isn't the touch you're looking for.
6606		if (!touch) { return; }
6607
6608		removeActiveTouch(data);
6609		endEvent(target, event, timer);
6610	}
6611
6612	function removeActiveTouch(data) {
6613		off(document, touchevents.move, data.activeTouchmove);
6614		off(document, touchevents.end, data.activeTouchend);
6615	}
6616
6617
6618	// Logic for triggering move and moveend events
6619
6620	function updateEvent(event, touch, timeStamp) {
6621		var time = timeStamp - event.timeStamp;
6622
6623		event.distX =  touch.pageX - event.startX;
6624		event.distY =  touch.pageY - event.startY;
6625		event.deltaX = touch.pageX - event.pageX;
6626		event.deltaY = touch.pageY - event.pageY;
6627
6628		// Average the velocity of the last few events using a decay
6629		// curve to even out spurious jumps in values.
6630		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6631		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6632		event.pageX =  touch.pageX;
6633		event.pageY =  touch.pageY;
6634	}
6635
6636	function endEvent(target, event, timer, fn) {
6637		timer.end(function(){
6638			trigger(target, 'moveend', event);
6639			return fn && fn();
6640		});
6641	}
6642
6643
6644	// Set up the DOM
6645
6646	function movestart(e) {
6647		if (e.defaultPrevented) { return; }
6648		if (!e.moveEnabled) { return; }
6649
6650		var event = {
6651			startX:        e.startX,
6652			startY:        e.startY,
6653			pageX:         e.pageX,
6654			pageY:         e.pageY,
6655			distX:         e.distX,
6656			distY:         e.distY,
6657			deltaX:        e.deltaX,
6658			deltaY:        e.deltaY,
6659			velocityX:     e.velocityX,
6660			velocityY:     e.velocityY,
6661			identifier:    e.identifier,
6662			targetTouches: e.targetTouches,
6663			finger:        e.finger
6664		};
6665
6666		var data = {
6667			target:    e.target,
6668			event:     event,
6669			timer:     new Timer(update),
6670			touch:     undefined,
6671			timeStamp: e.timeStamp
6672		};
6673
6674		function update(time) {
6675			updateEvent(event, data.touch, data.timeStamp);
6676			trigger(data.target, 'move', event);
6677		}
6678
6679		if (e.identifier === undefined) {
6680			// We're dealing with a mouse event.
6681			// Stop clicks from propagating during a move
6682			on(e.target, 'click', preventDefault);
6683			on(document, mouseevents.move, activeMousemove, data);
6684			on(document, mouseevents.end, activeMouseend, data);
6685		}
6686		else {
6687			// In order to unbind correct handlers they have to be unique
6688			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6689			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6690
6691			// We're dealing with a touch.
6692			on(document, touchevents.move, data.activeTouchmove, data);
6693			on(document, touchevents.end, data.activeTouchend, data);
6694		}
6695	}
6696
6697	on(document, 'mousedown', mousedown);
6698	on(document, 'touchstart', touchstart);
6699	on(document, 'movestart', movestart);
6700
6701
6702	// jQuery special events
6703	//
6704	// jQuery event objects are copies of DOM event objects. They need
6705	// a little help copying the move properties across.
6706
6707	if (!window.jQuery) { return; }
6708
6709	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6710
6711	function enableMove1(e) { e.enableMove(); }
6712	function enableMove2(e) { e.enableMove(); }
6713	function enableMove3(e) { e.enableMove(); }
6714
6715	function add(handleObj) {
6716		var handler = handleObj.handler;
6717
6718		handleObj.handler = function(e) {
6719			// Copy move properties across from originalEvent
6720			var i = properties.length;
6721			var property;
6722
6723			while(i--) {
6724				property = properties[i];
6725				e[property] = e.originalEvent[property];
6726			}
6727
6728			handler.apply(this, arguments);
6729		};
6730	}
6731
6732	jQuery.event.special.movestart = {
6733		setup: function() {
6734			// Movestart must be enabled to allow other move events
6735			on(this, 'movestart', enableMove1);
6736
6737			// Do listen to DOM events
6738			return false;
6739		},
6740
6741		teardown: function() {
6742			off(this, 'movestart', enableMove1);
6743			return false;
6744		},
6745
6746		add: add
6747	};
6748
6749	jQuery.event.special.move = {
6750		setup: function() {
6751			on(this, 'movestart', enableMove2);
6752			return false;
6753		},
6754
6755		teardown: function() {
6756			off(this, 'movestart', enableMove2);
6757			return false;
6758		},
6759
6760		add: add
6761	};
6762
6763	jQuery.event.special.moveend = {
6764		setup: function() {
6765			on(this, 'movestart', enableMove3);
6766			return false;
6767		},
6768
6769		teardown: function() {
6770			off(this, 'movestart', enableMove3);
6771			return false;
6772		},
6773
6774		add: add
6775	};
6776});
6777
6778  $.fn.twentytwenty = function(options) {
6779    var options = $.extend({
6780      default_offset_pct: 0.5,
6781      orientation: 'horizontal',
6782      before_label: 'Before',
6783      after_label: 'After',
6784      no_overlay: false,
6785      move_slider_on_hover: false,
6786      move_with_handle_only: true,
6787      click_to_move: false
6788    }, options);
6789
6790    return this.each(function() {
6791
6792      var sliderPct = options.default_offset_pct;
6793      var container = $(this);
6794      var sliderOrientation = options.orientation;
6795      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6796      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6797
6798
6799      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6800      if(!options.no_overlay) {
6801        container.append("<div class='twentytwenty-overlay'></div>");
6802        var overlay = container.find(".twentytwenty-overlay");
6803        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6804        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6805      }
6806      var beforeImg = container.find("img:first");
6807      var afterImg = container.find("img:last");
6808      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6809      var slider = container.find(".twentytwenty-handle");
6810      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6811      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6812      container.addClass("twentytwenty-container");
6813      beforeImg.addClass("twentytwenty-before");
6814      afterImg.addClass("twentytwenty-after");
6815
6816      var calcOffset = function(dimensionPct) {
6817        var w = beforeImg.width();
6818        var h = beforeImg.height();
6819        return {
6820          w: w+"px",
6821          h: h+"px",
6822          cw: (dimensionPct*w)+"px",
6823          ch: (dimensionPct*h)+"px"
6824        };
6825      };
6826
6827      var adjustContainer = function(offset) {
6828      	if (sliderOrientation === 'vertical') {
6829          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6830          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6831      	}
6832      	else {
6833          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6834          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6835    	}
6836        container.css("height", offset.h);
6837      };
6838
6839      var adjustSlider = function(pct) {
6840        var offset = calcOffset(pct);
6841        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6842        adjustContainer(offset);
6843      };
6844
6845      // Return the number specified or the min/max number if it outside the range given.
6846      var minMaxNumber = function(num, min, max) {
6847        return Math.max(min, Math.min(max, num));
6848      };
6849
6850      // Calculate the slider percentage based on the position.
6851      var getSliderPercentage = function(positionX, positionY) {
6852        var sliderPercentage = (sliderOrientation === 'vertical') ?
6853          (positionY-offsetY)/imgHeight :
6854          (positionX-offsetX)/imgWidth;
6855
6856        return minMaxNumber(sliderPercentage, 0, 1);
6857      };
6858
6859
6860      $(window).on("resize.twentytwenty", function(e) {
6861        adjustSlider(sliderPct);
6862      });
6863
6864      var offsetX = 0;
6865      var offsetY = 0;
6866      var imgWidth = 0;
6867      var imgHeight = 0;
6868      var onMoveStart = function(e) {
6869        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6870          e.preventDefault();
6871        }
6872        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6873          e.preventDefault();
6874        }
6875        container.addClass("active");
6876        offsetX = container.offset().left;
6877        offsetY = container.offset().top;
6878        imgWidth = beforeImg.width();
6879        imgHeight = beforeImg.height();
6880      };
6881      var onMove = function(e) {
6882        if (container.hasClass("active")) {
6883          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6884          adjustSlider(sliderPct);
6885        }
6886      };
6887      var onMoveEnd = function() {
6888          container.removeClass("active");
6889      };
6890
6891      var moveTarget = options.move_with_handle_only ? slider : container;
6892      moveTarget.on("movestart",onMoveStart);
6893      moveTarget.on("move",onMove);
6894      moveTarget.on("moveend",onMoveEnd);
6895
6896      if (options.move_slider_on_hover) {
6897        container.on("mouseenter", onMoveStart);
6898        container.on("mousemove", onMove);
6899        container.on("mouseleave", onMoveEnd);
6900      }
6901
6902      slider.on("touchmove", function(e) {
6903        e.preventDefault();
6904      });
6905
6906      container.find("img").on("mousedown", function(event) {
6907        event.preventDefault();
6908      });
6909
6910      if (options.click_to_move) {
6911        container.on('click', function(e) {
6912          offsetX = container.offset().left;
6913          offsetY = container.offset().top;
6914          imgWidth = beforeImg.width();
6915          imgHeight = beforeImg.height();
6916
6917          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6918          adjustSlider(sliderPct);
6919        });
6920      }
6921
6922      $(window).trigger("resize.twentytwenty");
6923    });
6924  };
6925
6926
6927  $(window).on("load", function(e) {
6928  	$('.twentytwenty-container').each(function(){
6929  		var $container = $(this);
6930  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6931  			$container.twentytwenty();
6932  		}
6933  		$('img', $container).on('async-done', function(){
6934	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6935	  			$container.twentytwenty();
6936	  		}
6937	    });
6938  	});
6939  });
6940}
6941
6942UNCODE.justifiedGallery = function() {
6943
6944	var breakPointMe = function( val ) {
6945		val = parseInt( val );
6946		if ( isNaN(val) ) {
6947			return false;
6948		}
6949		if ( val >= 1500 ) {
6950			return 1;
6951		} else if ( val < 1500 && val >= 960 ) {
6952			return 2;
6953		} else if ( val < 960 && val >= 570 ) {
6954			return 3;
6955		} else if ( val < 570 ) {
6956			return 4;
6957		}
6958	}
6959
6960	var gutterByBreakpoint = function( bp, gutter ) {
6961		var ret;
6962		switch(gutter) {
6963		    case 'no-gutter':
6964		    	ret = 0;
6965		        break;
6966		    case 'px-gutter':
6967		    	ret = 1;
6968		        break;
6969		    case 'half-gutter':
6970		    	ret = 18;
6971		        break;
6972		    case 'double-gutter':
6973				switch(bp) {
6974				    case 3:
6975				    case 4:
6976				    	ret = 36;
6977				        break;
6978				    default:
6979				    	ret = 72;
6980				        break;
6981				}
6982		        break;
6983		    case 'triple-gutter':
6984				switch(bp) {
6985				    case 3:
6986				    case 4:
6987				    	ret = 36;
6988				        break;
6989				    default:
6990				    	ret = 108;
6991				        break;
6992				}
6993		        break;
6994		    case 'quad-gutter':
6995				switch(bp) {
6996				    case 2:
6997				    	ret = 108;
6998				        break;
6999				    case 3:
7000				    	ret = 72;
7001				        break;
7002				    case 4:
7003				    	ret = 36;
7004				        break;
7005				    default:
7006				    	ret = 144;
7007				        break;
7008				}
7009		        break;
7010		    default:
7011		    	ret = 36;//single-gutter
7012		}
7013		return ret;
7014	}
7015
7016	if ($('.justified-layout').length > 0) {
7017		var justifiedContainersArray = [],
7018			typeGridArray = [],
7019			layoutGridArray = [],
7020			transitionDuration = [],
7021			$filterItems = [],
7022			$filters = $('.justified-system .isotope-filters'),
7023			$itemSelector = '.tmb',
7024			$items,
7025			itemMargin,
7026			correctionFactor = 0,
7027			firstLoad = true,
7028			isOriginLeft = $('body').hasClass('rtl') ? false : true,
7029			prevW = breakPointMe(UNCODE.wwidth);
7030		$('[class*="justified-container"]').each(function() {
7031			var isoData = $(this).data();
7032			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7033			if (isoData.type == 'metro') typeGridArray.push(true);
7034			else typeGridArray.push(false);
7035			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
7036			else layoutGridArray.push('justified');
7037			justifiedContainersArray.push($(this));
7038		});
7039		var init_justifiedGallery = function() {
7040			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
7041				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
7042					justifiedId = justifiedSystem.attr('id'),
7043					$layoutMode = layoutGridArray[i],
7044					gutter = $(justifiedContainersArray[i]).data('gutter'),
7045					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
7046					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
7047					lastRow = $(justifiedContainersArray[i]).data('last-row'),
7048					margins;
7049
7050				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
7051				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
7052				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7053
7054				margins = gutterByBreakpoint(prevW, gutter);
7055
7056				$(justifiedContainersArray[i]).justifiedGallery({
7057					rowHeight: rowHeight,
7058					maxRowHeight: maxRowHeight,
7059					margins: margins,
7060					cssAnimation: true,
7061					lastRow: lastRow,
7062					waitThumbnailsLoad: false
7063				}).one('jg.complete', function(){ onLayout($(this), 0); } );
7064
7065				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
7066					$(justifiedContainersArray[i]).infinitescroll({
7067							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
7068							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7069							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
7070							animate: false,
7071							behavior: 'local',
7072							debug: false,
7073							loading: {
7074								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
7075								speed: 0,
7076								finished: undefined,
7077								msg: $('#' + justifiedId + ' .loadmore-button'),
7078							},
7079							errorCallback: function() {
7080								var justified_system = $(this).closest('.justified-system');
7081								$('.loading-button', justified_system).hide();
7082								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
7083							}
7084						},
7085						// append the new items to galleryJustified on the infinitescroll callback function.
7086						function(newElements, opts) {
7087							var $galleryJustified = $(this),
7088								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
7089								filters = new Array(),
7090								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
7091								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
7092								$numPages = $('a', $infinite_button).data('pages'),
7093								delay = 300;
7094							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7095							if ($galleryJustified.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
7096								$infinite_button.show();
7097							} else {
7098								$infinite_button.hide();
7099							}
7100							$loading_button.hide();
7101							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7102							$('> li', $galleryJustified).remove();
7103							$.each($(newElements), function(index, val) {
7104								$(val).addClass('tmb-iso');
7105								if ($(val).is("li")) {
7106									filters.push($(val)[0]);
7107								}
7108								$(val).addClass('uncode-appended');
7109							});
7110							newElements = newElements.filter(function(x) {
7111								return filters.indexOf(x) < 0
7112							});
7113							$.each($(filters), function(index, val) {
7114								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
7115							});
7116							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
7117							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7118								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
7119								if (typeof getLightbox === 'object') {
7120									getLightbox.refresh();
7121								} else {
7122									UNCODE.lightbox();
7123								}
7124							}
7125							if ( typeof twttr !== 'undefined' )
7126								twttr.widgets.load(justifiedContainersArray[i]);
7127
7128							requestTimeout(function() {
7129								$galleryJustified.trigger('more-items-loaded');
7130								$(window).trigger('more-items-loaded');
7131								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7132								fillIfNotScrollable($galleryJustified);
7133							}, 1000);
7134						});
7135					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
7136						var $infinite_justified = $(justifiedContainersArray[i]),
7137							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
7138						$infinite_justified.infinitescroll('pause');
7139						$infinite_button.on('click', function(event) {
7140							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7141								$.each(UNCODE.lightboxArray, function(index, val) {
7142									UNCODE.lightboxArray[index].destroy();
7143								});
7144							}
7145							event.preventDefault();
7146							var $justified_system = $(event.target).closest('.justified-system'),
7147							$infinite_justified = $justified_system.find('.justified-container'),
7148							justifiedId = $justified_system.attr('id');
7149							$(event.currentTarget).html(SiteParameters.loading);
7150							$infinite_justified.infinitescroll('resume');
7151							$infinite_justified.infinitescroll('retrieve');
7152							$infinite_justified.infinitescroll('pause');
7153							$infinite_justified.trigger('more-items-loaded');
7154							$(window).trigger('more-items-loaded');
7155							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7156						});
7157					}
7158					(function ($c) {
7159						requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
7160					})($(justifiedContainersArray[i]));
7161				}
7162			}
7163		},
7164		fillIfNotScrollable = function ($container) {
7165			if ($container.hasClass('isotope-infinite-button')) return;
7166			if (!$container.hasClass('isotope-infinite')) return;
7167			var infData = $container.data('infinitescroll');
7168			if (!infData || !infData.options || !infData.options.state) return;
7169			var state = infData.options.state;
7170			if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPaused) return;
7171			var $loadMoreA = $container.closest('.justified-system').find('.loadmore-button a');
7172			var numPages = parseInt($loadMoreA.data('pages'), 10);
7173			if (!numPages || state.currPage >= numPages) return;
7174			if (document.documentElement.scrollHeight > window.innerHeight + 1) return;
7175			$container.infinitescroll('retrieve');
7176		},
7177		onLayout = function(justifiedObj, startIndex) {
7178			justifiedObj.css('opacity', 1);
7179			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
7180			$('.tmb', justifiedObj).addClass('justified-object-loaded');
7181
7182			requestTimeout(function() {
7183				// window.dispatchEvent(UNCODE.boxEvent);
7184				UNCODE.adaptive();
7185				if (SiteParameters.dynamic_srcset_active === '1') {
7186					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7187				}
7188				if (typeof MediaElement === "function") {
7189					$(justifiedObj).find('audio,video').each(function() {
7190						$(this).mediaelementplayer({
7191								pauseOtherPlayers: false,
7192						});
7193					});
7194				}
7195				if ($(justifiedObj).find('.nested-carousel').length) {
7196					if (typeof UNCODE.carousel !== 'undefined') {
7197						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7198					}
7199					requestTimeout(function() {
7200						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7201						justifiedObj.addClass('justified-gallery-finished')
7202						Waypoint.refreshAll();
7203					}, 200);
7204				} else {
7205					requestTimeout(function() {
7206						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7207						justifiedObj.addClass('justified-gallery-finished')
7208						Waypoint.refreshAll();
7209					}, 300);
7210				}
7211			}, 100);
7212
7213		},
7214		boxAnimation = function(items, startIndex, sequential, container) {
7215			var $allItems = items.length - startIndex,
7216				showed = 0,
7217				index = 0;
7218			if (container.closest('.owl-item').length == 1) return false;
7219			$.each(items, function(index, val) {
7220				var elInner = $('> .t-inside', val);
7221				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7222					return;
7223				}
7224				if (val[0]) val = val[0];
7225				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7226					new Waypoint({
7227						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7228						element: val,
7229						handler: function() {
7230							var element = $('> .t-inside', this.element),
7231								parent = $(this.element),
7232								currentIndex = parent.index();
7233							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7234								delayAttr = parseInt(element.attr('data-delay'));
7235							if (isNaN(delayAttr)) delayAttr = 100;
7236							delay -= showed;
7237							var objTimeout = requestTimeout(function() {
7238								element.removeClass('zoom-reverse').addClass('start_animation');
7239								showed = parent.index();
7240							}, delay * delayAttr);
7241							parent.data('objTimeout', objTimeout);
7242							if (!UNCODE.isUnmodalOpen) {
7243								this.destroy();
7244							}
7245						},
7246						offset: '100%'
7247					})
7248				} else {
7249					elInner.removeClass('animate_when_almost_visible');
7250					$(val).addClass('no-waypoint-animation');
7251					/*if (elInner.hasClass('force-anim')) {
7252						elInner.addClass('start_animation');
7253					} else {
7254						elInner.css('opacity', 1);
7255					}*/
7256				}
7257				index++;
7258			});
7259		};
7260		$filters.on('click', 'a[data-filter]', function(evt) {
7261			var $filter = $(this),
7262				filterContainer = $filter.closest('.isotope-filters'),
7263				filterValue = $filter.attr('data-filter'),
7264				container = $filter.closest('.justified-system').find($('.justified-layout')),
7265				lastRow = container.data('last-row'),
7266				transitionDuration = 0,
7267				delay = 300,
7268				filterItems = [];
7269
7270			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7271
7272			var filter_items = function(){
7273				if (filterValue !== undefined) {
7274					$.each($('> .tmb > .t-inside', container), function(index, val) {
7275						var parent = $(val).parent(),
7276							objTimeout = parent.data('objTimeout');
7277						if (objTimeout) {
7278							$(val).removeClass('zoom-reverse');
7279							clearRequestTimeout(objTimeout);
7280						}
7281						if (transitionDuration == 0) {
7282							if ($(val).hasClass('animate_when_almost_visible')) {
7283								$(val).addClass('zoom-reverse').removeClass('start_animation');
7284							} else {
7285								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7286							}
7287						}
7288					});
7289
7290					requestTimeout(function() {
7291						var $block,
7292							selector,
7293							lightboxElements,
7294							$boxes;
7295
7296						if ( filterValue !== '' && filterValue !== '*' ) {
7297							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7298							selector = '.' + filterValue;
7299							$.each($(selector, container), function(index, block) {
7300								lightboxElements = $('[data-lbox^=ilightbox]', block);
7301								if (lightboxElements.length) {
7302									lightboxElements.removeClass('lb-disabled');
7303									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7304								}
7305								filterItems.push(block);
7306							});
7307							container.justifiedGallery({
7308								filter: selector,
7309								lastRow: 'nojustify'
7310							});
7311						} else {
7312							container.justifiedGallery({
7313								filter: false,
7314								lastRow: lastRow
7315							});
7316							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7317							filterItems = $('> .tmb', container);
7318						}
7319						container.trigger('more-items-loaded');
7320						$(window).trigger('more-items-loaded');
7321						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7322
7323						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7324						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7325							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7326							if (typeof getLightbox === 'object') {
7327								getLightbox.refresh();
7328							} else {
7329								UNCODE.lightbox();
7330							}
7331						}
7332
7333						if (transitionDuration == 0) {
7334							requestTimeout(function() {
7335								boxAnimation(filterItems, 0, false, container);
7336							}, 100);
7337						}
7338						requestTimeout(function() {
7339							Waypoint.refreshAll();
7340							container.trigger('more-items-loaded');
7341							$(window).trigger('more-items-loaded');
7342							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7343							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7344								$(document).trigger('uncode-scrolltrigger-refresh');
7345							}
7346						}, 2000);
7347						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
7348
7349					}, delay);
7350				} else {
7351					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7352						$.each(UNCODE.lightboxArray, function(index, val) {
7353							UNCODE.lightboxArray[index].destroy();
7354						});
7355					}
7356					$.each($('> .tmb > .t-inside', container), function(index, val) {
7357						var parent = $(val).parent(),
7358							objTimeout = parent.data('objTimeout');
7359						if (objTimeout) {
7360							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7361							clearRequestTimeout(objTimeout);
7362						}
7363						if (transitionDuration == 0) {
7364							if ($(val).hasClass('animate_when_almost_visible')) {
7365								$(val).addClass('zoom-reverse').removeClass('start_animation');
7366							} else {
7367								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7368							}
7369						}
7370					});
7371					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7372						UNCODE.lightbox();
7373					}
7374					container.parent().addClass('justified-loading');
7375					container.trigger('more-items-loaded');
7376					$(window).trigger('more-items-loaded');
7377					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7378				}
7379			};
7380
7381			if (!$filter.hasClass('active')) {
7382				/** Scroll top with filtering */
7383				if (filterContainer.hasClass('filter-scroll')) {
7384                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7385                    calc_scroll -= UNCODE.get_scroll_offset();
7386
7387					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7388						delta = bodyTop - calc_scroll,
7389						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7390						filterTolerance = false,
7391						filter_timeout;
7392					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7393
7394					if ( !UNCODE.isFullPage ) {
7395						if (scrollSpeed == 0) {
7396							$('html, body').scrollTop(calc_scroll);
7397							UNCODE.scrolling = false;
7398							filter_items();
7399						} else {
7400
7401							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7402								filter_items();
7403								filterTolerance = true;
7404							}
7405
7406							$('html, body').animate({
7407								scrollTop: calc_scroll
7408							},{
7409								easing: 'easeInOutQuad',
7410								duration: scrollSpeed,
7411								complete: function(){
7412									UNCODE.scrolling = false;
7413									if ( !filterTolerance ) {
7414										filter_timeout = setTimeout(function(){
7415											clearTimeout(filter_timeout);
7416											filter_items();
7417										}, 200);
7418									}
7419								}
7420							});
7421						}
7422					}
7423				} else {
7424					filter_items();
7425				}
7426			}
7427			evt.preventDefault();
7428		});
7429
7430		$filters.each(function(i, buttonGroup) {
7431			var $buttonGroup = $(buttonGroup);
7432			$buttonGroup.on('click', 'a', function() {
7433				$buttonGroup.find('.active').removeClass('active');
7434				$(this).addClass('active');
7435			});
7436
7437			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7438				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7439				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7440			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7441				e.preventDefault();
7442				$cats_filters.slideToggle(400, 'easeInOutCirc');
7443			});
7444		});
7445		window.addEventListener('boxResized', function(e) {
7446			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7447				prevW = breakPointMe(UNCODE.wwidth);
7448				$.each($('.justified-layout'), function(index, val) {
7449					var gutter = $(this).data('gutter'),
7450						margins = gutterByBreakpoint( prevW, gutter);
7451					$(this).justifiedGallery({
7452						margins: margins
7453					});
7454					$(this).find('.mejs-video,.mejs-audio').each(function() {
7455						$(this).trigger('resize');
7456					});
7457				});
7458			}
7459		}, false);
7460
7461		init_justifiedGallery();
7462	};
7463};
7464
7465UNCODE.cssGrid = function() {
7466	if ($('.cssgrid-layout').length > 0) {
7467		var cssGridContainersArray = [];
7468		var transitionDuration = [];
7469		var $filters = $('.cssgrid-system .cssgrid-filters');
7470
7471		$('[class*="cssgrid-container"]').each(function() {
7472			cssGridContainersArray.push($(this));
7473			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7474		});
7475
7476		var init_cssGridAjax = function() {
7477			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7478				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7479					cssGridId = cssGridSystem.attr('id');
7480
7481				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7482
7483				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7484					$(cssGridContainersArray[i]).infinitescroll({
7485						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7486						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7487						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7488						animate: false,
7489						behavior: 'local',
7490						debug: false,
7491						loading: {
7492							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7493							speed: 0,
7494							finished: undefined,
7495							msg: $('#' + cssGridId + ' .loadmore-button'),
7496						},
7497						errorCallback: function() {
7498							var cssgrid_system = $(this).closest('.cssgrid-system');
7499							$('.loading-button', cssgrid_system).hide();
7500							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7501						}
7502					},
7503					// append the new items to cssGrid on the infinitescroll callback function.
7504					function(newElements, opts) {
7505						var $cssGrid = $(this),
7506							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7507							cssGridId = cssGridSystemCont.attr('id'),
7508							filters = new Array(),
7509							$loading_button = cssGridSystemCont.find('.loading-button'),
7510							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7511							$numPages = $('a', $infinite_button).data('pages'),
7512							$woo_results,
7513							delay = 300;
7514						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7515						$infinite_button.show();
7516						$loading_button.hide();
7517						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7518						$('> li', $cssGrid).remove();
7519						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7520						$.each($(newElements), function (index, val) {
7521							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7522								$woo_results = $(val);
7523								delete newElements[index];
7524							} else {
7525								$(val).addClass('tmb-grid');
7526								if ($(val).is("li")) {
7527									filters.push($(val)[0]);
7528								}
7529							}
7530							$(val).addClass('uncode-appended');
7531						});
7532						newElements = newElements.filter(function(x) {
7533							return filters.indexOf(x) < 0
7534						});
7535						$.each($(filters), function(index, val) {
7536							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7537						});
7538						if ($woo_results && $woo_results.length > 0) {
7539							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7540							var new_count = $woo_results.find('.woocommerce-result-count').text();
7541							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7542							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7543							function replaceMatch(match, p1, p2) {
7544        						return old_start + '–' + new_end;
7545							}
7546							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7547							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7548						}
7549
7550						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7551						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7552						if (filterValue !== undefined && filterValue != '*') {
7553							$(newElements).hide();
7554							var els_to_show = $();
7555							$(newElements).each(function() {
7556								var el = $(this);
7557								if (el.hasClass(filterValue)) {
7558									els_to_show = els_to_show.add(el);
7559									el.show();
7560								}
7561							});
7562							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7563						} else {
7564							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7565						}
7566
7567						UNCODE.adaptive();
7568						if (SiteParameters.dynamic_srcset_active === '1') {
7569							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7570						}
7571						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7572							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7573							if (typeof getLightbox === 'object') {
7574								getLightbox.refresh();
7575							} else {
7576								UNCODE.lightbox();
7577							}
7578						}
7579						if ( typeof twttr !== 'undefined' ) {
7580							twttr.widgets.load(cssGridContainersArray[i]);
7581						}
7582
7583						UNCODE.carousel($(newElements));
7584						requestTimeout(function() {
7585							$cssGrid.trigger('more-items-loaded');
7586							$(window).trigger('more-items-loaded');
7587							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7588						}, 1000);
7589
7590					});
7591					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7592						var $cssgrid_el = $(cssGridContainersArray[i]),
7593							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7594						$cssgrid_el.infinitescroll('pause');
7595						$infinite_button.on('click', function(event) {
7596							event.preventDefault();
7597							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7598							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7599							cssGridId = $cssgrid_system.attr('id');
7600							$(event.currentTarget).html(SiteParameters.loading);
7601							$cssgrid_el.infinitescroll('resume');
7602							$cssgrid_el.infinitescroll('retrieve');
7603							$cssgrid_el.infinitescroll('pause');
7604						});
7605					}
7606				}
7607			}
7608		};
7609
7610		init_cssGridAjax();
7611
7612		if ($('.cssgrid-pagination').length > 0) {
7613			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7614				evt.preventDefault();
7615
7616				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7617					var container = $(this).closest('.cssgrid-system'),
7618						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7619						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7620
7621					if ( pagination_disable_scroll !== 'disabled' ) {
7622						calc_scroll -= UNCODE.get_scroll_offset();
7623
7624						var menu_container = $('.menu-sticky');
7625						var menu = menu_container.find('.menu-container');
7626
7627						if (menu_container.length > 0 && menu.length > 0) {
7628							calc_scroll = calc_scroll - menu.outerHeight();
7629						}
7630
7631						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7632							delta = bodyTop - calc_scroll,
7633							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7634						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7635
7636						if ( !UNCODE.isFullPage ) {
7637							if (scrollSpeed == 0) {
7638								$('html, body').scrollTop(calc_scroll);
7639							} else {
7640								$('html, body').animate({
7641									scrollTop: calc_scroll
7642								},{
7643									easing: 'easeInOutQuad',
7644									duration: scrollSpeed,
7645									complete: function(){
7646										UNCODE.scrolling = false;
7647									}
7648								});
7649							}
7650						}
7651					}
7652				}
7653
7654				loadCssGrid($(this), true);
7655			});
7656		}
7657
7658		$filters.on('click', 'a.grid-nav-link', function(evt) {
7659			if ($(this).hasClass('no-grid-filter')) {
7660				return;
7661			}
7662			var $filter = $(this),
7663				filterContainer = $filter.closest('.cssgrid-filters'),
7664				filterValue = $filter.attr('data-filter'),
7665				containerSystem = $filter.closest('.cssgrid-system'),
7666				container = containerSystem.find($('.cssgrid-layout')),
7667				transitionDuration = containerSystem.data('transitionDuration'),
7668				delay = 300,
7669				filterItems = [],
7670				all_thumbs = container.find('.tmb-grid');
7671
7672			var filter_items = function(){
7673				if (filterValue !== undefined) {
7674					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7675						var parent = $(val).parent(),
7676							objTimeout = parent.data('objTimeout');
7677						if (objTimeout) {
7678							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7679							clearRequestTimeout(objTimeout);
7680						}
7681						if (transitionDuration == 0) {
7682							if ($(val).hasClass('animate_when_almost_visible')) {
7683								$(val).addClass('zoom-reverse').removeClass('start_animation');
7684							} else {
7685								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7686							}
7687						}
7688					});
7689					requestTimeout(function(){
7690						if ( filterValue == '*' ) {
7691							all_thumbs.show();
7692							all_thumbs.each(function(index, val) {
7693								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7694								filterItems.push($(this));
7695							});
7696						} else {
7697							all_thumbs.each(function() {
7698								var _tmb = $(this);
7699								if (_tmb.hasClass(filterValue)) {
7700									_tmb.show();
7701									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7702									filterItems.push(_tmb);
7703								} else {
7704									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7705									_tmb.hide();
7706								}
7707							});
7708						}
7709
7710						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7711
7712						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7713						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7714						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7715						if (lightboxElements.length) {
7716							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7717							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7718								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7719								if (typeof getLightbox === 'object') {
7720									getLightbox.refresh();
7721								} else {
7722									UNCODE.lightbox();
7723								}
7724							}
7725						}
7726						container.trigger('more-items-loaded');
7727						$(window).trigger('more-items-loaded');
7728						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7729					}, delay);
7730				} else {
7731					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7732						var parent = $(val).parent(),
7733							objTimeout = parent.data('objTimeout');
7734						if (objTimeout) {
7735							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7736							clearRequestTimeout(objTimeout);
7737						}
7738						if (transitionDuration == 0) {
7739							if ($(val).hasClass('animate_when_almost_visible')) {
7740								$(val).addClass('zoom-reverse').removeClass('start_animation');
7741							} else {
7742								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7743							}
7744						}
7745					});
7746					loadCssGrid($filter);
7747				}
7748			};
7749
7750			if (!$filter.hasClass('active')) {
7751				/** Scroll top with filtering */
7752				if (filterContainer.hasClass('filter-scroll')) {
7753                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7754                    calc_scroll -= UNCODE.get_scroll_offset();
7755
7756					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7757						delta = bodyTop - calc_scroll,
7758						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7759						filterTolerance = false,
7760						filter_timeout;
7761					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7762
7763					if ( !UNCODE.isFullPage ) {
7764						if (scrollSpeed == 0) {
7765							$('html, body').scrollTop(calc_scroll);
7766							UNCODE.scrolling = false;
7767							filter_items();
7768						} else {
7769
7770							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7771								filter_items();
7772								filterTolerance = true;
7773							}
7774
7775							$('html, body').animate({
7776								scrollTop: calc_scroll
7777							},{
7778								easing: 'easeInOutQuad',
7779								duration: scrollSpeed,
7780								complete: function(){
7781									UNCODE.scrolling = false;
7782									if ( !filterTolerance ) {
7783										filter_timeout = setTimeout(function(){
7784											clearTimeout(filter_timeout);
7785											filter_items();
7786										}, 200);
7787									}
7788								}
7789							});
7790						}
7791					}
7792				} else {
7793					filter_items();
7794				}
7795			}
7796			evt.preventDefault();
7797		});
7798
7799		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7800			var params = UNCODE.getURLParams(window.location);
7801			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7802
7803			UNCODE.lastURL = window.location.href;
7804
7805			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7806				return;
7807			}
7808
7809			if (params.id === undefined) {
7810				$.each($('.cssgrid-system'), function(index, val) {
7811					loadCssGrid($(val));
7812				});
7813			} else {
7814				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7815					loadCssGrid($('#' + params.id));
7816				}
7817			}
7818		});
7819
7820		var loadCssGrid = function($href, $paginating) {
7821			var is_paginating = false;
7822
7823			if (undefined !== $paginating && $paginating) {
7824				var is_paginating = $paginating;
7825			}
7826
7827			var href = ($href.is("a") ? $href.attr('href') : location),
7828				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7829				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7830				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7831				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7832				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7833				cssgridId = cssgridSystem.attr('id');
7834			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7835				UNCODE.lastURL = href;
7836				history.pushState({
7837					myCSSgrid: true
7838				}, document.title, href);
7839			}
7840			cssgridWrapper.addClass('cssgrid-loading');
7841			if (is_paginating) {
7842				cssgridWrapper.addClass('grid-filtering');
7843			}
7844			$.ajax({
7845				url: href
7846			}).done(function(data) {
7847				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7848					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7849					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7850				requestTimeout(function() {
7851					cssgridContainer.html($resultItems);
7852					cssgridWrapper.removeClass('cssgrid-loading');
7853					cssgridWrapper.removeClass('grid-filtering');
7854					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7855					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7856					UNCODE.adaptive();
7857					if (SiteParameters.dynamic_srcset_active === '1') {
7858						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7859					}
7860					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7861						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7862						if (typeof getLightbox === 'object') {
7863							getLightbox.refresh();
7864						} else {
7865							UNCODE.lightbox();
7866						}
7867					}
7868					cssgridContainer.trigger('more-items-loaded');
7869					$(window).trigger('more-items-loaded');
7870					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7871				}, 300);
7872
7873				$('.pagination', cssgridFooter).remove();
7874				cssgridFooter.append($resultPagination);
7875
7876				if (cssgridResultCount.length > 0) {
7877					$('.woocommerce-result-count', cssgridResultCount).remove();
7878					cssgridResultCount.append($resultCount);
7879				}
7880			});
7881		};
7882
7883		$filters.each(function(i, buttonGroup) {
7884			var $buttonGroup = $(buttonGroup);
7885			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7886				$buttonGroup.find('.active').removeClass('active');
7887				$(this).addClass('active');
7888
7889			});
7890
7891			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7892				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7893				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7894			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7895				e.preventDefault();
7896				$cats_filters.slideToggle(400, 'easeInOutCirc');
7897			});
7898
7899		});
7900	};
7901};
7902
7903UNCODE.linearGrid = function(){
7904	$('.linear-wrapper').each(function(){
7905		var $wrap = $(this),
7906			$system = $wrap.closest('.linear-system'),
7907			$dragger = $('[data-dragger]', $system),
7908			$row = $wrap.closest('.vc_row[data-parent]'),
7909			_row = $row[0],
7910			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7911			vertical = $cont.hasClass('linear-or-vertical'),
7912			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7913			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7914			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7915			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7916			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7917			isInViewport = false,
7918			isHover = false,
7919			init = false,
7920			stableHeight = UNCODE.wheight,
7921			wCont, hCont, docH, marqueeTL;
7922
7923		if ( ! $('.tmb', $cont).length ) {
7924			return;
7925		}
7926
7927		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7928		var dataX = dataSpeed;
7929
7930		dataSpeed += 5;
7931
7932		var checkLinearGridSize = function(){
7933			if ( !$wrap.is(':visible') )  {
7934				return;
7935			}
7936			$wrap.find('.cont-appended').remove();
7937
7938			if ( vertical ) {
7939				if ( ! SiteParameters.is_frontend_editor ) {
7940					hCont = $cont.outerHeight();
7941					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7942					if ( hCont < docH ) {
7943						var res = docH - hCont * 3,
7944							times = 2 * Math.round((res/hCont+1) / 2);
7945					}
7946					for ( var i = 0; i < times; i++ ) {
7947						var $cloneCont = $cont.clone(),
7948							$cloneCont2 = $cont.clone(),
7949							trans = ( (i+2) ) * 100;
7950						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7951						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7952						$cloneCont.find('a[data-lbox]').each(function(){
7953							var dataLbox = $(this).attr('data-lbox');
7954							$(this).attr('data-lbox', dataLbox + '_' + i);
7955						});
7956						$cloneCont.find('.wp-video-shortcode').each(function(){
7957							var thisID = $(this).attr('id');
7958							$(this).attr('id', thisID + '_' + i);
7959						});
7960						$cloneCont2.find('a[data-lbox]').each(function(){
7961							var dataLbox = $(this).attr('data-lbox');
7962							$(this).attr('data-lbox', dataLbox + '_2' + i);
7963						});
7964						$cloneCont2.find('.wp-video-shortcode').each(function(){
7965							var thisID = $(this).attr('id');
7966							$(this).attr('id', thisID + '__' + i);
7967						});
7968						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7969							UNCODE.lightgallery($cloneCont);
7970							UNCODE.lightgallery($cloneCont2);
7971						}
7972					}
7973                }
7974			} else {
7975				wCont = $cont.outerWidth();
7976				if ( (wCont) < UNCODE.wwidth*2 ) {
7977					var res = UNCODE.wwidth*2 - (wCont),
7978						times = 2 * Math.round((res/wCont+1) / 2);
7979				}
7980				for ( var i = 0; i < times; i++ ) {
7981					var $cloneCont = $cont.clone(),
7982						$cloneCont2 = $cont.clone(),
7983						trans = ( (i+2) ) * 100;
7984					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7985					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7986					$cloneCont.find('a[data-lbox]').each(function(){
7987						var dataLbox = $(this).attr('data-lbox');
7988						$(this).attr('data-lbox', dataLbox + '_' + i);
7989					});
7990					$cloneCont.find('[id]').each(function(){
7991						var thisID = $(this).attr('id');
7992						$(this).attr('id', thisID + '_' + i);
7993					});
7994					$cloneCont2.find('a[data-lbox]').each(function(){
7995						var dataLbox = $(this).attr('data-lbox');
7996						$(this).attr('data-lbox', dataLbox + '_2' + i);
7997					});
7998					$cloneCont2.find('[id]').each(function(){
7999						var thisID = $(this).attr('id');
8000						$(this).attr('id', thisID + '__' + i);
8001					});
8002                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
8003                        UNCODE.lightgallery($cloneCont);
8004                        UNCODE.lightgallery($cloneCont2);
8005                    }
8006                }
8007			}
8008		};
8009		if ( clone ) {
8010			checkLinearGridSize();
8011			$(window).on('resize.linearGrid', function(){
8012				checkLinearGridSize();
8013			});
8014		}
8015
8016		var continuousLinearMarquee = function(_xStrt){
8017			if ( !$wrap.is(':visible') )  {
8018				return;
8019			}
8020			var ease = 'none';
8021			wCont = $cont.outerWidth();
8022			hCont = $cont.outerHeight();
8023
8024			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
8025				xEnd = vertical ? hCont : wCont,
8026				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8027				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
8028				speedSlow = (xEnd + xStrt) / 45,
8029				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8030
8031			marqueeTL = new TimelineMax({paused:true, reversed:true});
8032
8033			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
8034				marqueeTL.play();
8035
8036				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
8037					var $column = $wrap.closest('.wpb_column'),
8038						$col_link = $('.col-link', $column),
8039						$hover_sel = $wrap;
8040
8041					if ( $col_link.length ) {
8042						$hover_sel = $wrap.add($column);
8043					}
8044
8045					$hover_sel.on('mouseover', function(){
8046						if ( $wrap.attr('data-hover') === 'yes' ) {
8047							//speed = ( 10 - dataSpeed ) * 5;
8048							ease = 'power2.out';
8049							marqueeTL.duration( speedSlow );
8050						} else {
8051							marqueeTL.pause();
8052						}
8053						isHover = true;
8054					}).on('mouseout', function(){
8055						if ( $wrap.attr('data-hover') === 'yes' ) {
8056							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
8057							ease = 'power2.in';
8058							marqueeTL.duration( speed );
8059						} else {
8060							marqueeTL.play();
8061						}
8062						isHover = false;
8063					});
8064				}
8065
8066				$(document).on('sub-menu-slide-up', function(){
8067					if ( isInMenu ) {
8068						marqueeTL.pause();
8069					}
8070				});
8071
8072			}
8073	
8074			gsap.killTweensOf($wrap);
8075			if ( vertical ) {
8076				marqueeTL.fromTo( $wrap, {
8077					y: xStrt * direction
8078				},
8079				{
8080					duration: speed,
8081					y: xEnd * direction * -1,
8082					onComplete: function(){
8083						continuousLinearMarquee();
8084					},
8085					ease: ease,
8086					paused: freezed
8087				});
8088			} else {
8089				marqueeTL.fromTo( $wrap, {
8090					x: xStrt * direction
8091				},
8092				{
8093					duration: speed,
8094					x: xEnd * direction * -1,
8095					onComplete: function(){
8096						continuousLinearMarquee();
8097					},
8098					ease: ease,
8099					paused: freezed
8100				});
8101			}
8102		};
8103
8104		var dragLinearContinuous = function(){
8105			if ( !$wrap.is(':visible') )  {
8106				return;
8107			}
8108			var matrix, _x, _y,
8109				dragAction = false;
8110			Draggable.create($wrap[0], {
8111				type: vertical ? "y" : "x",
8112				bounds: document.getElementById("container"),
8113				inertia: false,
8114				onPress: function (e) {
8115				},
8116				onRelease: function (e) {
8117					if ( dragAction === true ) {
8118						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8119						_x = matrix[12] || matrix[4];
8120						_y = matrix[13] || matrix[5];
8121						if ( vertical ) {
8122							continuousLinearMarquee(_y * -1);
8123						} else {
8124							continuousLinearMarquee(_x * -1);
8125						}
8126						$wrap.removeClass('linear-dragging');
8127					}
8128				},
8129				onDrag: function (e) {
8130					dragAction = true;
8131					$wrap.addClass('linear-dragging');
8132				},
8133				onDragEnd: function (e) {
8134					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8135					_x = matrix[12] || matrix[4];
8136					_y = matrix[13] || matrix[5];
8137					wCont = $cont.outerWidth();
8138					hCont = $cont.outerHeight();
8139					if ( vertical ) {
8140						if ( Math.abs(_y) > hCont ) {
8141							if ( _y < 0 ) {
8142								_y = hCont + parseFloat( _y );
8143							} else {
8144								_y = parseFloat( _y ) - hCont;
8145							}
8146						}
8147						continuousLinearMarquee(_y * -1);
8148					} else {
8149						if ( Math.abs(_x) > wCont ) {
8150							if ( _x < 0 ) {
8151								_x = wCont + parseFloat( _x );
8152							} else {
8153								_x = parseFloat( _x ) - wCont;
8154							}
8155						}
8156						continuousLinearMarquee(_x * -1);
8157					}
8158					$wrap.removeClass('linear-dragging');
8159					dragAction = false;
8160				},
8161			});
8162		};
8163
8164		var runScrollLinear = function(){
8165			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8166			if ( (!$wrap.is(':visible') || freezed) )  {
8167				return;
8168			}
8169			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8170				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
8171			
8172			var linearGridScroll = function(){
8173				if ( isInViewport ) {
8174					var bound = _row.getBoundingClientRect();
8175
8176					var bound_top = bound.top,
8177						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
8178
8179					if ( vertical ) {
8180						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8181					} else {
8182						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8183					}
8184					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8185						requestAnimationFrame(linearGridScroll);
8186					}
8187				}
8188				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8189					window.addEventListener("scroll", linearGridScroll);
8190				}
8191			};
8192
8193			$(window).on( 'load wwResize', function(e) {
8194				stableHeight = UNCODE.wheight;
8195				linearGridScroll();
8196			});
8197			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8198				requestAnimationFrame(linearGridScroll);
8199			}
8200		};
8201		
8202		var dragLinear = function(){
8203			if ( !$wrap.is(':visible') )  {
8204				return;
8205			}
8206			var matrix, _x, _y;
8207			Draggable.create($dragger[0], {
8208				type: vertical ? "y" : "x",
8209				bounds: document.getElementById("container"),
8210				inertia: false,
8211				onPress: function (e) {
8212				},
8213				onRelease: function (e) {
8214				},
8215				onDrag: function (e) {
8216					$wrap.addClass('linear-dragging');
8217				},
8218				onDragEnd: function (e) {
8219					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8220					_x = matrix[12] || matrix[4];
8221					_y = matrix[13] || matrix[5];
8222					wCont = $cont.outerWidth();
8223					hCont = $cont.outerHeight();
8224					if ( vertical ) {
8225						if ( Math.abs(_y) > hCont ) {
8226							if ( _y < 0 ) {
8227								_y = hCont + parseFloat( _y );
8228							} else {
8229								_y = parseFloat( _y ) - hCont;
8230							}
8231							gsap.to( $dragger[0], {
8232								duration: 0,
8233								y: _y,
8234							});
8235						}
8236					} else {
8237						if ( Math.abs(_x) > wCont ) {
8238							if ( _x < 0 ) {
8239								_x = wCont + parseFloat( _x );
8240							} else {
8241								_x = parseFloat( _x ) - wCont;
8242							}
8243							gsap.to( $dragger[0], {
8244								duration: 0,
8245								x: _x,
8246							});
8247						}
8248					}
8249					$wrap.removeClass('linear-dragging');
8250				},
8251			});
8252		};
8253
8254		if ( ! $('body').hasClass('compose-mode') ) {
8255			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8256				continuousLinearMarquee();
8257				$(window).on( 'wwResize', function(e) {
8258					continuousLinearMarquee();
8259				});	
8260				$(document).on('sub-menu-slide-down', function(){
8261					if ( isInMenu ) {
8262						continuousLinearMarquee();
8263					}
8264				});
8265				if ( $wrap.attr('data-draggable') === 'yes' ) {
8266					dragLinearContinuous();
8267				}
8268			}
8269
8270			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8271				runScrollLinear();
8272				if ( $wrap.attr('data-draggable') === 'yes' ) {
8273					dragLinear();
8274				}
8275			}
8276
8277			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8278				var observer = new IntersectionObserver(function(entries) {
8279						
8280					entries.forEach(function(entry){
8281						if ( entry.isIntersecting ) {
8282							isInViewport = true;
8283							if ( !init ) {
8284								init = true;
8285								continuousLinearMarquee();
8286							} else {
8287								if ( typeof marqueeTL !== 'undefined' ) {
8288									marqueeTL.play();
8289								}
8290							}
8291							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8292								requestAnimFrame(runScrollLinear);
8293							}
8294						} else {
8295							isInViewport = false;
8296							if ( typeof marqueeTL !== 'undefined' ) {
8297								marqueeTL.pause();
8298							}
8299						}
8300					});
8301				}, { 
8302					root: document,
8303				});
8304
8305				observer.observe(_row);
8306
8307			} else {
8308
8309				var checkVisible = function( el, off ) {
8310					if (typeof jQuery === "function" && el instanceof jQuery) {
8311						el = el[0];
8312					}
8313			
8314					off = typeof off=='undefined' ? 50 : off;
8315			
8316					var rect = el.getBoundingClientRect();
8317			
8318					return (
8319						(
8320							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8321							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8322							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8323						)
8324					);
8325				};
8326				
8327				var checkVisibility = function(){
8328
8329					if ( checkVisible($row) ) {
8330						isInViewport = true;
8331						if ( typeof marqueeTL !== 'undefined' ) {
8332							marqueeTL.play();
8333						}
8334					} else {
8335						isInViewport = false;
8336						if ( typeof marqueeTL !== 'undefined' ) {
8337							marqueeTL.pause();
8338						}
8339					}
8340				}
8341
8342				window.addEventListener("scroll", checkVisibility);
8343				checkVisibility();
8344
8345			}
8346		}
8347	});
8348};
8349UNCODE.wrapperMarquee = function () {
8350
8351	function createMarquee(opts) {
8352		if (!opts) return;
8353
8354		var parent = opts.parent;
8355		var originals = opts.originals;
8356
8357		if (!parent || !originals) return;
8358		if (parent.getAttribute('data-marquee-init') === '1') return;
8359		parent.setAttribute('data-marquee-init', '1');
8360
8361		function raf(cb) {
8362			return (window.requestAnimationFrame ||
8363				window.webkitRequestAnimationFrame ||
8364				window.mozRequestAnimationFrame ||
8365				function (fn) { return window.setTimeout(fn, 16); }
8366			)(cb);
8367		}
8368
8369		function caf(id) {
8370			return (window.cancelAnimationFrame ||
8371				window.webkitCancelAnimationFrame ||
8372				window.mozCancelAnimationFrame ||
8373				function (tid) { window.clearTimeout(tid); }
8374			)(id);
8375		}
8376
8377		function getWidth(el) {
8378			if (!el) return 0;
8379			if (el.getBoundingClientRect) return el.getBoundingClientRect().width;
8380			return el.offsetWidth || 0;
8381		}
8382
8383		function getPointX(e) {
8384			if (e.touches && e.touches.length) return e.touches[0].clientX;
8385			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientX;
8386			return e.clientX;
8387		}
8388
8389		function getPointY(e) {
8390			if (e.touches && e.touches.length) return e.touches[0].clientY;
8391			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientY;
8392			return e.clientY;
8393		}
8394
8395		function getPageY() {
8396			if (typeof window.pageYOffset === 'number') return window.pageYOffset;
8397			return (document.documentElement ? document.documentElement.scrollTop : 0);
8398		}
8399
8400		function getViewportW() {
8401			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
8402		}
8403
8404		var baseSpeed = (typeof opts.speed === 'number') ? opts.speed : 50;
8405		var direction = (typeof opts.direction === 'number') ? opts.direction : -1;
8406		var maxReps = (typeof opts.maxReps === 'number') ? opts.maxReps : 12;
8407
8408		var scrollDriven = (opts.scrollDriven === true);
8409		var scrollFactor = (typeof opts.scrollFactor === 'number') ? opts.scrollFactor : 0.6;
8410		var isScrollControlled = (opts.isScrollControlled === true);
8411
8412		var inViewOnly = (opts.inViewOnly !== false);
8413		var viewMargin = (typeof opts.viewMargin === 'number') ? opts.viewMargin : 80;
8414
8415		var hoverSpeed = (typeof opts.hoverSpeed === 'number') ? opts.hoverSpeed : null;
8416		var isHover = false;
8417
8418		var infinite = (opts.infinite === true) && !SiteParameters.is_frontend_editor;
8419		var draggable = (opts.draggable === true);
8420
8421		var freezeMode = (typeof opts.freeze === 'string') ? opts.freeze : null;
8422		var freezeBp = (typeof opts.freezeBp === 'number') ? opts.freezeBp : 960;
8423
8424		function isFrozenNow() {
8425			if (!freezeMode) return false;
8426
8427			var w = getViewportW();
8428			if (freezeMode === 'always') return true;
8429			if (freezeMode === 'desktop') return w >= freezeBp;
8430			if (freezeMode === 'mobile') return w < freezeBp;
8431
8432			return false;
8433		}
8434
8435		function closestRowParent(el) {
8436			if (!el || !el.closest) return null;
8437			return el.closest('[data-parent="true"]') || null;
8438		}
8439
8440		function ensureId(el, prefix) {
8441			if (!el) return null;
8442			if (el.id && el.id.length) return el.id;
8443
8444			var p = prefix || 'uncode-row';
8445			var rnd = (Math.random().toString(36).slice(2) + Date.now().toString(36)).slice(0, 12);
8446			el.id = p + '-' + rnd;
8447			return el.id;
8448		}
8449
8450		function dispatchClonesEvent(payload) {
8451			try {
8452				parent.dispatchEvent(new CustomEvent('uncode:marquee:clones-built', {
8453					bubbles: true,
8454					detail: payload
8455				}));
8456			} catch (e) {}
8457		}
8458
8459		var clonesEventRaf = 0;
8460		function dispatchClonesEventDebounced(payload) {
8461			if (clonesEventRaf) return;
8462			clonesEventRaf = raf(function () {
8463				clonesEventRaf = 0;
8464				dispatchClonesEvent(payload);
8465			});
8466		}
8467
8468		var base = [];
8469		var i;
8470		for (i = 0; i < originals.length; i++) base.push(originals[i]);
8471		if (!base.length) return;
8472
8473		var track = document.createElement('div');
8474		track.className = (opts.trackClassName ? opts.trackClassName : 'cs-track');
8475
8476		gsap.set(track, {
8477			x: 0,
8478			force3D: true,
8479			willChange: 'transform'
8480		});
8481
8482		var baseWrap = document.createElement('div');
8483		baseWrap.className = 'cs-base';
8484
8485		var leftWrap = null;
8486		var rightWrap = null;
8487
8488		parent.insertBefore(track, parent.firstChild);
8489
8490		if (infinite) {
8491			leftWrap = document.createElement('div');
8492			leftWrap.className = 'cs-clones cs-clones--left';
8493
8494			rightWrap = document.createElement('div');
8495			rightWrap.className = 'cs-clones cs-clones--right';
8496
8497			track.appendChild(leftWrap);
8498			track.appendChild(baseWrap);
8499			track.appendChild(rightWrap);
8500		} else {
8501			track.appendChild(baseWrap);
8502		}
8503
8504		var sourceWrap = document.createElement('div');
8505		sourceWrap.className = 'cs-source';
8506		sourceWrap.style.display = 'none';
8507
8508		track.parentNode.insertBefore(sourceWrap, track);
8509
8510		for (i = 0; i < base.length; i++) {
8511			sourceWrap.appendChild(base[i]);
8512		}
8513
8514		function fillBaseWrapFromSource() {
8515			baseWrap.innerHTML = '';
8516
8517			var fragBase = document.createDocumentFragment();
8518			var k, clone;
8519
8520			for (k = 0; k < base.length; k++) {
8521				clone = base[k].cloneNode(true);
8522				clone.setAttribute('data-marquee-clone', '1');
8523				clone.setAttribute('data-marquee-origin-index', k);
8524				clone.setAttribute('aria-hidden', 'true');
8525				fragBase.appendChild(clone);
8526			}
8527
8528			baseWrap.appendChild(fragBase);
8529		}
8530
8531		fillBaseWrapFromSource();
8532
8533		var cycleW = 1;
8534
8535		function clearClones() {
8536			if (!infinite) return;
8537			leftWrap.innerHTML = '';
8538			rightWrap.innerHTML = '';
8539		}
8540
8541		function measureCycle() {
8542			cycleW = baseWrap.scrollWidth || 0;
8543			if (!cycleW || cycleW < 1) cycleW = 1;
8544
8545			track.style.width = cycleW + 'px';
8546		}
8547
8548		function buildClones() {
8549			fillBaseWrapFromSource();
8550			
8551			measureCycle();
8552
8553			if (!infinite) {
8554				var rowP0 = closestRowParent(parent);
8555				var rowId0 = ensureId(rowP0, 'uncode-row');
8556
8557				dispatchClonesEventDebounced({
8558					type: 'measured-only',
8559					parent: parent,
8560					track: track,
8561					baseWrap: baseWrap,
8562					leftWrap: leftWrap,
8563					rightWrap: rightWrap,
8564					rowParent: rowP0,
8565					rowParentId: rowId0,
8566					infinite: false,
8567					cycleW: cycleW,
8568					reps: 0
8569				});
8570
8571				triggerMarqueeRefreshDebounced(baseWrap);
8572				dispatchMarqueeReady();
8573				return true;
8574			}
8575
8576			clearClones();
8577
8578			var parentW = getWidth(parent);
8579			if (!cycleW || !parentW) return false;
8580
8581			var reps = Math.ceil((parentW * 2) / cycleW) + 1;
8582			if (reps < 1) reps = 1;
8583			if (reps > maxReps) reps = maxReps;
8584
8585			var fragL = document.createDocumentFragment();
8586			var fragR = document.createDocumentFragment();
8587			var r, k, clone;
8588
8589			for (r = 0; r < reps; r++) {
8590				for (k = 0; k < base.length; k++) {
8591					clone = base[k].cloneNode(true);
8592					clone.setAttribute('data-marquee-clone', '1');
8593					clone.setAttribute('data-marquee-origin-index', k);
8594					clone.setAttribute('aria-hidden', 'true');
8595					fragL.appendChild(clone);
8596				}
8597			}
8598
8599			for (r = 0; r < reps; r++) {
8600				for (k = 0; k < base.length; k++) {
8601					clone = base[k].cloneNode(true);
8602					clone.setAttribute('data-marquee-clone', '1');
8603					clone.setAttribute('data-marquee-origin-index', k);
8604					clone.setAttribute('aria-hidden', 'true');
8605					fragR.appendChild(clone);
8606				}
8607			}
8608
8609			leftWrap.appendChild(fragL);
8610			rightWrap.appendChild(fragR);
8611
8612			measureCycle();
8613
8614			var rowP = closestRowParent(parent);
8615			var rowId = ensureId(rowP, 'uncode-row');
8616
8617			dispatchClonesEventDebounced({
8618				type: 'clones-built',
8619				parent: parent,
8620				track: track,
8621				baseWrap: baseWrap,
8622				leftWrap: leftWrap,
8623				rightWrap: rightWrap,
8624				rowParent: rowP,
8625				rowParentId: rowId,
8626				infinite: true,
8627				cycleW: cycleW,
8628				reps: reps
8629			});
8630
8631			triggerMarqueeRefreshDebounced(baseWrap);
8632			dispatchMarqueeReady();
8633
8634			return true;
8635		}
8636
8637		function findClosestClone(node) {
8638			while (node && node !== parent) {
8639				if (node.getAttribute && node.getAttribute('data-marquee-clone') === '1') {
8640					return node;
8641				}
8642				node = node.parentNode;
8643			}
8644			return null;
8645		}
8646
8647		function findClickableInsideClone(node, cloneRoot) {
8648			while (node && node !== cloneRoot) {
8649				if (node.matches && node.matches('a[href], [data-lbox], [data-lightbox], .uncode-lbox')) {
8650					return node;
8651				}
8652				node = node.parentNode;
8653			}
8654			return null;
8655		}
8656
8657		function findMatchingOriginalClickable(originalRoot, clickedEl) {
8658			if (!originalRoot || !clickedEl) return null;
8659
8660			var all = originalRoot.querySelectorAll('a[href], [data-lbox], [data-lightbox], .uncode-lbox');
8661			if (!all.length) return null;
8662
8663			var href = clickedEl.getAttribute && clickedEl.getAttribute('href');
8664			var dataLbox = clickedEl.getAttribute && clickedEl.getAttribute('data-lbox');
8665
8666			var i, el;
8667			for (i = 0; i < all.length; i++) {
8668				el = all[i];
8669
8670				if (dataLbox && el.getAttribute('data-lbox') === dataLbox) return el;
8671				if (href && el.getAttribute('href') === href) return el;
8672			}
8673
8674			return all[0];
8675		}
8676
8677		function onCloneDelegatedClick(e) {
8678			var cloneRoot = findClosestClone(e.target);
8679			if (!cloneRoot) return;
8680
8681			var clickedEl = findClickableInsideClone(e.target, cloneRoot);
8682			if (!clickedEl) return;
8683
8684			var idx = parseInt(cloneRoot.getAttribute('data-marquee-origin-index'), 10);
8685			if (isNaN(idx) || !base[idx]) return;
8686
8687			var originalClickable = findMatchingOriginalClickable(base[idx], clickedEl);
8688			if (!originalClickable) return;
8689
8690			if (e.preventDefault) e.preventDefault();
8691			if (e.stopPropagation) e.stopPropagation();
8692			e.cancelBubble = true;
8693
8694			originalClickable.dispatchEvent(new MouseEvent('click', {
8695				bubbles: true,
8696				cancelable: true,
8697				view: window
8698			}));
8699
8700			return false;
8701		}
8702
8703		var xRaw = 0;
8704		var manualOffset = 0;
8705		var lastTs = 0;
8706		var frameId = 0;
8707		var isActive = true;
8708
8709		var lastVisibilityCheck = 0;
8710		var visibilityCheckEvery = 120;
8711
8712		var isDragging = false;
8713		var isTouchDragging = false;
8714		var touchDirectionLocked = null;
8715		var dragStartX = 0;
8716		var dragStartY = 0;
8717		var dragStartOffset = 0;
8718		var hasDragged = false;
8719		var dragThreshold = 6;
8720		var touchDirectionThreshold = 8;
8721
8722		var throwV = 0;
8723		var lastDragX = 0;
8724		var lastDragT = 0;
8725
8726		var lastPageY = getPageY();
8727		var scrollVelocity = 0;
8728
8729		var io = new IntersectionObserver(function(entries) {
8730			isActive = entries[0].isIntersecting;
8731		}, { rootMargin: viewMargin + 'px' });
8732
8733		io.observe(parent);
8734
8735		function updateInView() {
8736			if (!inViewOnly) isActive = true;
8737		}
8738
8739		function getEffectiveSpeed() {
8740			if (hoverSpeed !== null && isHover) return hoverSpeed;
8741			return baseSpeed;
8742		}
8743
8744		function dispatchMarqueeReady() {
8745			if ( SiteParameters.is_frontend_editor ) return;
8746			requestTimeout(function() {
8747
8748				var rowP = closestRowParent(parent);
8749				var rowId = ensureId(rowP, 'uncode-row');
8750
8751				document.dispatchEvent(new CustomEvent('uncode:marquee:ready', {
8752					bubbles: true,
8753					detail: {
8754						parent: parent,
8755						baseWrap: baseWrap,
8756						leftWrap: leftWrap,
8757						rightWrap: rightWrap,
8758						infinite: infinite,
8759						rowParent: rowP,
8760						rowParentId: rowId,
8761					}
8762				}));
8763			}, 0);
8764		}
8765
8766		function triggerMarqueeReinit(contextEl) {
8767			try {
8768				$(document).trigger('uncode-marquee-updated', {
8769					parent: parent,
8770					context: contextEl || baseWrap,
8771					baseWrap: baseWrap,
8772					leftWrap: leftWrap,
8773					rightWrap: rightWrap
8774				});
8775			} catch (e) {}
8776		}
8777
8778		var marqueeRefreshT = 0;
8779		function triggerMarqueeRefreshDebounced(contextEl) {
8780			if (marqueeRefreshT) {
8781				window.clearTimeout(marqueeRefreshT);
8782			}
8783			marqueeRefreshT = window.setTimeout(function() {
8784				triggerMarqueeReinit(contextEl || baseWrap);
8785				marqueeRefreshT = 0;
8786			}, 60);
8787		}
8788		
8789		function render() {
8790			var x;
8791			var totalX = xRaw + manualOffset;
8792
8793			if (infinite) {
8794				var m = totalX % cycleW;
8795				if (m > 0) m -= cycleW;
8796				x = m;
8797			} else {
8798				x = totalX;
8799			}
8800
8801			gsap.set(track, {
8802				x: x,
8803				force3D: true
8804			});
8805		}
8806
8807		function tick(ts) {
8808			if (!lastTs) lastTs = ts;
8809			var dt = (ts - lastTs) / 1000;
8810			lastTs = ts;
8811
8812			if (dt > 0.05) dt = 0.05;
8813
8814			updateInView();
8815
8816			if (!isActive) {
8817				frameId = raf(tick);
8818				return;
8819			}
8820
8821			if (!isDragging) {
8822
8823				if (isFrozenNow()) {
8824					throwV = 0;
8825					frameId = raf(tick);
8826					return;
8827				}
8828
8829				if (isScrolling) {
8830					frameId = raf(tick);
8831					return;
8832				}
8833
8834				if (!scrollDriven) {
8835					var s = getEffectiveSpeed();
8836					if (s) xRaw += (direction * s * dt);
8837				}
8838
8839				if (throwV) {
8840					xRaw += (throwV * dt);
8841					throwV *= Math.pow(0.04, dt);
8842					if (throwV < 8 && throwV > -8) throwV = 0;
8843				}
8844
8845				render();
8846			}
8847
8848			frameId = raf(tick);
8849		}
8850
8851		function start() {
8852			if (!buildClones()) {
8853				window.setTimeout(start, 50);
8854				return;
8855			}
8856
8857			lastTs = 0;
8858
8859			if (isScrollControlled) {
8860				render();
8861				return;
8862			}
8863
8864			if (frameId) caf(frameId);
8865			frameId = raf(tick);
8866			render();
8867		}
8868
8869		function stop() {
8870			if (frameId) caf(frameId);
8871			frameId = 0;
8872		}
8873
8874		function onDown(e) {
8875			if (e.type === 'mousedown' && e.button !== 0) return;
8876			if (isFrozenNow()) return;
8877
8878			dragStartX = getPointX(e);
8879			dragStartY = getPointY(e);
8880			dragStartOffset = manualOffset;
8881			hasDragged = false;
8882
8883			throwV = 0;
8884			lastDragX = dragStartX;
8885			lastDragT = (new Date()).getTime();
8886
8887			isTouchDragging = e.type === 'touchstart';
8888			touchDirectionLocked = null;
8889
8890			if (!isTouchDragging) {
8891				isDragging = true;
8892
8893				if (e.preventDefault) e.preventDefault();
8894				if (e.stopPropagation) e.stopPropagation();
8895			} else {
8896				isDragging = false;
8897			}
8898
8899			bindMoveUp(true);
8900		}
8901
8902		function onMove(e) {
8903			var nowX = getPointX(e);
8904			var nowY = getPointY(e);
8905			var dx = nowX - dragStartX;
8906			var dy = nowY - dragStartY;
8907
8908			if (isTouchDragging && touchDirectionLocked === null) {
8909				if (Math.abs(dx) < touchDirectionThreshold && Math.abs(dy) < touchDirectionThreshold) {
8910					return;
8911				}
8912
8913				if (Math.abs(dy) > Math.abs(dx)) {
8914					touchDirectionLocked = 'vertical';
8915					isDragging = false;
8916					bindMoveUp(false);
8917					return;
8918				}
8919
8920				touchDirectionLocked = 'horizontal';
8921				isDragging = true;
8922			}
8923
8924			if (!isDragging) return;
8925
8926			if (!hasDragged && (dx < -dragThreshold || dx > dragThreshold)) hasDragged = true;
8927
8928			manualOffset = dragStartOffset + dx;
8929			render();
8930
8931			var nowT = (new Date()).getTime();
8932			var dtMs = nowT - lastDragT;
8933			if (dtMs > 0) {
8934				var vx = (nowX - lastDragX) / (dtMs / 1000);
8935				if (vx > 2500) vx = 2500;
8936				if (vx < -2500) vx = -2500;
8937				throwV = vx * 0.5;
8938			}
8939
8940			lastDragX = nowX;
8941			lastDragT = nowT;
8942
8943			if (e.preventDefault) e.preventDefault();
8944		}
8945
8946		function onUp(e) {
8947			if (!isDragging && !isTouchDragging) return;
8948
8949			isDragging = false;
8950			isTouchDragging = false;
8951			touchDirectionLocked = null;
8952
8953			lastTs = 0;
8954			lastPageY = getPageY();
8955
8956			render();
8957			bindMoveUp(false);
8958
8959			if (e && hasDragged && e.preventDefault) e.preventDefault();
8960
8961			setTimeout(function () { hasDragged = false; }, 0);
8962		}
8963
8964		function bindMoveUp(bind) {
8965			if (bind) {
8966				document.addEventListener('mousemove', onMove, false);
8967				document.addEventListener('mouseup', onUp, false);
8968				document.addEventListener('touchmove', onTouchMoveDetect, { passive: true });
8969				document.addEventListener('touchend', onUp, false);
8970				document.addEventListener('touchcancel', onUp, false);
8971			} else {
8972				document.removeEventListener('mousemove', onMove, false);
8973				document.removeEventListener('mouseup', onUp, false);
8974				document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8975				document.removeEventListener('touchmove', onMove, { passive: false });
8976				document.removeEventListener('touchend', onUp, false);
8977				document.removeEventListener('touchcancel', onUp, false);
8978			}
8979		}
8980
8981		function onTouchMoveDetect(e) {
8982			var dx = Math.abs(getPointX(e) - dragStartX);
8983			var dy = Math.abs(getPointY(e) - dragStartY);
8984			if (dx < touchDirectionThreshold && dy < touchDirectionThreshold) return;
8985
8986			document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8987
8988			if (dy > dx) {
8989				isDragging = false;
8990				touchDirectionLocked = 'vertical';
8991				bindMoveUp(false);
8992			} else {
8993				touchDirectionLocked = 'horizontal';
8994				isDragging = true;
8995				document.addEventListener('touchmove', onMove, { passive: false });
8996			}
8997		}
8998
8999		if (parent.addEventListener) {
9000			if (draggable) {
9001				parent.addEventListener('mousedown', onDown, false);
9002				parent.addEventListener('touchstart', onDown, { passive: true });
9003			}
9004
9005			if (hoverSpeed !== null) {
9006				parent.addEventListener('mouseenter', function () { isHover = true; }, false);
9007				parent.addEventListener('mouseleave', function () { isHover = false; }, false);
9008			}
9009
9010			parent.addEventListener('click', onCloneDelegatedClick, false);
9011
9012		} else {
9013			if (draggable) {
9014				parent.onmousedown = onDown;
9015				parent.ontouchstart = onDown;
9016			}
9017		}
9018
9019		function onClickCapture(e) {
9020			if (hasDragged) {
9021				if (e.preventDefault) e.preventDefault();
9022				if (e.stopPropagation) e.stopPropagation();
9023				e.cancelBubble = true;
9024				return false;
9025			}
9026		}
9027
9028		if (draggable) {
9029			if (parent.addEventListener) parent.addEventListener('click', onClickCapture, true);
9030			else parent.onclick = onClickCapture;
9031		}
9032
9033		var resizeTimer = 0;
9034		var lastResizeW = getViewportW();
9035
9036		function onResize() {
9037			var currentW = getViewportW();
9038
9039			if (Math.abs(currentW - lastResizeW) < 2) {
9040				return;
9041			}
9042
9043			lastResizeW = currentW;
9044
9045			if (resizeTimer) window.clearTimeout(resizeTimer);
9046
9047			resizeTimer = window.setTimeout(function () {
9048				buildClones();
9049				render();
9050			}, 150);
9051		}
9052
9053		if (window.addEventListener) window.addEventListener('resize', onResize, false);
9054		else window.onresize = onResize;
9055
9056		var isScrolling = false;
9057		var scrollEndTimer = 0;
9058
9059		function onWindowScroll() {
9060			isScrolling = true;
9061			if (scrollEndTimer) clearTimeout(scrollEndTimer);
9062			scrollEndTimer = setTimeout(function () {
9063				isScrolling = false;
9064				lastTs = 0; // evita spike dt alla ripresa
9065			}, 80);
9066		}
9067
9068		if (scrollDriven) {
9069			if (window.addEventListener) window.addEventListener('scroll', onWindowScroll, { passive: true });
9070			else window.onscroll = onWindowScroll;
9071		}
9072
9073		start();
9074
9075		window.setTimeout(function () {
9076			buildClones();
9077			render();
9078			triggerMarqueeRefreshDebounced(baseWrap);
9079		}, 500);
9080
9081		return {
9082			start: start,
9083			stop: stop,
9084			setX: function (value) { xRaw = value; render(); },
9085			addX: function (delta) { xRaw += delta; render(); },
9086			setManualOffset: function (value) { manualOffset = value; render(); },
9087			getManualOffset: function () { return manualOffset; },
9088			resetManualOffset: function () { manualOffset = 0; render(); },
9089			getCycleW: function () { return cycleW; },
9090			update: function () {
9091				buildClones();
9092				render();
9093			},
9094			isFrozen: function () { return isFrozenNow(); }
9095		};
9096	}
9097
9098	function initMarqueesOnce() {
9099		if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') {
9100			return false;
9101		}
9102		gsap.registerPlugin(ScrollTrigger);
9103		function getViewportW() {
9104			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9105		}
9106		var wrappers = document.querySelectorAll('.cs-wrapper-marquee, .cs-wrapper');
9107
9108		if (!wrappers || !wrappers.length) wrappers = document.getElementsByClassName('cs-wrapper');
9109
9110		var itemClass = 'cs-container';
9111
9112		if (!wrappers || !wrappers.length) {
9113			return false;
9114		}
9115
9116		function isScrollMode(wrapper) {
9117			var mode = wrapper.getAttribute('data-mode');
9118			return mode === 'marquee-scroll' || mode === 'marquee-scroll-opposite';
9119		}
9120
9121		function getDirection(wrapper) {
9122			var mode = wrapper.getAttribute('data-mode');
9123			if (mode === 'marquee-opposite' || mode === 'marquee-scroll-opposite') return 1;
9124			return -1;
9125		}
9126
9127		function clamp(v, a, b) { return v < a ? a : (v > b ? b : v); }
9128
9129		function readStep(wrapper) {
9130			var v = parseFloat(wrapper.getAttribute('data-speed'));
9131			if (isNaN(v)) v = 0;
9132			return clamp(v, -4, 4);
9133		}
9134
9135		function stepToPxPerSec(step, baseDefault) {
9136			return (baseDefault / 5) * (step + 5);
9137		}
9138
9139		function readFreeze(wrapper) {
9140			var f = wrapper.getAttribute('data-freeze');
9141			if (f !== 'always' && f !== 'desktop' && f !== 'mobile') return null;
9142			return f;
9143		}
9144
9145		function isFrozenByAttr(freezeMode, bp) {
9146			if (!freezeMode) return false;
9147			var w = window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9148			if (freezeMode === 'always') return true;
9149			if (freezeMode === 'desktop') return w >= bp;
9150			if (freezeMode === 'mobile') return w < bp;
9151			return false;
9152		}
9153
9154		var baseDefault = 50;
9155		var autoFactor = 5;
9156		var freezeBp = 960;
9157
9158		var inited = 0;
9159
9160		for (var i = 0; i < wrappers.length; i++) {
9161			(function (wrapper) {
9162
9163				if (wrapper.getAttribute('data-anim') !== 'uncode_slider_marquee') {
9164					return;
9165				}
9166
9167				var items = wrapper.getElementsByClassName(itemClass);
9168				if (!items || !items.length) {
9169					return;
9170				}
9171
9172				var scrollMode = isScrollMode(wrapper);
9173				var dir = getDirection(wrapper);
9174
9175				var step = readStep(wrapper);
9176				var pxPerSec = stepToPxPerSec(step, baseDefault);
9177				var autoplayPxPerSec = pxPerSec * autoFactor;
9178
9179				var needHover = wrapper.getAttribute('data-hover');
9180				var hoverSpeed;
9181				if (needHover === 'yes') hoverSpeed = autoplayPxPerSec * 0.2;
9182				else if (needHover === 'pause') hoverSpeed = 0;
9183				else hoverSpeed = autoplayPxPerSec;
9184
9185				var freeze = readFreeze(wrapper);
9186
9187				var marquee = createMarquee({
9188					parent: wrapper,
9189					originals: items,
9190					infinite: wrapper.getAttribute('data-infinite') === 'yes' && !SiteParameters.is_frontend_editor,
9191					speed: scrollMode ? 0 : autoplayPxPerSec,
9192					draggable: wrapper.getAttribute('data-draggable') === 'yes' || SiteParameters.is_frontend_editor,
9193					scrollDriven: false,
9194					isScrollControlled: scrollMode,
9195					inViewOnly: true,
9196					viewMargin: 300,
9197					maxReps: getViewportW() < 570 ? 4 : 8,
9198					direction: dir,
9199					hoverSpeed: scrollMode || SiteParameters.is_frontend_editor ? 0 : hoverSpeed,
9200					freeze: freeze && !SiteParameters.is_frontend_editor,
9201					freezeBp: freezeBp
9202				});
9203
9204				if (!marquee) {
9205					return;
9206				}
9207
9208				wrapper._uncodeMarqueeApi = marquee;
9209	
9210				inited++;
9211
9212				if (!scrollMode || SiteParameters.is_frontend_editor) {
9213					ScrollTrigger.create({
9214						trigger: wrapper,
9215						start: 'top bottom',
9216						end: 'bottom top',
9217						invalidateOnRefresh: true,
9218						refreshPriority: -1,
9219						onEnter: function () {
9220							if (isFrozenByAttr(freeze, freezeBp)) return;
9221							marquee.start();
9222						},
9223						onEnterBack: function () {
9224							if (isFrozenByAttr(freeze, freezeBp)) return;
9225							marquee.start();
9226						},
9227						onLeave: function () { marquee.stop(); },
9228						onLeaveBack: function () { marquee.stop(); }
9229					});
9230				} else {
9231					ScrollTrigger.create({
9232						trigger: wrapper,
9233						start: 'top bottom',
9234						end: 'bottom top',
9235						scrub: true,
9236						invalidateOnRefresh: true,
9237						refreshPriority: -1,
9238						onUpdate: function (self) {
9239							if (isFrozenByAttr(freeze, freezeBp)) return;
9240
9241							var w = marquee.getCycleW();
9242							if (!w) return;
9243
9244							var cycles = pxPerSec / baseDefault;
9245
9246							if (getViewportW() < 570) {
9247								cycles *= 0.55;
9248							}
9249
9250							marquee.setX(dir * self.progress * cycles * w);
9251						}
9252					});
9253				}
9254
9255			})(wrappers[i]);
9256		}
9257
9258		if (typeof ResizeObserver !== 'undefined' && typeof ScrollTrigger !== 'undefined') {
9259			var t = 0;
9260			function refreshST() {
9261				if (t) window.clearTimeout(t);
9262				t = window.setTimeout(function () {
9263					ScrollTrigger.refresh();
9264				}, 150);
9265			}
9266
9267			var ro = new ResizeObserver(function () {
9268				refreshST();
9269			});
9270
9271			if (getViewportW() >= 960) {
9272				ro.observe(document.body);
9273			}
9274		}
9275
9276		window.setTimeout(function () {
9277			if (typeof ScrollTrigger !== 'undefined') {
9278				ScrollTrigger.sort();
9279				ScrollTrigger.refresh();
9280			}
9281		}, 0);
9282		
9283		return true;
9284	}
9285
9286	(function retryInit() {
9287		var tries = 0;
9288		var maxTries = 40;
9289		function go() {
9290			tries++;
9291			var ok = initMarqueesOnce();
9292			if (ok) return;
9293			if (tries >= maxTries) {
9294				return;
9295			}
9296			window.setTimeout(go, 100);
9297		}
9298		go();
9299	})();
9300};
9301UNCODE.wrapperSticky = function(){
9302    (function () {
9303        if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') return;
9304        gsap.registerPlugin(ScrollTrigger);
9305
9306        var wrappers = document.getElementsByClassName('cs-wrapper-sticky');
9307        var i;
9308
9309        function ensureTrack(wrapper) {
9310            var track = wrapper.querySelector('.cs-track');
9311            if (track) return track;
9312
9313            track = document.createElement('div');
9314            track.className = 'cs-track';
9315
9316            var items = wrapper.getElementsByClassName('cs-container');
9317            var list = [];
9318            var k;
9319            for (k = 0; k < items.length; k++) list.push(items[k]);
9320
9321            wrapper.insertBefore(track, wrapper.firstChild);
9322            for (k = 0; k < list.length; k++) track.appendChild(list[k]);
9323
9324            return track;
9325        }
9326
9327        function setupHorizontalPin(wrapper) {
9328            var track = ensureTrack(wrapper);
9329            var tween = null;
9330            var st = null;
9331
9332            function getTriggerElement() {
9333                if (wrapper.closest) {
9334                    return wrapper.closest('.vc_row[data-parent]') || wrapper;
9335                }
9336                return wrapper;
9337            }
9338
9339            function isStickyDisabled() {
9340                var w = window.innerWidth || document.documentElement.clientWidth;
9341
9342                if (wrapper.getAttribute('data-disable-sticky-mobile') === 'yes' && w < 570) {
9343                    return true;
9344                }
9345
9346                if (wrapper.getAttribute('data-disable-sticky-tablet') === 'yes' && w < 960) {
9347                    return true;
9348                }
9349
9350                return false;
9351            }
9352
9353            function getDirection() {
9354                var d = wrapper.getAttribute('data-direction');
9355                if (d === 'reverse' || d === 'rtl' || d === 'right') return 1;
9356                return -1;
9357            }
9358
9359            function getStartPosition() {
9360                var align = wrapper.getAttribute('data-align');
9361                return align ? align : 'top top';
9362            }
9363
9364            function getDistance() {
9365                var wrapperW = wrapper.getBoundingClientRect
9366                    ? wrapper.getBoundingClientRect().width
9367                    : wrapper.offsetWidth;
9368
9369                var dist = track.scrollWidth - wrapperW;
9370                if (dist < 0) dist = 0;
9371                return dist;
9372            }
9373
9374            function destroy() {
9375                if (st) {
9376                    st.kill();
9377                    st = null;
9378                }
9379
9380                if (tween) {
9381                    tween.kill();
9382                    tween = null;
9383                }
9384
9385                gsap.set(track, { clearProps: 'transform' });
9386            }
9387
9388            function make() {
9389                destroy();
9390
9391                if (isStickyDisabled()) {
9392                    return;
9393                }
9394
9395                var dist = getDistance();
9396                if (!dist) return;
9397
9398                var dir = getDirection();
9399                var startPos = getStartPosition();
9400                var triggerEl = getTriggerElement();
9401
9402                gsap.set(track, { x: 0 });
9403
9404                tween = gsap.to(track, {
9405                    x: dist * dir,
9406                    ease: 'none',
9407                    scrollTrigger: {
9408                        trigger: triggerEl,
9409                        start: startPos,
9410                        end: function () { return '+=' + dist; },
9411                        scrub: true,
9412                        pin: triggerEl,
9413                        anticipatePin: 1,
9414                        invalidateOnRefresh: true
9415                    }
9416                });
9417
9418                st = tween.scrollTrigger;
9419            }
9420
9421            make();
9422
9423            ScrollTrigger.addEventListener('refreshInit', function () {
9424                if (!isStickyDisabled()) {
9425                    gsap.set(track, { x: 0 });
9426                }
9427            });
9428
9429            var resizeT = 0;
9430            var lastResizeW = window.innerWidth || document.documentElement.clientWidth;
9431
9432            window.addEventListener('resize', function () {
9433                var currentW = window.innerWidth || document.documentElement.clientWidth;
9434
9435                if (Math.abs(currentW - lastResizeW) < 2) {
9436                    return;
9437                }
9438
9439                lastResizeW = currentW;
9440
9441                if (resizeT) window.clearTimeout(resizeT);
9442
9443                resizeT = window.setTimeout(function () {
9444                    make();
9445                    ScrollTrigger.refresh();
9446                }, 150);
9447            }, false);
9448
9449            setTimeout(function () {
9450                ScrollTrigger.refresh();
9451            }, 500);
9452        }
9453
9454        for (i = 0; i < wrappers.length; i++) {
9455            setupHorizontalPin(wrappers[i]);
9456        }
9457    })();
9458
9459};
9460UNCODE.mouseTrail = (function () {
9461
9462	"use strict";
9463
9464	var __globalDestroy = null;
9465
9466	return function () {
9467
9468		if (typeof __globalDestroy === "function") {
9469			try { __globalDestroy(); } catch (e) {}
9470			__globalDestroy = null;
9471		}
9472
9473		function initImageTrail(options) {
9474
9475			options = options || {};
9476
9477			var area = options.area;
9478			var hoverArea = options.hoverArea;
9479
9480			var images       = options.images || [];
9481			var size         = options.size != null ? options.size : 120;
9482
9483			var minWidth = (options.minWidth != null) ? options.minWidth : null;
9484			var maxWidth = (options.maxWidth != null) ? options.maxWidth : null;
9485
9486			var life         = options.life != null ? options.life : 1.6;
9487			var spawnEvery   = options.spawnEvery != null ? options.spawnEvery : 60;
9488			var touchSpawnEvery = options.touchSpawnEvery != null
9489				? options.touchSpawnEvery
9490				: spawnEvery * 2;
9491			var minDistance  = options.minDistance != null ? options.minDistance : 18;
9492			var rotateRange  = options.rotateRange != null ? options.rotateRange : 10;
9493			var scaleRange   = options.scaleRange || [0.9, 1.05];
9494			var zIndex       = options.zIndex != null ? options.zIndex : 10;
9495			var inOpacity    = options.inOpacity != null ? options.inOpacity : 0;
9496			var midOpacity   = options.midOpacity != null ? options.midOpacity : 1;
9497			var outOpacity   = options.outOpacity != null ? options.outOpacity : 0;
9498			var drift        = options.drift != null ? options.drift : true;
9499
9500			var poolSize     = options.poolSize != null ? options.poolSize : 16;
9501
9502			var inScale      = options.inScale != null ? options.inScale : 0.6;
9503			var outScale     = options.outScale != null ? options.outScale : 0.6;
9504			var inDuration   = options.inDuration != null ? options.inDuration : 0.2;
9505			var outDuration  = options.outDuration != null ? options.outDuration : 0.35;
9506			var inEase       = options.inEase || "power3.out";
9507			var outEase      = options.outEase || "power3.in";
9508
9509			var scrollOn     = options.scrollOn != null ? options.scrollOn : true;
9510
9511			if (!area || !hoverArea) return null;
9512
9513			var areaStyle = window.getComputedStyle(area);
9514			if (areaStyle.position === "static") area.style.position = "relative";
9515
9516			var lastTime = 0;
9517			var lastX = null;
9518			var lastY = null;
9519
9520			var pointerX = null;
9521			var pointerY = null;
9522
9523			var scrollLastTime = 0;
9524			var scrollLastPageY = null;
9525			var scrollSpawnEvery = options.scrollSpawnEvery != null ? options.scrollSpawnEvery : 220;
9526			var scrollMinDistance = options.scrollMinDistance != null ? options.scrollMinDistance : 40;
9527
9528			var touchViewportOn = options.touchViewportOn !== false;
9529			var desktopAutoOn = options.desktopAutoOn === true;
9530
9531			var safeW = options.safeW != null ? options.safeW : 0;
9532			var safeH = options.safeH != null ? options.safeH : 0;
9533			var safeMode = options.safeMode || "avoid";
9534			var particleSafeAreaOn = options.particleSafeAreaOn === true;
9535
9536			var isTouchDevice = (
9537				("ontouchstart" in window) ||
9538				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
9539				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
9540			) && !window.matchMedia("(pointer: fine)").matches;
9541
9542			var useAutoViewportTrail = isTouchDevice
9543				? touchViewportOn
9544				: desktopAutoOn;
9545
9546			var autoSpawnEvery = isTouchDevice
9547				? touchSpawnEvery
9548				: spawnEvery;
9549
9550			var autoTimer = null;
9551			var autoRunning = false;
9552			var rafWatch = 0;
9553			var watchActive = true;
9554
9555			var i = 0;
9556
9557			for (var p = 0; p < images.length; p++) {
9558				var preload = new Image();
9559				preload.src = images[p];
9560			}
9561
9562			var pool = [];
9563			var poolIndex = 0;
9564
9565			function rectVisible(rect, vh) {
9566				return rect.bottom > 0 && rect.top < vh && rect.height > 0;
9567			}
9568
9569			function buildSafeRect(rect) {
9570				if (!particleSafeAreaOn || !safeW || !safeH) return null;
9571
9572				var w = rect.width * (safeW / 100);
9573				var h = rect.height * (safeH / 100);
9574
9575				if (!w || !h) return null;
9576
9577				return {
9578					left: rect.left + (rect.width - w) / 2,
9579					top: rect.top + (rect.height - h) / 2,
9580					right: rect.left + (rect.width + w) / 2,
9581					bottom: rect.top + (rect.height + h) / 2,
9582					width: w,
9583					height: h
9584				};
9585			}
9586
9587			function pointInSafeRect(x, y, safeRect) {
9588				if (!safeRect) return false;
9589				return (
9590					x >= safeRect.left &&
9591					x <= safeRect.right &&
9592					y >= safeRect.top &&
9593					y <= safeRect.bottom
9594				);
9595			}
9596
9597			function randomPointInRect(rect) {
9598				var safeRect = buildSafeRect(rect);
9599
9600				if (!safeRect) {
9601					return {
9602						x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9603						y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9604					};
9605				}
9606
9607				if (safeMode === "soft") {
9608					var best = null;
9609					var cx = safeRect.left + safeRect.width / 2;
9610					var cy = safeRect.top + safeRect.height / 2;
9611
9612					for (var i = 0; i < 40; i++) {
9613						var x = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9614						var y = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9615
9616						var dx = x - cx;
9617						var dy = y - cy;
9618						var dist = Math.sqrt(dx * dx + dy * dy);
9619
9620						if (pointInSafeRect(x, y, safeRect)) {
9621							dist -= 99999;
9622						}
9623
9624						if (!best || dist > best.score) {
9625							best = {
9626								x: x,
9627								y: y,
9628								score: dist
9629							};
9630						}
9631					}
9632
9633					return {
9634						x: best.x,
9635						y: best.y
9636					};
9637				}
9638
9639				for (var j = 0; j < 40; j++) {
9640					var px = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9641					var py = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9642
9643					if (!pointInSafeRect(px, py, safeRect)) {
9644						return {
9645							x: px,
9646							y: py
9647						};
9648					}
9649				}
9650
9651				return {
9652					x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9653					y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9654				};
9655			}
9656
9657			function spawnRandomInViewportArea() {
9658				var rect = hoverArea.getBoundingClientRect();
9659				var vh = window.innerHeight || document.documentElement.clientHeight;
9660
9661				if (!rectVisible(rect, vh)) return;
9662
9663				var p = randomPointInRect(rect);
9664
9665				lastX = null;
9666				lastY = null;
9667
9668				spawn(p.x, p.y);
9669			}
9670
9671			function startAutoViewportTrail() {
9672				if (!useAutoViewportTrail || autoRunning) return;
9673
9674				autoRunning = true;
9675
9676				function loop() {
9677					if (!autoRunning) return;
9678					spawnRandomInViewportArea();
9679					autoTimer = setTimeout(loop, autoSpawnEvery);
9680				}
9681
9682				loop();
9683			}
9684
9685			function stopAutoViewportTrail() {
9686				autoRunning = false;
9687				if (autoTimer) {
9688					clearTimeout(autoTimer);
9689					autoTimer = null;
9690				}
9691			}
9692
9693			function resetPool() {
9694				for (var ii = 0; ii < pool.length; ii++) {
9695					var img = pool[ii];
9696					if (!img) continue;
9697
9698					img.__trailToken = (img.__trailToken || 0) + 1;
9699					gsap.killTweensOf(img);
9700
9701					gsap.set(img, {
9702						x: -9999,
9703						y: -9999,
9704						opacity: 0,
9705						scale: inScale,
9706						rotation: 0
9707					});
9708				}
9709			}
9710
9711			function onVisibilityChange() {
9712				if (document.visibilityState === "hidden") {
9713					stopAutoViewportTrail();
9714					resetPool();
9715					lastX = null;
9716					lastY = null;
9717					scrollLastPageY = null;
9718					pointerX = null;
9719					pointerY = null;
9720					lastTime = 0;
9721					scrollLastTime = 0;
9722					if (rafWatch) {
9723						cancelAnimationFrame(rafWatch);
9724						rafWatch = 0;
9725					}
9726				} else {
9727					resetPool();
9728					if (useAutoViewportTrail) {
9729						watchViewportAutoState();
9730					}
9731				}
9732			}
9733
9734			function watchViewportAutoState() {
9735				if (!watchActive || rafWatch) return;
9736
9737				function tick() {
9738					if (!watchActive) {
9739						rafWatch = 0;
9740						return;
9741					}
9742
9743					if (useAutoViewportTrail) {
9744						var rect = hoverArea.getBoundingClientRect();
9745						var vh = window.innerHeight || document.documentElement.clientHeight;
9746
9747						if (rectVisible(rect, vh)) startAutoViewportTrail();
9748						else stopAutoViewportTrail();
9749					}
9750
9751					rafWatch = requestAnimationFrame(tick);
9752				}
9753
9754				rafWatch = requestAnimationFrame(tick);
9755			}
9756
9757			function endsWith(str, suffix) {
9758				str = String(str);
9759				suffix = String(suffix);
9760				return str.indexOf(suffix, str.length - suffix.length) !== -1;
9761			}
9762
9763			function cssSizeToPx(value, referenceEl) {
9764				if (value == null) return null;
9765				if (typeof value === "number") return value;
9766
9767				value = String(value).trim();
9768
9769				if (endsWith(value, "px")) return parseFloat(value);
9770				if (endsWith(value, "vw")) return window.innerWidth * parseFloat(value) / 100;
9771				if (endsWith(value, "vh")) return window.innerHeight * parseFloat(value) / 100;
9772
9773				if (endsWith(value, "%")) {
9774					var rect = referenceEl.getBoundingClientRect();
9775					return rect.width * parseFloat(value) / 100;
9776				}
9777
9778				if (!isNaN(value)) return parseFloat(value);
9779
9780				return null;
9781			}
9782
9783			function getRandomWidthPx() {
9784
9785				if (minWidth == null && maxWidth == null) return null;
9786
9787				var minPx = cssSizeToPx(minWidth, area);
9788				var maxPx = cssSizeToPx(maxWidth, area);
9789
9790				if (minPx == null && maxPx == null) return null;
9791
9792				if (minPx == null) minPx = maxPx;
9793				if (maxPx == null) maxPx = minPx;
9794
9795				if (maxPx < minPx) {
9796					var t = minPx;
9797					minPx = maxPx;
9798					maxPx = t;
9799				}
9800
9801				return gsap.utils.random(minPx, maxPx, 1);
9802			}
9803
9804			function applySizing(el) {
9805				el.style.minWidth = "";
9806				el.style.maxWidth = "";
9807
9808				if (size !== "auto" && size != null) {
9809					el.style.width = (typeof size === "number") ? (size + "px") : String(size);
9810					el.style.height = "auto";
9811					return;
9812				}
9813
9814				el.style.width = "";
9815				el.style.height = "auto";
9816
9817				if (minWidth != null && minWidth !== "") el.style.minWidth = String(minWidth);
9818				if (maxWidth != null && maxWidth !== "") el.style.maxWidth = String(maxWidth);
9819			}
9820
9821			for (var k = 0; k < poolSize; k++) {
9822				var el = document.createElement("img");
9823				el.className = "trail-img";
9824
9825				applySizing(el);
9826
9827				el.style.zIndex = zIndex;
9828				el.style.position = "absolute";
9829				el.style.left = "0";
9830				el.style.top = "0";
9831				el.style.pointerEvents = "none";
9832				el.style.userSelect = "none";
9833				el.style.willChange = "transform,opacity";
9834
9835				el.__trailToken = 0;
9836
9837				area.appendChild(el);
9838
9839				gsap.set(el, {
9840					x: -9999,
9841					y: -9999,
9842					opacity: 0,
9843					scale: inScale,
9844					rotation: 0,
9845					transformOrigin: "50% 50%"
9846				});
9847
9848				pool.push(el);
9849			}
9850
9851			function whenDecoded(img, cb) {
9852				if (img && img.decode) {
9853					img.decode().then(function () { cb(); }).catch(function () { cb(); });
9854				} else {
9855					cb();
9856				}
9857			}
9858
9859			function spawn(clientX, clientY) {
9860
9861				if (!images.length) return;
9862
9863				var src = images[i % images.length];
9864				i++;
9865
9866				var img = pool[poolIndex % pool.length];
9867				poolIndex++;
9868
9869				if (img.parentNode !== area) area.appendChild(img);
9870
9871				img.__trailToken = (img.__trailToken || 0) + 1;
9872				var token = img.__trailToken;
9873
9874				gsap.killTweensOf(img);
9875
9876				applySizing(img);
9877
9878				if (img.getAttribute("src") !== src) {
9879					img.setAttribute("src", src);
9880				}
9881
9882				var rect = area.getBoundingClientRect();
9883				var localX = clientX - rect.left;
9884				var localY = clientY - rect.top;
9885
9886				var rot = gsap.utils.random(-rotateRange, rotateRange, 0.1);
9887				var scl = gsap.utils.random(scaleRange[0], scaleRange[1], 0.01);
9888
9889				var randomWidth = getRandomWidthPx();
9890				if (randomWidth) {
9891					img.style.width = randomWidth + "px";
9892					img.style.height = "auto";
9893				}
9894
9895				gsap.set(img, {
9896					x: localX,
9897					y: localY,
9898					xPercent: -50,
9899					yPercent: -50,
9900					rotation: rot,
9901					scale: inScale,
9902					opacity: inOpacity,
9903					transformOrigin: "50% 50%"
9904				});
9905
9906				whenDecoded(img, function () {
9907
9908					if (img.__trailToken !== token) return;
9909
9910					var tl = gsap.timeline({
9911						onComplete: function () {
9912							if (img.__trailToken !== token) return;
9913							gsap.set(img, { x: -9999, y: -9999, opacity: 0, scale: inScale, rotation: 0 });
9914						}
9915					});
9916
9917					tl.to(img, {
9918						opacity: midOpacity,
9919						scale: scl,
9920						duration: inDuration,
9921						ease: inEase
9922					}, 0);
9923
9924					if (drift) {
9925						tl.to(img, {
9926							x: "+=" + gsap.utils.random(-12, 12, 1),
9927							y: "+=" + gsap.utils.random(-18, 18, 1),
9928							rotation: rot + gsap.utils.random(-6, 6, 0.1),
9929							duration: life,
9930							ease: inEase
9931						}, 0);
9932					}
9933
9934					tl.to(img, {
9935						opacity: outOpacity,
9936						scale: outScale,
9937						duration: outDuration,
9938						ease: outEase
9939					}, Math.max(0, life - outDuration));
9940
9941				});
9942			}
9943
9944			function onMove(e) {
9945
9946				pointerX = e.clientX;
9947				pointerY = e.clientY;
9948
9949				var now = Date.now();
9950				if (now - lastTime < spawnEvery) return;
9951
9952				var x = e.clientX;
9953				var y = e.clientY;
9954
9955				if (lastX !== null) {
9956					var dx = x - lastX;
9957					var dy = y - lastY;
9958					var dist = Math.sqrt(dx * dx + dy * dy);
9959					if (dist < minDistance) return;
9960				}
9961
9962				lastTime = now;
9963				lastX = x;
9964				lastY = y;
9965
9966				spawn(x, y);
9967			}
9968
9969			function onLeave() {
9970				lastX = null;
9971				lastY = null;
9972				scrollLastPageY = null;
9973			}
9974
9975			function onPointerMove(e) {
9976				pointerX = e.clientX;
9977				pointerY = e.clientY;
9978			}
9979
9980			function pointInRect(x, y, rect) {
9981				return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
9982			}
9983
9984			function onScroll() {
9985
9986				if (pointerX === null || pointerY === null) return;
9987
9988				var now = Date.now();
9989				if (now - scrollLastTime < scrollSpawnEvery) return;
9990
9991				var rect = hoverArea.getBoundingClientRect();
9992				if (!pointInRect(pointerX, pointerY, rect)) return;
9993
9994				var pageY = window.pageYOffset || document.documentElement.scrollTop || 0;
9995
9996				if (scrollLastPageY !== null) {
9997					var scrollDelta = Math.abs(pageY - scrollLastPageY);
9998					if (scrollDelta < scrollMinDistance) return;
9999				}
10000
10001				var x = Math.min(Math.max(pointerX, rect.left + 1), rect.right - 1);
10002				var y = Math.min(Math.max(pointerY, rect.top + 1), rect.bottom - 1);
10003
10004				scrollLastTime = now;
10005				scrollLastPageY = pageY;
10006
10007				spawn(x, y);
10008			}
10009
10010			if (!useAutoViewportTrail) {
10011				hoverArea.addEventListener("mousemove", onMove);
10012				hoverArea.addEventListener("mouseleave", onLeave);
10013
10014				if (scrollOn) {
10015					window.addEventListener("mousemove", onPointerMove, { passive: true });
10016					window.addEventListener("scroll", onScroll, { passive: true });
10017				}
10018			} else {
10019				watchViewportAutoState();
10020			}
10021
10022			document.addEventListener("visibilitychange", onVisibilityChange);
10023
10024			return function () {
10025
10026				document.removeEventListener("visibilitychange", onVisibilityChange);
10027
10028				if (!useAutoViewportTrail) {
10029					hoverArea.removeEventListener("mousemove", onMove);
10030					hoverArea.removeEventListener("mouseleave", onLeave);
10031
10032					if (scrollOn) {
10033						window.removeEventListener("mousemove", onPointerMove);
10034						window.removeEventListener("scroll", onScroll);
10035					}
10036				}
10037
10038				stopAutoViewportTrail();
10039
10040				watchActive = false;
10041				if (rafWatch) {
10042					cancelAnimationFrame(rafWatch);
10043					rafWatch = 0;
10044				}
10045
10046				for (var ii = 0; ii < pool.length; ii++) {
10047					if (pool[ii] && pool[ii].parentNode) {
10048						gsap.killTweensOf(pool[ii]);
10049						pool[ii].parentNode.removeChild(pool[ii]);
10050					}
10051				}
10052				pool.length = 0;
10053			};
10054
10055		}
10056
10057		function getTrailImagesFromArea(area, useParticleImages) {
10058			var node = null;
10059
10060			if (useParticleImages) {
10061				node = area.querySelector(".particle-images");
10062				if (!node) node = area.querySelector(".trail-images");
10063			} else {
10064				node = area.querySelector(".trail-images");
10065				if (!node) node = area.querySelector(".particle-images");
10066			}
10067
10068			if (!node) return [];
10069
10070			var json = node.textContent || node.innerText || "[]";
10071			try {
10072				return JSON.parse(json);
10073			} catch (e) {
10074				return [];
10075			}
10076		}
10077
10078		function closestPolyfill(el, selector) {
10079			while (el && el.nodeType === 1) {
10080				if (matchesSelector(el, selector)) return el;
10081				el = el.parentNode;
10082			}
10083			return null;
10084		}
10085
10086		function matchesSelector(el, selector) {
10087			var p = Element.prototype;
10088			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10089			if (!fn) return false;
10090			return fn.call(el, selector);
10091		}
10092
10093		function getDataFromArea(area, key, fallback) {
10094			if (!area || !key) return fallback;
10095
10096			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10097			var raw = area.getAttribute(attr);
10098			if (raw == null) return fallback;
10099
10100			raw = String(raw).trim();
10101
10102			if (raw === "true") return true;
10103			if (raw === "false") return false;
10104			if (raw === "null") return null;
10105
10106			var num = raw.replace(",", ".");
10107			if (num !== "" && isFinite(num)) return parseFloat(num);
10108
10109			if (
10110				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10111				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10112			) {
10113				try { return JSON.parse(raw); } catch (e) {}
10114			}
10115
10116			return raw;
10117		}
10118
10119		var destroyers = [];
10120
10121		var areas = document.querySelectorAll(".uncode-bg-trail");
10122		for (var n = 0; n < areas.length; n++) {
10123
10124			var renderArea = areas[n];
10125
10126			if (renderArea.__trailDestroy && typeof renderArea.__trailDestroy === "function") {
10127				try { renderArea.__trailDestroy(); } catch (e) {}
10128				renderArea.__trailDestroy = null;
10129			}
10130
10131			var hoverArea = renderArea.closest
10132				? renderArea.closest('.vc_row[data-parent="true"]')
10133				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10134
10135			if (!hoverArea) continue;
10136
10137			var isTouchDevice = (
10138				("ontouchstart" in window) ||
10139				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
10140				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
10141			) && !window.matchMedia("(pointer: fine)").matches;
10142
10143			var desktopAutoOn = String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes";
10144			var mobileAutoOn = String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes";
10145
10146			var useParticleImages = isTouchDevice ? mobileAutoOn : desktopAutoOn;
10147
10148			var images = getTrailImagesFromArea(renderArea, useParticleImages);
10149
10150			renderArea.__trailDestroy = initImageTrail({
10151				area: renderArea,
10152				hoverArea: hoverArea,
10153				images: images,
10154				size: "auto",
10155
10156				minWidth: getDataFromArea(renderArea, "min-width", null),
10157				maxWidth: getDataFromArea(renderArea, "max-width", null),
10158
10159				life: (getDataFromArea(renderArea, "life", 1) +
10160					getDataFromArea(renderArea, "in-duration", 0.25) +
10161					getDataFromArea(renderArea, "out-duration", 0.3)),
10162
10163				spawnEvery: getDataFromArea(renderArea, "interval", 100),
10164				minDistance: getDataFromArea(renderArea, "distance", 150),
10165				scrollSpawnEvery: Math.max(180, getDataFromArea(renderArea, "interval", 100) * 2),
10166				scrollMinDistance: 30,
10167
10168				poolSize: getDataFromArea(renderArea, "count", 16),
10169
10170				inScale: 0,
10171				outScale: 0,
10172				inDuration: getDataFromArea(renderArea, "in-duration", 0.25),
10173				outDuration: getDataFromArea(renderArea, "out-duration", 0.3),
10174
10175				rotateRange: getDataFromArea(renderArea, "rotate", 10),
10176
10177				inOpacity: 0,
10178				midOpacity: 1,
10179				outOpacity: 0,
10180				drift: getDataFromArea(renderArea, "drift", false),
10181				scrollOn: getDataFromArea(renderArea, "scroll", false),
10182
10183				touchViewportOn: String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes",
10184				touchSpawnEvery: getDataFromArea(renderArea, "mobile-interval", 1750),
10185				desktopAutoOn: String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes",
10186
10187				particleSafeAreaOn: useParticleImages,
10188				safeW: getDataFromArea(renderArea, "safe-w", 0),
10189				safeH: getDataFromArea(renderArea, "safe-h", 0),
10190				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10191
10192				inEase: "power3.out",
10193				outEase: "power3.in"
10194			}) || null;
10195
10196			if (renderArea.__trailDestroy) {
10197				destroyers.push(renderArea.__trailDestroy);
10198			}
10199		}
10200
10201		__globalDestroy = function () {
10202			for (var i = 0; i < destroyers.length; i++) {
10203				try { destroyers[i](); } catch (e) {}
10204			}
10205			destroyers.length = 0;
10206		};
10207
10208	};
10209
10210})();
10211UNCODE.magneticPattern = (function () {
10212
10213	"use strict";
10214
10215	var __globalDestroy = null;
10216
10217	return function () {
10218
10219		if (typeof __globalDestroy === "function") {
10220			try { __globalDestroy(); } catch (e) {}
10221			__globalDestroy = null;
10222		}
10223
10224		function getMagneticImagesFromArea(area) {
10225			var node = area.querySelector(".magnetic-images");
10226			if (!node) return [];
10227			var json = node.textContent || node.innerText || "[]";
10228			try { return JSON.parse(json); } catch (e) { return []; }
10229		}
10230
10231		function closestPolyfill(el, selector) {
10232			while (el && el.nodeType === 1) {
10233				if (matchesSelector(el, selector)) return el;
10234				el = el.parentNode;
10235			}
10236			return null;
10237		}
10238
10239		function matchesSelector(el, selector) {
10240			var p = Element.prototype;
10241			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10242			if (!fn) return false;
10243			return fn.call(el, selector);
10244		}
10245
10246		function clamp01(v) {
10247			if (v < 0) return 0;
10248			if (v > 1) return 1;
10249			return v;
10250		}
10251
10252		function toNumber(value, fallback) {
10253			if (value == null) return fallback;
10254			var s = String(value).trim();
10255			if (!s) return fallback;
10256			s = s.replace(",", ".");
10257			var m = s.match(/-?\d+(\.\d+)?/);
10258			if (!m) return fallback;
10259			var n = parseFloat(m[0]);
10260			return isFinite(n) ? n : fallback;
10261		}
10262
10263		function getDataFromArea(area, key, fallback) {
10264			if (!area || !key) return fallback;
10265
10266			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10267			var raw = area.getAttribute(attr);
10268			if (raw == null) return fallback;
10269
10270			raw = String(raw).trim();
10271
10272			if (raw === "true") return true;
10273			if (raw === "false") return false;
10274			if (raw === "null") return null;
10275
10276			var num = raw.replace(",", ".");
10277			if (num !== "" && isFinite(num)) return parseFloat(num);
10278
10279			if (
10280				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10281				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10282			) {
10283				try { return JSON.parse(raw); } catch (e) {}
10284			}
10285
10286			return raw;
10287		}
10288
10289		function dedupeImages(list) {
10290			var uniq = [];
10291			var seen = {};
10292			for (var i = 0; i < list.length; i++) {
10293				var src = list[i];
10294				if (src == null) continue;
10295				src = String(src);
10296				if (!seen[src]) {
10297					seen[src] = true;
10298					uniq.push(src);
10299				}
10300			}
10301			return uniq;
10302		}
10303
10304		function rectsOverlap(a, b) {
10305			return !(
10306				a.x + a.w <= b.x ||
10307				b.x + b.w <= a.x ||
10308				a.y + a.h <= b.y ||
10309				b.y + b.h <= a.y
10310			);
10311		}
10312
10313		function initMagneticPattern(options) {
10314
10315			options = options || {};
10316
10317			var renderArea = options.area;
10318			var hoverArea  = options.hoverArea;
10319			var images     = options.images || [];
10320
10321			if (!renderArea || !hoverArea || !images.length) return null;
10322
10323			var count      = (options.count != null) ? options.count : 12;
10324			var padding    = (options.padding != null) ? options.padding : 24;
10325			var jitter     = (options.jitter != null) ? options.jitter : 0.35;
10326
10327			var rawMoveX   = (options.moveX != null) ? options.moveX : 200;
10328			var rawMoveY   = (options.moveY != null) ? options.moveY : 150;
10329			var rawSpillX  = (options.spillX != null) ? options.spillX : 0;
10330			var rawSpillY  = (options.spillY != null) ? options.spillY : 0;
10331
10332			var moveX      = cssLengthToPx(rawMoveX, hoverArea, 200);
10333			var moveY      = cssLengthToPx(rawMoveY, hoverArea, 150);
10334			var spillX     = cssLengthToPx(rawSpillX, renderArea, 0);
10335			var spillY     = cssLengthToPx(rawSpillY, renderArea, 0);
10336
10337			var easeDur    = (options.easeDur != null) ? options.easeDur : 0.6;
10338			var easeLeave  = (options.easeLeave != null) ? options.easeLeave : 1.2;
10339			var ease       = options.ease || "power3.out";
10340
10341			var opacityMin = (options.opacityMin != null) ? options.opacityMin : 0.25;
10342			var opacityMax = (options.opacityMax != null) ? options.opacityMax : 0.9;
10343
10344			var enableBlur = options.enableBlur === true;
10345			var blurMin    = (options.blurMin != null) ? options.blurMin : 0;
10346			var blurMax    = (options.blurMax != null) ? options.blurMax : 6;
10347
10348			var scaleMin   = (options.scaleMin != null) ? options.scaleMin : 0.6;
10349			var scaleMax   = (options.scaleMax != null) ? options.scaleMax : 1;
10350
10351			var depthMin   = (options.depthMin != null) ? options.depthMin : 0.3;
10352			var depthMax   = (options.depthMax != null) ? options.depthMax : 1;
10353
10354			var unique     = options.unique === true;
10355
10356			var zIndexBase     = (options.zIndexBase != null) ? options.zIndexBase : 1;
10357			var zIndexRange    = (options.zIndexRange != null) ? options.zIndexRange : 30;
10358			var enableRotation = options.enableRotation !== false;
10359			var rotationRange  = (options.rotationRange != null) ? options.rotationRange : 8;
10360
10361			var noOverlap = options.noOverlap === true;
10362			var attempts  = (options.attempts != null) ? options.attempts : 120;
10363			var gap       = (options.gap != null) ? options.gap : 8;
10364
10365			var baseWidth = (options.baseWidth != null) ? options.baseWidth : 300;
10366
10367			var depthEnabled = options.flatDepth !== true;
10368
10369			var enableScrollMotion = options.scrollMotion !== false;
10370
10371			var safeW = (options.safeW != null) ? options.safeW : 0;
10372			var safeH = (options.safeH != null) ? options.safeH : 0;
10373			var safeMode = options.safeMode || "avoid";
10374
10375			var items = [];
10376
10377			function cssLengthToPx(value, el, fallback) {
10378				if (value == null) return fallback;
10379
10380				if (typeof value === "number") return isFinite(value) ? value : fallback;
10381
10382				var s = String(value).trim();
10383				if (!s) return fallback;
10384
10385				var n = parseFloat(s.replace(",", "."));
10386				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10387
10388				var probe = document.createElement("div");
10389				probe.style.position = "absolute";
10390				probe.style.visibility = "hidden";
10391				probe.style.pointerEvents = "none";
10392				probe.style.width = s;
10393				probe.style.height = "0";
10394
10395				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10396				parent.appendChild(probe);
10397
10398				var px = probe.getBoundingClientRect().width;
10399				parent.removeChild(probe);
10400
10401				return (px && isFinite(px)) ? px : fallback;
10402			}
10403
10404			if (window.getComputedStyle(renderArea).position === "static") {
10405				renderArea.style.position = "relative";
10406			}
10407
10408			function lerp(a, b, t) {
10409				return a + (b - a) * t;
10410			}
10411
10412			function clearAll() {
10413				var nodes = renderArea.querySelectorAll(".pattern-img");
10414				for (var i = nodes.length - 1; i >= 0; i--) {
10415					if (nodes[i] && nodes[i].parentNode) nodes[i].parentNode.removeChild(nodes[i]);
10416				}
10417				items.length = 0;
10418			}
10419
10420			function buildSafeRect(virtualW, virtualH, originX, originY) {
10421				if (!safeW || !safeH) return null;
10422
10423				var szW = (safeW / 100) * virtualW;
10424				var szH = (safeH / 100) * virtualH;
10425
10426				if (!szW || !szH) return null;
10427
10428				return {
10429					x: originX + (virtualW - szW) / 2,
10430					y: originY + (virtualH - szH) / 2,
10431					w: szW,
10432					h: szH
10433				};
10434			}
10435
10436			var rafWatch = 0;
10437			var lastTop = null;
10438			var lastHeight = null;
10439			var watchActive = true;
10440
10441			function watchPosition() {
10442				if (!watchActive) return;
10443
10444				var rect = hoverArea.getBoundingClientRect();
10445				var top = Math.round(rect.top);
10446				var height = Math.round(rect.height);
10447
10448				var movedEnough =
10449					lastTop === null ||
10450					Math.abs(top - lastTop) > 1 ||
10451					Math.abs(height - lastHeight) > 1;
10452
10453				if (movedEnough) {
10454					lastTop = top;
10455					lastHeight = height;
10456					onScroll();
10457				}
10458
10459				rafWatch = requestAnimationFrame(watchPosition);
10460			}
10461			
10462			function buildLayout() {
10463
10464				clearAll();
10465
10466				var rect = renderArea.getBoundingClientRect();
10467
10468				var width  = rect.width  + spillX * 2;
10469				var height = rect.height + spillY * 2;
10470
10471				var originX = -spillX;
10472				var originY = -spillY;
10473
10474				var safeRect = buildSafeRect(width, height, originX, originY);
10475
10476				var imgs = unique ? dedupeImages(images) : images;
10477				var effectiveCount = unique ? Math.min(count, imgs.length) : count;
10478
10479				var cols = Math.ceil(Math.sqrt(effectiveCount));
10480				var rows = Math.ceil(effectiveCount / cols);
10481
10482				var cellW = (width  - padding * 2) / cols;
10483				var cellH = (height - padding * 2) / rows;
10484
10485				var frag = document.createDocumentFragment();
10486				var placed = [];
10487
10488				for (var i = 0; i < effectiveCount; i++) {
10489
10490					var src = imgs[i % imgs.length];
10491
10492					var el = document.createElement("img");
10493					el.className = "pattern-img";
10494					el.src = src;
10495
10496					el.style.position = "absolute";
10497					el.style.left = "0";
10498					el.style.top = "0";
10499					el.style.pointerEvents = "none";
10500					el.style.userSelect = "none";
10501					el.style.willChange = "transform,opacity,filter";
10502
10503					el.style.width = baseWidth + "px";
10504					el.style.height = "auto";
10505
10506					var col = i % cols;
10507					var row = Math.floor(i / cols);
10508
10509					var baseCellX = originX + padding + col * cellW;
10510					var baseCellY = originY + padding + row * cellH;
10511
10512					var baseX = baseCellX + cellW / 2 + (Math.random() - 0.5) * cellW * jitter;
10513					var baseY = baseCellY + cellH / 2 + (Math.random() - 0.5) * cellH * jitter;
10514
10515					var placedOk = true;
10516
10517					function isBadCandidate(x, y) {
10518						var cand = { x: x, y: y, w: baseWidth + gap, h: baseWidth + gap };
10519
10520						if (safeRect && rectsOverlap(cand, safeRect)) {
10521							if (safeMode === "avoid") return true;
10522						}
10523
10524						if (noOverlap) {
10525							for (var p = 0; p < placed.length; p++) {
10526								if (rectsOverlap(cand, placed[p])) return true;
10527							}
10528						}
10529
10530						return false;
10531					}
10532
10533					if (safeRect && safeMode === "soft") {
10534						var best = { x: baseX, y: baseY, score: -999999 };
10535						var softTries = Math.max(20, Math.min(120, attempts));
10536
10537						for (var st = 0; st < softTries; st++) {
10538							var rxS = baseCellX + (Math.random() * cellW);
10539							var ryS = baseCellY + (Math.random() * cellH);
10540
10541							var candS = { x: rxS, y: ryS, w: baseWidth + gap, h: baseWidth + gap };
10542
10543							var score = 0;
10544
10545							if (noOverlap) {
10546								for (var pp = 0; pp < placed.length; pp++) {
10547									if (rectsOverlap(candS, placed[pp])) { score -= 1000; break; }
10548								}
10549							}
10550
10551							if (rectsOverlap(candS, safeRect)) score -= 500;
10552
10553							var sx = safeRect.x + safeRect.w / 2;
10554							var sy = safeRect.y + safeRect.h / 2;
10555							var dxs = (rxS - sx);
10556							var dys = (ryS - sy);
10557							score += Math.sqrt(dxs * dxs + dys * dys);
10558
10559							if (score > best.score) best = { x: rxS, y: ryS, score: score };
10560						}
10561
10562						baseX = best.x;
10563						baseY = best.y;
10564
10565						if (noOverlap) {
10566							if (isBadCandidate(baseX, baseY)) {
10567								placedOk = false;
10568							}
10569						}
10570
10571					} else {
10572						if (noOverlap || safeRect) {
10573							placedOk = false;
10574
10575							for (var a = 0; a < attempts; a++) {
10576								var rx = baseCellX + (Math.random() * cellW);
10577								var ry = baseCellY + (Math.random() * cellH);
10578
10579								if (safeRect && safeMode === "avoid") {
10580									var cx = rx + (baseWidth / 2);
10581									var cy = ry + (baseWidth / 2);
10582									if (cx >= safeRect.x && cx <= safeRect.x + safeRect.w &&
10583										cy >= safeRect.y && cy <= safeRect.y + safeRect.h) {
10584										continue;
10585									}
10586								}
10587
10588								var cand = { x: rx, y: ry, w: baseWidth + gap, h: baseWidth + gap };
10589
10590								var collides = false;
10591								if (noOverlap) {
10592									for (var p = 0; p < placed.length; p++) {
10593										if (rectsOverlap(cand, placed[p])) { collides = true; break; }
10594									}
10595								}
10596
10597								if (!collides) {
10598									baseX = rx;
10599									baseY = ry;
10600									placed.push(cand);
10601									placedOk = true;
10602									break;
10603								}
10604							}
10605
10606							if (!placedOk) continue;
10607						}
10608					}
10609
10610					if (noOverlap && placedOk) {
10611						placed.push({ x: baseX, y: baseY, w: baseWidth + gap, h: baseWidth + gap });
10612					}
10613
10614					var rnd = Math.random();
10615					var tDepth = depthEnabled ? rnd : 0;
10616
10617					var tScale = depthEnabled ? (1 - tDepth) : Math.random();
10618					tScale = clamp01(tScale);
10619
10620					var scale = lerp(scaleMin, scaleMax, tScale);
10621
10622					var moveFactor = depthEnabled ? lerp(1, 0.25, tDepth) : 1;
10623
10624					var opacity = depthEnabled
10625						? lerp(opacityMax, opacityMin, tDepth)
10626						: lerp(opacityMin, opacityMax, Math.random());
10627
10628					var blur = 0;
10629					if (enableBlur) {
10630						blur = depthEnabled
10631							? lerp(blurMin, blurMax, tDepth)
10632							: lerp(blurMin, blurMax, Math.random());
10633					}
10634
10635					var tZ = depthEnabled
10636						? (1 - tDepth)
10637						: ((scaleMax === scaleMin) ? 1 : (scale - scaleMin) / (scaleMax - scaleMin));
10638					tZ = clamp01(tZ);
10639
10640					el.style.zIndex = zIndexBase + Math.round(zIndexRange * tZ);
10641
10642					var rot = 0;
10643					if (enableRotation) {
10644						rot = gsap.utils.random(-rotationRange, rotationRange, 0.1);
10645					}
10646
10647					gsap.set(el, {
10648						x: baseX,
10649						y: baseY,
10650						scale: scale,
10651						rotation: rot,
10652						opacity: opacity,
10653						filter: enableBlur ? "blur(" + blur.toFixed(2) + "px)" : "none"
10654					});
10655
10656					items.push({
10657						el: el,
10658						baseX: baseX,
10659						baseY: baseY,
10660						moveFactor: moveFactor
10661					});
10662
10663					frag.appendChild(el);
10664				}
10665
10666				renderArea.appendChild(frag);
10667			}
10668
10669			buildLayout();
10670
10671			function onMove(e) {
10672
10673				var rect = hoverArea.getBoundingClientRect();
10674				if (!rect.width || !rect.height) return;
10675
10676				var nx = (e.clientX - rect.left - rect.width / 2) / (rect.width / 2);
10677				var ny = (e.clientY - rect.top  - rect.height / 2) / (rect.height / 2);
10678
10679				for (var i = 0; i < items.length; i++) {
10680					var it = items[i];
10681
10682					var dx = -nx * moveX * it.moveFactor;
10683					var dy = -ny * moveY * it.moveFactor;
10684
10685					gsap.to(it.el, {
10686						x: it.baseX + dx,
10687						y: it.baseY + dy,
10688						duration: easeDur,
10689						ease: ease,
10690						overwrite: true
10691					});
10692				}
10693			}
10694
10695			function onScroll() {
10696
10697				if (!enableScrollMotion) return;
10698
10699				var rect = hoverArea.getBoundingClientRect();
10700				var vh = window.innerHeight || document.documentElement.clientHeight;
10701
10702				if (!rect.height) return;
10703
10704				// completamente fuori
10705				if (rect.bottom <= 0 || rect.top >= vh) {
10706					for (var k = 0; k < items.length; k++) {
10707						var it0 = items[k];
10708						gsap.to(it0.el, {
10709							x: it0.baseX,
10710							y: it0.baseY,
10711							duration: easeLeave,
10712							ease: ease,
10713							overwrite: true
10714						});
10715					}
10716					return;
10717				}
10718
10719				var travel = vh + rect.height;
10720				var progress = (vh - rect.top) / travel;
10721
10722				if (progress < 0) progress = 0;
10723				if (progress > 1) progress = 1;
10724
10725				var ny = progress * 2 - 1;
10726				var nx = ny * 0.35;
10727
10728				for (var i = 0; i < items.length; i++) {
10729					var it = items[i];
10730
10731					var dx = -nx * moveX * 0.35 * it.moveFactor;
10732					var dy = -ny * moveY * 0.35 * it.moveFactor;
10733
10734					gsap.to(it.el, {
10735						x: it.baseX + dx,
10736						y: it.baseY + dy,
10737						duration: easeDur,
10738						ease: ease,
10739						overwrite: true
10740					});
10741				}
10742			}
10743
10744			function onLeave() {
10745				for (var i = 0; i < items.length; i++) {
10746					var it = items[i];
10747					gsap.to(it.el, {
10748						x: it.baseX,
10749						y: it.baseY,
10750						duration: easeLeave,
10751						ease: ease,
10752						overwrite: true
10753					});
10754				}
10755			}
10756
10757			var sizeObserver = null;
10758			var lastLayoutW = 0;
10759			var lastLayoutH = 0;
10760
10761			function updateLayoutSizeCache() {
10762				var r = renderArea.getBoundingClientRect();
10763				lastLayoutW = Math.round(r.width);
10764				lastLayoutH = Math.round(r.height);
10765			}
10766
10767			function shouldRebuildLayout() {
10768				var r = renderArea.getBoundingClientRect();
10769				var newW = Math.round(r.width);
10770				var newH = Math.round(r.height);
10771
10772				var dw = Math.abs(newW - lastLayoutW);
10773				var dh = Math.abs(newH - lastLayoutH);
10774
10775				// rebuild sempre se cambia la larghezza
10776				// sull'altezza, tollera micro-variazioni tipiche del browser mobile durante lo scroll
10777				var mustRebuild = dw > 1 || dh > 80;
10778
10779				if (mustRebuild) {
10780					lastLayoutW = newW;
10781					lastLayoutH = newH;
10782				}
10783
10784				return mustRebuild;
10785			}
10786
10787			updateLayoutSizeCache();
10788
10789			if ("ResizeObserver" in window) {
10790				sizeObserver = new ResizeObserver(function () {
10791					if (shouldRebuildLayout()) {
10792						buildLayout();
10793					}
10794					onScroll();
10795				});
10796				sizeObserver.observe(renderArea);
10797			}
10798
10799			hoverArea.addEventListener("mousemove", onMove);
10800			hoverArea.addEventListener("mouseleave", onLeave);
10801
10802			function onWindowResize() {
10803				if (shouldRebuildLayout()) {
10804					buildLayout();
10805				}
10806				onScroll();
10807			}
10808
10809			window.addEventListener("resize", onWindowResize);
10810			window.addEventListener("scroll", onScroll, { passive: true });
10811			onScroll();
10812			watchPosition();
10813
10814			return function () {
10815				hoverArea.removeEventListener("mousemove", onMove);
10816				hoverArea.removeEventListener("mouseleave", onLeave);
10817				window.removeEventListener("resize", onWindowResize);
10818				window.removeEventListener("scroll", onScroll);
10819
10820				if (sizeObserver) {
10821					sizeObserver.disconnect();
10822					sizeObserver = null;
10823				}
10824
10825				watchActive = false;
10826				if (rafWatch) {
10827					cancelAnimationFrame(rafWatch);
10828					rafWatch = 0;
10829				}
10830				
10831				clearAll();
10832			};
10833
10834		}
10835
10836		var destroyers = [];
10837
10838		var areas = document.querySelectorAll(".uncode-bg-magnetic");
10839		for (var n = 0; n < areas.length; n++) {
10840			var renderArea = areas[n];
10841
10842			if (renderArea.__magneticDestroy && typeof renderArea.__magneticDestroy === "function") {
10843				try { renderArea.__magneticDestroy(); } catch (e) {}
10844				renderArea.__magneticDestroy = null;
10845			}
10846
10847			var hoverArea = renderArea.closest
10848				? renderArea.closest('.vc_row[data-parent="true"]')
10849				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10850
10851			if (!hoverArea) continue;
10852
10853			var images = getMagneticImagesFromArea(renderArea);
10854			if (!images.length) continue;
10855
10856			function cssLengthToPx(value, el, fallback) {
10857				if (value == null) return fallback;
10858
10859				if (typeof value === "number") return isFinite(value) ? value : fallback;
10860
10861				var s = String(value).trim();
10862				if (!s) return fallback;
10863
10864				var n = parseFloat(s.replace(",", "."));
10865				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10866
10867				var probe = document.createElement("div");
10868				probe.style.position = "absolute";
10869				probe.style.visibility = "hidden";
10870				probe.style.pointerEvents = "none";
10871				probe.style.width = s;
10872				probe.style.height = "0";
10873
10874				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10875				parent.appendChild(probe);
10876
10877				var px = probe.getBoundingClientRect().width;
10878				parent.removeChild(probe);
10879
10880				return (px && isFinite(px)) ? px : fallback;
10881			}
10882
10883			var rawMin = getDataFromArea(renderArea, "min-width", "100px");
10884			var rawMax = getDataFromArea(renderArea, "max-width", "300px");
10885
10886			var minW = cssLengthToPx(rawMin, renderArea, 100);
10887			var maxW = cssLengthToPx(rawMax, renderArea, 300);
10888			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
10889
10890			var scaleMin = (maxW > 0) ? (minW / maxW) : 1;
10891
10892			var rawMoveX = getDataFromArea(renderArea, "move-x", "400px");
10893			var rawMoveY = getDataFromArea(renderArea, "move-y", "300px");
10894			var rawSpillX = getDataFromArea(renderArea, "spill-x", null);
10895			var rawSpillY = getDataFromArea(renderArea, "spill-y", null);
10896
10897			if (rawSpillX == null || rawSpillX === "") {
10898				if (typeof rawMoveX === "number") rawSpillX = rawMoveX / 2;
10899				else rawSpillX = "calc((" + rawMoveX + ") / 2)";
10900			}
10901
10902			if (rawSpillY == null || rawSpillY === "") {
10903				if (typeof rawMoveY === "number") rawSpillY = rawMoveY / 2;
10904				else rawSpillY = "calc((" + rawMoveY + ") / 2)";
10905			}
10906
10907			renderArea.__magneticDestroy = initMagneticPattern({
10908				area: renderArea,
10909				hoverArea: hoverArea,
10910				images: images,
10911
10912				count: toNumber(getDataFromArea(renderArea, "count", 16), 16),
10913
10914				padding: 27,
10915				jitter: 0.35,
10916
10917				moveX: rawMoveX,
10918				moveY: rawMoveY,
10919				spillX: rawSpillX,
10920				spillY: rawSpillY,
10921
10922				easeDur: 0.7,
10923				easeLeave: 1.7,
10924				ease: "power3.out",
10925
10926				opacityMin: toNumber(getDataFromArea(renderArea, "min-opacity", 0.25), 0.25),
10927				opacityMax: toNumber(getDataFromArea(renderArea, "max-opacity", 1), 1),
10928
10929				zIndexBase: 1,
10930				zIndexRange: 30,
10931
10932				enableRotation: false,
10933				rotationRange: 8,
10934
10935				enableBlur: String(getDataFromArea(renderArea, "blur", "no")) === "yes",
10936				blurMin: 0,
10937				blurMax: 1.5,
10938
10939				baseWidth: maxW,
10940				scaleMin: scaleMin,
10941				scaleMax: 1,
10942
10943				flatDepth: String(getDataFromArea(renderArea, "depth", "no")) !== "yes",
10944
10945				noOverlap: String(getDataFromArea(renderArea, "no-overlap", "no")) === "yes",
10946				attempts: toNumber(getDataFromArea(renderArea, "attempts", 120), 120),
10947				gap: toNumber(getDataFromArea(renderArea, "gap", 8), 8),
10948
10949				depthMin: 0.25,
10950				depthMax: 1.0,
10951
10952				unique: String(getDataFromArea(renderArea, "unique", "no")) === "yes",
10953
10954				safeW: toNumber(getDataFromArea(renderArea, "safe-w", 0), 0),
10955				safeH: toNumber(getDataFromArea(renderArea, "safe-h", 0), 0),
10956				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10957
10958				scrollMotion: String(getDataFromArea(renderArea, "stop-scroll", "no")) !== "yes",
10959			}) || null;
10960
10961			if (renderArea.__magneticDestroy) {
10962				destroyers.push(renderArea.__magneticDestroy);
10963			}
10964		}
10965
10966		__globalDestroy = function () {
10967			for (var i = 0; i < destroyers.length; i++) {
10968				try { destroyers[i](); } catch (e) {}
10969			}
10970			destroyers.length = 0;
10971		};
10972
10973	};
10974
10975})();
10976UNCODE.thumbDrop = (function () {
10977
10978	"use strict";
10979
10980	var __globalDestroy = null;
10981
10982	return function () {
10983
10984		if (!window.Matter) return;
10985
10986		if (typeof __globalDestroy === "function") {
10987			try { __globalDestroy(); } catch (e) {}
10988			__globalDestroy = null;
10989		}
10990
10991		var Engine = Matter.Engine;
10992		var World  = Matter.World;
10993		var Bodies = Matter.Bodies;
10994		var Body   = Matter.Body;
10995		var Mouse  = Matter.Mouse;
10996		var MouseConstraint = Matter.MouseConstraint;
10997
10998		function getDropImagesFromArea(area) {
10999			var node = area.querySelector("script.drop-images");
11000			if (!node) return [];
11001			var json = node.textContent || node.innerText || "[]";
11002			try { return JSON.parse(json); } catch (e) { return []; }
11003		}
11004
11005		function matchesSelector(el, selector) {
11006			var p = Element.prototype;
11007			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
11008			if (!fn) return false;
11009			return fn.call(el, selector);
11010		}
11011
11012		function closestPolyfill(el, selector) {
11013			while (el && el.nodeType === 1) {
11014				if (matchesSelector(el, selector)) return el;
11015				el = el.parentNode;
11016			}
11017			return null;
11018		}
11019
11020		function debounce(fn, wait) {
11021			var t = null;
11022			return function () {
11023				var ctx = this;
11024				var args = arguments;
11025				clearTimeout(t);
11026				t = setTimeout(function () { fn.apply(ctx, args); }, wait);
11027			};
11028		}
11029
11030		function clamp(v, a, b) {
11031			return v < a ? a : (v > b ? b : v);
11032		}
11033
11034		function toNumber(value, fallback) {
11035			if (value == null) return fallback;
11036			var s = String(value).trim();
11037			if (!s) return fallback;
11038			s = s.replace(",", ".");
11039			var m = s.match(/-?\d+(\.\d+)?/);
11040			if (!m) return fallback;
11041			var n = parseFloat(m[0]);
11042			return isFinite(n) ? n : fallback;
11043		}
11044
11045		function cssLengthToPx(value, el, fallback) {
11046			if (value == null) return fallback;
11047
11048			if (typeof value === "number") return isFinite(value) ? value : fallback;
11049
11050			var s = String(value).trim();
11051			if (!s) return fallback;
11052
11053			var n = parseFloat(s.replace(",", "."));
11054			if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
11055
11056			var probe = document.createElement("div");
11057			probe.style.position = "absolute";
11058			probe.style.visibility = "hidden";
11059			probe.style.pointerEvents = "none";
11060			probe.style.width = "0";
11061			probe.style.height = "0";
11062
11063			var parent = (el && el.parentNode) ? el.parentNode : document.body;
11064			parent.appendChild(probe);
11065
11066			probe.style.width = s;
11067			var px = probe.getBoundingClientRect().width;
11068
11069			parent.removeChild(probe);
11070
11071			if (!px || !isFinite(px)) return fallback;
11072			return px;
11073		}
11074
11075		function getDataFromArea(area, key, fallback) {
11076			if (!area || !key) return fallback;
11077
11078			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
11079			var raw = area.getAttribute(attr);
11080			if (raw == null) return fallback;
11081
11082			raw = String(raw).trim();
11083
11084			if (raw === "true") return true;
11085			if (raw === "false") return false;
11086			if (raw === "null") return null;
11087
11088			var num = raw.replace(",", ".");
11089			if (num !== "" && isFinite(num)) return parseFloat(num);
11090
11091			if (
11092				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
11093				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
11094			) {
11095				try { return JSON.parse(raw); } catch (e) {}
11096			}
11097
11098			return raw;
11099		}
11100
11101		function raf2(cb) {
11102			requestAnimationFrame(function () {
11103				requestAnimationFrame(function () {
11104					cb();
11105				});
11106			});
11107		}
11108
11109		function normalizeDragMode(v) {
11110			if (v == null) return "";
11111			if (v === true) return "drag";
11112			var s = String(v).trim().toLowerCase();
11113			if (!s) return "";
11114			if (s === "1" || s === "yes" || s === "true") return "drag";
11115			if (s === "drag" || s === "hover") return s;
11116			return "";
11117		}
11118
11119		function initMatterDrop(options) {
11120			options = options || {};
11121
11122			var area    = options.area;
11123			var surface = options.surface;
11124			var images  = options.images || [];
11125
11126			var maxAvailable = images.length;
11127			var duplicateImages = options.duplicateImages !== false;
11128			var count = options.count != null ? options.count : Math.min(18, maxAvailable);
11129
11130			if (!duplicateImages && count > maxAvailable) {
11131				count = maxAvailable;
11132			}
11133
11134			var sizeMin    = options.sizeMin != null ? options.sizeMin : 140;
11135			var sizeMax    = options.sizeMax != null ? options.sizeMax : 260;
11136			var spawnEvery = options.spawnEvery != null ? options.spawnEvery : 160;
11137			var startDelay = options.startDelay != null ? options.startDelay : 0;
11138
11139			var gravityY    = options.gravityY != null ? options.gravityY : 1.25;
11140			var restitution = options.restitution != null ? options.restitution : 0.35;
11141			var frictionAir = options.frictionAir != null ? options.frictionAir : 0.02;
11142			var friction    = options.friction != null ? options.friction : 0.25;
11143			var density     = options.density != null ? options.density : 0.001;
11144
11145			var wallThickness = options.wallThickness != null ? options.wallThickness : 80;
11146			var floorPadding  = options.floorPadding != null ? options.floorPadding : 0;
11147
11148			var rotateRange = options.rotateRange != null ? options.rotateRange : 18;
11149
11150			var once       = options.once !== false;
11151			var threshold  = options.threshold != null ? options.threshold : 0.25;
11152			var rootMargin = options.rootMargin || "0px 0px -10% 0px";
11153
11154			var dragMode = normalizeDragMode(options.enableDrag);
11155			var enableDrag = dragMode === "drag";
11156			var enableHoverRepel = dragMode === "hover";
11157
11158			var dragStiffness = options.dragStiffness != null ? options.dragStiffness : 0.18;
11159			var dragDamping   = options.dragDamping != null ? options.dragDamping : 0.06;
11160
11161			var hoverRadius = options.hoverRadius != null ? options.hoverRadius : 260;
11162			var spawnXMode = String(options.spawnXMode || "random").toLowerCase();
11163			var spawnXFixed = options.spawnXFixed != null ? options.spawnXFixed : 50;
11164			var spawnXJitter = options.spawnXJitter != null ? options.spawnXJitter : 0;	
11165
11166			if (!area || !surface || !images.length) return null;
11167
11168			var cs = window.getComputedStyle(area);
11169			if (cs.position === "static") area.style.position = "absolute";
11170			if (!area.style.left) area.style.left = "0";
11171			if (!area.style.top) area.style.top = "0";
11172			if (!area.style.width) area.style.width = "100%";
11173			if (!area.style.height) area.style.height = "100%";
11174
11175			area.style.pointerEvents = enableDrag ? "auto" : "none";
11176
11177			var engine = Engine.create();
11178			engine.enableSleeping = false;
11179			engine.gravity.y = gravityY;
11180
11181			var alive = true;
11182			var started = false;
11183
11184			var bounds = { w: 0, h: 0 };
11185			var walls = null;
11186			var items = [];
11187
11188			var spawnTimer = null;
11189			var spawned = 0;
11190
11191			var ro = null;
11192			var pollTimer = null;
11193			var lastW = 0;
11194			var lastH = 0;
11195
11196			var mouseConstraint = null;
11197
11198			var rafId = 0;
11199			var io = null;
11200			var scrollHandler = null;
11201			var dragMousemoveHandler = null;
11202
11203			var hoverMoveHandler = null;
11204			var hoverLeaveHandler = null;
11205			var hoverX = null;
11206			var hoverY = null;
11207			var hoverActive = false;
11208
11209			function updateRects() {
11210				bounds.w = area.offsetWidth;
11211				bounds.h = area.offsetHeight;
11212			}
11213
11214			function removeWalls() {
11215				if (!walls) return;
11216				World.remove(engine.world, walls.floor);
11217				World.remove(engine.world, walls.left);
11218				World.remove(engine.world, walls.right);
11219				walls = null;
11220			}
11221
11222			function createWalls() {
11223				updateRects();
11224
11225				var w = bounds.w;
11226				var h = bounds.h;
11227				if (!w || !h) return false;
11228
11229				var t = wallThickness;
11230				var floorY = h + t * 0.5 + floorPadding;
11231
11232				var floor = Bodies.rectangle(w * 0.5, floorY, w + t * 2, t, { isStatic: true, restitution: 0, friction: 1 });
11233				var left  = Bodies.rectangle(-t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11234				var right = Bodies.rectangle(w + t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11235
11236				walls = { floor: floor, left: left, right: right };
11237				World.add(engine.world, [floor, left, right]);
11238
11239				return true;
11240			}
11241
11242			function setTransform(el, x, y, a) {
11243				el.style.transform = "translate3d(" + x + "px," + y + "px,0) rotate(" + a + "deg)";
11244			}
11245
11246			function preloadAll(list) {
11247				for (var i = 0; i < list.length; i++) {
11248					var im = new Image();
11249					im.src = list[i];
11250				}
11251			}
11252
11253			function recalcSpawnSizes() {
11254				if (!options.rawMin && !options.rawMax) return;
11255
11256				var newMin = cssLengthToPx(options.rawMin, area, sizeMin);
11257				var newMax = cssLengthToPx(options.rawMax, area, sizeMax);
11258
11259				if (newMax < newMin) { var t = newMin; newMin = newMax; newMax = t; }
11260
11261				sizeMin = newMin;
11262				sizeMax = newMax;
11263			}
11264
11265			function setupDrag() {
11266				if (!enableDrag || !Mouse || !MouseConstraint) return;
11267
11268				var mouse = Mouse.create(area);
11269				mouse.pixelRatio = 1;
11270
11271				mouseConstraint = MouseConstraint.create(engine, {
11272					mouse: mouse,
11273					constraint: {
11274						stiffness: dragStiffness,
11275						damping: dragDamping,
11276						render: { visible: false }
11277					}
11278				});
11279
11280				World.add(engine.world, mouseConstraint);
11281
11282				dragMousemoveHandler = function () {
11283					mouse.offset.x = 0;
11284					mouse.offset.y = 0;
11285				};
11286				area.addEventListener("mousemove", dragMousemoveHandler);
11287
11288				area.style.userSelect = "none";
11289				area.style.webkitUserSelect = "none";
11290			}
11291
11292			function setupHoverRepel() {
11293				if (!enableHoverRepel) return;
11294
11295				area.style.pointerEvents = "auto";
11296
11297				hoverMoveHandler = function (e) {
11298					var r = area.getBoundingClientRect();
11299					hoverX = e.clientX - r.left;
11300					hoverY = e.clientY - r.top;
11301
11302					hoverActive = true;
11303				};
11304
11305				hoverLeaveHandler = function () {
11306					hoverActive = false;
11307					hoverX = null;
11308					hoverY = null;
11309				};
11310
11311				area.addEventListener("mousemove", hoverMoveHandler);
11312				area.addEventListener("mouseleave", hoverLeaveHandler);
11313			}
11314
11315			function getSpawnX(w) {
11316				var minX = w * 0.5;
11317				var maxX = Math.max(minX, bounds.w - w * 0.5);
11318
11319				if (spawnXMode === "fixed") {
11320					var pct = clamp(spawnXFixed, 0, 100) / 100;
11321					var baseX = minX + (maxX - minX) * pct;
11322
11323					if (spawnXJitter > 0) {
11324						var jitterPx = (bounds.w * spawnXJitter / 100) * (Math.random() - 0.5);
11325						baseX += jitterPx;
11326					}
11327
11328					return clamp(baseX, minX, maxX);
11329				}
11330
11331				if (spawnXMode === "sequence") {
11332					var total = Math.max(1, count);
11333
11334					if (total === 1) {
11335						return (minX + maxX) * 0.5;
11336					}
11337
11338					var progress = duplicateImages
11339						? ((spawned % total) / (total - 1))
11340						: (spawned / Math.max(1, total - 1));
11341
11342					return minX + (maxX - minX) * progress;
11343				}
11344
11345				return minX + Math.random() * Math.max(0, maxX - minX);
11346			}
11347
11348			function spawnOne() {
11349				if (!alive) return;
11350				if (spawned >= count) return;
11351
11352				updateRects();
11353				if (!bounds.w || !bounds.h) return;
11354
11355				if (!duplicateImages && spawned >= images.length) return;
11356
11357				var src = duplicateImages
11358					? images[spawned % images.length]
11359					: images[spawned];
11360
11361				var w = Math.round(Matter.Common.random(sizeMin, sizeMax));
11362				var x = getSpawnX(w);
11363
11364				var img = new Image();
11365				img.onload = function () {
11366					if (!alive) return;
11367
11368					var css = getComputedStyle(area);
11369					var ratioVar = (css.getPropertyValue("--bgm-ratio") || "").trim();
11370					var ratio = null;
11371
11372					if (ratioVar) {
11373						var parts = ratioVar.split("/");
11374						if (parts.length === 2) {
11375							var rw = parseFloat(parts[0]);
11376							var rh = parseFloat(parts[1]);
11377							if (rw > 0 && rh > 0) ratio = rh / rw;
11378						}
11379					}
11380
11381					var r = ratio;
11382					if (!r) {
11383						if (img.naturalWidth && img.naturalHeight) r = img.naturalHeight / img.naturalWidth;
11384						else r = 1;
11385					}
11386
11387					var h = Math.max(20, Math.round(w * r));
11388
11389					var startY = -(h + 300);
11390
11391					var el = document.createElement("img");
11392					el.className = "drop-img";
11393					el.setAttribute("src", src);
11394					el.style.width = w + "px";
11395					el.style.height = h + "px";
11396					el.style.position = "absolute";
11397					el.style.left = "0";
11398					el.style.top = "0";
11399					el.style.willChange = "transform";
11400					el.style.pointerEvents = "none";
11401					el.style.userSelect = "none";
11402
11403					el.style.opacity = "0";
11404
11405					setTransform(el, x - w * 0.5, startY - h * 0.5, 0);
11406
11407					area.appendChild(el);
11408
11409					var body = Bodies.rectangle(x, startY, w, h, {
11410						restitution: restitution,
11411						frictionAir: frictionAir,
11412						friction: friction,
11413						density: density
11414					});
11415
11416					Body.setVelocity(body, {
11417						x: (Math.random() - 0.5) * 4,
11418						y: Math.random() * 2
11419					});
11420
11421					World.add(engine.world, body);
11422					items.push({ el: el, body: body, w: w, h: h });
11423
11424					requestAnimationFrame(function () {
11425						el.style.opacity = "1";
11426					});
11427
11428					setTransform(el, body.position.x - w * 0.5, body.position.y - h * 0.5, body.angle * 180 / Math.PI);
11429				};
11430				img.onerror = function () {};
11431				img.src = src;
11432
11433				spawned++;
11434			}
11435
11436			function applyHoverRepel() {
11437
11438				if (!enableHoverRepel) return;
11439				if (!hoverActive || hoverX == null || hoverY == null) return;
11440
11441				var radius = hoverRadius;
11442				var r2 = radius * radius;
11443
11444				for (var i = 0; i < items.length; i++) {
11445
11446					var b = items[i].body;
11447
11448					var dx = b.position.x - hoverX;
11449					var dy = b.position.y - hoverY;
11450
11451					var d2 = dx * dx + dy * dy;
11452					if (d2 > r2 || d2 < 0.001) continue;
11453
11454					var d = Math.sqrt(d2);
11455
11456					var nx = dx / d;
11457					var ny = dy / d;
11458
11459					var strength = (1 - d / radius) * 25;
11460
11461					Body.setVelocity(b, {
11462						x: b.velocity.x + nx * strength,
11463						y: b.velocity.y + ny * strength - strength * 0.6
11464					});
11465
11466					for (var j = 0; j < items.length; j++) {
11467
11468						if (i === j) continue;
11469
11470						var nb = items[j].body;
11471
11472						var ddx = nb.position.x - b.position.x;
11473						var ddy = nb.position.y - b.position.y;
11474
11475						var dist = Math.sqrt(ddx * ddx + ddy * ddy);
11476
11477						if (dist < 120 && dist > 0.001) {
11478
11479							var nnx = ddx / dist;
11480							var nny = ddy / dist;
11481
11482							Body.setVelocity(nb, {
11483								x: nb.velocity.x + nnx * 2,
11484								y: nb.velocity.y + nny * 2
11485							});
11486
11487						}
11488					}
11489				}
11490			}
11491
11492			function tick() {
11493				if (!alive) return;
11494
11495				applyHoverRepel();
11496
11497				if (mouseConstraint && mouseConstraint.body) {
11498					var dragged = mouseConstraint.body;
11499
11500					for (var di = 0; di < items.length; di++) {
11501						if (items[di].body === dragged) {
11502							var halfW = items[di].w * 0.5;
11503							var halfH = items[di].h * 0.5;
11504
11505							var clampedX = clamp(dragged.position.x, halfW + 2, bounds.w - halfW - 2);
11506							var clampedY = clamp(dragged.position.y, halfH + 2, bounds.h - halfH - 2);
11507
11508							if (clampedX !== dragged.position.x || clampedY !== dragged.position.y) {
11509								Body.setPosition(dragged, { x: clampedX, y: clampedY });
11510								Body.setVelocity(dragged, { x: 0, y: 0 });
11511							}
11512							break;
11513						}
11514					}
11515				}
11516	
11517				Engine.update(engine, 1000 / 60);
11518
11519				var sideLimit = Math.max(120, wallThickness * 1.5);
11520				var bottomLimit = bounds.h + Math.max(160, wallThickness * 1.5);
11521
11522				for (var i = 0; i < items.length; i++) {
11523					var it0 = items[i];
11524					var b0 = it0.body;
11525
11526					var halfW = it0.w * 0.5;
11527					var halfH = it0.h * 0.5;
11528
11529					var minX = halfW + 2;
11530					var maxX = bounds.w - halfW - 2;
11531					var rescueY = Math.max(halfH + 2, 20);
11532					var floorY = bounds.h - halfH - 2;
11533
11534					var outLeft = b0.position.x < -sideLimit;
11535					var outRight = b0.position.x > bounds.w + sideLimit;
11536					var outBottom = b0.position.y > bottomLimit;
11537
11538					if (outLeft || outRight || outBottom) {
11539						var safeX = clamp(b0.position.x, minX, maxX);
11540						var safeY = clamp(b0.position.y, rescueY, floorY);
11541
11542						if (outBottom) safeY = floorY;
11543
11544						Body.setPosition(b0, { x: safeX, y: safeY });
11545						Body.setVelocity(b0, { x: 0, y: 0 });
11546						Body.setAngularVelocity(b0, 0);
11547					}
11548				}
11549
11550				for (var j = 0; j < items.length; j++) {
11551					var it = items[j];
11552					var b = it.body;
11553					setTransform(it.el, b.position.x - it.w * 0.5, b.position.y - it.h * 0.5, b.angle * 180 / Math.PI);
11554				}
11555
11556				rafId = requestAnimationFrame(tick);
11557			}
11558
11559			function resetToNewSize() {
11560				if (!started) return;
11561
11562				removeWalls();
11563				if (!createWalls()) return;
11564
11565				updateRects();
11566
11567				var w = bounds.w;
11568				var h = bounds.h;
11569
11570				for (var i = 0; i < items.length; i++) {
11571					var it = items[i];
11572					var bw = it.w;
11573					var bh = it.h;
11574
11575					var px = clamp(it.body.position.x, bw * 0.5 + 2, w - bw * 0.5 - 2);
11576					var py = clamp(it.body.position.y, -2000, h - bh * 0.5 - 2);
11577					Body.setPosition(it.body, { x: px, y: py });
11578				}
11579			}
11580
11581			function startSizeObserver() {
11582				updateRects();
11583				lastW = bounds.w;
11584				lastH = bounds.h;
11585
11586				if ("ResizeObserver" in window) {
11587					ro = new ResizeObserver(function () {
11588						raf2(function () {
11589							updateRects();
11590							if (bounds.w !== lastW || bounds.h !== lastH) {
11591								lastW = bounds.w;
11592								lastH = bounds.h;
11593								resetToNewSize();
11594							}
11595						});
11596					});
11597					ro.observe(area);
11598					return;
11599				}
11600
11601				pollTimer = setInterval(function () {
11602					updateRects();
11603					if (bounds.w !== lastW || bounds.h !== lastH) {
11604						lastW = bounds.w;
11605						lastH = bounds.h;
11606						resetToNewSize();
11607					}
11608				}, 200);
11609			}
11610
11611			function stopSizeObserver() {
11612				if (ro) { ro.disconnect(); ro = null; }
11613				if (pollTimer) { clearInterval(pollTimer); pollTimer = null; }
11614			}
11615
11616			function startSpawning() {
11617				if (!alive) return;
11618				if (started) return;
11619
11620				var tries = 0;
11621				var stable = 0;
11622				var prevW = 0;
11623				var prevH = 0;
11624
11625				function check() {
11626					if (!alive) return;
11627
11628					updateRects();
11629
11630					if (!bounds.w || !bounds.h) {
11631						tries++;
11632						if (tries < 40) setTimeout(check, 150);
11633						return;
11634					}
11635
11636					if (bounds.w === prevW && bounds.h === prevH) stable++;
11637					else {
11638						stable = 0;
11639						prevW = bounds.w;
11640						prevH = bounds.h;
11641					}
11642
11643					if (stable < 2) {
11644						setTimeout(check, 150);
11645						return;
11646					}
11647
11648					started = true;
11649
11650					removeWalls();
11651					if (!createWalls()) {
11652						started = false;
11653						setTimeout(check, 200);
11654						return;
11655					}
11656
11657					setupDrag();
11658					setupHoverRepel();
11659					tick();
11660
11661					var start = function () {
11662						spawnOne();
11663						spawnTimer = setInterval(function () {
11664							if (!alive) return;
11665							if (spawned >= count) {
11666								clearInterval(spawnTimer);
11667								spawnTimer = null;
11668								return;
11669							}
11670							spawnOne();
11671						}, spawnEvery);
11672					};
11673
11674					if (startDelay > 0) setTimeout(start, startDelay);
11675					else start();
11676				}
11677
11678				check();
11679			}
11680
11681			function setupViewportTrigger() {
11682				if ("IntersectionObserver" in window) {
11683					io = new IntersectionObserver(function (entries) {
11684						for (var i = 0; i < entries.length; i++) {
11685							if (entries[i].isIntersecting) {
11686								startSpawning();
11687								if (once && io) { io.disconnect(); io = null; }
11688								break;
11689							}
11690						}
11691					}, { root: null, rootMargin: rootMargin, threshold: threshold });
11692
11693					io.observe(surface);
11694					return;
11695				}
11696
11697				scrollHandler = debounce(function () {
11698					var r = surface.getBoundingClientRect();
11699					var vh = window.innerHeight || document.documentElement.clientHeight;
11700					if (r.top < vh * 0.9 && r.bottom > vh * 0.1) {
11701						startSpawning();
11702						if (once && scrollHandler) {
11703							window.removeEventListener("scroll", scrollHandler);
11704							scrollHandler = null;
11705						}
11706					}
11707				}, 100);
11708
11709				window.addEventListener("scroll", scrollHandler);
11710				scrollHandler();
11711			}
11712
11713			recalcSpawnSizes();
11714			preloadAll(images);
11715			startSizeObserver();
11716			setupViewportTrigger();
11717
11718			return function destroy() {
11719				alive = false;
11720
11721				if (rafId) { cancelAnimationFrame(rafId); rafId = 0; }
11722
11723				stopSizeObserver();
11724
11725				if (io) { try { io.disconnect(); } catch (e) {} io = null; }
11726
11727				if (scrollHandler) {
11728					window.removeEventListener("scroll", scrollHandler);
11729					scrollHandler = null;
11730				}
11731
11732				if (spawnTimer) { clearInterval(spawnTimer); spawnTimer = null; }
11733
11734				if (dragMousemoveHandler) {
11735					area.removeEventListener("mousemove", dragMousemoveHandler);
11736					dragMousemoveHandler = null;
11737				}
11738
11739				if (hoverMoveHandler) {
11740					area.removeEventListener("mousemove", hoverMoveHandler);
11741					hoverMoveHandler = null;
11742				}
11743				if (hoverLeaveHandler) {
11744					area.removeEventListener("mouseleave", hoverLeaveHandler);
11745					hoverLeaveHandler = null;
11746				}
11747
11748				removeWalls();
11749
11750				if (mouseConstraint) {
11751					World.remove(engine.world, mouseConstraint);
11752					mouseConstraint = null;
11753				}
11754
11755				for (var i = 0; i < items.length; i++) {
11756					try { World.remove(engine.world, items[i].body); } catch (e) {}
11757					if (items[i].el && items[i].el.parentNode) items[i].el.parentNode.removeChild(items[i].el);
11758				}
11759				items.length = 0;
11760
11761				var nodes = area.querySelectorAll(".drop-img");
11762				for (var n = nodes.length - 1; n >= 0; n--) {
11763					if (nodes[n] && nodes[n].parentNode) nodes[n].parentNode.removeChild(nodes[n]);
11764				}
11765			};
11766		}
11767
11768		var destroyers = [];
11769
11770		var areas = document.querySelectorAll(".uncode-bg-drop");
11771		for (var n = 0; n < areas.length; n++) {
11772
11773			var renderArea = areas[n];
11774
11775			if (renderArea.__thumbDropDestroy && typeof renderArea.__thumbDropDestroy === "function") {
11776				try { renderArea.__thumbDropDestroy(); } catch (e) {}
11777				renderArea.__thumbDropDestroy = null;
11778			}
11779
11780			var surface = renderArea.closest
11781				? renderArea.closest('.vc_row[data-parent="true"]')
11782				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
11783
11784			if (!surface) continue;
11785
11786			var images = getDropImagesFromArea(renderArea);
11787			if (!images.length) continue;
11788
11789			var rawMin = getDataFromArea(renderArea, "min-width", "140px");
11790			var rawMax = getDataFromArea(renderArea, "max-width", "260px");
11791
11792			var minW = cssLengthToPx(rawMin, renderArea, 140);
11793			var maxW = cssLengthToPx(rawMax, renderArea, 260);
11794			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
11795
11796			renderArea.__thumbDropDestroy = initMatterDrop({
11797				area: renderArea,
11798				surface: surface,
11799				images: images,
11800
11801				rawMin: rawMin,
11802				rawMax: rawMax,
11803
11804				count: toNumber(getDataFromArea(renderArea, "count", 14), 14),
11805				duplicateImages: String(getDataFromArea(renderArea, "unique", "no")) !== "yes",
11806				sizeMin: minW,
11807				sizeMax: maxW,
11808
11809				spawnEvery: toNumber(getDataFromArea(renderArea, "interval", 160), 160),
11810				startDelay: toNumber(getDataFromArea(renderArea, "delay", 0), 0
11810),
11811
11812				gravityY: toNumber(getDataFromArea(renderArea, "gravity", 1.25), 1.25),
11813				restitution: toNumber(getDataFromArea(renderArea, "restitution", 0.35), 0.35),
11814				frictionAir: toNumber(getDataFromArea(renderArea, "friction-air", 0.02), 0.02),
11815				friction: toNumber(getDataFromArea(renderArea, "friction", 0.25), 0.25),
11816				density: toNumber(getDataFromArea(renderArea, "density", 0.001), 0.001),
11817
11818				wallThickness: toNumber(getDataFromArea(renderArea, "wall", 80), 80),
11819				floorPadding: toNumber(getDataFromArea(renderArea, "floor", 0), 0),
11820
11821				rotateRange: toNumber(getDataFromArea(renderArea, "rotate", 18), 18),
11822
11823				once: String(getDataFromArea(renderArea, "once", "yes")) !== "no",
11824				threshold: toNumber(getDataFromArea(renderArea, "threshold", 0.25), 0.25),
11825				rootMargin: String(getDataFromArea(renderArea, "root-margin", "0px 0px -10% 0px")),
11826
11827				enableDrag: String(getDataFromArea(renderArea, "interactive", "")),
11828
11829				dragStiffness: toNumber(getDataFromArea(renderArea, "drag-stiffness", 0.18), 0.18),
11830				dragDamping: toNumber(getDataFromArea(renderArea, "drag-damping", 0.06), 0.06),
11831
11832				hoverRadius: toNumber(getDataFromArea(renderArea, "hover-radius", 50), 50),
11833
11834				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11835				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11836				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11837				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11838				spawnXJitter: toNumber(getDataFromArea(renderArea, "spawn-x-jitter", 13), 13),
11839
11840			}) || null;
11841
11842			if (renderArea.__thumbDropDestroy) {
11843				destroyers.push(renderArea.__thumbDropDestroy);
11844			}
11845		}
11846
11847		__globalDestroy = function () {
11848			for (var i = 0; i < destroyers.length; i++) {
11849				try { destroyers[i](); } catch (e) {}
11850			}
11851			destroyers.length = 0;
11852		};
11853
11854	};
11855
11856})();
11857UNCODE.preventDoubleTransition = function() {
11858	$('.sticky-element .animate_when_almost_visible').each(function(){
11859		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
11860			$el.addClass('do_not_reanimate');
11861		});
11862	});
11863};
11864
11865UNCODE.checkScrollForTabs = function(){
11866	var goToSection = window.location.hash.replace('#', ''),
11867		$index;
11868
11869	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
11870	goToSection = encodeURIComponent(goToSection);
11871	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
11872
11873	$index.attr('data-parent', 'parent-' + goToSection);
11874
11875	if (window.location.hash != undefined && window.location.hash != '') {
11876		requestTimeout(function() {
11877			scrollBody('parent-' + goToSection);
11878		}, 500);
11879	}
11880
11881	$('.page-body a[href^="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
11882		var hash = (e.currentTarget).hash;
11883		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
11884			$('a[href="' + hash + '"][data-tab-history]').click();
11885			scrollBody(hash);
11886		}
11887	});
11888
11889	var scrollBody = function(index) {
11890
11891		var getSection = $('a[href="' + index + '"][data-tab-history]'),
11892			scrollTo,
11893			safeGap = 27;
11894
11895		if ( ! getSection.length ) {
11896			getSection = $('div[data-parent="' + index + '"]');
11897
11898			if ( getSection.attr('data-target') == 'row' ) {
11899				getSection = getSection.closest('.vc_row');
11900				safeGap = 0;
11901			}
11902		}
11903
11904		if (typeof getSection === 'undefined' || ! getSection.length ) {
11905			return;
11906		}
11907
11908		var body = $("html, body"),
11909		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
11910		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
11911		getOffset = UNCODE.get_scroll_offset();
11912		if ( typeof getSection.offset() === 'undefined' )
11913			return;
11914		scrollTo = getSection.offset().top - safeGap;
11915		scrollTo -= getOffset;
11916
11917		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
11918		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
11919
11920		if (index != 0) {
11921			UNCODE.scrolling = true;
11922		}
11923
11924		if (scrollSpeed == 0) {
11925			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
11926			UNCODE.scrolling = false;
11927		} else {
11928			body.animate({
11929				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
11930			}, scrollSpeed, 'easeInOutQuad', function() {
11931				requestTimeout(function() {
11932					UNCODE.scrolling = false;
11933					if (getOffset != UNCODE.get_scroll_offset()) {
11934						scrollBody(index);
11935					}
11936				}, 100);
11937			});
11938		}
11939
11940	};
11941};
11942
11943UNCODE.printScreen = function() {
11944	var inlineMediaStyle = null,
11945		setResize;
11946
11947    function changeMediaStyle() {
11948		clearRequestTimeout(setResize);
11949		setResize = requestTimeout(function(){
11950	        var $head = document.getElementsByTagName('head')[0],
11951	        	$newStyle = document.createElement('style'),
11952	        	winW = window.innerWidth,
11953	        	printH = window.innerHeight;
11954
11955	        $newStyle.setAttribute('type', 'text/css');
11956	        $newStyle.setAttribute('media', 'print');
11957	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
11958
11959	        if (inlineMediaStyle != null) {
11960	            $head.replaceChild($newStyle, inlineMediaStyle)
11961	        } else {
11962	            $head.appendChild($newStyle);
11963	        }
11964	        inlineMediaStyle = $newStyle;
11965	    }, 1000);
11966    }
11967
11968    changeMediaStyle();
11969    window.addEventListener('resize', changeMediaStyle);
11970};
11971
11972UNCODE.fullPage = function() {
11973	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
11974		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
11975		return false;
11976	} else {
11977		requestTimeout(function() {
11978			window.scrollTo(0, 0);
11979		}, 10);
11980	}
11981
11982	var $masthead = $('#masthead'),
11983		$logo = $('#logo-container-mobile'),
11984		$logolink = $('[data-minheight]', $logo),
11985		logoMinScale = $logolink.data('minheight'),
11986		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
11987		$container = $('.main-container .post-content'),
11988		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
11989		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
11990		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
11991		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
11992		headerWithOpacity = $('.header-scroll-opacity', $header).length,
11993		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
11994		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
11995		scrollBar = true,
11996		effect,
11997		animationEndTimeOut,
11998		fp_anim_time = 900,
11999		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
12000		is_scrolling = false,
12001		dataNames = [],
12002		is_first = true,
12003		no_history = $('body').hasClass('uncode-scroll-no-history'),
12004		theres_footer = true;
12005
12006	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
12007		$('> div', $footer).each(function(index, el){
12008			if ( $(el).outerHeight() < 2 )
12009				theres_footer = false;
12010			else
12011				theres_footer = true;
12012		});
12013	}
12014
12015	if ( !$footer.length )
12016		theres_footer = false;
12017
12018	if ( !UNCODE.isFullPageSnap ) {
12019
12020		if ( $('body').hasClass('uncode-fullpage-zoom') )
12021			effect = 'scaleDown';
12022		else if ( $('body').hasClass('uncode-fullpage-parallax') )
12023			effect = 'moveparallax';
12024		else
12025			effect = 'movecurtain';
12026	}
12027
12028	if ( $('body').hasClass('uncode-fullpage-trid') )
12029		fp_anim_time = fp_anim_time*2;
12030
12031	if ( $header.length ) {
12032		if ( headerName !== '' )
12033			$header.attr('data-name', headerName);
12034		if ( headerLabel !== '' )
12035			$header.attr('data-label', headerLabel);
12036		$container.prepend($header);
12037	}
12038	if ( theres_footer ) {
12039		$container.append($footer);
12040		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
12041		$('aside.widget ul', $footer).addClass('no-list');
12042	}
12043
12044	var $all = $rows.add($header);
12045
12046	if ( theres_footer )
12047		$all = $all.add($footer);
12048
12049	$all.each(function(index, row) {
12050		if( index === 0 )
12051			$(row).addClass('uncode-scroll-active');
12052	});
12053
12054    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
12055
12056	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
12057		$("<ul class='onepage-pagination'></ul>").prependTo("body");
12058	}
12059
12060	$all.each(function(index, val) {
12061		var getName = $(val).data('name'),
12062			label;
12063
12064		if (typeof getName == 'undefined' || getName == 'undefined')
12065			getName = SiteParameters.slide_name + '-' + index;
12066
12067		//if ( dataNames.includes(getName) ) {
12068		if ( dataNames.indexOf(getName) > 0 ) {
12069			getName += '_' + index;
12070			$(val).data('name', getName);
12071		}
12072
12073		dataNames.push(getName);
12074
12075		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
12076
12077		if (typeof $(val).attr('data-label') !== 'undefined')
12078			label = $(val).attr('data-label');
12079		else label = '';
12080
12081		if ( $(val).is($footer) )
12082			return;
12083
12084		if (label != '' ) {
12085			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
12086			$('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>");
12087		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
12088			$('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>");
12089		}
12090	});
12091
12092	var checkVisible = function( el, off ) {
12093		if (typeof jQuery === "function" && el instanceof jQuery) {
12094			el = el[0];
12095		}
12096
12097		off = typeof off=='undefined' ? 50 : off;
12098
12099		var rect = el.getBoundingClientRect();
12100
12101		return (
12102			(
12103				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12104				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12105				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
12106			)
12107		);
12108	};
12109
12110	var animationEndAction = function( index, nextIndex ) {
12111		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12112			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12113			player, iframe;
12114
12115		if ( !$nextSlide.is($footer) ) {
12116			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
12117		}
12118
12119		if ( !UNCODE.isFullPageSnap ) {
12120			activateKBurns( nextIndex );
12121		}
12122
12123		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12124			if ($(this).attr('data-provider') == 'vimeo') {
12125				iframe = $(this).find('iframe');
12126				player = new Vimeo.Player(iframe[0]);
12127				player.pause();
12128			} else if ($(this).attr('data-provider') == 'youtube') {
12129				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12130			} else {
12131				if ($(this).is('video')) {
12132					$(this)[0].volume = 0;
12133					$(this)[0].pause();
12134				}
12135			}
12136		});
12137
12138		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12139			if ( $nextSlide.is($header) )
12140				$header.removeClass('header-scrolled');
12141		}
12142
12143		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
12144		$otherEl.each(function(){
12145			var $otherThis = $(this),
12146				$bgwrapperOther = $('.background-inner', $otherThis);
12147			if ( !checkVisible($otherThis) )
12148				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
12149
12150		});
12151
12152		if ( !checkVisible($currentSlide) ) {
12153			$currentSlide.removeClass('uncode-scroll-visible');
12154			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
12155			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
12156				currentScroll.scrollTo(0, 0, 0);
12157		}
12158
12159		clearRequestTimeout(animationEndTimeOut);
12160		animationEndTimeOut = requestTimeout(function(){
12161			Waypoint.refreshAll();
12162			$( document.body ).trigger('uncode_waypoints');
12163			var eventFP = new CustomEvent('fp-slide-changed');
12164			window.dispatchEvent(eventFP);
12165			is_scrolling = false;
12166
12167			if ( is_first ) {
12168				$('ul.onepage-pagination a').removeClass('is-selected');
12169				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12170				is_first = false;
12171			}
12172
12173		}, 500);
12174	};
12175
12176	var postLeaveActions = function( nextIndex ){
12177		if ( menuHidden && ! UNCODE.isMobile )
12178			return false;
12179
12180		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12181			$cols = $('.uncol', $el),
12182			anchor = $el.data('anchor');
12183
12184		if ( ! UNCODE.isFullPageSnap ) {
12185			$.each($cols, function(index, val){
12186				if ( $(val).hasClass('style-light') ){
12187					$masthead.removeClass('style-dark-override').addClass('style-light-override');
12188					return false;
12189				} else if ( $(val).hasClass('style-dark') ) {
12190					$masthead.removeClass('style-light-override').addClass('style-dark-override');
12191					return false;
12192				}
12193			});
12194		}
12195
12196		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
12197			$('.menu-item' ).removeClass('active');
12198			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12199		}
12200
12201		if ( !UNCODE.isFullPageSnap ) {
12202			activateBackWash( nextIndex );
12203		}
12204	};
12205
12206	var activateBackWash = function( nextIndex ){
12207		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12208			$bgwrapper;
12209
12210		if ( $el.length ) {
12211			if ( $el.hasClass('with-zoomout') ) {
12212				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12213			} else if ( $('.with-zoomout', $el).length ) {
12214				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
12215			} else {
12216				return false;
12217			}
12218		} else {
12219			return false;
12220		}
12221
12222		$bgwrapper.addClass('uncode-zoomout');
12223
12224	};
12225
12226	var activateKBurns = function( nextIndex ){
12227		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12228			$bgwrapper;
12229
12230		if ( $el.length ) {
12231			if ( $el.hasClass('with-kburns') ) {
12232				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12233			} else if ( $('.with-kburns', $el).length ) {
12234				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
12235			} else {
12236				return false;
12237			}
12238		} else {
12239			return false;
12240		}
12241
12242		$bgwrapper.addClass('uncode-kburns');
12243
12244	};
12245
12246	var activateParallax = function( nextIndex, direction ){
12247
12248		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12249			$cell = $('.fp-tableCell', $el),
12250			animationEnd = 'webkitAnimationEnd animationend',
12251			cellAnim;
12252
12253		switch( direction ) {
12254			case 'up':
12255				cellAnim = 'moveFromTopInner';
12256				break;
12257			default:
12258				cellAnim = 'moveFromBottomInner';
12259		}
12260
12261		$cell.css({
12262			'animation-name': cellAnim,
12263			'animation-duration': fp_anim_time + 'ms',
12264			'animation-delay': '',
12265			'animation-timing-function': fp_easing,
12266			'animation-fill-mode': 'both',
12267		}).off(animationEnd)
12268		.on(animationEnd, function(event) {
12269			if ( event.originalEvent.animationName === cellAnim ) {
12270				$cell
12271					.css({
12272						'animation-name': '',
12273						'animation-duration': '',
12274						'animation-delay': '',
12275						'animation-timing-function': '',
12276						'animation-fill-mode': '',
12277					});
12278			}
12279		});
12280	};
12281
12282	var scrollHashes = function(){
12283		var hash = window.location.hash.replace('#', '').split('/'),
12284			hashInd;
12285		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
12286			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
12287				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
12288				$.fn.fullpage.moveTo(hashInd+1);
12289			}
12290		} else if( hash[0] === '' ) {
12291			$.fn.fullpage.moveTo(1);
12292		}
12293	};
12294
12295	var hideMenu = function( index, nextIndex ){
12296		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
12297			return false;
12298
12299		var hMenu = UNCODE.menuHeight,
12300			transTime = hMenu * 2;
12301
12302		if ( index === 1 && nextIndex > 1 ) {
12303			hMenu = hMenu * -1;
12304		} else if  ( index !== 1 && nextIndex === 1 ) {
12305			hMenu = 0;
12306		} else {
12307			return false;
12308		}
12309
12310		$masthead.css({
12311			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12312			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12313			'-webkit-transition': 'transform 0.5s ease-in-out',
12314			'transition': 'transform 0.5s ease-in-out'
12315		});
12316	};
12317
12318	var shrinkMenu = function( index, nextIndex ){
12319		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
12320			return false;
12321
12322		if ( index === 1 && nextIndex > 1 ) {
12323			$logo.addClass('shrinked');
12324			$('div', $logo).each(function(index, val){
12325				$(val).css({
12326					'height': logoMinScale,
12327					'line-height': logoMinScale
12328				});
12329				if ($(val).hasClass('text-logo')) {
12330					$(val).css({
12331						'font-size': logoMinScale + 'px'
12332					});
12333				}
12334			});
12335			requestTimeout(function() {
12336				UNCODE.menuMobileHeight = $masthead.outerHeight();
12337			}, 300);
12338		} else if ( index !== 1 && nextIndex === 1 ) {
12339			$logo.removeClass('shrinked');
12340			$('div', $logo).each(function(index, val){
12341				$(val).css({
12342					'height': logoMaxScale,
12343					'line-height': logoMaxScale
12344				});
12345				if ($(val).hasClass('text-logo')) {
12346					$(val).css({
12347						'font-size': logoMaxScale + 'px'
12348					});
12349				}
12350			});
12351			requestTimeout(function() {
12352				UNCODE.menuMobileHeight = $masthead.outerHeight();
12353			}, 300);
12354		} else {
12355			return false;
12356		}
12357
12358	};
12359
12360	var anchorLink = function(){
12361
12362		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
12363			var $this = $(e.currentTarget),
12364				hash = e.currentTarget.href.split('#'),
12365				current = window.location.href.split('#'),
12366				ind,
12367				currentMenuOpened = UNCODE.menuOpened,
12368				go = false;
12369
12370			var hash_url = hash[0].replace(/\/?$/, '/'),
12371				current_url = current[0].replace(/\/?$/, '/');
12372
12373			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
12374				hash = '#'+hash[1];
12375				e.preventDefault();
12376				go = true;
12377			}
12378
12379			if ( go ) {
12380
12381				if ( $(hash).length ) {
12382					ind = $(hash).closest('.fp-section').index();
12383				} else {
12384					hash = hash.slice(1);
12385					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
12386				}
12387
12388				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
12389					ind = $this.closest('.fp-section').index();
12390
12391				UNCODE.menuOpened = false;
12392
12393				$.fn.fullpage.moveTo(ind+1);
12394
12395				UNCODE.menuOpened = currentMenuOpened;
12396				if (UNCODE.menuOpened) {
12397					if (UNCODE.wwidth < UNCODE.mediaQuery) {
12398						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
12399					} else {
12400						$('.mmb-container-overlay .overlay-close').trigger('click');
12401						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
12402					}
12403				}
12404
12405			}
12406
12407		});
12408
12409		$('.header-scrolldown').on('click', function(event) {
12410			event.preventDefault();
12411			var scrollDown = $(this),
12412				ind = scrollDown.closest('.fp-section').index();
12413
12414			$.fn.fullpage.moveTo(ind+2);
12415		});
12416
12417		var anchor = $('.fp-section.active').data('anchor');
12418
12419		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
12420			$('.menu-item').removeClass('active');
12421			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12422		}
12423
12424	};
12425
12426	var slideLeave = function( index, nextIndex, direction ) {
12427		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12428			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12429			animationEnd = 'webkitAnimationEnd animationend',
12430			transitionEnd = 'webkitTransitionEnd transitionend',
12431			animOut = effect != 'scaleDown' ? effect + direction : effect,
12432			animIn,
12433			isFooter = false,
12434			isFooterNext = false,
12435			footerH = $footer.outerHeight(),
12436			timeout,
12437			player, iframe,
12438			footerCoeff;
12439		switch( direction ) {
12440			case 'up':
12441				animIn = 'moveFromTop';
12442				break;
12443			default:
12444				animIn = 'moveFromBottom';
12445		}
12446
12447		if ( $('body').hasClass('uncode-fullpage-trid') ) {
12448			animOut = animIn + 'trid';
12449			animIn = animOut + 'In';
12450		} else if ( UNCODE.isFullPageSnap ) {
12451			animIn = animOut = 'none';
12452		}
12453
12454		hideMenu(index, nextIndex);
12455		shrinkMenu(index, nextIndex);
12456
12457		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12458			if ($(this).attr('data-provider') == 'vimeo') {
12459				iframe = $(this).find('iframe');
12460				player = new Vimeo.Player(iframe[0]);
12461				player.pause();
12462			} else if ($(this).attr('data-provider') == 'youtube') {
12463				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12464			} else {
12465				if ($(this).is('video')) {
12466					$(this)[0].volume = 0;
12467					$(this)[0].pause();
12468				}
12469			}
12470		});
12471
12472		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
12473			if ($(this).attr('data-provider') == 'vimeo') {
12474				iframe = $(this).find('iframe');
12475				iframe.on('load', function(){
12476					player = new Vimeo.Player(iframe);
12477					player.setVolume(0);
12478					player.play();
12479				});
12480				player = new Vimeo.Player(iframe);
12481				player.setVolume(0);
12482				player.play();
12483			} else if ($(this).attr('data-provider') == 'youtube') {
12484				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
12485			} else {
12486				if ($(this).is('video')) {
12487					$(this)[0].volume = 0;
12488					$(this)[0].play();
12489				}
12490			}
12491		});
12492
12493		if ( $currentSlide.is($footer) )
12494			isFooter = true;
12495
12496		if ( $nextSlide.is($footer) )
12497			isFooterNext = true;
12498
12499		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12500			if ( $currentSlide.is($header) )
12501				$header.addClass('header-scrolled');
12502		}
12503
12504		footerCoeff = footerH;
12505
12506		if ( UNCODE.isFullPageSnap ) {
12507			postLeaveActions( nextIndex );
12508			activateBackWash( nextIndex );
12509			activateKBurns( nextIndex );
12510			requestTimeout(function(){
12511				animationEndAction( index, nextIndex );
12512			}, fp_anim_time+150);
12513		} else {
12514			if ( isFooterNext ) {
12515
12516				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
12517				$iscrollWrapper.addClass('no-scrolloverflow');
12518
12519				$nextSlide
12520				.add($currentSlide)
12521				.addClass('uncode-scroll-front')
12522				.addClass('uncode-scroll-active')
12523				.addClass('uncode-scroll-visible');
12524				$container.css({
12525					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12526					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12527					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12528					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12529				}).off(transitionEnd)
12530				.one(transitionEnd, function(){
12531					animationEndAction( index, nextIndex );
12532				});
12533
12534			} else if ( isFooter ) {
12535
12536				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
12537				.add($currentSlide)
12538				.addClass('uncode-scroll-front')
12539				.addClass('uncode-scroll-active')
12540				.addClass('uncode-scroll-visible');
12541				$container.css({
12542					'-webkit-transform': 'translate3d(0, 0, 0)',
12543					'transform': 'translate3d(0, 0, 0)',
12544					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12545					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12546				})
12547				.one(transitionEnd, function(){
12548					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
12549						clearRequestTimeout(timeout);
12550						timeout = requestTimeout(function(){
12551							$.fn.fullpage.moveTo(nextIndex);
12552							slideLeave( index-1, nextIndex, 'up' );
12553							$container.off(transitionEnd);
12554						}, 50);
12555					}
12556					animationEndAction( index, nextIndex );
12557				});
12558
12559			} else {
12560
12561				postLeaveActions( nextIndex );
12562
12563				if ( !$('body').hasClass('uncode-fullpage-trid') )
12564					activateParallax( nextIndex, direction );
12565
12566				var $outBg = $('.background-wrapper', $currentSlide);
12567
12568				$nextSlide
12569				.addClass('uncode-scroll-front')
12570				.addClass('uncode-scroll-active')
12571				.addClass('uncode-scroll-visible')
12572				.addClass('uncode-scroll-animating-in')
12573				.css({
12574					'z-index':4,
12575					'animation-name': animIn,
12576					'animation-duration': fp_anim_time + 'ms',
12577					'animation-delay': '',
12578					'animation-timing-function': fp_easing,
12579					'animation-fill-mode': 'both',
12580					'transition': 'initial',
12581				}).off(animationEnd)
12582				.on(animationEnd, function(event) {
12583					if ( event.originalEvent.animationName === animIn ) {
12584						$(this)
12585							.addClass('uncode-scroll-already')
12586							.removeClass('uncode-scroll-front')
12587							.removeClass('uncode-scroll-animating-in')
12588							.css({
12589								'animation-name': '',
12590								'animation-duration': '',
12591								'animation-delay': '',
12592								'animation-timing-function': '',
12593								'animation-fill-mode': '',
12594								'transition': 'initial',
12595							});
12596
12597						$currentSlide
12598							.removeClass('uncode-scroll-active')
12599							.add($outBg)
12600							.css({
12601								'animation-name': '',
12602								'animation-duration': '',
12603								'animation-delay': '',
12604								'animation-timing-function': '',
12605								'animation-fill-mode': '',
12606								'transition': 'initial',
12607							});
12608
12609						animationEndAction( index, nextIndex );
12610
12611					}
12612
12613					if ( nextIndex > 1 )
12614						$('body').addClass('window-scrolled');
12615					else
12616						$('body').removeClass('window-scrolled');
12617				});
12618
12619				$currentSlide
12620					.addClass('uncode-scroll-animating-out')
12621					.removeClass('uncode-scroll-front')
12622					.css({
12623						'z-index':'1',
12624						'animation-name': animOut,
12625						'animation-duration': fp_anim_time + 'ms',
12626						'animation-delay': '',
12627						'animation-timing-function': fp_easing,
12628						'animation-fill-mode': 'both',
12629						'transition': 'initial',
12630						'will-change': 'auto'
12631					}).off(animationEnd)
12632					.on(animationEnd, function(event) {
12633						if ( event.originalEvent.animationName === animOut ) {
12634							$currentSlide.removeClass('uncode-scroll-animating-out');
12635						}
12636					});
12637
12638				if ( $('body').hasClass('uncode-fp-opacity') ) {
12639					$currentSlide.find('> div').css({
12640						'animation-name': 'opacityout',
12641						'animation-duration': fp_anim_time + 'ms',
12642						'animation-delay': '',
12643						'animation-timing-function': fp_easing,
12644						'animation-fill-mode': 'both',
12645						'transition': 'initial',
12646					}).off(animationEnd)
12647					.on(animationEnd, function(event) {
12648						if ( event.originalEvent.animationName === 'opacityout' ) {
12649							$(event.currentTarget).css({
12650								'animation-name': '',
12651								'animation-duration': '',
12652								'animation-delay': '',
12653								'animation-timing-function': '',
12654								'animation-fill-mode': '',
12655								'transition': '',
12656							});
12657						}
12658					});
12659				}
12660			}
12661		}
12662
12663		$('.scroll-top').on('click', function(e){
12664			$.fn.fullpage.moveTo(1);
12665			return false;
12666		});
12667
12668	};
12669
12670	var init_fullPage = function(mode){
12671
12672		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
12673		// 	scrollBar = false;
12674		// }
12675
12676		var checkFPeffects;
12677
12678		$container.fullpage({
12679			sectionSelector: '.uncode-scroll-lock',
12680			scrollOverflow: true,
12681			scrollOverflowOptions: {
12682				click: false,
12683				preventDefaultException: { tagName:/.*/ }
12684			},
12685			normalScrollElements: ".masthead-vertical",
12686			navigation: false,
12687			scrollBar: scrollBar,
12688			scrollingSpeed: fp_anim_time,
12689			verticalCentered: true,
12690			anchors: no_history ? false : dataNames,
12691			recordHistory: !no_history,
12692			afterRender: function(){
12693				$('body').removeClass('fp-waiting');
12694				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
12695					var $invisible = $(this).addClass('hidden-scroll');//,
12696				});
12697				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
12698					var $visible = $(this).addClass('uncode-scroll-visible'),
12699						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
12700					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
12701				});
12702
12703				$('ul.onepage-pagination a').on('click', function(e){
12704					e.preventDefault();
12705					var $a = $(this),
12706						toIndex = $a.data('index');
12707
12708					$.fn.fullpage.moveTo(toIndex+1);
12709				});
12710
12711				requestTimeout(function(){
12712					scrollHashes();
12713				}, 1000);
12714
12715				$(window).on('hashchange', function(e){
12716					requestTimeout(function(){
12717						scrollHashes();
12718					}, 500);
12719				});
12720
12721				anchorLink();
12722
12723				if ( $('body').hasClass('uncode-fp-opacity') ) {
12724					$all.each(function(index, row) {
12725						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
12726							classBg;
12727
12728						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
12729							classBg = testmatch[0];
12730							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
12731						}
12732					});
12733				}
12734
12735				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
12736					$(window).on('menuOpen gdprOpen', function(){
12737						$.fn.fullpage.setAutoScrolling(false);
12738					}).on('menuClose gdprClose', function(){
12739						$.fn.fullpage.setAutoScrolling(true);
12740					});
12741				}
12742
12743				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
12744					requestTimeout(function(){
12745						$.fn.fullpage.setAutoScrolling(false);
12746					}, 1000);
12747				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
12748					$.fn.fullpage.setAutoScrolling(true);
12749				});
12750
12751				if ( !UNCODE.isFullPageSnap ) {
12752					clearRequestTimeout(checkFPeffects);
12753					checkFPeffects = requestTimeout(function(){
12754						activateBackWash( 1 );
12755						activateKBurns( 1 );
12756					}, 100);
12757				}
12758
12759			},
12760			onLeave: function( index, nextIndex, direction ){
12761
12762				if ( UNCODE.menuOpened || is_scrolling )
12763					return false;
12764
12765				is_scrolling = true;
12766
12767				var event = new CustomEvent('fp-slide-leave');
12768				window.dispatchEvent(event);
12769
12770				slideLeave( index, nextIndex, direction );
12771
12772				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
12773					if ( direction === 'up' ) {
12774						$.fn.fullpage.moveTo(nextIndex-1);
12775					} else {
12776						$.fn.fullpage.moveTo(nextIndex+1);
12777					}
12778					return false;
12779				}
12780
12781				$('ul.onepage-pagination a').removeClass('is-selected');
12782				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12783
12784			}
12785		});
12786	};
12787
12788	init_fullPage();
12789	$(window).on('load', function(){
12790		requestTimeout(function(){
12791			$.fn.fullpage.reBuild();
12792		}, 3000);
12793	});
12794
12795	var addScrollingClass,
12796		removeScrollingClass;
12797
12798	window.addEventListener("fp-slide-scroll", function(){
12799		addScrollingClass = requestTimeout( function(){
12800			$('body').addClass('fp-slide-scrolling');
12801		}, 10 );
12802
12803		clearRequestTimeout(removeScrollingClass);
12804		removeScrollingClass = requestTimeout( function(){
12805			$('body').removeClass('fp-slide-scrolling');
12806		}, 150 );
12807
12808		Waypoint.refreshAll();
12809	}, false);
12810
12811	var setFPheight = function(){
12812		var $body = document.body,
12813			$footer = document.getElementById('colophon'),
12814			$maincontainer = document.querySelector('.main-wrapper'),
12815			$boxcontainer = document.querySelector('.box-container'),
12816			$sections = document.querySelectorAll('.fp-section'),
12817			rect = $maincontainer.getBoundingClientRect(),
12818			rect2 = $boxcontainer.getBoundingClientRect(),
12819			$masthead = document.getElementById('masthead'),
12820			_hideMenu = false,
12821			menuHeight = UNCODE.menuHeight;
12822		$body.style.height = UNCODE.wheight + 'px';
12823
12824		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
12825			_hideMenu = true;
12826		}
12827		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
12828			menuHeight = 0
12829		}
12830
12831
12832		if ( theres_footer )
12833			$footer.style.top = (rect.height || rect2.height) + 'px';
12834
12835		for (var i = 0; i < $sections.length; i++) {
12836			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
12837		}
12838	};
12839
12840	setFPheight();
12841
12842	window.addEventListener('resize', setFPheight, false);
12843	window.addEventListener('orientationchange', setFPheight, false);
12844
12845};
12846
12847UNCODE.particles = function() {
12848	$(".vc-particles-background").each(function() {
12849		var $particle = $(this);
12850		var $parent = $particle.closest('[data-parent]');
12851
12852		$parent.prepend($particle);
12853		// $(window).trigger('resize');
12854	})
12855};
12856
12857
12858UNCODE.readMoreCol = function( $el ){
12859	if ( typeof $el === 'undefined' || $el === null ) {
12860		$el = $('body');
12861	}
12862	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
12863	$readMoreCols.each(function(){
12864		var $uncont = $(this),
12865			$row = $uncont.closest('.row-container'),
12866			max_h = $uncont.attr('data-ov-height'),
12867			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
12868			actual_max_h = $uncont.outerHeight(),
12869			inner_h,
12870			$read_more = $('+ .btn-more-wrap', $uncont),
12871			read_more_resize = $read_more.hasClass('trigger-resize'),
12872			marginClosedBtn = $uncont.attr('data-margin-closed'),
12873			marginClosed = 0,
12874			marginOpenBtn = $uncont.attr('data-margin-open'),
12875			marginOpen = 0,
12876			anim_t = 250,
12877			resized = false;
12878
12879		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
12880
12881		switch (marginClosedBtn) {
12882			case 'sm':
12883				marginClosed = 18
12884				break;
12885				
12886			case 'std':
12887				marginClosed = 36
12888				break;
12889				
12890			case 'lg':
12891				marginClosed = 72
12892				break;
12893				
12894			case '':
12895			default:
12896				marginClosed = 0
12897				break;
12898				
12899		}
12900
12901		switch (marginOpenBtn) {
12902			case 'sm':
12903				marginOpen = 18
12904				break;
12905				
12906			case 'std':
12907				marginOpen = 36
12908				break;
12909				
12910			case 'lg':
12911				marginOpen = 72
12912				break;
12913				
12914			case 'no':
12915				marginOpen = 0
12916				break;
12917				
12918		}
12919
12920		var checkToggleMobile = function(){
12921			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
12922				resized = true;
12923				if ( $read_more.hasClass('state-closed') ) {
12924					$uncont[0].style.height = '';
12925					$uncont[0].style.maxHeight = max_h_mobile;
12926				}
12927			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
12928				if ( $read_more.hasClass('state-closed') ) {
12929					$uncont[0].style.height = '';
12930					$uncont[0].style.maxHeight = max_h;
12931				}
12932				resized = false;
12933			}
12934		}
12935		checkToggleMobile();
12936		$(window).on('resize', function() {
12937			checkToggleMobile();
12938		});
12939
12940		$('a', $read_more).on('click', function(e){
12941			e.preventDefault();
12942
12943			var $a = $(this);
12944
12945			if ( $read_more.hasClass('state-closed') ) {
12946
12947				$read_more
12948					.removeClass('state-closed')
12949					.addClass('state-open');
12950
12951				$uncont.css({
12952					'max-height': 'none',
12953					'height': 'auto',
12954				});
12955	
12956				inner_h = parseFloat( $uncont.outerHeight() );
12957
12958				$uncont.css({
12959					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
12960				});
12961		
12962				anim_t = inner_h - actual_max_h;
12963				if ( anim_t < 250 ) {
12964					anim_t = 250;
12965				} else if ( anim_t > 1000 ) {
12966					anim_t = 1000;
12967				}
12968
12969				$uncont.css({
12970					'transition-duration' : anim_t + 'ms'
12971				}).addClass('overflow-mask-animation').animate({
12972					'height': inner_h
12973				}, anim_t, 'easeInOutCubic', function(){
12974					$uncont.css({
12975						'height' : 'auto'
12976					}).removeClass('overflow-mask');
12977					if ( read_more_resize === true ) {
12978						window.dispatchEvent(new Event('resize'));
12979						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12980							ScrollTrigger.refresh(true);
12981						}
12982					}
12983				});
12984
12985				if ( marginOpen != '' ) {
12986					$read_more.animate({
12987						'margin-top' : marginOpen
12988					}, anim_t, 'easeInOutCubic');
12989				}
12990
12991			} else {
12992				$read_more
12993					.removeClass('state-open')
12994					.addClass('state-closed');
12995
12996				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
12997					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
12998				}, anim_t, 'easeInOutCubic', function(){
12999					if ( read_more_resize === true ) {
13000						window.dispatchEvent(new Event('resize'));
13001						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
13002							ScrollTrigger.refresh(true);
13003						}
13004					}
13005				});
13006
13007				if ( marginClosed !== '' ) {
13008					$read_more.animate({
13009						'margin-top' : marginClosed
13010					}, anim_t, 'easeInOutCubic');
13011				}
13012
13013				if ( $a.hasClass('toggle-scroll') ) {
13014                    var $masthead = $('#masthead > div:first-child'),
13015                        headH = $masthead.outerHeight(),
13016						rectTop = $row[0].getBoundingClientRect().top,
13017						checkNavBar = $a.hasClass('toggle-navbar'),
13018						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
13019                        offCont = ( $row.offset().top );
13020
13021					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13022						checkNavBar = checkNavBarMobile;
13023					}
13024
13025					if ( checkNavBar ) {
13026						offCont = offCont - headH;
13027					}
13028			
13029					if ( rectTop < headH ) {
13030						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
13031							$(this).stop();
13032						}).animate({
13033							scrollTop: offCont
13034						}, anim_t, 'easeInOutCubic');
13035					}
13036				}
13037
13038			}
13039		});
13040	});
13041}
13042UNCODE.filters = function() {
13043	var $systems = $('.isotope-system, .cssgrid-system');
13044
13045	$systems.each(function(index, val){
13046		var $system = $(this),
13047			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
13048			$widgets = $('.widgetized-cb-wrapper', $system),
13049			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
13050			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
13051			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
13052			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
13053
13054		if ($system.hasClass('isotope-processed')) {
13055			return;
13056		}
13057
13058		$cats_trigger.on('click', function(e) {
13059			if ( ! $('html').hasClass('screen-sm') ) {
13060				// $widgets.add($sorting_dd).slideUp(400);
13061				e.preventDefault();
13062				$widgets.slideUp(400, 'easeInOutCirc');
13063			}
13064		});
13065
13066		$('.filters-toggle-trigger', $system).on('click', function(e) {
13067			e.preventDefault();
13068			var $filters = $('.isotope-filters .menu-horizontal', $system);
13069			$filters.slideToggle(400, 'easeInOutCirc');
13070			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13071		});
13072
13073		$widget_trgr.on('click', function(e) {
13074			e.preventDefault();
13075			$widgets.slideToggle(400, 'easeInOutCirc');
13076			if (!$('html').hasClass('screen-sm')) {
13077				$cats_filters.slideUp(400, 'easeInOutCirc');
13078			}
13079			window.dispatchEvent(new CustomEvent('boxResized'));
13080		});
13081
13082		$sorting_trgr.on('click', function(e) {
13083			e.preventDefault();
13084			if (!$('html').hasClass('screen-sm')) {
13085				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13086			}
13087		});
13088
13089		$system.addClass('isotope-processed');
13090	});
13091
13092};
13093
13094UNCODE.widgets = function() {
13095	var widget_collapses = $('.widget-collapse');
13096
13097	widget_collapses.each(function(){
13098		var widget_collapse = $(this),
13099			widget_title = widget_collapse.find('.widget-title'),
13100			widget = widget_title.closest('.widget'),
13101			content = widget.children().not('.widget-title'),
13102			setCTA;
13103
13104		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13105			widget_title.toggleClass('open');
13106		}
13107
13108		widget_title.each(function() {
13109			var _this = $(this);
13110			var content = _this.closest('.widget').find('.widget-collapse-content');
13111
13112			$(window).on('load resize', function(){
13113				clearRequestTimeout(setCTA);
13114				setCTA = requestTimeout( function() {
13115					if ( content.is(':visible') ) {
13116						_this.addClass( 'open' );
13117					} else {
13118						_this.removeClass( 'open' );
13119					}
13120				}, 10 );
13121			})
13122
13123			_this.on( 'click', function(){
13124
13125				// Get content of :after element (+ icon) to check the visibility
13126				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
13127
13128				if (icon_content === 'none' || !icon_content) {
13129					return false;
13130				}
13131
13132				_this.toggleClass('open');
13133				var isOpen = _this.hasClass('open'),
13134					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
13135				content.animate({
13136					height: 'toggle',
13137					padding: 'toggle',
13138					opacity: 'toggle',
13139					top: isOpen ? 0 : hasBorder
13140				}, {
13141					duration: 400,
13142					easing: "easeInOutCirc",
13143				});
13144
13145				return false;
13146
13147			});
13148		});
13149	});
13150
13151	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
13152};
13153
13154UNCODE.unmodal = function() {
13155	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
13156		$('.unmodal-overlay').fadeIn();
13157		$('.unmodal-overlay').addClass('loading');
13158		$('body').addClass('uncode-unmodal-overlay-visible');
13159		$(window).trigger('unmodal-open');
13160	});
13161
13162	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
13163		$('.unmodal-overlay').fadeOut();
13164		$('.unmodal').fadeOut();
13165		$('body').removeClass('uncode-unmodal-overlay-visible');
13166		$('body').removeClass('uncode-unmodal-open');
13167		$('html').removeClass('uncode-unmodal-body-disable-scroll');
13168		$(document).trigger('unmodal-close');
13169		UNCODE.isUnmodalOpen = false;
13170	});
13171
13172	$(document).on('uncode-unmodal-show-content', function() {
13173		$('.unmodal-overlay').removeClass('loading');
13174		$('.unmodal').show();
13175		$('.unmodal').addClass('show-unmodal-with-animation');
13176		$('.unmodal-content')[0].scrollTop = 0;
13177		$('body').addClass('uncode-unmodal-open');
13178		UNCODE.isUnmodalOpen = true;
13179
13180		if ($('body').hasClass('qw-body-scroll-disabled')) {
13181			$('html').addClass('uncode-unmodal-body-disable-scroll');
13182		}
13183
13184		if ($('.unmodal').hasClass('auto-height')) {
13185			set_modal_height();
13186		}
13187	});
13188
13189	var set_modal_height = function() {
13190		var modal = $('.unmodal').css({height: 'auto'});
13191		var window_height = $(window).outerHeight();
13192		var modal_height = modal.outerHeight();
13193
13194		modal.css('height', 'auto');
13195
13196		if (modal_height > window_height) {
13197			modal.outerHeight(window_height);
13198		}
13199	}
13200
13201	if ($('.unmodal').hasClass('auto-height')) {
13202		var setCTA;
13203
13204		$(window).on('resize', function() {
13205			clearRequestTimeout(setCTA);
13206			setCTA = requestTimeout(function() {
13207				set_modal_height();
13208			}, 100);
13209		});
13210	}
13211};
13212
13213UNCODE.bgChanger = function() {
13214	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
13215		$bg_first = $('.vc_row[data-bg-remove]'),
13216		bg_remove = $bg_first.attr('data-bg-remove'),
13217		$first = $bg_changers.first(),
13218		$last = $bg_changers.last(),
13219		$bg_wrapper = $('#changer-back-color'),
13220		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
13221		setCTA, localH = UNCODE.wheight,
13222		isScrolling;
13223
13224	$bg_first.removeClass(bg_remove);
13225
13226	var bgChange = function($col, bgColor, skin, tmbskin){
13227		$bg_wrapper.attr( 'class', bgColor );
13228		var menuskin;
13229		if ( typeof skin !== 'undefined' ) {
13230			menuskin = skin.replace('style', 'menu')
13231		}
13232
13233		if ( $col.length ) {
13234			$('.uncol[data-skin-change]').each(function(){
13235				var $isoFooter = $('.isotope-footer', this);
13236				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
13237				if ( menuskin !== '' ) {
13238					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
13239				}
13240			});
13241
13242			$('.tmb[data-skin-change]').each(function(){
13243				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
13244			});
13245		}
13246	};
13247
13248	var $masthead = $('#masthead'),
13249		transDesktop,
13250		transMobile,
13251		changeSkin,
13252
13253	checkTransparencyAndChange = function( skin ){
13254		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
13255		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
13256		changeSkin = $masthead.hasClass('menu-change-skin');
13257
13258		if ( ! transDesktop && ! transMobile ) {
13259			return false;
13260		}
13261
13262		if ( ! changeSkin ) {
13263			return false;
13264		}
13265
13266		if ( skin === 'style-light' ){
13267			$masthead.removeClass('style-dark-override').addClass('style-light-override');
13268			return false;
13269		} else if ( skin === 'style-dark' ) {
13270			$masthead.removeClass('style-light-override').addClass('style-dark-override');
13271			return false;
13272		}
13273	};
13274
13275	var bg_waypoints = function(){
13276		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
13277
13278			$.each($bg_changers, function(index, row) {
13279
13280				var $row = $(row),
13281					$col = $('.uncol[data-skin-change]', $row).eq(0),
13282					skin,
13283					$tmbs,
13284					tmbskin,
13285					bgColor = $row.attr('data-bg-color');
13286
13287				if ( ! $row.is(':visible') ) {
13288					return false;
13289				}
13290
13291				if ( $col.length ) {
13292					skin = $col.attr('data-skin-change');
13293					$tmbs = $('.tmb[data-skin-change]', $row);
13294					tmbskin = skin.replace('style', 'tmb');
13295				}
13296
13297				if ( ! $row.hasClass('unscroll-horizontal') ) {
13298					$row.waypoint(function( dir ) {
13299						if ( dir === 'down' ) {
13300							bgChange($col, bgColor, skin, tmbskin);
13301							checkTransparencyAndChange(skin);
13302						} else {
13303							return;
13304						}
13305					}, {
13306						offset: '50%'
13307		  			});
13308
13309					$row.waypoint(function( dir ) {
13310						if ( dir === 'up' ) {
13311							bgChange($col, bgColor, skin, tmbskin);
13312							checkTransparencyAndChange(skin);
13313						} else {
13314							return;
13315						}
13316					}, {
13317						offset: function() {
13318							var clH = this.element.clientHeight,
13319								wH = window.innerHeight,
13320								ret = clH > 200 ? -100 : clH * -0.5;
13321							return ( wH / 2 ) - clH;
13322						}
13323					});
13324				}
13325
13326			});
13327
13328			$('body').addClass('bg-changer-init');
13329
13330		}
13331	};
13332
13333	var body = document.body,
13334	edges = false;
13335
13336	var throttle = function(fn, wait) {
13337		var time = Date.now();
13338		return function() {
13339			if ((time + wait - Date.now()) < 0) {
13340				fn();
13341				time = Date.now();
13342			}
13343		}
13344	}
13345
13346	var $wrapper = document.querySelector(".main-wrapper"),
13347		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
13348
13349	var $title = document.querySelector('#rotating');
13350	if ( $title !== null ) {
13351		$title.style.whiteSpace = 'nowrap';
13352		$title.style.transition = 'transform 200ms linear';
13353	}
13354
13355	window.addEventListener( 'scroll', throttle( function() {
13356		window.clearRequestTimeout( isScrolling );
13357
13358		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
13359
13360			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
13361				body = document.body,
13362				html = document.documentElement,
13363				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13364				$row = false,
13365				firstOff,
13366				lastOff;
13367
13368			if ( scrolled < 100 && $first.length ) {
13369				firstOff = $first.offset().top;
13370				if ( firstOff < 100 ) {
13371					var $row = $first;
13372				}
13373			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
13374				lastOff = $last.offset().top + $last.outerHeight();
13375				if ( lastOff > ( docH - 100 ) ) {
13376					var $row = $last;
13377				}
13378			}
13379
13380			if ( $row.length ) {
13381				var $col = $('.uncol[data-skin-change]', $row).eq(0),
13382					skin,
13383					$tmbs,
13384					tmbskin,
13385					bgColor = $row.attr('data-bg-color');
13386
13387				if ( $col.length ) {
13388					skin = $col.attr('data-skin-change');
13389					$tmbs = $('.tmb[data-skin-change]', $row);
13390					tmbskin = skin.replace('style', 'tmb');
13391				}
13392
13393				bgChange($col, bgColor, skin, tmbskin);
13394				checkTransparencyAndChange(skin);
13395				edges = true;
13396			}
13397
13398		}, 150);
13399
13400		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
13401			bg_waypoints();
13402			Waypoint.refreshAll();
13403			edges = false;
13404		}
13405
13406	}, 100), false);
13407
13408	$(window).on('resize', function() {
13409		clearRequestTimeout(setCTA);
13410		setCTA = requestTimeout(function() {
13411			if ( localH != UNCODE.wheight ) {
13412				localH = UNCODE.wheight;
13413				bg_waypoints();
13414				Waypoint.refreshAll();
13415			}
13416		}, 100);
13417	});
13418
13419	bg_waypoints();
13420
13421};
13422
13423UNCODE.skewIt = function() {
13424
13425	if ( $('body').hasClass('compose-mode') ) {
13426		return;
13427	}
13428
13429	var justscrolled = false;
13430
13431	var loadSkewIt = function(){
13432
13433		var $pageHeader = $('#page-header'),
13434			$page_body = $('.page-body'),
13435			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
13436
13437		if ( $header_skew.length ) {
13438			$pageHeader.addClass('uncode-skew').css({
13439				position: 'relative',
13440				zIndex: 1
13441			});
13442			$header_skew.removeClass('uncode-skew');
13443			$page_body.css({
13444				position: 'relative',
13445				zIndex: 0
13446			});
13447		}
13448
13449		var $skew = $('.uncode-skew'),
13450			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
13451			horizontal = $horizontal.length,
13452			stopSkewing,
13453			lastOffset = 0,
13454			lastDate = Date.now();
13455
13456		if ( ! $skew.length ) {
13457			return;
13458		}
13459
13460		var dropSkew = function(){
13461			if ( UNCODE.wwidth < UNCODE.mediaQuery )
13462				return;
13463
13464			$skew.each(function(){
13465				var $this = $(this),
13466					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13467
13468				if ( $drop.length ) {
13469					$this.css({
13470						'transform': 'skew(0)'
13471					});
13472					var bound = $this[0].getBoundingClientRect();
13473					$drop.css({
13474						left: bound.x * -1,
13475						top: bound.y * -1,
13476					});
13477				}
13478			});
13479		};
13480		dropSkew();
13481
13482		$(window).on('resize', dropSkew);
13483
13484		window.addEventListener( 'scroll', function() {
13485
13486			if ( justscrolled !== true ) {
13487				justscrolled = true;
13488				return;
13489			}
13490
13491			window.clearRequestTimeout( stopSkewing );
13492
13493			var now = Date.now(),
13494				delayInMs = now - lastDate,
13495				offset = window.pageYOffset || window.document.documentElement.scrollTop,
13496				newOffset = offset - lastOffset,
13497				speed = Math.pow((newOffset / delayInMs), 3) * -1,
13498				body = document.body,
13499				html = document.documentElement,
13500				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13501				wait = 50,
13502				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
13503
13504			if ((lastDate + wait - now) < 0) {
13505
13506				lastDate = now;
13507				lastOffset = offset;
13508
13509				if ( speed > 6 ) {
13510					speed = 6;
13511				} else if ( speed < -6 ) {
13512					speed = -6;
13513				}
13514
13515				if ( speed > 2 && offset < UNCODE.wheight ) {
13516					speed = 2;
13517				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
13518					speed = -2;
13519				}
13520
13521				var speedY = speed,
13522					speedX = speed * 1.25;
13523
13524				if ( horizontal ) {
13525					speedY = 0;
13526					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13527						speedX = 0;
13528						return;
13529					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13530						speedX = 0;
13531						return;
13532					}
13533				} else {
13534					speedX = 0;
13535				}
13536
13537				if ( ! $skew.closest('.enter-st').length ) {
13538					speedX = 0;
13539				}
13540
13541				gsap.killTweensOf($skew);
13542				gsap.to( $skew, {
13543					duration: 0.2,
13544					skewY: (speedY * maxSpeed) + "deg",
13545					skewX: (speedX * maxSpeed) + "deg",
13546					ease: Power0.easeNone,
13547					transformOrigin: 'center',
13548				});
13549
13550			}
13551
13552			stopSkewing = requestTimeout(function() {
13553				gsap.killTweensOf($skew);
13554				gsap.to( $skew, {
13555					duration: 0.5,
13556					skewY: "0deg",
13557					skewX: "0deg",
13558					transformOrigin: 'center',
13559					ease: Expo.easeOut,
13560				});
13561
13562				$skew.each(function(){
13563					var $this = $(this),
13564						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13565
13566					if ( $drop.length ) {
13567						var bound = $this[0].getBoundingClientRect()
13568						$drop.css({
13569							left: bound.x * -1,
13570							top: bound.y * -1,
13571						});
13572					}
13573				});
13574
13575			}, 200);
13576
13577		}, false);
13578
13579	};
13580
13581	$(window).on('load', loadSkewIt);
13582
13583};
13584
13585UNCODE.rotateIt = function() {
13586
13587	if ( $('body').hasClass('compose-mode') ) {
13588		return;
13589	}
13590
13591	var frameRotate = false;
13592	var loadRotateIt = function(){
13593
13594		var $toRotate = $('.uncode-rotate');
13595
13596		$toRotate.each(function(){
13597			var $rotate = $(this),
13598				deg = 0,
13599				dir = true,
13600				coeff = 1,
13601				lastOffset = 0,
13602				lastDate = Date.now();
13603
13604			var checkScroll = function($rotate){
13605				// if ( ! $rotate.length ) {
13606				// 	return;
13607				// }
13608
13609				var now = Date.now(),
13610					delayInMs = now - lastDate,
13611					offset = window.pageYOffset || window.document.documentElement.scrollTop,
13612					newOffset = offset - lastOffset,
13613					speed = (newOffset / delayInMs) * 5,
13614					body = document.body,
13615					html = document.documentElement,
13616					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
13617
13618				lastDate = now;
13619				lastOffset = offset;
13620
13621				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
13622					deg = 0;
13623				}
13624
13625				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
13626					deg = parseFloat(deg) + parseFloat(speed);
13627				}
13628
13629				if ( $rotate.hasClass('uncode-rotate-hover') ) {
13630					$rotate.hover(function(){
13631						coeff = 1.75;
13632					}, function(){
13633						coeff = 1;
13634					});
13635				}
13636
13637				// if ( speed > 0 ) {
13638				// 	dir = true
13639				// } else if ( speed < 0 ) {
13640				// 	dir = false
13641				// }
13642
13643				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
13644					deg = deg+coeff;
13645					// if ( dir ) {
13646					// 	deg = deg+coeff;
13647					// } else {
13648					// 	deg = deg-coeff;
13649					// }
13650				}
13651
13652				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13653					return false;
13654				}
13655				
13656				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
13657					var undeg = deg*-1;
13658					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
13659				} else {
13660					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
13661				}
13662
13663				requestAnimationFrame(function() {
13664					if ( frameRotate === true ) {
13665						frameRotate = false;
13666						return;
13667					}
13668					checkScroll($rotate);
13669				});
13670			};
13671
13672			checkScroll($rotate);
13673
13674		});
13675
13676	};
13677
13678	$(window).on('load', loadRotateIt);
13679
13680	var checkRotate;
13681	var resizeRotate = function(){
13682		var $inlineRotates = $('.inline-rotate');
13683		$inlineRotates.each(function(){
13684			$(this).addClass('inline-rotate-standby');
13685		});
13686		clearTimeout(checkRotate);
13687		checkRotate = setTimeout(function(){
13688			$('.inline-rotate').each(function(){
13689				$(this).removeClass('inline-rotate-standby');
13690				frameRotate = true;
13691			});
13692			loadRotateIt();
13693		}, 500);
13694	};
13695
13696	$(window).off('resize.inline-rotate', resizeRotate)
13697	.on('resize.inline-rotate', resizeRotate);
13698
13699};
13700
13701var marqueeAttempts = 0,
13702	marqueeTO,
13703	marqueeCheckResize,
13704	initMarquee;
13705
13706UNCODE.textMarquee = function( $titles ) {
13707
13708	var isInitMarque = false;
13709	var lastMarqueeDocH = Math.round($(document).height());
13710
13711	var initTextMarquee = function( $titles ){
13712
13713		if ( typeof $titles == 'undefined' ) {
13714			$titles = $('.un-text-marquee');
13715		}
13716
13717		if ( ! $titles.length ) {
13718			return;
13719		}
13720
13721		isInitMarque = true;
13722
13723		var stableHeight = UNCODE.wheight;
13724
13725		$titles.each(function(){
13726			var $title = $(this),
13727				marqueeNS = '.textMarquee-' + Math.random().toString(36).slice(2),
13728				$span = $('> span, > i > span', $title),
13729				txt,
13730				first = true,
13731				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
13732				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
13733				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
13734				hasSticky = false,
13735				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
13736				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
13737				newW = UNCODE.wwidth,
13738				marqueeTL, inview,
13739				isInMenu = $title.closest('.megamenu-block-wrapper').length;
13740
13741
13742			var getStickyBound = function() {
13743				var $sticky = $title.closest('.sticky-trigger, .sticky-element');
13744
13745				if ( $sticky.length ) {
13746					var $pinSpacer = $sticky.closest('.pin-spacer');
13747					return $pinSpacer.length ? $pinSpacer : $sticky;
13748				}
13749
13750				var $pinSpacerOnly = $title.closest('.pin-spacer');
13751
13752				if ( $pinSpacerOnly.length ) {
13753					return $pinSpacerOnly;
13754				}
13755
13756				return $title.closest('.vc_row');
13757			};
13758
13759			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
13760				hasSticky = true;
13761				dataTrigger = 'row';
13762			}
13763
13764			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13765				dataNavBar = dataNavBarMobile;
13766			}
13767
13768			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
13769			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
13770			var dataX = dataSpeed;
13771
13772			dataSpeed += 5;
13773
13774			$('.marquee-clone-wrap', $title).remove();
13775
13776			txt = $span.html();
13777
13778			if ( ! $('.marquee-original-core', $span).length ) {
13779				txt = $span.html();
13780				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
13781			} else {
13782				txt = $('.marquee-original-core', $span).html();
13783			}
13784
13785			var spanW,
13786				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
13787				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
13788				speed = 10 - dataSpeed;
13789
13790			$span.prepend($prepended);
13791			$span.append($appended);
13792
13793			var continuousTextMarquee = function () {
13794				var bound = $title
13795						.css({
13796							transform: "none",
13797							opacity: 0,
13798						})
13799						.offset(),
13800					ease = "none";
13801
13802				var xStrt =
13803						first || $title.hasClass("un-marquee-infinite")
13804							? 0
13805							: UNCODE.wwidth - bound.left,
13806					xEnd = $title.hasClass("un-marquee-infinite")
13807						? spanW
13808						: spanW + bound.left,
13809					xSpeed =
13810						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
13811						dataSpeed,
13812					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
13813					speedSlow = (xEnd + xStrt) / 45,
13814					transFormVal,
13815					translX;
13816
13817				if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
13818					marqueeTL.kill();
13819				}
13820
13821				marqueeTL = new TimelineMax({ paused: true, reversed: true });
13822				marqueeTL.play();
13823
13824				var inViewElement =
13825						dataTrigger === "row" ? ( hasSticky ? getStickyBound()[0] : $title.closest(".vc_row")[0] ) : $title[0],
13826					wayOff =
13827						dataTrigger === "row" && dataNavBar === "yes"
13828							? UNCODE.menuHeight
13829							: 0;
13830
13831				if ( isInMenu ) {
13832					$(document).on('un-menu-show.marquee', function(e, $ul){
13833						marqueeTL.restart();
13834					});
13835					$(document).on('un-menu-hide.marquee', function(e, $ul){
13836						marqueeTL.pause();
13837					});
13838				} else {
13839					inview = new Waypoint.Inview({
13840						element: inViewElement,
13841						offset: wayOff,
13842						enter: function (direction) {
13843							marqueeTL.play();
13844						},
13845						exited: function (direction) {
13846							if (!$title.closest(".pin-spacer").length) {
13847								marqueeTL.pause();
13848							}
13849						},
13850					});
13851				}
13852
13853				if ($title.hasClass("un-marquee-hover")) {
13854					var $column = $title.closest(".wpb_column"),
13855						$col_link = $(".col-link", $column),
13856						$hover_sel = $title;
13857
13858					if ($col_link.length) {
13859						$hover_sel = $title.add($column);
13860					}
13861					$hover_sel
13862						.on("mouseover", function () {
13863							ease = "power2.out";
13864							transFormVal = $title.css("transform").split(/[()]/)[1];
13865							translX = transFormVal.split(",")[4];
13866							speedSlow = (xEnd + (xStrt - translX)) / 45;
13867							marqueeTL.duration(speedSlow);
13868						})
13869						.on("mouseout", function () {
13870							ease = "power2.in";
13871							transFormVal = $title.css("transform").split(/[()]/)[1];
13872							translX = transFormVal.split(",")[4];
13873							speedSlow =
13874								((xEnd + (xStrt - translX)) /
13875									(dataSpeed * dataSpeed * dataSpeed) /
13876									5) *
13877								dataSpeed;
13878							marqueeTL.duration(speedSlow);
13879						});
13880				}
13881		
13882				gsap.killTweensOf($title);
13883				marqueeTL.fromTo( $title, {
13884					opacity: 1,
13885					x: xStrt * direction * -1
13886				},
13887				{
13888					duration: xSpeed,
13889					x: xEnd * direction,
13890					onComplete: function(){
13891						first = false;
13892						if ( isInMenu ) {
13893							marqueeTL.restart();
13894						} else {
13895							continuousTextMarquee();
13896						}
13897					},
13898					onUpdate: function(){
13899						if ( ! $title[0].isConnected ) {
13900							marqueeTL.kill();
13901							initTextMarquee();
13902						}
13903					},
13904					ease: ease
13905				});
13906		
13907			};
13908			
13909			var runTextMarquee = function(){
13910				var time = Date.now();
13911
13912				var textMarqueeScroll = function(){
13913					var $row = $title.closest('.vc_row');
13914					if ( hasSticky ) {
13915						$row = getStickyBound();
13916					}
13917					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
13918
13919					if ( !$bound.length ) {
13920						return;
13921					}
13922
13923					var bound = $bound[0].getBoundingClientRect(),
13924						wait = 100,
13925						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
13926						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
13927
13928					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
13929						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
13930						marqueeAttempts < 2 ) {
13931
13932						clearRequestTimeout(marqueeTO);
13933
13934						marqueeTO = requestTimeout(function(){
13935							marqueeAttempts++;
13936							runTextMarquee();
13937						}, 100);
13938					}
13939
13940
13941					var bound_top = bound.top,
13942						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
13943
13944					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
13945						if ( dataTrigger === 'row-middle' ) {
13946							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
13947						}
13948						if ( dataNavBar === 'yes' ) {
13949							bound_top = bound_top - UNCODE.menuHeight;
13950						}
13951						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
13952					}
13953
13954					gsap.killTweensOf($title);
13955					gsap.to( $title, {
13956						duration: 0.24,
13957						x: gsap_calc,
13958					});
13959				};
13960
13961				textMarqueeScroll();
13962				$(window)
13963					.off('load' + marqueeNS + ' scroll' + marqueeNS)
13964					.on('load' + marqueeNS + ' scroll' + marqueeNS, function(e) {
13965						textMarqueeScroll();
13966				});
13967			};
13968
13969			var cloneSpan = function($_title, cntnt){
13970
13971				if ( $_title.hasClass('un-marquee-infinite') ) {
13972					$('> span.marquee-clone-wrap', $_title).text('');
13973				}
13974
13975				gsap.to( $_title, {
13976					duration: 0,
13977					x: 0
13978				});
13979				spanW = $span.outerWidth();
13980
13981
13982				if ( !spanW ) {
13983					return;
13984				}
13985
13986				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
13987					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
13988
13989				if ( $_title.hasClass('un-marquee-infinite') ) {
13990
13991					for ( var i = 0; i < part; i++ ) {
13992						$prepended.append(cntnt + spaceSpan);
13993						$appended.append(cntnt + spaceSpan);
13994					}
13995				}
13996
13997				if ( $('body').hasClass('compose-mode') ) {
13998					$('.uncode_fe_safe').remove();
13999					return;
14000				}
14001
14002				if ( $title.closest('.marquee-freezed').length ) {
14003					return;
14004				}
14005
14006				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
14007					continuousTextMarquee();
14008				}
14009
14010				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
14011					runTextMarquee();
14012				}
14013
14014			};
14015
14016			var marqueeResize = function(e){
14017				if ( isInMenu ) {
14018					return;
14019				}
14020				var tOut = 1000;
14021				if ( isInMenu ) {
14022						gsap.killTweensOf($title);
14023						if ( typeof inview !== 'undefined' && inview !== null ) {
14024							inview.destroy();
14025						}
14026						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14027							marqueeTL.kill();
14028						}
14029						first = true;
14030						$(window).off(marqueeNS);
14031						$(document).off(marqueeNS);
14032						initTextMarquee();
14033				} else {
14034					clearRequestTimeout(marqueeCheckResize);
14035					marqueeCheckResize = requestTimeout(function(){
14036						if ( newW !== UNCODE.wwidth ) {
14037							gsap.killTweensOf($title);
14038							if ( typeof inview !== 'undefined' && inview !== null ) {
14039								inview.destroy();
14040							}
14041							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14042								marqueeTL.kill();
14043							}
14044							first = true;
14045							$(window).off(marqueeNS);
14046							$(document).off(marqueeNS);
14047							initTextMarquee();
14048							newW = UNCODE.wwidth;
14049						}
14050					}, tOut);
14051				}
14052			};
14053
14054			$(window).off('resize', marqueeResize)
14055			.on( 'resize', marqueeResize);
14056			$(window).off('uncode.re-layout', marqueeResize)
14057			.on( 'uncode.re-layout', marqueeResize);
14058
14059			cloneSpan($title, txt);
14060
14061			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14062				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
14063					var $_titles = $('.un-text-marquee',e.view.$el);
14064					clearRequestTimeout(marqueeCheckResize);
14065					marqueeCheckResize = requestTimeout(function(){
14066						initTextMarquee($_titles);
14067					}, 1000);
14068				});
14069			}
14070		});
14071
14072		$(window).on( 'load wwResize', function(e) {
14073			stableHeight = UNCODE.wheight;
14074		});
14075
14076	};
14077
14078	document.addEventListener("DOMContentLoaded", function() {
14079		if ( isInitMarque !== true ) {
14080			initTextMarquee();
14081		}
14082	});
14083
14084	$(window).on('focus load resize',function(){
14085		clearTimeout(initMarquee);
14086		initMarquee = setTimeout(function(){
14087			if ( isInitMarque !== true ) {
14088				initTextMarquee();
14089			}
14090		}, 500);
14091	});
14092	
14093	$(document).on('pumAfterOpen pumAfterClose', function(args){
14094		initTextMarquee();
14095	});
14096
14097	$(document).on('uncode-scrolltrigger-refresh', function(args){
14098		var nextDocH = Math.round($(document).height());
14099
14100		if ( Math.abs(nextDocH - lastMarqueeDocH) <= 2 ) {
14101			return;
14102		}
14103
14104		lastMarqueeDocH = nextDocH;
14105
14106		clearRequestTimeout(marqueeCheckResize);
14107
14108		marqueeCheckResize = requestTimeout(function(){
14109			initTextMarquee();
14110		}, 250);
14111	});
14112};
14113	
14114UNCODE.parallax = function() {
14115	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
14116		if ($('.parallax-el').length > 0) {
14117			var parallax_elements = new Rellax('.parallax-el');
14118			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
14119			window.addEventListener('boxResized', function(e) {
14120				parallax_elements.refresh();
14121			}, false);
14122			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
14123				requestTimeout(function() {
14124					parallax_elements.refresh();
14125				}, 100);
14126			});
14127
14128			if ( typeof UNCODE.hDoc === 'undefined' ) {
14129				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14130					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14131			}
14132		
14133			function paralraf(time) {
14134				requestAnimationFrame(paralraf)
14135		
14136				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14137					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14138				
14139				if ( UNCODE.hDoc !== newHdoc ) {
14140					UNCODE.hDoc = newHdoc;
14141					parallax_elements.refresh();
14142				}
14143			}
14144		
14145			requestAnimationFrame(paralraf)
14146		
14147		}
14148	}
14149};
14150
14151UNCODE.magicCursor = function(){
14152	var $customCursor = $('#uncode-custom-cursor'),
14153		$customPilot = $('#uncode-custom-cursor-pilot'),
14154		$tooltip = $('.title-tooltip', $customCursor),
14155		$cursorSpan = $('> span', $tooltip),
14156		currentBg = false,
14157		fromTitle = false,
14158		setTime,
14159		mouseEvent;
14160
14161		var spanW, spanH,
14162		maxW = false;
14163
14164	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
14165		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
14166			$tooltip.css({opacity: 0});
14167			delayt_time += 400;
14168		}
14169		clearRequestTimeout(setTime);
14170		setTime = requestTimeout(function() {
14171
14172			$tooltip.css({opacity: ''});
14173
14174			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
14175
14176			if ( cursorTitle !== '' ) {
14177				if ( fromTitle && dataTitle === 'boing' ) {
14178					setTimeout(function(){
14179						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
14180					}, 5);
14181				}
14182				$cursorSpan.attr('class', fontClass).html( cursorTitle );
14183			} else {
14184				if ( cursorType !== 'auto' ) {
14185					$cursorSpan.html('');
14186				}
14187			}
14188
14189			$cursorSpan.addClass('in-tooltip');
14190
14191			$customCursor.attr('data-cursor', cursorType);
14192
14193			if ( fromTitle ) {
14194				$customCursor.addClass('from-tooltip-title');
14195			} else {
14196				$customCursor.removeClass('from-tooltip-title');
14197			}
14198
14199			if ( cursorBg !== false ) {
14200				$customCursor.attr('data-bg', 'transparent');
14201			} else {
14202				$customCursor.removeAttr('data-bg');
14203			}
14204
14205			currentBg = cursorBg;
14206
14207			if ( cursorTitle !== '' ) {
14208				fromTitle = true;
14209				$customCursor.attr('data-cursor', cursorType);
14210				$customCursor.attr('data-title', 'true');
14211				$cursorSpan.css({width: ''});
14212			} else {
14213				fromTitle = false;
14214				$customCursor.removeAttr('data-title');
14215			}
14216			spanW = $cursorSpan.outerWidth();
14217			
14218			if ( spanW >= maxW && maxW !== false ) {
14219				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
14220				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
14221					width: maxW
14222				});
14223				spanW = maxW;
14224			} else {
14225				$customCursor.find('> span:first-child').removeClass('max-width');
14226			}
14227			spanH = $cursorSpan.outerHeight();
14228			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
14229				$customCursor.find('> span:first-child').add($tooltip).css({
14230					width: spanW,
14231					height: spanH
14232				});
14233			} else {
14234				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
14235			}
14236			if ( $customPilot.length ) {
14237				$customPilot.attr('data-cursor', cursorType);
14238			}
14239		}, delayt_time);
14240	}
14241
14242	function changeCursor($wrap){
14243		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14244		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
14245			$href = $wrap.find(href),
14246			cursorType,
14247			cursorTitle = '',
14248			tooltip_class = '',
14249			cursorBg = false;
14250
14251		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
14252			var $this = $(this).addClass("cursor-init"),
14253				$tmb = $this.closest('.tmb'),
14254				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
14255				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
14256				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
14257				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
14258				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
14259				$title = $('.t-entry-title', $tmb),
14260				is_frontend_editor = $this.closest('.vc_controls').length,
14261				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
14262				$parent_cursor = $this.closest('[class*="custom-cursor"]');
14263
14264			if ( is_frontend_editor ) {
14265				cursorType = 'auto';
14266			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
14267				cursorType = data_cursor;
14268			} else if ( $parent_cursor.length ) {
14269				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
14270					cursorType = 'icon-light';
14271				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
14272					cursorType = 'icon-diff';
14273				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
14274					cursorType = 'icon-accent';
14275				} else {
14276					cursorType = 'icon-dark';
14277				}
14278			} else {
14279				cursorType = 'pointer';
14280			}
14281
14282			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
14283				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
14284					cursorTitle = custom_text;
14285				} else {
14286					cursorTitle = $title.clone();
14287					$('a', cursorTitle).replaceWith(function() {
14288						return this.childNodes;
14289					});
14290					$('*', cursorTitle).replaceWith(function(){
14291						return $(this).removeAttr('class');
14292					});
14293					cursorTitle = cursorTitle.html();
14294				}
14295			} else {
14296				cursorTitle = '';
14297			}
14298
14299			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
14300				tooltip_class = data_class;
14301			} else {
14302				tooltip_class = '';
14303			}
14304
14305			if ( cursor_bg == 'true' ) {
14306				cursorBg = true;
14307			} else {
14308				cursorBg = false;
14309			}
14310
14311			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
14312		}).on("mouseleave.cursor", href, function(e) {
14313			var outTime = 150;
14314			if ( currentBg !== false && cursorBg === false ) {
14315				outTime = 0;
14316			}
14317			delayChangeCursor('auto', '', false, outTime, false, '');
14318		});
14319
14320		$(window).on('disable-hover', function(event) {
14321			document.addEventListener("mousemove", function(e) {
14322				mouseEvent = e;
14323			});
14324			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
14325		});
14326
14327		$(window).on('enable-hover', function(event) {
14328			if ( typeof mouseEvent !== 'undefined' ) {
14329				var x = mouseEvent.clientX,
14330					y = mouseEvent.clientY;
14331
14332				var elements = document.elementsFromPoint(x, y),
14333					$element = $(elements[0]);
14334
14335				$element.closest(href).trigger('mouseenter');
14336			}
14337		});
14338
14339	}
14340
14341	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14342		changeCursor();
14343	});
14344
14345	$(document).ajaxComplete(function( event, xhr, settings ) {
14346		changeCursor();
14347	});
14348
14349	$('.isotope-container').on('isotope-layout-complete', function() {
14350		var $this = $(this);
14351		changeCursor($this);
14352	});
14353
14354};
14355
14356UNCODE.magneticCursor = function(){
14357	function magneticCursor($wrap){
14358		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14359		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'));
14360
14361		$magnetics.on('mousemove', function(e){
14362			var $this = $(this),
14363				$el,
14364				bound = e.currentTarget.getBoundingClientRect(),
14365				coeff = 30,
14366				hor = (bound.width / 2) - (e.clientX - bound.left),
14367				ver = (bound.height / 2) - (e.clientY - bound.top),
14368				toX = hor / bound.width * coeff,
14369				toY = ver / bound.height * coeff,
14370				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
14371				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
14372				toScale = Math.max(scaleX, scaleY);
14373
14374			if ( $this.hasClass('magnetic') ) {
14375				$el = $('.background-inner, .header-bg', $this);
14376			} else {
14377				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14378			}
14379
14380			gsap.killTweensOf($el);
14381			gsap.to( $el, {
14382				duration: 0.75,
14383				x: toX,
14384				y: toY,
14385				scale: toScale,
14386				ease: Power1.easeOut,
14387				transformPerspective: 900,
14388				transformOrigin: 'center',
14389				force3D: true
14390			});
14391		}).on('mouseout', function(e){
14392			var $this = $(this),
14393				$el
14394			if ( $this.hasClass('magnetic') ) {
14395				$el = $('.background-inner, .header-bg', $this);
14396			} else {
14397				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14398			}
14399			gsap.killTweensOf($el);
14400			gsap.to( $el, {
14401				duration: 0.6,
14402				y: 0,
14403				x: 0,
14404				scale: 1,
14405				ease: Power1.easeOut,
14406				transformPerspective: 900,
14407				transformOrigin: 'center',
14408				force3D: true
14409			});
14410		});
14411	};
14412
14413	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14414		magneticCursor();
14415	});
14416
14417	$(document).ajaxComplete(function( event, xhr, settings ) {
14418		magneticCursor();
14419	});
14420
14421	$('.isotope-container').on('isotope-layout-complete', function() {
14422		var $this = $(this);
14423		magneticCursor($this);
14424	});
14425
14426};
14427
14428UNCODE.dropImage = function() {
14429
14430	/****************************
14431	 * Image hover *
14432	****************************/
14433	function imageHover(){
14434		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14435			return;
14436		}
14437
14438		var $postLists = $('.uncode-post-titles');
14439		$postLists.each(function(){
14440			var $list = $(this),
14441				timing = parseFloat( $list.attr('data-timing') ),
14442				default_image = $list.hasClass('uncode-post-titles-default-image'),
14443				default_title = $list.hasClass('uncode-post-titles-default-title'),
14444				$tmbs = $('.tmb', $list),
14445				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
14446				clientX,
14447				clientY,
14448				$row_parent = $list.closest('.vc_row'),
14449				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
14450				$col_parent = $list.closest('.uncell'),
14451				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
14452				stoppedScrolling = true,
14453				setCTA;
14454
14455			timing *= 0.001;
14456
14457			var drop_bgs = function(){
14458				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
14459					var $drop = $(this),
14460						srcset = $drop.attr('data-bgset'),
14461						setArr = srcset.split(","),
14462						setArrOrder = [],
14463						biggest = 0,
14464						checkBg = false,
14465						desktopBG = $drop.data('[data-background-image]'),
14466						mobileBG = $drop.data('[data-mobile-background-image]');
14467
14468					if ( $drop.hasClass('srcset-bg-async') ) {
14469
14470						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
14471							return;
14472						}
14473						
14474					}
14475
14476					if ( SiteParameters.uncode_adaptive == true ) {
14477						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
14478							$drop.css({
14479								'background-image' : 'url(' + setArr[0] + ')'
14480							});
14481						}
14482					} else {
14483						for ( var i = 0; i < setArr.length; i++ ) {
14484							var setLoop = setArr[i].trim().split(" ");
14485							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
14486								var parseSet = parseFloat(setLoop[1]);
14487								if ( biggest < parseSet ) {
14488									biggest = parseSet;
14489								}
14490								setArrOrder[parseSet] = setLoop[0];
14491								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
14492									checkBg = true;
14493									$drop.css({
14494										'background-image' : 'url(' + setLoop[0] + ')'
14495									});
14496								}
14497							}
14498						}
14499
14500						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
14501							$drop.css({
14502								'background-image' : 'url(' + setArrOrder[biggest] + ')'
14503							});
14504						}
14505					}
14506
14507				});
14508			};
14509
14510			drop_bgs();
14511
14512			var dropMovesSize = function(){
14513				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
14514					return;
14515				}
14516				$drop_moves.each(function(){
14517					var $drop_move = $(this),
14518						dataW = $drop_move.attr('data-w'),
14519						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
14520					if ( typeof dataW !== 'undefined' && dataW !== null ) {
14521						dataW = screenInfo.width / 12 * parseFloat( dataW );
14522					}
14523					$drop_moves.css({
14524						width: dataW
14525					});
14526
14527					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14528						$anim_parent.on('animationend', function(){
14529							var bound = $anim_parent[0].getBoundingClientRect();
14530							$drop_move.css({
14531								left: bound.x * -1,
14532								top: bound.y * -1,
14533							});
14534						});
14535					}
14536				});
14537
14538
14539			};
14540
14541			dropMovesSize();
14542
14543			$(window).on( 'resize', function(){
14544				clearRequestTimeout(setCTA);
14545				setCTA = requestTimeout( function() {
14546					drop_bgs();
14547					dropMovesSize();
14548				}, 100 );
14549			});
14550
14551			if ( $drop_row_parents.length ) {
14552				$row_parent.addClass( 'drop-added' );
14553			}
14554
14555			$drop_row_parents.each(function(index, val){
14556				var $drop = $(val);
14557				$row_parent.prepend($drop);
14558				manageVideos($drop, false);
14559				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14560					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14561				}
14562				if ( default_image && index == 0 ) {
14563					manageVideos($drop, true);
14564					var bgStyle = $drop.css('background-image');
14565					var match = bgStyle && bgStyle.match(/url\(["']?([^"')]+)["']?\)/);
14566					var bg_img = match ? match[1] : null;
14567					var image_ph = new Image();
14568
14569					if (bg_img) {
14570						image_ph.onload = function() {
14571							$drop.addClass('active');
14572							if (default_title) {
14573								$list.addClass('drop-hover');
14574								$tmbs.first().addClass('drop-active');
14575							}
14576						};
14577						image_ph.src = bg_img;
14578					}
14579					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14580						image_ph.onload = function() {
14581							$drop.addClass('active');
14582							if ( default_title ) {
14583								$list.addClass('drop-hover');
14584								$tmbs.first().addClass('drop-active');
14585							}
14586						};
14587						image_ph.src = bg_img;
14588					}
14589				}
14590			});
14591
14592			if ( $drop_col_parents.length ) {
14593				$col_parent.addClass( 'drop-added' );
14594			}
14595
14596			$drop_col_parents.each(function(index, val){
14597				var $drop = $(this);
14598				$col_parent.prepend($drop);
14599				manageVideos($drop, false);
14600				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14601					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14602				}
14603				if ( default_image && index == 0 ) {
14604					manageVideos($drop, true);
14605					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
14606						image_ph = new Image();
14607					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14608						image_ph.onload = function() {
14609							$drop.addClass('active');
14610							if ( default_title ) {
14611								$list.addClass('drop-hover');
14612								$tmbs.first().addClass('drop-active');
14613							}
14614						};
14615						image_ph.src = bg_img;
14616					}
14617				}
14618			});
14619
14620			function manageVideos( $el, start ) {
14621				var videoElem = $('video', $el),
14622					$iframe = $('iframe', $el),
14623					iframeID = $iframe.attr('id');
14624				if ( videoElem.length ) {
14625					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
14626						if ( start ) {
14627							videoElem[0].setCurrentTime(0);
14628							videoElem[0].play();
14629						} else {
14630							videoElem[0].pause();
14631							videoElem[0].setCurrentTime(0);
14632						}
14633					} else {
14634						if ( start ) {
14635							videoElem[0].currentTime = 0;
14636							videoElem[0].play();
14637						} else {
14638							videoElem[0].pause();
14639							videoElem[0].currentTime = 0;
14640						}
14641					}
14642				}
14643
14644				$el.data('active', start);
14645
14646				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
14647					var iframeIDv = iframeID.replace('okplayer-', ''),
14648						optionsV = $(window).data('okoptions-' + iframeIDv),
14649						vimeo = $iframe[0],
14650						playerV = new Vimeo.Player(vimeo),
14651						timeV = 0;
14652
14653					if (optionsV.time != null) {
14654						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
14655						for ( var i = 0; i < timeArr.length; i++ ) {
14656							if ( timeArr[i] === 'h' ) {
14657								timeV += parseFloat(timeArr[i-1]) * 3600;
14658							} else if ( timeArr[i] === 'm' ) {
14659								timeV += parseFloat(timeArr[i-1]) * 60;
14660							} else if ( timeArr[i] === 's' ) {
14661								timeV += parseFloat(timeArr[i-1]);
14662							}
14663						}
14664					}
14665					playerV.setCurrentTime(timeV);
14666					if ( start ) {
14667						playerV.setVolume(0);
14668						playerV.play();
14669					} else {
14670						playerV.pause();
14671					}
14672				} else if ( $el.attr('data-provider') === 'youtube' ) {
14673					if ( start ) {
14674						$el.trigger('uncode-resume');
14675					} else {
14676						$el.trigger('uncode-pause');
14677					}
14678				}
14679
14680			}
14681
14682			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
14683
14684				document.addEventListener("mousemove", function(e) {
14685					$drop_moves.each(function(){
14686						var $drop_move = $(this),
14687							duration = 0.4;
14688
14689						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
14690							duration = 0.8;
14691						}
14692
14693						clientX = e.clientX;
14694						clientY = e.clientY;
14695
14696						gsap.to( $drop_move, {
14697							duration: duration,
14698							x: clientX,
14699							y: clientY,
14700							ease: Power1.easeOut,
14701						});
14702					});
14703				});
14704
14705			} else {
14706
14707				$(window).on("touchend scroll", function(e) {
14708					$list.removeClass('drop-hover');
14709					$drop_moves.removeClass('active');
14710					$tmbs.removeClass('drop-active');
14711				});
14712
14713				$drop_moves.each(function(){
14714					var $drop_move = $(this),
14715						$tmb = $drop_move.closest('.tmb'),
14716						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
14717
14718					if ( $anim_parent.hasClass('uncode-skew') ) {
14719						$anim_parent.css({
14720							'transform': 'skew(0)'
14721						});
14722					}
14723
14724					$tmb.on('touchend', function(e){
14725						e.stopPropagation();
14726
14727						$drop_moves.removeClass('active');
14728						$tmbs.removeClass('drop-active');
14729
14730						$list.addClass('drop-hover');
14731						$tmb.addClass('drop-active');
14732						$drop_move.addClass('active');
14733						manageVideos($drop_move, true);
14734						clientX = e.changedTouches[0].clientX;
14735						clientY = e.changedTouches[0].clientY;
14736
14737						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14738							var bound = $anim_parent[0].getBoundingClientRect();
14739							clientX = clientX - bound.x;
14740							clientY = clientY - bound.y;
14741						}
14742
14743						$drop_move.css({
14744							left: clientX,
14745							top: clientY
14746						});
14747					});
14748				});
14749
14750			}
14751
14752			$tmbs.each(function(e){
14753				var $tmb = $(this),
14754					// $trgr = $('a', $tmb),
14755					$trgr = $tmb,
14756					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
14757					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
14757(.t-inside), .parallax-el'),
14758					$video = $('video', $tmb),
14759					$iframe = $('iframe', $tmb),
14760					$entryTxt = $('.t-entry-text', $tmb),
14761					stopBounding;
14762
14763				$entryTxt.add($drop_move).css({
14764					'transition-duration': timing + 's'
14765				});
14766
14767				if ( $video.length ) {
14768					var vidH = $video[0].videoHeight,
14769						vidW = $video[0].videoWidth;
14770					$video.css({
14771						'height': vidH,
14772						'width': vidW
14773					});
14774				}
14775
14776				if ( $iframe.length ) {
14777					var vidH = $drop_move.attr('data-height'),
14778						vidW = $drop_move.attr('data-width');
14779					$iframe.css({
14780						'height': vidH,
14781						'width': vidW
14782					});
14783				}
14784
14785				$iframe.each(function(){
14786					var $video = $(this),
14787						vidH = $video[0].videoHeight,
14788						vidW = $video[0].videoWidth;
14789					$video.css({
14790						'height': vidH,
14791						'width': vidW
14792					});
14793				});
14794
14795				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
14796					$trgr.on('mouseenter',function(e){
14797
14798						$list.addClass('drop-hover');
14799						$tmbs.removeClass('drop-active');
14800						$tmb.addClass('drop-active');
14801						$drop_move.addClass('active');
14802						manageVideos($drop_move, true);
14803
14804						var clientX = e.clientX,
14805							clientY = e.clientY;
14806						$drop_move.css({
14807							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
14808						});
14809
14810					})
14811					.on('mouseleave', function(e){
14812						$list.removeClass('drop-hover');
14813						$drop_move.css({
14814							'transition-duration': ( timing*1.25 ) + 's'
14815						});
14816						$drop_move.removeClass('active');
14817						$tmb.removeClass('drop-active');
14818						$drop_move.on('transitionend', function(e){
14819							$drop_move.off('transitionend');
14820							$drop_move.css({
14821								'transition-duration': timing + 's'
14822							});
14823							manageVideos($drop_move,false);
14824						});
14825					});
14826
14827					document.addEventListener('visibilitychange', function(){
14828						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
14829							$drop_move.css({
14830								'transition-duration': '0s'
14831							});
14832							$drop_move.removeClass('active');
14833							manageVideos($drop_move, false);
14834						}
14835					});
14836
14837					document.addEventListener('scroll', function(){
14838						window.clearRequestTimeout( stopBounding );
14839						if ( stoppedScrolling ) {
14840							stoppedScrolling = false;
14841							if ( $drop_move.hasClass('active') ) {
14842								$list.removeClass('drop-hover');
14843								$tmbs.removeClass('drop-active');
14844								$drop_move.removeClass('active');
14845								$drop_move.on('transitionend', function(e){
14846									$drop_move.off('transitionend');
14847									$drop_move.css({
14848										'transition-duration': timing + 's'
14849									});
14850									manageVideos($drop_move,false);
14851								});
14852							}
14853						}
14854
14855						stopBounding = requestTimeout(function() {
14856							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14857								var bound = $anim_parent[0].getBoundingClientRect();
14858								$drop_move.css({
14859									left: bound.x * -1,
14860									top: bound.y * -1,
14861								});
14862							}
14863							stoppedScrolling = true;
14864						}, 500);
14865					});
14866				}
14867
14868				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
14869					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
14870
14871				$drop.css({
14872					'transition-duration': timing + 's'
14873				});
14874
14875				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
14876					$trgr.on('mouseenter',function(e){
14877						$row_parent.add($col_parent).addClass('drop-list-loaded');
14878						$list.addClass('drop-hover');
14879
14880						if ( !$tmb.hasClass('drop-active') ) {
14881							$tmbs.removeClass('drop-active');
14882							$tmb.addClass('drop-active');
14883							if ( default_image && !$drop.hasClass('active') ) {
14884								var $prev = $('[data-drop].active', $row_parent);
14885								$prev.css({
14886									'transition-duration': (timing*1.5) + 's'
14887								});
14888								$prev.removeClass('active');
14889								$prev.on('transitionend', function(e){
14890									$prev.off('transitionend');
14891									manageVideos($prev,false);
14892								});
14893							}
14894							$drop.css({
14895								'transition-duration': timing + 's'
14896							});
14897							$drop.off('transitionend');
14898							$drop.addClass('active');
14899							manageVideos($drop, true);
14900						}
14901					})
14902					.on('mouseleave', function(e){
14903						if ( ( default_image && !default_title ) || !default_image ) {
14904							$list.removeClass('drop-hover');
14905							$tmb.removeClass('drop-active');
14906						}
14907						if ( ! default_image ) {
14908							$drop.css({
14909								'transition-duration': (timing*1.5) + 's'
14910							});
14911							$drop.removeClass('active');
14912
14913							$drop.on('transitionend', function(e){
14914								$drop.off('transitionend');
14915								manageVideos($drop,false);
14916							});
14917						}
14918					});
14919
14920					document.addEventListener('visibilitychange', function(){
14921						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
14922							$drop.css({
14923								'transition-duration': '0s'
14924							});
14925							$drop.removeClass('active');
14926							manageVideos($drop, false);
14927						}
14928					});
14929				}
14930			});
14931
14932		});
14933	};
14934
14935	$(window).on('load', function(event) {
14936		imageHover();
14937	});
14938
14939	var drop_wp_animation = function() {
14940		var $postLists = $('.uncode-post-titles');
14941		$postLists.each(function(){
14942			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
14943				new Waypoint({
14944					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
14945					element: val,
14946					handler: function() {
14947						var element = $(this.element),
14948							parent = element.closest('.tmb'),
14949							currentIndex = parent.index(),
14950							delay = currentIndex,
14951							delayAttr = parseInt(element.attr('data-delay'));
14952						if (isNaN(delayAttr)) delayAttr = 100;
14953						var objTimeout = requestTimeout(function() {
14954							element.addClass('start_animation');
14955
14956							var nextTimeout = requestTimeout(function() {
14957								$('.drop-image-separator', parent).addClass('start_animation');
14958							}, 50);
14959
14960						}, delay * delayAttr);
14961						if (!UNCODE.isUnmodalOpen) {
14962							this.destroy();
14963						}
14964					},
14965					offset: UNCODE.isFullPage ? '100%' : '90%'
14966				})
14967			});
14968		});
14969	}
14970
14971	var runWaypoints_TO,
14972		runWaypoints_delay = 0;
14973
14974	var runWaypoints = function(){
14975		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
14976			runWaypoints_delay = 400;
14977		}
14978		clearRequestTimeout(runWaypoints_TO);
14979		runWaypoints_TO = requestTimeout(function() {
14980			drop_wp_animation();
14981		}, runWaypoints_delay);
14982	};
14983	runWaypoints();
14984	$( document.body ).on( 'uncode_waypoints', runWaypoints );
14985	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14986		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
14987			// imageHover();
14988			runWaypoints();
14989		});
14990	}
14991};
14992
14993UNCODE.postTable = function() {
14994
14995	var clickRow = function(){
14996		var $postLists = $('.uncode-post-table');
14997
14998		$postLists.each(function(){
14999			var $postList = $(this),
15000				$tmbClicks = $('.tmb.tmb-click-row', $postList);
15001
15002			$tmbClicks.each(function(){
15003				var $tmb = $(this),
15004					$click = $('.table-click-row', $tmb);
15005				$('*:not(.table-click-row)', $tmb).on('click', function(e){
15006					e.preventDefault();
15007					e.stopPropagation();
15008					$click[0].click();
15009					return false;
15010				});
15011			});
15012
15013		})
15014	};
15015
15016	clickRow();
15017
15018	var hoverRow = function(){
15019		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
15020
15021		$postLists.on('mouseenter', function(){
15022			$(this).addClass('post-table-hover');
15023		});
15024		$postLists.on('mouseleave', function(){
15025			$(this).removeClass('post-table-hover');
15026		});
15027	}
15028
15029	hoverRow();
15030
15031	var drop_wp_animation = function() {
15032		var $postLists = $('.uncode-post-table');
15033		$postLists.each(function(){
15034			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
15035				new Waypoint({
15036					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15037					element: val,
15038					handler: function() {
15039						var element = $(this.element),
15040							parent = element.closest('.tmb'),
15041							currentIndex = parent.index(),
15042							delay = currentIndex,
15043							delayAttr = parseInt(element.attr('data-delay'));
15044						if (isNaN(delayAttr)) delayAttr = 100;
15045						var objTimeout = requestTimeout(function() {
15046							element.addClass('start_animation');
15047						}, delay * delayAttr);
15048						if (!UNCODE.isUnmodalOpen) {
15049							this.destroy();
15050						}
15051					},
15052					offset: UNCODE.isFullPage ? '100%' : '90%'
15053				})
15054			});
15055		});
15056	}
15057
15058	var runWaypoints_TO,
15059		runWaypoints_delay = 0;
15060
15061	var runWaypoints = function(){
15062		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
15063			runWaypoints_delay = 400;
15064		}
15065		clearRequestTimeout(runWaypoints_TO);
15066		runWaypoints_TO = requestTimeout(function() {
15067			drop_wp_animation();
15068		}, runWaypoints_delay);
15069	};
15070	runWaypoints();
15071	$( document.body ).on( 'uncode_waypoints', runWaypoints );
15072	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15073		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
15074			runWaypoints();
15075			// clickRow();
15076		});
15077	}
15078};
15079
15080UNCODE.rotatingTxt = function($ctxt) {
15081
15082	if ( $('body').hasClass('compose-mode') ) {
15083		return;
15084	}
15085
15086	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
15087	var setCTA;
15088
15089	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
15090		var $heading = $(this),
15091			// debug = 0,
15092			cycle = 0,
15093			$trgt,
15094			$toMove,
15095			$highl,
15096			$col = $heading.closest('.uncont'),
15097			txt,
15098			arrTxt,
15099			textFadeIn, textFadeOut,
15100			removeWraps;
15101
15102		var defineObjs = function() {
15103			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
15104				var $rtx = $(this),
15105					fx = $rtx.attr('data-fx'),
15106					wait = $rtx.attr('data-wait'),
15107					$prev = $(this).prev().addClass('prev-rotating-start'),
15108					splitToMove = [],
15109					splitArray = [],
15110					lineArray = [],
15111					lineIndex = 0,
15112					lineStart = true,
15113					lineEnd = false,
15114					startSplit = false,
15115					$line_wrap = $rtx.closest('.heading-line-wrap'),
15116					same_line = true,
15117					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
15118					indexRtx = $splits.index($rtx);
15119
15120				fx = typeof fx === 'undefined' ? '' : fx;
15121				wait = typeof wait === 'undefined' ? '' : wait;
15122
15123				$splits.each(function(key, val){
15124					var $split = $(this),
15125						$new_line_wrap = $split.closest('.heading-line-wrap');
15126
15127					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
15128						splitArray.push( $split );
15129					}
15130
15131					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15132						startSplit = false;
15133					}
15134
15135					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15136						splitArray.push( $split );
15137
15138						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
15139							same_line = true;
15140						} else {
15141							same_line = false;
15142						}
15143					}
15144
15145					if ( key == indexRtx ) {
15146						if ( /\S/.test($split.text()) ) {
15147							startSplit = true;
15148							$line_wrap = $split.closest('.heading-line-wrap');
15149							splitArray.push( $split );
15150						} else {
15151							indexRtx++;
15152						}
15153					}
15154
15155					$line_wrap = $new_line_wrap;
15156				});
15157
15158				$toMove = $($.map(splitToMove, function(el){return el.get();}));
15159				$trgt = $($.map(splitArray, function(el){return el.get();}));
15160
15161				if ( same_line ) {
15162					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
15163					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
15164				}
15165
15166				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
15167					$prev.addClass('empty-span-hidden');
15168				}
15169
15170				$highl = $('.heading-text-highlight-inner', $trgt);
15171
15172				$rtx.attr('data-animated', 'true');
15173				if ( cycle == 0 ) {
15174					$( document.body ).trigger('defer-highlights');
15175					cycle++;
15176					defineObjs();
15177					return;
15178				}
15179				cycle++;
15180
15181				txt = $rtx.attr('data-text');
15182				arrTxt = txt.split("|");
15183
15184				textFadeOut($trgt);
15185
15186			});
15187		};
15188
15189		removeWraps = function(){
15190
15191			// if ( debug == 1 ) return;
15192			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
15193			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
15194
15195
15196				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
15197					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
15198
15199				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
15200
15201				$splitFlow.each(function(){
15202					$(this).append($temp_highl);
15203				});
15204
15205				var $line_wrap = $wraps[wrap_k];
15206				var $parent_wrap = $line_wrap.parentNode;
15207				if ( $parent_wrap !== null ) {
15208					while ( $line_wrap.firstChild ) {
15209						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
15210					}
15211					$parent_wrap.removeChild($line_wrap);
15212				}
15213			}
15214			// debug++;
15215			defineObjs();
15216		};
15217
15218		var loop = 0;
15219		textFadeIn = function($trgt){
15220			var word = arrTxt[loop].split(" "),
15221				worsSpan = '',
15222				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15223				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15224				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
15225
15226			for (var w = 0; w < word.length; w++) {
15227				var highl;
15228				if ( $highl.length ) {
15229					highl = $highl[0].outerHTML;
15230				} else {
15231					highl = '';
15232				}
15233
15234				if ( w > 0 ) {
15235					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
15236				}
15237				var charachters = word[w].split('');
15238				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
15239				if ( ! SiteParameters.uncode_has_ligatures ) {
15240					for (var c = 0; c < charachters.length; c++) {
15241						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
15242					}
15243				} else {
15244					worsSpan += word[w];
15245				}
15246				worsSpan += '</span>' + highl + '</span></span>';
15247			}
15248
15249			if ( $wrap.length && $wrap_inner.length ) {
15250				var words_w = $wrap_inner.outerWidth();
15251				$wrap.css({
15252					width: words_w
15253				});
15254
15255				$highl = $('.heading-text-highlight-inner', $wrap);
15256				$highl.prependTo($wrap);
15257
15258				$wrap_inner.css({
15259					opacity: 0
15260				});
15261
15262				$wrap_inner.html(worsSpan);
15263				$('.heading-text-highlight-inner', $wrap_inner).remove();
15264				words_w = $wrap_inner.innerWidth();
15265
15266				var duration = 0.45;
15267
15268				$heading.removeClass('auto-width');
15269				if ( words_w > $col.width() ) {
15270					$heading.addClass('auto-width');
15271					words_w = 'auto';
15272					duration = 0;
15273				}
15274
15275				$wrap.css({
15276					'width': words_w,
15277					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
15278				});
15279
15280				var $word_inner = $('.split-word-inner', $wrap_inner),
15281					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
15282
15283				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15284
15285				if ( !$target_fx.length ) {
15286					return;
15287				}
15288
15289				gsap.killTweensOf($target_fx);
15290
15291				if ( fx !== 'zoom' ) {
15292					gsap.fromTo( $target_fx, {
15293						y: fx === 'opacity' ? '0%' : '-10%'
15294					},{
15295						delay: duration,
15296						duration: 0.25,
15297						y: '0%',
15298						ease: Circ.easeOut,
15299					});
15300
15301					if ( !$wrap_inner.length ) {
15302						return;
15303					}
15304
15305					gsap.fromTo( $wrap_inner, {
15306						opacity: 0,
15307					},{
15308						delay: duration,
15309						duration: 0.25,
15310						opacity: 1,
15311						ease: Circ.easeOut,
15312						onComplete: function(){
15313							$('> .heading-text-highlight-inner', $wrap).remove();
15314							$wrap_inner.html(worsSpan);
15315							removeWraps();
15316						}
15317					})
15318
15319				} else {
15320					gsap.fromTo( $target_fx, {
15321						transformOrigin: '50%',
15322						opacity: 0,
15323						scale: 0.875,
15324					},{
15325						opacity: 1,
15326						delay: duration,
15327						duration: 0.25,
15328						scale: 1,
15329						ease: Circ.easeOut,
15330						onComplete: function(){
15331							$('> .heading-text-highlight-inner', $wrap).remove();
15332							$wrap_inner.html(worsSpan);
15333							removeWraps();
15334						}
15335					});
15336				}
15337
15338			} else {
15339
15340				if ( !$wrap_inner.length ) {
15341					return;
15342				}
15343
15344				gsap.to( $wrap_inner, {
15345					duration: 0.4,
15346					opacity: 0,
15347					ease: Power1.easeOut,
15348					onComplete: function(){
15349						$wrap_inner.html(worsSpan);
15350						words_w = $wrap_inner.innerWidth();
15351
15352						gsap.to( $wrap_inner, {
15353							duration: 0.2,
15354							opacity: 1,
15355							ease: Power1.easeOut,
15356							onComplete: function(){
15357								$('> .heading-text-highlight-inner', $wrap).remove();
15358								$wrap_inner.html(worsSpan);
15359								removeWraps();
15360							}
15361						})
15362					}
15363				});
15364			}
15365
15366			if ( loop < arrTxt.length-1 ) {
15367				loop++;
15368			} else {
15369				loop = 0;
15370			}
15371
15372		};
15373
15374		textFadeOut = function($trgt){
15375			var $word_inner = $('.split-word-inner', $trgt),
15376				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15377				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15378				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
15379				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
15380
15381			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
15382
15383			var gsap_param = {
15384					delay: wait,
15385					duration: 0.25,
15386					y: fx === '' ? '10%' : '0%',
15387					opacity: 0,
15388					ease: Circ.easeOut,
15389					onStart: function(){
15390						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
15391							$highl = $('.heading-text-highlight-inner', $wrap);
15392							$highl.prependTo($wrap);
15393						}
15394					},
15395					onComplete: textFadeIn,
15396					onCompleteParams: [$trgt]
15397				};
15398
15399			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15400
15401			if ( fx === '' ) {
15402				gsap_param.y = '10%';
15403			} else if ( fx === 'zoom' ) {
15404				gsap_param.scale = '1.045';
15405			}
15406
15407			if ( !$target_fx.length ) {
15408				return;
15409			}
15410
15411			if ( $heading.data('waypoint') !== true ) {
15412				var textInView = new Waypoint.Inview({
15413					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15414					element: $heading[0],
15415					enter: function(direction) {
15416						$heading.data('waypoint',true);
15417						gsap.fromTo( $target_fx, {
15418							transformOrigin: '50%'
15419						}, gsap_param );
15420					}
15421				});
15422			} else {
15423				gsap.fromTo( $target_fx, {
15424					transformOrigin: '50%'
15425				}, gsap_param );
15426			}
15427		};
15428
15429		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15430			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
15431				var $el = model.view.$el,
15432					shortcode = model.attributes.shortcode;
15433
15434				UNCODE.rotatingTxt($el);
15435			});
15436		} else {
15437			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
15438				$heading.on('already-animated', function(){
15439					removeWraps();
15440					window.addEventListener('removeOldLines', function(){
15441						clearRequestTimeout(setCTA);
15442						setCTA = requestTimeout( removeWraps, 150 );
15443					});
15444				});
15445			} else {
15446				$(window).on('load', function(){
15447					removeWraps();
15448					window.addEventListener('removeOldLines', function(){
15449						clearRequestTimeout(setCTA);
15450						setCTA = requestTimeout( removeWraps, 150 );
15451					});
15452				});
15453			}
15454		}
15455	});
15456
15457};
15458
15459UNCODE.verticalText = function() {
15460	$(window).on('menuCanvasOpen', function(){
15461		$('.vertical-text--fixed').fadeOut(500);
15462		$('.horizontal-text--fixed').fadeOut(500);
15463	}).on('menuCanvasClose', function(){
15464		$('.vertical-text--fixed').fadeIn(500);
15465		$('.horizontal-text--fixed').fadeIn(500);
15466	});
15467
15468	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
15469	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
15470	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
15471	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
15472
15473	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
15474		window.addEventListener('scroll', function(e) {
15475			var totalPageHeight = document.body.scrollHeight;
15476			var scrollPoint = window.scrollY + window.innerHeight;
15477
15478			if (window.scrollY > 0) {
15479				showOnTopVerticalTexts.fadeOut();
15480				showOnTopHorizontalTexts.fadeOut();
15481			} else {
15482				showOnTopVerticalTexts.fadeIn();
15483				showOnTopHorizontalTexts.fadeIn();
15484			}
15485
15486			if (scrollPoint >= totalPageHeight) {
15487				hideOnBottomVerticalTexts.fadeOut();
15488				hideOnBottomHorizontalTexts.fadeOut();
15489			} else {
15490				hideOnBottomVerticalTexts.fadeIn();
15491				hideOnBottomHorizontalTexts.fadeIn();
15492			}
15493		}, false);
15494	}
15495};
15496
15497UNCODE.stickyScroll = function( $el ) {
15498	if ( typeof $el === 'undefined' || $el === null ) {
15499		$el = $('body');
15500	}
15501	var checkVisible = function( el, dir ) {
15502		if (typeof jQuery === "function" && el instanceof jQuery) {
15503			el = el[0];
15504		}
15505
15506		var off = 50;
15507		dir = typeof dir=='undefined' ? 'right' : dir;
15508		var rect = el.getBoundingClientRect();
15509
15510		return (
15511			(
15512				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15513				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15514				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
15515			) &&
15516			(
15517				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15518				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15519				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
15520				( rect.right <= window.innerWidth && rect.left >= 0 )
15521			)
15522		);
15523	};
15524
15525	var setItemsRelHeight = function(reset) {
15526		var $_el = $el;
15527		if ( $el.is('.index-scroll') ) {
15528			var $_el = $el.closest('.uncont');
15529		}
15530		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
15531		// 	$.each($('.tmb', item), function(index, val) {
15532		// 		if ( reset === true ) {
15533		// 			$(val).css( 'visibility', 'hidden' );
15534		// 		} else {
15535		// 			$(val).css( 'visibility', 'visible' );
15536		// 		}
15537		// 	});
15538		// });
15539		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
15540			$.each($('.tmb', item), function(index, val) {
15541				if ( reset === true ) {
15542					$(val).css( 'visibility', 'hidden' );
15543					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
15544				} else {
15545					var $rowParent = $(item).closest('.row-parent'),
15546						rowRatio = $rowParent.attr('data-height-ratio'),
15547						$rowInner = $(item).closest('.row-child'),
15548						rowRatioInner = $rowInner.attr('data-height'),
15549						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15550						$colContainer = $(item).closest('.uncell'),
15551						$uncont = $(item).closest('.uncont'),
15552						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
15553						safe_heigth = $(item).data('safe-height'),
15554						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
15555						offSet = $(item).offset().top - $uncont.offset().top,
15556						multiplier_h,
15557						data_viewport_h,
15558						body_border = $('.body-borders .top-border').outerHeight() * 2,
15559						remove_menu = $(item).data('vp-menu');
15560
15561					if ( rowRatio === 'full' || rowRatio === '' ) {
15562						rowRatio = 1;
15563					} else {
15564						rowRatio = rowRatio / 100;
15565					}
15566
15567					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
15568						rowRatio = rowRatio;
15569					} else {
15570						rowRatio = rowRatio * rowRatioInner / 100;
15571					}
15572
15573					winHeight = winHeight * rowRatio;
15574
15575					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
15576						multiplier_h = parseInt($(item).attr('data-vp-height'));
15577					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
15578						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
15579					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
15580						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
15581					}
15582
15583					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
15584						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
15585						if ( remove_menu === true ) {
15586							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
15587						}
15588						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
15589					} else {
15590						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
15591					}
15592
15593				}
15594			});
15595		});
15596		$('.index-scroll', $_el).each(function(i, item){
15597			var $uncoltable = $(item).closest('.uncoltable'),
15598				$rowParent = $(item).closest('.row-parent'),
15599				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15600				body_border = $('.body-borders .top-border').outerHeight() * 2,
15601				$index_row = $('.index-row', item),
15602				safe_heigth = $index_row.data('safe-height'),
15603				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
15604			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
15605				var data_viewport_h = winHeight - ( paddingRow + body_border );
15606				$uncoltable.css({
15607					'min-height': data_viewport_h
15608				});
15609			} else {
15610				$uncoltable.css({
15611					'min-height': 'auto'
15612				});
15613			}
15614		});
15615
15616	}
15617	setItemsRelHeight();
15618
15619	var $index_scrolls = $('.index-scroll', $el);
15620
15621	$index_scrolls.each(function(key, value){
15622		var $index = $(this),
15623			$parent_row = $index.closest('.vc_row[data-parent]'),
15624			$index_row = $('.index-row', $index),
15625			dir = $index_row.attr('data-direction');
15626		dir = typeof dir === 'undefined' ? 'right' : dir;
15627
15628		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
15629
15630		if ( $('.animate_when_almost_visible', $index).length ) {
15631			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
15632		}
15633
15634	});
15635
15636	var $horScrolls = $('.unscroll-horizontal', $el);
15637
15638	if ( $horScrolls.length ) {
15639
15640		$('body').addClass('scrolling-trigger');
15641
15642		$horScrolls.each(function(key, value){
15643			var $section = $(this),
15644				$index_scroll = $('.index-scroll', $section),
15645				$index_row = $('.index-row', $index_scroll),
15646				dir = $section.attr('data-direction'),
15647				wrap = $index_row.attr('data-wrap'),
15648				$pinWrap,
15649				$pinTrigger;
15650
15651			dir = typeof dir === 'undefined' ? 'right' : dir;
15652			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
15653			$pinWrap = $('<div class="pin-wrap" />');
15654			if ( SiteParameters.is_frontend_editor ) {
15655				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
15656				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
15657			} else {
15658				if ( wrap === 'column' ) {
15659					$index_scroll.wrapInner( $pinWrap );
15660				} else {
15661					$('> .row', $section).wrap( $pinWrap );
15662				}
15663				$section.wrapInner( $pinTrigger );
15664			}
15665
15666		});
15667
15668		var $pinWraps = $('.pin-wrap', $el);
15669
15670		var horScrollSizes = function(){
15671
15672			$pinWraps.each(function(key, val){
15673				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
15674					$pinTrigger = $pinWrap.closest('.pin-trigger'),
15675					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
15676					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
15677					$boxContainer = $('.box-container'),
15678					box_m = $boxContainer.css('margin-left'),
15679					st_active = true;
15680
15681				var setHorW,
15682				horWidth = function(){
15683					$index_scroll.each(function(){
15684						var $this = $(this),
15685							$index_row = $('.index-row', $this),
15686							$rowContainer = $index_row.closest('.vc_row'),
15687							$rowInner = $index_row.closest('.wpb_row'),
15688							$rowParent = $index_row.closest('.row-parent'),
15689							$tmbs = $('.tmb', $index_row),
15690							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
15691							$uncont = $index_row.closest('.uncont'),
15692							$parent_col = $index_row.closest('.wpb_column'),
15693							col_w = $uncont.width(),
15694							data_lg = parseFloat( $index_row.attr('data-lg') ),
15695							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
15696							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
15697							tmb_w;
15698
15699						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
15700						tmb_w = ( col_w + padding_tmb ) / data_lg;
15701
15702						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
15703							tmb_w = ( col_w + padding_tmb ) / data_sm;
15704						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
15705							tmb_w = ( col_w + padding_tmb ) / data_md;
15706						}
15707
15708						if ( !isNaN(tmb_w) ) {
15709							$tmbs.css({
15710								'width': tmb_w
15711							});
15712						}
15713
15714						$tmbs.css({
15715							'visibility': 'visible'
15716						});
15717
15718					});
15719				};
15720
15721				horWidth();
15722				clearRequestTimeout(setHorW);
15723				setHorW = requestTimeout( function(){
15724					setItemsRelHeight();
15725					horWidth();
15726				}, 100 );
15727
15728				if ( SiteParameters.is_frontend_editor ) {
15729					return;
15730				}
15731
15732				var $vmenu = $('body.vmenu .vmenu-container'),
15733					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
15734					winWidth = window.innerWidth - vmenuW,
15735					$tmb = $('.tmb', $index_scroll).eq(0),
15736					paddingRight = parseFloat( $tmb.css('padding-right') ),
15737					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
15737scroll.width() + paddingRight ) ),
15738					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
15739					scroll_anim;
15740
15741				if ( $('body').hasClass('rtl') ) {
15742					if ( dir === 'left' ) {
15743						scroll_anim = gsap.fromTo( $pinWrap, {
15744							x: stickyScrollLength
15745						},{
15746							x: 0,
15747							ease: "none"
15748						});
15749					} else {
15750						scroll_anim = gsap.fromTo( $pinWrap, {
15751							x: 0
15752						},{
15753							x: stickyScrollLength,
15754							ease: "none"
15755						});
15756					}
15757				} else {
15758					if ( dir === 'left' ) {
15759						scroll_anim = gsap.fromTo( $pinWrap, {
15760							x: -stickyScrollLength
15761						},{
15762							x: 0,
15763							ease: "none"
15764						});
15765					} else {
15766						scroll_anim = gsap.fromTo( $pinWrap, {
15767							x: 0
15768						},{
15769							x: -stickyScrollLength,
15770							ease: "none"
15771						});
15772					}
15773				}
15774
15775				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
15776					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
15777				}
15778
15779				var animationIncrease;
15780
15781				var checkForAnimations = function(){
15782					animationIncrease = 0
15783					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15784						var _this = this;
15785						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
15786							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15787							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15788							requestTimeout(function() {
15789								$(_this).addClass('start_animation');
15790							}, delayAttr + animationIncrease);
15791							animationIncrease += 150;
15792						}
15793						$(_this).on([
15794							'webkitAnimationEnd',
15795							'mozAnimationEnd',
15796							'MSAnimationEnd',
15797							'oanimationend',
15798							'animationend'
15799						].join(' '), function(e) {
15800							$(e.currentTarget).removeClass('animate_when_almost_visible');
15801						});
15802					});
15803
15804					var batchTime = 0;
15805
15806					var resetBatch = function(){
15807						batchTime = 0;
15808					}
15809
15810					if (ScrollTrigger.isScrolling()) {
15811						resetBatch();
15812					}
15813					
15814					$('.tmb-mask-reveal', $pinTrigger).each(function(){
15815						var _this = this,
15816							$this = $(_this),
15817							$inside = $('.t-inside', $this),
15818							delay = parseFloat( $inside.attr('data-delay') ),
15819							speed = parseFloat( $inside.attr('data-speed') ),
15820							easing = $inside.attr('data-easing'),
15821							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
15822
15823						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
15824						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
15825						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
15826						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
15827
15828						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
15829							$this.addClass('tmb-mask-init');
15830							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
15831								gsap.to($('.t-entry-visual-tc', $this), speed, {
15832									clipPath: 'inset(0% 0% 0% 0%)',
15833									delay: delay + batchTime,
15834									ease: easing,
15835								});
15836								gsap.to($('.t-entry-visual-cont', $this), speed, {
15837									clipPath: 'inset(0% 0% 0% 0%)',
15838									scale: 1,
15839									delay: delay + batchTime + (speed*bgDelay),
15840									ease: easing,
15841									onComplete: resetBatch,
15842								});
15843							} else {
15844								gsap.to($('.t-entry-visual-cont', $this), speed, {
15845									clipPath: 'inset(0% 0% 0% 0%)',
15846									scale: 1,
15847									delay: delay + batchTime,
15848									ease: easing,
15849									onComplete: resetBatch,
15850								});
15851							}
15852							batchTime += 0.1;
15853						}
15854					});
15855				
15856				};
15857				checkForAnimations();
15858
15859				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
15860				var start = 0;
15861
15862				var horST = ScrollTrigger.create({
15863					id: "stickySectionScrolling" + key,
15864					scrub: true,
15865					trigger: $pinTrigger[0],
15866					pin: true,
15867					anticipatePin: 1,
15868					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
15869					end: function() { return "+="+stickyScrollLength; },
15870					animation: scroll_anim,
15871					ease: Sine.easeOut,
15872					onUpdate: checkForAnimations,
15873					invalidateOnRefresh: true,
15874					onEnter: function(){
15875						$pinTrigger.addClass('enter-st');
15876					},
15877					onEnterBack: function(){
15878						$pinTrigger.addClass('enter-st');
15879					},
15880					onLeave: function(){
15881						$pinTrigger.removeClass('enter-st');
15882					},
15883					onLeaveBack: function(){
15884						$pinTrigger.removeClass('enter-st');
15885					}
15886				});
15887
15888				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
15889				window.dispatchEvent(new CustomEvent('boxResized'));
15890
15891				var testSecondTrigger = function(){
15892					animationIncrease = 0
15893					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15894						var _this = this;
15895						if ( checkVisible(_this) ) {
15896							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15897							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15898							requestTimeout(function() {
15899								$(_this).addClass('start_animation');
15900							}, delayAttr + animationIncrease);
15901							animationIncrease += 150;
15902						}
15903					});
15904
15905				};
15906
15907				var verST = ScrollTrigger.create({
15908					id: "verticalSectionScrolling" + key,
15909					trigger: $pinTrigger[0],
15910					start: "top center",
15911					end: function() { return "+="+UNCODE.wheight; },
15912					onUpdate: testSecondTrigger,
15913					invalidateOnRefresh: true
15914				});
15915
15916				var setCTA,
15917
15918				dis_enable_ST = function(){
15919					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
15920						horST.kill();
15921						verST.kill();
15922						$pinTrigger.addClass('disabled');
15923						st_active = false;
15924					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15925						horST.kill();
15926						verST.kill();
15927						$pinTrigger.addClass('disabled');
15928						st_active = false;
15929					}
15930				};
15931
15932				$(window).on('resize load', function() {
15933					clearRequestTimeout(setCTA);
15934					setCTA = requestTimeout(function() {
15935						dis_enable_ST();
15936						checkForAnimations();
15937					}, 500);
15938				});
15939
15940			});
15941		};
15942
15943		$(window).on( 'load', function(){
15944			horScrollSizes();
15945		});
15946		var setResize,
15947			setReLayout,
15948			doubleResize = true;
15949		$(window).on( 'load', function(){
15950			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
15951				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
15952				Array.prototype.forEach.call($row_inners, function(el) {
15953					el.style.height = '';
15954					el.style.marginBottom = '';
15955				});
15956				setItemsRelHeight();
15957				horScrollSizes();
15958				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15959					$(document).trigger('uncode-scrolltrigger-refresh');
15960				}
15961			}
15962			var carousel = document.querySelector(".owl-carousel"),
15963				grid = document.querySelector(".isotope-container"),
15964				stickyAll = document.querySelectorAll(".index-scroll");
15965
15966			if ( stickyAll.length ) {
15967				var sticky = stickyAll[(stickyAll.length-1)];
15968			}
15969
15970			if ( typeof sticky !== "undefined" ) {
15971
15972				if ( typeof carousel !== "undefined" && carousel !== null ) {
15973					var carousel_position = sticky.compareDocumentPosition(carousel);
15974				}
15975				if ( typeof grid !== "undefined" && grid !== null ) {
15976					var grid_position = sticky.compareDocumentPosition(grid);
15977				}
15978
15979				if ( carousel_position === 2 || grid_position === 2 ) {
15980					setTimeout(function(){
15981						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15982							$(document).trigger('uncode-scrolltrigger-refresh');
15983						}
15984					}, 500);
15985				}
15986
15987			}
15988			
15989		});
15990        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
15991            android = /Android/.test(navigator.userAgent) && !window.MSStream;
15992		$(window).on( 'resize orientationchange', function(e){
15993			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
15994				return;
15995			}
15996			setItemsRelHeight(true);
15997			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
15998			Array.prototype.forEach.call($row_inners, function(el) {
15999				el.style.height = '';
16000				el.style.marginBottom = '';
16001			});
16002			clearRequestTimeout(setResize);
16003			setResize = requestTimeout( function(){
16004				setItemsRelHeight();
16005				horScrollSizes();
16006				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16007					$(document).trigger('uncode-scrolltrigger-refresh');
16008				}
16009				if ( doubleResize === true ) {
16010					window.dispatchEvent(new Event('resize'));
16011					doubleResize = false;
16012				} else {
16013					doubleResize = true;
16014				}
16015				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
16016			}, 100 );
16017		});
16018
16019		var show_pins = function(){
16020			$('.index-scroll').css({'opacity':'1'});
16021		};
16022		ScrollTrigger.addEventListener("refresh", show_pins);
16023		$(window).on( 'uncode.re-layout', function(){
16024			//$('.index-scroll').css({'opacity':'0'});
16025			$('.pin-spacer').each(function(){
16026				var space_h = $(this).outerHeight(),
16027					$row = $(this).closest('.row-container');
16028				$row.css({
16029					'height': space_h,
16030					'overflow': 'hidden'
16031				});
16032			});
16033			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16034				ScrollTrigger.refresh(true);
16035			}
16036			clearRequestTimeout(setReLayout);
16037			setReLayout = requestTimeout( function(){
16038				$('.row-container').each(function(){
16039					$(this).css({
16040						'height': '',
16041						'overflow': ''
16042					});
16043				});
16044			}, 1000);
16045		});
16046	}
16047
16048};
16049
16050UNCODE.stickyTrigger = function($el) {
16051	if (SiteParameters.is_frontend_editor) {
16052		return false;
16053	}
16054
16055	var resizeTimer;
16056	var oldW = UNCODE.wwidth;
16057	var stickyObservers = [];
16058	var stickyInstances = [];
16059	var isRefreshing = false;
16060	var pendingRefresh = false;
16061	var lastStickyMetrics = {
16062		rowH: 0,
16063		uncontH: 0
16064	};
16065
16066	function clearStickyInstances() {
16067		stickyInstances.forEach(function(st) {
16068			if (st && st.kill) {
16069				st.kill();
16070			}
16071		});
16072		stickyInstances = [];
16073	}
16074
16075	function clearStickyObservers() {
16076		stickyObservers.forEach(function(observer) {
16077			try {
16078				observer.disconnect();
16079			} catch (e) {}
16080		});
16081		stickyObservers = [];
16082	}
16083
16084	function getStickyMetrics() {
16085		var $firstSticky = $('.sticky-trigger').first();
16086		if (!$firstSticky.length) {
16087			return {
16088				rowH: 0,
16089				uncontH: 0
16090			};
16091		}
16092
16093		var $row = $firstSticky.closest('.vc_row');
16094		var $uncont = $firstSticky.closest('.uncont');
16095
16096		return {
16097			rowH: $row.length ? Math.round($row.outerHeight()) : 0,
16098			uncontH: $uncont.length ? Math.round($uncont.outerHeight()) : 0
16099		};
16100	}
16101
16102	function metricsChanged(nextMetrics) {
16103		return (
16104			Math.abs(nextMetrics.rowH - lastStickyMetrics.rowH) > 1 ||
16105			Math.abs(nextMetrics.uncontH - lastStickyMetrics.uncontH) > 1
16106		);
16107	}
16108
16109	function buildSticky() {
16110		clearStickyInstances();
16111		clearStickyObservers();
16112
16113		$('.sticky-trigger').each(function() {
16114			var $sticky = $(this);
16115			var $inside = $sticky.children('div').first();
16116			var $row = $sticky.closest('.vc_row');
16117			var $uncont = $sticky.closest('.uncont');
16118
16119			if (!$inside.length || !$row.length || !$uncont.length) {
16120				return;
16121			}
16122
16123			var st = ScrollTrigger.create({
16124				trigger: $sticky[0],
16125				start: function() {
16126					var insideH = $inside.outerHeight() || 0;
16127					return 'top center-=' + (insideH / 2);
16128				},
16129				endTrigger: $row[0],
16130				end: function() {
16131					var insideH = $inside.outerHeight() || 0;
16132					var rowBottom = $row.offset().top + $row.outerHeight();
16133					var uncontBottom = $uncont.offset().top + $uncont.outerHeight();
16134					var diffBottom = rowBottom - uncontBottom;
16135
16136					return 'bottom center+=' + (insideH / 2 + diffBottom);
16137				},
16138				anticipatePin: true,
16139				pin: true,
16140				pinSpacing: false,
16141				scrub: true,
16142				invalidateOnRefresh: true
16143			});
16144
16145			stickyInstances.push(st);
16146
16147			if (typeof ResizeObserver !== 'undefined') {
16148				var ro = new ResizeObserver(function() {
16149					if (isRefreshing) {
16150						pendingRefresh = true;
16151						return;
16152					}
16153
16154					var nextMetrics = getStickyMetrics();
16155
16156					if (!metricsChanged(nextMetrics)) {
16157						return;
16158					}
16159
16160					refreshSticky(true);
16161				});
16162
16163				try {
16164					// NON osservare $inside: tende a creare loop continui
16165					ro.observe($row[0]);
16166					ro.observe($uncont[0]);
16167					stickyObservers.push(ro);
16168				} catch (e) {}
16169			}
16170		});
16171
16172		lastStickyMetrics = getStickyMetrics();
16173	}
16174
16175	function refreshSticky(fromObserver) {
16176		clearRequestTimeout(resizeTimer);
16177
16178		resizeTimer = requestTimeout(function() {
16179			if (isRefreshing) {
16180				pendingRefresh = true;
16181				return;
16182			}
16183
16184			isRefreshing = true;
16185			pendingRefresh = false;
16186
16187			if (!fromObserver) {
16188				buildSticky();
16189			}
16190
16191			requestTimeout(function() {
16192				isRefreshing = false;
16193
16194				lastStickyMetrics = getStickyMetrics();
16195
16196				if (!fromObserver) {
16197					$(document).trigger('uncode-scrolltrigger-refresh');
16198				} else {
16199					$(document).trigger('uncode-scrolltrigger-refresh');
16200				}
16201
16202				if (pendingRefresh) {
16203					pendingRefresh = false;
16204					refreshSticky(true);
16205				}
16206			}, 120);
16207		}, fromObserver ? 160 : 100);
16208	}
16209
16210	function maybeDelayedRefresh() {
16211		var carousel = document.querySelector('.owl-carousel');
16212		var grid = document.querySelector('.isotope-container');
16213		var stickyAll = document.querySelectorAll('.sticky-trigger');
16214		var sticky = stickyAll.length ? stickyAll[stickyAll.length - 1] : null;
16215		var carousel_position;
16216		var grid_position;
16217
16218		if (!sticky) {
16219			return;
16220		}
16221
16222		if (carousel) {
16223			carousel_position = sticky.compareDocumentPosition(carousel);
16224		}
16225		if (grid) {
16226			grid_position = sticky.compareDocumentPosition(grid);
16227		}
16228
16229		if (carousel_position === 2 || grid_position === 2) {
16230			setTimeout(function() {
16231				refreshSticky(false);
16232			}, 500);
16233		}
16234	}
16235
16236	$(window).on('load', function() {
16237		buildSticky();
16238		maybeDelayedRefresh();
16239	});
16240
16241	$(window).on('resize uncode.re-layout', function(e) {
16242		if (e.type === 'resize' && oldW === UNCODE.wwidth) {
16243			return;
16244		}
16245
16246		oldW = UNCODE.wwidth;
16247		refreshSticky(false);
16248	});
16249
16250	$(document).on('uncode-sticky-refresh uncode-toggle-change', function() {
16251		refreshSticky(false);
16252	});
16253};
16254UNCODE.areaTextReveal = function() {
16255    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
16256        return;
16257    }
16258	if ( ! SiteParameters.is_frontend_editor ) {
16259        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
16260            android = /Android/.test(navigator.userAgent) && !window.MSStream,
16261            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16262            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16263                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16264            firstObs = true,
16265            isMobileUsing = false;
16266
16267        var observer = new ResizeObserver(function(){
16268            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16269                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16270                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16271                set = false;
16272            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
16273                set = true;
16274                prevW = newW;
16275            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16276                set = true;
16277                prevH = newH;
16278            }
16279            if ( set || firstObs ) {
16280                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
16281                firstObs = false;
16282            }
16283        }).observe(document.body);
16284
16285        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16286            window.scrollTo = function() {
16287                return;
16288            };
16289            isMobileUsing = true;
16290
16291            $('html, body').css({
16292                'overscroll-behavior': 'none'
16293            });
16294        }
16295
16296        var setTriggerObserve;
16297
16298        ScrollTrigger.observe({
16299            trigger: 'body',
16300            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
16301            onUp: function() { ScrollTrigger.update(); },
16302        });
16303    }
16304
16305    var textReveal = function(){
16306
16307        if ( SiteParameters.is_frontend_editor ) {
16308            return;
16309        }
16310
16311        var setTxtReveal,
16312            txtTrggrStart = false;
16313
16314        function headingReveal($sel){
16315            txtTrggrStart = true;
16316            $('.text-reveal', $sel).each(function(val, key){
16317                var $txtReveal = $(this).attr('data-init-reveal', true),
16318                    $trigger = $txtReveal,
16319                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
16320                    hReveal = $txtReveal.outerHeight(),
16321                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
16322                    $sticky = $txtReveal.closest('.sticky-element'),
16323                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16324                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16325                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
16326                    $lines = $('.heading-line-wrap', $txtReveal),
16327                    $words = $('.split-word-inner', $txtReveal),
16328                    $chars = $('.split-char', $txtReveal),
16329                    $elToReveal = $words;
16330
16331                if ( $pin.length ) {
16332                    return;
16333                } else if ( $sticky.length ) {
16334                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
16335                    $trigger = $sticky.parent();
16336                }
16337
16338                if ( dataReveal === 'chars' ) {
16339                    $elToReveal = $chars;
16340                } else if ( dataReveal === 'lines' ) {
16341                    $elToReveal = $lines;
16342                }
16343                
16344                var tl = gsap.timeline({
16345                    scrollTrigger: {
16346                        trigger: $trigger,
16347                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
16348                        end: "+=" + hReveal + "px",
16349                        id: "txt_reveal_" + key,
16350                        scrub: true,
16351                    }
16352                });
16353                gsap.set(
16354                    $elToReveal, {
16355                        opacity: dataRevealOpacity,
16356                    }
16357                )
16358                tl.fromTo($elToReveal, {
16359                    opacity: dataRevealOpacity,
16360                    duration: 1,
16361                }, {
16362                    opacity: 1,
16363                    stagger: 0.05,
16364                    duration: 1,
16365
16366                });
16367                $(window).on('uncode.tl-refresh', function(){
16368                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
16369                        tl.scrollTrigger.refresh();
16370                    }
16371                });
16372
16373                $rowParent.one( 'uncodeWordLines', function(){
16374                    clearRequestTimeout(setTxtReveal);
16375                    setTxtReveal = requestTimeout( function(){
16376                        gsap.set($elToReveal, {clearProps: true});
16377                        tl.kill(true);
16378                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
16379                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
16380                        }
16381                        headingReveal($sel)
16382                    }, 100);
16383                });
16384
16385            });
16386        };
16387
16388        window.addEventListener("load", function (e) {
16389            if (!txtTrggrStart) {
16390                headingReveal($("body"));
16391                $(window).trigger("resize");
16392            }
16393        });
16394
16395        $('.row-container[data-parent]').each(function(){
16396            if (!txtTrggrStart) {
16397                var $this = $(this);
16398                $this.on('uncodeWordLines', function(){
16399                    headingReveal($this);
16400                });
16401            }
16402        });
16403
16404        $(window).on('uncode-sticky-trigger-observe', function(e){
16405            clearRequestTimeout(setTriggerObserve);
16406            setTriggerObserve = requestTimeout( function(){
16407                $(window).trigger('uncode.tl-refresh');
16408            }, 2000 );
16409        });
16410    
16411    };
16412    textReveal();
16413
16414    var areaReveal = function(){
16415        if ( SiteParameters.is_frontend_editor ) {
16416            return;
16417        }
16418
16419        $('.scroll-trigger-el').each(function(){
16420            var $scrollTrgrEl = $(this),
16421                $row = $('> .row', $scrollTrgrEl),
16422                $row_in = $('> .row-inner', $row),
16423                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
16424                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
16425                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
16426                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
16427                $animateTrgrEl = $scrollTrgrEl,
16428                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
16429                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
16430                els = $scrollTrgrEl.attr('data-anim-els'),
16431                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
16432                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
16433                state = $scrollTrgrEl.attr('data-anim-state'),
16434                target = $scrollTrgrEl.attr('data-anim-target'),
16435                origin = $scrollTrgrEl.attr('data-anim-origin'),
16436                mask = $scrollTrgrEl.attr('data-anim-mask'),
16437                _scale = $scrollTrgrEl.attr('data-anim-scale'),
16438                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
16439                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
16440                radius = $scrollTrgrEl.attr('data-anim-radius'),
16441                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
16442                clip_path = $scrollTrgrEl.attr('data-clip-path'),
16443                animation_x = $scrollTrgrEl.attr('data-anim-x'),
16444                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
16445                animation_y = $scrollTrgrEl.attr('data-anim-y'),
16446                blur = $scrollTrgrEl.attr('data-anim-blur'),
16447                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
16448                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
16449                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
16450                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
16451                offTop = $scrollTrgrEl.attr('data-anim-top'),
16452                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
16453                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
16454                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
16455                mobile_rows_start = $scrollTrgrEl.attr('data-mobile-start-point'),
16456                mobile_start_add = $scrollTrgrEl.attr('data-mobile-start-point-add'),
16457                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
16458                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
16459                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
16460                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
16461                setTxtReveal,
16462                txtTrggrStart = false,
16463                alreadyareaAnimateScrollTl = false;
16464    
16465            _scale = _scale === '' ? 0 : parseFloat( _scale );
16466            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
16467            offTop = offTop === '' ? 0 : parseFloat( offTop );
16468            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
16469            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
16470
16471            function areaAnimateScrollTl($el, id, last) {
16472                alreadyareaAnimateScrollTl = true;
16473
16474                var pTop = parseFloat( $row.css('padding-top') ),
16475                    innerGap = pTop + offSetCard * id,
16476                    scale = _scale,
16477                    rows_start = animation_rows_start;
16478                    
16479                if ( isMobileUsing && typeof mobile_rows_start !== 'undefined' ) {
16480                    rows_start = mobile_rows_start;
16481                    innerGap = 0 + parseFloat(mobile_start_add);
16482                }
16483
16484                if ( stepScale ) {
16485                    if ( _scale < 100 ) {
16486                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
16487                    }
16488                }
16489
16490                if ( els === 'content' ) {
16491                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
16492                } else if ( els === 'bg' ) {
16493                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
16494                } else {
16495                    $animateTrgrEl = $el;
16496                }
16497
16498                if ( rotate_alt === 'yes') {
16499                    rotate *= -1;
16500                    perspective *= -1;
16501                }
16502                
16503                if ( animation_x_alt === 'yes') {
16504                    animation_x *= -1;
16505                }
16506
16507                var $parentDiv = $el.closest('div[data-sticky]');
16508
16509                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
16510
16511                var scrllTrggr = {
16512                    trigger: $parentDiv,
16513                    end: function(){
16514                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
16515                    },
16516                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
16517                    pin: sticky === 'yes' || stickyCards ? true : false,
16518                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
16519                    scrub: true,
16520                    id: 'sticky_' + id,
16521                    anticipatePin: 1,
16522                    invalidateOnRefresh: true,
16523                    // markers: {
16524                    //     indent: 150 * id
16525                    // },
16526                    onToggle: function(){
16527                        $scrollTrgrEl.attr('data-revealed', true);
16528                    },
16529                };
16530
16531
16532                if ( !stickyLast && state === 'end' ) {
16533                    last = false;
16534                } 
16535
16536                if ( stickyCards ) {
16537                    if ( state !== 'end' ) {
16538                        if ( rows_start === 'center' ) {
16539                            scrllTrggr.start = "center center";
16540                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
16541                        } else if ( rows_start === 'bottom' ) {
16542                            if ( stickyOpts !== 'no' ) {
16543                                scrllTrggr.start = "bottom bottom-=" + (innerGap-1)
16544                                scrllTrggr.end = "bottom bottom";
16545                            }
16546                        } else {
16547                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
16548                        } 
16549                        if ( stickyOpts === 'no' ) {
16550                            scrllTrggr.endTrigger = $el;
16551                            scrllTrggr.end = "+=100%";
16552                        } else {
16553                            scrllTrggr.endTrigger = $row;
16554                        }
16555                    } else {
16556                        if ( rows_start === 'center' ) {
16557                            scrllTrggr.start = "center center";
16558                        } else if ( rows_start === 'bottom' ) {
16559                            scrllTrggr.start = "bottom bottom";
16560                        } 
16561                        if ( stickyOpts !== 'no' ) {
16562                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
16563                            scrllTrggr.endTrigger = $lastEl;
16564                        } else {
16565                            scrllTrggr.end = "bottom bottom";
16566                        }
16567                    }
16568                }
16569                
16570                var tl = gsap.timeline({
16571                    scrollTrigger: scrllTrggr
16572                });
16573
16574                // var mark = last ? {
16575                //         startColor:"blue",
16576                //         endColor:"orange",
16577                //     } : false;
16578
16579                if ( !stickyCards ) {
16580                    var tlConds = tl;
16581                } else {
16582                    var scrllTrggrConds = {
16583                        trigger: $parentDiv,
16584                        end: function(){
16585                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
16586                        }, 
16587                        pin: (state === 'end' && last),
16588                        pinSpacing: false,
16589                        scrub: true,
16590                        id: 'card_' + id,
16591                        invalidateOnRefresh: true,
16592                        // markers: true,
16593                    };
16594
16595                    if ( stickyCards ) {
16596                        if ( state !== 'end' ) {
16597                            if ( stickyOpts === '' ) {
16598                                scrllTrggrConds.end = "bottom bottom-=100%";
16599                                scrllTrggrConds.endTrigger = $row_in;
16600                            }
16601
16602                            if ( rows_start === 'bottom' ) {
16603                                if ( stickyOpts !== 'no') {
16604                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
16605                                    scrllTrggrConds.end = "bottom bottom";
16606                                }
16607                            } else if ( rows_start === 'center' ) {
16608                                scrllTrggrConds.start =  "center center";
16609                            } else {
16610                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16611                            }
16612                            
16613                        } else {
16614                            if ( stickyOpts === '' ) {
16615                                if ( animLast ) {
16616                                    scrllTrggrConds.end = "bottom bottom-=100%";
16617                                } else {
16618                                    scrllTrggrConds.end = "bottom bottom";
16619                                }
16620                                scrllTrggrConds.endTrigger = $lastEl;
16621                            }
16622
16623                            if ( rows_start === 'bottom' && stickyOpts !== 'no' ) {
16624                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16625                                    scrllTrggrConds.start = "bottom bottom";
16626                                } else {
16627                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
16628                                }
16629                            } else if ( rows_start === 'center' ) {
16630                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16631                                    scrllTrggrConds.start =  "center center";
16632                                } else {
16633                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
16633+ window.innerHeight/2;
16634                                }
16635                            } else {
16636                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16637                                    scrllTrggrConds.start = "top top";
16638                                } else {
16639                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16640                                }
16641                            }
16642
16643                        }
16644
16645                    } else {
16646                        scrllTrggrConds.start =  start_topBottom;
16647                    }
16648
16649                    var tlConds = gsap.timeline({
16650                        scrollTrigger: scrllTrggrConds
16651                    });
16652                }
16653
16654                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
16655                    if ( target === 'mask' ) {
16656                        if ( state !== 'end' ) {
16657                            if ( mask === 'auto' ) {
16658                                gsap.set(
16659                                    $animateTrgrEl, {
16660                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16661                                        opacity: parseFloat(opacity)/100,
16662                                        filter: 'blur(' + blur + 'px)',
16663                                        visibility: 'visible',
16664                                    }
16665                                )
16666                                tlConds.fromTo($animateTrgrEl, {
16667                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16668                                    opacity: parseFloat(opacity)/100,
16669                                    filter: 'blur(' + blur + 'px)',
16670                                    duration: 1,
16671                                }, {
16672                                    opacity: 1,
16673                                    clipPath: 'inset(0% 0px round 0' + radiu
16673s_unit + ')',
16674                                    filter: 'blur(0px)',
16675                                    duration: 1,
16676                                    ease: easeOut,
16677                                    //delay: 0.1
16678                                });	
16679                            } else {
16680                                tlConds.fromTo($animateTrgrEl, {
16681                                    opacity: parseFloat(opacity)/100,
16682                                    clipPath: clip_path,
16683                                    filter: 'blur(' + blur + 'px)',
16684                                    duration: 1,
16685                                }, {
16686                                    opacity: 1,
16687                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16688                                    filter: 'blur(0px)',
16689                                    duration: 1,
16690                                    ease: easeOut,
16691                                    //delay: 0.1
16692                                });	
16693                            }
16694                        } else {
16695                            if ( mask === 'auto' ) {
16696                                tlConds.fromTo($animateTrgrEl, {
16697                                    opacity: 1,
16698                                    clipPath: 'inset(0% 0px round 0' + radiu
16698s_unit + ')',
16699                                    filter: 'blur(0px)',
16700                                    duration: 1,
16701                                },{
16702                                    opacity: parseFloat(opacity)/100,
16703                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16704                                    filter: 'blur(' + blur + 'px)',
16705                                    ease: easeOut,
16706                                    duration: 1,
16707                                    //delay: 0.1
16708                                });	
16709                            } else {
16710                                tlConds.fromTo($animateTrgrEl, {
16711                                    opacity: 1,
16712                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16713                                    filter: 'blur(0px)',
16714                                    duration: 1,
16715                                },{
16716                                    opacity: parseFloat(opacity)/100,
16717                                    clipPath: clip_path,
16718                                    filter: 'blur(' + blur + 'px)',
16719                                    duration: 1,
16720                                    ease: easeOut,
16721                                    //delay: 0.1
16722                                });	
16723                            }
16724                        }
16725                    } else {
16726                        if ( state !== 'end' ) {
16727                            if ( scale === 'auto' ) {
16728                                if ( radius ) {
16729                                    gsap.set(
16730                                        $animateTrgrEl, {
16731                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16732                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16733                                            x: animation_x + 'vw',
16734                                            y: animation_y + 'vh',
16735                                            filter: 'blur(' + blur + 'px)',
16736                                            rotation: rotate,
16737                                            rotationX: rotate == 0 ? perspective : 0,
16738                                            transformPerspective: '100vw',
16739                                            opacity: parseFloat(opacity)/100,
16740                                            transformOrigin: origin,
16741                                            borderRadius: radius + radius_unit,
16742                                            visibility: 'visible',
16743                                        }
16744                                    )
16745                                    tlConds.fromTo($animateTrgrEl, {
16746                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16747                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16748                                        x: animation_x + 'vw',
16749                                        y: animation_y + 'vh',
16750                                        filter: 'blur(' + blur + 'px)',
16751                                        rotation: rotate,
16752                                        rotationX: rotate == 0 ? perspective : 0,
16753                                        transformPerspective: '100vw',
16754                                        opacity: parseFloat(opacity)/100,
16755                                        borderRadius: radius + radius_unit,
16756                                        transformOrigin: origin,
16757                                        duration: 1,
16758                                    }, {
16759                                        scaleX: 1,
16760                                        scaleY: 1,
16761                                        x: 0,
16762                                        y: 0,
16763                                        filter: 'blur(0px)',
16764                                        rotation: 0,
16765                                        rotationX: 0,
16766                                        opacity: 1,
16767                                        borderRadius: 0 + radius_unit,
16768                                        transformOrigin: origin,
16769                                        duration: 1,
16770                                        ease: easeOut,
16771                                        //delay: 0.1
16772                                    });	
16773                                } else {
16774                                    gsap.set(
16775                                        $animateTrgrEl, {
16776                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16777                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16778                                            x: animation_x + 'vw',
16779                                            y: animation_y + 'vh',
16780                                            filter: 'blur(' + blur + 'px)',
16781                                            rotation: rotate,
16782                                            rotationX: rotate == 0 ? perspective : 0,
16783                                            transformPerspective: '100vw',
16784                                            opacity: parseFloat(opacity)/100,
16785                                            transformOrigin: origin,
16786                                            visibility: 'visible',
16787                                        }
16788                                    )
16789                                    tlConds.fromTo($animateTrgrEl, {
16790                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16791                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16792                                        x: animation_x + 'vw',
16793                                        y: animation_y + 'vh',
16794                                        filter: 'blur(' + blur + 'px)',
16795                                        rotation: rotate,
16796                                        rotationX: rotate == 0 ? perspective : 0,
16797                                        transformPerspective: '100vw',
16798                                        opacity: parseFloat(opacity)/100,
16799                                        transformOrigin: origin,
16800                                        duration: 1,
16801                                    }, {
16802                                        scaleX: 1,
16803                                        scaleY: 1,
16804                                        x: 0,
16805                                        y: 0,
16806                                        filter: 'blur(0px)',
16807                                        rotation: 0,
16808                                        rotationX: 0,
16809                                        opacity: 1,
16810                                        transformOrigin: origin,
16811                                        duration: 1,
16812                                        ease: easeOut,
16813                                        //delay: 0.1
16814                                    });	
16815                                }
16816                            } else {
16817                                if ( radius ) {
16818                                    gsap.set(
16819                                        $animateTrgrEl, {
16820                                            scaleX: parseFloat( scale ) / 100,
16821                                            scaleY: parseFloat( scale ) / 100,
16822                                            opacity: parseFloat(opacity)/100,
16823                                            x: animation_x + 'vw',
16824                                            y: animation_y + 'vh',
16825                                            filter: 'blur(' + blur + 'px)',
16826                                            rotation: rotate,
16827                                            rotationX: rotate == 0 ? perspective : 0,
16828                                            transformPerspective: '100vw',
16829                                            transformOrigin: origin,
16830                                            borderRadius: radius + radius_unit,
16831                                            visibility: 'visible',
16832                                        }
16833                                    )
16834                                    tlConds.fromTo($animateTrgrEl, {
16835                                        scaleX: parseFloat( scale ) / 100,
16836                                        scaleY: parseFloat( scale ) / 100,
16837                                        opacity: parseFloat(opacity)/100,
16838                                        x: animation_x + 'vw',
16839                                        y: animation_y + 'vh',
16840                                        filter: 'blur(' + blur + 'px)',
16841                                        rotation: rotate,
16842                                        rotationX: rotate == 0 ? perspective : 0,
16843                                        transformPerspective: '100vw',
16844                                        borderRadius: radius + radius_unit,
16845                                        transformOrigin: origin,
16846                                        duration: 1,
16847                                    }, {
16848                                        scaleX: 1,
16849                                        scaleY: 1,
16850                                        opacity: 1,
16851                                        x: 0,
16852                                        y: 0,
16853                                        filter: 'blur(0px)',
16854                                        rotation: 0,
16855                                        rotationX: 0,
16856                                        transformOrigin: origin,
16857                                        ease: easeOut,
16858                                        duration: 1,
16859                                        borderRadius: 0 + radius_unit,
16860                                        //delay: 0.1
16861                                    });	
16862                                } else {
16863                                    gsap.set(
16864                                        $animateTrgrEl, {
16865                                            scaleX: parseFloat( scale ) / 100,
16866                                            scaleY: parseFloat( scale ) / 100,
16867                                            opacity: parseFloat(opacity)/100,
16868                                            x: animation_x + 'vw',
16869                                            y: animation_y + 'vh',
16870                                            filter: 'blur(' + blur + 'px)',
16871                                            rotation: rotate,
16872                                            rotationX: rotate == 0 ? perspective : 0,
16873                                            transformPerspective: '100vw',
16874                                            transformOrigin: origin,
16875                                            visibility: 'visible',
16876                                        }
16877                                    )
16878                                    tlConds.fromTo($animateTrgrEl, {
16879                                        scaleX: parseFloat( scale ) / 100,
16880                                        scaleY: parseFloat( scale ) / 100,
16881                                        opacity: parseFloat(opacity)/100,
16882                                        x: animation_x + 'vw',
16883                                        y: animation_y + 'vh',
16884                                        filter: 'blur(' + blur + 'px)',
16885                                        rotation: rotate,
16886                                        rotationX: rotate == 0 ? perspective : 0,
16887                                        transformPerspective: '100vw',
16888                                        transformOrigin: origin,
16889                                        duration: 1,
16890                                    }, {
16891                                        scaleX: 1,
16892                                        scaleY: 1,
16893                                        opacity: 1,
16894                                        x: 0,
16895                                        y: 0,
16896                                        filter: 'blur(0px)',
16897                                        rotation: 0,
16898                                        rotationX: 0,
16899                                        transformOrigin: origin,
16900                                        duration: 1,
16901                                        ease: easeOut,
16902                                        //delay: 0.1
16903                                    });
16904                                }
16905                            }
16906                        } else {
16907                            if ( scale === 'auto' ) {
16908                                tlConds.fromTo($animateTrgrEl, {
16909                                    scaleX: 1,
16910                                    scaleY: 1,
16911                                    opacity: 1,
16912                                    x: 0,
16913                                    y: 0,
16914                                    filter: 'blur(0px)',
16915                                    rotation: 0,
16916                                    rotationX: 0,
16917                                    transformOrigin: origin,
16918                                    duration: 1,
16919                                }, {
16920                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16921                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16922                                    opacity: parseFloat(opacity)/100,
16923                                    x: animation_x + 'vw',
16924                                    y: animation_y + 'vh',
16925                                    filter: 'blur(' + blur + 'px)',
16926                                    rotation: rotate,
16927                                    rotationX: rotate == 0 ? perspective : 0,
16928                                    transformPerspective: '100vw',
16929                                    transformOrigin: origin,
16930                                    duration: 1,
16931                                    ease: easeOut,
16932                                    //delay: 0.1
16933                                })
16934                            } else {
16935                                tlConds.fromTo($animateTrgrEl, {
16936                                    scaleX: 1,
16937                                    scaleY: 1,
16938                                    opacity: 1,
16939                                    x: 0,
16940                                    y: 0,
16941                                    filter: 'blur(0px)',
16942                                    rotation: 0,
16943                                    rotationX: 0,
16944                                    transformPerspective: '100vw',
16945                                    transformOrigin: origin,
16946                                    borderRadius: 0 + radius_unit,
16947                                    duration: 1,
16948                                }, {
16949                                    scaleX: parseFloat( scale ) / 100,
16950                                    scaleY: parseFloat( scale ) / 100,
16951                                    opacity: parseFloat(opacity)/100,
16952                                    x: animation_x + 'vw',
16953                                    y: animation_y + 'vh',
16954                                    filter: 'blur(' + blur + 'px)',
16955                                    rotation: rotate,
16956                                    rotationX: rotate == 0 ? perspective : 0,
16957                                    transformPerspective: '100vw',
16958                                    transformOrigin: origin,
16959                                    borderRadius: radius + radius_unit,
16960                                    duration: 1,
16961                                    ease: easeOut,
16962                                    //delay: 0.1
16963                                })
16964                            }
16965                        }
16966                    }
16967                }
16968
16969                function headingReveal($el){
16970                    txtTrggrStart = true;
16971                    $('.text-reveal', $el).each(function(_key, _val){
16972                        var $txtReveal = $(_val),
16973                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16974                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16975                            $lines = $('.heading-line-wrap', $txtReveal),
16976                            $words = $('.split-word-inner', $txtReveal),
16977                            $chars = $('.split-char', $txtReveal),
16978                            _setTxtReveal,
16979                            $elToReveal = $words;
16980
16981                        if ( !(sticky === 'yes' || stickyCards) ) {
16982                            return;
16983                        }
16984            
16985                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
16986
16987                        if ( dataReveal === 'chars' ) {
16988                            $elToReveal = $chars;
16989                        } else if ( dataReveal === 'lines' ) {
16990                            $elToReveal = $lines;
16991                        }
16992
16993                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
16994                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
16995                        scrllTrggrTxt.pin = false;
16996
16997                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
16998                        var _tl = gsap.timeline({
16999                            scrollTrigger: scrllTrggrTxt
17000                        });
17001                        _tl.fromTo($elToReveal, {
17002                            opacity: dataRevealOpacity,
17003                        }, {
17004                            opacity: 1,
17005                            stagger: 0.05
17006                        });
17007
17008                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
17009                            clearRequestTimeout(_setTxtReveal);
17010                            _setTxtReveal = requestTimeout( function(){
17011                                gsap.set($elToReveal, {clearProps: true});
17012                                _tl.kill(true);
17013                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
17014                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
17015                                }
17016                                headingReveal($el)
17017                            }, 100);
17018                        });
17019
17020                    });
17021                };
17022
17023                if (!txtTrggrStart) {
17024                    headingReveal($el);
17025                }
17026
17027                $scrollTrgrEl.one( 'uncodeWordLines', function(){
17028                    if (!txtTrggrStart) {
17029                        headingReveal($el);
17030                    }
17031                });
17032                
17033                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
17034                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
17035                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
17036                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
17037                    
17038                $(window).on('uncode-sticky-trigger-observe', function(e){
17039                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17040                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
17041                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
17042                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
17043                    if ( stickyCards ) {
17044                        $('.tmb', $scrollTrgrEl).removeAttr('style');
17045                    }
17046                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
17047                    clearRequestTimeout(setTxtReveal);
17048                    setTxtReveal = requestTimeout( function(){
17049                        $(document).trigger('uncode-scrolltrigger-refresh');
17050                        if ( isMobileUsing ) {
17051                            if ( typeof tl !== 'undefined' ) {
17052                                tl.scrollTrigger.refresh();
17053                            }
17054                            if ( typeof tlConds !== 'undefined' ) {
17055                                tlConds.scrollTrigger.refresh();
17056                            }
17057                            $(window).trigger('scroll');
17058                            _width = __width;
17059                        } else if ( _width !== __width && ( isMobileUsing ) ) {
17060                            window.dispatchEvent(new CustomEvent('vc-resize'));
17061                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
17062                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
17063                                    if ( typeof tl !== 'undefined' ) {
17064                                        tl.scrollTrigger.refresh();
17065                                    }
17066                                    if ( typeof tlConds !== 'undefined' ) {
17067                                        tlConds.scrollTrigger.refresh();
17068                                    }
17069                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
17070                                }});
17071                            } else {
17072                                if ( typeof tl !== 'undefined' ) {
17073                                    tl.scrollTrigger.refresh();
17074                                }
17075                                if ( typeof tlConds !== 'undefined' ) {
17076                                    tlConds.scrollTrigger.refresh();
17077                                }
17078                                $(window).trigger('scroll');
17079                            }
17080                            _height = __height;
17081                        }
17082                    }, 500);
17083                });
17084
17085
17086                $(window).on('load ', function(e){
17087                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17088                    if ( _height !== ___height ) {
17089                        $scrollTrgrEl.attr('data-toggled', true);
17090                        $(window).trigger('resize');
17091                        if ( typeof tl !== 'undefined' ) {
17092                            tl.scrollTrigger.refresh();
17093                        }
17094                        if ( typeof tlConds !== 'undefined' ) {
17095                            tlConds.scrollTrigger.refresh();
17096                        }
17097                        _height = ___height;
17098                    }
17099
17100                    
17101                    
17102                    $(document).trigger('uncode-scrolltrigger-refresh');
17103
17104                });
17105
17106            };
17107
17108            var callAreaAnimateScrollTl = function() {
17109                if ( stickyCards ) {
17110                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
17111                        if ( key+1 < cardL || animLast || state !== 'end' ) {
17112                            var $this = $(val),
17113                                last = key+1===cardL;
17114                            areaAnimateScrollTl($this, key, last);
17115                        }
17116                    });
17117                } else {
17118                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
17119                }    
17120            };
17121
17122            $(window).on('wwResize', function(){
17123                if ( !alreadyareaAnimateScrollTl ) {
17124                    if ( noMobile ) {
17125                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17126                            return;
17127                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17128                            return;
17129                        }
17130                    }
17131                    
17132                    callAreaAnimateScrollTl();
17133                }
17134            })
17135
17136            if ( noMobile ) {
17137                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17138                    return;
17139                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17140                    return;
17141                }
17142            }
17143
17144            callAreaAnimateScrollTl();
17145
17146        });
17147
17148    };
17149
17150    areaReveal();
17151
17152};
17153UNCODE.thumbsReveal = function() {
17154
17155    var recalc = false,
17156        thumbsRevealResizeTO;
17157
17158    var isTouchDevice = function() {
17159        return (
17160            'ontouchstart' in window ||
17161            navigator.maxTouchPoints > 0 ||
17162            navigator.msMaxTouchPoints > 0
17163        );
17164    };
17165
17166    var resetThumbsReveal = function() {
17167        $('.tmb-mask-init').each(function(){
17168            var el = this;
17169
17170            if ( el._thumbsRevealST ) {
17171                el._thumbsRevealST.kill();
17172                el._thumbsRevealST = null;
17173            }
17174
17175            if ( el._thumbsRevealIO ) {
17176                el._thumbsRevealIO.disconnect();
17177                el._thumbsRevealIO = null;
17178            }
17179
17180            gsap.set($('img, video, .fluid-object', el), {
17181                clearProps: 'transform'
17182            });
17183
17184            $(el).removeClass('tmb-mask-init');
17185        });
17186
17187        revealThumbs();
17188    };
17189
17190    var revealThumbs = function( $el ){
17191        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
17192            $el = $('body');
17193        }
17194
17195        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
17196            var $container = $(this),
17197                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
17198                isContainer = false;
17199
17200            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
17201                $stickys.each(function(){
17202                    var $sticky = $(this).addClass('tmb-mask-init'),
17203                        $rellax = $sticky.closest('.parallax-el'),
17204                        $inside = $('.t-inside', $sticky),
17205                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
17206                        val = parseFloat( $inside.attr('data-scroll-val') ),
17207                        no_device = $inside.attr('data-anim-no-mobile') === 'yes';
17208
17209                    if ( no_device && isTouchDevice() ) {
17210                        gsap.set($media, {
17211                            clearProps: 'transform'
17212                        });
17213
17214                        return;
17215                    }
17216
17217                    if ( $rellax.length ) {
17218                        recalc = true;
17219                    }
17220
17221                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
17222                    
17223                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
17224
17225                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
17226                            ? val * 0.05 : 0;
17227
17228                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17229                            ? val * 4 : 0;
17230
17231                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17232                            ? parax * 0.01 : 0;
17233
17234                        var isThumbVisible = false;
17235                        var lastProgress = 0;
17236
17237                        var io = null;
17238
17239                        if (typeof IntersectionObserver !== 'undefined') {
17240                            io = new IntersectionObserver(function(entries){
17241                                var entry = entries[0];
17242
17243                                isThumbVisible = !!(
17244                                    entry &&
17245                                    entry.isIntersecting &&
17246                                    entry.intersectionRect &&
17247                                    entry.intersectionRect.width > 0 &&
17248                                    entry.intersectionRect.height > 0
17249                                );
17250
17251                                if (!isThumbVisible) {
17252                                    gsap.set($media, {
17253                                        yPercent: 0,
17254                                        scale: 1 + extra
17255                                    });
17256                                }
17257                            }, {
17258                                root: null,
17259                                threshold: 0.01
17260                            });
17261
17262                            io.observe($sticky[0]);
17263
17264                            $sticky[0]._thumbsRevealIO = io;
17265                        }
17266
17267                        var st = ScrollTrigger.create({
17268                            trigger: $sticky[0],
17269                            scrub: true,
17270                            start: 'top bottom',
17271                            end: 'bottom top',
17272                            onUpdate: function(self) {
17273                                lastProgress = self.progress;
17274
17275                                if (!isThumbVisible) return;
17276
17277                                var currentY = gsap.utils.interpolate(-parax, parax, lastProgress);
17278                                var currentScale = gsap.utils.interpolate(1 + zoom + extra, 1 + extra, lastProgress);
17279
17280                                gsap.set($media, {
17281                                    yPercent: currentY,
17282                                    scale: currentScale
17283                                });
17284                            }
17285                        });
17286
17287                        $sticky[0]._thumbsRevealST = st;
17288
17289                        if ( recalc ) {
17290                            $(window).on('uncode-thumbsreveal-refresh', function(){
17291                                if ( st ) {
17292                                    st.refresh();
17293                                }
17294                            });
17295                        }
17296                    }
17297                });
17298            }
17299
17300            if ( $container.has('.tmb-mask-reveal') ) {
17301                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
17302                    staggerTime = 0.1;
17303
17304                $('.t-inside', $container).each(function(){
17305                    var checkEasing = $(this).attr('data-easing');
17306
17307                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
17308                        gsap.registerPlugin(CustomEase);
17309                        return false;
17310                    }
17311                });
17312
17313                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
17314                    $markTrigger = $container;
17315                    isContainer = true;
17316                    staggerTime = 0;
17317                }
17318
17319                ScrollTrigger.batch( $markTrigger, {
17320                    start: function( el ){
17321                        return "top 96%";
17322                    },
17323                    onEnter: function(batch){
17324                        var $inside = $(batch).closest('.t-inside');
17325
17326                        if ( isContainer ) {
17327                            $inside = $(batch).find('.t-inside').first();
17328                        }
17329
17330                        var delay = parseFloat( $inside.attr('data-delay') ),
17331                            speed = parseFloat( $inside.attr('data-speed') ),
17332                            easing = $inside.attr('data-easing'),
17333                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
17334
17335                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay / 1000;
17336                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed / 1000;
17337                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
17338                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
17339
17340                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
17341                            gsap.to($('.t-entry-visual-tc', batch), speed, {
17342                                clipPath: 'inset(0% 0% 0% 0%)',
17343                                stagger: staggerTime,
17344                                delay: delay,
17345                                ease: easing
17346                            });
17347
17348                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17349                                clipPath: 'inset(0% 0% 0% 0%)',
17350                                stagger: staggerTime,
17351                                scale: 1,
17352                                delay: delay + (speed * bgDelay),
17353                                ease: easing
17354                            });
17355                        } else {
17356                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17357                                clipPath: 'inset(0% 0% 0% 0%)',
17358                                stagger: staggerTime,
17359                                scale: 1,
17360                                delay: delay,
17361                                ease: easing
17362                            });
17363                        }
17364                    }
17365                });
17366            }
17367        });
17368
17369        function raf(time) {
17370            requestAnimationFrame(raf);
17371            $(window).trigger('uncode-thumbsreveal-refresh');
17372        }
17373
17374        if ( recalc ) {
17375            requestAnimationFrame(raf);
17376        }
17377    };
17378
17379    $(window).on( 'load more-items-loaded', function(){
17380        revealThumbs();
17381    });
17382
17383    $(document).on('uncode-ajax-filtered', function(){
17384        revealThumbs();
17385    });
17386
17387    $(window).on('resize orientationchange', function(){
17388        clearTimeout(thumbsRevealResizeTO);
17389
17390        thumbsRevealResizeTO = setTimeout(function(){
17391            resetThumbsReveal();
17392        }, 150);
17393    });
17394
17395    document.addEventListener('uncode:marquee:ready', function(e) {
17396        if (!e || !e.detail || !e.detail.baseWrap) return;
17397
17398        var parent = e.detail.parent || e.detail.baseWrap;
17399        var $marquee = $(e.detail.baseWrap);
17400
17401        if (e.detail.leftWrap) {
17402            $marquee = $marquee.add(e.detail.leftWrap);
17403        }
17404
17405        if (e.detail.rightWrap) {
17406            $marquee = $marquee.add(e.detail.rightWrap);
17407        }
17408
17409        if (parent._uncodeThumbsRevealT) {
17410            clearRequestTimeout(parent._uncodeThumbsRevealT);
17411        }
17412
17413        parent._uncodeThumbsRevealT = requestTimeout(function() {
17414            $('.tmb-mask-init', $marquee).removeClass('tmb-mask-init');
17415            revealThumbs($marquee);
17416            parent._uncodeThumbsRevealT = null;
17417        }, 20);
17418    }, false);
17419    
17420    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
17421        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
17422            var $el = model.view.$el,
17423                shortcode = model.attributes.shortcode;
17424
17425            if ( $el.is('.custom-grid-container') ) {
17426                $el = $el.parent();
17427            }
17428
17429            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
17430                revealThumbs($el);
17431            }
17432        });
17433    }
17434
17435};
17436UNCODE.revslider = function() {
17437	var revSlider6In = function(){
17438		$('rs-module').each(function(){
17439			var $slider = $(this);
17440
17441			$slider.on('revolution.slide.onloaded', function(e, data){
17442				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17443					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
17444						scrolltop = $(document).scrollTop();
17445					if ( style != undefined ) {
17446						UNCODE.switchColorsMenu(scrolltop, style);
17447					}
17448				}
17449			});
17450
17451			$slider.on('revolution.slide.onchange', function(e, data){
17452				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17453					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
17454						scrolltop = $(document).scrollTop();
17455					if ( style != undefined ) {
17456						UNCODE.switchColorsMenu(scrolltop, style);
17457					}
17458				}
17459			});
17460
17461		});
17462
17463	};
17464	revSlider6In();
17465	$(window).on("load", revSlider6In );
17466
17467	document.addEventListener("sr.module.ready", function(e) { 
17468		var $slider = $('#'+e.id),
17469			settings = SR7.JSON[e.id];
17470
17471		if ( typeof settings !== 'undefined' && settings !== null ) {
17472			if ( $slider.closest(".header-revslider").length ) {
17473				var style = settings.slides[1].slide.attr.data,
17474					scrolltop = $(document).scrollTop();
17475				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17476				style = style[1];
17477				if ( style[1] != undefined ) {
17478					UNCODE.switchColorsMenu(scrolltop, style);
17479				}
17480			}
17481		}
17482	});
17483
17484	document.addEventListener("sr.slide.afterChange", function(e) {
17485		var $slider = $('#'+e.id),
17486			settings = SR7.JSON[e.id];
17487
17488		if ( typeof settings !== 'undefined' && settings !== null ) {
17489			if ( $slider.closest(".header-revslider").length ) {
17490				var style = settings.slides[e.current.id].slide.attr.data,
17491					scrolltop = $(document).scrollTop();
17492				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17493				style = style[1];
17494				if ( style != undefined ) {
17495					UNCODE.switchColorsMenu(scrolltop, style);
17496				}
17497			}
17498		}
17499	});
17500
17501};
17502UNCODE.layerslider = function() {
17503	$(window).on("load", function() {
17504
17505		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
17506
17507			var slideData = slider.slides.current.data,
17508				scrolltop = $(document).scrollTop();
17509			if( slideData && slideData.skin ) {
17510
17511				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
17512
17513			}
17514		});
17515
17516	});
17517};
17518
17519UNCODE.ajax_filters = function () {
17520	var isAjaxing = false;
17521
17522/*************************
17523 *
17524 * Filters Menu and Widgets Area
17525 *
17526 ************************/
17527
17528 	var clear_clicked = false;
17529
17530 	var init_ajax_grid = function(){
17531
17532		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
17533		$grids.each(function(index, val){
17534			var $body = $('body'),
17535				$grid = $(val).addClass('init-ajax-grid'),
17536				starting_point = $grid.attr('data-toggle'),
17537				$trigger = $('.uncode-toggle-ajax-filters', $grid),
17538				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
17539				$isotope_wrapper = $('.isotope-wrapper', $grid),
17540				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
17541				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
17542				$footprint = $('.ajax-filter-footprint', $grid),
17543				sidebar_w,
17544				data_w = parseFloat( $sidebar.attr('data-max-width') ),
17545				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
17546				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
17547				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
17548				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17549				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
17550				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
17551				sidew,
17552				$inside_row = $('> .row-parent', $vc_row),
17553				bg_row,
17554				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
17555				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
17556				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
17557				sidebar_overlay = false,
17558				sidebar_hover = false,
17559				switchMobile = false,
17560				scrollTop;
17561
17562			if ( $vc_row.attr('class') ) {
17563				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
17564			}
17565
17566			if ( bg_row != null ) {
17567				$side_header.add($side_footer).addClass(bg_row[0]);
17568			}
17569
17570			$trigger.add($apply_filters).on('click', function(e){
17571				e.preventDefault();
17572				e.stopPropagation();
17573				$grid = $('.ajax-grid-system').eq(0);
17574				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17575				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17576				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17577				sidebar_w = $sidebar_wrapper.width();
17578				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17579				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
17580					$(this).trigger('uncode-ajax-clear-filters');
17581				}
17582				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17583					$grid.toggleClass('ajax-hide-filters-blanks');
17584					$sidebar.slideToggle({
17585						duration: 400,
17586						easing: 'easeOutQuad',
17587					});
17588				} else {
17589					$grid.removeClass('ajax-hide-filters-blanks');
17590					$grid.toggleClass('ajax-hide-filters');
17591					if ( $grid.hasClass('ajax-hide-filters') ) {
17592						$body.addClass('ajax-hide-filters');
17593					} else {
17594						scrollTop = $('html, body').scrollTop();
17595						$body.removeClass('ajax-hide-filters');
17596					}
17597				}
17598				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17599					$('html, body').scrollTop(scrollTop);
17600				}
17601				return false;
17602			});
17603
17604			$close_btn.on('click', function(e){
17605				e.preventDefault();
17606				$grid = $('.ajax-grid-system').eq(0);
17607				$grid.addClass('ajax-hide-filters');
17608				if ( $grid.hasClass('ajax-hide-filters') ) {
17609					$body.addClass('ajax-hide-filters');
17610				} else {
17611					scrollTop = $('html, body').scrollTop();
17612					$body.removeClass('ajax-hide-filters');
17613				}
17614				$('html, body').scrollTop(scrollTop);
17615			});
17616
17617			$sidebar_wrapper.on('mouseover',function(){
17618				sidebar_hover = true;
17619			}).on('mouseout', function(){
17620				sidebar_hover = false;
17621			});
17622
17623			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
17624				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
17625					return;
17626				}
17627				if (undefined !== from && from === 'select_active_attributes') {
17628					return;
17629				}
17630				if ($(e.target).closest('.select2-container--open').length ) {
17631					return;
17632				}
17633				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
17634					$grid.add($body).addClass('ajax-hide-filters');
17635				}
17636			});
17637
17638			$sorting_trgr.on('click', function(e) {
17639				e.preventDefault();
17640			});
17641
17642			var inside_width = function(){
17643				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17644				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17645				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17646				$inside_row = $('> .row-parent', $vc_row);
17647				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
17648					sidew = $sidebar.width();
17649					$inside_row.css({
17650						width: sidew
17651					});
17652				} else {
17653					$inside_row.css({
17654						width: ''
17655					});
17656				}
17657			};
17658			inside_width();
17659
17660			var ajax_sidebar_position = function(e, f_editor){
17661				$grid = $('.ajax-grid-system').eq(0);
17662				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17663				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17664				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17665				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17666				$inside_row = $('> .row-parent', $vc_row);
17667				scrollTop = $('html, body').scrollTop();
17668				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery) || overlay_desktop ) ) {
17669					if ( switchMobile !== true ) {
17670						$grid.add($body).addClass('ajax-hide-filters');
17671						$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
17672						$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
17673						sidebar_overlay = true;
17674						$body.addClass('ajax-filter-sidebar-overlay');
17675						$sidebar_wrapper.addClass(skin);
17676						var sideHeadH = $side_header.outerHeight(),
17677							sideFooterH = $side_footer.outerHeight();
17678						if ( data_w !== '' && data_w > 0 ) {
17679							if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
17680								$sidebar.css({
17681									'max-width': data_w
17682								});
17683							} else {
17684								$sidebar.css({
17685									'max-width':'none'
17686								});
17687							}
17688						}
17689						$vc_row.css({
17690							'padding-top':sideHeadH,
17691							'padding-bottom':sideFooterH
17692						}).attr('data-lenis-prevent', true);
17693						var sidew = $sidebar.width();
17694						$inside_row.css({
17695							width: sidew
17696						});
17697						switchMobile = true;
17698					}
17699				} else {
17700					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
17701						scrollTop = $('html, body').scrollTop();
17702						$grid.add($body).removeClass('ajax-hide-filters');
17703					}
17704					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
17705						$grid.addClass('ajax-hide-filters-blanks');
17706						$sidebar.hide();
17707					}
17708					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
17709					$('.ajax-sidebar-placeholder', $grid).remove();
17710					sidebar_overlay = false;
17711					$body.removeClass('ajax-filter-sidebar-overlay');
17712					$sidebar_wrapper.removeClass(skin);
17713					if ( data_w !== '' && data_w > 0 ) {
17714						$sidebar.css({
17715							'max-width':'none'
17716						});
17717					}
17718					$vc_row.css({
17719						'padding-top':0,
17720						'padding-bottom':0,
17721					}).removeAttr('data-lenis-prevent');
17722
17723					$inside_row.css({
17724						width: ''
17725					});
17726
17727					if ( f_editor === true ) {
17728						UNCODE.ajax_filters();
17729					}
17730
17731					switchMobile = false;
17732				}
17733				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17734					$('html, body').scrollTop(scrollTop);
17735				}
17736			};
17737
17738			var sidebar_width = function(){
17739				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17740					sidebar_w = $footprint.width();
17741					$sidebar.css({ width: sidebar_w });
17742				} else {
17743					$sidebar.css({ width: '' });
17744				}
17745			};
17746			sidebar_width();
17747
17748			if ( SiteParameters.is_frontend_editor ) {
17749				ajax_sidebar_position();
17750			}
17751
17752			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
17753				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
17754					ajax_sidebar_position(e);
17755				}
17756				sidebar_width();
17757			});
17758
17759			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
17760				ajax_sidebar_position(e, true);
17761			});
17762
17763			$isotope_wrapper.on('transitionend', function(e){
17764				if ( $(e.target).hasClass('isotope-wrapper') ) {
17765					window.dispatchEvent(new CustomEvent('boxResized'));
17766				}
17767				return false;
17768			});
17769
17770			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
17771				var $grid = $('.ajax-grid-system').eq(0);
17772				$grid.addClass('ajax-hide-filters');
17773			}
17774
17775		});
17776	};
17777
17778	init_ajax_grid();
17779	$(document).on('uncode-ajax-filtered', init_ajax_grid);
17780
17781/*************************
17782 *
17783 * Hover hack
17784 *
17785 ************************/
17786 	var widget_hover_hack = function() {
17787 		$('.widget, .uncode_widget').each(function(){
17788			var $widget = $(this),
17789				class_w = $widget.attr('class'),
17790				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
17791				$footer = $widget.closest('#colophon');
17792
17793			if ( class_w.indexOf('widget_yith') > 0 ) {
17794				return true;
17795			}
17796
17797			$lis.each(function(){
17798 				var $li = $(this),
17799 					$a = $('a', $li),
17800 					$label = $a.closest('label');
17801
17802				if ( !$footer.length ) {
17803					$li.addClass('no-evts');
17804				}
17805
17806				if ( ! $('span', $a).length ) {
17807 					$li.addClass( 'li-hover' );
17808 				}
17809
17810 				$('li', $li).hover(function(e){
17811 					$(e.target).parents('li').each(function(){
17812 						$(this).addClass( 'parent-li-hover' );
17813 					});
17814					}, function (e) {
17815 					$(e.target).parents('li').each(function(key, val){
17816 						if ( key === 0) {
17817	 						$(val).removeClass( 'parent-li-hover' );
17818	 					}
17819 					});
17820 				});
17821
17822				$li.off('mouseup').on('mouseup', function (e) {
17823					if (e.which !== 3) {
17824						e.stopPropagation();
17825						var $a = $('a', this).first();
17826						$a[0].click();
17827					}
17828	 			});
17829 			});
17830 		});
17831	  }
17832
17833	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
17834
17835	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
17836		widget_hover_hack();
17837		$(document).on('uncode-ajax-filtered', widget_hover_hack);
17838	}
17839
17840/*************************
17841 *
17842 * Init Filters
17843 *
17844 ************************/
17845
17846	function init_filters() {
17847		$(document).on('click', '.term-filter-link', function(e) {
17848			var _this = $(this);
17849			var widget = _this.closest('.uncode_widget');
17850			var container = get_filters_container();
17851
17852			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17853				return true;
17854			}
17855
17856			e.preventDefault();
17857
17858			if (widget.hasClass('widget-ajax-filters--checkbox')) {
17859				_this.parent().find('input[type="checkbox"]').trigger('click');
17860			} else {
17861				if (_this.hasClass('term-filter-link--active')) {
17862					_this.removeClass('term-filter-link--active');
17863				} else {
17864					_this.addClass('term-filter-link--active');
17865
17866					if (widget.hasClass('widget-ajax-filters--single')) {
17867						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
17868					}
17869				}
17870
17871				if (!ajax_filters_button_mode) {
17872					var url = _this.attr('href');
17873
17874					reload_items(container, url, true);
17875				}
17876			}
17877		});
17878
17879		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
17880			var _this = $(this);
17881			var widget = _this.closest('.uncode_widget');
17882			var link = _this.closest('.term-filter').find('.term-filter-link');
17883			var url = link.attr('href');
17884			var container = get_filters_container();
17885
17886			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
17887				window.location = url;
17888				return;
17889			}
17890
17891			if (widget.hasClass('widget-ajax-filters--single')) {
17892				widget.find('input[type="checkbox"]').each(function() {
17893					if (_this.attr('id') !== $(this).attr('id')) {
17894						$(this).prop('checked', false);
17895						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
17896					}
17897				});
17898			}
17899
17900			if (_this.prop('checked')) {
17901				link.addClass('term-filter-link--active');
17902			} else {
17903				link.removeClass('term-filter-link--active');
17904			}
17905
17906			if (!ajax_filters_button_mode) {
17907				reload_items(container, url, true);
17908			}
17909		});
17910
17911		$(document).on('change', 'select.select--term-filters', function(e) {
17912			var _this = $(this);
17913			var selected = _this.find('option:selected');
17914			var option = $(selected);
17915			var url = option.attr('data-term-filter-url');
17916			var container = get_filters_container();
17917			var widget = _this.closest('.uncode_widget');
17918
17919			if (!ajax_filters_button_mode) {
17920				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17921					window.location = url;
17922				} else {
17923					reload_items(container, url, true);
17924				}
17925			}
17926		});
17927
17928		$(document).on('click', '.filter-list__link', function(e) {
17929			if (SiteParameters.is_frontend_editor) {
17930				return false;
17931			}
17932
17933			e.preventDefault();
17934
17935			var _this = $(this);
17936			var container = get_filters_container();
17937			var url = _this.attr('href');
17938			reload_items(container, url, true);
17939		});
17940
17941		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
17942			var _this = $(this);
17943			var container = get_filters_container();
17944			var url = _this.attr('href');
17945			reload_items(container, url, true);
17946		});
17947
17948		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
17949
17950			var _this = $(this);
17951			var container = get_filters_container();
17952			var url = _this.attr('href');
17953
17954			if ( container.length ) {
17955				e.preventDefault();
17956				reload_items(container, url, true);
17957			}
17958		});
17959
17960		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
17961			var _this = $(this);
17962			var container = get_filters_container();
17963
17964			if (container.length > 0) {
17965				e.preventDefault();
17966
17967				var min_price = $('#min_price').val();
17968				var max_price = $('#max_price').val();
17969				var location = window.location;
17970				var url = location.href;
17971				var page_uri = location.origin + location.pathname;
17972				var is_filtered = page_uri !== url;
17973
17974				if (is_filtered) {
17975					url = remove_parameter_from_url(url, 'min_price');
17976					url = remove_parameter_from_url(url, 'max_price');
17977				}
17978
17979				var concat = page_uri === url ? '?' : '&';
17980				var params = {'min_price': min_price, 'max_price': max_price};
17981
17982				url = url + concat + $.param(params);
17983
17984				reload_items(container, url, true);
17985			}
17986		});
17987
17988		if (!ajax_filters_button_mode && !window._uncode_search_bound) {
17989			window._uncode_search_bound = true;
17990			var search_timeout = parseInt(SiteParameters.ajax_filter_search_timeout, 10);
17991
17992			$(document).on('input', '.term-filters-search-input', function () {
17993				var _this = $(this);
17994				var container = get_filters_container();
17995				var value = _this.val();
17996
17997				if (window._uncode_search_timer) {
17998					clearTimeout(window._uncode_search_timer);
17999				}
18000
18001				window._uncode_search_timer = setTimeout(function () {
18002					update_search_url(container, value);
18003				}, search_timeout);
18004			});
18005		}
18006
18007		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
18008			var container = get_filters_container();
18009
18010			if (container.length) {
18011				e.preventDefault();
18012				var paramMap = {};
18013
18014				$('.term-filter-link--active').each(function () {
18015					collect_from_query(paramMap, this.href.split('?')[1] || '');
18016				});
18017
18018				$('.select--term-filters').each(function () {
18019					var select = $(this);
18020					var val = select.val();
18021
18022					if (!val) {
18023						return
18024					};
18025
18026					var selected_option = select.find('option:selected');
18027					var qUrl = selected_option.data('term-filter-url') || '';
18028
18029					collect_from_query(paramMap, qUrl.split('?')[1] || '');
18030				});
18031
18032				var search = $('.term-filters-search-input');
18033
18034				if (search.length > 0) {
18035					var search_value = search.val().trim();
18036					if (search_value) {
18037						paramMap[SiteParameters.ajax_filter_key_search] = {};
18038						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
18039					}
18040				}
18041
18042				var qsParts = [];
18043				$.each(paramMap, function (key, valSet) {
18044					var vals = Object.keys(valSet);
18045					qsParts.push(key + '=' + vals.join(','));
18046				});
18047
18048				var final_url = window.location.origin + window.location.pathname;
18049
18050				if (qsParts.length > 0) {
18051					qsParts.push('unfilter=1');
18052
18053					var qs = qsParts.join('&');
18054					final_url = '?' + qs;
18055				}
18056
18057				reload_items(container, final_url, true);
18058			}
18059		});
18060	}
18061
18062	function collect_from_query(paramMap, query) {
18063		$.each(query.split('&'), function (_, pair) {
18064			if (!pair) {
18065				return
18066			};
18067
18068			var kv  = pair.split('=');
18069			var key = kv[0];
18070			var val = kv[1] || '';
18071
18072			if (key === 'unfilter') {
18073				return;
18074			}
18075			if (!paramMap[key]) {
18076				paramMap[key] = {}
18077			};
18078
18079			paramMap[key][val] = 1;
18080		});
18081	}
18082
18083	function update_search_url(container, search_value) {
18084		var location = window.location;
18085		var url = location.href;
18086		var page_uri = location.origin + location.pathname;
18087		var is_filtered = page_uri !== url;
18088		var key_search = SiteParameters.ajax_filter_key_search;
18089		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
18090
18091		if (is_filtered) {
18092			url = remove_parameter_from_url(url, key_search);
18093			url = remove_parameter_from_url(url, key_unfilter);
18094		}
18095
18096		if (search_value) {
18097			var concat = page_uri === url ? '?' : '&';
18098			var params = {};
18099
18100			params[key_search] = search_value;
18101			params[key_unfilter] = 1;
18102			url = url + concat + $.param(params);
18103		} else {
18104			url = remove_parameter_from_url(url, key_search);
18105		}
18106
18107		reload_items(container, url, true);
18108	}
18109
18110	function remove_parameter_from_url(url, parameter) {
18111		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
18112	}
18113
18114	function get_filters_container() {
18115		var container = $('.ajax-grid-system');
18116
18117		if (container.length == 0) {
18118			container = $('.ajax-filters-target');
18119		}
18120
18121		return container;
18122	}
18123
18124	function update_widgets_state(widgets_states, container) {
18125		for (var i = widgets_states.length - 1; i >= 0; i--) {
18126			var state = widgets_states[i];
18127
18128			if (!state.collapse) {
18129				continue;
18130			}
18131
18132			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
18133
18134			if (state.open) {
18135				new_widget.find('.widget-title').addClass('open');
18136				if (state.css) {
18137					new_widget.find('.widget-collapse-content').attr('style', state.css);
18138				}
18139			} else {
18140				new_widget.find('.widget-title').removeClass('open');
18141				if (state.css) {
18142					new_widget.find('.widget-collapse-content').attr('style', state.css);
18143				}
18144			}
18145		}
18146	}
18147
18148	// Find filters container
18149	function find_filters_container(context) {
18150		const widget = context.find('.widget-ajax-filters').first();
18151		if (!widget.length) return $();
18152
18153		const sidebar = widget.closest('.ajax-filters-sidebar');
18154		if (sidebar.length) {
18155			return sidebar.find('.uncol').last();
18156		}
18157
18158		const col = widget.closest('.uncol');
18159		if (col.length) {
18160			return col;
18161		}
18162
18163		return $();
18164	}
18165
18166	// Reload items via AJAX
18167	function reload_items(container, url, push) {
18168		if (isAjaxing) {
18169			return
18170		};
18171
18172		isAjaxing = true;
18173
18174		container.addClass('grid-filtering');
18175
18176		$.ajax({
18177			url     : url,
18178			success : function(response) {
18179				if (!response) {
18180					return;
18181				}
18182
18183				$(document).trigger('uncode-ajax-pre-filtered');
18184
18185				var container_id = container.attr('id');
18186				var pagination = $('.row-navigation');
18187				var filters_container;
18188
18189				var isTargetFilterMode = container.hasClass('ajax-filters-target');
18190
18191				if (isTargetFilterMode) {
18192					filters_container = find_filters_container($(document));
18193				}
18194
18195				if (container_id) {
18196					var container_to_append = $(response).find('#' + container_id);
18197					var pagination_to_append = $(response).find('.row-navigation');
18198					var filters_to_append;
18199					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18200
18201					if (isTargetFilterMode) {
18202						filters_to_append = find_filters_container($(response));
18203					}
18204
18205					// Remember open/closed widgets
18206					var widgets = $('.uncode_widget');
18207					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
18208					var widgets_states = [];
18209
18210					widgets.each(function() {
18211						var widget = $(this);
18212						var id = widget.attr('data-id');
18213						var state = {
18214							'id': id,
18215							'collapse': false,
18216							'open': false,
18217							'css': false,
18218						};
18219
18220						var collapse_wrapper = widget.find('.widget-collapse-content');
18221
18222						if (collapse_wrapper.length > 0) {
18223							state.collapse = true;
18224
18225							var collapse_wrapper_css = collapse_wrapper.attr('style');
18226							var title = widget.find('.widget-title');
18227
18228							state.css = collapse_wrapper_css;
18229
18230							if (title.hasClass('open')) {
18231								state.open = true;
18232							} else {
18233								state.open = false;
18234							}
18235						}
18236
18237						widgets_states.push(state);
18238					});
18239
18240					// Update widgets state when it is not in target mode
18241					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
18242						update_widgets_state(widgets_states, container_to_append);
18243					}
18244
18245					// Update default sidebar state
18246					if (!container.hasClass('ajax-hide-filters')) {
18247						container_to_append.removeClass('ajax-hide-filters');
18248					}
18249
18250					// Update horizontal sidebar
18251					if (!container.hasClass('ajax-hide-filters-blanks')) {
18252						container_to_append.removeClass('ajax-hide-filters-blanks');
18253					}
18254					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
18255					if (horizontal_sidebar_wrapper.length > 0) {
18256						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
18257						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
18258						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
18259						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
18260
18261						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
18262						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
18263					}
18264
18265					// Append container
18266					container.replaceWith(container_to_append);
18267
18268					// Hide first thumbnail until the new srcset is loaded
18269					if (SiteParameters.dynamic_srcset_active === '1') {
18270						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
18271					}
18272
18273					// Remove loading attribute to images
18274					container_to_append.find('img').attr('loading', '');
18275
18276					// Append pagination
18277					if (pagination.length > 0) {
18278						if (pagination_to_append.length > 0) {
18279							pagination.html(pagination_to_append.html());
18280						} else {
18281							pagination.html('');
18282						}
18283					} else {
18284						if (pagination_to_append.length > 0) {
18285							$('.post-wrapper').append(pagination_to_append);
18286						}
18287					}
18288
18289					// Append filters
18290					if (isTargetFilterMode && filters_container.length > 0) {
18291						filters_container.html(filters_to_append.html());
18292					}
18293
18294					// Update widgets state when it is in target mode
18295					if (isTargetFilterMode && filters_container.length > 0) {
18296						update_widgets_state(widgets_states, filters_container);
18297					}
18298
18299					// Update off canvas sidebar (mobile and overlay)
18300					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18301
18302					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
18303						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
18304						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
18305						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
18306						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
18307
18308						// Update widgets state
18309						update_widgets_state(widgets_states, sidebar_to_append);
18310
18311						// Update sidebar
18312						sidebar_container.html(sidebar_to_append.html());
18313					}
18314
18315					if (push) {
18316						UNCODE.lastURL = url;
18317						window.history.pushState(
18318							{ pageTitle: document.title },
18319							'',
18320							url
18321						);
18322					}
18323
18324					if (typeof UNCODE.isotopeLayout !== 'undefined') {
18325						UNCODE.isotopeLayout();
18326					}
18327					if (typeof UNCODE.justifiedGallery !== 'undefined') {
18328						UNCODE.justifiedGallery();
18329					}
18330					if (typeof UNCODE.cssGrid !== 'undefined') {
18331						UNCODE.cssGrid();
18332					}
18333					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
18334						UNCODE.lightbox();
18335					}
18336					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
18337						UNCODE.lightgallery();
18338					}
18339					if (typeof UNCODE.carousel !== 'undefined') {
18340						UNCODE.carousel($('body'));
18341					}
18342					UNCODE.animations();
18343					if (typeof UNCODE.filters !== 'undefined') {
18344						UNCODE.filters();
18345					}
18346					if (typeof UNCODE.widgets !== 'undefined' && !(isTargetFilterMode && filters_container.length > 0)) {
18347						UNCODE.widgets();
18348					}
18349
18350					if (SiteParameters.dynamic_srcset_active === '1') {
18351						UNCODE.refresh_dynamic_srcset_size();
18352					}
18353
18354					if (typeof UNCODE.menuSmartInit !== 'undefined') {
18355						UNCODE.menuSmartInit();
18356					}
18357
18358					if (typeof UNCODE.parallax !== 'undefined') {
18359						UNCODE.parallax();
18360					}
18361
18362					maybe_scroll_to_top();
18363
18364					var woo_select2_cats = $('.dropdown_product_cat');
18365
18366					if (woo_select2_cats.length > 0) {
18367						woo_select2_cats.on( 'change', function() {
18368							if ( $(this).val() != '' ) {
18369								var this_page = '';
18370								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
18371								if ( home_url.indexOf( '?' ) > 0 ) {
18372									this_page = home_url + '&product_cat=' + $(this).val();
18373								} else {
18374									this_page = home_url + '?product_cat=' + $(this).val();
18375								}
18376								location.href = this_page;
18377							} else {
18378								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
18379							}
18380						});
18381
18382						if ( $().selectWoo ) {
18383							var wc_product_cat_select = function() {
18384								woo_select2_cats.selectWoo( {
18385									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
18386									minimumResultsForSearch: 5,
18387									width: '100%',
18388									allowClear: true,
18389									language: {
18390										noResults: function() {
18391											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
18392										}
18393									}
18394								} );
18395							};
18396							wc_product_cat_select();
18397						}
18398					}
18399
18400					$(document).trigger('uncode-ajax-filtered');
18401					$(document.body).trigger('init_price_filter');
18402					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
18403					window.document.dispatchEvent(new Event("DOMContentLoaded", {
18404						bubbles: true,
18405						cancelable: true
18406					}));
18407
18408					isAjaxing = false;
18409				}
18410			},
18411			error: function() {
18412				container.removeClass('grid-filtering');
18413
18414				isAjaxing = false;
18415
18416				if (SiteParameters.enable_debug == true) {
18417					// This console log is disabled by default
18418					// So nothing is printed in a typical installation
18419					//
18420					// It can be enabled for debugging purposes setting
18421					// the 'uncode_enable_debug_on_js_scripts' filter to true
18422					console.log('There was an error retrieving the products');
18423				}
18424			}
18425		});
18426	}
18427
18428	// Scroll to top after filtering
18429	function maybe_scroll_to_top() {
18430		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18431
18432		if (offcanvas_sidebar_wrapper.length > 0) {
18433			return;
18434		}
18435
18436		var container = get_filters_container();
18437		var bound = container[0].getBoundingClientRect();
18438
18439		if (bound.y < 0) {
18440			$(window).scrollTop(container.offset().top);
18441		}
18442	}
18443
18444	// Back/forward browser buttons
18445	$(window).on("popstate.ajaxfilters", function(e) {
18446		var location = window.location;
18447		var url = location.href;
18448		var params = UNCODE.getURLParams(window.location);
18449		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
18450
18451		UNCODE.lastURL = url;
18452
18453		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
18454			return;
18455		}
18456
18457		var container = get_filters_container();
18458
18459		reload_items(container, url, false);
18460	});
18461
18462	// Destroy load more before to init a new one
18463	$(window).on('uncode-ajax-pre-filtered', function() {
18464		if ($.fn.infinitescroll) {
18465			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
18466		}
18467	});
18468
18469	init_filters();
18470};
18471
18472UNCODE.videoThumbs = function() {
18473	var checkResize,
18474		newW = UNCODE.wwidth;
18475	var checkForVideos = function(){
18476
18477		$(window).on('okevents.y.change', function(e, y){
18478			var $video = $(y.target.g),
18479				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18480				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18481				restart = !$video_wrap.hasClass('play-pause'),
18482				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18483				setTime;
18484			if ( newW >= UNCODE.mediaQuery ) {
18485
18486				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
18487					$video_wrap.data('hovered', true);
18488					$video_wrap.addClass('played-on');
18489					y.target.pauseVideo();
18490					$tmb.on('mouseenter', function(){
18491						if ( restart ) {
18492							y.target.seekTo(0);
18493						}
18494						y.target.playVideo();
18495					}).on('mouseleave', function(){
18496						clearTimeout(setTime);
18497						setTime = setTimeout(function(){
18498							y.target.pauseVideo();
18499						}, 300);
18500					});
18501				}
18502
18503			} else {
18504				if( $mobile_video_wrap.length ) {
18505					$video_wrap.addClass('played-on');
18506					y.target.playVideo();
18507				}
18508			}
18509
18510		});
18511
18512		$(window).on('okevents.v.loaded', function(e, playerV){
18513			var $video = $(playerV.element),
18514				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18515				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18516				restart = !$video_wrap.hasClass('play-pause'),
18517				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
18517: $video.closest('.t-entry-visual, .un-inline-image'),
18518				setTime;
18519
18520			if ( newW >= UNCODE.mediaQuery ) {
18521				
18522				if( $video_wrap.length ) {
18523
18524					var playPromise = playerV.play();
18525					if (playPromise !== undefined) {
18526						playPromise.then(function( value ) {
18527							playerV.pause();
18528						});
18529					}
18530					$video_wrap.addClass('played-on');
18531					$tmb.on('mouseenter', function(){
18532						if ( restart ) {
18533							playerV.setCurrentTime(0)
18534						}
18535						playerV.play();
18536					}).on('mouseleave', function(){
18537						clearTimeout(setTime);
18538						setTime = setTimeout(function(){
18539							playerV.pause();
18540						}, 300);
18541					});
18542				}
18543
18544			} else {
18545
18546				if( $mobile_video_wrap.length ) {
18547					var playPromise = playerV.play();
18548					if (playPromise !== undefined) {
18549						playPromise.then(function( value ) {
18550							playerV.play();
18551						});
18552					}
18553					$video_wrap.addClass('played-on');
18554				}
18555			}
18556		});
18557
18558		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
18559			var $video = $(video),
18560				$noscript = $('noscript', $video),
18561				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18562				restart = !$video_wrap.hasClass('play-pause'),
18563				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18564				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18565				setTime,
18566			manageVideo = function(){
18567				video.currentTime = 0;
18568				video.pause();
18569				if ( newW >= UNCODE.mediaQuery ) {
18570					if ( $video_wrap.length ) {
18571						$video_wrap.addClass('played-on');
18572						$tmb.on('mouseenter', function(){
18573							if ( restart ) {
18574								video.currentTime = 0;
18575							}
18576							video.play();
18577						}).on('mouseleave', function(){
18578							clearTimeout(setTime);
18579							setTime = setTimeout(function(){
18580								video.pause();
18581							}, 300);
18582						});
18583					} else {
18584						video.play();
18585					}
18586				} else {
18587					if ( $mobile_video_wrap.length ) {
18588						$mobile_video_wrap.addClass('played-on');
18589						video.play();
18590					}
18591				}
18592
18593			};
18594			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
18595				$noscript.each(function(key, val){
18596					$noscript.after(val.textContent || val.innerText || val.innerHTML);
18597					$noscript.remove();
18598				});
18599			}
18600
18601			if (typeof MediaElement === "function") {
18602				$video.has('source[src]').mediaelementplayer({
18603					pauseOtherPlayers: false,
18604				});
18605			}
18606			if (video.readyState > 0) {
18607				manageVideo();
18608			} else {
18609				window.addEventListener("pageshow", function (event) {
18610					if (event.persisted) {
18611						manageVideo();
18612					}
18613				});				
18614				$video.on("loadedmetadata", function(_event) {
18615					manageVideo();
18616				});
18617			};
18618		});
18619	
18620	};
18621	
18622	checkForVideos();
18623
18624	var checkVideoResize = function(){
18625		clearRequestTimeout(checkResize);
18626		checkResize = requestTimeout(function(){
18627			if ( newW !== UNCODE.wwidth ) {
18628				checkForVideos();
18629				newW = UNCODE.wwidth;
18630			}
18631		}, 1000);
18632	};
18633
18634	$(window).off('resize.videos', checkVideoResize)
18635	.on( 'resize.videos', checkVideoResize);
18636
18637	$(window).off('more-items-loaded.videos', checkForVideos)
18638	.on('more-items-loaded.videos', checkForVideos);
18639
18640	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
18641	.on('uncode-ajax-filtered.videos', checkForVideos);
18642
18643};
18644UNCODE.inlineImgs = function() {
18645    var linkInlineImgs = function(){
18646        $('.un-inline-image').each(function(){
18647            var $img = $(this),
18648                href = $(this).attr('data-link-href'),
18649                dataImg = $img.data();
18650			if ( dataImg != '' && href != null && href !== '' ) {
18651                var class_stra_a = 'unline-image-link';
18652                if ( $(this).hasClass('un-inline-space-over') ) {
18653                    class_stra_a += ' un-inline-space-over';
18654                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
18655                    class_stra_a += ' un-inline-space-gutter';
18656                }
18657                var str_a = '<a class="' + class_stra_a + '" ';
18658                for (var key in dataImg) {
18659                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
18660                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
18661                    }
18662                }
18663                str_a += ' />';
18664                $img.wrap(str_a);
18665			}
18666        });
18667    };
18668    $(window).on('load', linkInlineImgs );
18669};
18670UNCODE.lottie = function() {
18671    if ( SiteParameters.is_frontend_editor ) {
18672        var $lottie_wraps = $('div.uncode-lottie-wrap');
18673        $lottie_wraps.each(function(){
18674            var $lottie_wrap = $(this),
18675                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
18676                $player_clone = $div_player.clone(),
18677                player_id = $div_player.attr('data-id'),
18678                $lottie_players = $('lottie-player', $lottie_wrap).remove();
18679            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
18680                if ( $('#'+player_id).length ) {
18681                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
18682                }
18683                $player_clone.attr('id', player_id);
18684                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
18685                $div_player.after($player_clone);
18686                $div_player.attr('data-init',true);
18687            }
18688        });
18689    }
18690    var $players = $('.uncode-lottie-wrap lottie-player');
18691    $players.each(function(){
18692        var player = this,
18693            this_id = $(player).attr('id'),
18694            _player = document.getElementById(this_id),
18695            trigger = $(player).attr('data-trigger'),
18696            pFrames = $(player).attr('data-frames').split(','),
18697            srcPlayer = $(player).attr('src');
18698
18699        _player.load(srcPlayer);
18700
18701        _player.addEventListener("ready", function() {
18702
18703            var $_shadow = _player.shadowRoot;
18704            $($_shadow).find('.error').remove();
18705
18706            var tFrames = _player.getLottie().totalFrames / 100,
18707                pFrame_from = Math.round(tFrames * pFrames[0]),
18708                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
18709                loop = $(player).attr('loop'),
18710                mode,
18711                actions;
18712
18713            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
18714                if ( trigger === 'scroll' ) {
18715                    mode = 'scroll';
18716                    actions = [
18717                        {
18718                            visibility:[0, 1.0],
18719                            type: "seek",
18720                            frames: [pFrame_from, pFrame_to],
18721                        }
18722                    ];
18723                } else if ( trigger === 'viewport') {
18724                    mode = 'scroll';
18725                    actions = [
18726                        {
18727                            visibility: [0.20, 1.0],
18728                            frames: [pFrame_from, pFrame_to],
18729                            type: loop ? "loop" : "play"
18730                        }
18731                    ];
18732                } else if ( trigger === 'hover') {
18733                    $(player).on('mouseenter', function(){
18734                        _player.play();
18735                    }).on('mouseleave', function(){
18736                        _player.pause();
18737                    });
18738                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
18739                        _player.seek(pFrame_from);
18740                        _player.addEventListener("frame", function(){
18741                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
18742                                _player.seek(pFrame_from);
18743                            }
18744                        });
18745                    }
18746                }
18747                LottieInteractivity.create({
18748                    player: '#' + this_id,
18749                    mode: mode,
18750                    actions: actions
18751                });
18752            } else {
18753                if ( pFrame_from > 0 && pFrame_from < 99 ) {
18754                    _player.seek(pFrame_from);
18755                    _player.addEventListener("frame", function(){
18756                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
18757                            _player.seek(pFrame_from);
18758                        }
18759                    });
18760                }
18761            }
18762        });
18763
18764        $(window).on('unlottie-destroy', function(){
18765            _player.destroy();
18766        });
18767    });
18768};
18769
18770UNCODE.animatedBgGradient = function( _el ) {
18771
18772    var ev;
18773
18774	if ( typeof _el === 'undefined' || _el === null ) {
18775        _el = document;
18776        ev = false;
18777	} else {
18778        _el = _el[0];
18779        ev = 'shortcode:update';
18780    }
18781
18782    var simplex = new SimplexNoise();
18783
18784    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
18785		this.block = blockOverlay;
18786		this.wrap = canvasWrap;
18787		this.config();
18788		this.checker();
18789		this.loopRAF();
18790        this.animLoader();
18791    };
18792
18793    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
18794
18795    AnimGradient.config = function() {
18796        this.canvas = document.createElement('canvas');
18797        this.wrap.appendChild(this.canvas);
18798        this.ctx = this.canvas.getContext('2d');
18799        this.count = 0;        
18800        this.isOrientationChanged = false;
18801        this.res = UNCODE.isMobile ? 90 : 110;
18802        this.resPercent = 100/this.res;
18803        this.resAround = this.resPercent/100;
18804        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;
18805
18806        this.canvas.classList.add('uncode-bg-animated-gradient');
18807        this.canvas.setAttribute('height', this.res);
18808        this.canvas.setAttribute('width', this.res);
18809        this.canvas.style = 'height: 100%; position: relative; width:100%;';
18810
18811        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
18812
18813        this.cx = this.canvas.width/2;
18814        this.cy = this.canvas.height/2;
18815        this.data = this.imgdata.data;
18816
18817        this.opts = {
18818            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,
18819            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,
18820            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
18821        };
18822
18823        this.lavaTime = 1;
18824        this.bg_colors = [];
18825
18826        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
18827            return;
18828        }
18829
18830        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
18831            this.singleColor = true;
18832        }
18833
18834        if( this.opts.col_1st ) {
18835
18836            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
18837
18838            this.bg_colors.push({
18839                r: rgbColor1.r,
18840                g: rgbColor1.g,
18841                b: rgbColor1.b
18842            });
18843        }
18844
18845        if( this.opts.col_2nd ) {
18846
18847            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
18848
18849            this.bg_colors.push({
18850                r: rgbColor2.r,
18851                g: rgbColor2.g,
18852                b: rgbColor2.b
18853            });
18854        }
18855
18856    };
18857
18858    AnimGradient.checker = function() {
18859        var scope = this;
18860        this.checkInViewPort();
18861      
18862        window.addEventListener('resize', function() {
18863            if(UNCODE.isMobile && !scope.isOrientationChanged) {
18864                return;
18865            }
18866            scope.ratioCalc();
18867        });
18868
18869        window.addEventListener("orientationchange", function() {
18870            scope.isOrientationChanged = true;
18871        });
18872
18873        this.ratioCalc();
18874    }; 
18875
18876    AnimGradient.ratioCalc = function() {
18877      
18878        var blockW = this.block.clientWidth,
18879            blockH = this.block.clientHeight;
18880
18881        if ( blockH == 0 || blockW == 0 )
18882            return;
18883
18884        var blockRatio = blockH/blockW;
18885
18886        if(blockRatio < 1) {
18887            this.ratioParam = {
18888                x: 1.4,
18889                y: blockRatio*1.4
18890            }
18891        } else {
18892            this.ratioParam = {
18893                x: blockRatio/3,
18894                y: 1
18895            }
18896        }
18897         
18898    };
18899
18900    AnimGradient.checkInViewPort = function() {
18901        var scope = this;
18902        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
18903            scope.isInViewport = true;
18904        } else if( 'IntersectionObserver' in window ) {
18905		    var observer = new IntersectionObserver(function(entries) {
18906  
18907                entries.forEach(function(entry){
18908                    if ( entry.isIntersecting ) {
18909                        scope.isInViewport = true;
18910                    } else {
18911                        scope.isInViewport = false;
18912                    }
18913                });
18914  
18915		    }, { 
18916			root: document,
18917		  });
18918  
18919		  observer.observe(scope.block);
18920		}
18921	};
18922	
18923    AnimGradient.hexToRGB = function(hexval) {
18924        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
18925        if (!hexecuted) {
18926            return false;
18927        }
18928        return {
18929            r: parseInt(hexecuted[1], 16),
18930            g: parseInt(hexecuted[2], 16),
18931            b: parseInt(hexecuted[3], 16)
18932        }
18933    };
18934
18935    AnimGradient.factor = function(val_1, val_2, lava) { 
18936        return val_1 * (1 - lava) + val_2 * lava;
18937    };
18938
18939    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
18940        if (this.singleColor) {
18941            return this.bg_colors[0][wave_l];
18942        }
18943        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 );
18944        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
18945    };
18946
18947    AnimGradient.lava = function(x, y, grade) {
18948        var radians = (Math.PI / 180) * grade,
18949        cos = Math.cos(radians),
18950        sin = Math.sin(radians),
18951        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
18952        return nx;
18953    };
18954    
18955    AnimGradient.loopRAF = function() {
18956
18957      var scope = this;
18958
18959        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
18960            for (var x = 0; x < this.res; x++) {
18961                for (var y = 0; y < this.res; y++) {
18962                    
18963                    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
18964        
18965                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
18966                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
18967                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
18968                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
18969                  
18970                }
18971            }
18972   
18973            this.count++;
18974          
18975            this.ctx.putImageData(this.imgdata, 0, 0);
18976         
18977        }
18978
18979        requestAnimationFrame(function() {
18980            scope.loopRAF();
18981        });
18982    };
18983
18984    AnimGradient.animLoader = function() {
18985        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
18986    };
18987
18988    var anim_init = function() {
18989        var bgs = _el.querySelectorAll('.block-bg-overlay');
18990      
18991        bgs.forEach(function(blockOverlay) {
18992            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
18993            if( !blockOverlay || !canvasWrap ) {
18994                return;
18995            }
18996            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
18997        });
18998    }
18999
19000    $(window).on('load', function(){
19001        anim_init();
19002    });
19003
19004    if ( ev === 'shortcode:update' ) {
19005        anim_init();
19006    }
19007
19008};
19009UNCODE.multibg = function(){
19010	var $bgsWraps = $('.uncode-multi-bgs'),
19011		$body = $('body');
19012	$bgsWraps.each(function(){
19013		var $bgWrap = $(this),
19014			transition = $bgWrap.attr('data-transition'),
19015			transitionTime = $bgWrap.attr('data-transition-time'),
19016			dataPace = $bgWrap.attr('data-transition-pace'),
19017			dataThreshold = $bgWrap.attr('data-transition-threshold'),
19018			dataTime = $bgWrap.attr('data-carousel-time'),
19019			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
19020			random = $bgWrap.attr('data-multi-random'),
19021			_bgWrap = $bgWrap[0],
19022			$multiBgs = $('.multi-background', $bgWrap),
19023			imgFirst,
19024			bgAmount = $multiBgs.length,
19025			isInViewport = false,
19026			lastScrollTop = 0,
19027			counter = 0,
19028			totMove = 0,
19029			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
19030			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
19031			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
19032			offX, offY,
19033			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
19034			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
19035			requestCarousel,
19036			is_header = $bgWrap.closest('#page-header').length,
19037			startTime = new Date();
19038
19039		transition = typeof transition === 'undefined' ? '' : transition;
19040
19041		if ( random === 'true' ) {
19042			UNCODE.shuffle($multiBgs);
19043		}
19044
19045		$multiBgs.find('.background-inner').attr('data-active','false');
19046
19047		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
19048
19049		var loadFirst = function(){
19050			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
19051				opacity: 1
19052			}, 250, 'easeInQuad').css({
19053				zIndex: 1
19054			});	
19055		}
19056
19057		var loadError = function(){
19058			console.log('Multi BG loading error');
19059		}
19060
19061		if ( imgFirst && imgFirst !== 'none' ) {
19062			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
19063		} else {
19064			loadFirst();
19065		}
19066
19067		var loadSlides = function( $thisBg ){
19068			$thisBg.attr('data-load', 'loaded');	
19069		}
19070
19071		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
19072			var $thisBg = $(val);
19073
19074			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
19075
19076				var _imgBg = $(val).find('.background-inner').css('background-image');
19077
19078				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
19079					$thisBg.attr('data-load', 'loaded');
19080				} else {
19081					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
19082					if ( typeof _imgBg !== 'undefined' ) {
19083						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
19084					}
19085				}
19086			}
19087		});
19088					
19089		var multiCarousel = function(e) {
19090
19091			clearRequestTimeout(requestCarousel);
19092
19093			var checkTime = new Date();
19094			if ( checkTime - startTime >= carouselTime && isInViewport ) {
19095				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
19096
19097				if ( $checkEl.attr('data-load') !== 'loaded' ) {
19098					requestTimeout(function(){
19099						multiCarousel();
19100					}, 100);
19101					return;
19102				}
19103
19104				counter++;
19105
19106				$multiBgs.each(function(ind, val){
19107					if ( ind === counter%bgAmount ) {
19108						$(val).stop(true,false).animate({
19109							opacity: 1
19110						}, wait, 'easeInQuad').css({
19111							zIndex: 1
19112						}).find('.background-inner').attr('data-active','true');
19113					} else {
19114						$(val).stop(true,false).animate({
19115							opacity: 0
19116						}, wait, 'easeInQuad', function(){
19117							$(val).find('.background-inner').attr('data-active','false');
19118						}).css({
19119							zIndex: 0
19120						});
19121					}
19122				});
19123
19124			}
19125
19126			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
19127				requestCarousel = requestTimeout(multiCarousel, carouselTime);
19128			}
19129	
19130		};
19131
19132		var multiMove = function(e) {
19133			if ( $body.hasClass('navbar-hover') ) {
19134				return;
19135			}
19136			var checkTime = new Date(),
19137                bound = $bgWrap[0].getBoundingClientRect(),
19138                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
19139			if (offX) {
19140				totMove += Math.sqrt(
19141					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
19142				);
19143			}
19144			if (
19145                totMove >= pace && 
19146                checkTime - startTime >= wait &&
19147                e.clientX <= (bound.left + bound.width) &&
19148                e.clientX >= bound.left &&
19149                e.clientY <= (bound.top + bound.height) &&
19150                e.clientY >= bound.top
19151            ) {
19152				counter++;
19153				startTime = checkTime;
19154				$multiBgs.each(function(ind, val){
19155					if ( ind === counter%bgAmount ) {
19156						$(val).stop(true,false).animate({
19157							opacity: 1
19158						}, wait, 'easeInQuad').css({
19159							zIndex: 1
19160						}).find('.background-inner').attr('data-active','true');
19161					} else {
19162						$(val).stop(true,false).animate({
19163							opacity: 0
19164						}, wait, 'easeInQuad', function(){
19165							$(val).find('.background-inner').attr('data-active','false');
19166						}).css({
19167							zIndex: 0
19168						});
19169					}
19170				});
19171
19172				totMove = 0;
19173			}
19174			
19175			offX = e.clientX;
19176			offY = e.clientY;
19177			
19178		};
19179
19180		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19181			document.addEventListener("mousemove", multiMove);
19182		}
19183
19184		window.addEventListener('resize', function() {
19185			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19186				document.removeEventListener("mousemove", multiMove);
19187				document.addEventListener("mousemove", multiMove);
19188			}
19189		});
19190
19191		var lightLoopRAF = function() {
19192
19193			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
19194				checkTime = new Date(),
19195				bound = $bgWrap[0].getBoundingClientRect(),
19196				thresholdHeader = is_header ? 100 : threshold,
19197				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
19198			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
19199				counter++;
19200				lastScrollTop = scrollTop;
19201				startTime = checkTime;
19202
19203				$multiBgs.each(function(ind, val){
19204					if ( ind === counter%bgAmount ) {
19205						$(val).stop(true,false).animate({
19206							opacity: 1
19207						}, wait, 'easeInQuad').css({
19208							zIndex: 1
19209						}).find('.background-inner').attr('data-active','true');
19210					} else {
19211						$(val).stop(true,false).animate({
19212							opacity: 0
19213						}, wait, 'easeInQuad', function(){
19214							$(val).find('.background-inner').attr('data-active','false');
19215						}).css({
19216							zIndex: 0
19217						});
19218					}
19219				});
19220
19221			}
19222
19223			requestAnimationFrame(function() {
19224				if ( isInViewport ) {
19225					lightLoopRAF();
19226				}
19227			});
19228		};
19229
19230		var currentInd = 0;
19231
19232		var loopRAF = function() {
19233
19234			var multiBgRotate = function(slideInd){
19235				currentInd = slideInd;
19236				$multiBgs.each(function(ind, val){
19237					if ( ind === slideInd ) {
19238						$(val).stop(true,false).animate({
19239							opacity: 1
19240						}, wait, 'easeInQuad').css({
19241							zIndex: 1
19242						}).find('.background-inner').attr('data-active','true');
19243					} else {
19244						$(val).stop(true,false).animate({
19245							opacity: 0
19246						}, wait, 'easeInQuad', function(){
19247							$(val).find('.background-inner').attr('data-active','false');
19248						}).css({
19249							zIndex: 0
19250						});
19251					}
19252				});
19253			};
19254			var bound = $bgWrap[0].getBoundingClientRect(),
19255				thresholdPX = UNCODE.wheight * threshold / 100,
19256				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
19257				movePX = totMove / bgAmount,
19258				moving = UNCODE.wheight - (bound.top + thresholdPX),
19259				slideInd = 0;
19260
19261			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
19262				multiBgRotate(0);
19263			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
19264				multiBgRotate(bgAmount-1);
19265			} else {
19266				slideInd = Math.ceil(moving/movePX) - 1;
19267				if ( slideInd < 0 ) {
19268					slideInd = 0;
19269				} else if ( slideInd >= bgAmount ) {
19270					slideInd = bgAmount-1;
19271				}
19272				if ( slideInd !== currentInd ) {
19273					multiBgRotate(slideInd);
19274				}
19275			}
19276
19277			requestAnimationFrame(function() {
19278				if ( isInViewport ) {
19279					loopRAF();
19280				}
19281			});
19282		};
19283
19284		if( 'IntersectionObserver' in window ) {
19285		    var observer = new IntersectionObserver(function(entries) {
19286  
19287                entries.forEach(function(entry){
19288                    if ( entry.isIntersecting ) {
19289                        isInViewport = true;
19290						if ( transition === 'scroll' ) {
19291							if ( autoScroll ) {
19292								loopRAF();
19293							} else {
19294								lightLoopRAF();
19295							}
19296						} else {
19297							multiCarousel();
19298						}
19299                    } else {
19300                        isInViewport = false;
19301                   }
19302                });
19303  
19304		    }, { 
19305				root: document,
19306				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
19307		  	});
19308
19309			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19310		  		observer.observe(_bgWrap);
19311			}
19312
19313			window.addEventListener('resize', function() {
19314				observer.unobserve(_bgWrap);
19315				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19316					observer.observe(_bgWrap);
19317				}
19318			});
19319	
19320		}
19321
19322	});
19323}
19324
19325UNCODE.owlNav = function(target, ev) {
19326    target = target.replace(/#\S+/g, '');
19327    var $carousel = $('#'+target),
19328        $slider = $carousel.closest('.uncode-slider'),
19329        $checkNavs = $('.uncode-owl-nav');
19330    if ( !$checkNavs.length ) {
19331        return;
19332    }
19333
19334    if ( $slider.length ){
19335        target = $slider.attr('id');
19336    }
19337
19338    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
19339        $row;
19340
19341    if ( ! $navs.length ) {
19342        $row = $carousel.closest('.vc_row.row-container');
19343        $navs = $('.uncode-owl-nav:not([data-target])', $row);
19344    }
19345        
19346    if ( ! $navs.length ) {
19347        return;
19348    }
19349
19350    $navs.each(function(){
19351        var $nav = $(this),
19352            $outer = $nav.closest('.uncode-owl-nav-out'),
19353            $inner = $nav.find('.uncode-owl-nav-in'),
19354            $navDots = $('.uncode-nav-dots', $nav),
19355            $navCounter = $('.uncode-nav-counter', $nav),
19356            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
19357            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
19358            skinInherit = $nav.hasClass('skin-inherit'),
19359            digit = parseFloat($nav.attr('data-digit')),
19360            counterDigit = parseFloat($nav.attr('data-counter-digit')),
19361            navSpeed = parseFloat($carousel.attr('data-navspeed'));
19362        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
19363
19364        if ( $nav.hasClass('pos-abs') ){
19365            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
19366                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
19367            }
19368            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
19369        } 
19370
19371        $carousel.on('refreshed.owl.carousel', counter);
19372        $carousel.on('resized.owl.carousel', counter);
19373        $carousel.on('changed.owl.carousel', counter);
19374
19375        if ( $carousel.closest('.un-submenu').length ) {
19376            $carousel.on('initialized.owl.carousel', counter);
19377        }
19378
19379        var totalSlides = 0;
19380
19381        function counter(event) {
19382            if (!event.namespace) {
19383                return;
19384            }
19385            var slides = event.relatedTarget,
19386                current = slides._current,
19387                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
19388                item = event.item,
19389                page = event.page,
19390                countPages = Math.ceil(item.count / page.size),
19391                $currentSlide = $carousel.find('.owl-item').eq(current),
19392                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
19393                activeSlide = Math.ceil(itemIndex / page.size),
19394                $prev = $nav.find('.uncode-nav-prev'),
19395                $next = $nav.find('.uncode-nav-next'),
19396                $col = $currentSlide.find('.uncol').first();
19397
19398            if ( totalSlides != countPages ) {
19399                totalSlides = countPages;
19400                $navDots.html('');
19401                var nav_html = '';
19402                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
19403                    var padN = sl_ind+1;
19404                    if ( digit && digit > 1 ) {
19405                        padN = String(padN).padStart(digit, '0');
19406                    }
19407                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
19408                }
19409                $navDots.html(nav_html);
19410
19411                var totalSlidesDigit = totalSlides;
19412
19413                if ( counterDigit && counterDigit > 1 ) {
19414                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
19415                }
19416                $counterTotal.html(totalSlidesDigit);
19417            }
19418
19419            if ( loop !== true ) {
19420                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
19421                if ( itemIndex === 1 ) {
19422                    $prev.addClass('uncode-nav-disabled');
19423                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
19424                    $next.addClass('uncode-nav-disabled');
19425                    activeSlide = Math.ceil(item.count / page.size);
19426                }
19427            }
19428
19429            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
19430            var activeSlideDigit = activeSlide;
19431
19432            if ( counterDigit && counterDigit > 1 ) {
19433                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
19434            }
19435            $counterIndex.html(activeSlideDigit);
19436
19437            if ( skinInherit ) {
19438                if ( $col.hasClass('style-light') ){
19439                    $nav.removeClass('style-dark').addClass('style-light');
19440                } else if ( $col.hasClass('style-dark') ) {
19441                    $nav.removeClass('style-light').addClass('style-dark');
19442                }
19443            }
19444
19445            $inner.removeClass('uncode-owl-nav-waiting');
19446
19447            if ( $nav.hasClass('outer-width') ) {
19448                var navW = $nav.outerWidth(),
19449                    nexW = $next.outerWidth(),
19450                    prevW = $prev.outerWidth(),
19451                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
19452
19453                if ( $nav.hasClass('h-align-justify') ) {
19454                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
19455                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
19456                        $inner.css({'margin': 'auto'});
19457                    } else {
19458                        $inner.css({'margin': ''});
19459                    }
19460                } else {
19461                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
19462                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
19463                        $inner.css({'margin': 'auto'});
19464                    } else {
19465                        $inner.css({'margin': ''});
19466                    }
19467                }
19468            }
19469        }
19470
19471        $nav.on('click', '.uncode-nav-index', function(){
19472            var $bullet = $(this),
19473                slide_index = parseFloat( $bullet.attr('data-key') );
19474            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
19475        });
19476        $nav.on('click', '.uncode-nav-prev', function(){
19477            $carousel.trigger('prev.owl.carousel', [navSpeed]);
19478        });
19479        $nav.on('click', '.uncode-nav-next', function(){
19480            $carousel.trigger('next.owl.carousel', [navSpeed]);
19481        });
19482
19483        if ( $nav.hasClass('animated-arrows') ) {
19484            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
19485                $(this).addClass("hover"); 
19486            }).on('animationend', function(){
19487                $(this).removeClass("hover");  
19488            });
19489        }
19490
19491        var positionNav = function(){
19492            if ( $nav.hasClass('window-width') ) {
19493                var navOff = parseFloat( $nav.offset().left ) * -1;
19494                if ( navOff > 0 ) {
19495                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
19496                } else {
19497                    $inner.css({ transform: 'none' });
19498                }
19499            }
19500        }
19501        positionNav();
19502        $(window).on('resize', positionNav);
19503        $(document).on('un-menu-show', positionNav);
19504    });
19505
19506    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
19507};
19508
19509	UNCODE.init = function() {
19510		var wfl_check = false, wfl_request, waypoint_request;
19511		UNCODE.preventDoubleTransition();
19512		UNCODE.betterResize();
19513		UNCODE.utils();
19514		UNCODE.unBlockMenu();
19515		UNCODE.mobileMenuBlockSkins();
19516		UNCODE.magnetic();
19517		if (typeof UNCODE.accessibility !== 'undefined') {
19518			UNCODE.accessibility();
19519		}
19520		if (typeof UNCODE.rowParallax !== 'undefined') {
19521			UNCODE.rowParallax();
19522		}
19523		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
19524			UNCODE.changeSkinOnScroll();
19525		}
19526		if (typeof UNCODE.share !== 'undefined') {
19527			UNCODE.share();
19528		}
19529		if (typeof UNCODE.tooltip !== 'undefined') {
19530			UNCODE.tooltip();
19531		}
19532		if (typeof UNCODE.counters !== 'undefined') {
19533			UNCODE.counters();
19534		}
19535		if (typeof UNCODE.countdowns !== 'undefined') {
19536			UNCODE.countdowns();
19537		}
19538		if (typeof UNCODE.tabs !== 'undefined') {
19539			UNCODE.tabs();
19540		}
19541		if (typeof UNCODE.collapse !== 'undefined') {
19542			UNCODE.collapse();
19543		}
19544		if (typeof UNCODE.bigText !== 'undefined') {
19545			UNCODE.bigText();
19546		}
19547		UNCODE.menuSystem();
19548		if (typeof UNCODE.bgChanger !== 'undefined') {
19549			UNCODE.bgChanger();
19550		}
19551		if (typeof UNCODE.magicCursor !== 'undefined') {
19552			UNCODE.magicCursor();
19553		}
19554		if (typeof UNCODE.magneticCursor !== 'undefined') {
19555			UNCODE.magneticCursor();
19556		}
19557		if (typeof UNCODE.dropImage !== 'undefined') {
19558			UNCODE.dropImage();
19559		}
19560		if (typeof UNCODE.postTable !== 'undefined') {
19561			UNCODE.postTable();
19562		}
19563		if (typeof UNCODE.rotatingTxt !== 'undefined') {
19564			UNCODE.rotatingTxt();
19565		}
19566		if (typeof UNCODE.okvideo !== 'undefined') {
19567			UNCODE.okvideo();
19568			window.addEventListener( "uncode-more-items-loaded", function() {
19569				UNCODE.okvideo("uncode-more-items-loaded");
19570			});
19571		}
19572		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
19573			UNCODE.backgroundSelfVideos();
19574		}
19575		UNCODE.tapHover();
19576		if (typeof UNCODE.isotopeLayout !== 'undefined') {
19577			UNCODE.isotopeLayout();
19578		}
19579		if (typeof UNCODE.justifiedGallery !== 'undefined') {
19580			UNCODE.justifiedGallery();
19581		}
19582		if (typeof UNCODE.cssGrid !== 'undefined') {
19583			UNCODE.cssGrid();
19584		}
19585		if (typeof UNCODE.linearGrid !== 'undefined') {
19586			UNCODE.linearGrid();
19587		}
19588		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
19589			UNCODE.lightbox();
19590		}
19591		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
19592			$(window).on('load more-items-loaded',function(){
19593				UNCODE.lightgallery();
19594			});
19595		}
19596		if (typeof UNCODE.carousel !== 'undefined') {
19597			UNCODE.carousel($('body'));
19598		}
19599		if (typeof UNCODE.lettering !== 'undefined') {
19600			UNCODE.lettering();
19601		}
19602		UNCODE.animations();
19603		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
19604			UNCODE.stickyElements();
19605		}
19606		if (typeof UNCODE.twentytwenty !== 'undefined') {
19607			UNCODE.twentytwenty();
19608		}
19609		UNCODE.disableHoverScroll();
19610		UNCODE.printScreen();
19611		if (typeof UNCODE.particles !== 'undefined') {
19612			UNCODE.particles();
19613		}
19614		if (typeof UNCODE.filters !== 'undefined') {
19615			UNCODE.filters();
19616		}
19617		if (typeof UNCODE.ajax_filters !== 'undefined') {
19618			UNCODE.ajax_filters();
19619		}
19620		if (typeof UNCODE.widgets !== 'undefined') {
19621			UNCODE.widgets();
19622		}
19623		if (typeof UNCODE.unmodal !== 'undefined') {
19624			UNCODE.unmodal();
19625		}
19626		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
19627			if ( !UNCODE.isFullPage ) {
19628				UNCODE.checkScrollForTabs();
19629			}
19630		}
19631		if (typeof UNCODE.onePage !== 'undefined') {
19632			UNCODE.onePage(UNCODE.isMobile);
19633		}
19634		if (typeof UNCODE.fullPage !== 'undefined') {
19635			$(document).ready(function(){
19636				UNCODE.fullPage();
19637			});
19638		}
19639		if (typeof UNCODE.skewIt !== 'undefined') {
19640			UNCODE.skewIt();
19641		}
19642		if (typeof UNCODE.rotateIt !== 'undefined') {
19643			UNCODE.rotateIt();
19644		}
19645		if (typeof UNCODE.textMarquee !== 'undefined') {
19646			UNCODE.textMarquee();
19647		}
19648		if (typeof UNCODE.stickyScroll !== 'undefined') {
19649			UNCODE.stickyScroll();
19650		}
19651		if (typeof UNCODE.stickyTrigger !== 'undefined') {
19652			UNCODE.stickyTrigger();
19653		}
19654		if (typeof UNCODE.areaTextReveal !== 'undefined') {
19655			UNCODE.areaTextReveal();
19656		}
19657		if (typeof UNCODE.thumbsReveal !== 'undefined') {
19658			UNCODE.thumbsReveal();
19659		}
19660		if (typeof UNCODE.verticalText !== 'undefined') {
19661			UNCODE.verticalText();
19662		}
19663		if (typeof UNCODE.videoThumbs !== 'undefined') {
19664			UNCODE.videoThumbs();
19665		}
19666		if (typeof UNCODE.revslider !== 'undefined') {
19667			UNCODE.revslider();
19668		}
19669		if (typeof UNCODE.layerslider !== 'undefined') {
19670			UNCODE.layerslider();
19671		}
19672		if (typeof UNCODE.lottie !== 'undefined') {
19673			UNCODE.lottie();
19674		}
19675		if (typeof UNCODE.inlineImgs !== 'undefined') {
19676			UNCODE.inlineImgs();
19677		}
19678		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
19679			UNCODE.animatedBgGradient();
19680		}
19681		if (typeof UNCODE.readMoreCol !== 'undefined') {
19682			UNCODE.readMoreCol();
19683		}
19684		if (typeof UNCODE.multibg !== 'undefined') {
19685			UNCODE.multibg();
19686		}
19687		if (typeof UNCODE.flexEqual !== 'undefined') {
19688			UNCODE.flexEqual();
19689		}
19690		if (typeof UNCODE.wrapperMarquee !== 'undefined') {
19691			UNCODE.wrapperMarquee();
19692		}
19693		if (typeof UNCODE.wrapperSticky !== 'undefined') {
19694			UNCODE.wrapperSticky();
19695		}
19696		if (typeof UNCODE.mouseTrail !== 'undefined') {
19697			UNCODE.mouseTrail();
19698		}
19699		if (typeof UNCODE.magneticPattern !== 'undefined') {
19700			UNCODE.magneticPattern();
19701		}
19702		if (typeof UNCODE.thumbDrop !== 'undefined') {
19703			UNCODE.thumbDrop();
19704		}
19705		$(window).on('load',function(){
19706			clearRequestTimeout(waypoint_request);
19707			waypoint_request = requestTimeout( function(){
19708				Waypoint.refreshAll();
19709			}, 1000);
19710		});
19711		$(window).one('load',function(){
19712			if (typeof UNCODE.parallax !== 'undefined') {
19713				UNCODE.parallax();
19714			}
19715		});
19716	}
19717
19718	if ( ! SiteParameters.is_frontend_editor ) {
19719		UNCODE.init();
19720	}
19721
19722
19723})(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.