(()=>{function t(t,n,i,o,a){var e=i.find(".tabContainer"),l=i.find("ul"),s=i.find(".tabs-slider-left"),r=i.find(".tabs-slider-right"),c=_.debounce(f,300,{leading:!1,trailing:!0}),h=this;function d(){var t="page-tabs",n="page-tabs-vertical",o="page-tabs-horizontal",a=[t,o,n];h.tabs.length?(i.addClass("".concat(t," ").concat(h.horizontal?o:n)),i.removeClass(h.horizontal?n:o)):i.removeClass(a.join(" "))}function f(){var t,n,o,a=!1,i=!1;h.horizontal&&(t=l[0].scrollWidth,n=e.width(),a=!!(o=e.scrollLeft()),i=n+o<t),a?s.show():s.hide(),i?r.show():r.hide()}_.assign(h,{tabs:a.routeTabs,$onChanges:d,navigateTo:function(t){t&&o.path(t)},showTabs:function(){return _.some(h.tabs,"show")}}),a.$on(a.EVENT_UPDATE,function(){(()=>{var t,n,o=l.find(".active");h.horizontal&&o.length&&(t=l[0].scrollWidth,n=e.width(),o=o.position().left,n<o)&&(o=_.min([o,t-n]),e.scrollLeft(o))})(),f(),(()=>{var t=_.find(h.tabs,"active");h.selectedTabPath=_.get(t,"path")})()}),s.on("click",function(){var t=e.width(),n=e.scrollLeft(),n=_.max([0,n-t]);e.animate({scrollLeft:n},300)}),r.on("click",function(){var t=l[0].scrollWidth,n=e.width(),o=e.scrollLeft(),t=_.min([t-n,o+n]);e.animate({scrollLeft:t},300)}),e.on("scroll",c),$(n).on("resize",c),t.$watch(function(){return a.routeTabs.length},d)}t.$inject=["$scope","$window","$element","$location","c8yTabs"],angular.module("c8y.ui").component("c8yUiTabs",{templateUrl:":::PLUGIN_PATH:::/ui/navigation/tabs.html",controllerAs:"vm",controller:t,bindings:{horizontal:"<"}})})();