/**
* swiper 4.5.3
* most modern mobile touch slider and framework with hardware accelerated transitions
* http://www.idangero.us/swiper/
*
* copyright 2014-2019 vladimir kharlampidi
*
* released under the mit license
*
* released on: october 16, 2019
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.swiper = factory());
}(this, function () {
'use strict';
/**
* ssr window 1.0.1
* better handling for window object in ssr environment
* https://github.com/nolimits4web/ssr-window
*
* copyright 2018, vladimir kharlampidi
*
* licensed under mit
*
* released on: july 18, 2018
*/
var doc = (typeof document === 'undefined') ? {
body: {},
addeventlistener: function addeventlistener() {},
removeeventlistener: function removeeventlistener() {},
activeelement: {
blur: function blur() {},
nodename: '',
},
queryselector: function queryselector() {
return null;
},
queryselectorall: function queryselectorall() {
return [];
},
getelementbyid: function getelementbyid() {
return null;
},
createevent: function createevent() {
return {
initevent: function initevent() {},
};
},
createelement: function createelement() {
return {
children: [],
childnodes: [],
style: {},
setattribute: function setattribute() {},
getelementsbytagname: function getelementsbytagname() {
return [];
},
};
},
location: {
hash: ''
},
} : document; // eslint-disable-line
var win = (typeof window === 'undefined') ? {
document: doc,
navigator: {
useragent: '',
},
location: {},
history: {},
customevent: function customevent() {
return this;
},
addeventlistener: function addeventlistener() {},
removeeventlistener: function removeeventlistener() {},
getcomputedstyle: function getcomputedstyle() {
return {
getpropertyvalue: function getpropertyvalue() {
return '';
},
};
},
image: function image() {},
date: function date() {},
screen: {},
settimeout: function settimeout() {},
cleartimeout: function cleartimeout() {},
} : window; // eslint-disable-line
/**
* dom7 2.1.3
* minimalistic javascript library for dom manipulation, with a jquery-compatible api
* http://framework7.io/docs/dom.html
*
* copyright 2019, vladimir kharlampidi
* the idangero.us
* http://www.idangero.us/
*
* licensed under mit
*
* released on: february 11, 2019
*/
var dom7 = function dom7(arr) {
var self = this;
// create array-like object
for (var i = 0; i < arr.length; i += 1) {
self[i] = arr[i];
}
self.length = arr.length;
// return collection with methods
return this;
};
function $(selector, context) {
var arr = [];
var i = 0;
if (selector && !context) {
if (selector instanceof dom7) {
return selector;
}
}
if (selector) {
// string
if (typeof selector === 'string') {
var els;
var tempparent;
var html = selector.trim();
if (html.indexof('<') >= 0 && html.indexof('>') >= 0) {
var tocreate = 'div';
if (html.indexof('
:~]/)) {
// pure id selector
els = [doc.getelementbyid(selector.trim().split('#')[1])];
} else {
// other selectors
els = (context || doc).queryselectorall(selector.trim());
}
for (i = 0; i < els.length; i += 1) {
if (els[i]) {
arr.push(els[i]);
}
}
}
} else if (selector.nodetype || selector === win || selector === doc) {
// node/element
arr.push(selector);
} else if (selector.length > 0 && selector[0].nodetype) {
// array of elements or instance of dom
for (i = 0; i < selector.length; i += 1) {
arr.push(selector[i]);
}
}
}
return new dom7(arr);
}
$.fn = dom7.prototype;
$.class = dom7;
$.dom7 = dom7;
function unique(arr) {
var uniquearray = [];
for (var i = 0; i < arr.length; i += 1) {
if (uniquearray.indexof(arr[i]) === -1) {
uniquearray.push(arr[i]);
}
}
return uniquearray;
}
// classes and attributes
function addclass(classname) {
if (typeof classname === 'undefined') {
return this;
}
var classes = classname.split(' ');
for (var i = 0; i < classes.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
if (typeof this[j] !== 'undefined' && typeof this[j].classlist !== 'undefined') {
this[j].classlist.add(classes[i]);
}
}
}
return this;
}
function removeclass(classname) {
var classes = classname.split(' ');
for (var i = 0; i < classes.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
if (typeof this[j] !== 'undefined' && typeof this[j].classlist !== 'undefined') {
this[j].classlist.remove(classes[i]);
}
}
}
return this;
}
function hasclass(classname) {
if (!this[0]) {
return false;
}
return this[0].classlist.contains(classname);
}
function toggleclass(classname) {
var classes = classname.split(' ');
for (var i = 0; i < classes.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
if (typeof this[j] !== 'undefined' && typeof this[j].classlist !== 'undefined') {
this[j].classlist.toggle(classes[i]);
}
}
}
return this;
}
function attr(attrs, value) {
var arguments$1 = arguments;
if (arguments.length === 1 && typeof attrs === 'string') {
// get attr
if (this[0]) {
return this[0].getattribute(attrs);
}
return undefined;
}
// set attrs
for (var i = 0; i < this.length; i += 1) {
if (arguments$1.length === 2) {
// string
this[i].setattribute(attrs, value);
} else {
// object
// eslint-disable-next-line
for (var attrname in attrs) {
this[i][attrname] = attrs[attrname];
this[i].setattribute(attrname, attrs[attrname]);
}
}
}
return this;
}
// eslint-disable-next-line
function removeattr(attr) {
for (var i = 0; i < this.length; i += 1) {
this[i].removeattribute(attr);
}
return this;
}
function data(key, value) {
var el;
if (typeof value === 'undefined') {
el = this[0];
// get value
if (el) {
if (el.dom7elementdatastorage && (key in el.dom7elementdatastorage)) {
return el.dom7elementdatastorage[key];
}
var datakey = el.getattribute(("data-" + key));
if (datakey) {
return datakey;
}
return undefined;
}
return undefined;
}
// set value
for (var i = 0; i < this.length; i += 1) {
el = this[i];
if (!el.dom7elementdatastorage) {
el.dom7elementdatastorage = {};
}
el.dom7elementdatastorage[key] = value;
}
return this;
}
// transforms
// eslint-disable-next-line
function transform(transform) {
for (var i = 0; i < this.length; i += 1) {
var elstyle = this[i].style;
elstyle.webkittransform = transform;
elstyle.transform = transform;
}
return this;
}
function transition(duration) {
if (typeof duration !== 'string') {
duration = duration + "ms"; // eslint-disable-line
}
for (var i = 0; i < this.length; i += 1) {
var elstyle = this[i].style;
elstyle.webkittransitionduration = duration;
elstyle.transitionduration = duration;
}
return this;
}
// events
function on() {
var assign;
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var eventtype = args[0];
var targetselector = args[1];
var listener = args[2];
var capture = args[3];
if (typeof args[1] === 'function') {
(assign = args, eventtype = assign[0], listener = assign[1], capture = assign[2]);
targetselector = undefined;
}
if (!capture) {
capture = false;
}
function handleliveevent(e) {
var target = e.target;
if (!target) {
return;
}
var eventdata = e.target.dom7eventdata || [];
if (eventdata.indexof(e) < 0) {
eventdata.unshift(e);
}
if ($(target).is(targetselector)) {
listener.apply(target, eventdata);
} else {
var parents = $(target).parents(); // eslint-disable-line
for (var k = 0; k < parents.length; k += 1) {
if ($(parents[k]).is(targetselector)) {
listener.apply(parents[k], eventdata);
}
}
}
}
function handleevent(e) {
var eventdata = e && e.target ? e.target.dom7eventdata || [] : [];
if (eventdata.indexof(e) < 0) {
eventdata.unshift(e);
}
listener.apply(this, eventdata);
}
var events = eventtype.split(' ');
var j;
for (var i = 0; i < this.length; i += 1) {
var el = this[i];
if (!targetselector) {
for (j = 0; j < events.length; j += 1) {
var event = events[j];
if (!el.dom7listeners) {
el.dom7listeners = {};
}
if (!el.dom7listeners[event]) {
el.dom7listeners[event] = [];
}
el.dom7listeners[event].push({
listener: listener,
proxylistener: handleevent,
});
el.addeventlistener(event, handleevent, capture);
}
} else {
// live events
for (j = 0; j < events.length; j += 1) {
var event$1 = events[j];
if (!el.dom7livelisteners) {
el.dom7livelisteners = {};
}
if (!el.dom7livelisteners[event$1]) {
el.dom7livelisteners[event$1] = [];
}
el.dom7livelisteners[event$1].push({
listener: listener,
proxylistener: handleliveevent,
});
el.addeventlistener(event$1, handleliveevent, capture);
}
}
}
return this;
}
function off() {
var assign;
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var eventtype = args[0];
var targetselector = args[1];
var listener = args[2];
var capture = args[3];
if (typeof args[1] === 'function') {
(assign = args, eventtype = assign[0], listener = assign[1], capture = assign[2]);
targetselector = undefined;
}
if (!capture) {
capture = false;
}
var events = eventtype.split(' ');
for (var i = 0; i < events.length; i += 1) {
var event = events[i];
for (var j = 0; j < this.length; j += 1) {
var el = this[j];
var handlers = (void 0);
if (!targetselector && el.dom7listeners) {
handlers = el.dom7listeners[event];
} else if (targetselector && el.dom7livelisteners) {
handlers = el.dom7livelisteners[event];
}
if (handlers && handlers.length) {
for (var k = handlers.length - 1; k >= 0; k -= 1) {
var handler = handlers[k];
if (listener && handler.listener === listener) {
el.removeeventlistener(event, handler.proxylistener, capture);
handlers.splice(k, 1);
} else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
el.removeeventlistener(event, handler.proxylistener, capture);
handlers.splice(k, 1);
} else if (!listener) {
el.removeeventlistener(event, handler.proxylistener, capture);
handlers.splice(k, 1);
}
}
}
}
}
return this;
}
function trigger() {
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var events = args[0].split(' ');
var eventdata = args[1];
for (var i = 0; i < events.length; i += 1) {
var event = events[i];
for (var j = 0; j < this.length; j += 1) {
var el = this[j];
var evt = (void 0);
try {
evt = new win.customevent(event, {
detail: eventdata,
bubbles: true,
cancelable: true,
});
} catch (e) {
evt = doc.createevent('event');
evt.initevent(event, true, true);
evt.detail = eventdata;
}
// eslint-disable-next-line
el.dom7eventdata = args.filter(function (data, dataindex) {
return dataindex > 0;
});
el.dispatchevent(evt);
el.dom7eventdata = [];
delete el.dom7eventdata;
}
}
return this;
}
function transitionend(callback) {
var events = ['webkittransitionend', 'transitionend'];
var dom = this;
var i;
function firecallback(e) {
/* jshint validthis:true */
if (e.target !== this) {
return;
}
callback.call(this, e);
for (i = 0; i < events.length; i += 1) {
dom.off(events[i], firecallback);
}
}
if (callback) {
for (i = 0; i < events.length; i += 1) {
dom.on(events[i], firecallback);
}
}
return this;
}
function outerwidth(includemargins) {
if (this.length > 0) {
if (includemargins) {
// eslint-disable-next-line
var styles = this.styles();
return this[0].offsetwidth + parsefloat(styles.getpropertyvalue('margin-right')) + parsefloat(styles.getpropertyvalue('margin-left'));
}
return this[0].offsetwidth;
}
return null;
}
function outerheight(includemargins) {
if (this.length > 0) {
if (includemargins) {
// eslint-disable-next-line
var styles = this.styles();
return this[0].offsetheight + parsefloat(styles.getpropertyvalue('margin-top')) + parsefloat(styles.getpropertyvalue('margin-bottom'));
}
return this[0].offsetheight;
}
return null;
}
function offset() {
if (this.length > 0) {
var el = this[0];
var box = el.getboundingclientrect();
var body = doc.body;
var clienttop = el.clienttop || body.clienttop || 0;
var clientleft = el.clientleft || body.clientleft || 0;
var scrolltop = el === win ? win.scrolly : el.scrolltop;
var scrollleft = el === win ? win.scrollx : el.scrollleft;
return {
top: (box.top + scrolltop) - clienttop,
left: (box.left + scrollleft) - clientleft,
};
}
return null;
}
function styles() {
if (this[0]) {
return win.getcomputedstyle(this[0], null);
}
return {};
}
function css(props, value) {
var i;
if (arguments.length === 1) {
if (typeof props === 'string') {
if (this[0]) {
return win.getcomputedstyle(this[0], null).getpropertyvalue(props);
}
} else {
for (i = 0; i < this.length; i += 1) {
// eslint-disable-next-line
for (var prop in props) {
this[i].style[prop] = props[prop];
}
}
return this;
}
}
if (arguments.length === 2 && typeof props === 'string') {
for (i = 0; i < this.length; i += 1) {
this[i].style[props] = value;
}
return this;
}
return this;
}
// iterate over the collection passing elements to `callback`
function each(callback) {
// don't bother continuing without a callback
if (!callback) {
return this;
}
// iterate over the current collection
for (var i = 0; i < this.length; i += 1) {
// if the callback returns false
if (callback.call(this[i], i, this[i]) === false) {
// end the loop early
return this;
}
}
// return `this` to allow chained dom operations
return this;
}
// eslint-disable-next-line
function html(html) {
if (typeof html === 'undefined') {
return this[0] ? this[0].innerhtml : undefined;
}
for (var i = 0; i < this.length; i += 1) {
this[i].innerhtml = html;
}
return this;
}
// eslint-disable-next-line
function text(text) {
if (typeof text === 'undefined') {
if (this[0]) {
return this[0].textcontent.trim();
}
return null;
}
for (var i = 0; i < this.length; i += 1) {
this[i].textcontent = text;
}
return this;
}
function is(selector) {
var el = this[0];
var comparewith;
var i;
if (!el || typeof selector === 'undefined') {
return false;
}
if (typeof selector === 'string') {
if (el.matches) {
return el.matches(selector);
} else if (el.webkitmatchesselector) {
return el.webkitmatchesselector(selector);
} else if (el.msmatchesselector) {
return el.msmatchesselector(selector);
}
comparewith = $(selector);
for (i = 0; i < comparewith.length; i += 1) {
if (comparewith[i] === el) {
return true;
}
}
return false;
} else if (selector === doc) {
return el === doc;
} else if (selector === win) {
return el === win;
}
if (selector.nodetype || selector instanceof dom7) {
comparewith = selector.nodetype ? [selector] : selector;
for (i = 0; i < comparewith.length; i += 1) {
if (comparewith[i] === el) {
return true;
}
}
return false;
}
return false;
}
function index() {
var child = this[0];
var i;
if (child) {
i = 0;
// eslint-disable-next-line
while ((child = child.previoussibling) !== null) {
if (child.nodetype === 1) {
i += 1;
}
}
return i;
}
return undefined;
}
// eslint-disable-next-line
function eq(index) {
if (typeof index === 'undefined') {
return this;
}
var length = this.length;
var returnindex;
if (index > length - 1) {
return new dom7([]);
}
if (index < 0) {
returnindex = length + index;
if (returnindex < 0) {
return new dom7([]);
}
return new dom7([this[returnindex]]);
}
return new dom7([this[index]]);
}
function append() {
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var newchild;
for (var k = 0; k < args.length; k += 1) {
newchild = args[k];
for (var i = 0; i < this.length; i += 1) {
if (typeof newchild === 'string') {
var tempdiv = doc.createelement('div');
tempdiv.innerhtml = newchild;
while (tempdiv.firstchild) {
this[i].appendchild(tempdiv.firstchild);
}
} else if (newchild instanceof dom7) {
for (var j = 0; j < newchild.length; j += 1) {
this[i].appendchild(newchild[j]);
}
} else {
this[i].appendchild(newchild);
}
}
}
return this;
}
function prepend(newchild) {
var i;
var j;
for (i = 0; i < this.length; i += 1) {
if (typeof newchild === 'string') {
var tempdiv = doc.createelement('div');
tempdiv.innerhtml = newchild;
for (j = tempdiv.childnodes.length - 1; j >= 0; j -= 1) {
this[i].insertbefore(tempdiv.childnodes[j], this[i].childnodes[0]);
}
} else if (newchild instanceof dom7) {
for (j = 0; j < newchild.length; j += 1) {
this[i].insertbefore(newchild[j], this[i].childnodes[0]);
}
} else {
this[i].insertbefore(newchild, this[i].childnodes[0]);
}
}
return this;
}
function next(selector) {
if (this.length > 0) {
if (selector) {
if (this[0].nextelementsibling && $(this[0].nextelementsibling).is(selector)) {
return new dom7([this[0].nextelementsibling]);
}
return new dom7([]);
}
if (this[0].nextelementsibling) {
return new dom7([this[0].nextelementsibling]);
}
return new dom7([]);
}
return new dom7([]);
}
function nextall(selector) {
var nextels = [];
var el = this[0];
if (!el) {
return new dom7([]);
}
while (el.nextelementsibling) {
var next = el.nextelementsibling; // eslint-disable-line
if (selector) {
if ($(next).is(selector)) {
nextels.push(next);
}
} else {
nextels.push(next);
}
el = next;
}
return new dom7(nextels);
}
function prev(selector) {
if (this.length > 0) {
var el = this[0];
if (selector) {
if (el.previouselementsibling && $(el.previouselementsibling).is(selector)) {
return new dom7([el.previouselementsibling]);
}
return new dom7([]);
}
if (el.previouselementsibling) {
return new dom7([el.previouselementsibling]);
}
return new dom7([]);
}
return new dom7([]);
}
function prevall(selector) {
var prevels = [];
var el = this[0];
if (!el) {
return new dom7([]);
}
while (el.previouselementsibling) {
var prev = el.previouselementsibling; // eslint-disable-line
if (selector) {
if ($(prev).is(selector)) {
prevels.push(prev);
}
} else {
prevels.push(prev);
}
el = prev;
}
return new dom7(prevels);
}
function parent(selector) {
var parents = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
if (this[i].parentnode !== null) {
if (selector) {
if ($(this[i].parentnode).is(selector)) {
parents.push(this[i].parentnode);
}
} else {
parents.push(this[i].parentnode);
}
}
}
return $(unique(parents));
}
function parents(selector) {
var parents = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
var parent = this[i].parentnode; // eslint-disable-line
while (parent) {
if (selector) {
if ($(parent).is(selector)) {
parents.push(parent);
}
} else {
parents.push(parent);
}
parent = parent.parentnode;
}
}
return $(unique(parents));
}
function closest(selector) {
var closest = this; // eslint-disable-line
if (typeof selector === 'undefined') {
return new dom7([]);
}
if (!closest.is(selector)) {
closest = closest.parents(selector).eq(0);
}
return closest;
}
function find(selector) {
var foundelements = [];
for (var i = 0; i < this.length; i += 1) {
var found = this[i].queryselectorall(selector);
for (var j = 0; j < found.length; j += 1) {
foundelements.push(found[j]);
}
}
return new dom7(foundelements);
}
function children(selector) {
var children = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
var childnodes = this[i].childnodes;
for (var j = 0; j < childnodes.length; j += 1) {
if (!selector) {
if (childnodes[j].nodetype === 1) {
children.push(childnodes[j]);
}
} else if (childnodes[j].nodetype === 1 && $(childnodes[j]).is(selector)) {
children.push(childnodes[j]);
}
}
}
return new dom7(unique(children));
}
function remove() {
for (var i = 0; i < this.length; i += 1) {
if (this[i].parentnode) {
this[i].parentnode.removechild(this[i]);
}
}
return this;
}
function add() {
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var dom = this;
var i;
var j;
for (i = 0; i < args.length; i += 1) {
var toadd = $(args[i]);
for (j = 0; j < toadd.length; j += 1) {
dom[dom.length] = toadd[j];
dom.length += 1;
}
}
return dom;
}
var methods = {
addclass: addclass,
removeclass: removeclass,
hasclass: hasclass,
toggleclass: toggleclass,
attr: attr,
removeattr: removeattr,
data: data,
transform: transform,
transition: transition,
on: on,
off: off,
trigger: trigger,
transitionend: transitionend,
outerwidth: outerwidth,
outerheight: outerheight,
offset: offset,
css: css,
each: each,
html: html,
text: text,
is: is,
index: index,
eq: eq,
append: append,
prepend: prepend,
next: next,
nextall: nextall,
prev: prev,
prevall: prevall,
parent: parent,
parents: parents,
closest: closest,
find: find,
children: children,
remove: remove,
add: add,
styles: styles,
};
object.keys(methods).foreach(function (methodname) {
$.fn[methodname] = $.fn[methodname] || methods[methodname];
});
var utils = {
deleteprops: function deleteprops(obj) {
var object = obj;
object.keys(object).foreach(function (key) {
try {
object[key] = null;
} catch (e) {
// no getter for object
}
try {
delete object[key];
} catch (e) {
// something got wrong
}
});
},
nexttick: function nexttick(callback, delay) {
if (delay === void 0) delay = 0;
return settimeout(callback, delay);
},
now: function now() {
return date.now();
},
gettranslate: function gettranslate(el, axis) {
if (axis === void 0) axis = 'x';
var matrix;
var curtransform;
var transformmatrix;
var curstyle = win.getcomputedstyle(el, null);
if (win.webkitcssmatrix) {
curtransform = curstyle.transform || curstyle.webkittransform;
if (curtransform.split(',').length > 6) {
curtransform = curtransform.split(', ').map(function (a) {
return a.replace(',', '.');
}).join(', ');
}
// some old versions of webkit choke when 'none' is passed; pass
// empty string instead in this case
transformmatrix = new win.webkitcssmatrix(curtransform === 'none' ? '' : curtransform);
} else {
transformmatrix = curstyle.moztransform || curstyle.otransform || curstyle.mstransform || curstyle.mstransform || curstyle.transform || curstyle.getpropertyvalue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
matrix = transformmatrix.tostring().split(',');
}
if (axis === 'x') {
// latest chrome and webkits fix
if (win.webkitcssmatrix) {
curtransform = transformmatrix.m41;
}
// crazy ie10 matrix
else if (matrix.length === 16) {
curtransform = parsefloat(matrix[12]);
}
// normal browsers
else {
curtransform = parsefloat(matrix[4]);
}
}
if (axis === 'y') {
// latest chrome and webkits fix
if (win.webkitcssmatrix) {
curtransform = transformmatrix.m42;
}
// crazy ie10 matrix
else if (matrix.length === 16) {
curtransform = parsefloat(matrix[13]);
}
// normal browsers
else {
curtransform = parsefloat(matrix[5]);
}
}
return curtransform || 0;
},
parseurlquery: function parseurlquery(url) {
var query = {};
var urltoparse = url || win.location.href;
var i;
var params;
var param;
var length;
if (typeof urltoparse === 'string' && urltoparse.length) {
urltoparse = urltoparse.indexof('?') > -1 ? urltoparse.replace(/\s*\?/, '') : '';
params = urltoparse.split('&').filter(function (paramspart) {
return paramspart !== '';
});
length = params.length;
for (i = 0; i < length; i += 1) {
param = params[i].replace(/#\s+/g, '').split('=');
query[decodeuricomponent(param[0])] = typeof param[1] === 'undefined' ? undefined : decodeuricomponent(param[1]) || '';
}
}
return query;
},
isobject: function isobject(o) {
return typeof o === 'object' && o !== null && o.constructor && o.constructor === object;
},
extend: function extend() {
var args = [],
len$1 = arguments.length;
while (len$1--) args[len$1] = arguments[len$1];
var to = object(args[0]);
for (var i = 1; i < args.length; i += 1) {
var nextsource = args[i];
if (nextsource !== undefined && nextsource !== null) {
var keysarray = object.keys(object(nextsource));
for (var nextindex = 0, len = keysarray.length; nextindex < len; nextindex += 1) {
var nextkey = keysarray[nextindex];
var desc = object.getownpropertydescriptor(nextsource, nextkey);
if (desc !== undefined && desc.enumerable) {
if (utils.isobject(to[nextkey]) && utils.isobject(nextsource[nextkey])) {
utils.extend(to[nextkey], nextsource[nextkey]);
} else if (!utils.isobject(to[nextkey]) && utils.isobject(nextsource[nextkey])) {
to[nextkey] = {};
utils.extend(to[nextkey], nextsource[nextkey]);
} else {
to[nextkey] = nextsource[nextkey];
}
}
}
}
}
return to;
},
};
var support = (function support() {
var testdiv = doc.createelement('div');
return {
touch: (win.modernizr && win.modernizr.touch === true) || (function checktouch() {
return !!((win.navigator.maxtouchpoints > 0) || ('ontouchstart' in win) || (win.documenttouch && doc instanceof win.documenttouch));
}()),
pointerevents: !!(win.navigator.pointerenabled || win.pointerevent || ('maxtouchpoints' in win.navigator && win.navigator.maxtouchpoints > 0)),
prefixedpointerevents: !!win.navigator.mspointerenabled,
transition: (function checktransition() {
var style = testdiv.style;
return ('transition' in style || 'webkittransition' in style || 'moztransition' in style);
}()),
transforms3d: (win.modernizr && win.modernizr.csstransforms3d === true) || (function checktransforms3d() {
var style = testdiv.style;
return ('webkitperspective' in style || 'mozperspective' in style || 'operspective' in style || 'msperspective' in style || 'perspective' in style);
}()),
flexbox: (function checkflexbox() {
var style = testdiv.style;
var styles = ('alignitems webkitalignitems webkitboxalign msflexalign mozboxalign webkitflexdirection msflexdirection mozboxdirection mozboxorient webkitboxdirection webkitboxorient').split(' ');
for (var i = 0; i < styles.length; i += 1) {
if (styles[i] in style) {
return true;
}
}
return false;
}()),
observer: (function checkobserver() {
return ('mutationobserver' in win || 'webkitmutationobserver' in win);
}()),
passivelistener: (function checkpassivelistener() {
var supportspassive = false;
try {
var opts = object.defineproperty({}, 'passive', {
// eslint-disable-next-line
get: function get() {
supportspassive = true;
},
});
win.addeventlistener('testpassivelistener', null, opts);
} catch (e) {
// no support
}
return supportspassive;
}()),
gestures: (function checkgestures() {
return 'ongesturestart' in win;
}()),
};
}());
var browser = (function browser() {
function issafari() {
var ua = win.navigator.useragent.tolowercase();
return (ua.indexof('safari') >= 0 && ua.indexof('chrome') < 0 && ua.indexof('android') < 0);
}
return {
isie: !!win.navigator.useragent.match(/trident/g) || !!win.navigator.useragent.match(/msie/g),
isedge: !!win.navigator.useragent.match(/edge/g),
issafari: issafari(),
isuiwebview: /(iphone|ipod|ipad).*applewebkit(?!.*safari)/i.test(win.navigator.useragent),
};
}());
var swiperclass = function swiperclass(params) {
if (params === void 0) params = {};
var self = this;
self.params = params;
// events
self.eventslisteners = {};
if (self.params && self.params.on) {
object.keys(self.params.on).foreach(function (eventname) {
self.on(eventname, self.params.on[eventname]);
});
}
};
var staticaccessors = {
components: {
configurable: true
}
};
swiperclass.prototype.on = function on(events, handler, priority) {
var self = this;
if (typeof handler !== 'function') {
return self;
}
var method = priority ? 'unshift' : 'push';
events.split(' ').foreach(function (event) {
if (!self.eventslisteners[event]) {
self.eventslisteners[event] = [];
}
self.eventslisteners[event][method](handler);
});
return self;
};
swiperclass.prototype.once = function once(events, handler, priority) {
var self = this;
if (typeof handler !== 'function') {
return self;
}
function oncehandler() {
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
handler.apply(self, args);
self.off(events, oncehandler);
if (oncehandler.f7proxy) {
delete oncehandler.f7proxy;
}
}
oncehandler.f7proxy = handler;
return self.on(events, oncehandler, priority);
};
swiperclass.prototype.off = function off(events, handler) {
var self = this;
if (!self.eventslisteners) {
return self;
}
events.split(' ').foreach(function (event) {
if (typeof handler === 'undefined') {
self.eventslisteners[event] = [];
} else if (self.eventslisteners[event] && self.eventslisteners[event].length) {
self.eventslisteners[event].foreach(function (eventhandler, index) {
if (eventhandler === handler || (eventhandler.f7proxy && eventhandler.f7proxy === handler)) {
self.eventslisteners[event].splice(index, 1);
}
});
}
});
return self;
};
swiperclass.prototype.emit = function emit() {
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var self = this;
if (!self.eventslisteners) {
return self;
}
var events;
var data;
var context;
if (typeof args[0] === 'string' || array.isarray(args[0])) {
events = args[0];
data = args.slice(1, args.length);
context = self;
} else {
events = args[0].events;
data = args[0].data;
context = args[0].context || self;
}
var eventsarray = array.isarray(events) ? events : events.split(' ');
eventsarray.foreach(function (event) {
if (self.eventslisteners && self.eventslisteners[event]) {
var handlers = [];
self.eventslisteners[event].foreach(function (eventhandler) {
handlers.push(eventhandler);
});
handlers.foreach(function (eventhandler) {
eventhandler.apply(context, data);
});
}
});
return self;
};
swiperclass.prototype.usemodulesparams = function usemodulesparams(instanceparams) {
var instance = this;
if (!instance.modules) {
return;
}
object.keys(instance.modules).foreach(function (modulename) {
var module = instance.modules[modulename];
// extend params
if (module.params) {
utils.extend(instanceparams, module.params);
}
});
};
swiperclass.prototype.usemodules = function usemodules(modulesparams) {
if (modulesparams === void 0) modulesparams = {};
var instance = this;
if (!instance.modules) {
return;
}
object.keys(instance.modules).foreach(function (modulename) {
var module = instance.modules[modulename];
var moduleparams = modulesparams[modulename] || {};
// extend instance methods and props
if (module.instance) {
object.keys(module.instance).foreach(function (modulepropname) {
var moduleprop = module.instance[modulepropname];
if (typeof moduleprop === 'function') {
instance[modulepropname] = moduleprop.bind(instance);
} else {
instance[modulepropname] = moduleprop;
}
});
}
// add event listeners
if (module.on && instance.on) {
object.keys(module.on).foreach(function (moduleeventname) {
instance.on(moduleeventname, module.on[moduleeventname]);
});
}
// module create callback
if (module.create) {
module.create.bind(instance)(moduleparams);
}
});
};
staticaccessors.components.set = function (components) {
var class = this;
if (!class.use) {
return;
}
class.use(components);
};
swiperclass.installmodule = function installmodule(module) {
var params = [],
len = arguments.length - 1;
while (len-- > 0) params[len] = arguments[len + 1];
var class = this;
if (!class.prototype.modules) {
class.prototype.modules = {};
}
var name = module.name || (((object.keys(class.prototype.modules).length) + "_" + (utils.now())));
class.prototype.modules[name] = module;
// prototype
if (module.proto) {
object.keys(module.proto).foreach(function (key) {
class.prototype[key] = module.proto[key];
});
}
// class
if (module.static) {
object.keys(module.static).foreach(function (key) {
class[key] = module.static[key];
});
}
// callback
if (module.install) {
module.install.apply(class, params);
}
return class;
};
swiperclass.use = function use(module) {
var params = [],
len = arguments.length - 1;
while (len-- > 0) params[len] = arguments[len + 1];
var class = this;
if (array.isarray(module)) {
module.foreach(function (m) {
return class.installmodule(m);
});
return class;
}
return class.installmodule.apply(class, [module].concat(params));
};
object.defineproperties(swiperclass, staticaccessors);
function updatesize() {
var swiper = this;
var width;
var height;
var $el = swiper.$el;
if (typeof swiper.params.width !== 'undefined') {
width = swiper.params.width;
} else {
width = $el[0].clientwidth;
}
if (typeof swiper.params.height !== 'undefined') {
height = swiper.params.height;
} else {
height = $el[0].clientheight;
}
if ((width === 0 && swiper.ishorizontal()) || (height === 0 && swiper.isvertical())) {
return;
}
// subtract paddings
width = width - parseint($el.css('padding-left'), 10) - parseint($el.css('padding-right'), 10);
height = height - parseint($el.css('padding-top'), 10) - parseint($el.css('padding-bottom'), 10);
utils.extend(swiper, {
width: width,
height: height,
size: swiper.ishorizontal() ? width : height,
});
}
function updateslides() {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var swipersize = swiper.size;
var rtl = swiper.rtltranslate;
var wrongrtl = swiper.wrongrtl;
var isvirtual = swiper.virtual && params.virtual.enabled;
var previousslideslength = isvirtual ? swiper.virtual.slides.length : swiper.slides.length;
var slides = $wrapperel.children(("." + (swiper.params.slideclass)));
var slideslength = isvirtual ? swiper.virtual.slides.length : slides.length;
var snapgrid = [];
var slidesgrid = [];
var slidessizesgrid = [];
var offsetbefore = params.slidesoffsetbefore;
if (typeof offsetbefore === 'function') {
offsetbefore = params.slidesoffsetbefore.call(swiper);
}
var offsetafter = params.slidesoffsetafter;
if (typeof offsetafter === 'function') {
offsetafter = params.slidesoffsetafter.call(swiper);
}
var previoussnapgridlength = swiper.snapgrid.length;
var previousslidesgridlength = swiper.snapgrid.length;
var spacebetween = params.spacebetween;
var slideposition = -offsetbefore;
var prevslidesize = 0;
var index = 0;
if (typeof swipersize === 'undefined') {
return;
}
if (typeof spacebetween === 'string' && spacebetween.indexof('%') >= 0) {
spacebetween = (parsefloat(spacebetween.replace('%', '')) / 100) * swipersize;
}
swiper.virtualsize = -spacebetween;
// reset margins
if (rtl) {
slides.css({
marginleft: '',
margintop: ''
});
} else {
slides.css({
marginright: '',
marginbottom: ''
});
}
var slidesnumbereventorows;
if (params.slidespercolumn > 1) {
if (math.floor(slideslength / params.slidespercolumn) === slideslength / swiper.params.slidespercolumn) {
slidesnumbereventorows = slideslength;
} else {
slidesnumbereventorows = math.ceil(slideslength / params.slidespercolumn) * params.slidespercolumn;
}
if (params.slidesperview !== 'auto' && params.slidespercolumnfill === 'row') {
slidesnumbereventorows = math.max(slidesnumbereventorows, params.slidesperview * params.slidespercolumn);
}
}
// calc slides
var slidesize;
var slidespercolumn = params.slidespercolumn;
var slidesperrow = slidesnumbereventorows / slidespercolumn;
var numfullcolumns = math.floor(slideslength / params.slidespercolumn);
for (var i = 0; i < slideslength; i += 1) {
slidesize = 0;
var slide = slides.eq(i);
if (params.slidespercolumn > 1) {
// set slides order
var newslideorderindex = (void 0);
var column = (void 0);
var row = (void 0);
if (
(params.slidespercolumnfill === 'column') ||
(params.slidespercolumnfill === 'row' && params.slidespergroup > 1)
) {
if (params.slidespercolumnfill === 'column') {
column = math.floor(i / slidespercolumn);
row = i - (column * slidespercolumn);
if (column > numfullcolumns || (column === numfullcolumns && row === slidespercolumn - 1)) {
row += 1;
if (row >= slidespercolumn) {
row = 0;
column += 1;
}
}
} else {
var groupindex = math.floor(i / params.slidespergroup);
row = math.floor(i / params.slidesperview) - groupindex * params.slidespercolumn;
column = i - row * params.slidesperview - groupindex * params.slidesperview;
}
newslideorderindex = column + ((row * slidesnumbereventorows) / slidespercolumn);
slide
.css({
'-webkit-box-ordinal-group': newslideorderindex,
'-moz-box-ordinal-group': newslideorderindex,
'-ms-flex-order': newslideorderindex,
'-webkit-order': newslideorderindex,
order: newslideorderindex,
});
} else {
row = math.floor(i / slidesperrow);
column = i - (row * slidesperrow);
}
slide
.css(
("margin-" + (swiper.ishorizontal() ? 'top' : 'left')),
(row !== 0 && params.spacebetween) && (((params.spacebetween) + "px"))
)
.attr('data-swiper-column', column)
.attr('data-swiper-row', row);
}
if (slide.css('display') === 'none') {
continue;
} // eslint-disable-line
if (params.slidesperview === 'auto') {
var slidestyles = win.getcomputedstyle(slide[0], null);
var currenttransform = slide[0].style.transform;
var currentwebkittransform = slide[0].style.webkittransform;
if (currenttransform) {
slide[0].style.transform = 'none';
}
if (currentwebkittransform) {
slide[0].style.webkittransform = 'none';
}
if (params.roundlengths) {
slidesize = swiper.ishorizontal() ?
slide.outerwidth(true) :
slide.outerheight(true);
} else {
// eslint-disable-next-line
if (swiper.ishorizontal()) {
var width = parsefloat(slidestyles.getpropertyvalue('width'));
var paddingleft = parsefloat(slidestyles.getpropertyvalue('padding-left'));
var paddingright = parsefloat(slidestyles.getpropertyvalue('padding-right'));
var marginleft = parsefloat(slidestyles.getpropertyvalue('margin-left'));
var marginright = parsefloat(slidestyles.getpropertyvalue('margin-right'));
var boxsizing = slidestyles.getpropertyvalue('box-sizing');
if (boxsizing && boxsizing === 'border-box' && !browser.isie) {
slidesize = width + marginleft + marginright;
} else {
slidesize = width + paddingleft + paddingright + marginleft + marginright;
}
} else {
var height = parsefloat(slidestyles.getpropertyvalue('height'));
var paddingtop = parsefloat(slidestyles.getpropertyvalue('padding-top'));
var paddingbottom = parsefloat(slidestyles.getpropertyvalue('padding-bottom'));
var margintop = parsefloat(slidestyles.getpropertyvalue('margin-top'));
var marginbottom = parsefloat(slidestyles.getpropertyvalue('margin-bottom'));
var boxsizing$1 = slidestyles.getpropertyvalue('box-sizing');
if (boxsizing$1 && boxsizing$1 === 'border-box' && !browser.isie) {
slidesize = height + margintop + marginbottom;
} else {
slidesize = height + paddingtop + paddingbottom + margintop + marginbottom;
}
}
}
if (currenttransform) {
slide[0].style.transform = currenttransform;
}
if (currentwebkittransform) {
slide[0].style.webkittransform = currentwebkittransform;
}
if (params.roundlengths) {
slidesize = math.floor(slidesize);
}
} else {
slidesize = (swipersize - ((params.slidesperview - 1) * spacebetween)) / params.slidesperview;
if (params.roundlengths) {
slidesize = math.floor(slidesize);
}
if (slides[i]) {
if (swiper.ishorizontal()) {
slides[i].style.width = slidesize + "px";
} else {
slides[i].style.height = slidesize + "px";
}
}
}
if (slides[i]) {
slides[i].swiperslidesize = slidesize;
}
slidessizesgrid.push(slidesize);
if (params.centeredslides) {
slideposition = slideposition + (slidesize / 2) + (prevslidesize / 2) + spacebetween;
if (prevslidesize === 0 && i !== 0) {
slideposition = slideposition - (swipersize / 2) - spacebetween;
}
if (i === 0) {
slideposition = slideposition - (swipersize / 2) - spacebetween;
}
if (math.abs(slideposition) < 1 / 1000) {
slideposition = 0;
}
if (params.roundlengths) {
slideposition = math.floor(slideposition);
}
if ((index) % params.slidespergroup === 0) {
snapgrid.push(slideposition);
}
slidesgrid.push(slideposition);
} else {
if (params.roundlengths) {
slideposition = math.floor(slideposition);
}
if ((index) % params.slidespergroup === 0) {
snapgrid.push(slideposition);
}
slidesgrid.push(slideposition);
slideposition = slideposition + slidesize + spacebetween;
}
swiper.virtualsize += slidesize + spacebetween;
prevslidesize = slidesize;
index += 1;
}
swiper.virtualsize = math.max(swiper.virtualsize, swipersize) + offsetafter;
var newslidesgrid;
if (
rtl && wrongrtl && (params.effect === 'slide' || params.effect === 'coverflow')) {
$wrapperel.css({
width: ((swiper.virtualsize + params.spacebetween) + "px")
});
}
if (!support.flexbox || params.setwrappersize) {
if (swiper.ishorizontal()) {
$wrapperel.css({
width: ((swiper.virtualsize + params.spacebetween) + "px")
});
} else {
$wrapperel.css({
height: ((swiper.virtualsize + params.spacebetween) + "px")
});
}
}
if (params.slidespercolumn > 1) {
swiper.virtualsize = (slidesize + params.spacebetween) * slidesnumbereventorows;
swiper.virtualsize = math.ceil(swiper.virtualsize / params.slidespercolumn) - params.spacebetween;
if (swiper.ishorizontal()) {
$wrapperel.css({
width: ((swiper.virtualsize + params.spacebetween) + "px")
});
} else {
$wrapperel.css({
height: ((swiper.virtualsize + params.spacebetween) + "px")
});
}
if (params.centeredslides) {
newslidesgrid = [];
for (var i$1 = 0; i$1 < snapgrid.length; i$1 += 1) {
var slidesgriditem = snapgrid[i$1];
if (params.roundlengths) {
slidesgriditem = math.floor(slidesgriditem);
}
if (snapgrid[i$1] < swiper.virtualsize + snapgrid[0]) {
newslidesgrid.push(slidesgriditem);
}
}
snapgrid = newslidesgrid;
}
}
// remove last grid elements depending on width
if (!params.centeredslides) {
newslidesgrid = [];
for (var i$2 = 0; i$2 < snapgrid.length; i$2 += 1) {
var slidesgriditem$1 = snapgrid[i$2];
if (params.roundlengths) {
slidesgriditem$1 = math.floor(slidesgriditem$1);
}
if (snapgrid[i$2] <= swiper.virtualsize - swipersize) {
newslidesgrid.push(slidesgriditem$1);
}
}
snapgrid = newslidesgrid;
if (math.floor(swiper.virtualsize - swipersize) - math.floor(snapgrid[snapgrid.length - 1]) > 1) {
snapgrid.push(swiper.virtualsize - swipersize);
}
}
if (snapgrid.length === 0) {
snapgrid = [0];
}
if (params.spacebetween !== 0) {
if (swiper.ishorizontal()) {
if (rtl) {
slides.css({
marginleft: (spacebetween + "px")
});
} else {
slides.css({
marginright: (spacebetween + "px")
});
}
} else {
slides.css({
marginbottom: (spacebetween + "px")
});
}
}
if (params.centerinsufficientslides) {
var allslidessize = 0;
slidessizesgrid.foreach(function (slidesizevalue) {
allslidessize += slidesizevalue + (params.spacebetween ? params.spacebetween : 0);
});
allslidessize -= params.spacebetween;
if (allslidessize < swipersize) {
var allslidesoffset = (swipersize - allslidessize) / 2;
snapgrid.foreach(function (snap, snapindex) {
snapgrid[snapindex] = snap - allslidesoffset;
});
slidesgrid.foreach(function (snap, snapindex) {
slidesgrid[snapindex] = snap + allslidesoffset;
});
}
}
utils.extend(swiper, {
slides: slides,
snapgrid: snapgrid,
slidesgrid: slidesgrid,
slidessizesgrid: slidessizesgrid,
});
if (slideslength !== previousslideslength) {
swiper.emit('slideslengthchange');
}
if (snapgrid.length !== previoussnapgridlength) {
if (swiper.params.watchoverflow) {
swiper.checkoverflow();
}
swiper.emit('snapgridlengthchange');
}
if (slidesgrid.length !== previousslidesgridlength) {
swiper.emit('slidesgridlengthchange');
}
if (params.watchslidesprogress || params.watchslidesvisibility) {
swiper.updateslidesoffset();
}
}
function updateautoheight(speed) {
var swiper = this;
var activeslides = [];
var newheight = 0;
var i;
if (typeof speed === 'number') {
swiper.settransition(speed);
} else if (speed === true) {
swiper.settransition(swiper.params.speed);
}
// find slides currently in view
if (swiper.params.slidesperview !== 'auto' && swiper.params.slidesperview > 1) {
for (i = 0; i < math.ceil(swiper.params.slidesperview); i += 1) {
var index = swiper.activeindex + i;
if (index > swiper.slides.length) {
break;
}
activeslides.push(swiper.slides.eq(index)[0]);
}
} else {
activeslides.push(swiper.slides.eq(swiper.activeindex)[0]);
}
// find new height from highest slide in view
for (i = 0; i < activeslides.length; i += 1) {
if (typeof activeslides[i] !== 'undefined') {
var height = activeslides[i].offsetheight;
newheight = height > newheight ? height : newheight;
}
}
// update height
if (newheight) {
swiper.$wrapperel.css('height', (newheight + "px"));
}
}
function updateslidesoffset() {
var swiper = this;
var slides = swiper.slides;
for (var i = 0; i < slides.length; i += 1) {
slides[i].swiperslideoffset = swiper.ishorizontal() ? slides[i].offsetleft : slides[i].offsettop;
}
}
function updateslidesprogress(translate) {
var swiper = this;
var params = swiper.params;
if (typeof translate === 'undefined') {
// eslint-disable-next-line
translate = (swiper && swiper.translate) || 0;
}
var slides = swiper.slides;
var rtl = swiper.rtltranslate;
if (slides.length === 0) {
return;
}
if (typeof slides[0].swiperslideoffset === 'undefined') {
swiper.updateslidesoffset();
}
var offsetcenter = -translate;
if (rtl) {
offsetcenter = translate;
}
// visible slides
slides.removeclass(params.slidevisibleclass);
swiper.visibleslidesindexes = [];
swiper.visibleslides = [];
for (var i = 0; i < slides.length; i += 1) {
var slide = slides[i];
var slideprogress = (
(offsetcenter + (params.centeredslides ? swiper.mintranslate() : 0)) - slide.swiperslideoffset
) / (slide.swiperslidesize + params.spacebetween);
if (params.watchslidesvisibility) {
var slidebefore = -(offsetcenter - slide.swiperslideoffset);
var slideafter = slidebefore + swiper.slidessizesgrid[i];
var isvisible = (slidebefore >= 0 && slidebefore < swiper.size - 1) ||
(slideafter > 1 && slideafter <= swiper.size) ||
(slidebefore <= 0 && slideafter >= swiper.size);
if (isvisible) {
swiper.visibleslides.push(slide);
swiper.visibleslidesindexes.push(i);
slides.eq(i).addclass(params.slidevisibleclass);
}
}
slide.progress = rtl ? -slideprogress : slideprogress;
}
swiper.visibleslides = $(swiper.visibleslides);
}
function updateprogress(translate) {
var swiper = this;
var params = swiper.params;
if (typeof translate === 'undefined') {
var multiplier = swiper.rtltranslate ? -1 : 1;
// eslint-disable-next-line
translate = (swiper && swiper.translate && (swiper.translate * multiplier)) || 0;
}
var translatesdiff = swiper.maxtranslate() - swiper.mintranslate();
var progress = swiper.progress;
var isbeginning = swiper.isbeginning;
var isend = swiper.isend;
var wasbeginning = isbeginning;
var wasend = isend;
if (translatesdiff === 0) {
progress = 0;
isbeginning = true;
isend = true;
} else {
progress = (translate - swiper.mintranslate()) / (translatesdiff);
isbeginning = progress <= 0;
isend = progress >= 1;
}
utils.extend(swiper, {
progress: progress,
isbeginning: isbeginning,
isend: isend,
});
if (params.watchslidesprogress || params.watchslidesvisibility) {
swiper.updateslidesprogress(translate);
}
if (isbeginning && !wasbeginning) {
swiper.emit('reachbeginning toedge');
}
if (isend && !wasend) {
swiper.emit('reachend toedge');
}
if ((wasbeginning && !isbeginning) || (wasend && !isend)) {
swiper.emit('fromedge');
}
swiper.emit('progress', progress);
}
function updateslidesclasses() {
var swiper = this;
var slides = swiper.slides;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var activeindex = swiper.activeindex;
var realindex = swiper.realindex;
var isvirtual = swiper.virtual && params.virtual.enabled;
slides.removeclass(((params.slideactiveclass) + " " + (params.slidenextclass) + " " + (params.slideprevclass) + " " + (params.slideduplicateactiveclass) + " " + (params.slideduplicatenextclass) + " " + (params.slideduplicateprevclass)));
var activeslide;
if (isvirtual) {
activeslide = swiper.$wrapperel.find(("." + (params.slideclass) + "[data-swiper-slide-index=\"" + activeindex + "\"]"));
} else {
activeslide = slides.eq(activeindex);
}
// active classes
activeslide.addclass(params.slideactiveclass);
if (params.loop) {
// duplicate to all looped slides
if (activeslide.hasclass(params.slideduplicateclass)) {
$wrapperel
.children(("." + (params.slideclass) + ":not(." + (params.slideduplicateclass) + ")[data-swiper-slide-index=\"" + realindex + "\"]"))
.addclass(params.slideduplicateactiveclass);
} else {
$wrapperel
.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + "[data-swiper-slide-index=\"" + realindex + "\"]"))
.addclass(params.slideduplicateactiveclass);
}
}
// next slide
var nextslide = activeslide.nextall(("." + (params.slideclass))).eq(0).addclass(params.slidenextclass);
if (params.loop && nextslide.length === 0) {
nextslide = slides.eq(0);
nextslide.addclass(params.slidenextclass);
}
// prev slide
var prevslide = activeslide.prevall(("." + (params.slideclass))).eq(0).addclass(params.slideprevclass);
if (params.loop && prevslide.length === 0) {
prevslide = slides.eq(-1);
prevslide.addclass(params.slideprevclass);
}
if (params.loop) {
// duplicate to all looped slides
if (nextslide.hasclass(params.slideduplicateclass)) {
$wrapperel
.children(("." + (params.slideclass) + ":not(." + (params.slideduplicateclass) + ")[data-swiper-slide-index=\"" + (nextslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicatenextclass);
} else {
$wrapperel
.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + "[data-swiper-slide-index=\"" + (nextslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicatenextclass);
}
if (prevslide.hasclass(params.slideduplicateclass)) {
$wrapperel
.children(("." + (params.slideclass) + ":not(." + (params.slideduplicateclass) + ")[data-swiper-slide-index=\"" + (prevslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicateprevclass);
} else {
$wrapperel
.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + "[data-swiper-slide-index=\"" + (prevslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicateprevclass);
}
}
}
function updateactiveindex(newactiveindex) {
var swiper = this;
var translate = swiper.rtltranslate ? swiper.translate : -swiper.translate;
var slidesgrid = swiper.slidesgrid;
var snapgrid = swiper.snapgrid;
var params = swiper.params;
var previousindex = swiper.activeindex;
var previousrealindex = swiper.realindex;
var previoussnapindex = swiper.snapindex;
var activeindex = newactiveindex;
var snapindex;
if (typeof activeindex === 'undefined') {
for (var i = 0; i < slidesgrid.length; i += 1) {
if (typeof slidesgrid[i + 1] !== 'undefined') {
if (translate >= slidesgrid[i] && translate < slidesgrid[i + 1] - ((slidesgrid[i + 1] - slidesgrid[i]) / 2)) {
activeindex = i;
} else if (translate >= slidesgrid[i] && translate < slidesgrid[i + 1]) {
activeindex = i + 1;
}
} else if (translate >= slidesgrid[i]) {
activeindex = i;
}
}
// normalize slideindex
if (params.normalizeslideindex) {
if (activeindex < 0 || typeof activeindex === 'undefined') {
activeindex = 0;
}
}
}
if (snapgrid.indexof(translate) >= 0) {
snapindex = snapgrid.indexof(translate);
} else {
snapindex = math.floor(activeindex / params.slidespergroup);
}
if (snapindex >= snapgrid.length) {
snapindex = snapgrid.length - 1;
}
if (activeindex === previousindex) {
if (snapindex !== previoussnapindex) {
swiper.snapindex = snapindex;
swiper.emit('snapindexchange');
}
return;
}
// get real index
var realindex = parseint(swiper.slides.eq(activeindex).attr('data-swiper-slide-index') || activeindex, 10);
utils.extend(swiper, {
snapindex: snapindex,
realindex: realindex,
previousindex: previousindex,
activeindex: activeindex,
});
swiper.emit('activeindexchange');
swiper.emit('snapindexchange');
if (previousrealindex !== realindex) {
swiper.emit('realindexchange');
}
if (swiper.initialized || swiper.runcallbacksoninit) {
swiper.emit('slidechange');
}
}
function updateclickedslide(e) {
var swiper = this;
var params = swiper.params;
var slide = $(e.target).closest(("." + (params.slideclass)))[0];
var slidefound = false;
if (slide) {
for (var i = 0; i < swiper.slides.length; i += 1) {
if (swiper.slides[i] === slide) {
slidefound = true;
}
}
}
if (slide && slidefound) {
swiper.clickedslide = slide;
if (swiper.virtual && swiper.params.virtual.enabled) {
swiper.clickedindex = parseint($(slide).attr('data-swiper-slide-index'), 10);
} else {
swiper.clickedindex = $(slide).index();
}
} else {
swiper.clickedslide = undefined;
swiper.clickedindex = undefined;
return;
}
if (params.slidetoclickedslide && swiper.clickedindex !== undefined && swiper.clickedindex !== swiper.activeindex) {
swiper.slidetoclickedslide();
}
}
var update = {
updatesize: updatesize,
updateslides: updateslides,
updateautoheight: updateautoheight,
updateslidesoffset: updateslidesoffset,
updateslidesprogress: updateslidesprogress,
updateprogress: updateprogress,
updateslidesclasses: updateslidesclasses,
updateactiveindex: updateactiveindex,
updateclickedslide: updateclickedslide,
};
function gettranslate(axis) {
if (axis === void 0) axis = this.ishorizontal() ? 'x' : 'y';
var swiper = this;
var params = swiper.params;
var rtl = swiper.rtltranslate;
var translate = swiper.translate;
var $wrapperel = swiper.$wrapperel;
if (params.virtualtranslate) {
return rtl ? -translate : translate;
}
var currenttranslate = utils.gettranslate($wrapperel[0], axis);
if (rtl) {
currenttranslate = -currenttranslate;
}
return currenttranslate || 0;
}
function settranslate(translate, bycontroller) {
var swiper = this;
var rtl = swiper.rtltranslate;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var progress = swiper.progress;
var x = 0;
var y = 0;
var z = 0;
if (swiper.ishorizontal()) {
x = rtl ? -translate : translate;
} else {
y = translate;
}
if (params.roundlengths) {
x = math.floor(x);
y = math.floor(y);
}
if (!params.virtualtranslate) {
if (support.transforms3d) {
$wrapperel.transform(("translate3d(" + x + "px, " + y + "px, " + z + "px)"));
} else {
$wrapperel.transform(("translate(" + x + "px, " + y + "px)"));
}
}
swiper.previoustranslate = swiper.translate;
swiper.translate = swiper.ishorizontal() ? x : y;
// check if we need to update progress
var newprogress;
var translatesdiff = swiper.maxtranslate() - swiper.mintranslate();
if (translatesdiff === 0) {
newprogress = 0;
} else {
newprogress = (translate - swiper.mintranslate()) / (translatesdiff);
}
if (newprogress !== progress) {
swiper.updateprogress(translate);
}
swiper.emit('settranslate', swiper.translate, bycontroller);
}
function mintranslate() {
return (-this.snapgrid[0]);
}
function maxtranslate() {
return (-this.snapgrid[this.snapgrid.length - 1]);
}
var translate = {
gettranslate: gettranslate,
settranslate: settranslate,
mintranslate: mintranslate,
maxtranslate: maxtranslate,
};
function settransition(duration, bycontroller) {
var swiper = this;
swiper.$wrapperel.transition(duration);
swiper.emit('settransition', duration, bycontroller);
}
function transitionstart(runcallbacks, direction) {
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var activeindex = swiper.activeindex;
var params = swiper.params;
var previousindex = swiper.previousindex;
if (params.autoheight) {
swiper.updateautoheight();
}
var dir = direction;
if (!dir) {
if (activeindex > previousindex) {
dir = 'next';
} else if (activeindex < previousindex) {
dir = 'prev';
} else {
dir = 'reset';
}
}
swiper.emit('transitionstart');
if (runcallbacks && activeindex !== previousindex) {
if (dir === 'reset') {
swiper.emit('slideresettransitionstart');
return;
}
swiper.emit('slidechangetransitionstart');
if (dir === 'next') {
swiper.emit('slidenexttransitionstart');
} else {
swiper.emit('slideprevtransitionstart');
}
}
}
function transitionend$1(runcallbacks, direction) {
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var activeindex = swiper.activeindex;
var previousindex = swiper.previousindex;
swiper.animating = false;
swiper.settransition(0);
var dir = direction;
if (!dir) {
if (activeindex > previousindex) {
dir = 'next';
} else if (activeindex < previousindex) {
dir = 'prev';
} else {
dir = 'reset';
}
}
swiper.emit('transitionend');
if (runcallbacks && activeindex !== previousindex) {
if (dir === 'reset') {
swiper.emit('slideresettransitionend');
return;
}
swiper.emit('slidechangetransitionend');
if (dir === 'next') {
swiper.emit('slidenexttransitionend');
} else {
swiper.emit('slideprevtransitionend');
}
}
}
var transition$1 = {
settransition: settransition,
transitionstart: transitionstart,
transitionend: transitionend$1,
};
function slideto(index, speed, runcallbacks, internal) {
if (index === void 0) index = 0;
if (speed === void 0) speed = this.params.speed;
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var slideindex = index;
if (slideindex < 0) {
slideindex = 0;
}
var params = swiper.params;
var snapgrid = swiper.snapgrid;
var slidesgrid = swiper.slidesgrid;
var previousindex = swiper.previousindex;
var activeindex = swiper.activeindex;
var rtl = swiper.rtltranslate;
if (swiper.animating && params.preventinteractionontransition) {
return false;
}
var snapindex = math.floor(slideindex / params.slidespergroup);
if (snapindex >= snapgrid.length) {
snapindex = snapgrid.length - 1;
}
if ((activeindex || params.initialslide || 0) === (previousindex || 0) && runcallbacks) {
swiper.emit('beforeslidechangestart');
}
var translate = -snapgrid[snapindex];
// update progress
swiper.updateprogress(translate);
// normalize slideindex
if (params.normalizeslideindex) {
for (var i = 0; i < slidesgrid.length; i += 1) {
if (-math.floor(translate * 100) >= math.floor(slidesgrid[i] * 100)) {
slideindex = i;
}
}
}
// directions locks
if (swiper.initialized && slideindex !== activeindex) {
if (!swiper.allowslidenext && translate < swiper.translate && translate < swiper.mintranslate()) {
return false;
}
if (!swiper.allowslideprev && translate > swiper.translate && translate > swiper.maxtranslate()) {
if ((activeindex || 0) !== slideindex) {
return false;
}
}
}
var direction;
if (slideindex > activeindex) {
direction = 'next';
} else if (slideindex < activeindex) {
direction = 'prev';
} else {
direction = 'reset';
}
// update index
if ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) {
swiper.updateactiveindex(slideindex);
// update height
if (params.autoheight) {
swiper.updateautoheight();
}
swiper.updateslidesclasses();
if (params.effect !== 'slide') {
swiper.settranslate(translate);
}
if (direction !== 'reset') {
swiper.transitionstart(runcallbacks, direction);
swiper.transitionend(runcallbacks, direction);
}
return false;
}
if (speed === 0 || !support.transition) {
swiper.settransition(0);
swiper.settranslate(translate);
swiper.updateactiveindex(slideindex);
swiper.updateslidesclasses();
swiper.emit('beforetransitionstart', speed, internal);
swiper.transitionstart(runcallbacks, direction);
swiper.transitionend(runcallbacks, direction);
} else {
swiper.settransition(speed);
swiper.settranslate(translate);
swiper.updateactiveindex(slideindex);
swiper.updateslidesclasses();
swiper.emit('beforetransitionstart', speed, internal);
swiper.transitionstart(runcallbacks, direction);
if (!swiper.animating) {
swiper.animating = true;
if (!swiper.onslidetowrappertransitionend) {
swiper.onslidetowrappertransitionend = function transitionend(e) {
if (!swiper || swiper.destroyed) {
return;
}
if (e.target !== this) {
return;
}
swiper.$wrapperel[0].removeeventlistener('transitionend', swiper.onslidetowrappertransitionend);
swiper.$wrapperel[0].removeeventlistener('webkittransitionend', swiper.onslidetowrappertransitionend);
swiper.onslidetowrappertransitionend = null;
delete swiper.onslidetowrappertransitionend;
swiper.transitionend(runcallbacks, direction);
};
}
swiper.$wrapperel[0].addeventlistener('transitionend', swiper.onslidetowrappertransitionend);
swiper.$wrapperel[0].addeventlistener('webkittransitionend', swiper.onslidetowrappertransitionend);
}
}
return true;
}
function slidetoloop(index, speed, runcallbacks, internal) {
if (index === void 0) index = 0;
if (speed === void 0) speed = this.params.speed;
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var newindex = index;
if (swiper.params.loop) {
newindex += swiper.loopedslides;
}
return swiper.slideto(newindex, speed, runcallbacks, internal);
}
/* eslint no-unused-vars: "off" */
function slidenext(speed, runcallbacks, internal) {
if (speed === void 0) speed = this.params.speed;
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var params = swiper.params;
var animating = swiper.animating;
if (params.loop) {
if (animating) {
return false;
}
swiper.loopfix();
// eslint-disable-next-line
swiper._clientleft = swiper.$wrapperel[0].clientleft;
return swiper.slideto(swiper.activeindex + params.slidespergroup, speed, runcallbacks, internal);
}
return swiper.slideto(swiper.activeindex + params.slidespergroup, speed, runcallbacks, internal);
}
/* eslint no-unused-vars: "off" */
function slideprev(speed, runcallbacks, internal) {
if (speed === void 0) speed = this.params.speed;
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var params = swiper.params;
var animating = swiper.animating;
var snapgrid = swiper.snapgrid;
var slidesgrid = swiper.slidesgrid;
var rtltranslate = swiper.rtltranslate;
if (params.loop) {
if (animating) {
return false;
}
swiper.loopfix();
// eslint-disable-next-line
swiper._clientleft = swiper.$wrapperel[0].clientleft;
}
var translate = rtltranslate ? swiper.translate : -swiper.translate;
function normalize(val) {
if (val < 0) {
return -math.floor(math.abs(val));
}
return math.floor(val);
}
var normalizedtranslate = normalize(translate);
var normalizedsnapgrid = snapgrid.map(function (val) {
return normalize(val);
});
var normalizedslidesgrid = slidesgrid.map(function (val) {
return normalize(val);
});
var currentsnap = snapgrid[normalizedsnapgrid.indexof(normalizedtranslate)];
var prevsnap = snapgrid[normalizedsnapgrid.indexof(normalizedtranslate) - 1];
var previndex;
if (typeof prevsnap !== 'undefined') {
previndex = slidesgrid.indexof(prevsnap);
if (previndex < 0) {
previndex = swiper.activeindex - 1;
}
}
return swiper.slideto(previndex, speed, runcallbacks, internal);
}
/* eslint no-unused-vars: "off" */
function slidereset(speed, runcallbacks, internal) {
if (speed === void 0) speed = this.params.speed;
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
return swiper.slideto(swiper.activeindex, speed, runcallbacks, internal);
}
/* eslint no-unused-vars: "off" */
function slidetoclosest(speed, runcallbacks, internal) {
if (speed === void 0) speed = this.params.speed;
if (runcallbacks === void 0) runcallbacks = true;
var swiper = this;
var index = swiper.activeindex;
var snapindex = math.floor(index / swiper.params.slidespergroup);
if (snapindex < swiper.snapgrid.length - 1) {
var translate = swiper.rtltranslate ? swiper.translate : -swiper.translate;
var currentsnap = swiper.snapgrid[snapindex];
var nextsnap = swiper.snapgrid[snapindex + 1];
if ((translate - currentsnap) > (nextsnap - currentsnap) / 2) {
index = swiper.params.slidespergroup;
}
}
return swiper.slideto(index, speed, runcallbacks, internal);
}
function slidetoclickedslide() {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var slidesperview = params.slidesperview === 'auto' ? swiper.slidesperviewdynamic() : params.slidesperview;
var slidetoindex = swiper.clickedindex;
var realindex;
if (params.loop) {
if (swiper.animating) {
return;
}
realindex = parseint($(swiper.clickedslide).attr('data-swiper-slide-index'), 10);
if (params.centeredslides) {
if (
(slidetoindex < swiper.loopedslides - (slidesperview / 2)) ||
(slidetoindex > (swiper.slides.length - swiper.loopedslides) + (slidesperview / 2))
) {
swiper.loopfix();
slidetoindex = $wrapperel
.children(("." + (params.slideclass) + "[data-swiper-slide-index=\"" + realindex + "\"]:not(." + (params.slideduplicateclass) + ")"))
.eq(0)
.index();
utils.nexttick(function () {
swiper.slideto(slidetoindex);
});
} else {
swiper.slideto(slidetoindex);
}
} else if (slidetoindex > swiper.slides.length - slidesperview) {
swiper.loopfix();
slidetoindex = $wrapperel
.children(("." + (params.slideclass) + "[data-swiper-slide-index=\"" + realindex + "\"]:not(." + (params.slideduplicateclass) + ")"))
.eq(0)
.index();
utils.nexttick(function () {
swiper.slideto(slidetoindex);
});
} else {
swiper.slideto(slidetoindex);
}
} else {
swiper.slideto(slidetoindex);
}
}
var slide = {
slideto: slideto,
slidetoloop: slidetoloop,
slidenext: slidenext,
slideprev: slideprev,
slidereset: slidereset,
slidetoclosest: slidetoclosest,
slidetoclickedslide: slidetoclickedslide,
};
function loopcreate() {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
// remove duplicated slides
$wrapperel.children(("." + (params.slideclass) + "." + (params.slideduplicateclass))).remove();
var slides = $wrapperel.children(("." + (params.slideclass)));
if (params.loopfillgroupwithblank) {
var blankslidesnum = params.slidespergroup - (slides.length % params.slidespergroup);
if (blankslidesnum !== params.slidespergroup) {
for (var i = 0; i < blankslidesnum; i += 1) {
var blanknode = $(doc.createelement('div')).addclass(((params.slideclass) + " " + (params.slideblankclass)));
$wrapperel.append(blanknode);
}
slides = $wrapperel.children(("." + (params.slideclass)));
}
}
if (params.slidesperview === 'auto' && !params.loopedslides) {
params.loopedslides = slides.length;
}
swiper.loopedslides = parseint(params.loopedslides || params.slidesperview, 10);
swiper.loopedslides += params.loopadditionalslides;
if (swiper.loopedslides > slides.length) {
swiper.loopedslides = slides.length;
}
var prependslides = [];
var appendslides = [];
slides.each(function (index, el) {
var slide = $(el);
if (index < swiper.loopedslides) {
appendslides.push(el);
}
if (index < slides.length && index >= slides.length - swiper.loopedslides) {
prependslides.push(el);
}
slide.attr('data-swiper-slide-index', index);
});
for (var i$1 = 0; i$1 < appendslides.length; i$1 += 1) {
$wrapperel.append($(appendslides[i$1].clonenode(true)).addclass(params.slideduplicateclass));
}
for (var i$2 = prependslides.length - 1; i$2 >= 0; i$2 -= 1) {
$wrapperel.prepend($(prependslides[i$2].clonenode(true)).addclass(params.slideduplicateclass));
}
}
function loopfix() {
var swiper = this;
var params = swiper.params;
var activeindex = swiper.activeindex;
var slides = swiper.slides;
var loopedslides = swiper.loopedslides;
var allowslideprev = swiper.allowslideprev;
var allowslidenext = swiper.allowslidenext;
var snapgrid = swiper.snapgrid;
var rtl = swiper.rtltranslate;
var newindex;
swiper.allowslideprev = true;
swiper.allowslidenext = true;
var snaptranslate = -snapgrid[activeindex];
var diff = snaptranslate - swiper.gettranslate();
// fix for negative oversliding
if (activeindex < loopedslides) {
newindex = (slides.length - (loopedslides * 3)) + activeindex;
newindex += loopedslides;
var slidechanged = swiper.slideto(newindex, 0, false, true);
if (slidechanged && diff !== 0) {
swiper.settranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
} else if ((params.slidesperview === 'auto' && activeindex >= loopedslides * 2) || (activeindex >= slides.length - loopedslides)) {
// fix for positive oversliding
newindex = -slides.length + activeindex + loopedslides;
newindex += loopedslides;
var slidechanged$1 = swiper.slideto(newindex, 0, false, true);
if (slidechanged$1 && diff !== 0) {
swiper.settranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
}
swiper.allowslideprev = allowslideprev;
swiper.allowslidenext = allowslidenext;
}
function loopdestroy() {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var params = swiper.params;
var slides = swiper.slides;
$wrapperel.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + ",." + (params.slideclass) + "." + (params.slideblankclass))).remove();
slides.removeattr('data-swiper-slide-index');
}
var loop = {
loopcreate: loopcreate,
loopfix: loopfix,
loopdestroy: loopdestroy,
};
function setgrabcursor(moving) {
var swiper = this;
if (support.touch || !swiper.params.simulatetouch || (swiper.params.watchoverflow && swiper.islocked)) {
return;
}
var el = swiper.el;
el.style.cursor = 'move';
el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
el.style.cursor = moving ? 'grabbing' : 'grab';
}
function unsetgrabcursor() {
var swiper = this;
if (support.touch || (swiper.params.watchoverflow && swiper.islocked)) {
return;
}
swiper.el.style.cursor = '';
}
var grabcursor = {
setgrabcursor: setgrabcursor,
unsetgrabcursor: unsetgrabcursor,
};
function appendslide(slides) {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var params = swiper.params;
if (params.loop) {
swiper.loopdestroy();
}
if (typeof slides === 'object' && 'length' in slides) {
for (var i = 0; i < slides.length; i += 1) {
if (slides[i]) {
$wrapperel.append(slides[i]);
}
}
} else {
$wrapperel.append(slides);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
}
function prependslide(slides) {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var activeindex = swiper.activeindex;
if (params.loop) {
swiper.loopdestroy();
}
var newactiveindex = activeindex + 1;
if (typeof slides === 'object' && 'length' in slides) {
for (var i = 0; i < slides.length; i += 1) {
if (slides[i]) {
$wrapperel.prepend(slides[i]);
}
}
newactiveindex = activeindex + slides.length;
} else {
$wrapperel.prepend(slides);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
swiper.slideto(newactiveindex, 0, false);
}
function addslide(index, slides) {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var params = swiper.params;
var activeindex = swiper.activeindex;
var activeindexbuffer = activeindex;
if (params.loop) {
activeindexbuffer -= swiper.loopedslides;
swiper.loopdestroy();
swiper.slides = $wrapperel.children(("." + (params.slideclass)));
}
var baselength = swiper.slides.length;
if (index <= 0) {
swiper.prependslide(slides);
return;
}
if (index >= baselength) {
swiper.appendslide(slides);
return;
}
var newactiveindex = activeindexbuffer > index ? activeindexbuffer + 1 : activeindexbuffer;
var slidesbuffer = [];
for (var i = baselength - 1; i >= index; i -= 1) {
var currentslide = swiper.slides.eq(i);
currentslide.remove();
slidesbuffer.unshift(currentslide);
}
if (typeof slides === 'object' && 'length' in slides) {
for (var i$1 = 0; i$1 < slides.length; i$1 += 1) {
if (slides[i$1]) {
$wrapperel.append(slides[i$1]);
}
}
newactiveindex = activeindexbuffer > index ? activeindexbuffer + slides.length : activeindexbuffer;
} else {
$wrapperel.append(slides);
}
for (var i$2 = 0; i$2 < slidesbuffer.length; i$2 += 1) {
$wrapperel.append(slidesbuffer[i$2]);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
if (params.loop) {
swiper.slideto(newactiveindex + swiper.loopedslides, 0, false);
} else {
swiper.slideto(newactiveindex, 0, false);
}
}
function removeslide(slidesindexes) {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var activeindex = swiper.activeindex;
var activeindexbuffer = activeindex;
if (params.loop) {
activeindexbuffer -= swiper.loopedslides;
swiper.loopdestroy();
swiper.slides = $wrapperel.children(("." + (params.slideclass)));
}
var newactiveindex = activeindexbuffer;
var indextoremove;
if (typeof slidesindexes === 'object' && 'length' in slidesindexes) {
for (var i = 0; i < slidesindexes.length; i += 1) {
indextoremove = slidesindexes[i];
if (swiper.slides[indextoremove]) {
swiper.slides.eq(indextoremove).remove();
}
if (indextoremove < newactiveindex) {
newactiveindex -= 1;
}
}
newactiveindex = math.max(newactiveindex, 0);
} else {
indextoremove = slidesindexes;
if (swiper.slides[indextoremove]) {
swiper.slides.eq(indextoremove).remove();
}
if (indextoremove < newactiveindex) {
newactiveindex -= 1;
}
newactiveindex = math.max(newactiveindex, 0);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
if (params.loop) {
swiper.slideto(newactiveindex + swiper.loopedslides, 0, false);
} else {
swiper.slideto(newactiveindex, 0, false);
}
}
function removeallslides() {
var swiper = this;
var slidesindexes = [];
for (var i = 0; i < swiper.slides.length; i += 1) {
slidesindexes.push(i);
}
swiper.removeslide(slidesindexes);
}
var manipulation = {
appendslide: appendslide,
prependslide: prependslide,
addslide: addslide,
removeslide: removeslide,
removeallslides: removeallslides,
};
var device = (function device() {
var ua = win.navigator.useragent;
var device = {
ios: false,
android: false,
androidchrome: false,
desktop: false,
windows: false,
iphone: false,
ipod: false,
ipad: false,
cordova: win.cordova || win.phonegap,
phonegap: win.cordova || win.phonegap,
};
var windows = ua.match(/(windows phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
var android = ua.match(/(android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
var ipad = ua.match(/(ipad).*os\s([\d_]+)/);
var ipod = ua.match(/(ipod)(.*os\s([\d_]+))?/);
var iphone = !ipad && ua.match(/(iphone\sos|ios)\s([\d_]+)/);
// windows
if (windows) {
device.os = 'windows';
device.osversion = windows[2];
device.windows = true;
}
// android
if (android && !windows) {
device.os = 'android';
device.osversion = android[2];
device.android = true;
device.androidchrome = ua.tolowercase().indexof('chrome') >= 0;
}
if (ipad || iphone || ipod) {
device.os = 'ios';
device.ios = true;
}
// ios
if (iphone && !ipod) {
device.osversion = iphone[2].replace(/_/g, '.');
device.iphone = true;
}
if (ipad) {
device.osversion = ipad[2].replace(/_/g, '.');
device.ipad = true;
}
if (ipod) {
device.osversion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
device.iphone = true;
}
// ios 8+ changed ua
if (device.ios && device.osversion && ua.indexof('version/') >= 0) {
if (device.osversion.split('.')[0] === '10') {
device.osversion = ua.tolowercase().split('version/')[1].split(' ')[0];
}
}
// desktop
device.desktop = !(device.os || device.android || device.webview);
// webview
device.webview = (iphone || ipad || ipod) && ua.match(/.*applewebkit(?!.*safari)/i);
// minimal ui
if (device.os && device.os === 'ios') {
var osversionarr = device.osversion.split('.');
var metaviewport = doc.queryselector('meta[name="viewport"]');
device.minimalui = !device.webview &&
(ipod || iphone) &&
(osversionarr[0] * 1 === 7 ? osversionarr[1] * 1 >= 1 : osversionarr[0] * 1 > 7) &&
metaviewport && metaviewport.getattribute('content').indexof('minimal-ui') >= 0;
}
// pixel ratio
device.pixelratio = win.devicepixelratio || 1;
// export object
return device;
}());
function ontouchstart(event) {
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params;
var touches = swiper.touches;
if (swiper.animating && params.preventinteractionontransition) {
return;
}
var e = event;
if (e.originalevent) {
e = e.originalevent;
}
data.istouchevent = e.type === 'touchstart';
if (!data.istouchevent && 'which' in e && e.which === 3) {
return;
}
if (!data.istouchevent && 'button' in e && e.button > 0) {
return;
}
if (data.istouched && data.ismoved) {
return;
}
if (params.noswiping && $(e.target).closest(params.noswipingselector ? params.noswipingselector : ("." + (params.noswipingclass)))[0]) {
swiper.allowclick = true;
return;
}
if (params.swipehandler) {
if (!$(e).closest(params.swipehandler)[0]) {
return;
}
}
touches.currentx = e.type === 'touchstart' ? e.targettouches[0].pagex : e.pagex;
touches.currenty = e.type === 'touchstart' ? e.targettouches[0].pagey : e.pagey;
var startx = touches.currentx;
var starty = touches.currenty;
// do not start if ios edge swipe is detected. otherwise ios app (uiwebview) cannot swipe-to-go-back anymore
var edgeswipedetection = params.edgeswipedetection || params.iosedgeswipedetection;
var edgeswipethreshold = params.edgeswipethreshold || params.iosedgeswipethreshold;
if (
edgeswipedetection &&
((startx <= edgeswipethreshold) ||
(startx >= win.screen.width - edgeswipethreshold))
) {
return;
}
utils.extend(data, {
istouched: true,
ismoved: false,
allowtouchcallbacks: true,
isscrolling: undefined,
startmoving: undefined,
});
touches.startx = startx;
touches.starty = starty;
data.touchstarttime = utils.now();
swiper.allowclick = true;
swiper.updatesize();
swiper.swipedirection = undefined;
if (params.threshold > 0) {
data.allowthresholdmove = false;
}
if (e.type !== 'touchstart') {
var preventdefault = true;
if ($(e.target).is(data.formelements)) {
preventdefault = false;
}
if (
doc.activeelement &&
$(doc.activeelement).is(data.formelements) &&
doc.activeelement !== e.target
) {
doc.activeelement.blur();
}
var shouldpreventdefault = preventdefault && swiper.allowtouchmove && params.touchstartpreventdefault;
if (params.touchstartforcepreventdefault || shouldpreventdefault) {
e.preventdefault();
}
}
swiper.emit('touchstart', e);
}
function ontouchmove(event) {
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params;
var touches = swiper.touches;
var rtl = swiper.rtltranslate;
var e = event;
if (e.originalevent) {
e = e.originalevent;
}
if (!data.istouched) {
if (data.startmoving && data.isscrolling) {
swiper.emit('touchmoveopposite', e);
}
return;
}
if (data.istouchevent && e.type === 'mousemove') {
return;
}
var targettouch = e.type === 'touchmove' && e.targettouches && (e.targettouches[0] || e.changedtouches[0]);
var pagex = e.type === 'touchmove' ? targettouch.pagex : e.pagex;
var pagey = e.type === 'touchmove' ? targettouch.pagey : e.pagey;
if (e.preventedbynestedswiper) {
touches.startx = pagex;
touches.starty = pagey;
return;
}
if (!swiper.allowtouchmove) {
// ismoved = true;
swiper.allowclick = false;
if (data.istouched) {
utils.extend(touches, {
startx: pagex,
starty: pagey,
currentx: pagex,
currenty: pagey,
});
data.touchstarttime = utils.now();
}
return;
}
if (data.istouchevent && params.touchreleaseonedges && !params.loop) {
if (swiper.isvertical()) {
// vertical
if (
(pagey < touches.starty && swiper.translate <= swiper.maxtranslate()) ||
(pagey > touches.starty && swiper.translate >= swiper.mintranslate())
) {
data.istouched = false;
data.ismoved = false;
return;
}
} else if (
(pagex < touches.startx && swiper.translate <= swiper.maxtranslate()) ||
(pagex > touches.startx && swiper.translate >= swiper.mintranslate())
) {
return;
}
}
if (data.istouchevent && doc.activeelement) {
if (e.target === doc.activeelement && $(e.target).is(data.formelements)) {
data.ismoved = true;
swiper.allowclick = false;
return;
}
}
if (data.allowtouchcallbacks) {
swiper.emit('touchmove', e);
}
if (e.targettouches && e.targettouches.length > 1) {
return;
}
touches.currentx = pagex;
touches.currenty = pagey;
var diffx = touches.currentx - touches.startx;
var diffy = touches.currenty - touches.starty;
if (swiper.params.threshold && math.sqrt((math.pow(diffx, 2)) + (math.pow(diffy, 2))) < swiper.params.threshold) {
return;
}
if (typeof data.isscrolling === 'undefined') {
var touchangle;
if ((swiper.ishorizontal() && touches.currenty === touches.starty) || (swiper.isvertical() && touches.currentx === touches.startx)) {
data.isscrolling = false;
} else {
// eslint-disable-next-line
if ((diffx * diffx) + (diffy * diffy) >= 25) {
touchangle = (math.atan2(math.abs(diffy), math.abs(diffx)) * 180) / math.pi;
data.isscrolling = swiper.ishorizontal() ? touchangle > params.touchangle : (90 - touchangle > params.touchangle);
}
}
}
if (data.isscrolling) {
swiper.emit('touchmoveopposite', e);
}
if (typeof data.startmoving === 'undefined') {
if (touches.currentx !== touches.startx || touches.currenty !== touches.starty) {
data.startmoving = true;
}
}
if (data.isscrolling) {
data.istouched = false;
return;
}
if (!data.startmoving) {
return;
}
swiper.allowclick = false;
e.preventdefault();
if (params.touchmovestoppropagation && !params.nested) {
e.stoppropagation();
}
if (!data.ismoved) {
if (params.loop) {
swiper.loopfix();
}
data.starttranslate = swiper.gettranslate();
swiper.settransition(0);
if (swiper.animating) {
swiper.$wrapperel.trigger('webkittransitionend transitionend');
}
data.allowmomentumbounce = false;
// grab cursor
if (params.grabcursor && (swiper.allowslidenext === true || swiper.allowslideprev === true)) {
swiper.setgrabcursor(true);
}
swiper.emit('sliderfirstmove', e);
}
swiper.emit('slidermove', e);
data.ismoved = true;
var diff = swiper.ishorizontal() ? diffx : diffy;
touches.diff = diff;
diff *= params.touchratio;
if (rtl) {
diff = -diff;
}
swiper.swipedirection = diff > 0 ? 'prev' : 'next';
data.currenttranslate = diff + data.starttranslate;
var disableparentswiper = true;
var resistanceratio = params.resistanceratio;
if (params.touchreleaseonedges) {
resistanceratio = 0;
}
if ((diff > 0 && data.currenttranslate > swiper.mintranslate())) {
disableparentswiper = false;
if (params.resistance) {
data.currenttranslate = (swiper.mintranslate() - 1) + (math.pow((-swiper.mintranslate() + data.starttranslate + diff), resistanceratio));
}
} else if (diff < 0 && data.currenttranslate < swiper.maxtranslate()) {
disableparentswiper = false;
if (params.resistance) {
data.currenttranslate = (swiper.maxtranslate() + 1) - (math.pow((swiper.maxtranslate() - data.starttranslate - diff), resistanceratio));
}
}
if (disableparentswiper) {
e.preventedbynestedswiper = true;
}
// directions locks
if (!swiper.allowslidenext && swiper.swipedirection === 'next' && data.currenttranslate < data.starttranslate) {
data.currenttranslate = data.starttranslate;
}
if (!swiper.allowslideprev && swiper.swipedirection === 'prev' && data.currenttranslate > data.starttranslate) {
data.currenttranslate = data.starttranslate;
}
// threshold
if (params.threshold > 0) {
if (math.abs(diff) > params.threshold || data.allowthresholdmove) {
if (!data.allowthresholdmove) {
data.allowthresholdmove = true;
touches.startx = touches.currentx;
touches.starty = touches.currenty;
data.currenttranslate = data.starttranslate;
touches.diff = swiper.ishorizontal() ? touches.currentx - touches.startx : touches.currenty - touches.starty;
return;
}
} else {
data.currenttranslate = data.starttranslate;
return;
}
}
if (!params.followfinger) {
return;
}
// update active index in free mode
if (params.freemode || params.watchslidesprogress || params.watchslidesvisibility) {
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
if (params.freemode) {
// velocity
if (data.velocities.length === 0) {
data.velocities.push({
position: touches[swiper.ishorizontal() ? 'startx' : 'starty'],
time: data.touchstarttime,
});
}
data.velocities.push({
position: touches[swiper.ishorizontal() ? 'currentx' : 'currenty'],
time: utils.now(),
});
}
// update progress
swiper.updateprogress(data.currenttranslate);
// update translate
swiper.settranslate(data.currenttranslate);
}
function ontouchend(event) {
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params;
var touches = swiper.touches;
var rtl = swiper.rtltranslate;
var $wrapperel = swiper.$wrapperel;
var slidesgrid = swiper.slidesgrid;
var snapgrid = swiper.snapgrid;
var e = event;
if (e.originalevent) {
e = e.originalevent;
}
if (data.allowtouchcallbacks) {
swiper.emit('touchend', e);
}
data.allowtouchcallbacks = false;
if (!data.istouched) {
if (data.ismoved && params.grabcursor) {
swiper.setgrabcursor(false);
}
data.ismoved = false;
data.startmoving = false;
return;
}
// return grab cursor
if (params.grabcursor && data.ismoved && data.istouched && (swiper.allowslidenext === true || swiper.allowslideprev === true)) {
swiper.setgrabcursor(false);
}
// time diff
var touchendtime = utils.now();
var timediff = touchendtime - data.touchstarttime;
// tap, doubletap, click
if (swiper.allowclick) {
swiper.updateclickedslide(e);
swiper.emit('tap', e);
if (timediff < 300 && (touchendtime - data.lastclicktime) > 300) {
if (data.clicktimeout) {
cleartimeout(data.clicktimeout);
}
data.clicktimeout = utils.nexttick(function () {
if (!swiper || swiper.destroyed) {
return;
}
swiper.emit('click', e);
}, 300);
}
if (timediff < 300 && (touchendtime - data.lastclicktime) < 300) {
if (data.clicktimeout) {
cleartimeout(data.clicktimeout);
}
swiper.emit('doubletap', e);
}
}
data.lastclicktime = utils.now();
utils.nexttick(function () {
if (!swiper.destroyed) {
swiper.allowclick = true;
}
});
if (!data.istouched || !data.ismoved || !swiper.swipedirection || touches.diff === 0 || data.currenttranslate === data.starttranslate) {
data.istouched = false;
data.ismoved = false;
data.startmoving = false;
return;
}
data.istouched = false;
data.ismoved = false;
data.startmoving = false;
var currentpos;
if (params.followfinger) {
currentpos = rtl ? swiper.translate : -swiper.translate;
} else {
currentpos = -data.currenttranslate;
}
if (params.freemode) {
if (currentpos < -swiper.mintranslate()) {
swiper.slideto(swiper.activeindex);
return;
}
if (currentpos > -swiper.maxtranslate()) {
if (swiper.slides.length < snapgrid.length) {
swiper.slideto(snapgrid.length - 1);
} else {
swiper.slideto(swiper.slides.length - 1);
}
return;
}
if (params.freemodemomentum) {
if (data.velocities.length > 1) {
var lastmoveevent = data.velocities.pop();
var velocityevent = data.velocities.pop();
var distance = lastmoveevent.position - velocityevent.position;
var time = lastmoveevent.time - velocityevent.time;
swiper.velocity = distance / time;
swiper.velocity /= 2;
if (math.abs(swiper.velocity) < params.freemodeminimumvelocity) {
swiper.velocity = 0;
}
// this implies that the user stopped moving a finger then released.
// there would be no events with distance zero, so the last event is stale.
if (time > 150 || (utils.now() - lastmoveevent.time) > 300) {
swiper.velocity = 0;
}
} else {
swiper.velocity = 0;
}
swiper.velocity *= params.freemodemomentumvelocityratio;
data.velocities.length = 0;
var momentumduration = 1000 * params.freemodemomentumratio;
var momentumdistance = swiper.velocity * momentumduration;
var newposition = swiper.translate + momentumdistance;
if (rtl) {
newposition = -newposition;
}
var dobounce = false;
var afterbounceposition;
var bounceamount = math.abs(swiper.velocity) * 20 * params.freemodemomentumbounceratio;
var needsloopfix;
if (newposition < swiper.maxtranslate()) {
if (params.freemodemomentumbounce) {
if (newposition + swiper.maxtranslate() < -bounceamount) {
newposition = swiper.maxtranslate() - bounceamount;
}
afterbounceposition = swiper.maxtranslate();
dobounce = true;
data.allowmomentumbounce = true;
} else {
newposition = swiper.maxtranslate();
}
if (params.loop && params.centeredslides) {
needsloopfix = true;
}
} else if (newposition > swiper.mintranslate()) {
if (params.freemodemomentumbounce) {
if (newposition - swiper.mintranslate() > bounceamount) {
newposition = swiper.mintranslate() + bounceamount;
}
afterbounceposition = swiper.mintranslate();
dobounce = true;
data.allowmomentumbounce = true;
} else {
newposition = swiper.mintranslate();
}
if (params.loop && params.centeredslides) {
needsloopfix = true;
}
} else if (params.freemodesticky) {
var nextslide;
for (var j = 0; j < snapgrid.length; j += 1) {
if (snapgrid[j] > -newposition) {
nextslide = j;
break;
}
}
if (math.abs(snapgrid[nextslide] - newposition) < math.abs(snapgrid[nextslide - 1] - newposition) || swiper.swipedirection === 'next') {
newposition = snapgrid[nextslide];
} else {
newposition = snapgrid[nextslide - 1];
}
newposition = -newposition;
}
if (needsloopfix) {
swiper.once('transitionend', function () {
swiper.loopfix();
});
}
// fix duration
if (swiper.velocity !== 0) {
if (rtl) {
momentumduration = math.abs((-newposition - swiper.translate) / swiper.velocity);
} else {
momentumduration = math.abs((newposition - swiper.translate) / swiper.velocity);
}
} else if (params.freemodesticky) {
swiper.slidetoclosest();
return;
}
if (params.freemodemomentumbounce && dobounce) {
swiper.updateprogress(afterbounceposition);
swiper.settransition(momentumduration);
swiper.settranslate(newposition);
swiper.transitionstart(true, swiper.swipedirection);
swiper.animating = true;
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed || !data.allowmomentumbounce) {
return;
}
swiper.emit('momentumbounce');
swiper.settransition(params.speed);
swiper.settranslate(afterbounceposition);
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) {
return;
}
swiper.transitionend();
});
});
} else if (swiper.velocity) {
swiper.updateprogress(newposition);
swiper.settransition(momentumduration);
swiper.settranslate(newposition);
swiper.transitionstart(true, swiper.swipedirection);
if (!swiper.animating) {
swiper.animating = true;
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) {
return;
}
swiper.transitionend();
});
}
} else {
swiper.updateprogress(newposition);
}
swiper.updateactiveindex();
swiper.updateslidesclasses();
} else if (params.freemodesticky) {
swiper.slidetoclosest();
return;
}
if (!params.freemodemomentum || timediff >= params.longswipesms) {
swiper.updateprogress();
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
return;
}
// find current slide
var stopindex = 0;
var groupsize = swiper.slidessizesgrid[0];
for (var i = 0; i < slidesgrid.length; i += params.slidespergroup) {
if (typeof slidesgrid[i + params.slidespergroup] !== 'undefined') {
if (currentpos >= slidesgrid[i] && currentpos < slidesgrid[i + params.slidespergroup]) {
stopindex = i;
groupsize = slidesgrid[i + params.slidespergroup] - slidesgrid[i];
}
} else if (currentpos >= slidesgrid[i]) {
stopindex = i;
groupsize = slidesgrid[slidesgrid.length - 1] - slidesgrid[slidesgrid.length - 2];
}
}
// find current slide size
var ratio = (currentpos - slidesgrid[stopindex]) / groupsize;
if (timediff > params.longswipesms) {
// long touches
if (!params.longswipes) {
swiper.slideto(swiper.activeindex);
return;
}
if (swiper.swipedirection === 'next') {
if (ratio >= params.longswipesratio) {
swiper.slideto(stopindex + params.slidespergroup);
} else {
swiper.slideto(stopindex);
}
}
if (swiper.swipedirection === 'prev') {
if (ratio > (1 - params.longswipesratio)) {
swiper.slideto(stopindex + params.slidespergroup);
} else {
swiper.slideto(stopindex);
}
}
} else {
// short swipes
if (!params.shortswipes) {
swiper.slideto(swiper.activeindex);
return;
}
if (swiper.swipedirection === 'next') {
swiper.slideto(stopindex + params.slidespergroup);
}
if (swiper.swipedirection === 'prev') {
swiper.slideto(stopindex);
}
}
}
function onresize() {
var swiper = this;
var params = swiper.params;
var el = swiper.el;
if (el && el.offsetwidth === 0) {
return;
}
// breakpoints
if (params.breakpoints) {
swiper.setbreakpoint();
}
// save locks
var allowslidenext = swiper.allowslidenext;
var allowslideprev = swiper.allowslideprev;
var snapgrid = swiper.snapgrid;
// disable locks on resize
swiper.allowslidenext = true;
swiper.allowslideprev = true;
swiper.updatesize();
swiper.updateslides();
if (params.freemode) {
var newtranslate = math.min(math.max(swiper.translate, swiper.maxtranslate()), swiper.mintranslate());
swiper.settranslate(newtranslate);
swiper.updateactiveindex();
swiper.updateslidesclasses();
if (params.autoheight) {
swiper.updateautoheight();
}
} else {
swiper.updateslidesclasses();
if ((params.slidesperview === 'auto' || params.slidesperview > 1) && swiper.isend && !swiper.params.centeredslides) {
swiper.slideto(swiper.slides.length - 1, 0, false, true);
} else {
swiper.slideto(swiper.activeindex, 0, false, true);
}
}
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
swiper.autoplay.run();
}
// return locks after resize
swiper.allowslideprev = allowslideprev;
swiper.allowslidenext = allowslidenext;
if (swiper.params.watchoverflow && snapgrid !== swiper.snapgrid) {
swiper.checkoverflow();
}
}
function onclick(e) {
var swiper = this;
if (!swiper.allowclick) {
if (swiper.params.preventclicks) {
e.preventdefault();
}
if (swiper.params.preventclickspropagation && swiper.animating) {
e.stoppropagation();
e.stopimmediatepropagation();
}
}
}
var dummyeventattached = false;
function dummyeventlistener() {}
function attachevents() {
var swiper = this;
var params = swiper.params;
var touchevents = swiper.touchevents;
var el = swiper.el;
var wrapperel = swiper.wrapperel;
{
swiper.ontouchstart = ontouchstart.bind(swiper);
swiper.ontouchmove = ontouchmove.bind(swiper);
swiper.ontouchend = ontouchend.bind(swiper);
}
swiper.onclick = onclick.bind(swiper);
var target = params.toucheventstarget === 'container' ? el : wrapperel;
var capture = !!params.nested;
// touch events
{
if (!support.touch && (support.pointerevents || support.prefixedpointerevents)) {
target.addeventlistener(touchevents.start, swiper.ontouchstart, false);
doc.addeventlistener(touchevents.move, swiper.ontouchmove, capture);
doc.addeventlistener(touchevents.end, swiper.ontouchend, false);
} else {
if (support.touch) {
var passivelistener = touchevents.start === 'touchstart' && support.passivelistener && params.passivelisteners ? {
passive: true,
capture: false
} : false;
target.addeventlistener(touchevents.start, swiper.ontouchstart, passivelistener);
target.addeventlistener(touchevents.move, swiper.ontouchmove, support.passivelistener ? {
passive: false,
capture: capture
} : capture);
target.addeventlistener(touchevents.end, swiper.ontouchend, passivelistener);
if (!dummyeventattached) {
doc.addeventlistener('touchstart', dummyeventlistener);
dummyeventattached = true;
}
}
if ((params.simulatetouch && !device.ios && !device.android) || (params.simulatetouch && !support.touch && device.ios)) {
target.addeventlistener('mousedown', swiper.ontouchstart, false);
doc.addeventlistener('mousemove', swiper.ontouchmove, capture);
doc.addeventlistener('mouseup', swiper.ontouchend, false);
}
}
// prevent links clicks
if (params.preventclicks || params.preventclickspropagation) {
target.addeventlistener('click', swiper.onclick, true);
}
}
// resize handler
swiper.on((device.ios || device.android ? 'resize orientationchange observerupdate' : 'resize observerupdate'), onresize, true);
}
function detachevents() {
var swiper = this;
var params = swiper.params;
var touchevents = swiper.touchevents;
var el = swiper.el;
var wrapperel = swiper.wrapperel;
var target = params.toucheventstarget === 'container' ? el : wrapperel;
var capture = !!params.nested;
// touch events
{
if (!support.touch && (support.pointerevents || support.prefixedpointerevents)) {
target.removeeventlistener(touchevents.start, swiper.ontouchstart, false);
doc.removeeventlistener(touchevents.move, swiper.ontouchmove, capture);
doc.removeeventlistener(touchevents.end, swiper.ontouchend, false);
} else {
if (support.touch) {
var passivelistener = touchevents.start === 'ontouchstart' && support.passivelistener && params.passivelisteners ? {
passive: true,
capture: false
} : false;
target.removeeventlistener(touchevents.start, swiper.ontouchstart, passivelistener);
target.removeeventlistener(touchevents.move, swiper.ontouchmove, capture);
target.removeeventlistener(touchevents.end, swiper.ontouchend, passivelistener);
}
if ((params.simulatetouch && !device.ios && !device.android) || (params.simulatetouch && !support.touch && device.ios)) {
target.removeeventlistener('mousedown', swiper.ontouchstart, false);
doc.removeeventlistener('mousemove', swiper.ontouchmove, capture);
doc.removeeventlistener('mouseup', swiper.ontouchend, false);
}
}
// prevent links clicks
if (params.preventclicks || params.preventclickspropagation) {
target.removeeventlistener('click', swiper.onclick, true);
}
}
// resize handler
swiper.off((device.ios || device.android ? 'resize orientationchange observerupdate' : 'resize observerupdate'), onresize);
}
var events = {
attachevents: attachevents,
detachevents: detachevents,
};
function setbreakpoint() {
var swiper = this;
var activeindex = swiper.activeindex;
var initialized = swiper.initialized;
var loopedslides = swiper.loopedslides;
if (loopedslides === void 0) loopedslides = 0;
var params = swiper.params;
var breakpoints = params.breakpoints;
if (!breakpoints || (breakpoints && object.keys(breakpoints).length === 0)) {
return;
}
// set breakpoint for window width and update parameters
var breakpoint = swiper.getbreakpoint(breakpoints);
if (breakpoint && swiper.currentbreakpoint !== breakpoint) {
var breakpointonlyparams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
if (breakpointonlyparams) {
['slidesperview', 'spacebetween', 'slidespergroup'].foreach(function (param) {
var paramvalue = breakpointonlyparams[param];
if (typeof paramvalue === 'undefined') {
return;
}
if (param === 'slidesperview' && (paramvalue === 'auto' || paramvalue === 'auto')) {
breakpointonlyparams[param] = 'auto';
} else if (param === 'slidesperview') {
breakpointonlyparams[param] = parsefloat(paramvalue);
} else {
breakpointonlyparams[param] = parseint(paramvalue, 10);
}
});
}
var breakpointparams = breakpointonlyparams || swiper.originalparams;
var directionchanged = breakpointparams.direction && breakpointparams.direction !== params.direction;
var needsreloop = params.loop && (breakpointparams.slidesperview !== params.slidesperview || directionchanged);
if (directionchanged && initialized) {
swiper.changedirection();
}
utils.extend(swiper.params, breakpointparams);
utils.extend(swiper, {
allowtouchmove: swiper.params.allowtouchmove,
allowslidenext: swiper.params.allowslidenext,
allowslideprev: swiper.params.allowslideprev,
});
swiper.currentbreakpoint = breakpoint;
if (needsreloop && initialized) {
swiper.loopdestroy();
swiper.loopcreate();
swiper.updateslides();
swiper.slideto((activeindex - loopedslides) + swiper.loopedslides, 0, false);
}
swiper.emit('breakpoint', breakpointparams);
}
}
function getbreakpoint(breakpoints) {
var swiper = this;
// get breakpoint for window width
if (!breakpoints) {
return undefined;
}
var breakpoint = false;
var points = [];
object.keys(breakpoints).foreach(function (point) {
points.push(point);
});
points.sort(function (a, b) {
return parseint(a, 10) - parseint(b, 10);
});
for (var i = 0; i < points.length; i += 1) {
var point = points[i];
if (swiper.params.breakpointsinverse) {
if (point <= win.innerwidth) {
breakpoint = point;
}
} else if (point >= win.innerwidth && !breakpoint) {
breakpoint = point;
}
}
return breakpoint || 'max';
}
var breakpoints = {
setbreakpoint: setbreakpoint,
getbreakpoint: getbreakpoint
};
function addclasses() {
var swiper = this;
var classnames = swiper.classnames;
var params = swiper.params;
var rtl = swiper.rtl;
var $el = swiper.$el;
var suffixes = [];
suffixes.push('initialized');
suffixes.push(params.direction);
if (params.freemode) {
suffixes.push('free-mode');
}
if (!support.flexbox) {
suffixes.push('no-flexbox');
}
if (params.autoheight) {
suffixes.push('autoheight');
}
if (rtl) {
suffixes.push('rtl');
}
if (params.slidespercolumn > 1) {
suffixes.push('multirow');
}
if (device.android) {
suffixes.push('android');
}
if (device.ios) {
suffixes.push('ios');
}
// wp8 touch events fix
if ((browser.isie || browser.isedge) && (support.pointerevents || support.prefixedpointerevents)) {
suffixes.push(("wp8-" + (params.direction)));
}
suffixes.foreach(function (suffix) {
classnames.push(params.containermodifierclass + suffix);
});
$el.addclass(classnames.join(' '));
}
function removeclasses() {
var swiper = this;
var $el = swiper.$el;
var classnames = swiper.classnames;
$el.removeclass(classnames.join(' '));
}
var classes = {
addclasses: addclasses,
removeclasses: removeclasses
};
function loadimage(imageel, src, srcset, sizes, checkforcomplete, callback) {
var image;
function onready() {
if (callback) {
callback();
}
}
if (!imageel.complete || !checkforcomplete) {
if (src) {
image = new win.image();
image.onload = onready;
image.onerror = onready;
if (sizes) {
image.sizes = sizes;
}
if (srcset) {
image.srcset = srcset;
}
if (src) {
image.src = src;
}
} else {
onready();
}
} else {
// image already loaded...
onready();
}
}
function preloadimages() {
var swiper = this;
swiper.imagestoload = swiper.$el.find('img');
function onready() {
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) {
return;
}
if (swiper.imagesloaded !== undefined) {
swiper.imagesloaded += 1;
}
if (swiper.imagesloaded === swiper.imagestoload.length) {
if (swiper.params.updateonimagesready) {
swiper.update();
}
swiper.emit('imagesready');
}
}
for (var i = 0; i < swiper.imagestoload.length; i += 1) {
var imageel = swiper.imagestoload[i];
swiper.loadimage(
imageel,
imageel.currentsrc || imageel.getattribute('src'),
imageel.srcset || imageel.getattribute('srcset'),
imageel.sizes || imageel.getattribute('sizes'),
true,
onready
);
}
}
var images = {
loadimage: loadimage,
preloadimages: preloadimages,
};
function checkoverflow() {
var swiper = this;
var waslocked = swiper.islocked;
swiper.islocked = swiper.snapgrid.length === 1;
swiper.allowslidenext = !swiper.islocked;
swiper.allowslideprev = !swiper.islocked;
// events
if (waslocked !== swiper.islocked) {
swiper.emit(swiper.islocked ? 'lock' : 'unlock');
}
if (waslocked && waslocked !== swiper.islocked) {
swiper.isend = false;
swiper.navigation.update();
}
}
var checkoverflow$1 = {
checkoverflow: checkoverflow
};
var defaults = {
init: true,
direction: 'horizontal',
toucheventstarget: 'container',
initialslide: 0,
speed: 300,
//
preventinteractionontransition: false,
// to support ios's swipe-to-go-back gesture (when being used in-app, with uiwebview).
edgeswipedetection: false,
edgeswipethreshold: 20,
// free mode
freemode: false,
freemodemomentum: true,
freemodemomentumratio: 1,
freemodemomentumbounce: true,
freemodemomentumbounceratio: 1,
freemodemomentumvelocityratio: 1,
freemodesticky: false,
freemodeminimumvelocity: 0.02,
// autoheight
autoheight: false,
// set wrapper width
setwrappersize: false,
// virtual translate
virtualtranslate: false,
// effects
effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
// breakpoints
breakpoints: undefined,
breakpointsinverse: false,
// slides grid
spacebetween: 0,
slidesperview: 1,
slidespercolumn: 1,
slidespercolumnfill: 'column',
slidespergroup: 1,
centeredslides: false,
slidesoffsetbefore: 0, // in px
slidesoffsetafter: 0, // in px
normalizeslideindex: true,
centerinsufficientslides: false,
// disable swiper and hide navigation when container not overflow
watchoverflow: false,
// round length
roundlengths: false,
// touches
touchratio: 1,
touchangle: 45,
simulatetouch: true,
shortswipes: true,
longswipes: true,
longswipesratio: 0.5,
longswipesms: 300,
followfinger: true,
allowtouchmove: true,
threshold: 0,
touchmovestoppropagation: true,
touchstartpreventdefault: true,
touchstartforcepreventdefault: false,
touchreleaseonedges: false,
// unique navigation elements
uniquenavelements: true,
// resistance
resistance: true,
resistanceratio: 0.85,
// progress
watchslidesprogress: false,
watchslidesvisibility: false,
// cursor
grabcursor: false,
// clicks
preventclicks: true,
preventclickspropagation: true,
slidetoclickedslide: false,
// images
preloadimages: true,
updateonimagesready: true,
// loop
loop: false,
loopadditionalslides: 0,
loopedslides: null,
loopfillgroupwithblank: false,
// swiping/no swiping
allowslideprev: true,
allowslidenext: true,
swipehandler: null, // '.swipe-handler',
noswiping: true,
noswipingclass: 'swiper-no-swiping',
noswipingselector: null,
// passive listeners
passivelisteners: true,
// ns
containermodifierclass: 'swiper-container-', // new
slideclass: 'swiper-slide',
slideblankclass: 'swiper-slide-invisible-blank',
slideactiveclass: 'swiper-slide-active',
slideduplicateactiveclass: 'swiper-slide-duplicate-active',
slidevisibleclass: 'swiper-slide-visible',
slideduplicateclass: 'swiper-slide-duplicate',
slidenextclass: 'swiper-slide-next',
slideduplicatenextclass: 'swiper-slide-duplicate-next',
slideprevclass: 'swiper-slide-prev',
slideduplicateprevclass: 'swiper-slide-duplicate-prev',
wrapperclass: 'swiper-wrapper',
// callbacks
runcallbacksoninit: true,
};
/* eslint no-param-reassign: "off" */
var prototypes = {
update: update,
translate: translate,
transition: transition$1,
slide: slide,
loop: loop,
grabcursor: grabcursor,
manipulation: manipulation,
events: events,
breakpoints: breakpoints,
checkoverflow: checkoverflow$1,
classes: classes,
images: images,
};
var extendeddefaults = {};
var swiper = /*@__pure__*/ (function (swiperclass) {
function swiper() {
var assign;
var args = [],
len = arguments.length;
while (len--) args[len] = arguments[len];
var el;
var params;
if (args.length === 1 && args[0].constructor && args[0].constructor === object) {
params = args[0];
} else {
(assign = args, el = assign[0], params = assign[1]);
}
if (!params) {
params = {};
}
params = utils.extend({}, params);
if (el && !params.el) {
params.el = el;
}
swiperclass.call(this, params);
object.keys(prototypes).foreach(function (prototypegroup) {
object.keys(prototypes[prototypegroup]).foreach(function (protomethod) {
if (!swiper.prototype[protomethod]) {
swiper.prototype[protomethod] = prototypes[prototypegroup][protomethod];
}
});
});
// swiper instance
var swiper = this;
if (typeof swiper.modules === 'undefined') {
swiper.modules = {};
}
object.keys(swiper.modules).foreach(function (modulename) {
var module = swiper.modules[modulename];
if (module.params) {
var moduleparamname = object.keys(module.params)[0];
var moduleparams = module.params[moduleparamname];
if (typeof moduleparams !== 'object' || moduleparams === null) {
return;
}
if (!(moduleparamname in params && 'enabled' in moduleparams)) {
return;
}
if (params[moduleparamname] === true) {
params[moduleparamname] = {
enabled: true
};
}
if (
typeof params[moduleparamname] === 'object' &&
!('enabled' in params[moduleparamname])
) {
params[moduleparamname].enabled = true;
}
if (!params[moduleparamname]) {
params[moduleparamname] = {
enabled: false
};
}
}
});
// extend defaults with modules params
var swiperparams = utils.extend({}, defaults);
swiper.usemodulesparams(swiperparams);
// extend defaults with passed params
swiper.params = utils.extend({}, swiperparams, extendeddefaults, params);
swiper.originalparams = utils.extend({}, swiper.params);
swiper.passedparams = utils.extend({}, params);
// save dom lib
swiper.$ = $;
// find el
var $el = $(swiper.params.el);
el = $el[0];
if (!el) {
return undefined;
}
if ($el.length > 1) {
var swipers = [];
$el.each(function (index, containerel) {
var newparams = utils.extend({}, params, {
el: containerel
});
swipers.push(new swiper(newparams));
});
return swipers;
}
el.swiper = swiper;
$el.data('swiper', swiper);
// find wrapper
var $wrapperel = $el.children(("." + (swiper.params.wrapperclass)));
// extend swiper
utils.extend(swiper, {
$el: $el,
el: el,
$wrapperel: $wrapperel,
wrapperel: $wrapperel[0],
// classes
classnames: [],
// slides
slides: $(),
slidesgrid: [],
snapgrid: [],
slidessizesgrid: [],
// isdirection
ishorizontal: function ishorizontal() {
return swiper.params.direction === 'horizontal';
},
isvertical: function isvertical() {
return swiper.params.direction === 'vertical';
},
// rtl
rtl: (el.dir.tolowercase() === 'rtl' || $el.css('direction') === 'rtl'),
rtltranslate: swiper.params.direction === 'horizontal' && (el.dir.tolowercase() === 'rtl' || $el.css('direction') === 'rtl'),
wrongrtl: $wrapperel.css('display') === '-webkit-box',
// indexes
activeindex: 0,
realindex: 0,
//
isbeginning: true,
isend: false,
// props
translate: 0,
previoustranslate: 0,
progress: 0,
velocity: 0,
animating: false,
// locks
allowslidenext: swiper.params.allowslidenext,
allowslideprev: swiper.params.allowslideprev,
// touch events
touchevents: (function touchevents() {
var touch = ['touchstart', 'touchmove', 'touchend'];
var desktop = ['mousedown', 'mousemove', 'mouseup'];
if (support.pointerevents) {
desktop = ['pointerdown', 'pointermove', 'pointerup'];
} else if (support.prefixedpointerevents) {
desktop = ['mspointerdown', 'mspointermove', 'mspointerup'];
}
swiper.toucheventstouch = {
start: touch[0],
move: touch[1],
end: touch[2],
};
swiper.toucheventsdesktop = {
start: desktop[0],
move: desktop[1],
end: desktop[2],
};
return support.touch || !swiper.params.simulatetouch ? swiper.toucheventstouch : swiper.toucheventsdesktop;
}()),
toucheventsdata: {
istouched: undefined,
ismoved: undefined,
allowtouchcallbacks: undefined,
touchstarttime: undefined,
isscrolling: undefined,
currenttranslate: undefined,
starttranslate: undefined,
allowthresholdmove: undefined,
// form elements to match
formelements: 'input, select, option, textarea, button, video',
// last click time
lastclicktime: utils.now(),
clicktimeout: undefined,
// velocities
velocities: [],
allowmomentumbounce: undefined,
istouchevent: undefined,
startmoving: undefined,
},
// clicks
allowclick: true,
// touches
allowtouchmove: swiper.params.allowtouchmove,
touches: {
startx: 0,
starty: 0,
currentx: 0,
currenty: 0,
diff: 0,
},
// images
imagestoload: [],
imagesloaded: 0,
});
// install modules
swiper.usemodules();
// init
if (swiper.params.init) {
swiper.init();
}
// return app instance
return swiper;
}
if (swiperclass) swiper.__proto__ = swiperclass;
swiper.prototype = object.create(swiperclass && swiperclass.prototype);
swiper.prototype.constructor = swiper;
var staticaccessors = {
extendeddefaults: {
configurable: true
},
defaults: {
configurable: true
},
class: {
configurable: true
},
$: {
configurable: true
}
};
swiper.prototype.slidesperviewdynamic = function slidesperviewdynamic() {
var swiper = this;
var params = swiper.params;
var slides = swiper.slides;
var slidesgrid = swiper.slidesgrid;
var swipersize = swiper.size;
var activeindex = swiper.activeindex;
var spv = 1;
if (params.centeredslides) {
var slidesize = slides[activeindex].swiperslidesize;
var breakloop;
for (var i = activeindex + 1; i < slides.length; i += 1) {
if (slides[i] && !breakloop) {
slidesize += slides[i].swiperslidesize;
spv += 1;
if (slidesize > swipersize) {
breakloop = true;
}
}
}
for (var i$1 = activeindex - 1; i$1 >= 0; i$1 -= 1) {
if (slides[i$1] && !breakloop) {
slidesize += slides[i$1].swiperslidesize;
spv += 1;
if (slidesize > swipersize) {
breakloop = true;
}
}
}
} else {
for (var i$2 = activeindex + 1; i$2 < slides.length; i$2 += 1) {
if (slidesgrid[i$2] - slidesgrid[activeindex] < swipersize) {
spv += 1;
}
}
}
return spv;
};
swiper.prototype.update = function update() {
var swiper = this;
if (!swiper || swiper.destroyed) {
return;
}
var snapgrid = swiper.snapgrid;
var params = swiper.params;
// breakpoints
if (params.breakpoints) {
swiper.setbreakpoint();
}
swiper.updatesize();
swiper.updateslides();
swiper.updateprogress();
swiper.updateslidesclasses();
function settranslate() {
var translatevalue = swiper.rtltranslate ? swiper.translate * -1 : swiper.translate;
var newtranslate = math.min(math.max(translatevalue, swiper.maxtranslate()), swiper.mintranslate());
swiper.settranslate(newtranslate);
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
var translated;
if (swiper.params.freemode) {
settranslate();
if (swiper.params.autoheight) {
swiper.updateautoheight();
}
} else {
if ((swiper.params.slidesperview === 'auto' || swiper.params.slidesperview > 1) && swiper.isend && !swiper.params.centeredslides) {
translated = swiper.slideto(swiper.slides.length - 1, 0, false, true);
} else {
translated = swiper.slideto(swiper.activeindex, 0, false, true);
}
if (!translated) {
settranslate();
}
}
if (params.watchoverflow && snapgrid !== swiper.snapgrid) {
swiper.checkoverflow();
}
swiper.emit('update');
};
swiper.prototype.changedirection = function changedirection(newdirection, needupdate) {
if (needupdate === void 0) needupdate = true;
var swiper = this;
var currentdirection = swiper.params.direction;
if (!newdirection) {
// eslint-disable-next-line
newdirection = currentdirection === 'horizontal' ? 'vertical' : 'horizontal';
}
if ((newdirection === currentdirection) || (newdirection !== 'horizontal' && newdirection !== 'vertical')) {
return swiper;
}
swiper.$el
.removeclass(("" + (swiper.params.containermodifierclass) + currentdirection + " wp8-" + currentdirection))
.addclass(("" + (swiper.params.containermodifierclass) + newdirection));
if ((browser.isie || browser.isedge) && (support.pointerevents || support.prefixedpointerevents)) {
swiper.$el.addclass(((swiper.params.containermodifierclass) + "wp8-" + newdirection));
}
swiper.params.direction = newdirection;
swiper.slides.each(function (slideindex, slideel) {
if (newdirection === 'vertical') {
slideel.style.width = '';
} else {
slideel.style.height = '';
}
});
swiper.emit('changedirection');
if (needupdate) {
swiper.update();
}
return swiper;
};
swiper.prototype.init = function init() {
var swiper = this;
if (swiper.initialized) {
return;
}
swiper.emit('beforeinit');
// set breakpoint
if (swiper.params.breakpoints) {
swiper.setbreakpoint();
}
// add classes
swiper.addclasses();
// create loop
if (swiper.params.loop) {
swiper.loopcreate();
}
// update size
swiper.updatesize();
// update slides
swiper.updateslides();
if (swiper.params.watchoverflow) {
swiper.checkoverflow();
}
// set grab cursor
if (swiper.params.grabcursor) {
swiper.setgrabcursor();
}
if (swiper.params.preloadimages) {
swiper.preloadimages();
}
// slide to initial slide
if (swiper.params.loop) {
swiper.slideto(swiper.params.initialslide + swiper.loopedslides, 0, swiper.params.runcallbacksoninit);
} else {
swiper.slideto(swiper.params.initialslide, 0, swiper.params.runcallbacksoninit);
}
// attach events
swiper.attachevents();
// init flag
swiper.initialized = true;
// emit
swiper.emit('init');
};
swiper.prototype.destroy = function destroy(deleteinstance, cleanstyles) {
if (deleteinstance === void 0) deleteinstance = true;
if (cleanstyles === void 0) cleanstyles = true;
var swiper = this;
var params = swiper.params;
var $el = swiper.$el;
var $wrapperel = swiper.$wrapperel;
var slides = swiper.slides;
if (typeof swiper.params === 'undefined' || swiper.destroyed) {
return null;
}
swiper.emit('beforedestroy');
// init flag
swiper.initialized = false;
// detach events
swiper.detachevents();
// destroy loop
if (params.loop) {
swiper.loopdestroy();
}
// cleanup styles
if (cleanstyles) {
swiper.removeclasses();
$el.removeattr('style');
$wrapperel.removeattr('style');
if (slides && slides.length) {
slides
.removeclass([
params.slidevisibleclass,
params.slideactiveclass,
params.slidenextclass,
params.slideprevclass
].join(' '))
.removeattr('style')
.removeattr('data-swiper-slide-index')
.removeattr('data-swiper-column')
.removeattr('data-swiper-row');
}
}
swiper.emit('destroy');
// detach emitter events
object.keys(swiper.eventslisteners).foreach(function (eventname) {
swiper.off(eventname);
});
if (deleteinstance !== false) {
swiper.$el[0].swiper = null;
swiper.$el.data('swiper', null);
utils.deleteprops(swiper);
}
swiper.destroyed = true;
return null;
};
swiper.extenddefaults = function extenddefaults(newdefaults) {
utils.extend(extendeddefaults, newdefaults);
};
staticaccessors.extendeddefaults.get = function () {
return extendeddefaults;
};
staticaccessors.defaults.get = function () {
return defaults;
};
staticaccessors.class.get = function () {
return swiperclass;
};
staticaccessors.$.get = function () {
return $;
};
object.defineproperties(swiper, staticaccessors);
return swiper;
}(swiperclass));
var device$1 = {
name: 'device',
proto: {
device: device,
},
static: {
device: device,
},
};
var support$1 = {
name: 'support',
proto: {
support: support,
},
static: {
support: support,
},
};
var browser$1 = {
name: 'browser',
proto: {
browser: browser,
},
static: {
browser: browser,
},
};
var resize = {
name: 'resize',
create: function create() {
var swiper = this;
utils.extend(swiper, {
resize: {
resizehandler: function resizehandler() {
if (!swiper || swiper.destroyed || !swiper.initialized) {
return;
}
swiper.emit('beforeresize');
swiper.emit('resize');
},
orientationchangehandler: function orientationchangehandler() {
if (!swiper || swiper.destroyed || !swiper.initialized) {
return;
}
swiper.emit('orientationchange');
},
},
});
},
on: {
init: function init() {
var swiper = this;
// emit resize
win.addeventlistener('resize', swiper.resize.resizehandler);
// emit orientationchange
win.addeventlistener('orientationchange', swiper.resize.orientationchangehandler);
},
destroy: function destroy() {
var swiper = this;
win.removeeventlistener('resize', swiper.resize.resizehandler);
win.removeeventlistener('orientationchange', swiper.resize.orientationchangehandler);
},
},
};
var observer = {
func: win.mutationobserver || win.webkitmutationobserver,
attach: function attach(target, options) {
if (options === void 0) options = {};
var swiper = this;
var observerfunc = observer.func;
var observer = new observerfunc(function (mutations) {
// the observerupdate event should only be triggered
// once despite the number of mutations. additional
// triggers are redundant and are very costly
if (mutations.length === 1) {
swiper.emit('observerupdate', mutations[0]);
return;
}
var observerupdate = function observerupdate() {
swiper.emit('observerupdate', mutations[0]);
};
if (win.requestanimationframe) {
win.requestanimationframe(observerupdate);
} else {
win.settimeout(observerupdate, 0);
}
});
observer.observe(target, {
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
childlist: typeof options.childlist === 'undefined' ? true : options.childlist,
characterdata: typeof options.characterdata === 'undefined' ? true : options.characterdata,
});
swiper.observer.observers.push(observer);
},
init: function init() {
var swiper = this;
if (!support.observer || !swiper.params.observer) {
return;
}
if (swiper.params.observeparents) {
var containerparents = swiper.$el.parents();
for (var i = 0; i < containerparents.length; i += 1) {
swiper.observer.attach(containerparents[i]);
}
}
// observe container
swiper.observer.attach(swiper.$el[0], {
childlist: swiper.params.observeslidechildren
});
// observe wrapper
swiper.observer.attach(swiper.$wrapperel[0], {
attributes: false
});
},
destroy: function destroy() {
var swiper = this;
swiper.observer.observers.foreach(function (observer) {
observer.disconnect();
});
swiper.observer.observers = [];
},
};
var observer$1 = {
name: 'observer',
params: {
observer: false,
observeparents: false,
observeslidechildren: false,
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
observer: {
init: observer.init.bind(swiper),
attach: observer.attach.bind(swiper),
destroy: observer.destroy.bind(swiper),
observers: [],
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.observer.init();
},
destroy: function destroy() {
var swiper = this;
swiper.observer.destroy();
},
},
};
var virtual = {
update: function update(force) {
var swiper = this;
var ref = swiper.params;
var slidesperview = ref.slidesperview;
var slidespergroup = ref.slidespergroup;
var centeredslides = ref.centeredslides;
var ref$1 = swiper.params.virtual;
var addslidesbefore = ref$1.addslidesbefore;
var addslidesafter = ref$1.addslidesafter;
var ref$2 = swiper.virtual;
var previousfrom = ref$2.from;
var previousto = ref$2.to;
var slides = ref$2.slides;
var previousslidesgrid = ref$2.slidesgrid;
var renderslide = ref$2.renderslide;
var previousoffset = ref$2.offset;
swiper.updateactiveindex();
var activeindex = swiper.activeindex || 0;
var offsetprop;
if (swiper.rtltranslate) {
offsetprop = 'right';
} else {
offsetprop = swiper.ishorizontal() ? 'left' : 'top';
}
var slidesafter;
var slidesbefore;
if (centeredslides) {
slidesafter = math.floor(slidesperview / 2) + slidespergroup + addslidesbefore;
slidesbefore = math.floor(slidesperview / 2) + slidespergroup + addslidesafter;
} else {
slidesafter = slidesperview + (slidespergroup - 1) + addslidesbefore;
slidesbefore = slidespergroup + addslidesafter;
}
var from = math.max((activeindex || 0) - slidesbefore, 0);
var to = math.min((activeindex || 0) + slidesafter, slides.length - 1);
var offset = (swiper.slidesgrid[from] || 0) - (swiper.slidesgrid[0] || 0);
utils.extend(swiper.virtual, {
from: from,
to: to,
offset: offset,
slidesgrid: swiper.slidesgrid,
});
function onrendered() {
swiper.updateslides();
swiper.updateprogress();
swiper.updateslidesclasses();
if (swiper.lazy && swiper.params.lazy.enabled) {
swiper.lazy.load();
}
}
if (previousfrom === from && previousto === to && !force) {
if (swiper.slidesgrid !== previousslidesgrid && offset !== previousoffset) {
swiper.slides.css(offsetprop, (offset + "px"));
}
swiper.updateprogress();
return;
}
if (swiper.params.virtual.renderexternal) {
swiper.params.virtual.renderexternal.call(swiper, {
offset: offset,
from: from,
to: to,
slides: (function getslides() {
var slidestorender = [];
for (var i = from; i <= to; i += 1) {
slidestorender.push(slides[i]);
}
return slidestorender;
}()),
});
onrendered();
return;
}
var prependindexes = [];
var appendindexes = [];
if (force) {
swiper.$wrapperel.find(("." + (swiper.params.slideclass))).remove();
} else {
for (var i = previousfrom; i <= previousto; i += 1) {
if (i < from || i > to) {
swiper.$wrapperel.find(("." + (swiper.params.slideclass) + "[data-swiper-slide-index=\"" + i + "\"]")).remove();
}
}
}
for (var i$1 = 0; i$1 < slides.length; i$1 += 1) {
if (i$1 >= from && i$1 <= to) {
if (typeof previousto === 'undefined' || force) {
appendindexes.push(i$1);
} else {
if (i$1 > previousto) {
appendindexes.push(i$1);
}
if (i$1 < previousfrom) {
prependindexes.push(i$1);
}
}
}
}
appendindexes.foreach(function (index) {
swiper.$wrapperel.append(renderslide(slides[index], index));
});
prependindexes.sort(function (a, b) {
return b - a;
}).foreach(function (index) {
swiper.$wrapperel.prepend(renderslide(slides[index], index));
});
swiper.$wrapperel.children('.swiper-slide').css(offsetprop, (offset + "px"));
onrendered();
},
renderslide: function renderslide(slide, index) {
var swiper = this;
var params = swiper.params.virtual;
if (params.cache && swiper.virtual.cache[index]) {
return swiper.virtual.cache[index];
}
var $slideel = params.renderslide ?
$(params.renderslide.call(swiper, slide, index)) :
$(("" + slide + "
"));
if (!$slideel.attr('data-swiper-slide-index')) {
$slideel.attr('data-swiper-slide-index', index);
}
if (params.cache) {
swiper.virtual.cache[index] = $slideel;
}
return $slideel;
},
appendslide: function appendslide(slides) {
var swiper = this;
if (typeof slides === 'object' && 'length' in slides) {
for (var i = 0; i < slides.length; i += 1) {
if (slides[i]) {
swiper.virtual.slides.push(slides[i]);
}
}
} else {
swiper.virtual.slides.push(slides);
}
swiper.virtual.update(true);
},
prependslide: function prependslide(slides) {
var swiper = this;
var activeindex = swiper.activeindex;
var newactiveindex = activeindex + 1;
var numberofnewslides = 1;
if (array.isarray(slides)) {
for (var i = 0; i < slides.length; i += 1) {
if (slides[i]) {
swiper.virtual.slides.unshift(slides[i]);
}
}
newactiveindex = activeindex + slides.length;
numberofnewslides = slides.length;
} else {
swiper.virtual.slides.unshift(slides);
}
if (swiper.params.virtual.cache) {
var cache = swiper.virtual.cache;
var newcache = {};
object.keys(cache).foreach(function (cachedindex) {
newcache[parseint(cachedindex, 10) + numberofnewslides] = cache[cachedindex];
});
swiper.virtual.cache = newcache;
}
swiper.virtual.update(true);
swiper.slideto(newactiveindex, 0);
},
removeslide: function removeslide(slidesindexes) {
var swiper = this;
if (typeof slidesindexes === 'undefined' || slidesindexes === null) {
return;
}
var activeindex = swiper.activeindex;
if (array.isarray(slidesindexes)) {
for (var i = slidesindexes.length - 1; i >= 0; i -= 1) {
swiper.virtual.slides.splice(slidesindexes[i], 1);
if (swiper.params.virtual.cache) {
delete swiper.virtual.cache[slidesindexes[i]];
}
if (slidesindexes[i] < activeindex) {
activeindex -= 1;
}
activeindex = math.max(activeindex, 0);
}
} else {
swiper.virtual.slides.splice(slidesindexes, 1);
if (swiper.params.virtual.cache) {
delete swiper.virtual.cache[slidesindexes];
}
if (slidesindexes < activeindex) {
activeindex -= 1;
}
activeindex = math.max(activeindex, 0);
}
swiper.virtual.update(true);
swiper.slideto(activeindex, 0);
},
removeallslides: function removeallslides() {
var swiper = this;
swiper.virtual.slides = [];
if (swiper.params.virtual.cache) {
swiper.virtual.cache = {};
}
swiper.virtual.update(true);
swiper.slideto(0, 0);
},
};
var virtual$1 = {
name: 'virtual',
params: {
virtual: {
enabled: false,
slides: [],
cache: true,
renderslide: null,
renderexternal: null,
addslidesbefore: 0,
addslidesafter: 0,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
virtual: {
update: virtual.update.bind(swiper),
appendslide: virtual.appendslide.bind(swiper),
prependslide: virtual.prependslide.bind(swiper),
removeslide: virtual.removeslide.bind(swiper),
removeallslides: virtual.removeallslides.bind(swiper),
renderslide: virtual.renderslide.bind(swiper),
slides: swiper.params.virtual.slides,
cache: {},
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (!swiper.params.virtual.enabled) {
return;
}
swiper.classnames.push(((swiper.params.containermodifierclass) + "virtual"));
var overwriteparams = {
watchslidesprogress: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
if (!swiper.params.initialslide) {
swiper.virtual.update();
}
},
settranslate: function settranslate() {
var swiper = this;
if (!swiper.params.virtual.enabled) {
return;
}
swiper.virtual.update();
},
},
};
var keyboard = {
handle: function handle(event) {
var swiper = this;
var rtl = swiper.rtltranslate;
var e = event;
if (e.originalevent) {
e = e.originalevent;
} // jquery fix
var kc = e.keycode || e.charcode;
// directions locks
if (!swiper.allowslidenext && ((swiper.ishorizontal() && kc === 39) || (swiper.isvertical() && kc === 40) || kc === 34)) {
return false;
}
if (!swiper.allowslideprev && ((swiper.ishorizontal() && kc === 37) || (swiper.isvertical() && kc === 38) || kc === 33)) {
return false;
}
if (e.shiftkey || e.altkey || e.ctrlkey || e.metakey) {
return undefined;
}
if (doc.activeelement && doc.activeelement.nodename && (doc.activeelement.nodename.tolowercase() === 'input' || doc.activeelement.nodename.tolowercase() === 'textarea')) {
return undefined;
}
if (swiper.params.keyboard.onlyinviewport && (kc === 33 || kc === 34 || kc === 37 || kc === 39 || kc === 38 || kc === 40)) {
var inview = false;
// check that swiper should be inside of visible area of window
if (swiper.$el.parents(("." + (swiper.params.slideclass))).length > 0 && swiper.$el.parents(("." + (swiper.params.slideactiveclass))).length === 0) {
return undefined;
}
var windowwidth = win.innerwidth;
var windowheight = win.innerheight;
var swiperoffset = swiper.$el.offset();
if (rtl) {
swiperoffset.left -= swiper.$el[0].scrollleft;
}
var swipercoord = [
[swiperoffset.left, swiperoffset.top],
[swiperoffset.left + swiper.width, swiperoffset.top],
[swiperoffset.left, swiperoffset.top + swiper.height],
[swiperoffset.left + swiper.width, swiperoffset.top + swiper.height]
];
for (var i = 0; i < swipercoord.length; i += 1) {
var point = swipercoord[i];
if (
point[0] >= 0 && point[0] <= windowwidth &&
point[1] >= 0 && point[1] <= windowheight
) {
inview = true;
}
}
if (!inview) {
return undefined;
}
}
if (swiper.ishorizontal()) {
if (kc === 33 || kc === 34 || kc === 37 || kc === 39) {
if (e.preventdefault) {
e.preventdefault();
} else {
e.returnvalue = false;
}
}
if (((kc === 34 || kc === 39) && !rtl) || ((kc === 33 || kc === 37) && rtl)) {
swiper.slidenext();
}
if (((kc === 33 || kc === 37) && !rtl) || ((kc === 34 || kc === 39) && rtl)) {
swiper.slideprev();
}
} else {
if (kc === 33 || kc === 34 || kc === 38 || kc === 40) {
if (e.preventdefault) {
e.preventdefault();
} else {
e.returnvalue = false;
}
}
if (kc === 34 || kc === 40) {
swiper.slidenext();
}
if (kc === 33 || kc === 38) {
swiper.slideprev();
}
}
swiper.emit('keypress', kc);
return undefined;
},
enable: function enable() {
var swiper = this;
if (swiper.keyboard.enabled) {
return;
}
$(doc).on('keydown', swiper.keyboard.handle);
swiper.keyboard.enabled = true;
},
disable: function disable() {
var swiper = this;
if (!swiper.keyboard.enabled) {
return;
}
$(doc).off('keydown', swiper.keyboard.handle);
swiper.keyboard.enabled = false;
},
};
var keyboard$1 = {
name: 'keyboard',
params: {
keyboard: {
enabled: false,
onlyinviewport: true,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
keyboard: {
enabled: false,
enable: keyboard.enable.bind(swiper),
disable: keyboard.disable.bind(swiper),
handle: keyboard.handle.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.keyboard.enabled) {
swiper.keyboard.enable();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.keyboard.enabled) {
swiper.keyboard.disable();
}
},
},
};
function iseventsupported() {
var eventname = 'onwheel';
var issupported = eventname in doc;
if (!issupported) {
var element = doc.createelement('div');
element.setattribute(eventname, 'return;');
issupported = typeof element[eventname] === 'function';
}
if (!issupported &&
doc.implementation &&
doc.implementation.hasfeature
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
&&
doc.implementation.hasfeature('', '') !== true
) {
// this is the only way to test support for the `wheel` event in ie9+.
issupported = doc.implementation.hasfeature('events.wheel', '3.0');
}
return issupported;
}
var mousewheel = {
lastscrolltime: utils.now(),
event: (function getevent() {
if (win.navigator.useragent.indexof('firefox') > -1) {
return 'dommousescroll';
}
return iseventsupported() ? 'wheel' : 'mousewheel';
}()),
normalize: function normalize(e) {
// reasonable defaults
var pixel_step = 10;
var line_height = 40;
var page_height = 800;
var sx = 0;
var sy = 0; // spinx, spiny
var px = 0;
var py = 0; // pixelx, pixely
// legacy
if ('detail' in e) {
sy = e.detail;
}
if ('wheeldelta' in e) {
sy = -e.wheeldelta / 120;
}
if ('wheeldeltay' in e) {
sy = -e.wheeldeltay / 120;
}
if ('wheeldeltax' in e) {
sx = -e.wheeldeltax / 120;
}
// side scrolling on ff with dommousescroll
if ('axis' in e && e.axis === e.horizontal_axis) {
sx = sy;
sy = 0;
}
px = sx * pixel_step;
py = sy * pixel_step;
if ('deltay' in e) {
py = e.deltay;
}
if ('deltax' in e) {
px = e.deltax;
}
if ((px || py) && e.deltamode) {
if (e.deltamode === 1) { // delta in line units
px *= line_height;
py *= line_height;
} else { // delta in page units
px *= page_height;
py *= page_height;
}
}
// fall-back if spin cannot be determined
if (px && !sx) {
sx = (px < 1) ? -1 : 1;
}
if (py && !sy) {
sy = (py < 1) ? -1 : 1;
}
return {
spinx: sx,
spiny: sy,
pixelx: px,
pixely: py,
};
},
handlemouseenter: function handlemouseenter() {
var swiper = this;
swiper.mouseentered = true;
},
handlemouseleave: function handlemouseleave() {
var swiper = this;
swiper.mouseentered = false;
},
handle: function handle(event) {
var e = event;
var swiper = this;
var params = swiper.params.mousewheel;
if (!swiper.mouseentered && !params.releaseonedges) {
return true;
}
if (e.originalevent) {
e = e.originalevent;
} // jquery fix
var delta = 0;
var rtlfactor = swiper.rtltranslate ? -1 : 1;
var data = mousewheel.normalize(e);
if (params.forcetoaxis) {
if (swiper.ishorizontal()) {
if (math.abs(data.pixelx) > math.abs(data.pixely)) {
delta = data.pixelx * rtlfactor;
} else {
return true;
}
} else if (math.abs(data.pixely) > math.abs(data.pixelx)) {
delta = data.pixely;
} else {
return true;
}
} else {
delta = math.abs(data.pixelx) > math.abs(data.pixely) ? -data.pixelx * rtlfactor : -data.pixely;
}
if (delta === 0) {
return true;
}
if (params.invert) {
delta = -delta;
}
if (!swiper.params.freemode) {
if (utils.now() - swiper.mousewheel.lastscrolltime > 60) {
if (delta < 0) {
if ((!swiper.isend || swiper.params.loop) && !swiper.animating) {
swiper.slidenext();
swiper.emit('scroll', e);
} else if (params.releaseonedges) {
return true;
}
} else if ((!swiper.isbeginning || swiper.params.loop) && !swiper.animating) {
swiper.slideprev();
swiper.emit('scroll', e);
} else if (params.releaseonedges) {
return true;
}
}
swiper.mousewheel.lastscrolltime = (new win.date()).gettime();
} else {
// freemode or scrollcontainer:
if (swiper.params.loop) {
swiper.loopfix();
}
var position = swiper.gettranslate() + (delta * params.sensitivity);
var wasbeginning = swiper.isbeginning;
var wasend = swiper.isend;
if (position >= swiper.mintranslate()) {
position = swiper.mintranslate();
}
if (position <= swiper.maxtranslate()) {
position = swiper.maxtranslate();
}
swiper.settransition(0);
swiper.settranslate(position);
swiper.updateprogress();
swiper.updateactiveindex();
swiper.updateslidesclasses();
if ((!wasbeginning && swiper.isbeginning) || (!wasend && swiper.isend)) {
swiper.updateslidesclasses();
}
if (swiper.params.freemodesticky) {
cleartimeout(swiper.mousewheel.timeout);
swiper.mousewheel.timeout = utils.nexttick(function () {
swiper.slidetoclosest();
}, 300);
}
// emit event
swiper.emit('scroll', e);
// stop autoplay
if (swiper.params.autoplay && swiper.params.autoplaydisableoninteraction) {
swiper.autoplay.stop();
}
// return page scroll on edge positions
if (position === swiper.mintranslate() || position === swiper.maxtranslate()) {
return true;
}
}
if (e.preventdefault) {
e.preventdefault();
} else {
e.returnvalue = false;
}
return false;
},
enable: function enable() {
var swiper = this;
if (!mousewheel.event) {
return false;
}
if (swiper.mousewheel.enabled) {
return false;
}
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarged !== 'container') {
target = $(swiper.params.mousewheel.eventstarged);
}
target.on('mouseenter', swiper.mousewheel.handlemouseenter);
target.on('mouseleave', swiper.mousewheel.handlemouseleave);
target.on(mousewheel.event, swiper.mousewheel.handle);
swiper.mousewheel.enabled = true;
return true;
},
disable: function disable() {
var swiper = this;
if (!mousewheel.event) {
return false;
}
if (!swiper.mousewheel.enabled) {
return false;
}
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarged !== 'container') {
target = $(swiper.params.mousewheel.eventstarged);
}
target.off(mousewheel.event, swiper.mousewheel.handle);
swiper.mousewheel.enabled = false;
return true;
},
};
var mousewheel$1 = {
name: 'mousewheel',
params: {
mousewheel: {
enabled: false,
releaseonedges: false,
invert: false,
forcetoaxis: false,
sensitivity: 1,
eventstarged: 'container',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
mousewheel: {
enabled: false,
enable: mousewheel.enable.bind(swiper),
disable: mousewheel.disable.bind(swiper),
handle: mousewheel.handle.bind(swiper),
handlemouseenter: mousewheel.handlemouseenter.bind(swiper),
handlemouseleave: mousewheel.handlemouseleave.bind(swiper),
lastscrolltime: utils.now(),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.mousewheel.enabled) {
swiper.mousewheel.enable();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.mousewheel.enabled) {
swiper.mousewheel.disable();
}
},
},
};
var navigation = {
update: function update() {
// update navigation buttons
var swiper = this;
var params = swiper.params.navigation;
if (swiper.params.loop) {
return;
}
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if ($prevel && $prevel.length > 0) {
if (swiper.isbeginning) {
$prevel.addclass(params.disabledclass);
} else {
$prevel.removeclass(params.disabledclass);
}
$prevel[swiper.params.watchoverflow && swiper.islocked ? 'addclass' : 'removeclass'](params.lockclass);
}
if ($nextel && $nextel.length > 0) {
if (swiper.isend) {
$nextel.addclass(params.disabledclass);
} else {
$nextel.removeclass(params.disabledclass);
}
$nextel[swiper.params.watchoverflow && swiper.islocked ? 'addclass' : 'removeclass'](params.lockclass);
}
},
onprevclick: function onprevclick(e) {
var swiper = this;
e.preventdefault();
if (swiper.isbeginning && !swiper.params.loop) {
return;
}
swiper.slideprev();
},
onnextclick: function onnextclick(e) {
var swiper = this;
e.preventdefault();
if (swiper.isend && !swiper.params.loop) {
return;
}
swiper.slidenext();
},
init: function init() {
var swiper = this;
var params = swiper.params.navigation;
if (!(params.nextel || params.prevel)) {
return;
}
var $nextel;
var $prevel;
if (params.nextel) {
$nextel = $(params.nextel);
if (
swiper.params.uniquenavelements &&
typeof params.nextel === 'string' &&
$nextel.length > 1 &&
swiper.$el.find(params.nextel).length === 1
) {
$nextel = swiper.$el.find(params.nextel);
}
}
if (params.prevel) {
$prevel = $(params.prevel);
if (
swiper.params.uniquenavelements &&
typeof params.prevel === 'string' &&
$prevel.length > 1 &&
swiper.$el.find(params.prevel).length === 1
) {
$prevel = swiper.$el.find(params.prevel);
}
}
if ($nextel && $nextel.length > 0) {
$nextel.on('click', swiper.navigation.onnextclick);
}
if ($prevel && $prevel.length > 0) {
$prevel.on('click', swiper.navigation.onprevclick);
}
utils.extend(swiper.navigation, {
$nextel: $nextel,
nextel: $nextel && $nextel[0],
$prevel: $prevel,
prevel: $prevel && $prevel[0],
});
},
destroy: function destroy() {
var swiper = this;
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if ($nextel && $nextel.length) {
$nextel.off('click', swiper.navigation.onnextclick);
$nextel.removeclass(swiper.params.navigation.disabledclass);
}
if ($prevel && $prevel.length) {
$prevel.off('click', swiper.navigation.onprevclick);
$prevel.removeclass(swiper.params.navigation.disabledclass);
}
},
};
var navigation$1 = {
name: 'navigation',
params: {
navigation: {
nextel: null,
prevel: null,
hideonclick: false,
disabledclass: 'swiper-button-disabled',
hiddenclass: 'swiper-button-hidden',
lockclass: 'swiper-button-lock',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
navigation: {
init: navigation.init.bind(swiper),
update: navigation.update.bind(swiper),
destroy: navigation.destroy.bind(swiper),
onnextclick: navigation.onnextclick.bind(swiper),
onprevclick: navigation.onprevclick.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.navigation.init();
swiper.navigation.update();
},
toedge: function toedge() {
var swiper = this;
swiper.navigation.update();
},
fromedge: function fromedge() {
var swiper = this;
swiper.navigation.update();
},
destroy: function destroy() {
var swiper = this;
swiper.navigation.destroy();
},
click: function click(e) {
var swiper = this;
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if (
swiper.params.navigation.hideonclick &&
!$(e.target).is($prevel) &&
!$(e.target).is($nextel)
) {
var ishidden;
if ($nextel) {
ishidden = $nextel.hasclass(swiper.params.navigation.hiddenclass);
} else if ($prevel) {
ishidden = $prevel.hasclass(swiper.params.navigation.hiddenclass);
}
if (ishidden === true) {
swiper.emit('navigationshow', swiper);
} else {
swiper.emit('navigationhide', swiper);
}
if ($nextel) {
$nextel.toggleclass(swiper.params.navigation.hiddenclass);
}
if ($prevel) {
$prevel.toggleclass(swiper.params.navigation.hiddenclass);
}
}
},
},
};
var pagination = {
update: function update() {
// render || update pagination bullets/items
var swiper = this;
var rtl = swiper.rtl;
var params = swiper.params.pagination;
if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) {
return;
}
var slideslength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
var $el = swiper.pagination.$el;
// current/total
var current;
var total = swiper.params.loop ? math.ceil((slideslength - (swiper.loopedslides * 2)) / swiper.params.slidespergroup) : swiper.snapgrid.length;
if (swiper.params.loop) {
current = math.ceil((swiper.activeindex - swiper.loopedslides) / swiper.params.slidespergroup);
if (current > slideslength - 1 - (swiper.loopedslides * 2)) {
current -= (slideslength - (swiper.loopedslides * 2));
}
if (current > total - 1) {
current -= total;
}
if (current < 0 && swiper.params.paginationtype !== 'bullets') {
current = total + current;
}
} else if (typeof swiper.snapindex !== 'undefined') {
current = swiper.snapindex;
} else {
current = swiper.activeindex || 0;
}
// types
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
var bullets = swiper.pagination.bullets;
var firstindex;
var lastindex;
var midindex;
if (params.dynamicbullets) {
swiper.pagination.bulletsize = bullets.eq(0)[swiper.ishorizontal() ? 'outerwidth' : 'outerheight'](true);
$el.css(swiper.ishorizontal() ? 'width' : 'height', ((swiper.pagination.bulletsize * (params.dynamicmainbullets + 4)) + "px"));
if (params.dynamicmainbullets > 1 && swiper.previousindex !== undefined) {
swiper.pagination.dynamicbulletindex += (current - swiper.previousindex);
if (swiper.pagination.dynamicbulletindex > (params.dynamicmainbullets - 1)) {
swiper.pagination.dynamicbulletindex = params.dynamicmainbullets - 1;
} else if (swiper.pagination.dynamicbulletindex < 0) {
swiper.pagination.dynamicbulletindex = 0;
}
}
firstindex = current - swiper.pagination.dynamicbulletindex;
lastindex = firstindex + (math.min(bullets.length, params.dynamicmainbullets) - 1);
midindex = (lastindex + firstindex) / 2;
}
bullets.removeclass(((params.bulletactiveclass) + " " + (params.bulletactiveclass) + "-next " + (params.bulletactiveclass) + "-next-next " + (params.bulletactiveclass) + "-prev " + (params.bulletactiveclass) + "-prev-prev " + (params.bulletactiveclass) + "-main"));
if ($el.length > 1) {
bullets.each(function (index, bullet) {
var $bullet = $(bullet);
var bulletindex = $bullet.index();
if (bulletindex === current) {
$bullet.addclass(params.bulletactiveclass);
}
if (params.dynamicbullets) {
if (bulletindex >= firstindex && bulletindex <= lastindex) {
$bullet.addclass(((params.bulletactiveclass) + "-main"));
}
if (bulletindex === firstindex) {
$bullet
.prev()
.addclass(((params.bulletactiveclass) + "-prev"))
.prev()
.addclass(((params.bulletactiveclass) + "-prev-prev"));
}
if (bulletindex === lastindex) {
$bullet
.next()
.addclass(((params.bulletactiveclass) + "-next"))
.next()
.addclass(((params.bulletactiveclass) + "-next-next"));
}
}
});
} else {
var $bullet = bullets.eq(current);
$bullet.addclass(params.bulletactiveclass);
if (params.dynamicbullets) {
var $firstdisplayedbullet = bullets.eq(firstindex);
var $lastdisplayedbullet = bullets.eq(lastindex);
for (var i = firstindex; i <= lastindex; i += 1) {
bullets.eq(i).addclass(((params.bulletactiveclass) + "-main"));
}
$firstdisplayedbullet
.prev()
.addclass(((params.bulletactiveclass) + "-prev"))
.prev()
.addclass(((params.bulletactiveclass) + "-prev-prev"));
$lastdisplayedbullet
.next()
.addclass(((params.bulletactiveclass) + "-next"))
.next()
.addclass(((params.bulletactiveclass) + "-next-next"));
}
}
if (params.dynamicbullets) {
var dynamicbulletslength = math.min(bullets.length, params.dynamicmainbullets + 4);
var bulletsoffset = (((swiper.pagination.bulletsize * dynamicbulletslength) - (swiper.pagination.bulletsize)) / 2) - (midindex * swiper.pagination.bulletsize);
var offsetprop = rtl ? 'right' : 'left';
bullets.css(swiper.ishorizontal() ? offsetprop : 'top', (bulletsoffset + "px"));
}
}
if (params.type === 'fraction') {
$el.find(("." + (params.currentclass))).text(params.formatfractioncurrent(current + 1));
$el.find(("." + (params.totalclass))).text(params.formatfractiontotal(total));
}
if (params.type === 'progressbar') {
var progressbardirection;
if (params.progressbaropposite) {
progressbardirection = swiper.ishorizontal() ? 'vertical' : 'horizontal';
} else {
progressbardirection = swiper.ishorizontal() ? 'horizontal' : 'vertical';
}
var scale = (current + 1) / total;
var scalex = 1;
var scaley = 1;
if (progressbardirection === 'horizontal') {
scalex = scale;
} else {
scaley = scale;
}
$el.find(("." + (params.progressbarfillclass))).transform(("translate3d(0,0,0) scalex(" + scalex + ") scaley(" + scaley + ")")).transition(swiper.params.speed);
}
if (params.type === 'custom' && params.rendercustom) {
$el.html(params.rendercustom(swiper, current + 1, total));
swiper.emit('paginationrender', swiper, $el[0]);
} else {
swiper.emit('paginationupdate', swiper, $el[0]);
}
$el[swiper.params.watchoverflow && swiper.islocked ? 'addclass' : 'removeclass'](params.lockclass);
},
render: function render() {
// render container
var swiper = this;
var params = swiper.params.pagination;
if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) {
return;
}
var slideslength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
var $el = swiper.pagination.$el;
var paginationhtml = '';
if (params.type === 'bullets') {
var numberofbullets = swiper.params.loop ? math.ceil((slideslength - (swiper.loopedslides * 2)) / swiper.params.slidespergroup) : swiper.snapgrid.length;
for (var i = 0; i < numberofbullets; i += 1) {
if (params.renderbullet) {
paginationhtml += params.renderbullet.call(swiper, i, params.bulletclass);
} else {
paginationhtml += "<" + (params.bulletelement) + " class=\"" + (params.bulletclass) + "\">" + (params.bulletelement) + ">";
}
}
$el.html(paginationhtml);
swiper.pagination.bullets = $el.find(("." + (params.bulletclass)));
}
if (params.type === 'fraction') {
if (params.renderfraction) {
paginationhtml = params.renderfraction.call(swiper, params.currentclass, params.totalclass);
} else {
paginationhtml = "" +
' / ' +
"";
}
$el.html(paginationhtml);
}
if (params.type === 'progressbar') {
if (params.renderprogressbar) {
paginationhtml = params.renderprogressbar.call(swiper, params.progressbarfillclass);
} else {
paginationhtml = "";
}
$el.html(paginationhtml);
}
if (params.type !== 'custom') {
swiper.emit('paginationrender', swiper.pagination.$el[0]);
}
},
init: function init() {
var swiper = this;
var params = swiper.params.pagination;
if (!params.el) {
return;
}
var $el = $(params.el);
if ($el.length === 0) {
return;
}
if (
swiper.params.uniquenavelements &&
typeof params.el === 'string' &&
$el.length > 1 &&
swiper.$el.find(params.el).length === 1
) {
$el = swiper.$el.find(params.el);
}
if (params.type === 'bullets' && params.clickable) {
$el.addclass(params.clickableclass);
}
$el.addclass(params.modifierclass + params.type);
if (params.type === 'bullets' && params.dynamicbullets) {
$el.addclass(("" + (params.modifierclass) + (params.type) + "-dynamic"));
swiper.pagination.dynamicbulletindex = 0;
if (params.dynamicmainbullets < 1) {
params.dynamicmainbullets = 1;
}
}
if (params.type === 'progressbar' && params.progressbaropposite) {
$el.addclass(params.progressbaroppositeclass);
}
if (params.clickable) {
$el.on('click', ("." + (params.bulletclass)), function onclick(e) {
e.preventdefault();
var index = $(this).index() * swiper.params.slidespergroup;
if (swiper.params.loop) {
index += swiper.loopedslides;
}
swiper.slideto(index);
});
}
utils.extend(swiper.pagination, {
$el: $el,
el: $el[0],
});
},
destroy: function destroy() {
var swiper = this;
var params = swiper.params.pagination;
if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) {
return;
}
var $el = swiper.pagination.$el;
$el.removeclass(params.hiddenclass);
$el.removeclass(params.modifierclass + params.type);
if (swiper.pagination.bullets) {
swiper.pagination.bullets.removeclass(params.bulletactiveclass);
}
if (params.clickable) {
$el.off('click', ("." + (params.bulletclass)));
}
},
};
var pagination$1 = {
name: 'pagination',
params: {
pagination: {
el: null,
bulletelement: 'span',
clickable: false,
hideonclick: false,
renderbullet: null,
renderprogressbar: null,
renderfraction: null,
rendercustom: null,
progressbaropposite: false,
type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom'
dynamicbullets: false,
dynamicmainbullets: 1,
formatfractioncurrent: function (number) {
return number;
},
formatfractiontotal: function (number) {
return number;
},
bulletclass: 'swiper-pagination-bullet',
bulletactiveclass: 'swiper-pagination-bullet-active',
modifierclass: 'swiper-pagination-', // new
currentclass: 'swiper-pagination-current',
totalclass: 'swiper-pagination-total',
hiddenclass: 'swiper-pagination-hidden',
progressbarfillclass: 'swiper-pagination-progressbar-fill',
progressbaroppositeclass: 'swiper-pagination-progressbar-opposite',
clickableclass: 'swiper-pagination-clickable', // new
lockclass: 'swiper-pagination-lock',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
pagination: {
init: pagination.init.bind(swiper),
render: pagination.render.bind(swiper),
update: pagination.update.bind(swiper),
destroy: pagination.destroy.bind(swiper),
dynamicbulletindex: 0,
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.pagination.init();
swiper.pagination.render();
swiper.pagination.update();
},
activeindexchange: function activeindexchange() {
var swiper = this;
if (swiper.params.loop) {
swiper.pagination.update();
} else if (typeof swiper.snapindex === 'undefined') {
swiper.pagination.update();
}
},
snapindexchange: function snapindexchange() {
var swiper = this;
if (!swiper.params.loop) {
swiper.pagination.update();
}
},
slideslengthchange: function slideslengthchange() {
var swiper = this;
if (swiper.params.loop) {
swiper.pagination.render();
swiper.pagination.update();
}
},
snapgridlengthchange: function snapgridlengthchange() {
var swiper = this;
if (!swiper.params.loop) {
swiper.pagination.render();
swiper.pagination.update();
}
},
destroy: function destroy() {
var swiper = this;
swiper.pagination.destroy();
},
click: function click(e) {
var swiper = this;
if (
swiper.params.pagination.el &&
swiper.params.pagination.hideonclick &&
swiper.pagination.$el.length > 0 &&
!$(e.target).hasclass(swiper.params.pagination.bulletclass)
) {
var ishidden = swiper.pagination.$el.hasclass(swiper.params.pagination.hiddenclass);
if (ishidden === true) {
swiper.emit('paginationshow', swiper);
} else {
swiper.emit('paginationhide', swiper);
}
swiper.pagination.$el.toggleclass(swiper.params.pagination.hiddenclass);
}
},
},
};
var scrollbar = {
settranslate: function settranslate() {
var swiper = this;
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) {
return;
}
var scrollbar = swiper.scrollbar;
var rtl = swiper.rtltranslate;
var progress = swiper.progress;
var dragsize = scrollbar.dragsize;
var tracksize = scrollbar.tracksize;
var $dragel = scrollbar.$dragel;
var $el = scrollbar.$el;
var params = swiper.params.scrollbar;
var newsize = dragsize;
var newpos = (tracksize - dragsize) * progress;
if (rtl) {
newpos = -newpos;
if (newpos > 0) {
newsize = dragsize - newpos;
newpos = 0;
} else if (-newpos + dragsize > tracksize) {
newsize = tracksize + newpos;
}
} else if (newpos < 0) {
newsize = dragsize + newpos;
newpos = 0;
} else if (newpos + dragsize > tracksize) {
newsize = tracksize - newpos;
}
if (swiper.ishorizontal()) {
if (support.transforms3d) {
$dragel.transform(("translate3d(" + newpos + "px, 0, 0)"));
} else {
$dragel.transform(("translatex(" + newpos + "px)"));
}
$dragel[0].style.width = newsize + "px";
} else {
if (support.transforms3d) {
$dragel.transform(("translate3d(0px, " + newpos + "px, 0)"));
} else {
$dragel.transform(("translatey(" + newpos + "px)"));
}
$dragel[0].style.height = newsize + "px";
}
if (params.hide) {
cleartimeout(swiper.scrollbar.timeout);
$el[0].style.opacity = 1;
swiper.scrollbar.timeout = settimeout(function () {
$el[0].style.opacity = 0;
$el.transition(400);
}, 1000);
}
},
settransition: function settransition(duration) {
var swiper = this;
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) {
return;
}
swiper.scrollbar.$dragel.transition(duration);
},
updatesize: function updatesize() {
var swiper = this;
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) {
return;
}
var scrollbar = swiper.scrollbar;
var $dragel = scrollbar.$dragel;
var $el = scrollbar.$el;
$dragel[0].style.width = '';
$dragel[0].style.height = '';
var tracksize = swiper.ishorizontal() ? $el[0].offsetwidth : $el[0].offsetheight;
var divider = swiper.size / swiper.virtualsize;
var movedivider = divider * (tracksize / swiper.size);
var dragsize;
if (swiper.params.scrollbar.dragsize === 'auto') {
dragsize = tracksize * divider;
} else {
dragsize = parseint(swiper.params.scrollbar.dragsize, 10);
}
if (swiper.ishorizontal()) {
$dragel[0].style.width = dragsize + "px";
} else {
$dragel[0].style.height = dragsize + "px";
}
if (divider >= 1) {
$el[0].style.display = 'none';
} else {
$el[0].style.display = '';
}
if (swiper.params.scrollbar.hide) {
$el[0].style.opacity = 0;
}
utils.extend(scrollbar, {
tracksize: tracksize,
divider: divider,
movedivider: movedivider,
dragsize: dragsize,
});
scrollbar.$el[swiper.params.watchoverflow && swiper.islocked ? 'addclass' : 'removeclass'](swiper.params.scrollbar.lockclass);
},
getpointerposition: function getpointerposition(e) {
var swiper = this;
if (swiper.ishorizontal()) {
return ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targettouches[0].pagex : e.pagex || e.clientx);
}
return ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targettouches[0].pagey : e.pagey || e.clienty);
},
setdragposition: function setdragposition(e) {
var swiper = this;
var scrollbar = swiper.scrollbar;
var rtl = swiper.rtltranslate;
var $el = scrollbar.$el;
var dragsize = scrollbar.dragsize;
var tracksize = scrollbar.tracksize;
var dragstartpos = scrollbar.dragstartpos;
var positionratio;
positionratio = ((scrollbar.getpointerposition(e)) - $el.offset()[swiper.ishorizontal() ? 'left' : 'top'] -
(dragstartpos !== null ? dragstartpos : dragsize / 2)) / (tracksize - dragsize);
positionratio = math.max(math.min(positionratio, 1), 0);
if (rtl) {
positionratio = 1 - positionratio;
}
var position = swiper.mintranslate() + ((swiper.maxtranslate() - swiper.mintranslate()) * positionratio);
swiper.updateprogress(position);
swiper.settranslate(position);
swiper.updateactiveindex();
swiper.updateslidesclasses();
},
ondragstart: function ondragstart(e) {
var swiper = this;
var params = swiper.params.scrollbar;
var scrollbar = swiper.scrollbar;
var $wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el;
var $dragel = scrollbar.$dragel;
swiper.scrollbar.istouched = true;
swiper.scrollbar.dragstartpos = (e.target === $dragel[0] || e.target === $dragel) ?
scrollbar.getpointerposition(e) - e.target.getboundingclientrect()[swiper.ishorizontal() ? 'left' : 'top'] : null;
e.preventdefault();
e.stoppropagation();
$wrapperel.transition(100);
$dragel.transition(100);
scrollbar.setdragposition(e);
cleartimeout(swiper.scrollbar.dragtimeout);
$el.transition(0);
if (params.hide) {
$el.css('opacity', 1);
}
swiper.emit('scrollbardragstart', e);
},
ondragmove: function ondragmove(e) {
var swiper = this;
var scrollbar = swiper.scrollbar;
var $wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el;
var $dragel = scrollbar.$dragel;
if (!swiper.scrollbar.istouched) {
return;
}
if (e.preventdefault) {
e.preventdefault();
} else {
e.returnvalue = false;
}
scrollbar.setdragposition(e);
$wrapperel.transition(0);
$el.transition(0);
$dragel.transition(0);
swiper.emit('scrollbardragmove', e);
},
ondragend: function ondragend(e) {
var swiper = this;
var params = swiper.params.scrollbar;
var scrollbar = swiper.scrollbar;
var $el = scrollbar.$el;
if (!swiper.scrollbar.istouched) {
return;
}
swiper.scrollbar.istouched = false;
if (params.hide) {
cleartimeout(swiper.scrollbar.dragtimeout);
swiper.scrollbar.dragtimeout = utils.nexttick(function () {
$el.css('opacity', 0);
$el.transition(400);
}, 1000);
}
swiper.emit('scrollbardragend', e);
if (params.snaponrelease) {
swiper.slidetoclosest();
}
},
enabledraggable: function enabledraggable() {
var swiper = this;
if (!swiper.params.scrollbar.el) {
return;
}
var scrollbar = swiper.scrollbar;
var toucheventstouch = swiper.toucheventstouch;
var toucheventsdesktop = swiper.toucheventsdesktop;
var params = swiper.params;
var $el = scrollbar.$el;
var target = $el[0];
var activelistener = support.passivelistener && params.passivelisteners ? {
passive: false,
capture: false
} : false;
var passivelistener = support.passivelistener && params.passivelisteners ? {
passive: true,
capture: false
} : false;
if (!support.touch) {
target.addeventlistener(toucheventsdesktop.start, swiper.scrollbar.ondragstart, activelistener);
doc.addeventlistener(toucheventsdesktop.move, swiper.scrollbar.ondragmove, activelistener);
doc.addeventlistener(toucheventsdesktop.end, swiper.scrollbar.ondragend, passivelistener);
} else {
target.addeventlistener(toucheventstouch.start, swiper.scrollbar.ondragstart, activelistener);
target.addeventlistener(toucheventstouch.move, swiper.scrollbar.ondragmove, activelistener);
target.addeventlistener(toucheventstouch.end, swiper.scrollbar.ondragend, passivelistener);
}
},
disabledraggable: function disabledraggable() {
var swiper = this;
if (!swiper.params.scrollbar.el) {
return;
}
var scrollbar = swiper.scrollbar;
var toucheventstouch = swiper.toucheventstouch;
var toucheventsdesktop = swiper.toucheventsdesktop;
var params = swiper.params;
var $el = scrollbar.$el;
var target = $el[0];
var activelistener = support.passivelistener && params.passivelisteners ? {
passive: false,
capture: false
} : false;
var passivelistener = support.passivelistener && params.passivelisteners ? {
passive: true,
capture: false
} : false;
if (!support.touch) {
target.removeeventlistener(toucheventsdesktop.start, swiper.scrollbar.ondragstart, activelistener);
doc.removeeventlistener(toucheventsdesktop.move, swiper.scrollbar.ondragmove, activelistener);
doc.removeeventlistener(toucheventsdesktop.end, swiper.scrollbar.ondragend, passivelistener);
} else {
target.removeeventlistener(toucheventstouch.start, swiper.scrollbar.ondragstart, activelistener);
target.removeeventlistener(toucheventstouch.move, swiper.scrollbar.ondragmove, activelistener);
target.removeeventlistener(toucheventstouch.end, swiper.scrollbar.ondragend, passivelistener);
}
},
init: function init() {
var swiper = this;
if (!swiper.params.scrollbar.el) {
return;
}
var scrollbar = swiper.scrollbar;
var $swiperel = swiper.$el;
var params = swiper.params.scrollbar;
var $el = $(params.el);
if (swiper.params.uniquenavelements && typeof params.el === 'string' && $el.length > 1 && $swiperel.find(params.el).length === 1) {
$el = $swiperel.find(params.el);
}
var $dragel = $el.find(("." + (swiper.params.scrollbar.dragclass)));
if ($dragel.length === 0) {
$dragel = $((""));
$el.append($dragel);
}
utils.extend(scrollbar, {
$el: $el,
el: $el[0],
$dragel: $dragel,
dragel: $dragel[0],
});
if (params.draggable) {
scrollbar.enabledraggable();
}
},
destroy: function destroy() {
var swiper = this;
swiper.scrollbar.disabledraggable();
},
};
var scrollbar$1 = {
name: 'scrollbar',
params: {
scrollbar: {
el: null,
dragsize: 'auto',
hide: false,
draggable: false,
snaponrelease: true,
lockclass: 'swiper-scrollbar-lock',
dragclass: 'swiper-scrollbar-drag',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
scrollbar: {
init: scrollbar.init.bind(swiper),
destroy: scrollbar.destroy.bind(swiper),
updatesize: scrollbar.updatesize.bind(swiper),
settranslate: scrollbar.settranslate.bind(swiper),
settransition: scrollbar.settransition.bind(swiper),
enabledraggable: scrollbar.enabledraggable.bind(swiper),
disabledraggable: scrollbar.disabledraggable.bind(swiper),
setdragposition: scrollbar.setdragposition.bind(swiper),
getpointerposition: scrollbar.getpointerposition.bind(swiper),
ondragstart: scrollbar.ondragstart.bind(swiper),
ondragmove: scrollbar.ondragmove.bind(swiper),
ondragend: scrollbar.ondragend.bind(swiper),
istouched: false,
timeout: null,
dragtimeout: null,
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.scrollbar.init();
swiper.scrollbar.updatesize();
swiper.scrollbar.settranslate();
},
update: function update() {
var swiper = this;
swiper.scrollbar.updatesize();
},
resize: function resize() {
var swiper = this;
swiper.scrollbar.updatesize();
},
observerupdate: function observerupdate() {
var swiper = this;
swiper.scrollbar.updatesize();
},
settranslate: function settranslate() {
var swiper = this;
swiper.scrollbar.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
swiper.scrollbar.settransition(duration);
},
destroy: function destroy() {
var swiper = this;
swiper.scrollbar.destroy();
},
},
};
var parallax = {
settransform: function settransform(el, progress) {
var swiper = this;
var rtl = swiper.rtl;
var $el = $(el);
var rtlfactor = rtl ? -1 : 1;
var p = $el.attr('data-swiper-parallax') || '0';
var x = $el.attr('data-swiper-parallax-x');
var y = $el.attr('data-swiper-parallax-y');
var scale = $el.attr('data-swiper-parallax-scale');
var opacity = $el.attr('data-swiper-parallax-opacity');
if (x || y) {
x = x || '0';
y = y || '0';
} else if (swiper.ishorizontal()) {
x = p;
y = '0';
} else {
y = p;
x = '0';
}
if ((x).indexof('%') >= 0) {
x = (parseint(x, 10) * progress * rtlfactor) + "%";
} else {
x = (x * progress * rtlfactor) + "px";
}
if ((y).indexof('%') >= 0) {
y = (parseint(y, 10) * progress) + "%";
} else {
y = (y * progress) + "px";
}
if (typeof opacity !== 'undefined' && opacity !== null) {
var currentopacity = opacity - ((opacity - 1) * (1 - math.abs(progress)));
$el[0].style.opacity = currentopacity;
}
if (typeof scale === 'undefined' || scale === null) {
$el.transform(("translate3d(" + x + ", " + y + ", 0px)"));
} else {
var currentscale = scale - ((scale - 1) * (1 - math.abs(progress)));
$el.transform(("translate3d(" + x + ", " + y + ", 0px) scale(" + currentscale + ")"));
}
},
settranslate: function settranslate() {
var swiper = this;
var $el = swiper.$el;
var slides = swiper.slides;
var progress = swiper.progress;
var snapgrid = swiper.snapgrid;
$el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]')
.each(function (index, el) {
swiper.parallax.settransform(el, progress);
});
slides.each(function (slideindex, slideel) {
var slideprogress = slideel.progress;
if (swiper.params.slidespergroup > 1 && swiper.params.slidesperview !== 'auto') {
slideprogress += math.ceil(slideindex / 2) - (progress * (snapgrid.length - 1));
}
slideprogress = math.min(math.max(slideprogress, -1), 1);
$(slideel).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]')
.each(function (index, el) {
swiper.parallax.settransform(el, slideprogress);
});
});
},
settransition: function settransition(duration) {
if (duration === void 0) duration = this.params.speed;
var swiper = this;
var $el = swiper.$el;
$el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]')
.each(function (index, parallaxel) {
var $parallaxel = $(parallaxel);
var parallaxduration = parseint($parallaxel.attr('data-swiper-parallax-duration'), 10) || duration;
if (duration === 0) {
parallaxduration = 0;
}
$parallaxel.transition(parallaxduration);
});
},
};
var parallax$1 = {
name: 'parallax',
params: {
parallax: {
enabled: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
parallax: {
settransform: parallax.settransform.bind(swiper),
settranslate: parallax.settranslate.bind(swiper),
settransition: parallax.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (!swiper.params.parallax.enabled) {
return;
}
swiper.params.watchslidesprogress = true;
swiper.originalparams.watchslidesprogress = true;
},
init: function init() {
var swiper = this;
if (!swiper.params.parallax.enabled) {
return;
}
swiper.parallax.settranslate();
},
settranslate: function settranslate() {
var swiper = this;
if (!swiper.params.parallax.enabled) {
return;
}
swiper.parallax.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (!swiper.params.parallax.enabled) {
return;
}
swiper.parallax.settransition(duration);
},
},
};
var zoom = {
// calc scale from multi-touches
getdistancebetweentouches: function getdistancebetweentouches(e) {
if (e.targettouches.length < 2) {
return 1;
}
var x1 = e.targettouches[0].pagex;
var y1 = e.targettouches[0].pagey;
var x2 = e.targettouches[1].pagex;
var y2 = e.targettouches[1].pagey;
var distance = math.sqrt((math.pow((x2 - x1), 2)) + (math.pow((y2 - y1), 2)));
return distance;
},
// events
ongesturestart: function ongesturestart(e) {
var swiper = this;
var params = swiper.params.zoom;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
zoom.fakegesturetouched = false;
zoom.fakegesturemoved = false;
if (!support.gestures) {
if (e.type !== 'touchstart' || (e.type === 'touchstart' && e.targettouches.length < 2)) {
return;
}
zoom.fakegesturetouched = true;
gesture.scalestart = zoom.getdistancebetweentouches(e);
}
if (!gesture.$slideel || !gesture.$slideel.length) {
gesture.$slideel = $(e.target).closest('.swiper-slide');
if (gesture.$slideel.length === 0) {
gesture.$slideel = swiper.slides.eq(swiper.activeindex);
}
gesture.$imageel = gesture.$slideel.find('img, svg, canvas');
gesture.$imagewrapel = gesture.$imageel.parent(("." + (params.containerclass)));
gesture.maxratio = gesture.$imagewrapel.attr('data-swiper-zoom') || params.maxratio;
if (gesture.$imagewrapel.length === 0) {
gesture.$imageel = undefined;
return;
}
}
gesture.$imageel.transition(0);
swiper.zoom.isscaling = true;
},
ongesturechange: function ongesturechange(e) {
var swiper = this;
var params = swiper.params.zoom;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
if (!support.gestures) {
if (e.type !== 'touchmove' || (e.type === 'touchmove' && e.targettouches.length < 2)) {
return;
}
zoom.fakegesturemoved = true;
gesture.scalemove = zoom.getdistancebetweentouches(e);
}
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
if (support.gestures) {
zoom.scale = e.scale * zoom.currentscale;
} else {
zoom.scale = (gesture.scalemove / gesture.scalestart) * zoom.currentscale;
}
if (zoom.scale > gesture.maxratio) {
zoom.scale = (gesture.maxratio - 1) + (math.pow(((zoom.scale - gesture.maxratio) + 1), 0.5));
}
if (zoom.scale < params.minratio) {
zoom.scale = (params.minratio + 1) - (math.pow(((params.minratio - zoom.scale) + 1), 0.5));
}
gesture.$imageel.transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
},
ongestureend: function ongestureend(e) {
var swiper = this;
var params = swiper.params.zoom;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
if (!support.gestures) {
if (!zoom.fakegesturetouched || !zoom.fakegesturemoved) {
return;
}
if (e.type !== 'touchend' || (e.type === 'touchend' && e.changedtouches.length < 2 && !device.android)) {
return;
}
zoom.fakegesturetouched = false;
zoom.fakegesturemoved = false;
}
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
zoom.scale = math.max(math.min(zoom.scale, gesture.maxratio), params.minratio);
gesture.$imageel.transition(swiper.params.speed).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
zoom.currentscale = zoom.scale;
zoom.isscaling = false;
if (zoom.scale === 1) {
gesture.$slideel = undefined;
}
},
ontouchstart: function ontouchstart(e) {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
if (image.istouched) {
return;
}
if (device.android) {
e.preventdefault();
}
image.istouched = true;
image.touchesstart.x = e.type === 'touchstart' ? e.targettouches[0].pagex : e.pagex;
image.touchesstart.y = e.type === 'touchstart' ? e.targettouches[0].pagey : e.pagey;
},
ontouchmove: function ontouchmove(e) {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
var velocity = zoom.velocity;
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
swiper.allowclick = false;
if (!image.istouched || !gesture.$slideel) {
return;
}
if (!image.ismoved) {
image.width = gesture.$imageel[0].offsetwidth;
image.height = gesture.$imageel[0].offsetheight;
image.startx = utils.gettranslate(gesture.$imagewrapel[0], 'x') || 0;
image.starty = utils.gettranslate(gesture.$imagewrapel[0], 'y') || 0;
gesture.slidewidth = gesture.$slideel[0].offsetwidth;
gesture.slideheight = gesture.$slideel[0].offsetheight;
gesture.$imagewrapel.transition(0);
if (swiper.rtl) {
image.startx = -image.startx;
image.starty = -image.starty;
}
}
// define if we need image drag
var scaledwidth = image.width * zoom.scale;
var scaledheight = image.height * zoom.scale;
if (scaledwidth < gesture.slidewidth && scaledheight < gesture.slideheight) {
return;
}
image.minx = math.min(((gesture.slidewidth / 2) - (scaledwidth / 2)), 0);
image.maxx = -image.minx;
image.miny = math.min(((gesture.slideheight / 2) - (scaledheight / 2)), 0);
image.maxy = -image.miny;
image.touchescurrent.x = e.type === 'touchmove' ? e.targettouches[0].pagex : e.pagex;
image.touchescurrent.y = e.type === 'touchmove' ? e.targettouches[0].pagey : e.pagey;
if (!image.ismoved && !zoom.isscaling) {
if (
swiper.ishorizontal() &&
(
(math.floor(image.minx) === math.floor(image.startx) && image.touchescurrent.x < image.touchesstart.x) ||
(math.floor(image.maxx) === math.floor(image.startx) && image.touchescurrent.x > image.touchesstart.x)
)
) {
image.istouched = false;
return;
}
if (
!swiper.ishorizontal() &&
(
(math.floor(image.miny) === math.floor(image.starty) && image.touchescurrent.y < image.touchesstart.y) ||
(math.floor(image.maxy) === math.floor(image.starty) && image.touchescurrent.y > image.touchesstart.y)
)
) {
image.istouched = false;
return;
}
}
e.preventdefault();
e.stoppropagation();
image.ismoved = true;
image.currentx = (image.touchescurrent.x - image.touchesstart.x) + image.startx;
image.currenty = (image.touchescurrent.y - image.touchesstart.y) + image.starty;
if (image.currentx < image.minx) {
image.currentx = (image.minx + 1) - (math.pow(((image.minx - image.currentx) + 1), 0.8));
}
if (image.currentx > image.maxx) {
image.currentx = (image.maxx - 1) + (math.pow(((image.currentx - image.maxx) + 1), 0.8));
}
if (image.currenty < image.miny) {
image.currenty = (image.miny + 1) - (math.pow(((image.miny - image.currenty) + 1), 0.8));
}
if (image.currenty > image.maxy) {
image.currenty = (image.maxy - 1) + (math.pow(((image.currenty - image.maxy) + 1), 0.8));
}
// velocity
if (!velocity.prevpositionx) {
velocity.prevpositionx = image.touchescurrent.x;
}
if (!velocity.prevpositiony) {
velocity.prevpositiony = image.touchescurrent.y;
}
if (!velocity.prevtime) {
velocity.prevtime = date.now();
}
velocity.x = (image.touchescurrent.x - velocity.prevpositionx) / (date.now() - velocity.prevtime) / 2;
velocity.y = (image.touchescurrent.y - velocity.prevpositiony) / (date.now() - velocity.prevtime) / 2;
if (math.abs(image.touchescurrent.x - velocity.prevpositionx) < 2) {
velocity.x = 0;
}
if (math.abs(image.touchescurrent.y - velocity.prevpositiony) < 2) {
velocity.y = 0;
}
velocity.prevpositionx = image.touchescurrent.x;
velocity.prevpositiony = image.touchescurrent.y;
velocity.prevtime = date.now();
gesture.$imagewrapel.transform(("translate3d(" + (image.currentx) + "px, " + (image.currenty) + "px,0)"));
},
ontouchend: function ontouchend() {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
var velocity = zoom.velocity;
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
if (!image.istouched || !image.ismoved) {
image.istouched = false;
image.ismoved = false;
return;
}
image.istouched = false;
image.ismoved = false;
var momentumdurationx = 300;
var momentumdurationy = 300;
var momentumdistancex = velocity.x * momentumdurationx;
var newpositionx = image.currentx + momentumdistancex;
var momentumdistancey = velocity.y * momentumdurationy;
var newpositiony = image.currenty + momentumdistancey;
// fix duration
if (velocity.x !== 0) {
momentumdurationx = math.abs((newpositionx - image.currentx) / velocity.x);
}
if (velocity.y !== 0) {
momentumdurationy = math.abs((newpositiony - image.currenty) / velocity.y);
}
var momentumduration = math.max(momentumdurationx, momentumdurationy);
image.currentx = newpositionx;
image.currenty = newpositiony;
// define if we need image drag
var scaledwidth = image.width * zoom.scale;
var scaledheight = image.height * zoom.scale;
image.minx = math.min(((gesture.slidewidth / 2) - (scaledwidth / 2)), 0);
image.maxx = -image.minx;
image.miny = math.min(((gesture.slideheight / 2) - (scaledheight / 2)), 0);
image.maxy = -image.miny;
image.currentx = math.max(math.min(image.currentx, image.maxx), image.minx);
image.currenty = math.max(math.min(image.currenty, image.maxy), image.miny);
gesture.$imagewrapel.transition(momentumduration).transform(("translate3d(" + (image.currentx) + "px, " + (image.currenty) + "px,0)"));
},
ontransitionend: function ontransitionend() {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
if (gesture.$slideel && swiper.previousindex !== swiper.activeindex) {
gesture.$imageel.transform('translate3d(0,0,0) scale(1)');
gesture.$imagewrapel.transform('translate3d(0,0,0)');
zoom.scale = 1;
zoom.currentscale = 1;
gesture.$slideel = undefined;
gesture.$imageel = undefined;
gesture.$imagewrapel = undefined;
}
},
// toggle zoom
toggle: function toggle(e) {
var swiper = this;
var zoom = swiper.zoom;
if (zoom.scale && zoom.scale !== 1) {
// zoom out
zoom.out();
} else {
// zoom in
zoom.in(e);
}
},
in: function in$1(e) {
var swiper = this;
var zoom = swiper.zoom;
var params = swiper.params.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
if (!gesture.$slideel) {
gesture.$slideel = swiper.clickedslide ? $(swiper.clickedslide) : swiper.slides.eq(swiper.activeindex);
gesture.$imageel = gesture.$slideel.find('img, svg, canvas');
gesture.$imagewrapel = gesture.$imageel.parent(("." + (params.containerclass)));
}
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
gesture.$slideel.addclass(("" + (params.zoomedslideclass)));
var touchx;
var touchy;
var offsetx;
var offsety;
var diffx;
var diffy;
var translatex;
var translatey;
var imagewidth;
var imageheight;
var scaledwidth;
var scaledheight;
var translateminx;
var translateminy;
var translatemaxx;
var translatemaxy;
var slidewidth;
var slideheight;
if (typeof image.touchesstart.x === 'undefined' && e) {
touchx = e.type === 'touchend' ? e.changedtouches[0].pagex : e.pagex;
touchy = e.type === 'touchend' ? e.changedtouches[0].pagey : e.pagey;
} else {
touchx = image.touchesstart.x;
touchy = image.touchesstart.y;
}
zoom.scale = gesture.$imagewrapel.attr('data-swiper-zoom') || params.maxratio;
zoom.currentscale = gesture.$imagewrapel.attr('data-swiper-zoom') || params.maxratio;
if (e) {
slidewidth = gesture.$slideel[0].offsetwidth;
slideheight = gesture.$slideel[0].offsetheight;
offsetx = gesture.$slideel.offset().left;
offsety = gesture.$slideel.offset().top;
diffx = (offsetx + (slidewidth / 2)) - touchx;
diffy = (offsety + (slideheight / 2)) - touchy;
imagewidth = gesture.$imageel[0].offsetwidth;
imageheight = gesture.$imageel[0].offsetheight;
scaledwidth = imagewidth * zoom.scale;
scaledheight = imageheight * zoom.scale;
translateminx = math.min(((slidewidth / 2) - (scaledwidth / 2)), 0);
translateminy = math.min(((slideheight / 2) - (scaledheight / 2)), 0);
translatemaxx = -translateminx;
translatemaxy = -translateminy;
translatex = diffx * zoom.scale;
translatey = diffy * zoom.scale;
if (translatex < translateminx) {
translatex = translateminx;
}
if (translatex > translatemaxx) {
translatex = translatemaxx;
}
if (translatey < translateminy) {
translatey = translateminy;
}
if (translatey > translatemaxy) {
translatey = translatemaxy;
}
} else {
translatex = 0;
translatey = 0;
}
gesture.$imagewrapel.transition(300).transform(("translate3d(" + translatex + "px, " + translatey + "px,0)"));
gesture.$imageel.transition(300).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
},
out: function out() {
var swiper = this;
var zoom = swiper.zoom;
var params = swiper.params.zoom;
var gesture = zoom.gesture;
if (!gesture.$slideel) {
gesture.$slideel = swiper.clickedslide ? $(swiper.clickedslide) : swiper.slides.eq(swiper.activeindex);
gesture.$imageel = gesture.$slideel.find('img, svg, canvas');
gesture.$imagewrapel = gesture.$imageel.parent(("." + (params.containerclass)));
}
if (!gesture.$imageel || gesture.$imageel.length === 0) {
return;
}
zoom.scale = 1;
zoom.currentscale = 1;
gesture.$imagewrapel.transition(300).transform('translate3d(0,0,0)');
gesture.$imageel.transition(300).transform('translate3d(0,0,0) scale(1)');
gesture.$slideel.removeclass(("" + (params.zoomedslideclass)));
gesture.$slideel = undefined;
},
// attach/detach events
enable: function enable() {
var swiper = this;
var zoom = swiper.zoom;
if (zoom.enabled) {
return;
}
zoom.enabled = true;
var passivelistener = swiper.touchevents.start === 'touchstart' && support.passivelistener && swiper.params.passivelisteners ? {
passive: true,
capture: false
} : false;
// scale image
if (support.gestures) {
swiper.$wrapperel.on('gesturestart', '.swiper-slide', zoom.ongesturestart, passivelistener);
swiper.$wrapperel.on('gesturechange', '.swiper-slide', zoom.ongesturechange, passivelistener);
swiper.$wrapperel.on('gestureend', '.swiper-slide', zoom.ongestureend, passivelistener);
} else if (swiper.touchevents.start === 'touchstart') {
swiper.$wrapperel.on(swiper.touchevents.start, '.swiper-slide', zoom.ongesturestart, passivelistener);
swiper.$wrapperel.on(swiper.touchevents.move, '.swiper-slide', zoom.ongesturechange, passivelistener);
swiper.$wrapperel.on(swiper.touchevents.end, '.swiper-slide', zoom.ongestureend, passivelistener);
}
// move image
swiper.$wrapperel.on(swiper.touchevents.move, ("." + (swiper.params.zoom.containerclass)), zoom.ontouchmove);
},
disable: function disable() {
var swiper = this;
var zoom = swiper.zoom;
if (!zoom.enabled) {
return;
}
swiper.zoom.enabled = false;
var passivelistener = swiper.touchevents.start === 'touchstart' && support.passivelistener && swiper.params.passivelisteners ? {
passive: true,
capture: false
} : false;
// scale image
if (support.gestures) {
swiper.$wrapperel.off('gesturestart', '.swiper-slide', zoom.ongesturestart, passivelistener);
swiper.$wrapperel.off('gesturechange', '.swiper-slide', zoom.ongesturechange, passivelistener);
swiper.$wrapperel.off('gestureend', '.swiper-slide', zoom.ongestureend, passivelistener);
} else if (swiper.touchevents.start === 'touchstart') {
swiper.$wrapperel.off(swiper.touchevents.start, '.swiper-slide', zoom.ongesturestart, passivelistener);
swiper.$wrapperel.off(swiper.touchevents.move, '.swiper-slide', zoom.ongesturechange, passivelistener);
swiper.$wrapperel.off(swiper.touchevents.end, '.swiper-slide', zoom.ongestureend, passivelistener);
}
// move image
swiper.$wrapperel.off(swiper.touchevents.move, ("." + (swiper.params.zoom.containerclass)), zoom.ontouchmove);
},
};
var zoom$1 = {
name: 'zoom',
params: {
zoom: {
enabled: false,
maxratio: 3,
minratio: 1,
toggle: true,
containerclass: 'swiper-zoom-container',
zoomedslideclass: 'swiper-slide-zoomed',
},
},
create: function create() {
var swiper = this;
var zoom = {
enabled: false,
scale: 1,
currentscale: 1,
isscaling: false,
gesture: {
$slideel: undefined,
slidewidth: undefined,
slideheight: undefined,
$imageel: undefined,
$imagewrapel: undefined,
maxratio: 3,
},
image: {
istouched: undefined,
ismoved: undefined,
currentx: undefined,
currenty: undefined,
minx: undefined,
miny: undefined,
maxx: undefined,
maxy: undefined,
width: undefined,
height: undefined,
startx: undefined,
starty: undefined,
touchesstart: {},
touchescurrent: {},
},
velocity: {
x: undefined,
y: undefined,
prevpositionx: undefined,
prevpositiony: undefined,
prevtime: undefined,
},
};
('ongesturestart ongesturechange ongestureend ontouchstart ontouchmove ontouchend ontransitionend toggle enable disable in out').split(' ').foreach(function (methodname) {
zoom[methodname] = zoom[methodname].bind(swiper);
});
utils.extend(swiper, {
zoom: zoom,
});
var scale = 1;
object.defineproperty(swiper.zoom, 'scale', {
get: function get() {
return scale;
},
set: function set(value) {
if (scale !== value) {
var imageel = swiper.zoom.gesture.$imageel ? swiper.zoom.gesture.$imageel[0] : undefined;
var slideel = swiper.zoom.gesture.$slideel ? swiper.zoom.gesture.$slideel[0] : undefined;
swiper.emit('zoomchange', value, imageel, slideel);
}
scale = value;
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.zoom.enabled) {
swiper.zoom.enable();
}
},
destroy: function destroy() {
var swiper = this;
swiper.zoom.disable();
},
touchstart: function touchstart(e) {
var swiper = this;
if (!swiper.zoom.enabled) {
return;
}
swiper.zoom.ontouchstart(e);
},
touchend: function touchend(e) {
var swiper = this;
if (!swiper.zoom.enabled) {
return;
}
swiper.zoom.ontouchend(e);
},
doubletap: function doubletap(e) {
var swiper = this;
if (swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
swiper.zoom.toggle(e);
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
swiper.zoom.ontransitionend();
}
},
},
};
var lazy = {
loadinslide: function loadinslide(index, loadinduplicate) {
if (loadinduplicate === void 0) loadinduplicate = true;
var swiper = this;
var params = swiper.params.lazy;
if (typeof index === 'undefined') {
return;
}
if (swiper.slides.length === 0) {
return;
}
var isvirtual = swiper.virtual && swiper.params.virtual.enabled;
var $slideel = isvirtual ?
swiper.$wrapperel.children(("." + (swiper.params.slideclass) + "[data-swiper-slide-index=\"" + index + "\"]")) :
swiper.slides.eq(index);
var $images = $slideel.find(("." + (params.elementclass) + ":not(." + (params.loadedclass) + "):not(." + (params.loadingclass) + ")"));
if ($slideel.hasclass(params.elementclass) && !$slideel.hasclass(params.loadedclass) && !$slideel.hasclass(params.loadingclass)) {
$images = $images.add($slideel[0]);
}
if ($images.length === 0) {
return;
}
$images.each(function (imageindex, imageel) {
var $imageel = $(imageel);
$imageel.addclass(params.loadingclass);
var background = $imageel.attr('data-background');
var src = $imageel.attr('data-src');
var srcset = $imageel.attr('data-srcset');
var sizes = $imageel.attr('data-sizes');
swiper.loadimage($imageel[0], (src || background), srcset, sizes, false, function () {
if (typeof swiper === 'undefined' || swiper === null || !swiper || (swiper && !swiper.params) || swiper.destroyed) {
return;
}
if (background) {
$imageel.css('background-image', ("url(\"" + background + "\")"));
$imageel.removeattr('data-background');
} else {
if (srcset) {
$imageel.attr('srcset', srcset);
$imageel.removeattr('data-srcset');
}
if (sizes) {
$imageel.attr('sizes', sizes);
$imageel.removeattr('data-sizes');
}
if (src) {
$imageel.attr('src', src);
$imageel.removeattr('data-src');
}
}
$imageel.addclass(params.loadedclass).removeclass(params.loadingclass);
$slideel.find(("." + (params.preloaderclass))).remove();
if (swiper.params.loop && loadinduplicate) {
var slideoriginalindex = $slideel.attr('data-swiper-slide-index');
if ($slideel.hasclass(swiper.params.slideduplicateclass)) {
var originalslide = swiper.$wrapperel.children(("[data-swiper-slide-index=\"" + slideoriginalindex + "\"]:not(." + (swiper.params.slideduplicateclass) + ")"));
swiper.lazy.loadinslide(originalslide.index(), false);
} else {
var duplicatedslide = swiper.$wrapperel.children(("." + (swiper.params.slideduplicateclass) + "[data-swiper-slide-index=\"" + slideoriginalindex + "\"]"));
swiper.lazy.loadinslide(duplicatedslide.index(), false);
}
}
swiper.emit('lazyimageready', $slideel[0], $imageel[0]);
});
swiper.emit('lazyimageload', $slideel[0], $imageel[0]);
});
},
load: function load() {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var swiperparams = swiper.params;
var slides = swiper.slides;
var activeindex = swiper.activeindex;
var isvirtual = swiper.virtual && swiperparams.virtual.enabled;
var params = swiperparams.lazy;
var slidesperview = swiperparams.slidesperview;
if (slidesperview === 'auto') {
slidesperview = 0;
}
function slideexist(index) {
if (isvirtual) {
if ($wrapperel.children(("." + (swiperparams.slideclass) + "[data-swiper-slide-index=\"" + index + "\"]")).length) {
return true;
}
} else if (slides[index]) {
return true;
}
return false;
}
function slideindex(slideel) {
if (isvirtual) {
return $(slideel).attr('data-swiper-slide-index');
}
return $(slideel).index();
}
if (!swiper.lazy.initialimageloaded) {
swiper.lazy.initialimageloaded = true;
}
if (swiper.params.watchslidesvisibility) {
$wrapperel.children(("." + (swiperparams.slidevisibleclass))).each(function (elindex, slideel) {
var index = isvirtual ? $(slideel).attr('data-swiper-slide-index') : $(slideel).index();
swiper.lazy.loadinslide(index);
});
} else if (slidesperview > 1) {
for (var i = activeindex; i < activeindex + slidesperview; i += 1) {
if (slideexist(i)) {
swiper.lazy.loadinslide(i);
}
}
} else {
swiper.lazy.loadinslide(activeindex);
}
if (params.loadprevnext) {
if (slidesperview > 1 || (params.loadprevnextamount && params.loadprevnextamount > 1)) {
var amount = params.loadprevnextamount;
var spv = slidesperview;
var maxindex = math.min(activeindex + spv + math.max(amount, spv), slides.length);
var minindex = math.max(activeindex - math.max(spv, amount), 0);
// next slides
for (var i$1 = activeindex + slidesperview; i$1 < maxindex; i$1 += 1) {
if (slideexist(i$1)) {
swiper.lazy.loadinslide(i$1);
}
}
// prev slides
for (var i$2 = minindex; i$2 < activeindex; i$2 += 1) {
if (slideexist(i$2)) {
swiper.lazy.loadinslide(i$2);
}
}
} else {
var nextslide = $wrapperel.children(("." + (swiperparams.slidenextclass)));
if (nextslide.length > 0) {
swiper.lazy.loadinslide(slideindex(nextslide));
}
var prevslide = $wrapperel.children(("." + (swiperparams.slideprevclass)));
if (prevslide.length > 0) {
swiper.lazy.loadinslide(slideindex(prevslide));
}
}
}
},
};
var lazy$1 = {
name: 'lazy',
params: {
lazy: {
enabled: false,
loadprevnext: false,
loadprevnextamount: 1,
loadontransitionstart: false,
elementclass: 'swiper-lazy',
loadingclass: 'swiper-lazy-loading',
loadedclass: 'swiper-lazy-loaded',
preloaderclass: 'swiper-lazy-preloader',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
lazy: {
initialimageloaded: false,
load: lazy.load.bind(swiper),
loadinslide: lazy.loadinslide.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.lazy.enabled && swiper.params.preloadimages) {
swiper.params.preloadimages = false;
}
},
init: function init() {
var swiper = this;
if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialslide === 0) {
swiper.lazy.load();
}
},
scroll: function scroll() {
var swiper = this;
if (swiper.params.freemode && !swiper.params.freemodesticky) {
swiper.lazy.load();
}
},
resize: function resize() {
var swiper = this;
if (swiper.params.lazy.enabled) {
swiper.lazy.load();
}
},
scrollbardragmove: function scrollbardragmove() {
var swiper = this;
if (swiper.params.lazy.enabled) {
swiper.lazy.load();
}
},
transitionstart: function transitionstart() {
var swiper = this;
if (swiper.params.lazy.enabled) {
if (swiper.params.lazy.loadontransitionstart || (!swiper.params.lazy.loadontransitionstart && !swiper.lazy.initialimageloaded)) {
swiper.lazy.load();
}
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.params.lazy.enabled && !swiper.params.lazy.loadontransitionstart) {
swiper.lazy.load();
}
},
},
};
/* eslint no-bitwise: ["error", { "allow": [">>"] }] */
var controller = {
linearspline: function linearspline(x, y) {
var binarysearch = (function search() {
var maxindex;
var minindex;
var guess;
return function (array, val) {
minindex = -1;
maxindex = array.length;
while (maxindex - minindex > 1) {
guess = maxindex + minindex >> 1;
if (array[guess] <= val) {
minindex = guess;
} else {
maxindex = guess;
}
}
return maxindex;
};
}());
this.x = x;
this.y = y;
this.lastindex = x.length - 1;
// given an x value (x2), return the expected y2 value:
// (x1,y1) is the known point before given value,
// (x3,y3) is the known point after given value.
var i1;
var i3;
this.interpolate = function interpolate(x2) {
if (!x2) {
return 0;
}
// get the indexes of x1 and x3 (the array indexes before and after given x2):
i3 = binarysearch(this.x, x2);
i1 = i3 - 1;
// we have our indexes i1 & i3, so we can calculate already:
// y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
return (((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1])) + this.y[i1];
};
return this;
},
// xxx: for now i will just save one spline function to to
getinterpolatefunction: function getinterpolatefunction(c) {
var swiper = this;
if (!swiper.controller.spline) {
swiper.controller.spline = swiper.params.loop ?
new controller.linearspline(swiper.slidesgrid, c.slidesgrid) :
new controller.linearspline(swiper.snapgrid, c.snapgrid);
}
},
settranslate: function settranslate(settranslate$1, bycontroller) {
var swiper = this;
var controlled = swiper.controller.control;
var multiplier;
var controlledtranslate;
function setcontrolledtranslate(c) {
// this will create an interpolate function based on the snapgrids
// x is the grid of the scrolled scroller and y will be the controlled scroller
// it makes sense to create this only once and recall it for the interpolation
// the function does a lot of value caching for performance
var translate = swiper.rtltranslate ? -swiper.translate : swiper.translate;
if (swiper.params.controller.by === 'slide') {
swiper.controller.getinterpolatefunction(c);
// i am not sure why the values have to be multiplicated this way, tried to invert the snapgrid
// but it did not work out
controlledtranslate = -swiper.controller.spline.interpolate(-translate);
}
if (!controlledtranslate || swiper.params.controller.by === 'container') {
multiplier = (c.maxtranslate() - c.mintranslate()) / (swiper.maxtranslate() - swiper.mintranslate());
controlledtranslate = ((translate - swiper.mintranslate()) * multiplier) + c.mintranslate();
}
if (swiper.params.controller.inverse) {
controlledtranslate = c.maxtranslate() - controlledtranslate;
}
c.updateprogress(controlledtranslate);
c.settranslate(controlledtranslate, swiper);
c.updateactiveindex();
c.updateslidesclasses();
}
if (array.isarray(controlled)) {
for (var i = 0; i < controlled.length; i += 1) {
if (controlled[i] !== bycontroller && controlled[i] instanceof swiper) {
setcontrolledtranslate(controlled[i]);
}
}
} else if (controlled instanceof swiper && bycontroller !== controlled) {
setcontrolledtranslate(controlled);
}
},
settransition: function settransition(duration, bycontroller) {
var swiper = this;
var controlled = swiper.controller.control;
var i;
function setcontrolledtransition(c) {
c.settransition(duration, swiper);
if (duration !== 0) {
c.transitionstart();
if (c.params.autoheight) {
utils.nexttick(function () {
c.updateautoheight();
});
}
c.$wrapperel.transitionend(function () {
if (!controlled) {
return;
}
if (c.params.loop && swiper.params.controller.by === 'slide') {
c.loopfix();
}
c.transitionend();
});
}
}
if (array.isarray(controlled)) {
for (i = 0; i < controlled.length; i += 1) {
if (controlled[i] !== bycontroller && controlled[i] instanceof swiper) {
setcontrolledtransition(controlled[i]);
}
}
} else if (controlled instanceof swiper && bycontroller !== controlled) {
setcontrolledtransition(controlled);
}
},
};
var controller$1 = {
name: 'controller',
params: {
controller: {
control: undefined,
inverse: false,
by: 'slide', // or 'container'
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
controller: {
control: swiper.params.controller.control,
getinterpolatefunction: controller.getinterpolatefunction.bind(swiper),
settranslate: controller.settranslate.bind(swiper),
settransition: controller.settransition.bind(swiper),
},
});
},
on: {
update: function update() {
var swiper = this;
if (!swiper.controller.control) {
return;
}
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
resize: function resize() {
var swiper = this;
if (!swiper.controller.control) {
return;
}
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
observerupdate: function observerupdate() {
var swiper = this;
if (!swiper.controller.control) {
return;
}
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
settranslate: function settranslate(translate, bycontroller) {
var swiper = this;
if (!swiper.controller.control) {
return;
}
swiper.controller.settranslate(translate, bycontroller);
},
settransition: function settransition(duration, bycontroller) {
var swiper = this;
if (!swiper.controller.control) {
return;
}
swiper.controller.settransition(duration, bycontroller);
},
},
};
var a11y = {
makeelfocusable: function makeelfocusable($el) {
$el.attr('tabindex', '0');
return $el;
},
addelrole: function addelrole($el, role) {
$el.attr('role', role);
return $el;
},
addellabel: function addellabel($el, label) {
$el.attr('aria-label', label);
return $el;
},
disableel: function disableel($el) {
$el.attr('aria-disabled', true);
return $el;
},
enableel: function enableel($el) {
$el.attr('aria-disabled', false);
return $el;
},
onenterkey: function onenterkey(e) {
var swiper = this;
var params = swiper.params.a11y;
if (e.keycode !== 13) {
return;
}
var $targetel = $(e.target);
if (swiper.navigation && swiper.navigation.$nextel && $targetel.is(swiper.navigation.$nextel)) {
if (!(swiper.isend && !swiper.params.loop)) {
swiper.slidenext();
}
if (swiper.isend) {
swiper.a11y.notify(params.lastslidemessage);
} else {
swiper.a11y.notify(params.nextslidemessage);
}
}
if (swiper.navigation && swiper.navigation.$prevel && $targetel.is(swiper.navigation.$prevel)) {
if (!(swiper.isbeginning && !swiper.params.loop)) {
swiper.slideprev();
}
if (swiper.isbeginning) {
swiper.a11y.notify(params.firstslidemessage);
} else {
swiper.a11y.notify(params.prevslidemessage);
}
}
if (swiper.pagination && $targetel.is(("." + (swiper.params.pagination.bulletclass)))) {
$targetel[0].click();
}
},
notify: function notify(message) {
var swiper = this;
var notification = swiper.a11y.liveregion;
if (notification.length === 0) {
return;
}
notification.html('');
notification.html(message);
},
updatenavigation: function updatenavigation() {
var swiper = this;
if (swiper.params.loop) {
return;
}
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if ($prevel && $prevel.length > 0) {
if (swiper.isbeginning) {
swiper.a11y.disableel($prevel);
} else {
swiper.a11y.enableel($prevel);
}
}
if ($nextel && $nextel.length > 0) {
if (swiper.isend) {
swiper.a11y.disableel($nextel);
} else {
swiper.a11y.enableel($nextel);
}
}
},
updatepagination: function updatepagination() {
var swiper = this;
var params = swiper.params.a11y;
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.bullets.each(function (bulletindex, bulletel) {
var $bulletel = $(bulletel);
swiper.a11y.makeelfocusable($bulletel);
swiper.a11y.addelrole($bulletel, 'button');
swiper.a11y.addellabel($bulletel, params.paginationbulletmessage.replace(/{{index}}/, $bulletel.index() + 1));
});
}
},
init: function init() {
var swiper = this;
swiper.$el.append(swiper.a11y.liveregion);
// navigation
var params = swiper.params.a11y;
var $nextel;
var $prevel;
if (swiper.navigation && swiper.navigation.$nextel) {
$nextel = swiper.navigation.$nextel;
}
if (swiper.navigation && swiper.navigation.$prevel) {
$prevel = swiper.navigation.$prevel;
}
if ($nextel) {
swiper.a11y.makeelfocusable($nextel);
swiper.a11y.addelrole($nextel, 'button');
swiper.a11y.addellabel($nextel, params.nextslidemessage);
$nextel.on('keydown', swiper.a11y.onenterkey);
}
if ($prevel) {
swiper.a11y.makeelfocusable($prevel);
swiper.a11y.addelrole($prevel, 'button');
swiper.a11y.addellabel($prevel, params.prevslidemessage);
$prevel.on('keydown', swiper.a11y.onenterkey);
}
// pagination
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.$el.on('keydown', ("." + (swiper.params.pagination.bulletclass)), swiper.a11y.onenterkey);
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.a11y.liveregion && swiper.a11y.liveregion.length > 0) {
swiper.a11y.liveregion.remove();
}
var $nextel;
var $prevel;
if (swiper.navigation && swiper.navigation.$nextel) {
$nextel = swiper.navigation.$nextel;
}
if (swiper.navigation && swiper.navigation.$prevel) {
$prevel = swiper.navigation.$prevel;
}
if ($nextel) {
$nextel.off('keydown', swiper.a11y.onenterkey);
}
if ($prevel) {
$prevel.off('keydown', swiper.a11y.onenterkey);
}
// pagination
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.$el.off('keydown', ("." + (swiper.params.pagination.bulletclass)), swiper.a11y.onenterkey);
}
},
};
var a11y = {
name: 'a11y',
params: {
a11y: {
enabled: true,
notificationclass: 'swiper-notification',
prevslidemessage: 'previous slide',
nextslidemessage: 'next slide',
firstslidemessage: 'this is the first slide',
lastslidemessage: 'this is the last slide',
paginationbulletmessage: 'go to slide {{index}}',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
a11y: {
liveregion: $(("")),
},
});
object.keys(a11y).foreach(function (methodname) {
swiper.a11y[methodname] = a11y[methodname].bind(swiper);
});
},
on: {
init: function init() {
var swiper = this;
if (!swiper.params.a11y.enabled) {
return;
}
swiper.a11y.init();
swiper.a11y.updatenavigation();
},
toedge: function toedge() {
var swiper = this;
if (!swiper.params.a11y.enabled) {
return;
}
swiper.a11y.updatenavigation();
},
fromedge: function fromedge() {
var swiper = this;
if (!swiper.params.a11y.enabled) {
return;
}
swiper.a11y.updatenavigation();
},
paginationupdate: function paginationupdate() {
var swiper = this;
if (!swiper.params.a11y.enabled) {
return;
}
swiper.a11y.updatepagination();
},
destroy: function destroy() {
var swiper = this;
if (!swiper.params.a11y.enabled) {
return;
}
swiper.a11y.destroy();
},
},
};
var history = {
init: function init() {
var swiper = this;
if (!swiper.params.history) {
return;
}
if (!win.history || !win.history.pushstate) {
swiper.params.history.enabled = false;
swiper.params.hashnavigation.enabled = true;
return;
}
var history = swiper.history;
history.initialized = true;
history.paths = history.getpathvalues();
if (!history.paths.key && !history.paths.value) {
return;
}
history.scrolltoslide(0, history.paths.value, swiper.params.runcallbacksoninit);
if (!swiper.params.history.replacestate) {
win.addeventlistener('popstate', swiper.history.sethistorypopstate);
}
},
destroy: function destroy() {
var swiper = this;
if (!swiper.params.history.replacestate) {
win.removeeventlistener('popstate', swiper.history.sethistorypopstate);
}
},
sethistorypopstate: function sethistorypopstate() {
var swiper = this;
swiper.history.paths = history.getpathvalues();
swiper.history.scrolltoslide(swiper.params.speed, swiper.history.paths.value, false);
},
getpathvalues: function getpathvalues() {
var patharray = win.location.pathname.slice(1).split('/').filter(function (part) {
return part !== '';
});
var total = patharray.length;
var key = patharray[total - 2];
var value = patharray[total - 1];
return {
key: key,
value: value
};
},
sethistory: function sethistory(key, index) {
var swiper = this;
if (!swiper.history.initialized || !swiper.params.history.enabled) {
return;
}
var slide = swiper.slides.eq(index);
var value = history.slugify(slide.attr('data-history'));
if (!win.location.pathname.includes(key)) {
value = key + "/" + value;
}
var currentstate = win.history.state;
if (currentstate && currentstate.value === value) {
return;
}
if (swiper.params.history.replacestate) {
win.history.replacestate({
value: value
}, null, value);
} else {
win.history.pushstate({
value: value
}, null, value);
}
},
slugify: function slugify(text) {
return text.tostring()
.replace(/\s+/g, '-')
.replace(/[^\w-]+/g, '')
.replace(/--+/g, '-')
.replace(/^-+/, '')
.replace(/-+$/, '');
},
scrolltoslide: function scrolltoslide(speed, value, runcallbacks) {
var swiper = this;
if (value) {
for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
var slide = swiper.slides.eq(i);
var slidehistory = history.slugify(slide.attr('data-history'));
if (slidehistory === value && !slide.hasclass(swiper.params.slideduplicateclass)) {
var index = slide.index();
swiper.slideto(index, speed, runcallbacks);
}
}
} else {
swiper.slideto(0, speed, runcallbacks);
}
},
};
var history$1 = {
name: 'history',
params: {
history: {
enabled: false,
replacestate: false,
key: 'slides',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
history: {
init: history.init.bind(swiper),
sethistory: history.sethistory.bind(swiper),
sethistorypopstate: history.sethistorypopstate.bind(swiper),
scrolltoslide: history.scrolltoslide.bind(swiper),
destroy: history.destroy.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.history.enabled) {
swiper.history.init();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.params.history.enabled) {
swiper.history.destroy();
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.history.initialized) {
swiper.history.sethistory(swiper.params.history.key, swiper.activeindex);
}
},
},
};
var hashnavigation = {
onhashcange: function onhashcange() {
var swiper = this;
var newhash = doc.location.hash.replace('#', '');
var activeslidehash = swiper.slides.eq(swiper.activeindex).attr('data-hash');
if (newhash !== activeslidehash) {
var newindex = swiper.$wrapperel.children(("." + (swiper.params.slideclass) + "[data-hash=\"" + newhash + "\"]")).index();
if (typeof newindex === 'undefined') {
return;
}
swiper.slideto(newindex);
}
},
sethash: function sethash() {
var swiper = this;
if (!swiper.hashnavigation.initialized || !swiper.params.hashnavigation.enabled) {
return;
}
if (swiper.params.hashnavigation.replacestate && win.history && win.history.replacestate) {
win.history.replacestate(null, null, (("#" + (swiper.slides.eq(swiper.activeindex).attr('data-hash'))) || ''));
} else {
var slide = swiper.slides.eq(swiper.activeindex);
var hash = slide.attr('data-hash') || slide.attr('data-history');
doc.location.hash = hash || '';
}
},
init: function init() {
var swiper = this;
if (!swiper.params.hashnavigation.enabled || (swiper.params.history && swiper.params.history.enabled)) {
return;
}
swiper.hashnavigation.initialized = true;
var hash = doc.location.hash.replace('#', '');
if (hash) {
var speed = 0;
for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
var slide = swiper.slides.eq(i);
var slidehash = slide.attr('data-hash') || slide.attr('data-history');
if (slidehash === hash && !slide.hasclass(swiper.params.slideduplicateclass)) {
var index = slide.index();
swiper.slideto(index, speed, swiper.params.runcallbacksoninit, true);
}
}
}
if (swiper.params.hashnavigation.watchstate) {
$(win).on('hashchange', swiper.hashnavigation.onhashcange);
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.params.hashnavigation.watchstate) {
$(win).off('hashchange', swiper.hashnavigation.onhashcange);
}
},
};
var hashnavigation$1 = {
name: 'hash-navigation',
params: {
hashnavigation: {
enabled: false,
replacestate: false,
watchstate: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
hashnavigation: {
initialized: false,
init: hashnavigation.init.bind(swiper),
destroy: hashnavigation.destroy.bind(swiper),
sethash: hashnavigation.sethash.bind(swiper),
onhashcange: hashnavigation.onhashcange.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.hashnavigation.enabled) {
swiper.hashnavigation.init();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.params.hashnavigation.enabled) {
swiper.hashnavigation.destroy();
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.hashnavigation.initialized) {
swiper.hashnavigation.sethash();
}
},
},
};
/* eslint no-underscore-dangle: "off" */
var autoplay = {
run: function run() {
var swiper = this;
var $activeslideel = swiper.slides.eq(swiper.activeindex);
var delay = swiper.params.autoplay.delay;
if ($activeslideel.attr('data-swiper-autoplay')) {
delay = $activeslideel.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
}
cleartimeout(swiper.autoplay.timeout);
swiper.autoplay.timeout = utils.nexttick(function () {
if (swiper.params.autoplay.reversedirection) {
if (swiper.params.loop) {
swiper.loopfix();
swiper.slideprev(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.isbeginning) {
swiper.slideprev(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.params.autoplay.stoponlastslide) {
swiper.slideto(swiper.slides.length - 1, swiper.params.speed, true, true);
swiper.emit('autoplay');
} else {
swiper.autoplay.stop();
}
} else if (swiper.params.loop) {
swiper.loopfix();
swiper.slidenext(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.isend) {
swiper.slidenext(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.params.autoplay.stoponlastslide) {
swiper.slideto(0, swiper.params.speed, true, true);
swiper.emit('autoplay');
} else {
swiper.autoplay.stop();
}
}, delay);
},
start: function start() {
var swiper = this;
if (typeof swiper.autoplay.timeout !== 'undefined') {
return false;
}
if (swiper.autoplay.running) {
return false;
}
swiper.autoplay.running = true;
swiper.emit('autoplaystart');
swiper.autoplay.run();
return true;
},
stop: function stop() {
var swiper = this;
if (!swiper.autoplay.running) {
return false;
}
if (typeof swiper.autoplay.timeout === 'undefined') {
return false;
}
if (swiper.autoplay.timeout) {
cleartimeout(swiper.autoplay.timeout);
swiper.autoplay.timeout = undefined;
}
swiper.autoplay.running = false;
swiper.emit('autoplaystop');
return true;
},
pause: function pause(speed) {
var swiper = this;
if (!swiper.autoplay.running) {
return;
}
if (swiper.autoplay.paused) {
return;
}
if (swiper.autoplay.timeout) {
cleartimeout(swiper.autoplay.timeout);
}
swiper.autoplay.paused = true;
if (speed === 0 || !swiper.params.autoplay.waitfortransition) {
swiper.autoplay.paused = false;
swiper.autoplay.run();
} else {
swiper.$wrapperel[0].addeventlistener('transitionend', swiper.autoplay.ontransitionend);
swiper.$wrapperel[0].addeventlistener('webkittransitionend', swiper.autoplay.ontransitionend);
}
},
};
var autoplay$1 = {
name: 'autoplay',
params: {
autoplay: {
enabled: false,
delay: 3000,
waitfortransition: true,
disableoninteraction: true,
stoponlastslide: false,
reversedirection: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
autoplay: {
running: false,
paused: false,
run: autoplay.run.bind(swiper),
start: autoplay.start.bind(swiper),
stop: autoplay.stop.bind(swiper),
pause: autoplay.pause.bind(swiper),
ontransitionend: function ontransitionend(e) {
if (!swiper || swiper.destroyed || !swiper.$wrapperel) {
return;
}
if (e.target !== this) {
return;
}
swiper.$wrapperel[0].removeeventlistener('transitionend', swiper.autoplay.ontransitionend);
swiper.$wrapperel[0].removeeventlistener('webkittransitionend', swiper.autoplay.ontransitionend);
swiper.autoplay.paused = false;
if (!swiper.autoplay.running) {
swiper.autoplay.stop();
} else {
swiper.autoplay.run();
}
},
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.autoplay.enabled) {
swiper.autoplay.start();
}
},
beforetransitionstart: function beforetransitionstart(speed, internal) {
var swiper = this;
if (swiper.autoplay.running) {
if (internal || !swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.pause(speed);
} else {
swiper.autoplay.stop();
}
}
},
sliderfirstmove: function sliderfirstmove() {
var swiper = this;
if (swiper.autoplay.running) {
if (swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.stop();
} else {
swiper.autoplay.pause();
}
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.autoplay.running) {
swiper.autoplay.stop();
}
},
},
};
var fade = {
settranslate: function settranslate() {
var swiper = this;
var slides = swiper.slides;
for (var i = 0; i < slides.length; i += 1) {
var $slideel = swiper.slides.eq(i);
var offset = $slideel[0].swiperslideoffset;
var tx = -offset;
if (!swiper.params.virtualtranslate) {
tx -= swiper.translate;
}
var ty = 0;
if (!swiper.ishorizontal()) {
ty = tx;
tx = 0;
}
var slideopacity = swiper.params.fadeeffect.crossfade ?
math.max(1 - math.abs($slideel[0].progress), 0) :
1 + math.min(math.max($slideel[0].progress, -1), 0);
$slideel
.css({
opacity: slideopacity,
})
.transform(("translate3d(" + tx + "px, " + ty + "px, 0px)"));
}
},
settransition: function settransition(duration) {
var swiper = this;
var slides = swiper.slides;
var $wrapperel = swiper.$wrapperel;
slides.transition(duration);
if (swiper.params.virtualtranslate && duration !== 0) {
var eventtriggered = false;
slides.transitionend(function () {
if (eventtriggered) {
return;
}
if (!swiper || swiper.destroyed) {
return;
}
eventtriggered = true;
swiper.animating = false;
var triggerevents = ['webkittransitionend', 'transitionend'];
for (var i = 0; i < triggerevents.length; i += 1) {
$wrapperel.trigger(triggerevents[i]);
}
});
}
},
};
var effectfade = {
name: 'effect-fade',
params: {
fadeeffect: {
crossfade: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
fadeeffect: {
settranslate: fade.settranslate.bind(swiper),
settransition: fade.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'fade') {
return;
}
swiper.classnames.push(((swiper.params.containermodifierclass) + "fade"));
var overwriteparams = {
slidesperview: 1,
slidespercolumn: 1,
slidespergroup: 1,
watchslidesprogress: true,
spacebetween: 0,
virtualtranslate: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'fade') {
return;
}
swiper.fadeeffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'fade') {
return;
}
swiper.fadeeffect.settransition(duration);
},
},
};
var cube = {
settranslate: function settranslate() {
var swiper = this;
var $el = swiper.$el;
var $wrapperel = swiper.$wrapperel;
var slides = swiper.slides;
var swiperwidth = swiper.width;
var swiperheight = swiper.height;
var rtl = swiper.rtltranslate;
var swipersize = swiper.size;
var params = swiper.params.cubeeffect;
var ishorizontal = swiper.ishorizontal();
var isvirtual = swiper.virtual && swiper.params.virtual.enabled;
var wrapperrotate = 0;
var $cubeshadowel;
if (params.shadow) {
if (ishorizontal) {
$cubeshadowel = $wrapperel.find('.swiper-cube-shadow');
if ($cubeshadowel.length === 0) {
$cubeshadowel = $('');
$wrapperel.append($cubeshadowel);
}
$cubeshadowel.css({
height: (swiperwidth + "px")
});
} else {
$cubeshadowel = $el.find('.swiper-cube-shadow');
if ($cubeshadowel.length === 0) {
$cubeshadowel = $('');
$el.append($cubeshadowel);
}
}
}
for (var i = 0; i < slides.length; i += 1) {
var $slideel = slides.eq(i);
var slideindex = i;
if (isvirtual) {
slideindex = parseint($slideel.attr('data-swiper-slide-index'), 10);
}
var slideangle = slideindex * 90;
var round = math.floor(slideangle / 360);
if (rtl) {
slideangle = -slideangle;
round = math.floor(-slideangle / 360);
}
var progress = math.max(math.min($slideel[0].progress, 1), -1);
var tx = 0;
var ty = 0;
var tz = 0;
if (slideindex % 4 === 0) {
tx = -round * 4 * swipersize;
tz = 0;
} else if ((slideindex - 1) % 4 === 0) {
tx = 0;
tz = -round * 4 * swipersize;
} else if ((slideindex - 2) % 4 === 0) {
tx = swipersize + (round * 4 * swipersize);
tz = swipersize;
} else if ((slideindex - 3) % 4 === 0) {
tx = -swipersize;
tz = (3 * swipersize) + (swipersize * 4 * round);
}
if (rtl) {
tx = -tx;
}
if (!ishorizontal) {
ty = tx;
tx = 0;
}
var transform = "rotatex(" + (ishorizontal ? 0 : -slideangle) + "deg) rotatey(" + (ishorizontal ? slideangle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
if (progress <= 1 && progress > -1) {
wrapperrotate = (slideindex * 90) + (progress * 90);
if (rtl) {
wrapperrotate = (-slideindex * 90) - (progress * 90);
}
}
$slideel.transform(transform);
if (params.slideshadows) {
// set shadows
var shadowbefore = ishorizontal ? $slideel.find('.swiper-slide-shadow-left') : $slideel.find('.swiper-slide-shadow-top');
var shadowafter = ishorizontal ? $slideel.find('.swiper-slide-shadow-right') : $slideel.find('.swiper-slide-shadow-bottom');
if (shadowbefore.length === 0) {
shadowbefore = $((""));
$slideel.append(shadowbefore);
}
if (shadowafter.length === 0) {
shadowafter = $((""));
$slideel.append(shadowafter);
}
if (shadowbefore.length) {
shadowbefore[0].style.opacity = math.max(-progress, 0);
}
if (shadowafter.length) {
shadowafter[0].style.opacity = math.max(progress, 0);
}
}
}
$wrapperel.css({
'-webkit-transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
'-moz-transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
'-ms-transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
'transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
});
if (params.shadow) {
if (ishorizontal) {
$cubeshadowel.transform(("translate3d(0px, " + ((swiperwidth / 2) + params.shadowoffset) + "px, " + (-swiperwidth / 2) + "px) rotatex(90deg) rotatez(0deg) scale(" + (params.shadowscale) + ")"));
} else {
var shadowangle = math.abs(wrapperrotate) - (math.floor(math.abs(wrapperrotate) / 90) * 90);
var multiplier = 1.5 - (
(math.sin((shadowangle * 2 * math.pi) / 360) / 2) +
(math.cos((shadowangle * 2 * math.pi) / 360) / 2)
);
var scale1 = params.shadowscale;
var scale2 = params.shadowscale / multiplier;
var offset = params.shadowoffset;
$cubeshadowel.transform(("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + ((swiperheight / 2) + offset) + "px, " + (-swiperheight / 2 / scale2) + "px) rotatex(-90deg)"));
}
}
var zfactor = (browser.issafari || browser.isuiwebview) ? (-swipersize / 2) : 0;
$wrapperel
.transform(("translate3d(0px,0," + zfactor + "px) rotatex(" + (swiper.ishorizontal() ? 0 : wrapperrotate) + "deg) rotatey(" + (swiper.ishorizontal() ? -wrapperrotate : 0) + "deg)"));
},
settransition: function settransition(duration) {
var swiper = this;
var $el = swiper.$el;
var slides = swiper.slides;
slides
.transition(duration)
.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
.transition(duration);
if (swiper.params.cubeeffect.shadow && !swiper.ishorizontal()) {
$el.find('.swiper-cube-shadow').transition(duration);
}
},
};
var effectcube = {
name: 'effect-cube',
params: {
cubeeffect: {
slideshadows: true,
shadow: true,
shadowoffset: 20,
shadowscale: 0.94,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
cubeeffect: {
settranslate: cube.settranslate.bind(swiper),
settransition: cube.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'cube') {
return;
}
swiper.classnames.push(((swiper.params.containermodifierclass) + "cube"));
swiper.classnames.push(((swiper.params.containermodifierclass) + "3d"));
var overwriteparams = {
slidesperview: 1,
slidespercolumn: 1,
slidespergroup: 1,
watchslidesprogress: true,
resistanceratio: 0,
spacebetween: 0,
centeredslides: false,
virtualtranslate: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'cube') {
return;
}
swiper.cubeeffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'cube') {
return;
}
swiper.cubeeffect.settransition(duration);
},
},
};
var flip = {
settranslate: function settranslate() {
var swiper = this;
var slides = swiper.slides;
var rtl = swiper.rtltranslate;
for (var i = 0; i < slides.length; i += 1) {
var $slideel = slides.eq(i);
var progress = $slideel[0].progress;
if (swiper.params.flipeffect.limitrotation) {
progress = math.max(math.min($slideel[0].progress, 1), -1);
}
var offset = $slideel[0].swiperslideoffset;
var rotate = -180 * progress;
var rotatey = rotate;
var rotatex = 0;
var tx = -offset;
var ty = 0;
if (!swiper.ishorizontal()) {
ty = tx;
tx = 0;
rotatex = -rotatey;
rotatey = 0;
} else if (rtl) {
rotatey = -rotatey;
}
$slideel[0].style.zindex = -math.abs(math.round(progress)) + slides.length;
if (swiper.params.flipeffect.slideshadows) {
// set shadows
var shadowbefore = swiper.ishorizontal() ? $slideel.find('.swiper-slide-shadow-left') : $slideel.find('.swiper-slide-shadow-top');
var shadowafter = swiper.ishorizontal() ? $slideel.find('.swiper-slide-shadow-right') : $slideel.find('.swiper-slide-shadow-bottom');
if (shadowbefore.length === 0) {
shadowbefore = $((""));
$slideel.append(shadowbefore);
}
if (shadowafter.length === 0) {
shadowafter = $((""));
$slideel.append(shadowafter);
}
if (shadowbefore.length) {
shadowbefore[0].style.opacity = math.max(-progress, 0);
}
if (shadowafter.length) {
shadowafter[0].style.opacity = math.max(progress, 0);
}
}
$slideel
.transform(("translate3d(" + tx + "px, " + ty + "px, 0px) rotatex(" + rotatex + "deg) rotatey(" + rotatey + "deg)"));
}
},
settransition: function settransition(duration) {
var swiper = this;
var slides = swiper.slides;
var activeindex = swiper.activeindex;
var $wrapperel = swiper.$wrapperel;
slides
.transition(duration)
.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
.transition(duration);
if (swiper.params.virtualtranslate && duration !== 0) {
var eventtriggered = false;
// eslint-disable-next-line
slides.eq(activeindex).transitionend(function ontransitionend() {
if (eventtriggered) {
return;
}
if (!swiper || swiper.destroyed) {
return;
}
// if (!$(this).hasclass(swiper.params.slideactiveclass)) return;
eventtriggered = true;
swiper.animating = false;
var triggerevents = ['webkittransitionend', 'transitionend'];
for (var i = 0; i < triggerevents.length; i += 1) {
$wrapperel.trigger(triggerevents[i]);
}
});
}
},
};
var effectflip = {
name: 'effect-flip',
params: {
flipeffect: {
slideshadows: true,
limitrotation: true,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
flipeffect: {
settranslate: flip.settranslate.bind(swiper),
settransition: flip.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'flip') {
return;
}
swiper.classnames.push(((swiper.params.containermodifierclass) + "flip"));
swiper.classnames.push(((swiper.params.containermodifierclass) + "3d"));
var overwriteparams = {
slidesperview: 1,
slidespercolumn: 1,
slidespergroup: 1,
watchslidesprogress: true,
spacebetween: 0,
virtualtranslate: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'flip') {
return;
}
swiper.flipeffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'flip') {
return;
}
swiper.flipeffect.settransition(duration);
},
},
};
var coverflow = {
settranslate: function settranslate() {
var swiper = this;
var swiperwidth = swiper.width;
var swiperheight = swiper.height;
var slides = swiper.slides;
var $wrapperel = swiper.$wrapperel;
var slidessizesgrid = swiper.slidessizesgrid;
var params = swiper.params.coverfloweffect;
var ishorizontal = swiper.ishorizontal();
var transform = swiper.translate;
var center = ishorizontal ? -transform + (swiperwidth / 2) : -transform + (swiperheight / 2);
var rotate = ishorizontal ? params.rotate : -params.rotate;
var translate = params.depth;
// each slide offset from center
for (var i = 0, length = slides.length; i < length; i += 1) {
var $slideel = slides.eq(i);
var slidesize = slidessizesgrid[i];
var slideoffset = $slideel[0].swiperslideoffset;
var offsetmultiplier = ((center - slideoffset - (slidesize / 2)) / slidesize) * params.modifier;
var rotatey = ishorizontal ? rotate * offsetmultiplier : 0;
var rotatex = ishorizontal ? 0 : rotate * offsetmultiplier;
// var rotatez = 0
var translatez = -translate * math.abs(offsetmultiplier);
var translatey = ishorizontal ? 0 : params.stretch * (offsetmultiplier);
var translatex = ishorizontal ? params.stretch * (offsetmultiplier) : 0;
// fix for ultra small values
if (math.abs(translatex) < 0.001) {
translatex = 0;
}
if (math.abs(translatey) < 0.001) {
translatey = 0;
}
if (math.abs(translatez) < 0.001) {
translatez = 0;
}
if (math.abs(rotatey) < 0.001) {
rotatey = 0;
}
if (math.abs(rotatex) < 0.001) {
rotatex = 0;
}
var slidetransform = "translate3d(" + translatex + "px," + translatey + "px," + translatez + "px) rotatex(" + rotatex + "deg) rotatey(" + rotatey + "deg)";
$slideel.transform(slidetransform);
$slideel[0].style.zindex = -math.abs(math.round(offsetmultiplier)) + 1;
if (params.slideshadows) {
// set shadows
var $shadowbeforeel = ishorizontal ? $slideel.find('.swiper-slide-shadow-left') : $slideel.find('.swiper-slide-shadow-top');
var $shadowafterel = ishorizontal ? $slideel.find('.swiper-slide-shadow-right') : $slideel.find('.swiper-slide-shadow-bottom');
if ($shadowbeforeel.length === 0) {
$shadowbeforeel = $((""));
$slideel.append($shadowbeforeel);
}
if ($shadowafterel.length === 0) {
$shadowafterel = $((""));
$slideel.append($shadowafterel);
}
if ($shadowbeforeel.length) {
$shadowbeforeel[0].style.opacity = offsetmultiplier > 0 ? offsetmultiplier : 0;
}
if ($shadowafterel.length) {
$shadowafterel[0].style.opacity = (-offsetmultiplier) > 0 ? -offsetmultiplier : 0;
}
}
}
// set correct perspective for ie10
if (support.pointerevents || support.prefixedpointerevents) {
var ws = $wrapperel[0].style;
ws.perspectiveorigin = center + "px 50%";
}
},
settransition: function settransition(duration) {
var swiper = this;
swiper.slides
.transition(duration)
.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
.transition(duration);
},
};
var effectcoverflow = {
name: 'effect-coverflow',
params: {
coverfloweffect: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideshadows: true,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
coverfloweffect: {
settranslate: coverflow.settranslate.bind(swiper),
settransition: coverflow.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'coverflow') {
return;
}
swiper.classnames.push(((swiper.params.containermodifierclass) + "coverflow"));
swiper.classnames.push(((swiper.params.containermodifierclass) + "3d"));
swiper.params.watchslidesprogress = true;
swiper.originalparams.watchslidesprogress = true;
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'coverflow') {
return;
}
swiper.coverfloweffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'coverflow') {
return;
}
swiper.coverfloweffect.settransition(duration);
},
},
};
var thumbs = {
init: function init() {
var swiper = this;
var ref = swiper.params;
var thumbsparams = ref.thumbs;
var swiperclass = swiper.constructor;
if (thumbsparams.swiper instanceof swiperclass) {
swiper.thumbs.swiper = thumbsparams.swiper;
utils.extend(swiper.thumbs.swiper.originalparams, {
watchslidesprogress: true,
slidetoclickedslide: false,
});
utils.extend(swiper.thumbs.swiper.params, {
watchslidesprogress: true,
slidetoclickedslide: false,
});
} else if (utils.isobject(thumbsparams.swiper)) {
swiper.thumbs.swiper = new swiperclass(utils.extend({}, thumbsparams.swiper, {
watchslidesvisibility: true,
watchslidesprogress: true,
slidetoclickedslide: false,
}));
swiper.thumbs.swipercreated = true;
}
swiper.thumbs.swiper.$el.addclass(swiper.params.thumbs.thumbscontainerclass);
swiper.thumbs.swiper.on('tap', swiper.thumbs.onthumbclick);
},
onthumbclick: function onthumbclick() {
var swiper = this;
var thumbsswiper = swiper.thumbs.swiper;
if (!thumbsswiper) {
return;
}
var clickedindex = thumbsswiper.clickedindex;
var clickedslide = thumbsswiper.clickedslide;
if (clickedslide && $(clickedslide).hasclass(swiper.params.thumbs.slidethumbactiveclass)) {
return;
}
if (typeof clickedindex === 'undefined' || clickedindex === null) {
return;
}
var slidetoindex;
if (thumbsswiper.params.loop) {
slidetoindex = parseint($(thumbsswiper.clickedslide).attr('data-swiper-slide-index'), 10);
} else {
slidetoindex = clickedindex;
}
if (swiper.params.loop) {
var currentindex = swiper.activeindex;
if (swiper.slides.eq(currentindex).hasclass(swiper.params.slideduplicateclass)) {
swiper.loopfix();
// eslint-disable-next-line
swiper._clientleft = swiper.$wrapperel[0].clientleft;
currentindex = swiper.activeindex;
}
var previndex = swiper.slides.eq(currentindex).prevall(("[data-swiper-slide-index=\"" + slidetoindex + "\"]")).eq(0).index();
var nextindex = swiper.slides.eq(currentindex).nextall(("[data-swiper-slide-index=\"" + slidetoindex + "\"]")).eq(0).index();
if (typeof previndex === 'undefined') {
slidetoindex = nextindex;
} else if (typeof nextindex === 'undefined') {
slidetoindex = previndex;
} else if (nextindex - currentindex < currentindex - previndex) {
slidetoindex = nextindex;
} else {
slidetoindex = previndex;
}
}
swiper.slideto(slidetoindex);
},
update: function update(initial) {
var swiper = this;
var thumbsswiper = swiper.thumbs.swiper;
if (!thumbsswiper) {
return;
}
var slidesperview = thumbsswiper.params.slidesperview === 'auto' ?
thumbsswiper.slidesperviewdynamic() :
thumbsswiper.params.slidesperview;
if (swiper.realindex !== thumbsswiper.realindex) {
var currentthumbsindex = thumbsswiper.activeindex;
var newthumbsindex;
if (thumbsswiper.params.loop) {
if (thumbsswiper.slides.eq(currentthumbsindex).hasclass(thumbsswiper.params.slideduplicateclass)) {
thumbsswiper.loopfix();
// eslint-disable-next-line
thumbsswiper._clientleft = thumbsswiper.$wrapperel[0].clientleft;
currentthumbsindex = thumbsswiper.activeindex;
}
// find actual thumbs index to slide to
var prevthumbsindex = thumbsswiper.slides.eq(currentthumbsindex).prevall(("[data-swiper-slide-index=\"" + (swiper.realindex) + "\"]")).eq(0).index();
var nextthumbsindex = thumbsswiper.slides.eq(currentthumbsindex).nextall(("[data-swiper-slide-index=\"" + (swiper.realindex) + "\"]")).eq(0).index();
if (typeof prevthumbsindex === 'undefined') {
newthumbsindex = nextthumbsindex;
} else if (typeof nextthumbsindex === 'undefined') {
newthumbsindex = prevthumbsindex;
} else if (nextthumbsindex - currentthumbsindex === currentthumbsindex - prevthumbsindex) {
newthumbsindex = currentthumbsindex;
} else if (nextthumbsindex - currentthumbsindex < currentthumbsindex - prevthumbsindex) {
newthumbsindex = nextthumbsindex;
} else {
newthumbsindex = prevthumbsindex;
}
} else {
newthumbsindex = swiper.realindex;
}
if (thumbsswiper.visibleslidesindexes && thumbsswiper.visibleslidesindexes.indexof(newthumbsindex) < 0) {
if (thumbsswiper.params.centeredslides) {
if (newthumbsindex > currentthumbsindex) {
newthumbsindex = newthumbsindex - math.floor(slidesperview / 2) + 1;
} else {
newthumbsindex = newthumbsindex + math.floor(slidesperview / 2) - 1;
}
} else if (newthumbsindex > currentthumbsindex) {
newthumbsindex = newthumbsindex - slidesperview + 1;
}
thumbsswiper.slideto(newthumbsindex, initial ? 0 : undefined);
}
}
// activate thumbs
var thumbstoactivate = 1;
var thumbactiveclass = swiper.params.thumbs.slidethumbactiveclass;
if (swiper.params.slidesperview > 1 && !swiper.params.centeredslides) {
thumbstoactivate = swiper.params.slidesperview;
}
thumbsswiper.slides.removeclass(thumbactiveclass);
if (thumbsswiper.params.loop || thumbsswiper.params.virtual) {
for (var i = 0; i < thumbstoactivate; i += 1) {
thumbsswiper.$wrapperel.children(("[data-swiper-slide-index=\"" + (swiper.realindex + i) + "\"]")).addclass(thumbactiveclass);
}
} else {
for (var i$1 = 0; i$1 < thumbstoactivate; i$1 += 1) {
thumbsswiper.slides.eq(swiper.realindex + i$1).addclass(thumbactiveclass);
}
}
},
};
var thumbs$1 = {
name: 'thumbs',
params: {
thumbs: {
swiper: null,
slidethumbactiveclass: 'swiper-slide-thumb-active',
thumbscontainerclass: 'swiper-container-thumbs',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
thumbs: {
swiper: null,
init: thumbs.init.bind(swiper),
update: thumbs.update.bind(swiper),
onthumbclick: thumbs.onthumbclick.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
var ref = swiper.params;
var thumbs = ref.thumbs;
if (!thumbs || !thumbs.swiper) {
return;
}
swiper.thumbs.init();
swiper.thumbs.update(true);
},
slidechange: function slidechange() {
var swiper = this;
if (!swiper.thumbs.swiper) {
return;
}
swiper.thumbs.update();
},
update: function update() {
var swiper = this;
if (!swiper.thumbs.swiper) {
return;
}
swiper.thumbs.update();
},
resize: function resize() {
var swiper = this;
if (!swiper.thumbs.swiper) {
return;
}
swiper.thumbs.update();
},
observerupdate: function observerupdate() {
var swiper = this;
if (!swiper.thumbs.swiper) {
return;
}
swiper.thumbs.update();
},
settransition: function settransition(duration) {
var swiper = this;
var thumbsswiper = swiper.thumbs.swiper;
if (!thumbsswiper) {
return;
}
thumbsswiper.settransition(duration);
},
beforedestroy: function beforedestroy() {
var swiper = this;
var thumbsswiper = swiper.thumbs.swiper;
if (!thumbsswiper) {
return;
}
if (swiper.thumbs.swipercreated && thumbsswiper) {
thumbsswiper.destroy();
}
},
},
};
// swiper class
var components = [
device$1,
support$1,
browser$1,
resize,
observer$1,
virtual$1,
keyboard$1,
mousewheel$1,
navigation$1,
pagination$1,
scrollbar$1,
parallax$1,
zoom$1,
lazy$1,
controller$1,
a11y,
history$1,
hashnavigation$1,
autoplay$1,
effectfade,
effectcube,
effectflip,
effectcoverflow,
thumbs$1
];
if (typeof swiper.use === 'undefined') {
swiper.use = swiper.class.use;
swiper.installmodule = swiper.class.installmodule;
}
swiper.use(components);
return swiper;
}));