gt-react 10.19.17 → 10.19.19
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/CHANGELOG.md +19 -0
- package/dist/browser.cjs +698 -871
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +9 -6
- package/dist/browser.d.cts.map +1 -1
- package/dist/browser.d.mts +9 -6
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.mjs +698 -871
- package/dist/browser.mjs.map +1 -1
- package/dist/client.cjs +183 -182
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +183 -182
- package/dist/client.mjs.map +1 -1
- package/dist/index.cjs +183 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +183 -182
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +327 -326
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.mjs +301 -300
- package/dist/internal.mjs.map +1 -1
- package/dist/macros.cjs +465 -639
- package/dist/macros.cjs.map +1 -1
- package/dist/macros.mjs +465 -639
- package/dist/macros.mjs.map +1 -1
- package/package.json +5 -5
package/dist/browser.mjs
CHANGED
|
@@ -4191,14 +4191,17 @@ function extractVars(icuString) {
|
|
|
4191
4191
|
});
|
|
4192
4192
|
return variables;
|
|
4193
4193
|
}
|
|
4194
|
+
const CONTAINS_INDEXED_GT_REGEX = new RegExp(`${VAR_IDENTIFIER}\\d+`);
|
|
4194
4195
|
/**
|
|
4195
4196
|
* Given an indexed ICU string, condenses any select to an argument
|
|
4197
|
+
* Unindexed _gt_ source strings and indexed _gt_# translation strings
|
|
4198
|
+
* are mutually exclusive.
|
|
4196
4199
|
* indexVars('Hello {_gt_1, select, other {World}}') => 'Hello {_gt_1}'
|
|
4197
4200
|
* @param {string} icuString - The ICU string to condense.
|
|
4198
4201
|
* @returns {string} The condensed ICU string.
|
|
4199
4202
|
*/
|
|
4200
4203
|
function condenseVars(icuString) {
|
|
4201
|
-
if (!
|
|
4204
|
+
if (!CONTAINS_INDEXED_GT_REGEX.test(icuString)) return icuString;
|
|
4202
4205
|
function visitor(child) {
|
|
4203
4206
|
child.type = import_types.TYPE.argument;
|
|
4204
4207
|
Reflect.deleteProperty(child, "options");
|
|
@@ -4395,7 +4398,7 @@ function sanitizeJsxChildren(childrenAsObjects) {
|
|
|
4395
4398
|
return Array.isArray(childrenAsObjects) ? childrenAsObjects.map(sanitizeChild) : sanitizeChild(childrenAsObjects);
|
|
4396
4399
|
}
|
|
4397
4400
|
//#endregion
|
|
4398
|
-
//#region ../i18n/dist/versionId-
|
|
4401
|
+
//#region ../i18n/dist/versionId-BTjLA0FZ.mjs
|
|
4399
4402
|
/**
|
|
4400
4403
|
* Throw errors if there are any errors and log warnings if there are any warnings
|
|
4401
4404
|
* @param {ValidationResult[]} results - The results to print
|
|
@@ -4661,83 +4664,269 @@ function routeCreateTranslationLoader({ type, remoteTranslationLoaderParams, loa
|
|
|
4661
4664
|
case "disabled": return createFallbackTranslationLoader();
|
|
4662
4665
|
}
|
|
4663
4666
|
}
|
|
4664
|
-
function
|
|
4665
|
-
|
|
4666
|
-
const
|
|
4667
|
-
return
|
|
4667
|
+
function getDictionaryPath(id) {
|
|
4668
|
+
const path = id ? id.split(".") : [];
|
|
4669
|
+
for (const segment of path) assertSafeDictionaryPathSegment(segment, id);
|
|
4670
|
+
return path;
|
|
4668
4671
|
}
|
|
4669
|
-
function
|
|
4670
|
-
if (
|
|
4671
|
-
|
|
4672
|
-
|
|
4672
|
+
function assertSafeDictionaryPathSegment(segment, path) {
|
|
4673
|
+
if (segment === "__proto__" || segment === "constructor" || segment === "prototype") throw new Error(`Dictionary path "${path}" contains an unsafe segment`);
|
|
4674
|
+
}
|
|
4675
|
+
function isDictionaryObject(value) {
|
|
4676
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
4677
|
+
}
|
|
4678
|
+
function cloneDictionaryValue(value) {
|
|
4679
|
+
if (value === void 0 || typeof value === "string") return value;
|
|
4680
|
+
return structuredClone(value);
|
|
4681
|
+
}
|
|
4682
|
+
function getDictionaryValueAtPath(dictionary, path) {
|
|
4683
|
+
let current = dictionary;
|
|
4684
|
+
for (const segment of getDictionaryPath(path)) {
|
|
4685
|
+
if (!isDictionaryObject(current)) return;
|
|
4686
|
+
current = current[segment];
|
|
4687
|
+
}
|
|
4688
|
+
return current;
|
|
4689
|
+
}
|
|
4690
|
+
function setDictionaryValueAtPath(dictionary, path, value) {
|
|
4691
|
+
const segments = getDictionaryPath(path);
|
|
4692
|
+
if (isDictionaryObject(value)) assertSafeDictionaryObject(value, path);
|
|
4693
|
+
if (segments.length === 0) {
|
|
4694
|
+
if (isDictionaryObject(value)) replaceDictionary(dictionary, value);
|
|
4695
|
+
return;
|
|
4696
|
+
}
|
|
4697
|
+
let current = dictionary;
|
|
4698
|
+
for (const segment of segments.slice(0, -1)) {
|
|
4699
|
+
const next = current[segment];
|
|
4700
|
+
if (!isDictionaryObject(next)) current[segment] = {};
|
|
4701
|
+
current = current[segment];
|
|
4702
|
+
}
|
|
4703
|
+
const leafSegment = segments[segments.length - 1];
|
|
4704
|
+
current[leafSegment] = value;
|
|
4705
|
+
}
|
|
4706
|
+
function getDictionaryEntry(value) {
|
|
4707
|
+
if (!isDictionaryLeafNode(value)) return;
|
|
4708
|
+
return {
|
|
4709
|
+
entry: Array.isArray(value) ? value[0] : value,
|
|
4710
|
+
options: Array.isArray(value) ? value[1] ?? {} : {}
|
|
4711
|
+
};
|
|
4712
|
+
}
|
|
4713
|
+
function getDictionaryValue(value) {
|
|
4714
|
+
if (Object.keys(value.options).length === 0) return value.entry;
|
|
4715
|
+
return [value.entry, value.options];
|
|
4716
|
+
}
|
|
4717
|
+
function resolveDictionaryLookupOptions(options) {
|
|
4718
|
+
const { $format, context, ...rest } = options;
|
|
4719
|
+
return {
|
|
4720
|
+
...rest,
|
|
4721
|
+
$format: isStringFormat($format) ? $format : "ICU",
|
|
4722
|
+
...rest.$context === void 0 && typeof context === "string" && { $context: context }
|
|
4723
|
+
};
|
|
4724
|
+
}
|
|
4725
|
+
function isDictionaryLeafNode(value) {
|
|
4726
|
+
if (typeof value === "string") return true;
|
|
4727
|
+
if (!Array.isArray(value) || typeof value[0] !== "string") return false;
|
|
4728
|
+
if (value.length === 1) return true;
|
|
4729
|
+
return value.length === 2 && isDictionaryOptions(value[1]);
|
|
4730
|
+
}
|
|
4731
|
+
function isDictionaryOptions(value) {
|
|
4732
|
+
if (typeof value !== "object" || value == null || Array.isArray(value)) return false;
|
|
4733
|
+
const options = value;
|
|
4734
|
+
return (options.$context === void 0 || typeof options.$context === "string") && (options.$format === void 0 || isStringFormat(options.$format)) && (options.$maxChars === void 0 || typeof options.$maxChars === "number") && (options.context === void 0 || typeof options.context === "string");
|
|
4673
4735
|
}
|
|
4736
|
+
function isStringFormat(value) {
|
|
4737
|
+
return value === "ICU" || value === "I18NEXT" || value === "STRING";
|
|
4738
|
+
}
|
|
4739
|
+
function replaceDictionary(target, source) {
|
|
4740
|
+
for (const key of Object.keys(target)) delete target[key];
|
|
4741
|
+
for (const key of Object.keys(source)) target[key] = source[key];
|
|
4742
|
+
}
|
|
4743
|
+
function assertSafeDictionaryObject(dictionary, parentPath = "") {
|
|
4744
|
+
for (const [key, value] of Object.entries(dictionary)) {
|
|
4745
|
+
const path = parentPath ? `${parentPath}.${key}` : key;
|
|
4746
|
+
assertSafeDictionaryPathSegment(key, path);
|
|
4747
|
+
if (isDictionaryObject(value)) assertSafeDictionaryObject(value, path);
|
|
4748
|
+
}
|
|
4749
|
+
}
|
|
4750
|
+
var DictionarySourceNotFoundError = class extends Error {
|
|
4751
|
+
constructor(id) {
|
|
4752
|
+
super(`I18nManager: source dictionary entry ${id} is not defined`);
|
|
4753
|
+
this.name = "DictionarySourceNotFoundError";
|
|
4754
|
+
}
|
|
4755
|
+
};
|
|
4674
4756
|
/**
|
|
4675
|
-
*
|
|
4676
|
-
*
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4757
|
+
* Builds the dictionary value for a requested path by combining existing target
|
|
4758
|
+
* translations with runtime translations of any source leaves that are missing.
|
|
4759
|
+
*/
|
|
4760
|
+
async function materializeDictionaryValue({ key, sourceValue, targetValue, translateEntry }) {
|
|
4761
|
+
if (getDictionaryEntry(targetValue) !== void 0) return cloneDictionaryValue(targetValue);
|
|
4762
|
+
if (isDictionaryObject(targetValue) && !isDictionaryObject(sourceValue)) return cloneDictionaryValue(targetValue);
|
|
4763
|
+
const sourceEntry = getDictionaryEntry(sourceValue);
|
|
4764
|
+
if (sourceEntry !== void 0) return await translateEntry(key, sourceEntry);
|
|
4765
|
+
if (!isDictionaryObject(sourceValue)) throw new DictionarySourceNotFoundError(key);
|
|
4766
|
+
const targetDictionary = isDictionaryObject(targetValue) ? targetValue : {};
|
|
4767
|
+
const keys = new Set([...Object.keys(sourceValue), ...Object.keys(targetDictionary)]);
|
|
4768
|
+
const entries = await Promise.all(Array.from(keys).map(async (childKey) => {
|
|
4769
|
+
const childPath = key ? `${key}.${childKey}` : childKey;
|
|
4770
|
+
assertSafeDictionaryPathSegment(childKey, childPath);
|
|
4771
|
+
const childSource = sourceValue[childKey];
|
|
4772
|
+
if (childSource === void 0) return [childKey, cloneDictionaryValue(targetDictionary[childKey])];
|
|
4773
|
+
return [childKey, await materializeDictionaryValue({
|
|
4774
|
+
key: childPath,
|
|
4775
|
+
sourceValue: childSource,
|
|
4776
|
+
targetValue: targetDictionary[childKey],
|
|
4777
|
+
translateEntry
|
|
4778
|
+
})];
|
|
4779
|
+
}));
|
|
4780
|
+
return Object.fromEntries(entries);
|
|
4781
|
+
}
|
|
4782
|
+
function cloneDictionaryEntry(entry) {
|
|
4783
|
+
return {
|
|
4784
|
+
entry: entry.entry,
|
|
4785
|
+
options: structuredClone(entry.options)
|
|
4786
|
+
};
|
|
4787
|
+
}
|
|
4788
|
+
var DictionaryCache = class {
|
|
4789
|
+
constructor({ init, lifecycle = {}, runtimeTranslate }) {
|
|
4790
|
+
this.pendingTranslations = /* @__PURE__ */ new Map();
|
|
4791
|
+
this.pendingMaterializations = /* @__PURE__ */ new Map();
|
|
4691
4792
|
this.cache = structuredClone(init);
|
|
4692
|
-
this.
|
|
4693
|
-
this.
|
|
4793
|
+
this.runtimeTranslate = runtimeTranslate;
|
|
4794
|
+
this.lifecycle = lifecycle;
|
|
4694
4795
|
}
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4796
|
+
getEntry(key) {
|
|
4797
|
+
const value = getDictionaryValueAtPath(this.cache, key);
|
|
4798
|
+
const entry = getDictionaryEntry(value);
|
|
4799
|
+
if (entry === void 0) return;
|
|
4800
|
+
const outputEntry = cloneDictionaryEntry(entry);
|
|
4801
|
+
this.lifecycle.onHit?.({
|
|
4802
|
+
inputKey: key,
|
|
4803
|
+
cacheKey: key,
|
|
4804
|
+
cacheValue: value,
|
|
4805
|
+
outputValue: outputEntry
|
|
4806
|
+
});
|
|
4807
|
+
return outputEntry;
|
|
4700
4808
|
}
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4809
|
+
getValue(key) {
|
|
4810
|
+
const value = getDictionaryValueAtPath(this.cache, key);
|
|
4811
|
+
if (value === void 0) return;
|
|
4812
|
+
const outputValue = cloneDictionaryValue(value);
|
|
4813
|
+
this.lifecycle.onDictionaryObjectCacheHit?.({
|
|
4814
|
+
inputKey: key,
|
|
4815
|
+
cacheKey: key,
|
|
4816
|
+
cacheValue: value,
|
|
4817
|
+
outputValue
|
|
4818
|
+
});
|
|
4819
|
+
return outputValue;
|
|
4820
|
+
}
|
|
4821
|
+
setValue(key, value) {
|
|
4822
|
+
setDictionaryValueAtPath(this.cache, key, cloneDictionaryValue(value));
|
|
4707
4823
|
}
|
|
4708
|
-
/**
|
|
4709
|
-
* Get the internal cache
|
|
4710
|
-
* @returns The internal cache
|
|
4711
|
-
*
|
|
4712
|
-
* @internal - used by gt-tanstack-start
|
|
4713
|
-
*/
|
|
4714
4824
|
getInternalCache() {
|
|
4715
|
-
return
|
|
4825
|
+
return cloneDictionaryValue(this.cache);
|
|
4826
|
+
}
|
|
4827
|
+
async materializeValue(key, sourceValue, targetValue = getDictionaryValueAtPath(this.cache, key)) {
|
|
4828
|
+
let materializationPromise = this.pendingMaterializations.get(key);
|
|
4829
|
+
if (!materializationPromise) {
|
|
4830
|
+
materializationPromise = materializeDictionaryValue({
|
|
4831
|
+
key,
|
|
4832
|
+
sourceValue,
|
|
4833
|
+
targetValue,
|
|
4834
|
+
translateEntry: async (entryKey, sourceEntry) => getDictionaryValue(await this.materializeEntry(entryKey, sourceEntry))
|
|
4835
|
+
}).then((value) => {
|
|
4836
|
+
this.setValue(key, value);
|
|
4837
|
+
return value;
|
|
4838
|
+
});
|
|
4839
|
+
this.pendingMaterializations.set(key, materializationPromise);
|
|
4840
|
+
}
|
|
4841
|
+
try {
|
|
4842
|
+
return await materializationPromise;
|
|
4843
|
+
} finally {
|
|
4844
|
+
this.pendingMaterializations.delete(key);
|
|
4845
|
+
}
|
|
4716
4846
|
}
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4847
|
+
async materializeEntry(key, sourceEntry) {
|
|
4848
|
+
let translationPromise = this.pendingTranslations.get(key);
|
|
4849
|
+
if (!translationPromise) {
|
|
4850
|
+
translationPromise = this.runtimeTranslate(key, sourceEntry).then((value) => {
|
|
4851
|
+
setDictionaryValueAtPath(this.cache, key, value);
|
|
4852
|
+
const entry = getDictionaryEntry(value);
|
|
4853
|
+
if (entry === void 0) throw new Error("DictionaryCache materializeEntry did not return a DictionaryEntry");
|
|
4854
|
+
this.lifecycle.onMiss?.({
|
|
4855
|
+
inputKey: key,
|
|
4856
|
+
cacheKey: key,
|
|
4857
|
+
cacheValue: value,
|
|
4858
|
+
outputValue: cloneDictionaryEntry(entry)
|
|
4859
|
+
});
|
|
4860
|
+
return cloneDictionaryEntry(entry);
|
|
4861
|
+
});
|
|
4862
|
+
this.pendingTranslations.set(key, translationPromise);
|
|
4863
|
+
}
|
|
4864
|
+
try {
|
|
4865
|
+
return cloneDictionaryEntry(await translationPromise);
|
|
4866
|
+
} finally {
|
|
4867
|
+
this.pendingTranslations.delete(key);
|
|
4868
|
+
}
|
|
4722
4869
|
}
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4870
|
+
};
|
|
4871
|
+
var ResourceCache = class {
|
|
4872
|
+
constructor({ load, lifecycle = {}, ttl }) {
|
|
4873
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
4874
|
+
this.pendingLoads = /* @__PURE__ */ new Map();
|
|
4875
|
+
this.loadResource = load;
|
|
4876
|
+
this.lifecycle = lifecycle;
|
|
4877
|
+
this.ttl = ttl === null ? -1 : ttl ?? 6e4;
|
|
4878
|
+
}
|
|
4879
|
+
get(key) {
|
|
4880
|
+
const entry = this.cache.get(key);
|
|
4881
|
+
if (!entry || this.isExpired(entry)) return;
|
|
4882
|
+
this.lifecycle.onHit?.({
|
|
4883
|
+
inputKey: key,
|
|
4884
|
+
cacheKey: key,
|
|
4885
|
+
cacheValue: entry,
|
|
4886
|
+
outputValue: entry.value
|
|
4887
|
+
});
|
|
4888
|
+
return entry.value;
|
|
4889
|
+
}
|
|
4890
|
+
set(key, value, { expiresAt = this.getExpiresAt() } = {}) {
|
|
4891
|
+
this.cache.set(key, {
|
|
4892
|
+
expiresAt,
|
|
4893
|
+
value
|
|
4894
|
+
});
|
|
4895
|
+
}
|
|
4896
|
+
async getOrLoad(key) {
|
|
4897
|
+
return this.get(key) ?? await this.load(key);
|
|
4898
|
+
}
|
|
4899
|
+
async load(key) {
|
|
4900
|
+
let loadPromise = this.pendingLoads.get(key);
|
|
4901
|
+
if (!loadPromise) {
|
|
4902
|
+
loadPromise = this.loadResource(key).then((value) => {
|
|
4903
|
+
const entry = {
|
|
4904
|
+
expiresAt: this.getExpiresAt(),
|
|
4905
|
+
value
|
|
4906
|
+
};
|
|
4907
|
+
this.cache.set(key, entry);
|
|
4908
|
+
this.lifecycle.onMiss?.({
|
|
4909
|
+
inputKey: key,
|
|
4910
|
+
cacheKey: key,
|
|
4911
|
+
cacheValue: entry,
|
|
4912
|
+
outputValue: entry.value
|
|
4913
|
+
});
|
|
4914
|
+
return entry;
|
|
4915
|
+
});
|
|
4916
|
+
this.pendingLoads.set(key, loadPromise);
|
|
4917
|
+
}
|
|
4733
4918
|
try {
|
|
4734
|
-
|
|
4735
|
-
this.setCache(cacheKey, value);
|
|
4736
|
-
return value;
|
|
4919
|
+
return (await loadPromise).value;
|
|
4737
4920
|
} finally {
|
|
4738
|
-
|
|
4921
|
+
this.pendingLoads.delete(key);
|
|
4739
4922
|
}
|
|
4740
4923
|
}
|
|
4924
|
+
getExpiresAt() {
|
|
4925
|
+
return this.ttl < 0 ? this.ttl : Date.now() + this.ttl;
|
|
4926
|
+
}
|
|
4927
|
+
isExpired(entry) {
|
|
4928
|
+
return entry.expiresAt > 0 && entry.expiresAt < Date.now();
|
|
4929
|
+
}
|
|
4741
4930
|
};
|
|
4742
4931
|
/**
|
|
4743
4932
|
* Hash a message string
|
|
@@ -4782,20 +4971,22 @@ function normalizeBatchConfig(batchConfig) {
|
|
|
4782
4971
|
* Locale logic is handled at the LocalesCache level. Use a callback function that has the
|
|
4783
4972
|
* locale parameter embedded if you wish to use the locale code.
|
|
4784
4973
|
*/
|
|
4785
|
-
var TranslationsCache = class
|
|
4974
|
+
var TranslationsCache = class {
|
|
4786
4975
|
/**
|
|
4787
4976
|
* Constructor
|
|
4788
4977
|
* @param {Object} params - The parameters for the cache
|
|
4789
4978
|
* @param {Record<Hash, TranslationValue>} params.init - The initial cache
|
|
4790
4979
|
* @param {Function} params.fallback - Get the fallback value for a cache miss
|
|
4791
4980
|
*/
|
|
4792
|
-
constructor({ init, translateMany, lifecycle, batchConfig }) {
|
|
4793
|
-
|
|
4794
|
-
this.
|
|
4795
|
-
this.
|
|
4796
|
-
this.
|
|
4797
|
-
this.
|
|
4798
|
-
this.
|
|
4981
|
+
constructor({ init, translateMany, lifecycle = {}, batchConfig }) {
|
|
4982
|
+
this.pendingTranslations = /* @__PURE__ */ new Map();
|
|
4983
|
+
this.queue = [];
|
|
4984
|
+
this.batchTimer = null;
|
|
4985
|
+
this.activeRequests = 0;
|
|
4986
|
+
this.cache = structuredClone(init);
|
|
4987
|
+
this.translateMany = translateMany;
|
|
4988
|
+
this.batchConfig = normalizeBatchConfig(batchConfig);
|
|
4989
|
+
this.lifecycle = lifecycle;
|
|
4799
4990
|
}
|
|
4800
4991
|
/**
|
|
4801
4992
|
* Get the translation value for a given key
|
|
@@ -4803,10 +4994,11 @@ var TranslationsCache = class extends Cache {
|
|
|
4803
4994
|
* @returns The translation value
|
|
4804
4995
|
*/
|
|
4805
4996
|
get(key) {
|
|
4806
|
-
const
|
|
4807
|
-
|
|
4997
|
+
const cacheKey = this.getCacheKey(key);
|
|
4998
|
+
const value = this.cache[cacheKey];
|
|
4999
|
+
if (value != null) this.lifecycle.onHit?.({
|
|
4808
5000
|
inputKey: key,
|
|
4809
|
-
cacheKey
|
|
5001
|
+
cacheKey,
|
|
4810
5002
|
cacheValue: value,
|
|
4811
5003
|
outputValue: value
|
|
4812
5004
|
});
|
|
@@ -4818,75 +5010,64 @@ var TranslationsCache = class extends Cache {
|
|
|
4818
5010
|
* @returns The translation value
|
|
4819
5011
|
*/
|
|
4820
5012
|
async miss(key) {
|
|
4821
|
-
const
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
5013
|
+
const cacheKey = this.getCacheKey(key);
|
|
5014
|
+
let translationPromise = this.pendingTranslations.get(cacheKey);
|
|
5015
|
+
if (!translationPromise) {
|
|
5016
|
+
translationPromise = this.translate(key);
|
|
5017
|
+
this.pendingTranslations.set(cacheKey, translationPromise);
|
|
5018
|
+
}
|
|
5019
|
+
try {
|
|
5020
|
+
const value = await translationPromise;
|
|
5021
|
+
if (value != null) this.lifecycle.onMiss?.({
|
|
5022
|
+
inputKey: key,
|
|
5023
|
+
cacheKey,
|
|
5024
|
+
cacheValue: value,
|
|
5025
|
+
outputValue: value
|
|
5026
|
+
});
|
|
5027
|
+
return value;
|
|
5028
|
+
} finally {
|
|
5029
|
+
this.pendingTranslations.delete(cacheKey);
|
|
5030
|
+
}
|
|
4829
5031
|
}
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
*/
|
|
4835
|
-
genKey(key) {
|
|
5032
|
+
getInternalCache() {
|
|
5033
|
+
return structuredClone(this.cache);
|
|
5034
|
+
}
|
|
5035
|
+
getCacheKey(key) {
|
|
4836
5036
|
return hashMessage(key.message, key.options);
|
|
4837
5037
|
}
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
*/
|
|
4843
|
-
fallback(key) {
|
|
4844
|
-
const translationPromise = this._enqueueTranslation(key);
|
|
4845
|
-
if (this._queue.length >= this._batchConfig.maxBatchSize) this._flushNow();
|
|
4846
|
-
else this._scheduleBatch();
|
|
5038
|
+
translate(key) {
|
|
5039
|
+
const translationPromise = this.enqueueTranslation(key);
|
|
5040
|
+
if (this.queue.length >= this.batchConfig.maxBatchSize) this.flushNow();
|
|
5041
|
+
else this.scheduleBatch();
|
|
4847
5042
|
return translationPromise;
|
|
4848
5043
|
}
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
if (this._batchTimer) {
|
|
4854
|
-
clearTimeout(this._batchTimer);
|
|
4855
|
-
this._batchTimer = null;
|
|
5044
|
+
flushNow() {
|
|
5045
|
+
if (this.batchTimer) {
|
|
5046
|
+
clearTimeout(this.batchTimer);
|
|
5047
|
+
this.batchTimer = null;
|
|
4856
5048
|
}
|
|
4857
|
-
this.
|
|
4858
|
-
}
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
this.
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
* Drain the queue
|
|
4871
|
-
*/
|
|
4872
|
-
_drainQueue() {
|
|
4873
|
-
while (this._queue.length > 0 && this._activeRequests < this._batchConfig.maxConcurrentRequests) {
|
|
4874
|
-
const batch = this._queue.splice(0, this._batchConfig.maxBatchSize);
|
|
4875
|
-
this._sendBatchRequest(batch);
|
|
5049
|
+
this.drainQueue();
|
|
5050
|
+
}
|
|
5051
|
+
scheduleBatch() {
|
|
5052
|
+
if (this.batchTimer) return;
|
|
5053
|
+
this.batchTimer = setTimeout(() => {
|
|
5054
|
+
this.batchTimer = null;
|
|
5055
|
+
this.drainQueue();
|
|
5056
|
+
}, this.batchConfig.batchInterval);
|
|
5057
|
+
}
|
|
5058
|
+
drainQueue() {
|
|
5059
|
+
while (this.queue.length > 0 && this.activeRequests < this.batchConfig.maxConcurrentRequests) {
|
|
5060
|
+
const batch = this.queue.splice(0, this.batchConfig.maxBatchSize);
|
|
5061
|
+
this.sendBatchRequest(batch);
|
|
4876
5062
|
}
|
|
4877
|
-
if (this.
|
|
5063
|
+
if (this.queue.length > 0) this.scheduleBatch();
|
|
4878
5064
|
}
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
* @param {TranslationKey<TranslationValue>} key - The translation key
|
|
4882
|
-
* @returns {Promise<TranslationValue>} The translation promise
|
|
4883
|
-
*/
|
|
4884
|
-
_enqueueTranslation(key) {
|
|
4885
|
-
const hash = this.genKey(key);
|
|
5065
|
+
enqueueTranslation(key) {
|
|
5066
|
+
const hash = this.getCacheKey(key);
|
|
4886
5067
|
const options = key.options;
|
|
4887
5068
|
const metadataOptions = options;
|
|
4888
5069
|
return new Promise((resolve, reject) => {
|
|
4889
|
-
this.
|
|
5070
|
+
this.queue.push({
|
|
4890
5071
|
key: hash,
|
|
4891
5072
|
source: key.message,
|
|
4892
5073
|
metadata: {
|
|
@@ -4901,38 +5082,28 @@ var TranslationsCache = class extends Cache {
|
|
|
4901
5082
|
});
|
|
4902
5083
|
});
|
|
4903
5084
|
}
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
* @param {QueueEntry<TranslationValue>[]} batch - The batch of requests to send
|
|
4907
|
-
*/
|
|
4908
|
-
async _sendBatchRequest(batch) {
|
|
4909
|
-
this._activeRequests++;
|
|
5085
|
+
async sendBatchRequest(batch) {
|
|
5086
|
+
this.activeRequests++;
|
|
4910
5087
|
const requests = convertBatchToTranslateManyParams(batch);
|
|
4911
|
-
const response = await this.
|
|
4912
|
-
if (response) this.
|
|
4913
|
-
this.
|
|
5088
|
+
const response = await this.sendBatchRequestWithErrorHandling(batch, requests);
|
|
5089
|
+
if (response) this.handleTranslationResponse(batch, response);
|
|
5090
|
+
this.activeRequests--;
|
|
4914
5091
|
}
|
|
4915
|
-
|
|
4916
|
-
* Send a translation request with error handling
|
|
4917
|
-
*/
|
|
4918
|
-
async _sendBatchRequestWithErrorHandling(batch, requests) {
|
|
5092
|
+
async sendBatchRequestWithErrorHandling(batch, requests) {
|
|
4919
5093
|
try {
|
|
4920
|
-
return await this.
|
|
5094
|
+
return await this.translateMany(requests);
|
|
4921
5095
|
} catch (error) {
|
|
4922
5096
|
for (const entry of batch) entry.reject(error);
|
|
4923
5097
|
return;
|
|
4924
5098
|
}
|
|
4925
5099
|
}
|
|
4926
|
-
|
|
4927
|
-
* Handle a translation response
|
|
4928
|
-
*/
|
|
4929
|
-
_handleTranslationResponse(batch, response) {
|
|
5100
|
+
handleTranslationResponse(batch, response) {
|
|
4930
5101
|
for (const entry of batch) {
|
|
4931
5102
|
const { key } = entry;
|
|
4932
5103
|
const result = response[key];
|
|
4933
5104
|
if (result && result.success) {
|
|
4934
5105
|
const translation = result.translation;
|
|
4935
|
-
this.
|
|
5106
|
+
this.cache[key] = translation;
|
|
4936
5107
|
entry.resolve(translation);
|
|
4937
5108
|
} else entry.reject(result?.error);
|
|
4938
5109
|
}
|
|
@@ -4950,415 +5121,87 @@ function convertBatchToTranslateManyParams(batch) {
|
|
|
4950
5121
|
return acc;
|
|
4951
5122
|
}, {});
|
|
4952
5123
|
}
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
* @param {CreateTranslateMany} params.createTranslateMany - Factory function for creating a translate many function
|
|
4968
|
-
*/
|
|
4969
|
-
constructor({ init = {}, ttl, batchConfig, loadTranslations, createTranslateMany, lifecycle: { onLocalesCacheHit: onHit, onLocalesCacheMiss: onMiss, onTranslationsCacheHit, onTranslationsCacheMiss } }) {
|
|
4970
|
-
super(init, {
|
|
4971
|
-
onHit,
|
|
4972
|
-
onMiss
|
|
5124
|
+
var LocalesCache = class {
|
|
5125
|
+
constructor({ ttl, batchConfig, defaultLocale, dictionary = {}, loadTranslations, loadDictionary, createTranslateMany, translateDictionaryEntry, lifecycle }) {
|
|
5126
|
+
this.translations = new ResourceCache({
|
|
5127
|
+
ttl,
|
|
5128
|
+
load: async (locale) => new TranslationsCache({
|
|
5129
|
+
init: await loadTranslations(locale),
|
|
5130
|
+
lifecycle: createTranslationsCacheLifecycle(locale, lifecycle),
|
|
5131
|
+
translateMany: createTranslateMany(locale),
|
|
5132
|
+
batchConfig
|
|
5133
|
+
}),
|
|
5134
|
+
lifecycle: {
|
|
5135
|
+
onHit: lifecycle.onLocalesCacheHit,
|
|
5136
|
+
onMiss: lifecycle.onLocalesCacheMiss
|
|
5137
|
+
}
|
|
4973
5138
|
});
|
|
4974
|
-
this.
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
*/
|
|
4987
|
-
get(key) {
|
|
4988
|
-
const entry = this.getCache(key);
|
|
4989
|
-
if (!entry || entry.expiresAt > 0 && entry.expiresAt < Date.now()) return;
|
|
4990
|
-
const value = entry.translationsCache;
|
|
4991
|
-
if (value != null && this.onHit) this.onHit({
|
|
4992
|
-
inputKey: key,
|
|
4993
|
-
cacheKey: this.genKey(key),
|
|
4994
|
-
cacheValue: entry,
|
|
4995
|
-
outputValue: value
|
|
5139
|
+
this.dictionaries = new ResourceCache({
|
|
5140
|
+
ttl,
|
|
5141
|
+
load: async (locale) => createDictionaryCache({
|
|
5142
|
+
locale,
|
|
5143
|
+
dictionary: await loadDictionary(locale),
|
|
5144
|
+
translate: translateDictionaryEntry,
|
|
5145
|
+
lifecycle
|
|
5146
|
+
}),
|
|
5147
|
+
lifecycle: {
|
|
5148
|
+
onHit: lifecycle.onLocalesDictionaryCacheHit,
|
|
5149
|
+
onMiss: lifecycle.onLocalesDictionaryCacheMiss
|
|
5150
|
+
}
|
|
4996
5151
|
});
|
|
4997
|
-
|
|
5152
|
+
this.dictionaries.set(defaultLocale, createDictionaryCache({
|
|
5153
|
+
locale: defaultLocale,
|
|
5154
|
+
dictionary,
|
|
5155
|
+
translate: translateDictionaryEntry,
|
|
5156
|
+
lifecycle
|
|
5157
|
+
}), { expiresAt: -1 });
|
|
4998
5158
|
}
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
* @param key - The locale
|
|
5002
|
-
* @returns The translations cache
|
|
5003
|
-
*/
|
|
5004
|
-
async miss(key) {
|
|
5005
|
-
const cacheValue = await this.missCache(key);
|
|
5006
|
-
const value = cacheValue.translationsCache;
|
|
5007
|
-
if (value != null && this.onMiss) this.onMiss({
|
|
5008
|
-
inputKey: key,
|
|
5009
|
-
cacheKey: this.genKey(key),
|
|
5010
|
-
cacheValue,
|
|
5011
|
-
outputValue: value
|
|
5012
|
-
});
|
|
5013
|
-
return value;
|
|
5159
|
+
getTranslations(locale) {
|
|
5160
|
+
return this.translations.get(locale);
|
|
5014
5161
|
}
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
* @param key - The locale
|
|
5018
|
-
* @returns The cache key
|
|
5019
|
-
*
|
|
5020
|
-
* This is just an identity function, no transformation needed
|
|
5021
|
-
*/
|
|
5022
|
-
genKey(key) {
|
|
5023
|
-
return key;
|
|
5162
|
+
getOrLoadTranslations(locale) {
|
|
5163
|
+
return this.translations.getOrLoad(locale);
|
|
5024
5164
|
}
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
* @param locale - The locale
|
|
5028
|
-
* @returns The cache entry
|
|
5029
|
-
*/
|
|
5030
|
-
async fallback(locale) {
|
|
5031
|
-
return {
|
|
5032
|
-
translationsCache: new TranslationsCache({
|
|
5033
|
-
init: await this._translationLoader(locale),
|
|
5034
|
-
lifecycle: this._createTranslationsCacheLifecycle(locale),
|
|
5035
|
-
translateMany: this._createTranslateMany(locale),
|
|
5036
|
-
batchConfig: this._batchConfig
|
|
5037
|
-
}),
|
|
5038
|
-
expiresAt: this.ttl < 0 ? this.ttl : Date.now() + this.ttl
|
|
5039
|
-
};
|
|
5165
|
+
getDictionary(locale) {
|
|
5166
|
+
return this.dictionaries.get(locale);
|
|
5040
5167
|
}
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
* @param locale - The locale
|
|
5044
|
-
* @returns The translations cache lifecycle
|
|
5045
|
-
*/
|
|
5046
|
-
_createTranslationsCacheLifecycle(locale) {
|
|
5047
|
-
return {
|
|
5048
|
-
onHit: this._onTranslationsCacheHit ? (params) => this._onTranslationsCacheHit({
|
|
5049
|
-
locale,
|
|
5050
|
-
...params
|
|
5051
|
-
}) : void 0,
|
|
5052
|
-
onMiss: this._onTranslationsCacheMiss ? (params) => this._onTranslationsCacheMiss({
|
|
5053
|
-
locale,
|
|
5054
|
-
...params
|
|
5055
|
-
}) : void 0
|
|
5056
|
-
};
|
|
5168
|
+
getOrLoadDictionary(locale) {
|
|
5169
|
+
return this.dictionaries.getOrLoad(locale);
|
|
5057
5170
|
}
|
|
5058
5171
|
};
|
|
5059
|
-
function
|
|
5060
|
-
if (!id) return [];
|
|
5061
|
-
return id.split(".");
|
|
5062
|
-
}
|
|
5063
|
-
function isDictionaryValue(value) {
|
|
5064
|
-
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
5065
|
-
}
|
|
5066
|
-
function getDictionaryEntry(value) {
|
|
5067
|
-
if (!isDictionaryLeafNode(value)) return;
|
|
5172
|
+
function createTranslationsCacheLifecycle(locale, lifecycle) {
|
|
5068
5173
|
return {
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
};
|
|
5072
|
-
}
|
|
5073
|
-
function getDictionaryValue(value) {
|
|
5074
|
-
if (Object.keys(value.options).length === 0) return value.entry;
|
|
5075
|
-
return [value.entry, value.options];
|
|
5076
|
-
}
|
|
5077
|
-
function resolveDictionaryLookupOptions(options) {
|
|
5078
|
-
const { $format, ...rest } = options;
|
|
5079
|
-
return {
|
|
5080
|
-
...rest,
|
|
5081
|
-
$format: isStringFormat($format) ? $format : "ICU",
|
|
5082
|
-
...rest.$context === void 0 && typeof rest.context === "string" && { $context: rest.context }
|
|
5174
|
+
onHit: withLocale(locale, lifecycle.onTranslationsCacheHit),
|
|
5175
|
+
onMiss: withLocale(locale, lifecycle.onTranslationsCacheMiss)
|
|
5083
5176
|
};
|
|
5084
5177
|
}
|
|
5085
|
-
function
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
}
|
|
5096
|
-
function isStringFormat(value) {
|
|
5097
|
-
return value === "ICU" || value === "I18NEXT" || value === "STRING";
|
|
5178
|
+
function createDictionaryCache({ locale, dictionary, translate, lifecycle }) {
|
|
5179
|
+
const { onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit } = lifecycle;
|
|
5180
|
+
return new DictionaryCache({
|
|
5181
|
+
init: dictionary,
|
|
5182
|
+
runtimeTranslate: (key, sourceEntry) => translate(locale, key, sourceEntry),
|
|
5183
|
+
lifecycle: {
|
|
5184
|
+
onHit: withLocale(locale, onDictionaryCacheHit),
|
|
5185
|
+
onMiss: withLocale(locale, onDictionaryCacheMiss),
|
|
5186
|
+
onDictionaryObjectCacheHit: withLocale(locale, onDictionaryObjectCacheHit)
|
|
5187
|
+
}
|
|
5188
|
+
});
|
|
5098
5189
|
}
|
|
5099
|
-
function
|
|
5100
|
-
|
|
5101
|
-
|
|
5190
|
+
function withLocale(locale, callback) {
|
|
5191
|
+
return callback ? (params) => callback({
|
|
5192
|
+
locale,
|
|
5193
|
+
...params
|
|
5194
|
+
}) : void 0;
|
|
5102
5195
|
}
|
|
5103
|
-
|
|
5104
|
-
constructor(id) {
|
|
5105
|
-
super(`I18nManager: source dictionary entry ${id} is not defined`);
|
|
5106
|
-
this.name = "DictionarySourceNotFoundError";
|
|
5107
|
-
}
|
|
5108
|
-
};
|
|
5109
|
-
/**
|
|
5110
|
-
* A cache for a single locale's dictionary
|
|
5111
|
-
*
|
|
5112
|
-
* Principles:
|
|
5113
|
-
* - This class is language agnostic, and should never store the locale code as a parameter.
|
|
5114
|
-
* Locale logic is handled at the LocalesDictionaryCache level. Use a callback function
|
|
5115
|
-
* that has the locale parameter embedded if you wish to use the locale code.
|
|
5116
|
-
*/
|
|
5117
|
-
var DictionaryCache = class extends Cache {
|
|
5118
|
-
/**
|
|
5119
|
-
* Constructor
|
|
5120
|
-
* @param {Object} params - The parameters for the cache
|
|
5121
|
-
* @param {Dictionary} params.init - The initial cache
|
|
5122
|
-
*/
|
|
5123
|
-
constructor({ init, lifecycle, runtimeTranslate }) {
|
|
5124
|
-
super(init, lifecycle);
|
|
5125
|
-
this._runtimeTranslate = runtimeTranslate;
|
|
5126
|
-
this.onHitObj = lifecycle?.onHitObj;
|
|
5127
|
-
this.onMissObj = lifecycle?.onMissObj;
|
|
5128
|
-
}
|
|
5129
|
-
/**
|
|
5130
|
-
* Get the dictionary value for a given key
|
|
5131
|
-
* @param key - The dictionary key
|
|
5132
|
-
* @returns The dictionary value
|
|
5133
|
-
*/
|
|
5134
|
-
get(key) {
|
|
5135
|
-
const value = this.getCache(key);
|
|
5136
|
-
const entry = getDictionaryEntry(value);
|
|
5137
|
-
if (entry === void 0) return;
|
|
5138
|
-
if (this.onHit) this.onHit({
|
|
5139
|
-
inputKey: key,
|
|
5140
|
-
cacheKey: this.genKey(key),
|
|
5141
|
-
cacheValue: value,
|
|
5142
|
-
outputValue: entry
|
|
5143
|
-
});
|
|
5144
|
-
return entry;
|
|
5145
|
-
}
|
|
5146
|
-
set(key, value) {
|
|
5147
|
-
const dictionaryValue = getDictionaryValue(value);
|
|
5148
|
-
this.setCache(this.genKey(key), dictionaryValue);
|
|
5149
|
-
}
|
|
5150
|
-
getObj(key) {
|
|
5151
|
-
const value = this.getCache(key);
|
|
5152
|
-
if (value === void 0) return;
|
|
5153
|
-
const outputValue = structuredClone(value);
|
|
5154
|
-
if (this.onHitObj) this.onHitObj({
|
|
5155
|
-
inputKey: key,
|
|
5156
|
-
cacheKey: this.genKey(key),
|
|
5157
|
-
cacheValue: value,
|
|
5158
|
-
outputValue
|
|
5159
|
-
});
|
|
5160
|
-
return outputValue;
|
|
5161
|
-
}
|
|
5162
|
-
setObj(key, value) {
|
|
5163
|
-
this.setCache(this.genKey(key), structuredClone(value));
|
|
5164
|
-
}
|
|
5165
|
-
async missObj(key, sourceObject) {
|
|
5166
|
-
const sourceEntry = getDictionaryEntry(sourceObject);
|
|
5167
|
-
if (sourceEntry !== void 0) return getDictionaryValue(await this.miss(key, sourceEntry));
|
|
5168
|
-
if (!isDictionaryValue(sourceObject)) throw new DictionarySourceNotFoundError(key);
|
|
5169
|
-
const translatedEntries = await Promise.all(Object.entries(sourceObject).map(async ([childKey, childSource]) => {
|
|
5170
|
-
const childPath = key ? `${key}.${childKey}` : childKey;
|
|
5171
|
-
return [childKey, await this.missObj(childPath, childSource)];
|
|
5172
|
-
}));
|
|
5173
|
-
const translatedObject = Object.fromEntries(translatedEntries);
|
|
5174
|
-
this.setObj(key, translatedObject);
|
|
5175
|
-
return translatedObject;
|
|
5176
|
-
}
|
|
5177
|
-
/**
|
|
5178
|
-
* Miss the cache
|
|
5179
|
-
* @param key - The dictionary key
|
|
5180
|
-
* @returns The dictionary value
|
|
5181
|
-
*/
|
|
5182
|
-
async miss(key, sourceEntry) {
|
|
5183
|
-
const value = await this.missCache(key, sourceEntry);
|
|
5184
|
-
const entry = getDictionaryEntry(value);
|
|
5185
|
-
if (entry === void 0) throw new Error("DictionaryCache missCache did not return a DictionaryEntry");
|
|
5186
|
-
if (this.onMiss) this.onMiss({
|
|
5187
|
-
inputKey: key,
|
|
5188
|
-
cacheKey: this.genKey(key),
|
|
5189
|
-
cacheValue: value,
|
|
5190
|
-
outputValue: entry
|
|
5191
|
-
});
|
|
5192
|
-
return entry;
|
|
5193
|
-
}
|
|
5194
|
-
/**
|
|
5195
|
-
* Set the value for a key
|
|
5196
|
-
*/
|
|
5197
|
-
setCache(cacheKey, value) {
|
|
5198
|
-
const cache = this.getMutableCache();
|
|
5199
|
-
const dictionaryPath = getDictionaryPath(cacheKey);
|
|
5200
|
-
if (dictionaryPath.length === 0) {
|
|
5201
|
-
if (isDictionaryValue(value)) replaceDictionary(cache, value);
|
|
5202
|
-
return;
|
|
5203
|
-
}
|
|
5204
|
-
let current = cache;
|
|
5205
|
-
for (const key of dictionaryPath.slice(0, -1)) {
|
|
5206
|
-
const next = current[key];
|
|
5207
|
-
if (!isDictionaryValue(next)) current[key] = {};
|
|
5208
|
-
current = current[key];
|
|
5209
|
-
}
|
|
5210
|
-
current[dictionaryPath[dictionaryPath.length - 1]] = value;
|
|
5211
|
-
}
|
|
5212
|
-
/**
|
|
5213
|
-
* Look up the key
|
|
5214
|
-
*/
|
|
5215
|
-
getCache(key) {
|
|
5216
|
-
const dictionaryPath = getDictionaryPath(this.genKey(key));
|
|
5217
|
-
let current = this.getMutableCache();
|
|
5218
|
-
if (dictionaryPath.length === 0) return current;
|
|
5219
|
-
for (const pathSegment of dictionaryPath) {
|
|
5220
|
-
if (!isDictionaryValue(current)) return;
|
|
5221
|
-
current = current[pathSegment];
|
|
5222
|
-
}
|
|
5223
|
-
return current;
|
|
5224
|
-
}
|
|
5225
|
-
/**
|
|
5226
|
-
* Generate a key for the cache
|
|
5227
|
-
* @param key - The dictionary key
|
|
5228
|
-
* @returns The key
|
|
5229
|
-
*/
|
|
5230
|
-
genKey(key) {
|
|
5231
|
-
return key;
|
|
5232
|
-
}
|
|
5233
|
-
/**
|
|
5234
|
-
* Get the fallback value for a cache miss
|
|
5235
|
-
* @param key - The dictionary key
|
|
5236
|
-
* @returns The fallback value
|
|
5237
|
-
*
|
|
5238
|
-
* @throws {Error} - If the fallback is not implemented
|
|
5239
|
-
*/
|
|
5240
|
-
fallback(key, sourceEntry) {
|
|
5241
|
-
return this._runtimeTranslate(key, sourceEntry);
|
|
5242
|
-
}
|
|
5243
|
-
};
|
|
5244
|
-
/**
|
|
5245
|
-
* Cache for looking up dictionaries by locale
|
|
5246
|
-
*/
|
|
5247
|
-
var LocalesDictionaryCache = class extends Cache {
|
|
5248
|
-
/**
|
|
5249
|
-
* Constructor
|
|
5250
|
-
* @param {Object} params - The parameters for the cache
|
|
5251
|
-
* @param {number | null} params.ttl - The time to live for cache entries
|
|
5252
|
-
* @param {DictionaryLoader} params.loadDictionary - The dictionary loader function
|
|
5253
|
-
*/
|
|
5254
|
-
constructor({ ttl, defaultLocale, dictionary = {}, loadDictionary, runtimeTranslate, lifecycle: { onLocalesDictionaryCacheHit: onHit, onLocalesDictionaryCacheMiss: onMiss, onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit } }) {
|
|
5255
|
-
super({}, {
|
|
5256
|
-
onHit,
|
|
5257
|
-
onMiss
|
|
5258
|
-
});
|
|
5259
|
-
this.ttl = DEFAULT_CACHE_EXPIRY_TIME;
|
|
5260
|
-
this.ttl = ttl === null ? -1 : ttl ?? 6e4;
|
|
5261
|
-
this._dictionaryLoader = loadDictionary;
|
|
5262
|
-
this._runtimeTranslate = runtimeTranslate;
|
|
5263
|
-
this._onDictionaryCacheHit = onDictionaryCacheHit;
|
|
5264
|
-
this._onDictionaryCacheMiss = onDictionaryCacheMiss;
|
|
5265
|
-
this._onDictionaryObjectCacheHit = onDictionaryObjectCacheHit;
|
|
5266
|
-
this.setCache(defaultLocale, {
|
|
5267
|
-
dictionaryCache: new DictionaryCache({
|
|
5268
|
-
init: dictionary,
|
|
5269
|
-
runtimeTranslate: this._createDictionaryRuntimeTranslate(defaultLocale),
|
|
5270
|
-
lifecycle: this._createDictionaryCacheLifecycle(defaultLocale)
|
|
5271
|
-
}),
|
|
5272
|
-
expiresAt: -1
|
|
5273
|
-
});
|
|
5274
|
-
}
|
|
5275
|
-
/**
|
|
5276
|
-
* Get the dictionary for a given locale
|
|
5277
|
-
* @param key - The locale
|
|
5278
|
-
* @returns The dictionary
|
|
5279
|
-
*/
|
|
5280
|
-
get(key) {
|
|
5281
|
-
const entry = this.getCache(key);
|
|
5282
|
-
if (!entry || entry.expiresAt > 0 && entry.expiresAt < Date.now()) return;
|
|
5283
|
-
const value = entry.dictionaryCache;
|
|
5284
|
-
if (value != null && this.onHit) this.onHit({
|
|
5285
|
-
inputKey: key,
|
|
5286
|
-
cacheKey: this.genKey(key),
|
|
5287
|
-
cacheValue: entry,
|
|
5288
|
-
outputValue: value
|
|
5289
|
-
});
|
|
5290
|
-
return value;
|
|
5291
|
-
}
|
|
5292
|
-
/**
|
|
5293
|
-
* Miss the cache
|
|
5294
|
-
* @param key - The locale
|
|
5295
|
-
* @returns The dictionary cache
|
|
5296
|
-
*/
|
|
5297
|
-
async miss(key) {
|
|
5298
|
-
const cacheValue = await this.missCache(key);
|
|
5299
|
-
const value = cacheValue.dictionaryCache;
|
|
5300
|
-
if (value != null && this.onMiss) this.onMiss({
|
|
5301
|
-
inputKey: key,
|
|
5302
|
-
cacheKey: this.genKey(key),
|
|
5303
|
-
cacheValue,
|
|
5304
|
-
outputValue: value
|
|
5305
|
-
});
|
|
5306
|
-
return value;
|
|
5307
|
-
}
|
|
5308
|
-
/**
|
|
5309
|
-
* Generate the cache key for a given locale
|
|
5310
|
-
* @param key - The locale
|
|
5311
|
-
* @returns The cache key
|
|
5312
|
-
*
|
|
5313
|
-
* This is just an identity function, no transformation needed
|
|
5314
|
-
*/
|
|
5315
|
-
genKey(key) {
|
|
5316
|
-
return key;
|
|
5317
|
-
}
|
|
5318
|
-
/**
|
|
5319
|
-
* Fallback for a cache miss
|
|
5320
|
-
* @param locale - The locale
|
|
5321
|
-
* @returns The cache entry
|
|
5322
|
-
*/
|
|
5323
|
-
async fallback(locale) {
|
|
5324
|
-
return {
|
|
5325
|
-
dictionaryCache: new DictionaryCache({
|
|
5326
|
-
init: await this._dictionaryLoader(locale),
|
|
5327
|
-
runtimeTranslate: this._createDictionaryRuntimeTranslate(locale),
|
|
5328
|
-
lifecycle: this._createDictionaryCacheLifecycle(locale)
|
|
5329
|
-
}),
|
|
5330
|
-
expiresAt: this.ttl < 0 ? this.ttl : Date.now() + this.ttl
|
|
5331
|
-
};
|
|
5332
|
-
}
|
|
5333
|
-
/**
|
|
5334
|
-
* Create the dictionary cache lifecycle
|
|
5335
|
-
* @param locale - The locale
|
|
5336
|
-
* @returns The dictionary cache lifecycle
|
|
5337
|
-
*/
|
|
5338
|
-
_createDictionaryCacheLifecycle(locale) {
|
|
5339
|
-
return {
|
|
5340
|
-
onHit: this._onDictionaryCacheHit ? (params) => this._onDictionaryCacheHit({
|
|
5341
|
-
locale,
|
|
5342
|
-
...params
|
|
5343
|
-
}) : void 0,
|
|
5344
|
-
onMiss: this._onDictionaryCacheMiss ? (params) => this._onDictionaryCacheMiss({
|
|
5345
|
-
locale,
|
|
5346
|
-
...params
|
|
5347
|
-
}) : void 0,
|
|
5348
|
-
onHitObj: this._onDictionaryObjectCacheHit ? (params) => this._onDictionaryObjectCacheHit({
|
|
5349
|
-
locale,
|
|
5350
|
-
...params
|
|
5351
|
-
}) : void 0
|
|
5352
|
-
};
|
|
5353
|
-
}
|
|
5354
|
-
_createDictionaryRuntimeTranslate(locale) {
|
|
5355
|
-
return (key, sourceEntry) => this._runtimeTranslate(locale, key, sourceEntry);
|
|
5356
|
-
}
|
|
5357
|
-
};
|
|
5196
|
+
const LOCALES_CACHE_HIT_EVENT_NAME = "locales-cache-hit";
|
|
5358
5197
|
const LOCALES_CACHE_MISS_EVENT_NAME = "locales-cache-miss";
|
|
5198
|
+
const TRANSLATIONS_CACHE_HIT_EVENT_NAME = "translations-cache-hit";
|
|
5359
5199
|
const TRANSLATIONS_CACHE_MISS_EVENT_NAME = "translations-cache-miss";
|
|
5200
|
+
const LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME = "locales-dictionary-cache-hit";
|
|
5360
5201
|
const LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME = "locales-dictionary-cache-miss";
|
|
5202
|
+
const DICTIONARY_CACHE_HIT_EVENT_NAME = "dictionary-cache-hit";
|
|
5361
5203
|
const DICTIONARY_CACHE_MISS_EVENT_NAME = "dictionary-cache-miss";
|
|
5204
|
+
const DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME = "dictionary-object-cache-hit";
|
|
5362
5205
|
/**
|
|
5363
5206
|
* Maps consumer-facing lifecycle callbacks to internal locales cache lifecycle callbacks.
|
|
5364
5207
|
* The consumer API exposes simplified params (locale, hash, value) while the internal
|
|
@@ -5366,22 +5209,24 @@ const DICTIONARY_CACHE_MISS_EVENT_NAME = "dictionary-cache-miss";
|
|
|
5366
5209
|
*
|
|
5367
5210
|
* @deprecated - move to subscription api instead
|
|
5368
5211
|
*/
|
|
5369
|
-
function createLifecycleCallbacks(emit) {
|
|
5212
|
+
function createLifecycleCallbacks(emit, hasListeners = () => true) {
|
|
5370
5213
|
return {
|
|
5371
5214
|
onLocalesCacheHit: (params) => {
|
|
5372
|
-
|
|
5215
|
+
if (!hasListeners("locales-cache-hit")) return;
|
|
5216
|
+
emit(LOCALES_CACHE_HIT_EVENT_NAME, {
|
|
5373
5217
|
locale: params.inputKey,
|
|
5374
5218
|
translations: params.outputValue.getInternalCache()
|
|
5375
5219
|
});
|
|
5376
5220
|
},
|
|
5377
5221
|
onLocalesCacheMiss: (params) => {
|
|
5222
|
+
if (!hasListeners("locales-cache-miss")) return;
|
|
5378
5223
|
emit(LOCALES_CACHE_MISS_EVENT_NAME, {
|
|
5379
5224
|
locale: params.inputKey,
|
|
5380
5225
|
translations: params.outputValue.getInternalCache()
|
|
5381
5226
|
});
|
|
5382
5227
|
},
|
|
5383
5228
|
onTranslationsCacheHit: (params) => {
|
|
5384
|
-
emit(
|
|
5229
|
+
emit(TRANSLATIONS_CACHE_HIT_EVENT_NAME, {
|
|
5385
5230
|
locale: params.locale,
|
|
5386
5231
|
hash: params.cacheKey,
|
|
5387
5232
|
translation: params.outputValue
|
|
@@ -5395,19 +5240,21 @@ function createLifecycleCallbacks(emit) {
|
|
|
5395
5240
|
});
|
|
5396
5241
|
},
|
|
5397
5242
|
onLocalesDictionaryCacheHit: (params) => {
|
|
5398
|
-
|
|
5243
|
+
if (!hasListeners("locales-dictionary-cache-hit")) return;
|
|
5244
|
+
emit(LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME, {
|
|
5399
5245
|
locale: params.inputKey,
|
|
5400
5246
|
dictionary: params.outputValue.getInternalCache()
|
|
5401
5247
|
});
|
|
5402
5248
|
},
|
|
5403
5249
|
onLocalesDictionaryCacheMiss: (params) => {
|
|
5250
|
+
if (!hasListeners("locales-dictionary-cache-miss")) return;
|
|
5404
5251
|
emit(LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME, {
|
|
5405
5252
|
locale: params.inputKey,
|
|
5406
5253
|
dictionary: params.outputValue.getInternalCache()
|
|
5407
5254
|
});
|
|
5408
5255
|
},
|
|
5409
5256
|
onDictionaryCacheHit: (params) => {
|
|
5410
|
-
emit(
|
|
5257
|
+
emit(DICTIONARY_CACHE_HIT_EVENT_NAME, {
|
|
5411
5258
|
locale: params.locale,
|
|
5412
5259
|
id: params.cacheKey,
|
|
5413
5260
|
dictionaryEntry: params.outputValue
|
|
@@ -5421,7 +5268,7 @@ function createLifecycleCallbacks(emit) {
|
|
|
5421
5268
|
});
|
|
5422
5269
|
},
|
|
5423
5270
|
onDictionaryObjectCacheHit: (params) => {
|
|
5424
|
-
emit(
|
|
5271
|
+
emit(DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME, {
|
|
5425
5272
|
locale: params.locale,
|
|
5426
5273
|
id: params.cacheKey,
|
|
5427
5274
|
dictionaryValue: params.outputValue
|
|
@@ -5456,6 +5303,9 @@ var EventEmitter = class {
|
|
|
5456
5303
|
emit(eventName, event) {
|
|
5457
5304
|
this.listeners[eventName]?.forEach((subscriber) => subscriber(event));
|
|
5458
5305
|
}
|
|
5306
|
+
hasListeners(eventName) {
|
|
5307
|
+
return (this.listeners[eventName]?.size ?? 0) > 0;
|
|
5308
|
+
}
|
|
5459
5309
|
};
|
|
5460
5310
|
/**
|
|
5461
5311
|
* Subscribes to the lifecycle callbacks and emits the events to the event emitter
|
|
@@ -5465,7 +5315,7 @@ var EventEmitter = class {
|
|
|
5465
5315
|
* and is only used internally
|
|
5466
5316
|
*/
|
|
5467
5317
|
function subscribeLifecycleCallbacks({ onLocalesCacheHit, onLocalesCacheMiss, onTranslationsCacheHit, onTranslationsCacheMiss, onLocalesDictionaryCacheHit, onLocalesDictionaryCacheMiss, onDictionaryCacheHit, onDictionaryCacheMiss, onDictionaryObjectCacheHit }, subscribe) {
|
|
5468
|
-
if (onLocalesCacheHit) subscribe(
|
|
5318
|
+
if (onLocalesCacheHit) subscribe(LOCALES_CACHE_HIT_EVENT_NAME, (event) => {
|
|
5469
5319
|
onLocalesCacheHit({
|
|
5470
5320
|
...event,
|
|
5471
5321
|
value: event.translations
|
|
@@ -5477,7 +5327,7 @@ function subscribeLifecycleCallbacks({ onLocalesCacheHit, onLocalesCacheMiss, on
|
|
|
5477
5327
|
value: event.translations
|
|
5478
5328
|
});
|
|
5479
5329
|
});
|
|
5480
|
-
if (onTranslationsCacheHit) subscribe(
|
|
5330
|
+
if (onTranslationsCacheHit) subscribe(TRANSLATIONS_CACHE_HIT_EVENT_NAME, (event) => {
|
|
5481
5331
|
onTranslationsCacheHit({
|
|
5482
5332
|
...event,
|
|
5483
5333
|
value: event.translation
|
|
@@ -5489,19 +5339,19 @@ function subscribeLifecycleCallbacks({ onLocalesCacheHit, onLocalesCacheMiss, on
|
|
|
5489
5339
|
value: event.translation
|
|
5490
5340
|
});
|
|
5491
5341
|
});
|
|
5492
|
-
if (onLocalesDictionaryCacheHit) subscribe(
|
|
5342
|
+
if (onLocalesDictionaryCacheHit) subscribe(LOCALES_DICTIONARY_CACHE_HIT_EVENT_NAME, (event) => {
|
|
5493
5343
|
onLocalesDictionaryCacheHit(event);
|
|
5494
5344
|
});
|
|
5495
5345
|
if (onLocalesDictionaryCacheMiss) subscribe(LOCALES_DICTIONARY_CACHE_MISS_EVENT_NAME, (event) => {
|
|
5496
5346
|
onLocalesDictionaryCacheMiss(event);
|
|
5497
5347
|
});
|
|
5498
|
-
if (onDictionaryCacheHit) subscribe(
|
|
5348
|
+
if (onDictionaryCacheHit) subscribe(DICTIONARY_CACHE_HIT_EVENT_NAME, (event) => {
|
|
5499
5349
|
onDictionaryCacheHit(event);
|
|
5500
5350
|
});
|
|
5501
5351
|
if (onDictionaryCacheMiss) subscribe(DICTIONARY_CACHE_MISS_EVENT_NAME, (event) => {
|
|
5502
5352
|
onDictionaryCacheMiss(event);
|
|
5503
5353
|
});
|
|
5504
|
-
if (onDictionaryObjectCacheHit) subscribe(
|
|
5354
|
+
if (onDictionaryObjectCacheHit) subscribe(DICTIONARY_OBJECT_CACHE_HIT_EVENT_NAME, (event) => {
|
|
5505
5355
|
onDictionaryObjectCacheHit(event);
|
|
5506
5356
|
});
|
|
5507
5357
|
}
|
|
@@ -5532,26 +5382,32 @@ var I18nManager = class extends EventEmitter {
|
|
|
5532
5382
|
locales: this.config.locales,
|
|
5533
5383
|
customMapping: this.config.customMapping
|
|
5534
5384
|
});
|
|
5535
|
-
const loadTranslations =
|
|
5536
|
-
|
|
5385
|
+
const loadTranslations = routeCreateTranslationLoader({
|
|
5386
|
+
loadTranslations: params.loadTranslations,
|
|
5387
|
+
type: getLoadTranslationsType(params),
|
|
5388
|
+
remoteTranslationLoaderParams: {
|
|
5389
|
+
cacheUrl: params.cacheUrl,
|
|
5390
|
+
projectId: params.projectId,
|
|
5391
|
+
_versionId: params._versionId,
|
|
5392
|
+
_branchId: params._branchId,
|
|
5393
|
+
customMapping: params.customMapping
|
|
5394
|
+
}
|
|
5395
|
+
});
|
|
5396
|
+
const loadDictionary = params.loadDictionary ?? (() => Promise.resolve({}));
|
|
5537
5397
|
const runtimeTranslationTimeout = this.config.runtimeTranslation?.timeout ?? DEFAULT_TRANSLATION_TIMEOUT;
|
|
5538
5398
|
const runtimeTranslationMetadata = this.config.runtimeTranslation?.metadata ?? {};
|
|
5539
5399
|
const createTranslateMany = createTranslateManyFactory(this.getGTClassClean(), runtimeTranslationTimeout, runtimeTranslationMetadata);
|
|
5540
5400
|
subscribeLifecycleCallbacks(params.lifecycle ?? {}, (...args) => this.subscribe(...args));
|
|
5541
|
-
const lifecycle = createLifecycleCallbacks((...args) => this.emit(...args));
|
|
5401
|
+
const lifecycle = createLifecycleCallbacks((...args) => this.emit(...args), (eventName) => this.hasListeners(eventName));
|
|
5542
5402
|
this.localesCache = new LocalesCache({
|
|
5543
|
-
loadTranslations,
|
|
5544
|
-
createTranslateMany,
|
|
5545
|
-
lifecycle,
|
|
5546
|
-
ttl: this.config.cacheExpiryTime,
|
|
5547
|
-
batchConfig: this.config.batchConfig
|
|
5548
|
-
});
|
|
5549
|
-
this.localesDictionaryCache = new LocalesDictionaryCache({
|
|
5550
5403
|
defaultLocale: this.config.defaultLocale,
|
|
5551
5404
|
dictionary: params.dictionary,
|
|
5405
|
+
loadTranslations,
|
|
5552
5406
|
loadDictionary,
|
|
5553
|
-
|
|
5407
|
+
createTranslateMany,
|
|
5408
|
+
translateDictionaryEntry: (locale, id, sourceEntry) => this.translateDictionaryEntry(locale, id, sourceEntry),
|
|
5554
5409
|
ttl: this.config.cacheExpiryTime,
|
|
5410
|
+
batchConfig: this.config.batchConfig,
|
|
5555
5411
|
lifecycle
|
|
5556
5412
|
});
|
|
5557
5413
|
}
|
|
@@ -5623,9 +5479,7 @@ var I18nManager = class extends EventEmitter {
|
|
|
5623
5479
|
try {
|
|
5624
5480
|
const translationLocale = this.resolveCacheLocale(locale);
|
|
5625
5481
|
if (!translationLocale) return {};
|
|
5626
|
-
|
|
5627
|
-
if (!txCache) txCache = await this.localesCache.miss(translationLocale);
|
|
5628
|
-
return txCache.getInternalCache();
|
|
5482
|
+
return (await this.localesCache.getOrLoadTranslations(translationLocale)).getInternalCache();
|
|
5629
5483
|
} catch (error) {
|
|
5630
5484
|
this.handleError(error);
|
|
5631
5485
|
return {};
|
|
@@ -5638,10 +5492,8 @@ var I18nManager = class extends EventEmitter {
|
|
|
5638
5492
|
async loadDictionary(locale) {
|
|
5639
5493
|
try {
|
|
5640
5494
|
const dictionaryLocale = this.resolveCacheLocale(locale);
|
|
5641
|
-
if (!dictionaryLocale) return this.
|
|
5642
|
-
|
|
5643
|
-
if (!dictionaryCache) dictionaryCache = await this.localesDictionaryCache.miss(dictionaryLocale);
|
|
5644
|
-
return dictionaryCache.getInternalCache();
|
|
5495
|
+
if (!dictionaryLocale) return this.getDefaultDictionaryCache()?.getInternalCache() ?? {};
|
|
5496
|
+
return (await this.localesCache.getOrLoadDictionary(dictionaryLocale)).getInternalCache();
|
|
5645
5497
|
} catch (error) {
|
|
5646
5498
|
this.handleError(error);
|
|
5647
5499
|
return {};
|
|
@@ -5652,8 +5504,8 @@ var I18nManager = class extends EventEmitter {
|
|
|
5652
5504
|
*/
|
|
5653
5505
|
lookupDictionary(locale, id) {
|
|
5654
5506
|
try {
|
|
5655
|
-
const dictionaryLocale = this.
|
|
5656
|
-
return this.
|
|
5507
|
+
const dictionaryLocale = this.resolveDictionaryCacheLocale(locale);
|
|
5508
|
+
return this.localesCache.getDictionary(dictionaryLocale)?.getEntry(id);
|
|
5657
5509
|
} catch (error) {
|
|
5658
5510
|
this.handleError(error);
|
|
5659
5511
|
return;
|
|
@@ -5664,8 +5516,8 @@ var I18nManager = class extends EventEmitter {
|
|
|
5664
5516
|
*/
|
|
5665
5517
|
lookupDictionaryObj(locale, id) {
|
|
5666
5518
|
try {
|
|
5667
|
-
const dictionaryLocale = this.
|
|
5668
|
-
return this.
|
|
5519
|
+
const dictionaryLocale = this.resolveDictionaryCacheLocale(locale);
|
|
5520
|
+
return this.localesCache.getDictionary(dictionaryLocale)?.getValue(id);
|
|
5669
5521
|
} catch (error) {
|
|
5670
5522
|
this.handleError(error);
|
|
5671
5523
|
return;
|
|
@@ -5678,19 +5530,10 @@ var I18nManager = class extends EventEmitter {
|
|
|
5678
5530
|
async lookupDictionaryWithFallback(locale, id) {
|
|
5679
5531
|
try {
|
|
5680
5532
|
const dictionaryLocale = this.resolveCacheLocale(locale);
|
|
5681
|
-
if (!dictionaryLocale)
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
}
|
|
5686
|
-
let dictionaryCache = this.localesDictionaryCache.get(dictionaryLocale);
|
|
5687
|
-
if (!dictionaryCache) dictionaryCache = await this.localesDictionaryCache.miss(dictionaryLocale);
|
|
5688
|
-
let dictionaryEntry = dictionaryCache.get(id);
|
|
5689
|
-
if (dictionaryEntry === void 0) {
|
|
5690
|
-
const sourceEntry = this.localesDictionaryCache.get(this.config.defaultLocale)?.get(id);
|
|
5691
|
-
if (sourceEntry === void 0) throw new DictionarySourceNotFoundError(id);
|
|
5692
|
-
dictionaryEntry = await dictionaryCache.miss(id, sourceEntry);
|
|
5693
|
-
}
|
|
5533
|
+
if (!dictionaryLocale) return this.getSourceDictionaryEntry(id);
|
|
5534
|
+
const dictionaryCache = await this.localesCache.getOrLoadDictionary(dictionaryLocale);
|
|
5535
|
+
let dictionaryEntry = dictionaryCache.getEntry(id);
|
|
5536
|
+
if (dictionaryEntry === void 0) dictionaryEntry = await dictionaryCache.materializeEntry(id, this.getSourceDictionaryEntry(id));
|
|
5694
5537
|
return dictionaryEntry;
|
|
5695
5538
|
} catch (error) {
|
|
5696
5539
|
this.handleError(error);
|
|
@@ -5704,25 +5547,41 @@ var I18nManager = class extends EventEmitter {
|
|
|
5704
5547
|
async lookupDictionaryObjWithFallback(locale, id) {
|
|
5705
5548
|
try {
|
|
5706
5549
|
const dictionaryLocale = this.resolveCacheLocale(locale);
|
|
5707
|
-
if (!dictionaryLocale)
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5550
|
+
if (!dictionaryLocale) return this.getSourceDictionaryObject(id);
|
|
5551
|
+
const dictionaryCache = await this.localesCache.getOrLoadDictionary(dictionaryLocale);
|
|
5552
|
+
const targetObject = dictionaryCache.getValue(id);
|
|
5553
|
+
const sourceObject = this.getSourceDictionaryObject(id, { throwOnMissing: false });
|
|
5554
|
+
if (sourceObject === void 0) {
|
|
5555
|
+
if (targetObject !== void 0) return targetObject;
|
|
5556
|
+
throw new DictionarySourceNotFoundError(id);
|
|
5711
5557
|
}
|
|
5712
|
-
|
|
5713
|
-
if (!dictionaryCache) dictionaryCache = await this.localesDictionaryCache.miss(dictionaryLocale);
|
|
5714
|
-
let dictionaryObject = dictionaryCache.getObj(id);
|
|
5715
|
-
if (dictionaryObject === void 0) {
|
|
5716
|
-
const sourceObject = this.localesDictionaryCache.get(this.config.defaultLocale)?.getObj(id);
|
|
5717
|
-
if (sourceObject === void 0) throw new DictionarySourceNotFoundError(id);
|
|
5718
|
-
dictionaryObject = await dictionaryCache.missObj(id, sourceObject);
|
|
5719
|
-
}
|
|
5720
|
-
return dictionaryObject;
|
|
5558
|
+
return await dictionaryCache.materializeValue(id, sourceObject, targetObject);
|
|
5721
5559
|
} catch (error) {
|
|
5722
5560
|
this.handleError(error);
|
|
5723
5561
|
return;
|
|
5724
5562
|
}
|
|
5725
5563
|
}
|
|
5564
|
+
async translateDictionaryEntry(locale, id, sourceEntry) {
|
|
5565
|
+
const translation = await this.lookupTranslationWithFallbackResolved(locale, sourceEntry.entry, resolveDictionaryLookupOptions(sourceEntry.options));
|
|
5566
|
+
if (typeof translation !== "string") throw new Error(`Dictionary entry "${id}" could not be translated into a string. Check the source entry and translation loader output.`);
|
|
5567
|
+
return translation;
|
|
5568
|
+
}
|
|
5569
|
+
getSourceDictionaryEntry(id) {
|
|
5570
|
+
const sourceEntry = this.getDefaultDictionaryCache()?.getEntry(id);
|
|
5571
|
+
if (sourceEntry === void 0) throw new DictionarySourceNotFoundError(id);
|
|
5572
|
+
return sourceEntry;
|
|
5573
|
+
}
|
|
5574
|
+
getSourceDictionaryObject(id, { throwOnMissing = true } = {}) {
|
|
5575
|
+
const sourceObject = this.getDefaultDictionaryCache()?.getValue(id);
|
|
5576
|
+
if (sourceObject === void 0 && throwOnMissing) throw new DictionarySourceNotFoundError(id);
|
|
5577
|
+
return sourceObject;
|
|
5578
|
+
}
|
|
5579
|
+
getDefaultDictionaryCache() {
|
|
5580
|
+
return this.localesCache.getDictionary(this.config.defaultLocale);
|
|
5581
|
+
}
|
|
5582
|
+
resolveDictionaryCacheLocale(locale) {
|
|
5583
|
+
return this.resolveCacheLocale(locale) ?? this.config.defaultLocale;
|
|
5584
|
+
}
|
|
5726
5585
|
/**
|
|
5727
5586
|
* Just lookup a translation
|
|
5728
5587
|
*/
|
|
@@ -5730,7 +5589,7 @@ var I18nManager = class extends EventEmitter {
|
|
|
5730
5589
|
try {
|
|
5731
5590
|
const { translationLocale, options: lookupOptions } = this.resolveLookupParams(locale, options);
|
|
5732
5591
|
if (!translationLocale) return message;
|
|
5733
|
-
const txCache = this.localesCache.
|
|
5592
|
+
const txCache = this.localesCache.getTranslations(translationLocale);
|
|
5734
5593
|
if (!txCache) return void 0;
|
|
5735
5594
|
return txCache.get({
|
|
5736
5595
|
message,
|
|
@@ -5768,9 +5627,7 @@ var I18nManager = class extends EventEmitter {
|
|
|
5768
5627
|
if (!translationLocale) return (message) => message;
|
|
5769
5628
|
const resolvedPrefetchEntries = resolvePrefetchEntriesByLocale(prefetchEntries, translationLocale, (entryLocale) => this.resolveCacheLocale(entryLocale) ?? this.resolveLocale(entryLocale));
|
|
5770
5629
|
if (resolvedPrefetchEntries.length !== prefetchEntries.length) logger_default.warn(`I18nManager: getLookupTranslation(): prefetchEntries must all be the same locale, ignoring all entries that are not for ${translationLocale}`);
|
|
5771
|
-
|
|
5772
|
-
if (!txCache) txCache = await this.localesCache.miss(translationLocale);
|
|
5773
|
-
if (!txCache) return () => void 0;
|
|
5630
|
+
const txCache = await this.localesCache.getOrLoadTranslations(translationLocale);
|
|
5774
5631
|
await Promise.all(resolvedPrefetchEntries.filter((entry) => txCache.get(entry) == null).map((entry) => txCache.miss(entry)));
|
|
5775
5632
|
return (message, options = {}) => {
|
|
5776
5633
|
return txCache.get({
|
|
@@ -5872,8 +5729,7 @@ var I18nManager = class extends EventEmitter {
|
|
|
5872
5729
|
async lookupTranslationWithFallbackResolved(locale, message, options) {
|
|
5873
5730
|
const { translationLocale, options: lookupOptions } = this.resolveLookupParams(locale, options);
|
|
5874
5731
|
if (!translationLocale) return message;
|
|
5875
|
-
|
|
5876
|
-
if (!txCache) txCache = await this.localesCache.miss(translationLocale);
|
|
5732
|
+
const txCache = await this.localesCache.getOrLoadTranslations(translationLocale);
|
|
5877
5733
|
let translation = txCache.get({
|
|
5878
5734
|
message,
|
|
5879
5735
|
options: lookupOptions
|
|
@@ -5885,14 +5741,6 @@ var I18nManager = class extends EventEmitter {
|
|
|
5885
5741
|
return translation;
|
|
5886
5742
|
}
|
|
5887
5743
|
/**
|
|
5888
|
-
* Runtime lookup function for dictionaries
|
|
5889
|
-
*/
|
|
5890
|
-
async dictionaryRuntimeTranslate(locale, id, sourceEntry) {
|
|
5891
|
-
const translation = await this.lookupTranslationWithFallbackResolved(locale, sourceEntry.entry, resolveDictionaryLookupOptions(sourceEntry.options));
|
|
5892
|
-
if (typeof translation !== "string") throw new Error(`Dictionary entry "${id}" could not be translated into a string. Check the source entry and translation loader output.`);
|
|
5893
|
-
return translation;
|
|
5894
|
-
}
|
|
5895
|
-
/**
|
|
5896
5744
|
* A helper function to create a gt class that is locale agnostic
|
|
5897
5745
|
* This is helpful for when our getLocale function is bound to a
|
|
5898
5746
|
* specific context
|
|
@@ -5989,28 +5837,6 @@ function resolvePrefetchEntriesByLocale(prefetchEntries, locale, resolveLocale)
|
|
|
5989
5837
|
}
|
|
5990
5838
|
});
|
|
5991
5839
|
}
|
|
5992
|
-
/**
|
|
5993
|
-
* Helper function for creating a translation loader
|
|
5994
|
-
*/
|
|
5995
|
-
function createTranslationLoader(params) {
|
|
5996
|
-
return routeCreateTranslationLoader({
|
|
5997
|
-
loadTranslations: params.loadTranslations,
|
|
5998
|
-
type: getLoadTranslationsType(params),
|
|
5999
|
-
remoteTranslationLoaderParams: {
|
|
6000
|
-
cacheUrl: params.cacheUrl,
|
|
6001
|
-
projectId: params.projectId,
|
|
6002
|
-
_versionId: params._versionId,
|
|
6003
|
-
_branchId: params._branchId,
|
|
6004
|
-
customMapping: params.customMapping
|
|
6005
|
-
}
|
|
6006
|
-
});
|
|
6007
|
-
}
|
|
6008
|
-
/**
|
|
6009
|
-
* Helper function for creating a dictionary loader
|
|
6010
|
-
*/
|
|
6011
|
-
function createDictionaryLoader(params) {
|
|
6012
|
-
return params.loadDictionary ?? (() => Promise.resolve({}));
|
|
6013
|
-
}
|
|
6014
5840
|
let i18nManager = void 0;
|
|
6015
5841
|
let fallbackDefaultLocale = "en";
|
|
6016
5842
|
const fallbackConditionStore = { getLocale: () => fallbackDefaultLocale };
|
|
@@ -6349,7 +6175,7 @@ function S({ source: e, severity: t, whatHappened: n, reassurance: r, why: i, fi
|
|
|
6349
6175
|
let p = f.join(` `);
|
|
6350
6176
|
return l ? `${l} ${p}` : p;
|
|
6351
6177
|
}
|
|
6352
|
-
function
|
|
6178
|
+
function ie(e) {
|
|
6353
6179
|
let t = e;
|
|
6354
6180
|
if (t && typeof t == `object` && typeof t.k == `string`) {
|
|
6355
6181
|
let e = Object.keys(t);
|
|
@@ -6357,43 +6183,43 @@ function E(e) {
|
|
|
6357
6183
|
}
|
|
6358
6184
|
return !1;
|
|
6359
6185
|
}
|
|
6360
|
-
function
|
|
6186
|
+
function ae(e) {
|
|
6361
6187
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === `Uint8Array` && `BYTES_PER_ELEMENT` in e && e.BYTES_PER_ELEMENT === 1;
|
|
6362
6188
|
}
|
|
6363
|
-
function
|
|
6364
|
-
let r =
|
|
6189
|
+
function E(e, t, n = ``) {
|
|
6190
|
+
let r = ae(e), i = e?.length, a = t !== void 0;
|
|
6365
6191
|
if (!r || a && i !== t) {
|
|
6366
6192
|
let o = n && `"${n}" `, s = a ? ` of length ${t}` : ``, c = r ? `length=${i}` : `type=${typeof e}`, l = o + `expected Uint8Array` + s + `, got ` + c;
|
|
6367
6193
|
throw r ? RangeError(l) : TypeError(l);
|
|
6368
6194
|
}
|
|
6369
6195
|
return e;
|
|
6370
6196
|
}
|
|
6371
|
-
function
|
|
6197
|
+
function oe(e, t = !0) {
|
|
6372
6198
|
if (e.destroyed) throw Error(`Hash instance has been destroyed`);
|
|
6373
6199
|
if (t && e.finished) throw Error(`Hash#digest() has already been called`);
|
|
6374
6200
|
}
|
|
6375
|
-
function
|
|
6376
|
-
|
|
6201
|
+
function se(e, t) {
|
|
6202
|
+
E(e, void 0, `digestInto() output`);
|
|
6377
6203
|
let n = t.outputLen;
|
|
6378
6204
|
if (e.length < n) throw RangeError(`"digestInto() output" expected to be of length >=` + n);
|
|
6379
6205
|
}
|
|
6380
|
-
function
|
|
6206
|
+
function ce(...e) {
|
|
6381
6207
|
for (let t = 0; t < e.length; t++) e[t].fill(0);
|
|
6382
6208
|
}
|
|
6383
|
-
function
|
|
6209
|
+
function le(e) {
|
|
6384
6210
|
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
6385
6211
|
}
|
|
6386
|
-
function
|
|
6212
|
+
function D(e, t) {
|
|
6387
6213
|
return e << 32 - t | e >>> t;
|
|
6388
6214
|
}
|
|
6389
6215
|
new Uint8Array(new Uint32Array([287454020]).buffer)[0];
|
|
6390
6216
|
typeof Uint8Array.from([]).toHex == `function` && Uint8Array.fromHex;
|
|
6391
6217
|
Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, `0`));
|
|
6392
|
-
function
|
|
6218
|
+
function me(e, t = {}) {
|
|
6393
6219
|
let n = (t, n) => e(n).update(t).digest(), r = e(void 0);
|
|
6394
6220
|
return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.canXOF = r.canXOF, n.create = (t) => e(t), Object.assign(n, t), Object.freeze(n);
|
|
6395
6221
|
}
|
|
6396
|
-
const
|
|
6222
|
+
const he = (e) => ({ oid: Uint8Array.from([
|
|
6397
6223
|
6,
|
|
6398
6224
|
9,
|
|
6399
6225
|
96,
|
|
@@ -6406,13 +6232,13 @@ const me = (e) => ({ oid: Uint8Array.from([
|
|
|
6406
6232
|
2,
|
|
6407
6233
|
e
|
|
6408
6234
|
]) });
|
|
6409
|
-
function
|
|
6235
|
+
function ge(e, t, n) {
|
|
6410
6236
|
return e & t ^ ~e & n;
|
|
6411
6237
|
}
|
|
6412
|
-
function
|
|
6238
|
+
function _e(e, t, n) {
|
|
6413
6239
|
return e & t ^ e & n ^ t & n;
|
|
6414
6240
|
}
|
|
6415
|
-
var
|
|
6241
|
+
var ve = class {
|
|
6416
6242
|
blockLen;
|
|
6417
6243
|
outputLen;
|
|
6418
6244
|
canXOF = !1;
|
|
@@ -6425,15 +6251,15 @@ var _e = class {
|
|
|
6425
6251
|
pos = 0;
|
|
6426
6252
|
destroyed = !1;
|
|
6427
6253
|
constructor(e, t, n, r) {
|
|
6428
|
-
this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view =
|
|
6254
|
+
this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = le(this.buffer);
|
|
6429
6255
|
}
|
|
6430
6256
|
update(e) {
|
|
6431
|
-
|
|
6257
|
+
oe(this), E(e);
|
|
6432
6258
|
let { view: t, buffer: n, blockLen: r } = this, i = e.length;
|
|
6433
6259
|
for (let a = 0; a < i;) {
|
|
6434
6260
|
let o = Math.min(r - this.pos, i - a);
|
|
6435
6261
|
if (o === r) {
|
|
6436
|
-
let t =
|
|
6262
|
+
let t = le(e);
|
|
6437
6263
|
for (; r <= i - a; a += r) this.process(t, a);
|
|
6438
6264
|
continue;
|
|
6439
6265
|
}
|
|
@@ -6442,12 +6268,12 @@ var _e = class {
|
|
|
6442
6268
|
return this.length += e.length, this.roundClean(), this;
|
|
6443
6269
|
}
|
|
6444
6270
|
digestInto(e) {
|
|
6445
|
-
|
|
6271
|
+
oe(this), se(e, this), this.finished = !0;
|
|
6446
6272
|
let { buffer: t, view: n, blockLen: r, isLE: i } = this, { pos: a } = this;
|
|
6447
|
-
t[a++] = 128,
|
|
6273
|
+
t[a++] = 128, ce(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
|
|
6448
6274
|
for (let e = a; e < r; e++) t[e] = 0;
|
|
6449
6275
|
n.setBigUint64(r - 8, BigInt(this.length * 8), i), this.process(n, 0);
|
|
6450
|
-
let o =
|
|
6276
|
+
let o = le(e), s = this.outputLen;
|
|
6451
6277
|
if (s % 4) throw Error(`_sha2: outputLen must be aligned to 32bit`);
|
|
6452
6278
|
let c = s / 4, l = this.get();
|
|
6453
6279
|
if (c > l.length) throw Error(`_sha2: outputLen bigger than state`);
|
|
@@ -6468,7 +6294,7 @@ var _e = class {
|
|
|
6468
6294
|
return this._cloneInto();
|
|
6469
6295
|
}
|
|
6470
6296
|
};
|
|
6471
|
-
const
|
|
6297
|
+
const O = Uint32Array.from([
|
|
6472
6298
|
1779033703,
|
|
6473
6299
|
3144134277,
|
|
6474
6300
|
1013904242,
|
|
@@ -6477,25 +6303,25 @@ const k = Uint32Array.from([
|
|
|
6477
6303
|
2600822924,
|
|
6478
6304
|
528734635,
|
|
6479
6305
|
1541459225
|
|
6480
|
-
]),
|
|
6481
|
-
function
|
|
6306
|
+
]), k = BigInt(2 ** 32 - 1), ye = BigInt(32);
|
|
6307
|
+
function be(e, t = !1) {
|
|
6482
6308
|
return t ? {
|
|
6483
|
-
h: Number(e &
|
|
6484
|
-
l: Number(e >>
|
|
6309
|
+
h: Number(e & k),
|
|
6310
|
+
l: Number(e >> ye & k)
|
|
6485
6311
|
} : {
|
|
6486
|
-
h: Number(e >>
|
|
6487
|
-
l: Number(e &
|
|
6312
|
+
h: Number(e >> ye & k) | 0,
|
|
6313
|
+
l: Number(e & k) | 0
|
|
6488
6314
|
};
|
|
6489
6315
|
}
|
|
6490
|
-
function
|
|
6316
|
+
function xe(e, t = !1) {
|
|
6491
6317
|
let n = e.length, r = new Uint32Array(n), i = new Uint32Array(n);
|
|
6492
6318
|
for (let a = 0; a < n; a++) {
|
|
6493
|
-
let { h: n, l: o } =
|
|
6319
|
+
let { h: n, l: o } = be(e[a], t);
|
|
6494
6320
|
[r[a], i[a]] = [n, o];
|
|
6495
6321
|
}
|
|
6496
6322
|
return [r, i];
|
|
6497
6323
|
}
|
|
6498
|
-
const
|
|
6324
|
+
const Se = Uint32Array.from([
|
|
6499
6325
|
1116352408,
|
|
6500
6326
|
1899447441,
|
|
6501
6327
|
3049323471,
|
|
@@ -6560,8 +6386,8 @@ const xe = Uint32Array.from([
|
|
|
6560
6386
|
2756734187,
|
|
6561
6387
|
3204031479,
|
|
6562
6388
|
3329325298
|
|
6563
|
-
]),
|
|
6564
|
-
var
|
|
6389
|
+
]), A = new Uint32Array(64);
|
|
6390
|
+
var Ce = class extends ve {
|
|
6565
6391
|
constructor(e) {
|
|
6566
6392
|
super(64, e, 8, !1);
|
|
6567
6393
|
}
|
|
@@ -6582,41 +6408,41 @@ var Se = class extends _e {
|
|
|
6582
6408
|
this.A = e | 0, this.B = t | 0, this.C = n | 0, this.D = r | 0, this.E = i | 0, this.F = a | 0, this.G = o | 0, this.H = s | 0;
|
|
6583
6409
|
}
|
|
6584
6410
|
process(e, t) {
|
|
6585
|
-
for (let n = 0; n < 16; n++, t += 4)
|
|
6411
|
+
for (let n = 0; n < 16; n++, t += 4) A[n] = e.getUint32(t, !1);
|
|
6586
6412
|
for (let e = 16; e < 64; e++) {
|
|
6587
|
-
let t =
|
|
6588
|
-
|
|
6413
|
+
let t = A[e - 15], n = A[e - 2], r = D(t, 7) ^ D(t, 18) ^ t >>> 3;
|
|
6414
|
+
A[e] = (D(n, 17) ^ D(n, 19) ^ n >>> 10) + A[e - 7] + r + A[e - 16] | 0;
|
|
6589
6415
|
}
|
|
6590
6416
|
let { A: n, B: r, C: i, D: a, E: o, F: s, G: c, H: l } = this;
|
|
6591
6417
|
for (let e = 0; e < 64; e++) {
|
|
6592
|
-
let t =
|
|
6418
|
+
let t = D(o, 6) ^ D(o, 11) ^ D(o, 25), u = l + t + ge(o, s, c) + Se[e] + A[e] | 0, d = (D(n, 2) ^ D(n, 13) ^ D(n, 22)) + _e(n, r, i) | 0;
|
|
6593
6419
|
l = c, c = s, s = o, o = a + u | 0, a = i, i = r, r = n, n = u + d | 0;
|
|
6594
6420
|
}
|
|
6595
6421
|
n = n + this.A | 0, r = r + this.B | 0, i = i + this.C | 0, a = a + this.D | 0, o = o + this.E | 0, s = s + this.F | 0, c = c + this.G | 0, l = l + this.H | 0, this.set(n, r, i, a, o, s, c, l);
|
|
6596
6422
|
}
|
|
6597
6423
|
roundClean() {
|
|
6598
|
-
|
|
6424
|
+
ce(A);
|
|
6599
6425
|
}
|
|
6600
6426
|
destroy() {
|
|
6601
|
-
this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0),
|
|
6602
|
-
}
|
|
6603
|
-
},
|
|
6604
|
-
A =
|
|
6605
|
-
B =
|
|
6606
|
-
C =
|
|
6607
|
-
D =
|
|
6608
|
-
E =
|
|
6609
|
-
F =
|
|
6610
|
-
G =
|
|
6611
|
-
H =
|
|
6427
|
+
this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), ce(this.buffer);
|
|
6428
|
+
}
|
|
6429
|
+
}, we = class extends Ce {
|
|
6430
|
+
A = O[0] | 0;
|
|
6431
|
+
B = O[1] | 0;
|
|
6432
|
+
C = O[2] | 0;
|
|
6433
|
+
D = O[3] | 0;
|
|
6434
|
+
E = O[4] | 0;
|
|
6435
|
+
F = O[5] | 0;
|
|
6436
|
+
G = O[6] | 0;
|
|
6437
|
+
H = O[7] | 0;
|
|
6612
6438
|
constructor() {
|
|
6613
6439
|
super(32);
|
|
6614
6440
|
}
|
|
6615
6441
|
};
|
|
6616
|
-
const
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
const
|
|
6442
|
+
const Te = xe(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map((e) => BigInt(e)));
|
|
6443
|
+
Te[0], Te[1];
|
|
6444
|
+
me(() => new we(), he(1));
|
|
6445
|
+
const De = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${e}.`, Oe = `DEFAULT_TERMINATOR_KEY`, ke = {
|
|
6620
6446
|
ellipsis: {
|
|
6621
6447
|
fr: {
|
|
6622
6448
|
terminator: `…`,
|
|
@@ -6630,17 +6456,17 @@ const Ee = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${
|
|
|
6630
6456
|
terminator: `……`,
|
|
6631
6457
|
separator: void 0
|
|
6632
6458
|
},
|
|
6633
|
-
[
|
|
6459
|
+
[Oe]: {
|
|
6634
6460
|
terminator: `…`,
|
|
6635
6461
|
separator: void 0
|
|
6636
6462
|
}
|
|
6637
6463
|
},
|
|
6638
|
-
none: { [
|
|
6464
|
+
none: { [Oe]: {
|
|
6639
6465
|
terminator: void 0,
|
|
6640
6466
|
separator: void 0
|
|
6641
6467
|
} }
|
|
6642
6468
|
};
|
|
6643
|
-
var
|
|
6469
|
+
var Ae = class e {
|
|
6644
6470
|
static resolveLocale(e) {
|
|
6645
6471
|
try {
|
|
6646
6472
|
let t = e ? Array.isArray(e) ? e.map(String) : [String(e)] : [`en`], [n] = Intl.getCanonicalLocales(t);
|
|
@@ -6652,8 +6478,8 @@ var ke = class e {
|
|
|
6652
6478
|
constructor(t, n = {}) {
|
|
6653
6479
|
this.locale = e.resolveLocale(t);
|
|
6654
6480
|
let r = n.style ?? `ellipsis`;
|
|
6655
|
-
if (!
|
|
6656
|
-
let i = n.maxChars === void 0 ? void 0 :
|
|
6481
|
+
if (!ke[r]) throw Error(De(r));
|
|
6482
|
+
let i = n.maxChars === void 0 ? void 0 : ke[r][new Intl.Locale(this.locale).language] || ke[r].DEFAULT_TERMINATOR_KEY, a = n.terminator ?? i?.terminator, o = a == null ? void 0 : n.separator ?? i?.separator;
|
|
6657
6483
|
this.additionLength = (a?.length ?? 0) + (o?.length ?? 0), n.maxChars !== void 0 && Math.abs(n.maxChars) < this.additionLength && (a = void 0, o = void 0), this.options = {
|
|
6658
6484
|
maxChars: n.maxChars,
|
|
6659
6485
|
style: n.maxChars === void 0 ? void 0 : r,
|
|
@@ -6680,7 +6506,7 @@ var ke = class e {
|
|
|
6680
6506
|
return this.options;
|
|
6681
6507
|
}
|
|
6682
6508
|
};
|
|
6683
|
-
const
|
|
6509
|
+
const je = {
|
|
6684
6510
|
Collator: Intl.Collator,
|
|
6685
6511
|
DateTimeFormat: Intl.DateTimeFormat,
|
|
6686
6512
|
DisplayNames: Intl.DisplayNames,
|
|
@@ -6690,8 +6516,8 @@ const Ae = {
|
|
|
6690
6516
|
PluralRules: Intl.PluralRules,
|
|
6691
6517
|
RelativeTimeFormat: Intl.RelativeTimeFormat,
|
|
6692
6518
|
Segmenter: Intl.Segmenter,
|
|
6693
|
-
CutoffFormat:
|
|
6694
|
-
},
|
|
6519
|
+
CutoffFormat: Ae
|
|
6520
|
+
}, Me = new class {
|
|
6695
6521
|
constructor() {
|
|
6696
6522
|
this.cache = {};
|
|
6697
6523
|
}
|
|
@@ -6702,73 +6528,73 @@ const Ae = {
|
|
|
6702
6528
|
let [n = `en`, r = {}] = t, i = this.generateKey(n, r), a = this.cache[e];
|
|
6703
6529
|
a === void 0 && (a = {}, this.cache[e] = a);
|
|
6704
6530
|
let o = a[i];
|
|
6705
|
-
return o === void 0 && (o = new
|
|
6531
|
+
return o === void 0 && (o = new je[e](...t), a[i] = o), o;
|
|
6706
6532
|
}
|
|
6707
6533
|
}();
|
|
6708
|
-
function
|
|
6709
|
-
return
|
|
6534
|
+
function Ne(e) {
|
|
6535
|
+
return Me.get(`PluralRules`, e);
|
|
6710
6536
|
}
|
|
6711
|
-
var
|
|
6712
|
-
__addDisposableResource: () =>
|
|
6537
|
+
var j = m({
|
|
6538
|
+
__addDisposableResource: () => at,
|
|
6713
6539
|
__assign: () => F,
|
|
6714
|
-
__asyncDelegator: () =>
|
|
6715
|
-
__asyncGenerator: () =>
|
|
6716
|
-
__asyncValues: () =>
|
|
6717
|
-
__await: () =>
|
|
6718
|
-
__awaiter: () =>
|
|
6719
|
-
__classPrivateFieldGet: () =>
|
|
6720
|
-
__classPrivateFieldIn: () =>
|
|
6721
|
-
__classPrivateFieldSet: () =>
|
|
6540
|
+
__asyncDelegator: () => Ze,
|
|
6541
|
+
__asyncGenerator: () => Xe,
|
|
6542
|
+
__asyncValues: () => Qe,
|
|
6543
|
+
__await: () => N,
|
|
6544
|
+
__awaiter: () => Ue,
|
|
6545
|
+
__classPrivateFieldGet: () => nt,
|
|
6546
|
+
__classPrivateFieldIn: () => it,
|
|
6547
|
+
__classPrivateFieldSet: () => rt,
|
|
6722
6548
|
__createBinding: () => I,
|
|
6723
|
-
__decorate: () =>
|
|
6724
|
-
__disposeResources: () =>
|
|
6725
|
-
__esDecorate: () =>
|
|
6726
|
-
__exportStar: () =>
|
|
6727
|
-
__extends: () =>
|
|
6728
|
-
__generator: () =>
|
|
6729
|
-
__importDefault: () =>
|
|
6730
|
-
__importStar: () =>
|
|
6731
|
-
__makeTemplateObject: () =>
|
|
6732
|
-
__metadata: () =>
|
|
6733
|
-
__param: () =>
|
|
6734
|
-
__propKey: () =>
|
|
6735
|
-
__read: () =>
|
|
6736
|
-
__rest: () =>
|
|
6737
|
-
__rewriteRelativeImportExtension: () =>
|
|
6738
|
-
__runInitializers: () =>
|
|
6739
|
-
__setFunctionName: () =>
|
|
6740
|
-
__spread: () =>
|
|
6741
|
-
__spreadArray: () =>
|
|
6742
|
-
__spreadArrays: () =>
|
|
6743
|
-
__values: () =>
|
|
6549
|
+
__decorate: () => Ie,
|
|
6550
|
+
__disposeResources: () => ot,
|
|
6551
|
+
__esDecorate: () => Re,
|
|
6552
|
+
__exportStar: () => Ge,
|
|
6553
|
+
__extends: () => Pe,
|
|
6554
|
+
__generator: () => We,
|
|
6555
|
+
__importDefault: () => tt,
|
|
6556
|
+
__importStar: () => et,
|
|
6557
|
+
__makeTemplateObject: () => $e,
|
|
6558
|
+
__metadata: () => He,
|
|
6559
|
+
__param: () => Le,
|
|
6560
|
+
__propKey: () => Be,
|
|
6561
|
+
__read: () => Ke,
|
|
6562
|
+
__rest: () => Fe,
|
|
6563
|
+
__rewriteRelativeImportExtension: () => st,
|
|
6564
|
+
__runInitializers: () => ze,
|
|
6565
|
+
__setFunctionName: () => Ve,
|
|
6566
|
+
__spread: () => qe,
|
|
6567
|
+
__spreadArray: () => Ye,
|
|
6568
|
+
__spreadArrays: () => Je,
|
|
6569
|
+
__values: () => M,
|
|
6744
6570
|
default: () => ut
|
|
6745
6571
|
});
|
|
6746
|
-
function
|
|
6572
|
+
function Pe(e, t) {
|
|
6747
6573
|
if (typeof t != `function` && t !== null) throw TypeError(`Class extends value ` + String(t) + ` is not a constructor or null`);
|
|
6748
|
-
|
|
6574
|
+
P(e, t);
|
|
6749
6575
|
function n() {
|
|
6750
6576
|
this.constructor = e;
|
|
6751
6577
|
}
|
|
6752
6578
|
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
6753
6579
|
}
|
|
6754
|
-
function
|
|
6580
|
+
function Fe(e, t) {
|
|
6755
6581
|
var n = {};
|
|
6756
6582
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
6757
6583
|
if (e != null && typeof Object.getOwnPropertySymbols == `function`) for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++) t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
|
|
6758
6584
|
return n;
|
|
6759
6585
|
}
|
|
6760
|
-
function
|
|
6586
|
+
function Ie(e, t, n, r) {
|
|
6761
6587
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
6762
6588
|
if (typeof Reflect == `object` && typeof Reflect.decorate == `function`) a = Reflect.decorate(e, t, n, r);
|
|
6763
6589
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
6764
6590
|
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
6765
6591
|
}
|
|
6766
|
-
function
|
|
6592
|
+
function Le(e, t) {
|
|
6767
6593
|
return function(n, r) {
|
|
6768
6594
|
t(n, r, e);
|
|
6769
6595
|
};
|
|
6770
6596
|
}
|
|
6771
|
-
function
|
|
6597
|
+
function Re(e, t, n, r, i, a) {
|
|
6772
6598
|
function o(e) {
|
|
6773
6599
|
if (e !== void 0 && typeof e != `function`) throw TypeError(`Function expected`);
|
|
6774
6600
|
return e;
|
|
@@ -6793,23 +6619,23 @@ function Le(e, t, n, r, i, a) {
|
|
|
6793
6619
|
}
|
|
6794
6620
|
l && Object.defineProperty(l, r.name, u), f = !0;
|
|
6795
6621
|
}
|
|
6796
|
-
function
|
|
6622
|
+
function ze(e, t, n) {
|
|
6797
6623
|
for (var r = arguments.length > 2, i = 0; i < t.length; i++) n = r ? t[i].call(e, n) : t[i].call(e);
|
|
6798
6624
|
return r ? n : void 0;
|
|
6799
6625
|
}
|
|
6800
|
-
function
|
|
6626
|
+
function Be(e) {
|
|
6801
6627
|
return typeof e == `symbol` ? e : `${e}`;
|
|
6802
6628
|
}
|
|
6803
|
-
function
|
|
6629
|
+
function Ve(e, t, n) {
|
|
6804
6630
|
return typeof t == `symbol` && (t = t.description ? `[${t.description}]` : ``), Object.defineProperty(e, `name`, {
|
|
6805
6631
|
configurable: !0,
|
|
6806
6632
|
value: n ? `${n} ${t}` : t
|
|
6807
6633
|
});
|
|
6808
6634
|
}
|
|
6809
|
-
function
|
|
6635
|
+
function He(e, t) {
|
|
6810
6636
|
if (typeof Reflect == `object` && typeof Reflect.metadata == `function`) return Reflect.metadata(e, t);
|
|
6811
6637
|
}
|
|
6812
|
-
function
|
|
6638
|
+
function Ue(e, t, n, r) {
|
|
6813
6639
|
function i(e) {
|
|
6814
6640
|
return e instanceof n ? e : new n(function(t) {
|
|
6815
6641
|
t(e);
|
|
@@ -6836,7 +6662,7 @@ function He(e, t, n, r) {
|
|
|
6836
6662
|
c((r = r.apply(e, t || [])).next());
|
|
6837
6663
|
});
|
|
6838
6664
|
}
|
|
6839
|
-
function
|
|
6665
|
+
function We(e, t) {
|
|
6840
6666
|
var n = {
|
|
6841
6667
|
label: 0,
|
|
6842
6668
|
sent: function() {
|
|
@@ -6906,10 +6732,10 @@ function Ue(e, t) {
|
|
|
6906
6732
|
};
|
|
6907
6733
|
}
|
|
6908
6734
|
}
|
|
6909
|
-
function
|
|
6735
|
+
function Ge(e, t) {
|
|
6910
6736
|
for (var n in e) n !== `default` && !Object.prototype.hasOwnProperty.call(t, n) && I(t, e, n);
|
|
6911
6737
|
}
|
|
6912
|
-
function
|
|
6738
|
+
function M(e) {
|
|
6913
6739
|
var t = typeof Symbol == `function` && Symbol.iterator, n = t && e[t], r = 0;
|
|
6914
6740
|
if (n) return n.call(e);
|
|
6915
6741
|
if (e && typeof e.length == `number`) return { next: function() {
|
|
@@ -6920,7 +6746,7 @@ function N(e) {
|
|
|
6920
6746
|
} };
|
|
6921
6747
|
throw TypeError(t ? `Object is not iterable.` : `Symbol.iterator is not defined.`);
|
|
6922
6748
|
}
|
|
6923
|
-
function
|
|
6749
|
+
function Ke(e, t) {
|
|
6924
6750
|
var n = typeof Symbol == `function` && e[Symbol.iterator];
|
|
6925
6751
|
if (!n) return e;
|
|
6926
6752
|
var r = n.call(e), i, a = [], o;
|
|
@@ -6937,23 +6763,23 @@ function Ge(e, t) {
|
|
|
6937
6763
|
}
|
|
6938
6764
|
return a;
|
|
6939
6765
|
}
|
|
6940
|
-
function
|
|
6941
|
-
for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(
|
|
6766
|
+
function qe() {
|
|
6767
|
+
for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(Ke(arguments[t]));
|
|
6942
6768
|
return e;
|
|
6943
6769
|
}
|
|
6944
|
-
function
|
|
6770
|
+
function Je() {
|
|
6945
6771
|
for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
|
|
6946
6772
|
for (var r = Array(e), i = 0, t = 0; t < n; t++) for (var a = arguments[t], o = 0, s = a.length; o < s; o++, i++) r[i] = a[o];
|
|
6947
6773
|
return r;
|
|
6948
6774
|
}
|
|
6949
|
-
function
|
|
6775
|
+
function Ye(e, t, n) {
|
|
6950
6776
|
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
|
|
6951
6777
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
6952
6778
|
}
|
|
6953
|
-
function
|
|
6954
|
-
return this instanceof
|
|
6779
|
+
function N(e) {
|
|
6780
|
+
return this instanceof N ? (this.v = e, this) : new N(e);
|
|
6955
6781
|
}
|
|
6956
|
-
function
|
|
6782
|
+
function Xe(e, t, n) {
|
|
6957
6783
|
if (!Symbol.asyncIterator) throw TypeError(`Symbol.asyncIterator is not defined.`);
|
|
6958
6784
|
var r = n.apply(e, t || []), i, a = [];
|
|
6959
6785
|
return i = Object.create((typeof AsyncIterator == `function` ? AsyncIterator : Object).prototype), s(`next`), s(`throw`), s(`return`, o), i[Symbol.asyncIterator] = function() {
|
|
@@ -6984,7 +6810,7 @@ function Ye(e, t, n) {
|
|
|
6984
6810
|
}
|
|
6985
6811
|
}
|
|
6986
6812
|
function l(e) {
|
|
6987
|
-
e.value instanceof
|
|
6813
|
+
e.value instanceof N ? Promise.resolve(e.value.v).then(u, d) : f(a[0][2], e);
|
|
6988
6814
|
}
|
|
6989
6815
|
function u(e) {
|
|
6990
6816
|
c(`next`, e);
|
|
@@ -6996,7 +6822,7 @@ function Ye(e, t, n) {
|
|
|
6996
6822
|
e(t), a.shift(), a.length && c(a[0][0], a[0][1]);
|
|
6997
6823
|
}
|
|
6998
6824
|
}
|
|
6999
|
-
function
|
|
6825
|
+
function Ze(e) {
|
|
7000
6826
|
var t, n;
|
|
7001
6827
|
return t = {}, r(`next`), r(`throw`, function(e) {
|
|
7002
6828
|
throw e;
|
|
@@ -7006,16 +6832,16 @@ function Xe(e) {
|
|
|
7006
6832
|
function r(r, i) {
|
|
7007
6833
|
t[r] = e[r] ? function(t) {
|
|
7008
6834
|
return (n = !n) ? {
|
|
7009
|
-
value:
|
|
6835
|
+
value: N(e[r](t)),
|
|
7010
6836
|
done: !1
|
|
7011
6837
|
} : i ? i(t) : t;
|
|
7012
6838
|
} : i;
|
|
7013
6839
|
}
|
|
7014
6840
|
}
|
|
7015
|
-
function
|
|
6841
|
+
function Qe(e) {
|
|
7016
6842
|
if (!Symbol.asyncIterator) throw TypeError(`Symbol.asyncIterator is not defined.`);
|
|
7017
6843
|
var t = e[Symbol.asyncIterator], n;
|
|
7018
|
-
return t ? t.call(e) : (e = typeof
|
|
6844
|
+
return t ? t.call(e) : (e = typeof M == `function` ? M(e) : e[Symbol.iterator](), n = {}, r(`next`), r(`throw`), r(`return`), n[Symbol.asyncIterator] = function() {
|
|
7019
6845
|
return this;
|
|
7020
6846
|
}, n);
|
|
7021
6847
|
function r(t) {
|
|
@@ -7034,34 +6860,34 @@ function Ze(e) {
|
|
|
7034
6860
|
}, t);
|
|
7035
6861
|
}
|
|
7036
6862
|
}
|
|
7037
|
-
function
|
|
6863
|
+
function $e(e, t) {
|
|
7038
6864
|
return Object.defineProperty ? Object.defineProperty(e, `raw`, { value: t }) : e.raw = t, e;
|
|
7039
6865
|
}
|
|
7040
|
-
function
|
|
6866
|
+
function et(e) {
|
|
7041
6867
|
if (e && e.__esModule) return e;
|
|
7042
6868
|
var t = {};
|
|
7043
6869
|
if (e != null) for (var n = L(e), r = 0; r < n.length; r++) n[r] !== `default` && I(t, e, n[r]);
|
|
7044
6870
|
return ct(t, e), t;
|
|
7045
6871
|
}
|
|
7046
|
-
function
|
|
6872
|
+
function tt(e) {
|
|
7047
6873
|
return e && e.__esModule ? e : { default: e };
|
|
7048
6874
|
}
|
|
7049
|
-
function
|
|
6875
|
+
function nt(e, t, n, r) {
|
|
7050
6876
|
if (n === `a` && !r) throw TypeError(`Private accessor was defined without a getter`);
|
|
7051
6877
|
if (typeof t == `function` ? e !== t || !r : !t.has(e)) throw TypeError(`Cannot read private member from an object whose class did not declare it`);
|
|
7052
6878
|
return n === `m` ? r : n === `a` ? r.call(e) : r ? r.value : t.get(e);
|
|
7053
6879
|
}
|
|
7054
|
-
function
|
|
6880
|
+
function rt(e, t, n, r, i) {
|
|
7055
6881
|
if (r === `m`) throw TypeError(`Private method is not writable`);
|
|
7056
6882
|
if (r === `a` && !i) throw TypeError(`Private accessor was defined without a setter`);
|
|
7057
6883
|
if (typeof t == `function` ? e !== t || !i : !t.has(e)) throw TypeError(`Cannot write private member to an object whose class did not declare it`);
|
|
7058
6884
|
return r === `a` ? i.call(e, n) : i ? i.value = n : t.set(e, n), n;
|
|
7059
6885
|
}
|
|
7060
|
-
function
|
|
6886
|
+
function it(e, t) {
|
|
7061
6887
|
if (t === null || typeof t != `object` && typeof t != `function`) throw TypeError(`Cannot use 'in' operator on non-object`);
|
|
7062
6888
|
return typeof e == `function` ? t === e : e.has(t);
|
|
7063
6889
|
}
|
|
7064
|
-
function
|
|
6890
|
+
function at(e, t, n) {
|
|
7065
6891
|
if (t != null) {
|
|
7066
6892
|
if (typeof t != `object` && typeof t != `function`) throw TypeError(`Object expected.`);
|
|
7067
6893
|
var r, i;
|
|
@@ -7088,7 +6914,7 @@ function it(e, t, n) {
|
|
|
7088
6914
|
} else n && e.stack.push({ async: !0 });
|
|
7089
6915
|
return t;
|
|
7090
6916
|
}
|
|
7091
|
-
function
|
|
6917
|
+
function ot(e) {
|
|
7092
6918
|
function t(t) {
|
|
7093
6919
|
e.error = e.hasError ? new lt(t, e.error, `An error was suppressed during disposal.`) : t, e.hasError = !0;
|
|
7094
6920
|
}
|
|
@@ -7110,18 +6936,18 @@ function at(e) {
|
|
|
7110
6936
|
}
|
|
7111
6937
|
return i();
|
|
7112
6938
|
}
|
|
7113
|
-
function
|
|
6939
|
+
function st(e, t) {
|
|
7114
6940
|
return typeof e == `string` && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(e, n, r, i, a) {
|
|
7115
6941
|
return n ? t ? `.jsx` : `.js` : r && (!i || !a) ? e : r + i + `.` + a.toLowerCase() + `js`;
|
|
7116
6942
|
}) : e;
|
|
7117
6943
|
}
|
|
7118
|
-
var
|
|
7119
|
-
|
|
7120
|
-
return
|
|
6944
|
+
var P, F, I, ct, L, lt, ut, R = f((() => {
|
|
6945
|
+
P = function(e, t) {
|
|
6946
|
+
return P = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
|
|
7121
6947
|
e.__proto__ = t;
|
|
7122
6948
|
} || function(e, t) {
|
|
7123
6949
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
7124
|
-
},
|
|
6950
|
+
}, P(e, t);
|
|
7125
6951
|
}, F = function() {
|
|
7126
6952
|
return F = Object.assign || function(e) {
|
|
7127
6953
|
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
@@ -7155,38 +6981,38 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
7155
6981
|
var r = Error(n);
|
|
7156
6982
|
return r.name = `SuppressedError`, r.error = e, r.suppressed = t, r;
|
|
7157
6983
|
}, ut = {
|
|
7158
|
-
__extends:
|
|
6984
|
+
__extends: Pe,
|
|
7159
6985
|
__assign: F,
|
|
7160
|
-
__rest:
|
|
7161
|
-
__decorate:
|
|
7162
|
-
__param:
|
|
7163
|
-
__esDecorate:
|
|
7164
|
-
__runInitializers:
|
|
7165
|
-
__propKey:
|
|
7166
|
-
__setFunctionName:
|
|
7167
|
-
__metadata:
|
|
7168
|
-
__awaiter:
|
|
7169
|
-
__generator:
|
|
6986
|
+
__rest: Fe,
|
|
6987
|
+
__decorate: Ie,
|
|
6988
|
+
__param: Le,
|
|
6989
|
+
__esDecorate: Re,
|
|
6990
|
+
__runInitializers: ze,
|
|
6991
|
+
__propKey: Be,
|
|
6992
|
+
__setFunctionName: Ve,
|
|
6993
|
+
__metadata: He,
|
|
6994
|
+
__awaiter: Ue,
|
|
6995
|
+
__generator: We,
|
|
7170
6996
|
__createBinding: I,
|
|
7171
|
-
__exportStar:
|
|
7172
|
-
__values:
|
|
7173
|
-
__read:
|
|
7174
|
-
__spread:
|
|
7175
|
-
__spreadArrays:
|
|
7176
|
-
__spreadArray:
|
|
7177
|
-
__await:
|
|
7178
|
-
__asyncGenerator:
|
|
7179
|
-
__asyncDelegator:
|
|
7180
|
-
__asyncValues:
|
|
7181
|
-
__makeTemplateObject:
|
|
7182
|
-
__importStar:
|
|
7183
|
-
__importDefault:
|
|
7184
|
-
__classPrivateFieldGet:
|
|
7185
|
-
__classPrivateFieldSet:
|
|
7186
|
-
__classPrivateFieldIn:
|
|
7187
|
-
__addDisposableResource:
|
|
7188
|
-
__disposeResources:
|
|
7189
|
-
__rewriteRelativeImportExtension:
|
|
6997
|
+
__exportStar: Ge,
|
|
6998
|
+
__values: M,
|
|
6999
|
+
__read: Ke,
|
|
7000
|
+
__spread: qe,
|
|
7001
|
+
__spreadArrays: Je,
|
|
7002
|
+
__spreadArray: Ye,
|
|
7003
|
+
__await: N,
|
|
7004
|
+
__asyncGenerator: Xe,
|
|
7005
|
+
__asyncDelegator: Ze,
|
|
7006
|
+
__asyncValues: Qe,
|
|
7007
|
+
__makeTemplateObject: $e,
|
|
7008
|
+
__importStar: et,
|
|
7009
|
+
__importDefault: tt,
|
|
7010
|
+
__classPrivateFieldGet: nt,
|
|
7011
|
+
__classPrivateFieldSet: rt,
|
|
7012
|
+
__classPrivateFieldIn: it,
|
|
7013
|
+
__addDisposableResource: at,
|
|
7014
|
+
__disposeResources: ot,
|
|
7015
|
+
__rewriteRelativeImportExtension: st
|
|
7190
7016
|
};
|
|
7191
7017
|
})), dt = p(((e) => {
|
|
7192
7018
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.ErrorKind = void 0;
|
|
@@ -7356,7 +7182,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
7356
7182
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.WHITE_SPACE_REGEX = void 0, e.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
|
|
7357
7183
|
})), ht = p(((e) => {
|
|
7358
7184
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.parseNumberSkeletonFromString = r, e.parseNumberSkeleton = p;
|
|
7359
|
-
var t = (R(), g(
|
|
7185
|
+
var t = (R(), g(j)), n = mt();
|
|
7360
7186
|
function r(e) {
|
|
7361
7187
|
if (e.length === 0) throw Error(`Number skeleton cannot be empty`);
|
|
7362
7188
|
for (var t = e.split(n.WHITE_SPACE_REGEX).filter(function(e) {
|
|
@@ -7536,7 +7362,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
7536
7362
|
}
|
|
7537
7363
|
})), gt = p(((e) => {
|
|
7538
7364
|
Object.defineProperty(e, `__esModule`, { value: !0 });
|
|
7539
|
-
var t = (R(), g(
|
|
7365
|
+
var t = (R(), g(j));
|
|
7540
7366
|
t.__exportStar(pt(), e), t.__exportStar(ht(), e);
|
|
7541
7367
|
})), _t = p(((e) => {
|
|
7542
7368
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.timeData = void 0, e.timeData = {
|
|
@@ -8724,7 +8550,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
8724
8550
|
}
|
|
8725
8551
|
})), yt = p(((e) => {
|
|
8726
8552
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.Parser = void 0;
|
|
8727
|
-
var t = (R(), g(
|
|
8553
|
+
var t = (R(), g(j)), n = dt(), r = z(), i = ft(), a = gt(), o = vt(), s = RegExp(`^${i.SPACE_SEPARATOR_REGEX.source}*`), c = RegExp(`${i.SPACE_SEPARATOR_REGEX.source}*\$`);
|
|
8728
8554
|
function l(e, t) {
|
|
8729
8555
|
return {
|
|
8730
8556
|
start: e,
|
|
@@ -8784,7 +8610,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
8784
8610
|
} else C = function(e, t) {
|
|
8785
8611
|
for (var n = [];;) {
|
|
8786
8612
|
var r = x(e, t);
|
|
8787
|
-
if (r === void 0 ||
|
|
8613
|
+
if (r === void 0 || ae(r) || E(r)) break;
|
|
8788
8614
|
n.push(r), t += r >= 65536 ? 2 : 1;
|
|
8789
8615
|
}
|
|
8790
8616
|
return y.apply(void 0, n);
|
|
@@ -8863,7 +8689,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
8863
8689
|
} else return this.error(n.ErrorKind.INVALID_TAG, l(i, this.clonePosition()));
|
|
8864
8690
|
}, e.prototype.parseTagName = function() {
|
|
8865
8691
|
var e = this.offset();
|
|
8866
|
-
for (this.bump(); !this.isEOF() &&
|
|
8692
|
+
for (this.bump(); !this.isEOF() && ie(this.char());) this.bump();
|
|
8867
8693
|
return this.message.slice(e, this.offset());
|
|
8868
8694
|
}, e.prototype.parseLiteral = function(e, t) {
|
|
8869
8695
|
for (var n = this.clonePosition(), i = ``;;) {
|
|
@@ -9191,7 +9017,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
9191
9017
|
if (this.bump(), this.isEOF()) break;
|
|
9192
9018
|
}
|
|
9193
9019
|
}, e.prototype.bumpSpace = function() {
|
|
9194
|
-
for (; !this.isEOF() &&
|
|
9020
|
+
for (; !this.isEOF() && ae(this.char());) this.bump();
|
|
9195
9021
|
}, e.prototype.peek = function() {
|
|
9196
9022
|
if (this.isEOF()) return null;
|
|
9197
9023
|
var e = this.char(), t = this.offset();
|
|
@@ -9204,18 +9030,18 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
9204
9030
|
function re(e) {
|
|
9205
9031
|
return T(e) || e === 47;
|
|
9206
9032
|
}
|
|
9207
|
-
function
|
|
9033
|
+
function ie(e) {
|
|
9208
9034
|
return e === 45 || e === 46 || e >= 48 && e <= 57 || e === 95 || e >= 97 && e <= 122 || e >= 65 && e <= 90 || e == 183 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 893 || e >= 895 && e <= 8191 || e >= 8204 && e <= 8205 || e >= 8255 && e <= 8256 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039;
|
|
9209
9035
|
}
|
|
9210
|
-
function
|
|
9036
|
+
function ae(e) {
|
|
9211
9037
|
return e >= 9 && e <= 13 || e === 32 || e === 133 || e >= 8206 && e <= 8207 || e === 8232 || e === 8233;
|
|
9212
9038
|
}
|
|
9213
|
-
function
|
|
9039
|
+
function E(e) {
|
|
9214
9040
|
return e >= 33 && e <= 35 || e === 36 || e >= 37 && e <= 39 || e === 40 || e === 41 || e === 42 || e === 43 || e === 44 || e === 45 || e >= 46 && e <= 47 || e >= 58 && e <= 59 || e >= 60 && e <= 62 || e >= 63 && e <= 64 || e === 91 || e === 92 || e === 93 || e === 94 || e === 96 || e === 123 || e === 124 || e === 125 || e === 126 || e === 161 || e >= 162 && e <= 165 || e === 166 || e === 167 || e === 169 || e === 171 || e === 172 || e === 174 || e === 176 || e === 177 || e === 182 || e === 187 || e === 191 || e === 215 || e === 247 || e >= 8208 && e <= 8213 || e >= 8214 && e <= 8215 || e === 8216 || e === 8217 || e === 8218 || e >= 8219 && e <= 8220 || e === 8221 || e === 8222 || e === 8223 || e >= 8224 && e <= 8231 || e >= 8240 && e <= 8248 || e === 8249 || e === 8250 || e >= 8251 && e <= 8254 || e >= 8257 && e <= 8259 || e === 8260 || e === 8261 || e === 8262 || e >= 8263 && e <= 8273 || e === 8274 || e === 8275 || e >= 8277 && e <= 8286 || e >= 8592 && e <= 8596 || e >= 8597 && e <= 8601 || e >= 8602 && e <= 8603 || e >= 8604 && e <= 8607 || e === 8608 || e >= 8609 && e <= 8610 || e === 8611 || e >= 8612 && e <= 8613 || e === 8614 || e >= 8615 && e <= 8621 || e === 8622 || e >= 8623 && e <= 8653 || e >= 8654 && e <= 8655 || e >= 8656 && e <= 8657 || e === 8658 || e === 8659 || e === 8660 || e >= 8661 && e <= 8691 || e >= 8692 && e <= 8959 || e >= 8960 && e <= 8967 || e === 8968 || e === 8969 || e === 8970 || e === 8971 || e >= 8972 && e <= 8991 || e >= 8992 && e <= 8993 || e >= 8994 && e <= 9e3 || e === 9001 || e === 9002 || e >= 9003 && e <= 9083 || e === 9084 || e >= 9085 && e <= 9114 || e >= 9115 && e <= 9139 || e >= 9140 && e <= 9179 || e >= 9180 && e <= 9185 || e >= 9186 && e <= 9254 || e >= 9255 && e <= 9279 || e >= 9280 && e <= 9290 || e >= 9291 && e <= 9311 || e >= 9472 && e <= 9654 || e === 9655 || e >= 9656 && e <= 9664 || e === 9665 || e >= 9666 && e <= 9719 || e >= 9720 && e <= 9727 || e >= 9728 && e <= 9838 || e === 9839 || e >= 9840 && e <= 10087 || e === 10088 || e === 10089 || e === 10090 || e === 10091 || e === 10092 || e === 10093 || e === 10094 || e === 10095 || e === 10096 || e === 10097 || e === 10098 || e === 10099 || e === 10100 || e === 10101 || e >= 10132 && e <= 10175 || e >= 10176 && e <= 10180 || e === 10181 || e === 10182 || e >= 10183 && e <= 10213 || e === 10214 || e === 10215 || e === 10216 || e === 10217 || e === 10218 || e === 10219 || e === 10220 || e === 10221 || e === 10222 || e === 10223 || e >= 10224 && e <= 10239 || e >= 10240 && e <= 10495 || e >= 10496 && e <= 10626 || e === 10627 || e === 10628 || e === 10629 || e === 10630 || e === 10631 || e === 10632 || e === 10633 || e === 10634 || e === 10635 || e === 10636 || e === 10637 || e === 10638 || e === 10639 || e === 10640 || e === 10641 || e === 10642 || e === 10643 || e === 10644 || e === 10645 || e === 10646 || e === 10647 || e === 10648 || e >= 10649 && e <= 10711 || e === 10712 || e === 10713 || e === 10714 || e === 10715 || e >= 10716 && e <= 10747 || e === 10748 || e === 10749 || e >= 10750 && e <= 11007 || e >= 11008 && e <= 11055 || e >= 11056 && e <= 11076 || e >= 11077 && e <= 11078 || e >= 11079 && e <= 11084 || e >= 11085 && e <= 11123 || e >= 11124 && e <= 11125 || e >= 11126 && e <= 11157 || e === 11158 || e >= 11159 && e <= 11263 || e >= 11776 && e <= 11777 || e === 11778 || e === 11779 || e === 11780 || e === 11781 || e >= 11782 && e <= 11784 || e === 11785 || e === 11786 || e === 11787 || e === 11788 || e === 11789 || e >= 11790 && e <= 11798 || e === 11799 || e >= 11800 && e <= 11801 || e === 11802 || e === 11803 || e === 11804 || e === 11805 || e >= 11806 && e <= 11807 || e === 11808 || e === 11809 || e === 11810 || e === 11811 || e === 11812 || e === 11813 || e === 11814 || e === 11815 || e === 11816 || e === 11817 || e >= 11818 && e <= 11822 || e === 11823 || e >= 11824 && e <= 11833 || e >= 11834 && e <= 11835 || e >= 11836 && e <= 11839 || e === 11840 || e === 11841 || e === 11842 || e >= 11843 && e <= 11855 || e >= 11856 && e <= 11857 || e === 11858 || e >= 11859 && e <= 11903 || e >= 12289 && e <= 12291 || e === 12296 || e === 12297 || e === 12298 || e === 12299 || e === 12300 || e === 12301 || e === 12302 || e === 12303 || e === 12304 || e === 12305 || e >= 12306 && e <= 12307 || e === 12308 || e === 12309 || e === 12310 || e === 12311 || e === 12312 || e === 12313 || e === 12314 || e === 12315 || e === 12316 || e === 12317 || e >= 12318 && e <= 12319 || e === 12320 || e === 12336 || e === 64830 || e === 64831 || e >= 65093 && e <= 65094;
|
|
9215
9041
|
}
|
|
9216
9042
|
})), bt = p(((e) => {
|
|
9217
9043
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.hoistSelectors = s, e.isStructurallySame = l;
|
|
9218
|
-
var t = (R(), g(
|
|
9044
|
+
var t = (R(), g(j)), n = z();
|
|
9219
9045
|
function r(e) {
|
|
9220
9046
|
return Array.isArray(e) ? t.__spreadArray([], e.map(r), !0) : typeof e == `object` && e ? Object.keys(e).reduce(function(t, n) {
|
|
9221
9047
|
return t[n] = r(e[n]), t;
|
|
@@ -9274,7 +9100,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
9274
9100
|
}
|
|
9275
9101
|
})), xt = p(((e) => {
|
|
9276
9102
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.isStructurallySame = e._Parser = void 0, e.parse = o;
|
|
9277
|
-
var t = (R(), g(
|
|
9103
|
+
var t = (R(), g(j)), n = dt(), r = yt(), i = z();
|
|
9278
9104
|
function a(e) {
|
|
9279
9105
|
e.forEach(function(e) {
|
|
9280
9106
|
if (delete e.location, (0, i.isSelectElement)(e) || (0, i.isPluralElement)(e)) for (var t in e.options) delete e.options[t].location, a(e.options[t].value);
|
|
@@ -9303,7 +9129,7 @@ var st, F, I, ct, L, lt, ut, R = f((() => {
|
|
|
9303
9129
|
});
|
|
9304
9130
|
})), St = p(((e) => {
|
|
9305
9131
|
Object.defineProperty(e, `__esModule`, { value: !0 }), e.printAST = r;
|
|
9306
|
-
var t = (R(), g(
|
|
9132
|
+
var t = (R(), g(j)), n = z();
|
|
9307
9133
|
function r(e) {
|
|
9308
9134
|
return i(e, !1);
|
|
9309
9135
|
}
|
|
@@ -9384,7 +9210,7 @@ function Tt(e) {
|
|
|
9384
9210
|
return wt.includes(e);
|
|
9385
9211
|
}
|
|
9386
9212
|
function Et(e, t = wt, n = [`en`]) {
|
|
9387
|
-
let r =
|
|
9213
|
+
let r = Ne(n).select(e), i = Math.abs(e);
|
|
9388
9214
|
if (i === 0 && t.includes(`zero`)) return `zero`;
|
|
9389
9215
|
if (i === 1) {
|
|
9390
9216
|
if (t.includes(`singular`)) return `singular`;
|
|
@@ -9410,7 +9236,8 @@ function Ot(e) {
|
|
|
9410
9236
|
const U = `_gt_`;
|
|
9411
9237
|
RegExp(`^${U}\\d+$`);
|
|
9412
9238
|
RegExp(`^${U}$`);
|
|
9413
|
-
|
|
9239
|
+
RegExp(`${U}\\d+`);
|
|
9240
|
+
function Ht(e, n = 0) {
|
|
9414
9241
|
let r = n, a = (e) => {
|
|
9415
9242
|
let { type: t, props: n } = e;
|
|
9416
9243
|
r += 1;
|
|
@@ -9424,11 +9251,11 @@ function Vt(e, n = 0) {
|
|
|
9424
9251
|
if (a) {
|
|
9425
9252
|
let e = a.split(`-`);
|
|
9426
9253
|
if ((e[1] === `automatic` || e[2] === `automatic`) && (i.injectionType = `automatic`), e[0] === `translate` && (e[0] = `fragment`), e[0] === `variable` && (i.variableType = e?.[1] || `variable`), e[0] === `plural`) {
|
|
9427
|
-
let e = Object.entries(n).reduce((e, [t, n]) => (Tt(t) && (e[t] =
|
|
9254
|
+
let e = Object.entries(n).reduce((e, [t, n]) => (Tt(t) && (e[t] = Ht(n, r)), e), {});
|
|
9428
9255
|
Object.keys(e).length && (i.branches = e);
|
|
9429
9256
|
}
|
|
9430
9257
|
if (e[0] === `branch`) {
|
|
9431
|
-
let { children: e, branch: t, ...a } = n, o = Object.fromEntries(Object.entries(a).filter(([e]) => !e.startsWith(`data-`))), s = Object.entries(o).reduce((e, [t, n]) => (e[t] =
|
|
9258
|
+
let { children: e, branch: t, ...a } = n, o = Object.fromEntries(Object.entries(a).filter(([e]) => !e.startsWith(`data-`))), s = Object.entries(o).reduce((e, [t, n]) => (e[t] = Ht(n, r), e), {});
|
|
9432
9259
|
Object.keys(s).length && (i.branches = s);
|
|
9433
9260
|
}
|
|
9434
9261
|
i.transformation = e[0];
|
|
@@ -9450,10 +9277,10 @@ function Vt(e, n = 0) {
|
|
|
9450
9277
|
}
|
|
9451
9278
|
return c(e);
|
|
9452
9279
|
}
|
|
9453
|
-
const
|
|
9280
|
+
const Ut = `@generaltranslation/react-core`;
|
|
9454
9281
|
function W(e) {
|
|
9455
9282
|
return S({
|
|
9456
|
-
source:
|
|
9283
|
+
source: Ut,
|
|
9457
9284
|
...e
|
|
9458
9285
|
});
|
|
9459
9286
|
}
|
|
@@ -9500,12 +9327,12 @@ W({
|
|
|
9500
9327
|
whatHappened: `No dictionary was found`,
|
|
9501
9328
|
fix: `Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations`
|
|
9502
9329
|
});
|
|
9503
|
-
const
|
|
9504
|
-
function
|
|
9330
|
+
const qt = `${Ut} Warning: A <_T> component was found injected outside of a <Derive> boundary. This may affect translation resolution for this component.`;
|
|
9331
|
+
function Jt(e) {
|
|
9505
9332
|
return K(e, 0);
|
|
9506
9333
|
}
|
|
9507
|
-
function
|
|
9508
|
-
let { type: n, props: i } = e, a =
|
|
9334
|
+
function Yt(e, t) {
|
|
9335
|
+
let { type: n, props: i } = e, a = Xt(n);
|
|
9509
9336
|
if (typeof i != `object` || !i) return e;
|
|
9510
9337
|
if (a) {
|
|
9511
9338
|
let { componentType: n, injectionType: o } = a;
|
|
@@ -9517,7 +9344,7 @@ function Jt(e, t) {
|
|
|
9517
9344
|
...`children` in i && { children: K(i.children, t + 1) }
|
|
9518
9345
|
});
|
|
9519
9346
|
if (n === `translate` && o === `automatic` && t > 0) return `children` in i ? K(i.children, t) : void 0;
|
|
9520
|
-
n === `translate` && o === `automatic` && console.warn(
|
|
9347
|
+
n === `translate` && o === `automatic` && console.warn(qt);
|
|
9521
9348
|
}
|
|
9522
9349
|
return cloneElement(e, {
|
|
9523
9350
|
...i,
|
|
@@ -9525,12 +9352,12 @@ function Jt(e, t) {
|
|
|
9525
9352
|
});
|
|
9526
9353
|
}
|
|
9527
9354
|
function G(e, t) {
|
|
9528
|
-
return isValidElement(e) ?
|
|
9355
|
+
return isValidElement(e) ? Yt(e, t) : e;
|
|
9529
9356
|
}
|
|
9530
9357
|
function K(e, t) {
|
|
9531
9358
|
return Array.isArray(e) ? Children.map(e, (e) => G(e, t)) : G(e, t);
|
|
9532
9359
|
}
|
|
9533
|
-
function
|
|
9360
|
+
function Xt(e) {
|
|
9534
9361
|
let t = typeof e == `function` && `_gtt` in e ? e._gtt : void 0;
|
|
9535
9362
|
if (t == null || typeof t != `string`) return;
|
|
9536
9363
|
let n = t.split(`-`);
|
|
@@ -9539,27 +9366,27 @@ function Yt(e) {
|
|
|
9539
9366
|
injectionType: n[1] === `automatic` || n[2] === `automatic` ? `automatic` : `manual`
|
|
9540
9367
|
};
|
|
9541
9368
|
}
|
|
9542
|
-
const
|
|
9369
|
+
const Zt = {
|
|
9543
9370
|
variable: `value`,
|
|
9544
9371
|
number: `n`,
|
|
9545
9372
|
datetime: `date`,
|
|
9546
9373
|
currency: `cost`,
|
|
9547
9374
|
"relative-time": `time`
|
|
9548
9375
|
};
|
|
9549
|
-
function
|
|
9550
|
-
return typeof e.name == `string` ? e.name : `_gt_${
|
|
9376
|
+
function Qt(e = {}, t) {
|
|
9377
|
+
return typeof e.name == `string` ? e.name : `_gt_${Zt[t] || `value`}_${e[`data-_gt`]?.id}`;
|
|
9551
9378
|
}
|
|
9552
|
-
function
|
|
9379
|
+
function $t(e) {
|
|
9553
9380
|
return t$1.isValidElement(e);
|
|
9554
9381
|
}
|
|
9555
|
-
const
|
|
9382
|
+
const en = {
|
|
9556
9383
|
pl: `placeholder`,
|
|
9557
9384
|
ti: `title`,
|
|
9558
9385
|
alt: `alt`,
|
|
9559
9386
|
arl: `aria-label`,
|
|
9560
9387
|
arb: `aria-labelledby`,
|
|
9561
9388
|
ard: `aria-describedby`
|
|
9562
|
-
},
|
|
9389
|
+
}, tn = (e) => {
|
|
9563
9390
|
if (!e) return ``;
|
|
9564
9391
|
let { type: t, props: n } = e;
|
|
9565
9392
|
if (t && typeof t == `function`) {
|
|
@@ -9567,8 +9394,8 @@ const $t = {
|
|
|
9567
9394
|
if (`name` in t && typeof t.name == `string` && t.name) return t.name;
|
|
9568
9395
|
}
|
|
9569
9396
|
return t && typeof t == `string` ? t : n.href ? `a` : n[`data-_gt`]?.id ? `C${n[`data-_gt`].id}` : `function`;
|
|
9570
|
-
},
|
|
9571
|
-
let r = Object.entries(
|
|
9397
|
+
}, nn = (e, t, n) => {
|
|
9398
|
+
let r = Object.entries(en).reduce((e, [n, r]) => {
|
|
9572
9399
|
let i = t[r];
|
|
9573
9400
|
return typeof i == `string` && (e[n] = i), e;
|
|
9574
9401
|
}, {});
|
|
@@ -9593,20 +9420,20 @@ const $t = {
|
|
|
9593
9420
|
};
|
|
9594
9421
|
}
|
|
9595
9422
|
return Object.keys(r).length ? r : void 0;
|
|
9596
|
-
},
|
|
9597
|
-
let { props: t } = e, n = { t:
|
|
9423
|
+
}, rn = (e) => {
|
|
9424
|
+
let { props: t } = e, n = { t: tn(e) };
|
|
9598
9425
|
if (t[`data-_gt`]) {
|
|
9599
9426
|
let e = t[`data-_gt`], r = e.transformation;
|
|
9600
9427
|
if (r === `variable`) {
|
|
9601
|
-
let n = e.variableType || `variable`, r =
|
|
9428
|
+
let n = e.variableType || `variable`, r = Qt(t, n), i = Ot(n);
|
|
9602
9429
|
return {
|
|
9603
9430
|
i: e.id,
|
|
9604
9431
|
k: r,
|
|
9605
9432
|
v: i
|
|
9606
9433
|
};
|
|
9607
9434
|
}
|
|
9608
|
-
n.i = e.id, n.d =
|
|
9609
|
-
let i = Object.entries(
|
|
9435
|
+
n.i = e.id, n.d = nn(r, t, e.branches);
|
|
9436
|
+
let i = Object.entries(en).reduce((e, [n, r]) => {
|
|
9610
9437
|
let i = t[r];
|
|
9611
9438
|
return typeof i == `string` && (e[n] = i), e;
|
|
9612
9439
|
}, {});
|
|
@@ -9633,21 +9460,21 @@ const $t = {
|
|
|
9633
9460
|
n.d = Object.keys(i).length ? i : void 0;
|
|
9634
9461
|
}
|
|
9635
9462
|
return t.children && (n.c = q(t.children)), n;
|
|
9636
|
-
},
|
|
9463
|
+
}, an = (e) => $t(e) ? rn(e) : typeof e == `number` ? e.toString() : e;
|
|
9637
9464
|
function q(e) {
|
|
9638
|
-
return Array.isArray(e) ? e.map(
|
|
9465
|
+
return Array.isArray(e) ? e.map(an) : an(e);
|
|
9639
9466
|
}
|
|
9640
9467
|
function J(e, t, n) {
|
|
9641
9468
|
let r = ``, i = null;
|
|
9642
9469
|
return typeof e == `number` && !i && n && (r = Et(e, Object.keys(n).filter(Tt), t)), r && !i && (i = n[r]), i;
|
|
9643
9470
|
}
|
|
9644
|
-
function
|
|
9471
|
+
function sn(e) {
|
|
9645
9472
|
return typeof e == `object` && !!e && `data-_gt` in e && typeof e[`data-_gt`] == `object` && !!e[`data-_gt`] && `transformation` in e[`data-_gt`] && e[`data-_gt`]?.transformation === `variable`;
|
|
9646
9473
|
}
|
|
9647
|
-
function
|
|
9474
|
+
function cn(e) {
|
|
9648
9475
|
let t = e[`data-_gt`]?.variableType || `variable`;
|
|
9649
9476
|
return {
|
|
9650
|
-
variableName:
|
|
9477
|
+
variableName: Qt(e, t),
|
|
9651
9478
|
variableType: Ot(t),
|
|
9652
9479
|
injectionType: e[`data-_gt`]?.injectionType || `manual`,
|
|
9653
9480
|
variableValue: (() => {
|
|
@@ -9667,14 +9494,14 @@ function sn(e) {
|
|
|
9667
9494
|
})()
|
|
9668
9495
|
};
|
|
9669
9496
|
}
|
|
9670
|
-
function
|
|
9497
|
+
function un(e) {
|
|
9671
9498
|
return e && e.props && e.props[`data-_gt`] ? e.props[`data-_gt`] : null;
|
|
9672
9499
|
}
|
|
9673
9500
|
function Z({ children: e, defaultLocale: n = `en`, renderVariable: r }) {
|
|
9674
9501
|
let i = (e) => {
|
|
9675
|
-
let i =
|
|
9676
|
-
if (
|
|
9677
|
-
let { variableType: t, variableValue: i, variableOptions: a, injectionType: o } =
|
|
9502
|
+
let i = un(e);
|
|
9503
|
+
if (sn(e.props)) {
|
|
9504
|
+
let { variableType: t, variableValue: i, variableOptions: a, injectionType: o } = cn(e.props);
|
|
9678
9505
|
return r({
|
|
9679
9506
|
variableType: t,
|
|
9680
9507
|
variableValue: i,
|
|
@@ -9707,9 +9534,9 @@ function Z({ children: e, defaultLocale: n = `en`, renderVariable: r }) {
|
|
|
9707
9534
|
}, a = (e) => t$1.isValidElement(e) ? i(e) : e, o = (e) => Array.isArray(e) ? t$1.Children.map(e, a) : a(e);
|
|
9708
9535
|
return o(e);
|
|
9709
9536
|
}
|
|
9710
|
-
function
|
|
9537
|
+
function dn({ sourceElement: e, targetElement: n, locales: r = [`en`], renderVariable: i }) {
|
|
9711
9538
|
let { props: a } = e, o = a[`data-_gt`], s = o?.transformation, c = n.d, l = {};
|
|
9712
|
-
if (c && Object.entries(
|
|
9539
|
+
if (c && Object.entries(en).forEach(([e, t]) => {
|
|
9713
9540
|
c[e] && (l[t] = c[e]);
|
|
9714
9541
|
}), s === `plural`) {
|
|
9715
9542
|
let t = e.props.n;
|
|
@@ -9768,18 +9595,18 @@ function Q({ source: e, target: n, locales: r = [`en`], renderVariable: i }) {
|
|
|
9768
9595
|
if (typeof n == `string`) return n;
|
|
9769
9596
|
if (Array.isArray(n) && !Array.isArray(e) && e && (e = [e]), Array.isArray(e) && Array.isArray(n)) {
|
|
9770
9597
|
let a = {}, o = {}, c = {}, l = e.filter((e) => {
|
|
9771
|
-
if (t$1.isValidElement(e)) if (
|
|
9772
|
-
let { variableName: t, variableValue: n, variableOptions: r, injectionType: i } =
|
|
9598
|
+
if (t$1.isValidElement(e)) if (sn(e.props)) {
|
|
9599
|
+
let { variableName: t, variableValue: n, variableOptions: r, injectionType: i } = cn(e.props);
|
|
9773
9600
|
a[t] = n, o[t] = r, c[t] = i;
|
|
9774
9601
|
} else return !0;
|
|
9775
9602
|
return !1;
|
|
9776
9603
|
}), u = (e) => l.find((t) => {
|
|
9777
|
-
let n =
|
|
9604
|
+
let n = un(t);
|
|
9778
9605
|
return n?.id === void 0 ? !1 : n.id === e.i;
|
|
9779
9606
|
}) || l.shift();
|
|
9780
9607
|
return n.map((e, n) => {
|
|
9781
9608
|
if (typeof e == `string`) return jsx(t$1.Fragment, { children: e }, `string_${n}`);
|
|
9782
|
-
if (
|
|
9609
|
+
if (ie(e)) return jsx(t$1.Fragment, { children: i({
|
|
9783
9610
|
variableType: e.v || `v`,
|
|
9784
9611
|
variableValue: a[e.k],
|
|
9785
9612
|
variableOptions: o[e.k],
|
|
@@ -9787,7 +9614,7 @@ function Q({ source: e, target: n, locales: r = [`en`], renderVariable: i }) {
|
|
|
9787
9614
|
injectionType: c[e.k] || `manual`
|
|
9788
9615
|
}) }, `var_${n}`);
|
|
9789
9616
|
let l = u(e);
|
|
9790
|
-
return l ? jsx(t$1.Fragment, { children:
|
|
9617
|
+
return l ? jsx(t$1.Fragment, { children: dn({
|
|
9791
9618
|
sourceElement: l,
|
|
9792
9619
|
targetElement: e,
|
|
9793
9620
|
locales: r,
|
|
@@ -9796,16 +9623,16 @@ function Q({ source: e, target: n, locales: r = [`en`], renderVariable: i }) {
|
|
|
9796
9623
|
});
|
|
9797
9624
|
}
|
|
9798
9625
|
if (n && typeof n == `object` && !Array.isArray(n)) {
|
|
9799
|
-
let a =
|
|
9626
|
+
let a = ie(n) ? `variable` : `element`;
|
|
9800
9627
|
if (t$1.isValidElement(e)) {
|
|
9801
|
-
if (a === `element`) return
|
|
9628
|
+
if (a === `element`) return dn({
|
|
9802
9629
|
sourceElement: e,
|
|
9803
9630
|
targetElement: n,
|
|
9804
9631
|
locales: r,
|
|
9805
9632
|
renderVariable: i
|
|
9806
9633
|
});
|
|
9807
|
-
if (
|
|
9808
|
-
let { variableValue: t, variableOptions: n, variableType: a, injectionType: o } =
|
|
9634
|
+
if (sn(e.props)) {
|
|
9635
|
+
let { variableValue: t, variableOptions: n, variableType: a, injectionType: o } = cn(e.props);
|
|
9809
9636
|
return i({
|
|
9810
9637
|
variableType: a,
|
|
9811
9638
|
variableValue: t,
|
|
@@ -9822,15 +9649,15 @@ function Q({ source: e, target: n, locales: r = [`en`], renderVariable: i }) {
|
|
|
9822
9649
|
renderVariable: i
|
|
9823
9650
|
});
|
|
9824
9651
|
}
|
|
9825
|
-
const
|
|
9652
|
+
const mn = `generaltranslation.locale`;
|
|
9826
9653
|
e.use;
|
|
9827
|
-
function
|
|
9654
|
+
function Yn({ children: e }) {
|
|
9828
9655
|
return e;
|
|
9829
9656
|
}
|
|
9830
|
-
function
|
|
9831
|
-
return
|
|
9657
|
+
function Xn(e) {
|
|
9658
|
+
return Yn(e);
|
|
9832
9659
|
}
|
|
9833
|
-
|
|
9660
|
+
Yn._gtt = `derive`, Xn._gtt = `derive`;
|
|
9834
9661
|
//#endregion
|
|
9835
9662
|
//#region src/shared/cookies.ts
|
|
9836
9663
|
/**
|
|
@@ -9861,7 +9688,7 @@ function setCookieValue(cookieName, value) {
|
|
|
9861
9688
|
* @returns The determined locale
|
|
9862
9689
|
*
|
|
9863
9690
|
*/
|
|
9864
|
-
function determineLocale({ defaultLocale, locales, customMapping, localeCookieName =
|
|
9691
|
+
function determineLocale({ defaultLocale, locales, customMapping, localeCookieName = mn, getLocale }) {
|
|
9865
9692
|
const localeConfig = {
|
|
9866
9693
|
defaultLocale,
|
|
9867
9694
|
locales,
|
|
@@ -9896,7 +9723,7 @@ var BrowserConditionStore = class {
|
|
|
9896
9723
|
/**
|
|
9897
9724
|
* @param {BrowserConditionStoreConstructorParams} params - The configuration for the BrowserConditionStore
|
|
9898
9725
|
*/
|
|
9899
|
-
constructor({ getLocale, localeCookieName =
|
|
9726
|
+
constructor({ getLocale, localeCookieName = mn, ...localeConfig } = {}) {
|
|
9900
9727
|
this.localeConfig = localeConfig;
|
|
9901
9728
|
this.customGetLocale = getLocale;
|
|
9902
9729
|
this.localeCookieName = localeCookieName;
|
|
@@ -10641,7 +10468,7 @@ GtInternalTranslateJsx._gtt = "translate-client-automatic";
|
|
|
10641
10468
|
* Implementation for the T component logic
|
|
10642
10469
|
*/
|
|
10643
10470
|
function useComputeT({ children: sourceChildren, ...params }) {
|
|
10644
|
-
const taggedSourceChildren = useMemo(() =>
|
|
10471
|
+
const taggedSourceChildren = useMemo(() => Ht(Jt(sourceChildren)), [sourceChildren]);
|
|
10645
10472
|
const sourceJsxChildren = useMemo(() => q(taggedSourceChildren), [taggedSourceChildren]);
|
|
10646
10473
|
const renderSourceChildren = () => Z({
|
|
10647
10474
|
children: taggedSourceChildren,
|