text: "use strict";angular.module("ui.bootstrap.tree",[]).run(["$templateCache",function(a){a.put("uibTreeItemTemplate.html",'<span><i ng-class="getUibTreeNodeIcon(tree)" ng-click="toggleUibTreeNodeStatus(tree)"></i>&nbsp;<lable ng-click="toggleUibTreeNodeSelect(tree)" ng-class="getUibTreeLabelClass(tree)">{{tree.label}}</lable>&nbsp;<i ng-if="getUibTreeSelectStatus(tree)" ng-class="getUibTreeSelectIcon(tree)"></i></span><ul ng-if="getUibTreeNodeStatus(tree)" class="uib-tree"><li ng-repeat="tree in tree.children" ng-include="\'uibTreeItemTemplate.html\'"></li></ul>')}]).service("uibTreeUtil",function(){var a=function(a){return void 0!=a.selected&&null!=a.selected&&(1==a.selected||"true"==a.selected)},b=function(a){return void 0!=a.children&&null!=a.children&&(!!angular.isArray(a.children)&&a.children.length>0)},c=function(a){return void 0!=a.expanded&&null!=a.expanded&&(1==a.expanded||"true"==a.expanded)},d=function(a){if(c(a)||(a.expanded=!0),b(a))for(var e=0;e<a.children.length;e++)d(a.children[e])},e=function(a,d,f){if(c(a)||(a.expanded=!0),f++,b(a))for(var g=0;g<a.children.length&&f<d;g++)e(a.children[g],d,f)},f=function(a){if(c(a)&&(a.expanded=!1),b(a))for(var d=0;d<a.children.length;d++)f(a.children[d])},g=function(c){for(var d=0;d<c.length;d++){var e=c[d];if(a(e))b(e)&&g(e.children);else{if(c.splice(d,1),b(e))for(var f=e.children.length;f>0;f--)c.splice(d,0,e.children[f-1]);d--}}};return{expandAll:function(a){if(void 0!=a&&null!=a&&angular.isArray(a))for(var b=0;b<a.length;b++)d(a[b])},expandByLevel:function(a,b){if(void 0!=a&&null!=a&&angular.isArray(a)&&b>0)for(var c=0;c<a.length;c++)e(a[c],b,0)},collapseAll:function(a){if(void 0!=a&&null!=a&&angular.isArray(a))for(var b=0;b<a.length;b++)f(a[b])},getSelectedTreeModel:function(c){for(var d=angular.copy(c),e=0;e<d.length;e++){var f=d[e];if(a(f))b(f)&&g(f.children);else{if(d.splice(e,1),b(f))for(var h=f.children.length;h>0;h--)d.splice(e,0,f.children[h-1]);e--}}return d}}}).directive("uibTree",function(){return{restrict:"E",scope:{treeModel:"=",iconExpand:"@",iconCollapse:"@",iconLeaf:"@",iconSelect:"@",labelClass:"@",cascade:"@",reverse:"@",disableSelect:"@",onSelect:"&",onDeselect:"&"},template:'<ul class="uib-tree"><li ng-repeat="tree in treeModel" ng-include="\'uibTreeItemTemplate.html\'"></li></ul>',replace:!0,link:function(a,b,c){angular.isDefined(a.treeModel)?angular.isObject(a.treeModel)?angular.isArray(a.treeModel)||(a.treeModel=[a.treeModel]):console.error("Tree model must be an Object"):console.error("Tree model is required");var d=function(a){return void 0!=a.children&&null!=a.children&&(!!angular.isArray(a.children)&&a.children.length>0)},e=function(a){return void 0!=a.expanded&&null!=a.expanded&&(1==a.expanded||"true"==a.expanded)},f=function(a){return void 0!=a.selected&&null!=a.selected&&(1==a.selected||"true"==a.selected)},g=function(){return"true"==a.cascade},h=function(){return"true"==a.reverse},i=function(){return!g()&&!h()&&"true"==a.disableSelect},j=function(b){for(var c=null,e=function(a){if(d(a))if(-1!=a.children.indexOf(b))c=a;else for(var f=0;f<a.children.length&&(d(a.children[f])&&e(a.children[f]),null==c);f++);},f=0;f<a.treeModel.length&&(e(a.treeModel[f]),null==c);f++);return c},k=function(b){if(d(b))for(var c=0;c<b.children.length;c++)f(b.children[c])||k(b.children[c]);b.selected=!0,null!=b.onSelect?b.onSelect():null!=a.onSelect&&a.onSelect({model:b})},l=function(b){if(g()&&d(b))for(var c=0;c<b.children.length;c++)f(b.children[c])||k(b.children[c]);b.selected=!0,null!=b.onSelect?b.onSelect():null!=a.onSelect&&a.onSelect({model:b})},m=function(b){if(d(b))for(var c=0;c<b.children.length;c++)f(b.children[c])&&m(b.children[c]);b.selected=!1,null!=b.onDeselect?b.onDeselect():null!=a.onDeselect&&a.onDeselect({model:b})},n=function(b){var c=j(b);null!=c&&f(c)&&n(c),b.selected=!1,null!=b.onDeselect?b.onDeselect():null!=a.onDeselect&&a.onDeselect({model:b})},o=function(b){if(g()&&d(b))for(var c=0;c<b.children.length;c++)f(b.children[c])&&m(b.children[c]);if(h()){var e=j(b);null!=e&&f(e)&&n(e)}b.selected=!1,null!=b.onDeselect?b.onDeselect():null!=a.onDeselect&&a.onDeselect({model:b})};a.getUibTreeNodeStatus=function(a){return e(a)},a.getUibTreeNodeIcon=function(b){return d(b)?e(b)?void 0!=b.iconCollapse&&null!=b.iconCollapse&&""!=b.iconCollapse?b.iconCollapse:void 0!=a.iconCollapse&&""!=a.iconCollapse?a.iconCollapse:"icon-minus glyphicon glyphicon-minus fa fa-minus text-info":void 0!=b.iconExpand&&null!=b.iconExpand&&""!=b.iconExpand?b.iconExpand:void 0!=a.iconExpand&&""!=a.iconExpand?a.iconExpand:"icon-plus glyphicon glyphicon-plus fa fa-plus text-info":void 0!=b.iconLeaf&&null!=b.iconLeaf&&""!=b.iconLeaf?b.iconLeaf:void 0!=a.iconLeaf&&""!=a.iconLeaf?a.iconLeaf:"icon-file glyphicon glyphicon-file fa fa-file text-info"},a.getUibTreeSelectStatus=function(a){return!i()&&f(a)},a.getUibTreeSelectIcon=function(b){return void 0!=b.iconSelect&&null!=b.iconSelect&&""!=b.iconSelect?b.iconSelect:void 0!=a.iconSelect&&""!=a.iconSelect?a.iconSelect:"icon-check glyphicon glyphicon-ok fa fa-check text-info"},a.getUibTreeLabelClass=function(b){return void 0!=b.labelClass&&null!=b.labelClass&&""!=b.labelClass?b.labelClass:void 0!=a.labelClass&&""!=a.labelClass?a.labelClass:"text-info"},a.toggleUibTreeNodeStatus=function(a){d(a)&&(e(a)?a.expanded=!1:a.expanded=!0)},a.toggleUibTreeNodeSelect=function(a){i()||(f(a)?o(a):l(a))}}}});