var blogtale = blogtale || {}; function blogtaleDomReady(t) { if ("function" == typeof t) return "interactive" === document.readyState || "complete" === document.readyState ? t() : void document.addEventListener("DOMContentLoaded", t, !1); } function blogtaleToggleAttribute(t, e, o, n) { t.classList.contains("close-search-toggle") || (void 0 === o && (o = !0), void 0 === n && (n = !1), t.getAttribute(e) !== o ? t.setAttribute(e, o) : t.setAttribute(e, n)); } function blogtaleMenuToggle(t, e) { var o, n, a, i, l, s = [], c = []; t && ((a = t.closest(".menu-wrapper")), (i = a.querySelectorAll(".menu-item")).forEach(function (t, e) { s[e] = { x: t.offsetLeft, y: t.offsetTop }; }), (o = t.parentElement.offsetHeight), t.classList.add("toggling-target"), t.classList.toggle("active"), i.forEach(function (t, e) { c[e] = { x: t.offsetLeft, y: t.offsetTop }; }), (n = t.parentElement.offsetHeight), t.classList.toggle("active"), a.classList.add("is-toggling"), t.classList.toggle("active"), i.forEach(function (e, n) { var a = s[n]; 0 === a.y && e.parentElement === t && (a.y = o), (e.style.transform = "translate(" + a.x + "px, " + a.y + "px)"); }), requestAnimationFrame(function () { requestAnimationFrame(function () { a.classList.add("is-animating"), i.forEach(function (o, a) { var i = c[a]; 0 === i.y && o.parentElement === t && (i.y = n), void 0 !== e && (o.style.transitionDuration = e + "ms"), (o.style.transform = "translate(" + i.x + "px, " + i.y + "px)"); }), void 0 !== e && (t.style.transitionDuration = e + "ms"); }), (l = function () { a.classList.remove("is-animating"), a.classList.remove("is-toggling"), t.classList.remove("toggling-target"), i.forEach(function (t) { (t.style.transform = ""), (t.style.transitionDuration = ""); }), (t.style.transitionDuration = ""), t.removeEventListener("transitionend", l); }), t.addEventListener("transitionend", l); })); } function blogtaleFindParents(t, e) { var o = []; return ( (function t(n) { var a = n.parentNode; a instanceof HTMLElement && (a.matches(e) && o.push(a), t(a)); })(t), o ); } (blogtale.scrolled = 0), Element.prototype.closest || (Element.prototype.closest = function (t) { var e = this; do { if (e.matches(t)) return e; e = e.parentElement || e.parentNode; } while (null !== e && 1 === e.nodeType); return null; }), window.NodeList && !NodeList.prototype.forEach && (NodeList.prototype.forEach = function (t, e) { var o, n = this.length; for (e = e || window, o = 0; o < n; o++) t.call(e, this[o], o, this); }), (blogtale.createEvent = function (t) { var e; return ( "function" == typeof window.Event ? (e = new Event(t)) : (e = document.createEvent("Event")).initEvent(t, !0, !1), e ); }), Element.prototype.matches || (Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (t) { for ( var e = (this.document || this.ownerDocument).querySelectorAll(t), o = e.length; --o >= 0 && e.item(o) !== this; ); return o > -1; }), (blogtale.touchEnabled = { init: function () { var t; ("ontouchstart" in window || (window.DocumentTouch && document instanceof window.DocumentTouch) || ((t = [ "(", ["-webkit-", "-moz-", "-o-", "-ms-"].join("touch-enabled),("), "heartz", ")", ].join("")), window.matchMedia && window.matchMedia(t).matches)) && document.body.classList.add("touch-enabled"); }, }), (blogtale.coverModals = { init: function () { document.querySelector(".cover-modal") && (this.onToggle(), this.outsideUntoggle(), this.closeOnEscape(), this.hideAndShowModals()); }, onToggle: function () { document.querySelectorAll(".cover-modal").forEach(function (t) { t.addEventListener("toggled", function (t) { var e = t.target, o = document.body; e.classList.contains("active") ? o.classList.add("showing-modal") : (o.classList.remove("showing-modal"), o.classList.add("hiding-modal"), setTimeout(function () { o.classList.remove("hiding-modal"); }, 500)); }); }); }, outsideUntoggle: function () { document.addEventListener( "click", function (t) { var e = t.target, o = document.querySelector(".cover-modal.active"); "a" === t.target.tagName.toLowerCase() && t.target.hash.includes("#") && null !== o && (this.untoggleModal(o), setTimeout(function () { document.getElementById(t.target.hash.slice(1)).scrollIntoView(); }, 550)), e === o && this.untoggleModal(e); }.bind(this) ); }, closeOnEscape: function () { document.addEventListener( "keydown", function (t) { 27 === t.keyCode && (t.preventDefault(), document.querySelectorAll(".cover-modal.active").forEach( function (t) { this.untoggleModal(t); }.bind(this) )); }.bind(this) ); }, hideAndShowModals: function () { var t = document, e = window, o = t.querySelectorAll(".cover-modal"), n = t.documentElement.style, a = t.querySelector("#wpadminbar"); function i(t) { var o, n = e.pageYOffset; return a ? ((o = n + a.getBoundingClientRect().height), t ? -o : o) : 0 === n ? 0 : -n; } function l() { return { "overflow-y": e.innerHeight > t.documentElement.getBoundingClientRect().height ? "hidden" : "scroll", position: "fixed", width: "100%", top: i(!0) + "px", left: 0, }; } o.forEach(function (o) { o.addEventListener("toggle-target-before-inactive", function (s) { var c = l(), r = e.pageYOffset, d = Math.abs(i()) - r + "px", g = e.matchMedia("(max-width: 600px)"); s.target === o && (Object.keys(c).forEach(function (t) { n.setProperty(t, c[t]); }), (e.blogtale.scrolled = parseInt(c.top, 10)), a && (t.body.style.setProperty("padding-top", d), g.matches && (r >= i() ? o.style.setProperty("top", 0) : o.style.setProperty("top", i() - r + "px"))), o.classList.add("show-modal")); }), o.addEventListener("toggle-target-after-inactive", function (s) { s.target === o && setTimeout(function () { var s = blogtale.toggles.clickedEl; o.classList.remove("show-modal"), Object.keys(l()).forEach(function (t) { n.removeProperty(t); }), a && (t.body.style.removeProperty("padding-top"), o.style.removeProperty("top")), !1 !== s && (s.focus(), (s = !1)), e.scrollTo(0, Math.abs(e.blogtale.scrolled + i())), (e.blogtale.scrolled = 0); }, 500); }); }); }, untoggleModal: function (t) { var e, o = !1; t.dataset.modalTargetString && ((e = t.dataset.modalTargetString), (o = document.querySelector('*[data-toggle-target="' + e + '"]'))), o ? o.click() : t.classList.remove("active"); }, }), (blogtale.intrinsicRatioVideos = { init: function () { this.makeFit(), window.addEventListener( "resize", function () { this.makeFit(); }.bind(this) ); }, makeFit: function () { document.querySelectorAll("iframe, object, video").forEach(function (t) { var e, o, n = t.parentNode; if ( t.classList.contains("intrinsic-ignore") || t.parentNode.classList.contains("intrinsic-ignore") ) return !0; t.dataset.origwidth || (t.setAttribute("data-origwidth", t.width), t.setAttribute("data-origheight", t.height)), (e = (o = n.offsetWidth) / t.dataset.origwidth), (t.style.width = o + "px"), (t.style.height = t.dataset.origheight * e + "px"); }); }, }), (blogtale.modalMenu = { init: function () { this.expandLevel(), this.keepFocusInModal(); }, expandLevel: function () { document.querySelectorAll(".modal-menu").forEach(function (t) { var e = t.querySelector(".current-menu-item"); e && blogtaleFindParents(e, "li").forEach(function (t) { var e = t.querySelector(".sub-menu-toggle"); e && blogtale.toggles.performToggle(e, !0); }); }); }, keepFocusInModal: function () { var t = document; t.addEventListener("keydown", function (e) { var o, n, a, i, l, s, c, r, d, g, u = blogtale.toggles.clickedEl; u && t.body.classList.contains("showing-modal") && ((o = u.dataset.toggleTarget), "input, a, button", (n = t.querySelector(o)), (a = n.querySelectorAll("input, a, button")), (a = Array.prototype.slice.call(a)), ".menu-modal" === o && ((i = (i = window.matchMedia("(min-width: 1000px)").matches) ? ".expanded-menu" : ".mobile-menu"), (a = a.filter(function (t) { return null !== t.closest(i) && null !== t.offsetParent; })).unshift(t.querySelector(".close-nav-toggle")), (l = t.querySelector(".menu-bottom > nav")) && l.querySelectorAll("input, a, button").forEach(function (t) { a.push(t); })), (c = a[a.length - 1]), (r = a[0]), (s = t.activeElement), (d = 9 === e.keyCode), !(g = e.shiftKey) && d && c === s && (e.preventDefault(), r.focus()), g && d && r === s && (e.preventDefault(), c.focus())); }); }, }), (blogtale.primaryMenu = { init: function () { this.focusMenuWithChildren(); }, focusMenuWithChildren: function () { var t, e, o, n = document.querySelector(".primary-menu-wrapper"); if (!n) return !1; for (e = 0, o = (t = n.getElementsByTagName("a")).length; e < o; e++) t[e].addEventListener("focus", a, !0), t[e].addEventListener("blur", a, !0); function a() { for (var t = this; -1 === t.className.indexOf("primary-menu"); ) "li" === t.tagName.toLowerCase() && (-1 !== t.className.indexOf("focus") ? (t.className = t.className.replace(" focus", "")) : (t.className += " focus")), (t = t.parentElement); } }, }), (blogtale.toggles = { clickedEl: !1, init: function () { this.toggle(), this.resizeCheck(), this.untoggleOnEscapeKeyPress(); }, performToggle: function (t, e) { var o, n, a, i = this, l = document, s = t, c = s.dataset.toggleTarget; l.querySelectorAll(".show-modal").length || (i.clickedEl = l.activeElement), (o = "next" === c ? s.nextSibling : l.querySelector(c)).classList.contains( "active" ) ? o.dispatchEvent(blogtale.createEvent("toggle-target-before-active")) : o.dispatchEvent( blogtale.createEvent("toggle-target-before-inactive") ), (a = s.dataset.classToToggle ? s.dataset.classToToggle : "active"), (n = 0), o.classList.contains("cover-modal") && (n = 10), setTimeout(function () { var t, n = o.classList.contains("sub-menu") ? s.closest(".menu-item").querySelector(".sub-menu") : o, r = s.dataset.toggleDuration; "slidetoggle" !== s.dataset.toggleType || e || "0" === r ? n.classList.toggle(a) : blogtaleMenuToggle(n, r), "next" === c ? s.classList.toggle("active") : o.classList.contains("sub-menu") ? s.classList.toggle("active") : l .querySelector('*[data-toggle-target="' + c + '"]') .classList.toggle("active"), blogtaleToggleAttribute(s, "aria-expanded", "true", "false"), i.clickedEl && -1 !== s.getAttribute("class").indexOf("close-") && blogtaleToggleAttribute( i.clickedEl, "aria-expanded", "true", "false" ), s.dataset.toggleBodyClass && l.body.classList.toggle(s.dataset.toggleBodyClass), s.dataset.setFocus && (t = l.querySelector(s.dataset.setFocus)) && (o.classList.contains("active") ? t.focus() : t.blur()), o.dispatchEvent(blogtale.createEvent("toggled")), o.classList.contains("active") ? o.dispatchEvent( blogtale.createEvent("toggle-target-after-active") ) : o.dispatchEvent( blogtale.createEvent("toggle-target-after-inactive") ); }, n); }, toggle: function () { var t = this; document.querySelectorAll("*[data-toggle-target]").forEach(function (e) { e.addEventListener("click", function (o) { o.preventDefault(), t.performToggle(e); }); }); }, resizeCheck: function () { document.querySelectorAll( "*[data-untoggle-above], *[data-untoggle-below], *[data-toggle-above], *[data-toggle-below]" ).length && window.addEventListener("resize", function () { var t = window.innerWidth; document.querySelectorAll(".toggle").forEach(function (e) { var o = e.dataset.untoggleAbove, n = e.dataset.untoggleBelow, a = e.dataset.toggleAbove, i = e.dataset.toggleBelow; (o || n || a || i) && ((((o && t > o) || (n && t < n)) && e.classList.contains("active")) || (((a && t > a) || (i && t < i)) && !e.classList.contains("active"))) && e.click(); }); }); }, untoggleOnEscapeKeyPress: function () { document.addEventListener("keyup", function (t) { "Escape" === t.key && document .querySelectorAll("*[data-untoggle-on-escape].active") .forEach(function (t) { t.classList.contains("active") && t.click(); }); }); }, }), blogtaleDomReady(function () { blogtale.toggles.init(), blogtale.coverModals.init(), blogtale.modalMenu.init(), blogtale.primaryMenu.init(), blogtale.touchEnabled.init(); });