PageSourceSearch

https://xn--80aefqhcbdcbwkes3aoc8g3ck2d.xn--p1ai/local/components/…/lib/owl.carousel.js?169199456394859

js xn--80aefqhcbdcbwkes3aoc8g3ck2d.xn--p1ai collected 2026-10-03 22:29:13 UTC 94,859 bytes, 3,507 lines download raw bytes

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

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.