(function () {
var clickEvent = function (event) {
let anchor = event.target.closest('a');
if (anchor != null && anchor.href.startsWith(window.location.origin)) {
event.preventDefault();
let relativeHref = anchor.href.replace(window.location.origin, '');
document.dispatchEvent(new CustomEvent('siteHelper:navigate', { detail: { href: relativeHref }}));
}
};
if (Element.prototype.closest) {
document.addEventListener("click", clickEvent, true);
}
})();