PageSourceSearch

https://bewellfinder.com/wp-content/plugins/woocommerce-tm-extra-p…/assets/js/owl.carousel.js?ver=6.2

js bewellfinder.com collected 2026-09-28 10:50:01 UTC 95,147 bytes, 3,790 lines download raw bytes

vendor: 6,131 bytes, lines 1-347
1/**
2 * Owl Carousel v2.3.4
3 * Copyright 2013-2018 David Deutsch
4 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5 */
6/**
7 * Owl carousel
8 *
9 * @version 2.3.4
10 * @author Bartosz Wojciechowski
11 * @author David Deutsch
12 * @license The MIT License (MIT)
13 * @todo Lazy Load Icon
14 * @todo prevent animationend bubling
15 * @todo itemsScaleUp
16 * @todo Test Zepto
17 * @todo stagePadding calculate wrong active classes
18 * reformatted code by themeComplete
19 */
20( function( $, window, document ) {
21	'use strict';
22
23	/**
24	 * Creates a carousel.
25	 *
26	 * @class The Owl Carousel.
27	 * @public
28	 * @param {HTMLElement|jQuery} element - The element to create the carousel for.
29	 * @param {Object} [options] - The options
30	 */
31	function Owl( element, options ) {
32		/**
33		 * Current settings for the carousel.
34		 *
35		 * @public
36		 */
37		this.settings = null;
38
39		/**
40		 * Current options set by the caller including defaults.
41		 *
42		 * @public
43		 */
44		this.options = $.extend( {}, Owl.Defaults, options );
45
46		/**
47		 * Plugin element.
48		 *
49		 * @public
50		 */
51		this.$element = $( element );
52
53		/**
54		 * Proxied event handlers.
55		 *
56		 * @protected
57		 */
58		this._handlers = {};
59
60		/**
61		 * References to the running plugins of this carousel.
62		 *
63		 * @protected
64		 */
65		this._plugins = {};
66
67		/**
68		 * Currently suppressed events to prevent them from being retriggered.
69		 *
70		 * @protected
71		 */
72		this._supress = {};
73
74		/**
75		 * Absolute current position.
76		 *
77		 * @protected
78		 */
79		this._current = null;
80
81		/**
82		 * Animation speed in milliseconds.
83		 *
84		 * @protected
85		 */
86		this._speed = null;
87
88		/**
89		 * Coordinates of all items in pixel.
90		 *
91		 * @todo The name of this member is missleading.
92		 * @protected
93		 */
94		this._coordinates = [];
95
96		/**
97		 * Current breakpoint.
98		 *
99		 * @todo Real media queries would be nice.
100		 * @protected
101		 */
102		this._breakpoint = null;
103
104		/**
105		 * Current width of the plugin element.
106		 */
107		this._width = null;
108
109		/**
110		 * All real items.
111		 *
112		 * @protected
113		 */
114		this._items = [];
115
116		/**
117		 * All cloned items.
118		 *
119		 * @protected
120		 */
121		this._clones = [];
122
123		/**
124		 * Merge values of all items.
125		 *
126		 * @todo Maybe this could be part of a plugin.
127		 * @protected
128		 */
129		this._mergers = [];
130
131		/**
132		 * Widths of all items.
133		 */
134		this._widths = [];
135
136		/**
137		 * Invalidated parts within the update process.
138		 *
139		 * @protected
140		 */
141		this._invalidated = {};
142
143		/**
144		 * Ordered list of workers for the update process.
145		 *
146		 * @protected
147		 */
148		this._pipe = [];
149
150		/**
151		 * Current state information for the drag operation.
152		 *
153		 * @todo #261
154		 * @protected
155		 */
156		this._drag = {
157			time: null,
158			target: null,
159			pointer: null,
160			stage: {
161				start: null,
162				current: null
163			},
164			direction: null
165		};
166
167		/**
168		 * Current state information and their tags.
169		 *
170		 * @type {Object}
171		 * @protected
172		 */
173		this._states = {
174			current: {},
175			tags: {
176				initializing: [ 'busy' ],
177				animating: [ 'busy' ],
178				dragging: [ 'interacting' ]
179			}
180		};
181
182		$.each(
183			[ 'onResize', 'onThrottledResize' ],
184			$.proxy( function( i, handler ) {
185				this._handlers[ handler ] = $.proxy( this[ handler ], this );
186			}, this )
187		);
188
189		$.each(
190			Owl.Plugins,
191			$.proxy( function( key, Plugin ) {
192				this._plugins[ key.charAt( 0 ).toLowerCase() + key.slice( 1 ) ] = new Plugin( this );
193			}, this )
194		);
195
196		$.each(
197			Owl.Workers,
198			$.proxy( function( priority, worker ) {
199				this._pipe.push( {
200					filter: worker.filter,
201					run: $.proxy( worker.run, this )
202				} );
203			}, this )
204		);
205
206		this.setup();
207		this.initialize();
208	}
209
210	/**
211	 * Default options for the carousel.
212	 *
213	 * @public
214	 */
215	Owl.Defaults = {
216		items: 3,
217		loop: false,
218		center: false,
219		rewind: false,
220		checkVisibility: true,
221
222		mouseDrag: true,
223		touchDrag: true,
224		pullDrag: true,
225		freeDrag: false,
226
227		margin: 0,
228		stagePadding: 0,
229
230		merge: false,
231		mergeFit: true,
232		autoWidth: false,
233
234		startPosition: 0,
235		rtl: false,
236
237		smartSpeed: 250,
238		fluidSpeed: false,
239		dragEndSpeed: false,
240
241		responsive: {},
242		responsiveRefreshRate: 200,
243		responsiveBaseElement: window,
244
245		fallbackEasing: 'linear',
246		slideTransition: '',
247
248		info: false,
249
250		nestedItemSelector: false,
251		itemElement: 'div',
252		stageElement: 'div',
253
254		refreshClass: 'owl-refresh',
255		loadedClass: 'owl-loaded',
256		loadingClass: 'owl-loading',
257		rtlClass: 'owl-rtl',
258		responsiveClass: 'owl-responsive',
259		dragClass: 'owl-drag',
260		itemClass: 'owl-item',
261		stageClass: 'owl-stage',
262		stageOuterClass: 'owl-stage-outer',
263		grabClass: 'owl-grab'
264	};
265
266	/**
267	 * Enumeration for width.
268	 *
269	 * @public
270	 * @readonly
271	 * @enum {string}
272	 */
273	Owl.Width = {
274		Default: 'default',
275		Inner: 'inner',
276		Outer: 'outer'
277	};
278
279	/**
280	 * Enumeration for types.
281	 *
282	 * @public
283	 * @readonly
284	 * @enum {string}
285	 */
286	Owl.Type = {
287		Event: 'event',
288		State: 'state'
289	};
290
291	/**
292	 * Contains all registered plugins.
293	 *
294	 * @public
295	 */
296	Owl.Plugins = {};
297
298	/**
299	 * List of workers involved in the update process.
300	 */
301	Owl.Workers = [
302		{
303			filter: [ 'width', 'settings' ],
304			run: function() {
305				this._width = this.$element.width();
306			}
307		},
308		{
309			filter: [ 'width', 'items', 'settings' ],
310			run: function( cache ) {
311				cache.current = this._items && this._items[ this.relative( this._current ) ];
312			}
313		},
314		{
315			filter: [ 'items', 'settings' ],
316			run: function() {
317				this.$stage.children( '.cloned' ).remove();
318			}
319		},
320		{
321			filter: [ 'width', 'items', 'settings' ],
322			run: function( cache ) {
323				var margin = this.settings.margin || '',
324					grid = ! this.settings.autoWidth,
325					rtl = this.settings.rtl,
326					css = {
327						width: 'auto',
328						'margin-left': rtl ? margin : '',
329						'margin-right': rtl ? '' : margin
330					};
331
332				if ( ! grid ) {
333					this.$stage.children().css( css );
334				}
335
336				cache.css = css;
337			}
338		},
339		{
340			filter: [ 'width', 'items', 'settings' ],
341			run: function( cache ) {
342				var width = ( this.width() / this.settings.items ).toFixed( 3 ) - this.settings.margin,
343					merge = null,
344					iterator = this._items.length,
345					grid = ! this.settings.autoWidth,
346					widths = [];
347
348				cache.items = {
349					merge: false,
350					width: width
351				};
352
353				while ( iterator > 0 ) {
354					iterator = iterator - 1;
355					merge = this._mergers[ iterator ];
356					merge = ( this.settings.mergeFit && Math.min( merge, this.settings.items ) ) || merge;
357
358					cache.items.merge = merge > 1 || cache.items.merge;
359
360					widths[ iterator ] = ! grid ? this._items[ iterator ].width() : width * merge;
361				}
362
363				this._widths = widths;
364			}
365		},
366		{
367			filter: [ 'items', 'settings' ],
368			run: function() {
369				var clones = [],
370					items = this._items,
371					settings = this.settings,
372					// TODO: Should be computed from number of min width items in stage
373					view = Math.max( settings.items * 2, 4 ),
374					size = Math.ceil( items.length / 2 ) * 2,
375					repeat = settings.loop && items.length ? ( settings.rewind ? view : Math.max( view, size ) ) : 0,
376					append = '',
377					prepend = '';
378
379				repeat /= 2;
380
381				while ( repeat > 0 ) {
382					// Switch to only using appended clones
383					clones.push( this.normalize( clones.length / 2, true ) );
384					append = append + items[ clones[ clones.length - 1 ] ][ 0 ].outerHTML;
385					clones.push( this.normalize( items.length - 1 - ( ( clones.length - 1 ) / 2 ), true ) );
386					prepend = items[ clones[ clones.length - 1 ] ][ 0 ].outerHTML + prepend;
387					repeat -= 1;
388				}
389
390				this._clones = clones;
391
392				$( append ).addClass( 'cloned' ).appendTo( this.$stage );
393				$( prepend ).addClass( 'cloned' ).prependTo( this.$stage );
394			}
395		},
396		{
397			filter: [ 'width', 'items', 'settings' ],
398			run: function() {
399				var rtl = this.settings.rtl ? 1 : -1,
400					size = this._clones.length + this._items.length,
401					iterator = 0,
402					previous = 0,
403					current = 0,
404					coordinates = [];
405
406				while ( iterator < size ) {
407					previous = coordinates[ iterator - 1 ] || 0;
408					current = this._widths[ this.relative( iterator ) ] + this.settings.margin;
409					coordinates.push( previous + ( current * rtl ) );
410					iterator = iterator + 1;
411				}
412
413				this._coordinates = coordinates;
414			}
415		},
416		{
417			filter: [ 'width', 'items', 'settings' ],
418			run: function() {
419				var padding = this.settings.stagePadding,
420					coordinates = this._coordinates,
421					css = {
422						width: Math.ceil( Math.abs( coordinates[ coordinates.length - 1 ] ) ) + ( padding * 2 ),
423						'padding-left': padding || '',
424						'padding-right': padding || ''
425					};
426
427				this.$stage.css( css );
428			}
429		},
430		{
431			filter: [ 'width', 'items', 'settings' ],
432			run: function( cache ) {
433				var iterator = this._coordinates.length,
434					grid = ! this.settings.autoWidth,
435					items = this.$stage.children();
436
437				if ( grid && cache.items.merge ) {
438					while ( iterator > 0 ) {
439						iterator = iterator - 1;
440						cache.css.width = this._widths[ this.relative( iterator ) ];
441						items.eq( iterator ).css( cache.css );
442					}
443				} else if ( grid ) {
444					cache.css.width = cache.items.width;
445					items.css( cache.css );
446				}
447			}
448		},
449		{
450			filter: [ 'items' ],
451			run: function() {
452				if ( this._coordinates.length < 1 ) {
453					this.$stage.removeAttr( 'style' );
454				}
455			}
456		},
457		{
458			filter: [ 'width', 'items', 'settings' ],
459			run: function( cache ) {
460				cache.current = cache.current ? this.$stage.children().index( cache.current ) : 0;
461				cache.current = Math.max( this.minimum(), Math.min( this.maximum(), cache.current ) );
462				this.reset( cache.current );
463			}
464		},
465		{
466			filter: [ 'position' ],
467			run: function() {
468				this.animate( this.coordinates( this._current ) );
469			}
470		},
471		{
472			filter: [ 'width', 'position', 'items', 'settings' ],
473			run: function() {
474				var rtl = this.settings.rtl ? 1 : -1,
475					padding = this.settings.stagePadding * 2,
476					begin = this.coordinates( this.current() ) + padding,
477					end = begin + ( this.width() * rtl ),
478					inner,
479					outer,
480					matches = [],
481					i,
482					n;
483
484				for ( i = 0, n = this._coordinates.length; i < n; i += 1 ) {
485					inner = this._coordinates[ i - 1 ] || 0;
486					outer = Math.abs( this._coordinates[ i ] ) + ( padding * rtl );
487
488					if ( ( this.op( inner, '<=', begin ) && this.op( inner, '>', end ) ) || ( this.op( outer, '<', begin ) && this.op( outer, '>', end ) ) ) {
489						matches.push( i );
490					}
491				}
492
493				this.$stage.children( '.active' ).removeClass( 'active' );
494				this.$stage.children( ':eq(' + matches.join( '), :eq(' ) + ')' ).addClass( 'active' );
495
496				this.$stage.children( '.center' ).removeClass( 'center' );
497				if ( this.settings.center ) {
498					this.$stage.children().eq( this.current() ).addClass( 'center' );
499				}
500			}
501		}
502	];
503
504	/**
505	 * Create the stage DOM element
506	 */
507	Owl.prototype.initializeStage = function() {
508		this.$stage = this.$element.find( '.' + this.settings.stageClass );
509
510		// if the stage is already in the DOM, grab it and skip stage initialization
511		if ( this.$stage.length ) {
512			return;
513		}
514
515		this.$element.addClass( this.options.loadingClass );
516
517		// create stage
518		this.$stage = $( '<' + this.settings.stageElement + '>', {
519			class: this.settings.stageClass
520		} ).wrap(
521			$( '<div/>', {
522				class: this.settings.stageOuterClass
523			} )
524		);
525
526		// append stage
527		this.$element.append( this.$stage.parent() );
528	};
529
530	/**
531	 * Create item DOM elements
532	 */
533	Owl.prototype.initializeItems = function() {
534		var $items = this.$element.find( '.owl-item' );
535
536		// if the items are already in the DOM, grab them and skip item initialization
537		if ( $items.length ) {
538			this._items = $items.get().map( function( item ) {
539				return $( item );
540			} );
541
542			this._mergers = this._items.map( function() {
543				return 1;
544			} );
545
546			this.refresh();
547
548			return;
549		}
550
551		// append content
552		this.replace( this.$element.children().not( this.$stage.parent() ) );
553
554		// check visibility
555		if ( this.isVisible() ) {
556			// update view
557			this.refresh();
558		} else {
559			// invalidate width
560			this.invalidate( 'width' );
561		}
562
563		this.$element.removeClass( this.options.loadingClass ).addClass( this.options.loadedClass );
564	};
565
566	/**
567	 * Initializes the carousel.
568	 *
569	 * @protected
570	 */
571	Owl.prototype.initialize = function() {
572		var imgs, nestedSelector, width;
573		this.enter( 'initializing' );
574		this.trigger( 'initialize' );
575
576		this.$element.toggleClass( this.settings.rtlClass, this.settings.rtl );
577
578		if ( this.settings.autoWidth && ! this.is( 'pre-loading' ) ) {
vendor: 4,751 bytes, lines 579-767
579			imgs = this.$element.find( 'img' );
580			nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
581			width = this.$element.children( nestedSelector ).width();
582
583			if ( imgs.length && width <= 0 ) {
584				this.preloadAutoWidthImages( imgs );
585			}
586		}
587
588		this.initializeStage();
589		this.initializeItems();
590
591		// register event handlers
592		this.registerEventHandlers();
593
594		this.leave( 'initializing' );
595		this.trigger( 'initialized' );
596	};
597
598	/**
599	 * @returns {boolean} visibility of $element
600	 *                    if you know the carousel will always be visible you can set `checkVisibility` to `false` to
601	 *                    prevent the expensive browser layout forced reflow the $element.is(':visible') does
602	 */
603	Owl.prototype.isVisible = function() {
604		return this.settings.checkVisibility ? this.$element.is( ':visible' ) : true;
605	};
606
607	/**
608	 * Setups the current settings.
609	 *
610	 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
611	 * @todo Support for media queries by using `matchMedia` would be nice.
612	 * @public
613	 */
614	Owl.prototype.setup = function() {
615		var viewport = this.viewport(),
616			overwrites = this.options.responsive,
617			match = -1,
618			settings = null;
619
620		if ( ! overwrites ) {
621			settings = $.extend( {}, this.options );
622		} else {
623			$.each( overwrites, function( breakpoint ) {
624				if ( breakpoint <= viewport && breakpoint > match ) {
625					match = Number( breakpoint );
626				}
627			} );
628
629			settings = $.extend( {}, this.options, overwrites[ match ] );
630			if ( typeof settings.stagePadding === 'function' ) {
631				settings.stagePadding = settings.stagePadding();
632			}
633			delete settings.responsive;
634
635			// responsive class
636			if ( settings.responsiveClass ) {
637				this.$element.attr( 'class', this.$element.attr( 'class' ).replace( new RegExp( '(' + this.options.responsiveClass + '-)\\S+\\s', 'g' ), '$1' + match ) );
638			}
639		}
640
641		this.trigger( 'change', { property: { name: 'settings', value: settings } } );
642		this._breakpoint = match;
643		this.settings = settings;
644		this.invalidate( 'settings' );
645		this.trigger( 'changed', { property: { name: 'settings', value: this.settings } } );
646	};
647
648	/**
649	 * Updates option logic if necessery.
650	 *
651	 * @protected
652	 */
653	Owl.prototype.optionsLogic = function() {
654		if ( this.settings.autoWidth ) {
655			this.settings.stagePadding = false;
656			this.settings.merge = false;
657		}
658	};
659
660	/**
661		* Prepares an item before add.
662	 *
663		* @param item
664		* @todo Rename event parameter `content` to `item`.
665		* @protected
666		* @returns {jQuery|HTMLElement} - The item container.
667		*/
668	Owl.prototype.prepare = function( item ) {
669		var event = this.trigger( 'prepare', { content: item } );
670
671		if ( ! event.data ) {
672			event.data = $( '<' + this.settings.itemElement + '/>' )
673				.addClass( this.options.itemClass )
674				.append( item );
675		}
676
677		this.trigger( 'prepared', { content: event.data } );
678
679		return event.data;
680	};
681
682	/**
683	 * Updates the view.
684	 *
685	 * @public
686	 */
687	Owl.prototype.update = function() {
688		var i = 0,
689			n = this._pipe.length,
690			filter = $.proxy( function( p ) {
691				return this[ p ];
692			}, this._invalidated ),
693			cache = {};
694
695		while ( i < n ) {
696			if ( this._invalidated.all || $.grep( this._pipe[ i ].filter, filter ).length > 0 ) {
697				this._pipe[ i ].run( cache );
698			}
699			i += 1;
700		}
701
702		this._invalidated = {};
703
704		if ( ! this.is( 'valid' ) ) {
705			this.enter( 'valid' );
706		}
707	};
708
709	/**
710	 * Gets the width of the view.
711	 *
712	 * @public
713	 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
714	 * @returns {number} - The width of the view in pixel.
715	 */
716	Owl.prototype.width = function( dimension ) {
717		dimension = dimension || Owl.Width.Default;
718		switch ( dimension ) {
719			case Owl.Width.Inner:
720			case Owl.Width.Outer:
721				return this._width;
722			default:
723				return this._width - ( this.settings.stagePadding * 2 ) + this.settings.margin;
724		}
725	};
726
727	/**
728	 * Refreshes the carousel primarily for adaptive purposes.
729	 *
730	 * @public
731	 */
732	Owl.prototype.refresh = function() {
733		this.enter( 'refreshing' );
734		this.trigger( 'refresh' );
735
736		this.setup();
737
738		this.optionsLogic();
739
740		this.$element.addClass( this.options.refreshClass );
741
742		this.update();
743
744		this.$element.removeClass( this.options.refreshClass );
745
746		this.leave( 'refreshing' );
747		this.trigger( 'refreshed' );
748	};
749
750	/**
751	 * Checks window `resize` event.
752	 *
753	 * @protected
754	 */
755	Owl.prototype.onThrottledResize = function() {
756		window.clearTimeout( this.resizeTimer );
757		this.resizeTimer = window.setTimeout( this._handlers.onResize, this.settings.responsiveRefreshRate );
758	};
759
760	/**
761	 * Checks window `resize` event.
762	 *
763	 * @protected
764	 */
765	Owl.prototype.onResize = function() {
766		if ( ! this._items.length ) {
767			return false;
vendor: 14,446 bytes, lines 768-1302
768		}
769
770		if ( this._width === this.$element.width() ) {
771			return false;
772		}
773
774		if ( ! this.isVisible() ) {
775			return false;
776		}
777
778		this.enter( 'resizing' );
779
780		if ( this.trigger( 'resize' ).isDefaultPrevented() ) {
781			this.leave( 'resizing' );
782			return false;
783		}
784
785		this.invalidate( 'width' );
786
787		this.refresh();
788
789		this.leave( 'resizing' );
790		this.trigger( 'resized' );
791	};
792
793	/**
794	 * Registers event handlers.
795	 *
796	 * @todo Check `msPointerEnabled`
797	 * @todo #261
798	 * @protected
799	 */
800	Owl.prototype.registerEventHandlers = function() {
801		if ( $.support.transition ) {
802			this.$stage.on( $.support.transition.end + '.owl.core', $.proxy( this.onTransitionEnd, this ) );
803		}
804
805		if ( this.settings.responsive !== false ) {
806			this.on( window, 'resize', this._handlers.onThrottledResize );
807		}
808
809		if ( this.settings.mouseDrag ) {
810			this.$element.addClass( this.options.dragClass );
811			this.$stage.on( 'mousedown.owl.core', $.proxy( this.onDragStart, this ) );
812			this.$stage.on( 'dragstart.owl.core selectstart.owl.core', function() {
813				return false;
814			} );
815		}
816
817		if ( this.settings.touchDrag ) {
818			this.$stage.on( 'touchstart.owl.core', $.proxy( this.onDragStart, this ) );
819			this.$stage.on( 'touchcancel.owl.core', $.proxy( this.onDragEnd, this ) );
820		}
821	};
822
823	/**
824	 * Handles `touchstart` and `mousedown` events.
825	 *
826	 * @todo Horizontal swipe threshold as option
827	 * @todo #261
828	 * @protected
829	 * @param {Event} event - The event arguments.
830	 */
831	Owl.prototype.onDragStart = function( event ) {
832		var stage = null;
833
834		if ( event.which === 3 ) {
835			return;
836		}
837
838		if ( $.support.transform ) {
839			stage = this.$stage
840				.css( 'transform' )
841				.replace( /.*\(|\)| /g, '' )
842				.split( ',' );
843			stage = {
844				x: stage[ stage.length === 16 ? 12 : 4 ],
845				y: stage[ stage.length === 16 ? 13 : 5 ]
846			};
847		} else {
848			stage = this.$stage.position();
849			stage = {
850				x: this.settings.rtl ? stage.left + this.$stage.width() - this.width() + this.settings.margin : stage.left,
851				y: stage.top
852			};
853		}
854
855		if ( this.is( 'animating' ) ) {
856			if ( $.support.transform ) {
857				this.animate( stage.x );
858			} else {
859				this.$stage.stop();
860			}
861
862			this.invalidate( 'position' );
863		}
864
865		this.$element.toggleClass( this.options.grabClass, event.type === 'mousedown' );
866
867		this.speed( 0 );
868
869		this._drag.time = new Date().getTime();
870		this._drag.target = $( event.target );
871		this._drag.stage.start = stage;
872		this._drag.stage.current = stage;
873		this._drag.pointer = this.pointer( event );
874
875		$( document ).on( 'mouseup.owl.core touchend.owl.core', $.proxy( this.onDragEnd, this ) );
876
877		$( document ).one(
878			'mousemove.owl.core touchmove.owl.core',
879			$.proxy( function( e ) {
880				var delta = this.difference( this._drag.pointer, this.pointer( e ) );
881
882				$( document ).on( 'mousemove.owl.core touchmove.owl.core', $.proxy( this.onDragMove, this ) );
883
884				if ( Math.abs( delta.x ) < Math.abs( delta.y ) && this.is( 'valid' ) ) {
885					return;
886				}
887
888				e.preventDefault();
889
890				this.enter( 'dragging' );
891				this.trigger( 'drag' );
892			}, this )
893		);
894	};
895
896	/**
897	 * Handles the `touchmove` and `mousemove` events.
898	 *
899	 * @todo #261
900	 * @protected
901	 * @param {Event} event - The event arguments.
902	 */
903	Owl.prototype.onDragMove = function( event ) {
904		var minimum = null,
905			maximum = null,
906			pull = null,
907			delta = this.difference( this._drag.pointer, this.pointer( event ) ),
908			stage = this.difference( this._drag.stage.start, delta );
909
910		if ( ! this.is( 'dragging' ) ) {
911			return;
912		}
913
914		event.preventDefault();
915
916		if ( this.settings.loop ) {
917			minimum = this.coordinates( this.minimum() );
918			maximum = this.coordinates( this.maximum() + 1 ) - minimum;
919			stage.x = ( ( ( ( stage.x - minimum ) % maximum ) + maximum ) % maximum ) + minimum;
920		} else {
921			minimum = this.settings.rtl ? this.coordinates( this.maximum() ) : this.coordinates( this.minimum() );
922			maximum = this.settings.rtl ? this.coordinates( this.minimum() ) : this.coordinates( this.maximum() );
923			pull = this.settings.pullDrag ? ( -1 * delta.x ) / 5 : 0;
924			stage.x = Math.max( Math.min( stage.x, minimum + pull ), maximum + pull );
925		}
926
927		this._drag.stage.current = stage;
928
929		this.animate( stage.x );
930	};
931
932	/**
933	 * Handles the `touchend` and `mouseup` events.
934	 *
935	 * @todo #261
936	 * @todo Threshold for click event
937	 * @protected
938	 * @param {Event} event - The event arguments.
939	 */
940	Owl.prototype.onDragEnd = function( event ) {
941		var delta = this.difference( this._drag.pointer, this.pointer( event ) ),
942			stage = this._drag.stage.current,
943			direction,
944			isdeltax = delta.x > 0;
945		if ( ( isdeltax && ! this.settings.rtl ) || ( this.settings.rtl && ! isdeltax ) ) {
946			direction = 'left';
947		} else {
948			direction = 'right';
949		}
950		$( document ).off( '.owl.core' );
951
952		this.$element.removeClass( this.options.grabClass );
953
954		if ( ( delta.x !== 0 && this.is( 'dragging' ) ) || ! this.is( 'valid' ) ) {
955			this.speed( this.settings.dragEndSpeed || this.settings.smartSpeed );
956			this.current( this.closest( stage.x, delta.x !== 0 ? direction : this._drag.direction ) );
957			this.invalidate( 'position' );
958			this.update();
959
960			this._drag.direction = direction;
961
962			if ( Math.abs( delta.x ) > 3 || new Date().getTime() - this._drag.time > 300 ) {
963				this._drag.target.one( 'click.owl.core', function() {
964					return false;
965				} );
966			}
967		}
968
969		if ( ! this.is( 'dragging' ) ) {
970			return;
971		}
972
973		this.leave( 'dragging' );
974		this.trigger( 'dragged' );
975	};
976
977	/**
978	 * Gets absolute position of the closest item for a coordinate.
979	 *
980	 * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
981	 * @protected
982	 * @param {number} coordinate - The coordinate in pixel.
983	 * @param {string} direction - The direction to check for the closest item. Ether `left` or `right`.
984	 * @return {number} - The absolute position of the closest item.
985	 */
986	Owl.prototype.closest = function( coordinate, direction ) {
987		var position = -1,
988			pull = 30,
989			width = this.width(),
990			coordinates = this.coordinates();
991
992		if ( ! this.settings.freeDrag ) {
993			// check closest item
994			$.each(
995				coordinates,
996				$.proxy( function( index, value ) {
997					// on a left pull, check on current index
998					if ( direction === 'left' && coordinate > value - pull && coordinate < value + pull ) {
999						position = index;
1000						// on a right pull, check on previous index
1001						// to do so, subtract width from value and set position = index + 1
1002					} else if ( direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull ) {
1003						position = index + 1;
1004					} else if ( this.op( coordinate, '<', value ) && this.op( coordinate, '>', coordinates[ index + 1 ] !== undefined ? coordinates[ index + 1 ] : value - width ) ) {
1005						position = direction === 'left' ? index + 1 : index;
1006					}
1007					return position === -1;
1008				}, this )
1009			);
1010		}
1011
1012		if ( ! this.settings.loop ) {
1013			// non loop boundries
1014			if ( this.op( coordinate, '>', coordinates[ this.minimum() ] ) ) {
1015				coordinate = this.minimum();
1016				position = coordinate;
1017			} else if ( this.op( coordinate, '<', coordinates[ this.maximum() ] ) ) {
1018				coordinate = this.maximum();
1019				position = coordinate;
1020			}
1021		}
1022
1023		return position;
1024	};
1025
1026	/**
1027	 * Animates the stage.
1028	 *
1029	 * @todo #270
1030	 * @public
1031	 * @param {number} coordinate - The coordinate in pixels.
1032	 */
1033	Owl.prototype.animate = function( coordinate ) {
1034		var animate = this.speed() > 0;
1035
1036		if ( this.is( 'animating' ) ) {
1037			this.onTransitionEnd();
1038		}
1039
1040		if ( animate ) {
1041			this.enter( 'animating' );
1042			this.trigger( 'translate' );
1043		}
1044
1045		if ( $.support.transform3d && $.support.transition ) {
1046			this.$stage.css( {
1047				transform: 'translate3d(' + coordinate + 'px,0px,0px)',
1048				transition: ( this.speed() / 1000 ) + 's' + ( this.settings.slideTransition ? ' ' + this.settings.slideTransition : '' )
1049			} );
1050		} else if ( animate ) {
1051			this.$stage.animate(
1052				{
1053					left: coordinate + 'px'
1054				},
1055				this.speed(),
1056				this.settings.fallbackEasing,
1057				$.proxy( this.onTransitionEnd, this )
1058			);
1059		} else {
1060			this.$stage.css( {
1061				left: coordinate + 'px'
1062			} );
1063		}
1064	};
1065
1066	/**
1067	 * Checks whether the carousel is in a specific state or not.
1068	 *
1069	 * @param {string} state - The state to check.
1070	 * @returns {boolean} - The flag which indicates if the carousel is busy.
1071	 */
1072	Owl.prototype.is = function( state ) {
1073		return this._states.current[ state ] && this._states.current[ state ] > 0;
1074	};
1075
1076	/**
1077	 * Sets the absolute position of the current item.
1078	 *
1079	 * @public
1080	 * @param {number} [position] - The new absolute position or nothing to leave it unchanged.
1081	 * @returns {number} - The absolute position of the current item.
1082	 */
1083	Owl.prototype.current = function( position ) {
1084		var event;
1085		if ( position === undefined ) {
1086			return this._current;
1087		}
1088
1089		if ( this._items.length === 0 ) {
1090			return undefined;
1091		}
1092
1093		position = this.normalize( position );
1094
1095		if ( this._current !== position ) {
1096			event = this.trigger( 'change', { property: { name: 'position', value: position } } );
1097
1098			if ( event.data !== undefined ) {
1099				position = this.normalize( event.data );
1100			}
1101
1102			this._current = position;
1103
1104			this.invalidate( 'position' );
1105
1106			this.trigger( 'changed', { property: { name: 'position', value: this._current } } );
1107		}
1108
1109		return this._current;
1110	};
1111
1112	/**
1113	 * Invalidates the given part of the update routine.
1114	 *
1115	 * @param {string} [part] - The part to invalidate.
1116	 * @returns {Array.<string>} - The invalidated parts.
1117	 */
1118	Owl.prototype.invalidate = function( part ) {
1119		if ( typeof part === 'string' ) {
1120			this._invalidated[ part ] = true;
1121			if ( this.is( 'valid' ) ) {
1122				this.leave( 'valid' );
1123			}
1124		}
1125		return $.map( this._invalidated, function( v, i ) {
1126			return i;
1127		} );
1128	};
1129
1130	/**
1131	 * Resets the absolute position of the current item.
1132	 *
1133	 * @public
1134	 * @param {number} position - The absolute position of the new item.
1135	 */
1136	Owl.prototype.reset = function( position ) {
1137		position = this.normalize( position );
1138
1139		if ( position === undefined ) {
1140			return;
1141		}
1142
1143		this._speed = 0;
1144		this._current = position;
1145
1146		this.suppress( [ 'translate', 'translated' ] );
1147
1148		this.animate( this.coordinates( position ) );
1149
1150		this.release( [ 'translate', 'translated' ] );
1151	};
1152
1153	/**
1154	 * Normalizes an absolute or a relative position of an item.
1155	 *
1156	 * @public
1157	 * @param {number} position - The absolute or relative position to normalize.
1158	 * @param {boolean} [relative=false] - Whether the given position is relative or not.
1159	 * @returns {number} - The normalized position.
1160	 */
1161	Owl.prototype.normalize = function( position, relative ) {
1162		var n = this._items.length,
1163			m = relative ? 0 : this._clones.length;
1164
1165		if ( ! this.isNumeric( position ) || n < 1 ) {
1166			position = undefined;
1167		} else if ( position < 0 || position >= n + m ) {
1168			position = ( ( ( ( position - ( m / 2 ) ) % n ) + n ) % n ) + ( m / 2 );
1169		}
1170
1171		return position;
1172	};
1173
1174	/**
1175	 * Converts an absolute position of an item into a relative one.
1176	 *
1177	 * @public
1178	 * @param {number} position - The absolute position to convert.
1179	 * @returns {number} - The converted position.
1180	 */
1181	Owl.prototype.relative = function( position ) {
1182		position -= this._clones.length / 2;
1183		return this.normalize( position, true );
1184	};
1185
1186	/**
1187	 * Gets the maximum position for the current item.
1188	 *
1189	 * @public
1190	 * @param {boolean} [relative=false] - Whether to return an absolute position or a relative position.
1191	 * @returns {number}
1192	 */
1193	Owl.prototype.maximum = function( relative ) {
1194		var settings = this.settings,
1195			maximum = this._coordinates.length,
1196			iterator,
1197			reciprocalItemsWidth,
1198			elementWidth;
1199
1200		if ( settings.loop ) {
1201			maximum = ( this._clones.length / 2 ) + this._items.length - 1;
1202		} else if ( settings.autoWidth || settings.merge ) {
1203			iterator = this._items.length;
1204			if ( iterator ) {
1205				iterator = iterator - 1;
1206				reciprocalItemsWidth = this._items[ iterator ].width();
1207				elementWidth = this.$element.width();
1208				while ( iterator > 0 ) {
1209					reciprocalItemsWidth += this._items[ iterator ].width() + this.settings.margin;
1210					if ( reciprocalItemsWidth > elementWidth ) {
1211						break;
1212					}
1213					iterator = iterator - 1;
1214				}
1215			}
1216			maximum = iterator + 1;
1217		} else if ( settings.center ) {
1218			maximum = this._items.length - 1;
1219		} else {
1220			maximum = this._items.length - settings.items;
1221		}
1222
1223		if ( relative ) {
1224			maximum -= this._clones.length / 2;
1225		}
1226
1227		return Math.max( maximum, 0 );
1228	};
1229
1230	/**
1231	 * Gets the minimum position for the current item.
1232	 *
1233	 * @public
1234	 * @param {boolean} [relative=false] - Whether to return an absolute position or a relative position.
1235	 * @returns {number}
1236	 */
1237	Owl.prototype.minimum = function( relative ) {
1238		return relative ? 0 : this._clones.length / 2;
1239	};
1240
1241	/**
1242	 * Gets an item at the specified relative position.
1243	 *
1244	 * @public
1245	 * @param {number} [position] - The relative position of the item.
1246	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1247	 */
1248	Owl.prototype.items = function( position ) {
1249		if ( position === undefined ) {
1250			return this._items.slice();
1251		}
1252
1253		position = this.normalize( position, true );
1254		return this._items[ position ];
1255	};
1256
1257	/**
1258	 * Gets an item at the specified relative position.
1259	 *
1260	 * @public
1261	 * @param {number} [position] - The relative position of the item.
1262	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
1263	 */
1264	Owl.prototype.mergers = function( position ) {
1265		if ( position === undefined ) {
1266			return this._mergers.slice();
1267		}
1268
1269		position = this.normalize( position, true );
1270		return this._mergers[ position ];
1271	};
1272
1273	/**
1274	 * Gets the absolute positions of clones for an item.
1275	 *
1276	 * @public
1277	 * @param {number} [position] - The relative position of the item.
1278	 * @returns {Array.<number>} - The absolute positions of clones for the item or all if no position was given.
1279	 */
1280	Owl.prototype.clones = function( position ) {
1281		var odd = this._clones.length / 2,
1282			even = odd + this._items.length,
1283			map = function( index ) {
1284				return index % 2 === 0 ? even + ( index / 2 ) : odd - ( ( index + 1 ) / 2 );
1285			};
1286
1287		if ( position === undefined ) {
1288			return $.map( this._clones, function( v, i ) {
1289				return map( i );
1290			} );
1291		}
1292
1293		return $.map( this._clones, function( v, i ) {
1294			return v === position ? map( i ) : null;
1295		} );
1296	};
1297
1298	/**
1299	 * Sets the current animation speed.
1300	 *
1301	 * @public
1302	 * @param {number}
1302 [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
1303	 * @returns {number} - The current animation speed in milliseconds.
1304	 */
1305	Owl.prototype.speed = function( speed ) {
1306		if ( speed !== undefined ) {
1307			this._speed = speed;
1308		}
1309
1310		return this._speed;
1311	};
1312
1313	/**
1314	 * Gets the coordinate of an item.
1315	 *
1316	 * @todo The name of this method is missleanding.
1317	 * @public
1318	 * @param {number} position - The absolute position of the item within `minimum()` and `maximum()`.
1319	 * @returns {number|Array.<number>} - The coordinate of the item in pixel or all coordinates.
1320	 */
1321	Owl.prototype.coordinates = function( position ) {
1322		var multiplier = 1,
1323			newPosition = position - 1,
1324			coordinate;
1325
1326		if ( position === undefined ) {
1327			return $.map(
1328				this._coordinates,
1329				$.proxy( function( scoordinate, index ) {
1330					return this.coordinates( index );
1331				}, this )
1332			);
1333		}
1334
1335		if ( this.settings.center ) {
1336			if ( this.settings.rtl ) {
1337				multiplier = -1;
1338				newPosition = position + 1;
1339			}
1340
1341			coordinate = this._coordinates[ position ];
1342			coordinate += ( ( this.width() - coordinate + ( this._coordinates[ newPosition ] || 0 ) ) / 2 ) * multiplier;
1343		} else {
1344			coordinate = this._coordinates[ newPosition ] || 0;
1345		}
1346
1347		coordinate = Math.ceil( coordinate );
1348
1349		return coordinate;
1350	};
1351
1352	/**
1353	 * Calculates the speed for a translation.
1354	 *
1355	 * @protected
1356	 * @param {number} from - The absolute position of the start item.
1357	 * @param {number} to - The absolute position of the target item.
1358	 * @param {number} [factor=undefined] - The time factor in milliseconds.
1359	 * @returns {number} - The time in milliseconds for the translation.
1360	 */
1361	Owl.prototype.duration = function( from, to, factor ) {
1362		if ( factor === 0 ) {
1363			return 0;
1364		}
1365
1366		return Math.min( Math.max( Math.abs( to - from ), 1 ), 6 ) * Math.abs( factor || this.settings.smartSpeed );
1367	};
1368
1369	/**
1370	 * Slides to the specified item.
1371	 *
1372	 * @public
1373	 * @param {number} position - The position of the item.
1374	 * @param {number} [speed] - The time in milliseconds for the transition.
1375	 */
1376	Owl.prototype.to = function( position, speed ) {
1377		var current = this.current(),
1378			revert = null,
1379			distance = position - this.relative( current ),
1380			direction = ( distance > 0 ) - ( distance < 0 ),
1381			items = this._items.length,
1382			minimum = this.minimum(),
1383			maximum = this.maximum();
1384
1385		if ( this.settings.loop ) {
1386			if ( ! this.settings.rewind && Math.abs( distance ) > items / 2 ) {
1387				distance += direction * -1 * items;
1388			}
1389
1390			position = current + distance;
1391			revert = ( ( ( ( position - minimum ) % items ) + items ) % items ) + minimum;
1392
1393			if ( revert !== position && revert - distance <= maximum && revert - distance > 0 ) {
1394				current = revert - distance;
1395				position = revert;
1396				this.reset( current );
1397			}
1398		} else if ( this.settings.rewind ) {
1399			maximum += 1;
1400			position = ( ( position % maximum ) + maximum ) % maximum;
1401		} else {
1402			position = Math.max( minimum, Math.min( maximum, position ) );
1403		}
1404
1405		this.speed( this.duration( current, position, speed ) );
1406		this.current( position );
1407
1408		if ( this.isVisible() ) {
1409			this.update();
1410		}
1411	};
1412
1413	/**
1414	 * Slides to the next item.
1415	 *
1416	 * @public
1417	 * @param {number} [speed] - The time in milliseconds for the transition.
1418	 */
1419	Owl.prototype.next = function( speed ) {
1420		speed = speed || false;
1421		this.to( this.relative( this.current() ) + 1, speed );
1422	};
1423
1424	/**
1425	 * Slides to the previous item.
1426	 *
1427	 * @public
1428	 * @param {number} [speed] - The time in milliseconds for the transition.
1429	 */
1430	Owl.prototype.prev = function( speed ) {
1431		speed = speed || false;
1432		this.to( this.relative( this.current() ) - 1, speed );
1433	};
1434
1435	/**
1436	 * Handles the end of an animation.
1437	 *
1438	 * @protected
1439	 * @param {Event} event - The event arguments.
1440	 */
1441	Owl.prototype.onTransitionEnd = function( event ) {
1442		// if css2 animation then event object is undefined
1443		if ( event !== undefined ) {
1444			event.stopPropagation();
1445
1446			// Catch only owl-stage transitionEnd event
1447			if ( ( event.target || event.srcElement || event.originalTarget ) !== this.$stage.get( 0 ) ) {
1448				return false;
vendor: 12,558 bytes, lines 1449-1908
1449			}
1450		}
1451
1452		this.leave( 'animating' );
1453		this.trigger( 'translated' );
1454	};
1455
1456	/**
1457	 * Gets viewport width.
1458	 *
1459	 * @protected
1460	 * @return {number} - The width in pixel.
1461	 */
1462	Owl.prototype.viewport = function() {
1463		var width;
1464		if ( this.options.responsiveBaseElement !== window ) {
1465			width = $( this.options.responsiveBaseElement ).width();
1466		} else if ( window.innerWidth ) {
1467			width = window.innerWidth;
1468		} else if ( document.documentElement && document.documentElement.clientWidth ) {
1469			width = document.documentElement.clientWidth;
1470		} else {
1471			//Cannot detect viewport width
1472			return width;
1473		}
1474		return width;
1475	};
1476
1477	/**
1478	 * Replaces the current content.
1479	 *
1480	 * @public
1481	 * @param {HTMLElement|jQuery|string} content - The new content.
1482	 */
1483	Owl.prototype.replace = function( content ) {
1484		this.$stage.empty();
1485		this._items = [];
1486
1487		if ( content ) {
1488			content = content instanceof window.jQuery ? content : $( content );
1489		}
1490
1491		if ( this.settings.nestedItemSelector ) {
1492			content = content.find( '.' + this.settings.nestedItemSelector );
1493		}
1494
1495		content
1496			.filter( function() {
1497				return this.nodeType === 1;
1498			} )
1499			.each(
1500				$.proxy( function( index, item ) {
1501					item = this.prepare( item );
1502					this.$stage.append( item );
1503					this._items.push( item );
1504					this._mergers.push( item.find( '[data-merge]' ).addBack( '[data-merge]' ).attr( 'data-merge' ) * 1 || 1 );
1505				}, this )
1506			);
1507
1508		this.reset( this.isNumeric( this.settings.startPosition ) ? this.settings.startPosition : 0 );
1509
1510		this.invalidate( 'items' );
1511	};
1512
1513	/**
1514	 * Adds an item.
1515	 *
1516	 * @todo Use `item` instead of `content` for the event arguments.
1517	 * @public
1518	 * @param {HTMLElement|jQuery|string} content - The item content to add.
1519	 * @param {number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
1520	 */
1521	Owl.prototype.add = function( content, position ) {
1522		var current = this.relative( this._current );
1523
1524		position = position === undefined ? this._items.length : this.normalize( position, true );
1525		content = content instanceof window.jQuery ? content : $( content );
1526
1527		this.trigger( 'add', { content: content, position: position } );
1528
1529		content = this.prepare( content );
1530
1531		if ( this._items.length === 0 || position === this._items.length ) {
1532			if ( this._items.length === 0 ) {
1533				this.$stage.append( content );
1534			}
1535			if ( this._items.length !== 0 ) {
1536				this._items[ position - 1 ].after( content );
1537			}
1538			this._items.push( content );
1539			this._mergers.push( content.find( '[data-merge]' ).addBack( '[data-merge]' ).attr( 'data-merge' ) * 1 || 1 );
1540		} else {
1541			this._items[ position ].before( content );
1542			this._items.splice( position, 0, content );
1543			this._mergers.splice( position, 0, content.find( '[data-merge]' ).addBack( '[data-merge]' ).attr( 'data-merge' ) * 1 || 1 );
1544		}
1545
1546		if ( this._items[ current ] ) {
1547			this.reset( this._items[ current ].index() );
1548		}
1549
1550		this.invalidate( 'items' );
1551
1552		this.trigger( 'added', { content: content, position: position } );
1553	};
1554
1555	/**
1556	 * Removes an item by its position.
1557	 *
1558	 * @todo Use `item` instead of `content` for the event arguments.
1559	 * @public
1560	 * @param {number} position - The relative position of the item to remove.
1561	 */
1562	Owl.prototype.remove = function( position ) {
1563		position = this.normalize( position, true );
1564
1565		if ( position === undefined ) {
1566			return;
1567		}
1568
1569		this.trigger( 'remove', { content: this._items[ position ], position: position } );
1570
1571		this._items[ position ].remove();
1572		this._items.splice( position, 1 );
1573		this._mergers.splice( position, 1 );
1574
1575		this.invalidate( 'items' );
1576
1577		this.trigger( 'removed', { content: null, position: position } );
1578	};
1579
1580	/**
1581		* Preloads images with auto width.
1582	 *
1583		* @param images
1584		* @todo Replace by a more generic approach
1585		* @protected
1586		*/
1587	Owl.prototype.preloadAutoWidthImages = function( images ) {
1588		images.each(
1589			$.proxy( function( i, element ) {
1590				this.enter( 'pre-loading' );
1591				element = $( element );
1592				$( new Image() )
1593					.one(
1594						'load',
1595						$.proxy( function( e ) {
1596							element.attr( 'src', e.target.src );
1597							element.css( 'opacity', 1 );
1598							this.leave( 'pre-loading' );
1599							if ( ! this.is( 'pre-loading' ) && ! this.is( 'initializing' ) ) {
1600								this.refresh();
1601							}
1602						}, this )
1603					)
1604					.attr( 'src', element.attr( 'src' ) || element.attr( 'data-src' ) || element.attr( 'data-src-retina' ) );
1605			}, this )
1606		);
1607	};
1608
1609	/**
1610	 * Destroys the carousel.
1611	 *
1612	 * @public
1613	 */
1614	Owl.prototype.destroy = function() {
1615		this.$element.off( '.owl.core' );
1616		this.$stage.off( '.owl.core' );
1617		$( document ).off( '.owl.core' );
1618
1619		if ( this.settings.responsive !== false ) {
1620			window.clearTimeout( this.resizeTimer );
1621			this.off( window, 'resize', this._handlers.onThrottledResize );
1622		}
1623
1624		$.map( this._plugins, function( value ) {
1625			return value;
1626		} ).forEach( function( inst ) {
1627			if ( inst ) {
1628				inst.destroy();
1629			}
1630		} );
1631
1632		this.$stage.children( '.cloned' ).remove();
1633
1634		this.$stage.unwrap();
1635		this.$stage.children().contents().unwrap();
1636		this.$stage.children().unwrap();
1637		this.$stage.remove();
1638		this.$element
1639			.removeClass( this.options.refreshClass )
1640			.removeClass( this.options.loadingClass )
1641			.removeClass( this.options.loadedClass )
1642			.removeClass( this.options.rtlClass )
1643			.removeClass( this.options.dragClass )
1644			.removeClass( this.options.grabClass )
1645			.attr( 'class', this.$element.attr( 'class' ).replace( new RegExp( this.options.responsiveClass + '-\\S+\\s', 'g' ), '' ) )
1646			.removeData( 'owl.carousel' );
1647	};
1648
1649	/**
1650	 * Operators to calculate right-to-left and left-to-right.
1651	 *
1652	 * @protected
1653	 * @param {number} [a] - The left side operand.
1654	 * @param {string} [o] - The operator.
1655	 * @param {number} [b] - The right side operand.
1656	 */
1657	Owl.prototype.op = function( a, o, b ) {
1658		var rtl = this.settings.rtl;
1659		switch ( o ) {
1660			case '<':
1661				return rtl ? a > b : a < b;
1662			case '>':
1663				return rtl ? a < b : a > b;
1664			case '>=':
1665				return rtl ? a <= b : a >= b;
1666			case '<=':
1667				return rtl ? a >= b : a <= b;
1668			default:
1669				break;
1670		}
1671	};
1672
1673	/**
1674	 * Attaches to an internal event.
1675	 *
1676	 * @protected
1677	 * @param {HTMLElement} element - The event source.
1678	 * @param {string} event - The event name.
1679	 * @param {Function} listener - The event handler to attach.
1680	 * @param {boolean} capture - Wether the event should be handled at the capturing phase or not.
1681	 */
1682	Owl.prototype.on = function( element, event, listener, capture ) {
1683		if ( element.addEventListener ) {
1684			element.addEventListener( event, listener, capture );
1685		} else if ( element.attachEvent ) {
1686			element.attachEvent( 'on' + event, listener );
1687		}
1688	};
1689
1690	/**
1691	 * Detaches from an internal event.
1692	 *
1693	 * @protected
1694	 * @param {HTMLElement} element - The event source.
1695	 * @param {string} event - The event name.
1696	 * @param {Function} listener - The attached event handler to detach.
1697	 * @param {boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
1698	 */
1699	Owl.prototype.off = function( element, event, listener, capture ) {
1700		if ( element.removeEventListener ) {
1701			element.removeEventListener( event, listener, capture );
1702		} else if ( element.detachEvent ) {
1703			element.detachEvent( 'on' + event, listener );
1704		}
1705	};
1706
1707	/**
1708	 * Triggers a public event.
1709	 *
1710	 * @todo Remove `status`, `relatedTarget` should be used instead.
1711	 * @protected
1712	 * @param {string} name - The event name.
1713	 * @param {*} [data=null] - The event data.
1714	 * @param {string} [namespace=carousel] - The event namespace.
1715	 * @returns {Event} - The event arguments.
1716	 */
1717	Owl.prototype.trigger = function( name, data, namespace ) {
1718		var status = {
1719				item: { count: this._items.length, index: this.current() }
1720			},
1721			handler = $.camelCase(
1722				$.grep( [ 'on', name, namespace ], function( v ) {
1723					return v;
1724				} )
1725					.join( '-' )
1726					.toLowerCase()
1727			),
1728			/*eslint new-cap: [2, {capIsNewExceptions: ["Event"]}]*/
1729			event = $.Event( [ name, 'owl', namespace || 'carousel' ].join( '.' ).toLowerCase(), $.extend( { relatedTarget: this }, status, data ) );
1730
1731		if ( ! this._supress[ name ] ) {
1732			$.each( this._plugins, function( sname, plugin ) {
1733				if ( plugin.onTrigger ) {
1734					plugin.onTrigger( event );
1735				}
1736			} );
1737
1738			this.register( { type: Owl.Type.Event, name: name } );
1739			this.$element.trigger( event );
1740
1741			if ( this.settings && typeof this.settings[ handler ] === 'function' ) {
1742				this.settings[ handler ].call( this, event );
1743			}
1744		}
1745
1746		return event;
1747	};
1748
1749	/**
1750	 * Enters a state.
1751	 *
1752	 * @param name - The state name.
1753	 */
1754	Owl.prototype.enter = function( name ) {
1755		$.each(
1756			[ name ].concat( this._states.tags[ name ] || [] ),
1757			$.proxy( function( i, sname ) {
1758				if ( this._states.current[ sname ] === undefined ) {
1759					this._states.current[ sname ] = 0;
1760				}
1761
1762				this._states.current[ sname ] += 1;
1763			}, this )
1764		);
1765	};
1766
1767	/**
1768	 * Leaves a state.
1769	 *
1770	 * @param name - The state name.
1771	 */
1772	Owl.prototype.leave = function( name ) {
1773		$.each(
1774			[ name ].concat( this._states.tags[ name ] || [] ),
1775			$.proxy( function( i, sname ) {
1776				this._states.current[ sname ] -= 1;
1777			}, this )
1778		);
1779	};
1780
1781	/**
1782	 * Registers an event or state.
1783	 *
1784	 * @public
1785	 * @param {Object} object - The event or state to register.
1786	 */
1787	Owl.prototype.register = function( object ) {
1788		var _default;
1789		if ( object.type === Owl.Type.Event ) {
1790			if ( ! $.event.special[ object.name ] ) {
1791				$.event.special[ object.name ] = {};
1792			}
1793
1794			if ( ! $.event.special[ object.name ].owl ) {
1795				_default = $.event.special[ object.name ]._default;
1796				$.event.special[ object.name ]._default = function( e ) {
1797					if ( _default && _default.apply && ( ! e.namespace || e.namespace.indexOf( 'owl' ) === -1 ) ) {
1798						return _default.apply( this, arguments );
1799					}
1800					return e.namespace && e.namespace.indexOf( 'owl' ) > -1;
1801				};
1802				$.event.special[ object.name ].owl = true;
1803			}
1804		} else if ( object.type === Owl.Type.State ) {
1805			if ( ! this._states.tags[ object.name ] ) {
1806				this._states.tags[ object.name ] = object.tags;
1807			} else {
1808				this._states.tags[ object.name ] = this._states.tags[ object.name ].concat( object.tags );
1809			}
1810
1811			this._states.tags[ object.name ] = $.grep(
1812				this._states.tags[ object.name ],
1813				$.proxy( function( tag, i ) {
1814					return $.inArray( tag, this._states.tags[ object.name ] ) === i;
1815				}, this )
1816			);
1817		}
1818	};
1819
1820	/**
1821	 * Suppresses events.
1822	 *
1823	 * @protected
1824	 * @param {Array.<string>} events - The events to suppress.
1825	 */
1826	Owl.prototype.suppress = function( events ) {
1827		$.each(
1828			events,
1829			$.proxy( function( index, event ) {
1830				this._supress[ event ] = true;
1831			}, this )
1832		);
1833	};
1834
1835	/**
1836	 * Releases suppressed events.
1837	 *
1838	 * @protected
1839	 * @param {Array.<string>} events - The events to release.
1840	 */
1841	Owl.prototype.release = function( events ) {
1842		$.each(
1843			events,
1844			$.proxy( function( index, event ) {
1845				delete this._supress[ event ];
1846			}, this )
1847		);
1848	};
1849
1850	/**
1851		* Gets unified pointer coordinates from event.
1852		*
1853		* @todo #261
1854		* @param event
1855		* @protected
1856		* @param {Event} - The `mousedown` or `touchstart` event.
1857		* @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
1858		*/
1859	Owl.prototype.pointer = function( event ) {
1860		var result = { x: null, y: null };
1861
1862		event = event.originalEvent || event || window.event;
1863
1864		event = event.touches && event.touches.length ? event.touches[ 0 ] : event.changedTouches && event.changedTouches.length ? event.changedTouches[ 0 ] : event;
1865
1866		if ( event.pageX ) {
1867			result.x = event.pageX;
1868			result.y = event.pageY;
1869		} else {
1870			result.x = event.clientX;
1871			result.y = event.clientY;
1872		}
1873
1874		return result;
1875	};
1876
1877	/**
1878		* Determines if the input is a Number or something that can be coerced to a Number
1879	 *
1880		* @protected
1881		* @param number
1882		* @param {number|string|Object|Array|boolean|RegExp|Function|symbol} - The input to be tested
1883		* @returns {boolean} - An indication if the input is a Number or can be coerced to a Number
1884		*/
1885	Owl.prototype.isNumeric = function( number ) {
1886		return ! isNaN( parseFloat( number ) );
1887	};
1888
1889	/**
1890		* Gets the difference of two vectors.
1891	 *
1892		* @todo #261
1893		* @protected
1894		* @param first
1895		* @param second
1896		* @param {Object} - The first vector.
1897		* @param {Object} - The second vector.
1898		* @returns {Object} - The difference.
1899		*/
1900	Owl.prototype.difference = function( first, second ) {
1901		return {
1902			x: first.x - second.x,
1903			y: first.y - second.y
1904		};
1905	};
1906
1907	/**
1908		* The jQuery Plugin for the Owl Carousel
1909	 *
1910		* @param option
1911		* @todo Navigation plugin `next` and `prev`
1912		* @public
1913		*/
1914	$.fn.tmowlCarousel = function( option ) {
1915		var args = Array.prototype.slice.call( arguments, 1 );
1916
1917		return this.each( function() {
1918			var $this = $( this ),
1919				data = $this.data( 'owl.carousel' );
1920
1921			if ( ! data ) {
1922				data = new Owl( this, typeof option === 'object' && option );
1923				$this.data( 'owl.carousel', data );
1924
1925				$.each( [ 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove' ], function( i, event ) {
1926					data.register( { type: Owl.Type.Event, name: event } );
1927					data.$element.on(
1928						event + '.owl.carousel.core',
1929						$.proxy( function( e ) {
1930							if ( e.namespace && e.relatedTarget !== this ) {
1931								this.suppress( [ event ] );
1932								data[ event ].apply( this, [].slice.call( arguments, 1 ) );
1933								this.release( [ event ] );
1934							}
1935						}, data )
1936					);
1937				} );
1938			}
1939
1940			if ( typeof option === 'string' && option.charAt( 0 ) !== '_' ) {
1941				data[ option ].apply( data, args );
1942			}
1943		} );
1944	};
1945
1946	/**
1947	 * The constructor for the jQuery Plugin
1948	 *
1949	 * @public
1950	 */
1951	$.fn.tmowlCarousel.Constructor = Owl;
1952}( window.Zepto || window.jQuery, window, document ) );
1953
1954/**
1955 * AutoRefresh Plugin
1956 *
1957 * @version 2.3.4
1958 * @author Artus Kolanowski
1959 * @author David Deutsch
1960 * @license The MIT License (MIT)
1961 */
1962( function( $, window ) {
1963	'use strict';
1964	/**
1965	 * Creates the auto refresh plugin.
1966	 *
1967	 * @class The Auto Refresh Plugin
1968	 * @param {Owl} carousel - The Owl Carousel
1969	 */
1970	var AutoRefresh = function( carousel ) {
1971		/**
1972		 * Reference to the core.
1973		 *
1974		 * @protected
1975		 * @type {Owl}
1976		 */
1977		this._core = carousel;
1978
1979		/**
1980		 * Refresh interval.
1981		 *
1982		 * @protected
1983		 * @type {number}
1984		 */
1985		this._interval = null;
1986
1987		/**
1988		 * Whether the element is currently visible or not.
1989		 *
1990		 * @protected
1991		 * @type {boolean}
1992		 */
1993		this._visible = null;
1994
1995		/**
1996		 * All event handlers.
1997		 *
1998		 * @protected
1999		 * @type {Object}
2000		 */
2001		this._handlers = {
2002			'initialized.owl.carousel': $.proxy( function( e ) {
2003				if ( e.namespace && this._core.settings.autoRefresh ) {
2004					this.watch();
2005				}
2006			}, this )
2007		};
2008
2009		// set default options
2010		this._core.options = $.extend( {}, AutoRefresh.Defaults, this._core.options );
2011
2012		// register event handlers
2013		this._core.$element.on( this._handlers );
2014	};
2015
2016	/**
2017	 * Default options.
2018	 *
2019	 * @public
2020	 */
2021	AutoRefresh.Defaults = {
2022		autoRefresh: true,
2023		autoRefreshInterval: 500
2024	};
2025
2026	/**
2027	 * Watches the element.
2028	 */
2029	AutoRefresh.prototype.watch = function() {
2030		if ( this._interval ) {
2031			return;
2032		}
2033
2034		this._visible = this._core.isVisible();
2035		this._interval = window.setInterval( $.proxy( this.refresh, this ), this._core.settings.autoRefreshInterval );
2036	};
2037
2038	/**
2039	 * Refreshes the element.
2040	 */
2041	AutoRefresh.prototype.refresh = function() {
2042		if ( this._core.isVisible() === this._visible ) {
2043			return;
2044		}
2045
2046		this._visible = ! this._visible;
2047
2048		this._core.$element.toggleClass( 'owl-hidden', ! this._visible );
2049
2050		if ( this._visible && this._core.invalidate( 'width' ) ) {
2051			this._core.refresh();
2052		}
2053	};
2054
2055	/**
2056	 * Destroys the plugin.
2057	 */
2058	AutoRefresh.prototype.destroy = function() {
2059		var handler, property;
2060
2061		window.clearInterval( this._interval );
2062
2063		for ( handler in this._handlers ) {
2064			if ( handler ) {
2065				this._core.$element.off( handler, this._handlers[ handler ] );
2066			}
2067		}
2068		for ( property in Object.getOwnPropertyNames( this ) ) {
2069			if ( typeof this[ property ] !== 'function' ) {
2070				this[ property ] = null;
2071			}
2072		}
2073	};
2074
2075	$.fn.tmowlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
2076}( window.Zepto || window.jQuery, window ) );
2077
2078/**
2079 * Lazy Plugin
2080 *
2081 * @version 2.3.4
2082 * @author Bartosz Wojciechowski
2083 * @author David Deutsch
2084 * @license The MIT License (MIT)
2085 */
2086( function( $, window ) {
2087	'use strict';
2088	/**
2089	 * Creates the lazy plugin.
2090	 *
2091	 * @class The Lazy Plugin
2092	 * @param {Owl} carousel - The Owl Carousel
2093	 */
2094	var Lazy = function( carousel ) {
2095		/**
2096		 * Reference to the core.
2097		 *
2098		 * @protected
2099		 * @type {Owl}
2100		 */
2101		this._core = carousel;
2102
2103		/**
2104		 * Already loaded items.
2105		 *
2106		 * @protected
2107		 * @type {Array.<jQuery>}
2108		 */
2109		this._loaded = [];
2110
2111		/**
2112		 * Event handlers.
2113		 *
2114		 * @protected
2115		 * @type {Object}
2116		 */
2117		this._handlers = {
2118			'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy( function( e ) {
2119				var settings;
2120				var n;
2121				var i;
2122				var position;
2123				var clones;
2124				var load;
2125
2126				if ( ! e.namespace ) {
2127					return;
2128				}
2129
2130				if ( ! this._core.settings || ! this._core.settings.lazyLoad ) {
2131					return;
2132				}
2133
2134				if ( ( e.property && e.property.name === 'position' ) || e.type === 'initialized' ) {
2135					settings = this._core.settings;
2136					n = ( settings.center && Math.ceil( settings.items / 2 ) ) || settings.items;
2137					i = ( settings.center && n * -1 ) || 0;
2138					position = ( e.property && e.property.value !== undefined ? e.property.value : this._core.current() ) + i;
2139					clones = this._core.clones().length;
2140					load = $.proxy( function( ii, v ) {
2141						this.load( v );
2142					}, this );
2143					//TODO: Need documentation for this new option
2144					if ( settings.lazyLoadEager > 0 ) {
2145						n += settings.lazyLoadEager;
2146						// If the carousel is looping also preload images that are to the "left"
2147						if ( settings.loop ) {
2148							position -= settings.lazyLoadEager;
2149							n += 1;
2150						}
2151					}
2152
2153					while ( i < n ) {
2154						i += 1;
2155						this.load( ( clones / 2 ) + this._core.relative( position ) );
2156						if ( clones ) {
2157							$.each( this._core.clones( this._core.relative( position ) ), load );
2158						}
2159						position += 1;
2160					}
2161				}
2162			}, this )
2163		};
2164
2165		// set the default options
2166		this._core.options = $.extend( {}, Lazy.Defaults, this._core.options );
2167
2168		// register event handler
2169		this._core.$element.on( this._handlers );
2170	};
2171
2172	/**
2173	 * Default options.
2174	 *
2175	 * @public
2176	 */
2177	Lazy.Defaults = {
2178		lazyLoad: false,
2179		lazyLoadEager: 0
2180	};
2181
2182	/**
2183	 * Loads all resources of an item at the specified position.
2184	 *
2185	 * @param {number} position - The absolute position of the item.
2186	 * @protected
2187	 */
2188	Lazy.prototype.load = function( position ) {
2189		var $item = this._core.$stage.children().eq( position ),
2190			$elements = $item && $item.find( '.owl-lazy' );
2191
2192		if ( ! $elements || $.inArray( $item.get( 0 ), this._loaded ) > -1 ) {
2193			return;
2194		}
2195
2196		$elements.each(
2197			$.proxy( function( index, element ) {
2198				var $element = $( element ),
2199					image,
2200					url = ( window.devicePixelRatio > 1 && $element.attr( 'data-src-retina' ) ) || $element.attr( 'data-src' ) || $element.attr( 'data-srcset' );
2201
2202				this._core.trigger( 'load', { element: $element, url: url }, 'lazy' );
2203
2204				if ( $element.is( 'img' ) ) {
2205					$element
2206						.one(
2207							'load.owl.lazy',
2208							$.proxy( function() {
2209								$element.css( 'opacity', 1 );
2210								this._core.trigger( 'loaded', { element: $element, url: url }, 'lazy' );
2211							}, this )
2212						)
2213						.attr( 'src', url );
2214				} else if ( $element.is( 'source' ) ) {
2215					$element
2216						.one(
2217							'load.owl.lazy',
2218							$.proxy( function() {
2219								this._core.trigger( 'loaded', { element: $element, url: url }, 'lazy' );
2220							}, this )
2221						)
2222						.attr( 'srcset', url );
2223				} else {
2224					image = new Image();
2225					image.onload = $.proxy( function() {
2226						$element.css( {
2227							'background-image': 'url("' + url + '")',
2228							opacity: '1'
2229						} );
2230						this._core.trigger( 'loaded', { element: $element, url: url }, 'lazy' );
2231					}, this );
2232					image.src = url;
2233				}
2234			}, this )
2235		);
2236
2237		this._loaded.push( $item.get( 0 ) );
2238	};
2239
2240	/**
2241	 * Destroys the plugin.
2242	 *
2243	 * @public
2244	 */
2245	Lazy.prototype.destroy = function() {
2246		var handler, property;
2247
2248		for ( handler in this.handlers ) {
2249			if ( handler ) {
2250				this._core.$element.off( handler, this.handlers[ handler ] );
2251			}
2252		}
2253		for ( property in Object.getOwnPropertyNames( this ) ) {
2254			if ( typeof this[ property ] !== 'function' ) {
2255				this[ property ] = null;
2256			}
2257		}
2258	};
2259
vendor: 13,187 bytes, lines 2260-2764
2260	$.fn.tmowlCarousel.Constructor.Plugins.Lazy = Lazy;
2261}( window.Zepto || window.jQuery, window ) );
2262
2263/**
2264 * AutoHeight Plugin
2265 *
2266 * @version 2.3.4
2267 * @author Bartosz Wojciechowski
2268 * @author David Deutsch
2269 * @license The MIT License (MIT)
2270 */
2271( function( $, window ) {
2272	'use strict';
2273	/**
2274	 * Creates the auto height plugin.
2275	 *
2276	 * @class The Auto Height Plugin
2277	 * @param {Owl} carousel - The Owl Carousel
2278	 */
2279	var AutoHeight = function( carousel ) {
2280		var refThis = this;
2281		/**
2282		 * Reference to the core.
2283		 *
2284		 * @protected
2285		 * @type {Owl}
2286		 */
2287		this._core = carousel;
2288
2289		this._previousHeight = null;
2290
2291		/**
2292		 * All event handlers.
2293		 *
2294		 * @protected
2295		 * @type {Object}
2296		 */
2297		this._handlers = {
2298			'initialized.owl.carousel refreshed.owl.carousel': $.proxy( function( e ) {
2299				if ( e.namespace && this._core.settings.autoHeight ) {
2300					this.update();
2301				}
2302			}, this ),
2303			'changed.owl.carousel': $.proxy( function( e ) {
2304				if ( e.namespace && this._core.settings.autoHeight && e.property.name === 'position' ) {
2305					this.update();
2306				}
2307			}, this ),
2308			'loaded.owl.lazy': $.proxy( function( e ) {
2309				if ( e.namespace && this._core.settings.autoHeight && e.element.closest( '.' + this._core.settings.itemClass ).index() === this._core.current() ) {
2310					this.update();
2311				}
2312			}, this )
2313		};
2314
2315		// set default options
2316		this._core.options = $.extend( {}, AutoHeight.Defaults, this._core.options );
2317
2318		// register event handlers
2319		this._core.$element.on( this._handlers );
2320		this._intervalId = null;
2321
2322		// These changes have been taken from a PR by gavrochelegnou proposed in #1575
2323		// and have been made compatible with the latest jQuery version
2324		$( window ).on( 'load', function() {
2325			if ( refThis._core.settings.autoHeight ) {
2326				refThis.update();
2327			}
2328		} );
2329
2330		// Autoresize the height of the carousel when window is resized
2331		// When carousel has images, the height is dependent on the width
2332		// and should also change on resize
2333		$( window ).on( 'resize', function() {
2334			if ( refThis._core.settings.autoHeight ) {
2335				if ( refThis._intervalId !== null ) {
2336					clearTimeout( refThis._intervalId );
2337				}
2338
2339				refThis._intervalId = setTimeout( function() {
2340					refThis.update();
2341				}, 250 );
2342			}
2343		} );
2344	};
2345
2346	/**
2347	 * Default options.
2348	 *
2349	 * @public
2350	 */
2351	AutoHeight.Defaults = {
2352		autoHeight: false,
2353		autoHeightClass: 'owl-height'
2354	};
2355
2356	/**
2357	 * Updates the view.
2358	 */
2359	AutoHeight.prototype.update = function() {
2360		var start = this._core._current,
2361			end = start + this._core.settings.items,
2362			lazyLoadEnabled = this._core.settings.lazyLoad,
2363			visible = this._core.$stage.children().toArray().slice( start, end ),
2364			heights = [],
2365			maxheight = 0;
2366
2367		$.each( visible, function( index, item ) {
2368			heights.push( $( item ).height() );
2369		} );
2370
2371		maxheight = Math.max.apply( null, heights );
2372
2373		if ( maxheight <= 1 && lazyLoadEnabled && this._previousHeight ) {
2374			maxheight = this._previousHeight;
2375		}
2376
2377		this._previousHeight = maxheight;
2378
2379		this._core.$stage.parent().height( maxheight ).addClass( this._core.settings.autoHeightClass );
2380	};
2381
2382	AutoHeight.prototype.destroy = function() {
2383		var handler, property;
2384
2385		for ( handler in this._handlers ) {
2386			if ( handler ) {
2387				this._core.$element.off( handler, this._handlers[ handler ] );
2388			}
2389		}
2390		for ( property in Object.getOwnPropertyNames( this ) ) {
2391			if ( typeof this[ property ] !== 'function' ) {
2392				this[ property ] = null;
2393			}
2394		}
2395	};
2396
2397	$.fn.tmowlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
2398}( window.Zepto || window.jQuery ) );
2399
2400/**
2401 * Video Plugin
2402 *
2403 * @version 2.3.4
2404 * @author Bartosz Wojciechowski
2405 * @author David Deutsch
2406 * @license The MIT License (MIT)
2407 */
2408( function( $, window, document ) {
2409	'use strict';
2410	/**
2411	 * Creates the video plugin.
2412	 *
2413	 * @class The Video Plugin
2414	 * @param {Owl} carousel - The Owl Carousel
2415	 */
2416	var Video = function( carousel ) {
2417		/**
2418		 * Reference to the core.
2419		 *
2420		 * @protected
2421		 * @type {Owl}
2422		 */
2423		this._core = carousel;
2424
2425		/**
2426		 * Cache all video URLs.
2427		 *
2428		 * @protected
2429		 * @type {Object}
2430		 */
2431		this._videos = {};
2432
2433		/**
2434		 * Current playing item.
2435		 *
2436		 * @protected
2437		 * @type {jQuery}
2438		 */
2439		this._playing = null;
2440
2441		/**
2442		 * All event handlers.
2443		 *
2444		 * @todo The cloned content removale is too late
2445		 * @protected
2446		 * @type {Object}
2447		 */
2448		this._handlers = {
2449			'initialized.owl.carousel': $.proxy( function( e ) {
2450				if ( e.namespace ) {
2451					this._core.register( { type: 'state', name: 'playing', tags: [ 'interacting' ] } );
2452				}
2453			}, this ),
2454			'resize.owl.carousel': $.proxy( function( e ) {
2455				if ( e.namespace && this._core.settings.video && this.isInFullScreen() ) {
2456					e.preventDefault();
2457				}
2458			}, this ),
2459			'refreshed.owl.carousel': $.proxy( function( e ) {
2460				if ( e.namespace && this._core.is( 'resizing' ) ) {
2461					this._core.$stage.find( '.cloned .owl-video-frame' ).remove();
2462				}
2463			}, this ),
2464			'changed.owl.carousel': $.proxy( function( e ) {
2465				if ( e.namespace && e.property.name === 'position' && this._playing ) {
2466					this.stop();
2467				}
2468			}, this ),
2469			'prepared.owl.carousel': $.proxy( function( e ) {
2470				var $element;
2471				if ( ! e.namespace ) {
2472					return;
2473				}
2474
2475				$element = $( e.content ).find( '.owl-video' );
2476
2477				if ( $element.length ) {
2478					$element.css( 'display', 'none' );
2479					this.fetch( $element, $( e.content ) );
2480				}
2481			}, this )
2482		};
2483
2484		// set default options
2485		this._core.options = $.extend( {}, Video.Defaults, this._core.options );
2486
2487		// register event handlers
2488		this._core.$element.on( this._handlers );
2489
2490		this._core.$element.on(
2491			'click.owl.video',
2492			'.owl-video-play-icon',
2493			$.proxy( function( e ) {
2494				this.play( e );
2495			}, this )
2496		);
2497	};
2498
2499	/**
2500	 * Default options.
2501	 *
2502	 * @public
2503	 */
2504	Video.Defaults = {
2505		video: false,
2506		videoHeight: false,
2507		videoWidth: false
2508	};
2509
2510	/**
2511	 * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
2512	 *
2513	 * @protected
2514	 * @param {jQuery} target - The target containing the video data.
2515	 * @param {jQuery} item - The item containing the video.
2516	 */
2517	Video.prototype.fetch = function( target, item ) {
2518		var type = ( function() {
2519				if ( target.attr( 'data-vimeo-id' ) ) {
2520					return 'vimeo';
2521				} else if ( target.attr( 'data-vzaar-id' ) ) {
2522					return 'vzaar';
2523				}
2524				return 'youtube';
2525			}() ),
2526			id = target.attr( 'data-vimeo-id' ) || target.attr( 'data-youtube-id' ) || target.attr( 'data-vzaar-id' ),
2527			width = target.attr( 'data-width' ) || this._core.settings.videoWidth,
2528			height = target.attr( 'data-height' ) || this._core.settings.videoHeight,
2529			url = target.attr( 'href' );
2530
2531		if ( url ) {
2532			/*
2533             Parses the id's out of the following urls (and probably more):
2534             https://www.youtube.com/watch?v=:id
2535             https://youtu.be/:id
2536             https://vimeo.com/:id
2537             https://vimeo.com/channels/:channel/:id
2538             https://vimeo.com/groups/:group/videos/:id
2539             https://app.vzaar.com/videos/:id
2540
2541             Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
2542             */
2543
2544			id = url.match(
2545				// eslint-disable-next-line no-useless-escape
2546				/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/
2547			);
2548
2549			if ( id[ 3 ].indexOf( 'youtu' ) > -1 ) {
2550				type = 'youtube';
2551			} else if ( id[ 3 ].indexOf( 'vimeo' ) > -1 ) {
2552				type = 'vimeo';
2553			} else if ( id[ 3 ].indexOf( 'vzaar' ) > -1 ) {
2554				type = 'vzaar';
2555			} else {
2556				throw new Error( 'Video URL not supported.' );
2557			}
2558			id = id[ 6 ];
2559		} else {
2560			throw new Error( 'Missing video URL.' );
2561		}
2562
2563		this._videos[ url ] = {
2564			type: type,
2565			id: id,
2566			width: width,
2567			height: height
2568		};
2569
2570		item.attr( 'data-video', url );
2571
2572		this.thumbnail( target, this._videos[ url ] );
2573	};
2574
2575	/**
2576		* Creates video thumbnail.
2577	 *
2578		* @protected
2579		* @param {jQuery} target - The target containing the video data.
2580		* @param video
2581		* @param {Object} info - The video info object.
2582		* @see `fetch`
2583		*/
2584	Video.prototype.thumbnail = function( target, video ) {
2585		var tnLink,
2586			icon,
2587			path,
2588			dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '',
2589			customTn = target.find( 'img' ),
2590			srcType = 'src',
2591			lazyClass = '',
2592			settings = this._core.settings,
2593			create = function( thispath ) {
2594				icon = '<div class="owl-video-play-icon"></div>';
2595
2596				if ( settings.lazyLoad ) {
2597					tnLink = $( '<div/>', {
2598						class: 'owl-video-tn ' + lazyClass,
2599						srcType: thispath
2600					} );
2601				} else {
2602					tnLink = $( '<div/>', {
2603						class: 'owl-video-tn',
2604						style: 'opacity:1;background-image:url(' + thispath + ')'
2605					} );
2606				}
2607				target.after( tnLink );
2608				target.after( icon );
2609			};
2610
2611		// wrap video content into owl-video-wrapper div
2612		target.wrap(
2613			$( '<div/>', {
2614				class: 'owl-video-wrapper',
2615				style: dimensions
2616			} )
2617		);
2618
2619		if ( this._core.settings.lazyLoad ) {
2620			srcType = 'data-src';
2621			lazyClass = 'owl-lazy';
2622		}
2623
2624		// custom thumbnail
2625		if ( customTn.length ) {
2626			create( customTn.attr( srcType ) );
2627			customTn.remove();
2628			return false;
2629		}
2630
2631		if ( video.type === 'youtube' ) {
2632			path = '//img.youtube.com/vi/' + video.id + '/hqdefault.jpg';
2633			create( path );
2634		} else if ( video.type === 'vimeo' ) {
2635			$.ajax( {
2636				type: 'GET',
2637				url: '//vimeo.com/api/v2/video/' + video.id + '.json',
2638				jsonp: 'callback',
2639				dataType: 'jsonp',
2640				success: function( data ) {
2641					path = data[ 0 ].thumbnail_large;
2642					create( path );
2643				}
2644			} );
2645		} else if ( video.type === 'vzaar' ) {
2646			$.ajax( {
2647				type: 'GET',
2648				url: '//vzaar.com/api/videos/' + video.id + '.json',
2649				jsonp: 'callback',
2650				dataType: 'jsonp',
2651				success: function( data ) {
2652					path = data.framegrab_url;
2653					create( path );
2654				}
2655			} );
2656		}
2657	};
2658
2659	/**
2660	 * Stops the current video.
2661	 *
2662	 * @public
2663	 */
2664	Video.prototype.stop = function() {
2665		this._core.trigger( 'stop', null, 'video' );
2666		this._playing.find( '.owl-video-frame' ).remove();
2667		this._playing.removeClass( 'owl-video-playing' );
2668		this._playing = null;
2669		this._core.leave( 'playing' );
2670		this._core.trigger( 'stopped', null, 'video' );
2671	};
2672
2673	/**
2674	 * Starts the current video.
2675	 *
2676	 * @public
2677	 * @param {Event} event - The event arguments.
2678	 */
2679	Video.prototype.play = function( event ) {
2680		var target = $( event.target ),
2681			item = target.closest( '.' + this._core.settings.itemClass ),
2682			video = this._videos[ item.attr( 'data-video' ) ],
2683			width = video.width || '100%',
2684			height = video.height || this._core.$stage.height(),
2685			html;
2686
2687		if ( this._playing ) {
2688			return;
2689		}
2690
2691		this._core.enter( 'playing' );
2692		this._core.trigger( 'play', null, 'video' );
2693
2694		item = this._core.items( this._core.relative( item.index() ) );
2695
2696		this._core.reset( item.index() );
2697
2698		html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' );
2699		html.attr( 'height', height );
2700		html.attr( 'width', width );
2701		if ( video.type === 'youtube' ) {
2702			html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id );
2703		} else if ( video.type === 'vimeo' ) {
2704			html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' );
2705		} else if ( video.type === 'vzaar' ) {
2706			html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' );
2707		}
2708
2709		$( html ).wrap( '<div class="owl-video-frame" />' ).insertAfter( item.find( '.owl-video' ) );
2710
2711		this._playing = item.addClass( 'owl-video-playing' );
2712	};
2713
2714	/**
2715	 * Checks whether an video is currently in full screen mode or not.
2716	 *
2717	 * @todo Bad style because looks like a readonly method but changes members.
2718	 * @protected
2719	 * @returns {boolean}
2720	 */
2721	Video.prototype.isInFullScreen = function() {
2722		var element = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement;
2723
2724		return element && $( element ).parent().hasClass( 'owl-video-frame' );
2725	};
2726
2727	/**
2728	 * Destroys the plugin.
2729	 */
2730	Video.prototype.destroy = function() {
2731		var handler, property;
2732
2733		this._core.$element.off( 'click.owl.video' );
2734
2735		for ( handler in this._handlers ) {
2736			if ( handler ) {
2737				this._core.$element.off( handler, this._handlers[ handler ] );
2738			}
2739		}
2740		for ( property in Object.getOwnPropertyNames( this ) ) {
2741			if ( typeof this[ property ] !== 'function' ) {
2742				this[ property ] = null;
2743			}
2744		}
2745	};
2746
2747	$.fn.tmowlCarousel.Constructor.Plugins.Video = Video;
2748}( window.Zepto || window.jQuery, window, document ) );
2749
2750/**
2751 * Animate Plugin
2752 *
2753 * @version 2.3.4
2754 * @author Bartosz Wojciechowski
2755 * @author David Deutsch
2756 * @license The MIT License (MIT)
2757 */
2758( function( $ ) {
2759	'use strict';
2760	/**
2761	 * Creates the animate plugin.
2762	 *
2763	 * @class The Navigation Plugin
2764	 * @param {Owl} scope - The Owl Carousel
2765	 */
2766	var Animate = function( scope ) {
2767		this.core = scope;
2768		this.core.options = $.extend( {}, Animate.Defaults, this.core.options );
2769		this.swapping = true;
2770		this.previous = undefined;
2771		this.next = undefined;
2772
2773		this.handlers = {
2774			'change.owl.carousel': $.proxy( function( e ) {
2775				if ( e.namespace && e.property.name === 'position' ) {
2776					this.previous = this.core.current();
2777					this.next = e.property.value;
2778				}
2779			}, this ),
2780			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy( function( e ) {
2781				if ( e.namespace ) {
2782					this.swapping = e.type === 'translated';
2783				}
2784			}, this ),
2785			'translate.owl.carousel': $.proxy( function( e ) {
2786				if ( e.namespace && this.swapping && ( this.core.options.animateOut || this.core.options.animateIn ) ) {
2787					this.swap();
2788				}
2789			}, this )
2790		};
2791
2792		this.core.$element.on( this.handlers );
2793	};
2794
2795	/**
2796	 * Default options.
2797	 *
2798	 * @public
2799	 */
2800	Animate.Defaults = {
2801		animateOut: false,
2802		animateIn: false
2803	};
2804
2805	/**
2806	 * Toggles the animation classes whenever an translations starts.
2807	 *
2808	 * @protected
2809	 * @returns {boolean|undefined}
2810	 */
2811	Animate.prototype.swap = function() {
2812		var left, clear, previous, next, incoming, outgoing;
2813		if ( this.core.settings.items !== 1 ) {
2814			return;
2815		}
2816
2817		if ( ! $.support.animation || ! $.support.transition ) {
2818			return;
2819		}
2820
2821		this.core.speed( 0 );
2822
2823		clear = $.proxy( this.clear, this );
2824		previous = this.core.$stage.children().eq( this.previous );
2825		next = this.core.$stage.children().eq( this.next );
2826		incoming = this.core.settings.animateIn;
2827		outgoing = this.core.settings.animateOut;
2828
2829		if ( this.core.current() === this.previous ) {
2830			return;
2831		}
2832
2833		if ( outgoing ) {
2834			left = this.core.coordinates( this.previous ) - this.core.coordinates( this.next );
2835			previous
2836				.one( $.support.animation.end, clear )
2837				.css( { left: left + 'px' } )
2838				.addClass( 'animated owl-animated-out' )
2839				.addClass( outgoing );
2840		}
2841
2842		if ( incoming ) {
2843			next.one( $.support.animation.end, clear ).addClass( 'animated owl-animated-in' ).addClass( incoming );
2844		}
2845	};
2846
2847	Animate.prototype.clear = function( e ) {
2848		$( e.target ).css( { left: '' } ).removeClass( 'animated owl-animated-out owl-animated-in' ).removeClass( this.core.settings.animateIn ).removeClass( this.core.settings.animateOut );
2849		this.core.onTransitionEnd();
2850	};
2851
2852	/**
2853	 * Destroys the plugin.
2854	 *
2855	 * @public
2856	 */
2857	Animate.prototype.destroy = function() {
2858		var handler, property;
2859
2860		for ( handler in this.handlers ) {
2861			if ( handler ) {
2862				this.core.$element.off( handler, this.handlers[ handler ] );
2863			}
2864		}
2865		for ( property in Object.getOwnPropertyNames( this ) ) {
2866			if ( typeof this[ property ] !== 'function' ) {
2867				this[ property ] = null;
2868			}
2869		}
2870	};
2871
2872	$.fn.tmowlCarousel.Constructor.Plugins.Animate = Animate;
2873}( window.Zepto || window.jQuery ) );
2874
2875/**
2876 * Autoplay Plugin
2877 *
2878 * @version 2.3.4
2879 * @author Bartosz Wojciechowski
2880 * @author Artus Kolanowski
2881 * @author David Deutsch
2882 * @author Tom De Caluwé
2883 * @license The MIT License (MIT)
2884 */
2885( function( $, window, document ) {
2886	'use strict';
2887	/**
2888		* Creates the autoplay plugin.
2889	 *
2890		* @class The Autoplay Plugin
2891		* @param carousel
2892		* @param {Owl} scope - The Owl Carousel
2893		*/
2894	var Autoplay = function( carousel ) {
2895		/**
2896		 * Reference to the core.
2897		 *
2898		 * @protected
2899		 * @type {Owl}
2900		 */
2901		this._core = carousel;
2902
2903		/**
2904		 * The autoplay timeout id.
2905		 *
2906		 * @type {number}
2907		 */
2908		this._call = null;
2909
2910		/**
2911		 * Depending on the state of the plugin, this variable contains either
2912		 * the start time of the timer or the current timer value if it's
2913		 * paused. Since we start in a paused state we initialize the timer
2914		 * value.
2915		 *
2916		 * @type {number}
2917		 */
2918		this._time = 0;
2919
2920		/**
2921		 * Stores the timeout currently used.
2922		 *
2923		 * @type {number}
2924		 */
2925		this._timeout = 0;
2926
2927		/**
2928		 * Indicates whenever the autoplay is paused.
2929		 *
2930		 * @type {boolean}
2931		 */
2932		this._paused = true;
2933
2934		/**
2935		 * All event handlers.
2936		 *
2937		 * @protected
2938		 * @type {Object}
2939		 */
2940		this._handlers = {
2941			'changed.owl.carousel': $.proxy( function( e ) {
2942				if ( e.namespace && e.property.name === 'settings' ) {
2943					if ( this._core.settings.autoplay ) {
2944						this.play();
2945					} else {
2946						this.stop();
2947					}
2948				} else if ( e.namespace && e.property.name === 'position' && this._paused ) {
2949					// Reset the timer. This code is triggered when the position
2950					// of the carousel was changed through user interaction.
2951					this._time = 0;
2952				}
2953			}, this ),
2954			'initialized.owl.carousel': $.proxy( function( e ) {
2955				if ( e.namespace && this._core.settings.autoplay ) {
2956					this.play();
2957				}
2958			}, this ),
2959			'play.owl.autoplay': $.proxy( function( e, t, s ) {
2960				if ( e.namespace ) {
2961					this.play( t, s );
2962				}
2963			}, this ),
2964			'stop.owl.autoplay': $.proxy( function( e ) {
2965				if ( e.namespace ) {
2966					this.stop();
2967				}
2968			}, this ),
2969			'mouseover.owl.autoplay': $.proxy( function() {
2970				if ( this._core.settings.autoplayHoverPause && this._core.is( 'rotating' ) ) {
2971					this.pause();
2972				}
2973			}, this ),
2974			'mouseleave.owl.autoplay': $.proxy( function() {
2975				if ( this._core.settings.autoplayHoverPause && this._core.is( 'rotating' ) ) {
2976					this.play();
2977				}
2978			}, this ),
2979			'touchstart.owl.core': $.proxy( function() {
2980				if ( this._core.settings.autoplayHoverPause && this._core.is( 'rotating' ) ) {
2981					this.pause();
2982				}
2983			}, this ),
2984			'touchend.owl.core': $.proxy( function() {
2985				if ( this._core.settings.autoplayHoverPause ) {
2986					this.play();
2987				}
2988			}, this )
2989		};
2990
2991		// register event handlers
2992		this._core.$element.on( this._handlers );
2993
2994		// set default options
2995		this._core.options = $.extend( {}, Autoplay.Defaults, this._core.options );
2996	};
2997
2998	/**
2999	 * Default options.
3000	 *
3001	 * @public
3002	 */
3003	Autoplay.Defaults = {
3004		autoplay: false,
3005		autoplayTimeout: 5000,
3006		autoplayHoverPause: false,
3007		autoplaySpeed: false
3008	};
3009
3010	/**
3011	 * Transition to the next slide and set a timeout for the next transition.
3012	 *
3013	 * @private
3014	 * @param {number}
vendor: 7,904 bytes, lines 3014-3326
3014 [speed] - The animation speed for the animations.
3015	 */
3016	Autoplay.prototype._next = function( speed ) {
3017		this._call = window.setTimeout( $.proxy( this._next, this, speed ), ( this._timeout * ( Math.round( this.read() / this._timeout ) + 1 ) ) - this.read() );
3018
3019		if ( this._core.is( 'interacting' ) || document.hidden ) {
3020			return;
3021		}
3022		this._core.next( speed || this._core.settings.autoplaySpeed );
3023	};
3024
3025	/**
3026	 * Reads the current timer value when the timer is playing.
3027	 *
3028	 * @public
3029	 */
3030	Autoplay.prototype.read = function() {
3031		return new Date().getTime() - this._time;
3032	};
3033
3034	/**
3035	 * Starts the autoplay.
3036	 *
3037	 * @public
3038	 * @param {number} [timeout] - The interval before the next animation starts.
3039	 * @param {number} [speed] - The animation speed for the animations.
3040	 */
3041	Autoplay.prototype.play = function( timeout, speed ) {
3042		var elapsed;
3043
3044		if ( ! this._core.is( 'rotating' ) ) {
3045			this._core.enter( 'rotating' );
3046		}
3047
3048		timeout = timeout || this._core.settings.autoplayTimeout;
3049
3050		// Calculate the elapsed time since the last transition. If the carousel
3051		// wasn't playing this calculation will yield zero.
3052		elapsed = Math.min( this._time % ( this._timeout || timeout ), timeout );
3053
3054		if ( this._paused ) {
3055			// Start the clock.
3056			this._time = this.read();
3057			this._paused = false;
3058		} else {
3059			// Clear the active timeout to allow replacement.
3060			window.clearTimeout( this._call );
3061		}
3062
3063		// Adjust the origin of the timer to match the new timeout value.
3064		this._time += ( this.read() % timeout ) - elapsed;
3065
3066		this._timeout = timeout;
3067		this._call = window.setTimeout( $.proxy( this._next, this, speed ), timeout - elapsed );
3068	};
3069
3070	/**
3071	 * Stops the autoplay.
3072	 *
3073	 * @public
3074	 */
3075	Autoplay.prototype.stop = function() {
3076		if ( this._core.is( 'rotating' ) ) {
3077			// Reset the clock.
3078			this._time = 0;
3079			this._paused = true;
3080
3081			window.clearTimeout( this._call );
3082			this._core.leave( 'rotating' );
3083		}
3084	};
3085
3086	/**
3087	 * Pauses the autoplay.
3088	 *
3089	 * @public
3090	 */
3091	Autoplay.prototype.pause = function() {
3092		if ( this._core.is( 'rotating' ) && ! this._paused ) {
3093			// Pause the clock.
3094			this._time = this.read();
3095			this._paused = true;
3096
3097			window.clearTimeout( this._call );
3098		}
3099	};
3100
3101	/**
3102	 * Destroys the plugin.
3103	 */
3104	Autoplay.prototype.destroy = function() {
3105		var handler, property;
3106
3107		this.stop();
3108
3109		for ( handler in this._handlers ) {
3110			if ( handler ) {
3111				this._core.$element.off( handler, this._handlers[ handler ] );
3112			}
3113		}
3114		for ( property in Object.getOwnPropertyNames( this ) ) {
3115			if ( typeof this[ property ] !== 'function' ) {
3116				this[ property ] = null;
3117			}
3118		}
3119	};
3120
3121	$.fn.tmowlCarousel.Constructor.Plugins.autoplay = Autoplay;
3122}( window.Zepto || window.jQuery, window, document ) );
3123
3124/**
3125 * Navigation Plugin
3126 *
3127 * @version 2.3.4
3128 * @author Artus Kolanowski
3129 * @author David Deutsch
3130 * @license The MIT License (MIT)
3131 */
3132( function( $ ) {
3133	'use strict';
3134
3135	/**
3136	 * Creates the navigation plugin.
3137	 *
3138	 * @class The Navigation Plugin
3139	 * @param {Owl} carousel - The Owl Carousel.
3140	 */
3141	var Navigation = function( carousel ) {
3142		/**
3143		 * Reference to the core.
3144		 *
3145		 * @protected
3146		 * @type {Owl}
3147		 */
3148		this._core = carousel;
3149
3150		/**
3151		 * Indicates whether the plugin is initialized or not.
3152		 *
3153		 * @protected
3154		 * @type {boolean}
3155		 */
3156		this._initialized = false;
3157
3158		/**
3159		 * The current paging indexes.
3160		 *
3161		 * @protected
3162		 * @type {Array}
3163		 */
3164		this._pages = [];
3165
3166		/**
3167		 * All DOM elements of the user interface.
3168		 *
3169		 * @protected
3170		 * @type {Object}
3171		 */
3172		this._controls = {};
3173
3174		/**
3175		 * Markup for an indicator.
3176		 *
3177		 * @protected
3178		 * @type {Array.<string>}
3179		 */
3180		this._templates = [];
3181
3182		/**
3183		 * The carousel element.
3184		 *
3185		 * @type {jQuery}
3186		 */
3187		this.$element = this._core.$element;
3188
3189		/**
3190		 * Overridden methods of the carousel.
3191		 *
3192		 * @protected
3193		 * @type {Object}
3194		 */
3195		this._overrides = {
3196			next: this._core.next,
3197			prev: this._core.prev,
3198			to: this._core.to
3199		};
3200
3201		/**
3202		 * All event handlers.
3203		 *
3204		 * @protected
3205		 * @type {Object}
3206		 */
3207		this._handlers = {
3208			'prepared.owl.carousel': $.proxy( function( e ) {
3209				if ( e.namespace && this._core.settings.dotsData ) {
3210					this._templates.push( '<div class="' + this._core.settings.dotClass + '">' + $( e.content ).find( '[data-dot]' ).addBack( '[data-dot]' ).attr( 'data-dot' ) + '</div>' );
3211				}
3212			}, this ),
3213			'added.owl.carousel': $.proxy( function( e ) {
3214				if ( e.namespace && this._core.settings.dotsData ) {
3215					this._templates.splice( e.position, 0, this._templates.pop() );
3216				}
3217			}, this ),
3218			'remove.owl.carousel': $.proxy( function( e ) {
3219				if ( e.namespace && this._core.settings.dotsData ) {
3220					this._templates.splice( e.position, 1 );
3221				}
3222			}, this ),
3223			'changed.owl.carousel': $.proxy( function( e ) {
3224				if ( e.namespace && e.property.name === 'position' ) {
3225					this.draw();
3226				}
3227			}, this ),
3228			'initialized.owl.carousel': $.proxy( function( e ) {
3229				if ( e.namespace && ! this._initialized ) {
3230					this._core.trigger( 'initialize', null, 'navigation' );
3231					this.initialize();
3232					this.update();
3233					this.draw();
3234					this._initialized = true;
3235					this._core.trigger( 'initialized', null, 'navigation' );
3236				}
3237			}, this ),
3238			'refreshed.owl.carousel': $.proxy( function( e ) {
3239				if ( e.namespace && this._initialized ) {
3240					this._core.trigger( 'refresh', null, 'navigation' );
3241					this.update();
3242					this.draw();
3243					this._core.trigger( 'refreshed', null, 'navigation' );
3244				}
3245			}, this )
3246		};
3247
3248		// set default options
3249		this._core.options = $.extend( {}, Navigation.Defaults, this._core.options );
3250
3251		// register event handlers
3252		this.$element.on( this._handlers );
3253	};
3254
3255	/**
3256	 * Default options.
3257	 *
3258	 * @public
3259	 * @todo Rename `slideBy` to `navBy`
3260	 */
3261	Navigation.Defaults = {
3262		nav: false,
3263		navText: [ '<span aria-label="' + 'Previous' + '">&#x2039;</span>', '<span aria-label="' + 'Next' + '">&#x203a;</span>' ],
3264		navSpeed: false,
3265		navElement: 'button type="button" role="presentation"',
3266		navContainer: false,
3267		navContainerClass: 'owl-nav',
3268		navClass: [ 'owl-prev', 'owl-next' ],
3269		slideBy: 1,
3270		dotClass: 'owl-dot',
3271		dotsClass: 'owl-dots',
3272		dots: true,
3273		dotsEach: false,
3274		dotsData: false,
3275		dotsSpeed: false,
3276		dotsContainer: false
3277	};
3278
3279	/**
3280	 * Initializes the layout of the plugin and extends the carousel.
3281	 *
3282	 * @protected
3283	 */
3284	Navigation.prototype.initialize = function() {
3285		var override,
3286			settings = this._core.settings;
3287
3288		// create DOM structure for relative navigation
3289		this._controls.$relative = ( settings.navContainer ? $( settings.navContainer ) : $( '<div>' ).addClass( settings.navContainerClass ).appendTo( this.$element ) ).addClass( 'disabled' );
3290
3291		this._controls.$previous = $( '<' + settings.navElement + '>' )
3292			.addClass( settings.navClass[ 0 ] )
3293			.html( settings.navText[ 0 ] )
3294			.prependTo( this._controls.$relative )
3295			.on(
3296				'click',
3297				$.proxy( function() {
3298					this.prev( settings.navSpeed );
3299				}, this )
3300			);
3301		this._controls.$next = $( '<' + settings.navElement + '>' )
3302			.addClass( settings.navClass[ 1 ] )
3303			.html( settings.navText[ 1 ] )
3304			.appendTo( this._controls.$relative )
3305			.on(
3306				'click',
3307				$.proxy( function() {
3308					this.next( settings.navSpeed );
3309				}, this )
3310			);
3311
3312		// create DOM structure for absolute navigation
3313		if ( ! settings.dotsData ) {
3314			this._templates = [ $( '<button role="button">' ).addClass( settings.dotClass ).append( $( '<span>' ) ).prop( 'outerHTML' ) ];
3315		}
3316
3317		this._controls.$absolute = ( settings.dotsContainer ? $( settings.dotsContainer ) : $( '<div>' ).addClass( settings.dotsClass ).appendTo( this.$element ) ).addClass( 'disabled' );
3318
3319		this._controls.$absolute.on(
3320			'click',
3321			'button',
3322			$.proxy( function( e ) {
3323				var index = $( e.target ).parent().is( this._controls.$absolute ) ? $( e.target ).index() : $( e.target ).parent().index();
3324
3325				e.preventDefault();
3326
vendor: 6,014 bytes, lines 3327-3551
3327				this.to( index, settings.dotsSpeed );
3328			}, this )
3329		);
3330
3331		/*$el.on('focusin', function() {
3332         $(document).off(".carousel");
3333
3334         $(document).on('keydown.carousel', function(e) {
3335         if(e.keyCode == 37) {
3336         $el.trigger('prev.owl')
3337         }
3338         if(e.keyCode == 39) {
3339         $el.trigger('next.owl')
3340         }
3341         });
3342         });*/
3343
3344		// override public methods of the carousel
3345		for ( override in this._overrides ) {
3346			if ( override ) {
3347				this._core[ override ] = $.proxy( this[ override ], this );
3348			}
3349		}
3350	};
3351
3352	/**
3353	 * Destroys the plugin.
3354	 *
3355	 * @protected
3356	 */
3357	Navigation.prototype.destroy = function() {
3358		var handler, control, property, override, settings;
3359		settings = this._core.settings;
3360
3361		for ( handler in this._handlers ) {
3362			if ( handler ) {
3363				this.$element.off( handler, this._handlers[ handler ] );
3364			}
3365		}
3366		for ( control in this._controls ) {
3367			if ( control === '$relative' && settings.navContainer ) {
3368				this._controls[ control ].html( '' );
3369			} else {
3370				this._controls[ control ].remove();
3371			}
3372		}
3373		for ( override in this.overides ) {
3374			if ( override ) {
3375				this._core[ override ] = this._overrides[ override ];
3376			}
3377		}
3378		for ( property in Object.getOwnPropertyNames( this ) ) {
3379			if ( typeof this[ property ] !== 'function' ) {
3380				this[ property ] = null;
3381			}
3382		}
3383	};
3384
3385	/**
3386	 * Updates the internal state.
3387	 *
3388	 * @protected
3389	 */
3390	Navigation.prototype.update = function() {
3391		var i,
3392			j,
3393			lower = this._core.clones().length / 2,
3394			upper = lower + this._core.items().length,
3395			maximum = this._core.maximum( true ),
3396			settings = this._core.settings,
3397			size = settings.center || settings.autoWidth || settings.dotsData ? 1 : settings.dotsEach || settings.items;
3398
3399		if ( settings.slideBy !== 'page' ) {
3400			settings.slideBy = Math.min( settings.slideBy, settings.items );
3401		}
3402
3403		if ( settings.dots || settings.slideBy === 'page' ) {
3404			this._pages = [];
3405
3406			for ( i = lower, j = 0; i < upper; i += 1 ) {
3407				if ( j >= size || j === 0 ) {
3408					this._pages.push( {
3409						start: Math.min( maximum, i - lower ),
3410						end: i - lower + size - 1
3411					} );
3412					if ( Math.min( maximum, i - lower ) === maximum ) {
3413						break;
3414					}
3415					j = 0;
3416				}
3417				j += this._core.mergers( this._core.relative( i ) );
3418			}
3419		}
3420	};
3421
3422	/**
3423	 * Draws the user interface.
3424	 *
3425	 * @todo The option `dotsData` wont work.
3426	 * @protected
3427	 */
3428	Navigation.prototype.draw = function() {
3429		var difference,
3430			settings = this._core.settings,
3431			disabled = this._core.items().length <= settings.items,
3432			index = this._core.relative( this._core.current() ),
3433			loop = settings.loop || settings.rewind;
3434
3435		this._controls.$relative.toggleClass( 'disabled', ! settings.nav || disabled );
3436
3437		if ( settings.nav ) {
3438			this._controls.$previous.toggleClass( 'disabled', ! loop && index <= this._core.minimum( true ) );
3439			this._controls.$next.toggleClass( 'disabled', ! loop && index >= this._core.maximum( true ) );
3440		}
3441
3442		this._controls.$absolute.toggleClass( 'disabled', ! settings.dots || disabled );
3443
3444		if ( settings.dots ) {
3445			difference = this._pages.length - this._controls.$absolute.children().length;
3446
3447			if ( settings.dotsData && difference !== 0 ) {
3448				this._controls.$absolute.html( this._templates.join( '' ) );
3449			} else if ( difference > 0 ) {
3450				this._controls.$absolute.append( new Array( difference + 1 ).join( this._templates[ 0 ] ) );
3451			} else if ( difference < 0 ) {
3452				this._controls.$absolute.children().slice( difference ).remove();
3453			}
3454
3455			this._controls.$absolute.find( '.active' ).removeClass( 'active' );
3456			this._controls.$absolute.children().eq( $.inArray( this.current(), this._pages ) ).addClass( 'active' );
3457		}
3458	};
3459
3460	/**
3461	 * Extends event data.
3462	 *
3463	 * @protected
3464	 * @param {Event} event - The event object which gets thrown.
3465	 */
3466	Navigation.prototype.onTrigger = function( event ) {
3467		var settings = this._core.settings;
3468
3469		event.page = {
3470			index: $.inArray( this.current(), this._pages ),
3471			count: this._pages.length,
3472			size: settings && ( settings.center || settings.autoWidth || settings.dotsData ? 1 : settings.dotsEach || settings.items )
3473		};
3474	};
3475
3476	/**
3477	 * Gets the current page position of the carousel.
3478	 *
3479	 * @protected
3480	 * @returns {number}
3481	 */
3482	Navigation.prototype.current = function() {
3483		var current = this._core.relative( this._core.current() );
3484		return $.grep(
3485			this._pages,
3486			$.proxy( function( page ) {
3487				return page.start <= current && page.end >= current;
3488			}, this )
3489		).pop();
3490	};
3491
3492	/**
3493		* Gets the current succesor/predecessor position.
3494	 *
3495		* @param successor
3496		* @protected
3497		* @returns {number}
3498		*/
3499	Navigation.prototype.getPosition = function( successor ) {
3500		var position,
3501			length,
3502			settings = this._core.settings;
3503
3504		if ( settings.slideBy === 'page' ) {
3505			position = $.inArray( this.current(), this._pages );
3506			length = this._pages.length;
3507			if ( successor ) {
3508				position = position + 1;
3509			} else {
3510				position = position - 1;
3511			}
3512			position = this._pages[ ( ( position % length ) + length ) % length ].start;
3513		} else {
3514			position = this._core.relative( this._core.current() );
3515			length = this._core.items().length;
3516			if ( successor ) {
3517				position += settings.slideBy;
3518			} else {
3519				position -= settings.slideBy;
3520			}
3521		}
3522
3523		return position;
3524	};
3525
3526	/**
3527	 * Slides to the next item or page.
3528	 *
3529	 * @public
3530	 * @param {number} [speed=false] - The time in milliseconds for the transition.
3531	 */
3532	Navigation.prototype.next = function( speed ) {
3533		$.proxy( this._overrides.to, this._core )( this.getPosition( true ), speed );
3534	};
3535
3536	/**
3537	 * Slides to the previous item or page.
3538	 *
3539	 * @public
3540	 * @param {number} [speed=false] - The time in milliseconds for the transition.
3541	 */
3542	Navigation.prototype.prev = function( speed ) {
3543		$.proxy( this._overrides.to, this._core )( this.getPosition( false ), speed );
3544	};
3545
3546	/**
3547	 * Slides to the specified item or page.
3548	 *
3549	 * @public
3550	 * @param {number} position - The position of the item or page.
3551	 * @param {number}
3551 [speed] - The time in milliseconds for the transition.
3552	 * @param {boolean} [standard=false] - Whether to use the standard behaviour or not.
3553	 */
3554	Navigation.prototype.to = function( position, speed, standard ) {
3555		var length;
3556
3557		if ( ! standard && this._pages.length ) {
3558			length = this._pages.length;
3559			$.proxy( this._overrides.to, this._core )( this._pages[ ( ( position % length ) + length ) % length ].start, speed );
3560		} else {
3561			$.proxy( this._overrides.to, this._core )( position, speed );
3562		}
3563	};
3564
3565	$.fn.tmowlCarousel.Constructor.Plugins.Navigation = Navigation;
3566}( window.Zepto || window.jQuery ) );
3567
3568/**
3569 * Hash Plugin
3570 *
3571 * @version 2.3.4
3572 * @author Artus Kolanowski
3573 * @author David Deutsch
3574 * @license The MIT License (MIT)
3575 */
3576( function( $, window ) {
3577	'use strict';
3578
3579	/**
3580	 * Creates the hash plugin.
3581	 *
3582	 * @class The Hash Plugin
3583	 * @param {Owl} carousel - The Owl Carousel
3584	 */
3585	var Hash = function( carousel ) {
3586		/**
3587		 * Reference to the core.
3588		 *
3589		 * @protected
3590		 * @type {Owl}
3591		 */
3592		this._core = carousel;
3593
3594		/**
3595		 * Hash index for the items.
3596		 *
3597		 * @protected
3598		 * @type {Object}
3599		 */
3600		this._hashes = {};
3601
3602		/**
3603		 * The carousel element.
3604		 *
3605		 * @type {jQuery}
3606		 */
3607		this.$element = this._core.$element;
3608
3609		/**
3610		 * All event handlers.
3611		 *
3612		 * @protected
3613		 * @type {Object}
3614		 */
3615		this._handlers = {
3616			'initialized.owl.carousel': $.proxy( function( e ) {
3617				if ( e.namespace && this._core.settings.startPosition === 'URLHash' ) {
3618					$( window ).trigger( 'hashchange.owl.navigation' );
3619				}
3620			}, this ),
3621			'prepared.owl.carousel': $.proxy( function( e ) {
3622				var hash;
3623				if ( e.namespace ) {
3624					hash = $( e.content ).find( '[data-hash]' ).addBack( '[data-hash]' ).attr( 'data-hash' );
3625
3626					if ( ! hash ) {
3627						return;
3628					}
3629
3630					this._hashes[ hash ] = e.content;
3631				}
3632			}, this ),
3633			'changed.owl.carousel': $.proxy( function( e ) {
3634				var current;
3635				var hash;
3636				if ( e.namespace && e.property.name === 'position' ) {
3637					current = this._core.items( this._core.relative( this._core.current() ) );
3638					hash = $.map( this._hashes, function( item, thishash ) {
3639						return item === current ? thishash : null;
3640					} ).join();
3641
3642					if ( ! hash || window.location.hash.slice( 1 ) === hash ) {
3643						return;
3644					}
3645
3646					window.location.hash = hash;
3647				}
3648			}, this )
3649		};
3650
3651		// set default options
3652		this._core.options = $.extend( {}, Hash.Defaults, this._core.options );
3653
3654		// register the event handlers
3655		this.$element.on( this._handlers );
3656
3657		// register event listener for hash navigation
3658		$( window ).on(
3659			'hashchange.owl.navigation',
3660			$.proxy( function() {
3661				var hash = window.location.hash.substring( 1 ),
3662					items = this._core.$stage.children(),
3663					position = this._hashes[ hash ] && items.index( this._hashes[ hash ] );
3664
3665				if ( position === undefined || position === this._core.current() ) {
3666					return;
3667				}
3668
3669				this._core.to( this._core.relative( position ), false, true );
3670			}, this )
3671		);
3672	};
3673
3674	/**
3675	 * Default options.
3676	 *
3677	 * @public
3678	 */
3679	Hash.Defaults = {
3680		URLhashListener: false
3681	};
3682
3683	/**
3684	 * Destroys the plugin.
3685	 *
3686	 * @public
3687	 */
3688	Hash.prototype.destroy = function() {
3689		var handler, property;
3690
3691		$( window ).off( 'hashchange.owl.navigation' );
3692
3693		for ( handler in this._handlers ) {
3694			if ( handler ) {
3695				this._core.$element.off( handler, this._handlers[ handler ] );
3696			}
3697		}
3698		for ( property in Object.getOwnPropertyNames( this ) ) {
3699			if ( typeof this[ property ] !== 'function' ) {
3700				this[ property ] = null;
3701			}
3702		}
3703	};
3704
3705	$.fn.tmowlCarousel.Constructor.Plugins.Hash = Hash;
3706}( window.Zepto || window.jQuery, window ) );
3707
3708/**
3709 * Support Plugin
3710 *
3711 * @version 2.3.4
3712 * @author Vivid Planet Software GmbH
3713 * @author Artus Kolanowski
3714 * @author David Deutsch
3715 * @license The MIT License (MIT)
3716 */
3717( function( $ ) {
3718	'use strict';
3719	var style = $( '<support>' ).get( 0 ).style,
3720		prefixes = 'Webkit Moz O ms'.split( ' ' ),
3721		events = {
3722			transition: {
3723				end: {
3724					WebkitTransition: 'webkitTransitionEnd',
3725					MozTransition: 'transitionend',
3726					OTransition: 'oTransitionEnd',
3727					transition: 'transitionend'
3728				}
3729			},
3730			animation: {
3731				end: {
3732					WebkitAnimation: 'webkitAnimationEnd',
3733					MozAnimation: 'animationend',
3734					OAnimation: 'oAnimationEnd',
3735					animation: 'animationend'
3736				}
3737			}
3738		},
3739		tests;
3740
3741	function test( property, thisprefixed ) {
3742		var result = false,
3743			upper = property.charAt( 0 ).toUpperCase() + property.slice( 1 );
3744
3745		$.each( ( property + ' ' + prefixes.join( upper + ' ' ) + upper ).split( ' ' ), function( i, thisproperty ) {
3746			if ( style[ thisproperty ] !== undefined ) {
3747				result = thisprefixed ? thisproperty : true;
3748				return false;
3749			}
3750		} );
3751
3752		return result;
3753	}
3754
3755	function prefixed( property ) {
3756		return test( property, true );
3757	}
3758
3759	tests = {
3760		csstransforms: function() {
3761			return !! test( 'transform' );
3762		},
3763		csstransforms3d: function() {
3764			return !! test( 'perspective' );
3765		},
3766		csstransitions: function() {
3767			return !! test( 'transition' );
3768		},
3769		cssanimations: function() {
3770			return !! test( 'animation' );
3771		}
3772	};
3773	if ( tests.csstransitions() ) {
3774		/* jshint -W053 */
3775		$.support.transition = new String( prefixed( 'transition' ) );
3776		$.support.transition.end = events.transition.end[ $.support.transition ];
3777	}
3778
3779	if ( tests.cssanimations() ) {
3780		/* jshint -W053 */
3781		$.support.animation = new String( prefixed( 'animation' ) );
3782		$.support.animation.end = events.animation.end[ $.support.animation ];
3783	}
3784
3785	if ( tests.csstransforms() ) {
3786		/* jshint -W053 */
3787		$.support.transform = new String( prefixed( 'transform' ) );
3788		$.support.transform3d = tests.csstransforms3d();
3789	}
3790}( window.Zepto || window.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.