(()=>{e.$inject=["info","$window","$rootScope","c8yUser"],n.$inject=["$rootScope","$window","$q","info","c8yUser"],t.$inject=["info"];var r="_tcy8";function n(t,n,e,o,i){n=n.localStorage.getItem(r)||n.sessionStorage.getItem(r),o.token=n,!o.token||o.preventGetUser?e.reject("No token"):i.current().then(function(n){t.c8y=t.c8y||{},t.c8y.user=n,t.$emit("c8y.api.login")})}function c(n){return{getBaseUrl:function(){return n.baseUrl},getAppKey:function(){return n.appKey},getTenant:function(){return n.tenant}}}function t(t){var n={setBaseUrl:function(n){t.baseUrl=n},setAppKey:function(n){t.appKey=n},setTenant:function(n){t.tenant=n},$get:e};return _.assign(n,c(t)),n}function e(n,t,e,o){var i=c(n);function r(n){e.c8y=e.c8y||{},e.c8y.user=n}n={login:function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:i.getTenant();return o.login(n,1<arguments.length?arguments[1]:void 0,2<arguments.length?arguments[2]:void 0,3<arguments.length?arguments[3]:void 0).then(r).then(function(){e.$emit("c8y.api.login")})},logout:function(){r(null),o.logout(),e.$emit("c8y.api.logout")}};return _.assign(n,i),n}angular.module("c8y.sdk").provider("c8yCumulocity",t).run(n)})();