(()=>{function n(n){var e=window.c8y.coreFilePath("locales/angular");n.localeLocationPattern("".concat(e,"/angular-locale_{{locale}}.js"))}n.$inject=["tmhDynamicLocaleProvider"],angular.module("c8y.ui").config(n).provider("c8yLocales",function(){function n(i,l,r,n,g,e,s,a,f){var t="_",o={en:"en-gb","en-EN":"en-gb"},c={en:"en-GB","en-EN":"en-GB"},u="en-gb",m="en-GB",d="en",h=null,p="c8y_language";function S(){var n;return h||(h={},n=s.getRuntimeOption("languages"),_.forEach(n,v),_.forEach(R(),y)),h}function T(){var n=S();return _.keys(n)}function v(n){h[n]=h[n]||[]}function y(e){_.forEach(e.languages,function(n){v(n),h[n].push(e)})}function M(n){var e=T();return _.includes(e,$(n))}function E(){return(()=>{var t=[];return L()&&t.push(L()),C()&&t.push(C()),(t=t.concat(O())).length&&A(_.find(t,M)),a.get("language").then(function(n){var e;return n&&(t.unshift(n),L())&&t.unshift(L()),(t=(t=t.concat(O())).concat((n=t,e=[],_.forEach(n,function(n){n.indexOf("-")&&(n=n.split("-"),e.push(n[0]))}),e))).push(j(d)),_.find(t,M)})})().then(A)}function L(){return s.getRuntimeOption("queryStringLang")}function R(){return s.getRuntimeOption("importedPlugins")}function O(){for(var n=r.navigator,e=["languages","language","browserLanguage","systemLanguage","userLanguage"],t=[],a=0;a<e.length;a++){var o=n[e[a]];_.isArray(o)?t=t.concat(o):o&&t.push(o)}return t}function A(e){if(!e)return l.when();i.$emit("language:change");var n=_.map([N,I,F,D],function(n){return n(e)});return l.all(n)}function D(n){r.localStorage.setItem(p,n)}function C(){return r.localStorage.getItem(p)}function F(n){return e.set(P(n)).catch(angular.bind(e,e.set,P(n.split("-")[0]))).catch(angular.bind(e,e.set,u))}function P(n){return o[n]||j(n).toLowerCase()}function I(n){var n=w(n),e=moment();e.locale("en-GB").format(s.dateFullFormat)===e.locale(n).format(s.dateFullFormat)?moment.locale(n):moment.locale("en-GB")}function w(n){return c[n]||n||m}function N(n){function e(){--c||r.resolve()}var t,a,o=$(n),r=l.defer(),c=2;if(b(s.getFlag("langDebug")),f.setCurrentLanguage(o),window.C8Y_APP){if(g.has("c8yCachedLocaleDictionaryService")){var u=g.get("c8yCachedLocaleDictionaryService").cachedDictionary[n];if(u&&Object.keys(u).length)return f.setStrings(n,u),r.promise}var u=f.loadRemote((n=o,_.get(s.appOption("languages"),"".concat(n,".url"))||"".concat(n,".json")));return u.then(function(){i.$emit("language:loaded")}),u}return t=o,n=_([{rootContextPath:"c8ydata/"}].concat(R())).map("rootContextPath").map(function(n){return n.split("/")[0]}).uniq().value(),l.all(_.map(n,function(n){n=s.dataFilePath("locales/".concat(n,"/json/").concat(t,".json"));return f.loadRemote(n)})).finally(e),u=(n=>S()[n])(a=o),l.all(_.map(u,function(n){return f.loadRemote("/apps/".concat(n.rootContextPath,"/locales/").concat(a,".json"))})).finally(e),r.promise}function b(n){f.debug=n}function j(n){n=$(n).split(t);return n[0].toLowerCase()+(n[1]?"-".concat(n[1].toUpperCase()):"")}function $(n){var e=-1<n.indexOf("-")?"-":t,n=n.split(e);return n[0].toLowerCase()+(n[1]?t+n[1].toUpperCase():"")}function U(n,e){n=(n=>{var e=n;return _.isString(n)?e=f.getString(n):_.isObject(n)&&(e=(n=>_.mapValues(n,function(n){return _.isString(n)?f.getString(n):n}))(n)),e})(n);return _.assign(n,{__idx:e})}var B=l.defer(),x={initDone:B.promise,getSupportedLanguages:T,switchToDefaultLanguage:E,switchToLanguage:A,setDebugMode:b,getTranslatedArray:function(n){return _.map(n,U)},getD3Locales:function(){return d3.locale({decimal:n.NUMBER_FORMATS.DECIMAL_SEP,thousands:n.NUMBER_FORMATS.GROUP_SEP,days:n.DATETIME_FORMATS.DAY,shortDays:n.DATETIME_FORMATS.SHORTDAY,months:n.DATETIME_FORMATS.MONTH,shortMonths:n.DATETIME_FORMATS.SHORTMONTH,periods:n.DATETIME_FORMATS.AMPMS,grouping:[3],currency:[n.NUMBER_FORMATS.CURRENCY_SYM,""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S"})},getMomentLocalesLanguageString:w};return s.getFlag("skipSwitchingToDefaultLanguage")?B.resolve():E().finally(function(){B.resolve()}),x}return n.$inject=["$rootScope","$q","$window","$locale","$injector","tmhDynamicLocale","c8yBase","c8yUserPreferences","gettextCatalog"],{$get:n}})})();