!function(e,t){"function"==typeof define&&define.amd?define(["exports"],t):"undefined"!=typeof exports?t(exports):(t(t={}),e.main=t)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=function(){function n(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.elements=document.querySelectorAll(e),this.className=e.replace(/^.|^#/,""),this.removeClass=t}var e,t,o;return e=n,(t=[{key:"offset",value:function(e){var t=0,n=0;if(e.offsetParent)for(;t+=e.offsetTop,n+=e.offsetLeft,e=e.offsetParent;);return{top:parseInt(t),left:parseInt(n)}}},{key:"viewport",value:function(){var e=0,t=0,t=void 0!==window.innerHeight?(e=window.innerWidth,window.innerHeight):void 0!==document.documentElement&&void 0!==document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?(e=document.documentElement.clientWidth,document.documentElement.clientHeight):(e=document.getElementsByTagName("body")[0].clientWidth,document.getElementsByTagName("body")[0].clientHeight);return{width:e,height:t}}},{key:"scrollTop",value:function(){return window.pageYOffset||document.documentElement.scrollTop}},{key:"scrollLeft",value:function(){return window.pageXOffset||document.documentElement.scrollLeft}},{key:"inViewport",value:function(e){var t,n=e.getBoundingClientRect()?(t=e.getBoundingClientRect().top,e.getBoundingClientRect().left):(t=this.offset(e).top-this.scrollTop(),this.offset(e).left-this.scrollLeft()),o=this.scrollTop()+this.viewport().height-this.offset(e).top,e=this.scrollLeft()+this.viewport().width-this.offset(e).left;return{top:parseInt(t),left:parseInt(n),right:parseInt(e),bottom:parseInt(o)}}},{key:"start",value:function(r){for(var a=this,e=this.elements,t=0;t<e.length;t++)!function(e){var t=e.dataset.gravityIn||r.offset||a.viewport().height/5,n=e.dataset.gravityAnimation||r.animation||"upward",o=e.dataset.gravityDuration||r.duration||700,i=e.dataset.gravityDelay||r.delay||50;a.inViewport(e).top>t&&a.inViewport(e).bottom>t&&(e.style.animation=n+" "+o+"ms linear "+i+"ms forwards",e.style.webkitAnimation=n+" "+o+"ms linear "+i+"ms forwards",a.removeClass&&setTimeout(function(){e.classList.remove(a.className)},100+parseInt(i)))}(e[t])}},{key:"ready",value:function(e){var t=this,n=0<arguments.length&&void 0!==e?e:{};document.addEventListener("DOMContentLoaded",function(){t.start(n)}),window.addEventListener("scroll",function(){t.start(n)})}}])&&i(e.prototype,t),o&&i(e,o),n}();e.default=t,new(window.Gravity=t)(".gravity",!0).ready()});