/**
* swiper 6.6.2
* most modern mobile touch slider and framework with hardware accelerated transitions
*
* copyright 2014-2021 vladimir kharlampidi
*
* released under the mit license
*
* released on: may 19, 2021
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalthis !== 'undefined' ? globalthis : global || self, global.swiper = factory());
}(this, (function () { 'use strict';
function _defineproperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
object.defineproperty(target, descriptor.key, descriptor);
}
}
function _createclass(constructor, protoprops, staticprops) {
if (protoprops) _defineproperties(constructor.prototype, protoprops);
if (staticprops) _defineproperties(constructor, staticprops);
return constructor;
}
function _extends() {
_extends = object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (object.prototype.hasownproperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/**
* ssr window 3.0.0
* better handling for window object in ssr environment
* https://github.com/nolimits4web/ssr-window
*
* copyright 2020, vladimir kharlampidi
*
* licensed under mit
*
* released on: november 9, 2020
*/
/* eslint-disable no-param-reassign */
function isobject$1(obj) {
return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === object;
}
function extend$1(target, src) {
if (target === void 0) {
target = {};
}
if (src === void 0) {
src = {};
}
object.keys(src).foreach(function (key) {
if (typeof target[key] === 'undefined') target[key] = src[key];else if (isobject$1(src[key]) && isobject$1(target[key]) && object.keys(src[key]).length > 0) {
extend$1(target[key], src[key]);
}
});
}
var ssrdocument = {
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 [];
}
};
},
createelementns: function createelementns() {
return {};
},
importnode: function importnode() {
return null;
},
location: {
hash: '',
host: '',
hostname: '',
href: '',
origin: '',
pathname: '',
protocol: '',
search: ''
}
};
function getdocument() {
var doc = typeof document !== 'undefined' ? document : {};
extend$1(doc, ssrdocument);
return doc;
}
var ssrwindow = {
document: ssrdocument,
navigator: {
useragent: ''
},
location: {
hash: '',
host: '',
hostname: '',
href: '',
origin: '',
pathname: '',
protocol: '',
search: ''
},
history: {
replacestate: function replacestate() {},
pushstate: function pushstate() {},
go: function go() {},
back: function back() {}
},
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() {},
matchmedia: function matchmedia() {
return {};
},
requestanimationframe: function requestanimationframe(callback) {
if (typeof settimeout === 'undefined') {
callback();
return null;
}
return settimeout(callback, 0);
},
cancelanimationframe: function cancelanimationframe(id) {
if (typeof settimeout === 'undefined') {
return;
}
cleartimeout(id);
}
};
function getwindow() {
var win = typeof window !== 'undefined' ? window : {};
extend$1(win, ssrwindow);
return win;
}
/**
* dom7 3.0.0
* minimalistic javascript library for dom manipulation, with a jquery-compatible api
*
* copyright 2020, vladimir kharlampidi
*
* licensed under mit
*
* released on: november 9, 2020
*/
function _inheritsloose(subclass, superclass) {
subclass.prototype = object.create(superclass.prototype);
subclass.prototype.constructor = subclass;
subclass.__proto__ = superclass;
}
function _getprototypeof(o) {
_getprototypeof = object.setprototypeof ? object.getprototypeof : function _getprototypeof(o) {
return o.__proto__ || object.getprototypeof(o);
};
return _getprototypeof(o);
}
function _setprototypeof(o, p) {
_setprototypeof = object.setprototypeof || function _setprototypeof(o, p) {
o.__proto__ = p;
return o;
};
return _setprototypeof(o, p);
}
function _isnativereflectconstruct() {
if (typeof reflect === "undefined" || !reflect.construct) return false;
if (reflect.construct.sham) return false;
if (typeof proxy === "function") return true;
try {
date.prototype.tostring.call(reflect.construct(date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(parent, args, class) {
if (_isnativereflectconstruct()) {
_construct = reflect.construct;
} else {
_construct = function _construct(parent, args, class) {
var a = [null];
a.push.apply(a, args);
var constructor = function.bind.apply(parent, a);
var instance = new constructor();
if (class) _setprototypeof(instance, class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isnativefunction(fn) {
return function.tostring.call(fn).indexof("[native code]") !== -1;
}
function _wrapnativesuper(class) {
var _cache = typeof map === "function" ? new map() : undefined;
_wrapnativesuper = function _wrapnativesuper(class) {
if (class === null || !_isnativefunction(class)) return class;
if (typeof class !== "function") {
throw new typeerror("super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(class)) return _cache.get(class);
_cache.set(class, wrapper);
}
function wrapper() {
return _construct(class, arguments, _getprototypeof(this).constructor);
}
wrapper.prototype = object.create(class.prototype, {
constructor: {
value: wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setprototypeof(wrapper, class);
};
return _wrapnativesuper(class);
}
function _assertthisinitialized(self) {
if (self === void 0) {
throw new referenceerror("this hasn't been initialised - super() hasn't been called");
}
return self;
}
/* eslint-disable no-proto */
function makereactive(obj) {
var proto = obj.__proto__;
object.defineproperty(obj, '__proto__', {
get: function get() {
return proto;
},
set: function set(value) {
proto.__proto__ = value;
}
});
}
var dom7 = /*#__pure__*/function (_array) {
_inheritsloose(dom7, _array);
function dom7(items) {
var _this;
_this = _array.call.apply(_array, [this].concat(items)) || this;
makereactive(_assertthisinitialized(_this));
return _this;
}
return dom7;
}( /*#__pure__*/_wrapnativesuper(array));
function arrayflat(arr) {
if (arr === void 0) {
arr = [];
}
var res = [];
arr.foreach(function (el) {
if (array.isarray(el)) {
res.push.apply(res, arrayflat(el));
} else {
res.push(el);
}
});
return res;
}
function arrayfilter(arr, callback) {
return array.prototype.filter.call(arr, callback);
}
function arrayunique(arr) {
var uniquearray = [];
for (var i = 0; i < arr.length; i += 1) {
if (uniquearray.indexof(arr[i]) === -1) uniquearray.push(arr[i]);
}
return uniquearray;
}
function qsa(selector, context) {
if (typeof selector !== 'string') {
return [selector];
}
var a = [];
var res = context.queryselectorall(selector);
for (var i = 0; i < res.length; i += 1) {
a.push(res[i]);
}
return a;
}
function $(selector, context) {
var window = getwindow();
var document = getdocument();
var arr = [];
if (!context && selector instanceof dom7) {
return selector;
}
if (!selector) {
return new dom7(arr);
}
if (typeof selector === 'string') {
var html = selector.trim();
if (html.indexof('<') >= 0 && html.indexof('>') >= 0) {
var tocreate = 'div';
if (html.indexof('
0;
}).length > 0;
}
function attr(attrs, value) {
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.length === 2) {
// string
this[i].setattribute(attrs, value);
} else {
// object
for (var attrname in attrs) {
this[i][attrname] = attrs[attrname];
this[i].setattribute(attrname, attrs[attrname]);
}
}
}
return this;
}
function removeattr(attr) {
for (var i = 0; i < this.length; i += 1) {
this[i].removeattribute(attr);
}
return this;
}
function transform(transform) {
for (var i = 0; i < this.length; i += 1) {
this[i].style.transform = transform;
}
return this;
}
function transition$1(duration) {
for (var i = 0; i < this.length; i += 1) {
this[i].style.transitionduration = typeof duration !== 'string' ? duration + "ms" : duration;
}
return this;
}
function on() {
for (var _len5 = arguments.length, args = new array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
var eventtype = args[0],
targetselector = args[1],
listener = args[2],
capture = args[3];
if (typeof args[1] === 'function') {
eventtype = args[0];
listener = args[1];
capture = args[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 = events[j];
if (!el.dom7livelisteners) el.dom7livelisteners = {};
if (!el.dom7livelisteners[_event]) el.dom7livelisteners[_event] = [];
el.dom7livelisteners[_event].push({
listener: listener,
proxylistener: handleliveevent
});
el.addeventlistener(_event, handleliveevent, capture);
}
}
}
return this;
}
function off() {
for (var _len6 = arguments.length, args = new array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
var eventtype = args[0],
targetselector = args[1],
listener = args[2],
capture = args[3];
if (typeof args[1] === 'function') {
eventtype = args[0];
listener = args[1];
capture = args[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 window = getwindow();
for (var _len9 = arguments.length, args = new array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}
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];
if (window.customevent) {
var evt = new window.customevent(event, {
detail: eventdata,
bubbles: true,
cancelable: true
});
el.dom7eventdata = args.filter(function (data, dataindex) {
return dataindex > 0;
});
el.dispatchevent(evt);
el.dom7eventdata = [];
delete el.dom7eventdata;
}
}
}
return this;
}
function transitionend$1(callback) {
var dom = this;
function firecallback(e) {
if (e.target !== this) return;
callback.call(this, e);
dom.off('transitionend', firecallback);
}
if (callback) {
dom.on('transitionend', firecallback);
}
return this;
}
function outerwidth(includemargins) {
if (this.length > 0) {
if (includemargins) {
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) {
var _styles2 = this.styles();
return this[0].offsetheight + parsefloat(_styles2.getpropertyvalue('margin-top')) + parsefloat(_styles2.getpropertyvalue('margin-bottom'));
}
return this[0].offsetheight;
}
return null;
}
function offset() {
if (this.length > 0) {
var window = getwindow();
var document = getdocument();
var el = this[0];
var box = el.getboundingclientrect();
var body = document.body;
var clienttop = el.clienttop || body.clienttop || 0;
var clientleft = el.clientleft || body.clientleft || 0;
var scrolltop = el === window ? window.scrolly : el.scrolltop;
var scrollleft = el === window ? window.scrollx : el.scrollleft;
return {
top: box.top + scrolltop - clienttop,
left: box.left + scrollleft - clientleft
};
}
return null;
}
function styles() {
var window = getwindow();
if (this[0]) return window.getcomputedstyle(this[0], null);
return {};
}
function css(props, value) {
var window = getwindow();
var i;
if (arguments.length === 1) {
if (typeof props === 'string') {
// .css('width')
if (this[0]) return window.getcomputedstyle(this[0], null).getpropertyvalue(props);
} else {
// .css({ width: '100px' })
for (i = 0; i < this.length; i += 1) {
for (var _prop in props) {
this[i].style[_prop] = props[_prop];
}
}
return this;
}
}
if (arguments.length === 2 && typeof props === 'string') {
// .css('width', '100px')
for (i = 0; i < this.length; i += 1) {
this[i].style[props] = value;
}
return this;
}
return this;
}
function each(callback) {
if (!callback) return this;
this.foreach(function (el, index) {
callback.apply(el, [el, index]);
});
return this;
}
function filter(callback) {
var result = arrayfilter(this, callback);
return $(result);
}
function html(html) {
if (typeof html === 'undefined') {
return this[0] ? this[0].innerhtml : null;
}
for (var i = 0; i < this.length; i += 1) {
this[i].innerhtml = html;
}
return this;
}
function text(text) {
if (typeof text === 'undefined') {
return this[0] ? this[0].textcontent.trim() : null;
}
for (var i = 0; i < this.length; i += 1) {
this[i].textcontent = text;
}
return this;
}
function is(selector) {
var window = getwindow();
var document = getdocument();
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);
if (el.webkitmatchesselector) return el.webkitmatchesselector(selector);
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;
}
if (selector === document) {
return el === document;
}
if (selector === window) {
return el === window;
}
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;
}
function eq(index) {
if (typeof index === 'undefined') return this;
var length = this.length;
if (index > length - 1) {
return $([]);
}
if (index < 0) {
var returnindex = length + index;
if (returnindex < 0) return $([]);
return $([this[returnindex]]);
}
return $([this[index]]);
}
function append() {
var newchild;
var document = getdocument();
for (var k = 0; k < arguments.length; k += 1) {
newchild = k < 0 || arguments.length <= k ? undefined : arguments[k];
for (var i = 0; i < this.length; i += 1) {
if (typeof newchild === 'string') {
var tempdiv = document.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 document = getdocument();
var i;
var j;
for (i = 0; i < this.length; i += 1) {
if (typeof newchild === 'string') {
var tempdiv = document.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 $([this[0].nextelementsibling]);
}
return $([]);
}
if (this[0].nextelementsibling) return $([this[0].nextelementsibling]);
return $([]);
}
return $([]);
}
function nextall(selector) {
var nextels = [];
var el = this[0];
if (!el) return $([]);
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 $(nextels);
}
function prev(selector) {
if (this.length > 0) {
var el = this[0];
if (selector) {
if (el.previouselementsibling && $(el.previouselementsibling).is(selector)) {
return $([el.previouselementsibling]);
}
return $([]);
}
if (el.previouselementsibling) return $([el.previouselementsibling]);
return $([]);
}
return $([]);
}
function prevall(selector) {
var prevels = [];
var el = this[0];
if (!el) return $([]);
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 $(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 $(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 $(parents);
}
function closest(selector) {
var closest = this; // eslint-disable-line
if (typeof selector === 'undefined') {
return $([]);
}
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) {
try {
var found = this[i].queryselectorall(selector);
} catch (err) {
console.log(selector);
}
for (var j = 0; j < found.length; j += 1) {
foundelements.push(found[j]);
}
}
return $(foundelements);
}
function children(selector) {
var children = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
var childnodes = this[i].children;
for (var j = 0; j < childnodes.length; j += 1) {
if (!selector || $(childnodes[j]).is(selector)) {
children.push(childnodes[j]);
}
}
}
return $(children);
}
function remove() {
for (var i = 0; i < this.length; i += 1) {
if (this[i].parentnode) this[i].parentnode.removechild(this[i]);
}
return this;
}
var methods = {
addclass: addclass,
removeclass: removeclass,
hasclass: hasclass,
toggleclass: toggleclass,
attr: attr,
removeattr: removeattr,
transform: transform,
transition: transition$1,
on: on,
off: off,
trigger: trigger,
transitionend: transitionend$1,
outerwidth: outerwidth,
outerheight: outerheight,
styles: styles,
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,
filter: filter,
remove: remove
};
object.keys(methods).foreach(function (methodname) {
object.defineproperty($.fn, methodname, {
value: methods[methodname],
writable: true
});
});
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
}
});
}
function nexttick(callback, delay) {
if (delay === void 0) {
delay = 0;
}
return settimeout(callback, delay);
}
function now() {
return date.now();
}
function getcomputedstyle$1(el) {
var window = getwindow();
var style;
if (window.getcomputedstyle) {
style = window.getcomputedstyle(el, null);
}
if (!style && el.currentstyle) {
style = el.currentstyle;
}
if (!style) {
style = el.style;
}
return style;
}
function gettranslate(el, axis) {
if (axis === void 0) {
axis = 'x';
}
var window = getwindow();
var matrix;
var curtransform;
var transformmatrix;
var curstyle = getcomputedstyle$1(el);
if (window.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 window.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 (window.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 (window.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;
}
function isobject(o) {
return typeof o === 'object' && o !== null && o.constructor && object.prototype.tostring.call(o).slice(8, -1) === 'object';
}
function extend() {
var to = object(arguments.length <= 0 ? undefined : arguments[0]);
var noextend = ['__proto__', 'constructor', 'prototype'];
for (var i = 1; i < arguments.length; i += 1) {
var nextsource = i < 0 || arguments.length <= i ? undefined : arguments[i];
if (nextsource !== undefined && nextsource !== null) {
var keysarray = object.keys(object(nextsource)).filter(function (key) {
return noextend.indexof(key) < 0;
});
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 (isobject(to[nextkey]) && isobject(nextsource[nextkey])) {
if (nextsource[nextkey].__swiper__) {
to[nextkey] = nextsource[nextkey];
} else {
extend(to[nextkey], nextsource[nextkey]);
}
} else if (!isobject(to[nextkey]) && isobject(nextsource[nextkey])) {
to[nextkey] = {};
if (nextsource[nextkey].__swiper__) {
to[nextkey] = nextsource[nextkey];
} else {
extend(to[nextkey], nextsource[nextkey]);
}
} else {
to[nextkey] = nextsource[nextkey];
}
}
}
}
}
return to;
}
function bindmodulemethods(instance, obj) {
object.keys(obj).foreach(function (key) {
if (isobject(obj[key])) {
object.keys(obj[key]).foreach(function (subkey) {
if (typeof obj[key][subkey] === 'function') {
obj[key][subkey] = obj[key][subkey].bind(instance);
}
});
}
instance[key] = obj[key];
});
}
function classestoselector(classes) {
if (classes === void 0) {
classes = '';
}
return "." + classes.trim().replace(/([\.:\/])/g, '\\$1') // eslint-disable-line
.replace(/ /g, '.');
}
var support;
function calcsupport() {
var window = getwindow();
var document = getdocument();
return {
touch: !!('ontouchstart' in window || window.documenttouch && document instanceof window.documenttouch),
pointerevents: !!window.pointerevent && 'maxtouchpoints' in window.navigator && window.navigator.maxtouchpoints >= 0,
observer: function checkobserver() {
return 'mutationobserver' in window || 'webkitmutationobserver' in window;
}(),
passivelistener: function checkpassivelistener() {
var supportspassive = false;
try {
var opts = object.defineproperty({}, 'passive', {
// eslint-disable-next-line
get: function get() {
supportspassive = true;
}
});
window.addeventlistener('testpassivelistener', null, opts);
} catch (e) {// no support
}
return supportspassive;
}(),
gestures: function checkgestures() {
return 'ongesturestart' in window;
}()
};
}
function getsupport() {
if (!support) {
support = calcsupport();
}
return support;
}
var device;
function calcdevice(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
useragent = _ref.useragent;
var support = getsupport();
var window = getwindow();
var platform = window.navigator.platform;
var ua = useragent || window.navigator.useragent;
var device = {
ios: false,
android: false
};
var screenwidth = window.screen.width;
var screenheight = window.screen.height;
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_]+)/);
var windows = platform === 'win32';
var macos = platform === 'macintel'; // ipados 13 fix
var ipadscreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
if (!ipad && macos && support.touch && ipadscreens.indexof(screenwidth + "x" + screenheight) >= 0) {
ipad = ua.match(/(version)\/([\d.]+)/);
if (!ipad) ipad = [0, 1, '13_0_0'];
macos = false;
} // android
if (android && !windows) {
device.os = 'android';
device.android = true;
}
if (ipad || iphone || ipod) {
device.os = 'ios';
device.ios = true;
} // export object
return device;
}
function getdevice(overrides) {
if (overrides === void 0) {
overrides = {};
}
if (!device) {
device = calcdevice(overrides);
}
return device;
}
var browser;
function calcbrowser() {
var window = getwindow();
function issafari() {
var ua = window.navigator.useragent.tolowercase();
return ua.indexof('safari') >= 0 && ua.indexof('chrome') < 0 && ua.indexof('android') < 0;
}
return {
isedge: !!window.navigator.useragent.match(/edge/g),
issafari: issafari(),
iswebview: /(iphone|ipod|ipad).*applewebkit(?!.*safari)/i.test(window.navigator.useragent)
};
}
function getbrowser() {
if (!browser) {
browser = calcbrowser();
}
return browser;
}
var supportsresizeobserver = function supportsresizeobserver() {
var window = getwindow();
return typeof window.resizeobserver !== 'undefined';
};
var resize = {
name: 'resize',
create: function create() {
var swiper = this;
extend(swiper, {
resize: {
observer: null,
createobserver: function createobserver() {
if (!swiper || swiper.destroyed || !swiper.initialized) return;
swiper.resize.observer = new resizeobserver(function (entries) {
var width = swiper.width,
height = swiper.height;
var newwidth = width;
var newheight = height;
entries.foreach(function (_ref) {
var contentboxsize = _ref.contentboxsize,
contentrect = _ref.contentrect,
target = _ref.target;
if (target && target !== swiper.el) return;
newwidth = contentrect ? contentrect.width : (contentboxsize[0] || contentboxsize).inlinesize;
newheight = contentrect ? contentrect.height : (contentboxsize[0] || contentboxsize).blocksize;
});
if (newwidth !== width || newheight !== height) {
swiper.resize.resizehandler();
}
});
swiper.resize.observer.observe(swiper.el);
},
removeobserver: function removeobserver() {
if (swiper.resize.observer && swiper.resize.observer.unobserve && swiper.el) {
swiper.resize.observer.unobserve(swiper.el);
swiper.resize.observer = null;
}
},
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(swiper) {
var window = getwindow();
if (swiper.params.resizeobserver && supportsresizeobserver()) {
swiper.resize.createobserver();
return;
} // emit resize
window.addeventlistener('resize', swiper.resize.resizehandler); // emit orientationchange
window.addeventlistener('orientationchange', swiper.resize.orientationchangehandler);
},
destroy: function destroy(swiper) {
var window = getwindow();
swiper.resize.removeobserver();
window.removeeventlistener('resize', swiper.resize.resizehandler);
window.removeeventlistener('orientationchange', swiper.resize.orientationchangehandler);
}
}
};
var observer = {
attach: function attach(target, options) {
if (options === void 0) {
options = {};
}
var window = getwindow();
var swiper = this;
var observerfunc = window.mutationobserver || window.webkitmutationobserver;
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 (window.requestanimationframe) {
window.requestanimationframe(observerupdate);
} else {
window.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 (!swiper.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;
bindmodulemethods(swiper, {
observer: _extends({}, observer, {
observers: []
})
});
},
on: {
init: function init(swiper) {
swiper.observer.init();
},
destroy: function destroy(swiper) {
swiper.observer.destroy();
}
}
};
var modular = {
useparams: function useparams(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) {
extend(instanceparams, module.params);
}
});
},
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] || {}; // 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);
}
});
}
};
/* eslint-disable no-underscore-dangle */
var eventsemitter = {
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;
},
once: function once(events, handler, priority) {
var self = this;
if (typeof handler !== 'function') return self;
function oncehandler() {
self.off(events, oncehandler);
if (oncehandler.__emitterproxy) {
delete oncehandler.__emitterproxy;
}
for (var _len = arguments.length, args = new array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
handler.apply(self, args);
}
oncehandler.__emitterproxy = handler;
return self.on(events, oncehandler, priority);
},
onany: function onany(handler, priority) {
var self = this;
if (typeof handler !== 'function') return self;
var method = priority ? 'unshift' : 'push';
if (self.eventsanylisteners.indexof(handler) < 0) {
self.eventsanylisteners[method](handler);
}
return self;
},
offany: function offany(handler) {
var self = this;
if (!self.eventsanylisteners) return self;
var index = self.eventsanylisteners.indexof(handler);
if (index >= 0) {
self.eventsanylisteners.splice(index, 1);
}
return self;
},
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].foreach(function (eventhandler, index) {
if (eventhandler === handler || eventhandler.__emitterproxy && eventhandler.__emitterproxy === handler) {
self.eventslisteners[event].splice(index, 1);
}
});
}
});
return self;
},
emit: function emit() {
var self = this;
if (!self.eventslisteners) return self;
var events;
var data;
var context;
for (var _len2 = arguments.length, args = new array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
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;
}
data.unshift(context);
var eventsarray = array.isarray(events) ? events : events.split(' ');
eventsarray.foreach(function (event) {
if (self.eventsanylisteners && self.eventsanylisteners.length) {
self.eventsanylisteners.foreach(function (eventhandler) {
eventhandler.apply(context, [event].concat(data));
});
}
if (self.eventslisteners && self.eventslisteners[event]) {
self.eventslisteners[event].foreach(function (eventhandler) {
eventhandler.apply(context, data);
});
}
});
return self;
}
};
function updatesize() {
var swiper = this;
var width;
var height;
var $el = swiper.$el;
if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
width = swiper.params.width;
} else {
width = $el[0].clientwidth;
}
if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
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') || 0, 10) - parseint($el.css('padding-right') || 0, 10);
height = height - parseint($el.css('padding-top') || 0, 10) - parseint($el.css('padding-bottom') || 0, 10);
if (number.isnan(width)) width = 0;
if (number.isnan(height)) height = 0;
extend(swiper, {
width: width,
height: height,
size: swiper.ishorizontal() ? width : height
});
}
function updateslides() {
var swiper = this;
function getdirectionlabel(property) {
if (swiper.ishorizontal()) {
return property;
} // prettier-ignore
return {
'width': 'height',
'margin-top': 'margin-left',
'margin-bottom ': 'margin-right',
'margin-left': 'margin-top',
'margin-right': 'margin-bottom',
'padding-left': 'padding-top',
'padding-right': 'padding-bottom',
'marginright': 'marginbottom'
}[property];
}
function getdirectionpropertyvalue(node, label) {
return parsefloat(node.getpropertyvalue(getdirectionlabel(label)) || 0);
}
var params = swiper.params;
var $wrapperel = swiper.$wrapperel,
swipersize = swiper.size,
rtl = swiper.rtltranslate,
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.slidesgrid.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 === 'row' && params.slidespergroup > 1) {
var groupindex = math.floor(i / (params.slidespergroup * params.slidespercolumn));
var slideindexingroup = i - params.slidespercolumn * params.slidespergroup * groupindex;
var columnsingroup = groupindex === 0 ? params.slidespergroup : math.min(math.ceil((slideslength - groupindex * slidespercolumn * params.slidespergroup) / slidespercolumn), params.slidespergroup);
row = math.floor(slideindexingroup / columnsingroup);
column = slideindexingroup - row * columnsingroup + groupindex * params.slidespergroup;
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 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 {
row = math.floor(i / slidesperrow);
column = i - row * slidesperrow;
}
slide.css(getdirectionlabel('margin-top'), row !== 0 && params.spacebetween && params.spacebetween + "px");
}
if (slide.css('display') === 'none') continue; // eslint-disable-line
if (params.slidesperview === 'auto') {
var slidestyles = getcomputedstyle(slide[0]);
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
var width = getdirectionpropertyvalue(slidestyles, 'width');
var paddingleft = getdirectionpropertyvalue(slidestyles, 'padding-left');
var paddingright = getdirectionpropertyvalue(slidestyles, 'padding-right');
var marginleft = getdirectionpropertyvalue(slidestyles, 'margin-left');
var marginright = getdirectionpropertyvalue(slidestyles, 'margin-right');
var boxsizing = slidestyles.getpropertyvalue('box-sizing');
if (boxsizing && boxsizing === 'border-box') {
slidesize = width + marginleft + marginright;
} else {
var _slide$ = slide[0],
clientwidth = _slide$.clientwidth,
offsetwidth = _slide$.offsetwidth;
slidesize = width + paddingleft + paddingright + marginleft + marginright + (offsetwidth - clientwidth);
}
}
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]) {
slides[i].style[getdirectionlabel('width')] = 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 - math.min(swiper.params.slidespergroupskip, index)) % swiper.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 (params.setwrappersize) {
var _$wrapperel$css;
$wrapperel.css((_$wrapperel$css = {}, _$wrapperel$css[getdirectionlabel('width')] = swiper.virtualsize + params.spacebetween + "px", _$wrapperel$css));
}
if (params.slidespercolumn > 1) {
var _$wrapperel$css2;
swiper.virtualsize = (slidesize + params.spacebetween) * slidesnumbereventorows;
swiper.virtualsize = math.ceil(swiper.virtualsize / params.slidespercolumn) - params.spacebetween;
$wrapperel.css((_$wrapperel$css2 = {}, _$wrapperel$css2[getdirectionlabel('width')] = swiper.virtualsize + params.spacebetween + "px", _$wrapperel$css2));
if (params.centeredslides) {
newslidesgrid = [];
for (var _i = 0; _i < snapgrid.length; _i += 1) {
var slidesgriditem = snapgrid[_i];
if (params.roundlengths) slidesgriditem = math.floor(slidesgriditem);
if (snapgrid[_i] < swiper.virtualsize + snapgrid[0]) newslidesgrid.push(slidesgriditem);
}
snapgrid = newslidesgrid;
}
} // remove last grid elements depending on width
if (!params.centeredslides) {
newslidesgrid = [];
for (var _i2 = 0; _i2 < snapgrid.length; _i2 += 1) {
var _slidesgriditem = snapgrid[_i2];
if (params.roundlengths) _slidesgriditem = math.floor(_slidesgriditem);
if (snapgrid[_i2] <= swiper.virtualsize - swipersize) {
newslidesgrid.push(_slidesgriditem);
}
}
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) {
var _slides$filter$css;
var key = swiper.ishorizontal() && rtl ? 'marginleft' : getdirectionlabel('marginright');
slides.filter(function (_, slideindex) {
if (!params.cssmode) return true;
if (slideindex === slides.length - 1) {
return false;
}
return true;
}).css((_slides$filter$css = {}, _slides$filter$css[key] = spacebetween + "px", _slides$filter$css));
}
if (params.centeredslides && params.centeredslidesbounds) {
var allslidessize = 0;
slidessizesgrid.foreach(function (slidesizevalue) {
allslidessize += slidesizevalue + (params.spacebetween ? params.spacebetween : 0);
});
allslidessize -= params.spacebetween;
var maxsnap = allslidessize - swipersize;
snapgrid = snapgrid.map(function (snap) {
if (snap < 0) return -offsetbefore;
if (snap > maxsnap) return maxsnap + offsetafter;
return snap;
});
}
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;
});
}
}
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 isvirtual = swiper.virtual && swiper.params.virtual.enabled;
var newheight = 0;
var i;
if (typeof speed === 'number') {
swiper.settransition(speed);
} else if (speed === true) {
swiper.settransition(swiper.params.speed);
}
var getslidebyindex = function getslidebyindex(index) {
if (isvirtual) {
return swiper.slides.filter(function (el) {
return parseint(el.getattribute('data-swiper-slide-index'), 10) === index;
})[0];
}
return swiper.slides.eq(index)[0];
}; // find slides currently in view
if (swiper.params.slidesperview !== 'auto' && swiper.params.slidesperview > 1) {
if (swiper.params.centeredslides) {
swiper.visibleslides.each(function (slide) {
activeslides.push(slide);
});
} else {
for (i = 0; i < math.ceil(swiper.params.slidesperview); i += 1) {
var index = swiper.activeindex + i;
if (index > swiper.slides.length && !isvirtual) break;
activeslides.push(getslidebyindex(index));
}
}
} else {
activeslides.push(getslidebyindex(swiper.activeindex));
} // 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) {
if (translate === void 0) {
translate = this && this.translate || 0;
}
var swiper = this;
var params = swiper.params;
var slides = swiper.slides,
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 || params.centeredslides && params.autoheight) {
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;
if (typeof translate === 'undefined') {
var multiplier = swiper.rtltranslate ? -1 : 1; // eslint-disable-next-line
translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
}
var params = swiper.params;
var translatesdiff = swiper.maxtranslate() - swiper.mintranslate();
var progress = swiper.progress,
isbeginning = swiper.isbeginning,
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;
}
extend(swiper, {
progress: progress,
isbeginning: isbeginning,
isend: isend
});
if (params.watchslidesprogress || params.watchslidesvisibility || params.centeredslides && params.autoheight) 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,
params = swiper.params,
$wrapperel = swiper.$wrapperel,
activeindex = swiper.activeindex,
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);
}
}
swiper.emitslidesclasses();
}
function updateactiveindex(newactiveindex) {
var swiper = this;
var translate = swiper.rtltranslate ? swiper.translate : -swiper.translate;
var slidesgrid = swiper.slidesgrid,
snapgrid = swiper.snapgrid,
params = swiper.params,
previousindex = swiper.activeindex,
previousrealindex = swiper.realindex,
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 {
var skip = math.min(params.slidespergroupskip, activeindex);
snapindex = skip + math.floor((activeindex - skip) / 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);
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.params.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;
var slideindex;
if (slide) {
for (var i = 0; i < swiper.slides.length; i += 1) {
if (swiper.slides[i] === slide) {
slidefound = true;
slideindex = i;
break;
}
}
}
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 = slideindex;
}
} 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 getswipertranslate(axis) {
if (axis === void 0) {
axis = this.ishorizontal() ? 'x' : 'y';
}
var swiper = this;
var params = swiper.params,
rtl = swiper.rtltranslate,
translate = swiper.translate,
$wrapperel = swiper.$wrapperel;
if (params.virtualtranslate) {
return rtl ? -translate : translate;
}
if (params.cssmode) {
return translate;
}
var currenttranslate = gettranslate($wrapperel[0], axis);
if (rtl) currenttranslate = -currenttranslate;
return currenttranslate || 0;
}
function settranslate(translate, bycontroller) {
var swiper = this;
var rtl = swiper.rtltranslate,
params = swiper.params,
$wrapperel = swiper.$wrapperel,
wrapperel = swiper.wrapperel,
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.cssmode) {
wrapperel[swiper.ishorizontal() ? 'scrollleft' : 'scrolltop'] = swiper.ishorizontal() ? -x : -y;
} else if (!params.virtualtranslate) {
$wrapperel.transform("translate3d(" + x + "px, " + y + "px, " + z + "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];
}
function translateto(translate, speed, runcallbacks, translatebounds, internal) {
if (translate === void 0) {
translate = 0;
}
if (speed === void 0) {
speed = this.params.speed;
}
if (runcallbacks === void 0) {
runcallbacks = true;
}
if (translatebounds === void 0) {
translatebounds = true;
}
var swiper = this;
var params = swiper.params,
wrapperel = swiper.wrapperel;
if (swiper.animating && params.preventinteractionontransition) {
return false;
}
var mintranslate = swiper.mintranslate();
var maxtranslate = swiper.maxtranslate();
var newtranslate;
if (translatebounds && translate > mintranslate) newtranslate = mintranslate;else if (translatebounds && translate < maxtranslate) newtranslate = maxtranslate;else newtranslate = translate; // update progress
swiper.updateprogress(newtranslate);
if (params.cssmode) {
var ish = swiper.ishorizontal();
if (speed === 0) {
wrapperel[ish ? 'scrollleft' : 'scrolltop'] = -newtranslate;
} else {
// eslint-disable-next-line
if (wrapperel.scrollto) {
var _wrapperel$scrollto;
wrapperel.scrollto((_wrapperel$scrollto = {}, _wrapperel$scrollto[ish ? 'left' : 'top'] = -newtranslate, _wrapperel$scrollto.behavior = 'smooth', _wrapperel$scrollto));
} else {
wrapperel[ish ? 'scrollleft' : 'scrolltop'] = -newtranslate;
}
}
return true;
}
if (speed === 0) {
swiper.settransition(0);
swiper.settranslate(newtranslate);
if (runcallbacks) {
swiper.emit('beforetransitionstart', speed, internal);
swiper.emit('transitionend');
}
} else {
swiper.settransition(speed);
swiper.settranslate(newtranslate);
if (runcallbacks) {
swiper.emit('beforetransitionstart', speed, internal);
swiper.emit('transitionstart');
}
if (!swiper.animating) {
swiper.animating = true;
if (!swiper.ontranslatetowrappertransitionend) {
swiper.ontranslatetowrappertransitionend = function transitionend(e) {
if (!swiper || swiper.destroyed) return;
if (e.target !== this) return;
swiper.$wrapperel[0].removeeventlistener('transitionend', swiper.ontranslatetowrappertransitionend);
swiper.$wrapperel[0].removeeventlistener('webkittransitionend', swiper.ontranslatetowrappertransitionend);
swiper.ontranslatetowrappertransitionend = null;
delete swiper.ontranslatetowrappertransitionend;
if (runcallbacks) {
swiper.emit('transitionend');
}
};
}
swiper.$wrapperel[0].addeventlistener('transitionend', swiper.ontranslatetowrappertransitionend);
swiper.$wrapperel[0].addeventlistener('webkittransitionend', swiper.ontranslatetowrappertransitionend);
}
}
return true;
}
var translate = {
gettranslate: getswipertranslate,
settranslate: settranslate,
mintranslate: mintranslate,
maxtranslate: maxtranslate,
translateto: translateto
};
function settransition(duration, bycontroller) {
var swiper = this;
if (!swiper.params.cssmode) {
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,
params = swiper.params,
previousindex = swiper.previousindex;
if (params.cssmode) return;
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(runcallbacks, direction) {
if (runcallbacks === void 0) {
runcallbacks = true;
}
var swiper = this;
var activeindex = swiper.activeindex,
previousindex = swiper.previousindex,
params = swiper.params;
swiper.animating = false;
if (params.cssmode) return;
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 = {
settransition: settransition,
transitionstart: transitionstart,
transitionend: transitionend
};
function slideto(index, speed, runcallbacks, internal, initial) {
if (index === void 0) {
index = 0;
}
if (speed === void 0) {
speed = this.params.speed;
}
if (runcallbacks === void 0) {
runcallbacks = true;
}
if (typeof index !== 'number' && typeof index !== 'string') {
throw new error("the 'index' argument cannot have type other than 'number' or 'string'. [" + typeof index + "] given.");
}
if (typeof index === 'string') {
/**
* the `index` argument converted from `string` to `number`.
* @type {number}
*/
var indexasnumber = parseint(index, 10);
/**
* determines whether the `index` argument is a valid `number`
* after being converted from the `string` type.
* @type {boolean}
*/
var isvalidnumber = isfinite(indexasnumber);
if (!isvalidnumber) {
throw new error("the passed-in 'index' (string) couldn't be converted to 'number'. [" + index + "] given.");
} // knowing that the converted `index` is a valid number,
// we can update the original argument's value.
index = indexasnumber;
}
var swiper = this;
var slideindex = index;
if (slideindex < 0) slideindex = 0;
var params = swiper.params,
snapgrid = swiper.snapgrid,
slidesgrid = swiper.slidesgrid,
previousindex = swiper.previousindex,
activeindex = swiper.activeindex,
rtl = swiper.rtltranslate,
wrapperel = swiper.wrapperel,
enabled = swiper.enabled;
if (swiper.animating && params.preventinteractionontransition || !enabled && !internal && !initial) {
return false;
}
var skip = math.min(swiper.params.slidespergroupskip, slideindex);
var snapindex = skip + math.floor((slideindex - skip) / swiper.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) {
var normalizedtranslate = -math.floor(translate * 100);
var normalizedgird = math.floor(slidesgrid[i] * 100);
var normalizedgridnext = math.floor(slidesgrid[i + 1] * 100);
if (typeof slidesgrid[i + 1] !== 'undefined') {
if (normalizedtranslate >= normalizedgird && normalizedtranslate < normalizedgridnext - (normalizedgridnext - normalizedgird) / 2) {
slideindex = i;
} else if (normalizedtranslate >= normalizedgird && normalizedtranslate < normalizedgridnext) {
slideindex = i + 1;
}
} else if (normalizedtranslate >= normalizedgird) {
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 (params.cssmode) {
var ish = swiper.ishorizontal();
var t = -translate;
if (rtl) {
t = wrapperel.scrollwidth - wrapperel.offsetwidth - t;
}
if (speed === 0) {
wrapperel[ish ? 'scrollleft' : 'scrolltop'] = t;
} else {
// eslint-disable-next-line
if (wrapperel.scrollto) {
var _wrapperel$scrollto;
wrapperel.scrollto((_wrapperel$scrollto = {}, _wrapperel$scrollto[ish ? 'left' : 'top'] = t, _wrapperel$scrollto.behavior = 'smooth', _wrapperel$scrollto));
} else {
wrapperel[ish ? 'scrollleft' : 'scrolltop'] = t;
}
}
return true;
}
if (speed === 0) {
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,
animating = swiper.animating,
enabled = swiper.enabled;
if (!enabled) return swiper;
var increment = swiper.activeindex < params.slidespergroupskip ? 1 : params.slidespergroup;
if (params.loop) {
if (animating && params.looppreventsslide) return false;
swiper.loopfix(); // eslint-disable-next-line
swiper._clientleft = swiper.$wrapperel[0].clientleft;
}
return swiper.slideto(swiper.activeindex + increment, 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,
animating = swiper.animating,
snapgrid = swiper.snapgrid,
slidesgrid = swiper.slidesgrid,
rtltranslate = swiper.rtltranslate,
enabled = swiper.enabled;
if (!enabled) return swiper;
if (params.loop) {
if (animating && params.looppreventsslide) 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);
});
snapgrid[normalizedsnapgrid.indexof(normalizedtranslate)];
var prevsnap = snapgrid[normalizedsnapgrid.indexof(normalizedtranslate) - 1];
if (typeof prevsnap === 'undefined' && params.cssmode) {
snapgrid.foreach(function (snap) {
if (!prevsnap && normalizedtranslate >= snap) prevsnap = snap;
});
}
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, threshold) {
if (speed === void 0) {
speed = this.params.speed;
}
if (runcallbacks === void 0) {
runcallbacks = true;
}
if (threshold === void 0) {
threshold = 0.5;
}
var swiper = this;
var index = swiper.activeindex;
var skip = math.min(swiper.params.slidespergroupskip, index);
var snapindex = skip + math.floor((index - skip) / swiper.params.slidespergroup);
var translate = swiper.rtltranslate ? swiper.translate : -swiper.translate;
if (translate >= swiper.snapgrid[snapindex]) {
// the current translate is on or after the current snap index, so the choice
// is between the current index and the one after it.
var currentsnap = swiper.snapgrid[snapindex];
var nextsnap = swiper.snapgrid[snapindex + 1];
if (translate - currentsnap > (nextsnap - currentsnap) * threshold) {
index += swiper.params.slidespergroup;
}
} else {
// the current translate is before the current snap index, so the choice
// is between the current index and the one before it.
var prevsnap = swiper.snapgrid[snapindex - 1];
var _currentsnap = swiper.snapgrid[snapindex];
if (translate - prevsnap <= (_currentsnap - prevsnap) * threshold) {
index -= swiper.params.slidespergroup;
}
}
index = math.max(index, 0);
index = math.min(index, swiper.slidesgrid.length - 1);
return swiper.slideto(index, speed, runcallbacks, internal);
}
function slidetoclickedslide() {
var swiper = this;
var params = swiper.params,
$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();
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();
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 document = getdocument();
var params = swiper.params,
$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 = $(document.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 = math.ceil(parsefloat(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 (el, index) {
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 = 0; _i < appendslides.length; _i += 1) {
$wrapperel.append($(appendslides[_i].clonenode(true)).addclass(params.slideduplicateclass));
}
for (var _i2 = prependslides.length - 1; _i2 >= 0; _i2 -= 1) {
$wrapperel.prepend($(prependslides[_i2].clonenode(true)).addclass(params.slideduplicateclass));
}
}
function loopfix() {
var swiper = this;
swiper.emit('beforeloopfix');
var activeindex = swiper.activeindex,
slides = swiper.slides,
loopedslides = swiper.loopedslides,
allowslideprev = swiper.allowslideprev,
allowslidenext = swiper.allowslidenext,
snapgrid = swiper.snapgrid,
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 (activeindex >= slides.length - loopedslides) {
// fix for positive oversliding
newindex = -slides.length + activeindex + loopedslides;
newindex += loopedslides;
var _slidechanged = swiper.slideto(newindex, 0, false, true);
if (_slidechanged && diff !== 0) {
swiper.settranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
}
swiper.allowslideprev = allowslideprev;
swiper.allowslidenext = allowslidenext;
swiper.emit('loopfix');
}
function loopdestroy() {
var swiper = this;
var $wrapperel = swiper.$wrapperel,
params = swiper.params,
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 (swiper.support.touch || !swiper.params.simulatetouch || swiper.params.watchoverflow && swiper.islocked || swiper.params.cssmode) 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 (swiper.support.touch || swiper.params.watchoverflow && swiper.islocked || swiper.params.cssmode) {
return;
}
swiper.el.style.cursor = '';
}
var grabcursor = {
setgrabcursor: setgrabcursor,
unsetgrabcursor: unsetgrabcursor
};
function appendslide(slides) {
var swiper = this;
var $wrapperel = swiper.$wrapperel,
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 && swiper.support.observer)) {
swiper.update();
}
}
function prependslide(slides) {
var swiper = this;
var params = swiper.params,
$wrapperel = swiper.$wrapperel,
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 && swiper.support.observer)) {
swiper.update();
}
swiper.slideto(newactiveindex, 0, false);
}
function addslide(index, slides) {
var swiper = this;
var $wrapperel = swiper.$wrapperel,
params = swiper.params,
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 = 0; _i < slides.length; _i += 1) {
if (slides[_i]) $wrapperel.append(slides[_i]);
}
newactiveindex = activeindexbuffer > index ? activeindexbuffer + slides.length : activeindexbuffer;
} else {
$wrapperel.append(slides);
}
for (var _i2 = 0; _i2 < slidesbuffer.length; _i2 += 1) {
$wrapperel.append(slidesbuffer[_i2]);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && swiper.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,
$wrapperel = swiper.$wrapperel,
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 && swiper.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
};
function ontouchstart(event) {
var swiper = this;
var document = getdocument();
var window = getwindow();
var data = swiper.toucheventsdata;
var params = swiper.params,
touches = swiper.touches,
enabled = swiper.enabled;
if (!enabled) return;
if (swiper.animating && params.preventinteractionontransition) {
return;
}
var e = event;
if (e.originalevent) e = e.originalevent;
var $targetel = $(e.target);
if (params.toucheventstarget === 'wrapper') {
if (!$targetel.closest(swiper.wrapperel).length) return;
}
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; // change target el for shadow root componenet
var swipingclasshasvalue = !!params.noswipingclass && params.noswipingclass !== '';
if (swipingclasshasvalue && e.target && e.target.shadowroot && event.path && event.path[0]) {
$targetel = $(event.path[0]);
}
if (params.noswiping && $targetel.closest(params.noswipingselector ? params.noswipingselector : "." + params.noswipingclass)[0]) {
swiper.allowclick = true;
return;
}
if (params.swipehandler) {
if (!$targetel.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 cannot swipe-to-go-back anymore
var edgeswipedetection = params.edgeswipedetection || params.iosedgeswipedetection;
var edgeswipethreshold = params.edgeswipethreshold || params.iosedgeswipethreshold;
if (edgeswipedetection && (startx <= edgeswipethreshold || startx >= window.innerwidth - edgeswipethreshold)) {
if (edgeswipedetection === 'prevent') {
event.preventdefault();
} else {
return;
}
}
extend(data, {
istouched: true,
ismoved: false,
allowtouchcallbacks: true,
isscrolling: undefined,
startmoving: undefined
});
touches.startx = startx;
touches.starty = starty;
data.touchstarttime = now();
swiper.allowclick = true;
swiper.updatesize();
swiper.swipedirection = undefined;
if (params.threshold > 0) data.allowthresholdmove = false;
if (e.type !== 'touchstart') {
var preventdefault = true;
if ($targetel.is(data.formelements)) preventdefault = false;
if (document.activeelement && $(document.activeelement).is(data.formelements) && document.activeelement !== $targetel[0]) {
document.activeelement.blur();
}
var shouldpreventdefault = preventdefault && swiper.allowtouchmove && params.touchstartpreventdefault;
if ((params.touchstartforcepreventdefault || shouldpreventdefault) && !$targetel[0].iscontenteditable) {
e.preventdefault();
}
}
swiper.emit('touchstart', e);
}
function ontouchmove(event) {
var document = getdocument();
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params,
touches = swiper.touches,
rtl = swiper.rtltranslate,
enabled = swiper.enabled;
if (!enabled) return;
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 !== 'touchmove') 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) {
extend(touches, {
startx: pagex,
starty: pagey,
currentx: pagex,
currenty: pagey
});
data.touchstarttime = 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 && document.activeelement) {
if (e.target === document.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;
if (!params.cssmode && e.cancelable) {
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;
}
if (!swiper.allowslideprev && !swiper.allowslidenext) {
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 || params.cssmode) 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: 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,
touches = swiper.touches,
rtl = swiper.rtltranslate,
$wrapperel = swiper.$wrapperel,
slidesgrid = swiper.slidesgrid,
snapgrid = swiper.snapgrid,
enabled = swiper.enabled;
if (!enabled) return;
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 = now();
var timediff = touchendtime - data.touchstarttime; // tap, doubletap, click
if (swiper.allowclick) {
swiper.updateclickedslide(e);
swiper.emit('tap click', e);
if (timediff < 300 && touchendtime - data.lastclicktime < 300) {
swiper.emit('doubletap doubleclick', e);
}
}
data.lastclicktime = now();
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.cssmode) {
return;
}
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 || 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);
}
if (params.freemodesticky) {
// if freemodesticky is active and the user ends a swipe with a slow-velocity
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
// it's easy to see this when simulating touch with mouse events. to fix this,
// limit single-slide swipes to the default slide duration. this also has the
// nice side effect of matching slide speed if the user stopped moving before
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
// for faster swipes, also apply limits (albeit higher ones).
var movedistance = math.abs((rtl ? -newposition : newposition) - swiper.translate);
var currentslidesize = swiper.slidessizesgrid[swiper.activeindex];
if (movedistance < currentslidesize) {
momentumduration = params.speed;
} else if (movedistance < 2 * currentslidesize) {
momentumduration = params.speed * 1.5;
} else {
momentumduration = params.speed * 2.5;
}
}
} 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);
settimeout(function () {
swiper.settranslate(afterbounceposition);
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) return;
swiper.transitionend();
});
}, 0);
});
} 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.emit('_freemodenomomentumrelease');
swiper.updateprogress(newposition);
}
swiper.updateactiveindex();
swiper.updateslidesclasses();
} else if (params.freemodesticky) {
swiper.slidetoclosest();
return;
} else if (params.freemode) {
swiper.emit('_freemodenomomentumrelease');
}
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 += i < params.slidespergroupskip ? 1 : params.slidespergroup) {
var _increment = i < params.slidespergroupskip - 1 ? 1 : params.slidespergroup;
if (typeof slidesgrid[i + _increment] !== 'undefined') {
if (currentpos >= slidesgrid[i] && currentpos < slidesgrid[i + _increment]) {
stopindex = i;
groupsize = slidesgrid[i + _increment] - 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;
var increment = stopindex < params.slidespergroupskip - 1 ? 1 : params.slidespergroup;
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 + increment);else swiper.slideto(stopindex);
}
if (swiper.swipedirection === 'prev') {
if (ratio > 1 - params.longswipesratio) swiper.slideto(stopindex + increment);else swiper.slideto(stopindex);
}
} else {
// short swipes
if (!params.shortswipes) {
swiper.slideto(swiper.activeindex);
return;
}
var isnavbuttontarget = swiper.navigation && (e.target === swiper.navigation.nextel || e.target === swiper.navigation.prevel);
if (!isnavbuttontarget) {
if (swiper.swipedirection === 'next') {
swiper.slideto(stopindex + increment);
}
if (swiper.swipedirection === 'prev') {
swiper.slideto(stopindex);
}
} else if (e.target === swiper.navigation.nextel) {
swiper.slideto(stopindex + increment);
} else {
swiper.slideto(stopindex);
}
}
}
function onresize() {
var swiper = this;
var params = swiper.params,
el = swiper.el;
if (el && el.offsetwidth === 0) return; // breakpoints
if (params.breakpoints) {
swiper.setbreakpoint();
} // save locks
var allowslidenext = swiper.allowslidenext,
allowslideprev = swiper.allowslideprev,
snapgrid = swiper.snapgrid; // disable locks on resize
swiper.allowslidenext = true;
swiper.allowslideprev = true;
swiper.updatesize();
swiper.updateslides();
swiper.updateslidesclasses();
if ((params.slidesperview === 'auto' || params.slidesperview > 1) && swiper.isend && !swiper.isbeginning && !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.enabled) return;
if (!swiper.allowclick) {
if (swiper.params.preventclicks) e.preventdefault();
if (swiper.params.preventclickspropagation && swiper.animating) {
e.stoppropagation();
e.stopimmediatepropagation();
}
}
}
function onscroll() {
var swiper = this;
var wrapperel = swiper.wrapperel,
rtltranslate = swiper.rtltranslate,
enabled = swiper.enabled;
if (!enabled) return;
swiper.previoustranslate = swiper.translate;
if (swiper.ishorizontal()) {
if (rtltranslate) {
swiper.translate = wrapperel.scrollwidth - wrapperel.offsetwidth - wrapperel.scrollleft;
} else {
swiper.translate = -wrapperel.scrollleft;
}
} else {
swiper.translate = -wrapperel.scrolltop;
} // eslint-disable-next-line
if (swiper.translate === -0) swiper.translate = 0;
swiper.updateactiveindex();
swiper.updateslidesclasses();
var newprogress;
var translatesdiff = swiper.maxtranslate() - swiper.mintranslate();
if (translatesdiff === 0) {
newprogress = 0;
} else {
newprogress = (swiper.translate - swiper.mintranslate()) / translatesdiff;
}
if (newprogress !== swiper.progress) {
swiper.updateprogress(rtltranslate ? -swiper.translate : swiper.translate);
}
swiper.emit('settranslate', swiper.translate, false);
}
var dummyeventattached = false;
function dummyeventlistener() {}
function attachevents() {
var swiper = this;
var document = getdocument();
var params = swiper.params,
touchevents = swiper.touchevents,
el = swiper.el,
wrapperel = swiper.wrapperel,
device = swiper.device,
support = swiper.support;
swiper.ontouchstart = ontouchstart.bind(swiper);
swiper.ontouchmove = ontouchmove.bind(swiper);
swiper.ontouchend = ontouchend.bind(swiper);
if (params.cssmode) {
swiper.onscroll = onscroll.bind(swiper);
}
swiper.onclick = onclick.bind(swiper);
var capture = !!params.nested; // touch events
if (!support.touch && support.pointerevents) {
el.addeventlistener(touchevents.start, swiper.ontouchstart, false);
document.addeventlistener(touchevents.move, swiper.ontouchmove, capture);
document.addeventlistener(touchevents.end, swiper.ontouchend, false);
} else {
if (support.touch) {
var passivelistener = touchevents.start === 'touchstart' && support.passivelistener && params.passivelisteners ? {
passive: true,
capture: false
} : false;
el.addeventlistener(touchevents.start, swiper.ontouchstart, passivelistener);
el.addeventlistener(touchevents.move, swiper.ontouchmove, support.passivelistener ? {
passive: false,
capture: capture
} : capture);
el.addeventlistener(touchevents.end, swiper.ontouchend, passivelistener);
if (touchevents.cancel) {
el.addeventlistener(touchevents.cancel, swiper.ontouchend, passivelistener);
}
if (!dummyeventattached) {
document.addeventlistener('touchstart', dummyeventlistener);
dummyeventattached = true;
}
}
if (params.simulatetouch && !device.ios && !device.android || params.simulatetouch && !support.touch && device.ios) {
el.addeventlistener('mousedown', swiper.ontouchstart, false);
document.addeventlistener('mousemove', swiper.ontouchmove, capture);
document.addeventlistener('mouseup', swiper.ontouchend, false);
}
} // prevent links clicks
if (params.preventclicks || params.preventclickspropagation) {
el.addeventlistener('click', swiper.onclick, true);
}
if (params.cssmode) {
wrapperel.addeventlistener('scroll', swiper.onscroll);
} // resize handler
if (params.updateonwindowresize) {
swiper.on(device.ios || device.android ? 'resize orientationchange observerupdate' : 'resize observerupdate', onresize, true);
} else {
swiper.on('observerupdate', onresize, true);
}
}
function detachevents() {
var swiper = this;
var document = getdocument();
var params = swiper.params,
touchevents = swiper.touchevents,
el = swiper.el,
wrapperel = swiper.wrapperel,
device = swiper.device,
support = swiper.support;
var capture = !!params.nested; // touch events
if (!support.touch && support.pointerevents) {
el.removeeventlistener(touchevents.start, swiper.ontouchstart, false);
document.removeeventlistener(touchevents.move, swiper.ontouchmove, capture);
document.removeeventlistener(touchevents.end, swiper.ontouchend, false);
} else {
if (support.touch) {
var passivelistener = touchevents.start === 'ontouchstart' && support.passivelistener && params.passivelisteners ? {
passive: true,
capture: false
} : false;
el.removeeventlistener(touchevents.start, swiper.ontouchstart, passivelistener);
el.removeeventlistener(touchevents.move, swiper.ontouchmove, capture);
el.removeeventlistener(touchevents.end, swiper.ontouchend, passivelistener);
if (touchevents.cancel) {
el.removeeventlistener(touchevents.cancel, swiper.ontouchend, passivelistener);
}
}
if (params.simulatetouch && !device.ios && !device.android || params.simulatetouch && !support.touch && device.ios) {
el.removeeventlistener('mousedown', swiper.ontouchstart, false);
document.removeeventlistener('mousemove', swiper.ontouchmove, capture);
document.removeeventlistener('mouseup', swiper.ontouchend, false);
}
} // prevent links clicks
if (params.preventclicks || params.preventclickspropagation) {
el.removeeventlistener('click', swiper.onclick, true);
}
if (params.cssmode) {
wrapperel.removeeventlistener('scroll', swiper.onscroll);
} // 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,
initialized = swiper.initialized,
_swiper$loopedslides = swiper.loopedslides,
loopedslides = _swiper$loopedslides === void 0 ? 0 : _swiper$loopedslides,
params = swiper.params,
$el = swiper.$el;
var breakpoints = params.breakpoints;
if (!breakpoints || breakpoints && object.keys(breakpoints).length === 0) return; // get breakpoint for window width and update parameters
var breakpoint = swiper.getbreakpoint(breakpoints, swiper.params.breakpointsbase, swiper.el);
if (!breakpoint || swiper.currentbreakpoint === breakpoint) return;
var breakpointonlyparams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
if (breakpointonlyparams) {
['slidesperview', 'spacebetween', 'slidespergroup', 'slidespergroupskip', 'slidespercolumn'].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 wasmultirow = params.slidespercolumn > 1;
var ismultirow = breakpointparams.slidespercolumn > 1;
var wasenabled = params.enabled;
if (wasmultirow && !ismultirow) {
$el.removeclass(params.containermodifierclass + "multirow " + params.containermodifierclass + "multirow-column");
swiper.emitcontainerclasses();
} else if (!wasmultirow && ismultirow) {
$el.addclass(params.containermodifierclass + "multirow");
if (breakpointparams.slidespercolumnfill === 'column') {
$el.addclass(params.containermodifierclass + "multirow-column");
}
swiper.emitcontainerclasses();
}
var directionchanged = breakpointparams.direction && breakpointparams.direction !== params.direction;
var needsreloop = params.loop && (breakpointparams.slidesperview !== params.slidesperview || directionchanged);
if (directionchanged && initialized) {
swiper.changedirection();
}
extend(swiper.params, breakpointparams);
var isenabled = swiper.params.enabled;
extend(swiper, {
allowtouchmove: swiper.params.allowtouchmove,
allowslidenext: swiper.params.allowslidenext,
allowslideprev: swiper.params.allowslideprev
});
if (wasenabled && !isenabled) {
swiper.disable();
} else if (!wasenabled && isenabled) {
swiper.enable();
}
swiper.currentbreakpoint = breakpoint;
swiper.emit('_beforebreakpoint', breakpointparams);
if (needsreloop && initialized) {
swiper.loopdestroy();
swiper.loopcreate();
swiper.updateslides();
swiper.slideto(activeindex - loopedslides + swiper.loopedslides, 0, false);
}
swiper.emit('breakpoint', breakpointparams);
}
function getbreakpoint(breakpoints, base, containerel) {
if (base === void 0) {
base = 'window';
}
if (!breakpoints || base === 'container' && !containerel) return undefined;
var breakpoint = false;
var window = getwindow();
var currentwidth = base === 'window' ? window.innerwidth : containerel.clientwidth;
var currentheight = base === 'window' ? window.innerheight : containerel.clientheight;
var points = object.keys(breakpoints).map(function (point) {
if (typeof point === 'string' && point.indexof('@') === 0) {
var minratio = parsefloat(point.substr(1));
var value = currentheight * minratio;
return {
value: value,
point: point
};
}
return {
value: point,
point: point
};
});
points.sort(function (a, b) {
return parseint(a.value, 10) - parseint(b.value, 10);
});
for (var i = 0; i < points.length; i += 1) {
var _points$i = points[i],
point = _points$i.point,
value = _points$i.value;
if (value <= currentwidth) {
breakpoint = point;
}
}
return breakpoint || 'max';
}
var breakpoints = {
setbreakpoint: setbreakpoint,
getbreakpoint: getbreakpoint
};
function prepareclasses(entries, prefix) {
var resultclasses = [];
entries.foreach(function (item) {
if (typeof item === 'object') {
object.keys(item).foreach(function (classnames) {
if (item[classnames]) {
resultclasses.push(prefix + classnames);
}
});
} else if (typeof item === 'string') {
resultclasses.push(prefix + item);
}
});
return resultclasses;
}
function addclasses() {
var swiper = this;
var classnames = swiper.classnames,
params = swiper.params,
rtl = swiper.rtl,
$el = swiper.$el,
device = swiper.device,
support = swiper.support; // prettier-ignore
var suffixes = prepareclasses(['initialized', params.direction, {
'pointer-events': support.pointerevents && !support.touch
}, {
'free-mode': params.freemode
}, {
'autoheight': params.autoheight
}, {
'rtl': rtl
}, {
'multirow': params.slidespercolumn > 1
}, {
'multirow-column': params.slidespercolumn > 1 && params.slidespercolumnfill === 'column'
}, {
'android': device.android
}, {
'ios': device.ios
}, {
'css-mode': params.cssmode
}], params.containermodifierclass);
classnames.push.apply(classnames, suffixes);
$el.addclass([].concat(classnames).join(' '));
swiper.emitcontainerclasses();
}
function removeclasses() {
var swiper = this;
var $el = swiper.$el,
classnames = swiper.classnames;
$el.removeclass(classnames.join(' '));
swiper.emitcontainerclasses();
}
var classes = {
addclasses: addclasses,
removeclasses: removeclasses
};
function loadimage(imageel, src, srcset, sizes, checkforcomplete, callback) {
var window = getwindow();
var image;
function onready() {
if (callback) callback();
}
var ispicture = $(imageel).parent('picture')[0];
if (!ispicture && (!imageel.complete || !checkforcomplete)) {
if (src) {
image = new window.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 params = swiper.params;
var waslocked = swiper.islocked;
var lastslideposition = swiper.slides.length > 0 && params.slidesoffsetbefore + params.spacebetween * (swiper.slides.length - 1) + swiper.slides[0].offsetwidth * swiper.slides.length;
if (params.slidesoffsetbefore && params.slidesoffsetafter && lastslideposition) {
swiper.islocked = lastslideposition <= swiper.size;
} else {
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;
if (swiper.navigation) swiper.navigation.update();
}
}
var checkoverflow$1 = {
checkoverflow: checkoverflow
};
var defaults = {
init: true,
direction: 'horizontal',
toucheventstarget: 'container',
initialslide: 0,
speed: 300,
cssmode: false,
updateonwindowresize: true,
resizeobserver: false,
nested: false,
enabled: true,
// overrides
width: null,
height: null,
//
preventinteractionontransition: false,
// ssr
useragent: null,
url: null,
// to support ios's swipe-to-go-back gesture (when being used in-app).
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,
breakpointsbase: 'window',
// slides grid
spacebetween: 0,
slidesperview: 1,
slidespercolumn: 1,
slidespercolumnfill: 'column',
slidespergroup: 1,
slidespergroupskip: 0,
centeredslides: false,
centeredslidesbounds: 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: false,
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,
looppreventsslide: true,
// 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,
// internals
_emitclasses: false
};
var prototypes = {
modular: modular,
eventsemitter: eventsemitter,
update: update,
translate: translate,
transition: transition,
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 () {
function swiper() {
var el;
var params;
for (var _len = arguments.length, args = new array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 1 && args[0].constructor && object.prototype.tostring.call(args[0]).slice(8, -1) === 'object') {
params = args[0];
} else {
el = args[0];
params = args[1];
}
if (!params) params = {};
params = extend({}, params);
if (el && !params.el) params.el = el;
if (params.el && $(params.el).length > 1) {
var swipers = [];
$(params.el).each(function (containerel) {
var newparams = extend({}, params, {
el: containerel
});
swipers.push(new swiper(newparams));
});
return swipers;
} // swiper instance
var swiper = this;
swiper.__swiper__ = true;
swiper.support = getsupport();
swiper.device = getdevice({
useragent: params.useragent
});
swiper.browser = getbrowser();
swiper.eventslisteners = {};
swiper.eventsanylisteners = [];
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 = extend({}, defaults);
swiper.useparams(swiperparams); // extend defaults with passed params
swiper.params = extend({}, swiperparams, extendeddefaults, params);
swiper.originalparams = extend({}, swiper.params);
swiper.passedparams = extend({}, params); // add event listeners
if (swiper.params && swiper.params.on) {
object.keys(swiper.params.on).foreach(function (eventname) {
swiper.on(eventname, swiper.params.on[eventname]);
});
}
if (swiper.params && swiper.params.onany) {
swiper.onany(swiper.params.onany);
} // save dom lib
swiper.$ = $; // extend swiper
extend(swiper, {
enabled: swiper.params.enabled,
el: el,
// classes
classnames: [],
// slides
slides: $(),
slidesgrid: [],
snapgrid: [],
slidessizesgrid: [],
// isdirection
ishorizontal: function ishorizontal() {
return swiper.params.direction === 'horizontal';
},
isvertical: function isvertical() {
return swiper.params.direction === 'vertical';
},
// 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', 'touchcancel'];
var desktop = ['mousedown', 'mousemove', 'mouseup'];
if (swiper.support.pointerevents) {
desktop = ['pointerdown', 'pointermove', 'pointerup'];
}
swiper.toucheventstouch = {
start: touch[0],
move: touch[1],
end: touch[2],
cancel: touch[3]
};
swiper.toucheventsdesktop = {
start: desktop[0],
move: desktop[1],
end: desktop[2]
};
return swiper.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, label',
// last click time
lastclicktime: 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();
swiper.emit('_swiper'); // init
if (swiper.params.init) {
swiper.init();
} // return app instance
return swiper;
}
var _proto = swiper.prototype;
_proto.enable = function enable() {
var swiper = this;
if (swiper.enabled) return;
swiper.enabled = true;
if (swiper.params.grabcursor) {
swiper.setgrabcursor();
}
swiper.emit('enable');
};
_proto.disable = function disable() {
var swiper = this;
if (!swiper.enabled) return;
swiper.enabled = false;
if (swiper.params.grabcursor) {
swiper.unsetgrabcursor();
}
swiper.emit('disable');
};
_proto.setprogress = function setprogress(progress, speed) {
var swiper = this;
progress = math.min(math.max(progress, 0), 1);
var min = swiper.mintranslate();
var max = swiper.maxtranslate();
var current = (max - min) * progress + min;
swiper.translateto(current, typeof speed === 'undefined' ? 0 : speed);
swiper.updateactiveindex();
swiper.updateslidesclasses();
};
_proto.emitcontainerclasses = function emitcontainerclasses() {
var swiper = this;
if (!swiper.params._emitclasses || !swiper.el) return;
var classes = swiper.el.classname.split(' ').filter(function (classname) {
return classname.indexof('swiper-container') === 0 || classname.indexof(swiper.params.containermodifierclass) === 0;
});
swiper.emit('_containerclasses', classes.join(' '));
};
_proto.getslideclasses = function getslideclasses(slideel) {
var swiper = this;
return slideel.classname.split(' ').filter(function (classname) {
return classname.indexof('swiper-slide') === 0 || classname.indexof(swiper.params.slideclass) === 0;
}).join(' ');
};
_proto.emitslidesclasses = function emitslidesclasses() {
var swiper = this;
if (!swiper.params._emitclasses || !swiper.el) return;
var updates = [];
swiper.slides.each(function (slideel) {
var classnames = swiper.getslideclasses(slideel);
updates.push({
slideel: slideel,
classnames: classnames
});
swiper.emit('_slideclass', slideel, classnames);
});
swiper.emit('_slideclasses', updates);
};
_proto.slidesperviewdynamic = function slidesperviewdynamic() {
var swiper = this;
var params = swiper.params,
slides = swiper.slides,
slidesgrid = swiper.slidesgrid,
swipersize = swiper.size,
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 = activeindex - 1; _i >= 0; _i -= 1) {
if (slides[_i] && !breakloop) {
slidesize += slides[_i].swiperslidesize;
spv += 1;
if (slidesize > swipersize) breakloop = true;
}
}
} else {
for (var _i2 = activeindex + 1; _i2 < slides.length; _i2 += 1) {
if (slidesgrid[_i2] - slidesgrid[activeindex] < swipersize) {
spv += 1;
}
}
}
return spv;
};
_proto.update = function update() {
var swiper = this;
if (!swiper || swiper.destroyed) return;
var snapgrid = swiper.snapgrid,
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');
};
_proto.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).addclass("" + swiper.params.containermodifierclass + newdirection);
swiper.emitcontainerclasses();
swiper.params.direction = newdirection;
swiper.slides.each(function (slideel) {
if (newdirection === 'vertical') {
slideel.style.width = '';
} else {
slideel.style.height = '';
}
});
swiper.emit('changedirection');
if (needupdate) swiper.update();
return swiper;
};
_proto.mount = function mount(el) {
var swiper = this;
if (swiper.mounted) return true; // find el
var $el = $(el || swiper.params.el);
el = $el[0];
if (!el) {
return false;
}
el.swiper = swiper; // find wrapper
var $wrapperel;
if (el && el.shadowroot && el.shadowroot.queryselector) {
$wrapperel = $(el.shadowroot.queryselector("." + swiper.params.wrapperclass)); // children needs to return slot items
$wrapperel.children = function (options) {
return $el.children(options);
};
} else {
$wrapperel = $el.children("." + swiper.params.wrapperclass);
}
extend(swiper, {
$el: $el,
el: el,
$wrapperel: $wrapperel,
wrapperel: $wrapperel[0],
mounted: true,
// 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'
});
return true;
};
_proto.init = function init(el) {
var swiper = this;
if (swiper.initialized) return swiper;
var mounted = swiper.mount(el);
if (mounted === false) return swiper;
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.enabled) {
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, false, true);
} else {
swiper.slideto(swiper.params.initialslide, 0, swiper.params.runcallbacksoninit, false, true);
} // attach events
swiper.attachevents(); // init flag
swiper.initialized = true; // emit
swiper.emit('init');
swiper.emit('afterinit');
return swiper;
};
_proto.destroy = function destroy(deleteinstance, cleanstyles) {
if (deleteinstance === void 0) {
deleteinstance = true;
}
if (cleanstyles === void 0) {
cleanstyles = true;
}
var swiper = this;
var params = swiper.params,
$el = swiper.$el,
$wrapperel = swiper.$wrapperel,
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');
}
}
swiper.emit('destroy'); // detach emitter events
object.keys(swiper.eventslisteners).foreach(function (eventname) {
swiper.off(eventname);
});
if (deleteinstance !== false) {
swiper.$el[0].swiper = null;
deleteprops(swiper);
}
swiper.destroyed = true;
return null;
};
swiper.extenddefaults = function extenddefaults(newdefaults) {
extend(extendeddefaults, newdefaults);
};
swiper.installmodule = function installmodule(module) {
if (!swiper.prototype.modules) swiper.prototype.modules = {};
var name = module.name || object.keys(swiper.prototype.modules).length + "_" + now();
swiper.prototype.modules[name] = module;
};
swiper.use = function use(module) {
if (array.isarray(module)) {
module.foreach(function (m) {
return swiper.installmodule(m);
});
return swiper;
}
swiper.installmodule(module);
return swiper;
};
_createclass(swiper, null, [{
key: "extendeddefaults",
get: function get() {
return extendeddefaults;
}
}, {
key: "defaults",
get: function get() {
return defaults;
}
}]);
return swiper;
}();
object.keys(prototypes).foreach(function (prototypegroup) {
object.keys(prototypes[prototypegroup]).foreach(function (protomethod) {
swiper.prototype[protomethod] = prototypes[prototypegroup][protomethod];
});
});
swiper.use([resize, observer$1]);
var virtual = {
update: function update(force) {
var swiper = this;
var _swiper$params = swiper.params,
slidesperview = _swiper$params.slidesperview,
slidespergroup = _swiper$params.slidespergroup,
centeredslides = _swiper$params.centeredslides;
var _swiper$params$virtua = swiper.params.virtual,
addslidesbefore = _swiper$params$virtua.addslidesbefore,
addslidesafter = _swiper$params$virtua.addslidesafter;
var _swiper$virtual = swiper.virtual,
previousfrom = _swiper$virtual.from,
previousto = _swiper$virtual.to,
slides = _swiper$virtual.slides,
previousslidesgrid = _swiper$virtual.slidesgrid,
renderslide = _swiper$virtual.renderslide,
previousoffset = _swiper$virtual.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 + addslidesafter;
slidesbefore = math.floor(slidesperview / 2) + slidespergroup + addslidesbefore;
} else {
slidesafter = slidesperview + (slidespergroup - 1) + addslidesafter;
slidesbefore = slidespergroup + addslidesbefore;
}
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);
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;
}()
});
if (swiper.params.virtual.renderexternalupdate) {
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 = 0; _i < slides.length; _i += 1) {
if (_i >= from && _i <= to) {
if (typeof previousto === 'undefined' || force) {
appendindexes.push(_i);
} else {
if (_i > previousto) appendindexes.push(_i);
if (_i < previousfrom) prependindexes.push(_i);
}
}
}
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) {
var $cachedel = cache[cachedindex];
var cachedelindex = $cachedel.attr('data-swiper-slide-index');
if (cachedelindex) {
$cachedel.attr('data-swiper-slide-index', parseint(cachedelindex, 10) + 1);
}
newcache[parseint(cachedindex, 10) + numberofnewslides] = $cachedel;
});
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,
renderexternalupdate: true,
addslidesbefore: 0,
addslidesafter: 0
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
virtual: _extends({}, virtual, {
slides: swiper.params.virtual.slides,
cache: {}
})
});
},
on: {
beforeinit: function beforeinit(swiper) {
if (!swiper.params.virtual.enabled) return;
swiper.classnames.push(swiper.params.containermodifierclass + "virtual");
var overwriteparams = {
watchslidesprogress: true
};
extend(swiper.params, overwriteparams);
extend(swiper.originalparams, overwriteparams);
if (!swiper.params.initialslide) {
swiper.virtual.update();
}
},
settranslate: function settranslate(swiper) {
if (!swiper.params.virtual.enabled) return;
swiper.virtual.update();
}
}
};
var keyboard = {
handle: function handle(event) {
var swiper = this;
if (!swiper.enabled) return;
var window = getwindow();
var document = getdocument();
var rtl = swiper.rtltranslate;
var e = event;
if (e.originalevent) e = e.originalevent; // jquery fix
var kc = e.keycode || e.charcode;
var pageupdown = swiper.params.keyboard.pageupdown;
var ispageup = pageupdown && kc === 33;
var ispagedown = pageupdown && kc === 34;
var isarrowleft = kc === 37;
var isarrowright = kc === 39;
var isarrowup = kc === 38;
var isarrowdown = kc === 40; // directions locks
if (!swiper.allowslidenext && (swiper.ishorizontal() && isarrowright || swiper.isvertical() && isarrowdown || ispagedown)) {
return false;
}
if (!swiper.allowslideprev && (swiper.ishorizontal() && isarrowleft || swiper.isvertical() && isarrowup || ispageup)) {
return false;
}
if (e.shiftkey || e.altkey || e.ctrlkey || e.metakey) {
return undefined;
}
if (document.activeelement && document.activeelement.nodename && (document.activeelement.nodename.tolowercase() === 'input' || document.activeelement.nodename.tolowercase() === 'textarea')) {
return undefined;
}
if (swiper.params.keyboard.onlyinviewport && (ispageup || ispagedown || isarrowleft || isarrowright || isarrowup || isarrowdown)) {
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 $el = swiper.$el;
var swiperwidth = $el[0].clientwidth;
var swiperheight = $el[0].clientheight;
var windowwidth = window.innerwidth;
var windowheight = window.innerheight;
var swiperoffset = swiper.$el.offset();
if (rtl) swiperoffset.left -= swiper.$el[0].scrollleft;
var swipercoord = [[swiperoffset.left, swiperoffset.top], [swiperoffset.left + swiperwidth, swiperoffset.top], [swiperoffset.left, swiperoffset.top + swiperheight], [swiperoffset.left + swiperwidth, swiperoffset.top + swiperheight]];
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) {
if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
inview = true;
}
}
if (!inview) return undefined;
}
if (swiper.ishorizontal()) {
if (ispageup || ispagedown || isarrowleft || isarrowright) {
if (e.preventdefault) e.preventdefault();else e.returnvalue = false;
}
if ((ispagedown || isarrowright) && !rtl || (ispageup || isarrowleft) && rtl) swiper.slidenext();
if ((ispageup || isarrowleft) && !rtl || (ispagedown || isarrowright) && rtl) swiper.slideprev();
} else {
if (ispageup || ispagedown || isarrowup || isarrowdown) {
if (e.preventdefault) e.preventdefault();else e.returnvalue = false;
}
if (ispagedown || isarrowdown) swiper.slidenext();
if (ispageup || isarrowup) swiper.slideprev();
}
swiper.emit('keypress', kc);
return undefined;
},
enable: function enable() {
var swiper = this;
var document = getdocument();
if (swiper.keyboard.enabled) return;
$(document).on('keydown', swiper.keyboard.handle);
swiper.keyboard.enabled = true;
},
disable: function disable() {
var swiper = this;
var document = getdocument();
if (!swiper.keyboard.enabled) return;
$(document).off('keydown', swiper.keyboard.handle);
swiper.keyboard.enabled = false;
}
};
var keyboard$1 = {
name: 'keyboard',
params: {
keyboard: {
enabled: false,
onlyinviewport: true,
pageupdown: true
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
keyboard: _extends({
enabled: false
}, keyboard)
});
},
on: {
init: function init(swiper) {
if (swiper.params.keyboard.enabled) {
swiper.keyboard.enable();
}
},
destroy: function destroy(swiper) {
if (swiper.keyboard.enabled) {
swiper.keyboard.disable();
}
}
}
};
/* eslint-disable consistent-return */
function iseventsupported() {
var document = getdocument();
var eventname = 'onwheel';
var issupported = (eventname in document);
if (!issupported) {
var element = document.createelement('div');
element.setattribute(eventname, 'return;');
issupported = typeof element[eventname] === 'function';
}
if (!issupported && document.implementation && document.implementation.hasfeature && // always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasfeature('', '') !== true) {
// this is the only way to test support for the `wheel` event in ie9+.
issupported = document.implementation.hasfeature('events.wheel', '3.0');
}
return issupported;
}
var mousewheel = {
lastscrolltime: now(),
lasteventbeforesnap: undefined,
recentwheelevents: [],
event: function event() {
var window = getwindow();
if (window.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 (e.shiftkey && !px) {
// if user scrolls with shift he wants horizontal scroll
px = py;
py = 0;
}
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;
if (!swiper.enabled) return;
swiper.mouseentered = true;
},
handlemouseleave: function handlemouseleave() {
var swiper = this;
if (!swiper.enabled) return;
swiper.mouseentered = false;
},
handle: function handle(event) {
var e = event;
var disableparentswiper = true;
var swiper = this;
if (!swiper.enabled) return;
var params = swiper.params.mousewheel;
if (swiper.params.cssmode) {
e.preventdefault();
}
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarget !== 'container') {
target = $(swiper.params.mousewheel.eventstarget);
}
if (!swiper.mouseentered && !target[0].contains(e.target) && !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; // get the scroll positions
var positions = swiper.gettranslate() + delta * params.sensitivity;
if (positions >= swiper.mintranslate()) positions = swiper.mintranslate();
if (positions <= swiper.maxtranslate()) positions = swiper.maxtranslate(); // when loop is true:
// the disableparentswiper will be true.
// when loop is false:
// if the scroll positions is not on edge,
// then the disableparentswiper will be true.
// if the scroll on edge positions,
// then the disableparentswiper will be false.
disableparentswiper = swiper.params.loop ? true : !(positions === swiper.mintranslate() || positions === swiper.maxtranslate());
if (disableparentswiper && swiper.params.nested) e.stoppropagation();
if (!swiper.params.freemode) {
// register the new event in a variable which stores the relevant data
var newevent = {
time: now(),
delta: math.abs(delta),
direction: math.sign(delta),
raw: event
}; // keep the most recent events
var recentwheelevents = swiper.mousewheel.recentwheelevents;
if (recentwheelevents.length >= 2) {
recentwheelevents.shift(); // only store the last n events
}
var prevevent = recentwheelevents.length ? recentwheelevents[recentwheelevents.length - 1] : undefined;
recentwheelevents.push(newevent); // if there is at least one previous recorded event:
// if direction has changed or
// if the scroll is quicker than the previous one:
// animate the slider.
// else (this is the first time the wheel is moved):
// animate the slider.
if (prevevent) {
if (newevent.direction !== prevevent.direction || newevent.delta > prevevent.delta || newevent.time > prevevent.time + 150) {
swiper.mousewheel.animateslider(newevent);
}
} else {
swiper.mousewheel.animateslider(newevent);
} // if it's time to release the scroll:
// return now so you don't hit the preventdefault.
if (swiper.mousewheel.releasescroll(newevent)) {
return true;
}
} else {
// freemode or scrollcontainer:
// if we recently snapped after a momentum scroll, then ignore wheel events
// to give time for the deceleration to finish. stop ignoring after 500 msecs
// or if it's a new scroll (larger delta or inverse sign as last event before
// an end-of-momentum snap).
var _newevent = {
time: now(),
delta: math.abs(delta),
direction: math.sign(delta)
};
var lasteventbeforesnap = swiper.mousewheel.lasteventbeforesnap;
var ignorewheelevents = lasteventbeforesnap && _newevent.time < lasteventbeforesnap.time + 500 && _newevent.delta <= lasteventbeforesnap.delta && _newevent.direction === lasteventbeforesnap.direction;
if (!ignorewheelevents) {
swiper.mousewheel.lasteventbeforesnap = undefined;
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) {
// when wheel scrolling starts with sticky (aka snap) enabled, then detect
// the end of a momentum scroll by storing recent (n=15?) wheel events.
// 1. do all n events have decreasing or same (absolute value) delta?
// 2. did all n events arrive in the last m (m=500?) msecs?
// 3. does the earliest event have an (absolute value) delta that's
// at least p (p=1?) larger than the most recent event's delta?
// 4. does the latest event have a delta that's smaller than q (q=6?) pixels?
// if 1-4 are "yes" then we're near the end of a momentum scroll deceleration.
// snap immediately and ignore remaining wheel events in this scroll.
// see comment above for "remaining wheel events in this scroll" determination.
// if 1-4 aren't satisfied, then wait to snap until 500ms after the last event.
cleartimeout(swiper.mousewheel.timeout);
swiper.mousewheel.timeout = undefined;
var _recentwheelevents = swiper.mousewheel.recentwheelevents;
if (_recentwheelevents.length >= 15) {
_recentwheelevents.shift(); // only store the last n events
}
var _prevevent = _recentwheelevents.length ? _recentwheelevents[_recentwheelevents.length - 1] : undefined;
var firstevent = _recentwheelevents[0];
_recentwheelevents.push(_newevent);
if (_prevevent && (_newevent.delta > _prevevent.delta || _newevent.direction !== _prevevent.direction)) {
// increasing or reverse-sign delta means the user started scrolling again. clear the wheel event log.
_recentwheelevents.splice(0);
} else if (_recentwheelevents.length >= 15 && _newevent.time - firstevent.time < 500 && firstevent.delta - _newevent.delta >= 1 && _newevent.delta <= 6) {
// we're at the end of the deceleration of a momentum scroll, so there's no need
// to wait for more events. snap asap on the next tick.
// also, because there's some remaining momentum we'll bias the snap in the
// direction of the ongoing scroll because it's better ux for the scroll to snap
// in the same direction as the scroll instead of reversing to snap. therefore,
// if it's already scrolled more than 20% in the current direction, keep going.
var snaptothreshold = delta > 0 ? 0.8 : 0.2;
swiper.mousewheel.lasteventbeforesnap = _newevent;
_recentwheelevents.splice(0);
swiper.mousewheel.timeout = nexttick(function () {
swiper.slidetoclosest(swiper.params.speed, true, undefined, snaptothreshold);
}, 0); // no delay; move on next tick
}
if (!swiper.mousewheel.timeout) {
// if we get here, then we haven't detected the end of a momentum scroll, so
// we'll consider a scroll "complete" when there haven't been any wheel events
// for 500ms.
swiper.mousewheel.timeout = nexttick(function () {
var snaptothreshold = 0.5;
swiper.mousewheel.lasteventbeforesnap = _newevent;
_recentwheelevents.splice(0);
swiper.slidetoclosest(swiper.params.speed, true, undefined, snaptothreshold);
}, 500);
}
} // emit event
if (!ignorewheelevents) 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;
},
animateslider: function animateslider(newevent) {
var swiper = this;
var window = getwindow();
if (this.params.mousewheel.thresholddelta && newevent.delta < this.params.mousewheel.thresholddelta) {
// prevent if delta of wheel scroll delta is below configured threshold
return false;
}
if (this.params.mousewheel.thresholdtime && now() - swiper.mousewheel.lastscrolltime < this.params.mousewheel.thresholdtime) {
// prevent if time between scrolls is below configured threshold
return false;
} // if the movement is not big enough and
// if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):
// don't go any further (avoid insignificant scroll movement).
if (newevent.delta >= 6 && now() - swiper.mousewheel.lastscrolltime < 60) {
// return false as a default
return true;
} // if user is scrolling towards the end:
// if the slider hasn't hit the latest slide or
// if the slider is a loop and
// if the slider isn't moving right now:
// go to next slide and
// emit a scroll event.
// else (the user is scrolling towards the beginning) and
// if the slider hasn't hit the first slide or
// if the slider is a loop and
// if the slider isn't moving right now:
// go to prev slide and
// emit a scroll event.
if (newevent.direction < 0) {
if ((!swiper.isend || swiper.params.loop) && !swiper.animating) {
swiper.slidenext();
swiper.emit('scroll', newevent.raw);
}
} else if ((!swiper.isbeginning || swiper.params.loop) && !swiper.animating) {
swiper.slideprev();
swiper.emit('scroll', newevent.raw);
} // if you got here is because an animation has been triggered so store the current time
swiper.mousewheel.lastscrolltime = new window.date().gettime(); // return false as a default
return false;
},
releasescroll: function releasescroll(newevent) {
var swiper = this;
var params = swiper.params.mousewheel;
if (newevent.direction < 0) {
if (swiper.isend && !swiper.params.loop && params.releaseonedges) {
// return true to animate scroll on edges
return true;
}
} else if (swiper.isbeginning && !swiper.params.loop && params.releaseonedges) {
// return true to animate scroll on edges
return true;
}
return false;
},
enable: function enable() {
var swiper = this;
var event = mousewheel.event();
if (swiper.params.cssmode) {
swiper.wrapperel.removeeventlistener(event, swiper.mousewheel.handle);
return true;
}
if (!event) return false;
if (swiper.mousewheel.enabled) return false;
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarget !== 'container') {
target = $(swiper.params.mousewheel.eventstarget);
}
target.on('mouseenter', swiper.mousewheel.handlemouseenter);
target.on('mouseleave', swiper.mousewheel.handlemouseleave);
target.on(event, swiper.mousewheel.handle);
swiper.mousewheel.enabled = true;
return true;
},
disable: function disable() {
var swiper = this;
var event = mousewheel.event();
if (swiper.params.cssmode) {
swiper.wrapperel.addeventlistener(event, swiper.mousewheel.handle);
return true;
}
if (!event) return false;
if (!swiper.mousewheel.enabled) return false;
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarget !== 'container') {
target = $(swiper.params.mousewheel.eventstarget);
}
target.off(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,
eventstarget: 'container',
thresholddelta: null,
thresholdtime: null
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
mousewheel: {
enabled: false,
lastscrolltime: now(),
lasteventbeforesnap: undefined,
recentwheelevents: [],
enable: mousewheel.enable,
disable: mousewheel.disable,
handle: mousewheel.handle,
handlemouseenter: mousewheel.handlemouseenter,
handlemouseleave: mousewheel.handlemouseleave,
animateslider: mousewheel.animateslider,
releasescroll: mousewheel.releasescroll
}
});
},
on: {
init: function init(swiper) {
if (!swiper.params.mousewheel.enabled && swiper.params.cssmode) {
swiper.mousewheel.disable();
}
if (swiper.params.mousewheel.enabled) swiper.mousewheel.enable();
},
destroy: function destroy(swiper) {
if (swiper.params.cssmode) {
swiper.mousewheel.enable();
}
if (swiper.mousewheel.enabled) swiper.mousewheel.disable();
}
}
};
var navigation = {
toggleel: function toggleel($el, disabled) {
$el[disabled ? 'addclass' : 'removeclass'](this.params.navigation.disabledclass);
if ($el[0] && $el[0].tagname === 'button') $el[0].disabled = disabled;
},
update: function update() {
// update navigation buttons
var swiper = this;
var params = swiper.params.navigation;
var toggleel = swiper.navigation.toggleel;
if (swiper.params.loop) return;
var _swiper$navigation = swiper.navigation,
$nextel = _swiper$navigation.$nextel,
$prevel = _swiper$navigation.$prevel;
if ($prevel && $prevel.length > 0) {
if (swiper.isbeginning) {
toggleel($prevel, true);
} else {
toggleel($prevel, false);
}
if (swiper.params.watchoverflow && swiper.enabled) {
$prevel[swiper.islocked ? 'addclass' : 'removeclass'](params.lockclass);
}
}
if ($nextel && $nextel.length > 0) {
if (swiper.isend) {
toggleel($nextel, true);
} else {
toggleel($nextel, false);
}
if (swiper.params.watchoverflow && swiper.enabled) {
$nextel[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);
}
extend(swiper.navigation, {
$nextel: $nextel,
nextel: $nextel && $nextel[0],
$prevel: $prevel,
prevel: $prevel && $prevel[0]
});
if (!swiper.enabled) {
if ($nextel) $nextel.addclass(params.lockclass);
if ($prevel) $prevel.addclass(params.lockclass);
}
},
destroy: function destroy() {
var swiper = this;
var _swiper$navigation2 = swiper.navigation,
$nextel = _swiper$navigation2.$nextel,
$prevel = _swiper$navigation2.$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;
bindmodulemethods(swiper, {
navigation: _extends({}, navigation)
});
},
on: {
init: function init(swiper) {
swiper.navigation.init();
swiper.navigation.update();
},
toedge: function toedge(swiper) {
swiper.navigation.update();
},
fromedge: function fromedge(swiper) {
swiper.navigation.update();
},
destroy: function destroy(swiper) {
swiper.navigation.destroy();
},
'enable disable': function enabledisable(swiper) {
var _swiper$navigation3 = swiper.navigation,
$nextel = _swiper$navigation3.$nextel,
$prevel = _swiper$navigation3.$prevel;
if ($nextel) {
$nextel[swiper.enabled ? 'removeclass' : 'addclass'](swiper.params.navigation.lockclass);
}
if ($prevel) {
$prevel[swiper.enabled ? 'removeclass' : 'addclass'](swiper.params.navigation.lockclass);
}
},
click: function click(swiper, e) {
var _swiper$navigation4 = swiper.navigation,
$nextel = _swiper$navigation4.$nextel,
$prevel = _swiper$navigation4.$prevel;
var targetel = e.target;
if (swiper.params.navigation.hideonclick && !$(targetel).is($prevel) && !$(targetel).is($nextel)) {
if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetel || swiper.pagination.el.contains(targetel))) return;
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');
} else {
swiper.emit('navigationhide');
}
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 (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);
var bulletindex = $bullet.index();
$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");
}
if (swiper.params.loop) {
if (bulletindex >= bullets.length - params.dynamicmainbullets) {
for (var _i = params.dynamicmainbullets; _i >= 0; _i -= 1) {
bullets.eq(bullets.length - _i).addclass(params.bulletactiveclass + "-main");
}
bullets.eq(bullets.length - params.dynamicmainbullets - 1).addclass(params.bulletactiveclass + "-prev");
} else {
$firstdisplayedbullet.prev().addclass(params.bulletactiveclass + "-prev").prev().addclass(params.bulletactiveclass + "-prev-prev");
$lastdisplayedbullet.next().addclass(params.bulletactiveclass + "-next").next().addclass(params.bulletactiveclass + "-next-next");
}
} else {
$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(classestoselector(params.currentclass)).text(params.formatfractioncurrent(current + 1));
$el.find(classestoselector(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(classestoselector(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', $el[0]);
} else {
swiper.emit('paginationupdate', $el[0]);
}
if (swiper.params.watchoverflow && swiper.enabled) {
$el[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;
if (swiper.params.freemode && !swiper.params.loop && numberofbullets > slideslength) {
numberofbullets = slideslength;
}
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(classestoselector(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) {
$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', classestoselector(params.bulletclass), function onclick(e) {
e.preventdefault();
var index = $(this).index() * swiper.params.slidespergroup;
if (swiper.params.loop) index += swiper.loopedslides;
swiper.slideto(index);
});
}
extend(swiper.pagination, {
$el: $el,
el: $el[0]
});
if (!swiper.enabled) {
$el.addclass(params.lockclass);
}
},
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', classestoselector(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 formatfractioncurrent(number) {
return number;
},
formatfractiontotal: function formatfractiontotal(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;
bindmodulemethods(swiper, {
pagination: _extends({
dynamicbulletindex: 0
}, pagination)
});
},
on: {
init: function init(swiper) {
swiper.pagination.init();
swiper.pagination.render();
swiper.pagination.update();
},
activeindexchange: function activeindexchange(swiper) {
if (swiper.params.loop) {
swiper.pagination.update();
} else if (typeof swiper.snapindex === 'undefined') {
swiper.pagination.update();
}
},
snapindexchange: function snapindexchange(swiper) {
if (!swiper.params.loop) {
swiper.pagination.update();
}
},
slideslengthchange: function slideslengthchange(swiper) {
if (swiper.params.loop) {
swiper.pagination.render();
swiper.pagination.update();
}
},
snapgridlengthchange: function snapgridlengthchange(swiper) {
if (!swiper.params.loop) {
swiper.pagination.render();
swiper.pagination.update();
}
},
destroy: function destroy(swiper) {
swiper.pagination.destroy();
},
'enable disable': function enabledisable(swiper) {
var $el = swiper.pagination.$el;
if ($el) {
$el[swiper.enabled ? 'removeclass' : 'addclass'](swiper.params.pagination.lockclass);
}
},
click: function click(swiper, e) {
var targetel = e.target;
if (swiper.params.pagination.el && swiper.params.pagination.hideonclick && swiper.pagination.$el.length > 0 && !$(targetel).hasclass(swiper.params.pagination.bulletclass)) {
if (swiper.navigation && (swiper.navigation.nextel && targetel === swiper.navigation.nextel || swiper.navigation.prevel && targetel === swiper.navigation.prevel)) return;
var ishidden = swiper.pagination.$el.hasclass(swiper.params.pagination.hiddenclass);
if (ishidden === true) {
swiper.emit('paginationshow');
} else {
swiper.emit('paginationhide');
}
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,
rtl = swiper.rtltranslate,
progress = swiper.progress;
var dragsize = scrollbar.dragsize,
tracksize = scrollbar.tracksize,
$dragel = scrollbar.$dragel,
$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()) {
$dragel.transform("translate3d(" + newpos + "px, 0, 0)");
$dragel[0].style.width = newsize + "px";
} else {
$dragel.transform("translate3d(0px, " + newpos + "px, 0)");
$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,
$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;
}
extend(scrollbar, {
tracksize: tracksize,
divider: divider,
movedivider: movedivider,
dragsize: dragsize
});
if (swiper.params.watchoverflow && swiper.enabled) {
scrollbar.$el[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].clientx : e.clientx;
}
return e.type === 'touchstart' || e.type === 'touchmove' ? e.targettouches[0].clienty : e.clienty;
},
setdragposition: function setdragposition(e) {
var swiper = this;
var scrollbar = swiper.scrollbar,
rtl = swiper.rtltranslate;
var $el = scrollbar.$el,
dragsize = scrollbar.dragsize,
tracksize = scrollbar.tracksize,
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,
$wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el,
$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);
}
if (swiper.params.cssmode) {
swiper.$wrapperel.css('scroll-snap-type', 'none');
}
swiper.emit('scrollbardragstart', e);
},
ondragmove: function ondragmove(e) {
var swiper = this;
var scrollbar = swiper.scrollbar,
$wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el,
$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,
$wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el;
if (!swiper.scrollbar.istouched) return;
swiper.scrollbar.istouched = false;
if (swiper.params.cssmode) {
swiper.$wrapperel.css('scroll-snap-type', '');
$wrapperel.transition('');
}
if (params.hide) {
cleartimeout(swiper.scrollbar.dragtimeout);
swiper.scrollbar.dragtimeout = 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 document = getdocument();
var scrollbar = swiper.scrollbar,
toucheventstouch = swiper.toucheventstouch,
toucheventsdesktop = swiper.toucheventsdesktop,
params = swiper.params,
support = swiper.support;
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 (!target) return;
if (!support.touch) {
target.addeventlistener(toucheventsdesktop.start, swiper.scrollbar.ondragstart, activelistener);
document.addeventlistener(toucheventsdesktop.move, swiper.scrollbar.ondragmove, activelistener);
document.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 document = getdocument();
var scrollbar = swiper.scrollbar,
toucheventstouch = swiper.toucheventstouch,
toucheventsdesktop = swiper.toucheventsdesktop,
params = swiper.params,
support = swiper.support;
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 (!target) return;
if (!support.touch) {
target.removeeventlistener(toucheventsdesktop.start, swiper.scrollbar.ondragstart, activelistener);
document.removeeventlistener(toucheventsdesktop.move, swiper.scrollbar.ondragmove, activelistener);
document.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,
$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);
}
extend(scrollbar, {
$el: $el,
el: $el[0],
$dragel: $dragel,
dragel: $dragel[0]
});
if (params.draggable) {
scrollbar.enabledraggable();
}
if ($el) {
$el[swiper.enabled ? 'removeclass' : 'addclass'](swiper.params.scrollbar.lockclass);
}
},
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;
bindmodulemethods(swiper, {
scrollbar: _extends({
istouched: false,
timeout: null,
dragtimeout: null
}, scrollbar)
});
},
on: {
init: function init(swiper) {
swiper.scrollbar.init();
swiper.scrollbar.updatesize();
swiper.scrollbar.settranslate();
},
update: function update(swiper) {
swiper.scrollbar.updatesize();
},
resize: function resize(swiper) {
swiper.scrollbar.updatesize();
},
observerupdate: function observerupdate(swiper) {
swiper.scrollbar.updatesize();
},
settranslate: function settranslate(swiper) {
swiper.scrollbar.settranslate();
},
settransition: function settransition(swiper, duration) {
swiper.scrollbar.settransition(duration);
},
'enable disable': function enabledisable(swiper) {
var $el = swiper.scrollbar.$el;
if ($el) {
$el[swiper.enabled ? 'removeclass' : 'addclass'](swiper.params.scrollbar.lockclass);
}
},
destroy: function destroy(swiper) {
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,
slides = swiper.slides,
progress = swiper.progress,
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 (el) {
swiper.parallax.settransform(el, progress);
});
slides.each(function (slideel, slideindex) {
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 (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 (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;
bindmodulemethods(swiper, {
parallax: _extends({}, parallax)
});
},
on: {
beforeinit: function beforeinit(swiper) {
if (!swiper.params.parallax.enabled) return;
swiper.params.watchslidesprogress = true;
swiper.originalparams.watchslidesprogress = true;
},
init: function init(swiper) {
if (!swiper.params.parallax.enabled) return;
swiper.parallax.settranslate();
},
settranslate: function settranslate(swiper) {
if (!swiper.params.parallax.enabled) return;
swiper.parallax.settranslate();
},
settransition: function settransition(swiper, duration) {
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 support = swiper.support;
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.params.slideclass);
if (gesture.$slideel.length === 0) gesture.$slideel = swiper.slides.eq(swiper.activeindex);
gesture.$imageel = gesture.$slideel.find('img, svg, canvas, picture, .swiper-zoom-target');
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;
}
}
if (gesture.$imageel) {
gesture.$imageel.transition(0);
}
swiper.zoom.isscaling = true;
},
ongesturechange: function ongesturechange(e) {
var swiper = this;
var support = swiper.support;
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) {
if (e.type === 'gesturechange') zoom.ongesturestart(e);
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 device = swiper.device;
var support = swiper.support;
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 device = swiper.device;
var zoom = swiper.zoom;
var gesture = zoom.gesture,
image = zoom.image;
if (!gesture.$imageel || gesture.$imageel.length === 0) return;
if (image.istouched) return;
if (device.android && e.cancelable) 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,
image = zoom.image,
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 = gettranslate(gesture.$imagewrapel[0], 'x') || 0;
image.starty = 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;
}
}
if (e.cancelable) {
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,
image = zoom.image,
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) {
if (gesture.$imageel) {
gesture.$imageel.transform('translate3d(0,0,0) scale(1)');
}
if (gesture.$imagewrapel) {
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(e) {
var swiper = this;
var window = getwindow();
var zoom = swiper.zoom;
var params = swiper.params.zoom;
var gesture = zoom.gesture,
image = zoom.image;
if (!gesture.$slideel) {
if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
gesture.$slideel = swiper.$wrapperel.children("." + swiper.params.slideactiveclass);
} else {
gesture.$slideel = swiper.slides.eq(swiper.activeindex);
}
gesture.$imageel = gesture.$slideel.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imagewrapel = gesture.$imageel.parent("." + params.containerclass);
}
if (!gesture.$imageel || gesture.$imageel.length === 0 || !gesture.$imagewrapel || gesture.$imagewrapel.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 + window.scrollx;
offsety = gesture.$slideel.offset().top + window.scrolly;
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) {
if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
gesture.$slideel = swiper.$wrapperel.children("." + swiper.params.slideactiveclass);
} else {
gesture.$slideel = swiper.slides.eq(swiper.activeindex);
}
gesture.$imageel = gesture.$slideel.find('img, svg, canvas, picture, .swiper-zoom-target');
gesture.$imagewrapel = gesture.$imageel.parent("." + params.containerclass);
}
if (!gesture.$imageel || gesture.$imageel.length === 0 || !gesture.$imagewrapel || gesture.$imagewrapel.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;
},
togglegestures: function togglegestures(method) {
var swiper = this;
var zoom = swiper.zoom;
var selector = zoom.slideselector,
passive = zoom.passivelistener;
swiper.$wrapperel[method]('gesturestart', selector, zoom.ongesturestart, passive);
swiper.$wrapperel[method]('gesturechange', selector, zoom.ongesturechange, passive);
swiper.$wrapperel[method]('gestureend', selector, zoom.ongestureend, passive);
},
enablegestures: function enablegestures() {
if (this.zoom.gesturesenabled) return;
this.zoom.gesturesenabled = true;
this.zoom.togglegestures('on');
},
disablegestures: function disablegestures() {
if (!this.zoom.gesturesenabled) return;
this.zoom.gesturesenabled = false;
this.zoom.togglegestures('off');
},
// attach/detach events
enable: function enable() {
var swiper = this;
var support = swiper.support;
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;
var activelistenerwithcapture = support.passivelistener ? {
passive: false,
capture: true
} : true;
var slideselector = "." + swiper.params.slideclass;
swiper.zoom.passivelistener = passivelistener;
swiper.zoom.slideselector = slideselector; // scale image
if (support.gestures) {
swiper.$wrapperel.on(swiper.touchevents.start, swiper.zoom.enablegestures, passivelistener);
swiper.$wrapperel.on(swiper.touchevents.end, swiper.zoom.disablegestures, passivelistener);
} else if (swiper.touchevents.start === 'touchstart') {
swiper.$wrapperel.on(swiper.touchevents.start, slideselector, zoom.ongesturestart, passivelistener);
swiper.$wrapperel.on(swiper.touchevents.move, slideselector, zoom.ongesturechange, activelistenerwithcapture);
swiper.$wrapperel.on(swiper.touchevents.end, slideselector, zoom.ongestureend, passivelistener);
if (swiper.touchevents.cancel) {
swiper.$wrapperel.on(swiper.touchevents.cancel, slideselector, zoom.ongestureend, passivelistener);
}
} // move image
swiper.$wrapperel.on(swiper.touchevents.move, "." + swiper.params.zoom.containerclass, zoom.ontouchmove, activelistenerwithcapture);
},
disable: function disable() {
var swiper = this;
var zoom = swiper.zoom;
if (!zoom.enabled) return;
var support = swiper.support;
swiper.zoom.enabled = false;
var passivelistener = swiper.touchevents.start === 'touchstart' && support.passivelistener && swiper.params.passivelisteners ? {
passive: true,
capture: false
} : false;
var activelistenerwithcapture = support.passivelistener ? {
passive: false,
capture: true
} : true;
var slideselector = "." + swiper.params.slideclass; // scale image
if (support.gestures) {
swiper.$wrapperel.off(swiper.touchevents.start, swiper.zoom.enablegestures, passivelistener);
swiper.$wrapperel.off(swiper.touchevents.end, swiper.zoom.disablegestures, passivelistener);
} else if (swiper.touchevents.start === 'touchstart') {
swiper.$wrapperel.off(swiper.touchevents.start, slideselector, zoom.ongesturestart, passivelistener);
swiper.$wrapperel.off(swiper.touchevents.move, slideselector, zoom.ongesturechange, activelistenerwithcapture);
swiper.$wrapperel.off(swiper.touchevents.end, slideselector, zoom.ongestureend, passivelistener);
if (swiper.touchevents.cancel) {
swiper.$wrapperel.off(swiper.touchevents.cancel, slideselector, zoom.ongestureend, passivelistener);
}
} // move image
swiper.$wrapperel.off(swiper.touchevents.move, "." + swiper.params.zoom.containerclass, zoom.ontouchmove, activelistenerwithcapture);
}
};
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;
bindmodulemethods(swiper, {
zoom: _extends({
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
}
}, 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(swiper) {
if (swiper.params.zoom.enabled) {
swiper.zoom.enable();
}
},
destroy: function destroy(swiper) {
swiper.zoom.disable();
},
touchstart: function touchstart(swiper, e) {
if (!swiper.zoom.enabled) return;
swiper.zoom.ontouchstart(e);
},
touchend: function touchend(swiper, e) {
if (!swiper.zoom.enabled) return;
swiper.zoom.ontouchend(e);
},
doubletap: function doubletap(swiper, e) {
if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
swiper.zoom.toggle(e);
}
},
transitionend: function transitionend(swiper) {
if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
swiper.zoom.ontransitionend();
}
},
slidechange: function slidechange(swiper) {
if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssmode) {
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.push($slideel[0]);
}
if ($images.length === 0) return;
$images.each(function (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');
var $pictureel = $imageel.parent('picture');
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 ($pictureel.length) {
$pictureel.children('source').each(function (sourceel) {
var $source = $(sourceel);
if ($source.attr('data-srcset')) {
$source.attr('srcset', $source.attr('data-srcset'));
$source.removeattr('data-srcset');
}
});
}
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]);
if (swiper.params.autoheight) {
swiper.updateautoheight();
}
});
swiper.emit('lazyimageload', $slideel[0], $imageel[0]);
});
},
load: function load() {
var swiper = this;
var $wrapperel = swiper.$wrapperel,
swiperparams = swiper.params,
slides = swiper.slides,
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 (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 = activeindex + slidesperview; _i < maxindex; _i += 1) {
if (slideexist(_i)) swiper.lazy.loadinslide(_i);
} // prev slides
for (var _i2 = minindex; _i2 < activeindex; _i2 += 1) {
if (slideexist(_i2)) swiper.lazy.loadinslide(_i2);
}
} 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));
}
}
},
checkinviewonload: function checkinviewonload() {
var window = getwindow();
var swiper = this;
if (!swiper || swiper.destroyed) return;
var $scrollelement = swiper.params.lazy.scrollingelement ? $(swiper.params.lazy.scrollingelement) : $(window);
var iswindow = $scrollelement[0] === window;
var scrollelementwidth = iswindow ? window.innerwidth : $scrollelement[0].offsetwidth;
var scrollelementheight = iswindow ? window.innerheight : $scrollelement[0].offsetheight;
var swiperoffset = swiper.$el.offset();
var rtl = swiper.rtltranslate;
var inview = false;
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] <= scrollelementwidth && point[1] >= 0 && point[1] <= scrollelementheight) {
if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
inview = true;
}
}
if (inview) {
swiper.lazy.load();
$scrollelement.off('scroll', swiper.lazy.checkinviewonload);
} else if (!swiper.lazy.scrollhandlerattached) {
swiper.lazy.scrollhandlerattached = true;
$scrollelement.on('scroll', swiper.lazy.checkinviewonload);
}
}
};
var lazy$1 = {
name: 'lazy',
params: {
lazy: {
checkinview: false,
enabled: false,
loadprevnext: false,
loadprevnextamount: 1,
loadontransitionstart: false,
scrollingelement: '',
elementclass: 'swiper-lazy',
loadingclass: 'swiper-lazy-loading',
loadedclass: 'swiper-lazy-loaded',
preloaderclass: 'swiper-lazy-preloader'
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
lazy: _extends({
initialimageloaded: false
}, lazy)
});
},
on: {
beforeinit: function beforeinit(swiper) {
if (swiper.params.lazy.enabled && swiper.params.preloadimages) {
swiper.params.preloadimages = false;
}
},
init: function init(swiper) {
if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialslide === 0) {
if (swiper.params.lazy.checkinview) {
swiper.lazy.checkinviewonload();
} else {
swiper.lazy.load();
}
}
},
scroll: function scroll(swiper) {
if (swiper.params.freemode && !swiper.params.freemodesticky) {
swiper.lazy.load();
}
},
'scrollbardragmove resize _freemodenomomentumrelease': function lazyload(swiper) {
if (swiper.params.lazy.enabled) {
swiper.lazy.load();
}
},
transitionstart: function transitionstart(swiper) {
if (swiper.params.lazy.enabled) {
if (swiper.params.lazy.loadontransitionstart || !swiper.params.lazy.loadontransitionstart && !swiper.lazy.initialimageloaded) {
swiper.lazy.load();
}
}
},
transitionend: function transitionend(swiper) {
if (swiper.params.lazy.enabled && !swiper.params.lazy.loadontransitionstart) {
swiper.lazy.load();
}
},
slidechange: function slidechange(swiper) {
if (swiper.params.lazy.enabled && swiper.params.cssmode) {
swiper.lazy.load();
}
}
}
};
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, bycontroller) {
var swiper = this;
var controlled = swiper.controller.control;
var multiplier;
var controlledtranslate;
var swiper = swiper.constructor;
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 swiper = swiper.constructor;
var controlled = swiper.controller.control;
var i;
function setcontrolledtransition(c) {
c.settransition(duration, swiper);
if (duration !== 0) {
c.transitionstart();
if (c.params.autoheight) {
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;
bindmodulemethods(swiper, {
controller: _extends({
control: swiper.params.controller.control
}, controller)
});
},
on: {
update: function update(swiper) {
if (!swiper.controller.control) return;
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
resize: function resize(swiper) {
if (!swiper.controller.control) return;
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
observerupdate: function observerupdate(swiper) {
if (!swiper.controller.control) return;
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
settranslate: function settranslate(swiper, translate, bycontroller) {
if (!swiper.controller.control) return;
swiper.controller.settranslate(translate, bycontroller);
},
settransition: function settransition(swiper, duration, bycontroller) {
if (!swiper.controller.control) return;
swiper.controller.settransition(duration, bycontroller);
}
}
};
var a11y = {
getrandomnumber: function getrandomnumber(size) {
if (size === void 0) {
size = 16;
}
var randomchar = function randomchar() {
return math.round(16 * math.random()).tostring(16);
};
return 'x'.repeat(size).replace(/x/g, randomchar);
},
makeelfocusable: function makeelfocusable($el) {
$el.attr('tabindex', '0');
return $el;
},
makeelnotfocusable: function makeelnotfocusable($el) {
$el.attr('tabindex', '-1');
return $el;
},
addelrole: function addelrole($el, role) {
$el.attr('role', role);
return $el;
},
addelroledescription: function addelroledescription($el, description) {
$el.attr('aria-roledescription', description);
return $el;
},
addelcontrols: function addelcontrols($el, controls) {
$el.attr('aria-controls', controls);
return $el;
},
addellabel: function addellabel($el, label) {
$el.attr('aria-label', label);
return $el;
},
addelid: function addelid($el, id) {
$el.attr('id', id);
return $el;
},
addellive: function addellive($el, live) {
$el.attr('aria-live', live);
return $el;
},
disableel: function disableel($el) {
$el.attr('aria-disabled', true);
return $el;
},
enableel: function enableel($el) {
$el.attr('aria-disabled', false);
return $el;
},
onenterorspacekey: function onenterorspacekey(e) {
if (e.keycode !== 13 && e.keycode !== 32) return;
var swiper = this;
var params = swiper.params.a11y;
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(classestoselector(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 || !swiper.navigation) return;
var _swiper$navigation = swiper.navigation,
$nextel = _swiper$navigation.$nextel,
$prevel = _swiper$navigation.$prevel;
if ($prevel && $prevel.length > 0) {
if (swiper.isbeginning) {
swiper.a11y.disableel($prevel);
swiper.a11y.makeelnotfocusable($prevel);
} else {
swiper.a11y.enableel($prevel);
swiper.a11y.makeelfocusable($prevel);
}
}
if ($nextel && $nextel.length > 0) {
if (swiper.isend) {
swiper.a11y.disableel($nextel);
swiper.a11y.makeelnotfocusable($nextel);
} else {
swiper.a11y.enableel($nextel);
swiper.a11y.makeelfocusable($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 (bulletel) {
var $bulletel = $(bulletel);
swiper.a11y.makeelfocusable($bulletel);
if (!swiper.params.pagination.renderbullet) {
swiper.a11y.addelrole($bulletel, 'button');
swiper.a11y.addellabel($bulletel, params.paginationbulletmessage.replace(/\{\{index\}\}/, $bulletel.index() + 1));
}
});
}
},
init: function init() {
var swiper = this;
var params = swiper.params.a11y;
swiper.$el.append(swiper.a11y.liveregion); // container
var $containerel = swiper.$el;
if (params.containerroledescriptionmessage) {
swiper.a11y.addelroledescription($containerel, params.containerroledescriptionmessage);
}
if (params.containermessage) {
swiper.a11y.addellabel($containerel, params.containermessage);
} // wrapper
var $wrapperel = swiper.$wrapperel;
var wrapperid = $wrapperel.attr('id') || "swiper-wrapper-" + swiper.a11y.getrandomnumber(16);
var live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
swiper.a11y.addelid($wrapperel, wrapperid);
swiper.a11y.addellive($wrapperel, live); // slide
if (params.itemroledescriptionmessage) {
swiper.a11y.addelroledescription($(swiper.slides), params.itemroledescriptionmessage);
}
swiper.a11y.addelrole($(swiper.slides), params.sliderole);
swiper.slides.each(function (slideel) {
var $slideel = $(slideel);
var arialabelmessage = params.slidelabelmessage.replace(/\{\{index\}\}/, $slideel.index() + 1).replace(/\{\{slideslength\}\}/, swiper.slides.length);
swiper.a11y.addellabel($slideel, arialabelmessage);
}); // navigation
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.length) {
swiper.a11y.makeelfocusable($nextel);
if ($nextel[0].tagname !== 'button') {
swiper.a11y.addelrole($nextel, 'button');
$nextel.on('keydown', swiper.a11y.onenterorspacekey);
}
swiper.a11y.addellabel($nextel, params.nextslidemessage);
swiper.a11y.addelcontrols($nextel, wrapperid);
}
if ($prevel && $prevel.length) {
swiper.a11y.makeelfocusable($prevel);
if ($prevel[0].tagname !== 'button') {
swiper.a11y.addelrole($prevel, 'button');
$prevel.on('keydown', swiper.a11y.onenterorspacekey);
}
swiper.a11y.addellabel($prevel, params.prevslidemessage);
swiper.a11y.addelcontrols($prevel, wrapperid);
} // pagination
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.$el.on('keydown', classestoselector(swiper.params.pagination.bulletclass), swiper.a11y.onenterorspacekey);
}
},
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.onenterorspacekey);
}
if ($prevel) {
$prevel.off('keydown', swiper.a11y.onenterorspacekey);
} // pagination
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.$el.off('keydown', classestoselector(swiper.params.pagination.bulletclass), swiper.a11y.onenterorspacekey);
}
}
};
var a11y$1 = {
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}}',
slidelabelmessage: '{{index}} / {{slideslength}}',
containermessage: null,
containerroledescriptionmessage: null,
itemroledescriptionmessage: null,
sliderole: 'group'
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
a11y: _extends({}, a11y, {
liveregion: $("")
})
});
},
on: {
afterinit: function afterinit(swiper) {
if (!swiper.params.a11y.enabled) return;
swiper.a11y.init();
swiper.a11y.updatenavigation();
},
toedge: function toedge(swiper) {
if (!swiper.params.a11y.enabled) return;
swiper.a11y.updatenavigation();
},
fromedge: function fromedge(swiper) {
if (!swiper.params.a11y.enabled) return;
swiper.a11y.updatenavigation();
},
paginationupdate: function paginationupdate(swiper) {
if (!swiper.params.a11y.enabled) return;
swiper.a11y.updatepagination();
},
destroy: function destroy(swiper) {
if (!swiper.params.a11y.enabled) return;
swiper.a11y.destroy();
}
}
};
var history = {
init: function init() {
var swiper = this;
var window = getwindow();
if (!swiper.params.history) return;
if (!window.history || !window.history.pushstate) {
swiper.params.history.enabled = false;
swiper.params.hashnavigation.enabled = true;
return;
}
var history = swiper.history;
history.initialized = true;
history.paths = history.getpathvalues(swiper.params.url);
if (!history.paths.key && !history.paths.value) return;
history.scrolltoslide(0, history.paths.value, swiper.params.runcallbacksoninit);
if (!swiper.params.history.replacestate) {
window.addeventlistener('popstate', swiper.history.sethistorypopstate);
}
},
destroy: function destroy() {
var swiper = this;
var window = getwindow();
if (!swiper.params.history.replacestate) {
window.removeeventlistener('popstate', swiper.history.sethistorypopstate);
}
},
sethistorypopstate: function sethistorypopstate() {
var swiper = this;
swiper.history.paths = history.getpathvalues(swiper.params.url);
swiper.history.scrolltoslide(swiper.params.speed, swiper.history.paths.value, false);
},
getpathvalues: function getpathvalues(urloverride) {
var window = getwindow();
var location;
if (urloverride) {
location = new url(urloverride);
} else {
location = window.location;
}
var patharray = 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;
var window = getwindow();
if (!swiper.history.initialized || !swiper.params.history.enabled) return;
var location;
if (swiper.params.url) {
location = new url(swiper.params.url);
} else {
location = window.location;
}
var slide = swiper.slides.eq(index);
var value = history.slugify(slide.attr('data-history'));
if (swiper.params.history.root.length > 0) {
var root = swiper.params.history.root;
if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
value = root + "/" + key + "/" + value;
} else if (!location.pathname.includes(key)) {
value = key + "/" + value;
}
var currentstate = window.history.state;
if (currentstate && currentstate.value === value) {
return;
}
if (swiper.params.history.replacestate) {
window.history.replacestate({
value: value
}, null, value);
} else {
window.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,
root: '',
replacestate: false,
key: 'slides'
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
history: _extends({}, history)
});
},
on: {
init: function init(swiper) {
if (swiper.params.history.enabled) {
swiper.history.init();
}
},
destroy: function destroy(swiper) {
if (swiper.params.history.enabled) {
swiper.history.destroy();
}
},
'transitionend _freemodenomomentumrelease': function transitionend_freemodenomomentumrelease(swiper) {
if (swiper.history.initialized) {
swiper.history.sethistory(swiper.params.history.key, swiper.activeindex);
}
},
slidechange: function slidechange(swiper) {
if (swiper.history.initialized && swiper.params.cssmode) {
swiper.history.sethistory(swiper.params.history.key, swiper.activeindex);
}
}
}
};
var hashnavigation = {
onhashcange: function onhashcange() {
var swiper = this;
var document = getdocument();
swiper.emit('hashchange');
var newhash = document.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;
var window = getwindow();
var document = getdocument();
if (!swiper.hashnavigation.initialized || !swiper.params.hashnavigation.enabled) return;
if (swiper.params.hashnavigation.replacestate && window.history && window.history.replacestate) {
window.history.replacestate(null, null, "#" + swiper.slides.eq(swiper.activeindex).attr('data-hash') || '');
swiper.emit('hashset');
} else {
var slide = swiper.slides.eq(swiper.activeindex);
var hash = slide.attr('data-hash') || slide.attr('data-history');
document.location.hash = hash || '';
swiper.emit('hashset');
}
},
init: function init() {
var swiper = this;
var document = getdocument();
var window = getwindow();
if (!swiper.params.hashnavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;
swiper.hashnavigation.initialized = true;
var hash = document.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) {
$(window).on('hashchange', swiper.hashnavigation.onhashcange);
}
},
destroy: function destroy() {
var swiper = this;
var window = getwindow();
if (swiper.params.hashnavigation.watchstate) {
$(window).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;
bindmodulemethods(swiper, {
hashnavigation: _extends({
initialized: false
}, hashnavigation)
});
},
on: {
init: function init(swiper) {
if (swiper.params.hashnavigation.enabled) {
swiper.hashnavigation.init();
}
},
destroy: function destroy(swiper) {
if (swiper.params.hashnavigation.enabled) {
swiper.hashnavigation.destroy();
}
},
'transitionend _freemodenomomentumrelease': function transitionend_freemodenomomentumrelease(swiper) {
if (swiper.hashnavigation.initialized) {
swiper.hashnavigation.sethash();
}
},
slidechange: function slidechange(swiper) {
if (swiper.hashnavigation.initialized && swiper.params.cssmode) {
swiper.hashnavigation.sethash();
}
}
}
};
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 = nexttick(function () {
var autoplayresult;
if (swiper.params.autoplay.reversedirection) {
if (swiper.params.loop) {
swiper.loopfix();
autoplayresult = swiper.slideprev(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.isbeginning) {
autoplayresult = swiper.slideprev(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.params.autoplay.stoponlastslide) {
autoplayresult = 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();
autoplayresult = swiper.slidenext(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.isend) {
autoplayresult = swiper.slidenext(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.params.autoplay.stoponlastslide) {
autoplayresult = swiper.slideto(0, swiper.params.speed, true, true);
swiper.emit('autoplay');
} else {
swiper.autoplay.stop();
}
if (swiper.params.cssmode && swiper.autoplay.running) swiper.autoplay.run();else if (autoplayresult === false) {
swiper.autoplay.run();
}
}, 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 {
['transitionend', 'webkittransitionend'].foreach(function (event) {
swiper.$wrapperel[0].addeventlistener(event, swiper.autoplay.ontransitionend);
});
}
},
onvisibilitychange: function onvisibilitychange() {
var swiper = this;
var document = getdocument();
if (document.visibilitystate === 'hidden' && swiper.autoplay.running) {
swiper.autoplay.pause();
}
if (document.visibilitystate === 'visible' && swiper.autoplay.paused) {
swiper.autoplay.run();
swiper.autoplay.paused = false;
}
},
ontransitionend: function ontransitionend(e) {
var swiper = this;
if (!swiper || swiper.destroyed || !swiper.$wrapperel) return;
if (e.target !== swiper.$wrapperel[0]) return;
['transitionend', 'webkittransitionend'].foreach(function (event) {
swiper.$wrapperel[0].removeeventlistener(event, swiper.autoplay.ontransitionend);
});
swiper.autoplay.paused = false;
if (!swiper.autoplay.running) {
swiper.autoplay.stop();
} else {
swiper.autoplay.run();
}
},
onmouseenter: function onmouseenter() {
var swiper = this;
swiper.autoplay.pause();
['transitionend', 'webkittransitionend'].foreach(function (event) {
swiper.$wrapperel[0].removeeventlistener(event, swiper.autoplay.ontransitionend);
});
},
onmouseleave: function onmouseleave() {
var swiper = this;
swiper.autoplay.paused = false;
swiper.autoplay.run();
},
attachmouseevents: function attachmouseevents() {
var swiper = this;
if (swiper.params.autoplay.pauseonmouseenter) {
swiper.$el.on('mouseenter', swiper.autoplay.onmouseenter);
swiper.$el.on('mouseleave', swiper.autoplay.onmouseleave);
}
},
detachmouseevents: function detachmouseevents() {
var swiper = this;
swiper.$el.off('mouseenter', swiper.autoplay.onmouseenter);
swiper.$el.off('mouseleave', swiper.autoplay.onmouseleave);
}
};
var autoplay$1 = {
name: 'autoplay',
params: {
autoplay: {
enabled: false,
delay: 3000,
waitfortransition: true,
disableoninteraction: true,
stoponlastslide: false,
reversedirection: false,
pauseonmouseenter: false
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
autoplay: _extends({}, autoplay, {
running: false,
paused: false
})
});
},
on: {
init: function init(swiper) {
if (swiper.params.autoplay.enabled) {
swiper.autoplay.start();
var document = getdocument();
document.addeventlistener('visibilitychange', swiper.autoplay.onvisibilitychange);
swiper.autoplay.attachmouseevents();
}
},
beforetransitionstart: function beforetransitionstart(swiper, speed, internal) {
if (swiper.autoplay.running) {
if (internal || !swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.pause(speed);
} else {
swiper.autoplay.stop();
}
}
},
sliderfirstmove: function sliderfirstmove(swiper) {
if (swiper.autoplay.running) {
if (swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.stop();
} else {
swiper.autoplay.pause();
}
}
},
touchend: function touchend(swiper) {
if (swiper.params.cssmode && swiper.autoplay.paused && !swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.run();
}
},
destroy: function destroy(swiper) {
swiper.autoplay.detachmouseevents();
if (swiper.autoplay.running) {
swiper.autoplay.stop();
}
var document = getdocument();
document.removeeventlistener('visibilitychange', swiper.autoplay.onvisibilitychange);
}
}
};
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,
$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;
bindmodulemethods(swiper, {
fadeeffect: _extends({}, fade)
});
},
on: {
beforeinit: function beforeinit(swiper) {
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
};
extend(swiper.params, overwriteparams);
extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate(swiper) {
if (swiper.params.effect !== 'fade') return;
swiper.fadeeffect.settranslate();
},
settransition: function settransition(swiper, duration) {
if (swiper.params.effect !== 'fade') return;
swiper.fadeeffect.settransition(duration);
}
}
};
var cube = {
settranslate: function settranslate() {
var swiper = this;
var $el = swiper.$el,
$wrapperel = swiper.$wrapperel,
slides = swiper.slides,
swiperwidth = swiper.width,
swiperheight = swiper.height,
rtl = swiper.rtltranslate,
swipersize = swiper.size,
browser = swiper.browser;
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.iswebview ? -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,
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;
bindmodulemethods(swiper, {
cubeeffect: _extends({}, cube)
});
},
on: {
beforeinit: function beforeinit(swiper) {
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
};
extend(swiper.params, overwriteparams);
extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate(swiper) {
if (swiper.params.effect !== 'cube') return;
swiper.cubeeffect.settranslate();
},
settransition: function settransition(swiper, duration) {
if (swiper.params.effect !== 'cube') return;
swiper.cubeeffect.settransition(duration);
}
}
};
var flip = {
settranslate: function settranslate() {
var swiper = this;
var slides = swiper.slides,
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,
activeindex = swiper.activeindex,
$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;
bindmodulemethods(swiper, {
flipeffect: _extends({}, flip)
});
},
on: {
beforeinit: function beforeinit(swiper) {
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
};
extend(swiper.params, overwriteparams);
extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate(swiper) {
if (swiper.params.effect !== 'flip') return;
swiper.flipeffect.settranslate();
},
settransition: function settransition(swiper, duration) {
if (swiper.params.effect !== 'flip') return;
swiper.flipeffect.settransition(duration);
}
}
};
var coverflow = {
settranslate: function settranslate() {
var swiper = this;
var swiperwidth = swiper.width,
swiperheight = swiper.height,
slides = swiper.slides,
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 stretch = params.stretch; // allow percentage to make a relative stretch for responsive sliders
if (typeof stretch === 'string' && stretch.indexof('%') !== -1) {
stretch = parsefloat(params.stretch) / 100 * slidesize;
}
var translatey = ishorizontal ? 0 : stretch * offsetmultiplier;
var translatex = ishorizontal ? stretch * offsetmultiplier : 0;
var scale = 1 - (1 - params.scale) * math.abs(offsetmultiplier); // 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;
if (math.abs(scale) < 0.001) scale = 0;
var slidetransform = "translate3d(" + translatex + "px," + translatey + "px," + translatez + "px) rotatex(" + rotatex + "deg) rotatey(" + rotatey + "deg) scale(" + scale + ")";
$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;
}
}
},
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,
scale: 1,
modifier: 1,
slideshadows: true
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
coverfloweffect: _extends({}, coverflow)
});
},
on: {
beforeinit: function beforeinit(swiper) {
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(swiper) {
if (swiper.params.effect !== 'coverflow') return;
swiper.coverfloweffect.settranslate();
},
settransition: function settransition(swiper, duration) {
if (swiper.params.effect !== 'coverflow') return;
swiper.coverfloweffect.settransition(duration);
}
}
};
var thumbs = {
init: function init() {
var swiper = this;
var thumbsparams = swiper.params.thumbs;
if (swiper.thumbs.initialized) return false;
swiper.thumbs.initialized = true;
var swiperclass = swiper.constructor;
if (thumbsparams.swiper instanceof swiperclass) {
swiper.thumbs.swiper = thumbsparams.swiper;
extend(swiper.thumbs.swiper.originalparams, {
watchslidesprogress: true,
slidetoclickedslide: false
});
extend(swiper.thumbs.swiper.params, {
watchslidesprogress: true,
slidetoclickedslide: false
});
} else if (isobject(thumbsparams.swiper)) {
swiper.thumbs.swiper = new swiperclass(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);
return true;
},
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;
var autoscrolloffset = swiper.params.thumbs.autoscrolloffset;
var useoffset = autoscrolloffset && !thumbsswiper.params.loop;
if (swiper.realindex !== thumbsswiper.realindex || useoffset) {
var currentthumbsindex = thumbsswiper.activeindex;
var newthumbsindex;
var direction;
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;
direction = swiper.activeindex > swiper.previousindex ? 'next' : 'prev';
} else {
newthumbsindex = swiper.realindex;
direction = newthumbsindex > swiper.previousindex ? 'next' : 'prev';
}
if (useoffset) {
newthumbsindex += direction === 'next' ? autoscrolloffset : -1 * autoscrolloffset;
}
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;
}
if (!swiper.params.thumbs.multipleactivethumbs) {
thumbstoactivate = 1;
}
thumbstoactivate = math.floor(thumbstoactivate);
thumbsswiper.slides.removeclass(thumbactiveclass);
if (thumbsswiper.params.loop || thumbsswiper.params.virtual && thumbsswiper.params.virtual.enabled) {
for (var i = 0; i < thumbstoactivate; i += 1) {
thumbsswiper.$wrapperel.children("[data-swiper-slide-index=\"" + (swiper.realindex + i) + "\"]").addclass(thumbactiveclass);
}
} else {
for (var _i = 0; _i < thumbstoactivate; _i += 1) {
thumbsswiper.slides.eq(swiper.realindex + _i).addclass(thumbactiveclass);
}
}
}
};
var thumbs$1 = {
name: 'thumbs',
params: {
thumbs: {
swiper: null,
multipleactivethumbs: true,
autoscrolloffset: 0,
slidethumbactiveclass: 'swiper-slide-thumb-active',
thumbscontainerclass: 'swiper-container-thumbs'
}
},
create: function create() {
var swiper = this;
bindmodulemethods(swiper, {
thumbs: _extends({
swiper: null,
initialized: false
}, thumbs)
});
},
on: {
beforeinit: function beforeinit(swiper) {
var thumbs = swiper.params.thumbs;
if (!thumbs || !thumbs.swiper) return;
swiper.thumbs.init();
swiper.thumbs.update(true);
},
slidechange: function slidechange(swiper) {
if (!swiper.thumbs.swiper) return;
swiper.thumbs.update();
},
update: function update(swiper) {
if (!swiper.thumbs.swiper) return;
swiper.thumbs.update();
},
resize: function resize(swiper) {
if (!swiper.thumbs.swiper) return;
swiper.thumbs.update();
},
observerupdate: function observerupdate(swiper) {
if (!swiper.thumbs.swiper) return;
swiper.thumbs.update();
},
settransition: function settransition(swiper, duration) {
var thumbsswiper = swiper.thumbs.swiper;
if (!thumbsswiper) return;
thumbsswiper.settransition(duration);
},
beforedestroy: function beforedestroy(swiper) {
var thumbsswiper = swiper.thumbs.swiper;
if (!thumbsswiper) return;
if (swiper.thumbs.swipercreated && thumbsswiper) {
thumbsswiper.destroy();
}
}
}
};
// swiper class
var components = [virtual$1, keyboard$1, mousewheel$1, navigation$1, pagination$1, scrollbar$1, parallax$1, zoom$1, lazy$1, controller$1, a11y$1, history$1, hashnavigation$1, autoplay$1, effectfade, effectcube, effectflip, effectcoverflow, thumbs$1];
swiper.use(components);
return swiper;
})));
//# sourcemappingurl=swiper-bundle.js.map