var ScrollReveal=function(){"use strict";function e(i){for(var o=[],r=arguments.length-1;r-- >0;)o[r]=arguments[r+1];if(t(i))return n(o,function(o){n(o,function(n,o){t(n)?(i[o]&&t(i[o])||(i[o]={}),e(i[o],n)):i[o]=n})}),i;throw new TypeError("Expected an object literal.")}function t(e){return null!==e&&"object"==typeof e&&(e.constructor===Object||"[object Object]"===Object.prototype.toString.call(e))}function n(e,n){if(t(e))for(var i=Object.keys(e),o=0;or.left&&o.bottom>r.top&&o.left=16))return;var y=F();h={elementIds:[],head:{index:null,blocked:!1},tail:{index:null,blocked:!1},id:y,interval:Math.abs(r)}}var m;n(c,function(e){m||e.node!==f||(m=e.id)}),isNaN(m)&&(m=F());try{n(p.map(function(t){var n={},i=t.getAttribute("data-sr-id");return i?(e(n,a.store.elements[i]),n.node.setAttribute("style",n.styles.inline)):(n.id=F(),n.node=t,n.seen=!1,n.visible=!1),n.config=l,n.containerId=m,n.styles=A(n),h&&(n.sequence={id:h.id,index:h.elementIds.length},h.elementIds.push(n.id)),n}),function(e){a.store.elements[e.id]=e,e.node.setAttribute("data-sr-id",e.id)})}catch(e){return}c[m]=c[m]||{id:m,node:f},h&&(this.store.sequences[h.id]=h),s||(this.store.history.push({target:t,options:o,interval:r}),this.initTimeout&&window.clearTimeout(this.initTimeout),this.initTimeout=window.setTimeout(O.bind(this),0))}}function L(){var e=this;n(this.store.history,function(t){q.call(e,t.target,t.options,t.interval,!0)}),O.call(this)}function R(e){var t=this,n="always"===e.config.useDelay||"onload"===e.config.useDelay&&this.pristine||"once"===e.config.useDelay&&!e.seen,i=e.sequence?this.store.sequences[e.sequence.id]:null,o=[e.styles.inline];if(l.call(this,e)&&!e.visible){if(null!==i){if(null===i.head.index&&null===i.tail.index)i.head.index=i.tail.index=e.sequence.index,i.head.blocked=i.tail.blocked=!0;else if(i.head.index-1!==e.sequence.index||i.head.blocked){if(i.tail.index+1!==e.sequence.index||i.tail.blocked)return;i.tail.index++,i.tail.blocked=!0}else i.head.index--,i.head.blocked=!0;window.setTimeout(function(){i.head.blocked=i.tail.blocked=!1,t.delegate()},i.interval)}o.push(e.styles.opacity.computed),o.push(e.styles.transform.generated.final),n?o.push(e.styles.transition.generated.delayed):o.push(e.styles.transition.generated.instant),e.seen=!0,e.visible=!0,I.call(this,e,n),e.node.setAttribute("style",o.join(" "))}else if(!l.call(this,e)&&e.visible&&e.config.reset){if(i)if(i.head.index===e.sequence.index)i.head.index++;else{if(i.tail.index!==e.sequence.index)return;i.tail.index--}o.push(e.styles.opacity.generated),o.push(e.styles.transform.generated.initial),o.push(e.styles.transition.generated.instant),e.visible=!1,I.call(this,e),e.node.setAttribute("style",o.join(" "))}}function I(e,t){var n,i=this,o=t?e.config.duration+e.config.delay:e.config.duration;e.visible?(e.config.beforeReveal(e.node),n=e.config.afterReveal):(e.config.beforeReset(e.node),n=e.config.afterReset);var r=0;e.callbackTimer&&(r=Date.now()-e.callbackTimer.start,window.clearTimeout(e.callbackTimer.clock)),e.callbackTimer={start:Date.now(),clock:window.setTimeout(function(){n(e.node),e.callbackTimer=null,e.visible&&!e.config.reset&&h.call(i,e.node)},o-r)}}function N(e){var t=this;void 0===e&&(e={}),C(function(){var i=t.store.containers,o=t.store.elements;switch(e.type){case"scroll":n(i,function(e){return e.scroll=f.call(t,e)}),n(o,function(e){return R.call(t,e)});break;case"resize":default:n(i,function(e){e.geometry=c.call(t,e,!0),e.scroll=f.call(t,e)}),n(o,function(e){e.geometry=c.call(t,e),R.call(t,e)})}t.pristine=!1})}function z(t){if(void 0===t&&(t={}),void 0===this||Object.getPrototypeOf(this)!==z.prototype)return new z(t);if(!z.isSupported())return P;try{Object.defineProperty(this,"defaults",{get:function(){var n={};return e(n,M,t),function(){return n}}()})}catch(e){return P}if(!d(this.defaults.container))return P;this.defaults.mobile!==i()&&this.defaults.desktop!==!i()||document.documentElement.classList.add("sr"),this.store={containers:{},elements:{},history:[],sequences:{}},this.pristine=!0,this.delegate=N.bind(this),Object.defineProperty(this,"version",{get:function(){return W}}),Object.defineProperty(this,"noop",{get:function(){return!1}})}var M={origin:"bottom",distance:"0",duration:600,delay:0,rotate:{x:0,y:0,z:0},opacity:0,scale:1,easing:"cubic-bezier(0.6, 0.2, 0.1, 1)",container:document.documentElement,desktop:!0,mobile:!0,reset:!1,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},beforeReveal:function(){},beforeReset:function(){},afterReveal:function(){},afterReset:function(){}},P={clean:function(){},destroy:function(){},reveal:function(){},sync:function(){},get noop(){return!0}},F=function(){var e=0;return function(){return e++}}(),S=function(){function e(e,i){if(void 0===i&&(i=n),e&&"string"==typeof e){if(t[e])return t[e];if("string"==typeof i[e])return t[e]=e;if("string"==typeof i["-webkit-"+e])return t[e]="-webkit-"+e;throw new RangeError('Unable to find "'+e+'" style property.')}throw new TypeError("Expected a string.")}var t={},n=document.documentElement.style;return e.clearCache=function(){return t={}},e}(),D=function(){var e=Date.now();return function(t){var n=Date.now();n-e>16?(e=n,t(n)):setTimeout(function(){return D(t)},0)}}(),C=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||D,W="4.0.0-beta.2";return z.isSupported=function(){return s()&&a()},z.prototype.clean=h,z.prototype.destroy=y,z.prototype.reveal=q,z.prototype.sync=L,z}();