@bigbinary/neeto-team-members-frontend 2.4.15 → 2.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { createContext, useContext, createElement, isValidElement, cloneElement, useState, useRef, useEffect, useMemo, useCallback, useLayoutEffect } from 'react';
1
+ import React, { createElement, isValidElement, cloneElement, createContext, useContext, useState, useRef, useEffect, useMemo, useCallback, useLayoutEffect } from 'react';
2
2
  import { complement, isEmpty, modifyPath, prepend, assocPath, findIndex, propEq, dissocPath, groupBy, is, prop, keys, map, identical, modify, includes, pluck, fromPairs, toPairs, filter, isNil, curry, __, trim, toLower, identity, without, append, clamp, mergeLeft, head, reverse, assoc } from 'ramda';
3
3
  import { ExternalLink, MenuHorizontal, Up, Down, Search, Right as Right$1, Info } from '@bigbinary/neeto-icons';
4
4
  import { QueryClient, QueryCache, QueryClientProvider, useQuery, useMutation } from 'react-query';
@@ -158,10 +158,8 @@ function _toArray(arr) {
158
158
  return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
159
159
  }
160
160
 
161
- function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
162
-
163
- function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
164
-
161
+ function ownKeys$6$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
162
+ function _objectSpread$6$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
165
163
  var consoleLogger = {
166
164
  type: 'logger',
167
165
  log: function log(args) {
@@ -177,16 +175,12 @@ var consoleLogger = {
177
175
  if (console && console[type]) console[type].apply(console, args);
178
176
  }
179
177
  };
180
-
181
178
  var Logger = function () {
182
179
  function Logger(concreteLogger) {
183
180
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
184
-
185
181
  _classCallCheck(this, Logger);
186
-
187
182
  this.init(concreteLogger, options);
188
183
  }
189
-
190
184
  _createClass(Logger, [{
191
185
  key: "init",
192
186
  value: function init(concreteLogger) {
@@ -207,7 +201,6 @@ var Logger = function () {
207
201
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
208
202
  args[_key] = arguments[_key];
209
203
  }
210
-
211
204
  return this.forward(args, 'log', '', true);
212
205
  }
213
206
  }, {
@@ -216,7 +209,6 @@ var Logger = function () {
216
209
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
217
210
  args[_key2] = arguments[_key2];
218
211
  }
219
-
220
212
  return this.forward(args, 'warn', '', true);
221
213
  }
222
214
  }, {
@@ -225,7 +217,6 @@ var Logger = function () {
225
217
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
226
218
  args[_key3] = arguments[_key3];
227
219
  }
228
-
229
220
  return this.forward(args, 'error', '');
230
221
  }
231
222
  }, {
@@ -234,7 +225,6 @@ var Logger = function () {
234
225
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
235
226
  args[_key4] = arguments[_key4];
236
227
  }
237
-
238
228
  return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
239
229
  }
240
230
  }, {
@@ -247,7 +237,7 @@ var Logger = function () {
247
237
  }, {
248
238
  key: "create",
249
239
  value: function create(moduleName) {
250
- return new Logger(this.logger, _objectSpread$c(_objectSpread$c({}, {
240
+ return new Logger(this.logger, _objectSpread$6$1(_objectSpread$6$1({}, {
251
241
  prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
252
242
  }), this.options));
253
243
  }
@@ -259,27 +249,21 @@ var Logger = function () {
259
249
  return new Logger(this.logger, options);
260
250
  }
261
251
  }]);
262
-
263
252
  return Logger;
264
253
  }();
265
-
266
254
  var baseLogger = new Logger();
267
255
 
268
256
  var EventEmitter = function () {
269
257
  function EventEmitter() {
270
258
  _classCallCheck(this, EventEmitter);
271
-
272
259
  this.observers = {};
273
260
  }
274
-
275
261
  _createClass(EventEmitter, [{
276
262
  key: "on",
277
263
  value: function on(events, listener) {
278
264
  var _this = this;
279
-
280
265
  events.split(' ').forEach(function (event) {
281
266
  _this.observers[event] = _this.observers[event] || [];
282
-
283
267
  _this.observers[event].push(listener);
284
268
  });
285
269
  return this;
@@ -288,12 +272,10 @@ var EventEmitter = function () {
288
272
  key: "off",
289
273
  value: function off(event, listener) {
290
274
  if (!this.observers[event]) return;
291
-
292
275
  if (!listener) {
293
276
  delete this.observers[event];
294
277
  return;
295
278
  }
296
-
297
279
  this.observers[event] = this.observers[event].filter(function (l) {
298
280
  return l !== listener;
299
281
  });
@@ -304,24 +286,20 @@ var EventEmitter = function () {
304
286
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
305
287
  args[_key - 1] = arguments[_key];
306
288
  }
307
-
308
289
  if (this.observers[event]) {
309
290
  var cloned = [].concat(this.observers[event]);
310
291
  cloned.forEach(function (observer) {
311
292
  observer.apply(void 0, args);
312
293
  });
313
294
  }
314
-
315
295
  if (this.observers['*']) {
316
296
  var _cloned = [].concat(this.observers['*']);
317
-
318
297
  _cloned.forEach(function (observer) {
319
298
  observer.apply(observer, [event].concat(args));
320
299
  });
321
300
  }
322
301
  }
323
302
  }]);
324
-
325
303
  return EventEmitter;
326
304
  }();
327
305
 
@@ -345,68 +323,56 @@ function copy(a, s, t) {
345
323
  if (s[m]) t[m] = s[m];
346
324
  });
347
325
  }
348
-
349
326
  function getLastOfPath(object, path, Empty) {
350
327
  function cleanKey(key) {
351
328
  return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
352
329
  }
353
-
354
330
  function canNotTraverseDeeper() {
355
331
  return !object || typeof object === 'string';
356
332
  }
357
-
358
333
  var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
359
-
360
334
  while (stack.length > 1) {
361
335
  if (canNotTraverseDeeper()) return {};
362
336
  var key = cleanKey(stack.shift());
363
337
  if (!object[key] && Empty) object[key] = new Empty();
364
-
365
338
  if (Object.prototype.hasOwnProperty.call(object, key)) {
366
339
  object = object[key];
367
340
  } else {
368
341
  object = {};
369
342
  }
370
343
  }
371
-
372
344
  if (canNotTraverseDeeper()) return {};
373
345
  return {
374
346
  obj: object,
375
347
  k: cleanKey(stack.shift())
376
348
  };
377
349
  }
378
-
379
350
  function setPath(object, path, newValue) {
380
351
  var _getLastOfPath = getLastOfPath(object, path, Object),
381
- obj = _getLastOfPath.obj,
382
- k = _getLastOfPath.k;
383
-
352
+ obj = _getLastOfPath.obj,
353
+ k = _getLastOfPath.k;
384
354
  obj[k] = newValue;
385
355
  }
386
356
  function pushPath(object, path, newValue, concat) {
387
357
  var _getLastOfPath2 = getLastOfPath(object, path, Object),
388
- obj = _getLastOfPath2.obj,
389
- k = _getLastOfPath2.k;
390
-
358
+ obj = _getLastOfPath2.obj,
359
+ k = _getLastOfPath2.k;
391
360
  obj[k] = obj[k] || [];
392
361
  if (concat) obj[k] = obj[k].concat(newValue);
393
362
  if (!concat) obj[k].push(newValue);
394
363
  }
395
364
  function getPath(object, path) {
396
365
  var _getLastOfPath3 = getLastOfPath(object, path),
397
- obj = _getLastOfPath3.obj,
398
- k = _getLastOfPath3.k;
399
-
366
+ obj = _getLastOfPath3.obj,
367
+ k = _getLastOfPath3.k;
400
368
  if (!obj) return undefined;
401
369
  return obj[k];
402
370
  }
403
371
  function getPathWithDefaults(data, defaultData, key) {
404
372
  var value = getPath(data, key);
405
-
406
373
  if (value !== undefined) {
407
374
  return value;
408
375
  }
409
-
410
376
  return getPath(defaultData, key);
411
377
  }
412
378
  function deepExtend(target, source, overwrite) {
@@ -423,7 +389,6 @@ function deepExtend(target, source, overwrite) {
423
389
  }
424
390
  }
425
391
  }
426
-
427
392
  return target;
428
393
  }
429
394
  function regexEscape(str) {
@@ -443,7 +408,6 @@ function escape(data) {
443
408
  return _entityMap[s];
444
409
  });
445
410
  }
446
-
447
411
  return data;
448
412
  }
449
413
  var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
@@ -459,105 +423,77 @@ function looksLikeObjectPath(key, nsSeparator, keySeparator) {
459
423
  return c === '?' ? '\\?' : c;
460
424
  }).join('|'), ")"));
461
425
  var matched = !r.test(key);
462
-
463
426
  if (!matched) {
464
427
  var ki = key.indexOf(keySeparator);
465
-
466
428
  if (ki > 0 && !r.test(key.substring(0, ki))) {
467
429
  matched = true;
468
430
  }
469
431
  }
470
-
471
432
  return matched;
472
433
  }
473
434
 
474
- function ownKeys$1$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
475
-
476
- function _objectSpread$1$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
477
-
478
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
479
-
480
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
481
-
435
+ function ownKeys$5$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
436
+ function _objectSpread$5$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
437
+ function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
438
+ function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
482
439
  function deepFind(obj, path) {
483
440
  var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
484
441
  if (!obj) return undefined;
485
442
  if (obj[path]) return obj[path];
486
443
  var paths = path.split(keySeparator);
487
444
  var current = obj;
488
-
489
445
  for (var i = 0; i < paths.length; ++i) {
490
446
  if (!current) return undefined;
491
-
492
447
  if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
493
448
  return undefined;
494
449
  }
495
-
496
450
  if (current[paths[i]] === undefined) {
497
451
  var j = 2;
498
452
  var p = paths.slice(i, i + j).join(keySeparator);
499
453
  var mix = current[p];
500
-
501
454
  while (mix === undefined && paths.length > i + j) {
502
455
  j++;
503
456
  p = paths.slice(i, i + j).join(keySeparator);
504
457
  mix = current[p];
505
458
  }
506
-
507
459
  if (mix === undefined) return undefined;
508
460
  if (mix === null) return null;
509
-
510
461
  if (path.endsWith(p)) {
511
462
  if (typeof mix === 'string') return mix;
512
463
  if (p && typeof mix[p] === 'string') return mix[p];
513
464
  }
514
-
515
465
  var joinedPath = paths.slice(i + j).join(keySeparator);
516
466
  if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
517
467
  return undefined;
518
468
  }
519
-
520
469
  current = current[paths[i]];
521
470
  }
522
-
523
471
  return current;
524
472
  }
525
-
526
473
  var ResourceStore = function (_EventEmitter) {
527
474
  _inherits(ResourceStore, _EventEmitter);
528
-
529
- var _super = _createSuper(ResourceStore);
530
-
475
+ var _super = _createSuper$3(ResourceStore);
531
476
  function ResourceStore(data) {
532
477
  var _this;
533
-
534
478
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
535
479
  ns: ['translation'],
536
480
  defaultNS: 'translation'
537
481
  };
538
-
539
482
  _classCallCheck(this, ResourceStore);
540
-
541
483
  _this = _super.call(this);
542
-
543
484
  if (isIE10) {
544
485
  EventEmitter.call(_assertThisInitialized(_this));
545
486
  }
546
-
547
487
  _this.data = data || {};
548
488
  _this.options = options;
549
-
550
489
  if (_this.options.keySeparator === undefined) {
551
490
  _this.options.keySeparator = '.';
552
491
  }
553
-
554
492
  if (_this.options.ignoreJSONStructure === undefined) {
555
493
  _this.options.ignoreJSONStructure = true;
556
494
  }
557
-
558
495
  return _this;
559
496
  }
560
-
561
497
  _createClass(ResourceStore, [{
562
498
  key: "addNamespaces",
563
499
  value: function addNamespaces(ns) {
@@ -569,7 +505,6 @@ var ResourceStore = function (_EventEmitter) {
569
505
  key: "removeNamespaces",
570
506
  value: function removeNamespaces(ns) {
571
507
  var index = this.options.ns.indexOf(ns);
572
-
573
508
  if (index > -1) {
574
509
  this.options.ns.splice(index, 1);
575
510
  }
@@ -583,11 +518,9 @@ var ResourceStore = function (_EventEmitter) {
583
518
  var path = [lng, ns];
584
519
  if (key && typeof key !== 'string') path = path.concat(key);
585
520
  if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
586
-
587
521
  if (lng.indexOf('.') > -1) {
588
522
  path = lng.split('.');
589
523
  }
590
-
591
524
  var result = getPath(this.data, path);
592
525
  if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
593
526
  return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
@@ -602,13 +535,11 @@ var ResourceStore = function (_EventEmitter) {
602
535
  if (keySeparator === undefined) keySeparator = '.';
603
536
  var path = [lng, ns];
604
537
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
605
-
606
538
  if (lng.indexOf('.') > -1) {
607
539
  path = lng.split('.');
608
540
  value = ns;
609
541
  ns = path[1];
610
542
  }
611
-
612
543
  this.addNamespaces(ns);
613
544
  setPath(this.data, path, value);
614
545
  if (!options.silent) this.emit('added', lng, ns, key, value);
@@ -619,13 +550,11 @@ var ResourceStore = function (_EventEmitter) {
619
550
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
620
551
  silent: false
621
552
  };
622
-
623
553
  for (var m in resources) {
624
554
  if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
625
555
  silent: true
626
556
  });
627
557
  }
628
-
629
558
  if (!options.silent) this.emit('added', lng, ns, resources);
630
559
  }
631
560
  }, {
@@ -635,23 +564,19 @@ var ResourceStore = function (_EventEmitter) {
635
564
  silent: false
636
565
  };
637
566
  var path = [lng, ns];
638
-
639
567
  if (lng.indexOf('.') > -1) {
640
568
  path = lng.split('.');
641
569
  deep = resources;
642
570
  resources = ns;
643
571
  ns = path[1];
644
572
  }
645
-
646
573
  this.addNamespaces(ns);
647
574
  var pack = getPath(this.data, path) || {};
648
-
649
575
  if (deep) {
650
576
  deepExtend(pack, resources, overwrite);
651
577
  } else {
652
- pack = _objectSpread$1$1(_objectSpread$1$1({}, pack), resources);
578
+ pack = _objectSpread$5$1(_objectSpread$5$1({}, pack), resources);
653
579
  }
654
-
655
580
  setPath(this.data, path, pack);
656
581
  if (!options.silent) this.emit('added', lng, ns, resources);
657
582
  }
@@ -661,7 +586,6 @@ var ResourceStore = function (_EventEmitter) {
661
586
  if (this.hasResourceBundle(lng, ns)) {
662
587
  delete this.data[lng][ns];
663
588
  }
664
-
665
589
  this.removeNamespaces(ns);
666
590
  this.emit('removed', lng, ns);
667
591
  }
@@ -674,7 +598,7 @@ var ResourceStore = function (_EventEmitter) {
674
598
  key: "getResourceBundle",
675
599
  value: function getResourceBundle(lng, ns) {
676
600
  if (!ns) ns = this.options.defaultNS;
677
- if (this.options.compatibilityAPI === 'v1') return _objectSpread$1$1(_objectSpread$1$1({}, {}), this.getResource(lng, ns));
601
+ if (this.options.compatibilityAPI === 'v1') return _objectSpread$5$1(_objectSpread$5$1({}, {}), this.getResource(lng, ns));
678
602
  return this.getResource(lng, ns);
679
603
  }
680
604
  }, {
@@ -697,7 +621,6 @@ var ResourceStore = function (_EventEmitter) {
697
621
  return this.data;
698
622
  }
699
623
  }]);
700
-
701
624
  return ResourceStore;
702
625
  }(EventEmitter);
703
626
 
@@ -708,7 +631,6 @@ var postProcessor = {
708
631
  },
709
632
  handle: function handle(processors, value, key, options, translator) {
710
633
  var _this = this;
711
-
712
634
  processors.forEach(function (processor) {
713
635
  if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
714
636
  });
@@ -716,44 +638,30 @@ var postProcessor = {
716
638
  }
717
639
  };
718
640
 
719
- function ownKeys$2$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
720
-
721
- function _objectSpread$2$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
722
-
723
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
724
-
725
- function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
641
+ function ownKeys$4$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
642
+ function _objectSpread$4$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
643
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
644
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
726
645
  var checkedLoadedFor = {};
727
-
728
646
  var Translator = function (_EventEmitter) {
729
647
  _inherits(Translator, _EventEmitter);
730
-
731
- var _super = _createSuper$1(Translator);
732
-
648
+ var _super = _createSuper$2(Translator);
733
649
  function Translator(services) {
734
650
  var _this;
735
-
736
651
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
737
-
738
652
  _classCallCheck(this, Translator);
739
-
740
653
  _this = _super.call(this);
741
-
742
654
  if (isIE10) {
743
655
  EventEmitter.call(_assertThisInitialized(_this));
744
656
  }
745
-
746
657
  copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized(_this));
747
658
  _this.options = options;
748
-
749
659
  if (_this.options.keySeparator === undefined) {
750
660
  _this.options.keySeparator = '.';
751
661
  }
752
-
753
662
  _this.logger = baseLogger.create('translator');
754
663
  return _this;
755
664
  }
756
-
757
665
  _createClass(Translator, [{
758
666
  key: "changeLanguage",
759
667
  value: function changeLanguage(lng) {
@@ -765,11 +673,9 @@ var Translator = function (_EventEmitter) {
765
673
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
766
674
  interpolation: {}
767
675
  };
768
-
769
676
  if (key === undefined || key === null) {
770
677
  return false;
771
678
  }
772
-
773
679
  var resolved = this.resolve(key, options);
774
680
  return resolved && resolved.res !== undefined;
775
681
  }
@@ -782,22 +688,18 @@ var Translator = function (_EventEmitter) {
782
688
  var namespaces = options.ns || this.options.defaultNS || [];
783
689
  var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
784
690
  var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
785
-
786
691
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
787
692
  var m = key.match(this.interpolator.nestingRegexp);
788
-
789
693
  if (m && m.length > 0) {
790
694
  return {
791
695
  key: key,
792
696
  namespaces: namespaces
793
697
  };
794
698
  }
795
-
796
699
  var parts = key.split(nsSeparator);
797
700
  if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
798
701
  key = parts.join(keySeparator);
799
702
  }
800
-
801
703
  if (typeof namespaces === 'string') namespaces = [namespaces];
802
704
  return {
803
705
  key: key,
@@ -808,45 +710,35 @@ var Translator = function (_EventEmitter) {
808
710
  key: "translate",
809
711
  value: function translate(keys, options, lastKey) {
810
712
  var _this2 = this;
811
-
812
713
  if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
813
714
  options = this.options.overloadTranslationOptionHandler(arguments);
814
715
  }
815
-
816
716
  if (!options) options = {};
817
717
  if (keys === undefined || keys === null) return '';
818
718
  if (!Array.isArray(keys)) keys = [String(keys)];
819
719
  var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
820
720
  var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
821
-
822
721
  var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
823
- key = _this$extractFromKey.key,
824
- namespaces = _this$extractFromKey.namespaces;
825
-
722
+ key = _this$extractFromKey.key,
723
+ namespaces = _this$extractFromKey.namespaces;
826
724
  var namespace = namespaces[namespaces.length - 1];
827
725
  var lng = options.lng || this.language;
828
726
  var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
829
-
830
727
  if (lng && lng.toLowerCase() === 'cimode') {
831
728
  if (appendNamespaceToCIMode) {
832
729
  var nsSeparator = options.nsSeparator || this.options.nsSeparator;
833
-
834
730
  if (returnDetails) {
835
731
  resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
836
732
  return resolved;
837
733
  }
838
-
839
734
  return "".concat(namespace).concat(nsSeparator).concat(key);
840
735
  }
841
-
842
736
  if (returnDetails) {
843
737
  resolved.res = key;
844
738
  return resolved;
845
739
  }
846
-
847
740
  return key;
848
741
  }
849
-
850
742
  var resolved = this.resolve(keys, options);
851
743
  var res = resolved && resolved.res;
852
744
  var resUsedKey = resolved && resolved.usedKey || key;
@@ -856,41 +748,34 @@ var Translator = function (_EventEmitter) {
856
748
  var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
857
749
  var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
858
750
  var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
859
-
860
751
  if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
861
752
  if (!options.returnObjects && !this.options.returnObjects) {
862
753
  if (!this.options.returnedObjectHandler) {
863
754
  this.logger.warn('accessing an object - but returnObjects options is not enabled!');
864
755
  }
865
-
866
- var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
756
+ var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4$1(_objectSpread$4$1({}, options), {}, {
867
757
  ns: namespaces
868
758
  })) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
869
-
870
759
  if (returnDetails) {
871
760
  resolved.res = r;
872
761
  return resolved;
873
762
  }
874
-
875
763
  return r;
876
764
  }
877
-
878
765
  if (keySeparator) {
879
766
  var resTypeIsArray = resType === '[object Array]';
880
767
  var copy = resTypeIsArray ? [] : {};
881
768
  var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
882
-
883
769
  for (var m in res) {
884
770
  if (Object.prototype.hasOwnProperty.call(res, m)) {
885
771
  var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
886
- copy[m] = this.translate(deepKey, _objectSpread$2$1(_objectSpread$2$1({}, options), {
772
+ copy[m] = this.translate(deepKey, _objectSpread$4$1(_objectSpread$4$1({}, options), {
887
773
  joinArrays: false,
888
774
  ns: namespaces
889
775
  }));
890
776
  if (copy[m] === deepKey) copy[m] = res[m];
891
777
  }
892
778
  }
893
-
894
779
  res = copy;
895
780
  }
896
781
  } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
@@ -903,34 +788,27 @@ var Translator = function (_EventEmitter) {
903
788
  var hasDefaultValue = Translator.hasDefaultValue(options);
904
789
  var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
905
790
  var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
906
-
907
791
  if (!this.isValidLookup(res) && hasDefaultValue) {
908
792
  usedDefault = true;
909
793
  res = defaultValue;
910
794
  }
911
-
912
795
  if (!this.isValidLookup(res)) {
913
796
  usedKey = true;
914
797
  res = key;
915
798
  }
916
-
917
799
  var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
918
800
  var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
919
801
  var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
920
-
921
802
  if (usedKey || usedDefault || updateMissing) {
922
803
  this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
923
-
924
804
  if (keySeparator) {
925
- var fk = this.resolve(key, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
805
+ var fk = this.resolve(key, _objectSpread$4$1(_objectSpread$4$1({}, options), {}, {
926
806
  keySeparator: false
927
807
  }));
928
808
  if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');
929
809
  }
930
-
931
810
  var lngs = [];
932
811
  var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
933
-
934
812
  if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
935
813
  for (var i = 0; i < fallbackLngs.length; i++) {
936
814
  lngs.push(fallbackLngs[i]);
@@ -940,19 +818,15 @@ var Translator = function (_EventEmitter) {
940
818
  } else {
941
819
  lngs.push(options.lng || this.language);
942
820
  }
943
-
944
821
  var send = function send(l, k, specificDefaultValue) {
945
822
  var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
946
-
947
823
  if (_this2.options.missingKeyHandler) {
948
824
  _this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
949
825
  } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
950
826
  _this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
951
827
  }
952
-
953
828
  _this2.emit('missingKey', l, namespace, k, res);
954
829
  };
955
-
956
830
  if (this.options.saveMissing) {
957
831
  if (this.options.saveMissingPlurals && needsPluralHandling) {
958
832
  lngs.forEach(function (language) {
@@ -965,10 +839,8 @@ var Translator = function (_EventEmitter) {
965
839
  }
966
840
  }
967
841
  }
968
-
969
842
  res = this.extendTranslation(res, keys, options, resolved, lastKey);
970
843
  if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key);
971
-
972
844
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
973
845
  if (this.options.compatibilityAPI !== 'v1') {
974
846
  res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
@@ -977,77 +849,63 @@ var Translator = function (_EventEmitter) {
977
849
  }
978
850
  }
979
851
  }
980
-
981
852
  if (returnDetails) {
982
853
  resolved.res = res;
983
854
  return resolved;
984
855
  }
985
-
986
856
  return res;
987
857
  }
988
858
  }, {
989
859
  key: "extendTranslation",
990
860
  value: function extendTranslation(res, key, options, resolved, lastKey) {
991
861
  var _this3 = this;
992
-
993
862
  if (this.i18nFormat && this.i18nFormat.parse) {
994
- res = this.i18nFormat.parse(res, _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
863
+ res = this.i18nFormat.parse(res, _objectSpread$4$1(_objectSpread$4$1({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
995
864
  resolved: resolved
996
865
  });
997
866
  } else if (!options.skipInterpolation) {
998
- if (options.interpolation) this.interpolator.init(_objectSpread$2$1(_objectSpread$2$1({}, options), {
999
- interpolation: _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation), options.interpolation)
867
+ if (options.interpolation) this.interpolator.init(_objectSpread$4$1(_objectSpread$4$1({}, options), {
868
+ interpolation: _objectSpread$4$1(_objectSpread$4$1({}, this.options.interpolation), options.interpolation)
1000
869
  }));
1001
870
  var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
1002
871
  var nestBef;
1003
-
1004
872
  if (skipOnVariables) {
1005
873
  var nb = res.match(this.interpolator.nestingRegexp);
1006
874
  nestBef = nb && nb.length;
1007
875
  }
1008
-
1009
876
  var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
1010
- if (this.options.interpolation.defaultVariables) data = _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation.defaultVariables), data);
877
+ if (this.options.interpolation.defaultVariables) data = _objectSpread$4$1(_objectSpread$4$1({}, this.options.interpolation.defaultVariables), data);
1011
878
  res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
1012
-
1013
879
  if (skipOnVariables) {
1014
880
  var na = res.match(this.interpolator.nestingRegexp);
1015
881
  var nestAft = na && na.length;
1016
882
  if (nestBef < nestAft) options.nest = false;
1017
883
  }
1018
-
1019
884
  if (options.nest !== false) res = this.interpolator.nest(res, function () {
1020
885
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1021
886
  args[_key] = arguments[_key];
1022
887
  }
1023
-
1024
888
  if (lastKey && lastKey[0] === args[0] && !options.context) {
1025
889
  _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
1026
-
1027
890
  return null;
1028
891
  }
1029
-
1030
892
  return _this3.translate.apply(_this3, args.concat([key]));
1031
893
  }, options);
1032
894
  if (options.interpolation) this.interpolator.reset();
1033
895
  }
1034
-
1035
896
  var postProcess = options.postProcess || this.options.postProcess;
1036
897
  var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
1037
-
1038
898
  if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
1039
- res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2$1({
899
+ res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4$1({
1040
900
  i18nResolved: resolved
1041
901
  }, options) : options, this);
1042
902
  }
1043
-
1044
903
  return res;
1045
904
  }
1046
905
  }, {
1047
906
  key: "resolve",
1048
907
  value: function resolve(keys) {
1049
908
  var _this4 = this;
1050
-
1051
909
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1052
910
  var found;
1053
911
  var usedKey;
@@ -1057,65 +915,50 @@ var Translator = function (_EventEmitter) {
1057
915
  if (typeof keys === 'string') keys = [keys];
1058
916
  keys.forEach(function (k) {
1059
917
  if (_this4.isValidLookup(found)) return;
1060
-
1061
918
  var extracted = _this4.extractFromKey(k, options);
1062
-
1063
919
  var key = extracted.key;
1064
920
  usedKey = key;
1065
921
  var namespaces = extracted.namespaces;
1066
922
  if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
1067
923
  var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
1068
-
1069
924
  var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
1070
-
1071
925
  var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
1072
926
  var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
1073
927
  namespaces.forEach(function (ns) {
1074
928
  if (_this4.isValidLookup(found)) return;
1075
929
  usedNS = ns;
1076
-
1077
930
  if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
1078
931
  checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
1079
-
1080
932
  _this4.logger.warn("key \"".concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(usedNS, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
1081
933
  }
1082
-
1083
934
  codes.forEach(function (code) {
1084
935
  if (_this4.isValidLookup(found)) return;
1085
936
  usedLng = code;
1086
937
  var finalKeys = [key];
1087
-
1088
938
  if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
1089
939
  _this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
1090
940
  } else {
1091
941
  var pluralSuffix;
1092
942
  if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
1093
943
  var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero");
1094
-
1095
944
  if (needsPluralHandling) {
1096
945
  finalKeys.push(key + pluralSuffix);
1097
-
1098
946
  if (needsZeroSuffixLookup) {
1099
947
  finalKeys.push(key + zeroSuffix);
1100
948
  }
1101
949
  }
1102
-
1103
950
  if (needsContextHandling) {
1104
951
  var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
1105
952
  finalKeys.push(contextKey);
1106
-
1107
953
  if (needsPluralHandling) {
1108
954
  finalKeys.push(contextKey + pluralSuffix);
1109
-
1110
955
  if (needsZeroSuffixLookup) {
1111
956
  finalKeys.push(contextKey + zeroSuffix);
1112
957
  }
1113
958
  }
1114
959
  }
1115
960
  }
1116
-
1117
961
  var possibleKey;
1118
-
1119
962
  while (possibleKey = finalKeys.pop()) {
1120
963
  if (!_this4.isValidLookup(found)) {
1121
964
  exactUsedKey = possibleKey;
@@ -1149,33 +992,27 @@ var Translator = function (_EventEmitter) {
1149
992
  key: "hasDefaultValue",
1150
993
  value: function hasDefaultValue(options) {
1151
994
  var prefix = 'defaultValue';
1152
-
1153
995
  for (var option in options) {
1154
996
  if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
1155
997
  return true;
1156
998
  }
1157
999
  }
1158
-
1159
1000
  return false;
1160
1001
  }
1161
1002
  }]);
1162
-
1163
1003
  return Translator;
1164
1004
  }(EventEmitter);
1165
1005
 
1166
1006
  function capitalize$1(string) {
1167
1007
  return string.charAt(0).toUpperCase() + string.slice(1);
1168
1008
  }
1169
-
1170
1009
  var LanguageUtil = function () {
1171
1010
  function LanguageUtil(options) {
1172
1011
  _classCallCheck(this, LanguageUtil);
1173
-
1174
1012
  this.options = options;
1175
1013
  this.supportedLngs = this.options.supportedLngs || false;
1176
1014
  this.logger = baseLogger.create('languageUtils');
1177
1015
  }
1178
-
1179
1016
  _createClass(LanguageUtil, [{
1180
1017
  key: "getScriptPartFromCode",
1181
1018
  value: function getScriptPartFromCode(code) {
@@ -1199,7 +1036,6 @@ var LanguageUtil = function () {
1199
1036
  if (typeof code === 'string' && code.indexOf('-') > -1) {
1200
1037
  var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
1201
1038
  var p = code.split('-');
1202
-
1203
1039
  if (this.options.lowerCaseLng) {
1204
1040
  p = p.map(function (part) {
1205
1041
  return part.toLowerCase();
@@ -1215,10 +1051,8 @@ var LanguageUtil = function () {
1215
1051
  if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
1216
1052
  if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize$1(p[2].toLowerCase());
1217
1053
  }
1218
-
1219
1054
  return p.join('-');
1220
1055
  }
1221
-
1222
1056
  return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
1223
1057
  }
1224
1058
  }, {
@@ -1227,37 +1061,29 @@ var LanguageUtil = function () {
1227
1061
  if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
1228
1062
  code = this.getLanguagePartFromCode(code);
1229
1063
  }
1230
-
1231
1064
  return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
1232
1065
  }
1233
1066
  }, {
1234
1067
  key: "getBestMatchFromCodes",
1235
1068
  value: function getBestMatchFromCodes(codes) {
1236
1069
  var _this = this;
1237
-
1238
1070
  if (!codes) return null;
1239
1071
  var found;
1240
1072
  codes.forEach(function (code) {
1241
1073
  if (found) return;
1242
-
1243
1074
  var cleanedLng = _this.formatLanguageCode(code);
1244
-
1245
1075
  if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
1246
1076
  });
1247
-
1248
1077
  if (!found && this.options.supportedLngs) {
1249
1078
  codes.forEach(function (code) {
1250
1079
  if (found) return;
1251
-
1252
1080
  var lngOnly = _this.getLanguagePartFromCode(code);
1253
-
1254
1081
  if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
1255
1082
  found = _this.options.supportedLngs.find(function (supportedLng) {
1256
1083
  if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
1257
1084
  });
1258
1085
  });
1259
1086
  }
1260
-
1261
1087
  if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
1262
1088
  return found;
1263
1089
  }
@@ -1280,20 +1106,16 @@ var LanguageUtil = function () {
1280
1106
  key: "toResolveHierarchy",
1281
1107
  value: function toResolveHierarchy(code, fallbackCode) {
1282
1108
  var _this2 = this;
1283
-
1284
1109
  var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1285
1110
  var codes = [];
1286
-
1287
1111
  var addCode = function addCode(c) {
1288
1112
  if (!c) return;
1289
-
1290
1113
  if (_this2.isSupportedCode(c)) {
1291
1114
  codes.push(c);
1292
1115
  } else {
1293
1116
  _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
1294
1117
  }
1295
1118
  };
1296
-
1297
1119
  if (typeof code === 'string' && code.indexOf('-') > -1) {
1298
1120
  if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
1299
1121
  if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
@@ -1301,14 +1123,12 @@ var LanguageUtil = function () {
1301
1123
  } else if (typeof code === 'string') {
1302
1124
  addCode(this.formatLanguageCode(code));
1303
1125
  }
1304
-
1305
1126
  fallbackCodes.forEach(function (fc) {
1306
1127
  if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
1307
1128
  });
1308
1129
  return codes;
1309
1130
  }
1310
1131
  }]);
1311
-
1312
1132
  return LanguageUtil;
1313
1133
  }();
1314
1134
 
@@ -1482,7 +1302,6 @@ var suffixesOrder = {
1482
1302
  many: 4,
1483
1303
  other: 5
1484
1304
  };
1485
-
1486
1305
  function createRules() {
1487
1306
  var rules = {};
1488
1307
  sets.forEach(function (set) {
@@ -1495,25 +1314,19 @@ function createRules() {
1495
1314
  });
1496
1315
  return rules;
1497
1316
  }
1498
-
1499
1317
  var PluralResolver = function () {
1500
1318
  function PluralResolver(languageUtils) {
1501
1319
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1502
-
1503
1320
  _classCallCheck(this, PluralResolver);
1504
-
1505
1321
  this.languageUtils = languageUtils;
1506
1322
  this.options = options;
1507
1323
  this.logger = baseLogger.create('pluralResolver');
1508
-
1509
1324
  if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
1510
1325
  this.options.compatibilityJSON = 'v3';
1511
1326
  this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');
1512
1327
  }
1513
-
1514
1328
  this.rules = createRules();
1515
1329
  }
1516
-
1517
1330
  _createClass(PluralResolver, [{
1518
1331
  key: "addRule",
1519
1332
  value: function addRule(lng, obj) {
@@ -1523,7 +1336,6 @@ var PluralResolver = function () {
1523
1336
  key: "getRule",
1524
1337
  value: function getRule(code) {
1525
1338
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1526
-
1527
1339
  if (this.shouldUseIntlApi()) {
1528
1340
  try {
1529
1341
  return new Intl.PluralRules(code, {
@@ -1533,7 +1345,6 @@ var PluralResolver = function () {
1533
1345
  return;
1534
1346
  }
1535
1347
  }
1536
-
1537
1348
  return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
1538
1349
  }
1539
1350
  }, {
@@ -1541,11 +1352,9 @@ var PluralResolver = function () {
1541
1352
  value: function needsPlural(code) {
1542
1353
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1543
1354
  var rule = this.getRule(code, options);
1544
-
1545
1355
  if (this.shouldUseIntlApi()) {
1546
1356
  return rule && rule.resolvedOptions().pluralCategories.length > 1;
1547
1357
  }
1548
-
1549
1358
  return rule && rule.numbers.length > 1;
1550
1359
  }
1551
1360
  }, {
@@ -1560,14 +1369,11 @@ var PluralResolver = function () {
1560
1369
  key: "getSuffixes",
1561
1370
  value: function getSuffixes(code) {
1562
1371
  var _this = this;
1563
-
1564
1372
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1565
1373
  var rule = this.getRule(code, options);
1566
-
1567
1374
  if (!rule) {
1568
1375
  return [];
1569
1376
  }
1570
-
1571
1377
  if (this.shouldUseIntlApi()) {
1572
1378
  return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
1573
1379
  return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
@@ -1575,7 +1381,6 @@ var PluralResolver = function () {
1575
1381
  return "".concat(_this.options.prepend).concat(pluralCategory);
1576
1382
  });
1577
1383
  }
1578
-
1579
1384
  return rule.numbers.map(function (number) {
1580
1385
  return _this.getSuffix(code, number, options);
1581
1386
  });
@@ -1585,15 +1390,12 @@ var PluralResolver = function () {
1585
1390
  value: function getSuffix(code, count) {
1586
1391
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1587
1392
  var rule = this.getRule(code, options);
1588
-
1589
1393
  if (rule) {
1590
1394
  if (this.shouldUseIntlApi()) {
1591
1395
  return "".concat(this.options.prepend).concat(rule.select(count));
1592
1396
  }
1593
-
1594
1397
  return this.getSuffixRetroCompatible(rule, count);
1595
1398
  }
1596
-
1597
1399
  this.logger.warn("no plural rule found for: ".concat(code));
1598
1400
  return '';
1599
1401
  }
@@ -1601,10 +1403,8 @@ var PluralResolver = function () {
1601
1403
  key: "getSuffixRetroCompatible",
1602
1404
  value: function getSuffixRetroCompatible(rule, count) {
1603
1405
  var _this2 = this;
1604
-
1605
1406
  var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
1606
1407
  var suffix = rule.numbers[idx];
1607
-
1608
1408
  if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1609
1409
  if (suffix === 2) {
1610
1410
  suffix = 'plural';
@@ -1612,11 +1412,9 @@ var PluralResolver = function () {
1612
1412
  suffix = '';
1613
1413
  }
1614
1414
  }
1615
-
1616
1415
  var returnSuffix = function returnSuffix() {
1617
1416
  return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
1618
1417
  };
1619
-
1620
1418
  if (this.options.compatibilityJSON === 'v1') {
1621
1419
  if (suffix === 1) return '';
1622
1420
  if (typeof suffix === 'number') return "_plural_".concat(suffix.toString());
@@ -1626,7 +1424,6 @@ var PluralResolver = function () {
1626
1424
  } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1627
1425
  return returnSuffix();
1628
1426
  }
1629
-
1630
1427
  return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
1631
1428
  }
1632
1429
  }, {
@@ -1635,30 +1432,22 @@ var PluralResolver = function () {
1635
1432
  return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
1636
1433
  }
1637
1434
  }]);
1638
-
1639
1435
  return PluralResolver;
1640
1436
  }();
1641
1437
 
1642
- function ownKeys$3$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1643
-
1644
- function _objectSpread$3$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1645
-
1438
+ function ownKeys$3$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1439
+ function _objectSpread$3$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1646
1440
  var Interpolator = function () {
1647
1441
  function Interpolator() {
1648
1442
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1649
-
1650
1443
  _classCallCheck(this, Interpolator);
1651
-
1652
1444
  this.logger = baseLogger.create('interpolator');
1653
1445
  this.options = options;
1654
-
1655
1446
  this.format = options.interpolation && options.interpolation.format || function (value) {
1656
1447
  return value;
1657
1448
  };
1658
-
1659
1449
  this.init(options);
1660
1450
  }
1661
-
1662
1451
  _createClass(Interpolator, [{
1663
1452
  key: "init",
1664
1453
  value: function init() {
@@ -1701,16 +1490,13 @@ var Interpolator = function () {
1701
1490
  key: "interpolate",
1702
1491
  value: function interpolate(str, data, lng, options) {
1703
1492
  var _this = this;
1704
-
1705
1493
  var match;
1706
1494
  var value;
1707
1495
  var replaces;
1708
1496
  var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1709
-
1710
1497
  function regexSafe(val) {
1711
1498
  return val.replace(/\$/g, '$$$$');
1712
1499
  }
1713
-
1714
1500
  var handleFormat = function handleFormat(key) {
1715
1501
  if (key.indexOf(_this.formatSeparator) < 0) {
1716
1502
  var path = getPathWithDefaults(data, defaultData, key);
@@ -1718,7 +1504,6 @@ var Interpolator = function () {
1718
1504
  interpolationkey: key
1719
1505
  })) : path;
1720
1506
  }
1721
-
1722
1507
  var p = key.split(_this.formatSeparator);
1723
1508
  var k = p.shift().trim();
1724
1509
  var f = p.join(_this.formatSeparator).trim();
@@ -1726,7 +1511,6 @@ var Interpolator = function () {
1726
1511
  interpolationkey: k
1727
1512
  }));
1728
1513
  };
1729
-
1730
1514
  this.resetRegExp();
1731
1515
  var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
1732
1516
  var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
@@ -1743,11 +1527,9 @@ var Interpolator = function () {
1743
1527
  }];
1744
1528
  todos.forEach(function (todo) {
1745
1529
  replaces = 0;
1746
-
1747
1530
  while (match = todo.regex.exec(str)) {
1748
1531
  var matchedVar = match[1].trim();
1749
1532
  value = handleFormat(matchedVar);
1750
-
1751
1533
  if (value === undefined) {
1752
1534
  if (typeof missingInterpolationHandler === 'function') {
1753
1535
  var temp = missingInterpolationHandler(str, match, options);
@@ -1759,25 +1541,20 @@ var Interpolator = function () {
1759
1541
  continue;
1760
1542
  } else {
1761
1543
  _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
1762
-
1763
1544
  value = '';
1764
1545
  }
1765
1546
  } else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
1766
1547
  value = makeString(value);
1767
1548
  }
1768
-
1769
1549
  var safeValue = todo.safeValue(value);
1770
1550
  str = str.replace(match[0], safeValue);
1771
-
1772
1551
  if (skipOnVariables) {
1773
1552
  todo.regex.lastIndex += value.length;
1774
1553
  todo.regex.lastIndex -= match[0].length;
1775
1554
  } else {
1776
1555
  todo.regex.lastIndex = 0;
1777
1556
  }
1778
-
1779
1557
  replaces++;
1780
-
1781
1558
  if (replaces >= _this.maxReplaces) {
1782
1559
  break;
1783
1560
  }
@@ -1789,16 +1566,10 @@ var Interpolator = function () {
1789
1566
  key: "nest",
1790
1567
  value: function nest(str, fc) {
1791
1568
  var _this2 = this;
1792
-
1793
1569
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1794
1570
  var match;
1795
1571
  var value;
1796
-
1797
- var clonedOptions = _objectSpread$3$1({}, options);
1798
-
1799
- clonedOptions.applyPostProcessor = false;
1800
- delete clonedOptions.defaultValue;
1801
-
1572
+ var clonedOptions;
1802
1573
  function handleHasOptions(key, inheritedOptions) {
1803
1574
  var sep = this.nestingOptionsSeparator;
1804
1575
  if (key.indexOf(sep) < 0) return key;
@@ -1808,11 +1579,9 @@ var Interpolator = function () {
1808
1579
  optionsString = this.interpolate(optionsString, clonedOptions);
1809
1580
  var matchedSingleQuotes = optionsString.match(/'/g);
1810
1581
  var matchedDoubleQuotes = optionsString.match(/"/g);
1811
-
1812
1582
  if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1813
1583
  optionsString = optionsString.replace(/'/g, '"');
1814
1584
  }
1815
-
1816
1585
  try {
1817
1586
  clonedOptions = JSON.parse(optionsString);
1818
1587
  if (inheritedOptions) clonedOptions = _objectSpread$3$1(_objectSpread$3$1({}, inheritedOptions), clonedOptions);
@@ -1820,15 +1589,15 @@ var Interpolator = function () {
1820
1589
  this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
1821
1590
  return "".concat(key).concat(sep).concat(optionsString);
1822
1591
  }
1823
-
1824
1592
  delete clonedOptions.defaultValue;
1825
1593
  return key;
1826
1594
  }
1827
-
1828
1595
  while (match = this.nestingRegexp.exec(str)) {
1829
1596
  var formatters = [];
1597
+ clonedOptions = _objectSpread$3$1({}, options);
1598
+ clonedOptions.applyPostProcessor = false;
1599
+ delete clonedOptions.defaultValue;
1830
1600
  var doReduce = false;
1831
-
1832
1601
  if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
1833
1602
  var r = match[1].split(this.formatSeparator).map(function (elem) {
1834
1603
  return elem.trim();
@@ -1837,16 +1606,13 @@ var Interpolator = function () {
1837
1606
  formatters = r;
1838
1607
  doReduce = true;
1839
1608
  }
1840
-
1841
1609
  value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1842
1610
  if (value && match[0] === str && typeof value !== 'string') return value;
1843
1611
  if (typeof value !== 'string') value = makeString(value);
1844
-
1845
1612
  if (!value) {
1846
1613
  this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str));
1847
1614
  value = '';
1848
1615
  }
1849
-
1850
1616
  if (doReduce) {
1851
1617
  value = formatters.reduce(function (v, f) {
1852
1618
  return _this2.format(v, f, options.lng, _objectSpread$3$1(_objectSpread$3$1({}, options), {}, {
@@ -1854,31 +1620,24 @@ var Interpolator = function () {
1854
1620
  }));
1855
1621
  }, value.trim());
1856
1622
  }
1857
-
1858
1623
  str = str.replace(match[0], value);
1859
1624
  this.regexp.lastIndex = 0;
1860
1625
  }
1861
-
1862
1626
  return str;
1863
1627
  }
1864
1628
  }]);
1865
-
1866
1629
  return Interpolator;
1867
1630
  }();
1868
1631
 
1869
- function ownKeys$4$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1870
-
1871
- function _objectSpread$4$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1872
-
1632
+ function ownKeys$2$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1633
+ function _objectSpread$2$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1873
1634
  function parseFormatStr(formatStr) {
1874
1635
  var formatName = formatStr.toLowerCase().trim();
1875
1636
  var formatOptions = {};
1876
-
1877
1637
  if (formatStr.indexOf('(') > -1) {
1878
1638
  var p = formatStr.split('(');
1879
1639
  formatName = p[0].toLowerCase().trim();
1880
1640
  var optStr = p[1].substring(0, p[1].length - 1);
1881
-
1882
1641
  if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1883
1642
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1884
1643
  } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
@@ -1887,12 +1646,10 @@ function parseFormatStr(formatStr) {
1887
1646
  var opts = optStr.split(';');
1888
1647
  opts.forEach(function (opt) {
1889
1648
  if (!opt) return;
1890
-
1891
1649
  var _opt$split = opt.split(':'),
1892
- _opt$split2 = _toArray(_opt$split),
1893
- key = _opt$split2[0],
1894
- rest = _opt$split2.slice(1);
1895
-
1650
+ _opt$split2 = _toArray(_opt$split),
1651
+ key = _opt$split2[0],
1652
+ rest = _opt$split2.slice(1);
1896
1653
  var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1897
1654
  if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
1898
1655
  if (val === 'false') formatOptions[key.trim()] = false;
@@ -1901,34 +1658,27 @@ function parseFormatStr(formatStr) {
1901
1658
  });
1902
1659
  }
1903
1660
  }
1904
-
1905
1661
  return {
1906
1662
  formatName: formatName,
1907
1663
  formatOptions: formatOptions
1908
1664
  };
1909
1665
  }
1910
-
1911
1666
  function createCachedFormatter(fn) {
1912
1667
  var cache = {};
1913
1668
  return function invokeFormatter(val, lng, options) {
1914
1669
  var key = lng + JSON.stringify(options);
1915
1670
  var formatter = cache[key];
1916
-
1917
1671
  if (!formatter) {
1918
1672
  formatter = fn(lng, options);
1919
1673
  cache[key] = formatter;
1920
1674
  }
1921
-
1922
1675
  return formatter(val);
1923
1676
  };
1924
1677
  }
1925
-
1926
1678
  var Formatter = function () {
1927
1679
  function Formatter() {
1928
1680
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1929
-
1930
1681
  _classCallCheck(this, Formatter);
1931
-
1932
1682
  this.logger = baseLogger.create('formatter');
1933
1683
  this.options = options;
1934
1684
  this.formats = {
@@ -1939,7 +1689,7 @@ var Formatter = function () {
1939
1689
  };
1940
1690
  }),
1941
1691
  currency: createCachedFormatter(function (lng, options) {
1942
- var formatter = new Intl.NumberFormat(lng, _objectSpread$4$1(_objectSpread$4$1({}, options), {}, {
1692
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
1943
1693
  style: 'currency'
1944
1694
  }));
1945
1695
  return function (val) {
@@ -1947,19 +1697,19 @@ var Formatter = function () {
1947
1697
  };
1948
1698
  }),
1949
1699
  datetime: createCachedFormatter(function (lng, options) {
1950
- var formatter = new Intl.DateTimeFormat(lng, _objectSpread$4$1({}, options));
1700
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2$1({}, options));
1951
1701
  return function (val) {
1952
1702
  return formatter.format(val);
1953
1703
  };
1954
1704
  }),
1955
1705
  relativetime: createCachedFormatter(function (lng, options) {
1956
- var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$4$1({}, options));
1706
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2$1({}, options));
1957
1707
  return function (val) {
1958
1708
  return formatter.format(val, options.range || 'day');
1959
1709
  };
1960
1710
  }),
1961
1711
  list: createCachedFormatter(function (lng, options) {
1962
- var formatter = new Intl.ListFormat(lng, _objectSpread$4$1({}, options));
1712
+ var formatter = new Intl.ListFormat(lng, _objectSpread$2$1({}, options));
1963
1713
  return function (val) {
1964
1714
  return formatter.format(val);
1965
1715
  };
@@ -1967,7 +1717,6 @@ var Formatter = function () {
1967
1717
  };
1968
1718
  this.init(options);
1969
1719
  }
1970
-
1971
1720
  _createClass(Formatter, [{
1972
1721
  key: "init",
1973
1722
  value: function init(services) {
@@ -1991,72 +1740,53 @@ var Formatter = function () {
1991
1740
  key: "format",
1992
1741
  value: function format(value, _format, lng, options) {
1993
1742
  var _this = this;
1994
-
1995
1743
  var formats = _format.split(this.formatSeparator);
1996
-
1997
1744
  var result = formats.reduce(function (mem, f) {
1998
1745
  var _parseFormatStr = parseFormatStr(f),
1999
- formatName = _parseFormatStr.formatName,
2000
- formatOptions = _parseFormatStr.formatOptions;
2001
-
1746
+ formatName = _parseFormatStr.formatName,
1747
+ formatOptions = _parseFormatStr.formatOptions;
2002
1748
  if (_this.formats[formatName]) {
2003
1749
  var formatted = mem;
2004
-
2005
1750
  try {
2006
1751
  var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
2007
1752
  var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
2008
- formatted = _this.formats[formatName](mem, l, _objectSpread$4$1(_objectSpread$4$1(_objectSpread$4$1({}, formatOptions), options), valOptions));
1753
+ formatted = _this.formats[formatName](mem, l, _objectSpread$2$1(_objectSpread$2$1(_objectSpread$2$1({}, formatOptions), options), valOptions));
2009
1754
  } catch (error) {
2010
1755
  _this.logger.warn(error);
2011
1756
  }
2012
-
2013
1757
  return formatted;
2014
1758
  } else {
2015
1759
  _this.logger.warn("there was no format function for ".concat(formatName));
2016
1760
  }
2017
-
2018
1761
  return mem;
2019
1762
  }, value);
2020
1763
  return result;
2021
1764
  }
2022
1765
  }]);
2023
-
2024
1766
  return Formatter;
2025
1767
  }();
2026
1768
 
2027
- function ownKeys$5$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2028
-
2029
- function _objectSpread$5$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2030
-
2031
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2032
-
2033
- function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2034
-
1769
+ function ownKeys$1$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1770
+ function _objectSpread$1$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1771
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1772
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2035
1773
  function removePending(q, name) {
2036
1774
  if (q.pending[name] !== undefined) {
2037
1775
  delete q.pending[name];
2038
1776
  q.pendingCount--;
2039
1777
  }
2040
1778
  }
2041
-
2042
1779
  var Connector = function (_EventEmitter) {
2043
1780
  _inherits(Connector, _EventEmitter);
2044
-
2045
- var _super = _createSuper$2(Connector);
2046
-
1781
+ var _super = _createSuper$1(Connector);
2047
1782
  function Connector(backend, store, services) {
2048
1783
  var _this;
2049
-
2050
1784
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2051
-
2052
1785
  _classCallCheck(this, Connector);
2053
-
2054
1786
  _this = _super.call(this);
2055
-
2056
1787
  if (isIE10) {
2057
1788
  EventEmitter.call(_assertThisInitialized(_this));
2058
1789
  }
2059
-
2060
1790
  _this.backend = backend;
2061
1791
  _this.store = store;
2062
1792
  _this.services = services;
@@ -2070,19 +1800,15 @@ var Connector = function (_EventEmitter) {
2070
1800
  _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
2071
1801
  _this.state = {};
2072
1802
  _this.queue = [];
2073
-
2074
1803
  if (_this.backend && _this.backend.init) {
2075
1804
  _this.backend.init(services, options.backend, options);
2076
1805
  }
2077
-
2078
1806
  return _this;
2079
1807
  }
2080
-
2081
1808
  _createClass(Connector, [{
2082
1809
  key: "queueLoad",
2083
1810
  value: function queueLoad(languages, namespaces, options, callback) {
2084
1811
  var _this2 = this;
2085
-
2086
1812
  var toLoad = {};
2087
1813
  var pending = {};
2088
1814
  var toLoadLanguages = {};
@@ -2091,7 +1817,6 @@ var Connector = function (_EventEmitter) {
2091
1817
  var hasAllNamespaces = true;
2092
1818
  namespaces.forEach(function (ns) {
2093
1819
  var name = "".concat(lng, "|").concat(ns);
2094
-
2095
1820
  if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
2096
1821
  _this2.state[name] = 2;
2097
1822
  } else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
@@ -2106,7 +1831,6 @@ var Connector = function (_EventEmitter) {
2106
1831
  });
2107
1832
  if (!hasAllNamespaces) toLoadLanguages[lng] = true;
2108
1833
  });
2109
-
2110
1834
  if (Object.keys(toLoad).length || Object.keys(pending).length) {
2111
1835
  this.queue.push({
2112
1836
  pending: pending,
@@ -2116,7 +1840,6 @@ var Connector = function (_EventEmitter) {
2116
1840
  callback: callback
2117
1841
  });
2118
1842
  }
2119
-
2120
1843
  return {
2121
1844
  toLoad: Object.keys(toLoad),
2122
1845
  pending: Object.keys(pending),
@@ -2131,23 +1854,19 @@ var Connector = function (_EventEmitter) {
2131
1854
  var lng = s[0];
2132
1855
  var ns = s[1];
2133
1856
  if (err) this.emit('failedLoading', lng, ns, err);
2134
-
2135
1857
  if (data) {
2136
1858
  this.store.addResourceBundle(lng, ns, data);
2137
1859
  }
2138
-
2139
1860
  this.state[name] = err ? -1 : 2;
2140
1861
  var loaded = {};
2141
1862
  this.queue.forEach(function (q) {
2142
1863
  pushPath(q.loaded, [lng], ns);
2143
1864
  removePending(q, name);
2144
1865
  if (err) q.errors.push(err);
2145
-
2146
1866
  if (q.pendingCount === 0 && !q.done) {
2147
1867
  Object.keys(q.loaded).forEach(function (l) {
2148
1868
  if (!loaded[l]) loaded[l] = {};
2149
1869
  var loadedKeys = q.loaded[l];
2150
-
2151
1870
  if (loadedKeys.length) {
2152
1871
  loadedKeys.forEach(function (ns) {
2153
1872
  if (loaded[l][ns] === undefined) loaded[l][ns] = true;
@@ -2155,7 +1874,6 @@ var Connector = function (_EventEmitter) {
2155
1874
  }
2156
1875
  });
2157
1876
  q.done = true;
2158
-
2159
1877
  if (q.errors.length) {
2160
1878
  q.callback(q.errors);
2161
1879
  } else {
@@ -2172,12 +1890,10 @@ var Connector = function (_EventEmitter) {
2172
1890
  key: "read",
2173
1891
  value: function read(lng, ns, fcName) {
2174
1892
  var _this3 = this;
2175
-
2176
1893
  var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2177
1894
  var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
2178
1895
  var callback = arguments.length > 5 ? arguments[5] : undefined;
2179
1896
  if (!lng.length) return callback(null, {});
2180
-
2181
1897
  if (this.readingCalls >= this.maxParallelReads) {
2182
1898
  this.waitingReads.push({
2183
1899
  lng: lng,
@@ -2189,49 +1905,56 @@ var Connector = function (_EventEmitter) {
2189
1905
  });
2190
1906
  return;
2191
1907
  }
2192
-
2193
1908
  this.readingCalls++;
2194
- return this.backend[fcName](lng, ns, function (err, data) {
1909
+ var resolver = function resolver(err, data) {
2195
1910
  _this3.readingCalls--;
2196
-
2197
1911
  if (_this3.waitingReads.length > 0) {
2198
1912
  var next = _this3.waitingReads.shift();
2199
-
2200
1913
  _this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
2201
1914
  }
2202
-
2203
1915
  if (err && data && tried < _this3.maxRetries) {
2204
1916
  setTimeout(function () {
2205
1917
  _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
2206
1918
  }, wait);
2207
1919
  return;
2208
1920
  }
2209
-
2210
1921
  callback(err, data);
2211
- });
1922
+ };
1923
+ var fc = this.backend[fcName].bind(this.backend);
1924
+ if (fc.length === 2) {
1925
+ try {
1926
+ var r = fc(lng, ns);
1927
+ if (r && typeof r.then === 'function') {
1928
+ r.then(function (data) {
1929
+ return resolver(null, data);
1930
+ })["catch"](resolver);
1931
+ } else {
1932
+ resolver(null, r);
1933
+ }
1934
+ } catch (err) {
1935
+ resolver(err);
1936
+ }
1937
+ return;
1938
+ }
1939
+ return fc(lng, ns, resolver);
2212
1940
  }
2213
1941
  }, {
2214
1942
  key: "prepareLoading",
2215
1943
  value: function prepareLoading(languages, namespaces) {
2216
1944
  var _this4 = this;
2217
-
2218
1945
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2219
1946
  var callback = arguments.length > 3 ? arguments[3] : undefined;
2220
-
2221
1947
  if (!this.backend) {
2222
1948
  this.logger.warn('No backend was added via i18next.use. Will not load resources.');
2223
1949
  return callback && callback();
2224
1950
  }
2225
-
2226
1951
  if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
2227
1952
  if (typeof namespaces === 'string') namespaces = [namespaces];
2228
1953
  var toLoad = this.queueLoad(languages, namespaces, options, callback);
2229
-
2230
1954
  if (!toLoad.toLoad.length) {
2231
1955
  if (!toLoad.pending.length) callback();
2232
1956
  return null;
2233
1957
  }
2234
-
2235
1958
  toLoad.toLoad.forEach(function (name) {
2236
1959
  _this4.loadOne(name);
2237
1960
  });
@@ -2252,7 +1975,6 @@ var Connector = function (_EventEmitter) {
2252
1975
  key: "loadOne",
2253
1976
  value: function loadOne(name) {
2254
1977
  var _this5 = this;
2255
-
2256
1978
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2257
1979
  var s = name.split('|');
2258
1980
  var lng = s[0];
@@ -2260,7 +1982,6 @@ var Connector = function (_EventEmitter) {
2260
1982
  this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
2261
1983
  if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
2262
1984
  if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
2263
-
2264
1985
  _this5.loaded(name, err, data);
2265
1986
  });
2266
1987
  }
@@ -2268,25 +1989,43 @@ var Connector = function (_EventEmitter) {
2268
1989
  key: "saveMissing",
2269
1990
  value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
2270
1991
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2271
-
1992
+ var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
2272
1993
  if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
2273
1994
  this.logger.warn("did not save key \"".concat(key, "\" as the namespace \"").concat(namespace, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
2274
1995
  return;
2275
1996
  }
2276
-
2277
1997
  if (key === undefined || key === null || key === '') return;
2278
-
2279
1998
  if (this.backend && this.backend.create) {
2280
- this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5$1(_objectSpread$5$1({}, options), {}, {
1999
+ var opts = _objectSpread$1$1(_objectSpread$1$1({}, options), {}, {
2281
2000
  isUpdate: isUpdate
2282
- }));
2001
+ });
2002
+ var fc = this.backend.create.bind(this.backend);
2003
+ if (fc.length < 6) {
2004
+ try {
2005
+ var r;
2006
+ if (fc.length === 5) {
2007
+ r = fc(languages, namespace, key, fallbackValue, opts);
2008
+ } else {
2009
+ r = fc(languages, namespace, key, fallbackValue);
2010
+ }
2011
+ if (r && typeof r.then === 'function') {
2012
+ r.then(function (data) {
2013
+ return clb(null, data);
2014
+ })["catch"](clb);
2015
+ } else {
2016
+ clb(null, r);
2017
+ }
2018
+ } catch (err) {
2019
+ clb(err);
2020
+ }
2021
+ } else {
2022
+ fc(languages, namespace, key, fallbackValue, clb, opts);
2023
+ }
2283
2024
  }
2284
-
2285
2025
  if (!languages || !languages[0]) return;
2286
2026
  this.store.addResource(languages[0], namespace, key, fallbackValue);
2287
2027
  }
2288
2028
  }]);
2289
-
2290
2029
  return Connector;
2291
2030
  }(EventEmitter);
2292
2031
 
@@ -2329,14 +2068,12 @@ function get() {
2329
2068
  if (_typeof(args[1]) === 'object') ret = args[1];
2330
2069
  if (typeof args[1] === 'string') ret.defaultValue = args[1];
2331
2070
  if (typeof args[2] === 'string') ret.tDescription = args[2];
2332
-
2333
2071
  if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {
2334
2072
  var options = args[3] || args[2];
2335
2073
  Object.keys(options).forEach(function (key) {
2336
2074
  ret[key] = options[key];
2337
2075
  });
2338
2076
  }
2339
-
2340
2077
  return ret;
2341
2078
  },
2342
2079
  interpolation: {
@@ -2360,24 +2097,17 @@ function transformOptions(options) {
2360
2097
  if (typeof options.ns === 'string') options.ns = [options.ns];
2361
2098
  if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
2362
2099
  if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
2363
-
2364
2100
  if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
2365
2101
  options.supportedLngs = options.supportedLngs.concat(['cimode']);
2366
2102
  }
2367
-
2368
2103
  return options;
2369
2104
  }
2370
2105
 
2371
- function ownKeys$6$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2372
-
2373
- function _objectSpread$6$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2374
-
2375
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2376
-
2377
- function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2378
-
2106
+ function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2107
+ function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2108
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2109
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2379
2110
  function noop$1() {}
2380
-
2381
2111
  function bindMemberFunctions(inst) {
2382
2112
  var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
2383
2113
  mems.forEach(function (mem) {
@@ -2386,26 +2116,18 @@ function bindMemberFunctions(inst) {
2386
2116
  }
2387
2117
  });
2388
2118
  }
2389
-
2390
2119
  var I18n = function (_EventEmitter) {
2391
2120
  _inherits(I18n, _EventEmitter);
2392
-
2393
- var _super = _createSuper$3(I18n);
2394
-
2121
+ var _super = _createSuper(I18n);
2395
2122
  function I18n() {
2396
2123
  var _this;
2397
-
2398
2124
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2399
2125
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2400
-
2401
2126
  _classCallCheck(this, I18n);
2402
-
2403
2127
  _this = _super.call(this);
2404
-
2405
2128
  if (isIE10) {
2406
2129
  EventEmitter.call(_assertThisInitialized(_this));
2407
2130
  }
2408
-
2409
2131
  _this.options = transformOptions(options);
2410
2132
  _this.services = {};
2411
2133
  _this.logger = baseLogger;
@@ -2413,35 +2135,27 @@ var I18n = function (_EventEmitter) {
2413
2135
  external: []
2414
2136
  };
2415
2137
  bindMemberFunctions(_assertThisInitialized(_this));
2416
-
2417
2138
  if (callback && !_this.isInitialized && !options.isClone) {
2418
2139
  if (!_this.options.initImmediate) {
2419
2140
  _this.init(options, callback);
2420
-
2421
2141
  return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
2422
2142
  }
2423
-
2424
2143
  setTimeout(function () {
2425
2144
  _this.init(options, callback);
2426
2145
  }, 0);
2427
2146
  }
2428
-
2429
2147
  return _this;
2430
2148
  }
2431
-
2432
2149
  _createClass(I18n, [{
2433
2150
  key: "init",
2434
2151
  value: function init() {
2435
2152
  var _this2 = this;
2436
-
2437
2153
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2438
2154
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2439
-
2440
2155
  if (typeof options === 'function') {
2441
2156
  callback = options;
2442
2157
  options = {};
2443
2158
  }
2444
-
2445
2159
  if (!options.defaultNS && options.defaultNS !== false && options.ns) {
2446
2160
  if (typeof options.ns === 'string') {
2447
2161
  options.defaultNS = options.ns;
@@ -2449,43 +2163,34 @@ var I18n = function (_EventEmitter) {
2449
2163
  options.defaultNS = options.ns[0];
2450
2164
  }
2451
2165
  }
2452
-
2453
2166
  var defOpts = get();
2454
- this.options = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, defOpts), this.options), transformOptions(options));
2455
-
2167
+ this.options = _objectSpread$d(_objectSpread$d(_objectSpread$d({}, defOpts), this.options), transformOptions(options));
2456
2168
  if (this.options.compatibilityAPI !== 'v1') {
2457
- this.options.interpolation = _objectSpread$6$1(_objectSpread$6$1({}, defOpts.interpolation), this.options.interpolation);
2169
+ this.options.interpolation = _objectSpread$d(_objectSpread$d({}, defOpts.interpolation), this.options.interpolation);
2458
2170
  }
2459
-
2460
2171
  if (options.keySeparator !== undefined) {
2461
2172
  this.options.userDefinedKeySeparator = options.keySeparator;
2462
2173
  }
2463
-
2464
2174
  if (options.nsSeparator !== undefined) {
2465
2175
  this.options.userDefinedNsSeparator = options.nsSeparator;
2466
2176
  }
2467
-
2468
2177
  function createClassOnDemand(ClassOrObject) {
2469
2178
  if (!ClassOrObject) return null;
2470
2179
  if (typeof ClassOrObject === 'function') return new ClassOrObject();
2471
2180
  return ClassOrObject;
2472
2181
  }
2473
-
2474
2182
  if (!this.options.isClone) {
2475
2183
  if (this.modules.logger) {
2476
2184
  baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
2477
2185
  } else {
2478
2186
  baseLogger.init(null, this.options);
2479
2187
  }
2480
-
2481
2188
  var formatter;
2482
-
2483
2189
  if (this.modules.formatter) {
2484
2190
  formatter = this.modules.formatter;
2485
2191
  } else if (typeof Intl !== 'undefined') {
2486
2192
  formatter = Formatter;
2487
2193
  }
2488
-
2489
2194
  var lu = new LanguageUtil(this.options);
2490
2195
  this.store = new ResourceStore(this.options.resources, this.options);
2491
2196
  var s = this.services;
@@ -2497,13 +2202,11 @@ var I18n = function (_EventEmitter) {
2497
2202
  compatibilityJSON: this.options.compatibilityJSON,
2498
2203
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
2499
2204
  });
2500
-
2501
2205
  if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
2502
2206
  s.formatter = createClassOnDemand(formatter);
2503
2207
  s.formatter.init(s, this.options);
2504
2208
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
2505
2209
  }
2506
-
2507
2210
  s.interpolator = new Interpolator(this.options);
2508
2211
  s.utils = {
2509
2212
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
@@ -2513,50 +2216,40 @@ var I18n = function (_EventEmitter) {
2513
2216
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2514
2217
  args[_key - 1] = arguments[_key];
2515
2218
  }
2516
-
2517
2219
  _this2.emit.apply(_this2, [event].concat(args));
2518
2220
  });
2519
-
2520
2221
  if (this.modules.languageDetector) {
2521
2222
  s.languageDetector = createClassOnDemand(this.modules.languageDetector);
2522
- s.languageDetector.init(s, this.options.detection, this.options);
2223
+ if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
2523
2224
  }
2524
-
2525
2225
  if (this.modules.i18nFormat) {
2526
2226
  s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2527
2227
  if (s.i18nFormat.init) s.i18nFormat.init(this);
2528
2228
  }
2529
-
2530
2229
  this.translator = new Translator(this.services, this.options);
2531
2230
  this.translator.on('*', function (event) {
2532
2231
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2533
2232
  args[_key2 - 1] = arguments[_key2];
2534
2233
  }
2535
-
2536
2234
  _this2.emit.apply(_this2, [event].concat(args));
2537
2235
  });
2538
2236
  this.modules.external.forEach(function (m) {
2539
2237
  if (m.init) m.init(_this2);
2540
2238
  });
2541
2239
  }
2542
-
2543
2240
  this.format = this.options.interpolation.format;
2544
2241
  if (!callback) callback = noop$1;
2545
-
2546
2242
  if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2547
2243
  var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2548
2244
  if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
2549
2245
  }
2550
-
2551
2246
  if (!this.services.languageDetector && !this.options.lng) {
2552
2247
  this.logger.warn('init: no languageDetector is used and no lng is defined');
2553
2248
  }
2554
-
2555
2249
  var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
2556
2250
  storeApi.forEach(function (fcName) {
2557
2251
  _this2[fcName] = function () {
2558
2252
  var _this2$store;
2559
-
2560
2253
  return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
2561
2254
  };
2562
2255
  });
@@ -2564,63 +2257,48 @@ var I18n = function (_EventEmitter) {
2564
2257
  storeApiChained.forEach(function (fcName) {
2565
2258
  _this2[fcName] = function () {
2566
2259
  var _this2$store2;
2567
-
2568
2260
  (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
2569
-
2570
2261
  return _this2;
2571
2262
  };
2572
2263
  });
2573
2264
  var deferred = defer();
2574
-
2575
2265
  var load = function load() {
2576
2266
  var finish = function finish(err, t) {
2577
2267
  if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
2578
2268
  _this2.isInitialized = true;
2579
2269
  if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
2580
-
2581
2270
  _this2.emit('initialized', _this2.options);
2582
-
2583
2271
  deferred.resolve(t);
2584
2272
  callback(err, t);
2585
2273
  };
2586
-
2587
2274
  if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
2588
-
2589
2275
  _this2.changeLanguage(_this2.options.lng, finish);
2590
2276
  };
2591
-
2592
2277
  if (this.options.resources || !this.options.initImmediate) {
2593
2278
  load();
2594
2279
  } else {
2595
2280
  setTimeout(load, 0);
2596
2281
  }
2597
-
2598
2282
  return deferred;
2599
2283
  }
2600
2284
  }, {
2601
2285
  key: "loadResources",
2602
2286
  value: function loadResources(language) {
2603
2287
  var _this3 = this;
2604
-
2605
2288
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
2606
2289
  var usedCallback = callback;
2607
2290
  var usedLng = typeof language === 'string' ? language : this.language;
2608
2291
  if (typeof language === 'function') usedCallback = language;
2609
-
2610
2292
  if (!this.options.resources || this.options.partialBundledLanguages) {
2611
2293
  if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
2612
2294
  var toLoad = [];
2613
-
2614
2295
  var append = function append(lng) {
2615
2296
  if (!lng) return;
2616
-
2617
2297
  var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
2618
-
2619
2298
  lngs.forEach(function (l) {
2620
2299
  if (toLoad.indexOf(l) < 0) toLoad.push(l);
2621
2300
  });
2622
2301
  };
2623
-
2624
2302
  if (!usedLng) {
2625
2303
  var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2626
2304
  fallbacks.forEach(function (l) {
@@ -2629,13 +2307,11 @@ var I18n = function (_EventEmitter) {
2629
2307
  } else {
2630
2308
  append(usedLng);
2631
2309
  }
2632
-
2633
2310
  if (this.options.preload) {
2634
2311
  this.options.preload.forEach(function (l) {
2635
2312
  return append(l);
2636
2313
  });
2637
2314
  }
2638
-
2639
2315
  this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
2640
2316
  if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
2641
2317
  usedCallback(e);
@@ -2662,35 +2338,27 @@ var I18n = function (_EventEmitter) {
2662
2338
  value: function use(module) {
2663
2339
  if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
2664
2340
  if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
2665
-
2666
2341
  if (module.type === 'backend') {
2667
2342
  this.modules.backend = module;
2668
2343
  }
2669
-
2670
2344
  if (module.type === 'logger' || module.log && module.warn && module.error) {
2671
2345
  this.modules.logger = module;
2672
2346
  }
2673
-
2674
2347
  if (module.type === 'languageDetector') {
2675
2348
  this.modules.languageDetector = module;
2676
2349
  }
2677
-
2678
2350
  if (module.type === 'i18nFormat') {
2679
2351
  this.modules.i18nFormat = module;
2680
2352
  }
2681
-
2682
2353
  if (module.type === 'postProcessor') {
2683
2354
  postProcessor.addPostProcessor(module);
2684
2355
  }
2685
-
2686
2356
  if (module.type === 'formatter') {
2687
2357
  this.modules.formatter = module;
2688
2358
  }
2689
-
2690
2359
  if (module.type === '3rdParty') {
2691
2360
  this.modules.external.push(module);
2692
2361
  }
2693
-
2694
2362
  return this;
2695
2363
  }
2696
2364
  }, {
@@ -2698,11 +2366,9 @@ var I18n = function (_EventEmitter) {
2698
2366
  value: function setResolvedLanguage(l) {
2699
2367
  if (!l || !this.languages) return;
2700
2368
  if (['cimode', 'dev'].indexOf(l) > -1) return;
2701
-
2702
2369
  for (var li = 0; li < this.languages.length; li++) {
2703
2370
  var lngInLngs = this.languages[li];
2704
2371
  if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
2705
-
2706
2372
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
2707
2373
  this.resolvedLanguage = lngInLngs;
2708
2374
  break;
@@ -2713,34 +2379,25 @@ var I18n = function (_EventEmitter) {
2713
2379
  key: "changeLanguage",
2714
2380
  value: function changeLanguage(lng, callback) {
2715
2381
  var _this4 = this;
2716
-
2717
2382
  this.isLanguageChangingTo = lng;
2718
2383
  var deferred = defer();
2719
2384
  this.emit('languageChanging', lng);
2720
-
2721
2385
  var setLngProps = function setLngProps(l) {
2722
2386
  _this4.language = l;
2723
2387
  _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
2724
2388
  _this4.resolvedLanguage = undefined;
2725
-
2726
2389
  _this4.setResolvedLanguage(l);
2727
2390
  };
2728
-
2729
2391
  var done = function done(err, l) {
2730
2392
  if (l) {
2731
2393
  setLngProps(l);
2732
-
2733
2394
  _this4.translator.changeLanguage(l);
2734
-
2735
2395
  _this4.isLanguageChangingTo = undefined;
2736
-
2737
2396
  _this4.emit('languageChanged', l);
2738
-
2739
2397
  _this4.logger.log('languageChanged', l);
2740
2398
  } else {
2741
2399
  _this4.isLanguageChangingTo = undefined;
2742
2400
  }
2743
-
2744
2401
  deferred.resolve(function () {
2745
2402
  return _this4.t.apply(_this4, arguments);
2746
2403
  });
@@ -2748,53 +2405,47 @@ var I18n = function (_EventEmitter) {
2748
2405
  return _this4.t.apply(_this4, arguments);
2749
2406
  });
2750
2407
  };
2751
-
2752
2408
  var setLng = function setLng(lngs) {
2753
2409
  if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
2754
2410
  var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
2755
-
2756
2411
  if (l) {
2757
2412
  if (!_this4.language) {
2758
2413
  setLngProps(l);
2759
2414
  }
2760
-
2761
2415
  if (!_this4.translator.language) _this4.translator.changeLanguage(l);
2762
- if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);
2416
+ if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l);
2763
2417
  }
2764
-
2765
2418
  _this4.loadResources(l, function (err) {
2766
2419
  done(err, l);
2767
2420
  });
2768
2421
  };
2769
-
2770
2422
  if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
2771
2423
  setLng(this.services.languageDetector.detect());
2772
2424
  } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
2773
- this.services.languageDetector.detect(setLng);
2425
+ if (this.services.languageDetector.detect.length === 0) {
2426
+ this.services.languageDetector.detect().then(setLng);
2427
+ } else {
2428
+ this.services.languageDetector.detect(setLng);
2429
+ }
2774
2430
  } else {
2775
2431
  setLng(lng);
2776
2432
  }
2777
-
2778
2433
  return deferred;
2779
2434
  }
2780
2435
  }, {
2781
2436
  key: "getFixedT",
2782
2437
  value: function getFixedT(lng, ns, keyPrefix) {
2783
2438
  var _this5 = this;
2784
-
2785
2439
  var fixedT = function fixedT(key, opts) {
2786
2440
  var options;
2787
-
2788
2441
  if (_typeof(opts) !== 'object') {
2789
2442
  for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2790
2443
  rest[_key3 - 2] = arguments[_key3];
2791
2444
  }
2792
-
2793
2445
  options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
2794
2446
  } else {
2795
- options = _objectSpread$6$1({}, opts);
2447
+ options = _objectSpread$d({}, opts);
2796
2448
  }
2797
-
2798
2449
  options.lng = options.lng || fixedT.lng;
2799
2450
  options.lngs = options.lngs || fixedT.lngs;
2800
2451
  options.ns = options.ns || fixedT.ns;
@@ -2803,13 +2454,11 @@ var I18n = function (_EventEmitter) {
2803
2454
  var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2804
2455
  return _this5.t(resultKey, options);
2805
2456
  };
2806
-
2807
2457
  if (typeof lng === 'string') {
2808
2458
  fixedT.lng = lng;
2809
2459
  } else {
2810
2460
  fixedT.lngs = lng;
2811
2461
  }
2812
-
2813
2462
  fixedT.ns = ns;
2814
2463
  fixedT.keyPrefix = keyPrefix;
2815
2464
  return fixedT;
@@ -2818,14 +2467,12 @@ var I18n = function (_EventEmitter) {
2818
2467
  key: "t",
2819
2468
  value: function t() {
2820
2469
  var _this$translator;
2821
-
2822
2470
  return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
2823
2471
  }
2824
2472
  }, {
2825
2473
  key: "exists",
2826
2474
  value: function exists() {
2827
2475
  var _this$translator2;
2828
-
2829
2476
  return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
2830
2477
  }
2831
2478
  }, {
@@ -2837,35 +2484,27 @@ var I18n = function (_EventEmitter) {
2837
2484
  key: "hasLoadedNamespace",
2838
2485
  value: function hasLoadedNamespace(ns) {
2839
2486
  var _this6 = this;
2840
-
2841
2487
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2842
-
2843
2488
  if (!this.isInitialized) {
2844
2489
  this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2845
2490
  return false;
2846
2491
  }
2847
-
2848
2492
  if (!this.languages || !this.languages.length) {
2849
2493
  this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2850
2494
  return false;
2851
2495
  }
2852
-
2853
2496
  var lng = this.resolvedLanguage || this.languages[0];
2854
2497
  var fallbackLng = this.options ? this.options.fallbackLng : false;
2855
2498
  var lastLng = this.languages[this.languages.length - 1];
2856
2499
  if (lng.toLowerCase() === 'cimode') return true;
2857
-
2858
2500
  var loadNotPending = function loadNotPending(l, n) {
2859
2501
  var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)];
2860
-
2861
2502
  return loadState === -1 || loadState === 2;
2862
2503
  };
2863
-
2864
2504
  if (options.precheck) {
2865
2505
  var preResult = options.precheck(this, loadNotPending);
2866
2506
  if (preResult !== undefined) return preResult;
2867
2507
  }
2868
-
2869
2508
  if (this.hasResourceBundle(lng, ns)) return true;
2870
2509
  if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2871
2510
  if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
@@ -2875,14 +2514,11 @@ var I18n = function (_EventEmitter) {
2875
2514
  key: "loadNamespaces",
2876
2515
  value: function loadNamespaces(ns, callback) {
2877
2516
  var _this7 = this;
2878
-
2879
2517
  var deferred = defer();
2880
-
2881
2518
  if (!this.options.ns) {
2882
2519
  callback && callback();
2883
2520
  return Promise.resolve();
2884
2521
  }
2885
-
2886
2522
  if (typeof ns === 'string') ns = [ns];
2887
2523
  ns.forEach(function (n) {
2888
2524
  if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
@@ -2902,12 +2538,10 @@ var I18n = function (_EventEmitter) {
2902
2538
  var newLngs = lngs.filter(function (lng) {
2903
2539
  return preloaded.indexOf(lng) < 0;
2904
2540
  });
2905
-
2906
2541
  if (!newLngs.length) {
2907
2542
  if (callback) callback();
2908
2543
  return Promise.resolve();
2909
2544
  }
2910
-
2911
2545
  this.options.preload = preloaded.concat(newLngs);
2912
2546
  this.loadResources(function (err) {
2913
2547
  deferred.resolve();
@@ -2921,31 +2555,27 @@ var I18n = function (_EventEmitter) {
2921
2555
  if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
2922
2556
  if (!lng) return 'rtl';
2923
2557
  var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
2924
- return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2558
+ var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get());
2559
+ return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2925
2560
  }
2926
2561
  }, {
2927
2562
  key: "cloneInstance",
2928
2563
  value: function cloneInstance() {
2929
2564
  var _this8 = this;
2930
-
2931
2565
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2932
2566
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
2933
-
2934
- var mergedOptions = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, this.options), options), {
2567
+ var mergedOptions = _objectSpread$d(_objectSpread$d(_objectSpread$d({}, this.options), options), {
2935
2568
  isClone: true
2936
2569
  });
2937
-
2938
2570
  var clone = new I18n(mergedOptions);
2939
-
2940
2571
  if (options.debug !== undefined || options.prefix !== undefined) {
2941
2572
  clone.logger = clone.logger.clone(options);
2942
2573
  }
2943
-
2944
2574
  var membersToCopy = ['store', 'services', 'language'];
2945
2575
  membersToCopy.forEach(function (m) {
2946
2576
  clone[m] = _this8[m];
2947
2577
  });
2948
- clone.services = _objectSpread$6$1({}, this.services);
2578
+ clone.services = _objectSpread$d({}, this.services);
2949
2579
  clone.services.utils = {
2950
2580
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2951
2581
  };
@@ -2954,7 +2584,6 @@ var I18n = function (_EventEmitter) {
2954
2584
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
2955
2585
  args[_key4 - 1] = arguments[_key4];
2956
2586
  }
2957
-
2958
2587
  clone.emit.apply(clone, [event].concat(args));
2959
2588
  });
2960
2589
  clone.init(mergedOptions, callback);
@@ -2976,20 +2605,18 @@ var I18n = function (_EventEmitter) {
2976
2605
  };
2977
2606
  }
2978
2607
  }]);
2979
-
2980
2608
  return I18n;
2981
2609
  }(EventEmitter);
2982
-
2983
2610
  _defineProperty(I18n, "createInstance", function () {
2984
2611
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2985
2612
  var callback = arguments.length > 1 ? arguments[1] : undefined;
2986
2613
  return new I18n(options, callback);
2987
2614
  });
2988
-
2989
2615
  var instance = I18n.createInstance();
2990
2616
  instance.createInstance = I18n.createInstance;
2991
2617
 
2992
2618
  instance.createInstance;
2619
+ instance.dir;
2993
2620
  instance.init;
2994
2621
  instance.loadResources;
2995
2622
  instance.reloadResources;
@@ -3407,99 +3034,6 @@ var voidElements = {
3407
3034
 
3408
3035
  var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=/^\s*$/,s=Object.create(null);function a(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c={parse:function(e,t){t||(t={}),t.components||(t.components=s);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a("",t)},"")}};
3409
3036
 
3410
- var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
3411
- var htmlEntities = {
3412
- '&amp;': '&',
3413
- '&#38;': '&',
3414
- '&lt;': '<',
3415
- '&#60;': '<',
3416
- '&gt;': '>',
3417
- '&#62;': '>',
3418
- '&apos;': "'",
3419
- '&#39;': "'",
3420
- '&quot;': '"',
3421
- '&#34;': '"',
3422
- '&nbsp;': ' ',
3423
- '&#160;': ' ',
3424
- '&copy;': '©',
3425
- '&#169;': '©',
3426
- '&reg;': '®',
3427
- '&#174;': '®',
3428
- '&hellip;': '…',
3429
- '&#8230;': '…',
3430
- '&#x2F;': '/',
3431
- '&#47;': '/'
3432
- };
3433
-
3434
- var unescapeHtmlEntity = function unescapeHtmlEntity(m) {
3435
- return htmlEntities[m];
3436
- };
3437
-
3438
- var unescape = function unescape(text) {
3439
- return text.replace(matchHtmlEntity, unescapeHtmlEntity);
3440
- };
3441
-
3442
- function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3443
-
3444
- function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3445
- var defaultOptions = {
3446
- bindI18n: 'languageChanged',
3447
- bindI18nStore: '',
3448
- transEmptyNodeValue: '',
3449
- transSupportBasicHtmlNodes: true,
3450
- transWrapTextNodes: '',
3451
- transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
3452
- useSuspense: true,
3453
- unescape: unescape
3454
- };
3455
- var i18nInstance;
3456
- var I18nContext = createContext();
3457
- function setDefaults() {
3458
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3459
- defaultOptions = _objectSpread$b(_objectSpread$b({}, defaultOptions), options);
3460
- }
3461
- function getDefaults() {
3462
- return defaultOptions;
3463
- }
3464
- var ReportNamespaces = function () {
3465
- function ReportNamespaces() {
3466
- _classCallCheck(this, ReportNamespaces);
3467
-
3468
- this.usedNamespaces = {};
3469
- }
3470
-
3471
- _createClass(ReportNamespaces, [{
3472
- key: "addUsedNamespaces",
3473
- value: function addUsedNamespaces(namespaces) {
3474
- var _this = this;
3475
-
3476
- namespaces.forEach(function (ns) {
3477
- if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true;
3478
- });
3479
- }
3480
- }, {
3481
- key: "getUsedNamespaces",
3482
- value: function getUsedNamespaces() {
3483
- return Object.keys(this.usedNamespaces);
3484
- }
3485
- }]);
3486
-
3487
- return ReportNamespaces;
3488
- }();
3489
- function setI18n(instance) {
3490
- i18nInstance = instance;
3491
- }
3492
- function getI18n() {
3493
- return i18nInstance;
3494
- }
3495
- var initReactI18next = {
3496
- type: '3rdParty',
3497
- init: function init(instance) {
3498
- setDefaults(instance.options.react);
3499
- setI18n(instance);
3500
- }
3501
- };
3502
-
3503
3037
  function warn() {
3504
3038
  if (console && console.warn) {
3505
3039
  var _console;
@@ -3580,12 +3114,73 @@ function hasLoadedNamespace(ns, i18n) {
3580
3114
  });
3581
3115
  }
3582
3116
 
3583
- var _excluded$3 = ["format"],
3117
+ var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
3118
+ var htmlEntities = {
3119
+ '&amp;': '&',
3120
+ '&#38;': '&',
3121
+ '&lt;': '<',
3122
+ '&#60;': '<',
3123
+ '&gt;': '>',
3124
+ '&#62;': '>',
3125
+ '&apos;': "'",
3126
+ '&#39;': "'",
3127
+ '&quot;': '"',
3128
+ '&#34;': '"',
3129
+ '&nbsp;': ' ',
3130
+ '&#160;': ' ',
3131
+ '&copy;': '©',
3132
+ '&#169;': '©',
3133
+ '&reg;': '®',
3134
+ '&#174;': '®',
3135
+ '&hellip;': '…',
3136
+ '&#8230;': '…',
3137
+ '&#x2F;': '/',
3138
+ '&#47;': '/'
3139
+ };
3140
+
3141
+ var unescapeHtmlEntity = function unescapeHtmlEntity(m) {
3142
+ return htmlEntities[m];
3143
+ };
3144
+
3145
+ var unescape = function unescape(text) {
3146
+ return text.replace(matchHtmlEntity, unescapeHtmlEntity);
3147
+ };
3148
+
3149
+ function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3150
+
3151
+ function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3152
+ var defaultOptions = {
3153
+ bindI18n: 'languageChanged',
3154
+ bindI18nStore: '',
3155
+ transEmptyNodeValue: '',
3156
+ transSupportBasicHtmlNodes: true,
3157
+ transWrapTextNodes: '',
3158
+ transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
3159
+ useSuspense: true,
3160
+ unescape: unescape
3161
+ };
3162
+ function setDefaults() {
3163
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3164
+ defaultOptions = _objectSpread$c(_objectSpread$c({}, defaultOptions), options);
3165
+ }
3166
+ function getDefaults() {
3167
+ return defaultOptions;
3168
+ }
3169
+
3170
+ var i18nInstance;
3171
+ function setI18n(instance) {
3172
+ i18nInstance = instance;
3173
+ }
3174
+ function getI18n() {
3175
+ return i18nInstance;
3176
+ }
3177
+
3178
+ var _excluded$4 = ["format"],
3584
3179
  _excluded2$3 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
3585
3180
 
3586
- function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3181
+ function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3587
3182
 
3588
- function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3183
+ function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3589
3184
 
3590
3185
  function hasChildren(node, checkLength) {
3591
3186
  if (!node) return false;
@@ -3611,7 +3206,7 @@ function getAsArray(data) {
3611
3206
  }
3612
3207
 
3613
3208
  function mergeProps(source, target) {
3614
- var newTarget = _objectSpread$a({}, target);
3209
+ var newTarget = _objectSpread$b({}, target);
3615
3210
 
3616
3211
  newTarget.props = Object.assign(source.props, target.props);
3617
3212
  return newTarget;
@@ -3646,7 +3241,7 @@ function nodesToString(children, i18nOptions) {
3646
3241
  warn("Trans: the passed in value is invalid - seems you passed in a null child.");
3647
3242
  } else if (_typeof(child) === 'object') {
3648
3243
  var format = child.format,
3649
- clone = _objectWithoutProperties(child, _excluded$3);
3244
+ clone = _objectWithoutProperties(child, _excluded$4);
3650
3245
 
3651
3246
  var keys = Object.keys(clone);
3652
3247
 
@@ -3681,7 +3276,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, s
3681
3276
  getData(children);
3682
3277
  var ast = c.parse("<0>".concat(targetString, "</0>"));
3683
3278
 
3684
- var opts = _objectSpread$a(_objectSpread$a({}, data), combinedTOpts);
3279
+ var opts = _objectSpread$b(_objectSpread$b({}, data), combinedTOpts);
3685
3280
 
3686
3281
  function renderInner(child, node, rootReactNode) {
3687
3282
  var childs = getChildren(child);
@@ -3691,7 +3286,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, s
3691
3286
 
3692
3287
  function pushTranslatedJSX(child, inner, mem, i, isVoid) {
3693
3288
  if (child.dummy) child.children = inner;
3694
- mem.push(cloneElement(child, _objectSpread$a(_objectSpread$a({}, child.props), {}, {
3289
+ mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3695
3290
  key: i
3696
3291
  }), isVoid ? undefined : inner));
3697
3292
  }
@@ -3723,7 +3318,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, s
3723
3318
  } else if (isEmptyTransWithHTML) {
3724
3319
  var _inner = mapAST(reactNodes, node.children, rootReactNode);
3725
3320
 
3726
- mem.push(cloneElement(child, _objectSpread$a(_objectSpread$a({}, child.props), {}, {
3321
+ mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3727
3322
  key: i
3728
3323
  }), _inner));
3729
3324
  } else if (Number.isNaN(parseFloat(node.name))) {
@@ -3754,11 +3349,11 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, s
3754
3349
  var content = node.children[0] ? translationContent : null;
3755
3350
  if (content) mem.push(content);
3756
3351
  } else if (node.children.length === 1 && translationContent) {
3757
- mem.push(cloneElement(child, _objectSpread$a(_objectSpread$a({}, child.props), {}, {
3352
+ mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3758
3353
  key: i
3759
3354
  }), translationContent));
3760
3355
  } else {
3761
- mem.push(cloneElement(child, _objectSpread$a(_objectSpread$a({}, child.props), {}, {
3356
+ mem.push(cloneElement(child, _objectSpread$b(_objectSpread$b({}, child.props), {}, {
3762
3357
  key: i
3763
3358
  })));
3764
3359
  }
@@ -3787,7 +3382,7 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, s
3787
3382
  return getChildren(result[0]);
3788
3383
  }
3789
3384
 
3790
- function Trans(_ref) {
3385
+ function Trans$1(_ref) {
3791
3386
  var children = _ref.children,
3792
3387
  count = _ref.count,
3793
3388
  parent = _ref.parent,
@@ -3804,11 +3399,7 @@ function Trans(_ref) {
3804
3399
  shouldUnescape = _ref.shouldUnescape,
3805
3400
  additionalProps = _objectWithoutProperties(_ref, _excluded2$3);
3806
3401
 
3807
- var _ref2 = useContext(I18nContext) || {},
3808
- i18nFromContext = _ref2.i18n,
3809
- defaultNSFromContext = _ref2.defaultNS;
3810
-
3811
- var i18n = i18nFromProps || i18nFromContext || getI18n();
3402
+ var i18n = i18nFromProps || getI18n();
3812
3403
 
3813
3404
  if (!i18n) {
3814
3405
  warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
@@ -3821,21 +3412,21 @@ function Trans(_ref) {
3821
3412
 
3822
3413
  if (context) tOptions.context = context;
3823
3414
 
3824
- var reactI18nextOptions = _objectSpread$a(_objectSpread$a({}, getDefaults()), i18n.options && i18n.options.react);
3415
+ var reactI18nextOptions = _objectSpread$b(_objectSpread$b({}, getDefaults()), i18n.options && i18n.options.react);
3825
3416
 
3826
- var namespaces = ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
3417
+ var namespaces = ns || t.ns || i18n.options && i18n.options.defaultNS;
3827
3418
  namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
3828
3419
  var defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
3829
3420
  var hashTransKey = reactI18nextOptions.hashTransKey;
3830
3421
  var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
3831
3422
  var interpolationOverride = values ? tOptions.interpolation : {
3832
- interpolation: _objectSpread$a(_objectSpread$a({}, tOptions.interpolation), {}, {
3423
+ interpolation: _objectSpread$b(_objectSpread$b({}, tOptions.interpolation), {}, {
3833
3424
  prefix: '#$?',
3834
3425
  suffix: '?$#'
3835
3426
  })
3836
3427
  };
3837
3428
 
3838
- var combinedTOpts = _objectSpread$a(_objectSpread$a(_objectSpread$a(_objectSpread$a({}, tOptions), {}, {
3429
+ var combinedTOpts = _objectSpread$b(_objectSpread$b(_objectSpread$b(_objectSpread$b({}, tOptions), {}, {
3839
3430
  count: count
3840
3431
  }, values), interpolationOverride), {}, {
3841
3432
  defaultValue: defaultValue,
@@ -3848,6 +3439,90 @@ function Trans(_ref) {
3848
3439
  return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
3849
3440
  }
3850
3441
 
3442
+ var initReactI18next = {
3443
+ type: '3rdParty',
3444
+ init: function init(instance) {
3445
+ setDefaults(instance.options.react);
3446
+ setI18n(instance);
3447
+ }
3448
+ };
3449
+
3450
+ var I18nContext = createContext();
3451
+ var ReportNamespaces = function () {
3452
+ function ReportNamespaces() {
3453
+ _classCallCheck(this, ReportNamespaces);
3454
+
3455
+ this.usedNamespaces = {};
3456
+ }
3457
+
3458
+ _createClass(ReportNamespaces, [{
3459
+ key: "addUsedNamespaces",
3460
+ value: function addUsedNamespaces(namespaces) {
3461
+ var _this = this;
3462
+
3463
+ namespaces.forEach(function (ns) {
3464
+ if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true;
3465
+ });
3466
+ }
3467
+ }, {
3468
+ key: "getUsedNamespaces",
3469
+ value: function getUsedNamespaces() {
3470
+ return Object.keys(this.usedNamespaces);
3471
+ }
3472
+ }]);
3473
+
3474
+ return ReportNamespaces;
3475
+ }();
3476
+
3477
+ var _excluded$3 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
3478
+
3479
+ function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3480
+
3481
+ function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3482
+ function Trans(_ref) {
3483
+ var children = _ref.children,
3484
+ count = _ref.count,
3485
+ parent = _ref.parent,
3486
+ i18nKey = _ref.i18nKey,
3487
+ context = _ref.context,
3488
+ _ref$tOptions = _ref.tOptions,
3489
+ tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions,
3490
+ values = _ref.values,
3491
+ defaults = _ref.defaults,
3492
+ components = _ref.components,
3493
+ ns = _ref.ns,
3494
+ i18nFromProps = _ref.i18n,
3495
+ tFromProps = _ref.t,
3496
+ shouldUnescape = _ref.shouldUnescape,
3497
+ additionalProps = _objectWithoutProperties(_ref, _excluded$3);
3498
+
3499
+ var _ref2 = useContext(I18nContext) || {},
3500
+ i18nFromContext = _ref2.i18n,
3501
+ defaultNSFromContext = _ref2.defaultNS;
3502
+
3503
+ var i18n = i18nFromProps || i18nFromContext || getI18n();
3504
+
3505
+ var t = tFromProps || i18n.t.bind(i18n) || function (k) {
3506
+ return k;
3507
+ };
3508
+
3509
+ return Trans$1(_objectSpread$a({
3510
+ children: children,
3511
+ count: count,
3512
+ parent: parent,
3513
+ i18nKey: i18nKey,
3514
+ context: context,
3515
+ tOptions: tOptions,
3516
+ values: values,
3517
+ defaults: defaults,
3518
+ components: components,
3519
+ ns: ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS,
3520
+ i18n: i18n,
3521
+ t: tFromProps,
3522
+ shouldUnescape: shouldUnescape
3523
+ }, additionalProps));
3524
+ }
3525
+
3851
3526
  function _iterableToArrayLimit(arr, i) {
3852
3527
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3853
3528
  if (null != _i) {
@@ -3997,9 +3672,9 @@ function useTranslation(ns) {
3997
3672
  }
3998
3673
 
3999
3674
  var alerts$1 = {
4000
- activating_: "You are activating {{what}} {{person}}. Are you sure you want to proceed?",
4001
- deactivating_: "You are deactivating {{what}} {{person}}. Are you sure you want to proceed?",
4002
- deleting_: "You are permanently deleting the {{what}} {{name}}. This action cannot be undone. Are you sure you want to proceed?"
3675
+ activating_: "You are activating <strong>{{person}}</strong>. Are you sure you want to proceed?",
3676
+ deactivating_: "You are deactivating <strong>{{person}}</strong>. Are you sure you want to proceed?",
3677
+ deleting_: "You are permanently deleting the {{what}} <strong>{{name}}</strong>. This action cannot be undone. Are you sure you want to proceed?"
4003
3678
  };
4004
3679
  var buttons$1 = {
4005
3680
  cancel: "Cancel",
@@ -4095,9 +3770,9 @@ var en = {
4095
3770
  };
4096
3771
 
4097
3772
  var alerts = {
4098
- activating_: "Vous activez le {{what}} {{person}}. Es-tu sur de vouloir continuer?",
4099
- deactivating_: "Vous désactivez le {{what}} {{person}}. Es-tu sur de vouloir continuer?",
4100
- deleting_: "Vous supprimez définitivement le {{what}} {{name}}. Cette action ne peut pas être annulée. Êtes-vous sur de vouloir continuer?"
3773
+ activating_: "Vous activez <strong>{{person}}</strong>. Es-tu sur de vouloir continuer?",
3774
+ deactivating_: "Vous désactivez <strong>{{person}}</strong>. Es-tu sur de vouloir continuer?",
3775
+ deleting_: "Vous supprimez définitivement le {{what}} <strong>{{name}}</strong>. Cette action ne peut pas être annulée. Êtes-vous sur de vouloir continuer?"
4101
3776
  };
4102
3777
  var buttons = {
4103
3778
  cancel: "Annuler",
@@ -6315,13 +5990,17 @@ const Delete = _ref => {
6315
5990
  title: t("common.delete_", {
6316
5991
  what: t("common.role", SINGULAR).toLocaleLowerCase()
6317
5992
  }),
6318
- message: t("alerts.deleting_", {
6319
- what: t("common.role", SINGULAR).toLocaleLowerCase(),
6320
- name: selectedRole === null || selectedRole === void 0 ? void 0 : selectedRole.name
5993
+ message: /*#__PURE__*/React.createElement(Trans, {
5994
+ i18nKey: "alerts.deleting_",
5995
+ values: {
5996
+ name: selectedRole === null || selectedRole === void 0 ? void 0 : selectedRole.name,
5997
+ what: t("common.role", SINGULAR).toLocaleLowerCase()
5998
+ }
6321
5999
  }),
6322
6000
  isSubmitting: isDeleting,
6323
6001
  onSubmit: handleDelete,
6324
- submitButtonLabel: t("buttons.proceed")
6002
+ submitButtonLabel: t("buttons.proceed"),
6003
+ cancelButtonLabel: t("buttons.cancel")
6325
6004
  });
6326
6005
  };
6327
6006
 
@@ -6690,7 +6369,9 @@ const fetch = params => axios.get(`${BASE_URL}/teams`, {
6690
6369
  params
6691
6370
  });
6692
6371
  const create = payload => axios.post(`${BASE_URL}/teams`, payload);
6693
- const update = (id, payload) => axios.put(`${BASE_URL}/teams/${id}`, payload);
6372
+ const update = (id, payload) => axios.put(`${BASE_URL}/teams/${id}`, {
6373
+ team: payload
6374
+ });
6694
6375
  const bulkUpdate = payload => axios.patch(`${BASE_URL}/teams/bulk_update`, payload);
6695
6376
  const teamsApi = {
6696
6377
  bulkUpdate,
@@ -6794,15 +6475,19 @@ const MANAGE_ROLES_BUTTON_LABEL = instance.t("common.manage_", {
6794
6475
  });
6795
6476
 
6796
6477
  const Header = _ref => {
6797
- var _permissions$create;
6798
- let metaName = _ref.metaName,
6478
+ var _permissions$create, _config$header;
6479
+ let config = _ref.config,
6480
+ _ref$isEmptyState = _ref.isEmptyState,
6481
+ isEmptyState = _ref$isEmptyState === void 0 ? false : _ref$isEmptyState,
6482
+ metaName = _ref.metaName,
6799
6483
  _ref$onClick = _ref.onClick,
6800
6484
  onClick = _ref$onClick === void 0 ? noop : _ref$onClick,
6801
6485
  permissions = _ref.permissions,
6802
6486
  rolesButtonProps = _ref.rolesButtonProps;
6803
6487
  const isRolesButtonVisible = !!rolesButtonProps;
6804
6488
  const hasCreatePermission = (_permissions$create = permissions === null || permissions === void 0 ? void 0 : permissions.create) !== null && _permissions$create !== void 0 ? _permissions$create : hasPermission(MANAGE_MEMBER_PERMISSIONS);
6805
- return /*#__PURE__*/React.createElement(React.Fragment, null, isRolesButtonVisible ? /*#__PURE__*/React.createElement(Button, _extends({
6489
+ const isOtherActionBlockVisible = !!(config !== null && config !== void 0 && (_config$header = config.header) !== null && _config$header !== void 0 && _config$header.otherActionBlock) && !isEmptyState;
6490
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isOtherActionBlockVisible && config.header.otherActionBlock(), isRolesButtonVisible ? /*#__PURE__*/React.createElement(Button, _extends({
6806
6491
  "data-cy": "ntm-manage-roles-button",
6807
6492
  label: MANAGE_ROLES_BUTTON_LABEL,
6808
6493
  style: "secondary"
@@ -6958,8 +6643,8 @@ const filterBySearchTerm = (searchTerm, roles) => filter(_ref => {
6958
6643
  const getActivateButtonVisible = selectedRows => selectedRows.active.some(active => active === false);
6959
6644
  const getDeactivatedButtonVisible = selectedRows => selectedRows.active.some(active => active === true);
6960
6645
 
6961
- const Menu$1 = Dropdown.Menu,
6962
- MenuItem = Dropdown.MenuItem;
6646
+ const Menu$2 = Dropdown.Menu,
6647
+ MenuItem$1 = Dropdown.MenuItem;
6963
6648
  const RolesDropdown = _ref => {
6964
6649
  let handleRoleChange = _ref.handleRoleChange,
6965
6650
  hasUpdatePermission = _ref.hasUpdatePermission,
@@ -6995,7 +6680,7 @@ const RolesDropdown = _ref => {
6995
6680
  return /*#__PURE__*/React.createElement(Dropdown, {
6996
6681
  buttonStyle: "secondary",
6997
6682
  closeOnSelect: false,
6998
- customTarget: /*#__PURE__*/React.createElement(MenuItem.Button, {
6683
+ customTarget: /*#__PURE__*/React.createElement(MenuItem$1.Button, {
6999
6684
  suffix: /*#__PURE__*/React.createElement(Right$1, {
7000
6685
  size: 16
7001
6686
  })
@@ -7006,7 +6691,7 @@ const RolesDropdown = _ref => {
7006
6691
  onClick: handleClick,
7007
6692
  onClose: handleOnClose,
7008
6693
  position: "auto-end"
7009
- }, /*#__PURE__*/React.createElement(Menu$1, null, isSearchable && /*#__PURE__*/React.createElement("div", {
6694
+ }, /*#__PURE__*/React.createElement(Menu$2, null, isSearchable && /*#__PURE__*/React.createElement("div", {
7010
6695
  className: "neeto-ui-px-3 neeto-ui-py-2",
7011
6696
  onClick: e => {
7012
6697
  e.stopPropagation();
@@ -7021,7 +6706,7 @@ const RolesDropdown = _ref => {
7021
6706
  })), isNotEmpty$1(filteredRoles) ? filteredRoles.map(_ref3 => {
7022
6707
  let id = _ref3.id,
7023
6708
  name = _ref3.name;
7024
- return /*#__PURE__*/React.createElement(MenuItem.Button, {
6709
+ return /*#__PURE__*/React.createElement(MenuItem$1.Button, {
7025
6710
  key: id,
7026
6711
  onClick: () => handleSelectRole(name)
7027
6712
  }, name);
@@ -7689,6 +7374,8 @@ var pluralize = pluralize$1.exports;
7689
7374
 
7690
7375
  function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7691
7376
  function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7377
+ const Menu$1 = Dropdown.Menu,
7378
+ MenuItem = Dropdown.MenuItem;
7692
7379
  const renderNameColumn = (_ref, diplayStatusTag) => {
7693
7380
  let name = _ref.displayName,
7694
7381
  imageUrl = _ref.profileImageUrl,
@@ -7718,8 +7405,6 @@ const renderDropdownButton = (_ref2, handleUpdateRole, handleUpdateStatus, permi
7718
7405
  active = _ref2.active,
7719
7406
  email = _ref2.email,
7720
7407
  role = _ref2.role;
7721
- const Menu = Dropdown.Menu,
7722
- MenuItem = Dropdown.MenuItem;
7723
7408
  return /*#__PURE__*/React.createElement(Tooltip, {
7724
7409
  content: instance.t("tooltips.noPermissionToEditMembers"),
7725
7410
  disabled: !isDropDownButtonDisabled(permissions),
@@ -7730,7 +7415,7 @@ const renderDropdownButton = (_ref2, handleUpdateRole, handleUpdateStatus, permi
7730
7415
  buttonProps: DROPDOWN_BUTTON_PROPS,
7731
7416
  strategy: "fixed",
7732
7417
  disabled: isDropDownButtonDisabled(permissions)
7733
- }, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Tooltip, {
7418
+ }, /*#__PURE__*/React.createElement(Menu$1, null, /*#__PURE__*/React.createElement(Tooltip, {
7734
7419
  content: instance.t("tooltips.activateUserToEdit"),
7735
7420
  disabled: active,
7736
7421
  position: "top"
@@ -7766,14 +7451,12 @@ const getDefaultAlertTitle = _ref3 => {
7766
7451
  });
7767
7452
  };
7768
7453
  const getDefaultAlertMessage = _ref4 => {
7769
- let member = _ref4.member,
7770
- metaName = _ref4.metaName;
7771
- return member !== null && member !== void 0 && member.active ? instance.t("alerts.deactivating_", {
7772
- what: metaName(SINGULAR).toLocaleLowerCase(),
7773
- person: member === null || member === void 0 ? void 0 : member.name
7774
- }) : instance.t("alerts.activating_", {
7775
- what: metaName(SINGULAR).toLocaleLowerCase(),
7776
- person: member === null || member === void 0 ? void 0 : member.name
7454
+ let member = _ref4.member;
7455
+ return /*#__PURE__*/React.createElement(Trans, {
7456
+ i18nKey: member !== null && member !== void 0 && member.active ? "alerts.deactivating_" : "alerts.activating_",
7457
+ values: {
7458
+ person: member === null || member === void 0 ? void 0 : member.name
7459
+ }
7777
7460
  });
7778
7461
  };
7779
7462
  const getDefaultColumns = displayStatusTag => [{
@@ -8171,7 +7854,7 @@ const Menu = _ref => {
8171
7854
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8172
7855
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8173
7856
  const TeamMembers = _ref => {
8174
- var _config$permissions$v, _config$permissions, _config$permissions$v2, _config$permissions2, _filters$category;
7857
+ var _config$permissions$v, _config$permissions, _config$permissions$v2, _config$permissions2, _config$fetchApiRespo, _filters$category, _config$table, _config$table$onDropd;
8175
7858
  let config = _ref.config;
8176
7859
  const metaName = getMetaName((config === null || config === void 0 ? void 0 : config.metaName) || "member");
8177
7860
  const _useState = useState(DEFAULT_IS_OPEN_VALUES),
@@ -8218,6 +7901,9 @@ const TeamMembers = _ref => {
8218
7901
  }),
8219
7902
  updateMember = _useUpdateMember.mutate,
8220
7903
  isUpdatingMember = _useUpdateMember.isLoading;
7904
+ config === null || config === void 0 ? void 0 : (_config$fetchApiRespo = config.fetchApiResponse) === null || _config$fetchApiRespo === void 0 ? void 0 : _config$fetchApiRespo.call(config, {
7905
+ team
7906
+ });
8221
7907
  const currentCategoryCount = team === null || team === void 0 ? void 0 : team.perCategoryCount[filters === null || filters === void 0 ? void 0 : (_filters$category = filters.category) === null || _filters$category === void 0 ? void 0 : _filters$category.toLowerCase()];
8222
7908
  const searchProps = {
8223
7909
  "data-cy": "ntm-search-members-input",
@@ -8257,6 +7943,10 @@ const TeamMembers = _ref => {
8257
7943
  setSelectedMember(user);
8258
7944
  setIsOpen(assoc("manageMember", true));
8259
7945
  };
7946
+ config === null || config === void 0 ? void 0 : (_config$table = config.table) === null || _config$table === void 0 ? void 0 : (_config$table$onDropd = _config$table.onDropdownClick) === null || _config$table$onDropd === void 0 ? void 0 : _config$table$onDropd.call(_config$table, {
7947
+ handleUpdateRole,
7948
+ handleUpdateStatus
7949
+ });
8260
7950
  const columns = useMemo(() => getColumnData({
8261
7951
  config,
8262
7952
  handleUpdateRole,
@@ -8286,14 +7976,14 @@ const TeamMembers = _ref => {
8286
7976
  }));
8287
7977
  };
8288
7978
  const handleRowSelect = (keys, rowData) => {
8289
- var _config$table, _config$table$onRowSe;
7979
+ var _config$table2, _config$table2$onRowS;
8290
7980
  const rows = {
8291
7981
  active: pluck("active", rowData),
8292
7982
  emails: pluck("email", rowData),
8293
7983
  keys
8294
7984
  };
8295
7985
  setSelectedRows(_objectSpread({}, rows));
8296
- config === null || config === void 0 ? void 0 : (_config$table = config.table) === null || _config$table === void 0 ? void 0 : (_config$table$onRowSe = _config$table.onRowSelect) === null || _config$table$onRowSe === void 0 ? void 0 : _config$table$onRowSe.call(_config$table, {
7986
+ config === null || config === void 0 ? void 0 : (_config$table2 = config.table) === null || _config$table2 === void 0 ? void 0 : (_config$table2$onRowS = _config$table2.onRowSelect) === null || _config$table2$onRowS === void 0 ? void 0 : _config$table2$onRowS.call(_config$table2, {
8297
7987
  rows,
8298
7988
  resetSelectedRows,
8299
7989
  rowData
@@ -8322,6 +8012,7 @@ const TeamMembers = _ref => {
8322
8012
  })),
8323
8013
  searchProps: searchProps,
8324
8014
  actionBlock: /*#__PURE__*/React.createElement(Header, {
8015
+ config: config,
8325
8016
  metaName: metaName,
8326
8017
  onClick: () => setIsOpen(assoc("manageMember", true)),
8327
8018
  permissions: config === null || config === void 0 ? void 0 : config.permissions,
@@ -8364,6 +8055,7 @@ const TeamMembers = _ref => {
8364
8055
  what: metaName(PLURAL).toLocaleLowerCase()
8365
8056
  }),
8366
8057
  actionBlock: /*#__PURE__*/React.createElement(Header, {
8058
+ isEmptyState: true,
8367
8059
  metaName: metaName,
8368
8060
  onClick: () => setIsOpen(assoc("manageMember", true)),
8369
8061
  permissions: config === null || config === void 0 ? void 0 : config.permissions