var astraGetParents=function(elem,selector){if(!Element.prototype.matches){Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){var matches=(this.document||this.ownerDocument).querySelectorAll(s),i=matches.length;while(--i>=0&&matches.item(i)!==this){} return i>-1;};} var parents=[];for(;elem&&elem!==document;elem=elem.parentNode){if(selector){if(elem.matches(selector)){parents.push(elem);}}else{parents.push(elem);}} return parents;};var getParents=function(elem,selector){console.warn('getParents() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraGetParents() instead.');astraGetParents(elem,selector);} var astraToggleClass=function(el,className){if(el.classList.contains(className)){el.classList.remove(className);}else{el.classList.add(className);}};var toggleClass=function(el,className){console.warn('toggleClass() function has been deprecated since version 2.5.0 or above of Astra Theme and will be removed in the future. Use astraToggleClass() instead.');astraToggleClass(el,className);};(function(){if(typeof window.CustomEvent==="function")return false;function CustomEvent(event,params){params=params||{bubbles:false,cancelable:false,detail:undefined};var evt=document.createEvent('CustomEvent');evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt;} CustomEvent.prototype=window.Event.prototype;window.CustomEvent=CustomEvent;})();var astraTriggerEvent=function astraTriggerEvent(el,typeArg){var customEventInit=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var event=new CustomEvent(typeArg,customEventInit);el.dispatchEvent(event);};astraSmoothScroll=function astraSmoothScroll(e,top){e.preventDefault();window.scrollTo({top:top,left:0,behavior:'smooth'});};astScrollToTopHandler=function(masthead,astScrollTop){var content=getComputedStyle(astScrollTop).content,device=astScrollTop.dataset.onDevices;content=content.replace(/[^0-9]/g,'');if('both'==device||('desktop'==device&&'769'==content)||('mobile'==device&&''==content)){var scrollTop=window.pageYOffset||document.body.scrollTop;if(masthead&&masthead.length){if(scrollTop>masthead.offsetHeight+100){astScrollTop.style.display="block";}else{astScrollTop.style.display="none";}}else{if(window.pageYOffset>300){astScrollTop.style.display="block";}else{astScrollTop.style.display="none";}}}else{astScrollTop.style.display="none";}};(function(){var menu_toggle_all=document.querySelectorAll('.main-header-menu-toggle');var menu_click_listeners_nav={};var updateHeaderBreakPoint=function(){var originalOverflow=document.querySelector('body').style.overflow;document.querySelector('body').style.overflow='hidden';var ww=window.innerWidth;document.querySelector('body').style.overflow=originalOverflow;var break_point=astra.break_point,headerWrap=document.querySelectorAll('.main-header-bar-wrap');if(headerWrap.length>0){for(var i=0;ibreak_point){if(null!=menu_toggle_all[i]){menu_toggle_all[i].classList.remove('toggled');} document.body.classList.remove("ast-header-break-point");document.body.classList.add("ast-desktop");astraTriggerEvent(document.body,"astra-header-responsive-enabled");}else{document.body.classList.add("ast-header-break-point");document.body.classList.remove("ast-desktop");astraTriggerEvent(document.body,"astra-header-responsive-disabled")}}}}} updateHeaderBreakPoint();AstraToggleSubMenu=function(){var parent_li=this.parentNode;if(parent_li.classList.contains('ast-submenu-expanded')&&document.querySelector("header.site-header").classList.contains("ast-menu-toggle-link")){if(!this.classList.contains('ast-menu-toggle')){var link=parent_li.querySelector('a').getAttribute('href');if(''!==link||'#'!==link){window.location=link;}}} var parent_li_child=parent_li.querySelectorAll('.menu-item-has-children');for(var j=0;j0){for(var i=0;i0){for(var i=0;i .menu-link, .ast-header-break-point ul.main-header-menu .ast-menu-toggle');}else{var astra_menu_toggle=__main_header_all[i].querySelectorAll('ul.main-header-menu .ast-menu-toggle');} if(astra_menu_toggle.length>0){for(var j=0;j0){for(var i=0;i<__main_header_all.length;i++){if(null!=__main_header_all[i]){__main_header_all[i].classList.remove('toggle-on');__main_header_all[i].style.display='';} var sub_menu=__main_header_all[i].getElementsByClassName('sub-menu');for(var j=0;j{input.addEventListener('focus',function(e){var sibling=this.parentNode.parentNode.parentNode.querySelector('.ast-search-menu-icon');astraToggleClass(sibling,'ast-dropdown-active');});input.addEventListener('blur',function(e){var sibling=this.parentNode.parentNode.parentNode.querySelector('.ast-search-menu-icon');sibling.classList.remove('ast-dropdown-active');astraToggleClass(sibling,'ast-dropdown-active');});});document.body.onclick=function(event){if(typeof event.target.classList!=='undefined'){if(!event.target.classList.contains('ast-search-menu-icon')&&astraGetParents(event.target,'.ast-search-menu-icon').length===0&&astraGetParents(event.target,'.ast-search-icon').length===0){var dropdownSearchWrap=document.getElementsByClassName('ast-search-menu-icon');for(var i=0;i{offset+=single.clientHeight;});} const href=this.hash;if(href){const scrollId=document.querySelector(href);if(scrollId){const scrollOffsetTop=scrollId.offsetTop-offset;if(scrollOffsetTop){astraSmoothScroll(e,scrollOffsetTop);}}}}} window.addEventListener('DOMContentLoaded',(event)=>{for(let link of hashLinks){if(window.location.href.split('#')[0]===link.url){const siteHeader=document.querySelector('.site-header');let offset=0;const headerHeight=siteHeader.querySelectorAll('div[data-stick-support]');if(headerHeight){headerHeight.forEach(single=>{offset+=single.clientHeight;});} const scrollId=document.querySelector(link.hash);if(scrollId){const scrollOffsetTop=scrollId.offsetTop-offset;if(scrollOffsetTop){astraSmoothScroll(event,scrollOffsetTop);}}}}});} if(astra.is_scroll_to_top){var masthead=document.querySelector('#page header');var astScrollTop=document.getElementById('ast-scroll-top');astScrollToTopHandler(masthead,astScrollTop);window.addEventListener('scroll',function(){astScrollToTopHandler(masthead,astScrollTop);});astScrollTop.onclick=function(e){astraSmoothScroll(e,0);};}})();