angular.module("c8y.deviceSelector").directive("c8yDeviceSelectorComboDevices",function(){return{restrict:"A",link:function(e,i){e.__el=i;var l=e.depth||0;function t(){e.child.openChildren=e.idPath&&!!e.idPath[l]&&e.idPath[l]===e.child.id&&e.selectedChildDevice.id!==e.child.id,e.child.openChildren&&e.toggleChildren(e,e.child)}e.$evalAsync(function(){return e.propagateToggle.value&&t()})}}}).directive("c8yDeviceSelectorCombo",["$compile",function(l){return{restrict:"EA",scope:{parent:"=?",selectedChildDevice:"=?",selectedChildDeviceId:"=?",contextPaths:"=?",onSelect:"&",groupsSelectable:"=?",selectRequired:"=?",idPath:"=?",emptySelectionAvailable:"&?",emptySelectionIcon:"&?",emptySelectionLabel:"&?",readOnly:"<",readOnlyInfo:"&?",searchOnlyChildAssetsOf:"=?"},templateUrl:":::PLUGIN_PATH:::/views/deviceSelectorCombo.html",controller:"DeviceSelectorComboCtrl",require:"?^form",link:{post:function(o,c,e,i){var n=l('<div ng-include="\':::PLUGIN_PATH:::/views/deviceSelectorCombo.html\'" ng-controller="DeviceSelectorComboCtrl"></div>');o.top=!0,o.form=i,o.form&&o.selectedChildDevice&&!o.selectedChildDevice.id&&o.form.$setValidity("deviceSelected",!1),o.toggleChildren=function(e,i,l){return o._toggleChildren($(e.target),i,l)},o._toggleChildren=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:c,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:o,l=2<arguments.length?arguments[2]:void 0,t=e.hasClass("deviceRow")?e:e.parents(".deviceRow").first();l.openChildren=!l.openChildren,l.openChildren?(e=i.$new(),(l.childrenNewScope=e).openChildren=!1,e.propagateToggle=i.propagateToggle,e.parent=l,e.depth=_.isNumber(i.depth)?i.depth+1:1,e.children=[],e.top=!1,n(e,function(e){t.append(e)})):(t.children().last().remove(),l.childrenNewScope.$destroy(),delete l.childrenNewScope)}}}}}]);