text: "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var IntroScroll=/*#__PURE__*/function(){function a(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,a),this.settings=Object.assign({},{element:"#intro",wrapper:"#wrapper",container:"#container",trigger:"#intro__link",scrollClass:"is-scrolled",duration:1500,afterScroll:null},b),this.win=window,this.doc=document,this.element=this.getElement(this.settings.element),this.wrapper=this.getElement(this.settings.wrapper),this.container=this.getElement(this.settings.container),this.trigger=this.getElement(this.settings.trigger),this.scrollClass=this.settings.scrollClass,this.duration=this.settings.duration,this.afterScroll=this.settings.afterScroll,this.isScrolling=!1,this.init()}return _createClass(a,[{key:"init",value:function init(){this.bind()}},{key:"getElement",value:function getElement(a){return this.doc.querySelector(a)}},{key:"swipe",value:function swipe(a){var b=0,c=0,d=0,e=0,f=new Event("onswipeup"),g=new Event("onswiperight"),h=new Event("onswipedown"),i=new Event("onswipeleft"),j=new Event("tap");a.addEventListener("touchstart",function(a){b=a.changedTouches[0].screenX,c=a.changedTouches[0].screenY},!1),a.addEventListener("touchend",function(a){d=a.changedTouches[0].screenX,e=a.changedTouches[0].screenY,k()},!1);var k=function(){d<b&&a.dispatchEvent(i),d>b&&a.dispatchEvent(g),e<c&&a.dispatchEvent(f),e>c&&a.dispatchEvent(h),e===c&&a.dispatchEvent(j)}}},{key:"bind",value:function bind(){var a=this,b=this.win,c=this.trigger,d=this.element,e=this.wrapper,f=this.container;this.swipe(d),this.swipe(e),d.addEventListener("mousewheel",function(b){0<b.deltaY&&a.enableScroll()},!1),d.addEventListener("onswipeup",function(){a.enableScroll()},!1),e.addEventListener("onswipedown",function(){0>=a.win.pageYOffset&&a.disableScroll()},!1),f.addEventListener("mousewheel",function(b){0>b.deltaY&&0>=a.win.pageYOffset&&a.disableScroll()},!1),b.addEventListener("mousewheel",function(c){0>=b.pageYOffset&&e.classList.contains(a.scrollClass)&&0>c.deltaY&&a.disableScroll()},!1),c.addEventListener("click",function(c){c.preventDefault(),(!e.classList.contains(a.scrollClass)||1<b.pageYOffset)&&a.enableScroll()},!1)}},{key:"enableScroll",value:function enableScroll(){var a=this;this.wrapper.classList.add(this.scrollClass),this.isScrolling=!0,setTimeout(function(){a.doc.body.style.overflow="visible",a.isScrolling=!1,"function"==typeof a.afterScroll&&a.afterScroll(a)},this.duration)}},{key:"disableScroll",value:function disableScroll(){this.isScrolling||(this.wrapper.classList.remove(this.scrollClass),this.doc.body.style.overflow="hidden")}}]),a}();
  