(()=>{function e(i,e,n,s){var t,a=this,l=e.createEnum([{name:"NO_CONVERSION",label:s("No conversion"),value:""},{name:"IMPERIAL",label:s("Imperial"),value:"imperial"},{name:"METRIC",label:s("Metric"),value:"metric"}]);_.assign(a,{UNIT_TYPES:l.values(),$doCheck:function(){_.isEqual(a.user,t)||(a.loading=!0,i.current().then(function(e){var n=_.isEqual(e.userName,_.get(a,"user.userName"));_.set(a,"visible",(e=e,(i.hasRole(e,"ROLE_INVENTORY_READ")&&i.hasRole(e,"ROLE_INVENTORY_ADMIN")||i.hasRole(e,"ROLE_MANAGED_OBJECT_READ")&&i.hasRole(e,"ROLE_MANAGED_OBJECT_ADMIN"))&&n))}),n.get("unit",a.user).then(function(e){_.isUndefined(e)?_.set(a.user,"measurementUnit",l.NO_CONVERSION):_.set(a.user,"measurementUnit",_.find(l.values(),{value:e}))}).finally(function(){a.loading=!1}),t=a.user)},tooltip:s('Selected unit conversion will be used for displaying data. Select "No conversion" to see original units sent by devices.'),loading:!1})}e.$inject=["c8yUser","c8yBase","c8yUserPreferences","gettext"],angular.module("c8y.ui").component("c8yMeasurementUnitPreference",{controller:e,controllerAs:"vm",templateUrl:":::PLUGIN_PATH:::/ui/user/measurementUnitPreference.html",bindings:{user:"="}})})();