@cakemail-org/ui-components-v2 2.2.90 → 2.2.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1258,7 +1258,7 @@ const defer = () => {
1258
1258
  };
1259
1259
  const makeString = object => {
1260
1260
  if (object == null) return '';
1261
- return '' + object;
1261
+ return String(object);
1262
1262
  };
1263
1263
  const copy$1 = (a, s, t) => {
1264
1264
  a.forEach(m => {
@@ -1266,7 +1266,7 @@ const copy$1 = (a, s, t) => {
1266
1266
  });
1267
1267
  };
1268
1268
  const lastOfPathSeparatorRegExp = /###/g;
1269
- const cleanKey = key => key && key.indexOf('###') > -1 ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
1269
+ const cleanKey = key => key && key.includes('###') ? key.replace(lastOfPathSeparatorRegExp, '.') : key;
1270
1270
  const canNotTraverseDeeper = object => !object || isString(object);
1271
1271
  const getLastOfPath = (object, path, Empty) => {
1272
1272
  const stack = !isString(path) ? path : path.split('.');
@@ -1351,7 +1351,7 @@ const deepExtend = (target, source, overwrite) => {
1351
1351
  return target;
1352
1352
  };
1353
1353
  const regexEscape = str => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
1354
- var _entityMap = {
1354
+ const _entityMap = {
1355
1355
  '&': '&',
1356
1356
  '<': '&lt;',
1357
1357
  '>': '&gt;',
@@ -1390,7 +1390,7 @@ const looksLikeObjectPathRegExpCache = new RegExpCache(20);
1390
1390
  const looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
1391
1391
  nsSeparator = nsSeparator || '';
1392
1392
  keySeparator = keySeparator || '';
1393
- const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
1393
+ const possibleChars = chars.filter(c => !nsSeparator.includes(c) && !keySeparator.includes(c));
1394
1394
  if (possibleChars.length === 0) return true;
1395
1395
  const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map(c => c === '?' ? '\\?' : c).join('|')})`);
1396
1396
  let matched = !r.test(key);
@@ -1423,7 +1423,7 @@ const deepFind = (obj, path, keySeparator = '.') => {
1423
1423
  nextPath += tokens[j];
1424
1424
  next = current[nextPath];
1425
1425
  if (next !== undefined) {
1426
- if (['string', 'number', 'boolean'].indexOf(typeof next) > -1 && j < tokens.length - 1) {
1426
+ if (['string', 'number', 'boolean'].includes(typeof next) && j < tokens.length - 1) {
1427
1427
  continue;
1428
1428
  }
1429
1429
  i += j - i + 1;
@@ -1434,7 +1434,7 @@ const deepFind = (obj, path, keySeparator = '.') => {
1434
1434
  }
1435
1435
  return current;
1436
1436
  };
1437
- const getCleanedCode = code => code?.replace('_', '-');
1437
+ const getCleanedCode = code => code?.replace(/_/g, '-');
1438
1438
 
1439
1439
  const consoleLogger = {
1440
1440
  type: 'logger',
@@ -1514,6 +1514,14 @@ class EventEmitter {
1514
1514
  }
1515
1515
  this.observers[event].delete(listener);
1516
1516
  }
1517
+ once(event, listener) {
1518
+ const wrapper = (...args) => {
1519
+ listener(...args);
1520
+ this.off(event, wrapper);
1521
+ };
1522
+ this.on(event, wrapper);
1523
+ return this;
1524
+ }
1517
1525
  emit(event, ...args) {
1518
1526
  if (this.observers[event]) {
1519
1527
  const cloned = Array.from(this.observers[event].entries());
@@ -1527,7 +1535,7 @@ class EventEmitter {
1527
1535
  const cloned = Array.from(this.observers['*'].entries());
1528
1536
  cloned.forEach(([observer, numTimesAdded]) => {
1529
1537
  for (let i = 0; i < numTimesAdded; i++) {
1530
- observer.apply(observer, [event, ...args]);
1538
+ observer(event, ...args);
1531
1539
  }
1532
1540
  });
1533
1541
  }
@@ -1550,7 +1558,7 @@ class ResourceStore extends EventEmitter {
1550
1558
  }
1551
1559
  }
1552
1560
  addNamespaces(ns) {
1553
- if (this.options.ns.indexOf(ns) < 0) {
1561
+ if (!this.options.ns.includes(ns)) {
1554
1562
  this.options.ns.push(ns);
1555
1563
  }
1556
1564
  }
@@ -1564,7 +1572,7 @@ class ResourceStore extends EventEmitter {
1564
1572
  const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
1565
1573
  const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
1566
1574
  let path;
1567
- if (lng.indexOf('.') > -1) {
1575
+ if (lng.includes('.')) {
1568
1576
  path = lng.split('.');
1569
1577
  } else {
1570
1578
  path = [lng, ns];
@@ -1579,7 +1587,7 @@ class ResourceStore extends EventEmitter {
1579
1587
  }
1580
1588
  }
1581
1589
  const result = getPath$1(this.data, path);
1582
- if (!result && !ns && !key && lng.indexOf('.') > -1) {
1590
+ if (!result && !ns && !key && lng.includes('.')) {
1583
1591
  lng = path[0];
1584
1592
  ns = path[1];
1585
1593
  key = path.slice(2).join('.');
@@ -1593,7 +1601,7 @@ class ResourceStore extends EventEmitter {
1593
1601
  const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
1594
1602
  let path = [lng, ns];
1595
1603
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
1596
- if (lng.indexOf('.') > -1) {
1604
+ if (lng.includes('.')) {
1597
1605
  path = lng.split('.');
1598
1606
  value = ns;
1599
1607
  ns = path[1];
@@ -1617,7 +1625,7 @@ class ResourceStore extends EventEmitter {
1617
1625
  skipCopy: false
1618
1626
  }) {
1619
1627
  let path = [lng, ns];
1620
- if (lng.indexOf('.') > -1) {
1628
+ if (lng.includes('.')) {
1621
1629
  path = lng.split('.');
1622
1630
  deep = resources;
1623
1631
  resources = ns;
@@ -1677,7 +1685,36 @@ var postProcessor = {
1677
1685
  }
1678
1686
  };
1679
1687
 
1680
- const checkedLoadedFor = {};
1688
+ const PATH_KEY = Symbol('i18next/PATH_KEY');
1689
+ function createProxy() {
1690
+ const state = [];
1691
+ const handler = Object.create(null);
1692
+ let proxy;
1693
+ handler.get = (target, key) => {
1694
+ proxy?.revoke?.();
1695
+ if (key === PATH_KEY) return state;
1696
+ state.push(key);
1697
+ proxy = Proxy.revocable(target, handler);
1698
+ return proxy.proxy;
1699
+ };
1700
+ return Proxy.revocable(Object.create(null), handler).proxy;
1701
+ }
1702
+ function keysFromSelector(selector, opts) {
1703
+ const {
1704
+ [PATH_KEY]: path
1705
+ } = selector(createProxy());
1706
+ const keySeparator = opts?.keySeparator ?? '.';
1707
+ const nsSeparator = opts?.nsSeparator ?? ':';
1708
+ if (path.length > 1 && nsSeparator) {
1709
+ const ns = opts?.ns;
1710
+ const nsArray = Array.isArray(ns) ? ns : null;
1711
+ if (nsArray && nsArray.length > 1 && nsArray.slice(1).includes(path[0])) {
1712
+ return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
1713
+ }
1714
+ }
1715
+ return path.join(keySeparator);
1716
+ }
1717
+
1681
1718
  const shouldHandleAsObject = res => !isString(res) && typeof res !== 'boolean' && typeof res !== 'number';
1682
1719
  class Translator extends EventEmitter {
1683
1720
  constructor(services, options = {}) {
@@ -1688,6 +1725,7 @@ class Translator extends EventEmitter {
1688
1725
  this.options.keySeparator = '.';
1689
1726
  }
1690
1727
  this.logger = baseLogger.create('translator');
1728
+ this.checkedLoadedFor = {};
1691
1729
  }
1692
1730
  changeLanguage(lng) {
1693
1731
  if (lng) this.language = lng;
@@ -1700,14 +1738,19 @@ class Translator extends EventEmitter {
1700
1738
  };
1701
1739
  if (key == null) return false;
1702
1740
  const resolved = this.resolve(key, opt);
1703
- return resolved?.res !== undefined;
1741
+ if (resolved?.res === undefined) return false;
1742
+ const isObject = shouldHandleAsObject(resolved.res);
1743
+ if (opt.returnObjects === false && isObject) {
1744
+ return false;
1745
+ }
1746
+ return true;
1704
1747
  }
1705
1748
  extractFromKey(key, opt) {
1706
1749
  let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
1707
1750
  if (nsSeparator === undefined) nsSeparator = ':';
1708
1751
  const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
1709
1752
  let namespaces = opt.ns || this.options.defaultNS || [];
1710
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
1753
+ const wouldCheckForNsInKey = nsSeparator && key.includes(nsSeparator);
1711
1754
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
1712
1755
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
1713
1756
  const m = key.match(this.interpolator.nestingRegexp);
@@ -1718,7 +1761,7 @@ class Translator extends EventEmitter {
1718
1761
  };
1719
1762
  }
1720
1763
  const parts = key.split(nsSeparator);
1721
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
1764
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.includes(parts[0])) namespaces = parts.shift();
1722
1765
  key = parts.join(keySeparator);
1723
1766
  }
1724
1767
  return {
@@ -1733,12 +1776,20 @@ class Translator extends EventEmitter {
1733
1776
  if (typeof opt !== 'object' && this.options.overloadTranslationOptionHandler) {
1734
1777
  opt = this.options.overloadTranslationOptionHandler(arguments);
1735
1778
  }
1736
- if (typeof options === 'object') opt = {
1779
+ if (typeof opt === 'object') opt = {
1737
1780
  ...opt
1738
1781
  };
1739
1782
  if (!opt) opt = {};
1740
1783
  if (keys == null) return '';
1784
+ if (typeof keys === 'function') keys = keysFromSelector(keys, {
1785
+ ...this.options,
1786
+ ...opt
1787
+ });
1741
1788
  if (!Array.isArray(keys)) keys = [String(keys)];
1789
+ keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
1790
+ ...this.options,
1791
+ ...opt
1792
+ }) : String(k));
1742
1793
  const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
1743
1794
  const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
1744
1795
  const {
@@ -1797,7 +1848,7 @@ class Translator extends EventEmitter {
1797
1848
  }
1798
1849
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
1799
1850
  const resType = Object.prototype.toString.apply(resForObjHndl);
1800
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
1851
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
1801
1852
  if (!opt.returnObjects && !this.options.returnObjects) {
1802
1853
  if (!this.options.returnedObjectHandler) {
1803
1854
  this.logger.warn('accessing an object - but returnObjects options is not enabled!');
@@ -1893,7 +1944,7 @@ class Translator extends EventEmitter {
1893
1944
  if (this.options.saveMissingPlurals && needsPluralHandling) {
1894
1945
  lngs.forEach(language => {
1895
1946
  const suffixes = this.pluralResolver.getSuffixes(language, opt);
1896
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
1947
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && !suffixes.includes(`${this.options.pluralSeparator}zero`)) {
1897
1948
  suffixes.push(`${this.options.pluralSeparator}zero`);
1898
1949
  }
1899
1950
  suffixes.forEach(suffix => {
@@ -1985,6 +2036,10 @@ class Translator extends EventEmitter {
1985
2036
  let usedLng;
1986
2037
  let usedNS;
1987
2038
  if (isString(keys)) keys = [keys];
2039
+ if (Array.isArray(keys)) keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
2040
+ ...this.options,
2041
+ ...opt
2042
+ }) : k);
1988
2043
  keys.forEach(k => {
1989
2044
  if (this.isValidLookup(found)) return;
1990
2045
  const extracted = this.extractFromKey(k, opt);
@@ -1999,8 +2054,8 @@ class Translator extends EventEmitter {
1999
2054
  namespaces.forEach(ns => {
2000
2055
  if (this.isValidLookup(found)) return;
2001
2056
  usedNS = ns;
2002
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
2003
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
2057
+ if (!this.checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
2058
+ this.checkedLoadedFor[`${codes[0]}-${ns}`] = true;
2004
2059
  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!!!');
2005
2060
  }
2006
2061
  codes.forEach(code => {
@@ -2015,22 +2070,22 @@ class Translator extends EventEmitter {
2015
2070
  const zeroSuffix = `${this.options.pluralSeparator}zero`;
2016
2071
  const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
2017
2072
  if (needsPluralHandling) {
2018
- finalKeys.push(key + pluralSuffix);
2019
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
2073
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
2020
2074
  finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
2021
2075
  }
2076
+ finalKeys.push(key + pluralSuffix);
2022
2077
  if (needsZeroSuffixLookup) {
2023
2078
  finalKeys.push(key + zeroSuffix);
2024
2079
  }
2025
2080
  }
2026
2081
  if (needsContextHandling) {
2027
- const contextKey = `${key}${this.options.contextSeparator}${opt.context}`;
2082
+ const contextKey = `${key}${this.options.contextSeparator || '_'}${opt.context}`;
2028
2083
  finalKeys.push(contextKey);
2029
2084
  if (needsPluralHandling) {
2030
- finalKeys.push(contextKey + pluralSuffix);
2031
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
2085
+ if (opt.ordinal && pluralSuffix.startsWith(ordinalPrefix)) {
2032
2086
  finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
2033
2087
  }
2088
+ finalKeys.push(contextKey + pluralSuffix);
2034
2089
  if (needsZeroSuffixLookup) {
2035
2090
  finalKeys.push(contextKey + zeroSuffix);
2036
2091
  }
@@ -2088,7 +2143,7 @@ class Translator extends EventEmitter {
2088
2143
  static hasDefaultValue(options) {
2089
2144
  const prefix = 'defaultValue';
2090
2145
  for (const option in options) {
2091
- if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
2146
+ if (Object.prototype.hasOwnProperty.call(options, option) && option.startsWith(prefix) && undefined !== options[option]) {
2092
2147
  return true;
2093
2148
  }
2094
2149
  }
@@ -2104,7 +2159,7 @@ class LanguageUtil {
2104
2159
  }
2105
2160
  getScriptPartFromCode(code) {
2106
2161
  code = getCleanedCode(code);
2107
- if (!code || code.indexOf('-') < 0) return null;
2162
+ if (!code || !code.includes('-')) return null;
2108
2163
  const p = code.split('-');
2109
2164
  if (p.length === 2) return null;
2110
2165
  p.pop();
@@ -2113,12 +2168,12 @@ class LanguageUtil {
2113
2168
  }
2114
2169
  getLanguagePartFromCode(code) {
2115
2170
  code = getCleanedCode(code);
2116
- if (!code || code.indexOf('-') < 0) return code;
2171
+ if (!code || !code.includes('-')) return code;
2117
2172
  const p = code.split('-');
2118
2173
  return this.formatLanguageCode(p[0]);
2119
2174
  }
2120
2175
  formatLanguageCode(code) {
2121
- if (isString(code) && code.indexOf('-') > -1) {
2176
+ if (isString(code) && code.includes('-')) {
2122
2177
  let formattedCode;
2123
2178
  try {
2124
2179
  formattedCode = Intl.getCanonicalLocales(code)[0];
@@ -2138,7 +2193,7 @@ class LanguageUtil {
2138
2193
  if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
2139
2194
  code = this.getLanguagePartFromCode(code);
2140
2195
  }
2141
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
2196
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.includes(code);
2142
2197
  }
2143
2198
  getBestMatchFromCodes(codes) {
2144
2199
  if (!codes) return null;
@@ -2156,10 +2211,11 @@ class LanguageUtil {
2156
2211
  const lngOnly = this.getLanguagePartFromCode(code);
2157
2212
  if (this.isSupportedCode(lngOnly)) return found = lngOnly;
2158
2213
  found = this.options.supportedLngs.find(supportedLng => {
2159
- if (supportedLng === lngOnly) return supportedLng;
2160
- if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
2161
- if (supportedLng.indexOf('-') > 0 && lngOnly.indexOf('-') < 0 && supportedLng.substring(0, supportedLng.indexOf('-')) === lngOnly) return supportedLng;
2162
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
2214
+ if (supportedLng === lngOnly) return true;
2215
+ if (!supportedLng.includes('-') && !lngOnly.includes('-')) return false;
2216
+ if (supportedLng.includes('-') && !lngOnly.includes('-') && supportedLng.slice(0, supportedLng.indexOf('-')) === lngOnly) return true;
2217
+ if (supportedLng.startsWith(lngOnly) && lngOnly.length > 1) return true;
2218
+ return false;
2163
2219
  });
2164
2220
  });
2165
2221
  }
@@ -2190,7 +2246,7 @@ class LanguageUtil {
2190
2246
  this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
2191
2247
  }
2192
2248
  };
2193
- if (isString(code) && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {
2249
+ if (isString(code) && (code.includes('-') || code.includes('_'))) {
2194
2250
  if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
2195
2251
  if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
2196
2252
  if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
@@ -2198,7 +2254,7 @@ class LanguageUtil {
2198
2254
  addCode(this.formatLanguageCode(code));
2199
2255
  }
2200
2256
  fallbackCodes.forEach(fc => {
2201
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
2257
+ if (!codes.includes(fc)) addCode(this.formatLanguageCode(fc));
2202
2258
  });
2203
2259
  return codes;
2204
2260
  }
@@ -2225,9 +2281,6 @@ class PluralResolver {
2225
2281
  this.logger = baseLogger.create('pluralResolver');
2226
2282
  this.pluralRulesCache = {};
2227
2283
  }
2228
- addRule(lng, obj) {
2229
- this.rules[lng] = obj;
2230
- }
2231
2284
  clearCache() {
2232
2285
  this.pluralRulesCache = {};
2233
2286
  }
@@ -2247,7 +2300,7 @@ class PluralResolver {
2247
2300
  type
2248
2301
  });
2249
2302
  } catch (err) {
2250
- if (!Intl) {
2303
+ if (typeof Intl === 'undefined') {
2251
2304
  this.logger.error('No Intl support, please use an Intl polyfill!');
2252
2305
  return dummyRule;
2253
2306
  }
@@ -2349,7 +2402,7 @@ class Interpolator {
2349
2402
  };
2350
2403
  this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
2351
2404
  this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
2352
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
2405
+ this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
2353
2406
  }
2354
2407
  interpolate(str, data, lng, options) {
2355
2408
  let match;
@@ -2357,7 +2410,7 @@ class Interpolator {
2357
2410
  let replaces;
2358
2411
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
2359
2412
  const handleFormat = key => {
2360
- if (key.indexOf(this.formatSeparator) < 0) {
2413
+ if (!key.includes(this.formatSeparator)) {
2361
2414
  const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
2362
2415
  return this.alwaysFormat ? this.format(path, undefined, lng, {
2363
2416
  ...options,
@@ -2427,14 +2480,14 @@ class Interpolator {
2427
2480
  let clonedOptions;
2428
2481
  const handleHasOptions = (key, inheritedOptions) => {
2429
2482
  const sep = this.nestingOptionsSeparator;
2430
- if (key.indexOf(sep) < 0) return key;
2431
- const c = key.split(new RegExp(`${sep}[ ]*{`));
2483
+ if (!key.includes(sep)) return key;
2484
+ const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
2432
2485
  let optionsString = `{${c[1]}`;
2433
2486
  key = c[0];
2434
2487
  optionsString = this.interpolate(optionsString, clonedOptions);
2435
2488
  const matchedSingleQuotes = optionsString.match(/'/g);
2436
2489
  const matchedDoubleQuotes = optionsString.match(/"/g);
2437
- if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
2490
+ if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
2438
2491
  optionsString = optionsString.replace(/'/g, '"');
2439
2492
  }
2440
2493
  try {
@@ -2447,7 +2500,7 @@ class Interpolator {
2447
2500
  this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
2448
2501
  return `${key}${sep}${optionsString}`;
2449
2502
  }
2450
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
2503
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
2451
2504
  return key;
2452
2505
  };
2453
2506
  while (match = this.nestingRegexp.exec(str)) {
@@ -2486,13 +2539,13 @@ class Interpolator {
2486
2539
  const parseFormatStr = formatStr => {
2487
2540
  let formatName = formatStr.toLowerCase().trim();
2488
2541
  const formatOptions = {};
2489
- if (formatStr.indexOf('(') > -1) {
2542
+ if (formatStr.includes('(')) {
2490
2543
  const p = formatStr.split('(');
2491
2544
  formatName = p[0].toLowerCase().trim();
2492
- const optStr = p[1].substring(0, p[1].length - 1);
2493
- if (formatName === 'currency' && optStr.indexOf(':') < 0) {
2545
+ const optStr = p[1].slice(0, -1);
2546
+ if (formatName === 'currency' && !optStr.includes(':')) {
2494
2547
  if (!formatOptions.currency) formatOptions.currency = optStr.trim();
2495
- } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
2548
+ } else if (formatName === 'relativetime' && !optStr.includes(':')) {
2496
2549
  if (!formatOptions.range) formatOptions.range = optStr.trim();
2497
2550
  } else {
2498
2551
  const opts = optStr.split(';');
@@ -2586,9 +2639,11 @@ class Formatter {
2586
2639
  this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
2587
2640
  }
2588
2641
  format(value, format, lng, options = {}) {
2642
+ if (!format) return value;
2643
+ if (value == null) return value;
2589
2644
  const formats = format.split(this.formatSeparator);
2590
- if (formats.length > 1 && formats[0].indexOf('(') > 1 && formats[0].indexOf(')') < 0 && formats.find(f => f.indexOf(')') > -1)) {
2591
- const lastIndex = formats.findIndex(f => f.indexOf(')') > -1);
2645
+ if (formats.length > 1 && formats[0].indexOf('(') > 1 && !formats[0].includes(')') && formats.find(f => f.includes(')'))) {
2646
+ const lastIndex = formats.findIndex(f => f.includes(')'));
2592
2647
  formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
2593
2648
  }
2594
2649
  const result = formats.reduce((mem, f) => {
@@ -2742,7 +2797,7 @@ class Connector extends EventEmitter {
2742
2797
  }
2743
2798
  if (err && data && tried < this.maxRetries) {
2744
2799
  setTimeout(() => {
2745
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
2800
+ this.read(lng, ns, fcName, tried + 1, wait * 2, callback);
2746
2801
  }, wait);
2747
2802
  return;
2748
2803
  }
@@ -2846,7 +2901,6 @@ const get = () => ({
2846
2901
  nonExplicitSupportedLngs: false,
2847
2902
  load: 'all',
2848
2903
  preload: false,
2849
- simplifyPluralSuffix: true,
2850
2904
  keySeparator: '.',
2851
2905
  nsSeparator: ':',
2852
2906
  pluralSeparator: '_',
@@ -2883,7 +2937,6 @@ const get = () => ({
2883
2937
  },
2884
2938
  interpolation: {
2885
2939
  escapeValue: true,
2886
- format: value => value,
2887
2940
  prefix: '{{',
2888
2941
  suffix: '}}',
2889
2942
  formatSeparator: ',',
@@ -2900,10 +2953,9 @@ const transformOptions = options => {
2900
2953
  if (isString(options.ns)) options.ns = [options.ns];
2901
2954
  if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
2902
2955
  if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
2903
- if (options.supportedLngs?.indexOf?.('cimode') < 0) {
2956
+ if (options.supportedLngs && !options.supportedLngs.includes('cimode')) {
2904
2957
  options.supportedLngs = options.supportedLngs.concat(['cimode']);
2905
2958
  }
2906
- if (typeof options.initImmediate === 'boolean') options.initAsync = options.initImmediate;
2907
2959
  return options;
2908
2960
  };
2909
2961
 
@@ -2945,7 +2997,7 @@ class I18n extends EventEmitter {
2945
2997
  if (options.defaultNS == null && options.ns) {
2946
2998
  if (isString(options.ns)) {
2947
2999
  options.defaultNS = options.ns;
2948
- } else if (options.ns.indexOf('translation') < 0) {
3000
+ } else if (!options.ns.includes('translation')) {
2949
3001
  options.defaultNS = options.ns[0];
2950
3002
  }
2951
3003
  }
@@ -2965,6 +3017,9 @@ class I18n extends EventEmitter {
2965
3017
  if (options.nsSeparator !== undefined) {
2966
3018
  this.options.userDefinedNsSeparator = options.nsSeparator;
2967
3019
  }
3020
+ if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
3021
+ this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
3022
+ }
2968
3023
  const createClassOnDemand = ClassOrObject => {
2969
3024
  if (!ClassOrObject) return null;
2970
3025
  if (typeof ClassOrObject === 'function') return new ClassOrObject();
@@ -2989,14 +3044,9 @@ class I18n extends EventEmitter {
2989
3044
  s.resourceStore = this.store;
2990
3045
  s.languageUtils = lu;
2991
3046
  s.pluralResolver = new PluralResolver(lu, {
2992
- prepend: this.options.pluralSeparator,
2993
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
3047
+ prepend: this.options.pluralSeparator
2994
3048
  });
2995
- const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
2996
- if (usingLegacyFormatFunction) {
2997
- this.logger.warn(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
2998
- }
2999
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
3049
+ if (formatter) {
3000
3050
  s.formatter = createClassOnDemand(formatter);
3001
3051
  if (s.formatter.init) s.formatter.init(s, this.options);
3002
3052
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
@@ -3079,7 +3129,7 @@ class I18n extends EventEmitter {
3079
3129
  const lngs = this.services.languageUtils.toResolveHierarchy(lng);
3080
3130
  lngs.forEach(l => {
3081
3131
  if (l === 'cimode') return;
3082
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
3132
+ if (!toLoad.includes(l)) toLoad.push(l);
3083
3133
  });
3084
3134
  };
3085
3135
  if (!usedLng) {
@@ -3144,16 +3194,16 @@ class I18n extends EventEmitter {
3144
3194
  }
3145
3195
  setResolvedLanguage(l) {
3146
3196
  if (!l || !this.languages) return;
3147
- if (['cimode', 'dev'].indexOf(l) > -1) return;
3197
+ if (['cimode', 'dev'].includes(l)) return;
3148
3198
  for (let li = 0; li < this.languages.length; li++) {
3149
3199
  const lngInLngs = this.languages[li];
3150
- if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
3200
+ if (['cimode', 'dev'].includes(lngInLngs)) continue;
3151
3201
  if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
3152
3202
  this.resolvedLanguage = lngInLngs;
3153
3203
  break;
3154
3204
  }
3155
3205
  }
3156
- if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
3206
+ if (!this.resolvedLanguage && !this.languages.includes(l) && this.store.hasLanguageSomeTranslations(l)) {
3157
3207
  this.resolvedLanguage = l;
3158
3208
  this.languages.unshift(l);
3159
3209
  }
@@ -3225,11 +3275,20 @@ class I18n extends EventEmitter {
3225
3275
  o.lngs = o.lngs || fixedT.lngs;
3226
3276
  o.ns = o.ns || fixedT.ns;
3227
3277
  if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
3278
+ const selectorOpts = {
3279
+ ...this.options,
3280
+ ...o
3281
+ };
3282
+ if (typeof o.keyPrefix === 'function') o.keyPrefix = keysFromSelector(o.keyPrefix, selectorOpts);
3228
3283
  const keySeparator = this.options.keySeparator || '.';
3229
3284
  let resultKey;
3230
3285
  if (o.keyPrefix && Array.isArray(key)) {
3231
- resultKey = key.map(k => `${o.keyPrefix}${keySeparator}${k}`);
3286
+ resultKey = key.map(k => {
3287
+ if (typeof k === 'function') k = keysFromSelector(k, selectorOpts);
3288
+ return `${o.keyPrefix}${keySeparator}${k}`;
3289
+ });
3232
3290
  } else {
3291
+ if (typeof key === 'function') key = keysFromSelector(key, selectorOpts);
3233
3292
  resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
3234
3293
  }
3235
3294
  return this.t(resultKey, o);
@@ -3286,7 +3345,7 @@ class I18n extends EventEmitter {
3286
3345
  }
3287
3346
  if (isString(ns)) ns = [ns];
3288
3347
  ns.forEach(n => {
3289
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
3348
+ if (!this.options.ns.includes(n)) this.options.ns.push(n);
3290
3349
  });
3291
3350
  this.loadResources(err => {
3292
3351
  deferred.resolve();
@@ -3298,7 +3357,7 @@ class I18n extends EventEmitter {
3298
3357
  const deferred = defer();
3299
3358
  if (isString(lngs)) lngs = [lngs];
3300
3359
  const preloaded = this.options.preload || [];
3301
- const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
3360
+ const newLngs = lngs.filter(lng => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
3302
3361
  if (!newLngs.length) {
3303
3362
  if (callback) callback();
3304
3363
  return Promise.resolve();
@@ -3313,20 +3372,22 @@ class I18n extends EventEmitter {
3313
3372
  dir(lng) {
3314
3373
  if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
3315
3374
  if (!lng) return 'rtl';
3316
- if (Intl.Locale) {
3375
+ try {
3317
3376
  const l = new Intl.Locale(lng);
3318
3377
  if (l && l.getTextInfo) {
3319
3378
  const ti = l.getTextInfo();
3320
3379
  if (ti && ti.direction) return ti.direction;
3321
3380
  }
3322
- }
3381
+ } catch (e) {}
3323
3382
  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'];
3324
3383
  const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
3325
3384
  if (lng.toLowerCase().indexOf('-latn') > 1) return 'ltr';
3326
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
3385
+ return rtlLngs.includes(languageUtils.getLanguagePartFromCode(lng)) || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
3327
3386
  }
3328
3387
  static createInstance(options = {}, callback) {
3329
- return new I18n(options, callback);
3388
+ const instance = new I18n(options, callback);
3389
+ instance.createInstance = I18n.createInstance;
3390
+ return instance;
3330
3391
  }
3331
3392
  cloneInstance(options = {}, callback = noop) {
3332
3393
  const forkResourceStore = options.forkResourceStore;
@@ -3368,6 +3429,19 @@ class I18n extends EventEmitter {
3368
3429
  clone.store = new ResourceStore(clonedData, mergedOptions);
3369
3430
  clone.services.resourceStore = clone.store;
3370
3431
  }
3432
+ if (options.interpolation) {
3433
+ const defOpts = get();
3434
+ const mergedInterpolation = {
3435
+ ...defOpts.interpolation,
3436
+ ...this.options.interpolation,
3437
+ ...options.interpolation
3438
+ };
3439
+ const mergedForInterpolator = {
3440
+ ...mergedOptions,
3441
+ interpolation: mergedInterpolation
3442
+ };
3443
+ clone.services.interpolator = new Interpolator(mergedForInterpolator);
3444
+ }
3371
3445
  clone.translator = new Translator(clone.services, mergedOptions);
3372
3446
  clone.translator.on('*', (event, ...args) => {
3373
3447
  clone.emit(event, ...args);
@@ -3390,7 +3464,6 @@ class I18n extends EventEmitter {
3390
3464
  }
3391
3465
  }
3392
3466
  const instance = I18n.createInstance();
3393
- instance.createInstance = I18n.createInstance;
3394
3467
 
3395
3468
  instance.createInstance;
3396
3469
  instance.dir;
@@ -9272,7 +9345,7 @@ function EmptyContent(_a) {
9272
9345
  button && button));
9273
9346
  }
9274
9347
 
9275
- var css_248z$c = ".fileUpload-component-v2 {\n position: relative;\n width: 100%;\n}\n.fileUpload-component-v2 > .fileUploadContainer {\n box-sizing: border-box;\n text-align: center;\n cursor: pointer;\n width: 100%;\n padding: 3rem 2rem;\n display: flex;\n position: relative;\n}\n.fileUpload-component-v2 > .fileUploadContainer fieldset {\n position: absolute;\n margin: 0;\n padding: 0 0 0 1rem !important;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n border-radius: 8px;\n border: 1px dashed var(--pebble, #EAEAEA);\n text-align: left;\n position: absolute;\n padding-inline: 0.75em;\n margin-inline: unset;\n}\n.fileUpload-component-v2 > .fileUploadContainer img {\n max-width: 100%;\n}\n.fileUpload-component-v2 > .fileUploadContainer.hasDropdown fieldset {\n border-bottom-right-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n}\n.fileUpload-component-v2 .dropdown-component-v2 {\n flex: 1;\n margin-top: 0;\n position: relative;\n left: 1px;\n width: calc(100% - 2px);\n}\n.fileUpload-component-v2 .dropdown-component-v2 > .MuiInputBase-root {\n max-width: unset;\n border-top-right-radius: 0 !important;\n border-top-left-radius: 0 !important;\n}\n.fileUpload-component-v2 .dropdown-component-v2 > .MuiInputBase-root:not(:focus):not(:hover):not(:active) {\n outline-color: var(--secondary-brand-color, var(--teal, #0ABDAE));\n}";
9348
+ var css_248z$c = ".fileUpload-component-v2 {\n position: relative;\n width: 100%;\n}\n.fileUpload-component-v2 > .fileUploadContainer {\n box-sizing: border-box;\n text-align: center;\n cursor: pointer;\n width: 100%;\n padding: 3rem 2rem;\n display: flex;\n position: relative;\n}\n.fileUpload-component-v2 > .fileUploadContainer fieldset {\n position: absolute;\n margin: 0;\n padding: 0 0 0 1rem !important;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n border-radius: 8px;\n border: 1px dashed var(--pebble, #EAEAEA);\n text-align: left;\n position: absolute;\n padding-inline: 0.75em;\n margin-inline: unset;\n}\n.fileUpload-component-v2 > .fileUploadContainer img {\n max-width: 100%;\n}\n.fileUpload-component-v2 > .fileUploadContainer.hasDropdown fieldset {\n border-bottom-right-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n}\n.fileUpload-component-v2 .dropdown-component-v2 {\n flex: 1;\n margin-top: 0;\n position: relative;\n left: 1px;\n width: calc(100% - 2px);\n}\n.fileUpload-component-v2 .dropdown-component-v2 > .MuiInputBase-root:not(:focus):not(:hover):not(:active) {\n outline-color: var(--secondary-brand-color, var(--teal, #0ABDAE));\n}\n.fileUpload-component-v2 .dropdown-component-v2 > .MuiInputBase-root {\n max-width: unset;\n border-top-right-radius: 0 !important;\n border-top-left-radius: 0 !important;\n}";
9276
9349
  styleInject(css_248z$c);
9277
9350
 
9278
9351
  function FileUpload(_a) {
@@ -12450,6 +12523,7 @@ var ListPageModel = /** @class */ (function () {
12450
12523
  return __generator(this, function (_a) {
12451
12524
  dataToUpdate = page || this.toJson();
12452
12525
  return [2 /*return*/, updatePage({ id: this.id, page: dataToUpdate }).then(function (data) {
12526
+ debugger;
12453
12527
  trackEvent(exports.EEvents.PAGE_UPDATED, {
12454
12528
  id: _this.id,
12455
12529
  name: dataToUpdate === null || dataToUpdate === void 0 ? void 0 : dataToUpdate.name,
@@ -15992,7 +16066,7 @@ var propTypesExports = propTypes.exports;
15992
16066
  var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
15993
16067
 
15994
16068
  /**
15995
- * @mui/styled-engine v7.2.0
16069
+ * @mui/styled-engine v7.3.10
15996
16070
  *
15997
16071
  * @license MIT
15998
16072
  * This source code is licensed under the MIT license found in the
@@ -16054,8 +16128,8 @@ function requireReactIs_production () {
16054
16128
  REACT_PORTAL_TYPE = Symbol.for("react.portal"),
16055
16129
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
16056
16130
  REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
16057
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
16058
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
16131
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
16132
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
16059
16133
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
16060
16134
  REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
16061
16135
  REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
@@ -16225,8 +16299,8 @@ function requireReactIs_development () {
16225
16299
  REACT_PORTAL_TYPE = Symbol.for("react.portal"),
16226
16300
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
16227
16301
  REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
16228
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
16229
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
16302
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
16303
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
16230
16304
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
16231
16305
  REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
16232
16306
  REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
@@ -16467,7 +16541,7 @@ function createBreakpoints(breakpoints) {
16467
16541
  * For using in `sx` prop to sort the breakpoint from low to high.
16468
16542
  * Note: this function does not work and will not support multiple units.
16469
16543
  * e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
16470
- * output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
16544
+ * output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 even though 40rem > 300px
16471
16545
  */
16472
16546
  function sortContainerQueries(theme, css) {
16473
16547
  if (!theme.containerQueries) {
@@ -16496,7 +16570,7 @@ function getContainerQuery(theme, shorthand) {
16496
16570
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
16497
16571
  if (!matches) {
16498
16572
  if (process.env.NODE_ENV !== 'production') {
16499
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : formatMuiErrorMessage(18, `(${shorthand})`));
16573
+ throw /* minify-error */new Error(`MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.');
16500
16574
  }
16501
16575
  return null;
16502
16576
  }