phcthemes_admin_panel_pack 0.5.0 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cb0bec0f86c0f1c6e7d694b1bf153e908a7db294c12255df3fa64408c887621
4
- data.tar.gz: 6d6f6597b4becb88c05304d841e080509637abb8fbca2cc9436dc41cb8e9c180
3
+ metadata.gz: dac65825a7de54e026e96979ef0911ef860833ff031b54c17b29e05399f00425
4
+ data.tar.gz: 21cfb9a8e5bf9d8d123077005b0036142f0b32500de00a5e817bb7a122315129
5
5
  SHA512:
6
- metadata.gz: 12e2aefb84f79c4218fd35a89baecd8664e025a01efc9e8df826a2f49efc697b64739597050dac2a57a85d886e6b43b9c6b91a83f484520143ee9e419943225c
7
- data.tar.gz: 652d7c56e5dee3510d156b5c482fd3bff028a8965d2160c04bde4d80360f53bd45b69013786db5481a35b8bafb06de1cac99e00e2941ae898af886214850fc22
6
+ metadata.gz: f04d0b042d7fb01ff09c1792dc10cf822f0ab6ba65ff689c141882ae8cb8c98f0828018131cf6d2dbc7aa2b9eeb81fae6ff475ce24bbb1a88780298b07aca0a4
7
+ data.tar.gz: 590aa85e4fd2d3b490e89124bc66811c0060bbc352d1b7cb511b59636227d657070770c3bf735048af5ee1d22b756889cf87f74d06023211cee2c3d164393d46
@@ -0,0 +1,1318 @@
1
+ /*!
2
+ * perfect-scrollbar v1.4.0
3
+ * (c) 2018 Hyunje Jun
4
+ * @license MIT
5
+ */
6
+ 'use strict';
7
+
8
+ function get(element) {
9
+ return getComputedStyle(element);
10
+ }
11
+
12
+ function set(element, obj) {
13
+ for (var key in obj) {
14
+ var val = obj[key];
15
+ if (typeof val === 'number') {
16
+ val = val + "px";
17
+ }
18
+ element.style[key] = val;
19
+ }
20
+ return element;
21
+ }
22
+
23
+ function div(className) {
24
+ var div = document.createElement('div');
25
+ div.className = className;
26
+ return div;
27
+ }
28
+
29
+ var elMatches =
30
+ typeof Element !== 'undefined' &&
31
+ (Element.prototype.matches ||
32
+ Element.prototype.webkitMatchesSelector ||
33
+ Element.prototype.mozMatchesSelector ||
34
+ Element.prototype.msMatchesSelector);
35
+
36
+ function matches(element, query) {
37
+ if (!elMatches) {
38
+ throw new Error('No element matching method supported');
39
+ }
40
+
41
+ return elMatches.call(element, query);
42
+ }
43
+
44
+ function remove(element) {
45
+ if (element.remove) {
46
+ element.remove();
47
+ } else {
48
+ if (element.parentNode) {
49
+ element.parentNode.removeChild(element);
50
+ }
51
+ }
52
+ }
53
+
54
+ function queryChildren(element, selector) {
55
+ return Array.prototype.filter.call(element.children, function (child) { return matches(child, selector); }
56
+ );
57
+ }
58
+
59
+ var cls = {
60
+ main: 'ps',
61
+ element: {
62
+ thumb: function (x) { return ("ps__thumb-" + x); },
63
+ rail: function (x) { return ("ps__rail-" + x); },
64
+ consuming: 'ps__child--consume',
65
+ },
66
+ state: {
67
+ focus: 'ps--focus',
68
+ clicking: 'ps--clicking',
69
+ active: function (x) { return ("ps--active-" + x); },
70
+ scrolling: function (x) { return ("ps--scrolling-" + x); },
71
+ },
72
+ };
73
+
74
+ /*
75
+ * Helper methods
76
+ */
77
+ var scrollingClassTimeout = { x: null, y: null };
78
+
79
+ function addScrollingClass(i, x) {
80
+ var classList = i.element.classList;
81
+ var className = cls.state.scrolling(x);
82
+
83
+ if (classList.contains(className)) {
84
+ clearTimeout(scrollingClassTimeout[x]);
85
+ } else {
86
+ classList.add(className);
87
+ }
88
+ }
89
+
90
+ function removeScrollingClass(i, x) {
91
+ scrollingClassTimeout[x] = setTimeout(
92
+ function () { return i.isAlive && i.element.classList.remove(cls.state.scrolling(x)); },
93
+ i.settings.scrollingThreshold
94
+ );
95
+ }
96
+
97
+ function setScrollingClassInstantly(i, x) {
98
+ addScrollingClass(i, x);
99
+ removeScrollingClass(i, x);
100
+ }
101
+
102
+ var EventElement = function EventElement(element) {
103
+ this.element = element;
104
+ this.handlers = {};
105
+ };
106
+
107
+ var prototypeAccessors = { isEmpty: { configurable: true } };
108
+
109
+ EventElement.prototype.bind = function bind (eventName, handler) {
110
+ if (typeof this.handlers[eventName] === 'undefined') {
111
+ this.handlers[eventName] = [];
112
+ }
113
+ this.handlers[eventName].push(handler);
114
+ this.element.addEventListener(eventName, handler, false);
115
+ };
116
+
117
+ EventElement.prototype.unbind = function unbind (eventName, target) {
118
+ var this$1 = this;
119
+
120
+ this.handlers[eventName] = this.handlers[eventName].filter(function (handler) {
121
+ if (target && handler !== target) {
122
+ return true;
123
+ }
124
+ this$1.element.removeEventListener(eventName, handler, false);
125
+ return false;
126
+ });
127
+ };
128
+
129
+ EventElement.prototype.unbindAll = function unbindAll () {
130
+ var this$1 = this;
131
+
132
+ for (var name in this$1.handlers) {
133
+ this$1.unbind(name);
134
+ }
135
+ };
136
+
137
+ prototypeAccessors.isEmpty.get = function () {
138
+ var this$1 = this;
139
+
140
+ return Object.keys(this.handlers).every(
141
+ function (key) { return this$1.handlers[key].length === 0; }
142
+ );
143
+ };
144
+
145
+ Object.defineProperties( EventElement.prototype, prototypeAccessors );
146
+
147
+ var EventManager = function EventManager() {
148
+ this.eventElements = [];
149
+ };
150
+
151
+ EventManager.prototype.eventElement = function eventElement (element) {
152
+ var ee = this.eventElements.filter(function (ee) { return ee.element === element; })[0];
153
+ if (!ee) {
154
+ ee = new EventElement(element);
155
+ this.eventElements.push(ee);
156
+ }
157
+ return ee;
158
+ };
159
+
160
+ EventManager.prototype.bind = function bind (element, eventName, handler) {
161
+ this.eventElement(element).bind(eventName, handler);
162
+ };
163
+
164
+ EventManager.prototype.unbind = function unbind (element, eventName, handler) {
165
+ var ee = this.eventElement(element);
166
+ ee.unbind(eventName, handler);
167
+
168
+ if (ee.isEmpty) {
169
+ // remove
170
+ this.eventElements.splice(this.eventElements.indexOf(ee), 1);
171
+ }
172
+ };
173
+
174
+ EventManager.prototype.unbindAll = function unbindAll () {
175
+ this.eventElements.forEach(function (e) { return e.unbindAll(); });
176
+ this.eventElements = [];
177
+ };
178
+
179
+ EventManager.prototype.once = function once (element, eventName, handler) {
180
+ var ee = this.eventElement(element);
181
+ var onceHandler = function (evt) {
182
+ ee.unbind(eventName, onceHandler);
183
+ handler(evt);
184
+ };
185
+ ee.bind(eventName, onceHandler);
186
+ };
187
+
188
+ function createEvent(name) {
189
+ if (typeof window.CustomEvent === 'function') {
190
+ return new CustomEvent(name);
191
+ } else {
192
+ var evt = document.createEvent('CustomEvent');
193
+ evt.initCustomEvent(name, false, false, undefined);
194
+ return evt;
195
+ }
196
+ }
197
+
198
+ var processScrollDiff = function(
199
+ i,
200
+ axis,
201
+ diff,
202
+ useScrollingClass,
203
+ forceFireReachEvent
204
+ ) {
205
+ if ( useScrollingClass === void 0 ) useScrollingClass = true;
206
+ if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;
207
+
208
+ var fields;
209
+ if (axis === 'top') {
210
+ fields = [
211
+ 'contentHeight',
212
+ 'containerHeight',
213
+ 'scrollTop',
214
+ 'y',
215
+ 'up',
216
+ 'down' ];
217
+ } else if (axis === 'left') {
218
+ fields = [
219
+ 'contentWidth',
220
+ 'containerWidth',
221
+ 'scrollLeft',
222
+ 'x',
223
+ 'left',
224
+ 'right' ];
225
+ } else {
226
+ throw new Error('A proper axis should be provided');
227
+ }
228
+
229
+ processScrollDiff$1(i, diff, fields, useScrollingClass, forceFireReachEvent);
230
+ };
231
+
232
+ function processScrollDiff$1(
233
+ i,
234
+ diff,
235
+ ref,
236
+ useScrollingClass,
237
+ forceFireReachEvent
238
+ ) {
239
+ var contentHeight = ref[0];
240
+ var containerHeight = ref[1];
241
+ var scrollTop = ref[2];
242
+ var y = ref[3];
243
+ var up = ref[4];
244
+ var down = ref[5];
245
+ if ( useScrollingClass === void 0 ) useScrollingClass = true;
246
+ if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;
247
+
248
+ var element = i.element;
249
+
250
+ // reset reach
251
+ i.reach[y] = null;
252
+
253
+ // 1 for subpixel rounding
254
+ if (element[scrollTop] < 1) {
255
+ i.reach[y] = 'start';
256
+ }
257
+
258
+ // 1 for subpixel rounding
259
+ if (element[scrollTop] > i[contentHeight] - i[containerHeight] - 1) {
260
+ i.reach[y] = 'end';
261
+ }
262
+
263
+ if (diff) {
264
+ element.dispatchEvent(createEvent(("ps-scroll-" + y)));
265
+
266
+ if (diff < 0) {
267
+ element.dispatchEvent(createEvent(("ps-scroll-" + up)));
268
+ } else if (diff > 0) {
269
+ element.dispatchEvent(createEvent(("ps-scroll-" + down)));
270
+ }
271
+
272
+ if (useScrollingClass) {
273
+ setScrollingClassInstantly(i, y);
274
+ }
275
+ }
276
+
277
+ if (i.reach[y] && (diff || forceFireReachEvent)) {
278
+ element.dispatchEvent(createEvent(("ps-" + y + "-reach-" + (i.reach[y]))));
279
+ }
280
+ }
281
+
282
+ function toInt(x) {
283
+ return parseInt(x, 10) || 0;
284
+ }
285
+
286
+ function isEditable(el) {
287
+ return (
288
+ matches(el, 'input,[contenteditable]') ||
289
+ matches(el, 'select,[contenteditable]') ||
290
+ matches(el, 'textarea,[contenteditable]') ||
291
+ matches(el, 'button,[contenteditable]')
292
+ );
293
+ }
294
+
295
+ function outerWidth(element) {
296
+ var styles = get(element);
297
+ return (
298
+ toInt(styles.width) +
299
+ toInt(styles.paddingLeft) +
300
+ toInt(styles.paddingRight) +
301
+ toInt(styles.borderLeftWidth) +
302
+ toInt(styles.borderRightWidth)
303
+ );
304
+ }
305
+
306
+ var env = {
307
+ isWebKit:
308
+ typeof document !== 'undefined' &&
309
+ 'WebkitAppearance' in document.documentElement.style,
310
+ supportsTouch:
311
+ typeof window !== 'undefined' &&
312
+ ('ontouchstart' in window ||
313
+ (window.DocumentTouch && document instanceof window.DocumentTouch)),
314
+ supportsIePointer:
315
+ typeof navigator !== 'undefined' && navigator.msMaxTouchPoints,
316
+ isChrome:
317
+ typeof navigator !== 'undefined' &&
318
+ /Chrome/i.test(navigator && navigator.userAgent),
319
+ };
320
+
321
+ var updateGeometry = function(i) {
322
+ var element = i.element;
323
+ var roundedScrollTop = Math.floor(element.scrollTop);
324
+
325
+ i.containerWidth = element.clientWidth;
326
+ i.containerHeight = element.clientHeight;
327
+ i.contentWidth = element.scrollWidth;
328
+ i.contentHeight = element.scrollHeight;
329
+
330
+ if (!element.contains(i.scrollbarXRail)) {
331
+ // clean up and append
332
+ queryChildren(element, cls.element.rail('x')).forEach(function (el) { return remove(el); }
333
+ );
334
+ element.appendChild(i.scrollbarXRail);
335
+ }
336
+ if (!element.contains(i.scrollbarYRail)) {
337
+ // clean up and append
338
+ queryChildren(element, cls.element.rail('y')).forEach(function (el) { return remove(el); }
339
+ );
340
+ element.appendChild(i.scrollbarYRail);
341
+ }
342
+
343
+ if (
344
+ !i.settings.suppressScrollX &&
345
+ i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth
346
+ ) {
347
+ i.scrollbarXActive = true;
348
+ i.railXWidth = i.containerWidth - i.railXMarginWidth;
349
+ i.railXRatio = i.containerWidth / i.railXWidth;
350
+ i.scrollbarXWidth = getThumbSize(
351
+ i,
352
+ toInt(i.railXWidth * i.containerWidth / i.contentWidth)
353
+ );
354
+ i.scrollbarXLeft = toInt(
355
+ (i.negativeScrollAdjustment + element.scrollLeft) *
356
+ (i.railXWidth - i.scrollbarXWidth) /
357
+ (i.contentWidth - i.containerWidth)
358
+ );
359
+ } else {
360
+ i.scrollbarXActive = false;
361
+ }
362
+
363
+ if (
364
+ !i.settings.suppressScrollY &&
365
+ i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight
366
+ ) {
367
+ i.scrollbarYActive = true;
368
+ i.railYHeight = i.containerHeight - i.railYMarginHeight;
369
+ i.railYRatio = i.containerHeight / i.railYHeight;
370
+ i.scrollbarYHeight = getThumbSize(
371
+ i,
372
+ toInt(i.railYHeight * i.containerHeight / i.contentHeight)
373
+ );
374
+ i.scrollbarYTop = toInt(
375
+ roundedScrollTop *
376
+ (i.railYHeight - i.scrollbarYHeight) /
377
+ (i.contentHeight - i.containerHeight)
378
+ );
379
+ } else {
380
+ i.scrollbarYActive = false;
381
+ }
382
+
383
+ if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) {
384
+ i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth;
385
+ }
386
+ if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) {
387
+ i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight;
388
+ }
389
+
390
+ updateCss(element, i);
391
+
392
+ if (i.scrollbarXActive) {
393
+ element.classList.add(cls.state.active('x'));
394
+ } else {
395
+ element.classList.remove(cls.state.active('x'));
396
+ i.scrollbarXWidth = 0;
397
+ i.scrollbarXLeft = 0;
398
+ element.scrollLeft = 0;
399
+ }
400
+ if (i.scrollbarYActive) {
401
+ element.classList.add(cls.state.active('y'));
402
+ } else {
403
+ element.classList.remove(cls.state.active('y'));
404
+ i.scrollbarYHeight = 0;
405
+ i.scrollbarYTop = 0;
406
+ element.scrollTop = 0;
407
+ }
408
+ };
409
+
410
+ function getThumbSize(i, thumbSize) {
411
+ if (i.settings.minScrollbarLength) {
412
+ thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength);
413
+ }
414
+ if (i.settings.maxScrollbarLength) {
415
+ thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength);
416
+ }
417
+ return thumbSize;
418
+ }
419
+
420
+ function updateCss(element, i) {
421
+ var xRailOffset = { width: i.railXWidth };
422
+ var roundedScrollTop = Math.floor(element.scrollTop);
423
+
424
+ if (i.isRtl) {
425
+ xRailOffset.left =
426
+ i.negativeScrollAdjustment +
427
+ element.scrollLeft +
428
+ i.containerWidth -
429
+ i.contentWidth;
430
+ } else {
431
+ xRailOffset.left = element.scrollLeft;
432
+ }
433
+ if (i.isScrollbarXUsingBottom) {
434
+ xRailOffset.bottom = i.scrollbarXBottom - roundedScrollTop;
435
+ } else {
436
+ xRailOffset.top = i.scrollbarXTop + roundedScrollTop;
437
+ }
438
+ set(i.scrollbarXRail, xRailOffset);
439
+
440
+ var yRailOffset = { top: roundedScrollTop, height: i.railYHeight };
441
+ if (i.isScrollbarYUsingRight) {
442
+ if (i.isRtl) {
443
+ yRailOffset.right =
444
+ i.contentWidth -
445
+ (i.negativeScrollAdjustment + element.scrollLeft) -
446
+ i.scrollbarYRight -
447
+ i.scrollbarYOuterWidth;
448
+ } else {
449
+ yRailOffset.right = i.scrollbarYRight - element.scrollLeft;
450
+ }
451
+ } else {
452
+ if (i.isRtl) {
453
+ yRailOffset.left =
454
+ i.negativeScrollAdjustment +
455
+ element.scrollLeft +
456
+ i.containerWidth * 2 -
457
+ i.contentWidth -
458
+ i.scrollbarYLeft -
459
+ i.scrollbarYOuterWidth;
460
+ } else {
461
+ yRailOffset.left = i.scrollbarYLeft + element.scrollLeft;
462
+ }
463
+ }
464
+ set(i.scrollbarYRail, yRailOffset);
465
+
466
+ set(i.scrollbarX, {
467
+ left: i.scrollbarXLeft,
468
+ width: i.scrollbarXWidth - i.railBorderXWidth,
469
+ });
470
+ set(i.scrollbarY, {
471
+ top: i.scrollbarYTop,
472
+ height: i.scrollbarYHeight - i.railBorderYWidth,
473
+ });
474
+ }
475
+
476
+ var clickRail = function(i) {
477
+ i.event.bind(i.scrollbarY, 'mousedown', function (e) { return e.stopPropagation(); });
478
+ i.event.bind(i.scrollbarYRail, 'mousedown', function (e) {
479
+ var positionTop =
480
+ e.pageY -
481
+ window.pageYOffset -
482
+ i.scrollbarYRail.getBoundingClientRect().top;
483
+ var direction = positionTop > i.scrollbarYTop ? 1 : -1;
484
+
485
+ i.element.scrollTop += direction * i.containerHeight;
486
+ updateGeometry(i);
487
+
488
+ e.stopPropagation();
489
+ });
490
+
491
+ i.event.bind(i.scrollbarX, 'mousedown', function (e) { return e.stopPropagation(); });
492
+ i.event.bind(i.scrollbarXRail, 'mousedown', function (e) {
493
+ var positionLeft =
494
+ e.pageX -
495
+ window.pageXOffset -
496
+ i.scrollbarXRail.getBoundingClientRect().left;
497
+ var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;
498
+
499
+ i.element.scrollLeft += direction * i.containerWidth;
500
+ updateGeometry(i);
501
+
502
+ e.stopPropagation();
503
+ });
504
+ };
505
+
506
+ var dragThumb = function(i) {
507
+ bindMouseScrollHandler(i, [
508
+ 'containerWidth',
509
+ 'contentWidth',
510
+ 'pageX',
511
+ 'railXWidth',
512
+ 'scrollbarX',
513
+ 'scrollbarXWidth',
514
+ 'scrollLeft',
515
+ 'x',
516
+ 'scrollbarXRail' ]);
517
+ bindMouseScrollHandler(i, [
518
+ 'containerHeight',
519
+ 'contentHeight',
520
+ 'pageY',
521
+ 'railYHeight',
522
+ 'scrollbarY',
523
+ 'scrollbarYHeight',
524
+ 'scrollTop',
525
+ 'y',
526
+ 'scrollbarYRail' ]);
527
+ };
528
+
529
+ function bindMouseScrollHandler(
530
+ i,
531
+ ref
532
+ ) {
533
+ var containerHeight = ref[0];
534
+ var contentHeight = ref[1];
535
+ var pageY = ref[2];
536
+ var railYHeight = ref[3];
537
+ var scrollbarY = ref[4];
538
+ var scrollbarYHeight = ref[5];
539
+ var scrollTop = ref[6];
540
+ var y = ref[7];
541
+ var scrollbarYRail = ref[8];
542
+
543
+ var element = i.element;
544
+
545
+ var startingScrollTop = null;
546
+ var startingMousePageY = null;
547
+ var scrollBy = null;
548
+
549
+ function mouseMoveHandler(e) {
550
+ element[scrollTop] =
551
+ startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);
552
+ addScrollingClass(i, y);
553
+ updateGeometry(i);
554
+
555
+ e.stopPropagation();
556
+ e.preventDefault();
557
+ }
558
+
559
+ function mouseUpHandler() {
560
+ removeScrollingClass(i, y);
561
+ i[scrollbarYRail].classList.remove(cls.state.clicking);
562
+ i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
563
+ }
564
+
565
+ i.event.bind(i[scrollbarY], 'mousedown', function (e) {
566
+ startingScrollTop = element[scrollTop];
567
+ startingMousePageY = e[pageY];
568
+ scrollBy =
569
+ (i[contentHeight] - i[containerHeight]) /
570
+ (i[railYHeight] - i[scrollbarYHeight]);
571
+
572
+ i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
573
+ i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
574
+
575
+ i[scrollbarYRail].classList.add(cls.state.clicking);
576
+
577
+ e.stopPropagation();
578
+ e.preventDefault();
579
+ });
580
+ }
581
+
582
+ var keyboard = function(i) {
583
+ var element = i.element;
584
+
585
+ var elementHovered = function () { return matches(element, ':hover'); };
586
+ var scrollbarFocused = function () { return matches(i.scrollbarX, ':focus') || matches(i.scrollbarY, ':focus'); };
587
+
588
+ function shouldPreventDefault(deltaX, deltaY) {
589
+ var scrollTop = Math.floor(element.scrollTop);
590
+ if (deltaX === 0) {
591
+ if (!i.scrollbarYActive) {
592
+ return false;
593
+ }
594
+ if (
595
+ (scrollTop === 0 && deltaY > 0) ||
596
+ (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)
597
+ ) {
598
+ return !i.settings.wheelPropagation;
599
+ }
600
+ }
601
+
602
+ var scrollLeft = element.scrollLeft;
603
+ if (deltaY === 0) {
604
+ if (!i.scrollbarXActive) {
605
+ return false;
606
+ }
607
+ if (
608
+ (scrollLeft === 0 && deltaX < 0) ||
609
+ (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)
610
+ ) {
611
+ return !i.settings.wheelPropagation;
612
+ }
613
+ }
614
+ return true;
615
+ }
616
+
617
+ i.event.bind(i.ownerDocument, 'keydown', function (e) {
618
+ if (
619
+ (e.isDefaultPrevented && e.isDefaultPrevented()) ||
620
+ e.defaultPrevented
621
+ ) {
622
+ return;
623
+ }
624
+
625
+ if (!elementHovered() && !scrollbarFocused()) {
626
+ return;
627
+ }
628
+
629
+ var activeElement = document.activeElement
630
+ ? document.activeElement
631
+ : i.ownerDocument.activeElement;
632
+ if (activeElement) {
633
+ if (activeElement.tagName === 'IFRAME') {
634
+ activeElement = activeElement.contentDocument.activeElement;
635
+ } else {
636
+ // go deeper if element is a webcomponent
637
+ while (activeElement.shadowRoot) {
638
+ activeElement = activeElement.shadowRoot.activeElement;
639
+ }
640
+ }
641
+ if (isEditable(activeElement)) {
642
+ return;
643
+ }
644
+ }
645
+
646
+ var deltaX = 0;
647
+ var deltaY = 0;
648
+
649
+ switch (e.which) {
650
+ case 37: // left
651
+ if (e.metaKey) {
652
+ deltaX = -i.contentWidth;
653
+ } else if (e.altKey) {
654
+ deltaX = -i.containerWidth;
655
+ } else {
656
+ deltaX = -30;
657
+ }
658
+ break;
659
+ case 38: // up
660
+ if (e.metaKey) {
661
+ deltaY = i.contentHeight;
662
+ } else if (e.altKey) {
663
+ deltaY = i.containerHeight;
664
+ } else {
665
+ deltaY = 30;
666
+ }
667
+ break;
668
+ case 39: // right
669
+ if (e.metaKey) {
670
+ deltaX = i.contentWidth;
671
+ } else if (e.altKey) {
672
+ deltaX = i.containerWidth;
673
+ } else {
674
+ deltaX = 30;
675
+ }
676
+ break;
677
+ case 40: // down
678
+ if (e.metaKey) {
679
+ deltaY = -i.contentHeight;
680
+ } else if (e.altKey) {
681
+ deltaY = -i.containerHeight;
682
+ } else {
683
+ deltaY = -30;
684
+ }
685
+ break;
686
+ case 32: // space bar
687
+ if (e.shiftKey) {
688
+ deltaY = i.containerHeight;
689
+ } else {
690
+ deltaY = -i.containerHeight;
691
+ }
692
+ break;
693
+ case 33: // page up
694
+ deltaY = i.containerHeight;
695
+ break;
696
+ case 34: // page down
697
+ deltaY = -i.containerHeight;
698
+ break;
699
+ case 36: // home
700
+ deltaY = i.contentHeight;
701
+ break;
702
+ case 35: // end
703
+ deltaY = -i.contentHeight;
704
+ break;
705
+ default:
706
+ return;
707
+ }
708
+
709
+ if (i.settings.suppressScrollX && deltaX !== 0) {
710
+ return;
711
+ }
712
+ if (i.settings.suppressScrollY && deltaY !== 0) {
713
+ return;
714
+ }
715
+
716
+ element.scrollTop -= deltaY;
717
+ element.scrollLeft += deltaX;
718
+ updateGeometry(i);
719
+
720
+ if (shouldPreventDefault(deltaX, deltaY)) {
721
+ e.preventDefault();
722
+ }
723
+ });
724
+ };
725
+
726
+ var wheel = function(i) {
727
+ var element = i.element;
728
+
729
+ function shouldPreventDefault(deltaX, deltaY) {
730
+ var roundedScrollTop = Math.floor(element.scrollTop);
731
+ var isTop = element.scrollTop === 0;
732
+ var isBottom =
733
+ roundedScrollTop + element.offsetHeight === element.scrollHeight;
734
+ var isLeft = element.scrollLeft === 0;
735
+ var isRight =
736
+ element.scrollLeft + element.offsetWidth === element.scrollWidth;
737
+
738
+ var hitsBound;
739
+
740
+ // pick axis with primary direction
741
+ if (Math.abs(deltaY) > Math.abs(deltaX)) {
742
+ hitsBound = isTop || isBottom;
743
+ } else {
744
+ hitsBound = isLeft || isRight;
745
+ }
746
+
747
+ return hitsBound ? !i.settings.wheelPropagation : true;
748
+ }
749
+
750
+ function getDeltaFromEvent(e) {
751
+ var deltaX = e.deltaX;
752
+ var deltaY = -1 * e.deltaY;
753
+
754
+ if (typeof deltaX === 'undefined' || typeof deltaY === 'undefined') {
755
+ // OS X Safari
756
+ deltaX = -1 * e.wheelDeltaX / 6;
757
+ deltaY = e.wheelDeltaY / 6;
758
+ }
759
+
760
+ if (e.deltaMode && e.deltaMode === 1) {
761
+ // Firefox in deltaMode 1: Line scrolling
762
+ deltaX *= 10;
763
+ deltaY *= 10;
764
+ }
765
+
766
+ if (deltaX !== deltaX && deltaY !== deltaY /* NaN checks */) {
767
+ // IE in some mouse drivers
768
+ deltaX = 0;
769
+ deltaY = e.wheelDelta;
770
+ }
771
+
772
+ if (e.shiftKey) {
773
+ // reverse axis with shift key
774
+ return [-deltaY, -deltaX];
775
+ }
776
+ return [deltaX, deltaY];
777
+ }
778
+
779
+ function shouldBeConsumedByChild(target, deltaX, deltaY) {
780
+ // FIXME: this is a workaround for <select> issue in FF and IE #571
781
+ if (!env.isWebKit && element.querySelector('select:focus')) {
782
+ return true;
783
+ }
784
+
785
+ if (!element.contains(target)) {
786
+ return false;
787
+ }
788
+
789
+ var cursor = target;
790
+
791
+ while (cursor && cursor !== element) {
792
+ if (cursor.classList.contains(cls.element.consuming)) {
793
+ return true;
794
+ }
795
+
796
+ var style = get(cursor);
797
+ var overflow = [style.overflow, style.overflowX, style.overflowY].join(
798
+ ''
799
+ );
800
+
801
+ // if scrollable
802
+ if (overflow.match(/(scroll|auto)/)) {
803
+ var maxScrollTop = cursor.scrollHeight - cursor.clientHeight;
804
+ if (maxScrollTop > 0) {
805
+ if (
806
+ !(cursor.scrollTop === 0 && deltaY > 0) &&
807
+ !(cursor.scrollTop === maxScrollTop && deltaY < 0)
808
+ ) {
809
+ return true;
810
+ }
811
+ }
812
+ var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth;
813
+ if (maxScrollLeft > 0) {
814
+ if (
815
+ !(cursor.scrollLeft === 0 && deltaX < 0) &&
816
+ !(cursor.scrollLeft === maxScrollLeft && deltaX > 0)
817
+ ) {
818
+ return true;
819
+ }
820
+ }
821
+ }
822
+
823
+ cursor = cursor.parentNode;
824
+ }
825
+
826
+ return false;
827
+ }
828
+
829
+ function mousewheelHandler(e) {
830
+ var ref = getDeltaFromEvent(e);
831
+ var deltaX = ref[0];
832
+ var deltaY = ref[1];
833
+
834
+ if (shouldBeConsumedByChild(e.target, deltaX, deltaY)) {
835
+ return;
836
+ }
837
+
838
+ var shouldPrevent = false;
839
+ if (!i.settings.useBothWheelAxes) {
840
+ // deltaX will only be used for horizontal scrolling and deltaY will
841
+ // only be used for vertical scrolling - this is the default
842
+ element.scrollTop -= deltaY * i.settings.wheelSpeed;
843
+ element.scrollLeft += deltaX * i.settings.wheelSpeed;
844
+ } else if (i.scrollbarYActive && !i.scrollbarXActive) {
845
+ // only vertical scrollbar is active and useBothWheelAxes option is
846
+ // active, so let's scroll vertical bar using both mouse wheel axes
847
+ if (deltaY) {
848
+ element.scrollTop -= deltaY * i.settings.wheelSpeed;
849
+ } else {
850
+ element.scrollTop += deltaX * i.settings.wheelSpeed;
851
+ }
852
+ shouldPrevent = true;
853
+ } else if (i.scrollbarXActive && !i.scrollbarYActive) {
854
+ // useBothWheelAxes and only horizontal bar is active, so use both
855
+ // wheel axes for horizontal bar
856
+ if (deltaX) {
857
+ element.scrollLeft += deltaX * i.settings.wheelSpeed;
858
+ } else {
859
+ element.scrollLeft -= deltaY * i.settings.wheelSpeed;
860
+ }
861
+ shouldPrevent = true;
862
+ }
863
+
864
+ updateGeometry(i);
865
+
866
+ shouldPrevent = shouldPrevent || shouldPreventDefault(deltaX, deltaY);
867
+ if (shouldPrevent && !e.ctrlKey) {
868
+ e.stopPropagation();
869
+ e.preventDefault();
870
+ }
871
+ }
872
+
873
+ if (typeof window.onwheel !== 'undefined') {
874
+ i.event.bind(element, 'wheel', mousewheelHandler);
875
+ } else if (typeof window.onmousewheel !== 'undefined') {
876
+ i.event.bind(element, 'mousewheel', mousewheelHandler);
877
+ }
878
+ };
879
+
880
+ var touch = function(i) {
881
+ if (!env.supportsTouch && !env.supportsIePointer) {
882
+ return;
883
+ }
884
+
885
+ var element = i.element;
886
+
887
+ function shouldPrevent(deltaX, deltaY) {
888
+ var scrollTop = Math.floor(element.scrollTop);
889
+ var scrollLeft = element.scrollLeft;
890
+ var magnitudeX = Math.abs(deltaX);
891
+ var magnitudeY = Math.abs(deltaY);
892
+
893
+ if (magnitudeY > magnitudeX) {
894
+ // user is perhaps trying to swipe up/down the page
895
+
896
+ if (
897
+ (deltaY < 0 && scrollTop === i.contentHeight - i.containerHeight) ||
898
+ (deltaY > 0 && scrollTop === 0)
899
+ ) {
900
+ // set prevent for mobile Chrome refresh
901
+ return window.scrollY === 0 && deltaY > 0 && env.isChrome;
902
+ }
903
+ } else if (magnitudeX > magnitudeY) {
904
+ // user is perhaps trying to swipe left/right across the page
905
+
906
+ if (
907
+ (deltaX < 0 && scrollLeft === i.contentWidth - i.containerWidth) ||
908
+ (deltaX > 0 && scrollLeft === 0)
909
+ ) {
910
+ return true;
911
+ }
912
+ }
913
+
914
+ return true;
915
+ }
916
+
917
+ function applyTouchMove(differenceX, differenceY) {
918
+ element.scrollTop -= differenceY;
919
+ element.scrollLeft -= differenceX;
920
+
921
+ updateGeometry(i);
922
+ }
923
+
924
+ var startOffset = {};
925
+ var startTime = 0;
926
+ var speed = {};
927
+ var easingLoop = null;
928
+
929
+ function getTouch(e) {
930
+ if (e.targetTouches) {
931
+ return e.targetTouches[0];
932
+ } else {
933
+ // Maybe IE pointer
934
+ return e;
935
+ }
936
+ }
937
+
938
+ function shouldHandle(e) {
939
+ if (e.pointerType && e.pointerType === 'pen' && e.buttons === 0) {
940
+ return false;
941
+ }
942
+ if (e.targetTouches && e.targetTouches.length === 1) {
943
+ return true;
944
+ }
945
+ if (
946
+ e.pointerType &&
947
+ e.pointerType !== 'mouse' &&
948
+ e.pointerType !== e.MSPOINTER_TYPE_MOUSE
949
+ ) {
950
+ return true;
951
+ }
952
+ return false;
953
+ }
954
+
955
+ function touchStart(e) {
956
+ if (!shouldHandle(e)) {
957
+ return;
958
+ }
959
+
960
+ var touch = getTouch(e);
961
+
962
+ startOffset.pageX = touch.pageX;
963
+ startOffset.pageY = touch.pageY;
964
+
965
+ startTime = new Date().getTime();
966
+
967
+ if (easingLoop !== null) {
968
+ clearInterval(easingLoop);
969
+ }
970
+ }
971
+
972
+ function shouldBeConsumedByChild(target, deltaX, deltaY) {
973
+ if (!element.contains(target)) {
974
+ return false;
975
+ }
976
+
977
+ var cursor = target;
978
+
979
+ while (cursor && cursor !== element) {
980
+ if (cursor.classList.contains(cls.element.consuming)) {
981
+ return true;
982
+ }
983
+
984
+ var style = get(cursor);
985
+ var overflow = [style.overflow, style.overflowX, style.overflowY].join(
986
+ ''
987
+ );
988
+
989
+ // if scrollable
990
+ if (overflow.match(/(scroll|auto)/)) {
991
+ var maxScrollTop = cursor.scrollHeight - cursor.clientHeight;
992
+ if (maxScrollTop > 0) {
993
+ if (
994
+ !(cursor.scrollTop === 0 && deltaY > 0) &&
995
+ !(cursor.scrollTop === maxScrollTop && deltaY < 0)
996
+ ) {
997
+ return true;
998
+ }
999
+ }
1000
+ var maxScrollLeft = cursor.scrollLeft - cursor.clientWidth;
1001
+ if (maxScrollLeft > 0) {
1002
+ if (
1003
+ !(cursor.scrollLeft === 0 && deltaX < 0) &&
1004
+ !(cursor.scrollLeft === maxScrollLeft && deltaX > 0)
1005
+ ) {
1006
+ return true;
1007
+ }
1008
+ }
1009
+ }
1010
+
1011
+ cursor = cursor.parentNode;
1012
+ }
1013
+
1014
+ return false;
1015
+ }
1016
+
1017
+ function touchMove(e) {
1018
+ if (shouldHandle(e)) {
1019
+ var touch = getTouch(e);
1020
+
1021
+ var currentOffset = { pageX: touch.pageX, pageY: touch.pageY };
1022
+
1023
+ var differenceX = currentOffset.pageX - startOffset.pageX;
1024
+ var differenceY = currentOffset.pageY - startOffset.pageY;
1025
+
1026
+ if (shouldBeConsumedByChild(e.target, differenceX, differenceY)) {
1027
+ return;
1028
+ }
1029
+
1030
+ applyTouchMove(differenceX, differenceY);
1031
+ startOffset = currentOffset;
1032
+
1033
+ var currentTime = new Date().getTime();
1034
+
1035
+ var timeGap = currentTime - startTime;
1036
+ if (timeGap > 0) {
1037
+ speed.x = differenceX / timeGap;
1038
+ speed.y = differenceY / timeGap;
1039
+ startTime = currentTime;
1040
+ }
1041
+
1042
+ if (shouldPrevent(differenceX, differenceY)) {
1043
+ e.preventDefault();
1044
+ }
1045
+ }
1046
+ }
1047
+ function touchEnd() {
1048
+ if (i.settings.swipeEasing) {
1049
+ clearInterval(easingLoop);
1050
+ easingLoop = setInterval(function() {
1051
+ if (i.isInitialized) {
1052
+ clearInterval(easingLoop);
1053
+ return;
1054
+ }
1055
+
1056
+ if (!speed.x && !speed.y) {
1057
+ clearInterval(easingLoop);
1058
+ return;
1059
+ }
1060
+
1061
+ if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
1062
+ clearInterval(easingLoop);
1063
+ return;
1064
+ }
1065
+
1066
+ applyTouchMove(speed.x * 30, speed.y * 30);
1067
+
1068
+ speed.x *= 0.8;
1069
+ speed.y *= 0.8;
1070
+ }, 10);
1071
+ }
1072
+ }
1073
+
1074
+ if (env.supportsTouch) {
1075
+ i.event.bind(element, 'touchstart', touchStart);
1076
+ i.event.bind(element, 'touchmove', touchMove);
1077
+ i.event.bind(element, 'touchend', touchEnd);
1078
+ } else if (env.supportsIePointer) {
1079
+ if (window.PointerEvent) {
1080
+ i.event.bind(element, 'pointerdown', touchStart);
1081
+ i.event.bind(element, 'pointermove', touchMove);
1082
+ i.event.bind(element, 'pointerup', touchEnd);
1083
+ } else if (window.MSPointerEvent) {
1084
+ i.event.bind(element, 'MSPointerDown', touchStart);
1085
+ i.event.bind(element, 'MSPointerMove', touchMove);
1086
+ i.event.bind(element, 'MSPointerUp', touchEnd);
1087
+ }
1088
+ }
1089
+ };
1090
+
1091
+ var defaultSettings = function () { return ({
1092
+ handlers: ['click-rail', 'drag-thumb', 'keyboard', 'wheel', 'touch'],
1093
+ maxScrollbarLength: null,
1094
+ minScrollbarLength: null,
1095
+ scrollingThreshold: 1000,
1096
+ scrollXMarginOffset: 0,
1097
+ scrollYMarginOffset: 0,
1098
+ suppressScrollX: false,
1099
+ suppressScrollY: false,
1100
+ swipeEasing: true,
1101
+ useBothWheelAxes: false,
1102
+ wheelPropagation: true,
1103
+ wheelSpeed: 1,
1104
+ }); };
1105
+
1106
+ var handlers = {
1107
+ 'click-rail': clickRail,
1108
+ 'drag-thumb': dragThumb,
1109
+ keyboard: keyboard,
1110
+ wheel: wheel,
1111
+ touch: touch,
1112
+ };
1113
+
1114
+ var PerfectScrollbar = function PerfectScrollbar(element, userSettings) {
1115
+ var this$1 = this;
1116
+ if ( userSettings === void 0 ) userSettings = {};
1117
+
1118
+ if (typeof element === 'string') {
1119
+ element = document.querySelector(element);
1120
+ }
1121
+
1122
+ if (!element || !element.nodeName) {
1123
+ throw new Error('no element is specified to initialize PerfectScrollbar');
1124
+ }
1125
+
1126
+ this.element = element;
1127
+
1128
+ element.classList.add(cls.main);
1129
+
1130
+ this.settings = defaultSettings();
1131
+ for (var key in userSettings) {
1132
+ this$1.settings[key] = userSettings[key];
1133
+ }
1134
+
1135
+ this.containerWidth = null;
1136
+ this.containerHeight = null;
1137
+ this.contentWidth = null;
1138
+ this.contentHeight = null;
1139
+
1140
+ var focus = function () { return element.classList.add(cls.state.focus); };
1141
+ var blur = function () { return element.classList.remove(cls.state.focus); };
1142
+
1143
+ this.isRtl = get(element).direction === 'rtl';
1144
+ this.isNegativeScroll = (function () {
1145
+ var originalScrollLeft = element.scrollLeft;
1146
+ var result = null;
1147
+ element.scrollLeft = -1;
1148
+ result = element.scrollLeft < 0;
1149
+ element.scrollLeft = originalScrollLeft;
1150
+ return result;
1151
+ })();
1152
+ this.negativeScrollAdjustment = this.isNegativeScroll
1153
+ ? element.scrollWidth - element.clientWidth
1154
+ : 0;
1155
+ this.event = new EventManager();
1156
+ this.ownerDocument = element.ownerDocument || document;
1157
+
1158
+ this.scrollbarXRail = div(cls.element.rail('x'));
1159
+ element.appendChild(this.scrollbarXRail);
1160
+ this.scrollbarX = div(cls.element.thumb('x'));
1161
+ this.scrollbarXRail.appendChild(this.scrollbarX);
1162
+ this.scrollbarX.setAttribute('tabindex', 0);
1163
+ this.event.bind(this.scrollbarX, 'focus', focus);
1164
+ this.event.bind(this.scrollbarX, 'blur', blur);
1165
+ this.scrollbarXActive = null;
1166
+ this.scrollbarXWidth = null;
1167
+ this.scrollbarXLeft = null;
1168
+ var railXStyle = get(this.scrollbarXRail);
1169
+ this.scrollbarXBottom = parseInt(railXStyle.bottom, 10);
1170
+ if (isNaN(this.scrollbarXBottom)) {
1171
+ this.isScrollbarXUsingBottom = false;
1172
+ this.scrollbarXTop = toInt(railXStyle.top);
1173
+ } else {
1174
+ this.isScrollbarXUsingBottom = true;
1175
+ }
1176
+ this.railBorderXWidth =
1177
+ toInt(railXStyle.borderLeftWidth) + toInt(railXStyle.borderRightWidth);
1178
+ // Set rail to display:block to calculate margins
1179
+ set(this.scrollbarXRail, { display: 'block' });
1180
+ this.railXMarginWidth =
1181
+ toInt(railXStyle.marginLeft) + toInt(railXStyle.marginRight);
1182
+ set(this.scrollbarXRail, { display: '' });
1183
+ this.railXWidth = null;
1184
+ this.railXRatio = null;
1185
+
1186
+ this.scrollbarYRail = div(cls.element.rail('y'));
1187
+ element.appendChild(this.scrollbarYRail);
1188
+ this.scrollbarY = div(cls.element.thumb('y'));
1189
+ this.scrollbarYRail.appendChild(this.scrollbarY);
1190
+ this.scrollbarY.setAttribute('tabindex', 0);
1191
+ this.event.bind(this.scrollbarY, 'focus', focus);
1192
+ this.event.bind(this.scrollbarY, 'blur', blur);
1193
+ this.scrollbarYActive = null;
1194
+ this.scrollbarYHeight = null;
1195
+ this.scrollbarYTop = null;
1196
+ var railYStyle = get(this.scrollbarYRail);
1197
+ this.scrollbarYRight = parseInt(railYStyle.right, 10);
1198
+ if (isNaN(this.scrollbarYRight)) {
1199
+ this.isScrollbarYUsingRight = false;
1200
+ this.scrollbarYLeft = toInt(railYStyle.left);
1201
+ } else {
1202
+ this.isScrollbarYUsingRight = true;
1203
+ }
1204
+ this.scrollbarYOuterWidth = this.isRtl ? outerWidth(this.scrollbarY) : null;
1205
+ this.railBorderYWidth =
1206
+ toInt(railYStyle.borderTopWidth) + toInt(railYStyle.borderBottomWidth);
1207
+ set(this.scrollbarYRail, { display: 'block' });
1208
+ this.railYMarginHeight =
1209
+ toInt(railYStyle.marginTop) + toInt(railYStyle.marginBottom);
1210
+ set(this.scrollbarYRail, { display: '' });
1211
+ this.railYHeight = null;
1212
+ this.railYRatio = null;
1213
+
1214
+ this.reach = {
1215
+ x:
1216
+ element.scrollLeft <= 0
1217
+ ? 'start'
1218
+ : element.scrollLeft >= this.contentWidth - this.containerWidth
1219
+ ? 'end'
1220
+ : null,
1221
+ y:
1222
+ element.scrollTop <= 0
1223
+ ? 'start'
1224
+ : element.scrollTop >= this.contentHeight - this.containerHeight
1225
+ ? 'end'
1226
+ : null,
1227
+ };
1228
+
1229
+ this.isAlive = true;
1230
+
1231
+ this.settings.handlers.forEach(function (handlerName) { return handlers[handlerName](this$1); });
1232
+
1233
+ this.lastScrollTop = Math.floor(element.scrollTop); // for onScroll only
1234
+ this.lastScrollLeft = element.scrollLeft; // for onScroll only
1235
+ this.event.bind(this.element, 'scroll', function (e) { return this$1.onScroll(e); });
1236
+ updateGeometry(this);
1237
+ };
1238
+
1239
+ PerfectScrollbar.prototype.update = function update () {
1240
+ if (!this.isAlive) {
1241
+ return;
1242
+ }
1243
+
1244
+ // Recalcuate negative scrollLeft adjustment
1245
+ this.negativeScrollAdjustment = this.isNegativeScroll
1246
+ ? this.element.scrollWidth - this.element.clientWidth
1247
+ : 0;
1248
+
1249
+ // Recalculate rail margins
1250
+ set(this.scrollbarXRail, { display: 'block' });
1251
+ set(this.scrollbarYRail, { display: 'block' });
1252
+ this.railXMarginWidth =
1253
+ toInt(get(this.scrollbarXRail).marginLeft) +
1254
+ toInt(get(this.scrollbarXRail).marginRight);
1255
+ this.railYMarginHeight =
1256
+ toInt(get(this.scrollbarYRail).marginTop) +
1257
+ toInt(get(this.scrollbarYRail).marginBottom);
1258
+
1259
+ // Hide scrollbars not to affect scrollWidth and scrollHeight
1260
+ set(this.scrollbarXRail, { display: 'none' });
1261
+ set(this.scrollbarYRail, { display: 'none' });
1262
+
1263
+ updateGeometry(this);
1264
+
1265
+ processScrollDiff(this, 'top', 0, false, true);
1266
+ processScrollDiff(this, 'left', 0, false, true);
1267
+
1268
+ set(this.scrollbarXRail, { display: '' });
1269
+ set(this.scrollbarYRail, { display: '' });
1270
+ };
1271
+
1272
+ PerfectScrollbar.prototype.onScroll = function onScroll (e) {
1273
+ if (!this.isAlive) {
1274
+ return;
1275
+ }
1276
+
1277
+ updateGeometry(this);
1278
+ processScrollDiff(this, 'top', this.element.scrollTop - this.lastScrollTop);
1279
+ processScrollDiff(
1280
+ this,
1281
+ 'left',
1282
+ this.element.scrollLeft - this.lastScrollLeft
1283
+ );
1284
+
1285
+ this.lastScrollTop = Math.floor(this.element.scrollTop);
1286
+ this.lastScrollLeft = this.element.scrollLeft;
1287
+ };
1288
+
1289
+ PerfectScrollbar.prototype.destroy = function destroy () {
1290
+ if (!this.isAlive) {
1291
+ return;
1292
+ }
1293
+
1294
+ this.event.unbindAll();
1295
+ remove(this.scrollbarX);
1296
+ remove(this.scrollbarY);
1297
+ remove(this.scrollbarXRail);
1298
+ remove(this.scrollbarYRail);
1299
+ this.removePsClasses();
1300
+
1301
+ // unset elements
1302
+ this.element = null;
1303
+ this.scrollbarX = null;
1304
+ this.scrollbarY = null;
1305
+ this.scrollbarXRail = null;
1306
+ this.scrollbarYRail = null;
1307
+
1308
+ this.isAlive = false;
1309
+ };
1310
+
1311
+ PerfectScrollbar.prototype.removePsClasses = function removePsClasses () {
1312
+ this.element.className = this.element.className
1313
+ .split(' ')
1314
+ .filter(function (name) { return !name.match(/^ps([-_].+|)$/); })
1315
+ .join(' ');
1316
+ };
1317
+
1318
+ module.exports = PerfectScrollbar;