@forsakringskassan/docs-generator 2.39.2 → 2.40.0

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.
@@ -16821,7 +16821,7 @@ const defer = () => {
16821
16821
  };
16822
16822
  const makeString$1 = object => {
16823
16823
  if (object == null) return '';
16824
- return '' + object;
16824
+ return String(object);
16825
16825
  };
16826
16826
  const copy = (a, s, t) => {
16827
16827
  a.forEach(m => {
@@ -16829,7 +16829,7 @@ const copy = (a, s, t) => {
16829
16829
  });
16830
16830
  };
16831
16831
  const lastOfPathSeparatorRegExp = /###/g;
16832
- const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
16832
+ const cleanKey = key => key && key.includes('###') ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
16833
16833
  const canNotTraverseDeeper = object => !object || isString(object);
16834
16834
  const getLastOfPath = (object, path, Empty) => {
16835
16835
  const stack = !isString(path) ? path : path.split('.');
@@ -16914,7 +16914,7 @@ const deepExtend = (target, source, overwrite) => {
16914
16914
  return target;
16915
16915
  };
16916
16916
  const regexEscape = str => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
16917
- var _entityMap = {
16917
+ const _entityMap = {
16918
16918
  '&': '&',
16919
16919
  '<': '&lt;',
16920
16920
  '>': '&gt;',
@@ -16953,7 +16953,7 @@ const looksLikeObjectPathRegExpCache = new RegExpCache(20);
16953
16953
  const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
16954
16954
  nsSeparator = nsSeparator || '';
16955
16955
  keySeparator = keySeparator || '';
16956
- const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
16956
+ const possibleChars = chars.filter(c => !nsSeparator.includes(c) && !keySeparator.includes(c));
16957
16957
  if (possibleChars.length === 0) return true;
16958
16958
  const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
16959
16959
  let matched = !r.test(key);
@@ -16986,7 +16986,7 @@ const deepFind = (obj, path, keySeparator = '.') => {
16986
16986
  nextPath += tokens[j];
16987
16987
  next = current[nextPath];
16988
16988
  if (next !== undefined) {
16989
- if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {
16989
+ if (['string', 'number', 'boolean'].includes(typeof next) && j < tokens.length - 1) {
16990
16990
  continue;
16991
16991
  }
16992
16992
  i += j - i + 1;
@@ -17077,6 +17077,14 @@ class EventEmitter {
17077
17077
  }
17078
17078
  this.observers[event].delete(listener);
17079
17079
  }
17080
+ once(event, listener) {
17081
+ const wrapper = (...args) => {
17082
+ listener(...args);
17083
+ this.off(event, wrapper);
17084
+ };
17085
+ this.on(event, wrapper);
17086
+ return this;
17087
+ }
17080
17088
  emit(event, ...args) {
17081
17089
  if (this.observers[event]) {
17082
17090
  const cloned = Array.from(this.observers[event].entries());
@@ -17090,7 +17098,7 @@ class EventEmitter {
17090
17098
  const cloned = Array.from(this.observers['*'].entries());
17091
17099
  cloned.forEach(([observer, numTimesAdded]) => {
17092
17100
  for (let i = 0; i < numTimesAdded; i++) {
17093
- observer.apply(observer, [event, ...args]);
17101
+ observer(event, ...args);
17094
17102
  }
17095
17103
  });
17096
17104
  }
@@ -17113,7 +17121,7 @@ class ResourceStore extends EventEmitter {
17113
17121
  }
17114
17122
  }
17115
17123
  addNamespaces(ns) {
17116
- if (this.options.ns.indexOf(ns) < 0) {
17124
+ if (!this.options.ns.includes(ns)) {
17117
17125
  this.options.ns.push(ns);
17118
17126
  }
17119
17127
  }
@@ -17127,7 +17135,7 @@ class ResourceStore extends EventEmitter {
17127
17135
  const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
17128
17136
  const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
17129
17137
  let path;
17130
- if (lng.indexOf('.') > -1) {
17138
+ if (lng.includes('.')) {
17131
17139
  path = lng.split('.');
17132
17140
  } else {
17133
17141
  path = [lng, ns];
@@ -17142,7 +17150,7 @@ class ResourceStore extends EventEmitter {
17142
17150
  }
17143
17151
  }
17144
17152
  const result = getPath(this.data, path);
17145
- if (!result && !ns && !key && lng.indexOf('.') > -1) {
17153
+ if (!result && !ns && !key && lng.includes('.')) {
17146
17154
  lng = path[0];
17147
17155
  ns = path[1];
17148
17156
  key = path.slice(2).join('.');
@@ -17156,7 +17164,7 @@ class ResourceStore extends EventEmitter {
17156
17164
  const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
17157
17165
  let path = [lng, ns];
17158
17166
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
17159
- if (lng.indexOf('.') > -1) {
17167
+ if (lng.includes('.')) {
17160
17168
  path = lng.split('.');
17161
17169
  value = ns;
17162
17170
  ns = path[1];
@@ -17180,7 +17188,7 @@ class ResourceStore extends EventEmitter {
17180
17188
  skipCopy: false
17181
17189
  }) {
17182
17190
  let path = [lng, ns];
17183
- if (lng.indexOf('.') > -1) {
17191
+ if (lng.includes('.')) {
17184
17192
  path = lng.split('.');
17185
17193
  deep = resources;
17186
17194
  resources = ns;
@@ -17270,7 +17278,6 @@ function keysFromSelector(selector, opts) {
17270
17278
  return path.join(keySeparator);
17271
17279
  }
17272
17280
 
17273
- const checkedLoadedFor = {};
17274
17281
  const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
17275
17282
  class Translator extends EventEmitter {
17276
17283
  constructor(services, options = {}) {
@@ -17281,6 +17288,7 @@ class Translator extends EventEmitter {
17281
17288
  this.options.keySeparator = '.';
17282
17289
  }
17283
17290
  this.logger = baseLogger.create('translator');
17291
+ this.checkedLoadedFor = {};
17284
17292
  }
17285
17293
  changeLanguage(lng) {
17286
17294
  if (lng) this.language = lng;
@@ -17305,7 +17313,7 @@ class Translator extends EventEmitter {
17305
17313
  if (nsSeparator === undefined) nsSeparator = ':';
17306
17314
  const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
17307
17315
  let namespaces = opt.ns || this.options.defaultNS || [];
17308
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
17316
+ const wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
17309
17317
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
17310
17318
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
17311
17319
  const m = key.match(this.interpolator.nestingRegexp);
@@ -17316,7 +17324,7 @@ class Translator extends EventEmitter {
17316
17324
  };
17317
17325
  }
17318
17326
  const parts = key.split(nsSeparator);
17319
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
17327
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.includes(parts[0])) namespaces = parts.shift();
17320
17328
  key = parts.join(keySeparator);
17321
17329
  }
17322
17330
  return {
@@ -17403,7 +17411,7 @@ class Translator extends EventEmitter {
17403
17411
  }
17404
17412
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
17405
17413
  const resType = Object.prototype.toString.apply(resForObjHndl);
17406
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
17414
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
17407
17415
  if (!opt.returnObjects && !this.options.returnObjects) {
17408
17416
  if (!this.options.returnedObjectHandler) {
17409
17417
  this.logger.warn('accessing an object - but returnObjects options is not enabled!');
@@ -17499,7 +17507,7 @@ class Translator extends EventEmitter {
17499
17507
  if (this.options.saveMissingPlurals && needsPluralHandling) {
17500
17508
  lngs.forEach(language => {
17501
17509
  const suffixes = this.pluralResolver.getSuffixes(language, opt);
17502
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
17510
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && !suffixes.includes(`${this.options.pluralSeparator}zero`)) {
17503
17511
  suffixes.push(`${this.options.pluralSeparator}zero`);
17504
17512
  }
17505
17513
  suffixes.forEach(suffix => {
@@ -17609,8 +17617,8 @@ class Translator extends EventEmitter {
17609
17617
  namespaces.forEach(ns => {
17610
17618
  if (this.isValidLookup(found)) return;
17611
17619
  usedNS = ns;
17612
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
17613
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
17620
+ if (!this.checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
17621
+ this.checkedLoadedFor[`${codes[0]}-${ns}`] = true;
17614
17622
  this.logger.warn(`key "${usedKey}" for languages "${codes.join(', ')}" won't get resolved as namespace "${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!!!');
17615
17623
  }
17616
17624
  codes.forEach(code => {
@@ -17625,7 +17633,7 @@ class Translator extends EventEmitter {
17625
17633
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
17626
17634
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
17627
17635
  if (needsPluralHandling) {
17628
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
17636
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
17629
17637
  finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
17630
17638
  }
17631
17639
  finalKeys.push(key + pluralSuffix);
@@ -17637,7 +17645,7 @@ class Translator extends EventEmitter {
17637
17645
  const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`;
17638
17646
  finalKeys.push(contextKey);
17639
17647
  if (needsPluralHandling) {
17640
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
17648
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
17641
17649
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
17642
17650
  }
17643
17651
  finalKeys.push(contextKey + pluralSuffix);
@@ -17698,7 +17706,7 @@ class Translator extends EventEmitter {
17698
17706
  static hasDefaultValue(options) {
17699
17707
  const prefix = 'defaultValue';
17700
17708
  for (const option in options) {
17701
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
17709
+ if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix) && undefined !== options[option]) {
17702
17710
  return true;
17703
17711
  }
17704
17712
  }
@@ -17714,7 +17722,7 @@ class LanguageUtil {
17714
17722
  }
17715
17723
  getScriptPartFromCode(code) {
17716
17724
  code = getCleanedCode(code);
17717
- if (!code || code.indexOf('-') < 0) return null;
17725
+ if (!code || !code.includes('-')) return null;
17718
17726
  const p = code.split('-');
17719
17727
  if (p.length === 2) return null;
17720
17728
  p.pop();
@@ -17723,12 +17731,12 @@ class LanguageUtil {
17723
17731
  }
17724
17732
  getLanguagePartFromCode(code) {
17725
17733
  code = getCleanedCode(code);
17726
- if (!code || code.indexOf('-') < 0) return code;
17734
+ if (!code || !code.includes('-')) return code;
17727
17735
  const p = code.split('-');
17728
17736
  return this.formatLanguageCode(p[0]);
17729
17737
  }
17730
17738
  formatLanguageCode(code) {
17731
- if (isString(code) && code.indexOf('-') > -1) {
17739
+ if (isString(code) && code.includes('-')) {
17732
17740
  let formattedCode;
17733
17741
  try {
17734
17742
  formattedCode = Intl.getCanonicalLocales(code)[0];
@@ -17748,7 +17756,7 @@ class LanguageUtil {
17748
17756
  if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
17749
17757
  code = this.getLanguagePartFromCode(code);
17750
17758
  }
17751
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
17759
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
17752
17760
  }
17753
17761
  getBestMatchFromCodes(codes) {
17754
17762
  if (!codes) return null;
@@ -17766,10 +17774,11 @@ class LanguageUtil {
17766
17774
  const lngOnly = this.getLanguagePartFromCode(code);
17767
17775
  if (this.isSupportedCode(lngOnly)) return found = lngOnly;
17768
17776
  found = this.options.supportedLngs.find(supportedLng => {
17769
- if (supportedLng === lngOnly) return supportedLng;
17770
- if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
17771
- if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;
17772
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
17777
+ if (supportedLng === lngOnly) return true;
17778
+ if (!supportedLng.includes('-') && !lngOnly.includes('-')) return false;
17779
+ if (supportedLng.includes('-') && !lngOnly.includes('-') && supportedLng.slice(0, supportedLng.indexOf('-')) === lngOnly) return true;
17780
+ if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
17781
+ return false;
17773
17782
  });
17774
17783
  });
17775
17784
  }
@@ -17800,7 +17809,7 @@ class LanguageUtil {
17800
17809
  this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
17801
17810
  }
17802
17811
  };
17803
- if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
17812
+ if (isString(code) && (code.includes('-') || code.includes('_'))) {
17804
17813
  if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
17805
17814
  if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
17806
17815
  if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
@@ -17808,7 +17817,7 @@ class LanguageUtil {
17808
17817
  addCode(this.formatLanguageCode(code));
17809
17818
  }
17810
17819
  fallbackCodes.forEach(fc => {
17811
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
17820
+ if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
17812
17821
  });
17813
17822
  return codes;
17814
17823
  }
@@ -17964,7 +17973,7 @@ class Interpolator {
17964
17973
  let replaces;
17965
17974
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
17966
17975
  const handleFormat = key => {
17967
- if (key.indexOf(this.formatSeparator) < 0) {
17976
+ if (!key.includes(this.formatSeparator)) {
17968
17977
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
17969
17978
  return this.alwaysFormat ? this.format(path, undefined, lng, {
17970
17979
  ...options,
@@ -18034,7 +18043,7 @@ class Interpolator {
18034
18043
  let clonedOptions;
18035
18044
  const handleHasOptions = (key, inheritedOptions) => {
18036
18045
  const sep = this.nestingOptionsSeparator;
18037
- if (key.indexOf(sep) < 0) return key;
18046
+ if (!key.includes(sep)) return key;
18038
18047
  const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
18039
18048
  let optionsString = `{${c[1]}`;
18040
18049
  key = c[0];
@@ -18054,7 +18063,7 @@ class Interpolator {
18054
18063
  this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
18055
18064
  return `${key}${sep}${optionsString}`;
18056
18065
  }
18057
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
18066
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
18058
18067
  return key;
18059
18068
  };
18060
18069
  while (match = this.nestingRegexp.exec(str)) {
@@ -18093,13 +18102,13 @@ class Interpolator {
18093
18102
  const parseFormatStr = formatStr => {
18094
18103
  let formatName = formatStr.toLowerCase().trim();
18095
18104
  const formatOptions = {};
18096
- if (formatStr.indexOf('(') > -1) {
18105
+ if (formatStr.includes('(')) {
18097
18106
  const p = formatStr.split('(');
18098
18107
  formatName = p[0].toLowerCase().trim();
18099
- const optStr = p[1].substring(0, p[1].length - 1);
18100
- if (formatName === 'currency' && optStr.indexOf(':') < 0) {
18108
+ const optStr = p[1].slice(0, -1);
18109
+ if (formatName === 'currency' && !optStr.includes(':')) {
18101
18110
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
18102
- } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
18111
+ } else if (formatName === 'relativetime' && !optStr.includes(':')) {
18103
18112
  if (!formatOptions.range) formatOptions.range = optStr.trim();
18104
18113
  } else {
18105
18114
  const opts = optStr.split(';');
@@ -18193,9 +18202,11 @@ class Formatter {
18193
18202
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
18194
18203
  }
18195
18204
  format(value, format, lng, options = {}) {
18205
+ if (!format) return value;
18206
+ if (value == null) return value;
18196
18207
  const formats = format.split(this.formatSeparator);
18197
- if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
18198
- const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
18208
+ if (formats.length > 1 && formats[0].indexOf('(') > 1 && !formats[0].includes(')') && formats.find(f => f.includes(')'))) {
18209
+ const lastIndex = formats.findIndex(f => f.includes(')'));
18199
18210
  formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
18200
18211
  }
18201
18212
  const result = formats.reduce((mem, f) => {
@@ -18349,7 +18360,7 @@ class Connector extends EventEmitter {
18349
18360
  }
18350
18361
  if (err && data && tried < this.maxRetries) {
18351
18362
  setTimeout(() => {
18352
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
18363
+ this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
18353
18364
  }, wait);
18354
18365
  return;
18355
18366
  }
@@ -18453,7 +18464,6 @@ const get$1 = () => ({
18453
18464
  nonExplicitSupportedLngs: false,
18454
18465
  load: 'all',
18455
18466
  preload: false,
18456
- simplifyPluralSuffix: true,
18457
18467
  keySeparator: '.',
18458
18468
  nsSeparator: ':',
18459
18469
  pluralSeparator: '_',
@@ -18490,7 +18500,6 @@ const get$1 = () => ({
18490
18500
  },
18491
18501
  interpolation: {
18492
18502
  escapeValue: true,
18493
- format: value => value,
18494
18503
  prefix: '{{',
18495
18504
  suffix: '}}',
18496
18505
  formatSeparator: ',',
@@ -18507,10 +18516,9 @@ const transformOptions = options => {
18507
18516
  if (isString(options.ns)) options.ns = [options.ns];
18508
18517
  if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
18509
18518
  if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
18510
- if (options.supportedLngs?.indexOf?.('cimode') < 0) {
18519
+ if (options.supportedLngs && !options.supportedLngs.includes('cimode')) {
18511
18520
  options.supportedLngs = options.supportedLngs.concat(['cimode']);
18512
18521
  }
18513
- if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
18514
18522
  return options;
18515
18523
  };
18516
18524
 
@@ -18523,27 +18531,6 @@ const bindMemberFunctions = inst => {
18523
18531
  }
18524
18532
  });
18525
18533
  };
18526
- const SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
18527
- const getSupportNoticeShown = () => {
18528
- if (typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
18529
- if (typeof process !== 'undefined' && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
18530
- return false;
18531
- };
18532
- const setSupportNoticeShown = () => {
18533
- if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
18534
- };
18535
- const usesLocize = inst => {
18536
- if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
18537
- if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
18538
- if (inst?.options?.backend?.backends) {
18539
- if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
18540
- }
18541
- if (inst?.options?.backend?.projectId) return true;
18542
- if (inst?.options?.backend?.backendOptions) {
18543
- if (inst.options.backend.backendOptions.some(b => b?.projectId)) return true;
18544
- }
18545
- return false;
18546
- };
18547
18534
  class I18n extends EventEmitter {
18548
18535
  constructor(options = {}, callback) {
18549
18536
  super();
@@ -18573,7 +18560,7 @@ class I18n extends EventEmitter {
18573
18560
  if (options.defaultNS == null && options.ns) {
18574
18561
  if (isString(options.ns)) {
18575
18562
  options.defaultNS = options.ns;
18576
- } else if (options.ns.indexOf('translation') < 0) {
18563
+ } else if (!options.ns.includes('translation')) {
18577
18564
  options.defaultNS = options.ns[0];
18578
18565
  }
18579
18566
  }
@@ -18596,10 +18583,6 @@ class I18n extends EventEmitter {
18596
18583
  if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
18597
18584
  this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
18598
18585
  }
18599
- if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
18600
- if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
18601
- setSupportNoticeShown();
18602
- }
18603
18586
  const createClassOnDemand = ClassOrObject => {
18604
18587
  if (!ClassOrObject) return null;
18605
18588
  if (typeof ClassOrObject === 'function') return new ClassOrObject();
@@ -18624,14 +18607,9 @@ class I18n extends EventEmitter {
18624
18607
  s.resourceStore = this.store;
18625
18608
  s.languageUtils = lu;
18626
18609
  s.pluralResolver = new PluralResolver(lu, {
18627
- prepend: this.options.pluralSeparator,
18628
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
18610
+ prepend: this.options.pluralSeparator
18629
18611
  });
18630
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
18631
- if (usingLegacyFormatFunction) {
18632
- this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
18633
- }
18634
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
18612
+ if (formatter) {
18635
18613
  s.formatter = createClassOnDemand(formatter);
18636
18614
  if (s.formatter.init) s.formatter.init(s, this.options);
18637
18615
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
@@ -18714,7 +18692,7 @@ class I18n extends EventEmitter {
18714
18692
  const lngs = this.services.languageUtils.toResolveHierarchy(lng);
18715
18693
  lngs.forEach(l => {
18716
18694
  if (l === 'cimode') return;
18717
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
18695
+ if (!toLoad.includes(l)) toLoad.push(l);
18718
18696
  });
18719
18697
  };
18720
18698
  if (!usedLng) {
@@ -18779,16 +18757,16 @@ class I18n extends EventEmitter {
18779
18757
  }
18780
18758
  setResolvedLanguage(l) {
18781
18759
  if (!l || !this.languages) return;
18782
- if (['cimode', 'dev'].indexOf(l) > -1) return;
18760
+ if (['cimode', 'dev'].includes(l)) return;
18783
18761
  for (let li = 0; li < this.languages.length; li++) {
18784
18762
  const lngInLngs = this.languages[li];
18785
- if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
18763
+ if (['cimode', 'dev'].includes(lngInLngs)) continue;
18786
18764
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
18787
18765
  this.resolvedLanguage = lngInLngs;
18788
18766
  break;
18789
18767
  }
18790
18768
  }
18791
- if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
18769
+ if (!this.resolvedLanguage && !this.languages.includes(l) && this.store.hasLanguageSomeTranslations(l)) {
18792
18770
  this.resolvedLanguage = l;
18793
18771
  this.languages.unshift(l);
18794
18772
  }
@@ -18930,7 +18908,7 @@ class I18n extends EventEmitter {
18930
18908
  }
18931
18909
  if (isString(ns)) ns = [ns];
18932
18910
  ns.forEach(n => {
18933
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
18911
+ if (!this.options.ns.includes(n)) this.options.ns.push(n);
18934
18912
  });
18935
18913
  this.loadResources(err => {
18936
18914
  deferred.resolve();
@@ -18942,7 +18920,7 @@ class I18n extends EventEmitter {
18942
18920
  const deferred = defer();
18943
18921
  if (isString(lngs)) lngs = [lngs];
18944
18922
  const preloaded = this.options.preload || [];
18945
- const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
18923
+ const newLngs = lngs.filter(lng => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
18946
18924
  if (!newLngs.length) {
18947
18925
  if (callback) callback();
18948
18926
  return Promise.resolve();
@@ -18967,7 +18945,7 @@ class I18n extends EventEmitter {
18967
18945
  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'];
18968
18946
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get$1());
18969
18947
  if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
18970
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
18948
+ return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
18971
18949
  }
18972
18950
  static createInstance(options = {}, callback) {
18973
18951
  const instance = new I18n(options, callback);
@@ -19615,102 +19593,185 @@ var resolvePackagePath = /*@__PURE__*/getDefaultExportFromCjs(libExports);
19615
19593
 
19616
19594
  function e(e,n,r){throw new Error(r?`No known conditions for "${n}" specifier in "${e}" package`:`Missing "${n}" specifier in "${e}" package`)}function n$1(n,i,o,f){let s,u,l=r$2(n,o),c=function(e){let n=new Set(["default",...e.conditions||[]]);return e.unsafe||n.add(e.require?"require":"import"),e.unsafe||n.add(e.browser?"browser":"node"),n}(f||{}),a=i[l];if(void 0===a){let e,n,r,t;for(t in i)n&&t.length<n.length||("/"===t[t.length-1]&&l.startsWith(t)?(u=l.substring(t.length),n=t):t.length>1&&(r=t.indexOf("*",1),~r&&(e=RegExp("^"+t.substring(0,r)+"(.*)"+t.substring(1+r)+"$").exec(l),e&&e[1]&&(u=e[1],n=t))));a=i[n];}return a||e(n,l),s=t(a,c),s||e(n,l,1),u&&function(e,n){let r,t=0,i=e.length,o=/[*]/g,f=/[/]$/;for(;t<i;t++)e[t]=o.test(r=e[t])?r.replace(o,n):f.test(r)?r+n:r;}(s,u),s}function r$2(e,n,r){if(e===n||"."===n)return ".";let t=e+"/",i=t.length,o=n.slice(0,i)===t,f=o?n.slice(i):n;return "#"===f[0]?f:o||!r?"./"===f.slice(0,2)?f:"./"+f:f}function t(e,n,r){if(e){if("string"==typeof e)return r&&r.add(e),[e];let i,o;if(Array.isArray(e)){for(o=r||new Set,i=0;i<e.length;i++)t(e[i],n,o);if(!r&&o.size)return [...o]}else for(i in e)if(n.has(i))return t(e[i],n,r)}}function i(e,n={}){let t,i=0,o=n.browser,f=n.fields||["module","main"],s="string"==typeof o;for(o&&!f.includes("browser")&&(f.unshift("browser"),s&&(o=r$2(e.name,o,true)));i<f.length;i++)if(t=e[f[i]]){if("string"==typeof t);else {if("object"!=typeof t||"browser"!=f[i])continue;if(s&&(t=t[o],null==t))return o}return "string"==typeof t?"./"+t.replace(/^\.?\//,""):t}}function o$2(e,r,t){let i,o=e.exports;if(o){if("string"==typeof o)o={".":o};else for(i in o){"."!==i[0]&&(o={".":o});break}return n$1(e.name,o,r||".",t)}}
19617
19595
 
19618
- // src/importer.js
19596
+ const require$2 = createRequire(import.meta.url);
19597
+ var __require$1 = /* @__PURE__ */ ((x) => typeof require$2 !== "undefined" ? require$2 : typeof Proxy !== "undefined" ? new Proxy(x, {
19598
+ get: (a, b) => (typeof require$2 !== "undefined" ? require$2 : a)[b]
19599
+ }) : x)(function(x) {
19600
+ if (typeof require$2 !== "undefined") return require$2.apply(this, arguments);
19601
+ throw Error('Dynamic require of "' + x + '" is not supported');
19602
+ });
19603
+ function tryPackageExports(packageJson, subpath, moduleDirectory) {
19604
+ try {
19605
+ const match = o$2(packageJson, subpath.slice(1), {
19606
+ conditions: ["sass"]
19607
+ });
19608
+ if (match && match.length === 1) {
19609
+ return new URL(pathToFileURL(path__default.join(moduleDirectory, match[0])));
19610
+ }
19611
+ } catch {
19612
+ }
19613
+ return null;
19614
+ }
19615
+ function tryPackageMain(packageJson, filePath, moduleDirectory) {
19616
+ if (filePath !== "") {
19617
+ return null;
19618
+ }
19619
+ const match = i(packageJson, { fields: ["sass", "main"] });
19620
+ if (match && typeof match === "string") {
19621
+ return new URL(pathToFileURL(path__default.join(moduleDirectory, match)));
19622
+ }
19623
+ return null;
19624
+ }
19619
19625
 
19620
- // src/parsePackageName.js
19621
- var SCOPED_PACKAGE = /^(@[^/]+\/[^@/]+).*?$/;
19622
- var NON_SCOPED_PACKAGE = /^([^@/]+).*?$/;
19626
+ // src/utils/get-package-name-from-path.ts
19627
+ function isScoped(input) {
19628
+ return input.startsWith("@");
19629
+ }
19623
19630
  function getPackageNameFromPath(input) {
19624
- const match = SCOPED_PACKAGE.exec(input) || NON_SCOPED_PACKAGE.exec(input);
19625
- if (!input || !match) {
19631
+ if (!input) {
19632
+ return null;
19633
+ }
19634
+ if (input.startsWith(".") || input.startsWith("/")) {
19626
19635
  return null;
19627
19636
  }
19628
- return match[1];
19637
+ const parts = input.split("/");
19638
+ if (isScoped(input) && parts.length > 1) {
19639
+ return `${parts[0]}/${parts[1]}`;
19640
+ } else {
19641
+ return parts[0];
19642
+ }
19629
19643
  }
19630
19644
 
19631
- // src/importer.js
19632
- var { findUpPackagePath } = resolvePackagePath;
19633
- var require2 = createRequire(import.meta.url);
19645
+ // src/utils/is-errno-error.ts
19646
+ function isErrnoError(error) {
19647
+ return error instanceof Error && "code" in error && typeof error.code === "string";
19648
+ }
19649
+
19650
+ // src/utils/is-webpack-prefix.ts
19634
19651
  var WEBPACK_NODE_MODULE_PREFIX = "~";
19635
- var selfPackageJson = null;
19636
- var selfPackageJsonPath = null;
19637
- var moduleImporter = {
19638
- findFileUrl(url) {
19639
- setSelfPackage();
19640
- let findUrl = url;
19641
- if (url.startsWith(WEBPACK_NODE_MODULE_PREFIX)) {
19642
- findUrl = url.substring(1);
19643
- }
19644
- const packageName = getPackageNameFromPath(findUrl);
19645
- const filePath = findUrl.replace(packageName, "");
19646
- if (!packageName) {
19647
- return null;
19648
- }
19649
- let packageJson = selfPackageJson;
19650
- let packagePath = selfPackageJsonPath;
19651
- if (selfPackageJson.name !== packageName) {
19652
- packagePath = resolvePackagePath(packageName, process.cwd());
19653
- if (!packagePath) {
19654
- return null;
19655
- }
19656
- packageJson = JSON.parse(
19657
- readFileSync(packagePath, { encoding: "utf-8" })
19658
- );
19652
+ function isWebpackPrefix(url) {
19653
+ return url.startsWith(WEBPACK_NODE_MODULE_PREFIX);
19654
+ }
19655
+
19656
+ // src/utils/memoize.ts
19657
+ function cacheKey(args) {
19658
+ return JSON.stringify(args);
19659
+ }
19660
+ function memoize(callback) {
19661
+ const cache = /* @__PURE__ */ new Map();
19662
+ return (...args) => {
19663
+ const key = cacheKey(args);
19664
+ if (!cache.has(key)) {
19665
+ cache.set(key, callback(...args));
19659
19666
  }
19660
- const moduleDirectory = path__default.dirname(packagePath);
19667
+ return cache.get(key);
19668
+ };
19669
+ }
19670
+
19671
+ // src/utils/parse-import.ts
19672
+ function parseImport(url) {
19673
+ const name = getPackageNameFromPath(url);
19674
+ if (!name) {
19675
+ return { name: null, subpath: null };
19676
+ }
19677
+ const subpath = url.replace(name, "");
19678
+ return { name, subpath };
19679
+ }
19680
+ function readJsonFile(filePath) {
19681
+ const content = readFileSync(filePath, { encoding: "utf8" });
19682
+ try {
19683
+ return JSON.parse(content);
19684
+ } catch (error) {
19685
+ throw new Error(`Failed to parse JSON file at "${filePath}"`, {
19686
+ cause: error
19687
+ });
19688
+ }
19689
+ }
19690
+
19691
+ // src/resolvers/try-require-resolve.ts
19692
+ function tryRequireResolve(subpath, moduleDirectory, require2) {
19693
+ if (subpath === "") {
19694
+ return null;
19695
+ }
19696
+ const directory = path__default.dirname(subpath);
19697
+ const fileName = path__default.basename(subpath);
19698
+ const search = [
19699
+ `${fileName}.css`,
19700
+ `${fileName}.scss`,
19701
+ `_${fileName}.scss`,
19702
+ fileName,
19703
+ `${fileName}/_index.scss`
19704
+ ];
19705
+ for (const variant of search) {
19661
19706
  try {
19662
- const match = o$2(packageJson, filePath.substring(1), {
19663
- conditions: ["sass"]
19664
- });
19665
- if (match && match.length === 1) {
19666
- return new URL(
19667
- pathToFileURL(path__default.join(moduleDirectory, match[0]))
19668
- );
19707
+ const moduleName = path__default.posix.join(
19708
+ moduleDirectory,
19709
+ directory,
19710
+ variant
19711
+ );
19712
+ const resolved = require2.resolve(moduleName);
19713
+ return new URL(pathToFileURL(resolved));
19714
+ } catch (err) {
19715
+ if (isErrnoError(err) && err.code !== "MODULE_NOT_FOUND") {
19716
+ throw err;
19669
19717
  }
19670
- } catch {
19671
19718
  }
19672
- if (!filePath) {
19673
- const match = i(packageJson, { fields: ["sass", "main"] });
19674
- if (match) {
19675
- return new URL(
19676
- pathToFileURL(path__default.join(moduleDirectory, match))
19677
- );
19678
- }
19719
+ }
19720
+ return null;
19721
+ }
19722
+
19723
+ // src/importer.ts
19724
+ var { findUpPackagePath } = resolvePackagePath;
19725
+ var getSelfPackagePath = memoize((cwd) => {
19726
+ const selfPackageJsonPath = findUpPackagePath(cwd);
19727
+ if (!selfPackageJsonPath) {
19728
+ throw new Error("Could not find package.json");
19729
+ }
19730
+ return selfPackageJsonPath;
19731
+ });
19732
+ var getSelfPackageJson = memoize((cwd) => {
19733
+ const filePath = getSelfPackagePath(cwd);
19734
+ return readJsonFile(filePath);
19735
+ });
19736
+ function lazyEvaluateEach(fns) {
19737
+ for (const fn of fns) {
19738
+ const result = fn();
19739
+ if (result) {
19740
+ return result;
19679
19741
  }
19680
- const directory = path__default.dirname(filePath);
19681
- const fileName = path__default.basename(filePath);
19682
- const search = [
19683
- `${fileName}.css`,
19684
- `${fileName}.scss`,
19685
- `_${fileName}.scss`,
19686
- `${fileName}`,
19687
- `${fileName}/_index.scss`
19688
- ];
19689
- for (const variant of search) {
19690
- try {
19691
- const moduleName = path__default.posix.join(
19692
- moduleDirectory,
19693
- directory,
19694
- variant
19695
- );
19696
- const resolved = require2.resolve(moduleName);
19697
- return new URL(pathToFileURL(resolved));
19698
- } catch (err) {
19699
- if (err.code !== "MODULE_NOT_FOUND") {
19700
- throw err;
19742
+ }
19743
+ return null;
19744
+ }
19745
+ function moduleImporter() {
19746
+ return {
19747
+ findFileUrl(url) {
19748
+ let findUrl = url;
19749
+ if (isWebpackPrefix(url)) {
19750
+ findUrl = url.slice(1);
19751
+ }
19752
+ const { name, subpath } = parseImport(findUrl);
19753
+ if (!name) {
19754
+ return null;
19755
+ }
19756
+ const cwd = process.cwd();
19757
+ let packageJson = getSelfPackageJson(cwd);
19758
+ let packagePath = getSelfPackagePath(cwd);
19759
+ if (packageJson.name !== name) {
19760
+ const localPath = resolvePackagePath(name, cwd);
19761
+ if (!localPath) {
19762
+ return null;
19701
19763
  }
19764
+ packageJson = readJsonFile(localPath);
19765
+ packagePath = localPath;
19702
19766
  }
19767
+ const moduleDirectory = path__default.dirname(packagePath);
19768
+ return lazyEvaluateEach([
19769
+ () => tryPackageExports(packageJson, subpath, moduleDirectory),
19770
+ () => tryPackageMain(packageJson, subpath, moduleDirectory),
19771
+ () => tryRequireResolve(subpath, moduleDirectory, __require$1)
19772
+ ]);
19703
19773
  }
19704
- return null;
19705
- }
19706
- };
19707
- function setSelfPackage() {
19708
- if (!selfPackageJson) {
19709
- selfPackageJsonPath = findUpPackagePath(process.cwd());
19710
- selfPackageJson = JSON.parse(
19711
- readFileSync(selfPackageJsonPath, { encoding: "utf-8" })
19712
- );
19713
- }
19774
+ };
19714
19775
  }
19715
19776
 
19716
19777
  var eta;
@@ -69706,4 +69767,4 @@ var typescript = /*#__PURE__*/Object.freeze({
69706
69767
  });
69707
69768
 
69708
69769
  export { HighlightJS as H, MarkdownIt as M, Ze$a as Z, resolveConfig as a, createTwoFilesPatch$1 as b, createSyncFn as c, dedent$1 as d, deflist_plugin as e, format2 as f, closest as g, distance as h, fm$2 as i, isCI as j, cliProgress as k, tinylr as l, moduleImporter as m, createInstance as n, fse as o, inter as p, runAsWorker as r, ts$7 as t, watch$1 as w };
69709
- //# sourceMappingURL=vendor-KZo5HqAF.mjs.map
69770
+ //# sourceMappingURL=vendor-CZRU56SE.mjs.map