@pelcro/react-pelcro-js 4.0.0-alpha.14 → 4.0.0-alpha.15

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