(()=>{function e(e,i,t,n){var r=e.selectedDevices;function c(e){return e.childAssets.references.length+e.childDevices.references.length}function l(n){return n&&!!_.find(r,function(e){return parseInt(e.id,10)===parseInt(n.id,10)})}e.collapseExpandChildren=function(e){var n;0<c(e)&&(e.children?e.children=null:((n=e).__loading=!0,i.all([t.childAssets(n),t.childDevices(n)]).then(function(e){delete n.__loading,n.children=[],n.children.push(e[0]),n.children.push(e[1]),n.children=_.flattenDeep(n.children)})))},e.getChildrenCount=c,e.isSelected=l,e.onDeviceSelect=function(e){var n,i;l(e)?(n=e,_.remove(r,function(e){return parseInt(e.id,10)===parseInt(n.id,10)})):(i=e,_.find(r,function(e){return parseInt(e.id,10)===parseInt(i.id,10)})||r.push(i))},e.isDisabled=function(n){return _.find(e.disabledDevices,function(e){return parseInt(e.id,10)===parseInt(n.id,10)})},e.getDeviceTitle=function(e){return e.name||n.getString("Device {{id}}",e)}}e.$inject=["$scope","$q","c8yDevices","gettextCatalog"],angular.module("c8y.deviceSelector").controller("deviceSelectorListCtrl",e)})();