PageSourceSearch

https://autoaidbreakdown.co.uk/wp-content/themes/porto/js/theme-async.js?ver=7.9.4

js autoaidbreakdown.co.uk collected 2026-09-24 10:41:06 UTC 73,565 bytes, 2,070 lines download raw bytes

1( function( theme, $ ) {
2	'use strict';
3
4	theme = theme || {};
5
6	$.extend( theme, {
7		mfpConfig: {
8			tClose: js_porto_vars.popup_close,
9			tLoading: '<div class="porto-ajax-loading"><i class="porto-loading-icon"></i></div>',
10			gallery: {
11				tPrev: js_porto_vars.popup_prev,
12				tNext: js_porto_vars.popup_next,
13				tCounter: js_porto_vars.mfp_counter
14			},
15			image: {
16				tError: js_porto_vars.mfp_img_error
17			},
18			ajax: {
19				tError: js_porto_vars.mfp_ajax_error
20			},
21			callbacks: {
22				open: function() {
23					$( 'body' ).addClass( 'lightbox-opened' );
24					var fixed = this.st.fixedContentPos;
25					if ( fixed ) {
26						$( '#header.sticky-header .header-main.sticky, #header.sticky-header .main-menu-wrap, .fixed-header #header.sticky-header .header-main, .fixed-header #header.sticky-header .main-menu-wrap' ).css( theme.rtl_browser ? 'left' : 'right', theme.getScrollbarWidth() );
27					}
28					/* D3-Ahsan - Start */
29					var that = $( this._lastFocusedEl );
30					if ( ( that.closest( '.portfolios-lightbox' ).hasClass( 'with-thumbs' ) ) && $( document ).width() >= 1024 ) {
31
32						var portfolio_lightbox_thumbnails_base = that.closest( '.portfolios-lightbox.with-thumbs' ).find( '.porto-portfolios-lighbox-thumbn
32ails' ).clone(),
33							magnificPopup = $.magnificPopup.instance;
34
35						$( 'body' ).prepend( portfolio_lightbox_thumbnails_base );
36
37						var $portfolios_lightbox_thumbnails = $( 'body > .porto-portfolios-lighbox-thumbnails' ),
38							$portfolios_lightbox_thumbnails_carousel = $portfolios_lightbox_thumbnails.children( '.owl-carousel' );
39						$portfolios_lightbox_thumbnails_carousel.themeCarousel( $portfolios_lightbox_thumbnails_carousel.data( 'plugin-options' ) );
40						$portfolios_lightbox_thumbnails_carousel.trigger( 'refresh.owl.carousel' );
41
42						var $carousel_items_wrapper = $portfolios_lightbox_thumbnails_carousel.find( '.owl-stage' );
43
44						$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
45						$carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' );
46
47						$.magnificPopup.instance.next = function() {
48							var magnificPopup = $.magnificPopup.instance;
49							$.magnificPopup.proto.next.call( this );
50							$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
51							$carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' );
52						};
53
54						$.magnificPopup.instance.prev = function() {
55							var magnificPopup = $.magnificPopup.instance;
56							$.magnificPopup.proto.prev.call( this );
57							$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
58							$carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' );
59						};
60
61						$carousel_items_wrapper.find( '.owl-item' ).on( 'click', function() {
62							$carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' );
63							$.magnificPopup.instance.goTo( $( this ).index() );
64							$( this ).addClass( 'current' );
65						} );
66
67					}
68					/* End - D3-Ahsan */
69				},
70				close: function() {
71					$( 'body' ).removeClass( 'lightbox-opened' );
72					var fixed = this.st.fixedContentPos;
73					if ( fixed ) {
74						$( '#header.sticky-header .header-main.sticky, #header.sticky-header .main-menu-wrap, .fixed-header #header.sticky-header .header-main, .fixed-header #header.sticky-header .main-menu-wrap' ).css( theme.rtl_browser ? 'left' : 'right', '' );
75					}
76					$( '.owl-carousel .owl-stage' ).each( function() {
77						var $this = $( this ),
78							w = $this.width() + parseInt( $this.css( 'padding-left' ) ) + parseInt( $this.css( 'padding-right' ) );
79
80						$this.css( { 'width': w + 200 } );
81						setTimeout( function() {
82							$this.css( { 'width': w } );
83						}, 0 );
84					} );
85					/* D3-Ahsan - Start */
86					var that = $( this._lastFocusedEl );
87					if ( ( that.parents( '.portfolios-lightbox' ).hasClass( 'with-thumbs' ) ) && $( document ).width() >= 1024 ) {
88						$( ' body >
88 .porto-portfolios-lighbox-thumbnails' ).remove();
89					}
90					/* End - D3-Ahsan */
91				}
92			}
93		},
94	} );
95
96} ).apply( this, [window.theme, jQuery] );
97
98// Search
99( function( theme, $ ) {
100	'use strict';
101
102	theme = theme || {};
103
104	$.extend( theme, {
105
106		Search: {
107
108			defaults: {
109				popup: $( '.searchform-popup' ),
110				form: $( '.searchform' )
111			},
112
113			initialize: function( $popup, $form ) {
114				this.$popup = ( $popup || this.defaults.popup );
115				this.$form = ( $form || this.defaults.form );
116				this.form_layout = this.$form.hasClass( 'search-layout-overlay' ) ? 'overlay' : this.$form.hasClass( 'search-layout-reveal' ) ? 'reveal' : false;
117
118				this.build()
119					.events();
120
121				return this;
122			},
123
124			build: function() {
125				var self = this;
126
127				/* Change search form values */
128				var $search_form_texts = self.$form.find( '.text input' ),
129					$search_form_cats = self.$form.find( '.cat' );
130
131				if ( $( '.searchform .cat' ).get( 0 ) && $.fn.selectric ) {
132					$( '.searchform .cat' ).selectric( {
133						arrowButtonMarkup: '',
134						expandToItemText: true,
135						maxHeight: 240
136					} );
137				}
138
139				$search_form_texts.on( 'change', function() {
140					var $this = $( this ),
141						val = $this.val();
142
143					$search_form_texts.each( function() {
144						if ( $this != $( this ) ) $( this ).val( val );
145					} );
146				} );
147
148				$search_form_cats.on( 'change', function() {
149					var $this = $( this ),
150						val = $this.val();
151
152					$search_form_cats.each( function() {
153						if ( $this != $( this ) ) $( this ).val( val );
154					} );
155				} );
156
157				$( document ).on( 'focus', '.searchform-popup .text input', function (e) {
158					let $this = $( this );
159					$this.trigger( 'porto_sh_before_open' );
160					if ( $this.closest( '.searchform-popup' ).find( '.search-list:not(.search-history-list)' ).length ) {
161						$this.closest( '.searchform-popup' ).find( '.search-lists' ).addClass( 'show' );
162					}
163				});
164
165				return this;
166			},
167
168			events: function() {
169				var self = this;
170
171				$( 'body' ).on( 'click', '.searchform-popup', function( e ) {
172					e.stopPropagation();
173				} );
174				$( 'body' ).off( 'click', '.searchform-popup .search-toggle' ).on( 'click', '.searchform-popup .search-toggle', function( e ) {
175					var $this = $( this ),
176						$form = $this.next();
177					$this.toggleClass( 'opened' );
178					if ( 'overlay' == self.form_layout ) {
179						$this.siblings( '.search-layout-overlay' ).addClass( 'show' );
180						$( 'html' ).addClass( 'porto-search-opened porto-search-overlay-wrap' );
181						$this.closest( '.vc_row.vc_row-flex>.vc_column_container>.vc_column-inner' ).css( 'z-index', '999' );
182					} else if ( 'reveal' == self.form_layout  ) {
183						self.parents = [];
184						var $element = self.$popup;
185						while ( ! ( ( $element.hasClass( 'elementor-container' ) && ! $element.parent().hasClass( 'elementor-inner-container' ) ) || ( $element.hasClass( 'e-con-inner' ) && ! $element.parent().hasClass( 'e-child' ) ) || ( $element.parent().hasClass( 'vc_row' ) && ! $element.parent().hasClass( 'vc_inner' ) ) || 'header' == $element.parent().attr( 'id' ) || $element.parent().hasClass( 'header-main' ) || $element.parent().hasClass( 'header-top' ) || $element.parent().hasClass( 'header-bottom' ) ) ) {
186							$element = $element.parent();
187							$element.addClass( 'position-static' );
188							self.parents.push( $element );
189						}
190						if ( 'static' == $element.parent().css( 'position' ) ) {
191							self.topParent = $element.parent();
192							self.topParent.addClass( 'position-relative' );
193						}
194						$form.toggle();
195						window.setTimeout( function () {
196							$( 'body' ).addClass( 'porto-search-opened' );
197							$form.find( '.text>input[name="s"]' ).focus();
198						}, 100 );
199					} else {
200						$form.toggle();
201					}
202					if ( $this.hasClass( 'opened' ) ) {
203						$( '#mini-cart.open' ).removeClass( 'open' );
204						$this.next().find( 'input[type="text"]' ).focus();
205						if ( self.$popup.find( '.btn-close-search-form' ).length ) {
206							self.$popup.parent().addClass( 'position-static' );
207						}
208					} else if ( 'reveal' == self.form_layout ) {
209						self.removeFormStyle();
210					}
211					e.preventDefault();
212					e.stopPropagation();
213				} );
214
215				$( 'html,body' ).on( 'click', function() {
216					self.removeFormStyle();
217					$( '.search-lists' ).removeClass( 'show' );
218				} );
219
220				if ( !( 'ontouchstart' in document ) ) {
221
222					$( window ).on( 'resize', function() {
223						self.removeFormStyle();
224					} );
225				}
226
227				$( '.btn-close-search-form' ).on( 'click', function( e ) {
228					e.preventDefault();
229					self.removeFormStyle();
230				} );
231
232				return self;
233			},
234
235			removeFormStyle: function() {
236				this.$form.removeAttr( 'style' );
237				var $searchToggle = this.$popup.find( '.search-toggle' );
238				$searchToggle.removeClass( 'opened' );
239				if ( 'overlay' == this.form_layout ) {
240					$( 'html' ).removeClass( 'porto-search-opened porto-search-overlay-wrap' );
241					$searchToggle.siblings( '.search-layout-overlay' ).removeClass( 'show' );
242					$searchToggle.closest( '.vc_row.vc_row-flex>.vc_column_container>.vc_column-inner' ).css( 'z-index', '' );
243				} else if ( 'reveal' == this.form_layout && this.parents && this.parents.length >= 1 ) {
244					$( 'body' ).removeClass( 'porto-search-opened' );
245					this.parents.forEach( $element => {
246						$element.removeClass( 'position-static' );
247					});
248					if ( this.topParent ) {
249						this.topParent.removeClass( 'position-relative' );
250					}
251				}
252				if ( this.$popup.find( '.btn-close-search-form' ).length ) {
253					this.$popup.parent().removeClass( 'position-static' );
254				}
255			}
256		}
257
258	} );
259
260} ).apply( this, [window.theme, jQuery] );
261
262
263// Carousel
264
265( function( theme, $ ) {
266	'use strict';
267
268	theme = theme || {};
269
270	var instanceName = '__carousel';
271
272	var Carousel = function( $el, opts ) {
273		return this.initialize( $el, opts );
274	};
275
276	Carousel.defaults = $.extend( {}, {
277		loop: true,
278		navText: [],
279		themeConfig: false,
280		lazyLoad: true,
281		lg: 0,
282		md: 0,
283		sm: 0,
284		xs: 0,
285		single: false,
286		rtl: theme.rtl
287	} );
288
289	Carousel.prototype = {
290		initialize: function( $el, opts ) {
291			if ( $el.data( instanceName ) ) {
292				return this;
293			}
294
295			this.$el = $el;
296
297			this
298				.setData()
299				.setOptions( opts )
300				.build();
301
302			return this;
303		},
304
305		setData: function() {
306			this.$el.data( instanceName, true );
307
308			return this;
309		},
310
311		setOptions: function( opts ) {
312			if ( ( opts && opts.themeConfig ) || !opts ) {
313				this.options = $.extend( true, {}, Carousel.defaults, theme.owlConfig, opts, {
314					wrapper: this.$el,
315					themeConfig: true
316				} );
317			} else {
318				this.options = $.extend( true, {}, Carousel.defaults, opts, {
319					wrapper: this.$el
320				} );
321			}
322
323			return this;
324		},
325
326		calcOwlHeight: function( $el ) {
327			var h = 0;
328			$el.find( '.owl-item.active' ).each( function() {
329				if ( h < $( this ).height() )
330					h = $( this ).height();
331			} );
332			$el.children( '.owl-stage-outer' ).height( h );
333		},
334
335		build: function() {
336			if ( !$.fn.owlCarousel ) {
337				return this;
338			}
339
340			var $el = this.options.wrapper,
341				loop = this.options.loop,
342				lg = this.options.lg,
343				md = this.options.md,
344				sm = this.options.sm,
345				xs = this.options.xs,
346				single = this.options.single,
347				zoom = $el.find( '.zoom' ).filter( function() {
348					if ( $( this ).closest( '.tb-image-type-slider' ).length ) {
349						return false;
350					}
351					return true;
352				} ).get( 0 ),
353				responsive = {},
354				items,
355				count = $el.find( '.owl-item' ).length > 0 ? $el.find( '.owl-item:not(.cloned)' ).length : $el.find( '> *' ).length,
356				fullscreen = typeof this.options.fullscreen == 'undefined' ? false : this.options.fullscreen;
357
358
359			/*if (fullscreen) {
360				$el.children().width(window.innerWidth - theme.getScrollbarWidth());
361				$el.children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight);
362				$el.children().css('max-height', '100%');
363				$(window).on('resize', function() {
364					$el.find('.owl-item').children().width(window.innerWidth - theme.getScrollbarWidth());
365					$el.find('.owl-item').children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight);
366					$el.find('.owl-item').children().css('max-height', '100%');
367				});
368			}*/
369
370			if ( single ) {
371				items = 1;
372			} else if ( typeof this.options.responsive != 'undefined' ) {
373				for ( var w in this.options.responsive ) {
374					var number_items = Number( this.options.responsive[w] );
375					responsive[Number( w )] = { items: number_items, loop: ( loop && count >= number_items ) ? true : false };
376				}
377			} else {
378				items = this.options.items ? this.options.items : ( lg ? lg : 1 );
379				var isResponsive = ( this.options.xxl || this.options.xl || lg || md || sm || xs );
380				if ( isResponsive ) {
381					if ( this.options.xxl ) {
382						responsive[theme.screen_xxl] = { items: this.options.xxl, loop: ( loop && count > this.options.xxl ) ? true : false, mergeFit: this.options.mergeFit };
383					} else if ( lg && items > lg + 1 ) {
384						responsive[theme.screen_xxl] = { items: items, loop: ( loop && count > items ) ? true : false, mergeFit: this.options.mergeFit };
385						responsive[theme.screen_xl] = { items: lg + 1, loop: ( loop && count > lg + 1 ) ? true : false, mergeFit: this.options.mergeFit };
386					}
387					if ( this.options.xl ) {
388						responsive[theme.screen_xl] = { items: this.options.xl, loop: ( loop && count > this.options.xl ) ? true : false, mergeFit: this.options.mergeFit };
389					} else if ( typeof responsive[theme.screen_xl] == 'undefined' && ( ! lg || items != lg ) ) {
390						responsive[theme.screen_xl] = { items: items, loop: ( loop && count >= items ) ? true : false, mergeFit: this.options.mergeFit };
391					}
392					if ( lg ) responsive[992] = { items: lg, loop: ( loop && count >= lg ) ? true : false, mergeFit: this.options.mergeFit_lg };
393					if ( md ) responsive[768] = { items: md, loop: ( loop && count > md ) ? true : false, mergeFit: this.options.mergeFit_md };
394					if ( sm ) {
395						responsive[576] = { items: sm, loop: ( loop && count > sm ) ? true : false, mergeFit: this.options.mergeFit_sm };
396					} else {
397						if ( xs && xs > 1 )  {
398							responsive[576] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_sm };
399						} else {
400							responsive[576] = { items: 1, mergeFit: false };
401						}
402					}
403					if ( xs ) {
404						responsive[0] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_xs };
405					} else {
406						responsive[0] = { items: 1 };
407					}
408				}
409			}
410
411			// Responsive Item Margin: override owl's per-breakpoint margin when set ( options.margin_md /
412			// margin_sm / margin_xs come from the Porto Carousel block's responsive Item Margin control ).
413			var porto_bp_margin = { 768: this.options.margin_md, 576: this.options.margin_sm, 0: this.options.margin_xs };
414			for ( var porto_bp in porto_bp_margin ) {
415				if ( typeof porto_bp_margin[porto_bp] != 'undefined' && porto_bp_margin[porto_bp] !== '' && porto_bp_margin[porto_bp] !== null && responsive[porto_bp] ) {
416					responsive[porto_bp].margin = Number( porto_bp_margin[porto_bp] );
417				}
418			}
419
420			if ( !$el.hasClass( 'show-nav-title' ) && this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover ) {
421				$el.addClass( 'show-nav-hover' );
422			}
423
424			this.options = $.extend( true, {}, this.options, {
425				items: items,
426				loop: ( loop && count > items ) ? true : false,
427				responsive: responsive,
428				onInitialized: function() {
429					if ( $el.hasClass( 'stage-margin' ) ) {
430						$el.find( '.owl-stage-outer' ).css( {
431							'margin-left': this.options.stagePadding,
432							'margin-right': this.options.stagePadding
433						} );
434					}
435					var heading_cls = '.porto-u-heading, .vc_custom_heading, .slider-title, .elementor-widget-heading, .porto-heading';
436					if ( $el.hasClass( 'show-dots-title' ) && ( $el.prev( heading_cls ).length || $el.closest( '.slider-wrapper' ).prev( heading_cls ).length || $el.closest( '.porto-recent-posts' ).prev( heading_cls ).length || $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls ).length ) ) {
437						var $obj = $el.prev( heading_cls );
438						if ( !$obj.length ) {
439							$obj = $el.closest( '.slider-wrapper' ).prev( heading_cls );
440						}
441						if ( !$obj.length ) {
442							$obj = $el.closest( '.porto-recent-posts' ).prev( heading_cls );
443						}
444						if ( !$obj.length ) {
445							$obj = $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls );
446						}
447						try {
448							var innerWidth = $obj.addClass( 'w-auto' ).css( 'display', 'inline-block' ).width();
449							$obj.removeClass( 'w-auto' ).css( 'display', '' );
450							if ( innerWidth + 15 + $el.find( '.owl-dots' ).width() <= $obj.width() ) {
451								$el.find( '.owl-dots' ).css( ( $( 'body' ).hasClass( 'rtl' ) ? 'right' : 'left' ), innerWidth + 15 + ( $el.width() - $obj.width() ) / 2 );
452								$el.find( '.owl-dots' ).css( 'top', -1 * $obj.height() / 2 - parseInt( $obj.css( 'margin-bottom' ) ) - $el.find( '.owl-dots' ).height() / 2 + 2 );
453							} else {
454								$el.find( '.owl-dots' ).css( 'position', 'static' );
455							}
456						} catch ( e ) { }
457					}
458				}
459			} );
460
461			// Auto Height Fixes
462			if ( this.options.autoHeight ) {
463				var thisobj = this;
464				$( window ).on( 'resize', function() {
465					thisobj.calcOwlHeight( $el );
466				} );
467
468				if ( theme.isLoaded ) {
469					setTimeout( function() {
470						thisobj.calcOwlHeight( $el );
471					}, 100 );
472				} else {
473					$( window ).on( 'load', function() {
474						thisobj.calcOwlHeight( $el );
475					} );
476				}
477			}
478
479			var links = false;
480			if ( zoom ) {
481				links = [];
482				var i = 0;
483
484				$el.find( '.zoom' ).each( function() {
485					var slide = {},
486						$zoom = $( this );
487
488					slide.src = $zoom.data( 'src' ) ? $zoom.data( 'src' ) : $zoom.data( 'mfp-src' );
489					slide.title = $zoom.data( 'title' );
490					links[i] = slide;
491					$zoom.data( 'index', i );
492					i++;
493				} );
494			}
495
496			if ( $el.hasClass( 'show-nav-title' ) ) {
497				this.options.stagePadding = 0;
498			} else {
499				if ( this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover )
500					$el.addClass( 'show-nav-hover' );
501				if ( this.options.themeConfig && !theme.slider_nav_hover && theme.slider_margin )
502					$el.addClass( 'stage-margin' );
503			}
504			if ( $el.hasClass( 'has-ccols-spacing' ) ) {
505				$el.removeClass( 'has-ccols-spacing' );
506			}
507			$el.owlCarousel( this.options );
508
509			if ( zoom && links ) {
510				$el.on( 'click', '.zoom', function( e ) {
511					e.preventDefault();
512					if ( $.fn.magnificPopup ) {
513						var image_index = $( this ).data( 'index' );
514						if ( typeof image_index == 'undefined' ) {
515							image_index = ( $( this ).closest( '.owl-item' ).index() - $el.find( '.cloned' ).length / 2 ) % $el.data( 'owl.carousel' ).items().length;
516						}
517						$.magnificPopup.close();
518						$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
519							items: links,
520							gallery: {
521								enabled: true
522							},
523							type: 'image'
524						} ), image_index );
525					}
526					return false;
527				} );
528			}
529
530			return this;
531		}
532	}
533	// expose to scope
534	$.extend( theme, {
535		Carousel: Carousel
536	} );
537
538	// jquery plugin
539	$.fn.themeCarousel = function( opts, zoom ) {
540		if ( typeof $.fn.owlCarousel != 'function' ) {
541			return this;
542		}
543		return this.map( function() {
544			var $this = $( this );
545
546			if ( $this.data( instanceName ) ) {
547				return $this;
548			} else {
549				return new theme.Carousel( $this, opts, zoom );
550			}
551
552		} );
553	}
554
555} ).apply( this, [window.theme, jQuery] );
556
557// Lightbox
558( function( theme, $ ) {
559	'use strict';
560
561	theme = theme || {};
562
563	var instanceName = '__lightbox';
564
565	var Lightbox = function( $el, opts ) {
566		return this.initialize( $el, opts );
567	};
568
569	Lightbox.defaults = {
570		callbacks: {
571			open: function() {
572				$( 'body' ).addClass( 'lightbox-opened' );
573			},
574			close: function() {
575				$( 'body' ).removeClass( 'lightbox-opened' );
576			}
577		}
578	};
579
580	Lightbox.prototype = {
581		initialize: function( $el, opts ) {
582			if ( $el.data( instanceName ) ) {
583				return this;
584			}
585
586			this.$el = $el;
587
588			this
589				.setData()
590				.setOptions( opts )
591				.build();
592
593			return this;
594		},
595
596		setData: function() {
597			this.$el.data( instanceName, this );
598
599			return this;
600		},
601
602		setOptions: function( opts ) {
603			this.options = $.extend( true, {}, Lightbox.defaults, theme.mfpConfig, opts, {
604				wrapper: this.$el
605			} );
606
607			return this;
608		},
609
610		build: function() {
611			if ( !$.fn.magnificPopup ) {
612				return this;
613			}
614
615			this.options.wrapper.magnificPopup( this.options );
616
617			return this;
618		}
619	};
620
621	// expose to scope
622	$.extend( theme, {
623		Lightbox: Lightbox
624	} );
625
626	// jquery plugin
627	$.fn.themeLightbox = function( opts ) {
628		return this.map( function() {
629			var $this = $( this );
630
631			if ( $this.data( instanceName ) ) {
632				return $this.data( instanceName );
633			} else {
634				return new theme.Lightbox( $this, opts );
635			}
636
637		} );
638	}
639
640} ).apply( this, [window.theme, jQuery] );
641
642// Post Filter
643( function( theme, $ ) {
644	'use strict';
645
646	theme = theme || {};
647
648	$.extend( theme, {
649
650		PostFilter: {
651
652			cache: {
653			},
654
655			defaults: {
656				elements: '.portfolio-filter'
657			},
658
659			initialize: function( $elements, post_type ) {
660				this.$elements = ( $elements || $( this.defaults.elements ) );
661				this.build( post_type );
662
663				return this;
664			},
665
666			filterFn: function( e ) {
667				if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) {
668					return;
669				}
670				var self = e.data.selfobj;
671
672				if ( self.isLoading ) {
673					return false;
674				}
675				var $this = e.data.thisobj,
676					$elements = e.data.elements,
677					position = e.data.position,
678					post_type = e.data.post_type,
679					$parent = e.data.parent,
680					$posts_wrap = e.data.posts_wrap,
681					use_ajax = e.data.use_ajax,
682					page_path = e.data.page_path,
683					infinite_load = e.data.infinite_load,
684					load_more = e.data.load_more;
685				e.preventDefault();
686				if ( $( this ).hasClass( 'active' ) ) {
687					return;
688				}
689
690				self.isLoading = true;
691				var selector = $( this ).attr( 'data-filter' );
692				if ( 'sidebar' == position ) {
693					$( '.sidebar-overlay' ).trigger( 'click' );
694				}
695
696				$this.find( '.active' ).removeClass( 'active' );
697
698				if ( use_ajax ) {
699					var current_cat = '*' == selector ? '' : selector;
700					if ( !page_path ) {
701						page_path = $posts_wrap.data( 'page_path' );
702					}
703					if ( page_path ) {
704						$posts_wrap.data( 'page_path', page_path.replace( /&category=[^&]*&/, '&category=' + current_cat + '&' ) );
705					}
706
707					$( this ).addClass( 'active' );
708					self.load_posts( current_cat, infinite_load || load_more ? true : false, $parent, post_type, $posts_wrap, undefined, $( this ).children( 'a' ).attr( 'href' ) );
709				} else if ( 'faq' == post_type ) {
710					$parent.find( '.faq' ).each( function() {
711						var $that = $( this ), easing = "easeInOutQuart", timeout = 300;
712						if ( selector == '*' ) {
713							if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() {
714								$( this ).attr( 'style', '' ).show();
715							} );
716							selected++;
717						} else {
718							if ( $that.hasClass( selector ) ) {
719								if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() {
720									$( this ).attr( 'style', '' ).show();
721								} );
722								selected++;
723							} else {
724								if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function() {
725									$( this ).attr( 'style', '' ).hide();
726								} );
727							}
728						}
729					} );
730
731					if ( !selected && $parent.find( '.faqs-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) {
732						$parent.find( '.faqs-infinite' ).infinitescroll( 'retrieve' );
733					}
734				} else if ( $parent.hasClass( 'portfolios-timeline' ) ) {
735					var selected = 0;
736					$parent.find( '.portfolio' ).each( function() {
737						var $that = $( this ), easing = "easeInOutQuart", timeout = 300;
738						if ( selector == '*' ) {
739							if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() {
740								$( this ).attr( 'style', '' ).show();
741							} );
742							selected++;
743						} else {
744							if ( $that.hasClass( selector ) ) {
745								if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() {
746									$( this ).attr( 'style', '' ).show();
747								} );
748								selected++;
749							} else {
750								if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function() {
751									$( this ).attr( 'style', '' ).hide();
752								} );
753							}
754						}
755					} );
756					if ( !selected && $parent.find( '.portfolios-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) {
757						$parent.find( '.portfolios-infinite' ).infinitescroll( 'retrieve' );
758					}
759					setTimeout( function() {
760						theme.FilterZoom.initialize( $parent );
761					}, 400 );
762				} else {
763					$parent.find( '.' + post_type + '-row' ).isotope( {
764						filter: selector == '*' ? selector : '.' + selector
765					} );
766				}
767
768				if ( !use_ajax ) {
769					$( this ).addClass( 'active' );
770					self.isLoading = false;
771				}
772
773				if ( position == 'sidebar' ) {
774					self.$elements.each( function() {
775						var $that = $( this );
776
777						if ( $that == $this && $that.data( 'position' ) != 'sidebar' ) return;
778						$that.find( 'li' ).removeClass( 'active' );
779						$that.find( 'li[data-filter="' + selector + '"]' ).addClass( 'active' );
780					} );
781				}
782
783				if ( !use_ajax ) {
784					window.location.hash = '#' + selector;
785				}
786				theme.refreshVCContent();
787				return false;
788			},
789
790			build: function( post_type_param ) {
791				var self = this;
792
793				self.$elements.each( function() {
794					var $this = $( this ),
795						position = $this.data( 'position' ),
796						$parent,
797						post_type;
798					if ( typeof post_type_param == 'undefined' ) {
799						if ( $this.hasClass( 'member-filter' ) ) {
800							post_type = 'member';
801						} else if ( $this.hasClass( 'faq-filter' ) ) {
802							post_type = 'faq';
803						} else if ( $this.hasClass( 'product-filter' ) ) {
804							post_type = 'product';
805						} else if ( $this.hasClass( 'post-filter' ) ) {
806							post_type = 'post';
807						} else if ( $this.hasClass( 'portfolio-filter' ) ) {
808							post_type = 'portfolio';
809						} else {
810							post_type = $this.attr( 'data-filter-type' );
811						}
812					} else {
813						post_type = post_type_param;
814					}
815
816					if ( 'sidebar' == position ) {
817						$parent = $( '.main-content .page-' + post_type + 's' );
818						//theme.scrolltoContainer($parent);
819					} else if ( 'global' == position ) {
820						$parent = $( '.main-content .page-' + post_type + 's' );
821					} else {
822						$parent = $this.closest( '.page-' + post_type + 's' );
823					}
824					if ( !$parent.length ) {
825						$parent = $this.closest( '.porto-posts-grid' );
826					}
827					if ( !$parent || !$parent.length ) {
828						return;
829					}
830					var use_ajax = $this.hasClass( 'porto-ajax-filter' ),
831						infinite_load = $parent.hasClass( 'load-infinite' ),
832						load_more = $parent.hasClass( 'load-more' );
833
834					var $posts_wrap = $parent.find( '.' + post_type + 's-container' ),
835						page_path;
836					if ( use_ajax && ( ( !infinite_load && !load_more ) || !$parent.data( 'ajax_load_options' ) ) ) {
837						var current_url = window.location.href;
838						if ( -1 !== current_url.indexOf( '#' ) ) {
839							current_url = current_url.split( '#' )[0];
840						}
841						page_path = theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' )  + 'action=porto_ajax_posts&nonce=' + js_porto_vars.porto_nonce + '&post_type=' + post_type + '&current_link=' + current_url + '&category=&page=%cur_page%';
842						if ( $parent.data( 'post_layout' ) ) {
843							page_path += '&post_layout=' + $parent.data( 'post_layout' );
844						}
845						$posts_wrap.data( 'page_path', page_path );
846					}
847
848					$this.find( 'li' ).on( 'click', { thisobj: $this, selfobj: self, elements: self.$elements, position: position, parent: $parent, post_type: post_type, posts_wrap: $posts_wrap, use_ajax: use_ajax, page_path: page_path, infinite_load: infinite_load, load_more: load_more }, self.filterFn );
849				} );
850
851				$( window ).on( 'hashchange', { elements: self.$elements }, self.hashchange );
852				self.hashchange( { data: { elements: self.$elements } } );
853
854				return self;
855			},
856
857			hashchange: function( e ) {
858				if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) {
859					return;
860				}
861				var $elements = e.data.elements,
862					$filter = $( $elements.get( 0 ) ),
863					hash = window.location.hash;
864
865				if ( hash ) {
866					var $o = $filter.find( 'li[data-filter="' + hash.replace( '#', '' ) + '"]' );
867					if ( !$o.hasClass( 'active' ) ) {
868						$o.trigger( 'click' );
869					}
870				}
871			},
872
873			set_elements: function( $elements ) {
874				var self = this;
875				if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) {
876					self.destroy( self.$elements );
877					return;
878				}
879				self.$elements = $elements;
880				$( window ).off( 'hashchange', self.hashchange ).on( 'hashchange', { elements: $elements }, self.hashchange );
881			},
882
883			destroy: function( $elements ) {
884				if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) {
885					return;
886				}
887				var self = this;
888				$elements.find( 'li' ).off( 'click', self.filterFn );
889				$( window ).off( 'hashchange', self.hashchange );
890			},
891
892			load_posts: function( cat, is_infinite, $parent, post_type, $posts_wrap, default_args, page_url ) {
893				var _gridcookie = '';
894				if ( $parent.hasClass( 'archive-products' ) ) {
895					_gridcookie = new URLSearchParams( location.search.substring( 1 ) ).get( 'gridcookie' );
896					if ( ! ( _gridcookie == null || _gridcookie == '' || _gridcookie == 'grid' ) ) {
897						page_url = theme.addUrlParam( page_url, 'gridcookie', _gridcookie );
898					}
899				}
900				var pid = $parent.attr( 'id' ) || $parent.data( 'pid' ),
901					self = this,
902					is_archive = $parent.hasClass( 'archive-posts' );
903				if ( ! pid ) {
904					if ( typeof theme.PostFilter.load_posts.pid == 'undefined' ) {
905						theme.PostFilter.load_posts.pid = 0;
906					}
907					theme.PostFilter.load_posts.pid += 1;
908					pid = 'porto_posts_grid_cache_' + theme.PostFilter.load_posts.pid;
909					$parent.data('pid', pid);
910				}
911				var successfn = function( res, directcall ) {
912						if ( !res ) {
913							return;
914						}
915						if ( ( typeof directcall == 'undefined' || true !== directcall ) && typeof default_args == 'undefined' && pid ) {
916							if ( !self.cache[pid] ) {
917								self.cache[pid] = {};
918							}
919							self.cache[pid][cat + _gridcookie] = res;
920						}
921						var $res = $( res ),
922							is_shop = $parent.hasClass( 'archive-products' ),
923							$posts = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ).children();
924
925						if ( !$posts.length ) {
926							return;
927						}
928
929						if ( typeof $posts_wrap == 'undefined' || is_archive ) {
930							$posts_wrap = $parent.find( '.' + post_type + 's-container' );
931						}
932						if ( !$posts_wrap.length ) {
933							return;
934						}
935
936						if ( $posts_wrap.data( 'isotope' ) ) {
937							$posts_wrap.isotope( 'remove', $posts_wrap.children() );
938						} else {
939							$posts_wrap.children().remove();
940						}
941
942						if ( $posts_wrap.hasClass( 'owl-loaded' ) ) {
943							$posts_wrap.removeClass( 'owl-loaded' );
944						}
945						$posts.children().addClass( 'fadeInUp animated' );
946						$posts_wrap.append( $posts );
947						theme.refreshVCContent( $posts );
948
949						// filter
950						var $old_filter = $parent.find( '.' + post_type + '-filter' );
951						if ( $old_filter.length && !$old_filter.hasClass( 'porto-ajax-filter' ) && !$parent.hasClass( 'load-infinite' ) && !$parent.hasClass( 'load-more' ) ) {
952							var $new_filter = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.' + post_type + '-filter' );
953							if ( $new_filter.length ) {
954								$old_filter.find( 'li:first-child' ).trigger( 'click' );
955								theme.PostFilter.destroy( $old_filter );
956								$old_filter.replaceWith( $new_filter );
957								//$new_filter = $parent.find( '.' + post_type + '-filter' );
958								theme.PostFilter.initialize( $new_filter, post_type );
959								theme.PostFilter.set_elements( $( 'ul[data-filter-type], ul.portfolio-filter, ul.member-filter, ul.faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' ) );
960							}
961						}
962
963						porto_init( $parent );
964
965						var behavior_action = '';
966						if ( post_type != 'product' && post_type != 'member' && post_type != 'faq' && post_type != 'portfolio' && post_type != 'post' ) {
967							behavior_action = 'ptu';
968						} else {
969							behavior_action = post_type;
970						}
971						theme.PostsInfinite[behavior_action + 'Behavior']( $posts, $posts_wrap );
972
973						// init CountDown
974						$( document.body ).trigger( 'porto_init_countdown', [$posts_wrap] );
975
976						// pagination
977						var $old_pagination = $parent.find( '.pagination-wrap' ),
978							$new_pagination = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.pagination-wrap' ).eq( 0 ),
979							has_pagination = false,
980							nst_pagination = false;
981						if ( $old_pagination.length ) {
982							if ( $new_pagination.length ) {
983								$old_pagination.replaceWith( $new_pagination );
984								has_pagination = true;
985								nst_pagination = true;
986							} else {
987								$old_pagination.children().remove();
988							}
989						} else if ( $new_pagination.length ) {
990							$parent.append( $new_pagination );
991							has_pagination = true;
992							nst_pagination = true;
993						}
994
995						if ( is_shop ) { // shop builder with counter per page widget
996							let _paginationWrap = $( '.woocommerce-pagination' );
997							var $old_pagination = _paginationWrap.find( 'ul.page-numbers' ),
998							$new_pagination = $res.find( '.woocommerce-pagination ul.page-numbers' ).eq( 0 ),
999							has_pagination = false;
1000							if ( $old_pagination.length ) {
1001								if ( $new_pagination.length ) {
1002									$old_pagination.replaceWith( $new_pagination );
1003									has_pagination = true;
1004								} else {
1005									$old_pagination.children().remove();
1006								}
1007							} else if ( $new_pagination.length ) {
1008								_paginationWrap.append( $new_pagination );
1009								has_pagination = true;
1010							}
1011						}
1012					
1013
1014						if ( is_infinite ) {
1015							var infinitescroll_ins = $posts_wrap.data( 'infinitescroll' );
1016							if ( has_pagination || ( is_shop && nst_pagination ) ) {
1017								var $new_posts_wrap = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' );
1018								if ( $new_posts_wrap.data( 'cur_page' ) ) {
1019									$posts_wrap.data( 'cur_page', $new_posts_wrap.data( 'cur_page' ) );
1020									$posts_wrap.data( 'max_page', $new_posts_wrap.data( 'max_page' ) );
1021								}
1022
1023								var should_init_again = true;
1024								if ( infinitescroll_ins ) {
1025									if ( infinitescroll_ins.options.state.isDestroyed ) {
1026										$posts_wrap.removeData( 'infinitescroll' );
1027									} else {
1028										should_init_again = false;
1029										if ( $new_posts_wrap.data( 'cur_page' ) ) {
1030											infinitescroll_ins.update( {
1031												maxPage: $new_posts_wrap.data( 'max_page' ),
1032												state: {
1033													currPage: $new_posts_wrap.data( 'cur_page' )
1034												}
1035											} );
1036										}
1037										if ( infinitescroll_ins.options.state.isPaused ) {
1038											infinitescroll_ins.resume();
1039										}
1040									}
1041								}
1042
1043								if ( should_init_again ) {
1044									var ins = $posts_wrap.data( '__postsinfinite' );
1045									if ( ins ) {
1046										ins.destroy();
1047									}
1048									var selector_product = '.' + post_type + ', .timeline-date';
1049									if ( is_shop ) {
1050										selector_product = '.archive-products .product';
1051										if ( $( '.elementor-widget-wc-archive-products' ).length ) {
1052											selector_product = '.elementor-widget-wc-archive-products .product';
1053										}
1054									}
1055									new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type );
1056								}
1057
1058								if ( is_archive ) {
1059									var page_path = $posts_wrap.siblings( '.pagination-wrap' ).find( '.next' ).attr( 'href' );
1060									if ( page_path ) {
1061										page_path += ( -1 !== page_path.indexOf( '?' ) ? '&' : '?' ) + 'portoajax=1&load_posts_only=2';
1062										page_path = page_path.replace( /(paged=)(\d+)|(page\/)(\d+)/, '$1$3%cur_page%' );
1063										$posts_wrap.data( 'page_path', page_path );
1064									}
1065								}
1066								var selector_product = '.' + post_type + ', .timeline-date';
1067								if ( is_shop ) {
1068									selector_product = '.archive-products .product';
1069									if ( $( '.elementor-widget-wc-archive-products' ).length ) {
1070										selector_product = '.elementor-widget-wc-archive-products .product';
1071									}
1072								}
1073								new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type );
1074							}
1075						}
1076
1077						// in archive page
1078						if ( is_archive ) {
1079							// update widgets
1080							$( '.sidebar-content' ).each( function( index ) {
1081								var $this = $( this ),
1082									$that = $( $res.find( '.sidebar-content' ).get( index ) );
1083
1084								$this.html( $that.html() );
1085
1086								// in shop
1087								if ( is_shop ) {
1088									if ( typeof updateSelect2 != 'undefined' && updateSelect2 ) {
1089										// Use Select2 enhancement if possible
1090										if ( jQuery().selectWoo ) {
1091											var porto_wc_layered_nav_select = function() {
1092												$this.find( 'select.woocommerce-widget-layered-nav-dropdown' ).each( function() {
1093													$( this ).selectWoo( {
1094														placeholder: $( this ).find( 'option' ).eq( 0 ).text(),
1095														minimumResultsForSearch: 5,
1096														width: '100%',
1097														allowClear: typeof $( this ).attr( 'multiple' ) != 'undefined' && $( this ).attr( 'multiple' ) == 'multiple' ? 'false' : 'true'
1098													} );
1099												} );
1100											};
1101											porto_wc_layered_nav_select();
1102										}
1103										$( 'body' ).children( 'span.select2-container' ).remove();
1104									}
1105								}
1106							} );
1107
1108							// in shop
1109							if ( is_shop ) {
1110								var $script = $res.filter( 'script:contains("var woocommerce_price_slider_params")' ).first();
1111								if ( $script && $script.length && $script.text().indexOf( '{' ) !== -1 && $script.text().indexOf( '}' ) !== -1 ) {
1112									var arrStr = $script.text().substring( $script.text().indexOf( '{' ), $script.text().indexOf( '}' ) + 1 );
1113									window.woocommerce_price_slider_params = JSON.parse( arrStr );
1114								}
1115
1116								// update entry title
1117								var $title = $( '.entry-title' );
1118								if ( $title.length ) {
1119									var $newTitle = $res.find( '.entry-title' ).eq( 0 );
1120									if ( $newTitle.length ) {
1121										$title.html( $newTitle.html() );
1122									}
1123								}
1124
1125								// update entry description
1126								var $desc = $( '.entry-description' );
1127								if ( $desc.length ) {
1128									var $newDesc = $res.find( '.entry-description' ).eq( 0 );
1129									if ( $newDesc.length ) {
1130										$desc.html( $newDesc.html() );
1131									}
1132								}
1133
1134								// top toolbar
1135								var shop_before = '.shop-loop-before',
1136									$shop_before = $( shop_before );
1137								if ( $shop_before.length ) {
1138									if ( $res.find( shop_before ).length ) {
1139										$shop_before.each( function( index ) {
1140											var $res_shop_before = $res.find( shop_before ).eq( index );
1141											if ( $res_shop_before.length ) {
1142												$( this ).html( $res_shop_before.html() ).show();
1143											}
1144										} );
1145									} else {
1146										$shop_before.empty();
1147									}
1148								}
1149
1150								// update result count
1151								var $count = $( '.woocommerce-result-count' );
1152								if ( $count.length ) {
1153									var $newCount = $res.find( '.woocommerce-result-count' ).eq( 0 );
1154									if ( $newCount.length ) {
1155										$count[0].outerHTML = $newCount.length ? $newCount[0].outerHTML : '';
1156									}
1157								}
1158
1159								// trigger ready event
1160								$( document ).trigger( 'yith_wcan_init_shortcodes' );
1161								$( document ).trigger( 'yith-wcan-ajax-filtered' );
1162							}
1163
1164							// update browser history (IE doesn't support it)
1165							if ( page_url && !navigator.userAgent.match( /msie/i ) ) {
1166								window.history.pushState( { 'pageTitle': ( res && res.pageTitle ) || '' }, '', page_url );
1167							}
1168						}
1169
1170						$( document.body ).trigger( 'porto_load_posts_end', [$parent.parent()] );
1171					};
1172
1173				if ( typeof default_args == 'undefined' && typeof self.cache[pid] != 'undefined' && typeof self.cache[pid][cat+ _gridcookie] != 'undefined' && self.cache[pid][cat+ _gridcookie] ) {
1174					successfn( self.cache[pid][cat+ _gridcookie], true );
1175					self.isLoading = false;
1176					$parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove();
1177					return;
1178				}
1179
1180				var ajax_load_options = $parent.data( 'ajax_load_options' );
1181				if ( ( $parent.hasClass( 'archive-products' ) && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'shop' ) ) ||
1182					( is_archive && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'blog' ) ) ) { // skeleton 
1182screen in archive builder
1183					$posts_wrap = $parent.find( '.' + post_type + 's-container' );
1184					if ( ajax_load_options ) {
1185						var tag_name = 'div';
1186						if ( 'product' == post_type && 'ul' == $posts_wrap.get( 0 ).tagName.toLowerCase() ) {
1187							tag_name = 'li';
1188						}
1189						$posts_wrap.addClass( 'skeleton-body' ).empty();
1190						for ( var i = 0; i < Number( ajax_load_options.count || ( ajax_load_options.columns && ajax_load_options.columns * 3 ) || 12 ); i++ ) {
1191							$posts_wrap.append( '<' + tag_name + ' class="porto-tb-item post ' + post_type + ( 'product' == post_type ? ' product-col' : '' ) + '"></' + tag_name + '>' );
1192						}
1193					} else {
1194						$posts_wrap.addClass( 'skeleton-body' ).children().empty();
1195					}
1196				} else {
1197					if ( !$parent.children( '.porto-loading-icon' ).length ) {
1198						$parent.append( '<i class="porto-loading-icon"></i>' );
1199					}
1200					$parent.addClass( 'porto-ajax-loading' );
1201				}
1202
1203				var current_url = window.location.href;
1204				if ( -1 !== current_url.indexOf( '#' ) ) {
1205					current_url = current_url.split( '#' )[0];
1206				}
1207
1208				var args, load_url = theme.ajax_url;
1209				if ( $parent.hasClass( 'archive-posts' ) ) { // archive builder
1210					args = {
1211						portoajax: true,
1212						load_posts_only: true
1213					};
1214					if ( $parent.closest( '.porto-block' ).length ) {
1215						args['builder_id'] = $parent.closest( '.porto-block' ).data( 'id' );
1216					}
1217					load_url = typeof page_url != 'undefined' ? page_url : current_url;
1218				} else {
1219					args = {
1220						action: 'porto_ajax_posts',
1221						nonce: js_porto_vars.porto_nonce,
1222						post_type: post_type,
1223						current_link: current_url
1224					};
1225					if ( $parent.data( 'post_layout' ) ) {
1226						args['post_layout'] = $parent.data( 'post_layout' );
1227					}
1228					if ( ajax_load_options ) {
1229						args['extra'] = ajax_load_options;
1230					}
1231					if ( typeof default_args != 'undefined' ) {
1232						args = $.extend( args, default_args );
1233					}
1234				}
1235				if ( cat ) {
1236					args['category'] = cat;
1237				}
1238
1239				$.ajax( {
1240					url: load_url,
1241					type: 'post',
1242					data: args,
1243					success: successfn,
1244					complete: function() {
1245						self.isLoading = false;
1246						$posts_wrap.removeClass( 'skeleton-body' );
1247						$parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove();
1248					}
1249				} );
1250
1251			}
1252		}
1253
1254	} );
1255
1256} ).apply( this, [window.theme, jQuery] );
1257
1258// Filter Zoom
1259( function( theme, $ ) {
1260	'use strict';
1261
1262	theme = theme || {};
1263
1264	$.extend( theme, {
1265
1266		FilterZoom: {
1267
1268			defaults: {
1269				elements: null
1270			},
1271
1272			initialize: function( $elements ) {
1273				this.$elements = ( $elements || this.defaults.elements );
1274
1275				this.build();
1276
1277				return this;
1278			},
1279
1280			build: function() {
1281				var self = this;
1282
1283				self.$elements.each( function() {
1284					var $this = $( this ),
1285						zoom = $this.find( '.zoom, .thumb-info-zoom' ).get( 0 );
1286
1287					if ( !zoom ) return;
1288
1289					$this.find( '.zoom, .thumb-info-zoom' ).off( 'click' );
1290					var links = [];
1291					var i = 0;
1292					$this.find( 'article' ).each( function() {
1293						var $that = $( this );
1294						if ( $that.css( 'display' ) != 'none' ) {
1295							var $zoom = $that.find( '.zoom, .thumb-info-zoom' ),
1296								slide,
1297								src = $zoom.data( 'src' ),
1298								title = $zoom.data( 'title' );
1299
1300							$zoom.data( 'index', i );
1301							if ( Array.isArray( src ) ) {
1302								$.each( src, function( index, value ) {
1303									slide = {};
1304									slide.src = value;
1305									slide.title = title[index];
1306									links[i] = slide;
1307									i++;
1308								} );
1309							} else {
1310								slide = {};
1311								slide.src = src;
1312								slide.title = title;
1313								links[i] = slide;
1314								i++;
1315							}
1316						}
1317					} );
1318					$this.find( 'article' ).each( function() {
1319						var $that = $( this );
1320						if ( $that.css( 'display' ) != 'none' ) {
1321							$that.off( 'click', '.zoom, .thumb-info-zoom' ).on( 'click', '.zoom, .thumb-info-zoom', function( e ) {
1322								var $zoom = $( this ), $parent = $zoom.parents( '.thumb-info' ), offset = 0;
1323								if ( $parent.get( 0 ) ) {
1324									var $slider = $parent.find( '.porto-carousel' );
1325									if ( $slider.get( 0 ) ) {
1326										offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2;
1327									}
1328								}
1329								e.preventDefault();
1330								if ( $.fn.magnificPopup ) {
1331									$.magnificPopup.close();
1332									$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
1333										items: links,
1334										gallery: {
1335											enabled: true
1336										},
1337										type: 'image'
1338									} ), $zoom.data( 'index' ) + offset );
1339								}
1340								return false;
1341							} );
1342						}
1343					} );
1344				} );
1345
1346				return self;
1347			}
1348		}
1349
1350	} );
1351
1352} ).apply( this, [window.theme, jQuery] );
1353
1354/* initialize */
1355( function( theme, $ ) {
1356	theme.initAsync = function( $wrap, wrapObj ) {
1357		// Carousel
1358		if ( $.fn.themeCarousel ) {
1359
1360			$( function() {
1361				
1362				var portoImgNavMiddle = function ( $el ) {
1363					var $images = $el.find( '.owl-item img' ),
1364						height = 0;
1365						for ( var i = 0; i < $images.length; i++) {
1366							var imgHeight = $images.eq(i).height();
1367							if ( height < imgHeight ) {
1368								height = imgHeight;
1369							}
1370						}
1371					if ( $el.hasClass( 'products-slider' ) ) {
1372						$el.children( '.owl-nav' ).css( 'top', ( 5 + height / 2 ) + 'px' );
1373					} else {
1374						$el.children( '.owl-nav' ).css( 'top', height / 2 + 'px' );
1375					}
1376				};
1377				// Carousel Lazyload images
1378				var portoCarouselInit = function( e ) {
1379					var $this = $( e.currentTarget );
1380
1381					$this.find( '[data-appear-animation]:not(.appear-animation)' ).addClass( 'appear-animation' );
1382					if ( $this.find( '.owl-item.cloned' ).length ) {
1383						// compatibility with W3 Total Cache
1384						var $not_loaded = $this.find( 'img.lazy:not(.loaded)' );
1385						if ( $not_loaded.length ) {
1386							if (typeof window.w3tc_lazyload == 'object') {
1387								window.w3tc_lazyload.update();
1388							} else if (theme.w3tcLazyLoadInstance) {
1389								theme.w3tcLazyLoadInstance.update();
1390							}
1391						}
1392
1393						if ( $.fn.themePluginLazyLoad ) {
1394							$this.find( '.porto-lazyload:not(.lazy-load-loaded)' ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } );
1395						}
1396						var $animates = e.currentTarget.querySelectorAll( '.appear-animation' );
1397						if ( $animates.length ) {
1398							if ( theme.animation_support ) {
1399								// theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults );
1400							} else {
1401								$animates.forEach( function( o ) {
1402									o.classList.add( 'appear-animation-visible' );
1403								} );
1404							}
1405						}
1406						if ( $.fn.themePluginAnimatedLetters && ( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ).length ) ) {
1407							theme.dynIntObsInit( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ), 'themePluginAnimatedLetters' );
1408						}
1409					}
1410
1411					setTimeout( function() {
1412						var $hiddenItems = $this.find( '.owl-item:not(.active)' );
1413						if ( theme.animation_support ) {
1414							$hiddenItems.find( '.appear-animation' ).removeClass( 'appear-animation-visible' );
1415							$hiddenItems.find( '.appear-animation' ).each( function() {
1416								var $el = $( this ),
1417									delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : 0 );
1418								if ( delay > 1 ) {
1419									this.style.animationDelay = delay + 'ms';
1420								}
1421
1422								var duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : 1000 );
1423								if ( 1000 != duration ) {
1424									this.style.animationDuration = duration + 'ms';
1425								}
1426							} );
1427						}
1428						if ( window.innerWidth >= 1200 ) {
1429							$hiddenItems.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' );
1430						}
1431						// Position the navigation in the middle of the image
1432						if ( $this.hasClass( 'nav-center-images-only' ) ) {
1433							portoImgNavMiddle( $this );
1434						}
1435					}, 300 );
1436				};
1437				var portoCarouselTranslated = function( e ) {
1438					var $this = $( e.currentTarget );
1439					/*if ( window.innerWidth > 767 ) {
1440						if ( $this.find( '.owl-item.cloned' ).length && $this.find( '.appear-animation:not(.appear-animation-visible)' ).length ) {
1441							$( document.body ).trigger( 'appear_refresh' );
1442						}
1443					}*/
1444
1445					var $active = $this.find( '.owl-item.active' );
1446					if ( $active.hasClass( 'translating' ) ) {
1447						$active.removeClass( 'translating' );
1448						return;
1449					}
1450					$this.find( '.owl-item.translating' ).removeClass( 'translating' );
1451					// Animated Letters
1452					$this.find( '[data-plugin-animated-letters]' ).removeClass( 'invisible' );
1453					$this.find( '.owl-item.active [data-plugin-animated-letters]' ).trigger( 'animated.letters.initialize' );
1454
1455					if ( window.innerWidth > 767 ) {
1456						// WPBakery
1457						$this.find( '.appear-animation' ).removeClass( 'appear-animation-visible' );
1458						$active.find( '.appear-animation' ).each( function() {
1459							var $animation_item = $( this ),
1460								anim_name = $animation_item.data( 'appear-animation' );
1461							$animation_item.addClass( anim_name + ' appear-animation-visible' );
1462						} );
1463					}
1464
1465					// sticky sidebar
1466					if ( window.innerWidth > 991 ) {
1467						if ( $this.closest( '[data-plugin-sticky]' ).length ) {
1468							theme.refreshStickySidebar( false, $this.closest( '[data-plugin-sticky]' ) );
1469						}
1470					}
1471
1472					// Elementor
1473					$active.find( '.slide-animate' ).each( function() {
1474						var $animation_item = $( this ),
1475							settings = $animation_item.data( 'settings' );
1476						if ( settings && ( settings._animation || settings.animation ) ) {
1477							var animation = settings._animation || settings.animation,
1478								delay = settings._animation_delay || settings.animation_delay || 0;
1479							theme.requestTimeout( function() {
1480								$animation_item.removeClass( 'elementor-invisible' ).addClass( 'animated ' + animation );
1481							}, delay );
1482						}
1483					} );
1484
1485					// Visual Composer
1486					if ( window.innerWidth >= 1200 ) {
1487						$this.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ).removeAttr( 'data-vcv-o-animated-fully' );
1488						$active.find( '[data-vce-animate]' ).each( function() {
1489							var $animation_item = $( this );
1490							if ( $animation_item.data( 'porto-origin-anim' ) ) {
1491								var anim_name = $animation_item.data( 'porto-origin-anim' );
1492								$animation_item.attr( 'data-vce-animate', anim_name ).attr( 'data-vcv-o-animated', true );
1493								var duration = parseFloat( window.getComputedStyle( this )['animationDuration'] ) * 1000,
1494									delay = parseFloat( window.getComputedStyle( this )['animationDelay'] ) * 1000;
1495								window.setTimeout( function() {
1496									$animation_item.attr( 'data-vcv-o-animated-fully', true );
1497								}, delay + duration + 5 );
1498							}
1499						} );
1500					}
1501				};
1502				var portoCarouselTranslateVC = function( e ) {
1503					var $this = $( e.currentTarget );
1504					$this.find( '.owl-item.active' ).addClass( 'translating' );
1505
1506					if ( window.innerWidth >= 1200 ) {
1507						$this.find( '[data-vce-animate]' ).each( function() {
1508							var $animation_item = $( this );
1509							$animation_item.data( 'porto-origin-anim', $animation_item.data( 'vce-animate' ) ).attr( 'data-vce-animate', '' );
1510						} );
1511					}
1512				};
1513				var portoCarouselTranslateElementor = function( e ) {
1514					var $this = $( e.currentTarget );
1515					$this.find( '.owl-item.active' ).addClass( 'translating' );
1516					$this.find( '.owl-item:not(.active) .slide-animate' ).addClass( 'elementor-invisible' );
1517					$this.find( '.slide-animate' ).each( function() {
1518						var $animation_item = $( this ),
1519							settings = $animation_item.data( 'settings' );
1520						if ( settings._animation || settings.animation ) {
1521							$animation_item.removeClass( settings._animation || settings.animation );
1522						}
1523					} );
1524				};
1525				var portoCarouselTranslateWPB = function( e ) {
1526					if ( window.innerWidth > 767 ) {
1527						var $this = $( e.currentTarget );
1528						$this.find( '.owl-item.active' ).addClass( 'translating' );
1529						$this.find( '.appear-animation' ).each( function() {
1530							var $animation_item = $( this );
1531							$animation_item.removeClass( $animation_item.data( 'appear-animation' ) );
1532						} );
1533					}
1534				};
1535
1536				var carouselItems = $wrap.find( '.owl-carousel:not(.manual)' );
1537				carouselItems.on( 'initialized.owl.carousel refreshed.owl.carousel', portoCarouselInit ).on( 'translated.owl.carousel', portoCarouselTranslated );
1538				carouselItems.on( 'translate.owl.carousel', function() {
1539					// Hide elements inside carousel
1540					$( this ).find( '[data-plugin-animated-letters]' ).addClass( 'invisible' );
1541					// Animated Letters
1542					$( this ).find( '[data-plugin-animated-letters]' ).trigger( 'animated.letters.destroy' );
1543				} );
1544				carouselItems.on( 'resized.owl.carousel', function () {
1545					var $this = $( this );
1546					// Position the navigation in the middle of the image
1547					if ( $this.hasClass( 'nav-center-images-only' ) ) {
1548						portoImgNavMiddle( $this );
1549					}
1550				} )
1551				carouselItems.filter( function() {
1552					if ( $( this ).find( '[data-vce-animate]' ).length ) {
1553						return true;
1554					}
1555					return false;
1556				} ).on( 'translate.owl.carousel', portoCarouselTranslateVC );
1557				carouselItems.filter( function() {
1558					var $anim_obj = $( this ).find( '.elementor-invisible' );
1559					if ( $anim_obj.length ) {
1560						$anim_obj.addClass( 'slide-animate' );
1561						return true;
1562					}
1563					return false;
1564				} ).on( 'translate.owl.carousel', portoCarouselTranslateElementor );
1565				carouselItems.filter( function() {
1566					if ( $( this ).find( '.appear-animation, [data-appear-animation]' ).length ) {
1567						return true;
1568					}
1569					return false;
1570				} ).on( 'translate.owl.carousel', portoCarouselTranslateWPB );
1571
1572				$wrap.find( '[data-plugin-carousel]:not(.manual), .porto-carousel:not(.manual)' ).each( function() {
1573					var $this = $( this ),
1574						opts;
1575					if ( $this.closest( '.tab-pane' ).length && ! $this.closest( '.tab-pane' ).hasClass( 'active' ) ) {
1576						return;
1577					}
1578					if ( $this.closest( '.e-n-tabs-content > .e-con' ).length && ! $this.closest( '.e-n-tabs-content > .e-con' ).hasClass( 'e-active' ) ) {
1579						return;
1580					}
1581					if ( $this.closest( '.sidebar-menu:not(.side-menu-accordion) .menu-block' ).length ) {
1582						return;
1583					}
1584					if ( $this.closest( '.mega-menu .menu-block' ).length ) {
1585						return;
1586					}
1587					var pluginOptions = $this.data( 'plugin-options' );
1588					if ( pluginOptions )
1589						opts = pluginOptions;
1590
1591					setTimeout( function() {
1592						$this.themeCarousel( opts );
1593					}, 0 );
1594				} );
1595			} );
1596
1597		}
1598		// Fixed video
1599		$wrap.find( '.video-fixed' ).each( function() {
1600			var $this = $( this ),
1601				$video = $this.find( 'video, iframe' );
1602
1603			if ( $video.length ) {
1604				window.addEventListener( 'scroll', function() {
1605					var offset = $( window ).scrollTop() - $this.position().top + theme.adminBarHeight();
1606					$video.css( "cssText", "top: " + offset + "px !important;" );
1607				}, { passive: true } );
1608			}
1609		} );
1610		setTimeout( function() {
1611			// Search
1612			if ( typeof theme.Search !== 'undefined' ) {
1613				theme.Search.initialize();
1614			}
1615		}, 0 );
1616		if ( typeof theme.isAsyncInit == 'undefined' ) {
1617			theme.isAsyncInit = -1; //initial
1618		}
1619		$( document.body ).trigger( 'porto_after_async_init', [ $wrap, wrapObj ] );
1620		theme.isAsyncInit = 1;
1621	};
1622
1623	$( document.body ).trigger( 'porto_async_init' );
1624} ).apply( this, [window.theme, jQuery] );
1625
1626jQuery( document ).ready( function( $ ) {
1627	'use strict';
1628
1629	function porto_modal_open( $this ) {
1630		var trigger = $this.data( 'trigger-id' ),
1631			overlayClass = $this.data( 'overlay-class' ),
1632			disableOverlay = $this.data( 'disable-overlay' ),
1633			extraClass = $this.data( 'extra-class' ) ? $this.data( 'extra-class' ) : '',
1634			type = $this.data( 'type' ),
1635			buttonPopup = false,
1636			isExist = 0;
1637		if ( typeof trigger != 'undefined'/* && $('#' + escape(trigger)).length > 0*/ ) {
1638			if ( typeof type == 'undefined' ) {
1639				type = 'inline';
1640			}
1641			if ( type == 'inline' ) {
1642				trigger = '#' + escape( trigger );
1643			}
1644			if ( typeof $.magnificPopup.instance != 'undefined' && $.magnificPopup.instance.isOpen ) {
1645				isExist = 350;
1646				$.magnificPopup.close(); // Destroy before init
1647			}
1648
1649			try {
1650				if ( document.querySelector( trigger ) ) {
1651					if ( 'script' == document.querySelector( trigger ).nodeName.toLowerCase() ) { // Dynamic Popup Click
1652						trigger = $( trigger ).html();
1653						disableOverlay = $( trigger ).data( 'disable-overlay' );
1654						overlayClass = $( trigger ).data( 'overlay-class' );
1655						extraClass = 'button-popup ';
1656						buttonPopup = true;
1657					}
1658				}
1659			} catch( e ) {
1660
1661			}
1662
1663			var args = {
1664				items: {
1665					src: trigger
1666				},
1667				type: type,
1668				mainClass: extraClass + ( disableOverlay ? ' popup-builder-disable-overlay ' : '' ),
1669				prependTo: $( '.page-wrapper' )
1670			};
1671			if ( trigger == '#popup-builder' ) {
1672				args['fixedContentPos'] = true;
1673			}
1674			var $popupModal = $this;
1675			if ( buttonPopup ) {
1676				args['fixedContentPos'] = true;
1677				if ( disableOverlay ) {
1678					args['closeOnBgClick'] = false;
1679					args['fixedContentPos'] = false;
1680					args['focus'] = '.bb-none'; // random selector
1681				}
1682				args['callbacks'] = {
1683					'open': function () {
1684						if ( disableOverlay ) {
1685							$( '.button-popup.mfp-bg' ).remove();
1686							
1687						}
1688						// Update bootstrap tooltip for Popup
1689						var $popup_builder = $( '.button-popup.mfp-wrap' );
1690						if ( typeof theme.porto_init_builder_tooltip == 'function' ) {
1691							theme.porto_init_builder_tooltip( $popup_builder.get(0) );
1692						}
1693						porto_init( $popup_builder );
1694
1695						if ( $popup_builder.find( '.wpcf7' ).length ) {
1696							var $wpcf7 = $popup_builder.find( '.wpcf7 .wpcf7-form' );
1697							if ( typeof wpcf7 == 'object' ) {
1698								if ( typeof wpcf7.initForm == 'function' ) {
1699									wpcf7.initForm( $wpcf7 );
1700								} else if ( typeof wpcf7.init == 'function' ) {
1701									wpcf7.init( $wpcf7.get( 0 ) );
1702									$wpcf7.get( 0 ).classList.replace( "no-js", "js" );
1703								}
1704							}
1705						}
1706						if ( $popup_builder.find( '.wpforms-container' ).length ) {
1707							if ( typeof wpforms == 'object' && typeof wpforms.init == 'function' ) {
1708								wpforms.init();
1709							}
1710						}
1711					}
1712				};
1713			}
1714			if ( $this.hasClass( 'porto-onload' ) || $this.hasClass( 'porto-exit-intent' ) ) {
1715				if ( disableOverlay ) {
1716					args['closeOnBgClick'] = false;
1717					args['fixedContentPos'] = false;
1718					args['focus'] = '.bb-none'; // random selector
1719				}
1720				args['callbacks'] = {
1721					'beforeClose': function() {
1722						if ( $( '.mfp-wrap .porto-disable-modal-onload' ).length && ( $( '.mfp-wrap .porto-disable-modal-onload' ).is( ':checked' ) || $( '.mfp-wrap .porto-disable-modal-onload input[type="checkbox"]' ).is( ':checked' ) ) ) {
1723							$.cookie( 'porto_modal_disable_onload', 'true', { expires: 7 } );
1724						} else if ( 'undefined' !== typeof $popupModal.data( 'expired' ) && 'undefined' !== typeof $popupModal.data( 'popup-id' ) ) {
1725							$.cookie( 'porto_modal_disable_period_onload_' + $popupModal.data( 'popup-id' ), $popupModal.data('expired'), { expires: $popupModal.data('expired') } );
1726						}
1727					},
1728					'afterClose': function() {
1729						// If minicart(cart, wishlist) opened, keep disabling mouse scrolling
1730						if ( $( '#header .minicart-opened' ).length ) {
1731							$( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() );
1732							$( 'html' ).css( 'overflow', 'hidden' );
1733						}
1734					},
1735					'open': function () {
1736						if ( disableOverlay ) {
1737							$( '.popup-builder.mfp-bg' ).remove();
1738						}
1739						// Update bootstrap tooltip for Popup
1740						var $popup_builder = $( '.mfp-wrap .porto-block[data-bs-original-title]' );
1741						if ( $popup_builder.length ) {
1742							bootstrap.Tooltip.getInstance( $popup_builder[0] ).update();
1743						}
1744						if ( $popup_builder.find( '.marquee' ).length && $.isFunction( $.fn.marquee ) ) {
1745							$popup_builder.find( '.marquee' ).marquee( {
1746								duration: 5000,
1747								gap: 0,
1748								delayBeforeStart: 0,
1749								direction: 'left',
1750								duplicated: true
1751							} );
1752						}
1753						if ( $( '.mfp-wrap .porto-block .owl-carousel' ) ) {
1754							$( '.mfp-wrap .porto-block .owl-carousel' ).trigger( 'refresh.owl.carousel' );
1755						}
1756					}
1757				};
1758			}
1759			if ( typeof overlayClass != "undefined" && overlayClass ) {
1760				args.mainClass += escape( overlayClass );
1761			}
1762			setTimeout( () => {
1763				$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, args ), 0 );
1764			}, isExist );
1765
1766		}
1767	}
1768	theme.porto_modal_open = porto_modal_open;
1769	function porto_init_magnific_popup_functions( $wrap ) {
1770		if ( typeof $wrap == 'undefined' || !$wrap.length ) {
1771			$wrap = $( document.body );
1772		}
1773		$wrap.find( '.lightbox:not(.manual)' ).each( function() {
1774			var $this = $( this ),
1775				opts;
1776			if ( $this.find( '>.lb-dataContainer' ).length ) {
1777				return;
1778			}
1779			var pluginOptions = $this.data( 'lightbox-options' );
1780			if ( pluginOptions ) {
1781				opts = pluginOptions;
1782			} else {
1783				pluginOptions = $this.data( 'plugin-options' );
1784				if ( typeof pluginOptions != 'object' ) {
1785					pluginOptions = JSON.parse( pluginOptions );
1786				}
1787				if ( pluginOptions ) {
1788					opts = pluginOptions;
1789				}
1790			}
1791
1792			$this.themeLightbox( opts );
1793		} );
1794
1795		// Popup with video or map
1796		$wrap.find( '.porto-popup-iframe' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, {
1797			disableOn: 700,
1798			type: 'iframe',
1799			mainClass: 'mfp-fade',
1800			removalDelay: 160,
1801			preloader: false,
1802			fixedContentPos: false
1803		} ) );
1804
1805		// Popup with ajax
1806		$wrap.find( '.porto-popup-ajax' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, {
1807			type: 'ajax'
1808		} ) );
1809
1810		// Popup with content
1811		$wrap.find( '.porto-popup-content' ).each( function() {
1812			var animation = $( this ).attr( 'data-animation' );
1813			$( this ).magnificPopup( $.extend( true, {}, theme.mfpConfig, {
1814				type: 'inline',
1815				fixedContentPos: false,
1816				fixedBgPos: true,
1817				overflowY: 'auto',
1818				closeBtnInside: true,
1819				preloader: false,
1820				midClick: true,
1821				removalDelay: 300,
1822				mainClass: animation
1823			} ) );
1824		} );
1825
1826		// Porto Modal
1827		$wrap.find( '.popup-youtube, .popup-vimeo, .popup-gmaps' ).each( function( index ) {
1828			var overlayClass = $( this ).find( '.porto-modal-trigger' ).data( 'overlay-class' ),
1829				args = {
1830					type: 'iframe',
1831					removalDelay: 160,
1832					preloader: false,
1833
1834					fixedContentPos: false
1835				};
1836			if ( typeof overlayClass != "undefined" && overlayClass ) {
1837				args.mainClass = escape( overlayClass );
1838			}
1839			$( this ).magnificPopup( args );
1840		} );
1841
1842		$wrap.find( '[href*=porto-action_popup-id-]' ).each( function() {
1843			var $this = $( this ), popupId = $this.attr( 'href' );
1844			if ( popupId = popupId.match(/#porto-action_popup-id-(\d+)/)[1] ) {
1845				$this.attr( 'data-trigger-id', 'popup-id-' + popupId );
1846				$this.addClass( 'porto-modal-trigger' );
1847			}
1848		} );
1849
1850		if ( $wrap.find( '.porto-modal-trigger.porto-onload' ).length ) {
1851			var $obj = $wrap.find( '.porto-modal-trigger.porto-onload' ).eq( 0 ),
1852				timeout = 0;
1853			if ( $obj.data( 'timeout' ) ) {
1854				timeout = parseInt( $obj.data( 'timeout' ), 10 );
1855			}
1856			setTimeout( function() {
1857				porto_modal_open( $obj );
1858			}, timeout );
1859		}
1860		$wrap.on( 'click', '.porto-modal-trigger', function( e ) {
1861			e.preventDefault();
1862			porto_modal_open( $( this ) );
1863		} );
1864
1865		/* Woocommerce */
1866		// login popup
1867		if ( $wrap.hasClass( 'login-popup' ) ) {
1868			$wrap.find( '.porto-link-login, .porto-link-register' ).magnificPopup( {
1869				items: {
1870					src: theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' )  + 'action=porto_account_login_popup&nonce=' + js_porto_vars.porto_nonce,
1871					type: 'ajax'
1872				},
1873				tLoading: '<i class="porto-loading-icon"></i>',
1874				callbacks: {
1875					ajaxContentAdded: function() {
1876						$( window ).trigger( 'porto_login_popup_opened' );
1877					}
1878				}
1879			} );
1880		}
1881
1882		if ( typeof PhotoSwipe != 'undefined' ) {
1883			let _images = $wrap.find( '.product-images' ), links = [], i = 0;
1884			_images.find( 'img' ).each( function() {
1885				var slide = {};
1886
1887				slide.src = $( this ).attr( 'href' );
1888				slide.title = $( this ).attr( 'alt' );
1889				slide.w = parseInt( $( this ).attr( 'data-large_image_width' ) );
1890				slide.h = parseInt( $( this ).attr( 'data-large_image_height' ) );
1891				
1892				links[i] = slide;
1893				i++;
1894			} );
1895			_images.data( 'links', links );
1896			_images.on( 'click', '.img-thumbnail a.zoom', function( e ) {
1897				e.preventDefault();
1898				var options = $.extend( {
1899					index: $( this ).closest( '.img-thumbnail' ).index(),
1900					addCaptionHTMLFn: function( item, captionEl ) {
1901						if ( ! item.title ) {
1902							captionEl.children[0].textContent = '';
1903							return false;
1904						}
1905						captionEl.children[0].textContent = item.title;
1906						return true;
1907					}
1908				}, wc_single_product_params.photoswipe_options );
1909	
1910				// Initializes and opens PhotoSwipe.
1911				var photoswipe = new PhotoSwipe( $( '.pswp' )[0], PhotoSwipeUI_Default, _images.data( 'links' ), options );
1912				photoswipe.init();
1913			} );
1914
1915
1916		} else {
1917			$wrap.find( '.product-images' ).magnificPopup(
1918				$.extend( true, {}, theme.mfpConfig, {
1919					delegate: '.img-thumbnail a.zoom',
1920					type: 'image',
1921					gallery: { enabled: true }
1922				} )
1923			);
1924		}
1925		$wrap.find( '.porto-posts-grid' ).each( function() {
1926			$( this ).magnificPopup(
1927				$.extend( true, {}, theme.mfpConfig, {
1928					delegate: '.porto-tb-featured-image span.zoom, .porto-tb-featured-image a.zoom, .post-image span.zoom',
1929					type: 'image',
1930					gallery: { enabled: true }
1931				} )
1932			);
1933		} );
1934		$wrap.find( '.porto-posts-grid .tb-image-type-slider div.zoom' ).each( function() {
1935			var $this = $( this ),
1936				links = [];
1937			$this.find( 'a' ).each( function() {
1938				var slide = {};
1939				slide.src = $( this ).attr( 'href' );
1940				slide.title = $( this ).attr( 'title' );
1941				links.push( slide );
1942			} );
1943			if ( links.length ) {
1944				$this.on( 'click', function() {
1945					var $slider = $this.siblings( '.porto-carousel' );
1946					if ( $slider.length ) {
1947						var offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2;
1948						$.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, {
1949							items: links,
1950							gallery: {
1951								enabled: true
1952							},
1953							type: 'image'
1954						} ), offset );
1955					}
1956				} );
1957			}
1958		} );
1959	}
1960
1961	if ( $.fn.magnificPopup ) {
1962		porto_init_magnific_popup_functions();
1963	} else {
1964		setTimeout( function() {
1965			if ( $.fn.magnificPopup ) {
1966				porto_init_magnific_popup_functions();
1967			}
1968		}, 500 );
1969	}
1970	$( document.body ).on( 'porto_load_posts_end', function( e, $posts_wrap ) {
1971		if ( $.fn.magnificPopup ) {
1972			porto_init_magnific_popup_functions( $posts_wrap );
1973		}
1974	} );
1975
1976	// Post Filter
1977	if ( typeof theme.PostFilter !== 'undefined' ) {
1978		var $postFilterElements = $( 'ul[data-filter-type], .portfolio-filter, .member-filter, .faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' );
1979		if ( $postFilterElements.length ) {
1980			theme.PostFilter.initialize( $postFilterElements );
1981		}
1982	}
1983
1984	// Post ajax pagination
1985	$( 'body' ).on( 'click', '.porto-ajax-load .pagination:not(.load-more) .page-numbers', function( e ) {
1986		var $this = $( this );
1987		if ( $this.hasClass( 'current' ) || $this.hasClass( 'dots' ) ) {
1988			return;
1989		}
1990		e.preventDefault();
1991		var $wrap = $this.closest( '.porto-ajax-load' ),
1992			post_type = $wrap.data( 'post_type' ),
1993			$obj = $wrap.find( '.' + post_type + 's-container' );
1994
1995		if ( !$obj.length || $wrap.hasClass( 'loading' ) ) {
1996			return;
1997		}
1998		$wrap.addClass( 'loading' );
1999		var $filter = $wrap.find( '.porto-ajax-filter' ),
2000			cat = $filter.length && $filter.children( '.active' ).length && $filter.children( '.active' ).data( 'filter' );
2001		if ( '*' == cat ) {
2002			cat = '';
2003		}
2004		var default_args = {},
2005			page = $this.attr( 'href' ).match( /paged=(\d+)|page\/(\d+)/ );
2006
2007		if ( page && Array.isArray( page ) && ( page[1] || page[2] ) ) {
2008			default_args['page'] = parseInt( page[1] || page[2] );
2009		} else {
2010			if ( $this.hasClass( 'prev' ) ) {
2011				default_args['page'] = parseInt( $this.next().text() );
2012			} else if ( $this.hasClass( 'next' ) ) {
2013				default_args['page'] = parseInt( $this.prev().text() );
2014			} else {
2015				default_args['page'] = parseInt( $this.text() );
2016			}
2017		}
2018		if ( cat == '' && $wrap.find( 'input[type=hidden].category' ).length ) {
2019			cat = $wrap.find( 'input[type=hidden].category' ).val();
2020			default_args['taxonomy'] = $wrap.find( 'input[type=hidden].taxonomy' ).val();
2021		}
2022		theme.PostFilter.load_posts( cat, $wrap.hasClass( 'load-infinite' ), $wrap, post_type, $obj, default_args, $this.attr( 'href' ) );
2023
2024	} );
2025
2026	// Filter Zooms
2027	if ( typeof theme.FilterZoom !== 'undefined' ) {
2028		// Portfolio Filter Zoom
2029		theme.FilterZoom.initialize( $( '.page-portfolios' ) );
2030		// Member Filter Zoom
2031		theme.FilterZoom.initialize( $( '.page-members' ) );
2032		// Posts Related Style Filter Zoom
2033		theme.FilterZoom.initialize( $( '.blog-posts-related' ) );
2034	}
2035
2036	// close popup using esc key
2037	var $minicart_offcanvas = $( '.minicart-offcanvas' ),
2038		$wl_offcanvas = $( '.wishlist-offcanvas' ),
2039		$mobile_sidebar = $( '.mobile-sidebar' ),
2040		$mobile_panel = $( '#side-nav-panel' ),
2041		$overlay_search = $( '#header .btn-close-search-form' ),
2042		$html = $( 'html' );
2043	if ( $minicart_offcanvas.length || $wl_offcanvas.length || $mobile_sidebar.length || $mobile_panel.length || $( '.skeleton-loading' ).length || $overlay_search.length ) {
2044		$( document.documentElement ).on( 'keyup', function( e ) {
2045			try {
2046				if ( e.keyCode == 27 ) {
2047					$minicart_offcanvas.removeClass( 'minicart-opened' );
2048					$wl_offcanvas.removeClass( 'minicart-opened' );
2049					if ( $mobile_sidebar.length ) {
2050						$html.removeClass( 'filter-sidebar-opened' );
2051						$html.removeClass( 'sidebar-opened' );
2052						$( '.sidebar-overlay' ).removeClass( 'active' );
2053						$( 'html' ).css( 'overflow', '' );
2054						$( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' );
2055					}
2056					if ( $mobile_panel.length && $html.hasClass( 'panel-opened' ) ) {
2057						$html.removeClass( 'panel-opened' );
2058						$( '.panel-overlay' ).removeClass( 'active' );
2059					}
2060					if ( $overlay_search.length ) {
2061						$overlay_search.trigger( 'click' );
2062					}
2063				}
2064			} catch ( err ) { }
2065		} );
2066		$( '.skeleton-loading' ).on( 'skeleton-loaded', function() {
2067			$mobile_sidebar = $( '.mobile-sidebar' );
2068		} );
2069	}
2070} );

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.