(()=>{function e(n,c){var i="c8y_IsDeviceGroup",u="c8y_BrokerSource",t="_".concat(u);return{list:function(e){var r={fragmentType:i,pageSize:c.MAX_PAGESIZE};_.isObjectLike(e)&&(r=_.assign(r,e));return n.list(r)},detail:function(e){return n.detail(e)},create:function(e){return e.type="c8y_DeviceGroup",e[i]={},n.create(e)},createSubgroup:function(e){return e.type="c8y_DeviceSubgroup",e[i]={},n.create(e)},remove:function(e){if(e.childAssets.references.length)return!1;return n.remove(e)},addDevice:function(e,r){return r.c8y_Groups=_.isArray(r.c8y_Groups)?r.c8y_Groups:[],r.c8y_Groups.push({name:e.name,id:e.id}),n.update(r.id,{c8y_Groups:r.c8y_Groups}),n.addChildAsset(e,r)},removeDevice:function(r,e){_.isArray(e.c8y_Groups)&&(e.c8y_Groups=e.c8y_Groups.filter(function(e){return e.id!==r.id}),n.update(e.id,{c8y_Groups:e.c8y_Groups}));return n.removeChildAsset(r,e)},hasBrokerSource:function(e){var r=!_.isUndefined(e[u]),e=!_.isUndefined(e[t]);return r||e},isBrokerSourceActive:function(e){var r=_.isUndefined(e[t]),e=!_.isUndefined(e[u]);return r&&e}}}e.$inject=["c8yInventory","c8yBase"],angular.module("c8y.core").factory("c8yDeviceGroup",e)})();