function setActive(){let menuClass='';menuClass='.main-nav .item a';$(menuClass).each(function(){if(!$(this).attr('href')||$(this).attr('href')=='#'){return;}if(Utils.checkShouldBeActive($(this))){var menu=$(this).closest('.item');menu.addClass('active');}});}function setNewBreakpoint(){if(typeof NO_NEW_BREAKPOINT!='undefined'&&NO_NEW_BREAKPOINT){return;}if($('body').hasClass('layout-nav-side')){return;}var oldBreak=$('body').data('mobile-width');var breakPoint=0;$('#layout-nav').children().each(function(){if(!$(this).hasClass('modal')&&!$(this).hasClass('skip-width-calc')&&!$(this).hasClass('nav-no-sub')){breakPoint+=$(this).outerWidth();}});if($('.nav-no-sub').length){$('.nav-no-sub').addClass('calc-width');if($('#dashboard-title').length){breakPoint+=$('#dashboard-title h1').outerWidth();breakPoint+=parseInt($('#dashboard-title h1').parent().css('margin-left'));breakPoint+=parseInt($('#dashboard-title h1').parent().css('margin-right'));}if($('#action-btns').length){breakPoint+=$(
'#action-btns').outerWidth();}$('.nav-no-sub').removeClass('calc-width');}if(breakPoint<=Navigation.getMobileWidth()||$(window).width()<=Navigation.getMobileWidth()){return;}Navigation.newBreakpoint=breakPoint;const targetSheet=Array.from(document.styleSheets).find((sheet)=>{if(sheet.href&&!sheet.href.includes('vendor')&&sheet.href.includes('theme')||$(sheet.ownerNode).attr('id')==='css-preview'){return sheet;}});if(!targetSheet){console.error('Failed to find targetSheet.  Unable to re-write CSS styles to allow all menu items to fit on the page');}const newMobileRules=[];Array.from(targetSheet.cssRules).forEach((rule)=>{const replaceRule=rule.conditionText&&rule.cssText.includes('.mobile_nav--ruleset');if(replaceRule){newMobileRules.push(targetSheet.cssRules[j].cssText.replace(`${oldBreak}px`,`${breakPoint}px`));}else{newMobileRules.push(targetSheet.cssRules[j].cssText);}});$('head').append($("<style>").html(newMobileRules.join(' ')));targetSheet.ownerNode.remove();console.warn(
'Theme Stylesheet was delete and replaced with <style> tag (appended to the <head> section).'+`New navigation breakpoint set to: ${breakPoint}`);}function trackDownload(e){var category='File';var event='Download';var url=$(this).attr('href');var parts=url.split('/');var name=parts[parts.length-1];var value=1;if(typeof _paq!='undefined'){_paq.push(['trackEvent',category,event,name,value]);}if(typeof ga!='undefined'){ga('send',{hitType:'event',eventCategory:category,eventAction:event,eventLabel:name,eventValue:value,nonInteraction:true,});}}var Navigation={newBreakpoint:null,getMobileWidth:function(){if(Navigation.newBreakpoint){return Navigation.newBreakpoint;}var width=1024;if(typeof $('body').data('mobile-width')!=='undefined'){width=$('body').data('mobile-width');}return width;},mouseover:function(){if($(this).hasClass('has-children')){var sub=$(this).children('.secondary-subnav');if(sub.length){if(sub.get(0).getBoundingClientRect().right>$('body').get(0).getBoundingClientRect().
width){sub.addClass('no-after');sub.addClass('no-before');}}}},updateActiveItemByDashUrl:function(dashUrl){if($('a[data-dashurl="'+dashUrl+'"]').length){$('.navbar-nav li, #ml-menu li').removeClass('active');$('a[data-dashurl="'+dashUrl+'"]').closest('li').addClass('active');}},};$(document).ready(function(){if($('.layout-nav-mega').length&&$('#layout-nav').css('background-color')==$('body').css('background-color')){$('.dropdown').addClass('hide-caret');}$('#menu-trigger').click(function(){$('.main-nav').toggleClass('active');$('#menu-trigger').toggleClass('active');});$('.navbar-brand img').on('load',function(){setNewBreakpoint();}).each(function(){if(this.complete){setNewBreakpoint();}});var mobileWidth=Navigation.getMobileWidth();var newCSS;if($('.layout-nav-mega .main-nav.pull-left').length){newCSS='@media screen and (min-width: '+mobileWidth+'px) {';$('.main-nav .navbar-nav .dropdown').each(function(index){var size=0;var position=$(this).position();$(this).addClass('dropdown-'+(
index+1));newCSS+=' #layout-nav .dropdown.dropdown-';newCSS+=index+1;newCSS+=' .dropdown-menu {padding-left: '+position.left+'px;} ';$('.dropdown-menu .secondary-item',$(this)).each(function(){if(size<$(this).innerWidth()){size=$(this).innerWidth();}});});newCSS+='};';$('body').append('<style>'+newCSS+'</style>');}else if($('.layout-nav-mega .main-nav.pull-right').length){newCSS='@media screen and (min-width: '+mobileWidth+'px) {';$('.main-nav .navbar-nav .dropdown').each(function(index){var size=0;var position=$(this).position();$(this).addClass('dropdown-'+(index+1));newCSS+=' #layout-nav .dropdown.dropdown-'+(index+1)+' .dropdown-menu {display: flex; ';newCSS+='justify-content: flex-end; flex-wrap: wrap; padding-right: ';newCSS+=$(window).innerWidth()-position.left-150;newCSS+='px;} ';$('.dropdown-menu .secondary-item',$(this)).each(function(){if(size<$(this).innerWidth()){size=$(this).innerWidth();}});});newCSS+='};';$('body').append('<style>'+newCSS+'</style>');}$(
'.navbar-nav [data-toggle="collapse"]').collapse('hide');$('[data-toggle="collapse"]').click(function(e){if($(e.target).hasClass('caret')){e.preventDefault();$($(this).data('target')).collapse();}});$('.collapse').on('show.bs.collapse hide.bs.collapse',function(e){if($(window).width()>=mobileWidth){e.preventDefault();}});$('[data-toggle="collapse"]').on('click',function(e){if($(window).width()>=mobileWidth){$($(this).data('target')).toggleClass('in');}});$(window).resize(function(){if($(window).width()>Navigation.getMobileWidth()){$('.navbar-nav .dropdown-menu').height('auto');}else{$('.navbar-nav .dropdown-menu').height('');$('.navbar-nav [data-toggle="collapse"]').collapse('hide');}$('.off-canvas').removeClass('active');$('#menu-trigger').removeClass('active');if(!Navigation.newBreakpoint){setNewBreakpoint();}});$('body').on('click',function(e){if(!$('li.dropdown').is(e.target)&&$('li.dropdown').has(e.target).length===0&&$('.open').has(e.target).length===0){$('li.dropdown').
removeClass('open');}});$('a.tracking_download').each(function(){$(this).click(trackDownload);});var basePath=$('body').data('basepath');$('.phpdebugbar-open-btn').after('<a class="download-debug" title="Export"><span class="glyphicon glyphicon-download"></a>');$('.download-debug').click(function(){if(typeof jQuery.redirect!=='function'){jQuery.redirect(basePath+'/download',{'payload':iwdebug,});}else{$.redirect(basePath+'/download',{'payload':iwdebug,});}});if($('.nav .item.active').length){if(!Utils.checkActiveLink()){$('.nav .item.active').removeClass('active');setActive();}}else{setActive();}});