@pelcro/react-pelcro-js 4.0.0-alpha.16 → 4.0.0-alpha.18

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.
@@ -1,4649 +0,0 @@
1
- import { e as createCommonjsModule, f as unwrapExports, g as commonjsGlobal } from './components-0f4ebe18.js';
2
- import React__default from 'react';
3
- import 'react-dom';
4
- import 'prop-types';
5
-
6
- var initialState_1 = createCommonjsModule(function (module, exports) {
7
-
8
- Object.defineProperty(exports, "__esModule", {
9
- value: true
10
- });
11
- exports["default"] = void 0;
12
- var initialState = {
13
- animating: false,
14
- autoplaying: null,
15
- currentDirection: 0,
16
- currentLeft: null,
17
- currentSlide: 0,
18
- direction: 1,
19
- dragging: false,
20
- edgeDragged: false,
21
- initialized: false,
22
- lazyLoadedList: [],
23
- listHeight: null,
24
- listWidth: null,
25
- scrolling: false,
26
- slideCount: null,
27
- slideHeight: null,
28
- slideWidth: null,
29
- swipeLeft: null,
30
- swiped: false,
31
- // used by swipeEvent. differentites between touch and swipe.
32
- swiping: false,
33
- touchObject: {
34
- startX: 0,
35
- startY: 0,
36
- curX: 0,
37
- curY: 0
38
- },
39
- trackStyle: {},
40
- trackWidth: 0,
41
- targetSlide: 0
42
- };
43
- var _default = initialState;
44
- exports["default"] = _default;
45
- });
46
-
47
- unwrapExports(initialState_1);
48
-
49
- /**
50
- * lodash (Custom Build) <https://lodash.com/>
51
- * Build: `lodash modularize exports="npm" -o ./`
52
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
53
- * Released under MIT license <https://lodash.com/license>
54
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
55
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
56
- */
57
-
58
- /** Used as the `TypeError` message for "Functions" methods. */
59
- var FUNC_ERROR_TEXT = 'Expected a function';
60
-
61
- /** Used as references for various `Number` constants. */
62
- var NAN = 0 / 0;
63
-
64
- /** `Object#toString` result references. */
65
- var symbolTag = '[object Symbol]';
66
-
67
- /** Used to match leading and trailing whitespace. */
68
- var reTrim = /^\s+|\s+$/g;
69
-
70
- /** Used to detect bad signed hexadecimal string values. */
71
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
72
-
73
- /** Used to detect binary string values. */
74
- var reIsBinary = /^0b[01]+$/i;
75
-
76
- /** Used to detect octal string values. */
77
- var reIsOctal = /^0o[0-7]+$/i;
78
-
79
- /** Built-in method references without a dependency on `root`. */
80
- var freeParseInt = parseInt;
81
-
82
- /** Detect free variable `global` from Node.js. */
83
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
84
-
85
- /** Detect free variable `self`. */
86
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
87
-
88
- /** Used as a reference to the global object. */
89
- var root = freeGlobal || freeSelf || Function('return this')();
90
-
91
- /** Used for built-in method references. */
92
- var objectProto = Object.prototype;
93
-
94
- /**
95
- * Used to resolve the
96
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
97
- * of values.
98
- */
99
- var objectToString = objectProto.toString;
100
-
101
- /* Built-in method references for those with the same name as other `lodash` methods. */
102
- var nativeMax = Math.max,
103
- nativeMin = Math.min;
104
-
105
- /**
106
- * Gets the timestamp of the number of milliseconds that have elapsed since
107
- * the Unix epoch (1 January 1970 00:00:00 UTC).
108
- *
109
- * @static
110
- * @memberOf _
111
- * @since 2.4.0
112
- * @category Date
113
- * @returns {number} Returns the timestamp.
114
- * @example
115
- *
116
- * _.defer(function(stamp) {
117
- * console.log(_.now() - stamp);
118
- * }, _.now());
119
- * // => Logs the number of milliseconds it took for the deferred invocation.
120
- */
121
- var now = function() {
122
- return root.Date.now();
123
- };
124
-
125
- /**
126
- * Creates a debounced function that delays invoking `func` until after `wait`
127
- * milliseconds have elapsed since the last time the debounced function was
128
- * invoked. The debounced function comes with a `cancel` method to cancel
129
- * delayed `func` invocations and a `flush` method to immediately invoke them.
130
- * Provide `options` to indicate whether `func` should be invoked on the
131
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
132
- * with the last arguments provided to the debounced function. Subsequent
133
- * calls to the debounced function return the result of the last `func`
134
- * invocation.
135
- *
136
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
137
- * invoked on the trailing edge of the timeout only if the debounced function
138
- * is invoked more than once during the `wait` timeout.
139
- *
140
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
141
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
142
- *
143
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
144
- * for details over the differences between `_.debounce` and `_.throttle`.
145
- *
146
- * @static
147
- * @memberOf _
148
- * @since 0.1.0
149
- * @category Function
150
- * @param {Function} func The function to debounce.
151
- * @param {number} [wait=0] The number of milliseconds to delay.
152
- * @param {Object} [options={}] The options object.
153
- * @param {boolean} [options.leading=false]
154
- * Specify invoking on the leading edge of the timeout.
155
- * @param {number} [options.maxWait]
156
- * The maximum time `func` is allowed to be delayed before it's invoked.
157
- * @param {boolean} [options.trailing=true]
158
- * Specify invoking on the trailing edge of the timeout.
159
- * @returns {Function} Returns the new debounced function.
160
- * @example
161
- *
162
- * // Avoid costly calculations while the window size is in flux.
163
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
164
- *
165
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
166
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
167
- * 'leading': true,
168
- * 'trailing': false
169
- * }));
170
- *
171
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
172
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
173
- * var source = new EventSource('/stream');
174
- * jQuery(source).on('message', debounced);
175
- *
176
- * // Cancel the trailing debounced invocation.
177
- * jQuery(window).on('popstate', debounced.cancel);
178
- */
179
- function debounce(func, wait, options) {
180
- var lastArgs,
181
- lastThis,
182
- maxWait,
183
- result,
184
- timerId,
185
- lastCallTime,
186
- lastInvokeTime = 0,
187
- leading = false,
188
- maxing = false,
189
- trailing = true;
190
-
191
- if (typeof func != 'function') {
192
- throw new TypeError(FUNC_ERROR_TEXT);
193
- }
194
- wait = toNumber(wait) || 0;
195
- if (isObject(options)) {
196
- leading = !!options.leading;
197
- maxing = 'maxWait' in options;
198
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
199
- trailing = 'trailing' in options ? !!options.trailing : trailing;
200
- }
201
-
202
- function invokeFunc(time) {
203
- var args = lastArgs,
204
- thisArg = lastThis;
205
-
206
- lastArgs = lastThis = undefined;
207
- lastInvokeTime = time;
208
- result = func.apply(thisArg, args);
209
- return result;
210
- }
211
-
212
- function leadingEdge(time) {
213
- // Reset any `maxWait` timer.
214
- lastInvokeTime = time;
215
- // Start the timer for the trailing edge.
216
- timerId = setTimeout(timerExpired, wait);
217
- // Invoke the leading edge.
218
- return leading ? invokeFunc(time) : result;
219
- }
220
-
221
- function remainingWait(time) {
222
- var timeSinceLastCall = time - lastCallTime,
223
- timeSinceLastInvoke = time - lastInvokeTime,
224
- result = wait - timeSinceLastCall;
225
-
226
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
227
- }
228
-
229
- function shouldInvoke(time) {
230
- var timeSinceLastCall = time - lastCallTime,
231
- timeSinceLastInvoke = time - lastInvokeTime;
232
-
233
- // Either this is the first call, activity has stopped and we're at the
234
- // trailing edge, the system time has gone backwards and we're treating
235
- // it as the trailing edge, or we've hit the `maxWait` limit.
236
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
237
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
238
- }
239
-
240
- function timerExpired() {
241
- var time = now();
242
- if (shouldInvoke(time)) {
243
- return trailingEdge(time);
244
- }
245
- // Restart the timer.
246
- timerId = setTimeout(timerExpired, remainingWait(time));
247
- }
248
-
249
- function trailingEdge(time) {
250
- timerId = undefined;
251
-
252
- // Only invoke if we have `lastArgs` which means `func` has been
253
- // debounced at least once.
254
- if (trailing && lastArgs) {
255
- return invokeFunc(time);
256
- }
257
- lastArgs = lastThis = undefined;
258
- return result;
259
- }
260
-
261
- function cancel() {
262
- if (timerId !== undefined) {
263
- clearTimeout(timerId);
264
- }
265
- lastInvokeTime = 0;
266
- lastArgs = lastCallTime = lastThis = timerId = undefined;
267
- }
268
-
269
- function flush() {
270
- return timerId === undefined ? result : trailingEdge(now());
271
- }
272
-
273
- function debounced() {
274
- var time = now(),
275
- isInvoking = shouldInvoke(time);
276
-
277
- lastArgs = arguments;
278
- lastThis = this;
279
- lastCallTime = time;
280
-
281
- if (isInvoking) {
282
- if (timerId === undefined) {
283
- return leadingEdge(lastCallTime);
284
- }
285
- if (maxing) {
286
- // Handle invocations in a tight loop.
287
- timerId = setTimeout(timerExpired, wait);
288
- return invokeFunc(lastCallTime);
289
- }
290
- }
291
- if (timerId === undefined) {
292
- timerId = setTimeout(timerExpired, wait);
293
- }
294
- return result;
295
- }
296
- debounced.cancel = cancel;
297
- debounced.flush = flush;
298
- return debounced;
299
- }
300
-
301
- /**
302
- * Checks if `value` is the
303
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
304
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
305
- *
306
- * @static
307
- * @memberOf _
308
- * @since 0.1.0
309
- * @category Lang
310
- * @param {*} value The value to check.
311
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
312
- * @example
313
- *
314
- * _.isObject({});
315
- * // => true
316
- *
317
- * _.isObject([1, 2, 3]);
318
- * // => true
319
- *
320
- * _.isObject(_.noop);
321
- * // => true
322
- *
323
- * _.isObject(null);
324
- * // => false
325
- */
326
- function isObject(value) {
327
- var type = typeof value;
328
- return !!value && (type == 'object' || type == 'function');
329
- }
330
-
331
- /**
332
- * Checks if `value` is object-like. A value is object-like if it's not `null`
333
- * and has a `typeof` result of "object".
334
- *
335
- * @static
336
- * @memberOf _
337
- * @since 4.0.0
338
- * @category Lang
339
- * @param {*} value The value to check.
340
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
341
- * @example
342
- *
343
- * _.isObjectLike({});
344
- * // => true
345
- *
346
- * _.isObjectLike([1, 2, 3]);
347
- * // => true
348
- *
349
- * _.isObjectLike(_.noop);
350
- * // => false
351
- *
352
- * _.isObjectLike(null);
353
- * // => false
354
- */
355
- function isObjectLike(value) {
356
- return !!value && typeof value == 'object';
357
- }
358
-
359
- /**
360
- * Checks if `value` is classified as a `Symbol` primitive or object.
361
- *
362
- * @static
363
- * @memberOf _
364
- * @since 4.0.0
365
- * @category Lang
366
- * @param {*} value The value to check.
367
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
368
- * @example
369
- *
370
- * _.isSymbol(Symbol.iterator);
371
- * // => true
372
- *
373
- * _.isSymbol('abc');
374
- * // => false
375
- */
376
- function isSymbol(value) {
377
- return typeof value == 'symbol' ||
378
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
379
- }
380
-
381
- /**
382
- * Converts `value` to a number.
383
- *
384
- * @static
385
- * @memberOf _
386
- * @since 4.0.0
387
- * @category Lang
388
- * @param {*} value The value to process.
389
- * @returns {number} Returns the number.
390
- * @example
391
- *
392
- * _.toNumber(3.2);
393
- * // => 3.2
394
- *
395
- * _.toNumber(Number.MIN_VALUE);
396
- * // => 5e-324
397
- *
398
- * _.toNumber(Infinity);
399
- * // => Infinity
400
- *
401
- * _.toNumber('3.2');
402
- * // => 3.2
403
- */
404
- function toNumber(value) {
405
- if (typeof value == 'number') {
406
- return value;
407
- }
408
- if (isSymbol(value)) {
409
- return NAN;
410
- }
411
- if (isObject(value)) {
412
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
413
- value = isObject(other) ? (other + '') : other;
414
- }
415
- if (typeof value != 'string') {
416
- return value === 0 ? value : +value;
417
- }
418
- value = value.replace(reTrim, '');
419
- var isBinary = reIsBinary.test(value);
420
- return (isBinary || reIsOctal.test(value))
421
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
422
- : (reIsBadHex.test(value) ? NAN : +value);
423
- }
424
-
425
- var lodash_debounce = debounce;
426
-
427
- var classnames = createCommonjsModule(function (module) {
428
- /*!
429
- Copyright (c) 2018 Jed Watson.
430
- Licensed under the MIT License (MIT), see
431
- http://jedwatson.github.io/classnames
432
- */
433
- /* global define */
434
-
435
- (function () {
436
-
437
- var hasOwn = {}.hasOwnProperty;
438
-
439
- function classNames() {
440
- var classes = [];
441
-
442
- for (var i = 0; i < arguments.length; i++) {
443
- var arg = arguments[i];
444
- if (!arg) continue;
445
-
446
- var argType = typeof arg;
447
-
448
- if (argType === 'string' || argType === 'number') {
449
- classes.push(arg);
450
- } else if (Array.isArray(arg)) {
451
- if (arg.length) {
452
- var inner = classNames.apply(null, arg);
453
- if (inner) {
454
- classes.push(inner);
455
- }
456
- }
457
- } else if (argType === 'object') {
458
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
459
- classes.push(arg.toString());
460
- continue;
461
- }
462
-
463
- for (var key in arg) {
464
- if (hasOwn.call(arg, key) && arg[key]) {
465
- classes.push(key);
466
- }
467
- }
468
- }
469
- }
470
-
471
- return classes.join(' ');
472
- }
473
-
474
- if (module.exports) {
475
- classNames.default = classNames;
476
- module.exports = classNames;
477
- } else {
478
- window.classNames = classNames;
479
- }
480
- }());
481
- });
482
-
483
- var innerSliderUtils = createCommonjsModule(function (module, exports) {
484
-
485
- Object.defineProperty(exports, "__esModule", {
486
- value: true
487
- });
488
- exports.checkSpecKeys = exports.checkNavigable = exports.changeSlide = exports.canUseDOM = exports.canGoNext = void 0;
489
- exports.clamp = clamp;
490
- exports.swipeStart = exports.swipeMove = exports.swipeEnd = exports.slidesOnRight = exports.slidesOnLeft = exports.slideHandler = exports.siblingDirection = exports.safePreventDefault = exports.lazyStartIndex = exports.lazySlidesOnRight = exports.lazySlidesOnLeft = exports.lazyEndIndex = exports.keyHandler = exports.initializedState = exports.getWidth = exports.getTrackLeft = exports.getTrackCSS = exports.getTrackAnimateCSS = exports.getTotalSlides = exports.getSwipeDirection = exports.getSlideCount = exports.getRequiredLazySlides = exports.getPreClones = exports.getPostClones = exports.getOnDemandLazySlides = exports.getNavigableIndexes = exports.getHeight = exports.extractObject = void 0;
491
-
492
- var _react = _interopRequireDefault(React__default);
493
-
494
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
495
-
496
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
497
-
498
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
499
-
500
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
501
-
502
- function clamp(number, lowerBound, upperBound) {
503
- return Math.max(lowerBound, Math.min(number, upperBound));
504
- }
505
-
506
- var safePreventDefault = function safePreventDefault(event) {
507
- var passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
508
-
509
- if (!passiveEvents.includes(event._reactName)) {
510
- event.preventDefault();
511
- }
512
- };
513
-
514
- exports.safePreventDefault = safePreventDefault;
515
-
516
- var getOnDemandLazySlides = function getOnDemandLazySlides(spec) {
517
- var onDemandSlides = [];
518
- var startIndex = lazyStartIndex(spec);
519
- var endIndex = lazyEndIndex(spec);
520
-
521
- for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
522
- if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
523
- onDemandSlides.push(slideIndex);
524
- }
525
- }
526
-
527
- return onDemandSlides;
528
- }; // return list of slides that need to be present
529
-
530
-
531
- exports.getOnDemandLazySlides = getOnDemandLazySlides;
532
-
533
- var getRequiredLazySlides = function getRequiredLazySlides(spec) {
534
- var requiredSlides = [];
535
- var startIndex = lazyStartIndex(spec);
536
- var endIndex = lazyEndIndex(spec);
537
-
538
- for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
539
- requiredSlides.push(slideIndex);
540
- }
541
-
542
- return requiredSlides;
543
- }; // startIndex that needs to be present
544
-
545
-
546
- exports.getRequiredLazySlides = getRequiredLazySlides;
547
-
548
- var lazyStartIndex = function lazyStartIndex(spec) {
549
- return spec.currentSlide - lazySlidesOnLeft(spec);
550
- };
551
-
552
- exports.lazyStartIndex = lazyStartIndex;
553
-
554
- var lazyEndIndex = function lazyEndIndex(spec) {
555
- return spec.currentSlide + lazySlidesOnRight(spec);
556
- };
557
-
558
- exports.lazyEndIndex = lazyEndIndex;
559
-
560
- var lazySlidesOnLeft = function lazySlidesOnLeft(spec) {
561
- return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
562
- };
563
-
564
- exports.lazySlidesOnLeft = lazySlidesOnLeft;
565
-
566
- var lazySlidesOnRight = function lazySlidesOnRight(spec) {
567
- return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
568
- }; // get width of an element
569
-
570
-
571
- exports.lazySlidesOnRight = lazySlidesOnRight;
572
-
573
- var getWidth = function getWidth(elem) {
574
- return elem && elem.offsetWidth || 0;
575
- };
576
-
577
- exports.getWidth = getWidth;
578
-
579
- var getHeight = function getHeight(elem) {
580
- return elem && elem.offsetHeight || 0;
581
- };
582
-
583
- exports.getHeight = getHeight;
584
-
585
- var getSwipeDirection = function getSwipeDirection(touchObject) {
586
- var verticalSwiping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
587
- var xDist, yDist, r, swipeAngle;
588
- xDist = touchObject.startX - touchObject.curX;
589
- yDist = touchObject.startY - touchObject.curY;
590
- r = Math.atan2(yDist, xDist);
591
- swipeAngle = Math.round(r * 180 / Math.PI);
592
-
593
- if (swipeAngle < 0) {
594
- swipeAngle = 360 - Math.abs(swipeAngle);
595
- }
596
-
597
- if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
598
- return "left";
599
- }
600
-
601
- if (swipeAngle >= 135 && swipeAngle <= 225) {
602
- return "right";
603
- }
604
-
605
- if (verticalSwiping === true) {
606
- if (swipeAngle >= 35 && swipeAngle <= 135) {
607
- return "up";
608
- } else {
609
- return "down";
610
- }
611
- }
612
-
613
- return "vertical";
614
- }; // whether or not we can go next
615
-
616
-
617
- exports.getSwipeDirection = getSwipeDirection;
618
-
619
- var canGoNext = function canGoNext(spec) {
620
- var canGo = true;
621
-
622
- if (!spec.infinite) {
623
- if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
624
- canGo = false;
625
- } else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
626
- canGo = false;
627
- }
628
- }
629
-
630
- return canGo;
631
- }; // given an object and a list of keys, return new object with given keys
632
-
633
-
634
- exports.canGoNext = canGoNext;
635
-
636
- var extractObject = function extractObject(spec, keys) {
637
- var newObject = {};
638
- keys.forEach(function (key) {
639
- return newObject[key] = spec[key];
640
- });
641
- return newObject;
642
- }; // get initialized state
643
-
644
-
645
- exports.extractObject = extractObject;
646
-
647
- var initializedState = function initializedState(spec) {
648
- // spec also contains listRef, trackRef
649
- var slideCount = _react["default"].Children.count(spec.children);
650
-
651
- var listNode = spec.listRef;
652
- var listWidth = Math.ceil(getWidth(listNode));
653
- var trackNode = spec.trackRef && spec.trackRef.node;
654
- var trackWidth = Math.ceil(getWidth(trackNode));
655
- var slideWidth;
656
-
657
- if (!spec.vertical) {
658
- var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
659
-
660
- if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
661
- centerPaddingAdj *= listWidth / 100;
662
- }
663
-
664
- slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
665
- } else {
666
- slideWidth = listWidth;
667
- }
668
-
669
- var slideHeight = listNode && getHeight(listNode.querySelector('[data-index="0"]'));
670
- var listHeight = slideHeight * spec.slidesToShow;
671
- var currentSlide = spec.currentSlide === undefined ? spec.initialSlide : spec.currentSlide;
672
-
673
- if (spec.rtl && spec.currentSlide === undefined) {
674
- currentSlide = slideCount - 1 - spec.initialSlide;
675
- }
676
-
677
- var lazyLoadedList = spec.lazyLoadedList || [];
678
- var slidesToLoad = getOnDemandLazySlides(_objectSpread(_objectSpread({}, spec), {}, {
679
- currentSlide: currentSlide,
680
- lazyLoadedList: lazyLoadedList
681
- }));
682
- lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
683
- var state = {
684
- slideCount: slideCount,
685
- slideWidth: slideWidth,
686
- listWidth: listWidth,
687
- trackWidth: trackWidth,
688
- currentSlide: currentSlide,
689
- slideHeight: slideHeight,
690
- listHeight: listHeight,
691
- lazyLoadedList: lazyLoadedList
692
- };
693
-
694
- if (spec.autoplaying === null && spec.autoplay) {
695
- state["autoplaying"] = "playing";
696
- }
697
-
698
- return state;
699
- };
700
-
701
- exports.initializedState = initializedState;
702
-
703
- var slideHandler = function slideHandler(spec) {
704
- var waitForAnimate = spec.waitForAnimate,
705
- animating = spec.animating,
706
- fade = spec.fade,
707
- infinite = spec.infinite,
708
- index = spec.index,
709
- slideCount = spec.slideCount,
710
- lazyLoad = spec.lazyLoad,
711
- currentSlide = spec.currentSlide,
712
- centerMode = spec.centerMode,
713
- slidesToScroll = spec.slidesToScroll,
714
- slidesToShow = spec.slidesToShow,
715
- useCSS = spec.useCSS;
716
- var lazyLoadedList = spec.lazyLoadedList;
717
- if (waitForAnimate && animating) return {};
718
- var animationSlide = index,
719
- finalSlide,
720
- animationLeft,
721
- finalLeft;
722
- var state = {},
723
- nextState = {};
724
- var targetSlide = infinite ? index : clamp(index, 0, slideCount - 1);
725
-
726
- if (fade) {
727
- if (!infinite && (index < 0 || index >= slideCount)) return {};
728
-
729
- if (index < 0) {
730
- animationSlide = index + slideCount;
731
- } else if (index >= slideCount) {
732
- animationSlide = index - slideCount;
733
- }
734
-
735
- if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
736
- lazyLoadedList = lazyLoadedList.concat(animationSlide);
737
- }
738
-
739
- state = {
740
- animating: true,
741
- currentSlide: animationSlide,
742
- lazyLoadedList: lazyLoadedList,
743
- targetSlide: animationSlide
744
- };
745
- nextState = {
746
- animating: false,
747
- targetSlide: animationSlide
748
- };
749
- } else {
750
- finalSlide = animationSlide;
751
-
752
- if (animationSlide < 0) {
753
- finalSlide = animationSlide + slideCount;
754
- if (!infinite) finalSlide = 0;else if (slideCount % slidesToScroll !== 0) finalSlide = slideCount - slideCount % slidesToScroll;
755
- } else if (!canGoNext(spec) && animationSlide > currentSlide) {
756
- animationSlide = finalSlide = currentSlide;
757
- } else if (centerMode && animationSlide >= slideCount) {
758
- animationSlide = infinite ? slideCount : slideCount - 1;
759
- finalSlide = infinite ? 0 : slideCount - 1;
760
- } else if (animationSlide >= slideCount) {
761
- finalSlide = animationSlide - slideCount;
762
- if (!infinite) finalSlide = slideCount - slidesToShow;else if (slideCount % slidesToScroll !== 0) finalSlide = 0;
763
- }
764
-
765
- if (!infinite && animationSlide + slidesToShow >= slideCount) {
766
- finalSlide = slideCount - slidesToShow;
767
- }
768
-
769
- animationLeft = getTrackLeft(_objectSpread(_objectSpread({}, spec), {}, {
770
- slideIndex: animationSlide
771
- }));
772
- finalLeft = getTrackLeft(_objectSpread(_objectSpread({}, spec), {}, {
773
- slideIndex: finalSlide
774
- }));
775
-
776
- if (!infinite) {
777
- if (animationLeft === finalLeft) animationSlide = finalSlide;
778
- animationLeft = finalLeft;
779
- }
780
-
781
- if (lazyLoad) {
782
- lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides(_objectSpread(_objectSpread({}, spec), {}, {
783
- currentSlide: animationSlide
784
- })));
785
- }
786
-
787
- if (!useCSS) {
788
- state = {
789
- currentSlide: finalSlide,
790
- trackStyle: getTrackCSS(_objectSpread(_objectSpread({}, spec), {}, {
791
- left: finalLeft
792
- })),
793
- lazyLoadedList: lazyLoadedList,
794
- targetSlide: targetSlide
795
- };
796
- } else {
797
- state = {
798
- animating: true,
799
- currentSlide: finalSlide,
800
- trackStyle: getTrackAnimateCSS(_objectSpread(_objectSpread({}, spec), {}, {
801
- left: animationLeft
802
- })),
803
- lazyLoadedList: lazyLoadedList,
804
- targetSlide: targetSlide
805
- };
806
- nextState = {
807
- animating: false,
808
- currentSlide: finalSlide,
809
- trackStyle: getTrackCSS(_objectSpread(_objectSpread({}, spec), {}, {
810
- left: finalLeft
811
- })),
812
- swipeLeft: null,
813
- targetSlide: targetSlide
814
- };
815
- }
816
- }
817
-
818
- return {
819
- state: state,
820
- nextState: nextState
821
- };
822
- };
823
-
824
- exports.slideHandler = slideHandler;
825
-
826
- var changeSlide = function changeSlide(spec, options) {
827
- var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
828
- var slidesToScroll = spec.slidesToScroll,
829
- slidesToShow = spec.slidesToShow,
830
- slideCount = spec.slideCount,
831
- currentSlide = spec.currentSlide,
832
- previousTargetSlide = spec.targetSlide,
833
- lazyLoad = spec.lazyLoad,
834
- infinite = spec.infinite;
835
- unevenOffset = slideCount % slidesToScroll !== 0;
836
- indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
837
-
838
- if (options.message === "previous") {
839
- slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
840
- targetSlide = currentSlide - slideOffset;
841
-
842
- if (lazyLoad && !infinite) {
843
- previousInt = currentSlide - slideOffset;
844
- targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
845
- }
846
-
847
- if (!infinite) {
848
- targetSlide = previousTargetSlide - slidesToScroll;
849
- }
850
- } else if (options.message === "next") {
851
- slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
852
- targetSlide = currentSlide + slideOffset;
853
-
854
- if (lazyLoad && !infinite) {
855
- targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
856
- }
857
-
858
- if (!infinite) {
859
- targetSlide = previousTargetSlide + slidesToScroll;
860
- }
861
- } else if (options.message === "dots") {
862
- // Click on dots
863
- targetSlide = options.index * options.slidesToScroll;
864
- } else if (options.message === "children") {
865
- // Click on the slides
866
- targetSlide = options.index;
867
-
868
- if (infinite) {
869
- var direction = siblingDirection(_objectSpread(_objectSpread({}, spec), {}, {
870
- targetSlide: targetSlide
871
- }));
872
-
873
- if (targetSlide > options.currentSlide && direction === "left") {
874
- targetSlide = targetSlide - slideCount;
875
- } else if (targetSlide < options.currentSlide && direction === "right") {
876
- targetSlide = targetSlide + slideCount;
877
- }
878
- }
879
- } else if (options.message === "index") {
880
- targetSlide = Number(options.index);
881
- }
882
-
883
- return targetSlide;
884
- };
885
-
886
- exports.changeSlide = changeSlide;
887
-
888
- var keyHandler = function keyHandler(e, accessibility, rtl) {
889
- if (e.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility) return "";
890
- if (e.keyCode === 37) return rtl ? "next" : "previous";
891
- if (e.keyCode === 39) return rtl ? "previous" : "next";
892
- return "";
893
- };
894
-
895
- exports.keyHandler = keyHandler;
896
-
897
- var swipeStart = function swipeStart(e, swipe, draggable) {
898
- e.target.tagName === "IMG" && safePreventDefault(e);
899
- if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) return "";
900
- return {
901
- dragging: true,
902
- touchObject: {
903
- startX: e.touches ? e.touches[0].pageX : e.clientX,
904
- startY: e.touches ? e.touches[0].pageY : e.clientY,
905
- curX: e.touches ? e.touches[0].pageX : e.clientX,
906
- curY: e.touches ? e.touches[0].pageY : e.clientY
907
- }
908
- };
909
- };
910
-
911
- exports.swipeStart = swipeStart;
912
-
913
- var swipeMove = function swipeMove(e, spec) {
914
- // spec also contains, trackRef and slideIndex
915
- var scrolling = spec.scrolling,
916
- animating = spec.animating,
917
- vertical = spec.vertical,
918
- swipeToSlide = spec.swipeToSlide,
919
- verticalSwiping = spec.verticalSwiping,
920
- rtl = spec.rtl,
921
- currentSlide = spec.currentSlide,
922
- edgeFriction = spec.edgeFriction,
923
- edgeDragged = spec.edgeDragged,
924
- onEdge = spec.onEdge,
925
- swiped = spec.swiped,
926
- swiping = spec.swiping,
927
- slideCount = spec.slideCount,
928
- slidesToScroll = spec.slidesToScroll,
929
- infinite = spec.infinite,
930
- touchObject = spec.touchObject,
931
- swipeEvent = spec.swipeEvent,
932
- listHeight = spec.listHeight,
933
- listWidth = spec.listWidth;
934
- if (scrolling) return;
935
- if (animating) return safePreventDefault(e);
936
- if (vertical && swipeToSlide && verticalSwiping) safePreventDefault(e);
937
- var swipeLeft,
938
- state = {};
939
- var curLeft = getTrackLeft(spec);
940
- touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
941
- touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
942
- touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
943
- var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
944
-
945
- if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
946
- return {
947
- scrolling: true
948
- };
949
- }
950
-
951
- if (verticalSwiping) touchObject.swipeLength = verticalSwipeLength;
952
- var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
953
- if (verticalSwiping) positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
954
- var dotCount = Math.ceil(slideCount / slidesToScroll);
955
- var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
956
- var touchSwipeLength = touchObject.swipeLength;
957
-
958
- if (!infinite) {
959
- if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
960
- touchSwipeLength = touchObject.swipeLength * edgeFriction;
961
-
962
- if (edgeDragged === false && onEdge) {
963
- onEdge(swipeDirection);
964
- state["edgeDragged"] = true;
965
- }
966
- }
967
- }
968
-
969
- if (!swiped && swipeEvent) {
970
- swipeEvent(swipeDirection);
971
- state["swiped"] = true;
972
- }
973
-
974
- if (!vertical) {
975
- if (!rtl) {
976
- swipeLeft = curLeft + touchSwipeLength * positionOffset;
977
- } else {
978
- swipeLeft = curLeft - touchSwipeLength * positionOffset;
979
- }
980
- } else {
981
- swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
982
- }
983
-
984
- if (verticalSwiping) {
985
- swipeLeft = curLeft + touchSwipeLength * positionOffset;
986
- }
987
-
988
- state = _objectSpread(_objectSpread({}, state), {}, {
989
- touchObject: touchObject,
990
- swipeLeft: swipeLeft,
991
- trackStyle: getTrackCSS(_objectSpread(_objectSpread({}, spec), {}, {
992
- left: swipeLeft
993
- }))
994
- });
995
-
996
- if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
997
- return state;
998
- }
999
-
1000
- if (touchObject.swipeLength > 10) {
1001
- state["swiping"] = true;
1002
- safePreventDefault(e);
1003
- }
1004
-
1005
- return state;
1006
- };
1007
-
1008
- exports.swipeMove = swipeMove;
1009
-
1010
- var swipeEnd = function swipeEnd(e, spec) {
1011
- var dragging = spec.dragging,
1012
- swipe = spec.swipe,
1013
- touchObject = spec.touchObject,
1014
- listWidth = spec.listWidth,
1015
- touchThreshold = spec.touchThreshold,
1016
- verticalSwiping = spec.verticalSwiping,
1017
- listHeight = spec.listHeight,
1018
- swipeToSlide = spec.swipeToSlide,
1019
- scrolling = spec.scrolling,
1020
- onSwipe = spec.onSwipe,
1021
- targetSlide = spec.targetSlide,
1022
- currentSlide = spec.currentSlide,
1023
- infinite = spec.infinite;
1024
-
1025
- if (!dragging) {
1026
- if (swipe) safePreventDefault(e);
1027
- return {};
1028
- }
1029
-
1030
- var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
1031
- var swipeDirection = getSwipeDirection(touchObject, verticalSwiping); // reset the state of touch related state variables.
1032
-
1033
- var state = {
1034
- dragging: false,
1035
- edgeDragged: false,
1036
- scrolling: false,
1037
- swiping: false,
1038
- swiped: false,
1039
- swipeLeft: null,
1040
- touchObject: {}
1041
- };
1042
-
1043
- if (scrolling) {
1044
- return state;
1045
- }
1046
-
1047
- if (!touchObject.swipeLength) {
1048
- return state;
1049
- }
1050
-
1051
- if (touchObject.swipeLength > minSwipe) {
1052
- safePreventDefault(e);
1053
-
1054
- if (onSwipe) {
1055
- onSwipe(swipeDirection);
1056
- }
1057
-
1058
- var slideCount, newSlide;
1059
- var activeSlide = infinite ? currentSlide : targetSlide;
1060
-
1061
- switch (swipeDirection) {
1062
- case "left":
1063
- case "up":
1064
- newSlide = activeSlide + getSlideCount(spec);
1065
- slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
1066
- state["currentDirection"] = 0;
1067
- break;
1068
-
1069
- case "right":
1070
- case "down":
1071
- newSlide = activeSlide - getSlideCount(spec);
1072
- slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
1073
- state["currentDirection"] = 1;
1074
- break;
1075
-
1076
- default:
1077
- slideCount = activeSlide;
1078
- }
1079
-
1080
- state["triggerSlideHandler"] = slideCount;
1081
- } else {
1082
- // Adjust the track back to it's original position.
1083
- var currentLeft = getTrackLeft(spec);
1084
- state["trackStyle"] = getTrackAnimateCSS(_objectSpread(_objectSpread({}, spec), {}, {
1085
- left: currentLeft
1086
- }));
1087
- }
1088
-
1089
- return state;
1090
- };
1091
-
1092
- exports.swipeEnd = swipeEnd;
1093
-
1094
- var getNavigableIndexes = function getNavigableIndexes(spec) {
1095
- var max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
1096
- var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
1097
- var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
1098
- var indexes = [];
1099
-
1100
- while (breakpoint < max) {
1101
- indexes.push(breakpoint);
1102
- breakpoint = counter + spec.slidesToScroll;
1103
- counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
1104
- }
1105
-
1106
- return indexes;
1107
- };
1108
-
1109
- exports.getNavigableIndexes = getNavigableIndexes;
1110
-
1111
- var checkNavigable = function checkNavigable(spec, index) {
1112
- var navigables = getNavigableIndexes(spec);
1113
- var prevNavigable = 0;
1114
-
1115
- if (index > navigables[navigables.length - 1]) {
1116
- index = navigables[navigables.length - 1];
1117
- } else {
1118
- for (var n in navigables) {
1119
- if (index < navigables[n]) {
1120
- index = prevNavigable;
1121
- break;
1122
- }
1123
-
1124
- prevNavigable = navigables[n];
1125
- }
1126
- }
1127
-
1128
- return index;
1129
- };
1130
-
1131
- exports.checkNavigable = checkNavigable;
1132
-
1133
- var getSlideCount = function getSlideCount(spec) {
1134
- var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
1135
-
1136
- if (spec.swipeToSlide) {
1137
- var swipedSlide;
1138
- var slickList = spec.listRef;
1139
- var slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
1140
- Array.from(slides).every(function (slide) {
1141
- if (!spec.vertical) {
1142
- if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
1143
- swipedSlide = slide;
1144
- return false;
1145
- }
1146
- } else {
1147
- if (slide.offsetTop + getHeight(slide) / 2 > spec.swipeLeft * -1) {
1148
- swipedSlide = slide;
1149
- return false;
1150
- }
1151
- }
1152
-
1153
- return true;
1154
- });
1155
-
1156
- if (!swipedSlide) {
1157
- return 0;
1158
- }
1159
-
1160
- var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
1161
- var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
1162
- return slidesTraversed;
1163
- } else {
1164
- return spec.slidesToScroll;
1165
- }
1166
- };
1167
-
1168
- exports.getSlideCount = getSlideCount;
1169
-
1170
- var checkSpecKeys = function checkSpecKeys(spec, keysArray) {
1171
- return keysArray.reduce(function (value, key) {
1172
- return value && spec.hasOwnProperty(key);
1173
- }, true) ? null : console.error("Keys Missing:", spec);
1174
- };
1175
-
1176
- exports.checkSpecKeys = checkSpecKeys;
1177
-
1178
- var getTrackCSS = function getTrackCSS(spec) {
1179
- checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
1180
- var trackWidth, trackHeight;
1181
- var trackChildren = spec.slideCount + 2 * spec.slidesToShow;
1182
-
1183
- if (!spec.vertical) {
1184
- trackWidth = getTotalSlides(spec) * spec.slideWidth;
1185
- } else {
1186
- trackHeight = trackChildren * spec.slideHeight;
1187
- }
1188
-
1189
- var style = {
1190
- opacity: 1,
1191
- transition: "",
1192
- WebkitTransition: ""
1193
- };
1194
-
1195
- if (spec.useTransform) {
1196
- var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
1197
- var transform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
1198
- var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
1199
- style = _objectSpread(_objectSpread({}, style), {}, {
1200
- WebkitTransform: WebkitTransform,
1201
- transform: transform,
1202
- msTransform: msTransform
1203
- });
1204
- } else {
1205
- if (spec.vertical) {
1206
- style["top"] = spec.left;
1207
- } else {
1208
- style["left"] = spec.left;
1209
- }
1210
- }
1211
-
1212
- if (spec.fade) style = {
1213
- opacity: 1
1214
- };
1215
- if (trackWidth) style.width = trackWidth;
1216
- if (trackHeight) style.height = trackHeight; // Fallback for IE8
1217
-
1218
- if (window && !window.addEventListener && window.attachEvent) {
1219
- if (!spec.vertical) {
1220
- style.marginLeft = spec.left + "px";
1221
- } else {
1222
- style.marginTop = spec.left + "px";
1223
- }
1224
- }
1225
-
1226
- return style;
1227
- };
1228
-
1229
- exports.getTrackCSS = getTrackCSS;
1230
-
1231
- var getTrackAnimateCSS = function getTrackAnimateCSS(spec) {
1232
- checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
1233
- var style = getTrackCSS(spec); // useCSS is true by default so it can be undefined
1234
-
1235
- if (spec.useTransform) {
1236
- style.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
1237
- style.transition = "transform " + spec.speed + "ms " + spec.cssEase;
1238
- } else {
1239
- if (spec.vertical) {
1240
- style.transition = "top " + spec.speed + "ms " + spec.cssEase;
1241
- } else {
1242
- style.transition = "left " + spec.speed + "ms " + spec.cssEase;
1243
- }
1244
- }
1245
-
1246
- return style;
1247
- };
1248
-
1249
- exports.getTrackAnimateCSS = getTrackAnimateCSS;
1250
-
1251
- var getTrackLeft = function getTrackLeft(spec) {
1252
- if (spec.unslick) {
1253
- return 0;
1254
- }
1255
-
1256
- checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
1257
- var slideIndex = spec.slideIndex,
1258
- trackRef = spec.trackRef,
1259
- infinite = spec.infinite,
1260
- centerMode = spec.centerMode,
1261
- slideCount = spec.slideCount,
1262
- slidesToShow = spec.slidesToShow,
1263
- slidesToScroll = spec.slidesToScroll,
1264
- slideWidth = spec.slideWidth,
1265
- listWidth = spec.listWidth,
1266
- variableWidth = spec.variableWidth,
1267
- slideHeight = spec.slideHeight,
1268
- fade = spec.fade,
1269
- vertical = spec.vertical;
1270
- var slideOffset = 0;
1271
- var targetLeft;
1272
- var targetSlide;
1273
- var verticalOffset = 0;
1274
-
1275
- if (fade || spec.slideCount === 1) {
1276
- return 0;
1277
- }
1278
-
1279
- var slidesToOffset = 0;
1280
-
1281
- if (infinite) {
1282
- slidesToOffset = -getPreClones(spec); // bring active slide to the beginning of visual area
1283
- // if next scroll doesn't have enough children, just reach till the end of original slides instead of shifting slidesToScroll children
1284
-
1285
- if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
1286
- slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
1287
- } // shift current slide to center of the frame
1288
-
1289
-
1290
- if (centerMode) {
1291
- slidesToOffset += parseInt(slidesToShow / 2);
1292
- }
1293
- } else {
1294
- if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
1295
- slidesToOffset = slidesToShow - slideCount % slidesToScroll;
1296
- }
1297
-
1298
- if (centerMode) {
1299
- slidesToOffset = parseInt(slidesToShow / 2);
1300
- }
1301
- }
1302
-
1303
- slideOffset = slidesToOffset * slideWidth;
1304
- verticalOffset = slidesToOffset * slideHeight;
1305
-
1306
- if (!vertical) {
1307
- targetLeft = slideIndex * slideWidth * -1 + slideOffset;
1308
- } else {
1309
- targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
1310
- }
1311
-
1312
- if (variableWidth === true) {
1313
- var targetSlideIndex;
1314
- var trackElem = trackRef && trackRef.node;
1315
- targetSlideIndex = slideIndex + getPreClones(spec);
1316
- targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
1317
- targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
1318
-
1319
- if (centerMode === true) {
1320
- targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
1321
- targetSlide = trackElem && trackElem.children[targetSlideIndex];
1322
- targetLeft = 0;
1323
-
1324
- for (var slide = 0; slide < targetSlideIndex; slide++) {
1325
- targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
1326
- }
1327
-
1328
- targetLeft -= parseInt(spec.centerPadding);
1329
- targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
1330
- }
1331
- }
1332
-
1333
- return targetLeft;
1334
- };
1335
-
1336
- exports.getTrackLeft = getTrackLeft;
1337
-
1338
- var getPreClones = function getPreClones(spec) {
1339
- if (spec.unslick || !spec.infinite) {
1340
- return 0;
1341
- }
1342
-
1343
- if (spec.variableWidth) {
1344
- return spec.slideCount;
1345
- }
1346
-
1347
- return spec.slidesToShow + (spec.centerMode ? 1 : 0);
1348
- };
1349
-
1350
- exports.getPreClones = getPreClones;
1351
-
1352
- var getPostClones = function getPostClones(spec) {
1353
- if (spec.unslick || !spec.infinite) {
1354
- return 0;
1355
- }
1356
-
1357
- return spec.slideCount;
1358
- };
1359
-
1360
- exports.getPostClones = getPostClones;
1361
-
1362
- var getTotalSlides = function getTotalSlides(spec) {
1363
- return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
1364
- };
1365
-
1366
- exports.getTotalSlides = getTotalSlides;
1367
-
1368
- var siblingDirection = function siblingDirection(spec) {
1369
- if (spec.targetSlide > spec.currentSlide) {
1370
- if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
1371
- return "left";
1372
- }
1373
-
1374
- return "right";
1375
- } else {
1376
- if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
1377
- return "right";
1378
- }
1379
-
1380
- return "left";
1381
- }
1382
- };
1383
-
1384
- exports.siblingDirection = siblingDirection;
1385
-
1386
- var slidesOnRight = function slidesOnRight(_ref) {
1387
- var slidesToShow = _ref.slidesToShow,
1388
- centerMode = _ref.centerMode,
1389
- rtl = _ref.rtl,
1390
- centerPadding = _ref.centerPadding;
1391
-
1392
- // returns no of slides on the right of active slide
1393
- if (centerMode) {
1394
- var right = (slidesToShow - 1) / 2 + 1;
1395
- if (parseInt(centerPadding) > 0) right += 1;
1396
- if (rtl && slidesToShow % 2 === 0) right += 1;
1397
- return right;
1398
- }
1399
-
1400
- if (rtl) {
1401
- return 0;
1402
- }
1403
-
1404
- return slidesToShow - 1;
1405
- };
1406
-
1407
- exports.slidesOnRight = slidesOnRight;
1408
-
1409
- var slidesOnLeft = function slidesOnLeft(_ref2) {
1410
- var slidesToShow = _ref2.slidesToShow,
1411
- centerMode = _ref2.centerMode,
1412
- rtl = _ref2.rtl,
1413
- centerPadding = _ref2.centerPadding;
1414
-
1415
- // returns no of slides on the left of active slide
1416
- if (centerMode) {
1417
- var left = (slidesToShow - 1) / 2 + 1;
1418
- if (parseInt(centerPadding) > 0) left += 1;
1419
- if (!rtl && slidesToShow % 2 === 0) left += 1;
1420
- return left;
1421
- }
1422
-
1423
- if (rtl) {
1424
- return slidesToShow - 1;
1425
- }
1426
-
1427
- return 0;
1428
- };
1429
-
1430
- exports.slidesOnLeft = slidesOnLeft;
1431
-
1432
- var canUseDOM = function canUseDOM() {
1433
- return !!(typeof window !== "undefined" && window.document && window.document.createElement);
1434
- };
1435
-
1436
- exports.canUseDOM = canUseDOM;
1437
- });
1438
-
1439
- unwrapExports(innerSliderUtils);
1440
- innerSliderUtils.checkSpecKeys;
1441
- innerSliderUtils.checkNavigable;
1442
- innerSliderUtils.changeSlide;
1443
- innerSliderUtils.canUseDOM;
1444
- innerSliderUtils.canGoNext;
1445
- innerSliderUtils.clamp;
1446
- innerSliderUtils.swipeStart;
1447
- innerSliderUtils.swipeMove;
1448
- innerSliderUtils.swipeEnd;
1449
- innerSliderUtils.slidesOnRight;
1450
- innerSliderUtils.slidesOnLeft;
1451
- innerSliderUtils.slideHandler;
1452
- innerSliderUtils.siblingDirection;
1453
- innerSliderUtils.safePreventDefault;
1454
- innerSliderUtils.lazyStartIndex;
1455
- innerSliderUtils.lazySlidesOnRight;
1456
- innerSliderUtils.lazySlidesOnLeft;
1457
- innerSliderUtils.lazyEndIndex;
1458
- innerSliderUtils.keyHandler;
1459
- innerSliderUtils.initializedState;
1460
- innerSliderUtils.getWidth;
1461
- innerSliderUtils.getTrackLeft;
1462
- innerSliderUtils.getTrackCSS;
1463
- innerSliderUtils.getTrackAnimateCSS;
1464
- innerSliderUtils.getTotalSlides;
1465
- innerSliderUtils.getSwipeDirection;
1466
- innerSliderUtils.getSlideCount;
1467
- innerSliderUtils.getRequiredLazySlides;
1468
- innerSliderUtils.getPreClones;
1469
- innerSliderUtils.getPostClones;
1470
- innerSliderUtils.getOnDemandLazySlides;
1471
- innerSliderUtils.getNavigableIndexes;
1472
- innerSliderUtils.getHeight;
1473
- innerSliderUtils.extractObject;
1474
-
1475
- var track = createCommonjsModule(function (module, exports) {
1476
-
1477
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1478
-
1479
- Object.defineProperty(exports, "__esModule", {
1480
- value: true
1481
- });
1482
- exports.Track = void 0;
1483
-
1484
- var _react = _interopRequireDefault(React__default);
1485
-
1486
- var _classnames = _interopRequireDefault(classnames);
1487
-
1488
-
1489
-
1490
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1491
-
1492
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1493
-
1494
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1495
-
1496
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1497
-
1498
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1499
-
1500
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1501
-
1502
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1503
-
1504
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1505
-
1506
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
1507
-
1508
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1509
-
1510
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1511
-
1512
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1513
-
1514
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1515
-
1516
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1517
-
1518
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1519
-
1520
- // given specifications/props for a slide, fetch all the classes that need to be applied to the slide
1521
- var getSlideClasses = function getSlideClasses(spec) {
1522
- var slickActive, slickCenter, slickCloned;
1523
- var centerOffset, index;
1524
-
1525
- if (spec.rtl) {
1526
- index = spec.slideCount - 1 - spec.index;
1527
- } else {
1528
- index = spec.index;
1529
- }
1530
-
1531
- slickCloned = index < 0 || index >= spec.slideCount;
1532
-
1533
- if (spec.centerMode) {
1534
- centerOffset = Math.floor(spec.slidesToShow / 2);
1535
- slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
1536
-
1537
- if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
1538
- slickActive = true;
1539
- }
1540
- } else {
1541
- slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
1542
- }
1543
-
1544
- var focusedSlide;
1545
-
1546
- if (spec.targetSlide < 0) {
1547
- focusedSlide = spec.targetSlide + spec.slideCount;
1548
- } else if (spec.targetSlide >= spec.slideCount) {
1549
- focusedSlide = spec.targetSlide - spec.slideCount;
1550
- } else {
1551
- focusedSlide = spec.targetSlide;
1552
- }
1553
-
1554
- var slickCurrent = index === focusedSlide;
1555
- return {
1556
- "slick-slide": true,
1557
- "slick-active": slickActive,
1558
- "slick-center": slickCenter,
1559
- "slick-cloned": slickCloned,
1560
- "slick-current": slickCurrent // dubious in case of RTL
1561
-
1562
- };
1563
- };
1564
-
1565
- var getSlideStyle = function getSlideStyle(spec) {
1566
- var style = {};
1567
-
1568
- if (spec.variableWidth === undefined || spec.variableWidth === false) {
1569
- style.width = spec.slideWidth;
1570
- }
1571
-
1572
- if (spec.fade) {
1573
- style.position = "relative";
1574
-
1575
- if (spec.vertical) {
1576
- style.top = -spec.index * parseInt(spec.slideHeight);
1577
- } else {
1578
- style.left = -spec.index * parseInt(spec.slideWidth);
1579
- }
1580
-
1581
- style.opacity = spec.currentSlide === spec.index ? 1 : 0;
1582
-
1583
- if (spec.useCSS) {
1584
- style.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", " + "visibility " + spec.speed + "ms " + spec.cssEase;
1585
- }
1586
- }
1587
-
1588
- return style;
1589
- };
1590
-
1591
- var getKey = function getKey(child, fallbackKey) {
1592
- return child.key || fallbackKey;
1593
- };
1594
-
1595
- var renderSlides = function renderSlides(spec) {
1596
- var key;
1597
- var slides = [];
1598
- var preCloneSlides = [];
1599
- var postCloneSlides = [];
1600
-
1601
- var childrenCount = _react["default"].Children.count(spec.children);
1602
-
1603
- var startIndex = (0, innerSliderUtils.lazyStartIndex)(spec);
1604
- var endIndex = (0, innerSliderUtils.lazyEndIndex)(spec);
1605
-
1606
- _react["default"].Children.forEach(spec.children, function (elem, index) {
1607
- var child;
1608
- var childOnClickOptions = {
1609
- message: "children",
1610
- index: index,
1611
- slidesToScroll: spec.slidesToScroll,
1612
- currentSlide: spec.currentSlide
1613
- }; // in case of lazyLoad, whether or not we want to fetch the slide
1614
-
1615
- if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0) {
1616
- child = elem;
1617
- } else {
1618
- child = /*#__PURE__*/_react["default"].createElement("div", null);
1619
- }
1620
-
1621
- var childStyle = getSlideStyle(_objectSpread(_objectSpread({}, spec), {}, {
1622
- index: index
1623
- }));
1624
- var slideClass = child.props.className || "";
1625
- var slideClasses = getSlideClasses(_objectSpread(_objectSpread({}, spec), {}, {
1626
- index: index
1627
- })); // push a cloned element of the desired slide
1628
-
1629
- slides.push( /*#__PURE__*/_react["default"].cloneElement(child, {
1630
- key: "original" + getKey(child, index),
1631
- "data-index": index,
1632
- className: (0, _classnames["default"])(slideClasses, slideClass),
1633
- tabIndex: "-1",
1634
- "aria-hidden": !slideClasses["slick-active"],
1635
- style: _objectSpread(_objectSpread({
1636
- outline: "none"
1637
- }, child.props.style || {}), childStyle),
1638
- onClick: function onClick(e) {
1639
- child.props && child.props.onClick && child.props.onClick(e);
1640
-
1641
- if (spec.focusOnSelect) {
1642
- spec.focusOnSelect(childOnClickOptions);
1643
- }
1644
- }
1645
- })); // if slide needs to be precloned or postcloned
1646
-
1647
- if (spec.infinite && spec.fade === false) {
1648
- var preCloneNo = childrenCount - index;
1649
-
1650
- if (preCloneNo <= (0, innerSliderUtils.getPreClones)(spec) && childrenCount !== spec.slidesToShow) {
1651
- key = -preCloneNo;
1652
-
1653
- if (key >= startIndex) {
1654
- child = elem;
1655
- }
1656
-
1657
- slideClasses = getSlideClasses(_objectSpread(_objectSpread({}, spec), {}, {
1658
- index: key
1659
- }));
1660
- preCloneSlides.push( /*#__PURE__*/_react["default"].cloneElement(child, {
1661
- key: "precloned" + getKey(child, key),
1662
- "data-index": key,
1663
- tabIndex: "-1",
1664
- className: (0, _classnames["default"])(slideClasses, slideClass),
1665
- "aria-hidden": !slideClasses["slick-active"],
1666
- style: _objectSpread(_objectSpread({}, child.props.style || {}), childStyle),
1667
- onClick: function onClick(e) {
1668
- child.props && child.props.onClick && child.props.onClick(e);
1669
-
1670
- if (spec.focusOnSelect) {
1671
- spec.focusOnSelect(childOnClickOptions);
1672
- }
1673
- }
1674
- }));
1675
- }
1676
-
1677
- if (childrenCount !== spec.slidesToShow) {
1678
- key = childrenCount + index;
1679
-
1680
- if (key < endIndex) {
1681
- child = elem;
1682
- }
1683
-
1684
- slideClasses = getSlideClasses(_objectSpread(_objectSpread({}, spec), {}, {
1685
- index: key
1686
- }));
1687
- postCloneSlides.push( /*#__PURE__*/_react["default"].cloneElement(child, {
1688
- key: "postcloned" + getKey(child, key),
1689
- "data-index": key,
1690
- tabIndex: "-1",
1691
- className: (0, _classnames["default"])(slideClasses, slideClass),
1692
- "aria-hidden": !slideClasses["slick-active"],
1693
- style: _objectSpread(_objectSpread({}, child.props.style || {}), childStyle),
1694
- onClick: function onClick(e) {
1695
- child.props && child.props.onClick && child.props.onClick(e);
1696
-
1697
- if (spec.focusOnSelect) {
1698
- spec.focusOnSelect(childOnClickOptions);
1699
- }
1700
- }
1701
- }));
1702
- }
1703
- }
1704
- });
1705
-
1706
- if (spec.rtl) {
1707
- return preCloneSlides.concat(slides, postCloneSlides).reverse();
1708
- } else {
1709
- return preCloneSlides.concat(slides, postCloneSlides);
1710
- }
1711
- };
1712
-
1713
- var Track = /*#__PURE__*/function (_React$PureComponent) {
1714
- _inherits(Track, _React$PureComponent);
1715
-
1716
- var _super = _createSuper(Track);
1717
-
1718
- function Track() {
1719
- var _this;
1720
-
1721
- _classCallCheck(this, Track);
1722
-
1723
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1724
- args[_key] = arguments[_key];
1725
- }
1726
-
1727
- _this = _super.call.apply(_super, [this].concat(args));
1728
-
1729
- _defineProperty(_assertThisInitialized(_this), "node", null);
1730
-
1731
- _defineProperty(_assertThisInitialized(_this), "handleRef", function (ref) {
1732
- _this.node = ref;
1733
- });
1734
-
1735
- return _this;
1736
- }
1737
-
1738
- _createClass(Track, [{
1739
- key: "render",
1740
- value: function render() {
1741
- var slides = renderSlides(this.props);
1742
- var _this$props = this.props,
1743
- onMouseEnter = _this$props.onMouseEnter,
1744
- onMouseOver = _this$props.onMouseOver,
1745
- onMouseLeave = _this$props.onMouseLeave;
1746
- var mouseEvents = {
1747
- onMouseEnter: onMouseEnter,
1748
- onMouseOver: onMouseOver,
1749
- onMouseLeave: onMouseLeave
1750
- };
1751
- return /*#__PURE__*/_react["default"].createElement("div", _extends({
1752
- ref: this.handleRef,
1753
- className: "slick-track",
1754
- style: this.props.trackStyle
1755
- }, mouseEvents), slides);
1756
- }
1757
- }]);
1758
-
1759
- return Track;
1760
- }(_react["default"].PureComponent);
1761
-
1762
- exports.Track = Track;
1763
- });
1764
-
1765
- unwrapExports(track);
1766
- track.Track;
1767
-
1768
- var dots = createCommonjsModule(function (module, exports) {
1769
-
1770
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1771
-
1772
- Object.defineProperty(exports, "__esModule", {
1773
- value: true
1774
- });
1775
- exports.Dots = void 0;
1776
-
1777
- var _react = _interopRequireDefault(React__default);
1778
-
1779
- var _classnames = _interopRequireDefault(classnames);
1780
-
1781
-
1782
-
1783
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1784
-
1785
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1786
-
1787
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1788
-
1789
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1790
-
1791
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1792
-
1793
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1794
-
1795
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1796
-
1797
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1798
-
1799
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1800
-
1801
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1802
-
1803
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
1804
-
1805
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1806
-
1807
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1808
-
1809
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1810
-
1811
- var getDotCount = function getDotCount(spec) {
1812
- var dots;
1813
-
1814
- if (spec.infinite) {
1815
- dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
1816
- } else {
1817
- dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
1818
- }
1819
-
1820
- return dots;
1821
- };
1822
-
1823
- var Dots = /*#__PURE__*/function (_React$PureComponent) {
1824
- _inherits(Dots, _React$PureComponent);
1825
-
1826
- var _super = _createSuper(Dots);
1827
-
1828
- function Dots() {
1829
- _classCallCheck(this, Dots);
1830
-
1831
- return _super.apply(this, arguments);
1832
- }
1833
-
1834
- _createClass(Dots, [{
1835
- key: "clickHandler",
1836
- value: function clickHandler(options, e) {
1837
- // In Autoplay the focus stays on clicked button even after transition
1838
- // to next slide. That only goes away by click somewhere outside
1839
- e.preventDefault();
1840
- this.props.clickHandler(options);
1841
- }
1842
- }, {
1843
- key: "render",
1844
- value: function render() {
1845
- var _this$props = this.props,
1846
- onMouseEnter = _this$props.onMouseEnter,
1847
- onMouseOver = _this$props.onMouseOver,
1848
- onMouseLeave = _this$props.onMouseLeave,
1849
- infinite = _this$props.infinite,
1850
- slidesToScroll = _this$props.slidesToScroll,
1851
- slidesToShow = _this$props.slidesToShow,
1852
- slideCount = _this$props.slideCount,
1853
- currentSlide = _this$props.currentSlide;
1854
- var dotCount = getDotCount({
1855
- slideCount: slideCount,
1856
- slidesToScroll: slidesToScroll,
1857
- slidesToShow: slidesToShow,
1858
- infinite: infinite
1859
- });
1860
- var mouseEvents = {
1861
- onMouseEnter: onMouseEnter,
1862
- onMouseOver: onMouseOver,
1863
- onMouseLeave: onMouseLeave
1864
- };
1865
- var dots = [];
1866
-
1867
- for (var i = 0; i < dotCount; i++) {
1868
- var _rightBound = (i + 1) * slidesToScroll - 1;
1869
-
1870
- var rightBound = infinite ? _rightBound : (0, innerSliderUtils.clamp)(_rightBound, 0, slideCount - 1);
1871
-
1872
- var _leftBound = rightBound - (slidesToScroll - 1);
1873
-
1874
- var leftBound = infinite ? _leftBound : (0, innerSliderUtils.clamp)(_leftBound, 0, slideCount - 1);
1875
- var className = (0, _classnames["default"])({
1876
- "slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
1877
- });
1878
- var dotOptions = {
1879
- message: "dots",
1880
- index: i,
1881
- slidesToScroll: slidesToScroll,
1882
- currentSlide: currentSlide
1883
- };
1884
- var onClick = this.clickHandler.bind(this, dotOptions);
1885
- dots = dots.concat( /*#__PURE__*/_react["default"].createElement("li", {
1886
- key: i,
1887
- className: className
1888
- }, /*#__PURE__*/_react["default"].cloneElement(this.props.customPaging(i), {
1889
- onClick: onClick
1890
- })));
1891
- }
1892
-
1893
- return /*#__PURE__*/_react["default"].cloneElement(this.props.appendDots(dots), _objectSpread({
1894
- className: this.props.dotsClass
1895
- }, mouseEvents));
1896
- }
1897
- }]);
1898
-
1899
- return Dots;
1900
- }(_react["default"].PureComponent);
1901
-
1902
- exports.Dots = Dots;
1903
- });
1904
-
1905
- unwrapExports(dots);
1906
- dots.Dots;
1907
-
1908
- var arrows = createCommonjsModule(function (module, exports) {
1909
-
1910
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1911
-
1912
- Object.defineProperty(exports, "__esModule", {
1913
- value: true
1914
- });
1915
- exports.PrevArrow = exports.NextArrow = void 0;
1916
-
1917
- var _react = _interopRequireDefault(React__default);
1918
-
1919
- var _classnames = _interopRequireDefault(classnames);
1920
-
1921
-
1922
-
1923
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1924
-
1925
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1926
-
1927
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1928
-
1929
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1930
-
1931
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1932
-
1933
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1934
-
1935
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1936
-
1937
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1938
-
1939
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1940
-
1941
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1942
-
1943
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1944
-
1945
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
1946
-
1947
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1948
-
1949
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1950
-
1951
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1952
-
1953
- var PrevArrow = /*#__PURE__*/function (_React$PureComponent) {
1954
- _inherits(PrevArrow, _React$PureComponent);
1955
-
1956
- var _super = _createSuper(PrevArrow);
1957
-
1958
- function PrevArrow() {
1959
- _classCallCheck(this, PrevArrow);
1960
-
1961
- return _super.apply(this, arguments);
1962
- }
1963
-
1964
- _createClass(PrevArrow, [{
1965
- key: "clickHandler",
1966
- value: function clickHandler(options, e) {
1967
- if (e) {
1968
- e.preventDefault();
1969
- }
1970
-
1971
- this.props.clickHandler(options, e);
1972
- }
1973
- }, {
1974
- key: "render",
1975
- value: function render() {
1976
- var prevClasses = {
1977
- "slick-arrow": true,
1978
- "slick-prev": true
1979
- };
1980
- var prevHandler = this.clickHandler.bind(this, {
1981
- message: "previous"
1982
- });
1983
-
1984
- if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
1985
- prevClasses["slick-disabled"] = true;
1986
- prevHandler = null;
1987
- }
1988
-
1989
- var prevArrowProps = {
1990
- key: "0",
1991
- "data-role": "none",
1992
- className: (0, _classnames["default"])(prevClasses),
1993
- style: {
1994
- display: "block"
1995
- },
1996
- onClick: prevHandler
1997
- };
1998
- var customProps = {
1999
- currentSlide: this.props.currentSlide,
2000
- slideCount: this.props.slideCount
2001
- };
2002
- var prevArrow;
2003
-
2004
- if (this.props.prevArrow) {
2005
- prevArrow = /*#__PURE__*/_react["default"].cloneElement(this.props.prevArrow, _objectSpread(_objectSpread({}, prevArrowProps), customProps));
2006
- } else {
2007
- prevArrow = /*#__PURE__*/_react["default"].createElement("button", _extends({
2008
- key: "0",
2009
- type: "button"
2010
- }, prevArrowProps), " ", "Previous");
2011
- }
2012
-
2013
- return prevArrow;
2014
- }
2015
- }]);
2016
-
2017
- return PrevArrow;
2018
- }(_react["default"].PureComponent);
2019
-
2020
- exports.PrevArrow = PrevArrow;
2021
-
2022
- var NextArrow = /*#__PURE__*/function (_React$PureComponent2) {
2023
- _inherits(NextArrow, _React$PureComponent2);
2024
-
2025
- var _super2 = _createSuper(NextArrow);
2026
-
2027
- function NextArrow() {
2028
- _classCallCheck(this, NextArrow);
2029
-
2030
- return _super2.apply(this, arguments);
2031
- }
2032
-
2033
- _createClass(NextArrow, [{
2034
- key: "clickHandler",
2035
- value: function clickHandler(options, e) {
2036
- if (e) {
2037
- e.preventDefault();
2038
- }
2039
-
2040
- this.props.clickHandler(options, e);
2041
- }
2042
- }, {
2043
- key: "render",
2044
- value: function render() {
2045
- var nextClasses = {
2046
- "slick-arrow": true,
2047
- "slick-next": true
2048
- };
2049
- var nextHandler = this.clickHandler.bind(this, {
2050
- message: "next"
2051
- });
2052
-
2053
- if (!(0, innerSliderUtils.canGoNext)(this.props)) {
2054
- nextClasses["slick-disabled"] = true;
2055
- nextHandler = null;
2056
- }
2057
-
2058
- var nextArrowProps = {
2059
- key: "1",
2060
- "data-role": "none",
2061
- className: (0, _classnames["default"])(nextClasses),
2062
- style: {
2063
- display: "block"
2064
- },
2065
- onClick: nextHandler
2066
- };
2067
- var customProps = {
2068
- currentSlide: this.props.currentSlide,
2069
- slideCount: this.props.slideCount
2070
- };
2071
- var nextArrow;
2072
-
2073
- if (this.props.nextArrow) {
2074
- nextArrow = /*#__PURE__*/_react["default"].cloneElement(this.props.nextArrow, _objectSpread(_objectSpread({}, nextArrowProps), customProps));
2075
- } else {
2076
- nextArrow = /*#__PURE__*/_react["default"].createElement("button", _extends({
2077
- key: "1",
2078
- type: "button"
2079
- }, nextArrowProps), " ", "Next");
2080
- }
2081
-
2082
- return nextArrow;
2083
- }
2084
- }]);
2085
-
2086
- return NextArrow;
2087
- }(_react["default"].PureComponent);
2088
-
2089
- exports.NextArrow = NextArrow;
2090
- });
2091
-
2092
- unwrapExports(arrows);
2093
- arrows.PrevArrow;
2094
- arrows.NextArrow;
2095
-
2096
- /**
2097
- * A collection of shims that provide minimal functionality of the ES6 collections.
2098
- *
2099
- * These implementations are not meant to be used outside of the ResizeObserver
2100
- * modules as they cover only a limited range of use cases.
2101
- */
2102
- /* eslint-disable require-jsdoc, valid-jsdoc */
2103
- var MapShim = (function () {
2104
- if (typeof Map !== 'undefined') {
2105
- return Map;
2106
- }
2107
- /**
2108
- * Returns index in provided array that matches the specified key.
2109
- *
2110
- * @param {Array<Array>} arr
2111
- * @param {*} key
2112
- * @returns {number}
2113
- */
2114
- function getIndex(arr, key) {
2115
- var result = -1;
2116
- arr.some(function (entry, index) {
2117
- if (entry[0] === key) {
2118
- result = index;
2119
- return true;
2120
- }
2121
- return false;
2122
- });
2123
- return result;
2124
- }
2125
- return /** @class */ (function () {
2126
- function class_1() {
2127
- this.__entries__ = [];
2128
- }
2129
- Object.defineProperty(class_1.prototype, "size", {
2130
- /**
2131
- * @returns {boolean}
2132
- */
2133
- get: function () {
2134
- return this.__entries__.length;
2135
- },
2136
- enumerable: true,
2137
- configurable: true
2138
- });
2139
- /**
2140
- * @param {*} key
2141
- * @returns {*}
2142
- */
2143
- class_1.prototype.get = function (key) {
2144
- var index = getIndex(this.__entries__, key);
2145
- var entry = this.__entries__[index];
2146
- return entry && entry[1];
2147
- };
2148
- /**
2149
- * @param {*} key
2150
- * @param {*} value
2151
- * @returns {void}
2152
- */
2153
- class_1.prototype.set = function (key, value) {
2154
- var index = getIndex(this.__entries__, key);
2155
- if (~index) {
2156
- this.__entries__[index][1] = value;
2157
- }
2158
- else {
2159
- this.__entries__.push([key, value]);
2160
- }
2161
- };
2162
- /**
2163
- * @param {*} key
2164
- * @returns {void}
2165
- */
2166
- class_1.prototype.delete = function (key) {
2167
- var entries = this.__entries__;
2168
- var index = getIndex(entries, key);
2169
- if (~index) {
2170
- entries.splice(index, 1);
2171
- }
2172
- };
2173
- /**
2174
- * @param {*} key
2175
- * @returns {void}
2176
- */
2177
- class_1.prototype.has = function (key) {
2178
- return !!~getIndex(this.__entries__, key);
2179
- };
2180
- /**
2181
- * @returns {void}
2182
- */
2183
- class_1.prototype.clear = function () {
2184
- this.__entries__.splice(0);
2185
- };
2186
- /**
2187
- * @param {Function} callback
2188
- * @param {*} [ctx=null]
2189
- * @returns {void}
2190
- */
2191
- class_1.prototype.forEach = function (callback, ctx) {
2192
- if (ctx === void 0) { ctx = null; }
2193
- for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
2194
- var entry = _a[_i];
2195
- callback.call(ctx, entry[1], entry[0]);
2196
- }
2197
- };
2198
- return class_1;
2199
- }());
2200
- })();
2201
-
2202
- /**
2203
- * Detects whether window and document objects are available in current environment.
2204
- */
2205
- var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
2206
-
2207
- // Returns global object of a current environment.
2208
- var global$1 = (function () {
2209
- if (typeof global !== 'undefined' && global.Math === Math) {
2210
- return global;
2211
- }
2212
- if (typeof self !== 'undefined' && self.Math === Math) {
2213
- return self;
2214
- }
2215
- if (typeof window !== 'undefined' && window.Math === Math) {
2216
- return window;
2217
- }
2218
- // eslint-disable-next-line no-new-func
2219
- return Function('return this')();
2220
- })();
2221
-
2222
- /**
2223
- * A shim for the requestAnimationFrame which falls back to the setTimeout if
2224
- * first one is not supported.
2225
- *
2226
- * @returns {number} Requests' identifier.
2227
- */
2228
- var requestAnimationFrame$1 = (function () {
2229
- if (typeof requestAnimationFrame === 'function') {
2230
- // It's required to use a bounded function because IE sometimes throws
2231
- // an "Invalid calling object" error if rAF is invoked without the global
2232
- // object on the left hand side.
2233
- return requestAnimationFrame.bind(global$1);
2234
- }
2235
- return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
2236
- })();
2237
-
2238
- // Defines minimum timeout before adding a trailing call.
2239
- var trailingTimeout = 2;
2240
- /**
2241
- * Creates a wrapper function which ensures that provided callback will be
2242
- * invoked only once during the specified delay period.
2243
- *
2244
- * @param {Function} callback - Function to be invoked after the delay period.
2245
- * @param {number} delay - Delay after which to invoke callback.
2246
- * @returns {Function}
2247
- */
2248
- function throttle (callback, delay) {
2249
- var leadingCall = false, trailingCall = false, lastCallTime = 0;
2250
- /**
2251
- * Invokes the original callback function and schedules new invocation if
2252
- * the "proxy" was called during current request.
2253
- *
2254
- * @returns {void}
2255
- */
2256
- function resolvePending() {
2257
- if (leadingCall) {
2258
- leadingCall = false;
2259
- callback();
2260
- }
2261
- if (trailingCall) {
2262
- proxy();
2263
- }
2264
- }
2265
- /**
2266
- * Callback invoked after the specified delay. It will further postpone
2267
- * invocation of the original function delegating it to the
2268
- * requestAnimationFrame.
2269
- *
2270
- * @returns {void}
2271
- */
2272
- function timeoutCallback() {
2273
- requestAnimationFrame$1(resolvePending);
2274
- }
2275
- /**
2276
- * Schedules invocation of the original function.
2277
- *
2278
- * @returns {void}
2279
- */
2280
- function proxy() {
2281
- var timeStamp = Date.now();
2282
- if (leadingCall) {
2283
- // Reject immediately following calls.
2284
- if (timeStamp - lastCallTime < trailingTimeout) {
2285
- return;
2286
- }
2287
- // Schedule new call to be in invoked when the pending one is resolved.
2288
- // This is important for "transitions" which never actually start
2289
- // immediately so there is a chance that we might miss one if change
2290
- // happens amids the pending invocation.
2291
- trailingCall = true;
2292
- }
2293
- else {
2294
- leadingCall = true;
2295
- trailingCall = false;
2296
- setTimeout(timeoutCallback, delay);
2297
- }
2298
- lastCallTime = timeStamp;
2299
- }
2300
- return proxy;
2301
- }
2302
-
2303
- // Minimum delay before invoking the update of observers.
2304
- var REFRESH_DELAY = 20;
2305
- // A list of substrings of CSS properties used to find transition events that
2306
- // might affect dimensions of observed elements.
2307
- var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
2308
- // Check if MutationObserver is available.
2309
- var mutationObserverSupported = typeof MutationObserver !== 'undefined';
2310
- /**
2311
- * Singleton controller class which handles updates of ResizeObserver instances.
2312
- */
2313
- var ResizeObserverController = /** @class */ (function () {
2314
- /**
2315
- * Creates a new instance of ResizeObserverController.
2316
- *
2317
- * @private
2318
- */
2319
- function ResizeObserverController() {
2320
- /**
2321
- * Indicates whether DOM listeners have been added.
2322
- *
2323
- * @private {boolean}
2324
- */
2325
- this.connected_ = false;
2326
- /**
2327
- * Tells that controller has subscribed for Mutation Events.
2328
- *
2329
- * @private {boolean}
2330
- */
2331
- this.mutationEventsAdded_ = false;
2332
- /**
2333
- * Keeps reference to the instance of MutationObserver.
2334
- *
2335
- * @private {MutationObserver}
2336
- */
2337
- this.mutationsObserver_ = null;
2338
- /**
2339
- * A list of connected observers.
2340
- *
2341
- * @private {Array<ResizeObserverSPI>}
2342
- */
2343
- this.observers_ = [];
2344
- this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
2345
- this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
2346
- }
2347
- /**
2348
- * Adds observer to observers list.
2349
- *
2350
- * @param {ResizeObserverSPI} observer - Observer to be added.
2351
- * @returns {void}
2352
- */
2353
- ResizeObserverController.prototype.addObserver = function (observer) {
2354
- if (!~this.observers_.indexOf(observer)) {
2355
- this.observers_.push(observer);
2356
- }
2357
- // Add listeners if they haven't been added yet.
2358
- if (!this.connected_) {
2359
- this.connect_();
2360
- }
2361
- };
2362
- /**
2363
- * Removes observer from observers list.
2364
- *
2365
- * @param {ResizeObserverSPI} observer - Observer to be removed.
2366
- * @returns {void}
2367
- */
2368
- ResizeObserverController.prototype.removeObserver = function (observer) {
2369
- var observers = this.observers_;
2370
- var index = observers.indexOf(observer);
2371
- // Remove observer if it's present in registry.
2372
- if (~index) {
2373
- observers.splice(index, 1);
2374
- }
2375
- // Remove listeners if controller has no connected observers.
2376
- if (!observers.length && this.connected_) {
2377
- this.disconnect_();
2378
- }
2379
- };
2380
- /**
2381
- * Invokes the update of observers. It will continue running updates insofar
2382
- * it detects changes.
2383
- *
2384
- * @returns {void}
2385
- */
2386
- ResizeObserverController.prototype.refresh = function () {
2387
- var changesDetected = this.updateObservers_();
2388
- // Continue running updates if changes have been detected as there might
2389
- // be future ones caused by CSS transitions.
2390
- if (changesDetected) {
2391
- this.refresh();
2392
- }
2393
- };
2394
- /**
2395
- * Updates every observer from observers list and notifies them of queued
2396
- * entries.
2397
- *
2398
- * @private
2399
- * @returns {boolean} Returns "true" if any observer has detected changes in
2400
- * dimensions of it's elements.
2401
- */
2402
- ResizeObserverController.prototype.updateObservers_ = function () {
2403
- // Collect observers that have active observations.
2404
- var activeObservers = this.observers_.filter(function (observer) {
2405
- return observer.gatherActive(), observer.hasActive();
2406
- });
2407
- // Deliver notifications in a separate cycle in order to avoid any
2408
- // collisions between observers, e.g. when multiple instances of
2409
- // ResizeObserver are tracking the same element and the callback of one
2410
- // of them changes content dimensions of the observed target. Sometimes
2411
- // this may result in notifications being blocked for the rest of observers.
2412
- activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
2413
- return activeObservers.length > 0;
2414
- };
2415
- /**
2416
- * Initializes DOM listeners.
2417
- *
2418
- * @private
2419
- * @returns {void}
2420
- */
2421
- ResizeObserverController.prototype.connect_ = function () {
2422
- // Do nothing if running in a non-browser environment or if listeners
2423
- // have been already added.
2424
- if (!isBrowser || this.connected_) {
2425
- return;
2426
- }
2427
- // Subscription to the "Transitionend" event is used as a workaround for
2428
- // delayed transitions. This way it's possible to capture at least the
2429
- // final state of an element.
2430
- document.addEventListener('transitionend', this.onTransitionEnd_);
2431
- window.addEventListener('resize', this.refresh);
2432
- if (mutationObserverSupported) {
2433
- this.mutationsObserver_ = new MutationObserver(this.refresh);
2434
- this.mutationsObserver_.observe(document, {
2435
- attributes: true,
2436
- childList: true,
2437
- characterData: true,
2438
- subtree: true
2439
- });
2440
- }
2441
- else {
2442
- document.addEventListener('DOMSubtreeModified', this.refresh);
2443
- this.mutationEventsAdded_ = true;
2444
- }
2445
- this.connected_ = true;
2446
- };
2447
- /**
2448
- * Removes DOM listeners.
2449
- *
2450
- * @private
2451
- * @returns {void}
2452
- */
2453
- ResizeObserverController.prototype.disconnect_ = function () {
2454
- // Do nothing if running in a non-browser environment or if listeners
2455
- // have been already removed.
2456
- if (!isBrowser || !this.connected_) {
2457
- return;
2458
- }
2459
- document.removeEventListener('transitionend', this.onTransitionEnd_);
2460
- window.removeEventListener('resize', this.refresh);
2461
- if (this.mutationsObserver_) {
2462
- this.mutationsObserver_.disconnect();
2463
- }
2464
- if (this.mutationEventsAdded_) {
2465
- document.removeEventListener('DOMSubtreeModified', this.refresh);
2466
- }
2467
- this.mutationsObserver_ = null;
2468
- this.mutationEventsAdded_ = false;
2469
- this.connected_ = false;
2470
- };
2471
- /**
2472
- * "Transitionend" event handler.
2473
- *
2474
- * @private
2475
- * @param {TransitionEvent} event
2476
- * @returns {void}
2477
- */
2478
- ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
2479
- var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
2480
- // Detect whether transition may affect dimensions of an element.
2481
- var isReflowProperty = transitionKeys.some(function (key) {
2482
- return !!~propertyName.indexOf(key);
2483
- });
2484
- if (isReflowProperty) {
2485
- this.refresh();
2486
- }
2487
- };
2488
- /**
2489
- * Returns instance of the ResizeObserverController.
2490
- *
2491
- * @returns {ResizeObserverController}
2492
- */
2493
- ResizeObserverController.getInstance = function () {
2494
- if (!this.instance_) {
2495
- this.instance_ = new ResizeObserverController();
2496
- }
2497
- return this.instance_;
2498
- };
2499
- /**
2500
- * Holds reference to the controller's instance.
2501
- *
2502
- * @private {ResizeObserverController}
2503
- */
2504
- ResizeObserverController.instance_ = null;
2505
- return ResizeObserverController;
2506
- }());
2507
-
2508
- /**
2509
- * Defines non-writable/enumerable properties of the provided target object.
2510
- *
2511
- * @param {Object} target - Object for which to define properties.
2512
- * @param {Object} props - Properties to be defined.
2513
- * @returns {Object} Target object.
2514
- */
2515
- var defineConfigurable = (function (target, props) {
2516
- for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
2517
- var key = _a[_i];
2518
- Object.defineProperty(target, key, {
2519
- value: props[key],
2520
- enumerable: false,
2521
- writable: false,
2522
- configurable: true
2523
- });
2524
- }
2525
- return target;
2526
- });
2527
-
2528
- /**
2529
- * Returns the global object associated with provided element.
2530
- *
2531
- * @param {Object} target
2532
- * @returns {Object}
2533
- */
2534
- var getWindowOf = (function (target) {
2535
- // Assume that the element is an instance of Node, which means that it
2536
- // has the "ownerDocument" property from which we can retrieve a
2537
- // corresponding global object.
2538
- var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
2539
- // Return the local global object if it's not possible extract one from
2540
- // provided element.
2541
- return ownerGlobal || global$1;
2542
- });
2543
-
2544
- // Placeholder of an empty content rectangle.
2545
- var emptyRect = createRectInit(0, 0, 0, 0);
2546
- /**
2547
- * Converts provided string to a number.
2548
- *
2549
- * @param {number|string} value
2550
- * @returns {number}
2551
- */
2552
- function toFloat(value) {
2553
- return parseFloat(value) || 0;
2554
- }
2555
- /**
2556
- * Extracts borders size from provided styles.
2557
- *
2558
- * @param {CSSStyleDeclaration} styles
2559
- * @param {...string} positions - Borders positions (top, right, ...)
2560
- * @returns {number}
2561
- */
2562
- function getBordersSize(styles) {
2563
- var positions = [];
2564
- for (var _i = 1; _i < arguments.length; _i++) {
2565
- positions[_i - 1] = arguments[_i];
2566
- }
2567
- return positions.reduce(function (size, position) {
2568
- var value = styles['border-' + position + '-width'];
2569
- return size + toFloat(value);
2570
- }, 0);
2571
- }
2572
- /**
2573
- * Extracts paddings sizes from provided styles.
2574
- *
2575
- * @param {CSSStyleDeclaration} styles
2576
- * @returns {Object} Paddings box.
2577
- */
2578
- function getPaddings(styles) {
2579
- var positions = ['top', 'right', 'bottom', 'left'];
2580
- var paddings = {};
2581
- for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
2582
- var position = positions_1[_i];
2583
- var value = styles['padding-' + position];
2584
- paddings[position] = toFloat(value);
2585
- }
2586
- return paddings;
2587
- }
2588
- /**
2589
- * Calculates content rectangle of provided SVG element.
2590
- *
2591
- * @param {SVGGraphicsElement} target - Element content rectangle of which needs
2592
- * to be calculated.
2593
- * @returns {DOMRectInit}
2594
- */
2595
- function getSVGContentRect(target) {
2596
- var bbox = target.getBBox();
2597
- return createRectInit(0, 0, bbox.width, bbox.height);
2598
- }
2599
- /**
2600
- * Calculates content rectangle of provided HTMLElement.
2601
- *
2602
- * @param {HTMLElement} target - Element for which to calculate the content rectangle.
2603
- * @returns {DOMRectInit}
2604
- */
2605
- function getHTMLElementContentRect(target) {
2606
- // Client width & height properties can't be
2607
- // used exclusively as they provide rounded values.
2608
- var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
2609
- // By this condition we can catch all non-replaced inline, hidden and
2610
- // detached elements. Though elements with width & height properties less
2611
- // than 0.5 will be discarded as well.
2612
- //
2613
- // Without it we would need to implement separate methods for each of
2614
- // those cases and it's not possible to perform a precise and performance
2615
- // effective test for hidden elements. E.g. even jQuery's ':visible' filter
2616
- // gives wrong results for elements with width & height less than 0.5.
2617
- if (!clientWidth && !clientHeight) {
2618
- return emptyRect;
2619
- }
2620
- var styles = getWindowOf(target).getComputedStyle(target);
2621
- var paddings = getPaddings(styles);
2622
- var horizPad = paddings.left + paddings.right;
2623
- var vertPad = paddings.top + paddings.bottom;
2624
- // Computed styles of width & height are being used because they are the
2625
- // only dimensions available to JS that contain non-rounded values. It could
2626
- // be possible to utilize the getBoundingClientRect if only it's data wasn't
2627
- // affected by CSS transformations let alone paddings, borders and scroll bars.
2628
- var width = toFloat(styles.width), height = toFloat(styles.height);
2629
- // Width & height include paddings and borders when the 'border-box' box
2630
- // model is applied (except for IE).
2631
- if (styles.boxSizing === 'border-box') {
2632
- // Following conditions are required to handle Internet Explorer which
2633
- // doesn't include paddings and borders to computed CSS dimensions.
2634
- //
2635
- // We can say that if CSS dimensions + paddings are equal to the "client"
2636
- // properties then it's either IE, and thus we don't need to subtract
2637
- // anything, or an element merely doesn't have paddings/borders styles.
2638
- if (Math.round(width + horizPad) !== clientWidth) {
2639
- width -= getBordersSize(styles, 'left', 'right') + horizPad;
2640
- }
2641
- if (Math.round(height + vertPad) !== clientHeight) {
2642
- height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
2643
- }
2644
- }
2645
- // Following steps can't be applied to the document's root element as its
2646
- // client[Width/Height] properties represent viewport area of the window.
2647
- // Besides, it's as well not necessary as the <html> itself neither has
2648
- // rendered scroll bars nor it can be clipped.
2649
- if (!isDocumentElement(target)) {
2650
- // In some browsers (only in Firefox, actually) CSS width & height
2651
- // include scroll bars size which can be removed at this step as scroll
2652
- // bars are the only difference between rounded dimensions + paddings
2653
- // and "client" properties, though that is not always true in Chrome.
2654
- var vertScrollbar = Math.round(width + horizPad) - clientWidth;
2655
- var horizScrollbar = Math.round(height + vertPad) - clientHeight;
2656
- // Chrome has a rather weird rounding of "client" properties.
2657
- // E.g. for an element with content width of 314.2px it sometimes gives
2658
- // the client width of 315px and for the width of 314.7px it may give
2659
- // 314px. And it doesn't happen all the time. So just ignore this delta
2660
- // as a non-relevant.
2661
- if (Math.abs(vertScrollbar) !== 1) {
2662
- width -= vertScrollbar;
2663
- }
2664
- if (Math.abs(horizScrollbar) !== 1) {
2665
- height -= horizScrollbar;
2666
- }
2667
- }
2668
- return createRectInit(paddings.left, paddings.top, width, height);
2669
- }
2670
- /**
2671
- * Checks whether provided element is an instance of the SVGGraphicsElement.
2672
- *
2673
- * @param {Element} target - Element to be checked.
2674
- * @returns {boolean}
2675
- */
2676
- var isSVGGraphicsElement = (function () {
2677
- // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
2678
- // interface.
2679
- if (typeof SVGGraphicsElement !== 'undefined') {
2680
- return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
2681
- }
2682
- // If it's so, then check that element is at least an instance of the
2683
- // SVGElement and that it has the "getBBox" method.
2684
- // eslint-disable-next-line no-extra-parens
2685
- return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
2686
- typeof target.getBBox === 'function'); };
2687
- })();
2688
- /**
2689
- * Checks whether provided element is a document element (<html>).
2690
- *
2691
- * @param {Element} target - Element to be checked.
2692
- * @returns {boolean}
2693
- */
2694
- function isDocumentElement(target) {
2695
- return target === getWindowOf(target).document.documentElement;
2696
- }
2697
- /**
2698
- * Calculates an appropriate content rectangle for provided html or svg element.
2699
- *
2700
- * @param {Element} target - Element content rectangle of which needs to be calculated.
2701
- * @returns {DOMRectInit}
2702
- */
2703
- function getContentRect(target) {
2704
- if (!isBrowser) {
2705
- return emptyRect;
2706
- }
2707
- if (isSVGGraphicsElement(target)) {
2708
- return getSVGContentRect(target);
2709
- }
2710
- return getHTMLElementContentRect(target);
2711
- }
2712
- /**
2713
- * Creates rectangle with an interface of the DOMRectReadOnly.
2714
- * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
2715
- *
2716
- * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
2717
- * @returns {DOMRectReadOnly}
2718
- */
2719
- function createReadOnlyRect(_a) {
2720
- var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
2721
- // If DOMRectReadOnly is available use it as a prototype for the rectangle.
2722
- var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
2723
- var rect = Object.create(Constr.prototype);
2724
- // Rectangle's properties are not writable and non-enumerable.
2725
- defineConfigurable(rect, {
2726
- x: x, y: y, width: width, height: height,
2727
- top: y,
2728
- right: x + width,
2729
- bottom: height + y,
2730
- left: x
2731
- });
2732
- return rect;
2733
- }
2734
- /**
2735
- * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
2736
- * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
2737
- *
2738
- * @param {number} x - X coordinate.
2739
- * @param {number} y - Y coordinate.
2740
- * @param {number} width - Rectangle's width.
2741
- * @param {number} height - Rectangle's height.
2742
- * @returns {DOMRectInit}
2743
- */
2744
- function createRectInit(x, y, width, height) {
2745
- return { x: x, y: y, width: width, height: height };
2746
- }
2747
-
2748
- /**
2749
- * Class that is responsible for computations of the content rectangle of
2750
- * provided DOM element and for keeping track of it's changes.
2751
- */
2752
- var ResizeObservation = /** @class */ (function () {
2753
- /**
2754
- * Creates an instance of ResizeObservation.
2755
- *
2756
- * @param {Element} target - Element to be observed.
2757
- */
2758
- function ResizeObservation(target) {
2759
- /**
2760
- * Broadcasted width of content rectangle.
2761
- *
2762
- * @type {number}
2763
- */
2764
- this.broadcastWidth = 0;
2765
- /**
2766
- * Broadcasted height of content rectangle.
2767
- *
2768
- * @type {number}
2769
- */
2770
- this.broadcastHeight = 0;
2771
- /**
2772
- * Reference to the last observed content rectangle.
2773
- *
2774
- * @private {DOMRectInit}
2775
- */
2776
- this.contentRect_ = createRectInit(0, 0, 0, 0);
2777
- this.target = target;
2778
- }
2779
- /**
2780
- * Updates content rectangle and tells whether it's width or height properties
2781
- * have changed since the last broadcast.
2782
- *
2783
- * @returns {boolean}
2784
- */
2785
- ResizeObservation.prototype.isActive = function () {
2786
- var rect = getContentRect(this.target);
2787
- this.contentRect_ = rect;
2788
- return (rect.width !== this.broadcastWidth ||
2789
- rect.height !== this.broadcastHeight);
2790
- };
2791
- /**
2792
- * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
2793
- * from the corresponding properties of the last observed content rectangle.
2794
- *
2795
- * @returns {DOMRectInit} Last observed content rectangle.
2796
- */
2797
- ResizeObservation.prototype.broadcastRect = function () {
2798
- var rect = this.contentRect_;
2799
- this.broadcastWidth = rect.width;
2800
- this.broadcastHeight = rect.height;
2801
- return rect;
2802
- };
2803
- return ResizeObservation;
2804
- }());
2805
-
2806
- var ResizeObserverEntry = /** @class */ (function () {
2807
- /**
2808
- * Creates an instance of ResizeObserverEntry.
2809
- *
2810
- * @param {Element} target - Element that is being observed.
2811
- * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
2812
- */
2813
- function ResizeObserverEntry(target, rectInit) {
2814
- var contentRect = createReadOnlyRect(rectInit);
2815
- // According to the specification following properties are not writable
2816
- // and are also not enumerable in the native implementation.
2817
- //
2818
- // Property accessors are not being used as they'd require to define a
2819
- // private WeakMap storage which may cause memory leaks in browsers that
2820
- // don't support this type of collections.
2821
- defineConfigurable(this, { target: target, contentRect: contentRect });
2822
- }
2823
- return ResizeObserverEntry;
2824
- }());
2825
-
2826
- var ResizeObserverSPI = /** @class */ (function () {
2827
- /**
2828
- * Creates a new instance of ResizeObserver.
2829
- *
2830
- * @param {ResizeObserverCallback} callback - Callback function that is invoked
2831
- * when one of the observed elements changes it's content dimensions.
2832
- * @param {ResizeObserverController} controller - Controller instance which
2833
- * is responsible for the updates of observer.
2834
- * @param {ResizeObserver} callbackCtx - Reference to the public
2835
- * ResizeObserver instance which will be passed to callback function.
2836
- */
2837
- function ResizeObserverSPI(callback, controller, callbackCtx) {
2838
- /**
2839
- * Collection of resize observations that have detected changes in dimensions
2840
- * of elements.
2841
- *
2842
- * @private {Array<ResizeObservation>}
2843
- */
2844
- this.activeObservations_ = [];
2845
- /**
2846
- * Registry of the ResizeObservation instances.
2847
- *
2848
- * @private {Map<Element, ResizeObservation>}
2849
- */
2850
- this.observations_ = new MapShim();
2851
- if (typeof callback !== 'function') {
2852
- throw new TypeError('The callback provided as parameter 1 is not a function.');
2853
- }
2854
- this.callback_ = callback;
2855
- this.controller_ = controller;
2856
- this.callbackCtx_ = callbackCtx;
2857
- }
2858
- /**
2859
- * Starts observing provided element.
2860
- *
2861
- * @param {Element} target - Element to be observed.
2862
- * @returns {void}
2863
- */
2864
- ResizeObserverSPI.prototype.observe = function (target) {
2865
- if (!arguments.length) {
2866
- throw new TypeError('1 argument required, but only 0 present.');
2867
- }
2868
- // Do nothing if current environment doesn't have the Element interface.
2869
- if (typeof Element === 'undefined' || !(Element instanceof Object)) {
2870
- return;
2871
- }
2872
- if (!(target instanceof getWindowOf(target).Element)) {
2873
- throw new TypeError('parameter 1 is not of type "Element".');
2874
- }
2875
- var observations = this.observations_;
2876
- // Do nothing if element is already being observed.
2877
- if (observations.has(target)) {
2878
- return;
2879
- }
2880
- observations.set(target, new ResizeObservation(target));
2881
- this.controller_.addObserver(this);
2882
- // Force the update of observations.
2883
- this.controller_.refresh();
2884
- };
2885
- /**
2886
- * Stops observing provided element.
2887
- *
2888
- * @param {Element} target - Element to stop observing.
2889
- * @returns {void}
2890
- */
2891
- ResizeObserverSPI.prototype.unobserve = function (target) {
2892
- if (!arguments.length) {
2893
- throw new TypeError('1 argument required, but only 0 present.');
2894
- }
2895
- // Do nothing if current environment doesn't have the Element interface.
2896
- if (typeof Element === 'undefined' || !(Element instanceof Object)) {
2897
- return;
2898
- }
2899
- if (!(target instanceof getWindowOf(target).Element)) {
2900
- throw new TypeError('parameter 1 is not of type "Element".');
2901
- }
2902
- var observations = this.observations_;
2903
- // Do nothing if element is not being observed.
2904
- if (!observations.has(target)) {
2905
- return;
2906
- }
2907
- observations.delete(target);
2908
- if (!observations.size) {
2909
- this.controller_.removeObserver(this);
2910
- }
2911
- };
2912
- /**
2913
- * Stops observing all elements.
2914
- *
2915
- * @returns {void}
2916
- */
2917
- ResizeObserverSPI.prototype.disconnect = function () {
2918
- this.clearActive();
2919
- this.observations_.clear();
2920
- this.controller_.removeObserver(this);
2921
- };
2922
- /**
2923
- * Collects observation instances the associated element of which has changed
2924
- * it's content rectangle.
2925
- *
2926
- * @returns {void}
2927
- */
2928
- ResizeObserverSPI.prototype.gatherActive = function () {
2929
- var _this = this;
2930
- this.clearActive();
2931
- this.observations_.forEach(function (observation) {
2932
- if (observation.isActive()) {
2933
- _this.activeObservations_.push(observation);
2934
- }
2935
- });
2936
- };
2937
- /**
2938
- * Invokes initial callback function with a list of ResizeObserverEntry
2939
- * instances collected from active resize observations.
2940
- *
2941
- * @returns {void}
2942
- */
2943
- ResizeObserverSPI.prototype.broadcastActive = function () {
2944
- // Do nothing if observer doesn't have active observations.
2945
- if (!this.hasActive()) {
2946
- return;
2947
- }
2948
- var ctx = this.callbackCtx_;
2949
- // Create ResizeObserverEntry instance for every active observation.
2950
- var entries = this.activeObservations_.map(function (observation) {
2951
- return new ResizeObserverEntry(observation.target, observation.broadcastRect());
2952
- });
2953
- this.callback_.call(ctx, entries, ctx);
2954
- this.clearActive();
2955
- };
2956
- /**
2957
- * Clears the collection of active observations.
2958
- *
2959
- * @returns {void}
2960
- */
2961
- ResizeObserverSPI.prototype.clearActive = function () {
2962
- this.activeObservations_.splice(0);
2963
- };
2964
- /**
2965
- * Tells whether observer has active observations.
2966
- *
2967
- * @returns {boolean}
2968
- */
2969
- ResizeObserverSPI.prototype.hasActive = function () {
2970
- return this.activeObservations_.length > 0;
2971
- };
2972
- return ResizeObserverSPI;
2973
- }());
2974
-
2975
- // Registry of internal observers. If WeakMap is not available use current shim
2976
- // for the Map collection as it has all required methods and because WeakMap
2977
- // can't be fully polyfilled anyway.
2978
- var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
2979
- /**
2980
- * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
2981
- * exposing only those methods and properties that are defined in the spec.
2982
- */
2983
- var ResizeObserver = /** @class */ (function () {
2984
- /**
2985
- * Creates a new instance of ResizeObserver.
2986
- *
2987
- * @param {ResizeObserverCallback} callback - Callback that is invoked when
2988
- * dimensions of the observed elements change.
2989
- */
2990
- function ResizeObserver(callback) {
2991
- if (!(this instanceof ResizeObserver)) {
2992
- throw new TypeError('Cannot call a class as a function.');
2993
- }
2994
- if (!arguments.length) {
2995
- throw new TypeError('1 argument required, but only 0 present.');
2996
- }
2997
- var controller = ResizeObserverController.getInstance();
2998
- var observer = new ResizeObserverSPI(callback, controller, this);
2999
- observers.set(this, observer);
3000
- }
3001
- return ResizeObserver;
3002
- }());
3003
- // Expose public methods of ResizeObserver.
3004
- [
3005
- 'observe',
3006
- 'unobserve',
3007
- 'disconnect'
3008
- ].forEach(function (method) {
3009
- ResizeObserver.prototype[method] = function () {
3010
- var _a;
3011
- return (_a = observers.get(this))[method].apply(_a, arguments);
3012
- };
3013
- });
3014
-
3015
- var index$1 = (function () {
3016
- // Export existing implementation if available.
3017
- if (typeof global$1.ResizeObserver !== 'undefined') {
3018
- return global$1.ResizeObserver;
3019
- }
3020
- return ResizeObserver;
3021
- })();
3022
-
3023
- var innerSlider = createCommonjsModule(function (module, exports) {
3024
-
3025
- Object.defineProperty(exports, "__esModule", {
3026
- value: true
3027
- });
3028
- exports.InnerSlider = void 0;
3029
-
3030
- var _react = _interopRequireDefault(React__default);
3031
-
3032
- var _initialState = _interopRequireDefault(initialState_1);
3033
-
3034
- var _lodash = _interopRequireDefault(lodash_debounce);
3035
-
3036
- var _classnames = _interopRequireDefault(classnames);
3037
-
3038
-
3039
-
3040
-
3041
-
3042
-
3043
-
3044
-
3045
-
3046
- var _resizeObserverPolyfill = _interopRequireDefault(index$1);
3047
-
3048
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
3049
-
3050
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3051
-
3052
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3053
-
3054
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3055
-
3056
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
3057
-
3058
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3059
-
3060
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3061
-
3062
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3063
-
3064
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
3065
-
3066
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
3067
-
3068
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
3069
-
3070
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
3071
-
3072
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
3073
-
3074
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
3075
-
3076
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
3077
-
3078
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3079
-
3080
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3081
-
3082
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3083
-
3084
- var InnerSlider = /*#__PURE__*/function (_React$Component) {
3085
- _inherits(InnerSlider, _React$Component);
3086
-
3087
- var _super = _createSuper(InnerSlider);
3088
-
3089
- function InnerSlider(props) {
3090
- var _this;
3091
-
3092
- _classCallCheck(this, InnerSlider);
3093
-
3094
- _this = _super.call(this, props);
3095
-
3096
- _defineProperty(_assertThisInitialized(_this), "listRefHandler", function (ref) {
3097
- return _this.list = ref;
3098
- });
3099
-
3100
- _defineProperty(_assertThisInitialized(_this), "trackRefHandler", function (ref) {
3101
- return _this.track = ref;
3102
- });
3103
-
3104
- _defineProperty(_assertThisInitialized(_this), "adaptHeight", function () {
3105
- if (_this.props.adaptiveHeight && _this.list) {
3106
- var elem = _this.list.querySelector("[data-index=\"".concat(_this.state.currentSlide, "\"]"));
3107
-
3108
- _this.list.style.height = (0, innerSliderUtils.getHeight)(elem) + "px";
3109
- }
3110
- });
3111
-
3112
- _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
3113
- _this.props.onInit && _this.props.onInit();
3114
-
3115
- if (_this.props.lazyLoad) {
3116
- var slidesToLoad = (0, innerSliderUtils.getOnDemandLazySlides)(_objectSpread(_objectSpread({}, _this.props), _this.state));
3117
-
3118
- if (slidesToLoad.length > 0) {
3119
- _this.setState(function (prevState) {
3120
- return {
3121
- lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
3122
- };
3123
- });
3124
-
3125
- if (_this.props.onLazyLoad) {
3126
- _this.props.onLazyLoad(slidesToLoad);
3127
- }
3128
- }
3129
- }
3130
-
3131
- var spec = _objectSpread({
3132
- listRef: _this.list,
3133
- trackRef: _this.track
3134
- }, _this.props);
3135
-
3136
- _this.updateState(spec, true, function () {
3137
- _this.adaptHeight();
3138
-
3139
- _this.props.autoplay && _this.autoPlay("update");
3140
- });
3141
-
3142
- if (_this.props.lazyLoad === "progressive") {
3143
- _this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1000);
3144
- }
3145
-
3146
- _this.ro = new _resizeObserverPolyfill["default"](function () {
3147
- if (_this.state.animating) {
3148
- _this.onWindowResized(false); // don't set trackStyle hence don't break animation
3149
-
3150
-
3151
- _this.callbackTimers.push(setTimeout(function () {
3152
- return _this.onWindowResized();
3153
- }, _this.props.speed));
3154
- } else {
3155
- _this.onWindowResized();
3156
- }
3157
- });
3158
-
3159
- _this.ro.observe(_this.list);
3160
-
3161
- document.querySelectorAll && Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function (slide) {
3162
- slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
3163
- slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
3164
- });
3165
-
3166
- if (window.addEventListener) {
3167
- window.addEventListener("resize", _this.onWindowResized);
3168
- } else {
3169
- window.attachEvent("onresize", _this.onWindowResized);
3170
- }
3171
- });
3172
-
3173
- _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
3174
- if (_this.animationEndCallback) {
3175
- clearTimeout(_this.animationEndCallback);
3176
- }
3177
-
3178
- if (_this.lazyLoadTimer) {
3179
- clearInterval(_this.lazyLoadTimer);
3180
- }
3181
-
3182
- if (_this.callbackTimers.length) {
3183
- _this.callbackTimers.forEach(function (timer) {
3184
- return clearTimeout(timer);
3185
- });
3186
-
3187
- _this.callbackTimers = [];
3188
- }
3189
-
3190
- if (window.addEventListener) {
3191
- window.removeEventListener("resize", _this.onWindowResized);
3192
- } else {
3193
- window.detachEvent("onresize", _this.onWindowResized);
3194
- }
3195
-
3196
- if (_this.autoplayTimer) {
3197
- clearInterval(_this.autoplayTimer);
3198
- }
3199
-
3200
- _this.ro.disconnect();
3201
- });
3202
-
3203
- _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps) {
3204
- _this.checkImagesLoad();
3205
-
3206
- _this.props.onReInit && _this.props.onReInit();
3207
-
3208
- if (_this.props.lazyLoad) {
3209
- var slidesToLoad = (0, innerSliderUtils.getOnDemandLazySlides)(_objectSpread(_objectSpread({}, _this.props), _this.state));
3210
-
3211
- if (slidesToLoad.length > 0) {
3212
- _this.setState(function (prevState) {
3213
- return {
3214
- lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
3215
- };
3216
- });
3217
-
3218
- if (_this.props.onLazyLoad) {
3219
- _this.props.onLazyLoad(slidesToLoad);
3220
- }
3221
- }
3222
- } // if (this.props.onLazyLoad) {
3223
- // this.props.onLazyLoad([leftMostSlide])
3224
- // }
3225
-
3226
-
3227
- _this.adaptHeight();
3228
-
3229
- var spec = _objectSpread(_objectSpread({
3230
- listRef: _this.list,
3231
- trackRef: _this.track
3232
- }, _this.props), _this.state);
3233
-
3234
- var setTrackStyle = _this.didPropsChange(prevProps);
3235
-
3236
- setTrackStyle && _this.updateState(spec, setTrackStyle, function () {
3237
- if (_this.state.currentSlide >= _react["default"].Children.count(_this.props.children)) {
3238
- _this.changeSlide({
3239
- message: "index",
3240
- index: _react["default"].Children.count(_this.props.children) - _this.props.slidesToShow,
3241
- currentSlide: _this.state.currentSlide
3242
- });
3243
- }
3244
-
3245
- if (_this.props.autoplay) {
3246
- _this.autoPlay("update");
3247
- } else {
3248
- _this.pause("paused");
3249
- }
3250
- });
3251
- });
3252
-
3253
- _defineProperty(_assertThisInitialized(_this), "onWindowResized", function (setTrackStyle) {
3254
- if (_this.debouncedResize) _this.debouncedResize.cancel();
3255
- _this.debouncedResize = (0, _lodash["default"])(function () {
3256
- return _this.resizeWindow(setTrackStyle);
3257
- }, 50);
3258
-
3259
- _this.debouncedResize();
3260
- });
3261
-
3262
- _defineProperty(_assertThisInitialized(_this), "resizeWindow", function () {
3263
- var setTrackStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3264
- var isTrackMounted = Boolean(_this.track && _this.track.node); // prevent warning: setting state on unmounted component (server side rendering)
3265
-
3266
- if (!isTrackMounted) return;
3267
-
3268
- var spec = _objectSpread(_objectSpread({
3269
- listRef: _this.list,
3270
- trackRef: _this.track
3271
- }, _this.props), _this.state);
3272
-
3273
- _this.updateState(spec, setTrackStyle, function () {
3274
- if (_this.props.autoplay) _this.autoPlay("update");else _this.pause("paused");
3275
- }); // animating state should be cleared while resizing, otherwise autoplay stops working
3276
-
3277
-
3278
- _this.setState({
3279
- animating: false
3280
- });
3281
-
3282
- clearTimeout(_this.animationEndCallback);
3283
- delete _this.animationEndCallback;
3284
- });
3285
-
3286
- _defineProperty(_assertThisInitialized(_this), "updateState", function (spec, setTrackStyle, callback) {
3287
- var updatedState = (0, innerSliderUtils.initializedState)(spec);
3288
- spec = _objectSpread(_objectSpread(_objectSpread({}, spec), updatedState), {}, {
3289
- slideIndex: updatedState.currentSlide
3290
- });
3291
- var targetLeft = (0, innerSliderUtils.getTrackLeft)(spec);
3292
- spec = _objectSpread(_objectSpread({}, spec), {}, {
3293
- left: targetLeft
3294
- });
3295
- var trackStyle = (0, innerSliderUtils.getTrackCSS)(spec);
3296
-
3297
- if (setTrackStyle || _react["default"].Children.count(_this.props.children) !== _react["default"].Children.count(spec.children)) {
3298
- updatedState["trackStyle"] = trackStyle;
3299
- }
3300
-
3301
- _this.setState(updatedState, callback);
3302
- });
3303
-
3304
- _defineProperty(_assertThisInitialized(_this), "ssrInit", function () {
3305
- if (_this.props.variableWidth) {
3306
- var _trackWidth = 0,
3307
- _trackLeft = 0;
3308
- var childrenWidths = [];
3309
- var preClones = (0, innerSliderUtils.getPreClones)(_objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
3310
- slideCount: _this.props.children.length
3311
- }));
3312
- var postClones = (0, innerSliderUtils.getPostClones)(_objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
3313
- slideCount: _this.props.children.length
3314
- }));
3315
-
3316
- _this.props.children.forEach(function (child) {
3317
- childrenWidths.push(child.props.style.width);
3318
- _trackWidth += child.props.style.width;
3319
- });
3320
-
3321
- for (var i = 0; i < preClones; i++) {
3322
- _trackLeft += childrenWidths[childrenWidths.length - 1 - i];
3323
- _trackWidth += childrenWidths[childrenWidths.length - 1 - i];
3324
- }
3325
-
3326
- for (var _i = 0; _i < postClones; _i++) {
3327
- _trackWidth += childrenWidths[_i];
3328
- }
3329
-
3330
- for (var _i2 = 0; _i2 < _this.state.currentSlide; _i2++) {
3331
- _trackLeft += childrenWidths[_i2];
3332
- }
3333
-
3334
- var _trackStyle = {
3335
- width: _trackWidth + "px",
3336
- left: -_trackLeft + "px"
3337
- };
3338
-
3339
- if (_this.props.centerMode) {
3340
- var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
3341
- _trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
3342
- }
3343
-
3344
- return {
3345
- trackStyle: _trackStyle
3346
- };
3347
- }
3348
-
3349
- var childrenCount = _react["default"].Children.count(_this.props.children);
3350
-
3351
- var spec = _objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
3352
- slideCount: childrenCount
3353
- });
3354
-
3355
- var slideCount = (0, innerSliderUtils.getPreClones)(spec) + (0, innerSliderUtils.getPostClones)(spec) + childrenCount;
3356
- var trackWidth = 100 / _this.props.slidesToShow * slideCount;
3357
- var slideWidth = 100 / slideCount;
3358
- var trackLeft = -slideWidth * ((0, innerSliderUtils.getPreClones)(spec) + _this.state.currentSlide) * trackWidth / 100;
3359
-
3360
- if (_this.props.centerMode) {
3361
- trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
3362
- }
3363
-
3364
- var trackStyle = {
3365
- width: trackWidth + "%",
3366
- left: trackLeft + "%"
3367
- };
3368
- return {
3369
- slideWidth: slideWidth + "%",
3370
- trackStyle: trackStyle
3371
- };
3372
- });
3373
-
3374
- _defineProperty(_assertThisInitialized(_this), "checkImagesLoad", function () {
3375
- var images = _this.list && _this.list.querySelectorAll && _this.list.querySelectorAll(".slick-slide img") || [];
3376
- var imagesCount = images.length,
3377
- loadedCount = 0;
3378
- Array.prototype.forEach.call(images, function (image) {
3379
- var handler = function handler() {
3380
- return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
3381
- };
3382
-
3383
- if (!image.onclick) {
3384
- image.onclick = function () {
3385
- return image.parentNode.focus();
3386
- };
3387
- } else {
3388
- var prevClickHandler = image.onclick;
3389
-
3390
- image.onclick = function () {
3391
- prevClickHandler();
3392
- image.parentNode.focus();
3393
- };
3394
- }
3395
-
3396
- if (!image.onload) {
3397
- if (_this.props.lazyLoad) {
3398
- image.onload = function () {
3399
- _this.adaptHeight();
3400
-
3401
- _this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
3402
- };
3403
- } else {
3404
- image.onload = handler;
3405
-
3406
- image.onerror = function () {
3407
- handler();
3408
- _this.props.onLazyLoadError && _this.props.onLazyLoadError();
3409
- };
3410
- }
3411
- }
3412
- });
3413
- });
3414
-
3415
- _defineProperty(_assertThisInitialized(_this), "progressiveLazyLoad", function () {
3416
- var slidesToLoad = [];
3417
-
3418
- var spec = _objectSpread(_objectSpread({}, _this.props), _this.state);
3419
-
3420
- for (var index = _this.state.currentSlide; index < _this.state.slideCount + (0, innerSliderUtils.getPostClones)(spec); index++) {
3421
- if (_this.state.lazyLoadedList.indexOf(index) < 0) {
3422
- slidesToLoad.push(index);
3423
- break;
3424
- }
3425
- }
3426
-
3427
- for (var _index = _this.state.currentSlide - 1; _index >= -(0, innerSliderUtils.getPreClones)(spec); _index--) {
3428
- if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
3429
- slidesToLoad.push(_index);
3430
- break;
3431
- }
3432
- }
3433
-
3434
- if (slidesToLoad.length > 0) {
3435
- _this.setState(function (state) {
3436
- return {
3437
- lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
3438
- };
3439
- });
3440
-
3441
- if (_this.props.onLazyLoad) {
3442
- _this.props.onLazyLoad(slidesToLoad);
3443
- }
3444
- } else {
3445
- if (_this.lazyLoadTimer) {
3446
- clearInterval(_this.lazyLoadTimer);
3447
- delete _this.lazyLoadTimer;
3448
- }
3449
- }
3450
- });
3451
-
3452
- _defineProperty(_assertThisInitialized(_this), "slideHandler", function (index) {
3453
- var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3454
- var _this$props = _this.props,
3455
- asNavFor = _this$props.asNavFor,
3456
- beforeChange = _this$props.beforeChange,
3457
- onLazyLoad = _this$props.onLazyLoad,
3458
- speed = _this$props.speed,
3459
- afterChange = _this$props.afterChange; // capture currentslide before state is updated
3460
-
3461
- var currentSlide = _this.state.currentSlide;
3462
-
3463
- var _slideHandler = (0, innerSliderUtils.slideHandler)(_objectSpread(_objectSpread(_objectSpread({
3464
- index: index
3465
- }, _this.props), _this.state), {}, {
3466
- trackRef: _this.track,
3467
- useCSS: _this.props.useCSS && !dontAnimate
3468
- })),
3469
- state = _slideHandler.state,
3470
- nextState = _slideHandler.nextState;
3471
-
3472
- if (!state) return;
3473
- beforeChange && beforeChange(currentSlide, state.currentSlide);
3474
- var slidesToLoad = state.lazyLoadedList.filter(function (value) {
3475
- return _this.state.lazyLoadedList.indexOf(value) < 0;
3476
- });
3477
- onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
3478
-
3479
- if (!_this.props.waitForAnimate && _this.animationEndCallback) {
3480
- clearTimeout(_this.animationEndCallback);
3481
- afterChange && afterChange(currentSlide);
3482
- delete _this.animationEndCallback;
3483
- }
3484
-
3485
- _this.setState(state, function () {
3486
- // asNavForIndex check is to avoid recursive calls of slideHandler in waitForAnimate=false mode
3487
- if (asNavFor && _this.asNavForIndex !== index) {
3488
- _this.asNavForIndex = index;
3489
- asNavFor.innerSlider.slideHandler(index);
3490
- }
3491
-
3492
- if (!nextState) return;
3493
- _this.animationEndCallback = setTimeout(function () {
3494
- var animating = nextState.animating,
3495
- firstBatch = _objectWithoutProperties(nextState, ["animating"]);
3496
-
3497
- _this.setState(firstBatch, function () {
3498
- _this.callbackTimers.push(setTimeout(function () {
3499
- return _this.setState({
3500
- animating: animating
3501
- });
3502
- }, 10));
3503
-
3504
- afterChange && afterChange(state.currentSlide);
3505
- delete _this.animationEndCallback;
3506
- });
3507
- }, speed);
3508
- });
3509
- });
3510
-
3511
- _defineProperty(_assertThisInitialized(_this), "changeSlide", function (options) {
3512
- var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3513
-
3514
- var spec = _objectSpread(_objectSpread({}, _this.props), _this.state);
3515
-
3516
- var targetSlide = (0, innerSliderUtils.changeSlide)(spec, options);
3517
- if (targetSlide !== 0 && !targetSlide) return;
3518
-
3519
- if (dontAnimate === true) {
3520
- _this.slideHandler(targetSlide, dontAnimate);
3521
- } else {
3522
- _this.slideHandler(targetSlide);
3523
- }
3524
-
3525
- _this.props.autoplay && _this.autoPlay("update");
3526
-
3527
- if (_this.props.focusOnSelect) {
3528
- var nodes = _this.list.querySelectorAll(".slick-current");
3529
-
3530
- nodes[0] && nodes[0].focus();
3531
- }
3532
- });
3533
-
3534
- _defineProperty(_assertThisInitialized(_this), "clickHandler", function (e) {
3535
- if (_this.clickable === false) {
3536
- e.stopPropagation();
3537
- e.preventDefault();
3538
- }
3539
-
3540
- _this.clickable = true;
3541
- });
3542
-
3543
- _defineProperty(_assertThisInitialized(_this), "keyHandler", function (e) {
3544
- var dir = (0, innerSliderUtils.keyHandler)(e, _this.props.accessibility, _this.props.rtl);
3545
- dir !== "" && _this.changeSlide({
3546
- message: dir
3547
- });
3548
- });
3549
-
3550
- _defineProperty(_assertThisInitialized(_this), "selectHandler", function (options) {
3551
- _this.changeSlide(options);
3552
- });
3553
-
3554
- _defineProperty(_assertThisInitialized(_this), "disableBodyScroll", function () {
3555
- var preventDefault = function preventDefault(e) {
3556
- e = e || window.event;
3557
- if (e.preventDefault) e.preventDefault();
3558
- e.returnValue = false;
3559
- };
3560
-
3561
- window.ontouchmove = preventDefault;
3562
- });
3563
-
3564
- _defineProperty(_assertThisInitialized(_this), "enableBodyScroll", function () {
3565
- window.ontouchmove = null;
3566
- });
3567
-
3568
- _defineProperty(_assertThisInitialized(_this), "swipeStart", function (e) {
3569
- if (_this.props.verticalSwiping) {
3570
- _this.disableBodyScroll();
3571
- }
3572
-
3573
- var state = (0, innerSliderUtils.swipeStart)(e, _this.props.swipe, _this.props.draggable);
3574
- state !== "" && _this.setState(state);
3575
- });
3576
-
3577
- _defineProperty(_assertThisInitialized(_this), "swipeMove", function (e) {
3578
- var state = (0, innerSliderUtils.swipeMove)(e, _objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
3579
- trackRef: _this.track,
3580
- listRef: _this.list,
3581
- slideIndex: _this.state.currentSlide
3582
- }));
3583
- if (!state) return;
3584
-
3585
- if (state["swiping"]) {
3586
- _this.clickable = false;
3587
- }
3588
-
3589
- _this.setState(state);
3590
- });
3591
-
3592
- _defineProperty(_assertThisInitialized(_this), "swipeEnd", function (e) {
3593
- var state = (0, innerSliderUtils.swipeEnd)(e, _objectSpread(_objectSpread(_objectSpread({}, _this.props), _this.state), {}, {
3594
- trackRef: _this.track,
3595
- listRef: _this.list,
3596
- slideIndex: _this.state.currentSlide
3597
- }));
3598
- if (!state) return;
3599
- var triggerSlideHandler = state["triggerSlideHandler"];
3600
- delete state["triggerSlideHandler"];
3601
-
3602
- _this.setState(state);
3603
-
3604
- if (triggerSlideHandler === undefined) return;
3605
-
3606
- _this.slideHandler(triggerSlideHandler);
3607
-
3608
- if (_this.props.verticalSwiping) {
3609
- _this.enableBodyScroll();
3610
- }
3611
- });
3612
-
3613
- _defineProperty(_assertThisInitialized(_this), "touchEnd", function (e) {
3614
- _this.swipeEnd(e);
3615
-
3616
- _this.clickable = true;
3617
- });
3618
-
3619
- _defineProperty(_assertThisInitialized(_this), "slickPrev", function () {
3620
- // this and fellow methods are wrapped in setTimeout
3621
- // to make sure initialize setState has happened before
3622
- // any of such methods are called
3623
- _this.callbackTimers.push(setTimeout(function () {
3624
- return _this.changeSlide({
3625
- message: "previous"
3626
- });
3627
- }, 0));
3628
- });
3629
-
3630
- _defineProperty(_assertThisInitialized(_this), "slickNext", function () {
3631
- _this.callbackTimers.push(setTimeout(function () {
3632
- return _this.changeSlide({
3633
- message: "next"
3634
- });
3635
- }, 0));
3636
- });
3637
-
3638
- _defineProperty(_assertThisInitialized(_this), "slickGoTo", function (slide) {
3639
- var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3640
- slide = Number(slide);
3641
- if (isNaN(slide)) return "";
3642
-
3643
- _this.callbackTimers.push(setTimeout(function () {
3644
- return _this.changeSlide({
3645
- message: "index",
3646
- index: slide,
3647
- currentSlide: _this.state.currentSlide
3648
- }, dontAnimate);
3649
- }, 0));
3650
- });
3651
-
3652
- _defineProperty(_assertThisInitialized(_this), "play", function () {
3653
- var nextIndex;
3654
-
3655
- if (_this.props.rtl) {
3656
- nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
3657
- } else {
3658
- if ((0, innerSliderUtils.canGoNext)(_objectSpread(_objectSpread({}, _this.props), _this.state))) {
3659
- nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
3660
- } else {
3661
- return false;
3662
- }
3663
- }
3664
-
3665
- _this.slideHandler(nextIndex);
3666
- });
3667
-
3668
- _defineProperty(_assertThisInitialized(_this), "autoPlay", function (playType) {
3669
- if (_this.autoplayTimer) {
3670
- clearInterval(_this.autoplayTimer);
3671
- }
3672
-
3673
- var autoplaying = _this.state.autoplaying;
3674
-
3675
- if (playType === "update") {
3676
- if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
3677
- return;
3678
- }
3679
- } else if (playType === "leave") {
3680
- if (autoplaying === "paused" || autoplaying === "focused") {
3681
- return;
3682
- }
3683
- } else if (playType === "blur") {
3684
- if (autoplaying === "paused" || autoplaying === "hovered") {
3685
- return;
3686
- }
3687
- }
3688
-
3689
- _this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
3690
-
3691
- _this.setState({
3692
- autoplaying: "playing"
3693
- });
3694
- });
3695
-
3696
- _defineProperty(_assertThisInitialized(_this), "pause", function (pauseType) {
3697
- if (_this.autoplayTimer) {
3698
- clearInterval(_this.autoplayTimer);
3699
- _this.autoplayTimer = null;
3700
- }
3701
-
3702
- var autoplaying = _this.state.autoplaying;
3703
-
3704
- if (pauseType === "paused") {
3705
- _this.setState({
3706
- autoplaying: "paused"
3707
- });
3708
- } else if (pauseType === "focused") {
3709
- if (autoplaying === "hovered" || autoplaying === "playing") {
3710
- _this.setState({
3711
- autoplaying: "focused"
3712
- });
3713
- }
3714
- } else {
3715
- // pauseType is 'hovered'
3716
- if (autoplaying === "playing") {
3717
- _this.setState({
3718
- autoplaying: "hovered"
3719
- });
3720
- }
3721
- }
3722
- });
3723
-
3724
- _defineProperty(_assertThisInitialized(_this), "onDotsOver", function () {
3725
- return _this.props.autoplay && _this.pause("hovered");
3726
- });
3727
-
3728
- _defineProperty(_assertThisInitialized(_this), "onDotsLeave", function () {
3729
- return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
3730
- });
3731
-
3732
- _defineProperty(_assertThisInitialized(_this), "onTrackOver", function () {
3733
- return _this.props.autoplay && _this.pause("hovered");
3734
- });
3735
-
3736
- _defineProperty(_assertThisInitialized(_this), "onTrackLeave", function () {
3737
- return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
3738
- });
3739
-
3740
- _defineProperty(_assertThisInitialized(_this), "onSlideFocus", function () {
3741
- return _this.props.autoplay && _this.pause("focused");
3742
- });
3743
-
3744
- _defineProperty(_assertThisInitialized(_this), "onSlideBlur", function () {
3745
- return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
3746
- });
3747
-
3748
- _defineProperty(_assertThisInitialized(_this), "render", function () {
3749
- var className = (0, _classnames["default"])("slick-slider", _this.props.className, {
3750
- "slick-vertical": _this.props.vertical,
3751
- "slick-initialized": true
3752
- });
3753
-
3754
- var spec = _objectSpread(_objectSpread({}, _this.props), _this.state);
3755
-
3756
- var trackProps = (0, innerSliderUtils.extractObject)(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
3757
- var pauseOnHover = _this.props.pauseOnHover;
3758
- trackProps = _objectSpread(_objectSpread({}, trackProps), {}, {
3759
- onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
3760
- onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
3761
- onMouseOver: pauseOnHover ? _this.onTrackOver : null,
3762
- focusOnSelect: _this.props.focusOnSelect && _this.clickable ? _this.selectHandler : null
3763
- });
3764
- var dots$1;
3765
-
3766
- if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
3767
- var dotProps = (0, innerSliderUtils.extractObject)(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
3768
- var pauseOnDotsHover = _this.props.pauseOnDotsHover;
3769
- dotProps = _objectSpread(_objectSpread({}, dotProps), {}, {
3770
- clickHandler: _this.changeSlide,
3771
- onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
3772
- onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
3773
- onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
3774
- });
3775
- dots$1 = /*#__PURE__*/_react["default"].createElement(dots.Dots, dotProps);
3776
- }
3777
-
3778
- var prevArrow, nextArrow;
3779
- var arrowProps = (0, innerSliderUtils.extractObject)(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
3780
- arrowProps.clickHandler = _this.changeSlide;
3781
-
3782
- if (_this.props.arrows) {
3783
- prevArrow = /*#__PURE__*/_react["default"].createElement(arrows.PrevArrow, arrowProps);
3784
- nextArrow = /*#__PURE__*/_react["default"].createElement(arrows.NextArrow, arrowProps);
3785
- }
3786
-
3787
- var verticalHeightStyle = null;
3788
-
3789
- if (_this.props.vertical) {
3790
- verticalHeightStyle = {
3791
- height: _this.state.listHeight
3792
- };
3793
- }
3794
-
3795
- var centerPaddingStyle = null;
3796
-
3797
- if (_this.props.vertical === false) {
3798
- if (_this.props.centerMode === true) {
3799
- centerPaddingStyle = {
3800
- padding: "0px " + _this.props.centerPadding
3801
- };
3802
- }
3803
- } else {
3804
- if (_this.props.centerMode === true) {
3805
- centerPaddingStyle = {
3806
- padding: _this.props.centerPadding + " 0px"
3807
- };
3808
- }
3809
- }
3810
-
3811
- var listStyle = _objectSpread(_objectSpread({}, verticalHeightStyle), centerPaddingStyle);
3812
-
3813
- var touchMove = _this.props.touchMove;
3814
- var listProps = {
3815
- className: "slick-list",
3816
- style: listStyle,
3817
- onClick: _this.clickHandler,
3818
- onMouseDown: touchMove ? _this.swipeStart : null,
3819
- onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
3820
- onMouseUp: touchMove ? _this.swipeEnd : null,
3821
- onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
3822
- onTouchStart: touchMove ? _this.swipeStart : null,
3823
- onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
3824
- onTouchEnd: touchMove ? _this.touchEnd : null,
3825
- onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
3826
- onKeyDown: _this.props.accessibility ? _this.keyHandler : null
3827
- };
3828
- var innerSliderProps = {
3829
- className: className,
3830
- dir: "ltr",
3831
- style: _this.props.style
3832
- };
3833
-
3834
- if (_this.props.unslick) {
3835
- listProps = {
3836
- className: "slick-list"
3837
- };
3838
- innerSliderProps = {
3839
- className: className
3840
- };
3841
- }
3842
-
3843
- return /*#__PURE__*/_react["default"].createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /*#__PURE__*/_react["default"].createElement("div", _extends({
3844
- ref: _this.listRefHandler
3845
- }, listProps), /*#__PURE__*/_react["default"].createElement(track.Track, _extends({
3846
- ref: _this.trackRefHandler
3847
- }, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots$1 : "");
3848
- });
3849
-
3850
- _this.list = null;
3851
- _this.track = null;
3852
- _this.state = _objectSpread(_objectSpread({}, _initialState["default"]), {}, {
3853
- currentSlide: _this.props.initialSlide,
3854
- slideCount: _react["default"].Children.count(_this.props.children)
3855
- });
3856
- _this.callbackTimers = [];
3857
- _this.clickable = true;
3858
- _this.debouncedResize = null;
3859
-
3860
- var ssrState = _this.ssrInit();
3861
-
3862
- _this.state = _objectSpread(_objectSpread({}, _this.state), ssrState);
3863
- return _this;
3864
- }
3865
-
3866
- _createClass(InnerSlider, [{
3867
- key: "didPropsChange",
3868
- value: function didPropsChange(prevProps) {
3869
- var setTrackStyle = false;
3870
-
3871
- for (var _i3 = 0, _Object$keys = Object.keys(this.props); _i3 < _Object$keys.length; _i3++) {
3872
- var key = _Object$keys[_i3];
3873
-
3874
- if (!prevProps.hasOwnProperty(key)) {
3875
- setTrackStyle = true;
3876
- break;
3877
- }
3878
-
3879
- if (_typeof(prevProps[key]) === "object" || typeof prevProps[key] === "function") {
3880
- continue;
3881
- }
3882
-
3883
- if (prevProps[key] !== this.props[key]) {
3884
- setTrackStyle = true;
3885
- break;
3886
- }
3887
- }
3888
-
3889
- return setTrackStyle || _react["default"].Children.count(this.props.children) !== _react["default"].Children.count(prevProps.children);
3890
- }
3891
- }]);
3892
-
3893
- return InnerSlider;
3894
- }(_react["default"].Component);
3895
-
3896
- exports.InnerSlider = InnerSlider;
3897
- });
3898
-
3899
- unwrapExports(innerSlider);
3900
- innerSlider.InnerSlider;
3901
-
3902
- var camel2hyphen = function (str) {
3903
- return str
3904
- .replace(/[A-Z]/g, function (match) {
3905
- return '-' + match.toLowerCase();
3906
- })
3907
- .toLowerCase();
3908
- };
3909
-
3910
- var camel2hyphen_1 = camel2hyphen;
3911
-
3912
- var isDimension = function (feature) {
3913
- var re = /[height|width]$/;
3914
- return re.test(feature);
3915
- };
3916
-
3917
- var obj2mq = function (obj) {
3918
- var mq = '';
3919
- var features = Object.keys(obj);
3920
- features.forEach(function (feature, index) {
3921
- var value = obj[feature];
3922
- feature = camel2hyphen_1(feature);
3923
- // Add px to dimension features
3924
- if (isDimension(feature) && typeof value === 'number') {
3925
- value = value + 'px';
3926
- }
3927
- if (value === true) {
3928
- mq += feature;
3929
- } else if (value === false) {
3930
- mq += 'not ' + feature;
3931
- } else {
3932
- mq += '(' + feature + ': ' + value + ')';
3933
- }
3934
- if (index < features.length-1) {
3935
- mq += ' and ';
3936
- }
3937
- });
3938
- return mq;
3939
- };
3940
-
3941
- var json2mq = function (query) {
3942
- var mq = '';
3943
- if (typeof query === 'string') {
3944
- return query;
3945
- }
3946
- // Handling array of media queries
3947
- if (query instanceof Array) {
3948
- query.forEach(function (q, index) {
3949
- mq += obj2mq(q);
3950
- if (index < query.length-1) {
3951
- mq += ', ';
3952
- }
3953
- });
3954
- return mq;
3955
- }
3956
- // Handling single media query
3957
- return obj2mq(query);
3958
- };
3959
-
3960
- var json2mq_1 = json2mq;
3961
-
3962
- var defaultProps_1 = createCommonjsModule(function (module, exports) {
3963
-
3964
- Object.defineProperty(exports, "__esModule", {
3965
- value: true
3966
- });
3967
- exports["default"] = void 0;
3968
-
3969
- var _react = _interopRequireDefault(React__default);
3970
-
3971
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
3972
-
3973
- var defaultProps = {
3974
- accessibility: true,
3975
- adaptiveHeight: false,
3976
- afterChange: null,
3977
- appendDots: function appendDots(dots) {
3978
- return /*#__PURE__*/_react["default"].createElement("ul", {
3979
- style: {
3980
- display: "block"
3981
- }
3982
- }, dots);
3983
- },
3984
- arrows: true,
3985
- autoplay: false,
3986
- autoplaySpeed: 3000,
3987
- beforeChange: null,
3988
- centerMode: false,
3989
- centerPadding: "50px",
3990
- className: "",
3991
- cssEase: "ease",
3992
- customPaging: function customPaging(i) {
3993
- return /*#__PURE__*/_react["default"].createElement("button", null, i + 1);
3994
- },
3995
- dots: false,
3996
- dotsClass: "slick-dots",
3997
- draggable: true,
3998
- easing: "linear",
3999
- edgeFriction: 0.35,
4000
- fade: false,
4001
- focusOnSelect: false,
4002
- infinite: true,
4003
- initialSlide: 0,
4004
- lazyLoad: null,
4005
- nextArrow: null,
4006
- onEdge: null,
4007
- onInit: null,
4008
- onLazyLoadError: null,
4009
- onReInit: null,
4010
- pauseOnDotsHover: false,
4011
- pauseOnFocus: false,
4012
- pauseOnHover: true,
4013
- prevArrow: null,
4014
- responsive: null,
4015
- rows: 1,
4016
- rtl: false,
4017
- slide: "div",
4018
- slidesPerRow: 1,
4019
- slidesToScroll: 1,
4020
- slidesToShow: 1,
4021
- speed: 500,
4022
- swipe: true,
4023
- swipeEvent: null,
4024
- swipeToSlide: false,
4025
- touchMove: true,
4026
- touchThreshold: 5,
4027
- useCSS: true,
4028
- useTransform: true,
4029
- variableWidth: false,
4030
- vertical: false,
4031
- waitForAnimate: true
4032
- };
4033
- var _default = defaultProps;
4034
- exports["default"] = _default;
4035
- });
4036
-
4037
- unwrapExports(defaultProps_1);
4038
-
4039
- /**
4040
- * Delegate to handle a media query being matched and unmatched.
4041
- *
4042
- * @param {object} options
4043
- * @param {function} options.match callback for when the media query is matched
4044
- * @param {function} [options.unmatch] callback for when the media query is unmatched
4045
- * @param {function} [options.setup] one-time callback triggered the first time a query is matched
4046
- * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
4047
- * @constructor
4048
- */
4049
- function QueryHandler(options) {
4050
- this.options = options;
4051
- !options.deferSetup && this.setup();
4052
- }
4053
-
4054
- QueryHandler.prototype = {
4055
-
4056
- constructor : QueryHandler,
4057
-
4058
- /**
4059
- * coordinates setup of the handler
4060
- *
4061
- * @function
4062
- */
4063
- setup : function() {
4064
- if(this.options.setup) {
4065
- this.options.setup();
4066
- }
4067
- this.initialised = true;
4068
- },
4069
-
4070
- /**
4071
- * coordinates setup and triggering of the handler
4072
- *
4073
- * @function
4074
- */
4075
- on : function() {
4076
- !this.initialised && this.setup();
4077
- this.options.match && this.options.match();
4078
- },
4079
-
4080
- /**
4081
- * coordinates the unmatch event for the handler
4082
- *
4083
- * @function
4084
- */
4085
- off : function() {
4086
- this.options.unmatch && this.options.unmatch();
4087
- },
4088
-
4089
- /**
4090
- * called when a handler is to be destroyed.
4091
- * delegates to the destroy or unmatch callbacks, depending on availability.
4092
- *
4093
- * @function
4094
- */
4095
- destroy : function() {
4096
- this.options.destroy ? this.options.destroy() : this.off();
4097
- },
4098
-
4099
- /**
4100
- * determines equality by reference.
4101
- * if object is supplied compare options, if function, compare match callback
4102
- *
4103
- * @function
4104
- * @param {object || function} [target] the target for comparison
4105
- */
4106
- equals : function(target) {
4107
- return this.options === target || this.options.match === target;
4108
- }
4109
-
4110
- };
4111
-
4112
- var QueryHandler_1 = QueryHandler;
4113
-
4114
- /**
4115
- * Helper function for iterating over a collection
4116
- *
4117
- * @param collection
4118
- * @param fn
4119
- */
4120
- function each$2(collection, fn) {
4121
- var i = 0,
4122
- length = collection.length,
4123
- cont;
4124
-
4125
- for(i; i < length; i++) {
4126
- cont = fn(collection[i], i);
4127
- if(cont === false) {
4128
- break; //allow early exit
4129
- }
4130
- }
4131
- }
4132
-
4133
- /**
4134
- * Helper function for determining whether target object is an array
4135
- *
4136
- * @param target the object under test
4137
- * @return {Boolean} true if array, false otherwise
4138
- */
4139
- function isArray$1(target) {
4140
- return Object.prototype.toString.apply(target) === '[object Array]';
4141
- }
4142
-
4143
- /**
4144
- * Helper function for determining whether target object is a function
4145
- *
4146
- * @param target the object under test
4147
- * @return {Boolean} true if function, false otherwise
4148
- */
4149
- function isFunction$1(target) {
4150
- return typeof target === 'function';
4151
- }
4152
-
4153
- var Util = {
4154
- isFunction : isFunction$1,
4155
- isArray : isArray$1,
4156
- each : each$2
4157
- };
4158
-
4159
- var each$1 = Util.each;
4160
-
4161
- /**
4162
- * Represents a single media query, manages it's state and registered handlers for this query
4163
- *
4164
- * @constructor
4165
- * @param {string} query the media query string
4166
- * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design
4167
- */
4168
- function MediaQuery(query, isUnconditional) {
4169
- this.query = query;
4170
- this.isUnconditional = isUnconditional;
4171
- this.handlers = [];
4172
- this.mql = window.matchMedia(query);
4173
-
4174
- var self = this;
4175
- this.listener = function(mql) {
4176
- // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
4177
- self.mql = mql.currentTarget || mql;
4178
- self.assess();
4179
- };
4180
- this.mql.addListener(this.listener);
4181
- }
4182
-
4183
- MediaQuery.prototype = {
4184
-
4185
- constuctor : MediaQuery,
4186
-
4187
- /**
4188
- * add a handler for this query, triggering if already active
4189
- *
4190
- * @param {object} handler
4191
- * @param {function} handler.match callback for when query is activated
4192
- * @param {function} [handler.unmatch] callback for when query is deactivated
4193
- * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
4194
- * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
4195
- */
4196
- addHandler : function(handler) {
4197
- var qh = new QueryHandler_1(handler);
4198
- this.handlers.push(qh);
4199
-
4200
- this.matches() && qh.on();
4201
- },
4202
-
4203
- /**
4204
- * removes the given handler from the collection, and calls it's destroy methods
4205
- *
4206
- * @param {object || function} handler the handler to remove
4207
- */
4208
- removeHandler : function(handler) {
4209
- var handlers = this.handlers;
4210
- each$1(handlers, function(h, i) {
4211
- if(h.equals(handler)) {
4212
- h.destroy();
4213
- return !handlers.splice(i,1); //remove from array and exit each early
4214
- }
4215
- });
4216
- },
4217
-
4218
- /**
4219
- * Determine whether the media query should be considered a match
4220
- *
4221
- * @return {Boolean} true if media query can be considered a match, false otherwise
4222
- */
4223
- matches : function() {
4224
- return this.mql.matches || this.isUnconditional;
4225
- },
4226
-
4227
- /**
4228
- * Clears all handlers and unbinds events
4229
- */
4230
- clear : function() {
4231
- each$1(this.handlers, function(handler) {
4232
- handler.destroy();
4233
- });
4234
- this.mql.removeListener(this.listener);
4235
- this.handlers.length = 0; //clear array
4236
- },
4237
-
4238
- /*
4239
- * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
4240
- */
4241
- assess : function() {
4242
- var action = this.matches() ? 'on' : 'off';
4243
-
4244
- each$1(this.handlers, function(handler) {
4245
- handler[action]();
4246
- });
4247
- }
4248
- };
4249
-
4250
- var MediaQuery_1 = MediaQuery;
4251
-
4252
- var each = Util.each;
4253
- var isFunction = Util.isFunction;
4254
- var isArray = Util.isArray;
4255
-
4256
- /**
4257
- * Allows for registration of query handlers.
4258
- * Manages the query handler's state and is responsible for wiring up browser events
4259
- *
4260
- * @constructor
4261
- */
4262
- function MediaQueryDispatch () {
4263
- if(!window.matchMedia) {
4264
- throw new Error('matchMedia not present, legacy browsers require a polyfill');
4265
- }
4266
-
4267
- this.queries = {};
4268
- this.browserIsIncapable = !window.matchMedia('only all').matches;
4269
- }
4270
-
4271
- MediaQueryDispatch.prototype = {
4272
-
4273
- constructor : MediaQueryDispatch,
4274
-
4275
- /**
4276
- * Registers a handler for the given media query
4277
- *
4278
- * @param {string} q the media query
4279
- * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
4280
- * @param {function} options.match fired when query matched
4281
- * @param {function} [options.unmatch] fired when a query is no longer matched
4282
- * @param {function} [options.setup] fired when handler first triggered
4283
- * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
4284
- * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
4285
- */
4286
- register : function(q, options, shouldDegrade) {
4287
- var queries = this.queries,
4288
- isUnconditional = shouldDegrade && this.browserIsIncapable;
4289
-
4290
- if(!queries[q]) {
4291
- queries[q] = new MediaQuery_1(q, isUnconditional);
4292
- }
4293
-
4294
- //normalise to object in an array
4295
- if(isFunction(options)) {
4296
- options = { match : options };
4297
- }
4298
- if(!isArray(options)) {
4299
- options = [options];
4300
- }
4301
- each(options, function(handler) {
4302
- if (isFunction(handler)) {
4303
- handler = { match : handler };
4304
- }
4305
- queries[q].addHandler(handler);
4306
- });
4307
-
4308
- return this;
4309
- },
4310
-
4311
- /**
4312
- * unregisters a query and all it's handlers, or a specific handler for a query
4313
- *
4314
- * @param {string} q the media query to target
4315
- * @param {object || function} [handler] specific handler to unregister
4316
- */
4317
- unregister : function(q, handler) {
4318
- var query = this.queries[q];
4319
-
4320
- if(query) {
4321
- if(handler) {
4322
- query.removeHandler(handler);
4323
- }
4324
- else {
4325
- query.clear();
4326
- delete this.queries[q];
4327
- }
4328
- }
4329
-
4330
- return this;
4331
- }
4332
- };
4333
-
4334
- var MediaQueryDispatch_1 = MediaQueryDispatch;
4335
-
4336
- var src = new MediaQueryDispatch_1();
4337
-
4338
- var slider = createCommonjsModule(function (module, exports) {
4339
-
4340
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4341
-
4342
- Object.defineProperty(exports, "__esModule", {
4343
- value: true
4344
- });
4345
- exports["default"] = void 0;
4346
-
4347
- var _react = _interopRequireDefault(React__default);
4348
-
4349
-
4350
-
4351
- var _json2mq = _interopRequireDefault(json2mq_1);
4352
-
4353
- var _defaultProps = _interopRequireDefault(defaultProps_1);
4354
-
4355
-
4356
-
4357
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4358
-
4359
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4360
-
4361
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4362
-
4363
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4364
-
4365
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4366
-
4367
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4368
-
4369
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4370
-
4371
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
4372
-
4373
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
4374
-
4375
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
4376
-
4377
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
4378
-
4379
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
4380
-
4381
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4382
-
4383
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
4384
-
4385
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4386
-
4387
- var enquire = (0, innerSliderUtils.canUseDOM)() && src;
4388
-
4389
- var Slider = /*#__PURE__*/function (_React$Component) {
4390
- _inherits(Slider, _React$Component);
4391
-
4392
- var _super = _createSuper(Slider);
4393
-
4394
- function Slider(props) {
4395
- var _this;
4396
-
4397
- _classCallCheck(this, Slider);
4398
-
4399
- _this = _super.call(this, props);
4400
-
4401
- _defineProperty(_assertThisInitialized(_this), "innerSliderRefHandler", function (ref) {
4402
- return _this.innerSlider = ref;
4403
- });
4404
-
4405
- _defineProperty(_assertThisInitialized(_this), "slickPrev", function () {
4406
- return _this.innerSlider.slickPrev();
4407
- });
4408
-
4409
- _defineProperty(_assertThisInitialized(_this), "slickNext", function () {
4410
- return _this.innerSlider.slickNext();
4411
- });
4412
-
4413
- _defineProperty(_assertThisInitialized(_this), "slickGoTo", function (slide) {
4414
- var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4415
- return _this.innerSlider.slickGoTo(slide, dontAnimate);
4416
- });
4417
-
4418
- _defineProperty(_assertThisInitialized(_this), "slickPause", function () {
4419
- return _this.innerSlider.pause("paused");
4420
- });
4421
-
4422
- _defineProperty(_assertThisInitialized(_this), "slickPlay", function () {
4423
- return _this.innerSlider.autoPlay("play");
4424
- });
4425
-
4426
- _this.state = {
4427
- breakpoint: null
4428
- };
4429
- _this._responsiveMediaHandlers = [];
4430
- return _this;
4431
- }
4432
-
4433
- _createClass(Slider, [{
4434
- key: "media",
4435
- value: function media(query, handler) {
4436
- // javascript handler for css media query
4437
- enquire.register(query, handler);
4438
-
4439
- this._responsiveMediaHandlers.push({
4440
- query: query,
4441
- handler: handler
4442
- });
4443
- } // handles responsive breakpoints
4444
-
4445
- }, {
4446
- key: "componentDidMount",
4447
- value: function componentDidMount() {
4448
- var _this2 = this;
4449
-
4450
- // performance monitoring
4451
- //if (process.env.NODE_ENV !== 'production') {
4452
- //const { whyDidYouUpdate } = require('why-did-you-update')
4453
- //whyDidYouUpdate(React)
4454
- //}
4455
- if (this.props.responsive) {
4456
- var breakpoints = this.props.responsive.map(function (breakpt) {
4457
- return breakpt.breakpoint;
4458
- }); // sort them in increasing order of their numerical value
4459
-
4460
- breakpoints.sort(function (x, y) {
4461
- return x - y;
4462
- });
4463
- breakpoints.forEach(function (breakpoint, index) {
4464
- // media query for each breakpoint
4465
- var bQuery;
4466
-
4467
- if (index === 0) {
4468
- bQuery = (0, _json2mq["default"])({
4469
- minWidth: 0,
4470
- maxWidth: breakpoint
4471
- });
4472
- } else {
4473
- bQuery = (0, _json2mq["default"])({
4474
- minWidth: breakpoints[index - 1] + 1,
4475
- maxWidth: breakpoint
4476
- });
4477
- } // when not using server side rendering
4478
-
4479
-
4480
- (0, innerSliderUtils.canUseDOM)() && _this2.media(bQuery, function () {
4481
- _this2.setState({
4482
- breakpoint: breakpoint
4483
- });
4484
- });
4485
- }); // Register media query for full screen. Need to support resize from small to large
4486
- // convert javascript object to media query string
4487
-
4488
- var query = (0, _json2mq["default"])({
4489
- minWidth: breakpoints.slice(-1)[0]
4490
- });
4491
- (0, innerSliderUtils.canUseDOM)() && this.media(query, function () {
4492
- _this2.setState({
4493
- breakpoint: null
4494
- });
4495
- });
4496
- }
4497
- }
4498
- }, {
4499
- key: "componentWillUnmount",
4500
- value: function componentWillUnmount() {
4501
- this._responsiveMediaHandlers.forEach(function (obj) {
4502
- enquire.unregister(obj.query, obj.handler);
4503
- });
4504
- }
4505
- }, {
4506
- key: "render",
4507
- value: function render() {
4508
- var _this3 = this;
4509
-
4510
- var settings;
4511
- var newProps;
4512
-
4513
- if (this.state.breakpoint) {
4514
- newProps = this.props.responsive.filter(function (resp) {
4515
- return resp.breakpoint === _this3.state.breakpoint;
4516
- });
4517
- settings = newProps[0].settings === "unslick" ? "unslick" : _objectSpread(_objectSpread(_objectSpread({}, _defaultProps["default"]), this.props), newProps[0].settings);
4518
- } else {
4519
- settings = _objectSpread(_objectSpread({}, _defaultProps["default"]), this.props);
4520
- } // force scrolling by one if centerMode is on
4521
-
4522
-
4523
- if (settings.centerMode) {
4524
- if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== "production") {
4525
- console.warn("slidesToScroll should be equal to 1 in centerMode, you are using ".concat(settings.slidesToScroll));
4526
- }
4527
-
4528
- settings.slidesToScroll = 1;
4529
- } // force showing one slide and scrolling by one if the fade mode is on
4530
-
4531
-
4532
- if (settings.fade) {
4533
- if (settings.slidesToShow > 1 && process.env.NODE_ENV !== "production") {
4534
- console.warn("slidesToShow should be equal to 1 when fade is true, you're using ".concat(settings.slidesToShow));
4535
- }
4536
-
4537
- if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== "production") {
4538
- console.warn("slidesToScroll should be equal to 1 when fade is true, you're using ".concat(settings.slidesToScroll));
4539
- }
4540
-
4541
- settings.slidesToShow = 1;
4542
- settings.slidesToScroll = 1;
4543
- } // makes sure that children is an array, even when there is only 1 child
4544
-
4545
-
4546
- var children = _react["default"].Children.toArray(this.props.children); // Children may contain false or null, so we should filter them
4547
- // children may also contain string filled with spaces (in certain cases where we use jsx strings)
4548
-
4549
-
4550
- children = children.filter(function (child) {
4551
- if (typeof child === "string") {
4552
- return !!child.trim();
4553
- }
4554
-
4555
- return !!child;
4556
- }); // rows and slidesPerRow logic is handled here
4557
-
4558
- if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
4559
- console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
4560
- settings.variableWidth = false;
4561
- }
4562
-
4563
- var newChildren = [];
4564
- var currentWidth = null;
4565
-
4566
- for (var i = 0; i < children.length; i += settings.rows * settings.slidesPerRow) {
4567
- var newSlide = [];
4568
-
4569
- for (var j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
4570
- var row = [];
4571
-
4572
- for (var k = j; k < j + settings.slidesPerRow; k += 1) {
4573
- if (settings.variableWidth && children[k].props.style) {
4574
- currentWidth = children[k].props.style.width;
4575
- }
4576
-
4577
- if (k >= children.length) break;
4578
- row.push( /*#__PURE__*/_react["default"].cloneElement(children[k], {
4579
- key: 100 * i + 10 * j + k,
4580
- tabIndex: -1,
4581
- style: {
4582
- width: "".concat(100 / settings.slidesPerRow, "%"),
4583
- display: "inline-block"
4584
- }
4585
- }));
4586
- }
4587
-
4588
- newSlide.push( /*#__PURE__*/_react["default"].createElement("div", {
4589
- key: 10 * i + j
4590
- }, row));
4591
- }
4592
-
4593
- if (settings.variableWidth) {
4594
- newChildren.push( /*#__PURE__*/_react["default"].createElement("div", {
4595
- key: i,
4596
- style: {
4597
- width: currentWidth
4598
- }
4599
- }, newSlide));
4600
- } else {
4601
- newChildren.push( /*#__PURE__*/_react["default"].createElement("div", {
4602
- key: i
4603
- }, newSlide));
4604
- }
4605
- }
4606
-
4607
- if (settings === "unslick") {
4608
- var className = "regular slider " + (this.props.className || "");
4609
- return /*#__PURE__*/_react["default"].createElement("div", {
4610
- className: className
4611
- }, children);
4612
- } else if (newChildren.length <= settings.slidesToShow) {
4613
- settings.unslick = true;
4614
- }
4615
-
4616
- return /*#__PURE__*/_react["default"].createElement(innerSlider.InnerSlider, _extends({
4617
- style: this.props.style,
4618
- ref: this.innerSliderRefHandler
4619
- }, settings), newChildren);
4620
- }
4621
- }]);
4622
-
4623
- return Slider;
4624
- }(_react["default"].Component);
4625
-
4626
- exports["default"] = Slider;
4627
- });
4628
-
4629
- unwrapExports(slider);
4630
-
4631
- var lib = createCommonjsModule(function (module, exports) {
4632
-
4633
- Object.defineProperty(exports, "__esModule", {
4634
- value: true
4635
- });
4636
- exports["default"] = void 0;
4637
-
4638
- var _slider = _interopRequireDefault(slider);
4639
-
4640
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4641
-
4642
- var _default = _slider["default"];
4643
- exports["default"] = _default;
4644
- });
4645
-
4646
- var index = unwrapExports(lib);
4647
-
4648
- export default index;
4649
- export { lib as __moduleExports };