PageSourceSearch

https://www.qeshmmart.com/lib/themes/ryan/assets/js/libraries/owl.carousel.js?v=1125104433

js qeshmmart.com collected 2026-10-08 00:01:49 UTC 113,382 bytes, 3,467 lines download raw bytes

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