gantt-task-react-v 1.0.34 → 1.0.36

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.
@@ -187,8 +187,7 @@
187
187
  }
188
188
  return matched;
189
189
  };
190
- const deepFind = function(obj, path) {
191
- let keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
190
+ const deepFind = (obj, path, keySeparator = ".") => {
192
191
  if (!obj)
193
192
  return void 0;
194
193
  if (obj[path]) {
@@ -240,39 +239,25 @@
240
239
  }
241
240
  };
242
241
  class Logger {
243
- constructor(concreteLogger) {
244
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
242
+ constructor(concreteLogger, options = {}) {
245
243
  this.init(concreteLogger, options);
246
244
  }
247
- init(concreteLogger) {
248
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
245
+ init(concreteLogger, options = {}) {
249
246
  this.prefix = options.prefix || "i18next:";
250
247
  this.logger = concreteLogger || consoleLogger;
251
248
  this.options = options;
252
249
  this.debug = options.debug;
253
250
  }
254
- log() {
255
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
256
- args[_key] = arguments[_key];
257
- }
251
+ log(...args) {
258
252
  return this.forward(args, "log", "", true);
259
253
  }
260
- warn() {
261
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
262
- args[_key2] = arguments[_key2];
263
- }
254
+ warn(...args) {
264
255
  return this.forward(args, "warn", "", true);
265
256
  }
266
- error() {
267
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
268
- args[_key3] = arguments[_key3];
269
- }
257
+ error(...args) {
270
258
  return this.forward(args, "error", "");
271
259
  }
272
- deprecate() {
273
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
274
- args[_key4] = arguments[_key4];
275
- }
260
+ deprecate(...args) {
276
261
  return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
277
262
  }
278
263
  forward(args, lvl, prefix, debugOnly) {
@@ -319,14 +304,10 @@
319
304
  }
320
305
  this.observers[event].delete(listener);
321
306
  }
322
- emit(event) {
323
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
324
- args[_key - 1] = arguments[_key];
325
- }
307
+ emit(event, ...args) {
326
308
  if (this.observers[event]) {
327
309
  const cloned = Array.from(this.observers[event].entries());
328
- cloned.forEach((_ref) => {
329
- let [observer, numTimesAdded] = _ref;
310
+ cloned.forEach(([observer, numTimesAdded]) => {
330
311
  for (let i = 0; i < numTimesAdded; i++) {
331
312
  observer(...args);
332
313
  }
@@ -334,8 +315,7 @@
334
315
  }
335
316
  if (this.observers["*"]) {
336
317
  const cloned = Array.from(this.observers["*"].entries());
337
- cloned.forEach((_ref2) => {
338
- let [observer, numTimesAdded] = _ref2;
318
+ cloned.forEach(([observer, numTimesAdded]) => {
339
319
  for (let i = 0; i < numTimesAdded; i++) {
340
320
  observer.apply(observer, [event, ...args]);
341
321
  }
@@ -344,11 +324,10 @@
344
324
  }
345
325
  }
346
326
  class ResourceStore extends EventEmitter {
347
- constructor(data) {
348
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
349
- ns: ["translation"],
350
- defaultNS: "translation"
351
- };
327
+ constructor(data, options = {
328
+ ns: ["translation"],
329
+ defaultNS: "translation"
330
+ }) {
352
331
  super();
353
332
  this.data = data || {};
354
333
  this.options = options;
@@ -370,9 +349,8 @@
370
349
  this.options.ns.splice(index2, 1);
371
350
  }
372
351
  }
373
- getResource(lng, ns, key2) {
352
+ getResource(lng, ns, key2, options = {}) {
374
353
  var _a, _b;
375
- let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
376
354
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
377
355
  const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
378
356
  let path;
@@ -400,10 +378,9 @@
400
378
  return result;
401
379
  return deepFind((_b = (_a = this.data) == null ? void 0 : _a[lng]) == null ? void 0 : _b[ns], key2, keySeparator);
402
380
  }
403
- addResource(lng, ns, key2, value) {
404
- let options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
405
- silent: false
406
- };
381
+ addResource(lng, ns, key2, value, options = {
382
+ silent: false
383
+ }) {
407
384
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
408
385
  let path = [lng, ns];
409
386
  if (key2)
@@ -418,10 +395,9 @@
418
395
  if (!options.silent)
419
396
  this.emit("added", lng, ns, key2, value);
420
397
  }
421
- addResources(lng, ns, resources) {
422
- let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
423
- silent: false
424
- };
398
+ addResources(lng, ns, resources, options = {
399
+ silent: false
400
+ }) {
425
401
  for (const m in resources) {
426
402
  if (isString$1(resources[m]) || Array.isArray(resources[m]))
427
403
  this.addResource(lng, ns, m, resources[m], {
@@ -431,11 +407,10 @@
431
407
  if (!options.silent)
432
408
  this.emit("added", lng, ns, resources);
433
409
  }
434
- addResourceBundle(lng, ns, resources, deep, overwrite) {
435
- let options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
436
- silent: false,
437
- skipCopy: false
438
- };
410
+ addResourceBundle(lng, ns, resources, deep, overwrite, options = {
411
+ silent: false,
412
+ skipCopy: false
413
+ }) {
439
414
  let path = [lng, ns];
440
415
  if (lng.indexOf(".") > -1) {
441
416
  path = lng.split(".");
@@ -499,11 +474,32 @@
499
474
  return value;
500
475
  }
501
476
  };
477
+ const PATH_KEY = Symbol("i18next/PATH_KEY");
478
+ function createProxy() {
479
+ const state = [];
480
+ const handler = /* @__PURE__ */ Object.create(null);
481
+ let proxy;
482
+ handler.get = (target, key2) => {
483
+ var _a;
484
+ (_a = proxy == null ? void 0 : proxy.revoke) == null ? void 0 : _a.call(proxy);
485
+ if (key2 === PATH_KEY)
486
+ return state;
487
+ state.push(key2);
488
+ proxy = Proxy.revocable(target, handler);
489
+ return proxy.proxy;
490
+ };
491
+ return Proxy.revocable(/* @__PURE__ */ Object.create(null), handler).proxy;
492
+ }
493
+ function keysFromSelector(selector, opts) {
494
+ const {
495
+ [PATH_KEY]: path
496
+ } = selector(createProxy());
497
+ return path.join((opts == null ? void 0 : opts.keySeparator) ?? ".");
498
+ }
502
499
  const checkedLoadedFor = {};
503
500
  const shouldHandleAsObject = (res) => !isString$1(res) && typeof res !== "boolean" && typeof res !== "number";
504
501
  class Translator extends EventEmitter {
505
- constructor(services) {
506
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
502
+ constructor(services, options = {}) {
507
503
  super();
508
504
  copy(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
509
505
  this.options = options;
@@ -516,24 +512,25 @@
516
512
  if (lng)
517
513
  this.language = lng;
518
514
  }
519
- exists(key2) {
520
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
521
- interpolation: {}
515
+ exists(key2, o = {
516
+ interpolation: {}
517
+ }) {
518
+ const opt = {
519
+ ...o
522
520
  };
523
- if (key2 == null) {
521
+ if (key2 == null)
524
522
  return false;
525
- }
526
- const resolved = this.resolve(key2, options);
523
+ const resolved = this.resolve(key2, opt);
527
524
  return (resolved == null ? void 0 : resolved.res) !== void 0;
528
525
  }
529
- extractFromKey(key2, options) {
530
- let nsSeparator = options.nsSeparator !== void 0 ? options.nsSeparator : this.options.nsSeparator;
526
+ extractFromKey(key2, opt) {
527
+ let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
531
528
  if (nsSeparator === void 0)
532
529
  nsSeparator = ":";
533
- const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
534
- let namespaces = options.ns || this.options.defaultNS || [];
530
+ const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
531
+ let namespaces = opt.ns || this.options.defaultNS || [];
535
532
  const wouldCheckForNsInKey = nsSeparator && key2.indexOf(nsSeparator) > -1;
536
- const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key2, nsSeparator, keySeparator);
533
+ const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key2, nsSeparator, keySeparator);
537
534
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
538
535
  const m = key2.match(this.interpolator.nestingRegexp);
539
536
  if (m && m.length > 0) {
@@ -552,32 +549,42 @@
552
549
  namespaces: isString$1(namespaces) ? [namespaces] : namespaces
553
550
  };
554
551
  }
555
- translate(keys, options, lastKey) {
556
- if (typeof options !== "object" && this.options.overloadTranslationOptionHandler) {
557
- options = this.options.overloadTranslationOptionHandler(arguments);
552
+ translate(keys, o, lastKey) {
553
+ let opt = typeof o === "object" ? {
554
+ ...o
555
+ } : o;
556
+ if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
557
+ opt = this.options.overloadTranslationOptionHandler(arguments);
558
558
  }
559
- if (typeof options === "object")
560
- options = {
561
- ...options
559
+ if (typeof opt === "object")
560
+ opt = {
561
+ ...opt
562
562
  };
563
- if (!options)
564
- options = {};
563
+ if (!opt)
564
+ opt = {};
565
565
  if (keys == null)
566
566
  return "";
567
+ if (typeof keys === "function")
568
+ keys = keysFromSelector(keys, {
569
+ ...this.options,
570
+ ...opt
571
+ });
567
572
  if (!Array.isArray(keys))
568
573
  keys = [String(keys)];
569
- const returnDetails = options.returnDetails !== void 0 ? options.returnDetails : this.options.returnDetails;
570
- const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
574
+ const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
575
+ const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
571
576
  const {
572
577
  key: key2,
573
578
  namespaces
574
- } = this.extractFromKey(keys[keys.length - 1], options);
579
+ } = this.extractFromKey(keys[keys.length - 1], opt);
575
580
  const namespace = namespaces[namespaces.length - 1];
576
- const lng = options.lng || this.language;
577
- const appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
581
+ let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
582
+ if (nsSeparator === void 0)
583
+ nsSeparator = ":";
584
+ const lng = opt.lng || this.language;
585
+ const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
578
586
  if ((lng == null ? void 0 : lng.toLowerCase()) === "cimode") {
579
587
  if (appendNamespaceToCIMode) {
580
- const nsSeparator = options.nsSeparator || this.options.nsSeparator;
581
588
  if (returnDetails) {
582
589
  return {
583
590
  res: `${namespace}${nsSeparator}${key2}`,
@@ -585,7 +592,7 @@
585
592
  exactUsedKey: key2,
586
593
  usedLng: lng,
587
594
  usedNS: namespace,
588
- usedParams: this.getUsedParamsDetails(options)
595
+ usedParams: this.getUsedParamsDetails(opt)
589
596
  };
590
597
  }
591
598
  return `${namespace}${nsSeparator}${key2}`;
@@ -597,26 +604,26 @@
597
604
  exactUsedKey: key2,
598
605
  usedLng: lng,
599
606
  usedNS: namespace,
600
- usedParams: this.getUsedParamsDetails(options)
607
+ usedParams: this.getUsedParamsDetails(opt)
601
608
  };
602
609
  }
603
610
  return key2;
604
611
  }
605
- const resolved = this.resolve(keys, options);
612
+ const resolved = this.resolve(keys, opt);
606
613
  let res = resolved == null ? void 0 : resolved.res;
607
614
  const resUsedKey = (resolved == null ? void 0 : resolved.usedKey) || key2;
608
615
  const resExactUsedKey = (resolved == null ? void 0 : resolved.exactUsedKey) || key2;
609
616
  const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
610
- const joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays;
617
+ const joinArrays = opt.joinArrays !== void 0 ? opt.joinArrays : this.options.joinArrays;
611
618
  const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
612
- const needsPluralHandling = options.count !== void 0 && !isString$1(options.count);
613
- const hasDefaultValue = Translator.hasDefaultValue(options);
614
- const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : "";
615
- const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {
619
+ const needsPluralHandling = opt.count !== void 0 && !isString$1(opt.count);
620
+ const hasDefaultValue = Translator.hasDefaultValue(opt);
621
+ const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : "";
622
+ const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
616
623
  ordinal: false
617
624
  }) : "";
618
- const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0;
619
- const defaultValue2 = needsZeroSuffixLookup && options[`defaultValue${this.options.pluralSeparator}zero`] || options[`defaultValue${defaultValueSuffix}`] || options[`defaultValue${defaultValueSuffixOrdinalFallback}`] || options.defaultValue;
625
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
626
+ const defaultValue2 = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
620
627
  let resForObjHndl = res;
621
628
  if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
622
629
  resForObjHndl = defaultValue2;
@@ -624,17 +631,17 @@
624
631
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
625
632
  const resType = Object.prototype.toString.apply(resForObjHndl);
626
633
  if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString$1(joinArrays) && Array.isArray(resForObjHndl))) {
627
- if (!options.returnObjects && !this.options.returnObjects) {
634
+ if (!opt.returnObjects && !this.options.returnObjects) {
628
635
  if (!this.options.returnedObjectHandler) {
629
636
  this.logger.warn("accessing an object - but returnObjects options is not enabled!");
630
637
  }
631
638
  const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
632
- ...options,
639
+ ...opt,
633
640
  ns: namespaces
634
641
  }) : `key '${key2} (${this.language})' returned an object instead of string.`;
635
642
  if (returnDetails) {
636
643
  resolved.res = r;
637
- resolved.usedParams = this.getUsedParamsDetails(options);
644
+ resolved.usedParams = this.getUsedParamsDetails(opt);
638
645
  return resolved;
639
646
  }
640
647
  return r;
@@ -648,7 +655,7 @@
648
655
  const deepKey = `${newKeyToUse}${keySeparator}${m}`;
649
656
  if (hasDefaultValue && !res) {
650
657
  copy2[m] = this.translate(deepKey, {
651
- ...options,
658
+ ...opt,
652
659
  defaultValue: shouldHandleAsObject(defaultValue2) ? defaultValue2[m] : void 0,
653
660
  ...{
654
661
  joinArrays: false,
@@ -657,7 +664,7 @@
657
664
  });
658
665
  } else {
659
666
  copy2[m] = this.translate(deepKey, {
660
- ...options,
667
+ ...opt,
661
668
  ...{
662
669
  joinArrays: false,
663
670
  ns: namespaces
@@ -673,7 +680,7 @@
673
680
  } else if (handleAsObjectInI18nFormat && isString$1(joinArrays) && Array.isArray(res)) {
674
681
  res = res.join(joinArrays);
675
682
  if (res)
676
- res = this.extendTranslation(res, keys, options, lastKey);
683
+ res = this.extendTranslation(res, keys, opt, lastKey);
677
684
  } else {
678
685
  let usedDefault = false;
679
686
  let usedKey = false;
@@ -685,49 +692,49 @@
685
692
  usedKey = true;
686
693
  res = key2;
687
694
  }
688
- const missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
695
+ const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
689
696
  const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res;
690
697
  const updateMissing = hasDefaultValue && defaultValue2 !== res && this.options.updateMissing;
691
698
  if (usedKey || usedDefault || updateMissing) {
692
699
  this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key2, updateMissing ? defaultValue2 : res);
693
700
  if (keySeparator) {
694
701
  const fk = this.resolve(key2, {
695
- ...options,
702
+ ...opt,
696
703
  keySeparator: false
697
704
  });
698
705
  if (fk && fk.res)
699
706
  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.");
700
707
  }
701
708
  let lngs = [];
702
- const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
709
+ const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
703
710
  if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
704
711
  for (let i = 0; i < fallbackLngs.length; i++) {
705
712
  lngs.push(fallbackLngs[i]);
706
713
  }
707
714
  } else if (this.options.saveMissingTo === "all") {
708
- lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
715
+ lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
709
716
  } else {
710
- lngs.push(options.lng || this.language);
717
+ lngs.push(opt.lng || this.language);
711
718
  }
712
719
  const send = (l, k, specificDefaultValue) => {
713
720
  var _a;
714
721
  const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
715
722
  if (this.options.missingKeyHandler) {
716
- this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
723
+ this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
717
724
  } else if ((_a = this.backendConnector) == null ? void 0 : _a.saveMissing) {
718
- this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
725
+ this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
719
726
  }
720
727
  this.emit("missingKey", l, namespace, k, res);
721
728
  };
722
729
  if (this.options.saveMissing) {
723
730
  if (this.options.saveMissingPlurals && needsPluralHandling) {
724
731
  lngs.forEach((language) => {
725
- const suffixes = this.pluralResolver.getSuffixes(language, options);
726
- if (needsZeroSuffixLookup && options[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
732
+ const suffixes = this.pluralResolver.getSuffixes(language, opt);
733
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
727
734
  suffixes.push(`${this.options.pluralSeparator}zero`);
728
735
  }
729
736
  suffixes.forEach((suffix) => {
730
- send([language], key2 + suffix, options[`defaultValue${suffix}`] || defaultValue2);
737
+ send([language], key2 + suffix, opt[`defaultValue${suffix}`] || defaultValue2);
731
738
  });
732
739
  });
733
740
  } else {
@@ -735,91 +742,87 @@
735
742
  }
736
743
  }
737
744
  }
738
- res = this.extendTranslation(res, keys, options, resolved, lastKey);
739
- if (usedKey && res === key2 && this.options.appendNamespaceToMissingKey)
740
- res = `${namespace}:${key2}`;
745
+ res = this.extendTranslation(res, keys, opt, resolved, lastKey);
746
+ if (usedKey && res === key2 && this.options.appendNamespaceToMissingKey) {
747
+ res = `${namespace}${nsSeparator}${key2}`;
748
+ }
741
749
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
742
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key2}` : key2, usedDefault ? res : void 0);
750
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key2}` : key2, usedDefault ? res : void 0, opt);
743
751
  }
744
752
  }
745
753
  if (returnDetails) {
746
754
  resolved.res = res;
747
- resolved.usedParams = this.getUsedParamsDetails(options);
755
+ resolved.usedParams = this.getUsedParamsDetails(opt);
748
756
  return resolved;
749
757
  }
750
758
  return res;
751
759
  }
752
- extendTranslation(res, key2, options, resolved, lastKey) {
760
+ extendTranslation(res, key2, opt, resolved, lastKey) {
753
761
  var _a, _b;
754
- var _this = this;
755
762
  if ((_a = this.i18nFormat) == null ? void 0 : _a.parse) {
756
763
  res = this.i18nFormat.parse(res, {
757
764
  ...this.options.interpolation.defaultVariables,
758
- ...options
759
- }, options.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
765
+ ...opt
766
+ }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
760
767
  resolved
761
768
  });
762
- } else if (!options.skipInterpolation) {
763
- if (options.interpolation)
769
+ } else if (!opt.skipInterpolation) {
770
+ if (opt.interpolation)
764
771
  this.interpolator.init({
765
- ...options,
772
+ ...opt,
766
773
  ...{
767
774
  interpolation: {
768
775
  ...this.options.interpolation,
769
- ...options.interpolation
776
+ ...opt.interpolation
770
777
  }
771
778
  }
772
779
  });
773
- const skipOnVariables = isString$1(res) && (((_b = options == null ? void 0 : options.interpolation) == null ? void 0 : _b.skipOnVariables) !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
780
+ const skipOnVariables = isString$1(res) && (((_b = opt == null ? void 0 : opt.interpolation) == null ? void 0 : _b.skipOnVariables) !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
774
781
  let nestBef;
775
782
  if (skipOnVariables) {
776
783
  const nb = res.match(this.interpolator.nestingRegexp);
777
784
  nestBef = nb && nb.length;
778
785
  }
779
- let data = options.replace && !isString$1(options.replace) ? options.replace : options;
786
+ let data = opt.replace && !isString$1(opt.replace) ? opt.replace : opt;
780
787
  if (this.options.interpolation.defaultVariables)
781
788
  data = {
782
789
  ...this.options.interpolation.defaultVariables,
783
790
  ...data
784
791
  };
785
- res = this.interpolator.interpolate(res, data, options.lng || this.language || resolved.usedLng, options);
792
+ res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
786
793
  if (skipOnVariables) {
787
794
  const na = res.match(this.interpolator.nestingRegexp);
788
795
  const nestAft = na && na.length;
789
796
  if (nestBef < nestAft)
790
- options.nest = false;
791
- }
792
- if (!options.lng && resolved && resolved.res)
793
- options.lng = this.language || resolved.usedLng;
794
- if (options.nest !== false)
795
- res = this.interpolator.nest(res, function() {
796
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
797
- args[_key] = arguments[_key];
798
- }
799
- if ((lastKey == null ? void 0 : lastKey[0]) === args[0] && !options.context) {
800
- _this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key2[0]}`);
797
+ opt.nest = false;
798
+ }
799
+ if (!opt.lng && resolved && resolved.res)
800
+ opt.lng = this.language || resolved.usedLng;
801
+ if (opt.nest !== false)
802
+ res = this.interpolator.nest(res, (...args) => {
803
+ if ((lastKey == null ? void 0 : lastKey[0]) === args[0] && !opt.context) {
804
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key2[0]}`);
801
805
  return null;
802
806
  }
803
- return _this.translate(...args, key2);
804
- }, options);
805
- if (options.interpolation)
807
+ return this.translate(...args, key2);
808
+ }, opt);
809
+ if (opt.interpolation)
806
810
  this.interpolator.reset();
807
811
  }
808
- const postProcess = options.postProcess || this.options.postProcess;
812
+ const postProcess = opt.postProcess || this.options.postProcess;
809
813
  const postProcessorNames = isString$1(postProcess) ? [postProcess] : postProcess;
810
- if (res != null && (postProcessorNames == null ? void 0 : postProcessorNames.length) && options.applyPostProcessor !== false) {
814
+ if (res != null && (postProcessorNames == null ? void 0 : postProcessorNames.length) && opt.applyPostProcessor !== false) {
811
815
  res = postProcessor.handle(postProcessorNames, res, key2, this.options && this.options.postProcessPassResolved ? {
812
816
  i18nResolved: {
813
817
  ...resolved,
814
- usedParams: this.getUsedParamsDetails(options)
818
+ usedParams: this.getUsedParamsDetails(opt)
815
819
  },
816
- ...options
817
- } : options, this);
820
+ ...opt
821
+ } : opt, this);
818
822
  }
819
823
  return res;
820
824
  }
821
- resolve(keys) {
822
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
825
+ resolve(keys, opt = {}) {
823
826
  let found;
824
827
  let usedKey;
825
828
  let exactUsedKey;
@@ -830,16 +833,16 @@
830
833
  keys.forEach((k) => {
831
834
  if (this.isValidLookup(found))
832
835
  return;
833
- const extracted = this.extractFromKey(k, options);
836
+ const extracted = this.extractFromKey(k, opt);
834
837
  const key2 = extracted.key;
835
838
  usedKey = key2;
836
839
  let namespaces = extracted.namespaces;
837
840
  if (this.options.fallbackNS)
838
841
  namespaces = namespaces.concat(this.options.fallbackNS);
839
- const needsPluralHandling = options.count !== void 0 && !isString$1(options.count);
840
- const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0;
841
- const needsContextHandling = options.context !== void 0 && (isString$1(options.context) || typeof options.context === "number") && options.context !== "";
842
- const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);
842
+ const needsPluralHandling = opt.count !== void 0 && !isString$1(opt.count);
843
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
844
+ const needsContextHandling = opt.context !== void 0 && (isString$1(opt.context) || typeof opt.context === "number") && opt.context !== "";
845
+ const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
843
846
  namespaces.forEach((ns) => {
844
847
  var _a, _b;
845
848
  if (this.isValidLookup(found))
@@ -856,30 +859,30 @@
856
859
  usedLng = code;
857
860
  const finalKeys = [key2];
858
861
  if ((_a2 = this.i18nFormat) == null ? void 0 : _a2.addLookupKeys) {
859
- this.i18nFormat.addLookupKeys(finalKeys, key2, code, ns, options);
862
+ this.i18nFormat.addLookupKeys(finalKeys, key2, code, ns, opt);
860
863
  } else {
861
864
  let pluralSuffix;
862
865
  if (needsPluralHandling)
863
- pluralSuffix = this.pluralResolver.getSuffix(code, options.count, options);
866
+ pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
864
867
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
865
868
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
866
869
  if (needsPluralHandling) {
867
- finalKeys.push(key2 + pluralSuffix);
868
- if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
870
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
869
871
  finalKeys.push(key2 + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
870
872
  }
873
+ finalKeys.push(key2 + pluralSuffix);
871
874
  if (needsZeroSuffixLookup) {
872
875
  finalKeys.push(key2 + zeroSuffix);
873
876
  }
874
877
  }
875
878
  if (needsContextHandling) {
876
- const contextKey = `${key2}${this.options.contextSeparator}${options.context}`;
879
+ const contextKey = `${key2}${this.options.contextSeparator || "_"}${opt.context}`;
877
880
  finalKeys.push(contextKey);
878
881
  if (needsPluralHandling) {
879
- finalKeys.push(contextKey + pluralSuffix);
880
- if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
882
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
881
883
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
882
884
  }
885
+ finalKeys.push(contextKey + pluralSuffix);
883
886
  if (needsZeroSuffixLookup) {
884
887
  finalKeys.push(contextKey + zeroSuffix);
885
888
  }
@@ -890,7 +893,7 @@
890
893
  while (possibleKey = finalKeys.pop()) {
891
894
  if (!this.isValidLookup(found)) {
892
895
  exactUsedKey = possibleKey;
893
- found = this.getResource(code, ns, possibleKey, options);
896
+ found = this.getResource(code, ns, possibleKey, opt);
894
897
  }
895
898
  }
896
899
  });
@@ -907,15 +910,13 @@
907
910
  isValidLookup(res) {
908
911
  return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
909
912
  }
910
- getResource(code, ns, key2) {
913
+ getResource(code, ns, key2, options = {}) {
911
914
  var _a;
912
- let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
913
915
  if ((_a = this.i18nFormat) == null ? void 0 : _a.getResource)
914
916
  return this.i18nFormat.getResource(code, ns, key2, options);
915
917
  return this.resourceStore.getResource(code, ns, key2, options);
916
918
  }
917
- getUsedParamsDetails() {
918
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
919
+ getUsedParamsDetails(options = {}) {
919
920
  const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
920
921
  const useOptionsReplaceForData = options.replace && !isString$1(options.replace);
921
922
  let data = useOptionsReplaceForData ? options.replace : options;
@@ -1013,6 +1014,9 @@
1013
1014
  codes.forEach((code) => {
1014
1015
  if (found)
1015
1016
  return;
1017
+ const lngScOnly = this.getScriptPartFromCode(code);
1018
+ if (this.isSupportedCode(lngScOnly))
1019
+ return found = lngScOnly;
1016
1020
  const lngOnly = this.getLanguagePartFromCode(code);
1017
1021
  if (this.isSupportedCode(lngOnly))
1018
1022
  return found = lngOnly;
@@ -1055,7 +1059,7 @@
1055
1059
  return found || [];
1056
1060
  }
1057
1061
  toResolveHierarchy(code, fallbackCode) {
1058
- const fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1062
+ const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
1059
1063
  const codes = [];
1060
1064
  const addCode = (c) => {
1061
1065
  if (!c)
@@ -1098,8 +1102,7 @@
1098
1102
  })
1099
1103
  };
1100
1104
  class PluralResolver {
1101
- constructor(languageUtils) {
1102
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1105
+ constructor(languageUtils, options = {}) {
1103
1106
  this.languageUtils = languageUtils;
1104
1107
  this.options = options;
1105
1108
  this.logger = baseLogger.create("pluralResolver");
@@ -1111,8 +1114,7 @@
1111
1114
  clearCache() {
1112
1115
  this.pluralRulesCache = {};
1113
1116
  }
1114
- getRule(code) {
1115
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1117
+ getRule(code, options = {}) {
1116
1118
  const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
1117
1119
  const type = options.ordinal ? "ordinal" : "cardinal";
1118
1120
  const cacheKey = JSON.stringify({
@@ -1140,19 +1142,16 @@
1140
1142
  this.pluralRulesCache[cacheKey] = rule;
1141
1143
  return rule;
1142
1144
  }
1143
- needsPlural(code) {
1144
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1145
+ needsPlural(code, options = {}) {
1145
1146
  let rule = this.getRule(code, options);
1146
1147
  if (!rule)
1147
1148
  rule = this.getRule("dev", options);
1148
1149
  return (rule == null ? void 0 : rule.resolvedOptions().pluralCategories.length) > 1;
1149
1150
  }
1150
- getPluralFormsOfKey(code, key2) {
1151
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1151
+ getPluralFormsOfKey(code, key2, options = {}) {
1152
1152
  return this.getSuffixes(code, options).map((suffix) => `${key2}${suffix}`);
1153
1153
  }
1154
- getSuffixes(code) {
1155
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1154
+ getSuffixes(code, options = {}) {
1156
1155
  let rule = this.getRule(code, options);
1157
1156
  if (!rule)
1158
1157
  rule = this.getRule("dev", options);
@@ -1160,8 +1159,7 @@
1160
1159
  return [];
1161
1160
  return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
1162
1161
  }
1163
- getSuffix(code, count2) {
1164
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1162
+ getSuffix(code, count2, options = {}) {
1165
1163
  const rule = this.getRule(code, options);
1166
1164
  if (rule) {
1167
1165
  return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count2)}`;
@@ -1170,9 +1168,7 @@
1170
1168
  return this.getSuffix("dev", count2, options);
1171
1169
  }
1172
1170
  }
1173
- const deepFindWithDefaults = function(data, defaultData2, key2) {
1174
- let keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".";
1175
- let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
1171
+ const deepFindWithDefaults = (data, defaultData2, key2, keySeparator = ".", ignoreJSONStructure = true) => {
1176
1172
  let path = getPathWithDefaults(data, defaultData2, key2);
1177
1173
  if (!path && ignoreJSONStructure && isString$1(key2)) {
1178
1174
  path = deepFind(data, key2, keySeparator);
@@ -1183,16 +1179,14 @@
1183
1179
  };
1184
1180
  const regexSafe = (val) => val.replace(/\$/g, "$$$$");
1185
1181
  class Interpolator {
1186
- constructor() {
1182
+ constructor(options = {}) {
1187
1183
  var _a;
1188
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1189
1184
  this.logger = baseLogger.create("interpolator");
1190
1185
  this.options = options;
1191
1186
  this.format = ((_a = options == null ? void 0 : options.interpolation) == null ? void 0 : _a.format) || ((value) => value);
1192
1187
  this.init(options);
1193
1188
  }
1194
- init() {
1195
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1189
+ init(options = {}) {
1196
1190
  if (!options.interpolation)
1197
1191
  options.interpolation = {
1198
1192
  escapeValue: true
@@ -1245,7 +1239,7 @@
1245
1239
  };
1246
1240
  this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
1247
1241
  this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
1248
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
1242
+ this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
1249
1243
  }
1250
1244
  interpolate(str, data, lng, options) {
1251
1245
  var _a;
@@ -1318,8 +1312,7 @@
1318
1312
  });
1319
1313
  return str;
1320
1314
  }
1321
- nest(str, fc) {
1322
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1315
+ nest(str, fc, options = {}) {
1323
1316
  let match2;
1324
1317
  let value;
1325
1318
  let clonedOptions;
@@ -1359,12 +1352,10 @@
1359
1352
  clonedOptions = clonedOptions.replace && !isString$1(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1360
1353
  clonedOptions.applyPostProcessor = false;
1361
1354
  delete clonedOptions.defaultValue;
1362
- let doReduce = false;
1363
- if (match2[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match2[1])) {
1364
- const r = match2[1].split(this.formatSeparator).map((elem) => elem.trim());
1365
- match2[1] = r.shift();
1366
- formatters2 = r;
1367
- doReduce = true;
1355
+ const keyEndIndex = /{.*}/.test(match2[1]) ? match2[1].lastIndexOf("}") + 1 : match2[1].indexOf(this.formatSeparator);
1356
+ if (keyEndIndex !== -1) {
1357
+ formatters2 = match2[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
1358
+ match2[1] = match2[1].slice(0, keyEndIndex);
1368
1359
  }
1369
1360
  value = fc(handleHasOptions.call(this, match2[1].trim(), clonedOptions), clonedOptions);
1370
1361
  if (value && match2[0] === str && !isString$1(value))
@@ -1375,7 +1366,7 @@
1375
1366
  this.logger.warn(`missed to resolve ${match2[1]} for nesting ${str}`);
1376
1367
  value = "";
1377
1368
  }
1378
- if (doReduce) {
1369
+ if (formatters2.length) {
1379
1370
  value = formatters2.reduce((v, f) => this.format(v, f, options.lng, {
1380
1371
  ...options,
1381
1372
  interpolationkey: match2[1].trim()
@@ -1426,68 +1417,68 @@
1426
1417
  };
1427
1418
  const createCachedFormatter = (fn) => {
1428
1419
  const cache = {};
1429
- return (val, lng, options) => {
1430
- let optForCache = options;
1431
- if (options && options.interpolationkey && options.formatParams && options.formatParams[options.interpolationkey] && options[options.interpolationkey]) {
1420
+ return (v, l, o) => {
1421
+ let optForCache = o;
1422
+ if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
1432
1423
  optForCache = {
1433
1424
  ...optForCache,
1434
- [options.interpolationkey]: void 0
1425
+ [o.interpolationkey]: void 0
1435
1426
  };
1436
1427
  }
1437
- const key2 = lng + JSON.stringify(optForCache);
1438
- let formatter = cache[key2];
1439
- if (!formatter) {
1440
- formatter = fn(getCleanedCode(lng), options);
1441
- cache[key2] = formatter;
1428
+ const key2 = l + JSON.stringify(optForCache);
1429
+ let frm = cache[key2];
1430
+ if (!frm) {
1431
+ frm = fn(getCleanedCode(l), o);
1432
+ cache[key2] = frm;
1442
1433
  }
1443
- return formatter(val);
1434
+ return frm(v);
1444
1435
  };
1445
1436
  };
1437
+ const createNonCachedFormatter = (fn) => (v, l, o) => fn(getCleanedCode(l), o)(v);
1446
1438
  class Formatter {
1447
- constructor() {
1448
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1439
+ constructor(options = {}) {
1449
1440
  this.logger = baseLogger.create("formatter");
1450
1441
  this.options = options;
1442
+ this.init(options);
1443
+ }
1444
+ init(services, options = {
1445
+ interpolation: {}
1446
+ }) {
1447
+ this.formatSeparator = options.interpolation.formatSeparator || ",";
1448
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1451
1449
  this.formats = {
1452
- number: createCachedFormatter((lng, opt) => {
1450
+ number: cf((lng, opt) => {
1453
1451
  const formatter = new Intl.NumberFormat(lng, {
1454
1452
  ...opt
1455
1453
  });
1456
1454
  return (val) => formatter.format(val);
1457
1455
  }),
1458
- currency: createCachedFormatter((lng, opt) => {
1456
+ currency: cf((lng, opt) => {
1459
1457
  const formatter = new Intl.NumberFormat(lng, {
1460
1458
  ...opt,
1461
1459
  style: "currency"
1462
1460
  });
1463
1461
  return (val) => formatter.format(val);
1464
1462
  }),
1465
- datetime: createCachedFormatter((lng, opt) => {
1463
+ datetime: cf((lng, opt) => {
1466
1464
  const formatter = new Intl.DateTimeFormat(lng, {
1467
1465
  ...opt
1468
1466
  });
1469
1467
  return (val) => formatter.format(val);
1470
1468
  }),
1471
- relativetime: createCachedFormatter((lng, opt) => {
1469
+ relativetime: cf((lng, opt) => {
1472
1470
  const formatter = new Intl.RelativeTimeFormat(lng, {
1473
1471
  ...opt
1474
1472
  });
1475
1473
  return (val) => formatter.format(val, opt.range || "day");
1476
1474
  }),
1477
- list: createCachedFormatter((lng, opt) => {
1475
+ list: cf((lng, opt) => {
1478
1476
  const formatter = new Intl.ListFormat(lng, {
1479
1477
  ...opt
1480
1478
  });
1481
1479
  return (val) => formatter.format(val);
1482
1480
  })
1483
1481
  };
1484
- this.init(options);
1485
- }
1486
- init(services) {
1487
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1488
- interpolation: {}
1489
- };
1490
- this.formatSeparator = options.interpolation.formatSeparator || ",";
1491
1482
  }
1492
1483
  add(name, fc) {
1493
1484
  this.formats[name.toLowerCase().trim()] = fc;
@@ -1495,8 +1486,7 @@
1495
1486
  addCached(name, fc) {
1496
1487
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1497
1488
  }
1498
- format(value, format2, lng) {
1499
- let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1489
+ format(value, format2, lng, options = {}) {
1500
1490
  const formats = format2.split(this.formatSeparator);
1501
1491
  if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f) => f.indexOf(")") > -1)) {
1502
1492
  const lastIndex = formats.findIndex((f) => f.indexOf(")") > -1);
@@ -1537,9 +1527,8 @@
1537
1527
  }
1538
1528
  };
1539
1529
  class Connector extends EventEmitter {
1540
- constructor(backend, store, services) {
1530
+ constructor(backend, store, services, options = {}) {
1541
1531
  var _a, _b;
1542
- let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1543
1532
  super();
1544
1533
  this.backend = backend;
1545
1534
  this.store = store;
@@ -1645,10 +1634,7 @@
1645
1634
  this.emit("loaded", loaded);
1646
1635
  this.queue = this.queue.filter((q) => !q.done);
1647
1636
  }
1648
- read(lng, ns, fcName) {
1649
- let tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
1650
- let wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout;
1651
- let callback = arguments.length > 5 ? arguments[5] : void 0;
1637
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1652
1638
  if (!lng.length)
1653
1639
  return callback(null, {});
1654
1640
  if (this.readingCalls >= this.maxParallelReads) {
@@ -1693,9 +1679,7 @@
1693
1679
  }
1694
1680
  return fc(lng, ns, resolver);
1695
1681
  }
1696
- prepareLoading(languages, namespaces) {
1697
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1698
- let callback = arguments.length > 3 ? arguments[3] : void 0;
1682
+ prepareLoading(languages, namespaces, options = {}, callback) {
1699
1683
  if (!this.backend) {
1700
1684
  this.logger.warn("No backend was added via i18next.use. Will not load resources.");
1701
1685
  return callback && callback();
@@ -1722,8 +1706,7 @@
1722
1706
  reload: true
1723
1707
  }, callback);
1724
1708
  }
1725
- loadOne(name) {
1726
- let prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1709
+ loadOne(name, prefix = "") {
1727
1710
  const s = name.split("|");
1728
1711
  const lng = s[0];
1729
1712
  const ns = s[1];
@@ -1735,11 +1718,9 @@
1735
1718
  this.loaded(name, err, data);
1736
1719
  });
1737
1720
  }
1738
- saveMissing(languages, namespace, key2, fallbackValue, isUpdate) {
1721
+ saveMissing(languages, namespace, key2, fallbackValue, isUpdate, options = {}, clb = () => {
1722
+ }) {
1739
1723
  var _a, _b, _c, _d, _e;
1740
- let options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
1741
- let clb = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1742
- };
1743
1724
  if (((_b = (_a = this.services) == null ? void 0 : _a.utils) == null ? void 0 : _b.hasLoadedNamespace) && !((_d = (_c = this.services) == null ? void 0 : _c.utils) == null ? void 0 : _d.hasLoadedNamespace(namespace))) {
1744
1725
  this.logger.warn(`did not save key "${key2}" as the namespace "${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!!!");
1745
1726
  return;
@@ -1838,7 +1819,8 @@
1838
1819
  nestingOptionsSeparator: ",",
1839
1820
  maxReplaces: 1e3,
1840
1821
  skipOnVariables: true
1841
- }
1822
+ },
1823
+ cacheInBuiltFormats: true
1842
1824
  });
1843
1825
  const transformOptions = (options) => {
1844
1826
  var _a, _b;
@@ -1866,9 +1848,7 @@
1866
1848
  });
1867
1849
  };
1868
1850
  class I18n extends EventEmitter {
1869
- constructor() {
1870
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1871
- let callback = arguments.length > 1 ? arguments[1] : void 0;
1851
+ constructor(options = {}, callback) {
1872
1852
  super();
1873
1853
  this.options = transformOptions(options);
1874
1854
  this.services = {};
@@ -1887,10 +1867,7 @@
1887
1867
  }, 0);
1888
1868
  }
1889
1869
  }
1890
- init() {
1891
- var _this = this;
1892
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1893
- let callback = arguments.length > 1 ? arguments[1] : void 0;
1870
+ init(options = {}, callback) {
1894
1871
  this.isInitializing = true;
1895
1872
  if (typeof options === "function") {
1896
1873
  callback = options;
@@ -1948,9 +1925,14 @@
1948
1925
  prepend: this.options.pluralSeparator,
1949
1926
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
1950
1927
  });
1928
+ const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
1929
+ if (usingLegacyFormatFunction) {
1930
+ this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1931
+ }
1951
1932
  if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1952
1933
  s.formatter = createClassOnDemand(formatter);
1953
- s.formatter.init(s, this.options);
1934
+ if (s.formatter.init)
1935
+ s.formatter.init(s, this.options);
1954
1936
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1955
1937
  }
1956
1938
  s.interpolator = new Interpolator(this.options);
@@ -1958,11 +1940,8 @@
1958
1940
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1959
1941
  };
1960
1942
  s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1961
- s.backendConnector.on("*", function(event) {
1962
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1963
- args[_key - 1] = arguments[_key];
1964
- }
1965
- _this.emit(event, ...args);
1943
+ s.backendConnector.on("*", (event, ...args) => {
1944
+ this.emit(event, ...args);
1966
1945
  });
1967
1946
  if (this.modules.languageDetector) {
1968
1947
  s.languageDetector = createClassOnDemand(this.modules.languageDetector);
@@ -1975,11 +1954,8 @@
1975
1954
  s.i18nFormat.init(this);
1976
1955
  }
1977
1956
  this.translator = new Translator(this.services, this.options);
1978
- this.translator.on("*", function(event) {
1979
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1980
- args[_key2 - 1] = arguments[_key2];
1981
- }
1982
- _this.emit(event, ...args);
1957
+ this.translator.on("*", (event, ...args) => {
1958
+ this.emit(event, ...args);
1983
1959
  });
1984
1960
  this.modules.external.forEach((m) => {
1985
1961
  if (m.init)
@@ -1999,15 +1975,13 @@
1999
1975
  }
2000
1976
  const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
2001
1977
  storeApi.forEach((fcName) => {
2002
- this[fcName] = function() {
2003
- return _this.store[fcName](...arguments);
2004
- };
1978
+ this[fcName] = (...args) => this.store[fcName](...args);
2005
1979
  });
2006
1980
  const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
2007
1981
  storeApiChained.forEach((fcName) => {
2008
- this[fcName] = function() {
2009
- _this.store[fcName](...arguments);
2010
- return _this;
1982
+ this[fcName] = (...args) => {
1983
+ this.store[fcName](...args);
1984
+ return this;
2011
1985
  };
2012
1986
  });
2013
1987
  const deferred = defer();
@@ -2034,9 +2008,8 @@
2034
2008
  }
2035
2009
  return deferred;
2036
2010
  }
2037
- loadResources(language) {
2011
+ loadResources(language, callback = noop$1) {
2038
2012
  var _a, _b;
2039
- let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1;
2040
2013
  let usedCallback = callback;
2041
2014
  const usedLng = isString$1(language) ? language : this.language;
2042
2015
  if (typeof language === "function")
@@ -2138,9 +2111,12 @@
2138
2111
  break;
2139
2112
  }
2140
2113
  }
2114
+ if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
2115
+ this.resolvedLanguage = l;
2116
+ this.languages.unshift(l);
2117
+ }
2141
2118
  }
2142
2119
  changeLanguage(lng, callback) {
2143
- var _this2 = this;
2144
2120
  this.isLanguageChangingTo = lng;
2145
2121
  const deferred = defer();
2146
2122
  this.emit("languageChanging", lng);
@@ -2152,27 +2128,26 @@
2152
2128
  };
2153
2129
  const done = (err, l) => {
2154
2130
  if (l) {
2155
- setLngProps(l);
2156
- this.translator.changeLanguage(l);
2157
- this.isLanguageChangingTo = void 0;
2158
- this.emit("languageChanged", l);
2159
- this.logger.log("languageChanged", l);
2131
+ if (this.isLanguageChangingTo === lng) {
2132
+ setLngProps(l);
2133
+ this.translator.changeLanguage(l);
2134
+ this.isLanguageChangingTo = void 0;
2135
+ this.emit("languageChanged", l);
2136
+ this.logger.log("languageChanged", l);
2137
+ }
2160
2138
  } else {
2161
2139
  this.isLanguageChangingTo = void 0;
2162
2140
  }
2163
- deferred.resolve(function() {
2164
- return _this2.t(...arguments);
2165
- });
2141
+ deferred.resolve((...args) => this.t(...args));
2166
2142
  if (callback)
2167
- callback(err, function() {
2168
- return _this2.t(...arguments);
2169
- });
2143
+ callback(err, (...args) => this.t(...args));
2170
2144
  };
2171
2145
  const setLng = (lngs) => {
2172
2146
  var _a, _b;
2173
2147
  if (!lng && !lngs && this.services.languageDetector)
2174
2148
  lngs = [];
2175
- const l = isString$1(lngs) ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);
2149
+ const fl = isString$1(lngs) ? lngs : lngs && lngs[0];
2150
+ const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString$1(lngs) ? [lngs] : lngs);
2176
2151
  if (l) {
2177
2152
  if (!this.language) {
2178
2153
  setLngProps(l);
@@ -2199,32 +2174,40 @@
2199
2174
  return deferred;
2200
2175
  }
2201
2176
  getFixedT(lng, ns, keyPrefix) {
2202
- var _this3 = this;
2203
- const fixedT = function(key2, opts) {
2204
- let options;
2177
+ const fixedT = (key2, opts, ...rest) => {
2178
+ let o;
2205
2179
  if (typeof opts !== "object") {
2206
- for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2207
- rest[_key3 - 2] = arguments[_key3];
2208
- }
2209
- options = _this3.options.overloadTranslationOptionHandler([key2, opts].concat(rest));
2180
+ o = this.options.overloadTranslationOptionHandler([key2, opts].concat(rest));
2210
2181
  } else {
2211
- options = {
2182
+ o = {
2212
2183
  ...opts
2213
2184
  };
2214
2185
  }
2215
- options.lng = options.lng || fixedT.lng;
2216
- options.lngs = options.lngs || fixedT.lngs;
2217
- options.ns = options.ns || fixedT.ns;
2218
- if (options.keyPrefix !== "")
2219
- options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
2220
- const keySeparator = _this3.options.keySeparator || ".";
2186
+ o.lng = o.lng || fixedT.lng;
2187
+ o.lngs = o.lngs || fixedT.lngs;
2188
+ o.ns = o.ns || fixedT.ns;
2189
+ if (o.keyPrefix !== "")
2190
+ o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
2191
+ const keySeparator = this.options.keySeparator || ".";
2221
2192
  let resultKey;
2222
- if (options.keyPrefix && Array.isArray(key2)) {
2223
- resultKey = key2.map((k) => `${options.keyPrefix}${keySeparator}${k}`);
2193
+ if (o.keyPrefix && Array.isArray(key2)) {
2194
+ resultKey = key2.map((k) => {
2195
+ if (typeof k === "function")
2196
+ k = keysFromSelector(k, {
2197
+ ...this.options,
2198
+ ...opts
2199
+ });
2200
+ return `${o.keyPrefix}${keySeparator}${k}`;
2201
+ });
2224
2202
  } else {
2225
- resultKey = options.keyPrefix ? `${options.keyPrefix}${keySeparator}${key2}` : key2;
2203
+ if (typeof key2 === "function")
2204
+ key2 = keysFromSelector(key2, {
2205
+ ...this.options,
2206
+ ...opts
2207
+ });
2208
+ resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key2}` : key2;
2226
2209
  }
2227
- return _this3.t(resultKey, options);
2210
+ return this.t(resultKey, o);
2228
2211
  };
2229
2212
  if (isString$1(lng)) {
2230
2213
  fixedT.lng = lng;
@@ -2235,25 +2218,18 @@
2235
2218
  fixedT.keyPrefix = keyPrefix;
2236
2219
  return fixedT;
2237
2220
  }
2238
- t() {
2221
+ t(...args) {
2239
2222
  var _a;
2240
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2241
- args[_key4] = arguments[_key4];
2242
- }
2243
2223
  return (_a = this.translator) == null ? void 0 : _a.translate(...args);
2244
2224
  }
2245
- exists() {
2225
+ exists(...args) {
2246
2226
  var _a;
2247
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
2248
- args[_key5] = arguments[_key5];
2249
- }
2250
2227
  return (_a = this.translator) == null ? void 0 : _a.exists(...args);
2251
2228
  }
2252
2229
  setDefaultNamespace(ns) {
2253
2230
  this.options.defaultNS = ns;
2254
2231
  }
2255
- hasLoadedNamespace(ns) {
2256
- let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2232
+ hasLoadedNamespace(ns, options = {}) {
2257
2233
  if (!this.isInitialized) {
2258
2234
  this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
2259
2235
  return false;
@@ -2329,18 +2305,25 @@
2329
2305
  lng = this.resolvedLanguage || (((_a = this.languages) == null ? void 0 : _a.length) > 0 ? this.languages[0] : this.language);
2330
2306
  if (!lng)
2331
2307
  return "rtl";
2308
+ try {
2309
+ const l = new Intl.Locale(lng);
2310
+ if (l && l.getTextInfo) {
2311
+ const ti = l.getTextInfo();
2312
+ if (ti && ti.direction)
2313
+ return ti.direction;
2314
+ }
2315
+ } catch (e) {
2316
+ }
2332
2317
  const 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"];
2333
2318
  const languageUtils = ((_b = this.services) == null ? void 0 : _b.languageUtils) || new LanguageUtil(get());
2319
+ if (lng.toLowerCase().indexOf("-latn") > 1)
2320
+ return "ltr";
2334
2321
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
2335
2322
  }
2336
- static createInstance() {
2337
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2338
- let callback = arguments.length > 1 ? arguments[1] : void 0;
2323
+ static createInstance(options = {}, callback) {
2339
2324
  return new I18n(options, callback);
2340
2325
  }
2341
- cloneInstance() {
2342
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2343
- let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$1;
2326
+ cloneInstance(options = {}, callback = noop$1) {
2344
2327
  const forkResourceStore = options.forkResourceStore;
2345
2328
  if (forkResourceStore)
2346
2329
  delete options.forkResourceStore;
@@ -2370,21 +2353,19 @@
2370
2353
  prev[l] = {
2371
2354
  ...this.store.data[l]
2372
2355
  };
2373
- return Object.keys(prev[l]).reduce((acc, n) => {
2356
+ prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2374
2357
  acc[n] = {
2375
2358
  ...prev[l][n]
2376
2359
  };
2377
2360
  return acc;
2378
- }, {});
2361
+ }, prev[l]);
2362
+ return prev;
2379
2363
  }, {});
2380
2364
  clone.store = new ResourceStore(clonedData, mergedOptions);
2381
2365
  clone.services.resourceStore = clone.store;
2382
2366
  }
2383
2367
  clone.translator = new Translator(clone.services, mergedOptions);
2384
- clone.translator.on("*", function(event) {
2385
- for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
2386
- args[_key6 - 1] = arguments[_key6];
2387
- }
2368
+ clone.translator.on("*", (event, ...args) => {
2388
2369
  clone.emit(event, ...args);
2389
2370
  });
2390
2371
  clone.init(mergedOptions, callback);
@@ -10673,14 +10654,14 @@
10673
10654
  );
10674
10655
  };
10675
10656
  const TaskListTable = React.memo(TaskListTableDefaultInner);
10676
- const taskListRoot = "_taskListRoot_ycl6i_1";
10677
- const taskListHorizontalScroll = "_taskListHorizontalScroll_ycl6i_27";
10678
- const taskListResizer = "_taskListResizer_ycl6i_91";
10679
- const horizontalContainer$1 = "_horizontalContainer_ycl6i_155";
10680
- const tableWrapper = "_tableWrapper_ycl6i_173";
10681
- const scrollToTop = "_scrollToTop_ycl6i_185";
10682
- const scrollToBottom = "_scrollToBottom_ycl6i_201";
10683
- const hidden = "_hidden_ycl6i_217";
10657
+ const taskListRoot = "_taskListRoot_1x5nq_1";
10658
+ const taskListHorizontalScroll = "_taskListHorizontalScroll_1x5nq_25";
10659
+ const taskListResizer = "_taskListResizer_1x5nq_89";
10660
+ const horizontalContainer$1 = "_horizontalContainer_1x5nq_153";
10661
+ const tableWrapper = "_tableWrapper_1x5nq_171";
10662
+ const scrollToTop = "_scrollToTop_1x5nq_183";
10663
+ const scrollToBottom = "_scrollToBottom_1x5nq_199";
10664
+ const hidden = "_hidden_1x5nq_215";
10684
10665
  const styles$d = {
10685
10666
  taskListRoot,
10686
10667
  taskListHorizontalScroll,
@@ -13163,12 +13144,12 @@
13163
13144
  ] });
13164
13145
  };
13165
13146
  const TaskGanttContent = React.memo(TaskGanttContentInner);
13166
- const ganttVerticalContainer = "_ganttVerticalContainer_ht10f_1";
13167
- const horizontalContainer = "_horizontalContainer_ht10f_81";
13168
- const ganttHeader = "_ganttHeader_ht10f_103";
13169
- const ganttBodyScroll = "_ganttBodyScroll_ht10f_113";
13170
- const wrapper = "_wrapper_ht10f_131";
13171
- const calendarDragging = "_calendarDragging_ht10f_165";
13147
+ const ganttVerticalContainer = "_ganttVerticalContainer_1xboz_1";
13148
+ const horizontalContainer = "_horizontalContainer_1xboz_81";
13149
+ const ganttHeader = "_ganttHeader_1xboz_97";
13150
+ const ganttBodyScroll = "_ganttBodyScroll_1xboz_107";
13151
+ const wrapper = "_wrapper_1xboz_123";
13152
+ const calendarDragging = "_calendarDragging_1xboz_153";
13172
13153
  const styles$2 = {
13173
13154
  ganttVerticalContainer,
13174
13155
  horizontalContainer,
@@ -18786,8 +18767,8 @@
18786
18767
  [renderedColumnIndexes]
18787
18768
  );
18788
18769
  const svgWidth = React.useMemo(
18789
- () => Math.max(datesLength * distances.columnWidth, svgClientWidth),
18790
- [datesLength, distances, svgClientWidth]
18770
+ () => datesLength * distances.columnWidth,
18771
+ [datesLength, distances]
18791
18772
  );
18792
18773
  const countTaskCoordinates$1 = React.useCallback(
18793
18774
  (task) => countTaskCoordinates(