(()=>{function e(t,n,e,c,o,i,a,r,s){r=r||{},t.cancel=function(){n.dismiss()},t.select=function(e){e.c8y_Report?a.named("report_".concat(e.id)).then(n.close):n.close(e)},t.config=r,t.getConfigTitle=function(){return r.title||s("Select dashboard")},t.getConfigSelectLabel=function(){return r.selectLabel||s("Add")},delete t.dashboards;var l="list",d=a.getContext(),u=[];d.context&&r.inContext&&(l="".concat("device"===d.context?"deviceType":d.context,"List")),r.onlyReports||(d=d.id&&"device"===d.context?i.detail(d.id).then(o.getResData).then(a[l]):d.id&&"list"!==l?a[l](d.id):a[l](),u.push(d));try{var h=e.get("c8yReports");(r.onlyReports||r.useReports)&&h&&u.push(h.list())}catch(e){}function f(e){t.dashboards=e}function p(e){return _.filter(e,function(e){return e.name})}c.all(u).then(_.flattenDeep).then(p).then(f)}e.$inject=["$scope","$uibModalInstance","$injector","$q","c8yBase","c8yDevices","dashboardSvc","config","gettext"],angular.module("c8y.parts.dashboard2").controller("DashboardSelectController",e)})();