/*!
 * robust-admin-theme (https://pixinvent.com/bootstrap-admin-template/robust)
 * Copyright 2017 PIXINVENT
 * Licensed under the Themeforest Standard Licenses
 */
!function(window,document,$){"use strict";$.app=$.app||{};var $body=$("body"),$window=$(window);$('div[data-menu="menu-wrapper"]').html(),$('div[data-menu="menu-wrapper"]').attr("class");$.app.menu={expanded:null,collapsed:null,hidden:null,container:null,horizontalMenu:!1,manualScroller:{obj:null,init:function(){var scroll_theme=$(".main-menu").hasClass("menu-dark")?"light":"dark";this.obj=$(".main-menu-content").perfectScrollbar({suppressScrollX:!0,theme:scroll_theme})},update:function(){if(this.obj){if($(".main-menu").data("scroll-to-active")===!0){var position;position=$(".main-menu-content").find("li.active").parents("li").length>0?$(".main-menu-content").find("li.active").parents("li").last().position():$(".main-menu-content").find("li.active").position(),setTimeout(function(){$.app.menu.container.stop().animate({scrollTop:position.top},300),$(".main-menu").data("scroll-to-active","false")},300)}$(".main-menu-content").perfectScrollbar("update")}},enable:function(){this.init()},disable:function(){this.obj&&$(".main-menu-content").perfectScrollbar("destroy")},updateHeight:function(){"vertical-menu"!=$body.data("menu")&&"vertical-overlay-menu"!=$body.data("menu")||!$(".main-menu").hasClass("menu-fixed")||($(".main-menu-content").css("height",$(window).height()-$(".header-navbar").height()-$(".main-menu-header").outerHeight()-$(".main-menu-footer").outerHeight()),this.update())}},init:function(){if($(".main-menu-content").length>0){this.container=$(".main-menu-content");this.change()}else this.drillDownMenu()},drillDownMenu:function(screenSize){$(".drilldown-menu").length&&("sm"==screenSize||"xs"==screenSize?"true"==$("#navbar-mobile").attr("aria-expanded")&&$(".drilldown-menu").slidingMenu({backLabel:!0}):$(".drilldown-menu").slidingMenu({backLabel:!0}))},change:function(){var currentBreakpoint=Unison.fetch.now();this.reset();var menuType=$body.data("menu");if(currentBreakpoint)switch(currentBreakpoint.name){case"xl":case"lg":"vertical-overlay-menu"===menuType?this.hide():"vertical-compact-menu"===menuType?this.open():this.expand();break;case"md":"vertical-overlay-menu"===menuType||"vertical-mmenu"===menuType?this.hide():"vertical-compact-menu"===menuType?this.open():this.collapse();break;case"sm":this.hide();break;case"xs":this.hide()}"vertical-menu"!==menuType&&"vertical-compact-menu"!==menuType&&"vertical-content-menu"!==menuType||this.toOverlayMenu(currentBreakpoint.name),"horizontal-menu"!=menuType&&"horizontal-top-icon-menu"!=menuType&&this.drillDownMenu(currentBreakpoint.name),"xl"==currentBreakpoint.name&&($('body[data-open="hover"] .dropdown').on("mouseenter",function(){$(this).hasClass("open")?$(this).removeClass("open"):$(this).addClass("open")}).on("mouseleave",function(event){$(this).removeClass("open")}),$('body[data-open="hover"] .dropdown a').on("click",function(e){if("horizontal-menu"==menuType||"horizontal-top-icon-menu"==menuType){var $this=$(this);if($this.hasClass("dropdown-toggle"))return!1}})),$(".header-navbar").hasClass("navbar-brand-center")&&$(".header-navbar").attr("data-nav","brand-center"),"sm"==currentBreakpoint.name||"xs"==currentBreakpoint.name?$(".header-navbar[data-nav=brand-center]").removeClass("navbar-brand-center"):$(".header-navbar[data-nav=brand-center]").addClass("navbar-brand-center"),$("ul.dropdown-menu [data-toggle=dropdown]").on("click",function(event){$(this).siblings("ul.dropdown-menu").length>0&&event.preventDefault(),event.stopPropagation(),$(this).parent().siblings().removeClass("open"),$(this).parent().toggleClass("open")})},changeLogo:function(menuType){var logo=$(".brand-logo");"expand"==menuType?logo.attr("src",logo.data("expand")):logo.attr("src",logo.data("collapse"))},transit:function(callback1,callback2){var menuObj=this;$body.addClass("changing-menu"),callback1.call(menuObj),$body.hasClass("vertical-layout")&&($body.hasClass("menu-open")||$body.hasClass("menu-expanded")?($(".menu-toggle").addClass("is-active"),"vertical-menu"!==$body.data("menu")&&"vertical-content-menu"!==$body.data("menu")||$(".main-menu-header")&&$(".main-menu-header").show()):($(".menu-toggle").removeClass("is-active"),"vertical-menu"!==$body.data("menu")&&"vertical-content-menu"!==$body.data("menu")||$(".main-menu-header")&&$(".main-menu-header").hide())),setTimeout(function(){callback2.call(menuObj),$body.removeClass("changing-menu"),menuObj.update()},500)},open:function(){$body.is(".vertical-mmenu")&&this.mMenu.enable(),this.transit(function(){$body.removeClass("menu-hide menu-collapsed").addClass("menu-open"),this.hidden=!1,this.expanded=!0},function(){$(".main-menu").hasClass("menu-native-scroll")||$body.is(".vertical-mmenu")||!$(".main-menu").hasClass("menu-fixed")||(this.manualScroller.enable(),$(".main-menu-content").css("height",$(window).height()-$(".header-navbar").height()-$(".main-menu-header").outerHeight()-$(".main-menu-footer").outerHeight()))})},hide:function(){$body.is(".vertical-mmenu")&&this.mMenu.disable(),this.transit(function(){$body.removeClass("menu-open menu-expanded").addClass("menu-hide"),this.hidden=!0,this.expanded=!1},function(){$(".main-menu").hasClass("menu-native-scroll")||$body.is(".vertical-mmenu")||!$(".main-menu").hasClass("menu-fixed")||this.manualScroller.enable()})},expand:function(){this.expanded===!1&&("vertical-menu"==$body.data("menu")&&this.changeLogo("expand"),this.transit(function(){$body.removeClass("menu-collapsed").addClass("menu-expanded"),this.collapsed=!1,this.expanded=!0},function(){$body.is(".vertical-mmenu")?this.mMenu.enable():$(".main-menu").hasClass("menu-native-scroll")||"vertical-mmenu"==$body.data("menu")||"horizontal-menu"==$body.data("menu")||"horizontal-top-icon-menu"==$body.data("menu")?this.manualScroller.disable():$(".main-menu").hasClass("menu-fixed")&&this.manualScroller.enable(),"vertical-menu"==$body.data("menu")&&$(".main-menu").hasClass("menu-fixed")&&$(".main-menu-content").css("height",$(window).height()-$(".header-navbar").height()-$(".main-menu-header").outerHeight()-$(".main-menu-footer").outerHeight())}))},collapse:function(){this.collapsed===!1&&("vertical-menu"==$body.data("menu")&&this.changeLogo("collapse"),this.transit(function(){$body.removeClass("menu-expanded").addClass("menu-collapsed"),this.collapsed=!0,this.expanded=!1},function(){"vertical-content-menu"==$body.data("menu")&&this.manualScroller.disable(),"horizontal-menu"!=$body.data("menu")&&"horizontal-top-icon-menu"!=$body.data("menu")||!$body.hasClass("vertical-overlay-menu")||$(".main-menu").hasClass("menu-fixed")&&this.manualScroller.enable(),"vertical-menu"==$body.data("menu")&&$(".main-menu").hasClass("menu-fixed")&&$(".main-menu-content").css("height",$(window).height()-$(".header-navbar").height())}))},toOverlayMenu:function(screen){var menu=$body.data("menu");"sm"==screen||"xs"==screen?($body.hasClass(menu)&&$body.removeClass(menu).addClass("vertical-overlay-menu"),"vertical-content-menu"==menu&&$(".main-menu").addClass("menu-fixed")):($body.hasClass("vertical-overlay-menu")&&$body.removeClass("vertical-overlay-menu").addClass(menu),"vertical-content-menu"==menu&&$(".main-menu").removeClass("menu-fixed"))},toggle:function(){var currentBreakpoint=Unison.fetch.now(),expanded=(this.collapsed,this.expanded),hidden=this.hidden,menu=$body.data("menu");switch(currentBreakpoint.name){case"xl":case"lg":case"md":expanded===!0?"vertical-compact-menu"==menu||"vertical-mmenu"==menu||"vertical-overlay-menu"==menu?this.hide():this.collapse():"vertical-compact-menu"==menu||"vertical-mmenu"==menu||"vertical-overlay-menu"==menu?this.open():this.expand();break;case"sm":hidden===!0?this.open():this.hide();break;case"xs":hidden===!0?this.open():this.hide()}this.drillDownMenu(currentBreakpoint.name)},update:function(){this.manualScroller.update()},reset:function(){this.expanded=!1,this.collapsed=!1,this.hidden=!1,$body.removeClass("menu-hide menu-open menu-collapsed menu-expanded")}},$.app.nav={container:$(".navigation-main"),initialized:!1,navItem:$(".navigation-main").find("li").not(".navigation-category"),config:{speed:300},init:function(config){this.initialized=!0,$.extend(this.config,config),$body.is(".vertical-mmenu")||this.bind_events()},bind_events:function(){var menuObj=this;$(".navigation-main").on("mouseenter.app.menu","li",function(){var $this=$(this);if($(".hover",".navigation-main").removeClass("hover"),$body.hasClass("menu-collapsed")||"vertical-compact-menu"==$body.data("menu")&&!$body.hasClass("vertical-overlay-menu")){$(".main-menu-content").children("span.menu-title").remove(),$(".main-menu-content").children("a.menu-title").remove(),$(".main-menu-content").children("ul.menu-content").remove();var tempTitle,tempLink,menuTitle=$this.find("span.menu-title").clone();$this.hasClass("has-sub")||(tempTitle=$this.find("span.menu-title").text(),tempLink=$this.children("a").attr("href"),""!==tempTitle&&(menuTitle=$("<a>"),menuTitle.attr("href",tempLink),menuTitle.attr("title",tempTitle),menuTitle.text(tempTitle),menuTitle.addClass("menu-title")));var fromTop;if(fromTop=$this.css("border-top")?$this.position().top+parseInt($this.css("border-top"),10):$this.position().top,"vertical-compact-menu"!==$body.data("menu")&&menuTitle.appendTo(".main-menu-content").css({position:"fixed",top:fromTop}),$this.hasClass("has-sub")&&$this.hasClass("nav-item")){$this.children("ul:first");menuObj.adjustSubmenu($this)}}$this.addClass("hover")}).on("mouseleave.app.menu","li",function(){}).on("active.app.menu","li",function(e){$(this).addClass("active"),e.stopPropagation()}).on("deactive.app.menu","li.active",function(e){$(this).removeClass("active"),e.stopPropagation()}).on("open.app.menu","li",function(e){var $listItem=$(this);return $listItem.addClass("open"),menuObj.expand($listItem),!$(".main-menu").hasClass("menu-collapsible")&&($listItem.siblings(".open").find("li.open").trigger("close.app.menu"),$listItem.siblings(".open").trigger("close.app.menu"),void e.stopPropagation())}).on("close.app.menu","li.open",function(e){var $listItem=$(this);$listItem.removeClass("open"),menuObj.collapse($listItem),e.stopPropagation()}).on("click.app.menu","li",function(e){var $listItem=$(this);$listItem.is(".disabled")?e.preventDefault():$body.hasClass("menu-collapsed")||"vertical-compact-menu"==$body.data("menu")&&$listItem.is(".has-sub")&&!$body.hasClass("vertical-overlay-menu")?e.preventDefault():$listItem.has("ul")?$listItem.is(".open")?$listItem.trigger("close.app.menu"):$listItem.trigger("open.app.menu"):$listItem.is(".active")||($listItem.siblings(".active").trigger("deactive.app.menu"),$listItem.trigger("active.app.menu")),e.stopPropagation()}),$(".main-menu-content").on("mouseleave",function(){($body.hasClass("menu-collapsed")||"vertical-compact-menu"==$body.data("menu"))&&($(".main-menu-content").children("span.menu-title").remove(),$(".main-menu-content").children("a.menu-title").remove(),$(".main-menu-content").children("ul.menu-content").remove()),$(".hover",".navigation-main").removeClass("hover")}),$(".navigation-main li.has-sub > a").on("click",function(e){e.preventDefault()}),$("ul.menu-content").on("click","li",function(e){var $listItem=$(this);if($listItem.is(".disabled"))e.preventDefault();else if($listItem.has("ul"))if($listItem.is(".open"))$listItem.removeClass("open"),menuObj.collapse($listItem);else{if($listItem.addClass("open"),menuObj.expand($listItem),$(".main-menu").hasClass("menu-collapsible"))return!1;$listItem.siblings(".open").find("li.open").trigger("close.app.menu"),$listItem.siblings(".open").trigger("close.app.menu"),e.stopPropagation()}else $listItem.is(".active")||($listItem.siblings(".active").trigger("deactive.app.menu"),$listItem.trigger("active.app.menu"));e.stopPropagation()})},adjustSubmenu:function($menuItem){var menuHeaderHeight,menutop,topPos,winHeight,subMenuHeight,popOutMenuHeight,borderWidth,scroll_theme,$submenu=$menuItem.children("ul:first"),ul=$submenu.clone(!0);menuHeaderHeight=$(".main-menu-header").height(),menutop=$menuItem.position().top,winHeight=$window.height()-$(".header-navbar").height(),borderWidth=0,subMenuHeight=$submenu.height(),parseInt($menuItem.css("border-top"),10)>0&&(borderWidth=parseInt($menuItem.css("border-top"),10)),popOutMenuHeight=winHeight-menutop-$menuItem.height()-30,scroll_theme=$(".main-menu").hasClass("menu-dark")?"light":"dark","vertical-compact-menu"===$body.data("menu")?(topPos=menutop+borderWidth,popOutMenuHeight=winHeight-menutop-30):"vertical-content-menu"===$body.data("menu")?(topPos=menutop+$menuItem.height()+borderWidth,popOutMenuHeight=winHeight-$(".content-header").height()-$menuItem.height()-menutop-60):topPos=menutop+$menuItem.height()+borderWidth,"vertical-content-menu"==$body.data("menu")?ul.addClass("menu-popout").appendTo(".main-menu-content").css({top:topPos,position:"fixed"}):(ul.addClass("menu-popout").appendTo(".main-menu-content").css({top:topPos,position:"fixed","max-height":popOutMenuHeight}),$(".main-menu-content > ul.menu-content").perfectScrollbar({theme:scroll_theme}))},collapse:function($listItem,callback){var $subList=$listItem.children("ul");$subList.show().slideUp($.app.nav.config.speed,function(){$(this).css("display",""),$(this).find("> li").removeClass("is-shown"),callback&&callback(),$.app.nav.container.trigger("collapsed.app.menu")})},expand:function($listItem,callback){var $subList=$listItem.children("ul"),$children=$subList.children("li").addClass("is-hidden");$subList.hide().slideDown($.app.nav.config.speed,function(){$(this).css("display",""),callback&&callback(),$.app.nav.container.trigger("expanded.app.menu")}),setTimeout(function(){$children.addClass("is-shown"),$children.removeClass("is-hidden")},0)},refresh:function(){$.app.nav.container.find(".open").removeClass("open")}}}(window,document,jQuery);