/*! * gumshoejs v5.1.2 * A simple, framework-agnostic scrollspy script. * (c) 2019 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/gumshoe */(function(a,b){"function"==typeof define&&define.amd?define([],function(){return b(a)}):"object"==typeof exports?module.exports=b(a):a.Gumshoe=b(a)})("undefined"==typeof global?"undefined"==typeof window?this:window:global,function(a){"use strict";const b={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},c=function(){const a={};return Array.prototype.forEach.call(arguments,function(b){for(const c in b){if(!b.hasOwnProperty(c))return;a[c]=b[c]}}),a},d=function(a,b,c){if(c.settings.events){const d=new CustomEvent(a,{bubbles:!0,cancelable:!0,detail:c});b.dispatchEvent(d)}},e=function(a){let b=0;if(a.offsetParent)for(;a;)b+=a.offsetTop,a=a.offsetParent;return 0<=b?b:0},f=function(a){a&&a.sort(function(a,b){const c=e(a.content),d=e(b.content);return c=h())},l=function(a,b){return!!(k()&&j(a.content,b,!0))},m=function(a,b){const c=a[a.length-1];if(l(c,b))return c;for(let c=a.length-1;0<=c;c--)if(j(a[c].content,b))return a[c]};var n=function(a,b){if(b.nested&&a.parentNode){const c=a.parentNode.closest("li");c&&(c.classList.remove(b.nestedClass),n(c,b))}};const o=function(a,b){if(a){const c=a.nav.closest("li");c&&(c.classList.remove(b.navClass),a.content.classList.remove(b.contentClass),n(c,b),d("gumshoeDeactivate",c,{link:a.nav,content:a.content,settings:b}))}};var p=function(a,b){if(b.nested){const c=a.parentNode.closest("li");c&&(c.classList.add(b.nestedClass),p(c,b))}};const q=function(a,b){if(a){const c=a.nav.closest("li");c&&(c.classList.add(b.navClass),a.content.classList.add(b.contentClass),p(c,b),d("gumshoeActivate",c,{link:a.nav,content:a.content,settings:b}))}};return function(d,e){const g={};let h,i,j,k,l;g.setup=function(){h=document.querySelectorAll(d),i=[],Array.prototype.forEach.call(h,function(a){const b=document.getElementById(decodeURIComponent(a.hash.substr(1)));b&&i.push({nav:a,content:b})}),f(i)},g.detect=function(){const a=m(i,l);return a?void(j&&a.content===j.content||(o(j,l),q(a,l),j=a)):void(j&&(o(j,l),j=null))};const n=function(b){k&&a.cancelAnimationFrame(k),k=a.requestAnimationFrame(g.detect)},p=function(b){k&&a.cancelAnimationFrame(k),k=a.requestAnimationFrame(function(){f(i),g.detect()})};g.destroy=function(){j&&o(j,l),a.removeEventListener("scroll",n,!1),l.reflow&&a.removeEventListener("resize",p,!1),i=null,h=null,j=null,k=null,l=null};return function(){l=c(b,e||{}),g.setup(),g.detect(),a.addEventListener("scroll",n,!1),l.reflow&&a.addEventListener("resize",p,!1)}(),g}});