gsap-react-marquee 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var require$$0 = require('react');
6
6
  var react = require('@gsap/react');
7
- var gsap$1 = require('gsap');
7
+ var gsap$4 = require('gsap');
8
8
 
9
9
  var jsxRuntime = {exports: {}};
10
10
 
@@ -425,6 +425,3108 @@ if (process.env.NODE_ENV === 'production') {
425
425
 
426
426
  var jsxRuntimeExports = jsxRuntime.exports;
427
427
 
428
+ /*!
429
+ * matrix 3.13.0
430
+ * https://gsap.com
431
+ *
432
+ * Copyright 2008-2025, GreenSock. All rights reserved.
433
+ * Subject to the terms at https://gsap.com/standard-license
434
+ * @author: Jack Doyle, jack@greensock.com
435
+ */
436
+
437
+ /* eslint-disable */
438
+ var _doc$2,
439
+ _win$2,
440
+ _docElement$1,
441
+ _body$2,
442
+ _divContainer,
443
+ _svgContainer,
444
+ _identityMatrix$1,
445
+ _gEl,
446
+ _transformProp$1 = "transform",
447
+ _transformOriginProp$1 = _transformProp$1 + "Origin",
448
+ _hasOffsetBug,
449
+ _setDoc = function _setDoc(element) {
450
+ var doc = element.ownerDocument || element;
451
+
452
+ if (!(_transformProp$1 in element.style) && "msTransform" in element.style) {
453
+ //to improve compatibility with old Microsoft browsers
454
+ _transformProp$1 = "msTransform";
455
+ _transformOriginProp$1 = _transformProp$1 + "Origin";
456
+ }
457
+
458
+ while (doc.parentNode && (doc = doc.parentNode)) {}
459
+
460
+ _win$2 = window;
461
+ _identityMatrix$1 = new Matrix2D();
462
+
463
+ if (doc) {
464
+ _doc$2 = doc;
465
+ _docElement$1 = doc.documentElement;
466
+ _body$2 = doc.body;
467
+ _gEl = _doc$2.createElementNS("http://www.w3.org/2000/svg", "g"); // prevent any existing CSS from transforming it
468
+
469
+ _gEl.style.transform = "none"; // now test for the offset reporting bug. Use feature detection instead of browser sniffing to make things more bulletproof and future-proof. Hopefully Safari will fix their bug soon.
470
+
471
+ var d1 = doc.createElement("div"),
472
+ d2 = doc.createElement("div"),
473
+ root = doc && (doc.body || doc.firstElementChild);
474
+
475
+ if (root && root.appendChild) {
476
+ root.appendChild(d1);
477
+ d1.appendChild(d2);
478
+ d1.setAttribute("style", "position:static;transform:translate3d(0,0,1px)");
479
+ _hasOffsetBug = d2.offsetParent !== d1;
480
+ root.removeChild(d1);
481
+ }
482
+ }
483
+
484
+ return doc;
485
+ },
486
+ _forceNonZeroScale = function _forceNonZeroScale(e) {
487
+ // walks up the element's ancestors and finds any that had their scale set to 0 via GSAP, and changes them to 0.0001 to ensure that measurements work. Firefox has a bug that causes it to incorrectly report getBoundingClientRect() when scale is 0.
488
+ var a, cache;
489
+
490
+ while (e && e !== _body$2) {
491
+ cache = e._gsap;
492
+ cache && cache.uncache && cache.get(e, "x"); // force re-parsing of transforms if necessary
493
+
494
+ if (cache && !cache.scaleX && !cache.scaleY && cache.renderTransform) {
495
+ cache.scaleX = cache.scaleY = 1e-4;
496
+ cache.renderTransform(1, cache);
497
+ a ? a.push(cache) : a = [cache];
498
+ }
499
+
500
+ e = e.parentNode;
501
+ }
502
+
503
+ return a;
504
+ },
505
+ // possible future addition: pass an element to _forceDisplay() and it'll walk up all its ancestors and make sure anything with display: none is set to display: block, and if there's no parentNode, it'll add it to the body. It returns an Array that you can then feed to _revertDisplay() to have it revert all the changes it made.
506
+ // _forceDisplay = e => {
507
+ // let a = [],
508
+ // parent;
509
+ // while (e && e !== _body) {
510
+ // parent = e.parentNode;
511
+ // (_win.getComputedStyle(e).display === "none" || !parent) && a.push(e, e.style.display, parent) && (e.style.display = "block");
512
+ // parent || _body.appendChild(e);
513
+ // e = parent;
514
+ // }
515
+ // return a;
516
+ // },
517
+ // _revertDisplay = a => {
518
+ // for (let i = 0; i < a.length; i+=3) {
519
+ // a[i+1] ? (a[i].style.display = a[i+1]) : a[i].style.removeProperty("display");
520
+ // a[i+2] || a[i].parentNode.removeChild(a[i]);
521
+ // }
522
+ // },
523
+ _svgTemps = [],
524
+ //we create 3 elements for SVG, and 3 for other DOM elements and cache them for performance reasons. They get nested in _divContainer and _svgContainer so that just one element is added to the DOM on each successive attempt. Again, performance is key.
525
+ _divTemps = [],
526
+ _getDocScrollTop$1 = function _getDocScrollTop() {
527
+ return _win$2.pageYOffset || _doc$2.scrollTop || _docElement$1.scrollTop || _body$2.scrollTop || 0;
528
+ },
529
+ _getDocScrollLeft$1 = function _getDocScrollLeft() {
530
+ return _win$2.pageXOffset || _doc$2.scrollLeft || _docElement$1.scrollLeft || _body$2.scrollLeft || 0;
531
+ },
532
+ _svgOwner = function _svgOwner(element) {
533
+ return element.ownerSVGElement || ((element.tagName + "").toLowerCase() === "svg" ? element : null);
534
+ },
535
+ _isFixed$1 = function _isFixed(element) {
536
+ if (_win$2.getComputedStyle(element).position === "fixed") {
537
+ return true;
538
+ }
539
+
540
+ element = element.parentNode;
541
+
542
+ if (element && element.nodeType === 1) {
543
+ // avoid document fragments which will throw an error.
544
+ return _isFixed(element);
545
+ }
546
+ },
547
+ _createSibling = function _createSibling(element, i) {
548
+ if (element.parentNode && (_doc$2 || _setDoc(element))) {
549
+ var svg = _svgOwner(element),
550
+ ns = svg ? svg.getAttribute("xmlns") || "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml",
551
+ type = svg ? i ? "rect" : "g" : "div",
552
+ x = i !== 2 ? 0 : 100,
553
+ y = i === 3 ? 100 : 0,
554
+ css = "position:absolute;display:block;pointer-events:none;margin:0;padding:0;",
555
+ e = _doc$2.createElementNS ? _doc$2.createElementNS(ns.replace(/^https/, "http"), type) : _doc$2.createElement(type);
556
+
557
+ if (i) {
558
+ if (!svg) {
559
+ if (!_divContainer) {
560
+ _divContainer = _createSibling(element);
561
+ _divContainer.style.cssText = css;
562
+ }
563
+
564
+ e.style.cssText = css + "width:0.1px;height:0.1px;top:" + y + "px;left:" + x + "px";
565
+
566
+ _divContainer.appendChild(e);
567
+ } else {
568
+ _svgContainer || (_svgContainer = _createSibling(element));
569
+ e.setAttribute("width", 0.01);
570
+ e.setAttribute("height", 0.01);
571
+ e.setAttribute("transform", "translate(" + x + "," + y + ")");
572
+
573
+ _svgContainer.appendChild(e);
574
+ }
575
+ }
576
+
577
+ return e;
578
+ }
579
+
580
+ throw "Need document and parent.";
581
+ },
582
+ _consolidate = function _consolidate(m) {
583
+ // replaces SVGTransformList.consolidate() because a bug in Firefox causes it to break pointer events. See https://gsap.com/forums/topic/23248-touch-is-not-working-on-draggable-in-firefox-windows-v324/?tab=comments#comment-109800
584
+ var c = new Matrix2D(),
585
+ i = 0;
586
+
587
+ for (; i < m.numberOfItems; i++) {
588
+ c.multiply(m.getItem(i).matrix);
589
+ }
590
+
591
+ return c;
592
+ },
593
+ _getCTM = function _getCTM(svg) {
594
+ var m = svg.getCTM(),
595
+ transform;
596
+
597
+ if (!m) {
598
+ // Firefox returns null for getCTM() on root <svg> elements, so this is a workaround using a <g> that we temporarily append.
599
+ transform = svg.style[_transformProp$1];
600
+ svg.style[_transformProp$1] = "none"; // a bug in Firefox causes css transforms to contaminate the getCTM()
601
+
602
+ svg.appendChild(_gEl);
603
+ m = _gEl.getCTM();
604
+ svg.removeChild(_gEl);
605
+ transform ? svg.style[_transformProp$1] = transform : svg.style.removeProperty(_transformProp$1.replace(/([A-Z])/g, "-$1").toLowerCase());
606
+ }
607
+
608
+ return m || _identityMatrix$1.clone(); // Firefox will still return null if the <svg> has a width/height of 0 in the browser.
609
+ },
610
+ _placeSiblings = function _placeSiblings(element, adjustGOffset) {
611
+ var svg = _svgOwner(element),
612
+ isRootSVG = element === svg,
613
+ siblings = svg ? _svgTemps : _divTemps,
614
+ parent = element.parentNode,
615
+ appendToEl = parent && !svg && parent.shadowRoot && parent.shadowRoot.appendChild ? parent.shadowRoot : parent,
616
+ container,
617
+ m,
618
+ b,
619
+ x,
620
+ y,
621
+ cs;
622
+
623
+ if (element === _win$2) {
624
+ return element;
625
+ }
626
+
627
+ siblings.length || siblings.push(_createSibling(element, 1), _createSibling(element, 2), _createSibling(element, 3));
628
+ container = svg ? _svgContainer : _divContainer;
629
+
630
+ if (svg) {
631
+ if (isRootSVG) {
632
+ b = _getCTM(element);
633
+ x = -b.e / b.a;
634
+ y = -b.f / b.d;
635
+ m = _identityMatrix$1;
636
+ } else if (element.getBBox) {
637
+ b = element.getBBox();
638
+ m = element.transform ? element.transform.baseVal : {}; // IE11 doesn't follow the spec.
639
+
640
+ m = !m.numberOfItems ? _identityMatrix$1 : m.numberOfItems > 1 ? _consolidate(m) : m.getItem(0).matrix; // don't call m.consolidate().matrix because a bug in Firefox makes pointer events not work when consolidate() is called on the same tick as getBoundingClientRect()! See https://gsap.com/forums/topic/23248-touch-is-not-working-on-draggable-in-firefox-windows-v324/?tab=comments#comment-109800
641
+
642
+ x = m.a * b.x + m.c * b.y;
643
+ y = m.b * b.x + m.d * b.y;
644
+ } else {
645
+ // may be a <mask> which has no getBBox() so just use defaults instead of throwing errors.
646
+ m = new Matrix2D();
647
+ x = y = 0;
648
+ }
649
+
650
+ (isRootSVG ? svg : parent).appendChild(container);
651
+ container.setAttribute("transform", "matrix(" + m.a + "," + m.b + "," + m.c + "," + m.d + "," + (m.e + x) + "," + (m.f + y) + ")");
652
+ } else {
653
+ x = y = 0;
654
+
655
+ if (_hasOffsetBug) {
656
+ // some browsers (like Safari) have a bug that causes them to misreport offset values. When an ancestor element has a transform applied, it's supposed to treat it as if it's position: relative (new context). Safari botches this, so we need to find the closest ancestor (between the element and its offsetParent) that has a transform applied and if one is found, grab its offsetTop/Left and subtract them to compensate.
657
+ m = element.offsetParent;
658
+ b = element;
659
+
660
+ while (b && (b = b.parentNode) && b !== m && b.parentNode) {
661
+ if ((_win$2.getComputedStyle(b)[_transformProp$1] + "").length > 4) {
662
+ x = b.offsetLeft;
663
+ y = b.offsetTop;
664
+ b = 0;
665
+ }
666
+ }
667
+ }
668
+
669
+ cs = _win$2.getComputedStyle(element);
670
+
671
+ if (cs.position !== "absolute" && cs.position !== "fixed") {
672
+ m = element.offsetParent;
673
+
674
+ while (parent && parent !== m) {
675
+ // if there's an ancestor element between the element and its offsetParent that's scrolled, we must factor that in.
676
+ x += parent.scrollLeft || 0;
677
+ y += parent.scrollTop || 0;
678
+ parent = parent.parentNode;
679
+ }
680
+ }
681
+
682
+ b = container.style;
683
+ b.top = element.offsetTop - y + "px";
684
+ b.left = element.offsetLeft - x + "px";
685
+ b[_transformProp$1] = cs[_transformProp$1];
686
+ b[_transformOriginProp$1] = cs[_transformOriginProp$1]; // b.border = m.border;
687
+ // b.borderLeftStyle = m.borderLeftStyle;
688
+ // b.borderTopStyle = m.borderTopStyle;
689
+ // b.borderLeftWidth = m.borderLeftWidth;
690
+ // b.borderTopWidth = m.borderTopWidth;
691
+
692
+ b.position = cs.position === "fixed" ? "fixed" : "absolute";
693
+ appendToEl.appendChild(container);
694
+ }
695
+
696
+ return container;
697
+ },
698
+ _setMatrix = function _setMatrix(m, a, b, c, d, e, f) {
699
+ m.a = a;
700
+ m.b = b;
701
+ m.c = c;
702
+ m.d = d;
703
+ m.e = e;
704
+ m.f = f;
705
+ return m;
706
+ };
707
+
708
+ var Matrix2D = /*#__PURE__*/function () {
709
+ function Matrix2D(a, b, c, d, e, f) {
710
+ if (a === void 0) {
711
+ a = 1;
712
+ }
713
+
714
+ if (b === void 0) {
715
+ b = 0;
716
+ }
717
+
718
+ if (c === void 0) {
719
+ c = 0;
720
+ }
721
+
722
+ if (d === void 0) {
723
+ d = 1;
724
+ }
725
+
726
+ if (e === void 0) {
727
+ e = 0;
728
+ }
729
+
730
+ if (f === void 0) {
731
+ f = 0;
732
+ }
733
+
734
+ _setMatrix(this, a, b, c, d, e, f);
735
+ }
736
+
737
+ var _proto = Matrix2D.prototype;
738
+
739
+ _proto.inverse = function inverse() {
740
+ var a = this.a,
741
+ b = this.b,
742
+ c = this.c,
743
+ d = this.d,
744
+ e = this.e,
745
+ f = this.f,
746
+ determinant = a * d - b * c || 1e-10;
747
+ return _setMatrix(this, d / determinant, -b / determinant, -c / determinant, a / determinant, (c * f - d * e) / determinant, -(a * f - b * e) / determinant);
748
+ };
749
+
750
+ _proto.multiply = function multiply(matrix) {
751
+ var a = this.a,
752
+ b = this.b,
753
+ c = this.c,
754
+ d = this.d,
755
+ e = this.e,
756
+ f = this.f,
757
+ a2 = matrix.a,
758
+ b2 = matrix.c,
759
+ c2 = matrix.b,
760
+ d2 = matrix.d,
761
+ e2 = matrix.e,
762
+ f2 = matrix.f;
763
+ return _setMatrix(this, a2 * a + c2 * c, a2 * b + c2 * d, b2 * a + d2 * c, b2 * b + d2 * d, e + e2 * a + f2 * c, f + e2 * b + f2 * d);
764
+ };
765
+
766
+ _proto.clone = function clone() {
767
+ return new Matrix2D(this.a, this.b, this.c, this.d, this.e, this.f);
768
+ };
769
+
770
+ _proto.equals = function equals(matrix) {
771
+ var a = this.a,
772
+ b = this.b,
773
+ c = this.c,
774
+ d = this.d,
775
+ e = this.e,
776
+ f = this.f;
777
+ return a === matrix.a && b === matrix.b && c === matrix.c && d === matrix.d && e === matrix.e && f === matrix.f;
778
+ };
779
+
780
+ _proto.apply = function apply(point, decoratee) {
781
+ if (decoratee === void 0) {
782
+ decoratee = {};
783
+ }
784
+
785
+ var x = point.x,
786
+ y = point.y,
787
+ a = this.a,
788
+ b = this.b,
789
+ c = this.c,
790
+ d = this.d,
791
+ e = this.e,
792
+ f = this.f;
793
+ decoratee.x = x * a + y * c + e || 0;
794
+ decoratee.y = x * b + y * d + f || 0;
795
+ return decoratee;
796
+ };
797
+
798
+ return Matrix2D;
799
+ }(); // Feed in an element and it'll return a 2D matrix (optionally inverted) so that you can translate between coordinate spaces.
800
+ // Inverting lets you translate a global point into a local coordinate space. No inverting lets you go the other way.
801
+ // We needed this to work around various browser bugs, like Firefox doesn't accurately report getScreenCTM() when there
802
+ // are transforms applied to ancestor elements.
803
+ // The matrix math to convert any x/y coordinate is as follows, which is wrapped in a convenient apply() method of Matrix2D above:
804
+ // tx = m.a * x + m.c * y + m.e
805
+ // ty = m.b * x + m.d * y + m.f
806
+
807
+ function getGlobalMatrix(element, inverse, adjustGOffset, includeScrollInFixed) {
808
+ // adjustGOffset is typically used only when grabbing an element's PARENT's global matrix, and it ignores the x/y offset of any SVG <g> elements because they behave in a special way.
809
+ if (!element || !element.parentNode || (_doc$2 || _setDoc(element)).documentElement === element) {
810
+ return new Matrix2D();
811
+ }
812
+
813
+ var zeroScales = _forceNonZeroScale(element),
814
+ svg = _svgOwner(element),
815
+ temps = svg ? _svgTemps : _divTemps,
816
+ container = _placeSiblings(element),
817
+ b1 = temps[0].getBoundingClientRect(),
818
+ b2 = temps[1].getBoundingClientRect(),
819
+ b3 = temps[2].getBoundingClientRect(),
820
+ parent = container.parentNode,
821
+ isFixed = _isFixed$1(element),
822
+ m = new Matrix2D((b2.left - b1.left) / 100, (b2.top - b1.top) / 100, (b3.left - b1.left) / 100, (b3.top - b1.top) / 100, b1.left + (isFixed ? 0 : _getDocScrollLeft$1()), b1.top + (isFixed ? 0 : _getDocScrollTop$1()));
823
+
824
+ parent.removeChild(container);
825
+
826
+ if (zeroScales) {
827
+ b1 = zeroScales.length;
828
+
829
+ while (b1--) {
830
+ b2 = zeroScales[b1];
831
+ b2.scaleX = b2.scaleY = 0;
832
+ b2.renderTransform(1, b2);
833
+ }
834
+ }
835
+
836
+ return inverse ? m.inverse() : m;
837
+ }
838
+ // _doc || _setDoc(element);
839
+ // let m = (_win.getComputedStyle(element)[_transformProp] + "").substr(7).match(/[-.]*\d+[.e\-+]*\d*[e\-\+]*\d*/g),
840
+ // is2D = m && m.length === 6;
841
+ // return !m || m.length < 6 ? new Matrix2D() : new Matrix2D(+m[0], +m[1], +m[is2D ? 2 : 4], +m[is2D ? 3 : 5], +m[is2D ? 4 : 12], +m[is2D ? 5 : 13]);
842
+ // }
843
+
844
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
845
+
846
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
847
+
848
+ var gsap$3,
849
+ _win$1,
850
+ _doc$1,
851
+ _docElement,
852
+ _body$1,
853
+ _tempDiv,
854
+ _placeholderDiv,
855
+ _coreInitted$3,
856
+ _checkPrefix,
857
+ _toArray$2,
858
+ _supportsPassive,
859
+ _isTouchDevice,
860
+ _touchEventLookup,
861
+ _isMultiTouching,
862
+ _isAndroid,
863
+ InertiaPlugin$1,
864
+ _defaultCursor,
865
+ _supportsPointer,
866
+ _context$1,
867
+ _getStyleSaver$1,
868
+ _dragCount = 0,
869
+ _windowExists = function _windowExists() {
870
+ return typeof window !== "undefined";
871
+ },
872
+ _getGSAP$3 = function _getGSAP() {
873
+ return gsap$3 || _windowExists() && (gsap$3 = window.gsap) && gsap$3.registerPlugin && gsap$3;
874
+ },
875
+ _isFunction$1 = function _isFunction(value) {
876
+ return typeof value === "function";
877
+ },
878
+ _isObject$1 = function _isObject(value) {
879
+ return typeof value === "object";
880
+ },
881
+ _isUndefined = function _isUndefined(value) {
882
+ return typeof value === "undefined";
883
+ },
884
+ _emptyFunc$1 = function _emptyFunc() {
885
+ return false;
886
+ },
887
+ _transformProp = "transform",
888
+ _transformOriginProp = "transformOrigin",
889
+ _round$2 = function _round(value) {
890
+ return Math.round(value * 10000) / 10000;
891
+ },
892
+ _isArray$1 = Array.isArray,
893
+ _createElement = function _createElement(type, ns) {
894
+ var e = _doc$1.createElementNS ? _doc$1.createElementNS(("http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type); //some servers swap in https for http in the namespace which can break things, making "style" inaccessible.
895
+
896
+ return e.style ? e : _doc$1.createElement(type); //some environments won't allow access to the element's style when created with a namespace in which case we default to the standard createElement() to work around the issue. Also note that when GSAP is embedded directly inside an SVG file, createElement() won't allow access to the style object in Firefox (see https://gsap.com/forums/topic/20215-problem-using-tweenmax-in-standalone-self-containing-svg-file-err-cannot-set-property-csstext-of-undefined/).
897
+ },
898
+ _RAD2DEG = 180 / Math.PI,
899
+ _bigNum$1 = 1e20,
900
+ _identityMatrix = new Matrix2D(),
901
+ _getTime$1 = Date.now || function () {
902
+ return new Date().getTime();
903
+ },
904
+ _renderQueue = [],
905
+ _lookup$1 = {},
906
+ //when a Draggable is created, the target gets a unique _gsDragID property that allows gets associated with the Draggable instance for quick lookups in Draggable.get(). This avoids circular references that could cause gc problems.
907
+ _lookupCount = 0,
908
+ _clickableTagExp = /^(?:a|input|textarea|button|select)$/i,
909
+ _lastDragTime = 0,
910
+ _temp1 = {},
911
+ // a simple object we reuse and populate (usually x/y properties) to conserve memory and improve performance.
912
+ _windowProxy = {},
913
+ //memory/performance optimization - we reuse this object during autoScroll to store window-related bounds/offsets.
914
+ _copy = function _copy(obj, factor) {
915
+ var copy = {},
916
+ p;
917
+
918
+ for (p in obj) {
919
+ copy[p] = factor ? obj[p] * factor : obj[p];
920
+ }
921
+
922
+ return copy;
923
+ },
924
+ _extend$1 = function _extend(obj, defaults) {
925
+ for (var p in defaults) {
926
+ if (!(p in obj)) {
927
+ obj[p] = defaults[p];
928
+ }
929
+ }
930
+
931
+ return obj;
932
+ },
933
+ _setTouchActionForAllDescendants = function _setTouchActionForAllDescendants(elements, value) {
934
+ var i = elements.length,
935
+ children;
936
+
937
+ while (i--) {
938
+ value ? elements[i].style.touchAction = value : elements[i].style.removeProperty("touch-action");
939
+ children = elements[i].children;
940
+ children && children.length && _setTouchActionForAllDescendants(children, value);
941
+ }
942
+ },
943
+ _renderQueueTick = function _renderQueueTick() {
944
+ return _renderQueue.forEach(function (func) {
945
+ return func();
946
+ });
947
+ },
948
+ _addToRenderQueue = function _addToRenderQueue(func) {
949
+ _renderQueue.push(func);
950
+
951
+ if (_renderQueue.length === 1) {
952
+ gsap$3.ticker.add(_renderQueueTick);
953
+ }
954
+ },
955
+ _renderQueueTimeout = function _renderQueueTimeout() {
956
+ return !_renderQueue.length && gsap$3.ticker.remove(_renderQueueTick);
957
+ },
958
+ _removeFromRenderQueue = function _removeFromRenderQueue(func) {
959
+ var i = _renderQueue.length;
960
+
961
+ while (i--) {
962
+ if (_renderQueue[i] === func) {
963
+ _renderQueue.splice(i, 1);
964
+ }
965
+ }
966
+
967
+ gsap$3.to(_renderQueueTimeout, {
968
+ overwrite: true,
969
+ delay: 15,
970
+ duration: 0,
971
+ onComplete: _renderQueueTimeout,
972
+ data: "_draggable"
973
+ }); //remove the "tick" listener only after the render queue is empty for 15 seconds (to improve performance). Adding/removing it constantly for every click/touch wouldn't deliver optimal speed, and we also don't want the ticker to keep calling the render method when things are idle for long periods of time (we want to improve battery life on mobile devices).
974
+ },
975
+ _setDefaults = function _setDefaults(obj, defaults) {
976
+ for (var p in defaults) {
977
+ if (!(p in obj)) {
978
+ obj[p] = defaults[p];
979
+ }
980
+ }
981
+
982
+ return obj;
983
+ },
984
+ _addListener$1 = function _addListener(element, type, func, capture) {
985
+ if (element.addEventListener) {
986
+ var touchType = _touchEventLookup[type];
987
+ capture = capture || (_supportsPassive ? {
988
+ passive: false
989
+ } : null);
990
+ element.addEventListener(touchType || type, func, capture);
991
+ touchType && type !== touchType && element.addEventListener(type, func, capture); //some browsers actually support both, so must we. But pointer events cover all.
992
+ }
993
+ },
994
+ _removeListener$1 = function _removeListener(element, type, func, capture) {
995
+ if (element.removeEventListener) {
996
+ var touchType = _touchEventLookup[type];
997
+ element.removeEventListener(touchType || type, func, capture);
998
+ touchType && type !== touchType && element.removeEventListener(type, func, capture);
999
+ }
1000
+ },
1001
+ _preventDefault = function _preventDefault(event) {
1002
+ event.preventDefault && event.preventDefault();
1003
+ event.preventManipulation && event.preventManipulation(); //for some Microsoft browsers
1004
+ },
1005
+ _hasTouchID = function _hasTouchID(list, ID) {
1006
+ var i = list.length;
1007
+
1008
+ while (i--) {
1009
+ if (list[i].identifier === ID) {
1010
+ return true;
1011
+ }
1012
+ }
1013
+ },
1014
+ _onMultiTouchDocumentEnd = function _onMultiTouchDocumentEnd(event) {
1015
+ _isMultiTouching = event.touches && _dragCount < event.touches.length;
1016
+
1017
+ _removeListener$1(event.target, "touchend", _onMultiTouchDocumentEnd);
1018
+ },
1019
+ _onMultiTouchDocument = function _onMultiTouchDocument(event) {
1020
+ _isMultiTouching = event.touches && _dragCount < event.touches.length;
1021
+
1022
+ _addListener$1(event.target, "touchend", _onMultiTouchDocumentEnd);
1023
+ },
1024
+ _getDocScrollTop = function _getDocScrollTop(doc) {
1025
+ return _win$1.pageYOffset || doc.scrollTop || doc.documentElement.scrollTop || doc.body.scrollTop || 0;
1026
+ },
1027
+ _getDocScrollLeft = function _getDocScrollLeft(doc) {
1028
+ return _win$1.pageXOffset || doc.scrollLeft || doc.documentElement.scrollLeft || doc.body.scrollLeft || 0;
1029
+ },
1030
+ _addScrollListener = function _addScrollListener(e, callback) {
1031
+ _addListener$1(e, "scroll", callback);
1032
+
1033
+ if (!_isRoot(e.parentNode)) {
1034
+ _addScrollListener(e.parentNode, callback);
1035
+ }
1036
+ },
1037
+ _removeScrollListener = function _removeScrollListener(e, callback) {
1038
+ _removeListener$1(e, "scroll", callback);
1039
+
1040
+ if (!_isRoot(e.parentNode)) {
1041
+ _removeScrollListener(e.parentNode, callback);
1042
+ }
1043
+ },
1044
+ _isRoot = function _isRoot(e) {
1045
+ return !!(!e || e === _docElement || e.nodeType === 9 || e === _doc$1.body || e === _win$1 || !e.nodeType || !e.parentNode);
1046
+ },
1047
+ _getMaxScroll = function _getMaxScroll(element, axis) {
1048
+ var dim = axis === "x" ? "Width" : "Height",
1049
+ scroll = "scroll" + dim,
1050
+ client = "client" + dim;
1051
+ return Math.max(0, _isRoot(element) ? Math.max(_docElement[scroll], _body$1[scroll]) - (_win$1["inner" + dim] || _docElement[client] || _body$1[client]) : element[scroll] - element[client]);
1052
+ },
1053
+ _recordMaxScrolls = function _recordMaxScrolls(e, skipCurrent) {
1054
+ //records _gsMaxScrollX and _gsMaxScrollY properties for the element and all ancestors up the chain so that we can cap it, otherwise dragging beyond the edges with autoScroll on can endlessly scroll.
1055
+ var x = _getMaxScroll(e, "x"),
1056
+ y = _getMaxScroll(e, "y");
1057
+
1058
+ if (_isRoot(e)) {
1059
+ e = _windowProxy;
1060
+ } else {
1061
+ _recordMaxScrolls(e.parentNode, skipCurrent);
1062
+ }
1063
+
1064
+ e._gsMaxScrollX = x;
1065
+ e._gsMaxScrollY = y;
1066
+
1067
+ if (!skipCurrent) {
1068
+ e._gsScrollX = e.scrollLeft || 0;
1069
+ e._gsScrollY = e.scrollTop || 0;
1070
+ }
1071
+ },
1072
+ _setStyle = function _setStyle(element, property, value) {
1073
+ var style = element.style;
1074
+
1075
+ if (!style) {
1076
+ return;
1077
+ }
1078
+
1079
+ if (_isUndefined(style[property])) {
1080
+ property = _checkPrefix(property, element) || property;
1081
+ }
1082
+
1083
+ if (value == null) {
1084
+ style.removeProperty && style.removeProperty(property.replace(/([A-Z])/g, "-$1").toLowerCase());
1085
+ } else {
1086
+ style[property] = value;
1087
+ }
1088
+ },
1089
+ _getComputedStyle = function _getComputedStyle(element) {
1090
+ return _win$1.getComputedStyle(element instanceof Element ? element : element.host || (element.parentNode || {}).host || element);
1091
+ },
1092
+ //the "host" stuff helps to accommodate ShadowDom objects.
1093
+ _tempRect = {},
1094
+ //reuse to reduce garbage collection tasks
1095
+ _parseRect = function _parseRect(e) {
1096
+ //accepts a DOM element, a mouse event, or a rectangle object and returns the corresponding rectangle with left, right, width, height, top, and bottom properties
1097
+ if (e === _win$1) {
1098
+ _tempRect.left = _tempRect.top = 0;
1099
+ _tempRect.width = _tempRect.right = _docElement.clientWidth || e.innerWidth || _body$1.clientWidth || 0;
1100
+ _tempRect.height = _tempRect.bottom = (e.innerHeight || 0) - 20 < _docElement.clientHeight ? _docElement.clientHeight : e.innerHeight || _body$1.clientHeight || 0;
1101
+ return _tempRect;
1102
+ }
1103
+
1104
+ var doc = e.ownerDocument || _doc$1,
1105
+ r = !_isUndefined(e.pageX) ? {
1106
+ left: e.pageX - _getDocScrollLeft(doc),
1107
+ top: e.pageY - _getDocScrollTop(doc),
1108
+ right: e.pageX - _getDocScrollLeft(doc) + 1,
1109
+ bottom: e.pageY - _getDocScrollTop(doc) + 1
1110
+ } : !e.nodeType && !_isUndefined(e.left) && !_isUndefined(e.top) ? e : _toArray$2(e)[0].getBoundingClientRect();
1111
+
1112
+ if (_isUndefined(r.right) && !_isUndefined(r.width)) {
1113
+ r.right = r.left + r.width;
1114
+ r.bottom = r.top + r.height;
1115
+ } else if (_isUndefined(r.width)) {
1116
+ //some browsers don't include width and height properties. We can't just set them directly on r because some browsers throw errors, so create a new generic object.
1117
+ r = {
1118
+ width: r.right - r.left,
1119
+ height: r.bottom - r.top,
1120
+ right: r.right,
1121
+ left: r.left,
1122
+ bottom: r.bottom,
1123
+ top: r.top
1124
+ };
1125
+ }
1126
+
1127
+ return r;
1128
+ },
1129
+ _dispatchEvent = function _dispatchEvent(target, type, callbackName) {
1130
+ var vars = target.vars,
1131
+ callback = vars[callbackName],
1132
+ listeners = target._listeners[type],
1133
+ result;
1134
+
1135
+ if (_isFunction$1(callback)) {
1136
+ result = callback.apply(vars.callbackScope || target, vars[callbackName + "Params"] || [target.pointerEvent]);
1137
+ }
1138
+
1139
+ if (listeners && target.dispatchEvent(type) === false) {
1140
+ result = false;
1141
+ }
1142
+
1143
+ return result;
1144
+ },
1145
+ _getBounds = function _getBounds(target, context) {
1146
+ //accepts any of the following: a DOM element, jQuery object, selector text, or an object defining bounds as {top, left, width, height} or {minX, maxX, minY, maxY}. Returns an object with left, top, width, and height properties.
1147
+ var e = _toArray$2(target)[0],
1148
+ top,
1149
+ left,
1150
+ offset;
1151
+
1152
+ if (!e.nodeType && e !== _win$1) {
1153
+ if (!_isUndefined(target.left)) {
1154
+ offset = {
1155
+ x: 0,
1156
+ y: 0
1157
+ }; //_getOffsetTransformOrigin(context); //the bounds should be relative to the origin
1158
+
1159
+ return {
1160
+ left: target.left - offset.x,
1161
+ top: target.top - offset.y,
1162
+ width: target.width,
1163
+ height: target.height
1164
+ };
1165
+ }
1166
+
1167
+ left = target.min || target.minX || target.minRotation || 0;
1168
+ top = target.min || target.minY || 0;
1169
+ return {
1170
+ left: left,
1171
+ top: top,
1172
+ width: (target.max || target.maxX || target.maxRotation || 0) - left,
1173
+ height: (target.max || target.maxY || 0) - top
1174
+ };
1175
+ }
1176
+
1177
+ return _getElementBounds(e, context);
1178
+ },
1179
+ _point1 = {},
1180
+ //we reuse to minimize garbage collection tasks.
1181
+ _getElementBounds = function _getElementBounds(element, context) {
1182
+ context = _toArray$2(context)[0];
1183
+ var isSVG = element.getBBox && element.ownerSVGElement,
1184
+ doc = element.ownerDocument || _doc$1,
1185
+ left,
1186
+ right,
1187
+ top,
1188
+ bottom,
1189
+ matrix,
1190
+ p1,
1191
+ p2,
1192
+ p3,
1193
+ p4,
1194
+ bbox,
1195
+ width,
1196
+ height,
1197
+ cs;
1198
+
1199
+ if (element === _win$1) {
1200
+ top = _getDocScrollTop(doc);
1201
+ left = _getDocScrollLeft(doc);
1202
+ right = left + (doc.documentElement.clientWidth || element.innerWidth || doc.body.clientWidth || 0);
1203
+ bottom = top + ((element.innerHeight || 0) - 20 < doc.documentElement.clientHeight ? doc.documentElement.clientHeight : element.innerHeight || doc.body.clientHeight || 0); //some browsers (like Firefox) ignore absolutely positioned elements, and collapse the height of the documentElement, so it could be 8px, for example, if you have just an absolutely positioned div. In that case, we use the innerHeight to resolve this.
1204
+ } else if (context === _win$1 || _isUndefined(context)) {
1205
+ return element.getBoundingClientRect();
1206
+ } else {
1207
+ left = top = 0;
1208
+
1209
+ if (isSVG) {
1210
+ bbox = element.getBBox();
1211
+ width = bbox.width;
1212
+ height = bbox.height;
1213
+ } else {
1214
+ if (element.viewBox && (bbox = element.viewBox.baseVal)) {
1215
+ left = bbox.x || 0;
1216
+ top = bbox.y || 0;
1217
+ width = bbox.width;
1218
+ height = bbox.height;
1219
+ }
1220
+
1221
+ if (!width) {
1222
+ cs = _getComputedStyle(element);
1223
+ bbox = cs.boxSizing === "border-box";
1224
+ width = (parseFloat(cs.width) || element.clientWidth || 0) + (bbox ? 0 : parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth));
1225
+ height = (parseFloat(cs.height) || element.clientHeight || 0) + (bbox ? 0 : parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth));
1226
+ }
1227
+ }
1228
+
1229
+ right = width;
1230
+ bottom = height;
1231
+ }
1232
+
1233
+ if (element === context) {
1234
+ return {
1235
+ left: left,
1236
+ top: top,
1237
+ width: right - left,
1238
+ height: bottom - top
1239
+ };
1240
+ }
1241
+
1242
+ matrix = getGlobalMatrix(context, true).multiply(getGlobalMatrix(element));
1243
+ p1 = matrix.apply({
1244
+ x: left,
1245
+ y: top
1246
+ });
1247
+ p2 = matrix.apply({
1248
+ x: right,
1249
+ y: top
1250
+ });
1251
+ p3 = matrix.apply({
1252
+ x: right,
1253
+ y: bottom
1254
+ });
1255
+ p4 = matrix.apply({
1256
+ x: left,
1257
+ y: bottom
1258
+ });
1259
+ left = Math.min(p1.x, p2.x, p3.x, p4.x);
1260
+ top = Math.min(p1.y, p2.y, p3.y, p4.y);
1261
+ return {
1262
+ left: left,
1263
+ top: top,
1264
+ width: Math.max(p1.x, p2.x, p3.x, p4.x) - left,
1265
+ height: Math.max(p1.y, p2.y, p3.y, p4.y) - top
1266
+ };
1267
+ },
1268
+ _parseInertia = function _parseInertia(draggable, snap, max, min, factor, forceZeroVelocity) {
1269
+ var vars = {},
1270
+ a,
1271
+ i,
1272
+ l;
1273
+
1274
+ if (snap) {
1275
+ if (factor !== 1 && snap instanceof Array) {
1276
+ //some data must be altered to make sense, like if the user passes in an array of rotational values in degrees, we must convert it to radians. Or for scrollLeft and scrollTop, we invert the values.
1277
+ vars.end = a = [];
1278
+ l = snap.length;
1279
+
1280
+ if (_isObject$1(snap[0])) {
1281
+ //if the array is populated with objects, like points ({x:100, y:200}), make copies before multiplying by the factor, otherwise we'll mess up the originals and the user may reuse it elsewhere.
1282
+ for (i = 0; i < l; i++) {
1283
+ a[i] = _copy(snap[i], factor);
1284
+ }
1285
+ } else {
1286
+ for (i = 0; i < l; i++) {
1287
+ a[i] = snap[i] * factor;
1288
+ }
1289
+ }
1290
+
1291
+ max += 1.1; //allow 1.1 pixels of wiggle room when snapping in order to work around some browser inconsistencies in the way bounds are reported which can make them roughly a pixel off. For example, if "snap:[-$('#menu').width(), 0]" was defined and #menu had a wrapper that was used as the bounds, some browsers would be one pixel off, making the minimum -752 for example when snap was [-753,0], thus instead of snapping to -753, it would snap to 0 since -753 was below the minimum.
1292
+
1293
+ min -= 1.1;
1294
+ } else if (_isFunction$1(snap)) {
1295
+ vars.end = function (value) {
1296
+ var result = snap.call(draggable, value),
1297
+ copy,
1298
+ p;
1299
+
1300
+ if (factor !== 1) {
1301
+ if (_isObject$1(result)) {
1302
+ copy = {};
1303
+
1304
+ for (p in result) {
1305
+ copy[p] = result[p] * factor;
1306
+ }
1307
+
1308
+ result = copy;
1309
+ } else {
1310
+ result *= factor;
1311
+ }
1312
+ }
1313
+
1314
+ return result; //we need to ensure that we can scope the function call to the Draggable instance itself so that users can access important values like maxX, minX, maxY, minY, x, and y from within that function.
1315
+ };
1316
+ } else {
1317
+ vars.end = snap;
1318
+ }
1319
+ }
1320
+
1321
+ if (max || max === 0) {
1322
+ vars.max = max;
1323
+ }
1324
+
1325
+ if (min || min === 0) {
1326
+ vars.min = min;
1327
+ }
1328
+
1329
+ if (forceZeroVelocity) {
1330
+ vars.velocity = 0;
1331
+ }
1332
+
1333
+ return vars;
1334
+ },
1335
+ _isClickable = function _isClickable(element) {
1336
+ //sometimes it's convenient to mark an element as clickable by adding a data-clickable="true" attribute (in which case we won't preventDefault() the mouse/touch event). This method checks if the element is an <a>, <input>, or <button> or has the data-clickable or contentEditable attribute set to true (or any of its parent elements).
1337
+ var data;
1338
+ return !element || !element.getAttribute || element === _body$1 ? false : (data = element.getAttribute("data-clickable")) === "true" || data !== "false" && (_clickableTagExp.test(element.nodeName + "") || element.getAttribute("contentEditable") === "true") ? true : _isClickable(element.parentNode);
1339
+ },
1340
+ _setSelectable = function _setSelectable(elements, selectable) {
1341
+ var i = elements.length,
1342
+ e;
1343
+
1344
+ while (i--) {
1345
+ e = elements[i];
1346
+ e.ondragstart = e.onselectstart = selectable ? null : _emptyFunc$1;
1347
+ gsap$3.set(e, {
1348
+ lazy: true,
1349
+ userSelect: selectable ? "text" : "none"
1350
+ });
1351
+ }
1352
+ },
1353
+ _isFixed = function _isFixed(element) {
1354
+ if (_getComputedStyle(element).position === "fixed") {
1355
+ return true;
1356
+ }
1357
+
1358
+ element = element.parentNode;
1359
+
1360
+ if (element && element.nodeType === 1) {
1361
+ // avoid document fragments which will throw an error.
1362
+ return _isFixed(element);
1363
+ }
1364
+ },
1365
+ _supports3D,
1366
+ _addPaddingBR,
1367
+ //The ScrollProxy class wraps an element's contents into another div (we call it "content") that we either add padding when necessary or apply a translate3d() transform in order to overscroll (scroll past the boundaries). This allows us to simply set the scrollTop/scrollLeft (or top/left for easier reverse-axis orientation, which is what we do in Draggable) and it'll do all the work for us. For example, if we tried setting scrollTop to -100 on a normal DOM element, it wouldn't work - it'd look the same as setting it to 0, but if we set scrollTop of a ScrollProxy to -100, it'll give the correct appearance by either setting paddingTop of the wrapper to 100 or applying a 100-pixel translateY.
1368
+ ScrollProxy = function ScrollProxy(element, vars) {
1369
+ element = gsap$3.utils.toArray(element)[0];
1370
+ vars = vars || {};
1371
+ var content = document.createElement("div"),
1372
+ style = content.style,
1373
+ node = element.firstChild,
1374
+ offsetTop = 0,
1375
+ offsetLeft = 0,
1376
+ prevTop = element.scrollTop,
1377
+ prevLeft = element.scrollLeft,
1378
+ scrollWidth = element.scrollWidth,
1379
+ scrollHeight = element.scrollHeight,
1380
+ extraPadRight = 0,
1381
+ maxLeft = 0,
1382
+ maxTop = 0,
1383
+ elementWidth,
1384
+ elementHeight,
1385
+ contentHeight,
1386
+ nextNode,
1387
+ transformStart,
1388
+ transformEnd;
1389
+
1390
+ if (_supports3D && vars.force3D !== false) {
1391
+ transformStart = "translate3d(";
1392
+ transformEnd = "px,0px)";
1393
+ } else if (_transformProp) {
1394
+ transformStart = "translate(";
1395
+ transformEnd = "px)";
1396
+ }
1397
+
1398
+ this.scrollTop = function (value, force) {
1399
+ if (!arguments.length) {
1400
+ return -this.top();
1401
+ }
1402
+
1403
+ this.top(-value, force);
1404
+ };
1405
+
1406
+ this.scrollLeft = function (value, force) {
1407
+ if (!arguments.length) {
1408
+ return -this.left();
1409
+ }
1410
+
1411
+ this.left(-value, force);
1412
+ };
1413
+
1414
+ this.left = function (value, force) {
1415
+ if (!arguments.length) {
1416
+ return -(element.scrollLeft + offsetLeft);
1417
+ }
1418
+
1419
+ var dif = element.scrollLeft - prevLeft,
1420
+ oldOffset = offsetLeft;
1421
+
1422
+ if ((dif > 2 || dif < -2) && !force) {
1423
+ //if the user interacts with the scrollbar (or something else scrolls it, like the mouse wheel), we should kill any tweens of the ScrollProxy.
1424
+ prevLeft = element.scrollLeft;
1425
+ gsap$3.killTweensOf(this, {
1426
+ left: 1,
1427
+ scrollLeft: 1
1428
+ });
1429
+ this.left(-prevLeft);
1430
+
1431
+ if (vars.onKill) {
1432
+ vars.onKill();
1433
+ }
1434
+
1435
+ return;
1436
+ }
1437
+
1438
+ value = -value; //invert because scrolling works in the opposite direction
1439
+
1440
+ if (value < 0) {
1441
+ offsetLeft = value - 0.5 | 0;
1442
+ value = 0;
1443
+ } else if (value > maxLeft) {
1444
+ offsetLeft = value - maxLeft | 0;
1445
+ value = maxLeft;
1446
+ } else {
1447
+ offsetLeft = 0;
1448
+ }
1449
+
1450
+ if (offsetLeft || oldOffset) {
1451
+ if (!this._skip) {
1452
+ style[_transformProp] = transformStart + -offsetLeft + "px," + -offsetTop + transformEnd;
1453
+ }
1454
+
1455
+ if (offsetLeft + extraPadRight >= 0) {
1456
+ style.paddingRight = offsetLeft + extraPadRight + "px";
1457
+ }
1458
+ }
1459
+
1460
+ element.scrollLeft = value | 0;
1461
+ prevLeft = element.scrollLeft; //don't merge this with the line above because some browsers adjust the scrollLeft after it's set, so in order to be 100% accurate in tracking it, we need to ask the browser to report it.
1462
+ };
1463
+
1464
+ this.top = function (value, force) {
1465
+ if (!arguments.length) {
1466
+ return -(element.scrollTop + offsetTop);
1467
+ }
1468
+
1469
+ var dif = element.scrollTop - prevTop,
1470
+ oldOffset = offsetTop;
1471
+
1472
+ if ((dif > 2 || dif < -2) && !force) {
1473
+ //if the user interacts with the scrollbar (or something else scrolls it, like the mouse wheel), we should kill any tweens of the ScrollProxy.
1474
+ prevTop = element.scrollTop;
1475
+ gsap$3.killTweensOf(this, {
1476
+ top: 1,
1477
+ scrollTop: 1
1478
+ });
1479
+ this.top(-prevTop);
1480
+
1481
+ if (vars.onKill) {
1482
+ vars.onKill();
1483
+ }
1484
+
1485
+ return;
1486
+ }
1487
+
1488
+ value = -value; //invert because scrolling works in the opposite direction
1489
+
1490
+ if (value < 0) {
1491
+ offsetTop = value - 0.5 | 0;
1492
+ value = 0;
1493
+ } else if (value > maxTop) {
1494
+ offsetTop = value - maxTop | 0;
1495
+ value = maxTop;
1496
+ } else {
1497
+ offsetTop = 0;
1498
+ }
1499
+
1500
+ if (offsetTop || oldOffset) {
1501
+ if (!this._skip) {
1502
+ style[_transformProp] = transformStart + -offsetLeft + "px," + -offsetTop + transformEnd;
1503
+ }
1504
+ }
1505
+
1506
+ element.scrollTop = value | 0;
1507
+ prevTop = element.scrollTop;
1508
+ };
1509
+
1510
+ this.maxScrollTop = function () {
1511
+ return maxTop;
1512
+ };
1513
+
1514
+ this.maxScrollLeft = function () {
1515
+ return maxLeft;
1516
+ };
1517
+
1518
+ this.disable = function () {
1519
+ node = content.firstChild;
1520
+
1521
+ while (node) {
1522
+ nextNode = node.nextSibling;
1523
+ element.appendChild(node);
1524
+ node = nextNode;
1525
+ }
1526
+
1527
+ if (element === content.parentNode) {
1528
+ //in case disable() is called when it's already disabled.
1529
+ element.removeChild(content);
1530
+ }
1531
+ };
1532
+
1533
+ this.enable = function () {
1534
+ node = element.firstChild;
1535
+
1536
+ if (node === content) {
1537
+ return;
1538
+ }
1539
+
1540
+ while (node) {
1541
+ nextNode = node.nextSibling;
1542
+ content.appendChild(node);
1543
+ node = nextNode;
1544
+ }
1545
+
1546
+ element.appendChild(content);
1547
+ this.calibrate();
1548
+ };
1549
+
1550
+ this.calibrate = function (force) {
1551
+ var widthMatches = element.clientWidth === elementWidth,
1552
+ cs,
1553
+ x,
1554
+ y;
1555
+ prevTop = element.scrollTop;
1556
+ prevLeft = element.scrollLeft;
1557
+
1558
+ if (widthMatches && element.clientHeight === elementHeight && content.offsetHeight === contentHeight && scrollWidth === element.scrollWidth && scrollHeight === element.scrollHeight && !force) {
1559
+ return; //no need to recalculate things if the width and height haven't changed.
1560
+ }
1561
+
1562
+ if (offsetTop || offsetLeft) {
1563
+ x = this.left();
1564
+ y = this.top();
1565
+ this.left(-element.scrollLeft);
1566
+ this.top(-element.scrollTop);
1567
+ }
1568
+
1569
+ cs = _getComputedStyle(element); //first, we need to remove any width constraints to see how the content naturally flows so that we can see if it's wider than the containing element. If so, we've got to record the amount of overage so that we can apply that as padding in order for browsers to correctly handle things. Then we switch back to a width of 100% (without that, some browsers don't flow the content correctly)
1570
+
1571
+ if (!widthMatches || force) {
1572
+ style.display = "block";
1573
+ style.width = "auto";
1574
+ style.paddingRight = "0px";
1575
+ extraPadRight = Math.max(0, element.scrollWidth - element.clientWidth); //if the content is wider than the container, we need to add the paddingLeft and paddingRight in order for things to behave correctly.
1576
+
1577
+ if (extraPadRight) {
1578
+ extraPadRight += parseFloat(cs.paddingLeft) + (_addPaddingBR ? parseFloat(cs.paddingRight) : 0);
1579
+ }
1580
+ }
1581
+
1582
+ style.display = "inline-block";
1583
+ style.position = "relative";
1584
+ style.overflow = "visible";
1585
+ style.verticalAlign = "top";
1586
+ style.boxSizing = "content-box";
1587
+ style.width = "100%";
1588
+ style.paddingRight = extraPadRight + "px"; //some browsers neglect to factor in the bottom padding when calculating the scrollHeight, so we need to add that padding to the content when that happens. Allow a 2px margin for error
1589
+
1590
+ if (_addPaddingBR) {
1591
+ style.paddingBottom = cs.paddingBottom;
1592
+ }
1593
+
1594
+ elementWidth = element.clientWidth;
1595
+ elementHeight = element.clientHeight;
1596
+ scrollWidth = element.scrollWidth;
1597
+ scrollHeight = element.scrollHeight;
1598
+ maxLeft = element.scrollWidth - elementWidth;
1599
+ maxTop = element.scrollHeight - elementHeight;
1600
+ contentHeight = content.offsetHeight;
1601
+ style.display = "block";
1602
+
1603
+ if (x || y) {
1604
+ this.left(x);
1605
+ this.top(y);
1606
+ }
1607
+ };
1608
+
1609
+ this.content = content;
1610
+ this.element = element;
1611
+ this._skip = false;
1612
+ this.enable();
1613
+ },
1614
+ _initCore$3 = function _initCore(required) {
1615
+ if (_windowExists() && document.body) {
1616
+ var nav = window && window.navigator;
1617
+ _win$1 = window;
1618
+ _doc$1 = document;
1619
+ _docElement = _doc$1.documentElement;
1620
+ _body$1 = _doc$1.body;
1621
+ _tempDiv = _createElement("div");
1622
+ _supportsPointer = !!window.PointerEvent;
1623
+ _placeholderDiv = _createElement("div");
1624
+ _placeholderDiv.style.cssText = "visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;cursor:grab";
1625
+ _defaultCursor = _placeholderDiv.style.cursor === "grab" ? "grab" : "move";
1626
+ _isAndroid = nav && nav.userAgent.toLowerCase().indexOf("android") !== -1; //Android handles touch events in an odd way and it's virtually impossible to "feature test" so we resort to UA sniffing
1627
+
1628
+ _isTouchDevice = "ontouchstart" in _docElement && "orientation" in _win$1 || nav && (nav.MaxTouchPoints > 0 || nav.msMaxTouchPoints > 0);
1629
+
1630
+ _addPaddingBR = function () {
1631
+ //this function is in charge of analyzing browser behavior related to padding. It sets the _addPaddingBR to true if the browser doesn't normally factor in the bottom or right padding on the element inside the scrolling area, and it sets _addPaddingLeft to true if it's a browser that requires the extra offset (offsetLeft) to be added to the paddingRight (like Opera).
1632
+ var div = _createElement("div"),
1633
+ child = _createElement("div"),
1634
+ childStyle = child.style,
1635
+ parent = _body$1,
1636
+ val;
1637
+
1638
+ childStyle.display = "inline-block";
1639
+ childStyle.position = "relative";
1640
+ div.style.cssText = "width:90px;height:40px;padding:10px;overflow:auto;visibility:hidden";
1641
+ div.appendChild(child);
1642
+ parent.appendChild(div);
1643
+ val = child.offsetHeight + 18 > div.scrollHeight; //div.scrollHeight should be child.offsetHeight + 20 because of the 10px of padding on each side, but some browsers ignore one side. We allow a 2px margin of error.
1644
+
1645
+ parent.removeChild(div);
1646
+ return val;
1647
+ }();
1648
+
1649
+ _touchEventLookup = function (types) {
1650
+ //we create an object that makes it easy to translate touch event types into their "pointer" counterparts if we're in a browser that uses those instead. Like IE10 uses "MSPointerDown" instead of "touchstart", for example.
1651
+ var standard = types.split(","),
1652
+ converted = ("onpointerdown" in _tempDiv ? "pointerdown,pointermove,pointerup,pointercancel" : "onmspointerdown" in _tempDiv ? "MSPointerDown,MSPointerMove,MSPointerUp,MSPointerCancel" : types).split(","),
1653
+ obj = {},
1654
+ i = 4;
1655
+
1656
+ while (--i > -1) {
1657
+ obj[standard[i]] = converted[i];
1658
+ obj[converted[i]] = standard[i];
1659
+ } //to avoid problems in iOS 9, test to see if the browser supports the "passive" option on addEventListener().
1660
+
1661
+
1662
+ try {
1663
+ _docElement.addEventListener("test", null, Object.defineProperty({}, "passive", {
1664
+ get: function get() {
1665
+ _supportsPassive = 1;
1666
+ }
1667
+ }));
1668
+ } catch (e) {}
1669
+
1670
+ return obj;
1671
+ }("touchstart,touchmove,touchend,touchcancel");
1672
+
1673
+ _addListener$1(_doc$1, "touchcancel", _emptyFunc$1); //some older Android devices intermittently stop dispatching "touchmove" events if we don't listen for "touchcancel" on the document. Very strange indeed.
1674
+
1675
+
1676
+ _addListener$1(_win$1, "touchmove", _emptyFunc$1); //works around Safari bugs that still allow the page to scroll even when we preventDefault() on the touchmove event.
1677
+
1678
+
1679
+ _body$1 && _body$1.addEventListener("touchstart", _emptyFunc$1); //works around Safari bug: https://gsap.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/
1680
+
1681
+ _addListener$1(_doc$1, "contextmenu", function () {
1682
+ for (var p in _lookup$1) {
1683
+ if (_lookup$1[p].isPressed) {
1684
+ _lookup$1[p].endDrag();
1685
+ }
1686
+ }
1687
+ });
1688
+
1689
+ gsap$3 = _coreInitted$3 = _getGSAP$3();
1690
+ }
1691
+
1692
+ if (gsap$3) {
1693
+ InertiaPlugin$1 = gsap$3.plugins.inertia;
1694
+
1695
+ _context$1 = gsap$3.core.context || function () {};
1696
+
1697
+ _checkPrefix = gsap$3.utils.checkPrefix;
1698
+ _transformProp = _checkPrefix(_transformProp);
1699
+ _transformOriginProp = _checkPrefix(_transformOriginProp);
1700
+ _toArray$2 = gsap$3.utils.toArray;
1701
+ _getStyleSaver$1 = gsap$3.core.getStyleSaver;
1702
+ _supports3D = !!_checkPrefix("perspective");
1703
+ } else if (required) {
1704
+ console.warn("Please gsap.registerPlugin(Draggable)");
1705
+ }
1706
+ };
1707
+
1708
+ var EventDispatcher = /*#__PURE__*/function () {
1709
+ function EventDispatcher(target) {
1710
+ this._listeners = {};
1711
+ this.target = target || this;
1712
+ }
1713
+
1714
+ var _proto = EventDispatcher.prototype;
1715
+
1716
+ _proto.addEventListener = function addEventListener(type, callback) {
1717
+ var list = this._listeners[type] || (this._listeners[type] = []);
1718
+
1719
+ if (!~list.indexOf(callback)) {
1720
+ list.push(callback);
1721
+ }
1722
+ };
1723
+
1724
+ _proto.removeEventListener = function removeEventListener(type, callback) {
1725
+ var list = this._listeners[type],
1726
+ i = list && list.indexOf(callback);
1727
+ i >= 0 && list.splice(i, 1);
1728
+ };
1729
+
1730
+ _proto.dispatchEvent = function dispatchEvent(type) {
1731
+ var _this = this;
1732
+
1733
+ var result;
1734
+ (this._listeners[type] || []).forEach(function (callback) {
1735
+ return callback.call(_this, {
1736
+ type: type,
1737
+ target: _this.target
1738
+ }) === false && (result = false);
1739
+ });
1740
+ return result; //if any of the callbacks return false, pass that along.
1741
+ };
1742
+
1743
+ return EventDispatcher;
1744
+ }();
1745
+
1746
+ var Draggable = /*#__PURE__*/function (_EventDispatcher) {
1747
+ _inheritsLoose(Draggable, _EventDispatcher);
1748
+
1749
+ function Draggable(target, vars) {
1750
+ var _this2;
1751
+
1752
+ _this2 = _EventDispatcher.call(this) || this;
1753
+ _coreInitted$3 || _initCore$3(1);
1754
+ target = _toArray$2(target)[0]; //in case the target is a selector object or selector text
1755
+
1756
+ _this2.styles = _getStyleSaver$1 && _getStyleSaver$1(target, "transform,left,top");
1757
+
1758
+ if (!InertiaPlugin$1) {
1759
+ InertiaPlugin$1 = gsap$3.plugins.inertia;
1760
+ }
1761
+
1762
+ _this2.vars = vars = _copy(vars || {});
1763
+ _this2.target = target;
1764
+ _this2.x = _this2.y = _this2.rotation = 0;
1765
+ _this2.dragResistance = parseFloat(vars.dragResistance) || 0;
1766
+ _this2.edgeResistance = isNaN(vars.edgeResistance) ? 1 : parseFloat(vars.edgeResistance) || 0;
1767
+ _this2.lockAxis = vars.lockAxis;
1768
+ _this2.autoScroll = vars.autoScroll || 0;
1769
+ _this2.lockedAxis = null;
1770
+ _this2.allowEventDefault = !!vars.allowEventDefault;
1771
+ gsap$3.getProperty(target, "x"); // to ensure that transforms are instantiated.
1772
+
1773
+ var type = (vars.type || "x,y").toLowerCase(),
1774
+ xyMode = ~type.indexOf("x") || ~type.indexOf("y"),
1775
+ rotationMode = type.indexOf("rotation") !== -1,
1776
+ xProp = rotationMode ? "rotation" : xyMode ? "x" : "left",
1777
+ yProp = xyMode ? "y" : "top",
1778
+ allowX = !!(~type.indexOf("x") || ~type.indexOf("left") || type === "scroll"),
1779
+ allowY = !!(~type.indexOf("y") || ~type.indexOf("top") || type === "scroll"),
1780
+ minimumMovement = vars.minimumMovement || 2,
1781
+ self = _assertThisInitialized(_this2),
1782
+ triggers = _toArray$2(vars.trigger || vars.handle || target),
1783
+ killProps = {},
1784
+ dragEndTime = 0,
1785
+ checkAutoScrollBounds = false,
1786
+ autoScrollMarginTop = vars.autoScrollMarginTop || 40,
1787
+ autoScrollMarginRight = vars.autoScrollMarginRight || 40,
1788
+ autoScrollMarginBottom = vars.autoScrollMarginBottom || 40,
1789
+ autoScrollMarginLeft = vars.autoScrollMarginLeft || 40,
1790
+ isClickable = vars.clickableTest || _isClickable,
1791
+ clickTime = 0,
1792
+ gsCache = target._gsap || gsap$3.core.getCache(target),
1793
+ isFixed = _isFixed(target),
1794
+ getPropAsNum = function getPropAsNum(property, unit) {
1795
+ return parseFloat(gsCache.get(target, property, unit));
1796
+ },
1797
+ ownerDoc = target.ownerDocument || _doc$1,
1798
+ enabled,
1799
+ scrollProxy,
1800
+ startPointerX,
1801
+ startPointerY,
1802
+ startElementX,
1803
+ startElementY,
1804
+ hasBounds,
1805
+ hasDragCallback,
1806
+ hasMoveCallback,
1807
+ maxX,
1808
+ minX,
1809
+ maxY,
1810
+ minY,
1811
+ touch,
1812
+ touchID,
1813
+ rotationOrigin,
1814
+ dirty,
1815
+ old,
1816
+ snapX,
1817
+ snapY,
1818
+ snapXY,
1819
+ isClicking,
1820
+ touchEventTarget,
1821
+ matrix,
1822
+ interrupted,
1823
+ allowNativeTouchScrolling,
1824
+ touchDragAxis,
1825
+ isDispatching,
1826
+ clickDispatch,
1827
+ trustedClickDispatch,
1828
+ isPreventingDefault,
1829
+ innerMatrix,
1830
+ dragged,
1831
+ onContextMenu = function onContextMenu(e) {
1832
+ //used to prevent long-touch from triggering a context menu.
1833
+ // (self.isPressed && e.which < 2) && self.endDrag() // previously ended drag when context menu was triggered, but instead we should just stop propagation and prevent the default event behavior.
1834
+ _preventDefault(e);
1835
+
1836
+ e.stopImmediatePropagation && e.stopImmediatePropagation();
1837
+ return false;
1838
+ },
1839
+ //this method gets called on every tick of TweenLite.ticker which allows us to synchronize the renders to the core engine (which is typically synchronized with the display refresh via requestAnimationFrame). This is an optimization - it's better than applying the values inside the "mousemove" or "touchmove" event handler which may get called many times inbetween refreshes.
1840
+ render = function render(suppressEvents) {
1841
+ if (self.autoScroll && self.isDragging && (checkAutoScrollBounds || dirty)) {
1842
+ var e = target,
1843
+ autoScrollFactor = self.autoScroll * 15,
1844
+ //multiplying by 15 just gives us a better "feel" speed-wise.
1845
+ parent,
1846
+ isRoot,
1847
+ rect,
1848
+ pointerX,
1849
+ pointerY,
1850
+ changeX,
1851
+ changeY,
1852
+ gap;
1853
+ checkAutoScrollBounds = false;
1854
+ _windowProxy.scrollTop = _win$1.pageYOffset != null ? _win$1.pageYOffset : ownerDoc.documentElement.scrollTop != null ? ownerDoc.documentElement.scrollTop : ownerDoc.body.scrollTop;
1855
+ _windowProxy.scrollLeft = _win$1.pageXOffset != null ? _win$1.pageXOffset : ownerDoc.documentElement.scrollLeft != null ? ownerDoc.documentElement.scrollLeft : ownerDoc.body.scrollLeft;
1856
+ pointerX = self.pointerX - _windowProxy.scrollLeft;
1857
+ pointerY = self.pointerY - _windowProxy.scrollTop;
1858
+
1859
+ while (e && !isRoot) {
1860
+ //walk up the chain and sense wherever the pointer is within 40px of an edge that's scrollable.
1861
+ isRoot = _isRoot(e.parentNode);
1862
+ parent = isRoot ? _windowProxy : e.parentNode;
1863
+ rect = isRoot ? {
1864
+ bottom: Math.max(_docElement.clientHeight, _win$1.innerHeight || 0),
1865
+ right: Math.max(_docElement.clientWidth, _win$1.innerWidth || 0),
1866
+ left: 0,
1867
+ top: 0
1868
+ } : parent.getBoundingClientRect();
1869
+ changeX = changeY = 0;
1870
+
1871
+ if (allowY) {
1872
+ gap = parent._gsMaxScrollY - parent.scrollTop;
1873
+
1874
+ if (gap < 0) {
1875
+ changeY = gap;
1876
+ } else if (pointerY > rect.bottom - autoScrollMarginBottom && gap) {
1877
+ checkAutoScrollBounds = true;
1878
+ changeY = Math.min(gap, autoScrollFactor * (1 - Math.max(0, rect.bottom - pointerY) / autoScrollMarginBottom) | 0);
1879
+ } else if (pointerY < rect.top + autoScrollMarginTop && parent.scrollTop) {
1880
+ checkAutoScrollBounds = true;
1881
+ changeY = -Math.min(parent.scrollTop, autoScrollFactor * (1 - Math.max(0, pointerY - rect.top) / autoScrollMarginTop) | 0);
1882
+ }
1883
+
1884
+ if (changeY) {
1885
+ parent.scrollTop += changeY;
1886
+ }
1887
+ }
1888
+
1889
+ if (allowX) {
1890
+ gap = parent._gsMaxScrollX - parent.scrollLeft;
1891
+
1892
+ if (gap < 0) {
1893
+ changeX = gap;
1894
+ } else if (pointerX > rect.right - autoScrollMarginRight && gap) {
1895
+ checkAutoScrollBounds = true;
1896
+ changeX = Math.min(gap, autoScrollFactor * (1 - Math.max(0, rect.right - pointerX) / autoScrollMarginRight) | 0);
1897
+ } else if (pointerX < rect.left + autoScrollMarginLeft && parent.scrollLeft) {
1898
+ checkAutoScrollBounds = true;
1899
+ changeX = -Math.min(parent.scrollLeft, autoScrollFactor * (1 - Math.max(0, pointerX - rect.left) / autoScrollMarginLeft) | 0);
1900
+ }
1901
+
1902
+ if (changeX) {
1903
+ parent.scrollLeft += changeX;
1904
+ }
1905
+ }
1906
+
1907
+ if (isRoot && (changeX || changeY)) {
1908
+ _win$1.scrollTo(parent.scrollLeft, parent.scrollTop);
1909
+
1910
+ setPointerPosition(self.pointerX + changeX, self.pointerY + changeY);
1911
+ }
1912
+
1913
+ e = parent;
1914
+ }
1915
+ }
1916
+
1917
+ if (dirty) {
1918
+ var x = self.x,
1919
+ y = self.y;
1920
+
1921
+ if (rotationMode) {
1922
+ self.deltaX = x - parseFloat(gsCache.rotation);
1923
+ self.rotation = x;
1924
+ gsCache.rotation = x + "deg";
1925
+ gsCache.renderTransform(1, gsCache);
1926
+ } else {
1927
+ if (scrollProxy) {
1928
+ if (allowY) {
1929
+ self.deltaY = y - scrollProxy.top();
1930
+ scrollProxy.top(y);
1931
+ }
1932
+
1933
+ if (allowX) {
1934
+ self.deltaX = x - scrollProxy.left();
1935
+ scrollProxy.left(x);
1936
+ }
1937
+ } else if (xyMode) {
1938
+ if (allowY) {
1939
+ self.deltaY = y - parseFloat(gsCache.y);
1940
+ gsCache.y = y + "px";
1941
+ }
1942
+
1943
+ if (allowX) {
1944
+ self.deltaX = x - parseFloat(gsCache.x);
1945
+ gsCache.x = x + "px";
1946
+ }
1947
+
1948
+ gsCache.renderTransform(1, gsCache);
1949
+ } else {
1950
+ if (allowY) {
1951
+ self.deltaY = y - parseFloat(target.style.top || 0);
1952
+ target.style.top = y + "px";
1953
+ }
1954
+
1955
+ if (allowX) {
1956
+ self.deltaX = x - parseFloat(target.style.left || 0);
1957
+ target.style.left = x + "px";
1958
+ }
1959
+ }
1960
+ }
1961
+
1962
+ if (hasDragCallback && !suppressEvents && !isDispatching) {
1963
+ isDispatching = true; //in case onDrag has an update() call (avoid endless loop)
1964
+
1965
+ if (_dispatchEvent(self, "drag", "onDrag") === false) {
1966
+ if (allowX) {
1967
+ self.x -= self.deltaX;
1968
+ }
1969
+
1970
+ if (allowY) {
1971
+ self.y -= self.deltaY;
1972
+ }
1973
+
1974
+ render(true);
1975
+ }
1976
+
1977
+ isDispatching = false;
1978
+ }
1979
+ }
1980
+
1981
+ dirty = false;
1982
+ },
1983
+ //copies the x/y from the element (whether that be transforms, top/left, or ScrollProxy's top/left) to the Draggable's x and y (and rotation if necessary) properties so that they reflect reality and it also (optionally) applies any snapping necessary. This is used by the InertiaPlugin tween in an onUpdate to ensure things are synced and snapped.
1984
+ syncXY = function syncXY(skipOnUpdate, skipSnap) {
1985
+ var x = self.x,
1986
+ y = self.y,
1987
+ snappedValue,
1988
+ cs;
1989
+
1990
+ if (!target._gsap) {
1991
+ //just in case the _gsap cache got wiped, like if the user called clearProps on the transform or something (very rare).
1992
+ gsCache = gsap$3.core.getCache(target);
1993
+ }
1994
+
1995
+ gsCache.uncache && gsap$3.getProperty(target, "x"); // trigger a re-cache
1996
+
1997
+ if (xyMode) {
1998
+ self.x = parseFloat(gsCache.x);
1999
+ self.y = parseFloat(gsCache.y);
2000
+ } else if (rotationMode) {
2001
+ self.x = self.rotation = parseFloat(gsCache.rotation);
2002
+ } else if (scrollProxy) {
2003
+ self.y = scrollProxy.top();
2004
+ self.x = scrollProxy.left();
2005
+ } else {
2006
+ self.y = parseFloat(target.style.top || (cs = _getComputedStyle(target)) && cs.top) || 0;
2007
+ self.x = parseFloat(target.style.left || (cs || {}).left) || 0;
2008
+ }
2009
+
2010
+ if ((snapX || snapY || snapXY) && !skipSnap && (self.isDragging || self.isThrowing)) {
2011
+ if (snapXY) {
2012
+ _temp1.x = self.x;
2013
+ _temp1.y = self.y;
2014
+ snappedValue = snapXY(_temp1);
2015
+
2016
+ if (snappedValue.x !== self.x) {
2017
+ self.x = snappedValue.x;
2018
+ dirty = true;
2019
+ }
2020
+
2021
+ if (snappedValue.y !== self.y) {
2022
+ self.y = snappedValue.y;
2023
+ dirty = true;
2024
+ }
2025
+ }
2026
+
2027
+ if (snapX) {
2028
+ snappedValue = snapX(self.x);
2029
+
2030
+ if (snappedValue !== self.x) {
2031
+ self.x = snappedValue;
2032
+
2033
+ if (rotationMode) {
2034
+ self.rotation = snappedValue;
2035
+ }
2036
+
2037
+ dirty = true;
2038
+ }
2039
+ }
2040
+
2041
+ if (snapY) {
2042
+ snappedValue = snapY(self.y);
2043
+
2044
+ if (snappedValue !== self.y) {
2045
+ self.y = snappedValue;
2046
+ }
2047
+
2048
+ dirty = true;
2049
+ }
2050
+ }
2051
+
2052
+ dirty && render(true);
2053
+
2054
+ if (!skipOnUpdate) {
2055
+ self.deltaX = self.x - x;
2056
+ self.deltaY = self.y - y;
2057
+
2058
+ _dispatchEvent(self, "throwupdate", "onThrowUpdate");
2059
+ }
2060
+ },
2061
+ buildSnapFunc = function buildSnapFunc(snap, min, max, factor) {
2062
+ if (min == null) {
2063
+ min = -_bigNum$1;
2064
+ }
2065
+
2066
+ if (max == null) {
2067
+ max = _bigNum$1;
2068
+ }
2069
+
2070
+ if (_isFunction$1(snap)) {
2071
+ return function (n) {
2072
+ var edgeTolerance = !self.isPressed ? 1 : 1 - self.edgeResistance; //if we're tweening, disable the edgeTolerance because it's already factored into the tweening values (we don't want to apply it multiple times)
2073
+
2074
+ return snap.call(self, (n > max ? max + (n - max) * edgeTolerance : n < min ? min + (n - min) * edgeTolerance : n) * factor) * factor;
2075
+ };
2076
+ }
2077
+
2078
+ if (_isArray$1(snap)) {
2079
+ return function (n) {
2080
+ var i = snap.length,
2081
+ closest = 0,
2082
+ absDif = _bigNum$1,
2083
+ val,
2084
+ dif;
2085
+
2086
+ while (--i > -1) {
2087
+ val = snap[i];
2088
+ dif = val - n;
2089
+
2090
+ if (dif < 0) {
2091
+ dif = -dif;
2092
+ }
2093
+
2094
+ if (dif < absDif && val >= min && val <= max) {
2095
+ closest = i;
2096
+ absDif = dif;
2097
+ }
2098
+ }
2099
+
2100
+ return snap[closest];
2101
+ };
2102
+ }
2103
+
2104
+ return isNaN(snap) ? function (n) {
2105
+ return n;
2106
+ } : function () {
2107
+ return snap * factor;
2108
+ };
2109
+ },
2110
+ buildPointSnapFunc = function buildPointSnapFunc(snap, minX, maxX, minY, maxY, radius, factor) {
2111
+ radius = radius && radius < _bigNum$1 ? radius * radius : _bigNum$1; //so we don't have to Math.sqrt() in the functions. Performance optimization.
2112
+
2113
+ if (_isFunction$1(snap)) {
2114
+ return function (point) {
2115
+ var edgeTolerance = !self.isPressed ? 1 : 1 - self.edgeResistance,
2116
+ x = point.x,
2117
+ y = point.y,
2118
+ result,
2119
+ dx,
2120
+ dy; //if we're tweening, disable the edgeTolerance because it's already factored into the tweening values (we don't want to apply it multiple times)
2121
+
2122
+ point.x = x = x > maxX ? maxX + (x - maxX) * edgeTolerance : x < minX ? minX + (x - minX) * edgeTolerance : x;
2123
+ point.y = y = y > maxY ? maxY + (y - maxY) * edgeTolerance : y < minY ? minY + (y - minY) * edgeTolerance : y;
2124
+ result = snap.call(self, point);
2125
+
2126
+ if (result !== point) {
2127
+ point.x = result.x;
2128
+ point.y = result.y;
2129
+ }
2130
+
2131
+ if (factor !== 1) {
2132
+ point.x *= factor;
2133
+ point.y *= factor;
2134
+ }
2135
+
2136
+ if (radius < _bigNum$1) {
2137
+ dx = point.x - x;
2138
+ dy = point.y - y;
2139
+
2140
+ if (dx * dx + dy * dy > radius) {
2141
+ point.x = x;
2142
+ point.y = y;
2143
+ }
2144
+ }
2145
+
2146
+ return point;
2147
+ };
2148
+ }
2149
+
2150
+ if (_isArray$1(snap)) {
2151
+ return function (p) {
2152
+ var i = snap.length,
2153
+ closest = 0,
2154
+ minDist = _bigNum$1,
2155
+ x,
2156
+ y,
2157
+ point,
2158
+ dist;
2159
+
2160
+ while (--i > -1) {
2161
+ point = snap[i];
2162
+ x = point.x - p.x;
2163
+ y = point.y - p.y;
2164
+ dist = x * x + y * y;
2165
+
2166
+ if (dist < minDist) {
2167
+ closest = i;
2168
+ minDist = dist;
2169
+ }
2170
+ }
2171
+
2172
+ return minDist <= radius ? snap[closest] : p;
2173
+ };
2174
+ }
2175
+
2176
+ return function (n) {
2177
+ return n;
2178
+ };
2179
+ },
2180
+ calculateBounds = function calculateBounds() {
2181
+ var bounds, targetBounds, snap, snapIsRaw;
2182
+ hasBounds = false;
2183
+
2184
+ if (scrollProxy) {
2185
+ scrollProxy.calibrate();
2186
+ self.minX = minX = -scrollProxy.maxScrollLeft();
2187
+ self.minY = minY = -scrollProxy.maxScrollTop();
2188
+ self.maxX = maxX = self.maxY = maxY = 0;
2189
+ hasBounds = true;
2190
+ } else if (!!vars.bounds) {
2191
+ bounds = _getBounds(vars.bounds, target.parentNode); //could be a selector/jQuery object or a DOM element or a generic object like {top:0, left:100, width:1000, height:800} or {minX:100, maxX:1100, minY:0, maxY:800}
2192
+
2193
+ if (rotationMode) {
2194
+ self.minX = minX = bounds.left;
2195
+ self.maxX = maxX = bounds.left + bounds.width;
2196
+ self.minY = minY = self.maxY = maxY = 0;
2197
+ } else if (!_isUndefined(vars.bounds.maxX) || !_isUndefined(vars.bounds.maxY)) {
2198
+ bounds = vars.bounds;
2199
+ self.minX = minX = bounds.minX;
2200
+ self.minY = minY = bounds.minY;
2201
+ self.maxX = maxX = bounds.maxX;
2202
+ self.maxY = maxY = bounds.maxY;
2203
+ } else {
2204
+ targetBounds = _getBounds(target, target.parentNode);
2205
+ self.minX = minX = Math.round(getPropAsNum(xProp, "px") + bounds.left - targetBounds.left);
2206
+ self.minY = minY = Math.round(getPropAsNum(yProp, "px") + bounds.top - targetBounds.top);
2207
+ self.maxX = maxX = Math.round(minX + (bounds.width - targetBounds.width));
2208
+ self.maxY = maxY = Math.round(minY + (bounds.height - targetBounds.height));
2209
+ }
2210
+
2211
+ if (minX > maxX) {
2212
+ self.minX = maxX;
2213
+ self.maxX = maxX = minX;
2214
+ minX = self.minX;
2215
+ }
2216
+
2217
+ if (minY > maxY) {
2218
+ self.minY = maxY;
2219
+ self.maxY = maxY = minY;
2220
+ minY = self.minY;
2221
+ }
2222
+
2223
+ if (rotationMode) {
2224
+ self.minRotation = minX;
2225
+ self.maxRotation = maxX;
2226
+ }
2227
+
2228
+ hasBounds = true;
2229
+ }
2230
+
2231
+ if (vars.liveSnap) {
2232
+ snap = vars.liveSnap === true ? vars.snap || {} : vars.liveSnap;
2233
+ snapIsRaw = _isArray$1(snap) || _isFunction$1(snap);
2234
+
2235
+ if (rotationMode) {
2236
+ snapX = buildSnapFunc(snapIsRaw ? snap : snap.rotation, minX, maxX, 1);
2237
+ snapY = null;
2238
+ } else {
2239
+ if (snap.points) {
2240
+ snapXY = buildPointSnapFunc(snapIsRaw ? snap : snap.points, minX, maxX, minY, maxY, snap.radius, scrollProxy ? -1 : 1);
2241
+ } else {
2242
+ if (allowX) {
2243
+ snapX = buildSnapFunc(snapIsRaw ? snap : snap.x || snap.left || snap.scrollLeft, minX, maxX, scrollProxy ? -1 : 1);
2244
+ }
2245
+
2246
+ if (allowY) {
2247
+ snapY = buildSnapFunc(snapIsRaw ? snap : snap.y || snap.top || snap.scrollTop, minY, maxY, scrollProxy ? -1 : 1);
2248
+ }
2249
+ }
2250
+ }
2251
+ }
2252
+ },
2253
+ onThrowComplete = function onThrowComplete() {
2254
+ self.isThrowing = false;
2255
+
2256
+ _dispatchEvent(self, "throwcomplete", "onThrowComplete");
2257
+ },
2258
+ onThrowInterrupt = function onThrowInterrupt() {
2259
+ self.isThrowing = false;
2260
+ },
2261
+ animate = function animate(inertia, forceZeroVelocity) {
2262
+ var snap, snapIsRaw, tween, overshootTolerance;
2263
+
2264
+ if (inertia && InertiaPlugin$1) {
2265
+ if (inertia === true) {
2266
+ snap = vars.snap || vars.liveSnap || {};
2267
+ snapIsRaw = _isArray$1(snap) || _isFunction$1(snap);
2268
+ inertia = {
2269
+ resistance: (vars.throwResistance || vars.resistance || 1000) / (rotationMode ? 10 : 1)
2270
+ };
2271
+
2272
+ if (rotationMode) {
2273
+ inertia.rotation = _parseInertia(self, snapIsRaw ? snap : snap.rotation, maxX, minX, 1, forceZeroVelocity);
2274
+ } else {
2275
+ if (allowX) {
2276
+ inertia[xProp] = _parseInertia(self, snapIsRaw ? snap : snap.points || snap.x || snap.left, maxX, minX, scrollProxy ? -1 : 1, forceZeroVelocity || self.lockedAxis === "x");
2277
+ }
2278
+
2279
+ if (allowY) {
2280
+ inertia[yProp] = _parseInertia(self, snapIsRaw ? snap : snap.points || snap.y || snap.top, maxY, minY, scrollProxy ? -1 : 1, forceZeroVelocity || self.lockedAxis === "y");
2281
+ }
2282
+
2283
+ if (snap.points || _isArray$1(snap) && _isObject$1(snap[0])) {
2284
+ inertia.linkedProps = xProp + "," + yProp;
2285
+ inertia.radius = snap.radius; //note: we also disable liveSnapping while throwing if there's a "radius" defined, otherwise it looks weird to have the item thrown past a snapping point but live-snapping mid-tween. We do this by altering the onUpdateParams so that "skipSnap" parameter is true for syncXY.
2286
+ }
2287
+ }
2288
+ }
2289
+
2290
+ self.isThrowing = true;
2291
+ overshootTolerance = !isNaN(vars.overshootTolerance) ? vars.overshootTolerance : vars.edgeResistance === 1 ? 0 : 1 - self.edgeResistance + 0.2;
2292
+
2293
+ if (!inertia.duration) {
2294
+ inertia.duration = {
2295
+ max: Math.max(vars.minDuration || 0, "maxDuration" in vars ? vars.maxDuration : 2),
2296
+ min: !isNaN(vars.minDuration) ? vars.minDuration : overshootTolerance === 0 || _isObject$1(inertia) && inertia.resistance > 1000 ? 0 : 0.5,
2297
+ overshoot: overshootTolerance
2298
+ };
2299
+ }
2300
+
2301
+ self.tween = tween = gsap$3.to(scrollProxy || target, {
2302
+ inertia: inertia,
2303
+ data: "_draggable",
2304
+ inherit: false,
2305
+ onComplete: onThrowComplete,
2306
+ onInterrupt: onThrowInterrupt,
2307
+ onUpdate: vars.fastMode ? _dispatchEvent : syncXY,
2308
+ onUpdateParams: vars.fastMode ? [self, "onthrowupdate", "onThrowUpdate"] : snap && snap.radius ? [false, true] : []
2309
+ });
2310
+
2311
+ if (!vars.fastMode) {
2312
+ if (scrollProxy) {
2313
+ scrollProxy._skip = true; // Microsoft browsers have a bug that causes them to briefly render the position incorrectly (it flashes to the end state when we seek() the tween even though we jump right back to the current position, and this only seems to happen when we're affecting both top and left), so we set a _suspendTransforms flag to prevent it from actually applying the values in the ScrollProxy.
2314
+ }
2315
+
2316
+ tween.render(1e9, true, true); // force to the end. Remember, the duration will likely change upon initting because that's when InertiaPlugin calculates it.
2317
+
2318
+ syncXY(true, true);
2319
+ self.endX = self.x;
2320
+ self.endY = self.y;
2321
+
2322
+ if (rotationMode) {
2323
+ self.endRotation = self.x;
2324
+ }
2325
+
2326
+ tween.play(0);
2327
+ syncXY(true, true);
2328
+
2329
+ if (scrollProxy) {
2330
+ scrollProxy._skip = false; //Microsoft browsers have a bug that causes them to briefly render the position incorrectly (it flashes to the end state when we seek() the tween even though we jump right back to the current position, and this only seems to happen when we're affecting both top and left), so we set a _suspendTransforms flag to prevent it from actually applying the values in the ScrollProxy.
2331
+ }
2332
+ }
2333
+ } else if (hasBounds) {
2334
+ self.applyBounds();
2335
+ }
2336
+ },
2337
+ updateMatrix = function updateMatrix(shiftStart) {
2338
+ var start = matrix,
2339
+ p;
2340
+ matrix = getGlobalMatrix(target.parentNode, true);
2341
+
2342
+ if (shiftStart && self.isPressed && !matrix.equals(start || new Matrix2D())) {
2343
+ //if the matrix changes WHILE the element is pressed, we must adjust the startPointerX and startPointerY accordingly, so we invert the original matrix and figure out where the pointerX and pointerY were in the global space, then apply the new matrix to get the updated coordinates.
2344
+ p = start.inverse().apply({
2345
+ x: startPointerX,
2346
+ y: startPointerY
2347
+ });
2348
+ matrix.apply(p, p);
2349
+ startPointerX = p.x;
2350
+ startPointerY = p.y;
2351
+ }
2352
+
2353
+ if (matrix.equals(_identityMatrix)) {
2354
+ //if there are no transforms, we can optimize performance by not factoring in the matrix
2355
+ matrix = null;
2356
+ }
2357
+ },
2358
+ recordStartPositions = function recordStartPositions() {
2359
+ var edgeTolerance = 1 - self.edgeResistance,
2360
+ offsetX = isFixed ? _getDocScrollLeft(ownerDoc) : 0,
2361
+ offsetY = isFixed ? _getDocScrollTop(ownerDoc) : 0,
2362
+ parsedOrigin,
2363
+ x,
2364
+ y;
2365
+
2366
+ if (xyMode) {
2367
+ // in case the user set it as a different unit, like animating the x to "100%". We must convert it back to px!
2368
+ gsCache.x = getPropAsNum(xProp, "px") + "px";
2369
+ gsCache.y = getPropAsNum(yProp, "px") + "px";
2370
+ gsCache.renderTransform();
2371
+ }
2372
+
2373
+ updateMatrix(false);
2374
+ _point1.x = self.pointerX - offsetX;
2375
+ _point1.y = self.pointerY - offsetY;
2376
+ matrix && matrix.apply(_point1, _point1);
2377
+ startPointerX = _point1.x; //translate to local coordinate system
2378
+
2379
+ startPointerY = _point1.y;
2380
+
2381
+ if (dirty) {
2382
+ setPointerPosition(self.pointerX, self.pointerY);
2383
+ render(true);
2384
+ }
2385
+
2386
+ innerMatrix = getGlobalMatrix(target);
2387
+
2388
+ if (scrollProxy) {
2389
+ calculateBounds();
2390
+ startElementY = scrollProxy.top();
2391
+ startElementX = scrollProxy.left();
2392
+ } else {
2393
+ //if the element is in the process of tweening, don't force snapping to occur because it could make it jump. Imagine the user throwing, then before it's done, clicking on the element in its inbetween state.
2394
+ if (isTweening()) {
2395
+ syncXY(true, true);
2396
+ calculateBounds();
2397
+ } else {
2398
+ self.applyBounds();
2399
+ }
2400
+
2401
+ if (rotationMode) {
2402
+ parsedOrigin = target.ownerSVGElement ? [gsCache.xOrigin - target.getBBox().x, gsCache.yOrigin - target.getBBox().y] : (_getComputedStyle(target)[_transformOriginProp] || "0 0").split(" ");
2403
+ rotationOrigin = self.rotationOrigin = getGlobalMatrix(target).apply({
2404
+ x: parseFloat(parsedOrigin[0]) || 0,
2405
+ y: parseFloat(parsedOrigin[1]) || 0
2406
+ });
2407
+ syncXY(true, true);
2408
+ x = self.pointerX - rotationOrigin.x - offsetX;
2409
+ y = rotationOrigin.y - self.pointerY + offsetY;
2410
+ startElementX = self.x; //starting rotation (x always refers to rotation in type:"rotation", measured in degrees)
2411
+
2412
+ startElementY = self.y = Math.atan2(y, x) * _RAD2DEG;
2413
+ } else {
2414
+ //parent = !isFixed && target.parentNode;
2415
+ //startScrollTop = parent ? parent.scrollTop || 0 : 0;
2416
+ //startScrollLeft = parent ? parent.scrollLeft || 0 : 0;
2417
+ startElementY = getPropAsNum(yProp, "px"); //record the starting top and left values so that we can just add the mouse's movement to them later.
2418
+
2419
+ startElementX = getPropAsNum(xProp, "px");
2420
+ }
2421
+ }
2422
+
2423
+ if (hasBounds && edgeTolerance) {
2424
+ if (startElementX > maxX) {
2425
+ startElementX = maxX + (startElementX - maxX) / edgeTolerance;
2426
+ } else if (startElementX < minX) {
2427
+ startElementX = minX - (minX - startElementX) / edgeTolerance;
2428
+ }
2429
+
2430
+ if (!rotationMode) {
2431
+ if (startElementY > maxY) {
2432
+ startElementY = maxY + (startElementY - maxY) / edgeTolerance;
2433
+ } else if (startElementY < minY) {
2434
+ startElementY = minY - (minY - startElementY) / edgeTolerance;
2435
+ }
2436
+ }
2437
+ }
2438
+
2439
+ self.startX = startElementX = _round$2(startElementX);
2440
+ self.startY = startElementY = _round$2(startElementY);
2441
+ },
2442
+ isTweening = function isTweening() {
2443
+ return self.tween && self.tween.isActive();
2444
+ },
2445
+ removePlaceholder = function removePlaceholder() {
2446
+ if (_placeholderDiv.parentNode && !isTweening() && !self.isDragging) {
2447
+ //_placeholderDiv just props open auto-scrolling containers so they don't collapse as the user drags left/up. We remove it after dragging (and throwing, if necessary) finishes.
2448
+ _placeholderDiv.parentNode.removeChild(_placeholderDiv);
2449
+ }
2450
+ },
2451
+ //called when the mouse is pressed (or touch starts)
2452
+ onPress = function onPress(e, force) {
2453
+ var i;
2454
+
2455
+ if (!enabled || self.isPressed || !e || (e.type === "mousedown" || e.type === "pointerdown") && !force && _getTime$1() - clickTime < 30 && _touchEventLookup[self.pointerEvent.type]) {
2456
+ //when we DON'T preventDefault() in order to accommodate touch-scrolling and the user just taps, many browsers also fire a mousedown/mouseup sequence AFTER the touchstart/touchend sequence, thus it'd result in two quick "click" events being dispatched. This line senses that condition and halts it on the subsequent mousedown.
2457
+ isPreventingDefault && e && enabled && _preventDefault(e); // in some browsers, we must listen for multiple event types like touchstart, pointerdown, mousedown. The first time this function is called, we record whether or not we _preventDefault() so that on duplicate calls, we can do the same if necessary.
2458
+
2459
+ return;
2460
+ }
2461
+
2462
+ interrupted = isTweening();
2463
+ dragged = false; // we need to track whether or not it was dragged in this interaction so that if, for example, the user calls .endDrag() to FORCE it to stop and then they keep the mouse pressed down and eventually release, that would normally cause an onClick but we have to skip it in that case if there was dragging that occurred.
2464
+
2465
+ self.pointerEvent = e;
2466
+
2467
+ if (_touchEventLookup[e.type]) {
2468
+ //note: on iOS, BOTH touchmove and mousemove are dispatched, but the mousemove has pageY and pageX of 0 which would mess up the calculations and needlessly hurt performance.
2469
+ touchEventTarget = ~e.type.indexOf("touch") ? e.currentTarget || e.target : ownerDoc; //pointer-based touches (for Microsoft browsers) don't remain locked to the original target like other browsers, so we must use the document instead. The event type would be "MSPointerDown" or "pointerdown".
2470
+
2471
+ _addListener$1(touchEventTarget, "touchend", onRelease);
2472
+
2473
+ _addListener$1(touchEventTarget, "touchmove", onMove); // possible future change if PointerEvents are more standardized: https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
2474
+
2475
+
2476
+ _addListener$1(touchEventTarget, "touchcancel", onRelease);
2477
+
2478
+ _addListener$1(ownerDoc, "touchstart", _onMultiTouchDocument);
2479
+ } else {
2480
+ touchEventTarget = null;
2481
+
2482
+ _addListener$1(ownerDoc, "mousemove", onMove); //attach these to the document instead of the box itself so that if the user's mouse moves too quickly (and off of the box), things still work.
2483
+
2484
+ }
2485
+
2486
+ touchDragAxis = null;
2487
+
2488
+ if (!_supportsPointer || !touchEventTarget) {
2489
+ _addListener$1(ownerDoc, "mouseup", onRelease);
2490
+
2491
+ e && e.target && _addListener$1(e.target, "mouseup", onRelease); //we also have to listen directly on the element because some browsers don't bubble up the event to the _doc on elements with contentEditable="true"
2492
+ }
2493
+
2494
+ isClicking = isClickable.call(self, e.target) && vars.dragClickables === false && !force;
2495
+
2496
+ if (isClicking) {
2497
+ _addListener$1(e.target, "change", onRelease); //in some browsers, when you mousedown on a <select> element, no mouseup gets dispatched! So we listen for a "change" event instead.
2498
+
2499
+
2500
+ _dispatchEvent(self, "pressInit", "onPressInit");
2501
+
2502
+ _dispatchEvent(self, "press", "onPress");
2503
+
2504
+ _setSelectable(triggers, true); //accommodates things like inputs and elements with contentEditable="true" (otherwise user couldn't drag to select text)
2505
+
2506
+
2507
+ isPreventingDefault = false;
2508
+ return;
2509
+ }
2510
+
2511
+ allowNativeTouchScrolling = !touchEventTarget || allowX === allowY || self.vars.allowNativeTouchScrolling === false || self.vars.allowContextMenu && e && (e.ctrlKey || e.which > 2) ? false : allowX ? "y" : "x"; //note: in Chrome, right-clicking (for a context menu) fires onPress and it doesn't have the event.which set properly, so we must look for event.ctrlKey. If the user wants to allow context menus we should of course sense it here and not allow native touch scrolling.
2512
+
2513
+ isPreventingDefault = !allowNativeTouchScrolling && !self.allowEventDefault;
2514
+
2515
+ if (isPreventingDefault) {
2516
+ _preventDefault(e);
2517
+
2518
+ _addListener$1(_win$1, "touchforcechange", _preventDefault); //works around safari bug: https://gsap.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/
2519
+
2520
+ }
2521
+
2522
+ if (e.changedTouches) {
2523
+ //touch events store the data slightly differently
2524
+ e = touch = e.changedTouches[0];
2525
+ touchID = e.identifier;
2526
+ } else if (e.pointerId) {
2527
+ touchID = e.pointerId; //for some Microsoft browsers
2528
+ } else {
2529
+ touch = touchID = null;
2530
+ }
2531
+
2532
+ _dragCount++;
2533
+
2534
+ _addToRenderQueue(render); //causes the Draggable to render on each "tick" of gsap.ticker (performance optimization - updating values in a mousemove can cause them to happen too frequently, like multiple times between frame redraws which is wasteful, and it also prevents values from updating properly in IE8)
2535
+
2536
+
2537
+ startPointerY = self.pointerY = e.pageY; //record the starting x and y so that we can calculate the movement from the original in _onMouseMove
2538
+
2539
+ startPointerX = self.pointerX = e.pageX;
2540
+
2541
+ _dispatchEvent(self, "pressInit", "onPressInit");
2542
+
2543
+ if (allowNativeTouchScrolling || self.autoScroll) {
2544
+ _recordMaxScrolls(target.parentNode);
2545
+ }
2546
+
2547
+ if (target.parentNode && self.autoScroll && !scrollProxy && !rotationMode && target.parentNode._gsMaxScrollX && !_placeholderDiv.parentNode && !target.getBBox) {
2548
+ //add a placeholder div to prevent the parent container from collapsing when the user drags the element left.
2549
+ _placeholderDiv.style.width = target.parentNode.scrollWidth + "px";
2550
+ target.parentNode.appendChild(_placeholderDiv);
2551
+ }
2552
+
2553
+ recordStartPositions();
2554
+ self.tween && self.tween.kill();
2555
+ self.isThrowing = false;
2556
+ gsap$3.killTweensOf(scrollProxy || target, killProps, true); //in case the user tries to drag it before the last tween is done.
2557
+
2558
+ scrollProxy && gsap$3.killTweensOf(target, {
2559
+ scrollTo: 1
2560
+ }, true); //just in case the original target's scroll position is being tweened somewhere else.
2561
+
2562
+ self.tween = self.lockedAxis = null;
2563
+
2564
+ if (vars.zIndexBoost || !rotationMode && !scrollProxy && vars.zIndexBoost !== false) {
2565
+ target.style.zIndex = Draggable.zIndex++;
2566
+ }
2567
+
2568
+ self.isPressed = true;
2569
+ hasDragCallback = !!(vars.onDrag || self._listeners.drag);
2570
+ hasMoveCallback = !!(vars.onMove || self._listeners.move);
2571
+
2572
+ if (vars.cursor !== false || vars.activeCursor) {
2573
+ i = triggers.length;
2574
+
2575
+ while (--i > -1) {
2576
+ gsap$3.set(triggers[i], {
2577
+ cursor: vars.activeCursor || vars.cursor || (_defaultCursor === "grab" ? "grabbing" : _defaultCursor)
2578
+ });
2579
+ }
2580
+ }
2581
+
2582
+ _dispatchEvent(self, "press", "onPress");
2583
+ },
2584
+ //called every time the mouse/touch moves
2585
+ onMove = function onMove(e) {
2586
+ var originalEvent = e,
2587
+ touches,
2588
+ pointerX,
2589
+ pointerY,
2590
+ i,
2591
+ dx,
2592
+ dy;
2593
+
2594
+ if (!enabled || _isMultiTouching || !self.isPressed || !e) {
2595
+ isPreventingDefault && e && enabled && _preventDefault(e); // in some browsers, we must listen for multiple event types like touchmove, pointermove, mousemove. The first time this function is called, we record whether or not we _preventDefault() so that on duplicate calls, we can do the same if necessary.
2596
+
2597
+ return;
2598
+ }
2599
+
2600
+ self.pointerEvent = e;
2601
+ touches = e.changedTouches;
2602
+
2603
+ if (touches) {
2604
+ //touch events store the data slightly differently
2605
+ e = touches[0];
2606
+
2607
+ if (e !== touch && e.identifier !== touchID) {
2608
+ //Usually changedTouches[0] will be what we're looking for, but in case it's not, look through the rest of the array...(and Android browsers don't reuse the event like iOS)
2609
+ i = touches.length;
2610
+
2611
+ while (--i > -1 && (e = touches[i]).identifier !== touchID && e.target !== target) {} // Some Android devices dispatch a touchstart AND pointerdown initially, and then only pointermove thus the touchID may not match because it was grabbed from the touchstart event whereas the pointer event is the one that the browser dispatches for move, so if the event target matches this Draggable's target, let it through.
2612
+
2613
+
2614
+ if (i < 0) {
2615
+ return;
2616
+ }
2617
+ }
2618
+ } else if (e.pointerId && touchID && e.pointerId !== touchID) {
2619
+ //for some Microsoft browsers, we must attach the listener to the doc rather than the trigger so that when the finger moves outside the bounds of the trigger, things still work. So if the event we're receiving has a pointerId that doesn't match the touchID, ignore it (for multi-touch)
2620
+ return;
2621
+ }
2622
+
2623
+ if (touchEventTarget && allowNativeTouchScrolling && !touchDragAxis) {
2624
+ //Android browsers force us to decide on the first "touchmove" event if we should allow the default (scrolling) behavior or preventDefault(). Otherwise, a "touchcancel" will be fired and then no "touchmove" or "touchend" will fire during the scrolling (no good).
2625
+ _point1.x = e.pageX - (isFixed ? _getDocScrollLeft(ownerDoc) : 0);
2626
+ _point1.y = e.pageY - (isFixed ? _getDocScrollTop(ownerDoc) : 0);
2627
+ matrix && matrix.apply(_point1, _point1);
2628
+ pointerX = _point1.x;
2629
+ pointerY = _point1.y;
2630
+ dx = Math.abs(pointerX - startPointerX);
2631
+ dy = Math.abs(pointerY - startPointerY);
2632
+
2633
+ if (dx !== dy && (dx > minimumMovement || dy > minimumMovement) || _isAndroid && allowNativeTouchScrolling === touchDragAxis) {
2634
+ touchDragAxis = dx > dy && allowX ? "x" : "y";
2635
+
2636
+ if (allowNativeTouchScrolling && touchDragAxis !== allowNativeTouchScrolling) {
2637
+ _addListener$1(_win$1, "touchforcechange", _preventDefault); // prevents native touch scrolling from taking over if the user started dragging in the other direction in iOS Safari
2638
+
2639
+ }
2640
+
2641
+ if (self.vars.lockAxisOnTouchScroll !== false && allowX && allowY) {
2642
+ self.lockedAxis = touchDragAxis === "x" ? "y" : "x";
2643
+ _isFunction$1(self.vars.onLockAxis) && self.vars.onLockAxis.call(self, originalEvent);
2644
+ }
2645
+
2646
+ if (_isAndroid && allowNativeTouchScrolling === touchDragAxis) {
2647
+ onRelease(originalEvent);
2648
+ return;
2649
+ }
2650
+ }
2651
+ }
2652
+
2653
+ if (!self.allowEventDefault && (!allowNativeTouchScrolling || touchDragAxis && allowNativeTouchScrolling !== touchDragAxis) && originalEvent.cancelable !== false) {
2654
+ _preventDefault(originalEvent);
2655
+
2656
+ isPreventingDefault = true;
2657
+ } else if (isPreventingDefault) {
2658
+ isPreventingDefault = false;
2659
+ }
2660
+
2661
+ if (self.autoScroll) {
2662
+ checkAutoScrollBounds = true;
2663
+ }
2664
+
2665
+ setPointerPosition(e.pageX, e.pageY, hasMoveCallback);
2666
+ },
2667
+ setPointerPosition = function setPointerPosition(pointerX, pointerY, invokeOnMove) {
2668
+ var dragTolerance = 1 - self.dragResistance,
2669
+ edgeTolerance = 1 - self.edgeResistance,
2670
+ prevPointerX = self.pointerX,
2671
+ prevPointerY = self.pointerY,
2672
+ prevStartElementY = startElementY,
2673
+ prevX = self.x,
2674
+ prevY = self.y,
2675
+ prevEndX = self.endX,
2676
+ prevEndY = self.endY,
2677
+ prevEndRotation = self.endRotation,
2678
+ prevDirty = dirty,
2679
+ xChange,
2680
+ yChange,
2681
+ x,
2682
+ y,
2683
+ dif,
2684
+ temp;
2685
+ self.pointerX = pointerX;
2686
+ self.pointerY = pointerY;
2687
+
2688
+ if (isFixed) {
2689
+ pointerX -= _getDocScrollLeft(ownerDoc);
2690
+ pointerY -= _getDocScrollTop(ownerDoc);
2691
+ }
2692
+
2693
+ if (rotationMode) {
2694
+ y = Math.atan2(rotationOrigin.y - pointerY, pointerX - rotationOrigin.x) * _RAD2DEG;
2695
+ dif = self.y - y;
2696
+
2697
+ if (dif > 180) {
2698
+ startElementY -= 360;
2699
+ self.y = y;
2700
+ } else if (dif < -180) {
2701
+ startElementY += 360;
2702
+ self.y = y;
2703
+ }
2704
+
2705
+ if (self.x !== startElementX || Math.max(Math.abs(startPointerX - pointerX), Math.abs(startPointerY - pointerY)) > minimumMovement) {
2706
+ self.y = y;
2707
+ x = startElementX + (startElementY - y) * dragTolerance;
2708
+ } else {
2709
+ x = startElementX;
2710
+ }
2711
+ } else {
2712
+ if (matrix) {
2713
+ temp = pointerX * matrix.a + pointerY * matrix.c + matrix.e;
2714
+ pointerY = pointerX * matrix.b + pointerY * matrix.d + matrix.f;
2715
+ pointerX = temp;
2716
+ }
2717
+
2718
+ yChange = pointerY - startPointerY;
2719
+ xChange = pointerX - startPointerX;
2720
+
2721
+ if (yChange < minimumMovement && yChange > -minimumMovement) {
2722
+ yChange = 0;
2723
+ }
2724
+
2725
+ if (xChange < minimumMovement && xChange > -minimumMovement) {
2726
+ xChange = 0;
2727
+ }
2728
+
2729
+ if ((self.lockAxis || self.lockedAxis) && (xChange || yChange)) {
2730
+ temp = self.lockedAxis;
2731
+
2732
+ if (!temp) {
2733
+ self.lockedAxis = temp = allowX && Math.abs(xChange) > Math.abs(yChange) ? "y" : allowY ? "x" : null;
2734
+
2735
+ if (temp && _isFunction$1(self.vars.onLockAxis)) {
2736
+ self.vars.onLockAxis.call(self, self.pointerEvent);
2737
+ }
2738
+ }
2739
+
2740
+ if (temp === "y") {
2741
+ yChange = 0;
2742
+ } else if (temp === "x") {
2743
+ xChange = 0;
2744
+ }
2745
+ }
2746
+
2747
+ x = _round$2(startElementX + xChange * dragTolerance);
2748
+ y = _round$2(startElementY + yChange * dragTolerance);
2749
+ }
2750
+
2751
+ if ((snapX || snapY || snapXY) && (self.x !== x || self.y !== y && !rotationMode)) {
2752
+ if (snapXY) {
2753
+ _temp1.x = x;
2754
+ _temp1.y = y;
2755
+ temp = snapXY(_temp1);
2756
+ x = _round$2(temp.x);
2757
+ y = _round$2(temp.y);
2758
+ }
2759
+
2760
+ if (snapX) {
2761
+ x = _round$2(snapX(x));
2762
+ }
2763
+
2764
+ if (snapY) {
2765
+ y = _round$2(snapY(y));
2766
+ }
2767
+ }
2768
+
2769
+ if (hasBounds) {
2770
+ if (x > maxX) {
2771
+ x = maxX + Math.round((x - maxX) * edgeTolerance);
2772
+ } else if (x < minX) {
2773
+ x = minX + Math.round((x - minX) * edgeTolerance);
2774
+ }
2775
+
2776
+ if (!rotationMode) {
2777
+ if (y > maxY) {
2778
+ y = Math.round(maxY + (y - maxY) * edgeTolerance);
2779
+ } else if (y < minY) {
2780
+ y = Math.round(minY + (y - minY) * edgeTolerance);
2781
+ }
2782
+ }
2783
+ }
2784
+
2785
+ if (self.x !== x || self.y !== y && !rotationMode) {
2786
+ if (rotationMode) {
2787
+ self.endRotation = self.x = self.endX = x;
2788
+ dirty = true;
2789
+ } else {
2790
+ if (allowY) {
2791
+ self.y = self.endY = y;
2792
+ dirty = true; //a flag that indicates we need to render the target next time the TweenLite.ticker dispatches a "tick" event (typically on a requestAnimationFrame) - this is a performance optimization (we shouldn't render on every move because sometimes many move events can get dispatched between screen refreshes, and that'd be wasteful to render every time)
2793
+ }
2794
+
2795
+ if (allowX) {
2796
+ self.x = self.endX = x;
2797
+ dirty = true;
2798
+ }
2799
+ }
2800
+
2801
+ if (!invokeOnMove || _dispatchEvent(self, "move", "onMove") !== false) {
2802
+ if (!self.isDragging && self.isPressed) {
2803
+ self.isDragging = dragged = true;
2804
+
2805
+ _dispatchEvent(self, "dragstart", "onDragStart");
2806
+ }
2807
+ } else {
2808
+ //revert because the onMove returned false!
2809
+ self.pointerX = prevPointerX;
2810
+ self.pointerY = prevPointerY;
2811
+ startElementY = prevStartElementY;
2812
+ self.x = prevX;
2813
+ self.y = prevY;
2814
+ self.endX = prevEndX;
2815
+ self.endY = prevEndY;
2816
+ self.endRotation = prevEndRotation;
2817
+ dirty = prevDirty;
2818
+ }
2819
+ }
2820
+ },
2821
+ //called when the mouse/touch is released
2822
+ onRelease = function onRelease(e, force) {
2823
+ if (!enabled || !self.isPressed || e && touchID != null && !force && (e.pointerId && e.pointerId !== touchID && e.target !== target || e.changedTouches && !_hasTouchID(e.changedTouches, touchID))) {
2824
+ //for some Microsoft browsers, we must attach the listener to the doc rather than the trigger so that when the finger moves outside the bounds of the trigger, things still work. So if the event we're receiving has a pointerId that doesn't match the touchID, ignore it (for multi-touch)
2825
+ isPreventingDefault && e && enabled && _preventDefault(e); // in some browsers, we must listen for multiple event types like touchend, pointerup, mouseup. The first time this function is called, we record whether or not we _preventDefault() so that on duplicate calls, we can do the same if necessary.
2826
+
2827
+ return;
2828
+ }
2829
+
2830
+ self.isPressed = false;
2831
+ var originalEvent = e,
2832
+ wasDragging = self.isDragging,
2833
+ isContextMenuRelease = self.vars.allowContextMenu && e && (e.ctrlKey || e.which > 2),
2834
+ placeholderDelayedCall = gsap$3.delayedCall(0.001, removePlaceholder),
2835
+ touches,
2836
+ i,
2837
+ syntheticEvent,
2838
+ eventTarget,
2839
+ syntheticClick;
2840
+
2841
+ if (touchEventTarget) {
2842
+ _removeListener$1(touchEventTarget, "touchend", onRelease);
2843
+
2844
+ _removeListener$1(touchEventTarget, "touchmove", onMove);
2845
+
2846
+ _removeListener$1(touchEventTarget, "touchcancel", onRelease);
2847
+
2848
+ _removeListener$1(ownerDoc, "touchstart", _onMultiTouchDocument);
2849
+ } else {
2850
+ _removeListener$1(ownerDoc, "mousemove", onMove);
2851
+ }
2852
+
2853
+ _removeListener$1(_win$1, "touchforcechange", _preventDefault);
2854
+
2855
+ if (!_supportsPointer || !touchEventTarget) {
2856
+ _removeListener$1(ownerDoc, "mouseup", onRelease);
2857
+
2858
+ e && e.target && _removeListener$1(e.target, "mouseup", onRelease);
2859
+ }
2860
+
2861
+ dirty = false;
2862
+
2863
+ if (wasDragging) {
2864
+ dragEndTime = _lastDragTime = _getTime$1();
2865
+ self.isDragging = false;
2866
+ }
2867
+
2868
+ _removeFromRenderQueue(render);
2869
+
2870
+ if (isClicking && !isContextMenuRelease) {
2871
+ if (e) {
2872
+ _removeListener$1(e.target, "change", onRelease);
2873
+
2874
+ self.pointerEvent = originalEvent;
2875
+ }
2876
+
2877
+ _setSelectable(triggers, false);
2878
+
2879
+ _dispatchEvent(self, "release", "onRelease");
2880
+
2881
+ _dispatchEvent(self, "click", "onClick");
2882
+
2883
+ isClicking = false;
2884
+ return;
2885
+ }
2886
+
2887
+ i = triggers.length;
2888
+
2889
+ while (--i > -1) {
2890
+ _setStyle(triggers[i], "cursor", vars.cursor || (vars.cursor !== false ? _defaultCursor : null));
2891
+ }
2892
+
2893
+ _dragCount--;
2894
+
2895
+ if (e) {
2896
+ touches = e.changedTouches;
2897
+
2898
+ if (touches) {
2899
+ //touch events store the data slightly differently
2900
+ e = touches[0];
2901
+
2902
+ if (e !== touch && e.identifier !== touchID) {
2903
+ //Usually changedTouches[0] will be what we're looking for, but in case it's not, look through the rest of the array...(and Android browsers don't reuse the event like iOS)
2904
+ i = touches.length;
2905
+
2906
+ while (--i > -1 && (e = touches[i]).identifier !== touchID && e.target !== target) {}
2907
+
2908
+ if (i < 0 && !force) {
2909
+ return;
2910
+ }
2911
+ }
2912
+ }
2913
+
2914
+ self.pointerEvent = originalEvent;
2915
+ self.pointerX = e.pageX;
2916
+ self.pointerY = e.pageY;
2917
+ }
2918
+
2919
+ if (isContextMenuRelease && originalEvent) {
2920
+ _preventDefault(originalEvent);
2921
+
2922
+ isPreventingDefault = true;
2923
+
2924
+ _dispatchEvent(self, "release", "onRelease");
2925
+ } else if (originalEvent && !wasDragging) {
2926
+ isPreventingDefault = false;
2927
+
2928
+ if (interrupted && (vars.snap || vars.bounds)) {
2929
+ //otherwise, if the user clicks on the object while it's animating to a snapped position, and then releases without moving 3 pixels, it will just stay there (it should animate/snap)
2930
+ animate(vars.inertia || vars.throwProps);
2931
+ }
2932
+
2933
+ _dispatchEvent(self, "release", "onRelease");
2934
+
2935
+ if ((!_isAndroid || originalEvent.type !== "touchmove") && originalEvent.type.indexOf("cancel") === -1) {
2936
+ //to accommodate native scrolling on Android devices, we have to immediately call onRelease() on the first touchmove event, but that shouldn't trigger a "click".
2937
+ _dispatchEvent(self, "click", "onClick");
2938
+
2939
+ if (_getTime$1() - clickTime < 300) {
2940
+ _dispatchEvent(self, "doubleclick", "onDoubleClick");
2941
+ }
2942
+
2943
+ eventTarget = originalEvent.target || target; //old IE uses srcElement
2944
+
2945
+ clickTime = _getTime$1();
2946
+
2947
+ syntheticClick = function syntheticClick() {
2948
+ // some browsers (like Firefox) won't trust script-generated clicks, so if the user tries to click on a video to play it, for example, it simply won't work. Since a regular "click" event will most likely be generated anyway (one that has its isTrusted flag set to true), we must slightly delay our script-generated click so that the "real"/trusted one is prioritized. Remember, when there are duplicate events in quick succession, we suppress all but the first one. Some browsers don't even trigger the "real" one at all, so our synthetic one is a safety valve that ensures that no matter what, a click event does get dispatched.
2949
+ if (clickTime !== clickDispatch && self.enabled() && !self.isPressed && !originalEvent.defaultPrevented) {
2950
+ if (eventTarget.click) {
2951
+ //some browsers (like mobile Safari) don't properly trigger the click event
2952
+ eventTarget.click();
2953
+ } else if (ownerDoc.createEvent) {
2954
+ syntheticEvent = ownerDoc.createEvent("MouseEvents");
2955
+ syntheticEvent.initMouseEvent("click", true, true, _win$1, 1, self.pointerEvent.screenX, self.pointerEvent.screenY, self.pointerX, self.pointerY, false, false, false, false, 0, null);
2956
+ eventTarget.dispatchEvent(syntheticEvent);
2957
+ }
2958
+ }
2959
+ };
2960
+
2961
+ if (!_isAndroid && !originalEvent.defaultPrevented) {
2962
+ //iOS Safari requires the synthetic click to happen immediately or else it simply won't work, but Android doesn't play nice.
2963
+ gsap$3.delayedCall(0.05, syntheticClick); //in addition to the iOS bug workaround, there's a Firefox issue with clicking on things like a video to play, so we must fake a click event in a slightly delayed fashion. Previously, we listened for the "click" event with "capture" false which solved the video-click-to-play issue, but it would allow the "click" event to be dispatched twice like if you were using a jQuery.click() because that was handled in the capture phase, thus we had to switch to the capture phase to avoid the double-dispatching, but do the delayed synthetic click. Don't fire it too fast (like 0.00001) because we want to give the native event a chance to fire first as it's "trusted".
2964
+ }
2965
+ }
2966
+ } else {
2967
+ animate(vars.inertia || vars.throwProps); //will skip if inertia/throwProps isn't defined or InertiaPlugin isn't loaded.
2968
+
2969
+ if (!self.allowEventDefault && originalEvent && (vars.dragClickables !== false || !isClickable.call(self, originalEvent.target)) && wasDragging && (!allowNativeTouchScrolling || touchDragAxis && allowNativeTouchScrolling === touchDragAxis) && originalEvent.cancelable !== false) {
2970
+ isPreventingDefault = true;
2971
+
2972
+ _preventDefault(originalEvent);
2973
+ } else {
2974
+ isPreventingDefault = false;
2975
+ }
2976
+
2977
+ _dispatchEvent(self, "release", "onRelease");
2978
+ }
2979
+
2980
+ isTweening() && placeholderDelayedCall.duration(self.tween.duration()); //sync the timing so that the placeholder DIV gets
2981
+
2982
+ wasDragging && _dispatchEvent(self, "dragend", "onDragEnd");
2983
+ return true;
2984
+ },
2985
+ updateScroll = function updateScroll(e) {
2986
+ if (e && self.isDragging && !scrollProxy) {
2987
+ var parent = e.target || target.parentNode,
2988
+ deltaX = parent.scrollLeft - parent._gsScrollX,
2989
+ deltaY = parent.scrollTop - parent._gsScrollY;
2990
+
2991
+ if (deltaX || deltaY) {
2992
+ if (matrix) {
2993
+ startPointerX -= deltaX * matrix.a + deltaY * matrix.c;
2994
+ startPointerY -= deltaY * matrix.d + deltaX * matrix.b;
2995
+ } else {
2996
+ startPointerX -= deltaX;
2997
+ startPointerY -= deltaY;
2998
+ }
2999
+
3000
+ parent._gsScrollX += deltaX;
3001
+ parent._gsScrollY += deltaY;
3002
+ setPointerPosition(self.pointerX, self.pointerY);
3003
+ }
3004
+ }
3005
+ },
3006
+ onClick = function onClick(e) {
3007
+ //this was a huge pain in the neck to align all the various browsers and their behaviors. Chrome, Firefox, Safari, Opera, Android, and Microsoft Edge all handle events differently! Some will only trigger native behavior (like checkbox toggling) from trusted events. Others don't even support isTrusted, but require 2 events to flow through before triggering native behavior. Edge treats everything as trusted but also mandates that 2 flow through to trigger the correct native behavior.
3008
+ var time = _getTime$1(),
3009
+ recentlyClicked = time - clickTime < 100,
3010
+ recentlyDragged = time - dragEndTime < 50,
3011
+ alreadyDispatched = recentlyClicked && clickDispatch === clickTime,
3012
+ defaultPrevented = self.pointerEvent && self.pointerEvent.defaultPrevented,
3013
+ alreadyDispatchedTrusted = recentlyClicked && trustedClickDispatch === clickTime,
3014
+ trusted = e.isTrusted || e.isTrusted == null && recentlyClicked && alreadyDispatched; //note: Safari doesn't support isTrusted, and it won't properly execute native behavior (like toggling checkboxes) on the first synthetic "click" event - we must wait for the 2nd and treat it as trusted (but stop propagation at that point). Confusing, I know. Don't you love cross-browser compatibility challenges?
3015
+
3016
+
3017
+ if ((alreadyDispatched || recentlyDragged && self.vars.suppressClickOnDrag !== false) && e.stopImmediatePropagation) {
3018
+ e.stopImmediatePropagation();
3019
+ }
3020
+
3021
+ if (recentlyClicked && !(self.pointerEvent && self.pointerEvent.defaultPrevented) && (!alreadyDispatched || trusted && !alreadyDispatchedTrusted)) {
3022
+ //let the first click pass through unhindered. Let the next one only if it's trusted, then no more (stop quick-succession ones)
3023
+ if (trusted && alreadyDispatched) {
3024
+ trustedClickDispatch = clickTime;
3025
+ }
3026
+
3027
+ clickDispatch = clickTime;
3028
+ return;
3029
+ }
3030
+
3031
+ if (self.isPressed || recentlyDragged || recentlyClicked) {
3032
+ if (!trusted || !e.detail || !recentlyClicked || defaultPrevented) {
3033
+ _preventDefault(e);
3034
+ }
3035
+ }
3036
+
3037
+ if (!recentlyClicked && !recentlyDragged && !dragged) {
3038
+ // for script-triggered event dispatches, like element.click()
3039
+ e && e.target && (self.pointerEvent = e);
3040
+
3041
+ _dispatchEvent(self, "click", "onClick");
3042
+ }
3043
+ },
3044
+ localizePoint = function localizePoint(p) {
3045
+ return matrix ? {
3046
+ x: p.x * matrix.a + p.y * matrix.c + matrix.e,
3047
+ y: p.x * matrix.b + p.y * matrix.d + matrix.f
3048
+ } : {
3049
+ x: p.x,
3050
+ y: p.y
3051
+ };
3052
+ };
3053
+
3054
+ old = Draggable.get(target);
3055
+ old && old.kill(); // avoids duplicates (an element can only be controlled by one Draggable)
3056
+ //give the user access to start/stop dragging...
3057
+
3058
+ _this2.startDrag = function (event, align) {
3059
+ var r1, r2, p1, p2;
3060
+ onPress(event || self.pointerEvent, true); //if the pointer isn't on top of the element, adjust things accordingly
3061
+
3062
+ if (align && !self.hitTest(event || self.pointerEvent)) {
3063
+ r1 = _parseRect(event || self.pointerEvent);
3064
+ r2 = _parseRect(target);
3065
+ p1 = localizePoint({
3066
+ x: r1.left + r1.width / 2,
3067
+ y: r1.top + r1.height / 2
3068
+ });
3069
+ p2 = localizePoint({
3070
+ x: r2.left + r2.width / 2,
3071
+ y: r2.top + r2.height / 2
3072
+ });
3073
+ startPointerX -= p1.x - p2.x;
3074
+ startPointerY -= p1.y - p2.y;
3075
+ }
3076
+
3077
+ if (!self.isDragging) {
3078
+ self.isDragging = dragged = true;
3079
+
3080
+ _dispatchEvent(self, "dragstart", "onDragStart");
3081
+ }
3082
+ };
3083
+
3084
+ _this2.drag = onMove;
3085
+
3086
+ _this2.endDrag = function (e) {
3087
+ return onRelease(e || self.pointerEvent, true);
3088
+ };
3089
+
3090
+ _this2.timeSinceDrag = function () {
3091
+ return self.isDragging ? 0 : (_getTime$1() - dragEndTime) / 1000;
3092
+ };
3093
+
3094
+ _this2.timeSinceClick = function () {
3095
+ return (_getTime$1() - clickTime) / 1000;
3096
+ };
3097
+
3098
+ _this2.hitTest = function (target, threshold) {
3099
+ return Draggable.hitTest(self.target, target, threshold);
3100
+ };
3101
+
3102
+ _this2.getDirection = function (from, diagonalThreshold) {
3103
+ //from can be "start" (default), "velocity", or an element
3104
+ var mode = from === "velocity" && InertiaPlugin$1 ? from : _isObject$1(from) && !rotationMode ? "element" : "start",
3105
+ xChange,
3106
+ yChange,
3107
+ ratio,
3108
+ direction,
3109
+ r1,
3110
+ r2;
3111
+
3112
+ if (mode === "element") {
3113
+ r1 = _parseRect(self.target);
3114
+ r2 = _parseRect(from);
3115
+ }
3116
+
3117
+ xChange = mode === "start" ? self.x - startElementX : mode === "velocity" ? InertiaPlugin$1.getVelocity(target, xProp) : r1.left + r1.width / 2 - (r2.left + r2.width / 2);
3118
+
3119
+ if (rotationMode) {
3120
+ return xChange < 0 ? "counter-clockwise" : "clockwise";
3121
+ } else {
3122
+ diagonalThreshold = diagonalThreshold || 2;
3123
+ yChange = mode === "start" ? self.y - startElementY : mode === "velocity" ? InertiaPlugin$1.getVelocity(target, yProp) : r1.top + r1.height / 2 - (r2.top + r2.height / 2);
3124
+ ratio = Math.abs(xChange / yChange);
3125
+ direction = ratio < 1 / diagonalThreshold ? "" : xChange < 0 ? "left" : "right";
3126
+
3127
+ if (ratio < diagonalThreshold) {
3128
+ if (direction !== "") {
3129
+ direction += "-";
3130
+ }
3131
+
3132
+ direction += yChange < 0 ? "up" : "down";
3133
+ }
3134
+ }
3135
+
3136
+ return direction;
3137
+ };
3138
+
3139
+ _this2.applyBounds = function (newBounds, sticky) {
3140
+ var x, y, forceZeroVelocity, e, parent, isRoot;
3141
+
3142
+ if (newBounds && vars.bounds !== newBounds) {
3143
+ vars.bounds = newBounds;
3144
+ return self.update(true, sticky);
3145
+ }
3146
+
3147
+ syncXY(true);
3148
+ calculateBounds();
3149
+
3150
+ if (hasBounds && !isTweening()) {
3151
+ x = self.x;
3152
+ y = self.y;
3153
+
3154
+ if (x > maxX) {
3155
+ x = maxX;
3156
+ } else if (x < minX) {
3157
+ x = minX;
3158
+ }
3159
+
3160
+ if (y > maxY) {
3161
+ y = maxY;
3162
+ } else if (y < minY) {
3163
+ y = minY;
3164
+ }
3165
+
3166
+ if (self.x !== x || self.y !== y) {
3167
+ forceZeroVelocity = true;
3168
+ self.x = self.endX = x;
3169
+
3170
+ if (rotationMode) {
3171
+ self.endRotation = x;
3172
+ } else {
3173
+ self.y = self.endY = y;
3174
+ }
3175
+
3176
+ dirty = true;
3177
+ render(true);
3178
+
3179
+ if (self.autoScroll && !self.isDragging) {
3180
+ _recordMaxScrolls(target.parentNode);
3181
+
3182
+ e = target;
3183
+ _windowProxy.scrollTop = _win$1.pageYOffset != null ? _win$1.pageYOffset : ownerDoc.documentElement.scrollTop != null ? ownerDoc.documentElement.scrollTop : ownerDoc.body.scrollTop;
3184
+ _windowProxy.scrollLeft = _win$1.pageXOffset != null ? _win$1.pageXOffset : ownerDoc.documentElement.scrollLeft != null ? ownerDoc.documentElement.scrollLeft : ownerDoc.body.scrollLeft;
3185
+
3186
+ while (e && !isRoot) {
3187
+ //walk up the chain and sense wherever the scrollTop/scrollLeft exceeds the maximum.
3188
+ isRoot = _isRoot(e.parentNode);
3189
+ parent = isRoot ? _windowProxy : e.parentNode;
3190
+
3191
+ if (allowY && parent.scrollTop > parent._gsMaxScrollY) {
3192
+ parent.scrollTop = parent._gsMaxScrollY;
3193
+ }
3194
+
3195
+ if (allowX && parent.scrollLeft > parent._gsMaxScrollX) {
3196
+ parent.scrollLeft = parent._gsMaxScrollX;
3197
+ }
3198
+
3199
+ e = parent;
3200
+ }
3201
+ }
3202
+ }
3203
+
3204
+ if (self.isThrowing && (forceZeroVelocity || self.endX > maxX || self.endX < minX || self.endY > maxY || self.endY < minY)) {
3205
+ animate(vars.inertia || vars.throwProps, forceZeroVelocity);
3206
+ }
3207
+ }
3208
+
3209
+ return self;
3210
+ };
3211
+
3212
+ _this2.update = function (applyBounds, sticky, ignoreExternalChanges) {
3213
+ if (sticky && self.isPressed) {
3214
+ // in case the element was repositioned in the document flow, thus its x/y may be identical but its position is actually quite different.
3215
+ var m = getGlobalMatrix(target),
3216
+ p = innerMatrix.apply({
3217
+ x: self.x - startElementX,
3218
+ y: self.y - startElementY
3219
+ }),
3220
+ m2 = getGlobalMatrix(target.parentNode, true);
3221
+ m2.apply({
3222
+ x: m.e - p.x,
3223
+ y: m.f - p.y
3224
+ }, p);
3225
+ self.x -= p.x - m2.e;
3226
+ self.y -= p.y - m2.f;
3227
+ render(true);
3228
+ recordStartPositions();
3229
+ }
3230
+
3231
+ var x = self.x,
3232
+ y = self.y;
3233
+ updateMatrix(!sticky);
3234
+
3235
+ if (applyBounds) {
3236
+ self.applyBounds();
3237
+ } else {
3238
+ dirty && ignoreExternalChanges && render(true);
3239
+ syncXY(true);
3240
+ }
3241
+
3242
+ if (sticky) {
3243
+ setPointerPosition(self.pointerX, self.pointerY);
3244
+ dirty && render(true);
3245
+ }
3246
+
3247
+ if (self.isPressed && !sticky && (allowX && Math.abs(x - self.x) > 0.01 || allowY && Math.abs(y - self.y) > 0.01 && !rotationMode)) {
3248
+ recordStartPositions();
3249
+ }
3250
+
3251
+ if (self.autoScroll) {
3252
+ _recordMaxScrolls(target.parentNode, self.isDragging);
3253
+
3254
+ checkAutoScrollBounds = self.isDragging;
3255
+ render(true); //in case reparenting occurred.
3256
+
3257
+ _removeScrollListener(target, updateScroll);
3258
+
3259
+ _addScrollListener(target, updateScroll);
3260
+ }
3261
+
3262
+ return self;
3263
+ };
3264
+
3265
+ _this2.enable = function (type) {
3266
+ var setVars = {
3267
+ lazy: true
3268
+ },
3269
+ id,
3270
+ i,
3271
+ trigger;
3272
+
3273
+ if (vars.cursor !== false) {
3274
+ setVars.cursor = vars.cursor || _defaultCursor;
3275
+ }
3276
+
3277
+ if (gsap$3.utils.checkPrefix("touchCallout")) {
3278
+ setVars.touchCallout = "none";
3279
+ }
3280
+
3281
+ if (type !== "soft") {
3282
+ _setTouchActionForAllDescendants(triggers, allowX === allowY ? "none" : vars.allowNativeTouchScrolling && target.scrollHeight === target.clientHeight === (target.scrollWidth === target.clientHeight) || vars.allowEventDefault ? "manipulation" : allowX ? "pan-y" : "pan-x"); // Some browsers like Internet Explorer will fire a pointercancel event when the user attempts to drag when touchAction is "manipulate" because it's perceived as a pan. If the element has scrollable content in only one direction, we should use pan-x or pan-y accordingly so that the pointercancel doesn't prevent dragging.
3283
+
3284
+
3285
+ i = triggers.length;
3286
+
3287
+ while (--i > -1) {
3288
+ trigger = triggers[i];
3289
+ _supportsPointer || _addListener$1(trigger, "mousedown", onPress);
3290
+
3291
+ _addListener$1(trigger, "touchstart", onPress);
3292
+
3293
+ _addListener$1(trigger, "click", onClick, true); // note: used to pass true for capture but it prevented click-to-play-video functionality in Firefox.
3294
+
3295
+
3296
+ gsap$3.set(trigger, setVars);
3297
+
3298
+ if (trigger.getBBox && trigger.ownerSVGElement && allowX !== allowY) {
3299
+ // a bug in chrome doesn't respect touch-action on SVG elements - it only works if we set it on the parent SVG.
3300
+ gsap$3.set(trigger.ownerSVGElement, {
3301
+ touchAction: vars.allowNativeTouchScrolling || vars.allowEventDefault ? "manipulation" : allowX ? "pan-y" : "pan-x"
3302
+ });
3303
+ }
3304
+
3305
+ vars.allowContextMenu || _addListener$1(trigger, "contextmenu", onContextMenu);
3306
+ }
3307
+
3308
+ _setSelectable(triggers, false);
3309
+ }
3310
+
3311
+ _addScrollListener(target, updateScroll);
3312
+
3313
+ enabled = true;
3314
+
3315
+ if (InertiaPlugin$1 && type !== "soft") {
3316
+ InertiaPlugin$1.track(scrollProxy || target, xyMode ? "x,y" : rotationMode ? "rotation" : "top,left");
3317
+ }
3318
+
3319
+ target._gsDragID = id = target._gsDragID || "d" + _lookupCount++;
3320
+ _lookup$1[id] = self;
3321
+
3322
+ if (scrollProxy) {
3323
+ scrollProxy.enable();
3324
+ scrollProxy.element._gsDragID = id;
3325
+ }
3326
+
3327
+ (vars.bounds || rotationMode) && recordStartPositions();
3328
+ vars.bounds && self.applyBounds();
3329
+ return self;
3330
+ };
3331
+
3332
+ _this2.disable = function (type) {
3333
+ var dragging = self.isDragging,
3334
+ i = triggers.length,
3335
+ trigger;
3336
+
3337
+ while (--i > -1) {
3338
+ _setStyle(triggers[i], "cursor", null);
3339
+ }
3340
+
3341
+ if (type !== "soft") {
3342
+ _setTouchActionForAllDescendants(triggers, null);
3343
+
3344
+ i = triggers.length;
3345
+
3346
+ while (--i > -1) {
3347
+ trigger = triggers[i];
3348
+
3349
+ _setStyle(trigger, "touchCallout", null);
3350
+
3351
+ _removeListener$1(trigger, "mousedown", onPress);
3352
+
3353
+ _removeListener$1(trigger, "touchstart", onPress);
3354
+
3355
+ _removeListener$1(trigger, "click", onClick, true);
3356
+
3357
+ _removeListener$1(trigger, "contextmenu", onContextMenu);
3358
+ }
3359
+
3360
+ _setSelectable(triggers, true);
3361
+
3362
+ if (touchEventTarget) {
3363
+ _removeListener$1(touchEventTarget, "touchcancel", onRelease);
3364
+
3365
+ _removeListener$1(touchEventTarget, "touchend", onRelease);
3366
+
3367
+ _removeListener$1(touchEventTarget, "touchmove", onMove);
3368
+ }
3369
+
3370
+ _removeListener$1(ownerDoc, "mouseup", onRelease);
3371
+
3372
+ _removeListener$1(ownerDoc, "mousemove", onMove);
3373
+ }
3374
+
3375
+ _removeScrollListener(target, updateScroll);
3376
+
3377
+ enabled = false;
3378
+
3379
+ if (InertiaPlugin$1 && type !== "soft") {
3380
+ InertiaPlugin$1.untrack(scrollProxy || target, xyMode ? "x,y" : rotationMode ? "rotation" : "top,left");
3381
+ self.tween && self.tween.kill();
3382
+ }
3383
+
3384
+ scrollProxy && scrollProxy.disable();
3385
+
3386
+ _removeFromRenderQueue(render);
3387
+
3388
+ self.isDragging = self.isPressed = isClicking = false;
3389
+ dragging && _dispatchEvent(self, "dragend", "onDragEnd");
3390
+ return self;
3391
+ };
3392
+
3393
+ _this2.enabled = function (value, type) {
3394
+ return arguments.length ? value ? self.enable(type) : self.disable(type) : enabled;
3395
+ };
3396
+
3397
+ _this2.kill = function () {
3398
+ self.isThrowing = false;
3399
+ self.tween && self.tween.kill();
3400
+ self.disable();
3401
+ gsap$3.set(triggers, {
3402
+ clearProps: "userSelect"
3403
+ });
3404
+ delete _lookup$1[target._gsDragID];
3405
+ return self;
3406
+ };
3407
+
3408
+ _this2.revert = function () {
3409
+ this.kill();
3410
+ this.styles && this.styles.revert();
3411
+ };
3412
+
3413
+ if (~type.indexOf("scroll")) {
3414
+ scrollProxy = _this2.scrollProxy = new ScrollProxy(target, _extend$1({
3415
+ onKill: function onKill() {
3416
+ //ScrollProxy's onKill() gets called if/when the ScrollProxy senses that the user interacted with the scroll position manually (like using the scrollbar). IE9 doesn't fire the "mouseup" properly when users drag the scrollbar of an element, so this works around that issue.
3417
+ self.isPressed && onRelease(null);
3418
+ }
3419
+ }, vars)); //a bug in many Android devices' stock browser causes scrollTop to get forced back to 0 after it is altered via JS, so we set overflow to "hidden" on mobile/touch devices (they hide the scroll bar anyway). That works around the bug. (This bug is discussed at https://code.google.com/p/android/issues/detail?id=19625)
3420
+
3421
+ target.style.overflowY = allowY && !_isTouchDevice ? "auto" : "hidden";
3422
+ target.style.overflowX = allowX && !_isTouchDevice ? "auto" : "hidden";
3423
+ target = scrollProxy.content;
3424
+ }
3425
+
3426
+ if (rotationMode) {
3427
+ killProps.rotation = 1;
3428
+ } else {
3429
+ if (allowX) {
3430
+ killProps[xProp] = 1;
3431
+ }
3432
+
3433
+ if (allowY) {
3434
+ killProps[yProp] = 1;
3435
+ }
3436
+ }
3437
+
3438
+ gsCache.force3D = "force3D" in vars ? vars.force3D : true; //otherwise, normal dragging would be in 2D and then as soon as it's released and there's an inertia tween, it'd jump to 3D which can create an initial jump due to the work the browser must to do layerize it.
3439
+
3440
+ _context$1(_assertThisInitialized(_this2));
3441
+
3442
+ _this2.enable();
3443
+
3444
+ return _this2;
3445
+ }
3446
+
3447
+ Draggable.register = function register(core) {
3448
+ gsap$3 = core;
3449
+
3450
+ _initCore$3();
3451
+ };
3452
+
3453
+ Draggable.create = function create(targets, vars) {
3454
+ _coreInitted$3 || _initCore$3(true);
3455
+ return _toArray$2(targets).map(function (target) {
3456
+ return new Draggable(target, vars);
3457
+ });
3458
+ };
3459
+
3460
+ Draggable.get = function get(target) {
3461
+ return _lookup$1[(_toArray$2(target)[0] || {})._gsDragID];
3462
+ };
3463
+
3464
+ Draggable.timeSinceDrag = function timeSinceDrag() {
3465
+ return (_getTime$1() - _lastDragTime) / 1000;
3466
+ };
3467
+
3468
+ Draggable.hitTest = function hitTest(obj1, obj2, threshold) {
3469
+ if (obj1 === obj2) {
3470
+ return false;
3471
+ }
3472
+
3473
+ var r1 = _parseRect(obj1),
3474
+ r2 = _parseRect(obj2),
3475
+ top = r1.top,
3476
+ left = r1.left,
3477
+ right = r1.right,
3478
+ bottom = r1.bottom,
3479
+ width = r1.width,
3480
+ height = r1.height,
3481
+ isOutside = r2.left > right || r2.right < left || r2.top > bottom || r2.bottom < top,
3482
+ overlap,
3483
+ area,
3484
+ isRatio;
3485
+
3486
+ if (isOutside || !threshold) {
3487
+ return !isOutside;
3488
+ }
3489
+
3490
+ isRatio = (threshold + "").indexOf("%") !== -1;
3491
+ threshold = parseFloat(threshold) || 0;
3492
+ overlap = {
3493
+ left: Math.max(left, r2.left),
3494
+ top: Math.max(top, r2.top)
3495
+ };
3496
+ overlap.width = Math.min(right, r2.right) - overlap.left;
3497
+ overlap.height = Math.min(bottom, r2.bottom) - overlap.top;
3498
+
3499
+ if (overlap.width < 0 || overlap.height < 0) {
3500
+ return false;
3501
+ }
3502
+
3503
+ if (isRatio) {
3504
+ threshold *= 0.01;
3505
+ area = overlap.width * overlap.height;
3506
+ return area >= width * height * threshold || area >= r2.width * r2.height * threshold;
3507
+ }
3508
+
3509
+ return overlap.width > threshold && overlap.height > threshold;
3510
+ };
3511
+
3512
+ return Draggable;
3513
+ }(EventDispatcher);
3514
+
3515
+ _setDefaults(Draggable.prototype, {
3516
+ pointerX: 0,
3517
+ pointerY: 0,
3518
+ startX: 0,
3519
+ startY: 0,
3520
+ deltaX: 0,
3521
+ deltaY: 0,
3522
+ isDragging: false,
3523
+ isPressed: false
3524
+ });
3525
+
3526
+ Draggable.zIndex = 1000;
3527
+ Draggable.version = "3.13.0";
3528
+ _getGSAP$3() && gsap$3.registerPlugin(Draggable);
3529
+
428
3530
  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); } }
429
3531
 
430
3532
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
@@ -439,8 +3541,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
439
3541
  */
440
3542
 
441
3543
  /* eslint-disable */
442
- var gsap,
443
- _coreInitted,
3544
+ var gsap$2,
3545
+ _coreInitted$2,
444
3546
  _win,
445
3547
  _doc,
446
3548
  _docEl,
@@ -452,8 +3554,8 @@ var gsap,
452
3554
  _normalizer,
453
3555
  _eventTypes,
454
3556
  _context,
455
- _getGSAP = function _getGSAP() {
456
- return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap;
3557
+ _getGSAP$2 = function _getGSAP() {
3558
+ return gsap$2 || typeof window !== "undefined" && (gsap$2 = window.gsap) && gsap$2.registerPlugin && gsap$2;
457
3559
  },
458
3560
  _startup = 1,
459
3561
  _observers = [],
@@ -548,7 +3650,7 @@ var gsap,
548
3650
  })
549
3651
  },
550
3652
  _getTarget = function _getTarget(t, self) {
551
- return (self && self._ctx && self._ctx.selector || gsap.utils.toArray)(t)[0] || (typeof t === "string" && gsap.config().nullTargetWarn !== false ? console.warn("Element not found:", t) : null);
3653
+ return (self && self._ctx && self._ctx.selector || gsap$2.utils.toArray)(t)[0] || (typeof t === "string" && gsap$2.config().nullTargetWarn !== false ? console.warn("Element not found:", t) : null);
552
3654
  },
553
3655
  _isWithin = function _isWithin(element, list) {
554
3656
  // check if the element is in the list or is a descendant of an element in the list.
@@ -579,7 +3681,7 @@ var gsap,
579
3681
  return arguments.length ? element[s] = value : element[s];
580
3682
  })));
581
3683
  func.target = element;
582
- prev || (func.smooth = gsap.getProperty(element, "scrollBehavior") === "smooth"); // only set it the first time (don't reset every time a scrollFunc is requested because perhaps it happens during a refresh() when it's disabled in ScrollTrigger.
3684
+ prev || (func.smooth = gsap$2.getProperty(element, "scrollBehavior") === "smooth"); // only set it the first time (don't reset every time a scrollFunc is requested because perhaps it happens during a refresh() when it's disabled in ScrollTrigger.
583
3685
 
584
3686
  return func;
585
3687
  },
@@ -631,21 +3733,21 @@ var gsap,
631
3733
  return Math.abs(max) >= Math.abs(min) ? max : min;
632
3734
  },
633
3735
  _setScrollTrigger = function _setScrollTrigger() {
634
- ScrollTrigger = gsap.core.globals().ScrollTrigger;
3736
+ ScrollTrigger = gsap$2.core.globals().ScrollTrigger;
635
3737
  ScrollTrigger && ScrollTrigger.core && _integrate();
636
3738
  },
637
- _initCore = function _initCore(core) {
638
- gsap = core || _getGSAP();
3739
+ _initCore$2 = function _initCore(core) {
3740
+ gsap$2 = core || _getGSAP$2();
639
3741
 
640
- if (!_coreInitted && gsap && typeof document !== "undefined" && document.body) {
3742
+ if (!_coreInitted$2 && gsap$2 && typeof document !== "undefined" && document.body) {
641
3743
  _win = window;
642
3744
  _doc = document;
643
3745
  _docEl = _doc.documentElement;
644
3746
  _body = _doc.body;
645
3747
  _root = [_win, _doc, _docEl, _body];
646
- gsap.utils.clamp;
3748
+ gsap$2.utils.clamp;
647
3749
 
648
- _context = gsap.core.context || function () {};
3750
+ _context = gsap$2.core.context || function () {};
649
3751
 
650
3752
  _pointerType = "onpointerenter" in _body ? "pointer" : "mouse"; // isTouch is 0 if no touch, 1 if ONLY touch, and 2 if it can accommodate touch but also other types like mouse/pointer.
651
3753
 
@@ -657,10 +3759,10 @@ var gsap,
657
3759
 
658
3760
  _setScrollTrigger();
659
3761
 
660
- _coreInitted = 1;
3762
+ _coreInitted$2 = 1;
661
3763
  }
662
3764
 
663
- return _coreInitted;
3765
+ return _coreInitted$2;
664
3766
  };
665
3767
 
666
3768
  _horizontal.op = _vertical;
@@ -673,7 +3775,7 @@ var Observer = /*#__PURE__*/function () {
673
3775
  var _proto = Observer.prototype;
674
3776
 
675
3777
  _proto.init = function init(vars) {
676
- _coreInitted || _initCore(gsap) || console.warn("Please gsap.registerPlugin(Observer)");
3778
+ _coreInitted$2 || _initCore$2(gsap$2) || console.warn("Please gsap.registerPlugin(Observer)");
677
3779
  ScrollTrigger || _setScrollTrigger();
678
3780
  var tolerance = vars.tolerance,
679
3781
  dragMinimum = vars.dragMinimum,
@@ -719,7 +3821,7 @@ var Observer = /*#__PURE__*/function () {
719
3821
  onLockAxis = vars.onLockAxis;
720
3822
  this.target = target = _getTarget(target) || _docEl;
721
3823
  this.vars = vars;
722
- ignore && (ignore = gsap.utils.toArray(ignore));
3824
+ ignore && (ignore = gsap$2.utils.toArray(ignore));
723
3825
  tolerance = tolerance || 1e-9;
724
3826
  dragMinimum = dragMinimum || 0;
725
3827
  wheelSpeed = wheelSpeed || 1;
@@ -908,7 +4010,7 @@ var Observer = /*#__PURE__*/function () {
908
4010
 
909
4011
 
910
4012
  if (preventDefault && allowClicks) {
911
- gsap.delayedCall(0.08, function () {
4013
+ gsap$2.delayedCall(0.08, function () {
912
4014
  // some browsers (like Firefox) won't trust script-generated clicks, so if the user tries to click on a video to play it, for example, it simply won't work. Since a regular "click" event will most likely be generated anyway (one that has its isTrusted flag set to true), we must slightly delay our script-generated click so that the "real"/trusted one is prioritized. Remember, when there are duplicate events in quick succession, we suppress all but the first one. Some browsers don't even trigger the "real" one at all, so our synthetic one is a safety valve that ensures that no matter what, a click event does get dispatched.
913
4015
  if (_getTime() - onClickTime > 300 && !e.defaultPrevented) {
914
4016
  if (e.target.click) {
@@ -987,7 +4089,7 @@ var Observer = /*#__PURE__*/function () {
987
4089
  return _ignoreCheck(e) || _getEvent(e, preventDefault) && onClick(self);
988
4090
  };
989
4091
 
990
- onStopDelayedCall = self._dc = gsap.delayedCall(onStopDelay || 0.25, onStopFunc).pause();
4092
+ onStopDelayedCall = self._dc = gsap$2.delayedCall(onStopDelay || 0.25, onStopFunc).pause();
991
4093
  self.deltaX = self.deltaY = 0;
992
4094
  self._vx = _getVelocityProp(0, 50);
993
4095
  self._vy = _getVelocityProp(0, 50);
@@ -1115,7 +4217,7 @@ Observer.create = function (vars) {
1115
4217
  return new Observer(vars);
1116
4218
  };
1117
4219
 
1118
- Observer.register = _initCore;
4220
+ Observer.register = _initCore$2;
1119
4221
 
1120
4222
  Observer.getAll = function () {
1121
4223
  return _observers.slice();
@@ -1127,7 +4229,729 @@ Observer.getById = function (id) {
1127
4229
  })[0];
1128
4230
  };
1129
4231
 
1130
- _getGSAP() && gsap.registerPlugin(Observer);
4232
+ _getGSAP$2() && gsap$2.registerPlugin(Observer);
4233
+
4234
+ /*!
4235
+ * VelocityTracker: 3.13.0
4236
+ * https://gsap.com
4237
+ *
4238
+ * Copyright 2008-2025, GreenSock. All rights reserved.
4239
+ * Subject to the terms at https://gsap.com/standard-license
4240
+ * @author: Jack Doyle, jack@greensock.com
4241
+ */
4242
+
4243
+ /* eslint-disable */
4244
+ var gsap$1,
4245
+ _coreInitted$1,
4246
+ _toArray$1,
4247
+ _getUnit$1,
4248
+ _first,
4249
+ _ticker,
4250
+ _time1,
4251
+ _getCache$1,
4252
+ _getGSAP$1 = function _getGSAP() {
4253
+ return gsap$1 || typeof window !== "undefined" && (gsap$1 = window.gsap);
4254
+ },
4255
+ _lookup = {},
4256
+ _round$1 = function _round(value) {
4257
+ return Math.round(value * 10000) / 10000;
4258
+ },
4259
+ _getID = function _getID(target) {
4260
+ return _getCache$1(target).id;
4261
+ },
4262
+ _getByTarget = function _getByTarget(target) {
4263
+ return _lookup[_getID(typeof target === "string" ? _toArray$1(target)[0] : target)];
4264
+ },
4265
+ _onTick = function _onTick(time) {
4266
+ var pt = _first,
4267
+ val; //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values about 20 times per second
4268
+
4269
+ if (time - _time1 >= 0.05) {
4270
+ _time1 = time;
4271
+
4272
+ while (pt) {
4273
+ val = pt.g(pt.t, pt.p);
4274
+
4275
+ if (val !== pt.v1 || time - pt.t1 > 0.2) {
4276
+ //use a threshold of 0.2 seconds for zeroing-out velocity. If we only use 0.05 and things update slightly slower, like some Android devices dispatch "touchmove" events sluggishly so 2 or 3 ticks of the gsap.ticker may elapse inbetween, thus it may appear like the object is not moving but it actually is but it's not updating as frequently. A threshold of 0.2 seconds seems to be a good balance. We want to update things frequently (0.05 seconds) when they're moving so that we can respond to fast motions accurately, but we want to be more resistant to go back to a zero velocity.
4277
+ pt.v2 = pt.v1;
4278
+ pt.v1 = val;
4279
+ pt.t2 = pt.t1;
4280
+ pt.t1 = time;
4281
+ }
4282
+
4283
+ pt = pt._next;
4284
+ }
4285
+ }
4286
+ },
4287
+ _types = {
4288
+ deg: 360,
4289
+ rad: Math.PI * 2
4290
+ },
4291
+ _initCore$1 = function _initCore() {
4292
+ gsap$1 = _getGSAP$1();
4293
+
4294
+ if (gsap$1) {
4295
+ _toArray$1 = gsap$1.utils.toArray;
4296
+ _getUnit$1 = gsap$1.utils.getUnit;
4297
+ _getCache$1 = gsap$1.core.getCache;
4298
+ _ticker = gsap$1.ticker;
4299
+ _coreInitted$1 = 1;
4300
+ }
4301
+ };
4302
+
4303
+ var PropTracker = function PropTracker(target, property, type, next) {
4304
+ this.t = target;
4305
+ this.p = property;
4306
+ this.g = target._gsap.get;
4307
+ this.rCap = _types[type || _getUnit$1(this.g(target, property))]; //rotational cap (for degrees, "deg", it's 360 and for radians, "rad", it's Math.PI * 2)
4308
+
4309
+ this.v1 = this.v2 = 0;
4310
+ this.t1 = this.t2 = _ticker.time;
4311
+
4312
+ if (next) {
4313
+ this._next = next;
4314
+ next._prev = this;
4315
+ }
4316
+ };
4317
+
4318
+ var VelocityTracker = /*#__PURE__*/function () {
4319
+ function VelocityTracker(target, property) {
4320
+ if (!_coreInitted$1) {
4321
+ _initCore$1();
4322
+ }
4323
+
4324
+ this.target = _toArray$1(target)[0];
4325
+ _lookup[_getID(this.target)] = this;
4326
+ this._props = {};
4327
+ property && this.add(property);
4328
+ }
4329
+
4330
+ VelocityTracker.register = function register(core) {
4331
+ gsap$1 = core;
4332
+
4333
+ _initCore$1();
4334
+ };
4335
+
4336
+ var _proto = VelocityTracker.prototype;
4337
+
4338
+ _proto.get = function get(property, skipRecentTick) {
4339
+ var pt = this._props[property] || console.warn("Not tracking " + property + " velocity."),
4340
+ val,
4341
+ dif,
4342
+ rotationCap;
4343
+ val = parseFloat(skipRecentTick ? pt.v1 : pt.g(pt.t, pt.p));
4344
+ dif = val - parseFloat(pt.v2);
4345
+ rotationCap = pt.rCap;
4346
+
4347
+ if (rotationCap) {
4348
+ //rotational values need special interpretation so that if, for example, they go from 179 to -178 degrees it is interpreted as a change of 3 instead of -357.
4349
+ dif = dif % rotationCap;
4350
+
4351
+ if (dif !== dif % (rotationCap / 2)) {
4352
+ dif = dif < 0 ? dif + rotationCap : dif - rotationCap;
4353
+ }
4354
+ }
4355
+
4356
+ return _round$1(dif / ((skipRecentTick ? pt.t1 : _ticker.time) - pt.t2));
4357
+ };
4358
+
4359
+ _proto.getAll = function getAll() {
4360
+ var result = {},
4361
+ props = this._props,
4362
+ p;
4363
+
4364
+ for (p in props) {
4365
+ result[p] = this.get(p);
4366
+ }
4367
+
4368
+ return result;
4369
+ };
4370
+
4371
+ _proto.isTracking = function isTracking(property) {
4372
+ return property in this._props;
4373
+ };
4374
+
4375
+ _proto.add = function add(property, type) {
4376
+ if (!(property in this._props)) {
4377
+ if (!_first) {
4378
+ _ticker.add(_onTick);
4379
+
4380
+ _time1 = _ticker.time;
4381
+ }
4382
+
4383
+ _first = this._props[property] = new PropTracker(this.target, property, type, _first);
4384
+ }
4385
+ };
4386
+
4387
+ _proto.remove = function remove(property) {
4388
+ var pt = this._props[property],
4389
+ prev,
4390
+ next;
4391
+
4392
+ if (pt) {
4393
+ prev = pt._prev;
4394
+ next = pt._next;
4395
+
4396
+ if (prev) {
4397
+ prev._next = next;
4398
+ }
4399
+
4400
+ if (next) {
4401
+ next._prev = prev;
4402
+ } else if (_first === pt) {
4403
+ _ticker.remove(_onTick);
4404
+
4405
+ _first = 0;
4406
+ }
4407
+
4408
+ delete this._props[property];
4409
+ }
4410
+ };
4411
+
4412
+ _proto.kill = function kill(shallow) {
4413
+ for (var p in this._props) {
4414
+ this.remove(p);
4415
+ }
4416
+
4417
+ if (!shallow) {
4418
+ delete _lookup[_getID(this.target)];
4419
+ }
4420
+ };
4421
+
4422
+ VelocityTracker.track = function track(targets, properties, types) {
4423
+ if (!_coreInitted$1) {
4424
+ _initCore$1();
4425
+ }
4426
+
4427
+ var result = [],
4428
+ targs = _toArray$1(targets),
4429
+ a = properties.split(","),
4430
+ t = (types || "").split(","),
4431
+ i = targs.length,
4432
+ tracker,
4433
+ j;
4434
+
4435
+ while (i--) {
4436
+ tracker = _getByTarget(targs[i]) || new VelocityTracker(targs[i]);
4437
+ j = a.length;
4438
+
4439
+ while (j--) {
4440
+ tracker.add(a[j], t[j] || t[0]);
4441
+ }
4442
+
4443
+ result.push(tracker);
4444
+ }
4445
+
4446
+ return result;
4447
+ };
4448
+
4449
+ VelocityTracker.untrack = function untrack(targets, properties) {
4450
+ var props = (properties || "").split(",");
4451
+
4452
+ _toArray$1(targets).forEach(function (target) {
4453
+ var tracker = _getByTarget(target);
4454
+
4455
+ if (tracker) {
4456
+ if (!props.length) {
4457
+ tracker.kill(1);
4458
+ } else {
4459
+ props.forEach(function (p) {
4460
+ return tracker.remove(p);
4461
+ });
4462
+ }
4463
+ }
4464
+ });
4465
+ };
4466
+
4467
+ VelocityTracker.isTracking = function isTracking(target, property) {
4468
+ var tracker = _getByTarget(target);
4469
+
4470
+ return tracker && tracker.isTracking(property);
4471
+ };
4472
+
4473
+ VelocityTracker.getVelocity = function getVelocity(target, property) {
4474
+ var tracker = _getByTarget(target);
4475
+
4476
+ return !tracker || !tracker.isTracking(property) ? console.warn("Not tracking velocity of " + property) : tracker.get(property);
4477
+ };
4478
+
4479
+ return VelocityTracker;
4480
+ }();
4481
+ VelocityTracker.getByTarget = _getByTarget;
4482
+ _getGSAP$1() && gsap$1.registerPlugin(VelocityTracker);
4483
+
4484
+ /*!
4485
+ * InertiaPlugin 3.13.0
4486
+ * https://gsap.com
4487
+ *
4488
+ * @license Copyright 2008-2025, GreenSock. All rights reserved.
4489
+ * Subject to the terms at https://gsap.com/standard-license
4490
+ * @author: Jack Doyle, jack@greensock.com
4491
+ */
4492
+
4493
+
4494
+ var gsap,
4495
+ _coreInitted,
4496
+ _parseEase,
4497
+ _toArray,
4498
+ _power3,
4499
+ _config,
4500
+ _getUnit,
4501
+ PropTween,
4502
+ _getCache,
4503
+ _checkPointRatio,
4504
+ _clamp,
4505
+ _processingVars,
4506
+ _getStyleSaver,
4507
+ _reverting,
4508
+ _getTracker = VelocityTracker.getByTarget,
4509
+ _getGSAP = function _getGSAP() {
4510
+ return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap;
4511
+ },
4512
+ _isString = function _isString(value) {
4513
+ return typeof value === "string";
4514
+ },
4515
+ _isNumber = function _isNumber(value) {
4516
+ return typeof value === "number";
4517
+ },
4518
+ _isObject = function _isObject(value) {
4519
+ return typeof value === "object";
4520
+ },
4521
+ _isFunction = function _isFunction(value) {
4522
+ return typeof value === "function";
4523
+ },
4524
+ _bonusValidated = 1,
4525
+ //<name>InertiaPlugin</name>
4526
+ _isArray = Array.isArray,
4527
+ _emptyFunc = function _emptyFunc(p) {
4528
+ return p;
4529
+ },
4530
+ _bigNum = 1e10,
4531
+ _tinyNum = 1 / _bigNum,
4532
+ _checkPoint = 0.05,
4533
+ _round = function _round(value) {
4534
+ return Math.round(value * 10000) / 10000;
4535
+ },
4536
+ _extend = function _extend(obj, defaults, exclude) {
4537
+ for (var p in defaults) {
4538
+ if (!(p in obj) && p !== exclude) {
4539
+ obj[p] = defaults[p];
4540
+ }
4541
+ }
4542
+
4543
+ return obj;
4544
+ },
4545
+ _deepClone = function _deepClone(obj) {
4546
+ var copy = {},
4547
+ p,
4548
+ v;
4549
+
4550
+ for (p in obj) {
4551
+ copy[p] = _isObject(v = obj[p]) && !_isArray(v) ? _deepClone(v) : v;
4552
+ }
4553
+
4554
+ return copy;
4555
+ },
4556
+ _getClosest = function _getClosest(n, values, max, min, radius) {
4557
+ var i = values.length,
4558
+ closest = 0,
4559
+ absDif = _bigNum,
4560
+ val,
4561
+ dif,
4562
+ p,
4563
+ dist;
4564
+
4565
+ if (_isObject(n)) {
4566
+ while (i--) {
4567
+ val = values[i];
4568
+ dif = 0;
4569
+
4570
+ for (p in n) {
4571
+ dist = val[p] - n[p];
4572
+ dif += dist * dist;
4573
+ }
4574
+
4575
+ if (dif < absDif) {
4576
+ closest = i;
4577
+ absDif = dif;
4578
+ }
4579
+ }
4580
+
4581
+ if ((radius || _bigNum) < _bigNum && radius < Math.sqrt(absDif)) {
4582
+ return n;
4583
+ }
4584
+ } else {
4585
+ while (i--) {
4586
+ val = values[i];
4587
+ dif = val - n;
4588
+
4589
+ if (dif < 0) {
4590
+ dif = -dif;
4591
+ }
4592
+
4593
+ if (dif < absDif && val >= min && val <= max) {
4594
+ closest = i;
4595
+ absDif = dif;
4596
+ }
4597
+ }
4598
+ }
4599
+
4600
+ return values[closest];
4601
+ },
4602
+ _parseEnd = function _parseEnd(curProp, end, max, min, name, radius, velocity) {
4603
+ if (curProp.end === "auto") {
4604
+ return curProp;
4605
+ }
4606
+
4607
+ var endVar = curProp.end,
4608
+ adjustedEnd,
4609
+ p;
4610
+ max = isNaN(max) ? _bigNum : max;
4611
+ min = isNaN(min) ? -_bigNum : min;
4612
+
4613
+ if (_isObject(end)) {
4614
+ //for objects, like {x, y} where they're linked and we must pass an object to the function or find the closest value in an array.
4615
+ adjustedEnd = end.calculated ? end : (_isFunction(endVar) ? endVar(end, velocity) : _getClosest(end, endVar, max, min, radius)) || end;
4616
+
4617
+ if (!end.calculated) {
4618
+ for (p in adjustedEnd) {
4619
+ end[p] = adjustedEnd[p];
4620
+ }
4621
+
4622
+ end.calculated = true;
4623
+ }
4624
+
4625
+ adjustedEnd = adjustedEnd[name];
4626
+ } else {
4627
+ adjustedEnd = _isFunction(endVar) ? endVar(end, velocity) : _isArray(endVar) ? _getClosest(end, endVar, max, min, radius) : parseFloat(endVar);
4628
+ }
4629
+
4630
+ if (adjustedEnd > max) {
4631
+ adjustedEnd = max;
4632
+ } else if (adjustedEnd < min) {
4633
+ adjustedEnd = min;
4634
+ }
4635
+
4636
+ return {
4637
+ max: adjustedEnd,
4638
+ min: adjustedEnd,
4639
+ unitFactor: curProp.unitFactor
4640
+ };
4641
+ },
4642
+ _getNumOrDefault = function _getNumOrDefault(vars, property, defaultValue) {
4643
+ return isNaN(vars[property]) ? defaultValue : +vars[property];
4644
+ },
4645
+ _calculateChange = function _calculateChange(velocity, duration) {
4646
+ return duration * _checkPoint * velocity / _checkPointRatio;
4647
+ },
4648
+ _calculateDuration = function _calculateDuration(start, end, velocity) {
4649
+ return Math.abs((end - start) * _checkPointRatio / velocity / _checkPoint);
4650
+ },
4651
+ _reservedProps = {
4652
+ resistance: 1,
4653
+ checkpoint: 1,
4654
+ preventOvershoot: 1,
4655
+ linkedProps: 1,
4656
+ radius: 1,
4657
+ duration: 1
4658
+ },
4659
+ _processLinkedProps = function _processLinkedProps(target, vars, getVal, resistance) {
4660
+ if (vars.linkedProps) {
4661
+ //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop.
4662
+ var linkedPropNames = vars.linkedProps.split(","),
4663
+ linkedProps = {},
4664
+ i,
4665
+ p,
4666
+ curProp,
4667
+ curVelocity,
4668
+ tracker,
4669
+ curDuration;
4670
+
4671
+ for (i = 0; i < linkedPropNames.length; i++) {
4672
+ p = linkedPropNames[i];
4673
+ curProp = vars[p];
4674
+
4675
+ if (curProp) {
4676
+ if (_isNumber(curProp.velocity)) {
4677
+ curVelocity = curProp.velocity;
4678
+ } else {
4679
+ tracker = tracker || _getTracker(target);
4680
+ curVelocity = tracker && tracker.isTracking(p) ? tracker.get(p) : 0;
4681
+ }
4682
+
4683
+ curDuration = Math.abs(curVelocity / _getNumOrDefault(curProp, "resistance", resistance));
4684
+ linkedProps[p] = parseFloat(getVal(target, p)) + _calculateChange(curVelocity, curDuration);
4685
+ }
4686
+ }
4687
+
4688
+ return linkedProps;
4689
+ }
4690
+ },
4691
+ _calculateTweenDuration = function _calculateTweenDuration(target, vars, maxDuration, minDuration, overshootTolerance, recordEnd) {
4692
+ if (maxDuration === void 0) {
4693
+ maxDuration = 10;
4694
+ }
4695
+
4696
+ if (minDuration === void 0) {
4697
+ minDuration = 0.2;
4698
+ }
4699
+
4700
+ if (overshootTolerance === void 0) {
4701
+ overshootTolerance = 1;
4702
+ }
4703
+
4704
+ _isString(target) && (target = _toArray(target)[0]);
4705
+
4706
+ if (!target) {
4707
+ return 0;
4708
+ }
4709
+
4710
+ var duration = 0,
4711
+ clippedDuration = _bigNum,
4712
+ inertiaVars = vars.inertia || vars,
4713
+ getVal = _getCache(target).get,
4714
+ resistance = _getNumOrDefault(inertiaVars, "resistance", _config.resistance),
4715
+ p,
4716
+ curProp,
4717
+ curDuration,
4718
+ curVelocity,
4719
+ curVal,
4720
+ end,
4721
+ curClippedDuration,
4722
+ tracker,
4723
+ unitFactor,
4724
+ linkedProps; //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop.
4725
+
4726
+
4727
+ linkedProps = _processLinkedProps(target, inertiaVars, getVal, resistance);
4728
+
4729
+ for (p in inertiaVars) {
4730
+ if (!_reservedProps[p]) {
4731
+ curProp = inertiaVars[p];
4732
+
4733
+ if (!_isObject(curProp)) {
4734
+ tracker = tracker || _getTracker(target);
4735
+
4736
+ if (tracker && tracker.isTracking(p)) {
4737
+ curProp = _isNumber(curProp) ? {
4738
+ velocity: curProp
4739
+ } : {
4740
+ velocity: tracker.get(p)
4741
+ }; //if we're tracking this property, we should use the tracking velocity and then use the numeric value that was passed in as the min and max so that it tweens exactly there.
4742
+ } else {
4743
+ curVelocity = +curProp || 0;
4744
+ curDuration = Math.abs(curVelocity / resistance);
4745
+ }
4746
+ }
4747
+
4748
+ if (_isObject(curProp)) {
4749
+ if (_isNumber(curProp.velocity)) {
4750
+ curVelocity = curProp.velocity;
4751
+ } else {
4752
+ tracker = tracker || _getTracker(target);
4753
+ curVelocity = tracker && tracker.isTracking(p) ? tracker.get(p) : 0;
4754
+ }
4755
+
4756
+ curDuration = _clamp(minDuration, maxDuration, Math.abs(curVelocity / _getNumOrDefault(curProp, "resistance", resistance)));
4757
+ curVal = parseFloat(getVal(target, p)) || 0;
4758
+ end = curVal + _calculateChange(curVelocity, curDuration);
4759
+
4760
+ if ("end" in curProp) {
4761
+ curProp = _parseEnd(curProp, linkedProps && p in linkedProps ? linkedProps : end, curProp.max, curProp.min, p, inertiaVars.radius, curVelocity);
4762
+
4763
+ {
4764
+ _processingVars === vars && (_processingVars = inertiaVars = _deepClone(vars));
4765
+ inertiaVars[p] = _extend(curProp, inertiaVars[p], "end");
4766
+ }
4767
+ }
4768
+
4769
+ if ("max" in curProp && end > +curProp.max + _tinyNum) {
4770
+ unitFactor = curProp.unitFactor || _config.unitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly.
4771
+ //if the value is already exceeding the max or the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive. If the max and min match, it means we're animating to a particular value and we don't want to shorten the time unless the velocity is really slow. Example: a rotation where the start and natural end value are less than the snapping spot, but the natural end is pretty close to the snap.
4772
+
4773
+ curClippedDuration = curVal > curProp.max && curProp.min !== curProp.max || curVelocity * unitFactor > -15 && curVelocity * unitFactor < 45 ? minDuration + (maxDuration - minDuration) * 0.1 : _calculateDuration(curVal, curProp.max, curVelocity);
4774
+
4775
+ if (curClippedDuration + overshootTolerance < clippedDuration) {
4776
+ clippedDuration = curClippedDuration + overshootTolerance;
4777
+ }
4778
+ } else if ("min" in curProp && end < +curProp.min - _tinyNum) {
4779
+ unitFactor = curProp.unitFactor || _config.unitFactors[p] || 1; //some values are measured in special units like radians in which case our thresholds need to be adjusted accordingly.
4780
+ //if the value is already exceeding the min or if the velocity is too low, the duration can end up being uncomfortably long but in most situations, users want the snapping to occur relatively quickly (0.75 seconds), so we implement a cap here to make things more intuitive.
4781
+
4782
+ curClippedDuration = curVal < curProp.min && curProp.min !== curProp.max || curVelocity * unitFactor > -45 && curVelocity * unitFactor < 15 ? minDuration + (maxDuration - minDuration) * 0.1 : _calculateDuration(curVal, curProp.min, curVelocity);
4783
+
4784
+ if (curClippedDuration + overshootTolerance < clippedDuration) {
4785
+ clippedDuration = curClippedDuration + overshootTolerance;
4786
+ }
4787
+ }
4788
+
4789
+ curClippedDuration > duration && (duration = curClippedDuration);
4790
+ }
4791
+
4792
+ curDuration > duration && (duration = curDuration);
4793
+ }
4794
+ }
4795
+
4796
+ duration > clippedDuration && (duration = clippedDuration);
4797
+ return duration > maxDuration ? maxDuration : duration < minDuration ? minDuration : duration;
4798
+ },
4799
+ _initCore = function _initCore() {
4800
+ gsap = _getGSAP();
4801
+
4802
+ if (gsap) {
4803
+ _parseEase = gsap.parseEase;
4804
+ _toArray = gsap.utils.toArray;
4805
+ _getUnit = gsap.utils.getUnit;
4806
+ _getCache = gsap.core.getCache;
4807
+ _clamp = gsap.utils.clamp;
4808
+ _getStyleSaver = gsap.core.getStyleSaver;
4809
+
4810
+ _reverting = gsap.core.reverting || function () {};
4811
+
4812
+ _power3 = _parseEase("power3");
4813
+ _checkPointRatio = _power3(0.05);
4814
+ PropTween = gsap.core.PropTween;
4815
+ gsap.config({
4816
+ resistance: 100,
4817
+ unitFactors: {
4818
+ time: 1000,
4819
+ totalTime: 1000,
4820
+ progress: 1000,
4821
+ totalProgress: 1000
4822
+ }
4823
+ });
4824
+ _config = gsap.config();
4825
+ gsap.registerPlugin(VelocityTracker);
4826
+ _coreInitted = 1;
4827
+ }
4828
+ };
4829
+
4830
+ var InertiaPlugin = {
4831
+ version: "3.13.0",
4832
+ name: "inertia",
4833
+ register: function register(core) {
4834
+ gsap = core;
4835
+
4836
+ _initCore();
4837
+ },
4838
+ init: function init(target, vars, tween, index, targets) {
4839
+ _coreInitted || _initCore();
4840
+
4841
+ var tracker = _getTracker(target);
4842
+
4843
+ if (vars === "auto") {
4844
+ if (!tracker) {
4845
+ console.warn("No inertia tracking on " + target + ". InertiaPlugin.track(target) first.");
4846
+ return;
4847
+ }
4848
+
4849
+ vars = tracker.getAll();
4850
+ }
4851
+
4852
+ this.styles = _getStyleSaver && typeof target.style === "object" && _getStyleSaver(target);
4853
+ this.target = target;
4854
+ this.tween = tween;
4855
+ _processingVars = vars; // gets swapped inside _calculateTweenDuration() if there's a function-based value encountered (to avoid double-calling it)
4856
+
4857
+ var cache = target._gsap,
4858
+ getVal = cache.get,
4859
+ dur = vars.duration,
4860
+ durIsObj = _isObject(dur),
4861
+ preventOvershoot = vars.preventOvershoot || durIsObj && dur.overshoot === 0,
4862
+ resistance = _getNumOrDefault(vars, "resistance", _config.resistance),
4863
+ duration = _isNumber(dur) ? dur : _calculateTweenDuration(target, vars, durIsObj && dur.max || 10, durIsObj && dur.min || 0.2, durIsObj && "overshoot" in dur ? +dur.overshoot : preventOvershoot ? 0 : 1),
4864
+ p,
4865
+ curProp,
4866
+ curVal,
4867
+ unit,
4868
+ velocity,
4869
+ change1,
4870
+ end,
4871
+ change2,
4872
+ linkedProps;
4873
+
4874
+ vars = _processingVars;
4875
+ _processingVars = 0; //when there are linkedProps (typically "x,y" where snapping has to factor in multiple properties, we must first populate an object with all of those end values, then feed it to the function that make any necessary alterations. So the point of this first loop is to simply build an object (like {x:100, y:204.5}) for feeding into that function which we'll do later in the "real" loop.
4876
+
4877
+ linkedProps = _processLinkedProps(target, vars, getVal, resistance);
4878
+
4879
+ for (p in vars) {
4880
+ if (!_reservedProps[p]) {
4881
+ curProp = vars[p];
4882
+ _isFunction(curProp) && (curProp = curProp(index, target, targets));
4883
+
4884
+ if (_isNumber(curProp)) {
4885
+ velocity = curProp;
4886
+ } else if (_isObject(curProp) && !isNaN(curProp.velocity)) {
4887
+ velocity = +curProp.velocity;
4888
+ } else {
4889
+ if (tracker && tracker.isTracking(p)) {
4890
+ velocity = tracker.get(p);
4891
+ } else {
4892
+ console.warn("ERROR: No velocity was defined for " + target + " property: " + p);
4893
+ }
4894
+ }
4895
+
4896
+ change1 = _calculateChange(velocity, duration);
4897
+ change2 = 0;
4898
+ curVal = getVal(target, p);
4899
+ unit = _getUnit(curVal);
4900
+ curVal = parseFloat(curVal);
4901
+
4902
+ if (_isObject(curProp)) {
4903
+ end = curVal + change1;
4904
+
4905
+ if ("end" in curProp) {
4906
+ curProp = _parseEnd(curProp, linkedProps && p in linkedProps ? linkedProps : end, curProp.max, curProp.min, p, vars.radius, velocity);
4907
+ }
4908
+
4909
+ if ("max" in curProp && +curProp.max < end) {
4910
+ if (preventOvershoot || curProp.preventOvershoot) {
4911
+ change1 = curProp.max - curVal;
4912
+ } else {
4913
+ change2 = curProp.max - curVal - change1;
4914
+ }
4915
+ } else if ("min" in curProp && +curProp.min > end) {
4916
+ if (preventOvershoot || curProp.preventOvershoot) {
4917
+ change1 = curProp.min - curVal;
4918
+ } else {
4919
+ change2 = curProp.min - curVal - change1;
4920
+ }
4921
+ }
4922
+ }
4923
+
4924
+ this._props.push(p);
4925
+
4926
+ this.styles && this.styles.save(p);
4927
+ this._pt = new PropTween(this._pt, target, p, curVal, 0, _emptyFunc, 0, cache.set(target, p, this));
4928
+ this._pt.u = unit || 0;
4929
+ this._pt.c1 = change1;
4930
+ this._pt.c2 = change2;
4931
+ }
4932
+ }
4933
+
4934
+ tween.duration(duration);
4935
+ return _bonusValidated;
4936
+ },
4937
+ render: function render(ratio, data) {
4938
+ var pt = data._pt;
4939
+ ratio = _power3(data.tween._time / data.tween._dur);
4940
+
4941
+ if (ratio || !_reverting()) {
4942
+ while (pt) {
4943
+ pt.set(pt.t, pt.p, _round(pt.s + pt.c1 * ratio + pt.c2 * ratio * ratio) + pt.u, pt.d, ratio);
4944
+ pt = pt._next;
4945
+ }
4946
+ } else {
4947
+ data.styles.revert();
4948
+ }
4949
+ }
4950
+ };
4951
+ "track,untrack,isTracking,getVelocity,getByTarget".split(",").forEach(function (name) {
4952
+ return InertiaPlugin[name] = VelocityTracker[name];
4953
+ });
4954
+ _getGSAP() && gsap.registerPlugin(InertiaPlugin);
1131
4955
 
1132
4956
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
1133
4957
 
@@ -3695,7 +7519,7 @@ const setupContainerStyles = (containerMarquee, marquees, marqueesChildren, isVe
3695
7519
  * - gap: Space between marquee elements (prevents content overlap)
3696
7520
  * - rotate: 90° rotation for vertical movement (transforms horizontal motion to vertical)
3697
7521
  */
3698
- gsap$1.set(containerMarquee, {
7522
+ gsap$4.set(containerMarquee, {
3699
7523
  gap: `${spacing}px`,
3700
7524
  rotate: isVertical ? 90 : "0",
3701
7525
  });
@@ -3707,10 +7531,10 @@ const setupContainerStyles = (containerMarquee, marquees, marqueesChildren, isVe
3707
7531
  */
3708
7532
  if (isVertical) {
3709
7533
  const parent = containerMarquee.parentNode;
3710
- gsap$1.set(containerMarquee, {
7534
+ gsap$4.set(containerMarquee, {
3711
7535
  width: parent.offsetHeight, // Width becomes the vertical space available
3712
7536
  });
3713
- gsap$1.set(marqueesChildren, {
7537
+ gsap$4.set(marqueesChildren, {
3714
7538
  overflow: "visible", // Prevents clipping during animation
3715
7539
  });
3716
7540
  }
@@ -3727,7 +7551,7 @@ const setupContainerStyles = (containerMarquee, marquees, marqueesChildren, isVe
3727
7551
  if (alignRotationWithY && marquees.length > 0) {
3728
7552
  const marqueeHeight = marquees[0].offsetHeight;
3729
7553
  // Center align items within the container
3730
- gsap$1.set(containerMarquee, {
7554
+ gsap$4.set(containerMarquee, {
3731
7555
  alignItems: "center",
3732
7556
  });
3733
7557
  /**
@@ -3738,7 +7562,7 @@ const setupContainerStyles = (containerMarquee, marquees, marqueesChildren, isVe
3738
7562
  * - width: Set to marquee height since dimensions are swapped after rotation
3739
7563
  * - flexWrap/wordBreak/whiteSpace: Handle text flow in constrained space
3740
7564
  */
3741
- gsap$1.set(marqueesChildren, {
7565
+ gsap$4.set(marqueesChildren, {
3742
7566
  rotate: -90, // Counter-rotate to keep text readable
3743
7567
  x: (containerMarquee.offsetWidth - spacing) / 2 - spacing, // Center horizontally
3744
7568
  display: "flex",
@@ -3751,7 +7575,7 @@ const setupContainerStyles = (containerMarquee, marquees, marqueesChildren, isVe
3751
7575
  * Adjust marquee height to fit within the rotated container
3752
7576
  * Accounts for spacing to prevent overflow
3753
7577
  */
3754
- gsap$1.set(marquees, {
7578
+ gsap$4.set(marquees, {
3755
7579
  height: containerMarquee.offsetWidth - spacing,
3756
7580
  });
3757
7581
  }
@@ -3835,7 +7659,7 @@ const getMinWidth = (marqueesChildren, totalWidth, containerMarqueeWidth, props)
3835
7659
  return `${totalWidth}px`;
3836
7660
  };
3837
7661
  /**
3838
- * Creates a complex fill-based marquee animation with seamless looping
7662
+ * Creates a complex marquee animation with seamless looping and draggable support
3839
7663
  *
3840
7664
  * This is the core animation engine that creates smooth, continuous scrolling.
3841
7665
  * It handles the complex math required for seamless looping by calculating
@@ -3846,19 +7670,23 @@ const getMinWidth = (marqueesChildren, totalWidth, containerMarqueeWidth, props)
3846
7670
  * 2. **Seamless Looping**: Calculate track length and loop points to prevent gaps
3847
7671
  * 3. **Staggered Animation**: Each element starts at different times for smooth flow
3848
7672
  * 4. **Direction Handling**: Support forward and reverse directions with proper timing
7673
+ * 5. **Integrated Draggable**: Optional support for drag interaction with manual control
3849
7674
  *
3850
7675
  * Technical Details:
3851
7676
  * - Uses xPercent for percentage-based positioning (responsive to element width changes)
3852
7677
  * - Creates two-part animation: main movement + seamless loop reset
3853
7678
  * - Calculates precise durations based on distance and speed for consistent motion
7679
+ * - Implements draggable with intelligent pause/resume animation handling
3854
7680
  *
3855
7681
  * @param elementsToAnimate - Array of DOM elements to animate (content or containers)
3856
7682
  * @param startX - Starting X position reference point
3857
7683
  * @param tl - GSAP timeline to add animations to
3858
7684
  * @param isReverse - Whether animation should play in reverse direction
7685
+ * @param draggableTrigger - Element(s) that will trigger the draggable functionality
7686
+ * @param isVertical - Whether the marquee scrolls vertically
3859
7687
  * @param props - Configuration object with spacing, speed, delay, and other settings
3860
7688
  */
3861
- const coreAnimation = (elementsToAnimate, startX, tl, isReverse, props) => {
7689
+ const coreAnimation = (elementsToAnimate, startX, tl, isReverse, draggableTrigger, isVertical, props) => {
3862
7690
  const { spacing = 16, speed = 100, delay = 0, paused = false, alignRotationWithY = false, } = props;
3863
7691
  // Arrays to store calculated values for each element
3864
7692
  const widths = []; // Element widths in pixels
@@ -3874,22 +7702,22 @@ const coreAnimation = (elementsToAnimate, startX, tl, isReverse, props) => {
3874
7702
  *
3875
7703
  * This approach makes animations responsive to width changes
3876
7704
  */
3877
- gsap$1.set(elementsToAnimate, {
7705
+ gsap$4.set(elementsToAnimate, {
3878
7706
  xPercent: (i, el) => {
3879
7707
  // Get element width and store for later calculations
3880
- const w = (widths[i] = parseFloat(String(gsap$1.getProperty(el, "width", "px"))));
7708
+ const w = (widths[i] = parseFloat(String(gsap$4.getProperty(el, "width", "px"))));
3881
7709
  /**
3882
7710
  * Calculate current position as percentage of element width
3883
7711
  * Combines pixel position with any existing percentage offset
3884
7712
  */
3885
7713
  xPercents[i] =
3886
- (parseFloat(String(gsap$1.getProperty(el, "x", "px"))) / w) * 100 +
3887
- Number(gsap$1.getProperty(el, "xPercent"));
7714
+ (parseFloat(String(gsap$4.getProperty(el, "x", "px"))) / w) * 100 +
7715
+ Number(gsap$4.getProperty(el, "xPercent"));
3888
7716
  return xPercents[i];
3889
7717
  },
3890
7718
  });
3891
7719
  // Reset x position to 0 since we're now using xPercent for positioning
3892
- gsap$1.set(elementsToAnimate, { x: 0 });
7720
+ gsap$4.set(elementsToAnimate, { x: 0 });
3893
7721
  /**
3894
7722
  * Calculate total track length for seamless looping
3895
7723
  *
@@ -3979,7 +7807,7 @@ const coreAnimation = (elementsToAnimate, startX, tl, isReverse, props) => {
3979
7807
  * Start reverse playback after delay
3980
7808
  * This creates the proper reverse scrolling effect
3981
7809
  */
3982
- gsap$1.delayedCall(delay, () => {
7810
+ gsap$4.delayedCall(delay, () => {
3983
7811
  tl.reverse(); // Start playing backwards
3984
7812
  /**
3985
7813
  * Handle seamless looping in reverse direction
@@ -3991,8 +7819,88 @@ const coreAnimation = (elementsToAnimate, startX, tl, isReverse, props) => {
3991
7819
  });
3992
7820
  });
3993
7821
  }
7822
+ /**
7823
+ * ========================================
7824
+ * DRAGGABLE SECTION
7825
+ * ========================================
7826
+ *
7827
+ * Implements interactive drag functionality for manual marquee control.
7828
+ * When enabled, allows users to drag horizontally to control the animation
7829
+ * position in real-time.
7830
+ */
7831
+ // Essential variables for draggable functionality
7832
+ let proxy;
7833
+ if (typeof Draggable === "function" && props.draggable) {
7834
+ // Create an invisible proxy element to handle drag calculations
7835
+ proxy = document.createElement("div");
7836
+ const wrap = gsap$4.utils.wrap(0, 1); // Wrapping function to keep values between 0 and 1
7837
+ let ratio; // Ratio to convert drag position to timeline progress
7838
+ let startProgress; // Timeline progress at drag start
7839
+ /**
7840
+ * Alignment function that syncs drag position with timeline progress
7841
+ * Converts mouse movement into animation progress
7842
+ */
7843
+ const align = () => {
7844
+ const axis = isVertical
7845
+ ? draggable.startY - draggable.y
7846
+ : draggable.startX - draggable.x;
7847
+ tl.progress(wrap(startProgress + axis * ratio));
7848
+ };
7849
+ // Check InertiaPlugin availability for momentum scrolling
7850
+ if (typeof InertiaPlugin === "undefined") {
7851
+ console.warn("InertiaPlugin required for momentum-based scrolling and snapping. https://greensock.com/club");
7852
+ }
7853
+ const draggable = Draggable.create(proxy, {
7854
+ trigger: draggableTrigger, // Element that will trigger the drag
7855
+ type: isVertical ? "y" : "x",
7856
+ onPress() {
7857
+ // Initialization on click/touch
7858
+ gsap$4.killTweensOf(tl); // Stop any ongoing animations on timeline
7859
+ tl.pause(); // Pause main animation
7860
+ startProgress = tl.progress(); // Store current progress
7861
+ ratio = 1 / trackLength; // Calculate drag/progress ratio
7862
+ gsap$4.set(proxy, { x: startProgress / -ratio }); // Position the proxy
7863
+ },
7864
+ onDrag: align, // Call align during drag
7865
+ onThrowUpdate: align, // Call align during inertia
7866
+ overshootTolerance: 0, // No overshoot tolerance
7867
+ inertia: true, // Enable momentum scrolling
7868
+ onThrowComplete: () => {
7869
+ // Handle inertia completion
7870
+ if (isReverse) {
7871
+ // If paused is requested, stop and return
7872
+ if (paused) {
7873
+ tl.pause();
7874
+ return;
7875
+ }
7876
+ // Position timeline at correct position and pause
7877
+ tl.progress(tl.progress()).pause();
7878
+ /**
7879
+ * Start reverse playback after delay
7880
+ * This creates the proper reverse scrolling effect
7881
+ */
7882
+ gsap$4.delayedCall(delay, () => {
7883
+ tl.reverse(); // Start playing backwards
7884
+ /**
7885
+ * Handle seamless looping in reverse direction
7886
+ * When reverse completes, restart from end position
7887
+ * This prevents new delay in continuous reverse scrolling
7888
+ */
7889
+ tl.eventCallback("onReverseComplete", () => {
7890
+ tl.totalTime(tl.rawTime() + tl.duration() * 100);
7891
+ });
7892
+ });
7893
+ }
7894
+ else {
7895
+ // For normal direction, simply resume the animation
7896
+ tl.play();
7897
+ }
7898
+ },
7899
+ })[0];
7900
+ }
3994
7901
  };
3995
7902
 
7903
+ gsap$4.registerPlugin(react.useGSAP, Observer, InertiaPlugin, Draggable);
3996
7904
  const GSAPReactMarquee = require$$0.forwardRef((props, ref) => {
3997
7905
  const { children, className, dir = "left", loop = -1, paused = false, fill = false, followScrollDir = false, scrollSpeed = 2.5, gradient = false, gradientColor = null, } = props;
3998
7906
  const rootRef = require$$0.useRef(null) || ref;
@@ -4012,12 +7920,12 @@ const GSAPReactMarquee = require$$0.forwardRef((props, ref) => {
4012
7920
  if (!(marqueeRef === null || marqueeRef === void 0 ? void 0 : marqueeRef.current) || !containerRef.current)
4013
7921
  return;
4014
7922
  const containerMarquee = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
4015
- const marquees = gsap$1.utils.toArray(containerMarquee.querySelectorAll(".gsap-react-marquee"));
4016
- const marqueesChildren = gsap$1.utils.toArray(containerMarquee.querySelectorAll(".gsap-react-marquee .gsap-react-marquee-content"));
7923
+ const marquees = gsap$4.utils.toArray(containerMarquee.querySelectorAll(".gsap-react-marquee"));
7924
+ const marqueesChildren = gsap$4.utils.toArray(containerMarquee.querySelectorAll(".gsap-react-marquee .gsap-react-marquee-content"));
4017
7925
  const marquee = marqueeRef.current;
4018
7926
  if (!marquee || !marqueesChildren)
4019
7927
  return;
4020
- const tl = gsap$1.timeline({
7928
+ const tl = gsap$4.timeline({
4021
7929
  paused: paused,
4022
7930
  repeat: loop,
4023
7931
  defaults: { ease: "none" },
@@ -4036,16 +7944,16 @@ const GSAPReactMarquee = require$$0.forwardRef((props, ref) => {
4036
7944
  const clampedScrollSpeed = Math.min(4, Math.max(1.1, scrollSpeed));
4037
7945
  setMarqueeDuplicates(calculateDuplicates(marqueeChildrenWidth, containerMarqueeWidth, isVertical, props));
4038
7946
  // Calculate total width and set marquee styles
4039
- const totalWidth = gsap$1.utils
7947
+ const totalWidth = gsap$4.utils
4040
7948
  .toArray(marquee.children)
4041
7949
  .map((child) => child.offsetWidth)
4042
7950
  .reduce((a, b) => a + b, 0);
4043
- gsap$1.set(marquees, {
7951
+ gsap$4.set(marquees, {
4044
7952
  minWidth: getMinWidth(marqueesChildren, totalWidth, containerMarqueeWidth, props),
4045
7953
  flex: fill ? "0 0 auto" : "1",
4046
7954
  });
4047
7955
  // Create appropriate animation based on fill setting
4048
- coreAnimation(fill ? marqueesChildren : marquees, startX, tl, isReverse, props);
7956
+ coreAnimation(fill ? marqueesChildren : marquees, startX, tl, isReverse, marquees, isVertical, props);
4049
7957
  /**
4050
7958
  * GSAP Observer for scroll-based speed control
4051
7959
  *
@@ -4071,25 +7979,28 @@ const GSAPReactMarquee = require$$0.forwardRef((props, ref) => {
4071
7979
  *
4072
7980
  * Phase 1: Quick acceleration to new speed (0.2s)
4073
7981
  * - timeScale: Controls timeline playback speed (higher = faster)
4074
- * - factor * 2.5: Initial speed boost for responsive feel
7982
+ * - factor * clampedScrollSpeed: Initial speed boost for responsive feel
4075
7983
  * - overwrite: Cancels any previous speed animations
4076
7984
  *
4077
7985
  * Phase 2: Gradual deceleration to sustained speed (1s delay + 1s duration)
4078
- * - factor / 2.5: Settle to a more moderate sustained speed
7986
+ * - factor / clampedScrollSpeed: Settle to a more moderate sustained speed
4079
7987
  * - "+=0.3": Wait 0.3 seconds before starting deceleration
4080
7988
  */
4081
- gsap$1
7989
+ gsap$4
4082
7990
  .timeline({
4083
7991
  defaults: {
4084
7992
  ease: "none",
4085
7993
  },
4086
7994
  })
4087
7995
  .to(tl, {
4088
- timeScale: factor * 2.5,
7996
+ timeScale: factor * clampedScrollSpeed,
4089
7997
  duration: 0.2,
4090
7998
  overwrite: true,
4091
7999
  })
4092
- .to(tl, { timeScale: factor / 2.5, duration: 1 }, "+=0.3");
8000
+ .to(tl, {
8001
+ timeScale: factor / clampedScrollSpeed,
8002
+ duration: 1,
8003
+ }, "+=0.3");
4093
8004
  },
4094
8005
  });
4095
8006
  }, {