@forsakringskassan/docs-generator 2.28.0 → 2.28.1

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.
@@ -24151,8 +24151,7 @@ const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
24151
24151
  }
24152
24152
  return matched;
24153
24153
  };
24154
- const deepFind = function (obj, path) {
24155
- let keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
24154
+ const deepFind = (obj, path, keySeparator = '.') => {
24156
24155
  if (!obj) return undefined;
24157
24156
  if (obj[path]) {
24158
24157
  if (!Object.prototype.hasOwnProperty.call(obj, path)) return undefined;
@@ -24202,39 +24201,25 @@ const consoleLogger = {
24202
24201
  }
24203
24202
  };
24204
24203
  class Logger {
24205
- constructor(concreteLogger) {
24206
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24204
+ constructor(concreteLogger, options = {}) {
24207
24205
  this.init(concreteLogger, options);
24208
24206
  }
24209
- init(concreteLogger) {
24210
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24207
+ init(concreteLogger, options = {}) {
24211
24208
  this.prefix = options.prefix || 'i18next:';
24212
24209
  this.logger = concreteLogger || consoleLogger;
24213
24210
  this.options = options;
24214
24211
  this.debug = options.debug;
24215
24212
  }
24216
- log() {
24217
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24218
- args[_key] = arguments[_key];
24219
- }
24213
+ log(...args) {
24220
24214
  return this.forward(args, 'log', '', true);
24221
24215
  }
24222
- warn() {
24223
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
24224
- args[_key2] = arguments[_key2];
24225
- }
24216
+ warn(...args) {
24226
24217
  return this.forward(args, 'warn', '', true);
24227
24218
  }
24228
- error() {
24229
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
24230
- args[_key3] = arguments[_key3];
24231
- }
24219
+ error(...args) {
24232
24220
  return this.forward(args, 'error', '');
24233
24221
  }
24234
- deprecate() {
24235
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
24236
- args[_key4] = arguments[_key4];
24237
- }
24222
+ deprecate(...args) {
24238
24223
  return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
24239
24224
  }
24240
24225
  forward(args, lvl, prefix, debugOnly) {
@@ -24278,14 +24263,10 @@ class EventEmitter {
24278
24263
  }
24279
24264
  this.observers[event].delete(listener);
24280
24265
  }
24281
- emit(event) {
24282
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
24283
- args[_key - 1] = arguments[_key];
24284
- }
24266
+ emit(event, ...args) {
24285
24267
  if (this.observers[event]) {
24286
24268
  const cloned = Array.from(this.observers[event].entries());
24287
- cloned.forEach(_ref => {
24288
- let [observer, numTimesAdded] = _ref;
24269
+ cloned.forEach(([observer, numTimesAdded]) => {
24289
24270
  for (let i = 0; i < numTimesAdded; i++) {
24290
24271
  observer(...args);
24291
24272
  }
@@ -24293,8 +24274,7 @@ class EventEmitter {
24293
24274
  }
24294
24275
  if (this.observers['*']) {
24295
24276
  const cloned = Array.from(this.observers['*'].entries());
24296
- cloned.forEach(_ref2 => {
24297
- let [observer, numTimesAdded] = _ref2;
24277
+ cloned.forEach(([observer, numTimesAdded]) => {
24298
24278
  for (let i = 0; i < numTimesAdded; i++) {
24299
24279
  observer.apply(observer, [event, ...args]);
24300
24280
  }
@@ -24304,11 +24284,10 @@ class EventEmitter {
24304
24284
  }
24305
24285
 
24306
24286
  class ResourceStore extends EventEmitter {
24307
- constructor(data) {
24308
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
24309
- ns: ['translation'],
24310
- defaultNS: 'translation'
24311
- };
24287
+ constructor(data, options = {
24288
+ ns: ['translation'],
24289
+ defaultNS: 'translation'
24290
+ }) {
24312
24291
  super();
24313
24292
  this.data = data || {};
24314
24293
  this.options = options;
@@ -24330,8 +24309,7 @@ class ResourceStore extends EventEmitter {
24330
24309
  this.options.ns.splice(index, 1);
24331
24310
  }
24332
24311
  }
24333
- getResource(lng, ns, key) {
24334
- let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
24312
+ getResource(lng, ns, key, options = {}) {
24335
24313
  const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
24336
24314
  const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
24337
24315
  let path;
@@ -24358,10 +24336,9 @@ class ResourceStore extends EventEmitter {
24358
24336
  if (result || !ignoreJSONStructure || !isString(key)) return result;
24359
24337
  return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
24360
24338
  }
24361
- addResource(lng, ns, key, value) {
24362
- let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
24363
- silent: false
24364
- };
24339
+ addResource(lng, ns, key, value, options = {
24340
+ silent: false
24341
+ }) {
24365
24342
  const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
24366
24343
  let path = [lng, ns];
24367
24344
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
@@ -24374,10 +24351,9 @@ class ResourceStore extends EventEmitter {
24374
24351
  setPath(this.data, path, value);
24375
24352
  if (!options.silent) this.emit('added', lng, ns, key, value);
24376
24353
  }
24377
- addResources(lng, ns, resources) {
24378
- let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
24379
- silent: false
24380
- };
24354
+ addResources(lng, ns, resources, options = {
24355
+ silent: false
24356
+ }) {
24381
24357
  for (const m in resources) {
24382
24358
  if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
24383
24359
  silent: true
@@ -24385,11 +24361,10 @@ class ResourceStore extends EventEmitter {
24385
24361
  }
24386
24362
  if (!options.silent) this.emit('added', lng, ns, resources);
24387
24363
  }
24388
- addResourceBundle(lng, ns, resources, deep, overwrite) {
24389
- let options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
24390
- silent: false,
24391
- skipCopy: false
24392
- };
24364
+ addResourceBundle(lng, ns, resources, deep, overwrite, options = {
24365
+ silent: false,
24366
+ skipCopy: false
24367
+ }) {
24393
24368
  let path = [lng, ns];
24394
24369
  if (lng.indexOf('.') > -1) {
24395
24370
  path = lng.split('.');
@@ -24454,8 +24429,7 @@ var postProcessor = {
24454
24429
  const checkedLoadedFor = {};
24455
24430
  const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
24456
24431
  class Translator extends EventEmitter {
24457
- constructor(services) {
24458
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24432
+ constructor(services, options = {}) {
24459
24433
  super();
24460
24434
  copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);
24461
24435
  this.options = options;
@@ -24467,10 +24441,9 @@ class Translator extends EventEmitter {
24467
24441
  changeLanguage(lng) {
24468
24442
  if (lng) this.language = lng;
24469
24443
  }
24470
- exists(key) {
24471
- let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
24472
- interpolation: {}
24473
- };
24444
+ exists(key, o = {
24445
+ interpolation: {}
24446
+ }) {
24474
24447
  const opt = {
24475
24448
  ...o
24476
24449
  };
@@ -24522,11 +24495,12 @@ class Translator extends EventEmitter {
24522
24495
  namespaces
24523
24496
  } = this.extractFromKey(keys[keys.length - 1], opt);
24524
24497
  const namespace = namespaces[namespaces.length - 1];
24498
+ let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
24499
+ if (nsSeparator === undefined) nsSeparator = ':';
24525
24500
  const lng = opt.lng || this.language;
24526
24501
  const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
24527
24502
  if (lng?.toLowerCase() === 'cimode') {
24528
24503
  if (appendNamespaceToCIMode) {
24529
- const nsSeparator = opt.nsSeparator || this.options.nsSeparator;
24530
24504
  if (returnDetails) {
24531
24505
  return {
24532
24506
  res: `${namespace}${nsSeparator}${key}`,
@@ -24681,9 +24655,11 @@ class Translator extends EventEmitter {
24681
24655
  }
24682
24656
  }
24683
24657
  res = this.extendTranslation(res, keys, opt, resolved, lastKey);
24684
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;
24658
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
24659
+ res = `${namespace}${nsSeparator}${key}`;
24660
+ }
24685
24661
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
24686
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : undefined, opt);
24662
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
24687
24663
  }
24688
24664
  }
24689
24665
  if (returnDetails) {
@@ -24694,7 +24670,6 @@ class Translator extends EventEmitter {
24694
24670
  return res;
24695
24671
  }
24696
24672
  extendTranslation(res, key, opt, resolved, lastKey) {
24697
- var _this = this;
24698
24673
  if (this.i18nFormat?.parse) {
24699
24674
  res = this.i18nFormat.parse(res, {
24700
24675
  ...this.options.interpolation.defaultVariables,
@@ -24730,15 +24705,12 @@ class Translator extends EventEmitter {
24730
24705
  if (nestBef < nestAft) opt.nest = false;
24731
24706
  }
24732
24707
  if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
24733
- if (opt.nest !== false) res = this.interpolator.nest(res, function () {
24734
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24735
- args[_key] = arguments[_key];
24736
- }
24708
+ if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
24737
24709
  if (lastKey?.[0] === args[0] && !opt.context) {
24738
- _this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
24710
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
24739
24711
  return null;
24740
24712
  }
24741
- return _this.translate(...args, key);
24713
+ return this.translate(...args, key);
24742
24714
  }, opt);
24743
24715
  if (opt.interpolation) this.interpolator.reset();
24744
24716
  }
@@ -24755,8 +24727,7 @@ class Translator extends EventEmitter {
24755
24727
  }
24756
24728
  return res;
24757
24729
  }
24758
- resolve(keys) {
24759
- let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24730
+ resolve(keys, opt = {}) {
24760
24731
  let found;
24761
24732
  let usedKey;
24762
24733
  let exactUsedKey;
@@ -24836,13 +24807,11 @@ class Translator extends EventEmitter {
24836
24807
  isValidLookup(res) {
24837
24808
  return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
24838
24809
  }
24839
- getResource(code, ns, key) {
24840
- let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
24810
+ getResource(code, ns, key, options = {}) {
24841
24811
  if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
24842
24812
  return this.resourceStore.getResource(code, ns, key, options);
24843
24813
  }
24844
- getUsedParamsDetails() {
24845
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24814
+ getUsedParamsDetails(options = {}) {
24846
24815
  const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];
24847
24816
  const useOptionsReplaceForData = options.replace && !isString(options.replace);
24848
24817
  let data = useOptionsReplaceForData ? options.replace : options;
@@ -24999,8 +24968,7 @@ const dummyRule = {
24999
24968
  })
25000
24969
  };
25001
24970
  class PluralResolver {
25002
- constructor(languageUtils) {
25003
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24971
+ constructor(languageUtils, options = {}) {
25004
24972
  this.languageUtils = languageUtils;
25005
24973
  this.options = options;
25006
24974
  this.logger = baseLogger.create('pluralResolver');
@@ -25012,8 +24980,7 @@ class PluralResolver {
25012
24980
  clearCache() {
25013
24981
  this.pluralRulesCache = {};
25014
24982
  }
25015
- getRule(code) {
25016
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24983
+ getRule(code, options = {}) {
25017
24984
  const cleanedCode = getCleanedCode(code === 'dev' ? 'en' : code);
25018
24985
  const type = options.ordinal ? 'ordinal' : 'cardinal';
25019
24986
  const cacheKey = JSON.stringify({
@@ -25040,25 +25007,21 @@ class PluralResolver {
25040
25007
  this.pluralRulesCache[cacheKey] = rule;
25041
25008
  return rule;
25042
25009
  }
25043
- needsPlural(code) {
25044
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25010
+ needsPlural(code, options = {}) {
25045
25011
  let rule = this.getRule(code, options);
25046
25012
  if (!rule) rule = this.getRule('dev', options);
25047
25013
  return rule?.resolvedOptions().pluralCategories.length > 1;
25048
25014
  }
25049
- getPluralFormsOfKey(code, key) {
25050
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25015
+ getPluralFormsOfKey(code, key, options = {}) {
25051
25016
  return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);
25052
25017
  }
25053
- getSuffixes(code) {
25054
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25018
+ getSuffixes(code, options = {}) {
25055
25019
  let rule = this.getRule(code, options);
25056
25020
  if (!rule) rule = this.getRule('dev', options);
25057
25021
  if (!rule) return [];
25058
25022
  return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);
25059
25023
  }
25060
- getSuffix(code, count) {
25061
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25024
+ getSuffix(code, count, options = {}) {
25062
25025
  const rule = this.getRule(code, options);
25063
25026
  if (rule) {
25064
25027
  return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;
@@ -25068,9 +25031,7 @@ class PluralResolver {
25068
25031
  }
25069
25032
  }
25070
25033
 
25071
- const deepFindWithDefaults = function (data, defaultData, key) {
25072
- let keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
25073
- let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
25034
+ const deepFindWithDefaults = (data, defaultData, key, keySeparator = '.', ignoreJSONStructure = true) => {
25074
25035
  let path = getPathWithDefaults(data, defaultData, key);
25075
25036
  if (!path && ignoreJSONStructure && isString(key)) {
25076
25037
  path = deepFind(data, key, keySeparator);
@@ -25080,15 +25041,13 @@ const deepFindWithDefaults = function (data, defaultData, key) {
25080
25041
  };
25081
25042
  const regexSafe = val => val.replace(/\$/g, '$$$$');
25082
25043
  class Interpolator {
25083
- constructor() {
25084
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25044
+ constructor(options = {}) {
25085
25045
  this.logger = baseLogger.create('interpolator');
25086
25046
  this.options = options;
25087
25047
  this.format = options?.interpolation?.format || (value => value);
25088
25048
  this.init(options);
25089
25049
  }
25090
- init() {
25091
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25050
+ init(options = {}) {
25092
25051
  if (!options.interpolation) options.interpolation = {
25093
25052
  escapeValue: true
25094
25053
  };
@@ -25211,8 +25170,7 @@ class Interpolator {
25211
25170
  });
25212
25171
  return str;
25213
25172
  }
25214
- nest(str, fc) {
25215
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25173
+ nest(str, fc, options = {}) {
25216
25174
  let match;
25217
25175
  let value;
25218
25176
  let clonedOptions;
@@ -25309,68 +25267,68 @@ const parseFormatStr = formatStr => {
25309
25267
  };
25310
25268
  const createCachedFormatter = fn => {
25311
25269
  const cache = {};
25312
- return (val, lng, options) => {
25313
- let optForCache = options;
25314
- if (options && options.interpolationkey && options.formatParams && options.formatParams[options.interpolationkey] && options[options.interpolationkey]) {
25270
+ return (v, l, o) => {
25271
+ let optForCache = o;
25272
+ if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
25315
25273
  optForCache = {
25316
25274
  ...optForCache,
25317
- [options.interpolationkey]: undefined
25275
+ [o.interpolationkey]: undefined
25318
25276
  };
25319
25277
  }
25320
- const key = lng + JSON.stringify(optForCache);
25321
- let formatter = cache[key];
25322
- if (!formatter) {
25323
- formatter = fn(getCleanedCode(lng), options);
25324
- cache[key] = formatter;
25278
+ const key = l + JSON.stringify(optForCache);
25279
+ let frm = cache[key];
25280
+ if (!frm) {
25281
+ frm = fn(getCleanedCode(l), o);
25282
+ cache[key] = frm;
25325
25283
  }
25326
- return formatter(val);
25284
+ return frm(v);
25327
25285
  };
25328
25286
  };
25287
+ const createNonCachedFormatter = fn => (v, l, o) => fn(getCleanedCode(l), o)(v);
25329
25288
  class Formatter {
25330
- constructor() {
25331
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25289
+ constructor(options = {}) {
25332
25290
  this.logger = baseLogger.create('formatter');
25333
25291
  this.options = options;
25292
+ this.init(options);
25293
+ }
25294
+ init(services, options = {
25295
+ interpolation: {}
25296
+ }) {
25297
+ this.formatSeparator = options.interpolation.formatSeparator || ',';
25298
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
25334
25299
  this.formats = {
25335
- number: createCachedFormatter((lng, opt) => {
25300
+ number: cf((lng, opt) => {
25336
25301
  const formatter = new Intl.NumberFormat(lng, {
25337
25302
  ...opt
25338
25303
  });
25339
25304
  return val => formatter.format(val);
25340
25305
  }),
25341
- currency: createCachedFormatter((lng, opt) => {
25306
+ currency: cf((lng, opt) => {
25342
25307
  const formatter = new Intl.NumberFormat(lng, {
25343
25308
  ...opt,
25344
25309
  style: 'currency'
25345
25310
  });
25346
25311
  return val => formatter.format(val);
25347
25312
  }),
25348
- datetime: createCachedFormatter((lng, opt) => {
25313
+ datetime: cf((lng, opt) => {
25349
25314
  const formatter = new Intl.DateTimeFormat(lng, {
25350
25315
  ...opt
25351
25316
  });
25352
25317
  return val => formatter.format(val);
25353
25318
  }),
25354
- relativetime: createCachedFormatter((lng, opt) => {
25319
+ relativetime: cf((lng, opt) => {
25355
25320
  const formatter = new Intl.RelativeTimeFormat(lng, {
25356
25321
  ...opt
25357
25322
  });
25358
25323
  return val => formatter.format(val, opt.range || 'day');
25359
25324
  }),
25360
- list: createCachedFormatter((lng, opt) => {
25325
+ list: cf((lng, opt) => {
25361
25326
  const formatter = new Intl.ListFormat(lng, {
25362
25327
  ...opt
25363
25328
  });
25364
25329
  return val => formatter.format(val);
25365
25330
  })
25366
25331
  };
25367
- this.init(options);
25368
- }
25369
- init(services) {
25370
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
25371
- interpolation: {}
25372
- };
25373
- this.formatSeparator = options.interpolation.formatSeparator || ',';
25374
25332
  }
25375
25333
  add(name, fc) {
25376
25334
  this.formats[name.toLowerCase().trim()] = fc;
@@ -25378,8 +25336,7 @@ class Formatter {
25378
25336
  addCached(name, fc) {
25379
25337
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
25380
25338
  }
25381
- format(value, format, lng) {
25382
- let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25339
+ format(value, format, lng, options = {}) {
25383
25340
  const formats = format.split(this.formatSeparator);
25384
25341
  if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
25385
25342
  const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
@@ -25420,8 +25377,7 @@ const removePending = (q, name) => {
25420
25377
  }
25421
25378
  };
25422
25379
  class Connector extends EventEmitter {
25423
- constructor(backend, store, services) {
25424
- let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25380
+ constructor(backend, store, services, options = {}) {
25425
25381
  super();
25426
25382
  this.backend = backend;
25427
25383
  this.store = store;
@@ -25515,10 +25471,7 @@ class Connector extends EventEmitter {
25515
25471
  this.emit('loaded', loaded);
25516
25472
  this.queue = this.queue.filter(q => !q.done);
25517
25473
  }
25518
- read(lng, ns, fcName) {
25519
- let tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
25520
- let wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
25521
- let callback = arguments.length > 5 ? arguments[5] : undefined;
25474
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
25522
25475
  if (!lng.length) return callback(null, {});
25523
25476
  if (this.readingCalls >= this.maxParallelReads) {
25524
25477
  this.waitingReads.push({
@@ -25562,9 +25515,7 @@ class Connector extends EventEmitter {
25562
25515
  }
25563
25516
  return fc(lng, ns, resolver);
25564
25517
  }
25565
- prepareLoading(languages, namespaces) {
25566
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25567
- let callback = arguments.length > 3 ? arguments[3] : undefined;
25518
+ prepareLoading(languages, namespaces, options = {}, callback) {
25568
25519
  if (!this.backend) {
25569
25520
  this.logger.warn('No backend was added via i18next.use. Will not load resources.');
25570
25521
  return callback && callback();
@@ -25588,8 +25539,7 @@ class Connector extends EventEmitter {
25588
25539
  reload: true
25589
25540
  }, callback);
25590
25541
  }
25591
- loadOne(name) {
25592
- let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
25542
+ loadOne(name, prefix = '') {
25593
25543
  const s = name.split('|');
25594
25544
  const lng = s[0];
25595
25545
  const ns = s[1];
@@ -25599,9 +25549,7 @@ class Connector extends EventEmitter {
25599
25549
  this.loaded(name, err, data);
25600
25550
  });
25601
25551
  }
25602
- saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
25603
- let options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
25604
- let clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : () => {};
25552
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
25605
25553
  if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
25606
25554
  this.logger.warn(`did not save key "${key}" 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!!!');
25607
25555
  return;
@@ -25696,7 +25644,8 @@ const get$1 = () => ({
25696
25644
  nestingOptionsSeparator: ',',
25697
25645
  maxReplaces: 1000,
25698
25646
  skipOnVariables: true
25699
- }
25647
+ },
25648
+ cacheInBuiltFormats: true
25700
25649
  });
25701
25650
  const transformOptions = options => {
25702
25651
  if (isString(options.ns)) options.ns = [options.ns];
@@ -25719,9 +25668,7 @@ const bindMemberFunctions = inst => {
25719
25668
  });
25720
25669
  };
25721
25670
  class I18n extends EventEmitter {
25722
- constructor() {
25723
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25724
- let callback = arguments.length > 1 ? arguments[1] : undefined;
25671
+ constructor(options = {}, callback) {
25725
25672
  super();
25726
25673
  this.options = transformOptions(options);
25727
25674
  this.services = {};
@@ -25740,10 +25687,7 @@ class I18n extends EventEmitter {
25740
25687
  }, 0);
25741
25688
  }
25742
25689
  }
25743
- init() {
25744
- var _this = this;
25745
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25746
- let callback = arguments.length > 1 ? arguments[1] : undefined;
25690
+ init(options = {}, callback) {
25747
25691
  this.isInitializing = true;
25748
25692
  if (typeof options === 'function') {
25749
25693
  callback = options;
@@ -25809,11 +25753,8 @@ class I18n extends EventEmitter {
25809
25753
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
25810
25754
  };
25811
25755
  s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
25812
- s.backendConnector.on('*', function (event) {
25813
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
25814
- args[_key - 1] = arguments[_key];
25815
- }
25816
- _this.emit(event, ...args);
25756
+ s.backendConnector.on('*', (event, ...args) => {
25757
+ this.emit(event, ...args);
25817
25758
  });
25818
25759
  if (this.modules.languageDetector) {
25819
25760
  s.languageDetector = createClassOnDemand(this.modules.languageDetector);
@@ -25824,11 +25765,8 @@ class I18n extends EventEmitter {
25824
25765
  if (s.i18nFormat.init) s.i18nFormat.init(this);
25825
25766
  }
25826
25767
  this.translator = new Translator(this.services, this.options);
25827
- this.translator.on('*', function (event) {
25828
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
25829
- args[_key2 - 1] = arguments[_key2];
25830
- }
25831
- _this.emit(event, ...args);
25768
+ this.translator.on('*', (event, ...args) => {
25769
+ this.emit(event, ...args);
25832
25770
  });
25833
25771
  this.modules.external.forEach(m => {
25834
25772
  if (m.init) m.init(this);
@@ -25845,15 +25783,13 @@ class I18n extends EventEmitter {
25845
25783
  }
25846
25784
  const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
25847
25785
  storeApi.forEach(fcName => {
25848
- this[fcName] = function () {
25849
- return _this.store[fcName](...arguments);
25850
- };
25786
+ this[fcName] = (...args) => this.store[fcName](...args);
25851
25787
  });
25852
25788
  const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
25853
25789
  storeApiChained.forEach(fcName => {
25854
- this[fcName] = function () {
25855
- _this.store[fcName](...arguments);
25856
- return _this;
25790
+ this[fcName] = (...args) => {
25791
+ this.store[fcName](...args);
25792
+ return this;
25857
25793
  };
25858
25794
  });
25859
25795
  const deferred = defer();
@@ -25877,8 +25813,7 @@ class I18n extends EventEmitter {
25877
25813
  }
25878
25814
  return deferred;
25879
25815
  }
25880
- loadResources(language) {
25881
- let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
25816
+ loadResources(language, callback = noop) {
25882
25817
  let usedCallback = callback;
25883
25818
  const usedLng = isString(language) ? language : this.language;
25884
25819
  if (typeof language === 'function') usedCallback = language;
@@ -25971,7 +25906,6 @@ class I18n extends EventEmitter {
25971
25906
  }
25972
25907
  }
25973
25908
  changeLanguage(lng, callback) {
25974
- var _this2 = this;
25975
25909
  this.isLanguageChangingTo = lng;
25976
25910
  const deferred = defer();
25977
25911
  this.emit('languageChanging', lng);
@@ -25993,12 +25927,8 @@ class I18n extends EventEmitter {
25993
25927
  } else {
25994
25928
  this.isLanguageChangingTo = undefined;
25995
25929
  }
25996
- deferred.resolve(function () {
25997
- return _this2.t(...arguments);
25998
- });
25999
- if (callback) callback(err, function () {
26000
- return _this2.t(...arguments);
26001
- });
25930
+ deferred.resolve((...args) => this.t(...args));
25931
+ if (callback) callback(err, (...args) => this.t(...args));
26002
25932
  };
26003
25933
  const setLng = lngs => {
26004
25934
  if (!lng && !lngs && this.services.languageDetector) lngs = [];
@@ -26029,14 +25959,10 @@ class I18n extends EventEmitter {
26029
25959
  return deferred;
26030
25960
  }
26031
25961
  getFixedT(lng, ns, keyPrefix) {
26032
- var _this3 = this;
26033
- const fixedT = function (key, opts) {
25962
+ const fixedT = (key, opts, ...rest) => {
26034
25963
  let o;
26035
25964
  if (typeof opts !== 'object') {
26036
- for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
26037
- rest[_key3 - 2] = arguments[_key3];
26038
- }
26039
- o = _this3.options.overloadTranslationOptionHandler([key, opts].concat(rest));
25965
+ o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
26040
25966
  } else {
26041
25967
  o = {
26042
25968
  ...opts
@@ -26046,14 +25972,14 @@ class I18n extends EventEmitter {
26046
25972
  o.lngs = o.lngs || fixedT.lngs;
26047
25973
  o.ns = o.ns || fixedT.ns;
26048
25974
  if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
26049
- const keySeparator = _this3.options.keySeparator || '.';
25975
+ const keySeparator = this.options.keySeparator || '.';
26050
25976
  let resultKey;
26051
25977
  if (o.keyPrefix && Array.isArray(key)) {
26052
25978
  resultKey = key.map(k => `${o.keyPrefix}${keySeparator}${k}`);
26053
25979
  } else {
26054
25980
  resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
26055
25981
  }
26056
- return _this3.t(resultKey, o);
25982
+ return this.t(resultKey, o);
26057
25983
  };
26058
25984
  if (isString(lng)) {
26059
25985
  fixedT.lng = lng;
@@ -26064,23 +25990,16 @@ class I18n extends EventEmitter {
26064
25990
  fixedT.keyPrefix = keyPrefix;
26065
25991
  return fixedT;
26066
25992
  }
26067
- t() {
26068
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
26069
- args[_key4] = arguments[_key4];
26070
- }
25993
+ t(...args) {
26071
25994
  return this.translator?.translate(...args);
26072
25995
  }
26073
- exists() {
26074
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
26075
- args[_key5] = arguments[_key5];
26076
- }
25996
+ exists(...args) {
26077
25997
  return this.translator?.exists(...args);
26078
25998
  }
26079
25999
  setDefaultNamespace(ns) {
26080
26000
  this.options.defaultNS = ns;
26081
26001
  }
26082
- hasLoadedNamespace(ns) {
26083
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26002
+ hasLoadedNamespace(ns, options = {}) {
26084
26003
  if (!this.isInitialized) {
26085
26004
  this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
26086
26005
  return false;
@@ -26145,14 +26064,10 @@ class I18n extends EventEmitter {
26145
26064
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get$1());
26146
26065
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
26147
26066
  }
26148
- static createInstance() {
26149
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26150
- let callback = arguments.length > 1 ? arguments[1] : undefined;
26067
+ static createInstance(options = {}, callback) {
26151
26068
  return new I18n(options, callback);
26152
26069
  }
26153
- cloneInstance() {
26154
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26155
- let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
26070
+ cloneInstance(options = {}, callback = noop) {
26156
26071
  const forkResourceStore = options.forkResourceStore;
26157
26072
  if (forkResourceStore) delete options.forkResourceStore;
26158
26073
  const mergedOptions = {
@@ -26193,10 +26108,7 @@ class I18n extends EventEmitter {
26193
26108
  clone.services.resourceStore = clone.store;
26194
26109
  }
26195
26110
  clone.translator = new Translator(clone.services, mergedOptions);
26196
- clone.translator.on('*', function (event) {
26197
- for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
26198
- args[_key6 - 1] = arguments[_key6];
26199
- }
26111
+ clone.translator.on('*', (event, ...args) => {
26200
26112
  clone.emit(event, ...args);
26201
26113
  });
26202
26114
  clone.init(mergedOptions, callback);
@@ -28561,7 +28473,7 @@ function deflist_plugin (md) {
28561
28473
  var Diff = /** @class */ (function () {
28562
28474
  function Diff() {
28563
28475
  }
28564
- Diff.prototype.diff = function (oldString, newString,
28476
+ Diff.prototype.diff = function (oldStr, newStr,
28565
28477
  // Type below is not accurate/complete - see above for full possibilities - but it compiles
28566
28478
  options) {
28567
28479
  if (options === void 0) { options = {}; }
@@ -28574,8 +28486,8 @@ var Diff = /** @class */ (function () {
28574
28486
  callback = options.callback;
28575
28487
  }
28576
28488
  // Allow subclasses to massage the input prior to running
28577
- oldString = this.castInput(oldString, options);
28578
- newString = this.castInput(newString, options);
28489
+ var oldString = this.castInput(oldStr, options);
28490
+ var newString = this.castInput(newStr, options);
28579
28491
  var oldTokens = this.removeEmpty(this.tokenize(oldString, options));
28580
28492
  var newTokens = this.removeEmpty(this.tokenize(newString, options));
28581
28493
  return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
@@ -56853,4 +56765,4 @@ var srcExports = requireSrc();
56853
56765
  var tinylr = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
56854
56766
 
56855
56767
  export { HighlightJS as H, MarkdownIt as M, deflist_plugin as a, closest as b, createTwoFilesPatch as c, dedent as d, distance as e, fm as f, globSync as g, glob as h, isCI as i, moduleImporter as j, cliProgress as k, createInstance as l, minimatch as m, fse as n, tinylr as t, watch$1 as w };
56856
- //# sourceMappingURL=vendor-DxEOke6B.mjs.map
56768
+ //# sourceMappingURL=vendor-IOoC49Xw.mjs.map