{"version":3,"file":"vendors-f74eed0f.b149463909b5e91f4e75.bundle.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://app/./node_modules/aurelia-i18n/dist/native-modules/aurelia-i18n.js"],"sourcesContent":["import i18next from 'i18next';\nimport { getLogger } from 'aurelia-logging';\nimport { resolver } from 'aurelia-dependency-injection';\nimport { customAttribute, HtmlBehaviorResource, ViewResources } from 'aurelia-templating';\nimport { metadata } from 'aurelia-metadata';\nimport { DOM, PLATFORM } from 'aurelia-pal';\nimport { valueConverter } from 'aurelia-framework';\nimport { BindingSignaler, SignalBindingBehavior } from 'aurelia-templating-resources';\nimport { EventAggregator } from 'aurelia-event-aggregator';\nimport { ValueConverter, bindingBehavior, valueConverter as valueConverter$1 } from 'aurelia-binding';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\n\nvar I18N_EA_SIGNAL = \"i18n:locale:changed\";\nvar I18N = /** @class */ (function () {\n function I18N(ea, signaler) {\n this.ea = ea;\n this.signaler = signaler;\n this.globalVars = {};\n this.i18next = i18next;\n this.Intl = PLATFORM.global.Intl;\n }\n I18N.inject = function () { return [EventAggregator, BindingSignaler]; };\n I18N.prototype.setup = function (options) {\n return __awaiter(this, void 0, void 0, function () {\n var defaultOptions;\n var _this = this;\n return __generator(this, function (_a) {\n defaultOptions = {\n skipTranslationOnMissingKey: false,\n compatibilityJSON: \"v1\",\n lng: \"en\",\n attributes: [\"t\", \"i18n\"],\n fallbackLng: \"en\",\n debug: false\n };\n this.i18nextDeferred = new Promise(function (resolve, reject) {\n _this.i18next.init(options || defaultOptions, function (err) {\n if (err && !Array.isArray(err)) {\n reject(err);\n }\n // make sure attributes is an array in case a string was provided\n if (_this.i18next.options.attributes instanceof String) {\n _this.i18next.options.attributes = [_this.i18next.options.attributes];\n }\n resolve(_this.i18next);\n });\n });\n return [2 /*return*/, this.i18nextDeferred];\n });\n });\n };\n I18N.prototype.i18nextReady = function () {\n return this.i18nextDeferred;\n };\n I18N.prototype.setLocale = function (locale) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var oldLocale = _this.getLocale();\n _this.i18next.changeLanguage(locale, function (err, tr) {\n if (err) {\n reject(err);\n }\n _this.ea.publish(I18N_EA_SIGNAL, { oldValue: oldLocale, newValue: locale });\n _this.signaler.signal(\"aurelia-translation-signal\");\n resolve(tr);\n });\n });\n };\n I18N.prototype.getLocale = function () {\n return this.i18next.language;\n };\n I18N.prototype.nf = function (options, locales) {\n return new this.Intl.NumberFormat(locales || this.getLocale(), options || {});\n };\n I18N.prototype.uf = function (numberLike, locale) {\n var nf = this.nf({}, locale || this.getLocale());\n var comparer = nf.format(10000 / 3);\n var thousandSeparator = comparer[1];\n var decimalSeparator = comparer[5];\n if (thousandSeparator === \".\") {\n thousandSeparator = \"\\\\.\";\n }\n // remove all thousand seperators\n var result = numberLike.replace(new RegExp(thousandSeparator, \"g\"), \"\")\n // remove non-numeric signs except -> , .\n .replace(/[^\\d.,-]/g, \"\")\n // replace original decimalSeparator with english one\n .replace(decimalSeparator, \".\");\n // return real number\n return Number(result);\n };\n I18N.prototype.df = function (options, locales) {\n return new this.Intl.DateTimeFormat(locales || this.getLocale(), options);\n };\n I18N.prototype.tr = function (key, options) {\n var fullOptions = this.globalVars;\n if (options !== undefined) {\n fullOptions = Object.assign(Object.assign({}, this.globalVars), options);\n }\n return this.i18next.t(key, fullOptions);\n };\n I18N.prototype.registerGlobalVariable = function (key, value) {\n this.globalVars[key] = value;\n };\n I18N.prototype.unregisterGlobalVariable = function (key) {\n delete this.globalVars[key];\n };\n /**\n * Scans an element for children that have a translation attribute and\n * updates their innerHTML with the current translation values.\n *\n * If an image is encountered the translated value will be applied to the src attribute.\n *\n * @param el HTMLElement to search within\n */\n I18N.prototype.updateTranslations = function (el) {\n if (!el || !el.querySelectorAll) {\n return;\n }\n var i;\n var l;\n // create a selector from the specified attributes to look for\n // var selector = [].concat(this.i18next.options.attributes);\n var attributes = this.i18next.options.attributes;\n var selector = [].concat(attributes);\n for (i = 0, l = selector.length; i < l; i++) {\n selector[i] = \"[\" + selector[i] + \"]\";\n }\n selector = selector.join(\",\");\n // get the nodes\n var nodes = el.querySelectorAll(selector);\n for (i = 0, l = nodes.length; i < l; i++) {\n var node = nodes[i];\n var keys = void 0;\n var params = void 0;\n // test every attribute and get the first one that has a value\n for (var i2 = 0, l2 = attributes.length; i2 < l2; i2++) {\n keys = node.getAttribute(attributes[i2]);\n var pname = attributes[i2] + \"-params\";\n if (pname && node.au && node.au[pname]) {\n params = node.au[pname].viewModel.value;\n }\n if (keys) {\n break;\n }\n }\n // skip if nothing was found\n if (!keys) {\n continue;\n }\n // split the keys into multiple keys separated by a ;\n this.updateValue(node, keys, params);\n }\n };\n I18N.prototype.updateValue = function (node, value, params) {\n if (value === null || value === undefined) {\n value = \"\";\n }\n var keys = value.toString().split(\";\");\n var i = keys.length;\n while (i--) {\n var key = keys[i];\n // remove the optional attribute\n var re = /\\[([a-z\\-, ]*)\\]/ig;\n var m = void 0;\n var attr = \"text\";\n // set default attribute to src if this is an image node\n if (node.nodeName === \"IMG\") {\n attr = \"src\";\n }\n // check if a attribute was specified in the key\n // tslint:disable-next-line:no-conditional-assignment\n while ((m = re.exec(key)) !== null) {\n if (m.index === re.lastIndex) {\n re.lastIndex++;\n }\n if (m) {\n key = key.replace(m[0], \"\");\n attr = m[1];\n }\n }\n var attrs = attr.split(\",\");\n var j = attrs.length;\n while (j--) {\n attr = attrs[j].trim();\n if (!node._textContent) {\n node._textContent = node.textContent;\n }\n if (!node._innerHTML) {\n node._innerHTML = node.innerHTML;\n }\n // convert to camelCase\n // tslint:disable-next-line:only-arrow-functions\n var attrCC = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });\n var reservedNames = [\"prepend\", \"append\", \"text\", \"html\"];\n var i18nLogger = getLogger(\"i18n\");\n if (reservedNames.indexOf(attr) > -1 &&\n node.au &&\n node.au.controller &&\n node.au.controller.viewModel &&\n attrCC in node.au.controller.viewModel) {\n i18nLogger.warn(\"Aurelia I18N reserved attribute name\\n\\n [\" + reservedNames.join(\", \") + \"]\\n\\n Your custom element has a bindable named \" + attr + \" which is a reserved word.\\n\\n If you'd like Aurelia I18N to translate your bindable instead, please consider giving it another name.\");\n }\n if (this.i18next.options.skipTranslationOnMissingKey &&\n this.tr(key, params) === key) {\n i18nLogger.warn(\"Couldn't find translation for key: \" + key);\n return;\n }\n // handle various attributes\n // anything other than text,prepend,append or html will be added as an attribute on the element.\n switch (attr) {\n case \"text\":\n var newChild = DOM.createTextNode(this.tr(key, params));\n if (node._newChild && node._newChild.parentNode === node) {\n node.removeChild(node._newChild);\n }\n node._newChild = newChild;\n while (node.firstChild) {\n node.removeChild(node.firstChild);\n }\n node.appendChild(node._newChild);\n break;\n case \"prepend\":\n var prependParser = DOM.createElement(\"div\");\n prependParser.innerHTML = this.tr(key, params);\n for (var ni = node.childNodes.length - 1; ni >= 0; ni--) {\n if (node.childNodes[ni]._prepended) {\n node.removeChild(node.childNodes[ni]);\n }\n }\n for (var pi = prependParser.childNodes.length - 1; pi >= 0; pi--) {\n prependParser.childNodes[pi]._prepended = true;\n if (node.firstChild) {\n node.insertBefore(prependParser.childNodes[pi], node.firstChild);\n }\n else {\n node.appendChild(prependParser.childNodes[pi]);\n }\n }\n break;\n case \"append\":\n var appendParser = DOM.createElement(\"div\");\n appendParser.innerHTML = this.tr(key, params);\n for (var ni = node.childNodes.length - 1; ni >= 0; ni--) {\n if (node.childNodes[ni]._appended) {\n node.removeChild(node.childNodes[ni]);\n }\n }\n while (appendParser.firstChild) {\n appendParser.firstChild._appended = true;\n node.appendChild(appendParser.firstChild);\n }\n break;\n case \"html\":\n node.innerHTML = this.tr(key, params);\n break;\n default: // normal html attribute\n if (node.au &&\n node.au.controller &&\n node.au.controller.viewModel &&\n attrCC in node.au.controller.viewModel) {\n node.au.controller.viewModel[attrCC] = this.tr(key, params);\n }\n else {\n node.setAttribute(attr, this.tr(key, params));\n }\n break;\n }\n }\n }\n };\n return I18N;\n}());\n\nvar TBindingBehavior = /** @class */ (function () {\n function TBindingBehavior(signalBindingBehavior) {\n this.signalBindingBehavior = signalBindingBehavior;\n }\n TBindingBehavior.inject = function () { return [SignalBindingBehavior]; };\n TBindingBehavior.prototype.bind = function (binding, source) {\n // bind the signal behavior\n this.signalBindingBehavior.bind(binding, source, \"aurelia-translation-signal\");\n // rewrite the expression to use the TValueConverter.\n // pass through any args to the binding behavior to the TValueConverter\n var sourceExpression = binding.sourceExpression;\n // do create the sourceExpression only once\n if (sourceExpression.rewritten) {\n return;\n }\n sourceExpression.rewritten = true;\n var expression = sourceExpression.expression;\n sourceExpression.expression = new ValueConverter(expression, \"t\", sourceExpression.args, [expression].concat(sourceExpression.args));\n };\n TBindingBehavior.prototype.unbind = function (binding, source) {\n // unbind the signal behavior\n this.signalBindingBehavior.unbind(binding, source);\n };\n TBindingBehavior = __decorate([\n bindingBehavior(\"t\")\n ], TBindingBehavior);\n return TBindingBehavior;\n}());\n\n// tslint:disable-next-line:only-arrow-functions\nvar isInteger = Number.isInteger || function (value) {\n return typeof value === \"number\" &&\n isFinite(value) &&\n Math.floor(value) === value;\n};\nvar LazyOptional = /** @class */ (function () {\n function LazyOptional(key) {\n this.key = key;\n }\n LazyOptional_1 = LazyOptional;\n LazyOptional.of = function (key) {\n return new LazyOptional_1(key);\n };\n LazyOptional.prototype.get = function (container) {\n var _this = this;\n return function () {\n if (container.hasResolver(_this.key, false)) {\n return container.get(_this.key);\n }\n return null;\n };\n };\n var LazyOptional_1;\n LazyOptional = LazyOptional_1 = __decorate([\n resolver()\n ], LazyOptional);\n return LazyOptional;\n}());\n\nvar TParamsCustomAttribute = /** @class */ (function () {\n function TParamsCustomAttribute(element) {\n this.element = element;\n }\n TParamsCustomAttribute_1 = TParamsCustomAttribute;\n TParamsCustomAttribute.inject = function () {\n return [DOM.Element];\n };\n TParamsCustomAttribute.configureAliases = function (aliases) {\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TParamsCustomAttribute_1);\n r.aliases = aliases;\n };\n TParamsCustomAttribute.prototype.valueChanged = function () { };\n var TParamsCustomAttribute_1;\n TParamsCustomAttribute = TParamsCustomAttribute_1 = __decorate([\n customAttribute(\"t-params\")\n ], TParamsCustomAttribute);\n return TParamsCustomAttribute;\n}());\n\nvar TCustomAttribute = /** @class */ (function () {\n function TCustomAttribute(element, service, ea, p) {\n this.element = element;\n this.service = service;\n this.ea = ea;\n this.lazyParams = p;\n }\n TCustomAttribute_1 = TCustomAttribute;\n TCustomAttribute.inject = function () {\n return [DOM.Element, I18N, EventAggregator, LazyOptional.of(TParamsCustomAttribute)];\n };\n TCustomAttribute.configureAliases = function (aliases) {\n var r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, TCustomAttribute_1);\n r.aliases = aliases;\n };\n TCustomAttribute.prototype.bind = function () {\n var _this = this;\n this.params = this.lazyParams();\n if (this.params) {\n this.params.valueChanged = function (newParams, oldParams) {\n _this.paramsChanged(_this.value, newParams, oldParams);\n };\n }\n var p = this.params !== null ? this.params.value : undefined;\n this.subscription = this.ea.subscribe(I18N_EA_SIGNAL, function () {\n _this.service.updateValue(_this.element, _this.value, _this.params !== null ? _this.params.value : undefined);\n });\n this.service.updateValue(this.element, this.value, p);\n };\n TCustomAttribute.prototype.paramsChanged = function (newValue, newParams) {\n this.service.updateValue(this.element, newValue, newParams);\n };\n TCustomAttribute.prototype.valueChanged = function (newValue) {\n var p = this.params !== null ? this.params.value : undefined;\n this.service.updateValue(this.element, newValue, p);\n };\n TCustomAttribute.prototype.unbind = function () {\n // If unbind is called before timeout for subscription is triggered, subscription will be undefined\n if (this.subscription) {\n this.subscription.dispose();\n }\n };\n var TCustomAttribute_1;\n TCustomAttribute = TCustomAttribute_1 = __decorate([\n customAttribute(\"t\")\n ], TCustomAttribute);\n return TCustomAttribute;\n}());\n\nvar TValueConverter = /** @class */ (function () {\n function TValueConverter(service) {\n this.service = service;\n }\n TValueConverter.inject = function () { return [I18N]; };\n TValueConverter.prototype.toView = function (value, options) {\n return this.service.tr(value, options);\n };\n TValueConverter = __decorate([\n valueConverter(\"t\")\n ], TValueConverter);\n return TValueConverter;\n}());\n\nvar NfBindingBehavior = /** @class */ (function () {\n function NfBindingBehavior(signalBindingBehavior) {\n this.signalBindingBehavior = signalBindingBehavior;\n }\n NfBindingBehavior.inject = function () { return [SignalBindingBehavior]; };\n NfBindingBehavior.prototype.bind = function (binding, source) {\n // bind the signal behavior\n this.signalBindingBehavior.bind(binding, source, \"aurelia-translation-signal\");\n // rewrite the expression to use the NfValueConverter.\n // pass through any args to the binding behavior to the NfValueConverter\n var sourceExpression = binding.sourceExpression;\n // do create the sourceExpression only once\n if (sourceExpression.rewritten) {\n return;\n }\n sourceExpression.rewritten = true;\n var expression = sourceExpression.expression;\n sourceExpression.expression = new ValueConverter(expression, \"nf\", sourceExpression.args, [expression].concat(sourceExpression.args));\n };\n NfBindingBehavior.prototype.unbind = function (binding, source) {\n // unbind the signal behavior\n this.signalBindingBehavior.unbind(binding, source);\n };\n NfBindingBehavior = __decorate([\n bindingBehavior(\"nf\")\n ], NfBindingBehavior);\n return NfBindingBehavior;\n}());\n\nvar NfValueConverter = /** @class */ (function () {\n function NfValueConverter(service) {\n this.service = service;\n }\n NfValueConverter.inject = function () { return [I18N]; };\n NfValueConverter.prototype.toView = function (value, nfOrOptions, locale) {\n if (value === null\n || typeof value === \"undefined\"\n || (typeof value === \"string\" && value.trim() === \"\")) {\n return value;\n }\n if (nfOrOptions && (nfOrOptions instanceof Intl.NumberFormat && typeof nfOrOptions.format === \"function\")) {\n return nfOrOptions.format(value);\n }\n var nf = this.service.nf(nfOrOptions, locale || this.service.getLocale());\n return nf.format(value);\n };\n NfValueConverter = __decorate([\n valueConverter$1(\"nf\")\n ], NfValueConverter);\n return NfValueConverter;\n}());\n\nvar DfBindingBehavior = /** @class */ (function () {\n function DfBindingBehavior(signalBindingBehavior) {\n this.signalBindingBehavior = signalBindingBehavior;\n }\n DfBindingBehavior.inject = function () { return [SignalBindingBehavior]; };\n DfBindingBehavior.prototype.bind = function (binding, source) {\n // bind the signal behavior\n this.signalBindingBehavior.bind(binding, source, \"aurelia-translation-signal\");\n // rewrite the expression to use the DfValueConverter.\n // pass through any args to the binding behavior to the DfValueConverter\n var sourceExpression = binding.sourceExpression;\n // do create the sourceExpression only once\n if (sourceExpression.rewritten) {\n return;\n }\n sourceExpression.rewritten = true;\n var expression = sourceExpression.expression;\n sourceExpression.expression = new ValueConverter(expression, \"df\", sourceExpression.args, [expression].concat(sourceExpression.args));\n };\n DfBindingBehavior.prototype.unbind = function (binding, source) {\n // unbind the signal behavior\n this.signalBindingBehavior.unbind(binding, source);\n };\n DfBindingBehavior = __decorate([\n bindingBehavior(\"df\")\n ], DfBindingBehavior);\n return DfBindingBehavior;\n}());\n\nvar DfValueConverter = /** @class */ (function () {\n function DfValueConverter(service) {\n this.service = service;\n }\n DfValueConverter.inject = function () { return [I18N]; };\n DfValueConverter.prototype.toView = function (value, dfOrOptions, locale) {\n if (value === null\n || typeof value === \"undefined\"\n || (typeof value === \"string\" && value.trim() === \"\")) {\n return value;\n }\n if (typeof value === \"string\" && isNaN(value) && !isInteger(value)) {\n value = new Date(value);\n }\n if (dfOrOptions && (dfOrOptions instanceof Intl.DateTimeFormat && typeof dfOrOptions.format === \"function\")) {\n return dfOrOptions.format(value);\n }\n var df = this.service.df(dfOrOptions, locale || this.service.getLocale());\n return df.format(value);\n };\n DfValueConverter = __decorate([\n valueConverter$1(\"df\")\n ], DfValueConverter);\n return DfValueConverter;\n}());\n\nvar RtBindingBehavior = /** @class */ (function () {\n function RtBindingBehavior(signalBindingBehavior) {\n this.signalBindingBehavior = signalBindingBehavior;\n }\n RtBindingBehavior.inject = function () { return [SignalBindingBehavior]; };\n RtBindingBehavior.prototype.bind = function (binding, source) {\n // bind the signal behavior\n this.signalBindingBehavior.bind(binding, source, \"aurelia-translation-signal\", \"aurelia-relativetime-signal\");\n // rewrite the expression to use the RtValueConverter.\n // pass through any args to the binding behavior to the RtValueConverter\n var sourceExpression = binding.sourceExpression;\n // do create the sourceExpression only once\n if (sourceExpression.rewritten) {\n return;\n }\n sourceExpression.rewritten = true;\n var expression = sourceExpression.expression;\n sourceExpression.expression = new ValueConverter(expression, \"rt\", sourceExpression.args, [expression].concat(sourceExpression.args));\n };\n RtBindingBehavior.prototype.unbind = function (binding, source) {\n // unbind the signal behavior\n this.signalBindingBehavior.unbind(binding, source);\n };\n RtBindingBehavior = __decorate([\n bindingBehavior(\"rt\")\n ], RtBindingBehavior);\n return RtBindingBehavior;\n}());\n\nvar translations = {\n ar: {\n translation: {\n now: 'الآن',\n second_ago: 'قبل ثانية واØدة',\n second_ago_plural: 'قبل __count__ ثانية',\n second_in: 'خلال ثانية واØدة',\n second_in_plural: 'خلال __count__ ثانية',\n minute_ago: 'قبل دقيقة واØدة',\n minute_ago_plural: 'قبل __count__ دقيقة',\n minute_in: 'خلال دقيقة واØدة',\n minute_in_plural: 'خلال __count__ دقيقة',\n hour_ago: 'قبل ساعة واØدة',\n hour_ago_plural: 'قبل __count__ ساعة',\n hour_in: 'خلال ساعة واØدة',\n hour_in_plural: 'خلال __count__ ساعة',\n day_ago: 'قبل يوم واØد',\n day_ago_plural: 'قبل __count__ يومًا',\n day_in: 'خلال يوم واØد',\n day_in_plural: 'خلال __count__ يومًا',\n month_ago: 'قبل شهر واØد',\n month_ago_plural: 'قبل __count__ شهرًا',\n month_in: 'خلال شهر واØد',\n month_in_plural: 'خلال __count__ شهرًا',\n year_ago: 'قبل سنة واØدة',\n year_ago_plural: 'قبل __count__ سنة',\n year_in: 'خلال سنة واØدة',\n year_in_plural: 'خلال __count__ سنة'\n }\n },\n da: {\n translation: {\n now: 'nu',\n second_ago: 'for __count__ sekund siden',\n second_ago_plural: 'for __count__ sekunder siden',\n second_in: 'om __count__ sekund',\n second_in_plural: 'om __count__ sekunder',\n minute_ago: 'for __count__ minut siden',\n minute_ago_plural: 'for __count__ minutter siden',\n minute_in: 'om __count__ minut',\n minute_in_plural: 'om __count__ minutter',\n hour_ago: 'for __count__ time siden',\n hour_ago_plural: 'for __count__ timer siden',\n hour_in: 'om __count__ time',\n hour_in_plural: 'om __count__ timer',\n day_ago: 'for __count__ dag siden',\n day_ago_plural: 'for __count__ dage siden',\n day_in: 'om __count__ dag',\n day_in_plural: 'om __count__ dage',\n month_ago: 'for __count__ mÃ¥ned siden',\n month_ago_plural: 'for __count__ mÃ¥neder siden',\n month_in: 'om __count__ mÃ¥ned',\n month_in_plural: 'om __count__ mÃ¥neder',\n year_ago: 'for __count__ Ã¥r siden',\n year_ago_plural: 'for __count__ Ã¥r siden',\n year_in: 'om __count__ Ã¥r',\n year_in_plural: 'om __count__ Ã¥r'\n }\n },\n de: {\n translation: {\n now: 'jetzt',\n second_ago: 'vor __count__ Sekunde',\n second_ago_plural: 'vor __count__ Sekunden',\n second_in: 'in __count__ Sekunde',\n second_in_plural: 'in __count__ Sekunden',\n minute_ago: 'vor __count__ Minute',\n minute_ago_plural: 'vor __count__ Minuten',\n minute_in: 'in __count__ Minute',\n minute_in_plural: 'in __count__ Minuten',\n hour_ago: 'vor __count__ Stunde',\n hour_ago_plural: 'vor __count__ Stunden',\n hour_in: 'in __count__ Stunde',\n hour_in_plural: 'in __count__ Stunden',\n day_ago: 'vor __count__ Tag',\n day_ago_plural: 'vor __count__ Tagen',\n day_in: 'in __count__ Tag',\n day_in_plural: 'in __count__ Tagen',\n month_ago: 'vor __count__ Monat',\n month_ago_plural: 'vor __count__ Monaten',\n month_in: 'in __count__ Monat',\n month_in_plural: 'in __count__ Monaten',\n year_ago: 'vor __count__ Jahr',\n year_ago_plural: 'vor __count__ Jahren',\n year_in: 'in __count__ Jahr',\n year_in_plural: 'in __count__ Jahren'\n }\n },\n en: {\n translation: {\n now: 'now',\n second_ago: '__count__ second ago',\n second_ago_plural: '__count__ seconds ago',\n second_in: 'in __count__ second',\n second_in_plural: 'in __count__ seconds',\n minute_ago: '__count__ minute ago',\n minute_ago_plural: '__count__ minutes ago',\n minute_in: 'in __count__ minute',\n minute_in_plural: 'in __count__ minutes',\n hour_ago: '__count__ hour ago',\n hour_ago_plural: '__count__ hours ago',\n hour_in: 'in __count__ hour',\n hour_in_plural: 'in __count__ hours',\n day_ago: '__count__ day ago',\n day_ago_plural: '__count__ days ago',\n day_in: 'in __count__ day',\n day_in_plural: 'in __count__ days',\n month_ago: '__count__ month ago',\n month_ago_plural: '__count__ months ago',\n month_in: 'in __count__ month',\n month_in_plural: 'in __count__ months',\n year_ago: '__count__ year ago',\n year_ago_plural: '__count__ years ago',\n year_in: 'in __count__ year',\n year_in_plural: 'in __count__ years'\n }\n },\n es: {\n translation: {\n now: 'ahora',\n second_ago: 'hace __count__ segundo',\n second_ago_plural: 'hace __count__ segundos',\n second_in: 'dentro de __count__ segundo',\n second_in_plural: 'dentro de __count__ segundos',\n minute_ago: 'hace __count__ minuto',\n minute_ago_plural: 'hace __count__ minutos',\n minute_in: 'dentro de __count__ minuto',\n minute_in_plural: 'dentro de __count__ minutos',\n hour_ago: 'hace __count__ hora',\n hour_ago_plural: 'hace __count__ horas',\n hour_in: 'dentro de __count__ hora',\n hour_in_plural: 'dentro de __count__ horas',\n day_ago: 'hace __count__ dÃa',\n day_ago_plural: 'hace __count__ dÃas',\n day_in: 'dentro de __count__ dÃa',\n day_in_plural: 'dentro de __count__ dÃas',\n month_ago: 'hace __count__ mes',\n month_ago_plural: 'hace __count__ meses',\n month_in: 'dentro de __count__ mes',\n month_in_plural: 'dentro de __count__ meses',\n year_ago: 'hace __count__ año',\n year_ago_plural: 'hace __count__ años',\n year_in: 'dentro de __count__ año',\n year_in_plural: 'dentro de __count__ años'\n }\n },\n fi: {\n translation: {\n now: 'nyt',\n second_ago: '__count__ sekunti sitten',\n second_ago_plural: '__count__ sekuntia sitten',\n second_in: '__count__ sekunnin päästä',\n second_in_plural: '__count__ sekunnin päästä',\n minute_ago: '__count__ minuutti sitten',\n minute_ago_plural: '__count__ minuuttia sitten',\n minute_in: '__count__ minuutin päästä',\n minute_in_plural: '__count__ minuutin päästä',\n hour_ago: '__count__ tunti sitten',\n hour_ago_plural: '__count__ tuntia sitten',\n hour_in: '__count__ tunnin päästä',\n hour_in_plural: '__count__ tunnin päästä',\n day_ago: '__count__ päivä sitten',\n day_ago_plural: '__count__ päivää sitten',\n day_in: '__count__ päivän päästä',\n day_in_plural: '__count__ päivän päästä',\n month_ago: '__count__ kuukausi sitten',\n month_ago_plural: '__count__ kuukautta sitten',\n month_in: '__count__ kuukauden päästä',\n month_in_plural: '__count__ kuukauden päästä',\n year_ago: '__count__ vuosi sitten',\n year_ago_plural: '__count__ vuotta sitten',\n year_in: '__count__ vuoden päästä',\n year_in_plural: '__count__ vuoden päästä'\n }\n },\n fr: {\n translation: {\n now: 'maintenant',\n second_ago: 'il y a __count__ seconde',\n second_ago_plural: 'il y a __count__ secondes',\n second_in: 'dans __count__ seconde',\n second_in_plural: 'dans __count__ secondes',\n minute_ago: 'il y a __count__ minute',\n minute_ago_plural: 'il y a __count__ minutes',\n minute_in: 'dans __count__ minute',\n minute_in_plural: 'dans __count__ minutes',\n hour_ago: 'il y a __count__ heure',\n hour_ago_plural: 'il y a __count__ heures',\n hour_in: 'dans __count__ heure',\n hour_in_plural: 'dans __count__ heures',\n day_ago: 'il y a __count__ jour',\n day_ago_plural: 'il y a __count__ jours',\n day_in: 'dans __count__ jour',\n day_in_plural: 'dans __count__ jours',\n month_ago: 'il y a __count__ mois',\n month_ago_plural: 'il y a __count__ mois',\n month_in: 'dans __count__ mois',\n month_in_plural: 'dans __count__ mois',\n year_ago: 'il y a __count__ an',\n year_ago_plural: 'il y a __count__ ans',\n year_in: 'dans __count__ an',\n year_in_plural: 'dans __count__ ans'\n }\n },\n it: {\n translation: {\n now: 'ora',\n second_ago: '__count__ secondo fa',\n second_ago_plural: '__count__ secondi fa',\n second_in: 'tra __count__ secondo',\n second_in_plural: 'tra __count__ secondi',\n minute_ago: '__count__ minuto fa',\n minute_ago_plural: '__count__ minuti fa',\n minute_in: 'tra __count__ minuto',\n minute_in_plural: 'tra __count__ minuti',\n hour_ago: '__count__ ora fa',\n hour_ago_plural: '__count__ ore fa',\n hour_in: 'tra __count__ ora',\n hour_in_plural: 'tra __count__ ore',\n day_ago: '__count__ giorno fa',\n day_ago_plural: '__count__ giorni fa',\n day_in: 'tra __count__ giorno',\n day_in_plural: 'tra __count__ giorni',\n month_ago: '__count__ mese fa',\n month_ago_plural: '__count__ mesi fa',\n month_in: 'tra __count__ mese',\n month_in_plural: 'tra __count__ mesi',\n year_ago: '__count__ anno fa',\n year_ago_plural: '__count__ anni fa',\n year_in: 'tra __count__ anno',\n year_in_plural: 'tra __count__ anni'\n }\n },\n ja: {\n translation: {\n now: '今',\n second_ago: '__count__ 秒å‰',\n second_ago_plural: '__count__ 秒å‰',\n second_in: '__count__ 秒後',\n second_in_plural: '__count__ 秒後',\n minute_ago: '__count__ 分å‰',\n minute_ago_plural: '__count__ 分å‰',\n minute_in: '__count__ 分後',\n minute_in_plural: '__count__ 分後',\n hour_ago: '__count__ 時間å‰',\n hour_ago_plural: '__count__ 時間å‰',\n hour_in: '__count__ 時間後',\n hour_in_plural: '__count__ 時間後',\n day_ago: '__count__ æ—¥å‰',\n day_ago_plural: '__count__ æ—¥å‰',\n day_in: '__count__ 日後',\n day_in_plural: '__count__ 日後',\n month_ago: '__count__ ã‹æœˆå‰',\n month_ago_plural: '__count__ ã‹æœˆå‰',\n month_in: '__count__ ã‹æœˆå¾Œ',\n month_in_plural: '__count__ ã‹æœˆå¾Œ',\n year_ago: '__count__ å¹´å‰',\n year_ago_plural: '__count__ å¹´å‰',\n year_in: '__count__ 年後',\n year_in_plural: '__count__ 年後'\n }\n },\n lt: {\n translation: {\n now: 'dabar',\n second_ago: 'prieÅ¡ __count__ sekundÄ™',\n second_ago_plural: 'prieÅ¡ __count__ sekundes',\n second_in: 'po __count__ sekundÄ—s',\n second_in_plural: 'po __count__ sekundžių',\n minute_ago: 'prieÅ¡ __count__ minutÄ™',\n minute_ago_plural: 'prieÅ¡ __count__ minutes',\n minute_in: 'po __count__ minutÄ—s',\n minute_in_plural: 'po __count__ minuÄių',\n hour_ago: 'prieÅ¡ __count__ valandÄ…',\n hour_ago_plural: 'prieÅ¡ __count__ valandas',\n hour_in: 'po __count__ valandos',\n hour_in_plural: 'po __count__ valandų',\n day_ago: 'prieÅ¡ __count__ dienÄ…',\n day_ago_plural: 'prieÅ¡ __count__ dienas',\n day_in: 'po __count__ dienos',\n day_in_plural: 'po __count__ dienų',\n month_ago: 'prieÅ¡ __count__ mÄ—nesį',\n month_ago_plural: 'prieÅ¡ __count__ mÄ—nesius',\n month_in: 'po __count__ mÄ—nesio',\n month_in_plural: 'po __count__ mÄ—nesių',\n year_ago: 'prieÅ¡ __count__ metus',\n year_ago_plural: 'prieÅ¡ __count__ metus',\n year_in: 'po __count__ metų',\n year_in_plural: 'po __count__ metų'\n }\n },\n nl: {\n translation: {\n now: 'nu',\n second_ago: '__count__ seconde geleden',\n second_ago_plural: '__count__ seconden geleden',\n second_in: 'over __count__ seconde',\n second_in_plural: 'over __count__ seconden',\n minute_ago: '__count__ minuut geleden',\n minute_ago_plural: '__count__ minuten geleden',\n minute_in: 'over __count__ minuut',\n minute_in_plural: 'over __count__ minuten',\n hour_ago: '__count__ uur geleden',\n hour_ago_plural: '__count__ uur geleden',\n hour_in: 'over __count__ uur',\n hour_in_plural: 'over __count__ uur',\n day_ago: '__count__ dag geleden',\n day_ago_plural: '__count__ dagen geleden',\n day_in: 'over __count__ dag',\n day_in_plural: 'over __count__ dagen',\n month_ago: '__count__ maand geleden',\n month_ago_plural: '__count__ maanden geleden',\n month_in: 'over __count__ maand',\n month_in_plural: 'over __count__ maanden',\n year_ago: '__count__ jaar geleden',\n year_ago_plural: '__count__ jaar geleden',\n year_in: 'over __count__ jaar',\n year_in_plural: 'over __count__ jaar'\n }\n },\n nn: {\n translation: {\n now: 'no',\n second_ago: 'for __count__ sekund sidan',\n second_ago_plural: 'for __count__ sekund sidan',\n second_in: 'om __count__ sekund',\n second_in_plural: 'om __count__ sekund',\n minute_ago: 'for __count__ minutt sidan',\n minute_ago_plural: 'for __count__ minutt sidan',\n minute_in: 'om __count__ minutt',\n minute_in_plural: 'om __count__ minutt',\n hour_ago: 'for __count__ time sidan',\n hour_ago_plural: 'for __count__ timar sidan',\n hour_in: 'om __count__ time',\n hour_in_plural: 'om __count__ timar',\n day_ago: 'for __count__ døgn sidan',\n day_ago_plural: 'for __count__ døgn sidan',\n day_in: 'om __count__ døgn',\n day_in_plural: 'om __count__ døgn',\n month_ago: 'for __count__ mÃ¥nad sidan',\n month_ago_plural: 'for __count__ mÃ¥nadar sidan',\n month_in: 'om __count__ mÃ¥nad',\n month_in_plural: 'om __count__ mÃ¥nadar',\n year_ago: 'for __count__ Ã¥r sidan',\n year_ago_plural: 'for __count__ Ã¥r sidan',\n year_in: 'om __count__ Ã¥r',\n year_in_plural: 'om __count__ Ã¥r'\n }\n },\n nb: {\n translation: {\n now: 'nÃ¥',\n second_ago: 'for __count__ sekund siden',\n second_ago_plural: 'for __count__ sekunder siden',\n second_in: 'om __count__ sekund',\n second_in_plural: 'om __count__ sekunder',\n minute_ago: 'for __count__ minutt siden',\n minute_ago_plural: 'for __count__ minutter siden',\n minute_in: 'om __count__ minutt',\n minute_in_plural: 'om __count__ minutter',\n hour_ago: 'for __count__ time siden',\n hour_ago_plural: 'for __count__ timer siden',\n hour_in: 'om __count__ time',\n hour_in_plural: 'om __count__ timer',\n day_ago: 'for __count__ døgn siden',\n day_ago_plural: 'for __count__ døgn siden',\n day_in: 'om __count__ døgn',\n day_in_plural: 'om __count__ døgn',\n month_ago: 'for __count__ mÃ¥ned siden',\n month_ago_plural: 'for __count__ mÃ¥neder siden',\n month_in: 'om __count__ mÃ¥ned',\n month_in_plural: 'om __count__ mÃ¥neder',\n year_ago: 'for __count__ Ã¥r siden',\n year_ago_plural: 'for __count__ Ã¥r siden',\n year_in: 'om __count__ Ã¥r',\n year_in_plural: 'om __count__ Ã¥r'\n }\n },\n pl: {\n translation: {\n now: 'teraz',\n second_ago: '__count__ sekundÄ™ temu',\n second_ago_plural: '__count__ sekundy temu',\n second_in: 'za __count__ sekundÄ™',\n second_in_plural: 'za __count__ sekundy',\n minute_ago: '__count__ minutÄ™ temu',\n minute_ago_plural: '__count__ minuty temu',\n minute_in: 'za __count__ minutÄ™',\n minute_in_plural: 'za __count__ minuty',\n hour_ago: '__count__ godzinÄ™ temu',\n hour_ago_plural: '__count__ godziny temu',\n hour_in: 'za __count__ godzinÄ™',\n hour_in_plural: 'za __count__ godziny',\n day_ago: '__count__ dzieÅ„ temu',\n day_ago_plural: '__count__ dni temu',\n day_in: 'za __count__ dzieÅ„',\n day_in_plural: 'za __count__ dni',\n month_ago: '__count__ miesiÄ…c temu',\n month_ago_plural: '__count__ miesiÄ…ce temu',\n month_in: 'za __count__ miesiÄ…c',\n month_in_plural: 'za __count__ miesiÄ…ce',\n year_ago: '__count__ rok temu',\n year_ago_plural: '__count__ lata temu',\n year_in: 'za __count__ rok',\n year_in_plural: 'za __count__ lata'\n }\n },\n pt: {\n translation: {\n now: 'agora',\n second_ago: 'há __count__ segundo',\n second_ago_plural: 'há __count__ segundos',\n second_in: 'em __count__ segundo',\n second_in_plural: 'em __count__ segundos',\n minute_ago: 'há __count__ minuto',\n minute_ago_plural: 'há __count__ minutos',\n minute_in: 'em __count__ minuto',\n minute_in_plural: 'em __count__ minutos',\n hour_ago: 'há __count__ hora',\n hour_ago_plural: 'há __count__ horas',\n hour_in: 'em __count__ hora',\n hour_in_plural: 'em __count__ horas',\n day_ago: 'há __count__ dia',\n day_ago_plural: 'há __count__ dias',\n day_in: 'em __count__ dia',\n day_in_plural: 'em __count__ dias',\n month_ago: 'há __count__ mês',\n month_ago_plural: 'há __count__ meses',\n month_in: 'em __count__ mês',\n month_in_plural: 'em __count__ meses',\n year_ago: 'há __count__ ano',\n year_ago_plural: 'há __count__ anos',\n year_in: 'em __count__ ano',\n year_in_plural: 'em __count__ anos'\n }\n },\n sv: {\n translation: {\n now: 'nu',\n second_ago: 'för __count__ sekund sedan',\n second_ago_plural: 'för __count__ sekunder sedan',\n second_in: 'om __count__ sekund',\n second_in_plural: 'om __count__ sekunder',\n minute_ago: 'för __count__ minut sedan',\n minute_ago_plural: 'för __count__ minuter sedan',\n minute_in: 'om __count__ minut',\n minute_in_plural: 'om __count__ minuter',\n hour_ago: 'för __count__ timme sedan',\n hour_ago_plural: 'för __count__ timmar sedan',\n hour_in: 'om __count__ timme',\n hour_in_plural: 'om __count__ timmar',\n day_ago: 'för __count__ dag sedan',\n day_ago_plural: 'för __count__ dagar sedan',\n day_in: 'om __count__ dag',\n day_in_plural: 'om __count__ dagar',\n month_ago: 'för __count__ mÃ¥nad sedan',\n month_ago_plural: 'för __count__ mÃ¥nader sedan',\n month_in: 'om __count__ mÃ¥nad',\n month_in_plural: 'om __count__ mÃ¥nader',\n year_ago: 'för __count__ Ã¥r sedan',\n year_ago_plural: 'för __count__ Ã¥r sedan',\n year_in: 'om __count__ Ã¥r',\n year_in_plural: 'om __count__ Ã¥r'\n }\n },\n th: {\n translation: {\n now: 'ขณะนี้',\n second_ago: '__count__ วินาทีที่ผ่านมา',\n second_ago_plural: '__count__ วินาทีที่ผ่านมา',\n second_in: 'ในà¸à¸µà¸ __count__ วินาที',\n second_in_plural: 'ในà¸à¸µà¸ __count__ วินาที',\n minute_ago: '__count__ นาทีที่ผ่านมา',\n minute_ago_plural: '__count__ นาทีที่ผ่านมา',\n minute_in: 'ในà¸à¸µà¸ __count__ นาที',\n minute_in_plural: 'ในà¸à¸µà¸ __count__ นาที',\n hour_ago: '__count__ ชั่วโมงที่ผ่านมา',\n hour_ago_plural: '__count__ ชั่วโมงที่ผ่านมา',\n hour_in: 'ในà¸à¸µà¸ __count__ ชั่วโมง',\n hour_in_plural: 'ในà¸à¸µà¸ __count__ ชั่วโมง',\n day_ago: '__count__ วันที่ผ่านมา',\n day_ago_plural: '__count__ วันที่ผ่านมา',\n day_in: 'ในà¸à¸µà¸ __count__ วัน',\n day_in_plural: 'ในà¸à¸µà¸ __count__ วัน',\n month_ago: '__count__ เดืà¸à¸™à¸—ี่ผ่านมา',\n month_ago_plural: '__count__ เดืà¸à¸™à¸—ี่ผ่านมา',\n month_in: 'ในà¸à¸µà¸ __count__ เดืà¸à¸™',\n month_in_plural: 'ในà¸à¸µà¸ __count__ เดืà¸à¸™',\n year_ago: '__count__ ปีที่à¹à¸¥à¹‰à¸§',\n year_ago_plural: '__count__ ปีที่à¹à¸¥à¹‰à¸§',\n year_in: 'ในà¸à¸µà¸ __count__ ปี',\n year_in_plural: 'ในà¸à¸µà¸ __count__ ปี'\n }\n },\n zh: {\n translation: {\n now: '现在',\n second_ago: '__count__秒钟å‰',\n second_ago_plural: '__count__秒钟å‰',\n second_in: '__count__秒钟åŽ',\n second_in_plural: '__count__秒钟åŽ',\n minute_ago: '__count__分钟å‰',\n minute_ago_plural: '__count__分钟å‰',\n minute_in: '__count__分钟åŽ',\n minute_in_plural: '__count__分钟åŽ',\n hour_ago: '__count__å°æ—¶å‰',\n hour_ago_plural: '__count__å°æ—¶å‰',\n hour_in: '__count__å°æ—¶åŽ',\n hour_in_plural: '__count__å°æ—¶åŽ',\n day_ago: '__count__天å‰',\n day_ago_plural: '__count__天å‰',\n day_in: '__count__天åŽ',\n day_in_plural: '__count__天åŽ',\n month_ago: '__count__个月å‰',\n month_ago_plural: '__count__个月å‰',\n month_in: '__count__个月åŽ',\n month_in_plural: '__count__个月åŽ',\n year_ago: '__count__å¹´å‰',\n year_ago_plural: '__count__å¹´å‰',\n year_in: '__count__å¹´åŽ',\n year_in_plural: '__count__å¹´åŽ'\n }\n },\n 'zh-HK': {\n translation: {\n now: 'ç¾åœ¨',\n second_ago: '__count__ 秒å‰',\n second_ago_plural: '__count__ 秒å‰',\n second_in: '__count__ 秒後',\n second_in_plural: '__count__ 秒後',\n minute_ago: '__count__ 分é˜å‰',\n minute_ago_plural: '__count__ 分é˜å‰',\n minute_in: '__count__ 分é˜å¾Œ',\n minute_in_plural: '__count__ 分é˜å¾Œ',\n hour_ago: '__count__ å°æ™‚å‰',\n hour_ago_plural: '__count__ å°æ™‚å‰',\n hour_in: '__count__ å°æ™‚後',\n hour_in_plural: '__count__ å°æ™‚後',\n day_ago: '__count__ æ—¥å‰',\n day_ago_plural: '__count__ æ—¥å‰',\n day_in: '__count__ 日後',\n day_in_plural: '__count__ 日後',\n month_ago: '__count__ 個月å‰',\n month_ago_plural: '__count__ 個月å‰',\n month_in: '__count__ 個月後',\n month_in_plural: '__count__ 個月後',\n year_ago: '__count__ å¹´å‰',\n year_ago_plural: '__count__ å¹´å‰',\n year_in: '__count__ 年後',\n year_in_plural: '__count__ 年後'\n },\n },\n 'zh-TW': {\n translation: {\n now: '剛æ‰',\n second_ago: '__count__ 秒é˜å‰',\n second_ago_plural: '__count__ 秒é˜å‰',\n second_in: '__count__ 秒內',\n second_in_plural: '__count__ 秒內',\n minute_ago: '__count__ 分é˜å‰',\n minute_ago_plural: '__count__ 分é˜å‰',\n minute_in: '__count__ 分é˜å…§',\n minute_in_plural: '__count__ 分é˜å…§',\n hour_ago: '__count__ å°æ™‚å‰',\n hour_ago_plural: '__count__ å°æ™‚å‰',\n hour_in: '__count__ å°æ™‚å…§',\n hour_in_plural: '__count__ å°æ™‚å…§',\n day_ago: '__count__ 天å‰',\n day_ago_plural: '__count__ 天å‰',\n day_in: '__count__ 天內',\n day_in_plural: '__count__ 天內',\n month_ago: '__count__ 月å‰',\n month_ago_plural: '__count__ 月å‰',\n month_in: '__count__ 月內',\n month_in_plural: '__count__ 月內',\n year_ago: '__count__ å¹´å‰',\n year_ago_plural: '__count__ å¹´å‰',\n year_in: '__count__ å¹´å…§',\n year_in_plural: '__count__ å¹´å…§'\n }\n }\n};\n// tslint:enable\n\nvar RelativeTime = /** @class */ (function () {\n function RelativeTime(service, ea) {\n var _this = this;\n this.service = service;\n this.ea = ea;\n this.service.i18nextReady().then(function () {\n _this.setup();\n });\n this.ea.subscribe(I18N_EA_SIGNAL, function (locales) {\n _this.setup(locales);\n });\n }\n RelativeTime.inject = function () { return [I18N, EventAggregator]; };\n RelativeTime.prototype.setup = function (locales) {\n var trans = translations;\n var fallbackLng = this.service.i18next.fallbackLng;\n var alternateFb = fallbackLng || this.service.i18next.options.fallbackLng;\n if (Array.isArray(alternateFb) && alternateFb.length > 0) {\n alternateFb = alternateFb[0];\n }\n var key = ((locales && locales.newValue)\n ? locales.newValue\n : this.service.getLocale()) || alternateFb;\n var index = 0;\n // tslint:disable-next-line:no-conditional-assignment\n if ((index = key.indexOf(\"-\")) >= 0) {\n var baseLocale = key.substring(0, index);\n if (trans[baseLocale]) {\n this.addTranslationResource(baseLocale, trans[baseLocale].translation);\n }\n }\n if (trans[key]) {\n this.addTranslationResource(key, trans[key].translation);\n }\n if (trans[fallbackLng]) {\n this.addTranslationResource(key, trans[fallbackLng].translation);\n }\n };\n RelativeTime.prototype.addTranslationResource = function (key, translation) {\n var options = this.service.i18next.options;\n if (options.interpolation && (options.interpolation.prefix !== \"__\" || options.interpolation.suffix !== \"__\")) {\n // tslint:disable-next-line:forin\n for (var subkey in translation) {\n translation[subkey] = translation[subkey]\n .replace(\"__count__\", (options.interpolation.prefix || \"{{\") + \"count\" + (options.interpolation.suffix || \"}}\"));\n }\n }\n this.service.i18next.addResources(key, options.defaultNS || \"translation\", translation);\n };\n RelativeTime.prototype.getRelativeTime = function (time) {\n var now = new Date();\n var diff = now.getTime() - time.getTime();\n var timeDiff = this.getTimeDiffDescription(diff, \"year\", 31104000000);\n if (!timeDiff) {\n timeDiff = this.getTimeDiffDescription(diff, \"month\", 2592000000);\n if (!timeDiff) {\n timeDiff = this.getTimeDiffDescription(diff, \"day\", 86400000);\n if (!timeDiff) {\n timeDiff = this.getTimeDiffDescription(diff, \"hour\", 3600000);\n if (!timeDiff) {\n timeDiff = this.getTimeDiffDescription(diff, \"minute\", 60000);\n if (!timeDiff) {\n timeDiff = this.getTimeDiffDescription(diff, \"second\", 1000);\n if (!timeDiff) {\n timeDiff = this.service.tr(\"now\");\n }\n }\n }\n }\n }\n }\n return timeDiff;\n };\n RelativeTime.prototype.getTimeDiffDescription = function (diff, unit, timeDivisor) {\n var unitAmount = parseInt((diff / timeDivisor).toFixed(0), 10);\n if (unitAmount > 0) {\n return this.service.tr(unit, { count: unitAmount, context: \"ago\" });\n }\n else if (unitAmount < 0) {\n var abs = Math.abs(unitAmount);\n return this.service.tr(unit, { count: abs, context: \"in\" });\n }\n return null;\n };\n return RelativeTime;\n}());\n\nvar RtValueConverter = /** @class */ (function () {\n function RtValueConverter(service) {\n this.service = service;\n }\n RtValueConverter.inject = function () { return [RelativeTime]; };\n RtValueConverter.prototype.toView = function (value) {\n if (value === null\n || typeof value === \"undefined\"\n || (typeof value === \"string\" && value.trim() === \"\")) {\n return value;\n }\n if (typeof value === \"string\" && isNaN(value) && !Number.isInteger(value)) {\n value = new Date(value);\n }\n return this.service.getRelativeTime(value);\n };\n RtValueConverter = __decorate([\n valueConverter$1(\"rt\")\n ], RtValueConverter);\n return RtValueConverter;\n}());\n\nvar Backend = /** @class */ (function () {\n function Backend(services, options) {\n if (options === void 0) { options = {}; }\n this.services = services;\n this.options = options;\n this.type = \"backend\";\n this.init(services, options);\n }\n Backend.with = function (loader) {\n this.loader = loader;\n return this;\n };\n Backend.prototype.init = function (services, options) {\n if (options === void 0) { options = {}; }\n this.services = services;\n this.options = Object.assign({}, {\n loadPath: \"/locales/{{lng}}/{{ns}}.json\",\n addPath: \"locales/add/{{lng}}/{{ns}}\",\n allowMultiLoading: false,\n parse: JSON.parse\n }, options);\n };\n Backend.prototype.readMulti = function (languages, namespaces, callback) {\n var loadPath = this.options.loadPath;\n if (typeof this.options.loadPath === \"function\") {\n loadPath = this.options.loadPath(languages, namespaces);\n }\n var url = this.services\n .interpolator\n .interpolate(loadPath, { lng: languages.join(\"+\"), ns: namespaces.join(\"+\") });\n this.loadUrl(url, callback);\n };\n Backend.prototype.read = function (language, namespace, callback) {\n var loadPath = this.options.loadPath;\n if (typeof this.options.loadPath === \"function\") {\n loadPath = this.options.loadPath([language], [namespace]);\n }\n var url = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace });\n this.loadUrl(url, callback);\n };\n Backend.prototype.loadUrl = function (url, callback) {\n return __awaiter(this, void 0, void 0, function () {\n var response, ret, err, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4 /*yield*/, Backend.loader.loadText(url)];\n case 1:\n response = _b.sent();\n ret = void 0;\n err = void 0;\n try {\n ret = (response instanceof Object) ? response : this.options.parse(response, url);\n }\n catch (e) {\n err = \"failed parsing \" + url + \" to json\";\n }\n if (err) {\n return [2 /*return*/, callback(err, false)];\n }\n callback(null, ret);\n return [3 /*break*/, 3];\n case 2:\n _a = _b.sent();\n callback(\"failed loading \" + url, false /* no retry */);\n return [3 /*break*/, 3];\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n // tslint:disable-next-line:variable-name\n Backend.prototype.create = function (_languages, _namespace, _key, _fallbackValue) {\n // not supported\n };\n Backend.type = \"backend\";\n return Backend;\n}());\n\nfunction configure(frameworkConfig, cb) {\n if (typeof cb !== \"function\") {\n var errorMsg = \"You need to provide a callback method to properly configure the library\";\n throw errorMsg;\n }\n var instance = frameworkConfig.container.get(I18N);\n var ret = cb(instance);\n frameworkConfig.globalResources([\n TValueConverter,\n TBindingBehavior,\n TCustomAttribute,\n TParamsCustomAttribute,\n NfValueConverter,\n NfBindingBehavior,\n DfValueConverter,\n DfBindingBehavior,\n RtValueConverter,\n RtBindingBehavior\n ]);\n frameworkConfig.postTask(function () {\n var resources = frameworkConfig.container.get(ViewResources);\n var htmlBehaviorResource = resources.getAttribute(\"t\");\n var htmlParamsResource = resources.getAttribute(\"t-params\");\n var attributes = instance.i18next.options.attributes;\n // Register default attributes if none provided\n if (!attributes) {\n attributes = [\"t\", \"i18n\"];\n }\n attributes.forEach(function (alias) { return resources.registerAttribute(alias, htmlBehaviorResource, \"t\"); });\n attributes.forEach(function (alias) { return resources.registerAttribute(alias + \"-params\", htmlParamsResource, \"t-params\"); });\n });\n return ret;\n}\n\nexport { configure, DfValueConverter, DfBindingBehavior, NfValueConverter, NfBindingBehavior, RtValueConverter, RtBindingBehavior, TValueConverter, TBindingBehavior, TCustomAttribute, TParamsCustomAttribute, I18N_EA_SIGNAL, I18N, RelativeTime, Backend };\n"],"names":[],"sourceRoot":""}