1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[219],{"0R3c":function(t,e,o){t.exports=function(){"use strict";function t(t){return+t.getAttribute("data-scrollama-index")}function e(t){if("string"==typeof t&&t.indexOf("px")>0){const e=+t.replace("px","");return isNaN(e)?(err("offset value must be in 'px' format. Fallback to 0.5."),{format:"percent",value:.5}):{format:"pixels",value:e}}return"number"!=typeof t&&isNaN(+t)?null:(t>1&&err("offset value is greater than 1. Fallback to 1."),t<0&&err("offset value is lower than 0. Fallback to 0."),{format:"percent",value:Math.min(Math.max(0,t),1)})}function o(t){const{top:e}=t.getBoundingClientRect();return e+window.pageYOffset-(document.body.clientTop||0)}let n,i,r;function s(t){const e=t?t.scrollTop:window.pageYOffset;n!==e&&(n=e,n>i?r="down":n<i&&(r="up"),i=n)}return function(){let c,h,u,a={},l=function(){const t="abcdefghijklmnopqrstuvwxyz",e=Date.now(),o=[];for(let e=0;e<6;e+=1){const e=t[Math.floor(Math.random()*t.length)];o.push(e)}return`${o.join("")}${e}`}(),f=[],p=0,d=!1,g=!1,m=!1,b=!1,v=[];function w(){a={stepEnter:()=>{},stepExit:()=>{},stepProgress:()=>{}},v=[]}function y(t){t&&!d&&k(),!t&&d&&R(),d=t}function _(e,o){const n=t(e),i=f[n];void 0!==o&&(i.progress=o);const s={element:e,index:n,progress:o,direction:r};"enter"===i.state&&a.stepProgress(s)}function E([e]){const o=t(e.target),n=f[o],i=e.target.offsetHeight;i!==n.height&&(n.height=i,T(n),M(n),O(n))}function x([e]){s(h);const{isIntersecting:o,target:n}=e;o?function(e,o=!0){const n=t(e),i=f[n],s={element:e,index:n,direction:r};i.direction=r,i.state="enter",v[n]||a.stepEnter(s),b&&(v[n]=!0)}(n):function(e,o=!0){const n=t(e),i=f[n];if(!i.state)return!1;const s={element:e,index:n,direction:r};g&&("down"===r&&i.progress<1?_(e,1):"up"===r&&i.progress>0&&_(e,0)),i.direction=r,i.state="exit",a.stepExit(s)}(n)}function I([e]){const o=t(e.target),n=f[o],{isIntersecting:i,intersectionRatio:r,target:s}=e;i&&"enter"===n.state&&_(s,r)}function T({observers:t}){Object.keys(t).map(e=>{t[e].disconnect()})}function R(){f.forEach(T)}function O(t){const e=new ResizeObserver(E);e.observe(t.node),t.observers.resize=e}function M(t){const e=window.innerHeight,o=t.offset||c,n="pixels"===o.format?1:e,i=o.value*n,r=t.height/2-i,s=t.height/2-(e-i),h=new IntersectionObserver(x,{rootMargin:`${r}px 0px ${s}px 0px`,threshold:.5,root:u});h.observe(t.node),t.observers.step=h,m&&function({id:t,step:e,marginTop:o}){const{index:n,height:i}=e,r=`scrollama__debug-step--${t}-${n}`;let s=document.querySelector("."+r);s||(s=function(t){const e=document.createElement("div");e.className="scrollama__debug-step "+t,e.style.position="fixed",e.style.left="0",e.style.width="100%",e.style.zIndex="9999",e.style.borderTop="2px solid black",e.style.borderBottom="2px solid black";const o=document.createElement("p");return o.style.position="absolute",o.style.left="0",o.style.height="1px",o.style.width="100%",o.style.borderTop="1px dashed black",e.appendChild(o),document.body.appendChild(e),e}(r)),s.style.top=-1*o+"px",s.style.height=i+"px",s.querySelector("p").style.top=i/2+"px"}({id:l,step:t,marginTop:r,marginBottom:s})}function D(t){const e=window.innerHeight,o=t.offset||c,n="pixels"===o.format?1:e,i=o.value*n,r=`${-i+t.height}px 0px ${i-e}px 0px`,s=function(t,e){const o=Math.ceil(t/e),n=[],i=1/o;for(let t=0;t<o+1;t+=1)n.push(t*i);return n}(t.height,p),h=new IntersectionObserver(I,{rootMargin:r,threshold:s});h.observe(t.node),t.observers.progress=h}function k(){R(),f.forEach(O),f.forEach(M),g&&f.forEach(D)}const A={setup:({step:t,parent:r,offset:a=.5,threshold:l=4,progress:d=!1,once:v=!1,debug:_=!1,container:E,root:x=null})=>(function(t){n=0,i=0,document.addEventListener("scroll",()=>s(t))}(E),f=function(t,e=document){return"string"==typeof t?Array.from(e.querySelectorAll(t)):t instanceof Element?[t]:t instanceof NodeList?Array.from(t):t instanceof Array?t:[]}(t,r).map((t,n)=>({index:n,direction:void 0,height:t.offsetHeight,node:t,observers:{},offset:e(t.dataset.offset),top:o(t),progress:0,state:void 0})),f.length?(g=d,b=v,m=_,p=Math.max(1,+l),c=e(a),h=E,u=x,w(),function(t){t.forEach(t=>t.node.setAttribute("data-scrollama-index",t.index))}(f),y(!0),A):A),enable:()=>(y(!0),A),disable:()=>(y(!1),A),destroy:()=>(y(!1),w(),A),resize:()=>(k(),A),offset:t=>null==t?c.value:(c=e(t),k(),A),onStepEnter:t=>("function"==typeof t&&(a.stepEnter=t),A),onStepExit:t=>("function"==typeof t&&(a.stepExit=t),A),onStepProgress:t=>("function"==typeof t&&(a.stepProgress=t),A)};return A}}()},Wr5T:function(t,e){!function(){"use strict";if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=function(t){for(var e=window.document,o=i(e);o;)o=i(e=o.ownerDocument);return e}(),e=[],o=null,n=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return o||(o=function(t,o){n=t&&o?l(t,o):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach((function(t){t._checkForIntersections()}))}),o},s._resetCrossOriginUpdater=function(){o=null,n=null},s.prototype.observe=function(t){if(!this._observationTargets.some((function(e){return e.element==t}))){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter((function(e){return e.element!=t})),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter((function(t,e,o){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==o[e-1]}))},s.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map((function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}}));return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},s.prototype._monitorIntersections=function(e){var o=e.defaultView;if(o&&-1==this._monitoringDocuments.indexOf(e)){var n=this._checkForIntersections,r=null,s=null;this.POLL_INTERVAL?r=o.setInterval(n,this.POLL_INTERVAL):(c(o,"resize",n,!0),c(e,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(s=new o.MutationObserver(n)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push((function(){var t=e.defaultView;t&&(r&&t.clearInterval(r),h(t,"resize",n,!0)),h(e,"scroll",n,!0),s&&s.disconnect()}));var u=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=u){var a=i(e);a&&this._monitorIntersections(a.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var o=this._monitoringDocuments.indexOf(e);if(-1!=o){var n=this.root&&(this.root.ownerDocument||this.root)||t;if(!this._observationTargets.some((function(t){var o=t.element.ownerDocument;if(o==e)return!0;for(;o&&o!=n;){var r=i(o);if((o=r&&r.ownerDocument)==e)return!0}return!1}))){var r=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),r(),e!=n){var s=i(e);s&&this._unmonitorIntersections(s.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e<t.length;e++)t[e]()},s.prototype._checkForIntersections=function(){if(this.root||!o||n){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach((function(n){var i=n.element,s=u(i),c=this._rootContainsTarget(i),h=n.entry,a=t&&c&&this._computeTargetAndRootIntersection(i,s,e),l=null;this._rootContainsTarget(i)?o&&!this.root||(l=e):l={top:0,bottom:0,left:0,right:0,width:0,height:0};var f=n.entry=new r({time:window.performance&&performance.now&&performance.now(),target:i,boundingClientRect:s,rootBounds:l,intersectionRect:a});h?t&&c?this._hasCrossedThreshold(h,f)&&this._queuedEntries.push(f):h&&h.isIntersecting&&this._queuedEntries.push(f):this._queuedEntries.push(f)}),this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},s.prototype._computeTargetAndRootIntersection=function(e,i,r){if("none"!=window.getComputedStyle(e).display){for(var s,c,h,a,f,d,g,m,b=i,v=p(e),w=!1;!w&&v;){var y=null,_=1==v.nodeType?window.getComputedStyle(v):{};if("none"==_.display)return null;if(v==this.root||9==v.nodeType)if(w=!0,v==this.root||v==t)o&&!this.root?!n||0==n.width&&0==n.height?(v=null,y=null,b=null):y=n:y=r;else{var E=p(v),x=E&&u(E),I=E&&this._computeTargetAndRootIntersection(E,x,r);x&&I?(v=E,y=l(x,I)):(v=null,b=null)}else{var T=v.ownerDocument;v!=T.body&&v!=T.documentElement&&"visible"!=_.overflow&&(y=u(v))}if(y&&(s=y,c=b,void 0,void 0,void 0,void 0,void 0,void 0,h=Math.max(s.top,c.top),a=Math.min(s.bottom,c.bottom),f=Math.max(s.left,c.left),m=a-h,b=(g=(d=Math.min(s.right,c.right))-f)>=0&&m>=0&&{top:h,bottom:a,left:f,right:d,width:g,height:m}||null),!b)break;v=v&&p(v)}return b}},s.prototype._getRootRect=function(){var e;if(this.root&&!d(this.root))e=u(this.root);else{var o=d(this.root)?this.root:t,n=o.documentElement,i=o.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},s.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map((function(e,o){return"px"==e.unit?e.value:e.value*(o%2?t.width:t.height)/100})),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},s.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,n=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==n)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==o||r==n||r<o!=r<n)return!0}},s.prototype._rootIsInDom=function(){return!this.root||f(t,this.root)},s.prototype._rootContainsTarget=function(e){var o=this.root&&(this.root.ownerDocument||this.root)||t;return f(o,e)&&(!this.root||o==e.ownerDocument)},s.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},s.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=s,window.IntersectionObserverEntry=r}function i(t){try{return t.defaultView&&t.defaultView.frameElement||null}catch(t){return null}}function r(t){this.time=t.time,this.target=t.target,this.rootBounds=a(t.rootBounds),this.boundingClientRect=a(t.boundingClientRect),this.intersectionRect=a(t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0}),this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,o=e.width*e.height,n=this.intersectionRect,i=n.width*n.height;this.intersectionRatio=o?Number((i/o).toFixed(4)):this.isIntersecting?1:0}function s(t,e){var o,n,i,r=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(r.root&&1!=r.root.nodeType&&9!=r.root.nodeType)throw new Error("root must be a Document or Element");this._checkForIntersections=(o=this._checkForIntersections.bind(this),n=this.THROTTLE_TIMEOUT,i=null,function(){i||(i=setTimeout((function(){o(),i=null}),n))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(r.rootMargin),this.thresholds=this._initThresholds(r.threshold),this.root=r.root||null,this.rootMargin=this._rootMarginValues.map((function(t){return t.value+t.unit})).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}function c(t,e,o,n){"function"==typeof t.addEventListener?t.addEventListener(e,o,n||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,o)}function h(t,e,o,n){"function"==typeof t.removeEventListener?t.removeEventListener(e,o,n||!1):"function"==typeof t.detachEvent&&t.detachEvent("on"+e,o)}function u(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function a(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function l(t,e){var o=e.top-t.top,n=e.left-t.left;return{top:o,left:n,height:e.height,width:e.width,bottom:o+e.height,right:n+e.width}}function f(t,e){for(var o=e;o;){if(o==t)return!0;o=p(o)}return!1}function p(e){var o=e.parentNode;return 9==e.nodeType&&e!=t?i(e):(o&&o.assignedSlot&&(o=o.assignedSlot.parentNode),o&&11==o.nodeType&&o.host?o.host:o)}function d(t){return t&&9===t.nodeType}}()}}]); |