define(["layout/module","jquery"],function(a){"use strict";!function(a){a.fn.smartCollapseToggle=function(){return this.each(function(){var b=a("body"),c=a(this);b.hasClass("menu-on-top")||(b.hasClass("mobile-view-activated"),c.toggleClass("open"),b.hasClass("minified")?c.closest("nav ul ul").length&&(c.find(">a .collapse-sign .fa").toggleClass("fa-minus-square-o fa-plus-square-o"),c.find("ul:first").slideToggle(appConfig.menu_speed||200)):(c.find(">a .collapse-sign .fa").toggleClass("fa-minus-square-o fa-plus-square-o"),c.find("ul:first").slideToggle(appConfig.menu_speed||200)))})}}(jQuery),a.registerDirective("smartMenu",["$state","$rootScope",function(a,b){return{restrict:"A",link:function(a,c){var d=$("body"),e=c.find("li[data-menu-collapse]");e.each(function(a,b){var c=$(b);c.on("click",">a",function(a){c.siblings(".open").smartCollapseToggle(),c.smartCollapseToggle(),!c.hasClass("open")&&c.find("li.active").length>0&&c.addClass("active"),a.preventDefault()}).find(">a").append('<b class="collapse-sign"><em class="fa fa-plus-square-o"></em></b>'),c.find("li.active").length&&(c.smartCollapseToggle(),c.find("li.active").parents("li").addClass("active"))}),c.on("click","a[data-ui-sref]",function(){$(this).parents("li").addClass("active").each(function(){$(this).siblings("li.open").smartCollapseToggle(),$(this).siblings("li").removeClass("active")}),d.hasClass("mobile-view-activated")&&b.$broadcast("requestToggleMenu")}),a.$on("$smartLayoutMenuOnTop",function(a,b){b&&e.filter(".open").smartCollapseToggle()})}}}])});