System.register([],function(e){"use strict";return{execute:function(){e({a:o,b:i,c:r,d:n,h:u,n:a,s:t});function t(e,t){var r=e.replace(/( |:|\/|\.)/g,"-").toLowerCase();var n=t.querySelector("#"+r);if(!n){return}n.scrollIntoView({behavior:"smooth"});var a=window.location.href;var i="?";if(a.indexOf("chapter=")!==-1){a=window.location.href.split("chapter=")[0];if(a.length>0){i=a[a.length-1];a=a.substring(0,a.length-1)}}else{i=a.indexOf("?")>0?"&":"?"}var o=i+"chapter=";window.history.pushState({},"",""+a+o+r)}function r(e,t,r,n){if(r===void 0){r=false}if(n===void 0){n=null}var a=new CustomEvent(e,t);if(r){if(n){n.dispatchEvent(a)}else{document.dispatchEvent(a)}}}function n(e,t,r){var n=null;while(e){if(e.matches(t)){n=e;break}else if(r&&e.matches(r)){break}e=e.parentElement}return n}function a(e){return e.split("").map(function(e){if(e===e.toLowerCase()){return e}return"-"+e.toLowerCase()}).join("")}function i(e,t,r,n){if(n===void 0){n=null}var a=e.replace(t,r);if(n){return n(a)}return a}function o(e){if(e.startsWith("psk-")){return true}var t=["article","aside","blockquote","body","div","footer","h1","h2","h3","h4","h5","h6","header","main","nav","p","section","span"].find(function(t){return t===e});return t===e}function u(e){var t=this;var r=e.parentEventData&&e.parentEventData;if(!r){return}t.activeChapter=null;var n=null;var a=0;var i=Array.from(t.element.querySelectorAll("psk-chapter"));i.forEach(function(e){if(n!==null||t.activeChapter!==null){return}var i=e.getAttribute("guid");if(!i){return}var o=e.getElementsByTagName("psk-card")?e.getElementsByTagName("psk-card")[0]:null;if(o===null){return}var u=0;if(a>=o.offsetTop){u=a+o.offsetTop}else{u=o.offsetTop}var l=r.scrollTop;if(l>=a&&l<=u){n=i;t.activeChapter=n}a=u});if(i.length>0){t.activeChapter=n?n:i[0].getAttribute("guid")}}}}});