(()=>{function i(e,n,t,c,d,a,o){var i=this,r=this;function l(n){return _.find(r.devices,function(i){return n===i.id})}this.init=function(){e.child.config.deviceIds||(e.child.config.deviceIds={},_.forOwn(e.child.config.mapping,function(i,n){e.child.config.deviceIds[n]=e.child.config.device.id}));var i=_(e.child.config.deviceIds).values().uniq().map(function(i){return d.detailRealtime(i,e,function(i){i.name=t("truncate")(i.name)})}).value();n.all(i).then(function(i){r.devices=i,r.updateComputedProperties(e.child.config.deviceIds,e.child.config.mapping)}),c.detail(e.child.config.binaryId).then(function(i){r.svgFile=i.data,c.downloadAsDataUri(r.svgFile).then(c.decodeDataUri).then(function(i){return new File([i],r.svgFile.name,{type:r.svgFile.type})}).then(function(i){return o.sanitizeFileByLevel(i,e.child.config.sanitization)}).then(function(i){return c.readDataUri(i)}).then(c.decodeDataUri).then(function(i){r.svgFile.data=i})})},this.updateComputedProperties=function(i,e){i&&e&&_.forOwn(i,function(i,n){n=[e[n]];n.length&&a.attach(l(i),n)})},e.$watchGroup(["child.config.binaryId","child.config.sanitization","child.config.deviceIds"],function(){return i.init()}),e.$on("$destroy",function(){var i=_.uniq(_.values(e.child.config.deviceIds));_.forEach(i,function(i){a.detach(l(i))})})}i.$inject=["$scope","$q","$filter","c8yBinary","c8yDevices","c8yComputedProperties","c8ySanitizeHtml"],angular.module("c8y.parts.scadaWidget").controller("ScadaWidgetCtrl",i)})();