@realsee/dnalogel 2.1.0-alpha.12 → 2.1.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PanoTagPlugin/index.js +4126 -24
- package/dist/index.es.js +4105 -3
- package/dist/index.js +4127 -25
- package/dist/index.umd.js +4128 -27
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var line = require('@realsee/five/line');
|
|
|
8
8
|
var internal = require('svelte/internal');
|
|
9
9
|
var svelte = require('svelte');
|
|
10
10
|
var easing = require('svelte/easing');
|
|
11
|
-
var transition = require('svelte/transition');
|
|
11
|
+
var transition$1 = require('svelte/transition');
|
|
12
12
|
var store = require('svelte/store');
|
|
13
13
|
var five = require('@realsee/five');
|
|
14
14
|
var FBXLoader = require('three/examples/jsm/loaders/FBXLoader');
|
|
@@ -18,7 +18,8 @@ var classNames = require('classnames');
|
|
|
18
18
|
var objectAssignDeep = require('object-assign-deep');
|
|
19
19
|
var anime = require('animejs');
|
|
20
20
|
var svelte$1 = require('swiper/svelte');
|
|
21
|
-
var
|
|
21
|
+
var ssrWindow = require('ssr-window');
|
|
22
|
+
var dom7 = require('dom7');
|
|
22
23
|
require('swiper/css');
|
|
23
24
|
require('swiper/css/autoplay');
|
|
24
25
|
|
|
@@ -4882,7 +4883,7 @@ function create_if_block$n(ctx) {
|
|
|
4882
4883
|
|
|
4883
4884
|
if (!div_intro) {
|
|
4884
4885
|
internal.add_render_callback(() => {
|
|
4885
|
-
div_intro = internal.create_in_transition(div, transition.fade, {
|
|
4886
|
+
div_intro = internal.create_in_transition(div, transition$1.fade, {
|
|
4886
4887
|
duration: /*duration*/ ctx[0],
|
|
4887
4888
|
easing: easing.linear
|
|
4888
4889
|
});
|
|
@@ -20390,7 +20391,7 @@ function create_if_block$h(ctx) {
|
|
|
20390
20391
|
internal.add_render_callback(() => {
|
|
20391
20392
|
if (path_outro) path_outro.end(1);
|
|
20392
20393
|
|
|
20393
|
-
path_intro = internal.create_in_transition(path, transition.draw, {
|
|
20394
|
+
path_intro = internal.create_in_transition(path, transition$1.draw, {
|
|
20394
20395
|
duration: /*duration*/ ctx[1],
|
|
20395
20396
|
delay: /*inDelay*/ ctx[0]
|
|
20396
20397
|
});
|
|
@@ -20405,7 +20406,7 @@ function create_if_block$h(ctx) {
|
|
|
20405
20406
|
if (path_intro) path_intro.invalidate();
|
|
20406
20407
|
|
|
20407
20408
|
if (local) {
|
|
20408
|
-
path_outro = internal.create_out_transition(path, transition.draw, {
|
|
20409
|
+
path_outro = internal.create_out_transition(path, transition$1.draw, {
|
|
20409
20410
|
duration: /*duration*/ ctx[1],
|
|
20410
20411
|
delay: /*outDelay*/ ctx[2]
|
|
20411
20412
|
});
|
|
@@ -20611,7 +20612,7 @@ function create_if_block$g(ctx) {
|
|
|
20611
20612
|
if (local) {
|
|
20612
20613
|
internal.add_render_callback(() => {
|
|
20613
20614
|
if (div_outro) div_outro.end(1);
|
|
20614
|
-
div_intro = internal.create_in_transition(div, transition.fade, { duration: /*inDelay*/ ctx[0] });
|
|
20615
|
+
div_intro = internal.create_in_transition(div, transition$1.fade, { duration: /*inDelay*/ ctx[0] });
|
|
20615
20616
|
div_intro.start();
|
|
20616
20617
|
});
|
|
20617
20618
|
}
|
|
@@ -20622,7 +20623,7 @@ function create_if_block$g(ctx) {
|
|
|
20622
20623
|
if (div_intro) div_intro.invalidate();
|
|
20623
20624
|
|
|
20624
20625
|
if (local) {
|
|
20625
|
-
div_outro = internal.create_out_transition(div, transition.fade, { duration: /*outDelay*/ ctx[1] });
|
|
20626
|
+
div_outro = internal.create_out_transition(div, transition$1.fade, { duration: /*outDelay*/ ctx[1] });
|
|
20626
20627
|
}
|
|
20627
20628
|
|
|
20628
20629
|
current = false;
|
|
@@ -21073,7 +21074,7 @@ function create_if_block$f(ctx) {
|
|
|
21073
21074
|
internal.add_render_callback(() => {
|
|
21074
21075
|
if (div0_outro) div0_outro.end(1);
|
|
21075
21076
|
|
|
21076
|
-
div0_intro = internal.create_in_transition(div0, transition.fade, {
|
|
21077
|
+
div0_intro = internal.create_in_transition(div0, transition$1.fade, {
|
|
21077
21078
|
duration: /*duration*/ ctx[2],
|
|
21078
21079
|
delay: /*inDelay*/ ctx[3],
|
|
21079
21080
|
easing: easing.cubicInOut
|
|
@@ -21090,7 +21091,7 @@ function create_if_block$f(ctx) {
|
|
|
21090
21091
|
if (div0_intro) div0_intro.invalidate();
|
|
21091
21092
|
|
|
21092
21093
|
if (local) {
|
|
21093
|
-
div0_outro = internal.create_out_transition(div0, transition.fade, {
|
|
21094
|
+
div0_outro = internal.create_out_transition(div0, transition$1.fade, {
|
|
21094
21095
|
duration: /*duration*/ ctx[2],
|
|
21095
21096
|
delay: /*outDelay*/ ctx[4],
|
|
21096
21097
|
easing: easing.cubicInOut
|
|
@@ -21809,7 +21810,7 @@ function create_if_block$c(ctx) {
|
|
|
21809
21810
|
internal.add_render_callback(() => {
|
|
21810
21811
|
if (path_outro) path_outro.end(1);
|
|
21811
21812
|
|
|
21812
|
-
path_intro = internal.create_in_transition(path, transition.draw, {
|
|
21813
|
+
path_intro = internal.create_in_transition(path, transition$1.draw, {
|
|
21813
21814
|
duration: /*duration*/ ctx[1],
|
|
21814
21815
|
delay: /*inDelay*/ ctx[0],
|
|
21815
21816
|
easing: easing.cubicOut
|
|
@@ -21825,7 +21826,7 @@ function create_if_block$c(ctx) {
|
|
|
21825
21826
|
if (path_intro) path_intro.invalidate();
|
|
21826
21827
|
|
|
21827
21828
|
if (local) {
|
|
21828
|
-
path_outro = internal.create_out_transition(path, transition.draw, {
|
|
21829
|
+
path_outro = internal.create_out_transition(path, transition$1.draw, {
|
|
21829
21830
|
duration: /*duration*/ ctx[1],
|
|
21830
21831
|
delay: /*outDelay*/ ctx[2],
|
|
21831
21832
|
easing: easing.cubicInOut
|
|
@@ -21951,6 +21952,4107 @@ class Polyline extends internal.SvelteComponent {
|
|
|
21951
21952
|
}
|
|
21952
21953
|
}
|
|
21953
21954
|
|
|
21955
|
+
const Methods = {
|
|
21956
|
+
addClass: dom7.addClass,
|
|
21957
|
+
removeClass: dom7.removeClass,
|
|
21958
|
+
hasClass: dom7.hasClass,
|
|
21959
|
+
toggleClass: dom7.toggleClass,
|
|
21960
|
+
attr: dom7.attr,
|
|
21961
|
+
removeAttr: dom7.removeAttr,
|
|
21962
|
+
transform: dom7.transform,
|
|
21963
|
+
transition: dom7.transition,
|
|
21964
|
+
on: dom7.on,
|
|
21965
|
+
off: dom7.off,
|
|
21966
|
+
trigger: dom7.trigger,
|
|
21967
|
+
transitionEnd: dom7.transitionEnd,
|
|
21968
|
+
outerWidth: dom7.outerWidth,
|
|
21969
|
+
outerHeight: dom7.outerHeight,
|
|
21970
|
+
styles: dom7.styles,
|
|
21971
|
+
offset: dom7.offset,
|
|
21972
|
+
css: dom7.css,
|
|
21973
|
+
each: dom7.each,
|
|
21974
|
+
html: dom7.html,
|
|
21975
|
+
text: dom7.text,
|
|
21976
|
+
is: dom7.is,
|
|
21977
|
+
index: dom7.index,
|
|
21978
|
+
eq: dom7.eq,
|
|
21979
|
+
append: dom7.append,
|
|
21980
|
+
prepend: dom7.prepend,
|
|
21981
|
+
next: dom7.next,
|
|
21982
|
+
nextAll: dom7.nextAll,
|
|
21983
|
+
prev: dom7.prev,
|
|
21984
|
+
prevAll: dom7.prevAll,
|
|
21985
|
+
parent: dom7.parent,
|
|
21986
|
+
parents: dom7.parents,
|
|
21987
|
+
closest: dom7.closest,
|
|
21988
|
+
find: dom7.find,
|
|
21989
|
+
children: dom7.children,
|
|
21990
|
+
filter: dom7.filter,
|
|
21991
|
+
remove: dom7.remove
|
|
21992
|
+
};
|
|
21993
|
+
Object.keys(Methods).forEach(methodName => {
|
|
21994
|
+
Object.defineProperty(dom7.$.fn, methodName, {
|
|
21995
|
+
value: Methods[methodName],
|
|
21996
|
+
writable: true
|
|
21997
|
+
});
|
|
21998
|
+
});
|
|
21999
|
+
|
|
22000
|
+
function deleteProps(obj) {
|
|
22001
|
+
const object = obj;
|
|
22002
|
+
Object.keys(object).forEach(key => {
|
|
22003
|
+
try {
|
|
22004
|
+
object[key] = null;
|
|
22005
|
+
} catch (e) {// no getter for object
|
|
22006
|
+
}
|
|
22007
|
+
|
|
22008
|
+
try {
|
|
22009
|
+
delete object[key];
|
|
22010
|
+
} catch (e) {// something got wrong
|
|
22011
|
+
}
|
|
22012
|
+
});
|
|
22013
|
+
}
|
|
22014
|
+
|
|
22015
|
+
function nextTick(callback, delay = 0) {
|
|
22016
|
+
return setTimeout(callback, delay);
|
|
22017
|
+
}
|
|
22018
|
+
|
|
22019
|
+
function now() {
|
|
22020
|
+
return Date.now();
|
|
22021
|
+
}
|
|
22022
|
+
|
|
22023
|
+
function getComputedStyle$1(el) {
|
|
22024
|
+
const window = ssrWindow.getWindow();
|
|
22025
|
+
let style;
|
|
22026
|
+
|
|
22027
|
+
if (window.getComputedStyle) {
|
|
22028
|
+
style = window.getComputedStyle(el, null);
|
|
22029
|
+
}
|
|
22030
|
+
|
|
22031
|
+
if (!style && el.currentStyle) {
|
|
22032
|
+
style = el.currentStyle;
|
|
22033
|
+
}
|
|
22034
|
+
|
|
22035
|
+
if (!style) {
|
|
22036
|
+
style = el.style;
|
|
22037
|
+
}
|
|
22038
|
+
|
|
22039
|
+
return style;
|
|
22040
|
+
}
|
|
22041
|
+
|
|
22042
|
+
function getTranslate(el, axis = 'x') {
|
|
22043
|
+
const window = ssrWindow.getWindow();
|
|
22044
|
+
let matrix;
|
|
22045
|
+
let curTransform;
|
|
22046
|
+
let transformMatrix;
|
|
22047
|
+
const curStyle = getComputedStyle$1(el);
|
|
22048
|
+
|
|
22049
|
+
if (window.WebKitCSSMatrix) {
|
|
22050
|
+
curTransform = curStyle.transform || curStyle.webkitTransform;
|
|
22051
|
+
|
|
22052
|
+
if (curTransform.split(',').length > 6) {
|
|
22053
|
+
curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
|
|
22054
|
+
} // Some old versions of Webkit choke when 'none' is passed; pass
|
|
22055
|
+
// empty string instead in this case
|
|
22056
|
+
|
|
22057
|
+
|
|
22058
|
+
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
|
|
22059
|
+
} else {
|
|
22060
|
+
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
|
|
22061
|
+
matrix = transformMatrix.toString().split(',');
|
|
22062
|
+
}
|
|
22063
|
+
|
|
22064
|
+
if (axis === 'x') {
|
|
22065
|
+
// Latest Chrome and webkits Fix
|
|
22066
|
+
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix
|
|
22067
|
+
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers
|
|
22068
|
+
else curTransform = parseFloat(matrix[4]);
|
|
22069
|
+
}
|
|
22070
|
+
|
|
22071
|
+
if (axis === 'y') {
|
|
22072
|
+
// Latest Chrome and webkits Fix
|
|
22073
|
+
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix
|
|
22074
|
+
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers
|
|
22075
|
+
else curTransform = parseFloat(matrix[5]);
|
|
22076
|
+
}
|
|
22077
|
+
|
|
22078
|
+
return curTransform || 0;
|
|
22079
|
+
}
|
|
22080
|
+
|
|
22081
|
+
function isObject(o) {
|
|
22082
|
+
return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
|
|
22083
|
+
}
|
|
22084
|
+
|
|
22085
|
+
function isNode(node) {
|
|
22086
|
+
// eslint-disable-next-line
|
|
22087
|
+
if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
|
|
22088
|
+
return node instanceof HTMLElement;
|
|
22089
|
+
}
|
|
22090
|
+
|
|
22091
|
+
return node && (node.nodeType === 1 || node.nodeType === 11);
|
|
22092
|
+
}
|
|
22093
|
+
|
|
22094
|
+
function extend(...args) {
|
|
22095
|
+
const to = Object(args[0]);
|
|
22096
|
+
const noExtend = ['__proto__', 'constructor', 'prototype'];
|
|
22097
|
+
|
|
22098
|
+
for (let i = 1; i < args.length; i += 1) {
|
|
22099
|
+
const nextSource = args[i];
|
|
22100
|
+
|
|
22101
|
+
if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
|
|
22102
|
+
const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
|
|
22103
|
+
|
|
22104
|
+
for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
|
|
22105
|
+
const nextKey = keysArray[nextIndex];
|
|
22106
|
+
const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
22107
|
+
|
|
22108
|
+
if (desc !== undefined && desc.enumerable) {
|
|
22109
|
+
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
|
|
22110
|
+
if (nextSource[nextKey].__swiper__) {
|
|
22111
|
+
to[nextKey] = nextSource[nextKey];
|
|
22112
|
+
} else {
|
|
22113
|
+
extend(to[nextKey], nextSource[nextKey]);
|
|
22114
|
+
}
|
|
22115
|
+
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
|
|
22116
|
+
to[nextKey] = {};
|
|
22117
|
+
|
|
22118
|
+
if (nextSource[nextKey].__swiper__) {
|
|
22119
|
+
to[nextKey] = nextSource[nextKey];
|
|
22120
|
+
} else {
|
|
22121
|
+
extend(to[nextKey], nextSource[nextKey]);
|
|
22122
|
+
}
|
|
22123
|
+
} else {
|
|
22124
|
+
to[nextKey] = nextSource[nextKey];
|
|
22125
|
+
}
|
|
22126
|
+
}
|
|
22127
|
+
}
|
|
22128
|
+
}
|
|
22129
|
+
}
|
|
22130
|
+
|
|
22131
|
+
return to;
|
|
22132
|
+
}
|
|
22133
|
+
|
|
22134
|
+
function setCSSProperty(el, varName, varValue) {
|
|
22135
|
+
el.style.setProperty(varName, varValue);
|
|
22136
|
+
}
|
|
22137
|
+
|
|
22138
|
+
function animateCSSModeScroll({
|
|
22139
|
+
swiper,
|
|
22140
|
+
targetPosition,
|
|
22141
|
+
side
|
|
22142
|
+
}) {
|
|
22143
|
+
const window = ssrWindow.getWindow();
|
|
22144
|
+
const startPosition = -swiper.translate;
|
|
22145
|
+
let startTime = null;
|
|
22146
|
+
let time;
|
|
22147
|
+
const duration = swiper.params.speed;
|
|
22148
|
+
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
22149
|
+
window.cancelAnimationFrame(swiper.cssModeFrameID);
|
|
22150
|
+
const dir = targetPosition > startPosition ? 'next' : 'prev';
|
|
22151
|
+
|
|
22152
|
+
const isOutOfBound = (current, target) => {
|
|
22153
|
+
return dir === 'next' && current >= target || dir === 'prev' && current <= target;
|
|
22154
|
+
};
|
|
22155
|
+
|
|
22156
|
+
const animate = () => {
|
|
22157
|
+
time = new Date().getTime();
|
|
22158
|
+
|
|
22159
|
+
if (startTime === null) {
|
|
22160
|
+
startTime = time;
|
|
22161
|
+
}
|
|
22162
|
+
|
|
22163
|
+
const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
|
|
22164
|
+
const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
|
|
22165
|
+
let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
|
|
22166
|
+
|
|
22167
|
+
if (isOutOfBound(currentPosition, targetPosition)) {
|
|
22168
|
+
currentPosition = targetPosition;
|
|
22169
|
+
}
|
|
22170
|
+
|
|
22171
|
+
swiper.wrapperEl.scrollTo({
|
|
22172
|
+
[side]: currentPosition
|
|
22173
|
+
});
|
|
22174
|
+
|
|
22175
|
+
if (isOutOfBound(currentPosition, targetPosition)) {
|
|
22176
|
+
swiper.wrapperEl.style.overflow = 'hidden';
|
|
22177
|
+
swiper.wrapperEl.style.scrollSnapType = '';
|
|
22178
|
+
setTimeout(() => {
|
|
22179
|
+
swiper.wrapperEl.style.overflow = '';
|
|
22180
|
+
swiper.wrapperEl.scrollTo({
|
|
22181
|
+
[side]: currentPosition
|
|
22182
|
+
});
|
|
22183
|
+
});
|
|
22184
|
+
window.cancelAnimationFrame(swiper.cssModeFrameID);
|
|
22185
|
+
return;
|
|
22186
|
+
}
|
|
22187
|
+
|
|
22188
|
+
swiper.cssModeFrameID = window.requestAnimationFrame(animate);
|
|
22189
|
+
};
|
|
22190
|
+
|
|
22191
|
+
animate();
|
|
22192
|
+
}
|
|
22193
|
+
|
|
22194
|
+
let support;
|
|
22195
|
+
|
|
22196
|
+
function calcSupport() {
|
|
22197
|
+
const window = ssrWindow.getWindow();
|
|
22198
|
+
const document = ssrWindow.getDocument();
|
|
22199
|
+
return {
|
|
22200
|
+
smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style,
|
|
22201
|
+
touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
|
|
22202
|
+
passiveListener: function checkPassiveListener() {
|
|
22203
|
+
let supportsPassive = false;
|
|
22204
|
+
|
|
22205
|
+
try {
|
|
22206
|
+
const opts = Object.defineProperty({}, 'passive', {
|
|
22207
|
+
// eslint-disable-next-line
|
|
22208
|
+
get() {
|
|
22209
|
+
supportsPassive = true;
|
|
22210
|
+
}
|
|
22211
|
+
|
|
22212
|
+
});
|
|
22213
|
+
window.addEventListener('testPassiveListener', null, opts);
|
|
22214
|
+
} catch (e) {// No support
|
|
22215
|
+
}
|
|
22216
|
+
|
|
22217
|
+
return supportsPassive;
|
|
22218
|
+
}(),
|
|
22219
|
+
gestures: function checkGestures() {
|
|
22220
|
+
return 'ongesturestart' in window;
|
|
22221
|
+
}()
|
|
22222
|
+
};
|
|
22223
|
+
}
|
|
22224
|
+
|
|
22225
|
+
function getSupport() {
|
|
22226
|
+
if (!support) {
|
|
22227
|
+
support = calcSupport();
|
|
22228
|
+
}
|
|
22229
|
+
|
|
22230
|
+
return support;
|
|
22231
|
+
}
|
|
22232
|
+
|
|
22233
|
+
let deviceCached;
|
|
22234
|
+
|
|
22235
|
+
function calcDevice({
|
|
22236
|
+
userAgent
|
|
22237
|
+
} = {}) {
|
|
22238
|
+
const support = getSupport();
|
|
22239
|
+
const window = ssrWindow.getWindow();
|
|
22240
|
+
const platform = window.navigator.platform;
|
|
22241
|
+
const ua = userAgent || window.navigator.userAgent;
|
|
22242
|
+
const device = {
|
|
22243
|
+
ios: false,
|
|
22244
|
+
android: false
|
|
22245
|
+
};
|
|
22246
|
+
const screenWidth = window.screen.width;
|
|
22247
|
+
const screenHeight = window.screen.height;
|
|
22248
|
+
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
|
|
22249
|
+
|
|
22250
|
+
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
|
|
22251
|
+
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
|
|
22252
|
+
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
|
|
22253
|
+
const windows = platform === 'Win32';
|
|
22254
|
+
let macos = platform === 'MacIntel'; // iPadOs 13 fix
|
|
22255
|
+
|
|
22256
|
+
const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
|
|
22257
|
+
|
|
22258
|
+
if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {
|
|
22259
|
+
ipad = ua.match(/(Version)\/([\d.]+)/);
|
|
22260
|
+
if (!ipad) ipad = [0, 1, '13_0_0'];
|
|
22261
|
+
macos = false;
|
|
22262
|
+
} // Android
|
|
22263
|
+
|
|
22264
|
+
|
|
22265
|
+
if (android && !windows) {
|
|
22266
|
+
device.os = 'android';
|
|
22267
|
+
device.android = true;
|
|
22268
|
+
}
|
|
22269
|
+
|
|
22270
|
+
if (ipad || iphone || ipod) {
|
|
22271
|
+
device.os = 'ios';
|
|
22272
|
+
device.ios = true;
|
|
22273
|
+
} // Export object
|
|
22274
|
+
|
|
22275
|
+
|
|
22276
|
+
return device;
|
|
22277
|
+
}
|
|
22278
|
+
|
|
22279
|
+
function getDevice(overrides = {}) {
|
|
22280
|
+
if (!deviceCached) {
|
|
22281
|
+
deviceCached = calcDevice(overrides);
|
|
22282
|
+
}
|
|
22283
|
+
|
|
22284
|
+
return deviceCached;
|
|
22285
|
+
}
|
|
22286
|
+
|
|
22287
|
+
let browser;
|
|
22288
|
+
|
|
22289
|
+
function calcBrowser() {
|
|
22290
|
+
const window = ssrWindow.getWindow();
|
|
22291
|
+
|
|
22292
|
+
function isSafari() {
|
|
22293
|
+
const ua = window.navigator.userAgent.toLowerCase();
|
|
22294
|
+
return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
|
|
22295
|
+
}
|
|
22296
|
+
|
|
22297
|
+
return {
|
|
22298
|
+
isSafari: isSafari(),
|
|
22299
|
+
isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
|
|
22300
|
+
};
|
|
22301
|
+
}
|
|
22302
|
+
|
|
22303
|
+
function getBrowser() {
|
|
22304
|
+
if (!browser) {
|
|
22305
|
+
browser = calcBrowser();
|
|
22306
|
+
}
|
|
22307
|
+
|
|
22308
|
+
return browser;
|
|
22309
|
+
}
|
|
22310
|
+
|
|
22311
|
+
function Resize({
|
|
22312
|
+
swiper,
|
|
22313
|
+
on,
|
|
22314
|
+
emit
|
|
22315
|
+
}) {
|
|
22316
|
+
const window = ssrWindow.getWindow();
|
|
22317
|
+
let observer = null;
|
|
22318
|
+
let animationFrame = null;
|
|
22319
|
+
|
|
22320
|
+
const resizeHandler = () => {
|
|
22321
|
+
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
|
22322
|
+
emit('beforeResize');
|
|
22323
|
+
emit('resize');
|
|
22324
|
+
};
|
|
22325
|
+
|
|
22326
|
+
const createObserver = () => {
|
|
22327
|
+
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
|
22328
|
+
observer = new ResizeObserver(entries => {
|
|
22329
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
22330
|
+
const {
|
|
22331
|
+
width,
|
|
22332
|
+
height
|
|
22333
|
+
} = swiper;
|
|
22334
|
+
let newWidth = width;
|
|
22335
|
+
let newHeight = height;
|
|
22336
|
+
entries.forEach(({
|
|
22337
|
+
contentBoxSize,
|
|
22338
|
+
contentRect,
|
|
22339
|
+
target
|
|
22340
|
+
}) => {
|
|
22341
|
+
if (target && target !== swiper.el) return;
|
|
22342
|
+
newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
|
|
22343
|
+
newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
|
|
22344
|
+
});
|
|
22345
|
+
|
|
22346
|
+
if (newWidth !== width || newHeight !== height) {
|
|
22347
|
+
resizeHandler();
|
|
22348
|
+
}
|
|
22349
|
+
});
|
|
22350
|
+
});
|
|
22351
|
+
observer.observe(swiper.el);
|
|
22352
|
+
};
|
|
22353
|
+
|
|
22354
|
+
const removeObserver = () => {
|
|
22355
|
+
if (animationFrame) {
|
|
22356
|
+
window.cancelAnimationFrame(animationFrame);
|
|
22357
|
+
}
|
|
22358
|
+
|
|
22359
|
+
if (observer && observer.unobserve && swiper.el) {
|
|
22360
|
+
observer.unobserve(swiper.el);
|
|
22361
|
+
observer = null;
|
|
22362
|
+
}
|
|
22363
|
+
};
|
|
22364
|
+
|
|
22365
|
+
const orientationChangeHandler = () => {
|
|
22366
|
+
if (!swiper || swiper.destroyed || !swiper.initialized) return;
|
|
22367
|
+
emit('orientationchange');
|
|
22368
|
+
};
|
|
22369
|
+
|
|
22370
|
+
on('init', () => {
|
|
22371
|
+
if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
|
|
22372
|
+
createObserver();
|
|
22373
|
+
return;
|
|
22374
|
+
}
|
|
22375
|
+
|
|
22376
|
+
window.addEventListener('resize', resizeHandler);
|
|
22377
|
+
window.addEventListener('orientationchange', orientationChangeHandler);
|
|
22378
|
+
});
|
|
22379
|
+
on('destroy', () => {
|
|
22380
|
+
removeObserver();
|
|
22381
|
+
window.removeEventListener('resize', resizeHandler);
|
|
22382
|
+
window.removeEventListener('orientationchange', orientationChangeHandler);
|
|
22383
|
+
});
|
|
22384
|
+
}
|
|
22385
|
+
|
|
22386
|
+
function Observer({
|
|
22387
|
+
swiper,
|
|
22388
|
+
extendParams,
|
|
22389
|
+
on,
|
|
22390
|
+
emit
|
|
22391
|
+
}) {
|
|
22392
|
+
const observers = [];
|
|
22393
|
+
const window = ssrWindow.getWindow();
|
|
22394
|
+
|
|
22395
|
+
const attach = (target, options = {}) => {
|
|
22396
|
+
const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
|
|
22397
|
+
const observer = new ObserverFunc(mutations => {
|
|
22398
|
+
// The observerUpdate event should only be triggered
|
|
22399
|
+
// once despite the number of mutations. Additional
|
|
22400
|
+
// triggers are redundant and are very costly
|
|
22401
|
+
if (mutations.length === 1) {
|
|
22402
|
+
emit('observerUpdate', mutations[0]);
|
|
22403
|
+
return;
|
|
22404
|
+
}
|
|
22405
|
+
|
|
22406
|
+
const observerUpdate = function observerUpdate() {
|
|
22407
|
+
emit('observerUpdate', mutations[0]);
|
|
22408
|
+
};
|
|
22409
|
+
|
|
22410
|
+
if (window.requestAnimationFrame) {
|
|
22411
|
+
window.requestAnimationFrame(observerUpdate);
|
|
22412
|
+
} else {
|
|
22413
|
+
window.setTimeout(observerUpdate, 0);
|
|
22414
|
+
}
|
|
22415
|
+
});
|
|
22416
|
+
observer.observe(target, {
|
|
22417
|
+
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
|
|
22418
|
+
childList: typeof options.childList === 'undefined' ? true : options.childList,
|
|
22419
|
+
characterData: typeof options.characterData === 'undefined' ? true : options.characterData
|
|
22420
|
+
});
|
|
22421
|
+
observers.push(observer);
|
|
22422
|
+
};
|
|
22423
|
+
|
|
22424
|
+
const init = () => {
|
|
22425
|
+
if (!swiper.params.observer) return;
|
|
22426
|
+
|
|
22427
|
+
if (swiper.params.observeParents) {
|
|
22428
|
+
const containerParents = swiper.$el.parents();
|
|
22429
|
+
|
|
22430
|
+
for (let i = 0; i < containerParents.length; i += 1) {
|
|
22431
|
+
attach(containerParents[i]);
|
|
22432
|
+
}
|
|
22433
|
+
} // Observe container
|
|
22434
|
+
|
|
22435
|
+
|
|
22436
|
+
attach(swiper.$el[0], {
|
|
22437
|
+
childList: swiper.params.observeSlideChildren
|
|
22438
|
+
}); // Observe wrapper
|
|
22439
|
+
|
|
22440
|
+
attach(swiper.$wrapperEl[0], {
|
|
22441
|
+
attributes: false
|
|
22442
|
+
});
|
|
22443
|
+
};
|
|
22444
|
+
|
|
22445
|
+
const destroy = () => {
|
|
22446
|
+
observers.forEach(observer => {
|
|
22447
|
+
observer.disconnect();
|
|
22448
|
+
});
|
|
22449
|
+
observers.splice(0, observers.length);
|
|
22450
|
+
};
|
|
22451
|
+
|
|
22452
|
+
extendParams({
|
|
22453
|
+
observer: false,
|
|
22454
|
+
observeParents: false,
|
|
22455
|
+
observeSlideChildren: false
|
|
22456
|
+
});
|
|
22457
|
+
on('init', init);
|
|
22458
|
+
on('destroy', destroy);
|
|
22459
|
+
}
|
|
22460
|
+
|
|
22461
|
+
/* eslint-disable no-underscore-dangle */
|
|
22462
|
+
var eventsEmitter = {
|
|
22463
|
+
on(events, handler, priority) {
|
|
22464
|
+
const self = this;
|
|
22465
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
22466
|
+
if (typeof handler !== 'function') return self;
|
|
22467
|
+
const method = priority ? 'unshift' : 'push';
|
|
22468
|
+
events.split(' ').forEach(event => {
|
|
22469
|
+
if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
|
|
22470
|
+
self.eventsListeners[event][method](handler);
|
|
22471
|
+
});
|
|
22472
|
+
return self;
|
|
22473
|
+
},
|
|
22474
|
+
|
|
22475
|
+
once(events, handler, priority) {
|
|
22476
|
+
const self = this;
|
|
22477
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
22478
|
+
if (typeof handler !== 'function') return self;
|
|
22479
|
+
|
|
22480
|
+
function onceHandler(...args) {
|
|
22481
|
+
self.off(events, onceHandler);
|
|
22482
|
+
|
|
22483
|
+
if (onceHandler.__emitterProxy) {
|
|
22484
|
+
delete onceHandler.__emitterProxy;
|
|
22485
|
+
}
|
|
22486
|
+
|
|
22487
|
+
handler.apply(self, args);
|
|
22488
|
+
}
|
|
22489
|
+
|
|
22490
|
+
onceHandler.__emitterProxy = handler;
|
|
22491
|
+
return self.on(events, onceHandler, priority);
|
|
22492
|
+
},
|
|
22493
|
+
|
|
22494
|
+
onAny(handler, priority) {
|
|
22495
|
+
const self = this;
|
|
22496
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
22497
|
+
if (typeof handler !== 'function') return self;
|
|
22498
|
+
const method = priority ? 'unshift' : 'push';
|
|
22499
|
+
|
|
22500
|
+
if (self.eventsAnyListeners.indexOf(handler) < 0) {
|
|
22501
|
+
self.eventsAnyListeners[method](handler);
|
|
22502
|
+
}
|
|
22503
|
+
|
|
22504
|
+
return self;
|
|
22505
|
+
},
|
|
22506
|
+
|
|
22507
|
+
offAny(handler) {
|
|
22508
|
+
const self = this;
|
|
22509
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
22510
|
+
if (!self.eventsAnyListeners) return self;
|
|
22511
|
+
const index = self.eventsAnyListeners.indexOf(handler);
|
|
22512
|
+
|
|
22513
|
+
if (index >= 0) {
|
|
22514
|
+
self.eventsAnyListeners.splice(index, 1);
|
|
22515
|
+
}
|
|
22516
|
+
|
|
22517
|
+
return self;
|
|
22518
|
+
},
|
|
22519
|
+
|
|
22520
|
+
off(events, handler) {
|
|
22521
|
+
const self = this;
|
|
22522
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
22523
|
+
if (!self.eventsListeners) return self;
|
|
22524
|
+
events.split(' ').forEach(event => {
|
|
22525
|
+
if (typeof handler === 'undefined') {
|
|
22526
|
+
self.eventsListeners[event] = [];
|
|
22527
|
+
} else if (self.eventsListeners[event]) {
|
|
22528
|
+
self.eventsListeners[event].forEach((eventHandler, index) => {
|
|
22529
|
+
if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
|
|
22530
|
+
self.eventsListeners[event].splice(index, 1);
|
|
22531
|
+
}
|
|
22532
|
+
});
|
|
22533
|
+
}
|
|
22534
|
+
});
|
|
22535
|
+
return self;
|
|
22536
|
+
},
|
|
22537
|
+
|
|
22538
|
+
emit(...args) {
|
|
22539
|
+
const self = this;
|
|
22540
|
+
if (!self.eventsListeners || self.destroyed) return self;
|
|
22541
|
+
if (!self.eventsListeners) return self;
|
|
22542
|
+
let events;
|
|
22543
|
+
let data;
|
|
22544
|
+
let context;
|
|
22545
|
+
|
|
22546
|
+
if (typeof args[0] === 'string' || Array.isArray(args[0])) {
|
|
22547
|
+
events = args[0];
|
|
22548
|
+
data = args.slice(1, args.length);
|
|
22549
|
+
context = self;
|
|
22550
|
+
} else {
|
|
22551
|
+
events = args[0].events;
|
|
22552
|
+
data = args[0].data;
|
|
22553
|
+
context = args[0].context || self;
|
|
22554
|
+
}
|
|
22555
|
+
|
|
22556
|
+
data.unshift(context);
|
|
22557
|
+
const eventsArray = Array.isArray(events) ? events : events.split(' ');
|
|
22558
|
+
eventsArray.forEach(event => {
|
|
22559
|
+
if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
|
|
22560
|
+
self.eventsAnyListeners.forEach(eventHandler => {
|
|
22561
|
+
eventHandler.apply(context, [event, ...data]);
|
|
22562
|
+
});
|
|
22563
|
+
}
|
|
22564
|
+
|
|
22565
|
+
if (self.eventsListeners && self.eventsListeners[event]) {
|
|
22566
|
+
self.eventsListeners[event].forEach(eventHandler => {
|
|
22567
|
+
eventHandler.apply(context, data);
|
|
22568
|
+
});
|
|
22569
|
+
}
|
|
22570
|
+
});
|
|
22571
|
+
return self;
|
|
22572
|
+
}
|
|
22573
|
+
|
|
22574
|
+
};
|
|
22575
|
+
|
|
22576
|
+
function updateSize() {
|
|
22577
|
+
const swiper = this;
|
|
22578
|
+
let width;
|
|
22579
|
+
let height;
|
|
22580
|
+
const $el = swiper.$el;
|
|
22581
|
+
|
|
22582
|
+
if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
|
|
22583
|
+
width = swiper.params.width;
|
|
22584
|
+
} else {
|
|
22585
|
+
width = $el[0].clientWidth;
|
|
22586
|
+
}
|
|
22587
|
+
|
|
22588
|
+
if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
|
|
22589
|
+
height = swiper.params.height;
|
|
22590
|
+
} else {
|
|
22591
|
+
height = $el[0].clientHeight;
|
|
22592
|
+
}
|
|
22593
|
+
|
|
22594
|
+
if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
|
|
22595
|
+
return;
|
|
22596
|
+
} // Subtract paddings
|
|
22597
|
+
|
|
22598
|
+
|
|
22599
|
+
width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);
|
|
22600
|
+
height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);
|
|
22601
|
+
if (Number.isNaN(width)) width = 0;
|
|
22602
|
+
if (Number.isNaN(height)) height = 0;
|
|
22603
|
+
Object.assign(swiper, {
|
|
22604
|
+
width,
|
|
22605
|
+
height,
|
|
22606
|
+
size: swiper.isHorizontal() ? width : height
|
|
22607
|
+
});
|
|
22608
|
+
}
|
|
22609
|
+
|
|
22610
|
+
function updateSlides() {
|
|
22611
|
+
const swiper = this;
|
|
22612
|
+
|
|
22613
|
+
function getDirectionLabel(property) {
|
|
22614
|
+
if (swiper.isHorizontal()) {
|
|
22615
|
+
return property;
|
|
22616
|
+
} // prettier-ignore
|
|
22617
|
+
|
|
22618
|
+
|
|
22619
|
+
return {
|
|
22620
|
+
'width': 'height',
|
|
22621
|
+
'margin-top': 'margin-left',
|
|
22622
|
+
'margin-bottom ': 'margin-right',
|
|
22623
|
+
'margin-left': 'margin-top',
|
|
22624
|
+
'margin-right': 'margin-bottom',
|
|
22625
|
+
'padding-left': 'padding-top',
|
|
22626
|
+
'padding-right': 'padding-bottom',
|
|
22627
|
+
'marginRight': 'marginBottom'
|
|
22628
|
+
}[property];
|
|
22629
|
+
}
|
|
22630
|
+
|
|
22631
|
+
function getDirectionPropertyValue(node, label) {
|
|
22632
|
+
return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
|
|
22633
|
+
}
|
|
22634
|
+
|
|
22635
|
+
const params = swiper.params;
|
|
22636
|
+
const {
|
|
22637
|
+
$wrapperEl,
|
|
22638
|
+
size: swiperSize,
|
|
22639
|
+
rtlTranslate: rtl,
|
|
22640
|
+
wrongRTL
|
|
22641
|
+
} = swiper;
|
|
22642
|
+
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
22643
|
+
const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
|
|
22644
|
+
const slides = $wrapperEl.children(`.${swiper.params.slideClass}`);
|
|
22645
|
+
const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
|
|
22646
|
+
let snapGrid = [];
|
|
22647
|
+
const slidesGrid = [];
|
|
22648
|
+
const slidesSizesGrid = [];
|
|
22649
|
+
let offsetBefore = params.slidesOffsetBefore;
|
|
22650
|
+
|
|
22651
|
+
if (typeof offsetBefore === 'function') {
|
|
22652
|
+
offsetBefore = params.slidesOffsetBefore.call(swiper);
|
|
22653
|
+
}
|
|
22654
|
+
|
|
22655
|
+
let offsetAfter = params.slidesOffsetAfter;
|
|
22656
|
+
|
|
22657
|
+
if (typeof offsetAfter === 'function') {
|
|
22658
|
+
offsetAfter = params.slidesOffsetAfter.call(swiper);
|
|
22659
|
+
}
|
|
22660
|
+
|
|
22661
|
+
const previousSnapGridLength = swiper.snapGrid.length;
|
|
22662
|
+
const previousSlidesGridLength = swiper.slidesGrid.length;
|
|
22663
|
+
let spaceBetween = params.spaceBetween;
|
|
22664
|
+
let slidePosition = -offsetBefore;
|
|
22665
|
+
let prevSlideSize = 0;
|
|
22666
|
+
let index = 0;
|
|
22667
|
+
|
|
22668
|
+
if (typeof swiperSize === 'undefined') {
|
|
22669
|
+
return;
|
|
22670
|
+
}
|
|
22671
|
+
|
|
22672
|
+
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
|
|
22673
|
+
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
|
|
22674
|
+
}
|
|
22675
|
+
|
|
22676
|
+
swiper.virtualSize = -spaceBetween; // reset margins
|
|
22677
|
+
|
|
22678
|
+
if (rtl) slides.css({
|
|
22679
|
+
marginLeft: '',
|
|
22680
|
+
marginBottom: '',
|
|
22681
|
+
marginTop: ''
|
|
22682
|
+
});else slides.css({
|
|
22683
|
+
marginRight: '',
|
|
22684
|
+
marginBottom: '',
|
|
22685
|
+
marginTop: ''
|
|
22686
|
+
}); // reset cssMode offsets
|
|
22687
|
+
|
|
22688
|
+
if (params.centeredSlides && params.cssMode) {
|
|
22689
|
+
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', '');
|
|
22690
|
+
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', '');
|
|
22691
|
+
}
|
|
22692
|
+
|
|
22693
|
+
const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
|
|
22694
|
+
|
|
22695
|
+
if (gridEnabled) {
|
|
22696
|
+
swiper.grid.initSlides(slidesLength);
|
|
22697
|
+
} // Calc slides
|
|
22698
|
+
|
|
22699
|
+
|
|
22700
|
+
let slideSize;
|
|
22701
|
+
const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
|
|
22702
|
+
return typeof params.breakpoints[key].slidesPerView !== 'undefined';
|
|
22703
|
+
}).length > 0;
|
|
22704
|
+
|
|
22705
|
+
for (let i = 0; i < slidesLength; i += 1) {
|
|
22706
|
+
slideSize = 0;
|
|
22707
|
+
const slide = slides.eq(i);
|
|
22708
|
+
|
|
22709
|
+
if (gridEnabled) {
|
|
22710
|
+
swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
|
|
22711
|
+
}
|
|
22712
|
+
|
|
22713
|
+
if (slide.css('display') === 'none') continue; // eslint-disable-line
|
|
22714
|
+
|
|
22715
|
+
if (params.slidesPerView === 'auto') {
|
|
22716
|
+
if (shouldResetSlideSize) {
|
|
22717
|
+
slides[i].style[getDirectionLabel('width')] = ``;
|
|
22718
|
+
}
|
|
22719
|
+
|
|
22720
|
+
const slideStyles = getComputedStyle(slide[0]);
|
|
22721
|
+
const currentTransform = slide[0].style.transform;
|
|
22722
|
+
const currentWebKitTransform = slide[0].style.webkitTransform;
|
|
22723
|
+
|
|
22724
|
+
if (currentTransform) {
|
|
22725
|
+
slide[0].style.transform = 'none';
|
|
22726
|
+
}
|
|
22727
|
+
|
|
22728
|
+
if (currentWebKitTransform) {
|
|
22729
|
+
slide[0].style.webkitTransform = 'none';
|
|
22730
|
+
}
|
|
22731
|
+
|
|
22732
|
+
if (params.roundLengths) {
|
|
22733
|
+
slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);
|
|
22734
|
+
} else {
|
|
22735
|
+
// eslint-disable-next-line
|
|
22736
|
+
const width = getDirectionPropertyValue(slideStyles, 'width');
|
|
22737
|
+
const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
|
|
22738
|
+
const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
|
|
22739
|
+
const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
|
|
22740
|
+
const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
|
|
22741
|
+
const boxSizing = slideStyles.getPropertyValue('box-sizing');
|
|
22742
|
+
|
|
22743
|
+
if (boxSizing && boxSizing === 'border-box') {
|
|
22744
|
+
slideSize = width + marginLeft + marginRight;
|
|
22745
|
+
} else {
|
|
22746
|
+
const {
|
|
22747
|
+
clientWidth,
|
|
22748
|
+
offsetWidth
|
|
22749
|
+
} = slide[0];
|
|
22750
|
+
slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
|
|
22751
|
+
}
|
|
22752
|
+
}
|
|
22753
|
+
|
|
22754
|
+
if (currentTransform) {
|
|
22755
|
+
slide[0].style.transform = currentTransform;
|
|
22756
|
+
}
|
|
22757
|
+
|
|
22758
|
+
if (currentWebKitTransform) {
|
|
22759
|
+
slide[0].style.webkitTransform = currentWebKitTransform;
|
|
22760
|
+
}
|
|
22761
|
+
|
|
22762
|
+
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
22763
|
+
} else {
|
|
22764
|
+
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
|
|
22765
|
+
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
22766
|
+
|
|
22767
|
+
if (slides[i]) {
|
|
22768
|
+
slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
|
|
22769
|
+
}
|
|
22770
|
+
}
|
|
22771
|
+
|
|
22772
|
+
if (slides[i]) {
|
|
22773
|
+
slides[i].swiperSlideSize = slideSize;
|
|
22774
|
+
}
|
|
22775
|
+
|
|
22776
|
+
slidesSizesGrid.push(slideSize);
|
|
22777
|
+
|
|
22778
|
+
if (params.centeredSlides) {
|
|
22779
|
+
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
|
|
22780
|
+
if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
|
22781
|
+
if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
|
22782
|
+
if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
|
|
22783
|
+
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
|
22784
|
+
if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
|
|
22785
|
+
slidesGrid.push(slidePosition);
|
|
22786
|
+
} else {
|
|
22787
|
+
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
|
22788
|
+
if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
|
|
22789
|
+
slidesGrid.push(slidePosition);
|
|
22790
|
+
slidePosition = slidePosition + slideSize + spaceBetween;
|
|
22791
|
+
}
|
|
22792
|
+
|
|
22793
|
+
swiper.virtualSize += slideSize + spaceBetween;
|
|
22794
|
+
prevSlideSize = slideSize;
|
|
22795
|
+
index += 1;
|
|
22796
|
+
}
|
|
22797
|
+
|
|
22798
|
+
swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
|
|
22799
|
+
|
|
22800
|
+
if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
|
|
22801
|
+
$wrapperEl.css({
|
|
22802
|
+
width: `${swiper.virtualSize + params.spaceBetween}px`
|
|
22803
|
+
});
|
|
22804
|
+
}
|
|
22805
|
+
|
|
22806
|
+
if (params.setWrapperSize) {
|
|
22807
|
+
$wrapperEl.css({
|
|
22808
|
+
[getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px`
|
|
22809
|
+
});
|
|
22810
|
+
}
|
|
22811
|
+
|
|
22812
|
+
if (gridEnabled) {
|
|
22813
|
+
swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
|
|
22814
|
+
} // Remove last grid elements depending on width
|
|
22815
|
+
|
|
22816
|
+
|
|
22817
|
+
if (!params.centeredSlides) {
|
|
22818
|
+
const newSlidesGrid = [];
|
|
22819
|
+
|
|
22820
|
+
for (let i = 0; i < snapGrid.length; i += 1) {
|
|
22821
|
+
let slidesGridItem = snapGrid[i];
|
|
22822
|
+
if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
|
|
22823
|
+
|
|
22824
|
+
if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
|
|
22825
|
+
newSlidesGrid.push(slidesGridItem);
|
|
22826
|
+
}
|
|
22827
|
+
}
|
|
22828
|
+
|
|
22829
|
+
snapGrid = newSlidesGrid;
|
|
22830
|
+
|
|
22831
|
+
if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
|
|
22832
|
+
snapGrid.push(swiper.virtualSize - swiperSize);
|
|
22833
|
+
}
|
|
22834
|
+
}
|
|
22835
|
+
|
|
22836
|
+
if (snapGrid.length === 0) snapGrid = [0];
|
|
22837
|
+
|
|
22838
|
+
if (params.spaceBetween !== 0) {
|
|
22839
|
+
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
|
|
22840
|
+
slides.filter((_, slideIndex) => {
|
|
22841
|
+
if (!params.cssMode) return true;
|
|
22842
|
+
|
|
22843
|
+
if (slideIndex === slides.length - 1) {
|
|
22844
|
+
return false;
|
|
22845
|
+
}
|
|
22846
|
+
|
|
22847
|
+
return true;
|
|
22848
|
+
}).css({
|
|
22849
|
+
[key]: `${spaceBetween}px`
|
|
22850
|
+
});
|
|
22851
|
+
}
|
|
22852
|
+
|
|
22853
|
+
if (params.centeredSlides && params.centeredSlidesBounds) {
|
|
22854
|
+
let allSlidesSize = 0;
|
|
22855
|
+
slidesSizesGrid.forEach(slideSizeValue => {
|
|
22856
|
+
allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
|
|
22857
|
+
});
|
|
22858
|
+
allSlidesSize -= params.spaceBetween;
|
|
22859
|
+
const maxSnap = allSlidesSize - swiperSize;
|
|
22860
|
+
snapGrid = snapGrid.map(snap => {
|
|
22861
|
+
if (snap < 0) return -offsetBefore;
|
|
22862
|
+
if (snap > maxSnap) return maxSnap + offsetAfter;
|
|
22863
|
+
return snap;
|
|
22864
|
+
});
|
|
22865
|
+
}
|
|
22866
|
+
|
|
22867
|
+
if (params.centerInsufficientSlides) {
|
|
22868
|
+
let allSlidesSize = 0;
|
|
22869
|
+
slidesSizesGrid.forEach(slideSizeValue => {
|
|
22870
|
+
allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);
|
|
22871
|
+
});
|
|
22872
|
+
allSlidesSize -= params.spaceBetween;
|
|
22873
|
+
|
|
22874
|
+
if (allSlidesSize < swiperSize) {
|
|
22875
|
+
const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
|
|
22876
|
+
snapGrid.forEach((snap, snapIndex) => {
|
|
22877
|
+
snapGrid[snapIndex] = snap - allSlidesOffset;
|
|
22878
|
+
});
|
|
22879
|
+
slidesGrid.forEach((snap, snapIndex) => {
|
|
22880
|
+
slidesGrid[snapIndex] = snap + allSlidesOffset;
|
|
22881
|
+
});
|
|
22882
|
+
}
|
|
22883
|
+
}
|
|
22884
|
+
|
|
22885
|
+
Object.assign(swiper, {
|
|
22886
|
+
slides,
|
|
22887
|
+
snapGrid,
|
|
22888
|
+
slidesGrid,
|
|
22889
|
+
slidesSizesGrid
|
|
22890
|
+
});
|
|
22891
|
+
|
|
22892
|
+
if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
|
|
22893
|
+
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
|
|
22894
|
+
setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
|
|
22895
|
+
const addToSnapGrid = -swiper.snapGrid[0];
|
|
22896
|
+
const addToSlidesGrid = -swiper.slidesGrid[0];
|
|
22897
|
+
swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
|
|
22898
|
+
swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
|
|
22899
|
+
}
|
|
22900
|
+
|
|
22901
|
+
if (slidesLength !== previousSlidesLength) {
|
|
22902
|
+
swiper.emit('slidesLengthChange');
|
|
22903
|
+
}
|
|
22904
|
+
|
|
22905
|
+
if (snapGrid.length !== previousSnapGridLength) {
|
|
22906
|
+
if (swiper.params.watchOverflow) swiper.checkOverflow();
|
|
22907
|
+
swiper.emit('snapGridLengthChange');
|
|
22908
|
+
}
|
|
22909
|
+
|
|
22910
|
+
if (slidesGrid.length !== previousSlidesGridLength) {
|
|
22911
|
+
swiper.emit('slidesGridLengthChange');
|
|
22912
|
+
}
|
|
22913
|
+
|
|
22914
|
+
if (params.watchSlidesProgress) {
|
|
22915
|
+
swiper.updateSlidesOffset();
|
|
22916
|
+
}
|
|
22917
|
+
|
|
22918
|
+
if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
|
|
22919
|
+
const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
|
|
22920
|
+
const hasClassBackfaceClassAdded = swiper.$el.hasClass(backFaceHiddenClass);
|
|
22921
|
+
|
|
22922
|
+
if (slidesLength <= params.maxBackfaceHiddenSlides) {
|
|
22923
|
+
if (!hasClassBackfaceClassAdded) swiper.$el.addClass(backFaceHiddenClass);
|
|
22924
|
+
} else if (hasClassBackfaceClassAdded) {
|
|
22925
|
+
swiper.$el.removeClass(backFaceHiddenClass);
|
|
22926
|
+
}
|
|
22927
|
+
}
|
|
22928
|
+
}
|
|
22929
|
+
|
|
22930
|
+
function updateAutoHeight(speed) {
|
|
22931
|
+
const swiper = this;
|
|
22932
|
+
const activeSlides = [];
|
|
22933
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
22934
|
+
let newHeight = 0;
|
|
22935
|
+
let i;
|
|
22936
|
+
|
|
22937
|
+
if (typeof speed === 'number') {
|
|
22938
|
+
swiper.setTransition(speed);
|
|
22939
|
+
} else if (speed === true) {
|
|
22940
|
+
swiper.setTransition(swiper.params.speed);
|
|
22941
|
+
}
|
|
22942
|
+
|
|
22943
|
+
const getSlideByIndex = index => {
|
|
22944
|
+
if (isVirtual) {
|
|
22945
|
+
return swiper.slides.filter(el => parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0];
|
|
22946
|
+
}
|
|
22947
|
+
|
|
22948
|
+
return swiper.slides.eq(index)[0];
|
|
22949
|
+
}; // Find slides currently in view
|
|
22950
|
+
|
|
22951
|
+
|
|
22952
|
+
if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
|
|
22953
|
+
if (swiper.params.centeredSlides) {
|
|
22954
|
+
(swiper.visibleSlides || dom7.$([])).each(slide => {
|
|
22955
|
+
activeSlides.push(slide);
|
|
22956
|
+
});
|
|
22957
|
+
} else {
|
|
22958
|
+
for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
|
|
22959
|
+
const index = swiper.activeIndex + i;
|
|
22960
|
+
if (index > swiper.slides.length && !isVirtual) break;
|
|
22961
|
+
activeSlides.push(getSlideByIndex(index));
|
|
22962
|
+
}
|
|
22963
|
+
}
|
|
22964
|
+
} else {
|
|
22965
|
+
activeSlides.push(getSlideByIndex(swiper.activeIndex));
|
|
22966
|
+
} // Find new height from highest slide in view
|
|
22967
|
+
|
|
22968
|
+
|
|
22969
|
+
for (i = 0; i < activeSlides.length; i += 1) {
|
|
22970
|
+
if (typeof activeSlides[i] !== 'undefined') {
|
|
22971
|
+
const height = activeSlides[i].offsetHeight;
|
|
22972
|
+
newHeight = height > newHeight ? height : newHeight;
|
|
22973
|
+
}
|
|
22974
|
+
} // Update Height
|
|
22975
|
+
|
|
22976
|
+
|
|
22977
|
+
if (newHeight || newHeight === 0) swiper.$wrapperEl.css('height', `${newHeight}px`);
|
|
22978
|
+
}
|
|
22979
|
+
|
|
22980
|
+
function updateSlidesOffset() {
|
|
22981
|
+
const swiper = this;
|
|
22982
|
+
const slides = swiper.slides;
|
|
22983
|
+
|
|
22984
|
+
for (let i = 0; i < slides.length; i += 1) {
|
|
22985
|
+
slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;
|
|
22986
|
+
}
|
|
22987
|
+
}
|
|
22988
|
+
|
|
22989
|
+
function updateSlidesProgress(translate = this && this.translate || 0) {
|
|
22990
|
+
const swiper = this;
|
|
22991
|
+
const params = swiper.params;
|
|
22992
|
+
const {
|
|
22993
|
+
slides,
|
|
22994
|
+
rtlTranslate: rtl,
|
|
22995
|
+
snapGrid
|
|
22996
|
+
} = swiper;
|
|
22997
|
+
if (slides.length === 0) return;
|
|
22998
|
+
if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
|
|
22999
|
+
let offsetCenter = -translate;
|
|
23000
|
+
if (rtl) offsetCenter = translate; // Visible Slides
|
|
23001
|
+
|
|
23002
|
+
slides.removeClass(params.slideVisibleClass);
|
|
23003
|
+
swiper.visibleSlidesIndexes = [];
|
|
23004
|
+
swiper.visibleSlides = [];
|
|
23005
|
+
|
|
23006
|
+
for (let i = 0; i < slides.length; i += 1) {
|
|
23007
|
+
const slide = slides[i];
|
|
23008
|
+
let slideOffset = slide.swiperSlideOffset;
|
|
23009
|
+
|
|
23010
|
+
if (params.cssMode && params.centeredSlides) {
|
|
23011
|
+
slideOffset -= slides[0].swiperSlideOffset;
|
|
23012
|
+
}
|
|
23013
|
+
|
|
23014
|
+
const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
|
|
23015
|
+
const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween);
|
|
23016
|
+
const slideBefore = -(offsetCenter - slideOffset);
|
|
23017
|
+
const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
|
|
23018
|
+
const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
|
|
23019
|
+
|
|
23020
|
+
if (isVisible) {
|
|
23021
|
+
swiper.visibleSlides.push(slide);
|
|
23022
|
+
swiper.visibleSlidesIndexes.push(i);
|
|
23023
|
+
slides.eq(i).addClass(params.slideVisibleClass);
|
|
23024
|
+
}
|
|
23025
|
+
|
|
23026
|
+
slide.progress = rtl ? -slideProgress : slideProgress;
|
|
23027
|
+
slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
|
|
23028
|
+
}
|
|
23029
|
+
|
|
23030
|
+
swiper.visibleSlides = dom7.$(swiper.visibleSlides);
|
|
23031
|
+
}
|
|
23032
|
+
|
|
23033
|
+
function updateProgress(translate) {
|
|
23034
|
+
const swiper = this;
|
|
23035
|
+
|
|
23036
|
+
if (typeof translate === 'undefined') {
|
|
23037
|
+
const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line
|
|
23038
|
+
|
|
23039
|
+
translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
|
|
23040
|
+
}
|
|
23041
|
+
|
|
23042
|
+
const params = swiper.params;
|
|
23043
|
+
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
|
23044
|
+
let {
|
|
23045
|
+
progress,
|
|
23046
|
+
isBeginning,
|
|
23047
|
+
isEnd
|
|
23048
|
+
} = swiper;
|
|
23049
|
+
const wasBeginning = isBeginning;
|
|
23050
|
+
const wasEnd = isEnd;
|
|
23051
|
+
|
|
23052
|
+
if (translatesDiff === 0) {
|
|
23053
|
+
progress = 0;
|
|
23054
|
+
isBeginning = true;
|
|
23055
|
+
isEnd = true;
|
|
23056
|
+
} else {
|
|
23057
|
+
progress = (translate - swiper.minTranslate()) / translatesDiff;
|
|
23058
|
+
isBeginning = progress <= 0;
|
|
23059
|
+
isEnd = progress >= 1;
|
|
23060
|
+
}
|
|
23061
|
+
|
|
23062
|
+
Object.assign(swiper, {
|
|
23063
|
+
progress,
|
|
23064
|
+
isBeginning,
|
|
23065
|
+
isEnd
|
|
23066
|
+
});
|
|
23067
|
+
if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
|
|
23068
|
+
|
|
23069
|
+
if (isBeginning && !wasBeginning) {
|
|
23070
|
+
swiper.emit('reachBeginning toEdge');
|
|
23071
|
+
}
|
|
23072
|
+
|
|
23073
|
+
if (isEnd && !wasEnd) {
|
|
23074
|
+
swiper.emit('reachEnd toEdge');
|
|
23075
|
+
}
|
|
23076
|
+
|
|
23077
|
+
if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
|
|
23078
|
+
swiper.emit('fromEdge');
|
|
23079
|
+
}
|
|
23080
|
+
|
|
23081
|
+
swiper.emit('progress', progress);
|
|
23082
|
+
}
|
|
23083
|
+
|
|
23084
|
+
function updateSlidesClasses() {
|
|
23085
|
+
const swiper = this;
|
|
23086
|
+
const {
|
|
23087
|
+
slides,
|
|
23088
|
+
params,
|
|
23089
|
+
$wrapperEl,
|
|
23090
|
+
activeIndex,
|
|
23091
|
+
realIndex
|
|
23092
|
+
} = swiper;
|
|
23093
|
+
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
23094
|
+
slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`);
|
|
23095
|
+
let activeSlide;
|
|
23096
|
+
|
|
23097
|
+
if (isVirtual) {
|
|
23098
|
+
activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`);
|
|
23099
|
+
} else {
|
|
23100
|
+
activeSlide = slides.eq(activeIndex);
|
|
23101
|
+
} // Active classes
|
|
23102
|
+
|
|
23103
|
+
|
|
23104
|
+
activeSlide.addClass(params.slideActiveClass);
|
|
23105
|
+
|
|
23106
|
+
if (params.loop) {
|
|
23107
|
+
// Duplicate to all looped slides
|
|
23108
|
+
if (activeSlide.hasClass(params.slideDuplicateClass)) {
|
|
23109
|
+
$wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass);
|
|
23110
|
+
} else {
|
|
23111
|
+
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass);
|
|
23112
|
+
}
|
|
23113
|
+
} // Next Slide
|
|
23114
|
+
|
|
23115
|
+
|
|
23116
|
+
let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass);
|
|
23117
|
+
|
|
23118
|
+
if (params.loop && nextSlide.length === 0) {
|
|
23119
|
+
nextSlide = slides.eq(0);
|
|
23120
|
+
nextSlide.addClass(params.slideNextClass);
|
|
23121
|
+
} // Prev Slide
|
|
23122
|
+
|
|
23123
|
+
|
|
23124
|
+
let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass);
|
|
23125
|
+
|
|
23126
|
+
if (params.loop && prevSlide.length === 0) {
|
|
23127
|
+
prevSlide = slides.eq(-1);
|
|
23128
|
+
prevSlide.addClass(params.slidePrevClass);
|
|
23129
|
+
}
|
|
23130
|
+
|
|
23131
|
+
if (params.loop) {
|
|
23132
|
+
// Duplicate to all looped slides
|
|
23133
|
+
if (nextSlide.hasClass(params.slideDuplicateClass)) {
|
|
23134
|
+
$wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass);
|
|
23135
|
+
} else {
|
|
23136
|
+
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass);
|
|
23137
|
+
}
|
|
23138
|
+
|
|
23139
|
+
if (prevSlide.hasClass(params.slideDuplicateClass)) {
|
|
23140
|
+
$wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass);
|
|
23141
|
+
} else {
|
|
23142
|
+
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass);
|
|
23143
|
+
}
|
|
23144
|
+
}
|
|
23145
|
+
|
|
23146
|
+
swiper.emitSlidesClasses();
|
|
23147
|
+
}
|
|
23148
|
+
|
|
23149
|
+
function updateActiveIndex(newActiveIndex) {
|
|
23150
|
+
const swiper = this;
|
|
23151
|
+
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
|
23152
|
+
const {
|
|
23153
|
+
slidesGrid,
|
|
23154
|
+
snapGrid,
|
|
23155
|
+
params,
|
|
23156
|
+
activeIndex: previousIndex,
|
|
23157
|
+
realIndex: previousRealIndex,
|
|
23158
|
+
snapIndex: previousSnapIndex
|
|
23159
|
+
} = swiper;
|
|
23160
|
+
let activeIndex = newActiveIndex;
|
|
23161
|
+
let snapIndex;
|
|
23162
|
+
|
|
23163
|
+
if (typeof activeIndex === 'undefined') {
|
|
23164
|
+
for (let i = 0; i < slidesGrid.length; i += 1) {
|
|
23165
|
+
if (typeof slidesGrid[i + 1] !== 'undefined') {
|
|
23166
|
+
if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
|
|
23167
|
+
activeIndex = i;
|
|
23168
|
+
} else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
|
|
23169
|
+
activeIndex = i + 1;
|
|
23170
|
+
}
|
|
23171
|
+
} else if (translate >= slidesGrid[i]) {
|
|
23172
|
+
activeIndex = i;
|
|
23173
|
+
}
|
|
23174
|
+
} // Normalize slideIndex
|
|
23175
|
+
|
|
23176
|
+
|
|
23177
|
+
if (params.normalizeSlideIndex) {
|
|
23178
|
+
if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
|
|
23179
|
+
}
|
|
23180
|
+
}
|
|
23181
|
+
|
|
23182
|
+
if (snapGrid.indexOf(translate) >= 0) {
|
|
23183
|
+
snapIndex = snapGrid.indexOf(translate);
|
|
23184
|
+
} else {
|
|
23185
|
+
const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
|
|
23186
|
+
snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
|
|
23187
|
+
}
|
|
23188
|
+
|
|
23189
|
+
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
23190
|
+
|
|
23191
|
+
if (activeIndex === previousIndex) {
|
|
23192
|
+
if (snapIndex !== previousSnapIndex) {
|
|
23193
|
+
swiper.snapIndex = snapIndex;
|
|
23194
|
+
swiper.emit('snapIndexChange');
|
|
23195
|
+
}
|
|
23196
|
+
|
|
23197
|
+
return;
|
|
23198
|
+
} // Get real index
|
|
23199
|
+
|
|
23200
|
+
|
|
23201
|
+
const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);
|
|
23202
|
+
Object.assign(swiper, {
|
|
23203
|
+
snapIndex,
|
|
23204
|
+
realIndex,
|
|
23205
|
+
previousIndex,
|
|
23206
|
+
activeIndex
|
|
23207
|
+
});
|
|
23208
|
+
swiper.emit('activeIndexChange');
|
|
23209
|
+
swiper.emit('snapIndexChange');
|
|
23210
|
+
|
|
23211
|
+
if (previousRealIndex !== realIndex) {
|
|
23212
|
+
swiper.emit('realIndexChange');
|
|
23213
|
+
}
|
|
23214
|
+
|
|
23215
|
+
if (swiper.initialized || swiper.params.runCallbacksOnInit) {
|
|
23216
|
+
swiper.emit('slideChange');
|
|
23217
|
+
}
|
|
23218
|
+
}
|
|
23219
|
+
|
|
23220
|
+
function updateClickedSlide(e) {
|
|
23221
|
+
const swiper = this;
|
|
23222
|
+
const params = swiper.params;
|
|
23223
|
+
const slide = dom7.$(e).closest(`.${params.slideClass}`)[0];
|
|
23224
|
+
let slideFound = false;
|
|
23225
|
+
let slideIndex;
|
|
23226
|
+
|
|
23227
|
+
if (slide) {
|
|
23228
|
+
for (let i = 0; i < swiper.slides.length; i += 1) {
|
|
23229
|
+
if (swiper.slides[i] === slide) {
|
|
23230
|
+
slideFound = true;
|
|
23231
|
+
slideIndex = i;
|
|
23232
|
+
break;
|
|
23233
|
+
}
|
|
23234
|
+
}
|
|
23235
|
+
}
|
|
23236
|
+
|
|
23237
|
+
if (slide && slideFound) {
|
|
23238
|
+
swiper.clickedSlide = slide;
|
|
23239
|
+
|
|
23240
|
+
if (swiper.virtual && swiper.params.virtual.enabled) {
|
|
23241
|
+
swiper.clickedIndex = parseInt(dom7.$(slide).attr('data-swiper-slide-index'), 10);
|
|
23242
|
+
} else {
|
|
23243
|
+
swiper.clickedIndex = slideIndex;
|
|
23244
|
+
}
|
|
23245
|
+
} else {
|
|
23246
|
+
swiper.clickedSlide = undefined;
|
|
23247
|
+
swiper.clickedIndex = undefined;
|
|
23248
|
+
return;
|
|
23249
|
+
}
|
|
23250
|
+
|
|
23251
|
+
if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
|
|
23252
|
+
swiper.slideToClickedSlide();
|
|
23253
|
+
}
|
|
23254
|
+
}
|
|
23255
|
+
|
|
23256
|
+
var update = {
|
|
23257
|
+
updateSize,
|
|
23258
|
+
updateSlides,
|
|
23259
|
+
updateAutoHeight,
|
|
23260
|
+
updateSlidesOffset,
|
|
23261
|
+
updateSlidesProgress,
|
|
23262
|
+
updateProgress,
|
|
23263
|
+
updateSlidesClasses,
|
|
23264
|
+
updateActiveIndex,
|
|
23265
|
+
updateClickedSlide
|
|
23266
|
+
};
|
|
23267
|
+
|
|
23268
|
+
function getSwiperTranslate(axis = this.isHorizontal() ? 'x' : 'y') {
|
|
23269
|
+
const swiper = this;
|
|
23270
|
+
const {
|
|
23271
|
+
params,
|
|
23272
|
+
rtlTranslate: rtl,
|
|
23273
|
+
translate,
|
|
23274
|
+
$wrapperEl
|
|
23275
|
+
} = swiper;
|
|
23276
|
+
|
|
23277
|
+
if (params.virtualTranslate) {
|
|
23278
|
+
return rtl ? -translate : translate;
|
|
23279
|
+
}
|
|
23280
|
+
|
|
23281
|
+
if (params.cssMode) {
|
|
23282
|
+
return translate;
|
|
23283
|
+
}
|
|
23284
|
+
|
|
23285
|
+
let currentTranslate = getTranslate($wrapperEl[0], axis);
|
|
23286
|
+
if (rtl) currentTranslate = -currentTranslate;
|
|
23287
|
+
return currentTranslate || 0;
|
|
23288
|
+
}
|
|
23289
|
+
|
|
23290
|
+
function setTranslate(translate, byController) {
|
|
23291
|
+
const swiper = this;
|
|
23292
|
+
const {
|
|
23293
|
+
rtlTranslate: rtl,
|
|
23294
|
+
params,
|
|
23295
|
+
$wrapperEl,
|
|
23296
|
+
wrapperEl,
|
|
23297
|
+
progress
|
|
23298
|
+
} = swiper;
|
|
23299
|
+
let x = 0;
|
|
23300
|
+
let y = 0;
|
|
23301
|
+
const z = 0;
|
|
23302
|
+
|
|
23303
|
+
if (swiper.isHorizontal()) {
|
|
23304
|
+
x = rtl ? -translate : translate;
|
|
23305
|
+
} else {
|
|
23306
|
+
y = translate;
|
|
23307
|
+
}
|
|
23308
|
+
|
|
23309
|
+
if (params.roundLengths) {
|
|
23310
|
+
x = Math.floor(x);
|
|
23311
|
+
y = Math.floor(y);
|
|
23312
|
+
}
|
|
23313
|
+
|
|
23314
|
+
if (params.cssMode) {
|
|
23315
|
+
wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
|
|
23316
|
+
} else if (!params.virtualTranslate) {
|
|
23317
|
+
$wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`);
|
|
23318
|
+
}
|
|
23319
|
+
|
|
23320
|
+
swiper.previousTranslate = swiper.translate;
|
|
23321
|
+
swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress
|
|
23322
|
+
|
|
23323
|
+
let newProgress;
|
|
23324
|
+
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
|
23325
|
+
|
|
23326
|
+
if (translatesDiff === 0) {
|
|
23327
|
+
newProgress = 0;
|
|
23328
|
+
} else {
|
|
23329
|
+
newProgress = (translate - swiper.minTranslate()) / translatesDiff;
|
|
23330
|
+
}
|
|
23331
|
+
|
|
23332
|
+
if (newProgress !== progress) {
|
|
23333
|
+
swiper.updateProgress(translate);
|
|
23334
|
+
}
|
|
23335
|
+
|
|
23336
|
+
swiper.emit('setTranslate', swiper.translate, byController);
|
|
23337
|
+
}
|
|
23338
|
+
|
|
23339
|
+
function minTranslate() {
|
|
23340
|
+
return -this.snapGrid[0];
|
|
23341
|
+
}
|
|
23342
|
+
|
|
23343
|
+
function maxTranslate() {
|
|
23344
|
+
return -this.snapGrid[this.snapGrid.length - 1];
|
|
23345
|
+
}
|
|
23346
|
+
|
|
23347
|
+
function translateTo(translate = 0, speed = this.params.speed, runCallbacks = true, translateBounds = true, internal) {
|
|
23348
|
+
const swiper = this;
|
|
23349
|
+
const {
|
|
23350
|
+
params,
|
|
23351
|
+
wrapperEl
|
|
23352
|
+
} = swiper;
|
|
23353
|
+
|
|
23354
|
+
if (swiper.animating && params.preventInteractionOnTransition) {
|
|
23355
|
+
return false;
|
|
23356
|
+
}
|
|
23357
|
+
|
|
23358
|
+
const minTranslate = swiper.minTranslate();
|
|
23359
|
+
const maxTranslate = swiper.maxTranslate();
|
|
23360
|
+
let newTranslate;
|
|
23361
|
+
if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress
|
|
23362
|
+
|
|
23363
|
+
swiper.updateProgress(newTranslate);
|
|
23364
|
+
|
|
23365
|
+
if (params.cssMode) {
|
|
23366
|
+
const isH = swiper.isHorizontal();
|
|
23367
|
+
|
|
23368
|
+
if (speed === 0) {
|
|
23369
|
+
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
|
|
23370
|
+
} else {
|
|
23371
|
+
if (!swiper.support.smoothScroll) {
|
|
23372
|
+
animateCSSModeScroll({
|
|
23373
|
+
swiper,
|
|
23374
|
+
targetPosition: -newTranslate,
|
|
23375
|
+
side: isH ? 'left' : 'top'
|
|
23376
|
+
});
|
|
23377
|
+
return true;
|
|
23378
|
+
}
|
|
23379
|
+
|
|
23380
|
+
wrapperEl.scrollTo({
|
|
23381
|
+
[isH ? 'left' : 'top']: -newTranslate,
|
|
23382
|
+
behavior: 'smooth'
|
|
23383
|
+
});
|
|
23384
|
+
}
|
|
23385
|
+
|
|
23386
|
+
return true;
|
|
23387
|
+
}
|
|
23388
|
+
|
|
23389
|
+
if (speed === 0) {
|
|
23390
|
+
swiper.setTransition(0);
|
|
23391
|
+
swiper.setTranslate(newTranslate);
|
|
23392
|
+
|
|
23393
|
+
if (runCallbacks) {
|
|
23394
|
+
swiper.emit('beforeTransitionStart', speed, internal);
|
|
23395
|
+
swiper.emit('transitionEnd');
|
|
23396
|
+
}
|
|
23397
|
+
} else {
|
|
23398
|
+
swiper.setTransition(speed);
|
|
23399
|
+
swiper.setTranslate(newTranslate);
|
|
23400
|
+
|
|
23401
|
+
if (runCallbacks) {
|
|
23402
|
+
swiper.emit('beforeTransitionStart', speed, internal);
|
|
23403
|
+
swiper.emit('transitionStart');
|
|
23404
|
+
}
|
|
23405
|
+
|
|
23406
|
+
if (!swiper.animating) {
|
|
23407
|
+
swiper.animating = true;
|
|
23408
|
+
|
|
23409
|
+
if (!swiper.onTranslateToWrapperTransitionEnd) {
|
|
23410
|
+
swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
|
|
23411
|
+
if (!swiper || swiper.destroyed) return;
|
|
23412
|
+
if (e.target !== this) return;
|
|
23413
|
+
swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
|
|
23414
|
+
swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
|
|
23415
|
+
swiper.onTranslateToWrapperTransitionEnd = null;
|
|
23416
|
+
delete swiper.onTranslateToWrapperTransitionEnd;
|
|
23417
|
+
|
|
23418
|
+
if (runCallbacks) {
|
|
23419
|
+
swiper.emit('transitionEnd');
|
|
23420
|
+
}
|
|
23421
|
+
};
|
|
23422
|
+
}
|
|
23423
|
+
|
|
23424
|
+
swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
|
|
23425
|
+
swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);
|
|
23426
|
+
}
|
|
23427
|
+
}
|
|
23428
|
+
|
|
23429
|
+
return true;
|
|
23430
|
+
}
|
|
23431
|
+
|
|
23432
|
+
var translate = {
|
|
23433
|
+
getTranslate: getSwiperTranslate,
|
|
23434
|
+
setTranslate,
|
|
23435
|
+
minTranslate,
|
|
23436
|
+
maxTranslate,
|
|
23437
|
+
translateTo
|
|
23438
|
+
};
|
|
23439
|
+
|
|
23440
|
+
function setTransition(duration, byController) {
|
|
23441
|
+
const swiper = this;
|
|
23442
|
+
|
|
23443
|
+
if (!swiper.params.cssMode) {
|
|
23444
|
+
swiper.$wrapperEl.transition(duration);
|
|
23445
|
+
}
|
|
23446
|
+
|
|
23447
|
+
swiper.emit('setTransition', duration, byController);
|
|
23448
|
+
}
|
|
23449
|
+
|
|
23450
|
+
function transitionEmit({
|
|
23451
|
+
swiper,
|
|
23452
|
+
runCallbacks,
|
|
23453
|
+
direction,
|
|
23454
|
+
step
|
|
23455
|
+
}) {
|
|
23456
|
+
const {
|
|
23457
|
+
activeIndex,
|
|
23458
|
+
previousIndex
|
|
23459
|
+
} = swiper;
|
|
23460
|
+
let dir = direction;
|
|
23461
|
+
|
|
23462
|
+
if (!dir) {
|
|
23463
|
+
if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
|
|
23464
|
+
}
|
|
23465
|
+
|
|
23466
|
+
swiper.emit(`transition${step}`);
|
|
23467
|
+
|
|
23468
|
+
if (runCallbacks && activeIndex !== previousIndex) {
|
|
23469
|
+
if (dir === 'reset') {
|
|
23470
|
+
swiper.emit(`slideResetTransition${step}`);
|
|
23471
|
+
return;
|
|
23472
|
+
}
|
|
23473
|
+
|
|
23474
|
+
swiper.emit(`slideChangeTransition${step}`);
|
|
23475
|
+
|
|
23476
|
+
if (dir === 'next') {
|
|
23477
|
+
swiper.emit(`slideNextTransition${step}`);
|
|
23478
|
+
} else {
|
|
23479
|
+
swiper.emit(`slidePrevTransition${step}`);
|
|
23480
|
+
}
|
|
23481
|
+
}
|
|
23482
|
+
}
|
|
23483
|
+
|
|
23484
|
+
function transitionStart(runCallbacks = true, direction) {
|
|
23485
|
+
const swiper = this;
|
|
23486
|
+
const {
|
|
23487
|
+
params
|
|
23488
|
+
} = swiper;
|
|
23489
|
+
if (params.cssMode) return;
|
|
23490
|
+
|
|
23491
|
+
if (params.autoHeight) {
|
|
23492
|
+
swiper.updateAutoHeight();
|
|
23493
|
+
}
|
|
23494
|
+
|
|
23495
|
+
transitionEmit({
|
|
23496
|
+
swiper,
|
|
23497
|
+
runCallbacks,
|
|
23498
|
+
direction,
|
|
23499
|
+
step: 'Start'
|
|
23500
|
+
});
|
|
23501
|
+
}
|
|
23502
|
+
|
|
23503
|
+
function transitionEnd(runCallbacks = true, direction) {
|
|
23504
|
+
const swiper = this;
|
|
23505
|
+
const {
|
|
23506
|
+
params
|
|
23507
|
+
} = swiper;
|
|
23508
|
+
swiper.animating = false;
|
|
23509
|
+
if (params.cssMode) return;
|
|
23510
|
+
swiper.setTransition(0);
|
|
23511
|
+
transitionEmit({
|
|
23512
|
+
swiper,
|
|
23513
|
+
runCallbacks,
|
|
23514
|
+
direction,
|
|
23515
|
+
step: 'End'
|
|
23516
|
+
});
|
|
23517
|
+
}
|
|
23518
|
+
|
|
23519
|
+
var transition = {
|
|
23520
|
+
setTransition,
|
|
23521
|
+
transitionStart,
|
|
23522
|
+
transitionEnd
|
|
23523
|
+
};
|
|
23524
|
+
|
|
23525
|
+
function slideTo(index = 0, speed = this.params.speed, runCallbacks = true, internal, initial) {
|
|
23526
|
+
if (typeof index !== 'number' && typeof index !== 'string') {
|
|
23527
|
+
throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`);
|
|
23528
|
+
}
|
|
23529
|
+
|
|
23530
|
+
if (typeof index === 'string') {
|
|
23531
|
+
/**
|
|
23532
|
+
* The `index` argument converted from `string` to `number`.
|
|
23533
|
+
* @type {number}
|
|
23534
|
+
*/
|
|
23535
|
+
const indexAsNumber = parseInt(index, 10);
|
|
23536
|
+
/**
|
|
23537
|
+
* Determines whether the `index` argument is a valid `number`
|
|
23538
|
+
* after being converted from the `string` type.
|
|
23539
|
+
* @type {boolean}
|
|
23540
|
+
*/
|
|
23541
|
+
|
|
23542
|
+
const isValidNumber = isFinite(indexAsNumber);
|
|
23543
|
+
|
|
23544
|
+
if (!isValidNumber) {
|
|
23545
|
+
throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`);
|
|
23546
|
+
} // Knowing that the converted `index` is a valid number,
|
|
23547
|
+
// we can update the original argument's value.
|
|
23548
|
+
|
|
23549
|
+
|
|
23550
|
+
index = indexAsNumber;
|
|
23551
|
+
}
|
|
23552
|
+
|
|
23553
|
+
const swiper = this;
|
|
23554
|
+
let slideIndex = index;
|
|
23555
|
+
if (slideIndex < 0) slideIndex = 0;
|
|
23556
|
+
const {
|
|
23557
|
+
params,
|
|
23558
|
+
snapGrid,
|
|
23559
|
+
slidesGrid,
|
|
23560
|
+
previousIndex,
|
|
23561
|
+
activeIndex,
|
|
23562
|
+
rtlTranslate: rtl,
|
|
23563
|
+
wrapperEl,
|
|
23564
|
+
enabled
|
|
23565
|
+
} = swiper;
|
|
23566
|
+
|
|
23567
|
+
if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
|
|
23568
|
+
return false;
|
|
23569
|
+
}
|
|
23570
|
+
|
|
23571
|
+
const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
|
|
23572
|
+
let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
|
|
23573
|
+
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
23574
|
+
const translate = -snapGrid[snapIndex]; // Normalize slideIndex
|
|
23575
|
+
|
|
23576
|
+
if (params.normalizeSlideIndex) {
|
|
23577
|
+
for (let i = 0; i < slidesGrid.length; i += 1) {
|
|
23578
|
+
const normalizedTranslate = -Math.floor(translate * 100);
|
|
23579
|
+
const normalizedGrid = Math.floor(slidesGrid[i] * 100);
|
|
23580
|
+
const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
|
|
23581
|
+
|
|
23582
|
+
if (typeof slidesGrid[i + 1] !== 'undefined') {
|
|
23583
|
+
if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
|
|
23584
|
+
slideIndex = i;
|
|
23585
|
+
} else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
|
|
23586
|
+
slideIndex = i + 1;
|
|
23587
|
+
}
|
|
23588
|
+
} else if (normalizedTranslate >= normalizedGrid) {
|
|
23589
|
+
slideIndex = i;
|
|
23590
|
+
}
|
|
23591
|
+
}
|
|
23592
|
+
} // Directions locks
|
|
23593
|
+
|
|
23594
|
+
|
|
23595
|
+
if (swiper.initialized && slideIndex !== activeIndex) {
|
|
23596
|
+
if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {
|
|
23597
|
+
return false;
|
|
23598
|
+
}
|
|
23599
|
+
|
|
23600
|
+
if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
|
|
23601
|
+
if ((activeIndex || 0) !== slideIndex) return false;
|
|
23602
|
+
}
|
|
23603
|
+
}
|
|
23604
|
+
|
|
23605
|
+
if (slideIndex !== (previousIndex || 0) && runCallbacks) {
|
|
23606
|
+
swiper.emit('beforeSlideChangeStart');
|
|
23607
|
+
} // Update progress
|
|
23608
|
+
|
|
23609
|
+
|
|
23610
|
+
swiper.updateProgress(translate);
|
|
23611
|
+
let direction;
|
|
23612
|
+
if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index
|
|
23613
|
+
|
|
23614
|
+
if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
|
|
23615
|
+
swiper.updateActiveIndex(slideIndex); // Update Height
|
|
23616
|
+
|
|
23617
|
+
if (params.autoHeight) {
|
|
23618
|
+
swiper.updateAutoHeight();
|
|
23619
|
+
}
|
|
23620
|
+
|
|
23621
|
+
swiper.updateSlidesClasses();
|
|
23622
|
+
|
|
23623
|
+
if (params.effect !== 'slide') {
|
|
23624
|
+
swiper.setTranslate(translate);
|
|
23625
|
+
}
|
|
23626
|
+
|
|
23627
|
+
if (direction !== 'reset') {
|
|
23628
|
+
swiper.transitionStart(runCallbacks, direction);
|
|
23629
|
+
swiper.transitionEnd(runCallbacks, direction);
|
|
23630
|
+
}
|
|
23631
|
+
|
|
23632
|
+
return false;
|
|
23633
|
+
}
|
|
23634
|
+
|
|
23635
|
+
if (params.cssMode) {
|
|
23636
|
+
const isH = swiper.isHorizontal();
|
|
23637
|
+
const t = rtl ? translate : -translate;
|
|
23638
|
+
|
|
23639
|
+
if (speed === 0) {
|
|
23640
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
23641
|
+
|
|
23642
|
+
if (isVirtual) {
|
|
23643
|
+
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
23644
|
+
swiper._immediateVirtual = true;
|
|
23645
|
+
}
|
|
23646
|
+
|
|
23647
|
+
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
|
23648
|
+
|
|
23649
|
+
if (isVirtual) {
|
|
23650
|
+
requestAnimationFrame(() => {
|
|
23651
|
+
swiper.wrapperEl.style.scrollSnapType = '';
|
|
23652
|
+
swiper._swiperImmediateVirtual = false;
|
|
23653
|
+
});
|
|
23654
|
+
}
|
|
23655
|
+
} else {
|
|
23656
|
+
if (!swiper.support.smoothScroll) {
|
|
23657
|
+
animateCSSModeScroll({
|
|
23658
|
+
swiper,
|
|
23659
|
+
targetPosition: t,
|
|
23660
|
+
side: isH ? 'left' : 'top'
|
|
23661
|
+
});
|
|
23662
|
+
return true;
|
|
23663
|
+
}
|
|
23664
|
+
|
|
23665
|
+
wrapperEl.scrollTo({
|
|
23666
|
+
[isH ? 'left' : 'top']: t,
|
|
23667
|
+
behavior: 'smooth'
|
|
23668
|
+
});
|
|
23669
|
+
}
|
|
23670
|
+
|
|
23671
|
+
return true;
|
|
23672
|
+
}
|
|
23673
|
+
|
|
23674
|
+
swiper.setTransition(speed);
|
|
23675
|
+
swiper.setTranslate(translate);
|
|
23676
|
+
swiper.updateActiveIndex(slideIndex);
|
|
23677
|
+
swiper.updateSlidesClasses();
|
|
23678
|
+
swiper.emit('beforeTransitionStart', speed, internal);
|
|
23679
|
+
swiper.transitionStart(runCallbacks, direction);
|
|
23680
|
+
|
|
23681
|
+
if (speed === 0) {
|
|
23682
|
+
swiper.transitionEnd(runCallbacks, direction);
|
|
23683
|
+
} else if (!swiper.animating) {
|
|
23684
|
+
swiper.animating = true;
|
|
23685
|
+
|
|
23686
|
+
if (!swiper.onSlideToWrapperTransitionEnd) {
|
|
23687
|
+
swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
|
|
23688
|
+
if (!swiper || swiper.destroyed) return;
|
|
23689
|
+
if (e.target !== this) return;
|
|
23690
|
+
swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
|
|
23691
|
+
swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
|
|
23692
|
+
swiper.onSlideToWrapperTransitionEnd = null;
|
|
23693
|
+
delete swiper.onSlideToWrapperTransitionEnd;
|
|
23694
|
+
swiper.transitionEnd(runCallbacks, direction);
|
|
23695
|
+
};
|
|
23696
|
+
}
|
|
23697
|
+
|
|
23698
|
+
swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
|
|
23699
|
+
swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);
|
|
23700
|
+
}
|
|
23701
|
+
|
|
23702
|
+
return true;
|
|
23703
|
+
}
|
|
23704
|
+
|
|
23705
|
+
function slideToLoop(index = 0, speed = this.params.speed, runCallbacks = true, internal) {
|
|
23706
|
+
if (typeof index === 'string') {
|
|
23707
|
+
/**
|
|
23708
|
+
* The `index` argument converted from `string` to `number`.
|
|
23709
|
+
* @type {number}
|
|
23710
|
+
*/
|
|
23711
|
+
const indexAsNumber = parseInt(index, 10);
|
|
23712
|
+
/**
|
|
23713
|
+
* Determines whether the `index` argument is a valid `number`
|
|
23714
|
+
* after being converted from the `string` type.
|
|
23715
|
+
* @type {boolean}
|
|
23716
|
+
*/
|
|
23717
|
+
|
|
23718
|
+
const isValidNumber = isFinite(indexAsNumber);
|
|
23719
|
+
|
|
23720
|
+
if (!isValidNumber) {
|
|
23721
|
+
throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`);
|
|
23722
|
+
} // Knowing that the converted `index` is a valid number,
|
|
23723
|
+
// we can update the original argument's value.
|
|
23724
|
+
|
|
23725
|
+
|
|
23726
|
+
index = indexAsNumber;
|
|
23727
|
+
}
|
|
23728
|
+
|
|
23729
|
+
const swiper = this;
|
|
23730
|
+
let newIndex = index;
|
|
23731
|
+
|
|
23732
|
+
if (swiper.params.loop) {
|
|
23733
|
+
newIndex += swiper.loopedSlides;
|
|
23734
|
+
}
|
|
23735
|
+
|
|
23736
|
+
return swiper.slideTo(newIndex, speed, runCallbacks, internal);
|
|
23737
|
+
}
|
|
23738
|
+
|
|
23739
|
+
/* eslint no-unused-vars: "off" */
|
|
23740
|
+
function slideNext(speed = this.params.speed, runCallbacks = true, internal) {
|
|
23741
|
+
const swiper = this;
|
|
23742
|
+
const {
|
|
23743
|
+
animating,
|
|
23744
|
+
enabled,
|
|
23745
|
+
params
|
|
23746
|
+
} = swiper;
|
|
23747
|
+
if (!enabled) return swiper;
|
|
23748
|
+
let perGroup = params.slidesPerGroup;
|
|
23749
|
+
|
|
23750
|
+
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
|
23751
|
+
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
|
|
23752
|
+
}
|
|
23753
|
+
|
|
23754
|
+
const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
|
|
23755
|
+
|
|
23756
|
+
if (params.loop) {
|
|
23757
|
+
if (animating && params.loopPreventsSlide) return false;
|
|
23758
|
+
swiper.loopFix(); // eslint-disable-next-line
|
|
23759
|
+
|
|
23760
|
+
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
|
|
23761
|
+
}
|
|
23762
|
+
|
|
23763
|
+
if (params.rewind && swiper.isEnd) {
|
|
23764
|
+
return swiper.slideTo(0, speed, runCallbacks, internal);
|
|
23765
|
+
}
|
|
23766
|
+
|
|
23767
|
+
return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
|
|
23768
|
+
}
|
|
23769
|
+
|
|
23770
|
+
/* eslint no-unused-vars: "off" */
|
|
23771
|
+
function slidePrev(speed = this.params.speed, runCallbacks = true, internal) {
|
|
23772
|
+
const swiper = this;
|
|
23773
|
+
const {
|
|
23774
|
+
params,
|
|
23775
|
+
animating,
|
|
23776
|
+
snapGrid,
|
|
23777
|
+
slidesGrid,
|
|
23778
|
+
rtlTranslate,
|
|
23779
|
+
enabled
|
|
23780
|
+
} = swiper;
|
|
23781
|
+
if (!enabled) return swiper;
|
|
23782
|
+
|
|
23783
|
+
if (params.loop) {
|
|
23784
|
+
if (animating && params.loopPreventsSlide) return false;
|
|
23785
|
+
swiper.loopFix(); // eslint-disable-next-line
|
|
23786
|
+
|
|
23787
|
+
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
|
|
23788
|
+
}
|
|
23789
|
+
|
|
23790
|
+
const translate = rtlTranslate ? swiper.translate : -swiper.translate;
|
|
23791
|
+
|
|
23792
|
+
function normalize(val) {
|
|
23793
|
+
if (val < 0) return -Math.floor(Math.abs(val));
|
|
23794
|
+
return Math.floor(val);
|
|
23795
|
+
}
|
|
23796
|
+
|
|
23797
|
+
const normalizedTranslate = normalize(translate);
|
|
23798
|
+
const normalizedSnapGrid = snapGrid.map(val => normalize(val));
|
|
23799
|
+
let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
|
|
23800
|
+
|
|
23801
|
+
if (typeof prevSnap === 'undefined' && params.cssMode) {
|
|
23802
|
+
let prevSnapIndex;
|
|
23803
|
+
snapGrid.forEach((snap, snapIndex) => {
|
|
23804
|
+
if (normalizedTranslate >= snap) {
|
|
23805
|
+
// prevSnap = snap;
|
|
23806
|
+
prevSnapIndex = snapIndex;
|
|
23807
|
+
}
|
|
23808
|
+
});
|
|
23809
|
+
|
|
23810
|
+
if (typeof prevSnapIndex !== 'undefined') {
|
|
23811
|
+
prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
|
|
23812
|
+
}
|
|
23813
|
+
}
|
|
23814
|
+
|
|
23815
|
+
let prevIndex = 0;
|
|
23816
|
+
|
|
23817
|
+
if (typeof prevSnap !== 'undefined') {
|
|
23818
|
+
prevIndex = slidesGrid.indexOf(prevSnap);
|
|
23819
|
+
if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
|
|
23820
|
+
|
|
23821
|
+
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
|
23822
|
+
prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
|
|
23823
|
+
prevIndex = Math.max(prevIndex, 0);
|
|
23824
|
+
}
|
|
23825
|
+
}
|
|
23826
|
+
|
|
23827
|
+
if (params.rewind && swiper.isBeginning) {
|
|
23828
|
+
const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
|
|
23829
|
+
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
|
|
23830
|
+
}
|
|
23831
|
+
|
|
23832
|
+
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
|
|
23833
|
+
}
|
|
23834
|
+
|
|
23835
|
+
/* eslint no-unused-vars: "off" */
|
|
23836
|
+
function slideReset(speed = this.params.speed, runCallbacks = true, internal) {
|
|
23837
|
+
const swiper = this;
|
|
23838
|
+
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
|
|
23839
|
+
}
|
|
23840
|
+
|
|
23841
|
+
/* eslint no-unused-vars: "off" */
|
|
23842
|
+
function slideToClosest(speed = this.params.speed, runCallbacks = true, internal, threshold = 0.5) {
|
|
23843
|
+
const swiper = this;
|
|
23844
|
+
let index = swiper.activeIndex;
|
|
23845
|
+
const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
|
|
23846
|
+
const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
|
|
23847
|
+
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
|
|
23848
|
+
|
|
23849
|
+
if (translate >= swiper.snapGrid[snapIndex]) {
|
|
23850
|
+
// The current translate is on or after the current snap index, so the choice
|
|
23851
|
+
// is between the current index and the one after it.
|
|
23852
|
+
const currentSnap = swiper.snapGrid[snapIndex];
|
|
23853
|
+
const nextSnap = swiper.snapGrid[snapIndex + 1];
|
|
23854
|
+
|
|
23855
|
+
if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
|
|
23856
|
+
index += swiper.params.slidesPerGroup;
|
|
23857
|
+
}
|
|
23858
|
+
} else {
|
|
23859
|
+
// The current translate is before the current snap index, so the choice
|
|
23860
|
+
// is between the current index and the one before it.
|
|
23861
|
+
const prevSnap = swiper.snapGrid[snapIndex - 1];
|
|
23862
|
+
const currentSnap = swiper.snapGrid[snapIndex];
|
|
23863
|
+
|
|
23864
|
+
if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
|
|
23865
|
+
index -= swiper.params.slidesPerGroup;
|
|
23866
|
+
}
|
|
23867
|
+
}
|
|
23868
|
+
|
|
23869
|
+
index = Math.max(index, 0);
|
|
23870
|
+
index = Math.min(index, swiper.slidesGrid.length - 1);
|
|
23871
|
+
return swiper.slideTo(index, speed, runCallbacks, internal);
|
|
23872
|
+
}
|
|
23873
|
+
|
|
23874
|
+
function slideToClickedSlide() {
|
|
23875
|
+
const swiper = this;
|
|
23876
|
+
const {
|
|
23877
|
+
params,
|
|
23878
|
+
$wrapperEl
|
|
23879
|
+
} = swiper;
|
|
23880
|
+
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
|
|
23881
|
+
let slideToIndex = swiper.clickedIndex;
|
|
23882
|
+
let realIndex;
|
|
23883
|
+
|
|
23884
|
+
if (params.loop) {
|
|
23885
|
+
if (swiper.animating) return;
|
|
23886
|
+
realIndex = parseInt(dom7.$(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
|
|
23887
|
+
|
|
23888
|
+
if (params.centeredSlides) {
|
|
23889
|
+
if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
|
|
23890
|
+
swiper.loopFix();
|
|
23891
|
+
slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
|
|
23892
|
+
nextTick(() => {
|
|
23893
|
+
swiper.slideTo(slideToIndex);
|
|
23894
|
+
});
|
|
23895
|
+
} else {
|
|
23896
|
+
swiper.slideTo(slideToIndex);
|
|
23897
|
+
}
|
|
23898
|
+
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
|
|
23899
|
+
swiper.loopFix();
|
|
23900
|
+
slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
|
|
23901
|
+
nextTick(() => {
|
|
23902
|
+
swiper.slideTo(slideToIndex);
|
|
23903
|
+
});
|
|
23904
|
+
} else {
|
|
23905
|
+
swiper.slideTo(slideToIndex);
|
|
23906
|
+
}
|
|
23907
|
+
} else {
|
|
23908
|
+
swiper.slideTo(slideToIndex);
|
|
23909
|
+
}
|
|
23910
|
+
}
|
|
23911
|
+
|
|
23912
|
+
var slide = {
|
|
23913
|
+
slideTo,
|
|
23914
|
+
slideToLoop,
|
|
23915
|
+
slideNext,
|
|
23916
|
+
slidePrev,
|
|
23917
|
+
slideReset,
|
|
23918
|
+
slideToClosest,
|
|
23919
|
+
slideToClickedSlide
|
|
23920
|
+
};
|
|
23921
|
+
|
|
23922
|
+
function loopCreate() {
|
|
23923
|
+
const swiper = this;
|
|
23924
|
+
const document = ssrWindow.getDocument();
|
|
23925
|
+
const {
|
|
23926
|
+
params,
|
|
23927
|
+
$wrapperEl
|
|
23928
|
+
} = swiper; // Remove duplicated slides
|
|
23929
|
+
|
|
23930
|
+
const $selector = $wrapperEl.children().length > 0 ? dom7.$($wrapperEl.children()[0].parentNode) : $wrapperEl;
|
|
23931
|
+
$selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove();
|
|
23932
|
+
let slides = $selector.children(`.${params.slideClass}`);
|
|
23933
|
+
|
|
23934
|
+
if (params.loopFillGroupWithBlank) {
|
|
23935
|
+
const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
|
|
23936
|
+
|
|
23937
|
+
if (blankSlidesNum !== params.slidesPerGroup) {
|
|
23938
|
+
for (let i = 0; i < blankSlidesNum; i += 1) {
|
|
23939
|
+
const blankNode = dom7.$(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`);
|
|
23940
|
+
$selector.append(blankNode);
|
|
23941
|
+
}
|
|
23942
|
+
|
|
23943
|
+
slides = $selector.children(`.${params.slideClass}`);
|
|
23944
|
+
}
|
|
23945
|
+
}
|
|
23946
|
+
|
|
23947
|
+
if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
|
|
23948
|
+
swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
|
|
23949
|
+
swiper.loopedSlides += params.loopAdditionalSlides;
|
|
23950
|
+
|
|
23951
|
+
if (swiper.loopedSlides > slides.length && swiper.params.loopedSlidesLimit) {
|
|
23952
|
+
swiper.loopedSlides = slides.length;
|
|
23953
|
+
}
|
|
23954
|
+
|
|
23955
|
+
const prependSlides = [];
|
|
23956
|
+
const appendSlides = [];
|
|
23957
|
+
slides.each((el, index) => {
|
|
23958
|
+
const slide = dom7.$(el);
|
|
23959
|
+
slide.attr('data-swiper-slide-index', index);
|
|
23960
|
+
});
|
|
23961
|
+
|
|
23962
|
+
for (let i = 0; i < swiper.loopedSlides; i += 1) {
|
|
23963
|
+
const index = i - Math.floor(i / slides.length) * slides.length;
|
|
23964
|
+
appendSlides.push(slides.eq(index)[0]);
|
|
23965
|
+
prependSlides.unshift(slides.eq(slides.length - index - 1)[0]);
|
|
23966
|
+
}
|
|
23967
|
+
|
|
23968
|
+
for (let i = 0; i < appendSlides.length; i += 1) {
|
|
23969
|
+
$selector.append(dom7.$(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
|
|
23970
|
+
}
|
|
23971
|
+
|
|
23972
|
+
for (let i = prependSlides.length - 1; i >= 0; i -= 1) {
|
|
23973
|
+
$selector.prepend(dom7.$(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
|
|
23974
|
+
}
|
|
23975
|
+
}
|
|
23976
|
+
|
|
23977
|
+
function loopFix() {
|
|
23978
|
+
const swiper = this;
|
|
23979
|
+
swiper.emit('beforeLoopFix');
|
|
23980
|
+
const {
|
|
23981
|
+
activeIndex,
|
|
23982
|
+
slides,
|
|
23983
|
+
loopedSlides,
|
|
23984
|
+
allowSlidePrev,
|
|
23985
|
+
allowSlideNext,
|
|
23986
|
+
snapGrid,
|
|
23987
|
+
rtlTranslate: rtl
|
|
23988
|
+
} = swiper;
|
|
23989
|
+
let newIndex;
|
|
23990
|
+
swiper.allowSlidePrev = true;
|
|
23991
|
+
swiper.allowSlideNext = true;
|
|
23992
|
+
const snapTranslate = -snapGrid[activeIndex];
|
|
23993
|
+
const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
|
|
23994
|
+
|
|
23995
|
+
if (activeIndex < loopedSlides) {
|
|
23996
|
+
newIndex = slides.length - loopedSlides * 3 + activeIndex;
|
|
23997
|
+
newIndex += loopedSlides;
|
|
23998
|
+
const slideChanged = swiper.slideTo(newIndex, 0, false, true);
|
|
23999
|
+
|
|
24000
|
+
if (slideChanged && diff !== 0) {
|
|
24001
|
+
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
|
|
24002
|
+
}
|
|
24003
|
+
} else if (activeIndex >= slides.length - loopedSlides) {
|
|
24004
|
+
// Fix For Positive Oversliding
|
|
24005
|
+
newIndex = -slides.length + activeIndex + loopedSlides;
|
|
24006
|
+
newIndex += loopedSlides;
|
|
24007
|
+
const slideChanged = swiper.slideTo(newIndex, 0, false, true);
|
|
24008
|
+
|
|
24009
|
+
if (slideChanged && diff !== 0) {
|
|
24010
|
+
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
|
|
24011
|
+
}
|
|
24012
|
+
}
|
|
24013
|
+
|
|
24014
|
+
swiper.allowSlidePrev = allowSlidePrev;
|
|
24015
|
+
swiper.allowSlideNext = allowSlideNext;
|
|
24016
|
+
swiper.emit('loopFix');
|
|
24017
|
+
}
|
|
24018
|
+
|
|
24019
|
+
function loopDestroy() {
|
|
24020
|
+
const swiper = this;
|
|
24021
|
+
const {
|
|
24022
|
+
$wrapperEl,
|
|
24023
|
+
params,
|
|
24024
|
+
slides
|
|
24025
|
+
} = swiper;
|
|
24026
|
+
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove();
|
|
24027
|
+
slides.removeAttr('data-swiper-slide-index');
|
|
24028
|
+
}
|
|
24029
|
+
|
|
24030
|
+
var loop = {
|
|
24031
|
+
loopCreate,
|
|
24032
|
+
loopFix,
|
|
24033
|
+
loopDestroy
|
|
24034
|
+
};
|
|
24035
|
+
|
|
24036
|
+
function setGrabCursor(moving) {
|
|
24037
|
+
const swiper = this;
|
|
24038
|
+
if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
|
|
24039
|
+
const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
|
|
24040
|
+
el.style.cursor = 'move';
|
|
24041
|
+
el.style.cursor = moving ? 'grabbing' : 'grab';
|
|
24042
|
+
}
|
|
24043
|
+
|
|
24044
|
+
function unsetGrabCursor() {
|
|
24045
|
+
const swiper = this;
|
|
24046
|
+
|
|
24047
|
+
if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
|
|
24048
|
+
return;
|
|
24049
|
+
}
|
|
24050
|
+
|
|
24051
|
+
swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
|
|
24052
|
+
}
|
|
24053
|
+
|
|
24054
|
+
var grabCursor = {
|
|
24055
|
+
setGrabCursor,
|
|
24056
|
+
unsetGrabCursor
|
|
24057
|
+
};
|
|
24058
|
+
|
|
24059
|
+
function closestElement(selector, base = this) {
|
|
24060
|
+
function __closestFrom(el) {
|
|
24061
|
+
if (!el || el === ssrWindow.getDocument() || el === ssrWindow.getWindow()) return null;
|
|
24062
|
+
if (el.assignedSlot) el = el.assignedSlot;
|
|
24063
|
+
const found = el.closest(selector);
|
|
24064
|
+
|
|
24065
|
+
if (!found && !el.getRootNode) {
|
|
24066
|
+
return null;
|
|
24067
|
+
}
|
|
24068
|
+
|
|
24069
|
+
return found || __closestFrom(el.getRootNode().host);
|
|
24070
|
+
}
|
|
24071
|
+
|
|
24072
|
+
return __closestFrom(base);
|
|
24073
|
+
}
|
|
24074
|
+
|
|
24075
|
+
function onTouchStart(event) {
|
|
24076
|
+
const swiper = this;
|
|
24077
|
+
const document = ssrWindow.getDocument();
|
|
24078
|
+
const window = ssrWindow.getWindow();
|
|
24079
|
+
const data = swiper.touchEventsData;
|
|
24080
|
+
const {
|
|
24081
|
+
params,
|
|
24082
|
+
touches,
|
|
24083
|
+
enabled
|
|
24084
|
+
} = swiper;
|
|
24085
|
+
if (!enabled) return;
|
|
24086
|
+
|
|
24087
|
+
if (swiper.animating && params.preventInteractionOnTransition) {
|
|
24088
|
+
return;
|
|
24089
|
+
}
|
|
24090
|
+
|
|
24091
|
+
if (!swiper.animating && params.cssMode && params.loop) {
|
|
24092
|
+
swiper.loopFix();
|
|
24093
|
+
}
|
|
24094
|
+
|
|
24095
|
+
let e = event;
|
|
24096
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
24097
|
+
let $targetEl = dom7.$(e.target);
|
|
24098
|
+
|
|
24099
|
+
if (params.touchEventsTarget === 'wrapper') {
|
|
24100
|
+
if (!$targetEl.closest(swiper.wrapperEl).length) return;
|
|
24101
|
+
}
|
|
24102
|
+
|
|
24103
|
+
data.isTouchEvent = e.type === 'touchstart';
|
|
24104
|
+
if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
|
|
24105
|
+
if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
|
|
24106
|
+
if (data.isTouched && data.isMoved) return; // change target el for shadow root component
|
|
24107
|
+
|
|
24108
|
+
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; // eslint-disable-next-line
|
|
24109
|
+
|
|
24110
|
+
const eventPath = event.composedPath ? event.composedPath() : event.path;
|
|
24111
|
+
|
|
24112
|
+
if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
|
|
24113
|
+
$targetEl = dom7.$(eventPath[0]);
|
|
24114
|
+
}
|
|
24115
|
+
|
|
24116
|
+
const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
|
|
24117
|
+
const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element
|
|
24118
|
+
|
|
24119
|
+
if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, $targetEl[0]) : $targetEl.closest(noSwipingSelector)[0])) {
|
|
24120
|
+
swiper.allowClick = true;
|
|
24121
|
+
return;
|
|
24122
|
+
}
|
|
24123
|
+
|
|
24124
|
+
if (params.swipeHandler) {
|
|
24125
|
+
if (!$targetEl.closest(params.swipeHandler)[0]) return;
|
|
24126
|
+
}
|
|
24127
|
+
|
|
24128
|
+
touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
|
|
24129
|
+
touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
|
|
24130
|
+
const startX = touches.currentX;
|
|
24131
|
+
const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
|
|
24132
|
+
|
|
24133
|
+
const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
|
|
24134
|
+
const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
|
|
24135
|
+
|
|
24136
|
+
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
|
|
24137
|
+
if (edgeSwipeDetection === 'prevent') {
|
|
24138
|
+
event.preventDefault();
|
|
24139
|
+
} else {
|
|
24140
|
+
return;
|
|
24141
|
+
}
|
|
24142
|
+
}
|
|
24143
|
+
|
|
24144
|
+
Object.assign(data, {
|
|
24145
|
+
isTouched: true,
|
|
24146
|
+
isMoved: false,
|
|
24147
|
+
allowTouchCallbacks: true,
|
|
24148
|
+
isScrolling: undefined,
|
|
24149
|
+
startMoving: undefined
|
|
24150
|
+
});
|
|
24151
|
+
touches.startX = startX;
|
|
24152
|
+
touches.startY = startY;
|
|
24153
|
+
data.touchStartTime = now();
|
|
24154
|
+
swiper.allowClick = true;
|
|
24155
|
+
swiper.updateSize();
|
|
24156
|
+
swiper.swipeDirection = undefined;
|
|
24157
|
+
if (params.threshold > 0) data.allowThresholdMove = false;
|
|
24158
|
+
|
|
24159
|
+
if (e.type !== 'touchstart') {
|
|
24160
|
+
let preventDefault = true;
|
|
24161
|
+
|
|
24162
|
+
if ($targetEl.is(data.focusableElements)) {
|
|
24163
|
+
preventDefault = false;
|
|
24164
|
+
|
|
24165
|
+
if ($targetEl[0].nodeName === 'SELECT') {
|
|
24166
|
+
data.isTouched = false;
|
|
24167
|
+
}
|
|
24168
|
+
}
|
|
24169
|
+
|
|
24170
|
+
if (document.activeElement && dom7.$(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {
|
|
24171
|
+
document.activeElement.blur();
|
|
24172
|
+
}
|
|
24173
|
+
|
|
24174
|
+
const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
|
|
24175
|
+
|
|
24176
|
+
if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {
|
|
24177
|
+
e.preventDefault();
|
|
24178
|
+
}
|
|
24179
|
+
}
|
|
24180
|
+
|
|
24181
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
|
|
24182
|
+
swiper.freeMode.onTouchStart();
|
|
24183
|
+
}
|
|
24184
|
+
|
|
24185
|
+
swiper.emit('touchStart', e);
|
|
24186
|
+
}
|
|
24187
|
+
|
|
24188
|
+
function onTouchMove(event) {
|
|
24189
|
+
const document = ssrWindow.getDocument();
|
|
24190
|
+
const swiper = this;
|
|
24191
|
+
const data = swiper.touchEventsData;
|
|
24192
|
+
const {
|
|
24193
|
+
params,
|
|
24194
|
+
touches,
|
|
24195
|
+
rtlTranslate: rtl,
|
|
24196
|
+
enabled
|
|
24197
|
+
} = swiper;
|
|
24198
|
+
if (!enabled) return;
|
|
24199
|
+
let e = event;
|
|
24200
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
24201
|
+
|
|
24202
|
+
if (!data.isTouched) {
|
|
24203
|
+
if (data.startMoving && data.isScrolling) {
|
|
24204
|
+
swiper.emit('touchMoveOpposite', e);
|
|
24205
|
+
}
|
|
24206
|
+
|
|
24207
|
+
return;
|
|
24208
|
+
}
|
|
24209
|
+
|
|
24210
|
+
if (data.isTouchEvent && e.type !== 'touchmove') return;
|
|
24211
|
+
const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
|
|
24212
|
+
const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
|
|
24213
|
+
const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
|
|
24214
|
+
|
|
24215
|
+
if (e.preventedByNestedSwiper) {
|
|
24216
|
+
touches.startX = pageX;
|
|
24217
|
+
touches.startY = pageY;
|
|
24218
|
+
return;
|
|
24219
|
+
}
|
|
24220
|
+
|
|
24221
|
+
if (!swiper.allowTouchMove) {
|
|
24222
|
+
if (!dom7.$(e.target).is(data.focusableElements)) {
|
|
24223
|
+
swiper.allowClick = false;
|
|
24224
|
+
}
|
|
24225
|
+
|
|
24226
|
+
if (data.isTouched) {
|
|
24227
|
+
Object.assign(touches, {
|
|
24228
|
+
startX: pageX,
|
|
24229
|
+
startY: pageY,
|
|
24230
|
+
currentX: pageX,
|
|
24231
|
+
currentY: pageY
|
|
24232
|
+
});
|
|
24233
|
+
data.touchStartTime = now();
|
|
24234
|
+
}
|
|
24235
|
+
|
|
24236
|
+
return;
|
|
24237
|
+
}
|
|
24238
|
+
|
|
24239
|
+
if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
|
|
24240
|
+
if (swiper.isVertical()) {
|
|
24241
|
+
// Vertical
|
|
24242
|
+
if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
|
|
24243
|
+
data.isTouched = false;
|
|
24244
|
+
data.isMoved = false;
|
|
24245
|
+
return;
|
|
24246
|
+
}
|
|
24247
|
+
} else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
|
|
24248
|
+
return;
|
|
24249
|
+
}
|
|
24250
|
+
}
|
|
24251
|
+
|
|
24252
|
+
if (data.isTouchEvent && document.activeElement) {
|
|
24253
|
+
if (e.target === document.activeElement && dom7.$(e.target).is(data.focusableElements)) {
|
|
24254
|
+
data.isMoved = true;
|
|
24255
|
+
swiper.allowClick = false;
|
|
24256
|
+
return;
|
|
24257
|
+
}
|
|
24258
|
+
}
|
|
24259
|
+
|
|
24260
|
+
if (data.allowTouchCallbacks) {
|
|
24261
|
+
swiper.emit('touchMove', e);
|
|
24262
|
+
}
|
|
24263
|
+
|
|
24264
|
+
if (e.targetTouches && e.targetTouches.length > 1) return;
|
|
24265
|
+
touches.currentX = pageX;
|
|
24266
|
+
touches.currentY = pageY;
|
|
24267
|
+
const diffX = touches.currentX - touches.startX;
|
|
24268
|
+
const diffY = touches.currentY - touches.startY;
|
|
24269
|
+
if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
|
|
24270
|
+
|
|
24271
|
+
if (typeof data.isScrolling === 'undefined') {
|
|
24272
|
+
let touchAngle;
|
|
24273
|
+
|
|
24274
|
+
if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
|
|
24275
|
+
data.isScrolling = false;
|
|
24276
|
+
} else {
|
|
24277
|
+
// eslint-disable-next-line
|
|
24278
|
+
if (diffX * diffX + diffY * diffY >= 25) {
|
|
24279
|
+
touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
|
|
24280
|
+
data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
|
|
24281
|
+
}
|
|
24282
|
+
}
|
|
24283
|
+
}
|
|
24284
|
+
|
|
24285
|
+
if (data.isScrolling) {
|
|
24286
|
+
swiper.emit('touchMoveOpposite', e);
|
|
24287
|
+
}
|
|
24288
|
+
|
|
24289
|
+
if (typeof data.startMoving === 'undefined') {
|
|
24290
|
+
if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
|
|
24291
|
+
data.startMoving = true;
|
|
24292
|
+
}
|
|
24293
|
+
}
|
|
24294
|
+
|
|
24295
|
+
if (data.isScrolling) {
|
|
24296
|
+
data.isTouched = false;
|
|
24297
|
+
return;
|
|
24298
|
+
}
|
|
24299
|
+
|
|
24300
|
+
if (!data.startMoving) {
|
|
24301
|
+
return;
|
|
24302
|
+
}
|
|
24303
|
+
|
|
24304
|
+
swiper.allowClick = false;
|
|
24305
|
+
|
|
24306
|
+
if (!params.cssMode && e.cancelable) {
|
|
24307
|
+
e.preventDefault();
|
|
24308
|
+
}
|
|
24309
|
+
|
|
24310
|
+
if (params.touchMoveStopPropagation && !params.nested) {
|
|
24311
|
+
e.stopPropagation();
|
|
24312
|
+
}
|
|
24313
|
+
|
|
24314
|
+
if (!data.isMoved) {
|
|
24315
|
+
if (params.loop && !params.cssMode) {
|
|
24316
|
+
swiper.loopFix();
|
|
24317
|
+
}
|
|
24318
|
+
|
|
24319
|
+
data.startTranslate = swiper.getTranslate();
|
|
24320
|
+
swiper.setTransition(0);
|
|
24321
|
+
|
|
24322
|
+
if (swiper.animating) {
|
|
24323
|
+
swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
|
|
24324
|
+
}
|
|
24325
|
+
|
|
24326
|
+
data.allowMomentumBounce = false; // Grab Cursor
|
|
24327
|
+
|
|
24328
|
+
if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
24329
|
+
swiper.setGrabCursor(true);
|
|
24330
|
+
}
|
|
24331
|
+
|
|
24332
|
+
swiper.emit('sliderFirstMove', e);
|
|
24333
|
+
}
|
|
24334
|
+
|
|
24335
|
+
swiper.emit('sliderMove', e);
|
|
24336
|
+
data.isMoved = true;
|
|
24337
|
+
let diff = swiper.isHorizontal() ? diffX : diffY;
|
|
24338
|
+
touches.diff = diff;
|
|
24339
|
+
diff *= params.touchRatio;
|
|
24340
|
+
if (rtl) diff = -diff;
|
|
24341
|
+
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
|
|
24342
|
+
data.currentTranslate = diff + data.startTranslate;
|
|
24343
|
+
let disableParentSwiper = true;
|
|
24344
|
+
let resistanceRatio = params.resistanceRatio;
|
|
24345
|
+
|
|
24346
|
+
if (params.touchReleaseOnEdges) {
|
|
24347
|
+
resistanceRatio = 0;
|
|
24348
|
+
}
|
|
24349
|
+
|
|
24350
|
+
if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
|
|
24351
|
+
disableParentSwiper = false;
|
|
24352
|
+
if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
|
|
24353
|
+
} else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
|
|
24354
|
+
disableParentSwiper = false;
|
|
24355
|
+
if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
|
|
24356
|
+
}
|
|
24357
|
+
|
|
24358
|
+
if (disableParentSwiper) {
|
|
24359
|
+
e.preventedByNestedSwiper = true;
|
|
24360
|
+
} // Directions locks
|
|
24361
|
+
|
|
24362
|
+
|
|
24363
|
+
if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
|
|
24364
|
+
data.currentTranslate = data.startTranslate;
|
|
24365
|
+
}
|
|
24366
|
+
|
|
24367
|
+
if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
|
|
24368
|
+
data.currentTranslate = data.startTranslate;
|
|
24369
|
+
}
|
|
24370
|
+
|
|
24371
|
+
if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
|
|
24372
|
+
data.currentTranslate = data.startTranslate;
|
|
24373
|
+
} // Threshold
|
|
24374
|
+
|
|
24375
|
+
|
|
24376
|
+
if (params.threshold > 0) {
|
|
24377
|
+
if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
|
|
24378
|
+
if (!data.allowThresholdMove) {
|
|
24379
|
+
data.allowThresholdMove = true;
|
|
24380
|
+
touches.startX = touches.currentX;
|
|
24381
|
+
touches.startY = touches.currentY;
|
|
24382
|
+
data.currentTranslate = data.startTranslate;
|
|
24383
|
+
touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
|
|
24384
|
+
return;
|
|
24385
|
+
}
|
|
24386
|
+
} else {
|
|
24387
|
+
data.currentTranslate = data.startTranslate;
|
|
24388
|
+
return;
|
|
24389
|
+
}
|
|
24390
|
+
}
|
|
24391
|
+
|
|
24392
|
+
if (!params.followFinger || params.cssMode) return; // Update active index in free mode
|
|
24393
|
+
|
|
24394
|
+
if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
|
|
24395
|
+
swiper.updateActiveIndex();
|
|
24396
|
+
swiper.updateSlidesClasses();
|
|
24397
|
+
}
|
|
24398
|
+
|
|
24399
|
+
if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) {
|
|
24400
|
+
swiper.freeMode.onTouchMove();
|
|
24401
|
+
} // Update progress
|
|
24402
|
+
|
|
24403
|
+
|
|
24404
|
+
swiper.updateProgress(data.currentTranslate); // Update translate
|
|
24405
|
+
|
|
24406
|
+
swiper.setTranslate(data.currentTranslate);
|
|
24407
|
+
}
|
|
24408
|
+
|
|
24409
|
+
function onTouchEnd(event) {
|
|
24410
|
+
const swiper = this;
|
|
24411
|
+
const data = swiper.touchEventsData;
|
|
24412
|
+
const {
|
|
24413
|
+
params,
|
|
24414
|
+
touches,
|
|
24415
|
+
rtlTranslate: rtl,
|
|
24416
|
+
slidesGrid,
|
|
24417
|
+
enabled
|
|
24418
|
+
} = swiper;
|
|
24419
|
+
if (!enabled) return;
|
|
24420
|
+
let e = event;
|
|
24421
|
+
if (e.originalEvent) e = e.originalEvent;
|
|
24422
|
+
|
|
24423
|
+
if (data.allowTouchCallbacks) {
|
|
24424
|
+
swiper.emit('touchEnd', e);
|
|
24425
|
+
}
|
|
24426
|
+
|
|
24427
|
+
data.allowTouchCallbacks = false;
|
|
24428
|
+
|
|
24429
|
+
if (!data.isTouched) {
|
|
24430
|
+
if (data.isMoved && params.grabCursor) {
|
|
24431
|
+
swiper.setGrabCursor(false);
|
|
24432
|
+
}
|
|
24433
|
+
|
|
24434
|
+
data.isMoved = false;
|
|
24435
|
+
data.startMoving = false;
|
|
24436
|
+
return;
|
|
24437
|
+
} // Return Grab Cursor
|
|
24438
|
+
|
|
24439
|
+
|
|
24440
|
+
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
24441
|
+
swiper.setGrabCursor(false);
|
|
24442
|
+
} // Time diff
|
|
24443
|
+
|
|
24444
|
+
|
|
24445
|
+
const touchEndTime = now();
|
|
24446
|
+
const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
|
|
24447
|
+
|
|
24448
|
+
if (swiper.allowClick) {
|
|
24449
|
+
const pathTree = e.path || e.composedPath && e.composedPath();
|
|
24450
|
+
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
|
|
24451
|
+
swiper.emit('tap click', e);
|
|
24452
|
+
|
|
24453
|
+
if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
|
|
24454
|
+
swiper.emit('doubleTap doubleClick', e);
|
|
24455
|
+
}
|
|
24456
|
+
}
|
|
24457
|
+
|
|
24458
|
+
data.lastClickTime = now();
|
|
24459
|
+
nextTick(() => {
|
|
24460
|
+
if (!swiper.destroyed) swiper.allowClick = true;
|
|
24461
|
+
});
|
|
24462
|
+
|
|
24463
|
+
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
|
|
24464
|
+
data.isTouched = false;
|
|
24465
|
+
data.isMoved = false;
|
|
24466
|
+
data.startMoving = false;
|
|
24467
|
+
return;
|
|
24468
|
+
}
|
|
24469
|
+
|
|
24470
|
+
data.isTouched = false;
|
|
24471
|
+
data.isMoved = false;
|
|
24472
|
+
data.startMoving = false;
|
|
24473
|
+
let currentPos;
|
|
24474
|
+
|
|
24475
|
+
if (params.followFinger) {
|
|
24476
|
+
currentPos = rtl ? swiper.translate : -swiper.translate;
|
|
24477
|
+
} else {
|
|
24478
|
+
currentPos = -data.currentTranslate;
|
|
24479
|
+
}
|
|
24480
|
+
|
|
24481
|
+
if (params.cssMode) {
|
|
24482
|
+
return;
|
|
24483
|
+
}
|
|
24484
|
+
|
|
24485
|
+
if (swiper.params.freeMode && params.freeMode.enabled) {
|
|
24486
|
+
swiper.freeMode.onTouchEnd({
|
|
24487
|
+
currentPos
|
|
24488
|
+
});
|
|
24489
|
+
return;
|
|
24490
|
+
} // Find current slide
|
|
24491
|
+
|
|
24492
|
+
|
|
24493
|
+
let stopIndex = 0;
|
|
24494
|
+
let groupSize = swiper.slidesSizesGrid[0];
|
|
24495
|
+
|
|
24496
|
+
for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
|
|
24497
|
+
const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
|
24498
|
+
|
|
24499
|
+
if (typeof slidesGrid[i + increment] !== 'undefined') {
|
|
24500
|
+
if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
|
|
24501
|
+
stopIndex = i;
|
|
24502
|
+
groupSize = slidesGrid[i + increment] - slidesGrid[i];
|
|
24503
|
+
}
|
|
24504
|
+
} else if (currentPos >= slidesGrid[i]) {
|
|
24505
|
+
stopIndex = i;
|
|
24506
|
+
groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
|
|
24507
|
+
}
|
|
24508
|
+
}
|
|
24509
|
+
|
|
24510
|
+
let rewindFirstIndex = null;
|
|
24511
|
+
let rewindLastIndex = null;
|
|
24512
|
+
|
|
24513
|
+
if (params.rewind) {
|
|
24514
|
+
if (swiper.isBeginning) {
|
|
24515
|
+
rewindLastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
|
|
24516
|
+
} else if (swiper.isEnd) {
|
|
24517
|
+
rewindFirstIndex = 0;
|
|
24518
|
+
}
|
|
24519
|
+
} // Find current slide size
|
|
24520
|
+
|
|
24521
|
+
|
|
24522
|
+
const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
|
|
24523
|
+
const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
|
24524
|
+
|
|
24525
|
+
if (timeDiff > params.longSwipesMs) {
|
|
24526
|
+
// Long touches
|
|
24527
|
+
if (!params.longSwipes) {
|
|
24528
|
+
swiper.slideTo(swiper.activeIndex);
|
|
24529
|
+
return;
|
|
24530
|
+
}
|
|
24531
|
+
|
|
24532
|
+
if (swiper.swipeDirection === 'next') {
|
|
24533
|
+
if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
|
|
24534
|
+
}
|
|
24535
|
+
|
|
24536
|
+
if (swiper.swipeDirection === 'prev') {
|
|
24537
|
+
if (ratio > 1 - params.longSwipesRatio) {
|
|
24538
|
+
swiper.slideTo(stopIndex + increment);
|
|
24539
|
+
} else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
|
|
24540
|
+
swiper.slideTo(rewindLastIndex);
|
|
24541
|
+
} else {
|
|
24542
|
+
swiper.slideTo(stopIndex);
|
|
24543
|
+
}
|
|
24544
|
+
}
|
|
24545
|
+
} else {
|
|
24546
|
+
// Short swipes
|
|
24547
|
+
if (!params.shortSwipes) {
|
|
24548
|
+
swiper.slideTo(swiper.activeIndex);
|
|
24549
|
+
return;
|
|
24550
|
+
}
|
|
24551
|
+
|
|
24552
|
+
const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
|
|
24553
|
+
|
|
24554
|
+
if (!isNavButtonTarget) {
|
|
24555
|
+
if (swiper.swipeDirection === 'next') {
|
|
24556
|
+
swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
|
|
24557
|
+
}
|
|
24558
|
+
|
|
24559
|
+
if (swiper.swipeDirection === 'prev') {
|
|
24560
|
+
swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
|
|
24561
|
+
}
|
|
24562
|
+
} else if (e.target === swiper.navigation.nextEl) {
|
|
24563
|
+
swiper.slideTo(stopIndex + increment);
|
|
24564
|
+
} else {
|
|
24565
|
+
swiper.slideTo(stopIndex);
|
|
24566
|
+
}
|
|
24567
|
+
}
|
|
24568
|
+
}
|
|
24569
|
+
|
|
24570
|
+
function onResize() {
|
|
24571
|
+
const swiper = this;
|
|
24572
|
+
const {
|
|
24573
|
+
params,
|
|
24574
|
+
el
|
|
24575
|
+
} = swiper;
|
|
24576
|
+
if (el && el.offsetWidth === 0) return; // Breakpoints
|
|
24577
|
+
|
|
24578
|
+
if (params.breakpoints) {
|
|
24579
|
+
swiper.setBreakpoint();
|
|
24580
|
+
} // Save locks
|
|
24581
|
+
|
|
24582
|
+
|
|
24583
|
+
const {
|
|
24584
|
+
allowSlideNext,
|
|
24585
|
+
allowSlidePrev,
|
|
24586
|
+
snapGrid
|
|
24587
|
+
} = swiper; // Disable locks on resize
|
|
24588
|
+
|
|
24589
|
+
swiper.allowSlideNext = true;
|
|
24590
|
+
swiper.allowSlidePrev = true;
|
|
24591
|
+
swiper.updateSize();
|
|
24592
|
+
swiper.updateSlides();
|
|
24593
|
+
swiper.updateSlidesClasses();
|
|
24594
|
+
|
|
24595
|
+
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
|
|
24596
|
+
swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
|
24597
|
+
} else {
|
|
24598
|
+
swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
24599
|
+
}
|
|
24600
|
+
|
|
24601
|
+
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
|
|
24602
|
+
swiper.autoplay.run();
|
|
24603
|
+
} // Return locks after resize
|
|
24604
|
+
|
|
24605
|
+
|
|
24606
|
+
swiper.allowSlidePrev = allowSlidePrev;
|
|
24607
|
+
swiper.allowSlideNext = allowSlideNext;
|
|
24608
|
+
|
|
24609
|
+
if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
|
24610
|
+
swiper.checkOverflow();
|
|
24611
|
+
}
|
|
24612
|
+
}
|
|
24613
|
+
|
|
24614
|
+
function onClick(e) {
|
|
24615
|
+
const swiper = this;
|
|
24616
|
+
if (!swiper.enabled) return;
|
|
24617
|
+
|
|
24618
|
+
if (!swiper.allowClick) {
|
|
24619
|
+
if (swiper.params.preventClicks) e.preventDefault();
|
|
24620
|
+
|
|
24621
|
+
if (swiper.params.preventClicksPropagation && swiper.animating) {
|
|
24622
|
+
e.stopPropagation();
|
|
24623
|
+
e.stopImmediatePropagation();
|
|
24624
|
+
}
|
|
24625
|
+
}
|
|
24626
|
+
}
|
|
24627
|
+
|
|
24628
|
+
function onScroll() {
|
|
24629
|
+
const swiper = this;
|
|
24630
|
+
const {
|
|
24631
|
+
wrapperEl,
|
|
24632
|
+
rtlTranslate,
|
|
24633
|
+
enabled
|
|
24634
|
+
} = swiper;
|
|
24635
|
+
if (!enabled) return;
|
|
24636
|
+
swiper.previousTranslate = swiper.translate;
|
|
24637
|
+
|
|
24638
|
+
if (swiper.isHorizontal()) {
|
|
24639
|
+
swiper.translate = -wrapperEl.scrollLeft;
|
|
24640
|
+
} else {
|
|
24641
|
+
swiper.translate = -wrapperEl.scrollTop;
|
|
24642
|
+
} // eslint-disable-next-line
|
|
24643
|
+
|
|
24644
|
+
|
|
24645
|
+
if (swiper.translate === 0) swiper.translate = 0;
|
|
24646
|
+
swiper.updateActiveIndex();
|
|
24647
|
+
swiper.updateSlidesClasses();
|
|
24648
|
+
let newProgress;
|
|
24649
|
+
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
|
|
24650
|
+
|
|
24651
|
+
if (translatesDiff === 0) {
|
|
24652
|
+
newProgress = 0;
|
|
24653
|
+
} else {
|
|
24654
|
+
newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
|
|
24655
|
+
}
|
|
24656
|
+
|
|
24657
|
+
if (newProgress !== swiper.progress) {
|
|
24658
|
+
swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
|
|
24659
|
+
}
|
|
24660
|
+
|
|
24661
|
+
swiper.emit('setTranslate', swiper.translate, false);
|
|
24662
|
+
}
|
|
24663
|
+
|
|
24664
|
+
let dummyEventAttached = false;
|
|
24665
|
+
|
|
24666
|
+
function dummyEventListener() {}
|
|
24667
|
+
|
|
24668
|
+
const events = (swiper, method) => {
|
|
24669
|
+
const document = ssrWindow.getDocument();
|
|
24670
|
+
const {
|
|
24671
|
+
params,
|
|
24672
|
+
touchEvents,
|
|
24673
|
+
el,
|
|
24674
|
+
wrapperEl,
|
|
24675
|
+
device,
|
|
24676
|
+
support
|
|
24677
|
+
} = swiper;
|
|
24678
|
+
const capture = !!params.nested;
|
|
24679
|
+
const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
|
|
24680
|
+
const swiperMethod = method; // Touch Events
|
|
24681
|
+
|
|
24682
|
+
if (!support.touch) {
|
|
24683
|
+
el[domMethod](touchEvents.start, swiper.onTouchStart, false);
|
|
24684
|
+
document[domMethod](touchEvents.move, swiper.onTouchMove, capture);
|
|
24685
|
+
document[domMethod](touchEvents.end, swiper.onTouchEnd, false);
|
|
24686
|
+
} else {
|
|
24687
|
+
const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
|
|
24688
|
+
passive: true,
|
|
24689
|
+
capture: false
|
|
24690
|
+
} : false;
|
|
24691
|
+
el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener);
|
|
24692
|
+
el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
|
|
24693
|
+
passive: false,
|
|
24694
|
+
capture
|
|
24695
|
+
} : capture);
|
|
24696
|
+
el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener);
|
|
24697
|
+
|
|
24698
|
+
if (touchEvents.cancel) {
|
|
24699
|
+
el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener);
|
|
24700
|
+
}
|
|
24701
|
+
} // Prevent Links Clicks
|
|
24702
|
+
|
|
24703
|
+
|
|
24704
|
+
if (params.preventClicks || params.preventClicksPropagation) {
|
|
24705
|
+
el[domMethod]('click', swiper.onClick, true);
|
|
24706
|
+
}
|
|
24707
|
+
|
|
24708
|
+
if (params.cssMode) {
|
|
24709
|
+
wrapperEl[domMethod]('scroll', swiper.onScroll);
|
|
24710
|
+
} // Resize handler
|
|
24711
|
+
|
|
24712
|
+
|
|
24713
|
+
if (params.updateOnWindowResize) {
|
|
24714
|
+
swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
|
|
24715
|
+
} else {
|
|
24716
|
+
swiper[swiperMethod]('observerUpdate', onResize, true);
|
|
24717
|
+
}
|
|
24718
|
+
};
|
|
24719
|
+
|
|
24720
|
+
function attachEvents() {
|
|
24721
|
+
const swiper = this;
|
|
24722
|
+
const document = ssrWindow.getDocument();
|
|
24723
|
+
const {
|
|
24724
|
+
params,
|
|
24725
|
+
support
|
|
24726
|
+
} = swiper;
|
|
24727
|
+
swiper.onTouchStart = onTouchStart.bind(swiper);
|
|
24728
|
+
swiper.onTouchMove = onTouchMove.bind(swiper);
|
|
24729
|
+
swiper.onTouchEnd = onTouchEnd.bind(swiper);
|
|
24730
|
+
|
|
24731
|
+
if (params.cssMode) {
|
|
24732
|
+
swiper.onScroll = onScroll.bind(swiper);
|
|
24733
|
+
}
|
|
24734
|
+
|
|
24735
|
+
swiper.onClick = onClick.bind(swiper);
|
|
24736
|
+
|
|
24737
|
+
if (support.touch && !dummyEventAttached) {
|
|
24738
|
+
document.addEventListener('touchstart', dummyEventListener);
|
|
24739
|
+
dummyEventAttached = true;
|
|
24740
|
+
}
|
|
24741
|
+
|
|
24742
|
+
events(swiper, 'on');
|
|
24743
|
+
}
|
|
24744
|
+
|
|
24745
|
+
function detachEvents() {
|
|
24746
|
+
const swiper = this;
|
|
24747
|
+
events(swiper, 'off');
|
|
24748
|
+
}
|
|
24749
|
+
|
|
24750
|
+
var events$1 = {
|
|
24751
|
+
attachEvents,
|
|
24752
|
+
detachEvents
|
|
24753
|
+
};
|
|
24754
|
+
|
|
24755
|
+
const isGridEnabled = (swiper, params) => {
|
|
24756
|
+
return swiper.grid && params.grid && params.grid.rows > 1;
|
|
24757
|
+
};
|
|
24758
|
+
|
|
24759
|
+
function setBreakpoint() {
|
|
24760
|
+
const swiper = this;
|
|
24761
|
+
const {
|
|
24762
|
+
activeIndex,
|
|
24763
|
+
initialized,
|
|
24764
|
+
loopedSlides = 0,
|
|
24765
|
+
params,
|
|
24766
|
+
$el
|
|
24767
|
+
} = swiper;
|
|
24768
|
+
const breakpoints = params.breakpoints;
|
|
24769
|
+
if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters
|
|
24770
|
+
|
|
24771
|
+
const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
|
|
24772
|
+
if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
|
|
24773
|
+
const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
|
|
24774
|
+
const breakpointParams = breakpointOnlyParams || swiper.originalParams;
|
|
24775
|
+
const wasMultiRow = isGridEnabled(swiper, params);
|
|
24776
|
+
const isMultiRow = isGridEnabled(swiper, breakpointParams);
|
|
24777
|
+
const wasEnabled = params.enabled;
|
|
24778
|
+
|
|
24779
|
+
if (wasMultiRow && !isMultiRow) {
|
|
24780
|
+
$el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`);
|
|
24781
|
+
swiper.emitContainerClasses();
|
|
24782
|
+
} else if (!wasMultiRow && isMultiRow) {
|
|
24783
|
+
$el.addClass(`${params.containerModifierClass}grid`);
|
|
24784
|
+
|
|
24785
|
+
if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
|
|
24786
|
+
$el.addClass(`${params.containerModifierClass}grid-column`);
|
|
24787
|
+
}
|
|
24788
|
+
|
|
24789
|
+
swiper.emitContainerClasses();
|
|
24790
|
+
} // Toggle navigation, pagination, scrollbar
|
|
24791
|
+
|
|
24792
|
+
|
|
24793
|
+
['navigation', 'pagination', 'scrollbar'].forEach(prop => {
|
|
24794
|
+
const wasModuleEnabled = params[prop] && params[prop].enabled;
|
|
24795
|
+
const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
|
|
24796
|
+
|
|
24797
|
+
if (wasModuleEnabled && !isModuleEnabled) {
|
|
24798
|
+
swiper[prop].disable();
|
|
24799
|
+
}
|
|
24800
|
+
|
|
24801
|
+
if (!wasModuleEnabled && isModuleEnabled) {
|
|
24802
|
+
swiper[prop].enable();
|
|
24803
|
+
}
|
|
24804
|
+
});
|
|
24805
|
+
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
|
24806
|
+
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
|
24807
|
+
|
|
24808
|
+
if (directionChanged && initialized) {
|
|
24809
|
+
swiper.changeDirection();
|
|
24810
|
+
}
|
|
24811
|
+
|
|
24812
|
+
extend(swiper.params, breakpointParams);
|
|
24813
|
+
const isEnabled = swiper.params.enabled;
|
|
24814
|
+
Object.assign(swiper, {
|
|
24815
|
+
allowTouchMove: swiper.params.allowTouchMove,
|
|
24816
|
+
allowSlideNext: swiper.params.allowSlideNext,
|
|
24817
|
+
allowSlidePrev: swiper.params.allowSlidePrev
|
|
24818
|
+
});
|
|
24819
|
+
|
|
24820
|
+
if (wasEnabled && !isEnabled) {
|
|
24821
|
+
swiper.disable();
|
|
24822
|
+
} else if (!wasEnabled && isEnabled) {
|
|
24823
|
+
swiper.enable();
|
|
24824
|
+
}
|
|
24825
|
+
|
|
24826
|
+
swiper.currentBreakpoint = breakpoint;
|
|
24827
|
+
swiper.emit('_beforeBreakpoint', breakpointParams);
|
|
24828
|
+
|
|
24829
|
+
if (needsReLoop && initialized) {
|
|
24830
|
+
swiper.loopDestroy();
|
|
24831
|
+
swiper.loopCreate();
|
|
24832
|
+
swiper.updateSlides();
|
|
24833
|
+
swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);
|
|
24834
|
+
}
|
|
24835
|
+
|
|
24836
|
+
swiper.emit('breakpoint', breakpointParams);
|
|
24837
|
+
}
|
|
24838
|
+
|
|
24839
|
+
function getBreakpoint(breakpoints, base = 'window', containerEl) {
|
|
24840
|
+
if (!breakpoints || base === 'container' && !containerEl) return undefined;
|
|
24841
|
+
let breakpoint = false;
|
|
24842
|
+
const window = ssrWindow.getWindow();
|
|
24843
|
+
const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
|
|
24844
|
+
const points = Object.keys(breakpoints).map(point => {
|
|
24845
|
+
if (typeof point === 'string' && point.indexOf('@') === 0) {
|
|
24846
|
+
const minRatio = parseFloat(point.substr(1));
|
|
24847
|
+
const value = currentHeight * minRatio;
|
|
24848
|
+
return {
|
|
24849
|
+
value,
|
|
24850
|
+
point
|
|
24851
|
+
};
|
|
24852
|
+
}
|
|
24853
|
+
|
|
24854
|
+
return {
|
|
24855
|
+
value: point,
|
|
24856
|
+
point
|
|
24857
|
+
};
|
|
24858
|
+
});
|
|
24859
|
+
points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
|
|
24860
|
+
|
|
24861
|
+
for (let i = 0; i < points.length; i += 1) {
|
|
24862
|
+
const {
|
|
24863
|
+
point,
|
|
24864
|
+
value
|
|
24865
|
+
} = points[i];
|
|
24866
|
+
|
|
24867
|
+
if (base === 'window') {
|
|
24868
|
+
if (window.matchMedia(`(min-width: ${value}px)`).matches) {
|
|
24869
|
+
breakpoint = point;
|
|
24870
|
+
}
|
|
24871
|
+
} else if (value <= containerEl.clientWidth) {
|
|
24872
|
+
breakpoint = point;
|
|
24873
|
+
}
|
|
24874
|
+
}
|
|
24875
|
+
|
|
24876
|
+
return breakpoint || 'max';
|
|
24877
|
+
}
|
|
24878
|
+
|
|
24879
|
+
var breakpoints = {
|
|
24880
|
+
setBreakpoint,
|
|
24881
|
+
getBreakpoint
|
|
24882
|
+
};
|
|
24883
|
+
|
|
24884
|
+
function prepareClasses(entries, prefix) {
|
|
24885
|
+
const resultClasses = [];
|
|
24886
|
+
entries.forEach(item => {
|
|
24887
|
+
if (typeof item === 'object') {
|
|
24888
|
+
Object.keys(item).forEach(classNames => {
|
|
24889
|
+
if (item[classNames]) {
|
|
24890
|
+
resultClasses.push(prefix + classNames);
|
|
24891
|
+
}
|
|
24892
|
+
});
|
|
24893
|
+
} else if (typeof item === 'string') {
|
|
24894
|
+
resultClasses.push(prefix + item);
|
|
24895
|
+
}
|
|
24896
|
+
});
|
|
24897
|
+
return resultClasses;
|
|
24898
|
+
}
|
|
24899
|
+
|
|
24900
|
+
function addClasses() {
|
|
24901
|
+
const swiper = this;
|
|
24902
|
+
const {
|
|
24903
|
+
classNames,
|
|
24904
|
+
params,
|
|
24905
|
+
rtl,
|
|
24906
|
+
$el,
|
|
24907
|
+
device,
|
|
24908
|
+
support
|
|
24909
|
+
} = swiper; // prettier-ignore
|
|
24910
|
+
|
|
24911
|
+
const suffixes = prepareClasses(['initialized', params.direction, {
|
|
24912
|
+
'pointer-events': !support.touch
|
|
24913
|
+
}, {
|
|
24914
|
+
'free-mode': swiper.params.freeMode && params.freeMode.enabled
|
|
24915
|
+
}, {
|
|
24916
|
+
'autoheight': params.autoHeight
|
|
24917
|
+
}, {
|
|
24918
|
+
'rtl': rtl
|
|
24919
|
+
}, {
|
|
24920
|
+
'grid': params.grid && params.grid.rows > 1
|
|
24921
|
+
}, {
|
|
24922
|
+
'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
|
|
24923
|
+
}, {
|
|
24924
|
+
'android': device.android
|
|
24925
|
+
}, {
|
|
24926
|
+
'ios': device.ios
|
|
24927
|
+
}, {
|
|
24928
|
+
'css-mode': params.cssMode
|
|
24929
|
+
}, {
|
|
24930
|
+
'centered': params.cssMode && params.centeredSlides
|
|
24931
|
+
}, {
|
|
24932
|
+
'watch-progress': params.watchSlidesProgress
|
|
24933
|
+
}], params.containerModifierClass);
|
|
24934
|
+
classNames.push(...suffixes);
|
|
24935
|
+
$el.addClass([...classNames].join(' '));
|
|
24936
|
+
swiper.emitContainerClasses();
|
|
24937
|
+
}
|
|
24938
|
+
|
|
24939
|
+
function removeClasses() {
|
|
24940
|
+
const swiper = this;
|
|
24941
|
+
const {
|
|
24942
|
+
$el,
|
|
24943
|
+
classNames
|
|
24944
|
+
} = swiper;
|
|
24945
|
+
$el.removeClass(classNames.join(' '));
|
|
24946
|
+
swiper.emitContainerClasses();
|
|
24947
|
+
}
|
|
24948
|
+
|
|
24949
|
+
var classes = {
|
|
24950
|
+
addClasses,
|
|
24951
|
+
removeClasses
|
|
24952
|
+
};
|
|
24953
|
+
|
|
24954
|
+
function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {
|
|
24955
|
+
const window = ssrWindow.getWindow();
|
|
24956
|
+
let image;
|
|
24957
|
+
|
|
24958
|
+
function onReady() {
|
|
24959
|
+
if (callback) callback();
|
|
24960
|
+
}
|
|
24961
|
+
|
|
24962
|
+
const isPicture = dom7.$(imageEl).parent('picture')[0];
|
|
24963
|
+
|
|
24964
|
+
if (!isPicture && (!imageEl.complete || !checkForComplete)) {
|
|
24965
|
+
if (src) {
|
|
24966
|
+
image = new window.Image();
|
|
24967
|
+
image.onload = onReady;
|
|
24968
|
+
image.onerror = onReady;
|
|
24969
|
+
|
|
24970
|
+
if (sizes) {
|
|
24971
|
+
image.sizes = sizes;
|
|
24972
|
+
}
|
|
24973
|
+
|
|
24974
|
+
if (srcset) {
|
|
24975
|
+
image.srcset = srcset;
|
|
24976
|
+
}
|
|
24977
|
+
|
|
24978
|
+
if (src) {
|
|
24979
|
+
image.src = src;
|
|
24980
|
+
}
|
|
24981
|
+
} else {
|
|
24982
|
+
onReady();
|
|
24983
|
+
}
|
|
24984
|
+
} else {
|
|
24985
|
+
// image already loaded...
|
|
24986
|
+
onReady();
|
|
24987
|
+
}
|
|
24988
|
+
}
|
|
24989
|
+
|
|
24990
|
+
function preloadImages() {
|
|
24991
|
+
const swiper = this;
|
|
24992
|
+
swiper.imagesToLoad = swiper.$el.find('img');
|
|
24993
|
+
|
|
24994
|
+
function onReady() {
|
|
24995
|
+
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;
|
|
24996
|
+
if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;
|
|
24997
|
+
|
|
24998
|
+
if (swiper.imagesLoaded === swiper.imagesToLoad.length) {
|
|
24999
|
+
if (swiper.params.updateOnImagesReady) swiper.update();
|
|
25000
|
+
swiper.emit('imagesReady');
|
|
25001
|
+
}
|
|
25002
|
+
}
|
|
25003
|
+
|
|
25004
|
+
for (let i = 0; i < swiper.imagesToLoad.length; i += 1) {
|
|
25005
|
+
const imageEl = swiper.imagesToLoad[i];
|
|
25006
|
+
swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);
|
|
25007
|
+
}
|
|
25008
|
+
}
|
|
25009
|
+
|
|
25010
|
+
var images = {
|
|
25011
|
+
loadImage,
|
|
25012
|
+
preloadImages
|
|
25013
|
+
};
|
|
25014
|
+
|
|
25015
|
+
function checkOverflow() {
|
|
25016
|
+
const swiper = this;
|
|
25017
|
+
const {
|
|
25018
|
+
isLocked: wasLocked,
|
|
25019
|
+
params
|
|
25020
|
+
} = swiper;
|
|
25021
|
+
const {
|
|
25022
|
+
slidesOffsetBefore
|
|
25023
|
+
} = params;
|
|
25024
|
+
|
|
25025
|
+
if (slidesOffsetBefore) {
|
|
25026
|
+
const lastSlideIndex = swiper.slides.length - 1;
|
|
25027
|
+
const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
|
|
25028
|
+
swiper.isLocked = swiper.size > lastSlideRightEdge;
|
|
25029
|
+
} else {
|
|
25030
|
+
swiper.isLocked = swiper.snapGrid.length === 1;
|
|
25031
|
+
}
|
|
25032
|
+
|
|
25033
|
+
if (params.allowSlideNext === true) {
|
|
25034
|
+
swiper.allowSlideNext = !swiper.isLocked;
|
|
25035
|
+
}
|
|
25036
|
+
|
|
25037
|
+
if (params.allowSlidePrev === true) {
|
|
25038
|
+
swiper.allowSlidePrev = !swiper.isLocked;
|
|
25039
|
+
}
|
|
25040
|
+
|
|
25041
|
+
if (wasLocked && wasLocked !== swiper.isLocked) {
|
|
25042
|
+
swiper.isEnd = false;
|
|
25043
|
+
}
|
|
25044
|
+
|
|
25045
|
+
if (wasLocked !== swiper.isLocked) {
|
|
25046
|
+
swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
|
|
25047
|
+
}
|
|
25048
|
+
}
|
|
25049
|
+
|
|
25050
|
+
var checkOverflow$1 = {
|
|
25051
|
+
checkOverflow
|
|
25052
|
+
};
|
|
25053
|
+
|
|
25054
|
+
var defaults = {
|
|
25055
|
+
init: true,
|
|
25056
|
+
direction: 'horizontal',
|
|
25057
|
+
touchEventsTarget: 'wrapper',
|
|
25058
|
+
initialSlide: 0,
|
|
25059
|
+
speed: 300,
|
|
25060
|
+
cssMode: false,
|
|
25061
|
+
updateOnWindowResize: true,
|
|
25062
|
+
resizeObserver: true,
|
|
25063
|
+
nested: false,
|
|
25064
|
+
createElements: false,
|
|
25065
|
+
enabled: true,
|
|
25066
|
+
focusableElements: 'input, select, option, textarea, button, video, label',
|
|
25067
|
+
// Overrides
|
|
25068
|
+
width: null,
|
|
25069
|
+
height: null,
|
|
25070
|
+
//
|
|
25071
|
+
preventInteractionOnTransition: false,
|
|
25072
|
+
// ssr
|
|
25073
|
+
userAgent: null,
|
|
25074
|
+
url: null,
|
|
25075
|
+
// To support iOS's swipe-to-go-back gesture (when being used in-app).
|
|
25076
|
+
edgeSwipeDetection: false,
|
|
25077
|
+
edgeSwipeThreshold: 20,
|
|
25078
|
+
// Autoheight
|
|
25079
|
+
autoHeight: false,
|
|
25080
|
+
// Set wrapper width
|
|
25081
|
+
setWrapperSize: false,
|
|
25082
|
+
// Virtual Translate
|
|
25083
|
+
virtualTranslate: false,
|
|
25084
|
+
// Effects
|
|
25085
|
+
effect: 'slide',
|
|
25086
|
+
// 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
|
|
25087
|
+
// Breakpoints
|
|
25088
|
+
breakpoints: undefined,
|
|
25089
|
+
breakpointsBase: 'window',
|
|
25090
|
+
// Slides grid
|
|
25091
|
+
spaceBetween: 0,
|
|
25092
|
+
slidesPerView: 1,
|
|
25093
|
+
slidesPerGroup: 1,
|
|
25094
|
+
slidesPerGroupSkip: 0,
|
|
25095
|
+
slidesPerGroupAuto: false,
|
|
25096
|
+
centeredSlides: false,
|
|
25097
|
+
centeredSlidesBounds: false,
|
|
25098
|
+
slidesOffsetBefore: 0,
|
|
25099
|
+
// in px
|
|
25100
|
+
slidesOffsetAfter: 0,
|
|
25101
|
+
// in px
|
|
25102
|
+
normalizeSlideIndex: true,
|
|
25103
|
+
centerInsufficientSlides: false,
|
|
25104
|
+
// Disable swiper and hide navigation when container not overflow
|
|
25105
|
+
watchOverflow: true,
|
|
25106
|
+
// Round length
|
|
25107
|
+
roundLengths: false,
|
|
25108
|
+
// Touches
|
|
25109
|
+
touchRatio: 1,
|
|
25110
|
+
touchAngle: 45,
|
|
25111
|
+
simulateTouch: true,
|
|
25112
|
+
shortSwipes: true,
|
|
25113
|
+
longSwipes: true,
|
|
25114
|
+
longSwipesRatio: 0.5,
|
|
25115
|
+
longSwipesMs: 300,
|
|
25116
|
+
followFinger: true,
|
|
25117
|
+
allowTouchMove: true,
|
|
25118
|
+
threshold: 0,
|
|
25119
|
+
touchMoveStopPropagation: false,
|
|
25120
|
+
touchStartPreventDefault: true,
|
|
25121
|
+
touchStartForcePreventDefault: false,
|
|
25122
|
+
touchReleaseOnEdges: false,
|
|
25123
|
+
// Unique Navigation Elements
|
|
25124
|
+
uniqueNavElements: true,
|
|
25125
|
+
// Resistance
|
|
25126
|
+
resistance: true,
|
|
25127
|
+
resistanceRatio: 0.85,
|
|
25128
|
+
// Progress
|
|
25129
|
+
watchSlidesProgress: false,
|
|
25130
|
+
// Cursor
|
|
25131
|
+
grabCursor: false,
|
|
25132
|
+
// Clicks
|
|
25133
|
+
preventClicks: true,
|
|
25134
|
+
preventClicksPropagation: true,
|
|
25135
|
+
slideToClickedSlide: false,
|
|
25136
|
+
// Images
|
|
25137
|
+
preloadImages: true,
|
|
25138
|
+
updateOnImagesReady: true,
|
|
25139
|
+
// loop
|
|
25140
|
+
loop: false,
|
|
25141
|
+
loopAdditionalSlides: 0,
|
|
25142
|
+
loopedSlides: null,
|
|
25143
|
+
loopedSlidesLimit: true,
|
|
25144
|
+
loopFillGroupWithBlank: false,
|
|
25145
|
+
loopPreventsSlide: true,
|
|
25146
|
+
// rewind
|
|
25147
|
+
rewind: false,
|
|
25148
|
+
// Swiping/no swiping
|
|
25149
|
+
allowSlidePrev: true,
|
|
25150
|
+
allowSlideNext: true,
|
|
25151
|
+
swipeHandler: null,
|
|
25152
|
+
// '.swipe-handler',
|
|
25153
|
+
noSwiping: true,
|
|
25154
|
+
noSwipingClass: 'swiper-no-swiping',
|
|
25155
|
+
noSwipingSelector: null,
|
|
25156
|
+
// Passive Listeners
|
|
25157
|
+
passiveListeners: true,
|
|
25158
|
+
maxBackfaceHiddenSlides: 10,
|
|
25159
|
+
// NS
|
|
25160
|
+
containerModifierClass: 'swiper-',
|
|
25161
|
+
// NEW
|
|
25162
|
+
slideClass: 'swiper-slide',
|
|
25163
|
+
slideBlankClass: 'swiper-slide-invisible-blank',
|
|
25164
|
+
slideActiveClass: 'swiper-slide-active',
|
|
25165
|
+
slideDuplicateActiveClass: 'swiper-slide-duplicate-active',
|
|
25166
|
+
slideVisibleClass: 'swiper-slide-visible',
|
|
25167
|
+
slideDuplicateClass: 'swiper-slide-duplicate',
|
|
25168
|
+
slideNextClass: 'swiper-slide-next',
|
|
25169
|
+
slideDuplicateNextClass: 'swiper-slide-duplicate-next',
|
|
25170
|
+
slidePrevClass: 'swiper-slide-prev',
|
|
25171
|
+
slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',
|
|
25172
|
+
wrapperClass: 'swiper-wrapper',
|
|
25173
|
+
// Callbacks
|
|
25174
|
+
runCallbacksOnInit: true,
|
|
25175
|
+
// Internals
|
|
25176
|
+
_emitClasses: false
|
|
25177
|
+
};
|
|
25178
|
+
|
|
25179
|
+
function moduleExtendParams(params, allModulesParams) {
|
|
25180
|
+
return function extendParams(obj = {}) {
|
|
25181
|
+
const moduleParamName = Object.keys(obj)[0];
|
|
25182
|
+
const moduleParams = obj[moduleParamName];
|
|
25183
|
+
|
|
25184
|
+
if (typeof moduleParams !== 'object' || moduleParams === null) {
|
|
25185
|
+
extend(allModulesParams, obj);
|
|
25186
|
+
return;
|
|
25187
|
+
}
|
|
25188
|
+
|
|
25189
|
+
if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
|
|
25190
|
+
params[moduleParamName] = {
|
|
25191
|
+
auto: true
|
|
25192
|
+
};
|
|
25193
|
+
}
|
|
25194
|
+
|
|
25195
|
+
if (!(moduleParamName in params && 'enabled' in moduleParams)) {
|
|
25196
|
+
extend(allModulesParams, obj);
|
|
25197
|
+
return;
|
|
25198
|
+
}
|
|
25199
|
+
|
|
25200
|
+
if (params[moduleParamName] === true) {
|
|
25201
|
+
params[moduleParamName] = {
|
|
25202
|
+
enabled: true
|
|
25203
|
+
};
|
|
25204
|
+
}
|
|
25205
|
+
|
|
25206
|
+
if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
|
|
25207
|
+
params[moduleParamName].enabled = true;
|
|
25208
|
+
}
|
|
25209
|
+
|
|
25210
|
+
if (!params[moduleParamName]) params[moduleParamName] = {
|
|
25211
|
+
enabled: false
|
|
25212
|
+
};
|
|
25213
|
+
extend(allModulesParams, obj);
|
|
25214
|
+
};
|
|
25215
|
+
}
|
|
25216
|
+
|
|
25217
|
+
/* eslint no-param-reassign: "off" */
|
|
25218
|
+
const prototypes = {
|
|
25219
|
+
eventsEmitter,
|
|
25220
|
+
update,
|
|
25221
|
+
translate,
|
|
25222
|
+
transition,
|
|
25223
|
+
slide,
|
|
25224
|
+
loop,
|
|
25225
|
+
grabCursor,
|
|
25226
|
+
events: events$1,
|
|
25227
|
+
breakpoints,
|
|
25228
|
+
checkOverflow: checkOverflow$1,
|
|
25229
|
+
classes,
|
|
25230
|
+
images
|
|
25231
|
+
};
|
|
25232
|
+
const extendedDefaults = {};
|
|
25233
|
+
|
|
25234
|
+
class Swiper {
|
|
25235
|
+
constructor(...args) {
|
|
25236
|
+
let el;
|
|
25237
|
+
let params;
|
|
25238
|
+
|
|
25239
|
+
if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
|
|
25240
|
+
params = args[0];
|
|
25241
|
+
} else {
|
|
25242
|
+
[el, params] = args;
|
|
25243
|
+
}
|
|
25244
|
+
|
|
25245
|
+
if (!params) params = {};
|
|
25246
|
+
params = extend({}, params);
|
|
25247
|
+
if (el && !params.el) params.el = el;
|
|
25248
|
+
|
|
25249
|
+
if (params.el && dom7.$(params.el).length > 1) {
|
|
25250
|
+
const swipers = [];
|
|
25251
|
+
dom7.$(params.el).each(containerEl => {
|
|
25252
|
+
const newParams = extend({}, params, {
|
|
25253
|
+
el: containerEl
|
|
25254
|
+
});
|
|
25255
|
+
swipers.push(new Swiper(newParams));
|
|
25256
|
+
}); // eslint-disable-next-line no-constructor-return
|
|
25257
|
+
|
|
25258
|
+
return swipers;
|
|
25259
|
+
} // Swiper Instance
|
|
25260
|
+
|
|
25261
|
+
|
|
25262
|
+
const swiper = this;
|
|
25263
|
+
swiper.__swiper__ = true;
|
|
25264
|
+
swiper.support = getSupport();
|
|
25265
|
+
swiper.device = getDevice({
|
|
25266
|
+
userAgent: params.userAgent
|
|
25267
|
+
});
|
|
25268
|
+
swiper.browser = getBrowser();
|
|
25269
|
+
swiper.eventsListeners = {};
|
|
25270
|
+
swiper.eventsAnyListeners = [];
|
|
25271
|
+
swiper.modules = [...swiper.__modules__];
|
|
25272
|
+
|
|
25273
|
+
if (params.modules && Array.isArray(params.modules)) {
|
|
25274
|
+
swiper.modules.push(...params.modules);
|
|
25275
|
+
}
|
|
25276
|
+
|
|
25277
|
+
const allModulesParams = {};
|
|
25278
|
+
swiper.modules.forEach(mod => {
|
|
25279
|
+
mod({
|
|
25280
|
+
swiper,
|
|
25281
|
+
extendParams: moduleExtendParams(params, allModulesParams),
|
|
25282
|
+
on: swiper.on.bind(swiper),
|
|
25283
|
+
once: swiper.once.bind(swiper),
|
|
25284
|
+
off: swiper.off.bind(swiper),
|
|
25285
|
+
emit: swiper.emit.bind(swiper)
|
|
25286
|
+
});
|
|
25287
|
+
}); // Extend defaults with modules params
|
|
25288
|
+
|
|
25289
|
+
const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params
|
|
25290
|
+
|
|
25291
|
+
swiper.params = extend({}, swiperParams, extendedDefaults, params);
|
|
25292
|
+
swiper.originalParams = extend({}, swiper.params);
|
|
25293
|
+
swiper.passedParams = extend({}, params); // add event listeners
|
|
25294
|
+
|
|
25295
|
+
if (swiper.params && swiper.params.on) {
|
|
25296
|
+
Object.keys(swiper.params.on).forEach(eventName => {
|
|
25297
|
+
swiper.on(eventName, swiper.params.on[eventName]);
|
|
25298
|
+
});
|
|
25299
|
+
}
|
|
25300
|
+
|
|
25301
|
+
if (swiper.params && swiper.params.onAny) {
|
|
25302
|
+
swiper.onAny(swiper.params.onAny);
|
|
25303
|
+
} // Save Dom lib
|
|
25304
|
+
|
|
25305
|
+
|
|
25306
|
+
swiper.$ = dom7.$; // Extend Swiper
|
|
25307
|
+
|
|
25308
|
+
Object.assign(swiper, {
|
|
25309
|
+
enabled: swiper.params.enabled,
|
|
25310
|
+
el,
|
|
25311
|
+
// Classes
|
|
25312
|
+
classNames: [],
|
|
25313
|
+
// Slides
|
|
25314
|
+
slides: dom7.$(),
|
|
25315
|
+
slidesGrid: [],
|
|
25316
|
+
snapGrid: [],
|
|
25317
|
+
slidesSizesGrid: [],
|
|
25318
|
+
|
|
25319
|
+
// isDirection
|
|
25320
|
+
isHorizontal() {
|
|
25321
|
+
return swiper.params.direction === 'horizontal';
|
|
25322
|
+
},
|
|
25323
|
+
|
|
25324
|
+
isVertical() {
|
|
25325
|
+
return swiper.params.direction === 'vertical';
|
|
25326
|
+
},
|
|
25327
|
+
|
|
25328
|
+
// Indexes
|
|
25329
|
+
activeIndex: 0,
|
|
25330
|
+
realIndex: 0,
|
|
25331
|
+
//
|
|
25332
|
+
isBeginning: true,
|
|
25333
|
+
isEnd: false,
|
|
25334
|
+
// Props
|
|
25335
|
+
translate: 0,
|
|
25336
|
+
previousTranslate: 0,
|
|
25337
|
+
progress: 0,
|
|
25338
|
+
velocity: 0,
|
|
25339
|
+
animating: false,
|
|
25340
|
+
// Locks
|
|
25341
|
+
allowSlideNext: swiper.params.allowSlideNext,
|
|
25342
|
+
allowSlidePrev: swiper.params.allowSlidePrev,
|
|
25343
|
+
// Touch Events
|
|
25344
|
+
touchEvents: function touchEvents() {
|
|
25345
|
+
const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
|
|
25346
|
+
const desktop = ['pointerdown', 'pointermove', 'pointerup'];
|
|
25347
|
+
swiper.touchEventsTouch = {
|
|
25348
|
+
start: touch[0],
|
|
25349
|
+
move: touch[1],
|
|
25350
|
+
end: touch[2],
|
|
25351
|
+
cancel: touch[3]
|
|
25352
|
+
};
|
|
25353
|
+
swiper.touchEventsDesktop = {
|
|
25354
|
+
start: desktop[0],
|
|
25355
|
+
move: desktop[1],
|
|
25356
|
+
end: desktop[2]
|
|
25357
|
+
};
|
|
25358
|
+
return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;
|
|
25359
|
+
}(),
|
|
25360
|
+
touchEventsData: {
|
|
25361
|
+
isTouched: undefined,
|
|
25362
|
+
isMoved: undefined,
|
|
25363
|
+
allowTouchCallbacks: undefined,
|
|
25364
|
+
touchStartTime: undefined,
|
|
25365
|
+
isScrolling: undefined,
|
|
25366
|
+
currentTranslate: undefined,
|
|
25367
|
+
startTranslate: undefined,
|
|
25368
|
+
allowThresholdMove: undefined,
|
|
25369
|
+
// Form elements to match
|
|
25370
|
+
focusableElements: swiper.params.focusableElements,
|
|
25371
|
+
// Last click time
|
|
25372
|
+
lastClickTime: now(),
|
|
25373
|
+
clickTimeout: undefined,
|
|
25374
|
+
// Velocities
|
|
25375
|
+
velocities: [],
|
|
25376
|
+
allowMomentumBounce: undefined,
|
|
25377
|
+
isTouchEvent: undefined,
|
|
25378
|
+
startMoving: undefined
|
|
25379
|
+
},
|
|
25380
|
+
// Clicks
|
|
25381
|
+
allowClick: true,
|
|
25382
|
+
// Touches
|
|
25383
|
+
allowTouchMove: swiper.params.allowTouchMove,
|
|
25384
|
+
touches: {
|
|
25385
|
+
startX: 0,
|
|
25386
|
+
startY: 0,
|
|
25387
|
+
currentX: 0,
|
|
25388
|
+
currentY: 0,
|
|
25389
|
+
diff: 0
|
|
25390
|
+
},
|
|
25391
|
+
// Images
|
|
25392
|
+
imagesToLoad: [],
|
|
25393
|
+
imagesLoaded: 0
|
|
25394
|
+
});
|
|
25395
|
+
swiper.emit('_swiper'); // Init
|
|
25396
|
+
|
|
25397
|
+
if (swiper.params.init) {
|
|
25398
|
+
swiper.init();
|
|
25399
|
+
} // Return app instance
|
|
25400
|
+
// eslint-disable-next-line no-constructor-return
|
|
25401
|
+
|
|
25402
|
+
|
|
25403
|
+
return swiper;
|
|
25404
|
+
}
|
|
25405
|
+
|
|
25406
|
+
enable() {
|
|
25407
|
+
const swiper = this;
|
|
25408
|
+
if (swiper.enabled) return;
|
|
25409
|
+
swiper.enabled = true;
|
|
25410
|
+
|
|
25411
|
+
if (swiper.params.grabCursor) {
|
|
25412
|
+
swiper.setGrabCursor();
|
|
25413
|
+
}
|
|
25414
|
+
|
|
25415
|
+
swiper.emit('enable');
|
|
25416
|
+
}
|
|
25417
|
+
|
|
25418
|
+
disable() {
|
|
25419
|
+
const swiper = this;
|
|
25420
|
+
if (!swiper.enabled) return;
|
|
25421
|
+
swiper.enabled = false;
|
|
25422
|
+
|
|
25423
|
+
if (swiper.params.grabCursor) {
|
|
25424
|
+
swiper.unsetGrabCursor();
|
|
25425
|
+
}
|
|
25426
|
+
|
|
25427
|
+
swiper.emit('disable');
|
|
25428
|
+
}
|
|
25429
|
+
|
|
25430
|
+
setProgress(progress, speed) {
|
|
25431
|
+
const swiper = this;
|
|
25432
|
+
progress = Math.min(Math.max(progress, 0), 1);
|
|
25433
|
+
const min = swiper.minTranslate();
|
|
25434
|
+
const max = swiper.maxTranslate();
|
|
25435
|
+
const current = (max - min) * progress + min;
|
|
25436
|
+
swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
|
|
25437
|
+
swiper.updateActiveIndex();
|
|
25438
|
+
swiper.updateSlidesClasses();
|
|
25439
|
+
}
|
|
25440
|
+
|
|
25441
|
+
emitContainerClasses() {
|
|
25442
|
+
const swiper = this;
|
|
25443
|
+
if (!swiper.params._emitClasses || !swiper.el) return;
|
|
25444
|
+
const cls = swiper.el.className.split(' ').filter(className => {
|
|
25445
|
+
return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
|
|
25446
|
+
});
|
|
25447
|
+
swiper.emit('_containerClasses', cls.join(' '));
|
|
25448
|
+
}
|
|
25449
|
+
|
|
25450
|
+
getSlideClasses(slideEl) {
|
|
25451
|
+
const swiper = this;
|
|
25452
|
+
if (swiper.destroyed) return '';
|
|
25453
|
+
return slideEl.className.split(' ').filter(className => {
|
|
25454
|
+
return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
|
|
25455
|
+
}).join(' ');
|
|
25456
|
+
}
|
|
25457
|
+
|
|
25458
|
+
emitSlidesClasses() {
|
|
25459
|
+
const swiper = this;
|
|
25460
|
+
if (!swiper.params._emitClasses || !swiper.el) return;
|
|
25461
|
+
const updates = [];
|
|
25462
|
+
swiper.slides.each(slideEl => {
|
|
25463
|
+
const classNames = swiper.getSlideClasses(slideEl);
|
|
25464
|
+
updates.push({
|
|
25465
|
+
slideEl,
|
|
25466
|
+
classNames
|
|
25467
|
+
});
|
|
25468
|
+
swiper.emit('_slideClass', slideEl, classNames);
|
|
25469
|
+
});
|
|
25470
|
+
swiper.emit('_slideClasses', updates);
|
|
25471
|
+
}
|
|
25472
|
+
|
|
25473
|
+
slidesPerViewDynamic(view = 'current', exact = false) {
|
|
25474
|
+
const swiper = this;
|
|
25475
|
+
const {
|
|
25476
|
+
params,
|
|
25477
|
+
slides,
|
|
25478
|
+
slidesGrid,
|
|
25479
|
+
slidesSizesGrid,
|
|
25480
|
+
size: swiperSize,
|
|
25481
|
+
activeIndex
|
|
25482
|
+
} = swiper;
|
|
25483
|
+
let spv = 1;
|
|
25484
|
+
|
|
25485
|
+
if (params.centeredSlides) {
|
|
25486
|
+
let slideSize = slides[activeIndex].swiperSlideSize;
|
|
25487
|
+
let breakLoop;
|
|
25488
|
+
|
|
25489
|
+
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
|
25490
|
+
if (slides[i] && !breakLoop) {
|
|
25491
|
+
slideSize += slides[i].swiperSlideSize;
|
|
25492
|
+
spv += 1;
|
|
25493
|
+
if (slideSize > swiperSize) breakLoop = true;
|
|
25494
|
+
}
|
|
25495
|
+
}
|
|
25496
|
+
|
|
25497
|
+
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
|
25498
|
+
if (slides[i] && !breakLoop) {
|
|
25499
|
+
slideSize += slides[i].swiperSlideSize;
|
|
25500
|
+
spv += 1;
|
|
25501
|
+
if (slideSize > swiperSize) breakLoop = true;
|
|
25502
|
+
}
|
|
25503
|
+
}
|
|
25504
|
+
} else {
|
|
25505
|
+
// eslint-disable-next-line
|
|
25506
|
+
if (view === 'current') {
|
|
25507
|
+
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
|
25508
|
+
const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
|
|
25509
|
+
|
|
25510
|
+
if (slideInView) {
|
|
25511
|
+
spv += 1;
|
|
25512
|
+
}
|
|
25513
|
+
}
|
|
25514
|
+
} else {
|
|
25515
|
+
// previous
|
|
25516
|
+
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
|
25517
|
+
const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
|
|
25518
|
+
|
|
25519
|
+
if (slideInView) {
|
|
25520
|
+
spv += 1;
|
|
25521
|
+
}
|
|
25522
|
+
}
|
|
25523
|
+
}
|
|
25524
|
+
}
|
|
25525
|
+
|
|
25526
|
+
return spv;
|
|
25527
|
+
}
|
|
25528
|
+
|
|
25529
|
+
update() {
|
|
25530
|
+
const swiper = this;
|
|
25531
|
+
if (!swiper || swiper.destroyed) return;
|
|
25532
|
+
const {
|
|
25533
|
+
snapGrid,
|
|
25534
|
+
params
|
|
25535
|
+
} = swiper; // Breakpoints
|
|
25536
|
+
|
|
25537
|
+
if (params.breakpoints) {
|
|
25538
|
+
swiper.setBreakpoint();
|
|
25539
|
+
}
|
|
25540
|
+
|
|
25541
|
+
swiper.updateSize();
|
|
25542
|
+
swiper.updateSlides();
|
|
25543
|
+
swiper.updateProgress();
|
|
25544
|
+
swiper.updateSlidesClasses();
|
|
25545
|
+
|
|
25546
|
+
function setTranslate() {
|
|
25547
|
+
const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
|
|
25548
|
+
const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
|
|
25549
|
+
swiper.setTranslate(newTranslate);
|
|
25550
|
+
swiper.updateActiveIndex();
|
|
25551
|
+
swiper.updateSlidesClasses();
|
|
25552
|
+
}
|
|
25553
|
+
|
|
25554
|
+
let translated;
|
|
25555
|
+
|
|
25556
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled) {
|
|
25557
|
+
setTranslate();
|
|
25558
|
+
|
|
25559
|
+
if (swiper.params.autoHeight) {
|
|
25560
|
+
swiper.updateAutoHeight();
|
|
25561
|
+
}
|
|
25562
|
+
} else {
|
|
25563
|
+
if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {
|
|
25564
|
+
translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
|
25565
|
+
} else {
|
|
25566
|
+
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
25567
|
+
}
|
|
25568
|
+
|
|
25569
|
+
if (!translated) {
|
|
25570
|
+
setTranslate();
|
|
25571
|
+
}
|
|
25572
|
+
}
|
|
25573
|
+
|
|
25574
|
+
if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
|
25575
|
+
swiper.checkOverflow();
|
|
25576
|
+
}
|
|
25577
|
+
|
|
25578
|
+
swiper.emit('update');
|
|
25579
|
+
}
|
|
25580
|
+
|
|
25581
|
+
changeDirection(newDirection, needUpdate = true) {
|
|
25582
|
+
const swiper = this;
|
|
25583
|
+
const currentDirection = swiper.params.direction;
|
|
25584
|
+
|
|
25585
|
+
if (!newDirection) {
|
|
25586
|
+
// eslint-disable-next-line
|
|
25587
|
+
newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
|
|
25588
|
+
}
|
|
25589
|
+
|
|
25590
|
+
if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
|
|
25591
|
+
return swiper;
|
|
25592
|
+
}
|
|
25593
|
+
|
|
25594
|
+
swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`);
|
|
25595
|
+
swiper.emitContainerClasses();
|
|
25596
|
+
swiper.params.direction = newDirection;
|
|
25597
|
+
swiper.slides.each(slideEl => {
|
|
25598
|
+
if (newDirection === 'vertical') {
|
|
25599
|
+
slideEl.style.width = '';
|
|
25600
|
+
} else {
|
|
25601
|
+
slideEl.style.height = '';
|
|
25602
|
+
}
|
|
25603
|
+
});
|
|
25604
|
+
swiper.emit('changeDirection');
|
|
25605
|
+
if (needUpdate) swiper.update();
|
|
25606
|
+
return swiper;
|
|
25607
|
+
}
|
|
25608
|
+
|
|
25609
|
+
changeLanguageDirection(direction) {
|
|
25610
|
+
const swiper = this;
|
|
25611
|
+
if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;
|
|
25612
|
+
swiper.rtl = direction === 'rtl';
|
|
25613
|
+
swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
|
|
25614
|
+
|
|
25615
|
+
if (swiper.rtl) {
|
|
25616
|
+
swiper.$el.addClass(`${swiper.params.containerModifierClass}rtl`);
|
|
25617
|
+
swiper.el.dir = 'rtl';
|
|
25618
|
+
} else {
|
|
25619
|
+
swiper.$el.removeClass(`${swiper.params.containerModifierClass}rtl`);
|
|
25620
|
+
swiper.el.dir = 'ltr';
|
|
25621
|
+
}
|
|
25622
|
+
|
|
25623
|
+
swiper.update();
|
|
25624
|
+
}
|
|
25625
|
+
|
|
25626
|
+
mount(el) {
|
|
25627
|
+
const swiper = this;
|
|
25628
|
+
if (swiper.mounted) return true; // Find el
|
|
25629
|
+
|
|
25630
|
+
const $el = dom7.$(el || swiper.params.el);
|
|
25631
|
+
el = $el[0];
|
|
25632
|
+
|
|
25633
|
+
if (!el) {
|
|
25634
|
+
return false;
|
|
25635
|
+
}
|
|
25636
|
+
|
|
25637
|
+
el.swiper = swiper;
|
|
25638
|
+
|
|
25639
|
+
const getWrapperSelector = () => {
|
|
25640
|
+
return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
|
|
25641
|
+
};
|
|
25642
|
+
|
|
25643
|
+
const getWrapper = () => {
|
|
25644
|
+
if (el && el.shadowRoot && el.shadowRoot.querySelector) {
|
|
25645
|
+
const res = dom7.$(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items
|
|
25646
|
+
|
|
25647
|
+
res.children = options => $el.children(options);
|
|
25648
|
+
|
|
25649
|
+
return res;
|
|
25650
|
+
}
|
|
25651
|
+
|
|
25652
|
+
if (!$el.children) {
|
|
25653
|
+
return dom7.$($el).children(getWrapperSelector());
|
|
25654
|
+
}
|
|
25655
|
+
|
|
25656
|
+
return $el.children(getWrapperSelector());
|
|
25657
|
+
}; // Find Wrapper
|
|
25658
|
+
|
|
25659
|
+
|
|
25660
|
+
let $wrapperEl = getWrapper();
|
|
25661
|
+
|
|
25662
|
+
if ($wrapperEl.length === 0 && swiper.params.createElements) {
|
|
25663
|
+
const document = ssrWindow.getDocument();
|
|
25664
|
+
const wrapper = document.createElement('div');
|
|
25665
|
+
$wrapperEl = dom7.$(wrapper);
|
|
25666
|
+
wrapper.className = swiper.params.wrapperClass;
|
|
25667
|
+
$el.append(wrapper);
|
|
25668
|
+
$el.children(`.${swiper.params.slideClass}`).each(slideEl => {
|
|
25669
|
+
$wrapperEl.append(slideEl);
|
|
25670
|
+
});
|
|
25671
|
+
}
|
|
25672
|
+
|
|
25673
|
+
Object.assign(swiper, {
|
|
25674
|
+
$el,
|
|
25675
|
+
el,
|
|
25676
|
+
$wrapperEl,
|
|
25677
|
+
wrapperEl: $wrapperEl[0],
|
|
25678
|
+
mounted: true,
|
|
25679
|
+
// RTL
|
|
25680
|
+
rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',
|
|
25681
|
+
rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),
|
|
25682
|
+
wrongRTL: $wrapperEl.css('display') === '-webkit-box'
|
|
25683
|
+
});
|
|
25684
|
+
return true;
|
|
25685
|
+
}
|
|
25686
|
+
|
|
25687
|
+
init(el) {
|
|
25688
|
+
const swiper = this;
|
|
25689
|
+
if (swiper.initialized) return swiper;
|
|
25690
|
+
const mounted = swiper.mount(el);
|
|
25691
|
+
if (mounted === false) return swiper;
|
|
25692
|
+
swiper.emit('beforeInit'); // Set breakpoint
|
|
25693
|
+
|
|
25694
|
+
if (swiper.params.breakpoints) {
|
|
25695
|
+
swiper.setBreakpoint();
|
|
25696
|
+
} // Add Classes
|
|
25697
|
+
|
|
25698
|
+
|
|
25699
|
+
swiper.addClasses(); // Create loop
|
|
25700
|
+
|
|
25701
|
+
if (swiper.params.loop) {
|
|
25702
|
+
swiper.loopCreate();
|
|
25703
|
+
} // Update size
|
|
25704
|
+
|
|
25705
|
+
|
|
25706
|
+
swiper.updateSize(); // Update slides
|
|
25707
|
+
|
|
25708
|
+
swiper.updateSlides();
|
|
25709
|
+
|
|
25710
|
+
if (swiper.params.watchOverflow) {
|
|
25711
|
+
swiper.checkOverflow();
|
|
25712
|
+
} // Set Grab Cursor
|
|
25713
|
+
|
|
25714
|
+
|
|
25715
|
+
if (swiper.params.grabCursor && swiper.enabled) {
|
|
25716
|
+
swiper.setGrabCursor();
|
|
25717
|
+
}
|
|
25718
|
+
|
|
25719
|
+
if (swiper.params.preloadImages) {
|
|
25720
|
+
swiper.preloadImages();
|
|
25721
|
+
} // Slide To Initial Slide
|
|
25722
|
+
|
|
25723
|
+
|
|
25724
|
+
if (swiper.params.loop) {
|
|
25725
|
+
swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
25726
|
+
} else {
|
|
25727
|
+
swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
25728
|
+
} // Attach events
|
|
25729
|
+
|
|
25730
|
+
|
|
25731
|
+
swiper.attachEvents(); // Init Flag
|
|
25732
|
+
|
|
25733
|
+
swiper.initialized = true; // Emit
|
|
25734
|
+
|
|
25735
|
+
swiper.emit('init');
|
|
25736
|
+
swiper.emit('afterInit');
|
|
25737
|
+
return swiper;
|
|
25738
|
+
}
|
|
25739
|
+
|
|
25740
|
+
destroy(deleteInstance = true, cleanStyles = true) {
|
|
25741
|
+
const swiper = this;
|
|
25742
|
+
const {
|
|
25743
|
+
params,
|
|
25744
|
+
$el,
|
|
25745
|
+
$wrapperEl,
|
|
25746
|
+
slides
|
|
25747
|
+
} = swiper;
|
|
25748
|
+
|
|
25749
|
+
if (typeof swiper.params === 'undefined' || swiper.destroyed) {
|
|
25750
|
+
return null;
|
|
25751
|
+
}
|
|
25752
|
+
|
|
25753
|
+
swiper.emit('beforeDestroy'); // Init Flag
|
|
25754
|
+
|
|
25755
|
+
swiper.initialized = false; // Detach events
|
|
25756
|
+
|
|
25757
|
+
swiper.detachEvents(); // Destroy loop
|
|
25758
|
+
|
|
25759
|
+
if (params.loop) {
|
|
25760
|
+
swiper.loopDestroy();
|
|
25761
|
+
} // Cleanup styles
|
|
25762
|
+
|
|
25763
|
+
|
|
25764
|
+
if (cleanStyles) {
|
|
25765
|
+
swiper.removeClasses();
|
|
25766
|
+
$el.removeAttr('style');
|
|
25767
|
+
$wrapperEl.removeAttr('style');
|
|
25768
|
+
|
|
25769
|
+
if (slides && slides.length) {
|
|
25770
|
+
slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');
|
|
25771
|
+
}
|
|
25772
|
+
}
|
|
25773
|
+
|
|
25774
|
+
swiper.emit('destroy'); // Detach emitter events
|
|
25775
|
+
|
|
25776
|
+
Object.keys(swiper.eventsListeners).forEach(eventName => {
|
|
25777
|
+
swiper.off(eventName);
|
|
25778
|
+
});
|
|
25779
|
+
|
|
25780
|
+
if (deleteInstance !== false) {
|
|
25781
|
+
swiper.$el[0].swiper = null;
|
|
25782
|
+
deleteProps(swiper);
|
|
25783
|
+
}
|
|
25784
|
+
|
|
25785
|
+
swiper.destroyed = true;
|
|
25786
|
+
return null;
|
|
25787
|
+
}
|
|
25788
|
+
|
|
25789
|
+
static extendDefaults(newDefaults) {
|
|
25790
|
+
extend(extendedDefaults, newDefaults);
|
|
25791
|
+
}
|
|
25792
|
+
|
|
25793
|
+
static get extendedDefaults() {
|
|
25794
|
+
return extendedDefaults;
|
|
25795
|
+
}
|
|
25796
|
+
|
|
25797
|
+
static get defaults() {
|
|
25798
|
+
return defaults;
|
|
25799
|
+
}
|
|
25800
|
+
|
|
25801
|
+
static installModule(mod) {
|
|
25802
|
+
if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
|
|
25803
|
+
const modules = Swiper.prototype.__modules__;
|
|
25804
|
+
|
|
25805
|
+
if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
|
|
25806
|
+
modules.push(mod);
|
|
25807
|
+
}
|
|
25808
|
+
}
|
|
25809
|
+
|
|
25810
|
+
static use(module) {
|
|
25811
|
+
if (Array.isArray(module)) {
|
|
25812
|
+
module.forEach(m => Swiper.installModule(m));
|
|
25813
|
+
return Swiper;
|
|
25814
|
+
}
|
|
25815
|
+
|
|
25816
|
+
Swiper.installModule(module);
|
|
25817
|
+
return Swiper;
|
|
25818
|
+
}
|
|
25819
|
+
|
|
25820
|
+
}
|
|
25821
|
+
|
|
25822
|
+
Object.keys(prototypes).forEach(prototypeGroup => {
|
|
25823
|
+
Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
|
|
25824
|
+
Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
|
|
25825
|
+
});
|
|
25826
|
+
});
|
|
25827
|
+
Swiper.use([Resize, Observer]);
|
|
25828
|
+
|
|
25829
|
+
/* eslint no-underscore-dangle: "off" */
|
|
25830
|
+
function Autoplay({
|
|
25831
|
+
swiper,
|
|
25832
|
+
extendParams,
|
|
25833
|
+
on,
|
|
25834
|
+
emit
|
|
25835
|
+
}) {
|
|
25836
|
+
let timeout;
|
|
25837
|
+
swiper.autoplay = {
|
|
25838
|
+
running: false,
|
|
25839
|
+
paused: false
|
|
25840
|
+
};
|
|
25841
|
+
extendParams({
|
|
25842
|
+
autoplay: {
|
|
25843
|
+
enabled: false,
|
|
25844
|
+
delay: 3000,
|
|
25845
|
+
waitForTransition: true,
|
|
25846
|
+
disableOnInteraction: true,
|
|
25847
|
+
stopOnLastSlide: false,
|
|
25848
|
+
reverseDirection: false,
|
|
25849
|
+
pauseOnMouseEnter: false
|
|
25850
|
+
}
|
|
25851
|
+
});
|
|
25852
|
+
|
|
25853
|
+
function run() {
|
|
25854
|
+
if (!swiper.size) {
|
|
25855
|
+
swiper.autoplay.running = false;
|
|
25856
|
+
swiper.autoplay.paused = false;
|
|
25857
|
+
return;
|
|
25858
|
+
}
|
|
25859
|
+
|
|
25860
|
+
const $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
|
|
25861
|
+
let delay = swiper.params.autoplay.delay;
|
|
25862
|
+
|
|
25863
|
+
if ($activeSlideEl.attr('data-swiper-autoplay')) {
|
|
25864
|
+
delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
|
|
25865
|
+
}
|
|
25866
|
+
|
|
25867
|
+
clearTimeout(timeout);
|
|
25868
|
+
timeout = nextTick(() => {
|
|
25869
|
+
let autoplayResult;
|
|
25870
|
+
|
|
25871
|
+
if (swiper.params.autoplay.reverseDirection) {
|
|
25872
|
+
if (swiper.params.loop) {
|
|
25873
|
+
swiper.loopFix();
|
|
25874
|
+
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
|
|
25875
|
+
emit('autoplay');
|
|
25876
|
+
} else if (!swiper.isBeginning) {
|
|
25877
|
+
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
|
|
25878
|
+
emit('autoplay');
|
|
25879
|
+
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
25880
|
+
autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
|
|
25881
|
+
emit('autoplay');
|
|
25882
|
+
} else {
|
|
25883
|
+
stop();
|
|
25884
|
+
}
|
|
25885
|
+
} else if (swiper.params.loop) {
|
|
25886
|
+
swiper.loopFix();
|
|
25887
|
+
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
|
|
25888
|
+
emit('autoplay');
|
|
25889
|
+
} else if (!swiper.isEnd) {
|
|
25890
|
+
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
|
|
25891
|
+
emit('autoplay');
|
|
25892
|
+
} else if (!swiper.params.autoplay.stopOnLastSlide) {
|
|
25893
|
+
autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
|
|
25894
|
+
emit('autoplay');
|
|
25895
|
+
} else {
|
|
25896
|
+
stop();
|
|
25897
|
+
}
|
|
25898
|
+
|
|
25899
|
+
if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) {
|
|
25900
|
+
run();
|
|
25901
|
+
}
|
|
25902
|
+
}, delay);
|
|
25903
|
+
}
|
|
25904
|
+
|
|
25905
|
+
function start() {
|
|
25906
|
+
if (typeof timeout !== 'undefined') return false;
|
|
25907
|
+
if (swiper.autoplay.running) return false;
|
|
25908
|
+
swiper.autoplay.running = true;
|
|
25909
|
+
emit('autoplayStart');
|
|
25910
|
+
run();
|
|
25911
|
+
return true;
|
|
25912
|
+
}
|
|
25913
|
+
|
|
25914
|
+
function stop() {
|
|
25915
|
+
if (!swiper.autoplay.running) return false;
|
|
25916
|
+
if (typeof timeout === 'undefined') return false;
|
|
25917
|
+
|
|
25918
|
+
if (timeout) {
|
|
25919
|
+
clearTimeout(timeout);
|
|
25920
|
+
timeout = undefined;
|
|
25921
|
+
}
|
|
25922
|
+
|
|
25923
|
+
swiper.autoplay.running = false;
|
|
25924
|
+
emit('autoplayStop');
|
|
25925
|
+
return true;
|
|
25926
|
+
}
|
|
25927
|
+
|
|
25928
|
+
function pause(speed) {
|
|
25929
|
+
if (!swiper.autoplay.running) return;
|
|
25930
|
+
if (swiper.autoplay.paused) return;
|
|
25931
|
+
if (timeout) clearTimeout(timeout);
|
|
25932
|
+
swiper.autoplay.paused = true;
|
|
25933
|
+
|
|
25934
|
+
if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
|
|
25935
|
+
swiper.autoplay.paused = false;
|
|
25936
|
+
run();
|
|
25937
|
+
} else {
|
|
25938
|
+
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
|
25939
|
+
swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd);
|
|
25940
|
+
});
|
|
25941
|
+
}
|
|
25942
|
+
}
|
|
25943
|
+
|
|
25944
|
+
function onVisibilityChange() {
|
|
25945
|
+
const document = ssrWindow.getDocument();
|
|
25946
|
+
|
|
25947
|
+
if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
|
|
25948
|
+
pause();
|
|
25949
|
+
}
|
|
25950
|
+
|
|
25951
|
+
if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
|
|
25952
|
+
run();
|
|
25953
|
+
swiper.autoplay.paused = false;
|
|
25954
|
+
}
|
|
25955
|
+
}
|
|
25956
|
+
|
|
25957
|
+
function onTransitionEnd(e) {
|
|
25958
|
+
if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
|
|
25959
|
+
if (e.target !== swiper.$wrapperEl[0]) return;
|
|
25960
|
+
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
|
25961
|
+
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
|
|
25962
|
+
});
|
|
25963
|
+
swiper.autoplay.paused = false;
|
|
25964
|
+
|
|
25965
|
+
if (!swiper.autoplay.running) {
|
|
25966
|
+
stop();
|
|
25967
|
+
} else {
|
|
25968
|
+
run();
|
|
25969
|
+
}
|
|
25970
|
+
}
|
|
25971
|
+
|
|
25972
|
+
function onMouseEnter() {
|
|
25973
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
25974
|
+
stop();
|
|
25975
|
+
} else {
|
|
25976
|
+
emit('autoplayPause');
|
|
25977
|
+
pause();
|
|
25978
|
+
}
|
|
25979
|
+
|
|
25980
|
+
['transitionend', 'webkitTransitionEnd'].forEach(event => {
|
|
25981
|
+
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
|
|
25982
|
+
});
|
|
25983
|
+
}
|
|
25984
|
+
|
|
25985
|
+
function onMouseLeave() {
|
|
25986
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
25987
|
+
return;
|
|
25988
|
+
}
|
|
25989
|
+
|
|
25990
|
+
swiper.autoplay.paused = false;
|
|
25991
|
+
emit('autoplayResume');
|
|
25992
|
+
run();
|
|
25993
|
+
}
|
|
25994
|
+
|
|
25995
|
+
function attachMouseEvents() {
|
|
25996
|
+
if (swiper.params.autoplay.pauseOnMouseEnter) {
|
|
25997
|
+
swiper.$el.on('mouseenter', onMouseEnter);
|
|
25998
|
+
swiper.$el.on('mouseleave', onMouseLeave);
|
|
25999
|
+
}
|
|
26000
|
+
}
|
|
26001
|
+
|
|
26002
|
+
function detachMouseEvents() {
|
|
26003
|
+
swiper.$el.off('mouseenter', onMouseEnter);
|
|
26004
|
+
swiper.$el.off('mouseleave', onMouseLeave);
|
|
26005
|
+
}
|
|
26006
|
+
|
|
26007
|
+
on('init', () => {
|
|
26008
|
+
if (swiper.params.autoplay.enabled) {
|
|
26009
|
+
start();
|
|
26010
|
+
const document = ssrWindow.getDocument();
|
|
26011
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
26012
|
+
attachMouseEvents();
|
|
26013
|
+
}
|
|
26014
|
+
});
|
|
26015
|
+
on('beforeTransitionStart', (_s, speed, internal) => {
|
|
26016
|
+
if (swiper.autoplay.running) {
|
|
26017
|
+
if (internal || !swiper.params.autoplay.disableOnInteraction) {
|
|
26018
|
+
swiper.autoplay.pause(speed);
|
|
26019
|
+
} else {
|
|
26020
|
+
stop();
|
|
26021
|
+
}
|
|
26022
|
+
}
|
|
26023
|
+
});
|
|
26024
|
+
on('sliderFirstMove', () => {
|
|
26025
|
+
if (swiper.autoplay.running) {
|
|
26026
|
+
if (swiper.params.autoplay.disableOnInteraction) {
|
|
26027
|
+
stop();
|
|
26028
|
+
} else {
|
|
26029
|
+
pause();
|
|
26030
|
+
}
|
|
26031
|
+
}
|
|
26032
|
+
});
|
|
26033
|
+
on('touchEnd', () => {
|
|
26034
|
+
if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
|
|
26035
|
+
run();
|
|
26036
|
+
}
|
|
26037
|
+
});
|
|
26038
|
+
on('destroy', () => {
|
|
26039
|
+
detachMouseEvents();
|
|
26040
|
+
|
|
26041
|
+
if (swiper.autoplay.running) {
|
|
26042
|
+
stop();
|
|
26043
|
+
}
|
|
26044
|
+
|
|
26045
|
+
const document = ssrWindow.getDocument();
|
|
26046
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
26047
|
+
});
|
|
26048
|
+
Object.assign(swiper.autoplay, {
|
|
26049
|
+
pause,
|
|
26050
|
+
run,
|
|
26051
|
+
start,
|
|
26052
|
+
stop
|
|
26053
|
+
});
|
|
26054
|
+
}
|
|
26055
|
+
|
|
21954
26056
|
/* src/PanoTagPlugin/Components/Common/MediaItem.svelte generated by Svelte v3.50.1 */
|
|
21955
26057
|
|
|
21956
26058
|
function add_css$e(target) {
|
|
@@ -22230,7 +26332,7 @@ function create_if_block$a(ctx) {
|
|
|
22230
26332
|
internal.add_render_callback(() => {
|
|
22231
26333
|
if (div_outro) div_outro.end(1);
|
|
22232
26334
|
|
|
22233
|
-
div_intro = internal.create_in_transition(div, transition.fly, /*animation*/ ctx[5]
|
|
26335
|
+
div_intro = internal.create_in_transition(div, transition$1.fly, /*animation*/ ctx[5]
|
|
22234
26336
|
? {
|
|
22235
26337
|
y: 4,
|
|
22236
26338
|
duration: /*duration*/ ctx[3],
|
|
@@ -22250,7 +26352,7 @@ function create_if_block$a(ctx) {
|
|
|
22250
26352
|
if (div_intro) div_intro.invalidate();
|
|
22251
26353
|
|
|
22252
26354
|
if (local) {
|
|
22253
|
-
div_outro = internal.create_out_transition(div, transition.fly, /*animation*/ ctx[5]
|
|
26355
|
+
div_outro = internal.create_out_transition(div, transition$1.fly, /*animation*/ ctx[5]
|
|
22254
26356
|
? {
|
|
22255
26357
|
y: 4,
|
|
22256
26358
|
duration: /*duration*/ ctx[3],
|
|
@@ -22313,13 +26415,13 @@ function create_else_block$1(ctx) {
|
|
|
22313
26415
|
|
|
22314
26416
|
// (31:4) {#if carouselEnabled}
|
|
22315
26417
|
function create_if_block_1$6(ctx) {
|
|
22316
|
-
let swiper
|
|
26418
|
+
let swiper;
|
|
22317
26419
|
let current;
|
|
22318
26420
|
|
|
22319
|
-
swiper
|
|
26421
|
+
swiper = new svelte$1.Swiper({
|
|
22320
26422
|
props: {
|
|
22321
26423
|
style: "height: 100%",
|
|
22322
|
-
modules: [
|
|
26424
|
+
modules: [Autoplay],
|
|
22323
26425
|
spaceBetween: 30,
|
|
22324
26426
|
autoplay: /*autoplay*/ ctx[10]
|
|
22325
26427
|
? noTypecheck({
|
|
@@ -22334,14 +26436,14 @@ function create_if_block_1$6(ctx) {
|
|
|
22334
26436
|
}
|
|
22335
26437
|
});
|
|
22336
26438
|
|
|
22337
|
-
swiper
|
|
26439
|
+
swiper.$on("slideChange", /*slideChange_handler*/ ctx[13]);
|
|
22338
26440
|
|
|
22339
26441
|
return {
|
|
22340
26442
|
c() {
|
|
22341
|
-
internal.create_component(swiper
|
|
26443
|
+
internal.create_component(swiper.$$.fragment);
|
|
22342
26444
|
},
|
|
22343
26445
|
m(target, anchor) {
|
|
22344
|
-
internal.mount_component(swiper
|
|
26446
|
+
internal.mount_component(swiper, target, anchor);
|
|
22345
26447
|
current = true;
|
|
22346
26448
|
},
|
|
22347
26449
|
p(ctx, dirty) {
|
|
@@ -22359,19 +26461,19 @@ function create_if_block_1$6(ctx) {
|
|
|
22359
26461
|
swiper_changes.$$scope = { dirty, ctx };
|
|
22360
26462
|
}
|
|
22361
26463
|
|
|
22362
|
-
swiper
|
|
26464
|
+
swiper.$set(swiper_changes);
|
|
22363
26465
|
},
|
|
22364
26466
|
i(local) {
|
|
22365
26467
|
if (current) return;
|
|
22366
|
-
internal.transition_in(swiper
|
|
26468
|
+
internal.transition_in(swiper.$$.fragment, local);
|
|
22367
26469
|
current = true;
|
|
22368
26470
|
},
|
|
22369
26471
|
o(local) {
|
|
22370
|
-
internal.transition_out(swiper
|
|
26472
|
+
internal.transition_out(swiper.$$.fragment, local);
|
|
22371
26473
|
current = false;
|
|
22372
26474
|
},
|
|
22373
26475
|
d(detaching) {
|
|
22374
|
-
internal.destroy_component(swiper
|
|
26476
|
+
internal.destroy_component(swiper, detaching);
|
|
22375
26477
|
}
|
|
22376
26478
|
};
|
|
22377
26479
|
}
|
|
@@ -23781,7 +27883,7 @@ function create_if_block$7(ctx) {
|
|
|
23781
27883
|
internal.add_render_callback(() => {
|
|
23782
27884
|
if (div1_outro) div1_outro.end(1);
|
|
23783
27885
|
|
|
23784
|
-
div1_intro = internal.create_in_transition(div1, transition.fade, {
|
|
27886
|
+
div1_intro = internal.create_in_transition(div1, transition$1.fade, {
|
|
23785
27887
|
duration: /*duration*/ ctx[2],
|
|
23786
27888
|
delay: /*inDelay*/ ctx[0],
|
|
23787
27889
|
easing: easing.cubicInOut
|
|
@@ -23798,7 +27900,7 @@ function create_if_block$7(ctx) {
|
|
|
23798
27900
|
if (div1_intro) div1_intro.invalidate();
|
|
23799
27901
|
|
|
23800
27902
|
if (local) {
|
|
23801
|
-
div1_outro = internal.create_out_transition(div1, transition.fade, {
|
|
27903
|
+
div1_outro = internal.create_out_transition(div1, transition$1.fade, {
|
|
23802
27904
|
duration: /*duration*/ ctx[2],
|
|
23803
27905
|
delay: /*outDelay*/ ctx[1],
|
|
23804
27906
|
easing: easing.cubicInOut
|