gt-react 10.19.16 → 10.19.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Branch, Currency, DateTime, Derive, GTProvider as GTProvider$1, Num, Plural, RelativeTime, Static, T, Var, declareStatic, declareVar, decodeMsg, decodeOptions, decodeVars, derive, gtFallback, mFallback, msg, useDefaultLocale, useGT, useGTClass, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocaleSelector as useLocaleSelector$1, useLocales, useMessages, useRegion, useRegionSelector, useRegionSelector as useRegionSelector$1, useSetLocale, useTranslations, useVersionId } from "@generaltranslation/react-core";
2
2
  import * as e from "react";
3
- import { useEffect, useMemo, useRef, useState } from "react";
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { determineLocale, resolveAliasLocale } from "@generaltranslation/format";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import "generaltranslation";
@@ -22,27 +22,41 @@ function readAuthFromEnv({ projectId, devApiKey }) {
22
22
  };
23
23
  }
24
24
  //#endregion
25
+ //#region src/shared/cookies.ts
26
+ /**
27
+ * Minimally parses a cookie value for a given cookie name.
28
+ * @param cookieName - The name of the cookie
29
+ * @returns The cookie value, or undefined when it is not found
30
+ */
31
+ function getCookieValue(cookieName) {
32
+ if (typeof document === "undefined") return void 0;
33
+ return document.cookie.split("; ").find((row) => row.startsWith(`${cookieName}=`))?.split("=")[1];
34
+ }
35
+ /**
36
+ * Sets a cookie value for a given cookie name.
37
+ * @param cookieName - The name of the cookie
38
+ * @param value - The value to set
39
+ */
40
+ function setCookieValue(cookieName, value) {
41
+ if (typeof document === "undefined") return;
42
+ document.cookie = `${cookieName}=${value};path=/`;
43
+ }
44
+ //#endregion
25
45
  //#region src/react-context/provider/hooks/useRegionState.ts
26
- function getNewRegion({ _region, regionCookieName }) {
27
- const cookieRegion = typeof document !== "undefined" ? document.cookie.split("; ").find((row) => row.startsWith(`${regionCookieName}=`))?.split("=")[1] : void 0;
46
+ function getNewRegion(_region, regionCookieName) {
47
+ const cookieRegion = getCookieValue(regionCookieName);
28
48
  const newRegion = _region || cookieRegion;
29
- if (cookieRegion && cookieRegion !== newRegion && typeof document !== "undefined") document.cookie = `${regionCookieName}=${newRegion};path=/`;
49
+ if (cookieRegion && cookieRegion !== newRegion) setCookieValue(regionCookieName, newRegion || "");
30
50
  return newRegion;
31
51
  }
32
52
  function useRegionState({ _region, ssr, regionCookieName }) {
33
- const [region, _setRegion] = useState(ssr ? void 0 : getNewRegion({
34
- _region,
35
- regionCookieName
36
- }));
53
+ const [region, _setRegion] = useState(ssr ? void 0 : getNewRegion(_region, regionCookieName));
37
54
  const setRegion = (region) => {
38
55
  _setRegion(region);
39
- if (typeof document !== "undefined") document.cookie = `${regionCookieName}=${region || ""};path=/`;
56
+ setCookieValue(regionCookieName, region || "");
40
57
  };
41
58
  useEffect(() => {
42
- _setRegion(getNewRegion({
43
- _region,
44
- regionCookieName
45
- }));
59
+ _setRegion(getNewRegion(_region, regionCookieName));
46
60
  }, [_region, regionCookieName]);
47
61
  return {
48
62
  region,
@@ -61,16 +75,15 @@ function useRegionState({ _region, ssr, regionCookieName }) {
61
75
  function useEnableI18n({ enableI18n: _enableI18n, enableI18nCookieName, enableI18nLoaded, ssr }) {
62
76
  const asyncEnabled = enableI18nLoaded !== void 0;
63
77
  const isFirstRender = useRef(true);
64
- const [enableI18n, setEnableI18n] = useState(() => getInitialEnableI18n({
65
- _enableI18n,
66
- asyncEnabled,
67
- enableI18nCookieName,
68
- ssr
69
- }));
78
+ const getCookieEnableI18nValue = () => {
79
+ const rawCookieValue = getCookieValue(enableI18nCookieName);
80
+ return rawCookieValue === "true" ? true : rawCookieValue === "false" ? false : null;
81
+ };
82
+ const [enableI18n, setEnableI18n] = useState(() => !asyncEnabled || ssr ? _enableI18n : getCookieEnableI18nValue() ?? _enableI18n);
70
83
  useEffect(() => {
71
84
  if (ssr && asyncEnabled && isFirstRender.current) {
72
85
  isFirstRender.current = false;
73
- const cookieValue = getCookieEnableI18nValue(enableI18nCookieName);
86
+ const cookieValue = getCookieEnableI18nValue();
74
87
  if (cookieValue !== null && cookieValue !== enableI18n) setEnableI18n(cookieValue);
75
88
  return;
76
89
  }
@@ -88,10 +101,7 @@ function useEnableI18n({ enableI18n: _enableI18n, enableI18nCookieName, enableI1
88
101
  return;
89
102
  }
90
103
  if (!enableI18nLoaded) return;
91
- persistEnableI18nFlagToCookie({
92
- enableI18n: _enableI18n,
93
- enableI18nCookieName
94
- });
104
+ setCookieValue(enableI18nCookieName, _enableI18n ? "true" : "false");
95
105
  setEnableI18n(_enableI18n);
96
106
  }, [
97
107
  _enableI18n,
@@ -102,31 +112,133 @@ function useEnableI18n({ enableI18n: _enableI18n, enableI18nCookieName, enableI1
102
112
  ]);
103
113
  return { enableI18n };
104
114
  }
105
- /**
106
- * Get initial enableI18n flag
107
- */
108
- function getInitialEnableI18n({ _enableI18n, asyncEnabled, enableI18nCookieName, ssr }) {
109
- if (!asyncEnabled) return _enableI18n;
110
- if (ssr) return _enableI18n;
111
- const cookieValue = getCookieEnableI18nValue(enableI18nCookieName);
112
- if (cookieValue !== null) return cookieValue;
113
- return _enableI18n;
114
- }
115
- function getCookieEnableI18nValue(enableI18nCookieName) {
116
- if (typeof document === "undefined") return null;
117
- const rawCookieValue = document.cookie.split("; ").find((row) => row.startsWith(`${enableI18nCookieName}=`))?.split("=")[1];
118
- return rawCookieValue === "true" ? true : rawCookieValue === "false" ? false : null;
119
- }
120
- function persistEnableI18nFlagToCookie({ enableI18n, enableI18nCookieName }) {
121
- if (typeof document === "undefined") return;
122
- document.cookie = `${enableI18nCookieName}=${enableI18n ? "true" : "false"};path=/;`;
115
+ //#endregion
116
+ //#region ../core/dist/base64-r7YWJYWt.mjs
117
+ function ensureSentence(text) {
118
+ const trimmed = text.trim();
119
+ if (!trimmed) return "";
120
+ return /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;
121
+ }
122
+ function stripSentence(text) {
123
+ const trimmed = text.trim();
124
+ let end = trimmed.length;
125
+ while (end > 0) {
126
+ const char = trimmed[end - 1];
127
+ if (char !== "." && char !== "!" && char !== "?") break;
128
+ end -= 1;
129
+ }
130
+ return trimmed.slice(0, end);
131
+ }
132
+ function lowercaseFirstWord(text) {
133
+ return text.replace(/^[A-Z][a-z]/, (match) => match.toLowerCase());
134
+ }
135
+ function formatDetails(details) {
136
+ if (!details) return "";
137
+ const detailText = Array.isArray(details) ? details.join(", ") : details;
138
+ if (!detailText.trim()) return "";
139
+ return ensureSentence(`Details: ${detailText}`);
140
+ }
141
+ function createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {
142
+ const prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : "";
143
+ const whatAndWhy = why ? `${stripSentence(whatHappened)} because ${lowercaseFirstWord(stripSentence(why))}` : whatHappened;
144
+ const shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));
145
+ const messageParts = [
146
+ whatAndWhy,
147
+ reassurance,
148
+ shouldCombineWayOut ? `${stripSentence(fix)}, or ${lowercaseFirstWord(stripSentence(wayOut))}` : fix,
149
+ shouldCombineWayOut ? void 0 : wayOut,
150
+ formatDetails(details)
151
+ ].filter((part) => !!part).map(ensureSentence);
152
+ if (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);
153
+ const message = messageParts.join(" ");
154
+ return prefix ? `${prefix} ${message}` : message;
123
155
  }
124
156
  //#endregion
125
157
  //#region ../react-core/dist/errors.esm.min.mjs
126
- const e$1 = `@generaltranslation/react-core`;
127
- `${e$1}`, `${e$1}`, `${e$1}`, `${e$1}`, `${e$1}`, `${e$1}`, `${e$1}`, `${e$1}`, `${e$1}`;
128
- const t = (t, n, r = e$1) => `${r} Warning: "${n}" is not a supported locale. Update supported locales in your dashboard or gt.config.json. Falling back to "${t}".`;
129
- `${e$1}`, `${e$1}`;
158
+ function e$1(e) {
159
+ let t = e.trim();
160
+ return t ? /[.!?)]$/.test(t) ? t : `${t}.` : ``;
161
+ }
162
+ function t(e) {
163
+ let t = e.trim(), n = t.length;
164
+ for (; n > 0;) {
165
+ let e = t[n - 1];
166
+ if (e !== `.` && e !== `!` && e !== `?`) break;
167
+ --n;
168
+ }
169
+ return t.slice(0, n);
170
+ }
171
+ function n(e) {
172
+ return e.replace(/^[A-Z][a-z]/, (e) => e.toLowerCase());
173
+ }
174
+ function r(t) {
175
+ if (!t) return ``;
176
+ let n = Array.isArray(t) ? t.join(`, `) : t;
177
+ return n.trim() ? e$1(`Details: ${n}`) : ``;
178
+ }
179
+ function i({ source: i, severity: a, whatHappened: o, reassurance: s, why: c, fix: l, wayOut: u, details: d, docsUrl: f }) {
180
+ let p = i ? a ? `${i} ${a}:` : `${i}:` : a ? `${a}:` : ``, m = c ? `${t(o)} because ${n(t(c))}` : o, h = !!l && !!u && /^[a-z]/.test(t(u)), g = [
181
+ m,
182
+ s,
183
+ h ? `${t(l)}, or ${n(t(u))}` : l,
184
+ h ? void 0 : u,
185
+ r(d)
186
+ ].filter((e) => !!e).map(e$1);
187
+ f && g.push(`Learn more: ${f}`);
188
+ let _ = g.join(` `);
189
+ return p ? `${p} ${_}` : _;
190
+ }
191
+ const a = `@generaltranslation/react-core`;
192
+ function o(e) {
193
+ return i({
194
+ source: a,
195
+ ...e
196
+ });
197
+ }
198
+ o({
199
+ severity: `Error`,
200
+ whatHappened: `Runtime translation needs a project ID`,
201
+ fix: `Add projectId to your <GTProvider> configuration or set GT_PROJECT_ID in your environment`,
202
+ docsUrl: `https://generaltranslation.com/dashboard`
203
+ }), o({
204
+ severity: `Error`,
205
+ whatHappened: `Production environments cannot use a development API key`,
206
+ fix: `Replace it with a production API key before deploying`
207
+ }), o({
208
+ severity: `Error`,
209
+ whatHappened: `The API key is available to client-side production code`,
210
+ fix: `Move translation credentials to a server-only environment before deploying`
211
+ }), o({
212
+ severity: `Error`,
213
+ whatHappened: `Runtime translation is not configured`,
214
+ fix: `Add projectId and devApiKey to your environment, or pass them to <GTProvider> directly`
215
+ }), o({
216
+ severity: `Error`,
217
+ whatHappened: `Runtime translations could not be loaded`,
218
+ wayOut: `Source content will render as a fallback`,
219
+ fix: `Check your runtime translation configuration and try again`
220
+ }), o({
221
+ severity: `Error`,
222
+ whatHappened: `Runtime translation could not be completed`
223
+ }), o({
224
+ severity: `Warning`,
225
+ whatHappened: `Runtime translation needs a project ID`,
226
+ fix: `Add projectId to <GTProvider> or set GT_PROJECT_ID in your environment`,
227
+ docsUrl: `https://generaltranslation.com/dashboard`
228
+ }), o({
229
+ severity: `Warning`,
230
+ whatHappened: `Runtime translation needs a development API key`,
231
+ fix: `Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation`
232
+ }), o({
233
+ severity: `Warning`,
234
+ whatHappened: `Runtime translation timed out`
235
+ });
236
+ const s = (e, t, n = a) => `${n} Warning: "${t}" is not a supported locale. Update supported locales in your dashboard or gt.config.json. Falling back to "${e}".`;
237
+ o({
238
+ severity: `Warning`,
239
+ whatHappened: `No dictionary was found`,
240
+ fix: `Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations`
241
+ }), `${a}`;
130
242
  //#endregion
131
243
  //#region ../react-core/dist/internal.esm.min.mjs
132
244
  var c = Object.defineProperty, l = Object.getOwnPropertyDescriptor, u = Object.getOwnPropertyNames, d = Object.prototype.hasOwnProperty, f = (e, t) => () => (e && (t = e(e = 0)), t), p = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), m = (e, t) => {
@@ -143,43 +255,76 @@ var c = Object.defineProperty, l = Object.getOwnPropertyDescriptor, u = Object.g
143
255
  });
144
256
  return e;
145
257
  }, g = (e) => d.call(e, `module.exports`) ? e[`module.exports`] : h(c({}, `__esModule`, { value: !0 }), e);
146
- function w(e) {
258
+ function b(e) {
259
+ let t = e.trim();
260
+ return t ? /[.!?)]$/.test(t) ? t : `${t}.` : ``;
261
+ }
262
+ function x(e) {
263
+ let t = e.trim(), n = t.length;
264
+ for (; n > 0;) {
265
+ let e = t[n - 1];
266
+ if (e !== `.` && e !== `!` && e !== `?`) break;
267
+ --n;
268
+ }
269
+ return t.slice(0, n);
270
+ }
271
+ function te(e) {
272
+ return e.replace(/^[A-Z][a-z]/, (e) => e.toLowerCase());
273
+ }
274
+ function ne(e) {
275
+ if (!e) return ``;
276
+ let t = Array.isArray(e) ? e.join(`, `) : e;
277
+ return t.trim() ? b(`Details: ${t}`) : ``;
278
+ }
279
+ function S({ source: e, severity: t, whatHappened: n, reassurance: r, why: i, fix: a, wayOut: o, details: s, docsUrl: c }) {
280
+ let l = e ? t ? `${e} ${t}:` : `${e}:` : t ? `${t}:` : ``, u = i ? `${x(n)} because ${te(x(i))}` : n, d = !!a && !!o && /^[a-z]/.test(x(o)), f = [
281
+ u,
282
+ r,
283
+ d ? `${x(a)}, or ${te(x(o))}` : a,
284
+ d ? void 0 : o,
285
+ ne(s)
286
+ ].filter((e) => !!e).map(b);
287
+ c && f.push(`Learn more: ${c}`);
288
+ let p = f.join(` `);
289
+ return l ? `${l} ${p}` : p;
290
+ }
291
+ function ie(e) {
147
292
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === `Uint8Array` && `BYTES_PER_ELEMENT` in e && e.BYTES_PER_ELEMENT === 1;
148
293
  }
149
- function T$1(e, t, n = ``) {
150
- let r = w(e), i = e?.length, a = t !== void 0;
294
+ function D(e, t, n = ``) {
295
+ let r = ie(e), i = e?.length, a = t !== void 0;
151
296
  if (!r || a && i !== t) {
152
297
  let o = n && `"${n}" `, s = a ? ` of length ${t}` : ``, c = r ? `length=${i}` : `type=${typeof e}`, l = o + `expected Uint8Array` + s + `, got ` + c;
153
298
  throw r ? RangeError(l) : TypeError(l);
154
299
  }
155
300
  return e;
156
301
  }
157
- function E(e, t = !0) {
302
+ function ae(e, t = !0) {
158
303
  if (e.destroyed) throw Error(`Hash instance has been destroyed`);
159
304
  if (t && e.finished) throw Error(`Hash#digest() has already been called`);
160
305
  }
161
- function D(e, t) {
162
- T$1(e, void 0, `digestInto() output`);
306
+ function oe(e, t) {
307
+ D(e, void 0, `digestInto() output`);
163
308
  let n = t.outputLen;
164
309
  if (e.length < n) throw RangeError(`"digestInto() output" expected to be of length >=` + n);
165
310
  }
166
- function O(...e) {
311
+ function se(...e) {
167
312
  for (let t = 0; t < e.length; t++) e[t].fill(0);
168
313
  }
169
- function k(e) {
314
+ function ce(e) {
170
315
  return new DataView(e.buffer, e.byteOffset, e.byteLength);
171
316
  }
172
- function A(e, t) {
317
+ function O(e, t) {
173
318
  return e << 32 - t | e >>> t;
174
319
  }
175
320
  new Uint8Array(new Uint32Array([287454020]).buffer)[0];
176
321
  typeof Uint8Array.from([]).toHex == `function` && Uint8Array.fromHex;
177
322
  Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, `0`));
178
- function oe(e, t = {}) {
323
+ function pe(e, t = {}) {
179
324
  let n = (t, n) => e(n).update(t).digest(), r = e(void 0);
180
325
  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);
181
326
  }
182
- const se = (e) => ({ oid: Uint8Array.from([
327
+ const me = (e) => ({ oid: Uint8Array.from([
183
328
  6,
184
329
  9,
185
330
  96,
@@ -192,13 +337,13 @@ const se = (e) => ({ oid: Uint8Array.from([
192
337
  2,
193
338
  e
194
339
  ]) });
195
- function ce(e, t, n) {
340
+ function he(e, t, n) {
196
341
  return e & t ^ ~e & n;
197
342
  }
198
- function le(e, t, n) {
343
+ function ge(e, t, n) {
199
344
  return e & t ^ e & n ^ t & n;
200
345
  }
201
- var ue = class {
346
+ var _e = class {
202
347
  blockLen;
203
348
  outputLen;
204
349
  canXOF = !1;
@@ -211,15 +356,15 @@ var ue = class {
211
356
  pos = 0;
212
357
  destroyed = !1;
213
358
  constructor(e, t, n, r) {
214
- this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = k(this.buffer);
359
+ this.blockLen = e, this.outputLen = t, this.padOffset = n, this.isLE = r, this.buffer = new Uint8Array(e), this.view = ce(this.buffer);
215
360
  }
216
361
  update(e) {
217
- E(this), T$1(e);
362
+ ae(this), D(e);
218
363
  let { view: t, buffer: n, blockLen: r } = this, i = e.length;
219
364
  for (let a = 0; a < i;) {
220
365
  let o = Math.min(r - this.pos, i - a);
221
366
  if (o === r) {
222
- let t = k(e);
367
+ let t = ce(e);
223
368
  for (; r <= i - a; a += r) this.process(t, a);
224
369
  continue;
225
370
  }
@@ -228,12 +373,12 @@ var ue = class {
228
373
  return this.length += e.length, this.roundClean(), this;
229
374
  }
230
375
  digestInto(e) {
231
- E(this), D(e, this), this.finished = !0;
376
+ ae(this), oe(e, this), this.finished = !0;
232
377
  let { buffer: t, view: n, blockLen: r, isLE: i } = this, { pos: a } = this;
233
- t[a++] = 128, O(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
378
+ t[a++] = 128, se(this.buffer.subarray(a)), this.padOffset > r - a && (this.process(n, 0), a = 0);
234
379
  for (let e = a; e < r; e++) t[e] = 0;
235
380
  n.setBigUint64(r - 8, BigInt(this.length * 8), i), this.process(n, 0);
236
- let o = k(e), s = this.outputLen;
381
+ let o = ce(e), s = this.outputLen;
237
382
  if (s % 4) throw Error(`_sha2: outputLen must be aligned to 32bit`);
238
383
  let c = s / 4, l = this.get();
239
384
  if (c > l.length) throw Error(`_sha2: outputLen bigger than state`);
@@ -254,7 +399,7 @@ var ue = class {
254
399
  return this._cloneInto();
255
400
  }
256
401
  };
257
- const j = Uint32Array.from([
402
+ const k = Uint32Array.from([
258
403
  1779033703,
259
404
  3144134277,
260
405
  1013904242,
@@ -263,25 +408,25 @@ const j = Uint32Array.from([
263
408
  2600822924,
264
409
  528734635,
265
410
  1541459225
266
- ]), M = BigInt(2 ** 32 - 1), de = BigInt(32);
267
- function fe(e, t = !1) {
411
+ ]), A = BigInt(2 ** 32 - 1), ve = BigInt(32);
412
+ function ye(e, t = !1) {
268
413
  return t ? {
269
- h: Number(e & M),
270
- l: Number(e >> de & M)
414
+ h: Number(e & A),
415
+ l: Number(e >> ve & A)
271
416
  } : {
272
- h: Number(e >> de & M) | 0,
273
- l: Number(e & M) | 0
417
+ h: Number(e >> ve & A) | 0,
418
+ l: Number(e & A) | 0
274
419
  };
275
420
  }
276
- function pe(e, t = !1) {
421
+ function be(e, t = !1) {
277
422
  let n = e.length, r = new Uint32Array(n), i = new Uint32Array(n);
278
423
  for (let a = 0; a < n; a++) {
279
- let { h: n, l: o } = fe(e[a], t);
424
+ let { h: n, l: o } = ye(e[a], t);
280
425
  [r[a], i[a]] = [n, o];
281
426
  }
282
427
  return [r, i];
283
428
  }
284
- const me = Uint32Array.from([
429
+ const xe = Uint32Array.from([
285
430
  1116352408,
286
431
  1899447441,
287
432
  3049323471,
@@ -346,8 +491,8 @@ const me = Uint32Array.from([
346
491
  2756734187,
347
492
  3204031479,
348
493
  3329325298
349
- ]), N = new Uint32Array(64);
350
- var he = class extends ue {
494
+ ]), j = new Uint32Array(64);
495
+ var Se = class extends _e {
351
496
  constructor(e) {
352
497
  super(64, e, 8, !1);
353
498
  }
@@ -368,41 +513,41 @@ var he = class extends ue {
368
513
  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;
369
514
  }
370
515
  process(e, t) {
371
- for (let n = 0; n < 16; n++, t += 4) N[n] = e.getUint32(t, !1);
516
+ for (let n = 0; n < 16; n++, t += 4) j[n] = e.getUint32(t, !1);
372
517
  for (let e = 16; e < 64; e++) {
373
- let t = N[e - 15], n = N[e - 2], r = A(t, 7) ^ A(t, 18) ^ t >>> 3;
374
- N[e] = (A(n, 17) ^ A(n, 19) ^ n >>> 10) + N[e - 7] + r + N[e - 16] | 0;
518
+ let t = j[e - 15], n = j[e - 2], r = O(t, 7) ^ O(t, 18) ^ t >>> 3;
519
+ j[e] = (O(n, 17) ^ O(n, 19) ^ n >>> 10) + j[e - 7] + r + j[e - 16] | 0;
375
520
  }
376
521
  let { A: n, B: r, C: i, D: a, E: o, F: s, G: c, H: l } = this;
377
522
  for (let e = 0; e < 64; e++) {
378
- let t = A(o, 6) ^ A(o, 11) ^ A(o, 25), u = l + t + ce(o, s, c) + me[e] + N[e] | 0, d = (A(n, 2) ^ A(n, 13) ^ A(n, 22)) + le(n, r, i) | 0;
523
+ let t = O(o, 6) ^ O(o, 11) ^ O(o, 25), u = l + t + he(o, s, c) + xe[e] + j[e] | 0, d = (O(n, 2) ^ O(n, 13) ^ O(n, 22)) + ge(n, r, i) | 0;
379
524
  l = c, c = s, s = o, o = a + u | 0, a = i, i = r, r = n, n = u + d | 0;
380
525
  }
381
526
  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);
382
527
  }
383
528
  roundClean() {
384
- O(N);
529
+ se(j);
385
530
  }
386
531
  destroy() {
387
- this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), O(this.buffer);
388
- }
389
- }, ge = class extends he {
390
- A = j[0] | 0;
391
- B = j[1] | 0;
392
- C = j[2] | 0;
393
- D = j[3] | 0;
394
- E = j[4] | 0;
395
- F = j[5] | 0;
396
- G = j[6] | 0;
397
- H = j[7] | 0;
532
+ this.destroyed = !0, this.set(0, 0, 0, 0, 0, 0, 0, 0), se(this.buffer);
533
+ }
534
+ }, Ce = class extends Se {
535
+ A = k[0] | 0;
536
+ B = k[1] | 0;
537
+ C = k[2] | 0;
538
+ D = k[3] | 0;
539
+ E = k[4] | 0;
540
+ F = k[5] | 0;
541
+ G = k[6] | 0;
542
+ H = k[7] | 0;
398
543
  constructor() {
399
544
  super(32);
400
545
  }
401
546
  };
402
- const _e = pe(`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)));
403
- _e[0], _e[1];
404
- oe(() => new ge(), se(1));
405
- const ye = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${e}.`, be = `DEFAULT_TERMINATOR_KEY`, xe = {
547
+ const we = be(`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)));
548
+ we[0], we[1];
549
+ pe(() => new Ce(), me(1));
550
+ const Ee = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${e}.`, De = `DEFAULT_TERMINATOR_KEY`, Oe = {
406
551
  ellipsis: {
407
552
  fr: {
408
553
  terminator: `…`,
@@ -416,37 +561,35 @@ const ye = (e) => `generaltranslation Formatting Error: Invalid cutoff style: ${
416
561
  terminator: `……`,
417
562
  separator: void 0
418
563
  },
419
- [be]: {
564
+ [De]: {
420
565
  terminator: `…`,
421
566
  separator: void 0
422
567
  }
423
568
  },
424
- none: { [be]: {
569
+ none: { [De]: {
425
570
  terminator: void 0,
426
571
  separator: void 0
427
572
  } }
428
573
  };
429
- var Se = class {
430
- constructor(e, t = {}) {
574
+ var ke = class e {
575
+ static resolveLocale(e) {
431
576
  try {
432
- let t = e ? Array.isArray(e) ? e.map((e) => String(e)) : [String(e)] : [`en`], n = Intl.getCanonicalLocales(t);
433
- this.locale = n.length ? n[0] : `en`;
577
+ let t = e ? Array.isArray(e) ? e.map(String) : [String(e)] : [`en`], [n] = Intl.getCanonicalLocales(t);
578
+ return n ?? `en`;
434
579
  } catch {
435
- this.locale = `en`;
436
- }
437
- if (!xe[t.style ?? `ellipsis`]) throw Error(ye(t.style ?? `ellipsis`));
438
- let n, r;
439
- if (t.maxChars !== void 0) {
440
- n = t.style ?? `ellipsis`;
441
- let e = new Intl.Locale(this.locale).language;
442
- r = xe[n][e] || xe[n].DEFAULT_TERMINATOR_KEY;
580
+ return `en`;
443
581
  }
444
- let i = t.terminator ?? r?.terminator, a = i == null ? void 0 : t.separator ?? r?.separator;
445
- this.additionLength = (i?.length ?? 0) + (a?.length ?? 0), t.maxChars !== void 0 && Math.abs(t.maxChars) < this.additionLength && (i = void 0, a = void 0), this.options = {
446
- maxChars: t.maxChars,
447
- style: n,
448
- terminator: i,
449
- separator: a
582
+ }
583
+ constructor(t, n = {}) {
584
+ this.locale = e.resolveLocale(t);
585
+ let r = n.style ?? `ellipsis`;
586
+ if (!Oe[r]) throw Error(Ee(r));
587
+ let i = n.maxChars === void 0 ? void 0 : Oe[r][new Intl.Locale(this.locale).language] || Oe[r].DEFAULT_TERMINATOR_KEY, a = n.terminator ?? i?.terminator, o = a == null ? void 0 : n.separator ?? i?.separator;
588
+ 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 = {
589
+ maxChars: n.maxChars,
590
+ style: n.maxChars === void 0 ? void 0 : r,
591
+ terminator: a,
592
+ separator: o
450
593
  };
451
594
  }
452
595
  format(e) {
@@ -468,7 +611,7 @@ var Se = class {
468
611
  return this.options;
469
612
  }
470
613
  };
471
- const Ce = {
614
+ const Ae = {
472
615
  Collator: Intl.Collator,
473
616
  DateTimeFormat: Intl.DateTimeFormat,
474
617
  DisplayNames: Intl.DisplayNames,
@@ -478,81 +621,83 @@ const Ce = {
478
621
  PluralRules: Intl.PluralRules,
479
622
  RelativeTimeFormat: Intl.RelativeTimeFormat,
480
623
  Segmenter: Intl.Segmenter,
481
- CutoffFormat: Se
624
+ CutoffFormat: ke
482
625
  };
483
626
  new class {
484
627
  constructor() {
485
628
  this.cache = {};
486
629
  }
487
- _generateKey(e, t = {}) {
630
+ generateKey(e, t = {}) {
488
631
  return `${e ? Array.isArray(e) ? e.map((e) => String(e)).join(`,`) : String(e) : `undefined`}:${t ? JSON.stringify(t, Object.keys(t).sort()) : `{}`}`;
489
632
  }
490
633
  get(e, ...t) {
491
- let [n = `en`, r = {}] = t, i = this._generateKey(n, r), a = this.cache[e]?.[i];
492
- return a === void 0 && (a = new Ce[e](...t), this.cache[e] || (this.cache[e] = {}), this.cache[e][i] = a), a;
634
+ let [n = `en`, r = {}] = t, i = this.generateKey(n, r), a = this.cache[e];
635
+ a === void 0 && (a = {}, this.cache[e] = a);
636
+ let o = a[i];
637
+ return o === void 0 && (o = new Ae[e](...t), a[i] = o), o;
493
638
  }
494
639
  }();
495
- var P = m({
496
- __addDisposableResource: () => Ze,
497
- __assign: () => R,
498
- __asyncDelegator: () => Ue,
499
- __asyncGenerator: () => He,
500
- __asyncValues: () => We,
501
- __await: () => I,
502
- __awaiter: () => Fe,
503
- __classPrivateFieldGet: () => Je,
504
- __classPrivateFieldIn: () => Xe,
505
- __classPrivateFieldSet: () => Ye,
506
- __createBinding: () => z,
507
- __decorate: () => Oe,
508
- __disposeResources: () => Qe,
509
- __esDecorate: () => Ae,
510
- __exportStar: () => Le,
511
- __extends: () => Ee,
512
- __generator: () => Ie,
513
- __importDefault: () => qe,
514
- __importStar: () => Ke,
515
- __makeTemplateObject: () => Ge,
516
- __metadata: () => Pe,
517
- __param: () => ke,
518
- __propKey: () => Me,
519
- __read: () => Re,
520
- __rest: () => De,
521
- __rewriteRelativeImportExtension: () => $e,
522
- __runInitializers: () => je,
523
- __setFunctionName: () => Ne,
524
- __spread: () => ze,
525
- __spreadArray: () => Ve,
526
- __spreadArrays: () => Be,
527
- __values: () => F,
528
- default: () => nt
640
+ var M = m({
641
+ __addDisposableResource: () => it,
642
+ __assign: () => F,
643
+ __asyncDelegator: () => Xe,
644
+ __asyncGenerator: () => Ye,
645
+ __asyncValues: () => Ze,
646
+ __await: () => P,
647
+ __awaiter: () => He,
648
+ __classPrivateFieldGet: () => tt,
649
+ __classPrivateFieldIn: () => rt,
650
+ __classPrivateFieldSet: () => nt,
651
+ __createBinding: () => I,
652
+ __decorate: () => Fe,
653
+ __disposeResources: () => at,
654
+ __esDecorate: () => Le,
655
+ __exportStar: () => We,
656
+ __extends: () => Ne,
657
+ __generator: () => Ue,
658
+ __importDefault: () => et,
659
+ __importStar: () => $e,
660
+ __makeTemplateObject: () => Qe,
661
+ __metadata: () => Ve,
662
+ __param: () => Ie,
663
+ __propKey: () => ze,
664
+ __read: () => Ge,
665
+ __rest: () => Pe,
666
+ __rewriteRelativeImportExtension: () => ot,
667
+ __runInitializers: () => Re,
668
+ __setFunctionName: () => Be,
669
+ __spread: () => Ke,
670
+ __spreadArray: () => Je,
671
+ __spreadArrays: () => qe,
672
+ __values: () => N,
673
+ default: () => ut
529
674
  });
530
- function Ee(e, t) {
675
+ function Ne(e, t) {
531
676
  if (typeof t != `function` && t !== null) throw TypeError(`Class extends value ` + String(t) + ` is not a constructor or null`);
532
- L(e, t);
677
+ st(e, t);
533
678
  function n() {
534
679
  this.constructor = e;
535
680
  }
536
681
  e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
537
682
  }
538
- function De(e, t) {
683
+ function Pe(e, t) {
539
684
  var n = {};
540
685
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
541
686
  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]]);
542
687
  return n;
543
688
  }
544
- function Oe(e, t, n, r) {
689
+ function Fe(e, t, n, r) {
545
690
  var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
546
691
  if (typeof Reflect == `object` && typeof Reflect.decorate == `function`) a = Reflect.decorate(e, t, n, r);
547
692
  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);
548
693
  return i > 3 && a && Object.defineProperty(t, n, a), a;
549
694
  }
550
- function ke(e, t) {
695
+ function Ie(e, t) {
551
696
  return function(n, r) {
552
697
  t(n, r, e);
553
698
  };
554
699
  }
555
- function Ae(e, t, n, r, i, a) {
700
+ function Le(e, t, n, r, i, a) {
556
701
  function o(e) {
557
702
  if (e !== void 0 && typeof e != `function`) throw TypeError(`Function expected`);
558
703
  return e;
@@ -577,23 +722,23 @@ function Ae(e, t, n, r, i, a) {
577
722
  }
578
723
  l && Object.defineProperty(l, r.name, u), f = !0;
579
724
  }
580
- function je(e, t, n) {
725
+ function Re(e, t, n) {
581
726
  for (var r = arguments.length > 2, i = 0; i < t.length; i++) n = r ? t[i].call(e, n) : t[i].call(e);
582
727
  return r ? n : void 0;
583
728
  }
584
- function Me(e) {
729
+ function ze(e) {
585
730
  return typeof e == `symbol` ? e : `${e}`;
586
731
  }
587
- function Ne(e, t, n) {
732
+ function Be(e, t, n) {
588
733
  return typeof t == `symbol` && (t = t.description ? `[${t.description}]` : ``), Object.defineProperty(e, `name`, {
589
734
  configurable: !0,
590
735
  value: n ? `${n} ${t}` : t
591
736
  });
592
737
  }
593
- function Pe(e, t) {
738
+ function Ve(e, t) {
594
739
  if (typeof Reflect == `object` && typeof Reflect.metadata == `function`) return Reflect.metadata(e, t);
595
740
  }
596
- function Fe(e, t, n, r) {
741
+ function He(e, t, n, r) {
597
742
  function i(e) {
598
743
  return e instanceof n ? e : new n(function(t) {
599
744
  t(e);
@@ -620,7 +765,7 @@ function Fe(e, t, n, r) {
620
765
  c((r = r.apply(e, t || [])).next());
621
766
  });
622
767
  }
623
- function Ie(e, t) {
768
+ function Ue(e, t) {
624
769
  var n = {
625
770
  label: 0,
626
771
  sent: function() {
@@ -690,10 +835,10 @@ function Ie(e, t) {
690
835
  };
691
836
  }
692
837
  }
693
- function Le(e, t) {
694
- for (var n in e) n !== `default` && !Object.prototype.hasOwnProperty.call(t, n) && z(t, e, n);
838
+ function We(e, t) {
839
+ for (var n in e) n !== `default` && !Object.prototype.hasOwnProperty.call(t, n) && I(t, e, n);
695
840
  }
696
- function F(e) {
841
+ function N(e) {
697
842
  var t = typeof Symbol == `function` && Symbol.iterator, n = t && e[t], r = 0;
698
843
  if (n) return n.call(e);
699
844
  if (e && typeof e.length == `number`) return { next: function() {
@@ -704,7 +849,7 @@ function F(e) {
704
849
  } };
705
850
  throw TypeError(t ? `Object is not iterable.` : `Symbol.iterator is not defined.`);
706
851
  }
707
- function Re(e, t) {
852
+ function Ge(e, t) {
708
853
  var n = typeof Symbol == `function` && e[Symbol.iterator];
709
854
  if (!n) return e;
710
855
  var r = n.call(e), i, a = [], o;
@@ -721,23 +866,23 @@ function Re(e, t) {
721
866
  }
722
867
  return a;
723
868
  }
724
- function ze() {
725
- for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(Re(arguments[t]));
869
+ function Ke() {
870
+ for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(Ge(arguments[t]));
726
871
  return e;
727
872
  }
728
- function Be() {
873
+ function qe() {
729
874
  for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length;
730
875
  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];
731
876
  return r;
732
877
  }
733
- function Ve(e, t, n) {
878
+ function Je(e, t, n) {
734
879
  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]);
735
880
  return e.concat(a || Array.prototype.slice.call(t));
736
881
  }
737
- function I(e) {
738
- return this instanceof I ? (this.v = e, this) : new I(e);
882
+ function P(e) {
883
+ return this instanceof P ? (this.v = e, this) : new P(e);
739
884
  }
740
- function He(e, t, n) {
885
+ function Ye(e, t, n) {
741
886
  if (!Symbol.asyncIterator) throw TypeError(`Symbol.asyncIterator is not defined.`);
742
887
  var r = n.apply(e, t || []), i, a = [];
743
888
  return i = Object.create((typeof AsyncIterator == `function` ? AsyncIterator : Object).prototype), s(`next`), s(`throw`), s(`return`, o), i[Symbol.asyncIterator] = function() {
@@ -768,7 +913,7 @@ function He(e, t, n) {
768
913
  }
769
914
  }
770
915
  function l(e) {
771
- e.value instanceof I ? Promise.resolve(e.value.v).then(u, d) : f(a[0][2], e);
916
+ e.value instanceof P ? Promise.resolve(e.value.v).then(u, d) : f(a[0][2], e);
772
917
  }
773
918
  function u(e) {
774
919
  c(`next`, e);
@@ -780,7 +925,7 @@ function He(e, t, n) {
780
925
  e(t), a.shift(), a.length && c(a[0][0], a[0][1]);
781
926
  }
782
927
  }
783
- function Ue(e) {
928
+ function Xe(e) {
784
929
  var t, n;
785
930
  return t = {}, r(`next`), r(`throw`, function(e) {
786
931
  throw e;
@@ -790,16 +935,16 @@ function Ue(e) {
790
935
  function r(r, i) {
791
936
  t[r] = e[r] ? function(t) {
792
937
  return (n = !n) ? {
793
- value: I(e[r](t)),
938
+ value: P(e[r](t)),
794
939
  done: !1
795
940
  } : i ? i(t) : t;
796
941
  } : i;
797
942
  }
798
943
  }
799
- function We(e) {
944
+ function Ze(e) {
800
945
  if (!Symbol.asyncIterator) throw TypeError(`Symbol.asyncIterator is not defined.`);
801
946
  var t = e[Symbol.asyncIterator], n;
802
- return t ? t.call(e) : (e = typeof F == `function` ? F(e) : e[Symbol.iterator](), n = {}, r(`next`), r(`throw`), r(`return`), n[Symbol.asyncIterator] = function() {
947
+ return t ? t.call(e) : (e = typeof N == `function` ? N(e) : e[Symbol.iterator](), n = {}, r(`next`), r(`throw`), r(`return`), n[Symbol.asyncIterator] = function() {
803
948
  return this;
804
949
  }, n);
805
950
  function r(t) {
@@ -818,34 +963,34 @@ function We(e) {
818
963
  }, t);
819
964
  }
820
965
  }
821
- function Ge(e, t) {
966
+ function Qe(e, t) {
822
967
  return Object.defineProperty ? Object.defineProperty(e, `raw`, { value: t }) : e.raw = t, e;
823
968
  }
824
- function Ke(e) {
969
+ function $e(e) {
825
970
  if (e && e.__esModule) return e;
826
971
  var t = {};
827
- if (e != null) for (var n = B(e), r = 0; r < n.length; r++) n[r] !== `default` && z(t, e, n[r]);
828
- return et(t, e), t;
972
+ if (e != null) for (var n = L(e), r = 0; r < n.length; r++) n[r] !== `default` && I(t, e, n[r]);
973
+ return ct(t, e), t;
829
974
  }
830
- function qe(e) {
975
+ function et(e) {
831
976
  return e && e.__esModule ? e : { default: e };
832
977
  }
833
- function Je(e, t, n, r) {
978
+ function tt(e, t, n, r) {
834
979
  if (n === `a` && !r) throw TypeError(`Private accessor was defined without a getter`);
835
980
  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`);
836
981
  return n === `m` ? r : n === `a` ? r.call(e) : r ? r.value : t.get(e);
837
982
  }
838
- function Ye(e, t, n, r, i) {
983
+ function nt(e, t, n, r, i) {
839
984
  if (r === `m`) throw TypeError(`Private method is not writable`);
840
985
  if (r === `a` && !i) throw TypeError(`Private accessor was defined without a setter`);
841
986
  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`);
842
987
  return r === `a` ? i.call(e, n) : i ? i.value = n : t.set(e, n), n;
843
988
  }
844
- function Xe(e, t) {
989
+ function rt(e, t) {
845
990
  if (t === null || typeof t != `object` && typeof t != `function`) throw TypeError(`Cannot use 'in' operator on non-object`);
846
991
  return typeof e == `function` ? t === e : e.has(t);
847
992
  }
848
- function Ze(e, t, n) {
993
+ function it(e, t, n) {
849
994
  if (t != null) {
850
995
  if (typeof t != `object` && typeof t != `function`) throw TypeError(`Object expected.`);
851
996
  var r, i;
@@ -872,9 +1017,9 @@ function Ze(e, t, n) {
872
1017
  } else n && e.stack.push({ async: !0 });
873
1018
  return t;
874
1019
  }
875
- function Qe(e) {
1020
+ function at(e) {
876
1021
  function t(t) {
877
- e.error = e.hasError ? new tt(t, e.error, `An error was suppressed during disposal.`) : t, e.hasError = !0;
1022
+ e.error = e.hasError ? new lt(t, e.error, `An error was suppressed during disposal.`) : t, e.hasError = !0;
878
1023
  }
879
1024
  var n, r = 0;
880
1025
  function i() {
@@ -894,24 +1039,24 @@ function Qe(e) {
894
1039
  }
895
1040
  return i();
896
1041
  }
897
- function $e(e, t) {
1042
+ function ot(e, t) {
898
1043
  return typeof e == `string` && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(e, n, r, i, a) {
899
1044
  return n ? t ? `.jsx` : `.js` : r && (!i || !a) ? e : r + i + `.` + a.toLowerCase() + `js`;
900
1045
  }) : e;
901
1046
  }
902
- var L, R, z, et, B, tt, nt, V = f((() => {
903
- L = function(e, t) {
904
- return L = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
1047
+ var st, F, I, ct, L, lt, ut, R = f((() => {
1048
+ st = function(e, t) {
1049
+ return st = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
905
1050
  e.__proto__ = t;
906
1051
  } || function(e, t) {
907
1052
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
908
- }, L(e, t);
909
- }, R = function() {
910
- return R = Object.assign || function(e) {
1053
+ }, st(e, t);
1054
+ }, F = function() {
1055
+ return F = Object.assign || function(e) {
911
1056
  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]);
912
1057
  return e;
913
- }, R.apply(this, arguments);
914
- }, z = Object.create ? (function(e, t, n, r) {
1058
+ }, F.apply(this, arguments);
1059
+ }, I = Object.create ? (function(e, t, n, r) {
915
1060
  r === void 0 && (r = n);
916
1061
  var i = Object.getOwnPropertyDescriptor(t, n);
917
1062
  (!i || (`get` in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
@@ -922,63 +1067,63 @@ var L, R, z, et, B, tt, nt, V = f((() => {
922
1067
  }), Object.defineProperty(e, r, i);
923
1068
  }) : (function(e, t, n, r) {
924
1069
  r === void 0 && (r = n), e[r] = t[n];
925
- }), et = Object.create ? (function(e, t) {
1070
+ }), ct = Object.create ? (function(e, t) {
926
1071
  Object.defineProperty(e, `default`, {
927
1072
  enumerable: !0,
928
1073
  value: t
929
1074
  });
930
1075
  }) : function(e, t) {
931
1076
  e.default = t;
932
- }, B = function(e) {
933
- return B = Object.getOwnPropertyNames || function(e) {
1077
+ }, L = function(e) {
1078
+ return L = Object.getOwnPropertyNames || function(e) {
934
1079
  var t = [];
935
1080
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[t.length] = n);
936
1081
  return t;
937
- }, B(e);
938
- }, tt = typeof SuppressedError == `function` ? SuppressedError : function(e, t, n) {
1082
+ }, L(e);
1083
+ }, lt = typeof SuppressedError == `function` ? SuppressedError : function(e, t, n) {
939
1084
  var r = Error(n);
940
1085
  return r.name = `SuppressedError`, r.error = e, r.suppressed = t, r;
941
- }, nt = {
942
- __extends: Ee,
943
- __assign: R,
944
- __rest: De,
945
- __decorate: Oe,
946
- __param: ke,
947
- __esDecorate: Ae,
948
- __runInitializers: je,
949
- __propKey: Me,
950
- __setFunctionName: Ne,
951
- __metadata: Pe,
952
- __awaiter: Fe,
953
- __generator: Ie,
954
- __createBinding: z,
955
- __exportStar: Le,
956
- __values: F,
957
- __read: Re,
958
- __spread: ze,
959
- __spreadArrays: Be,
960
- __spreadArray: Ve,
961
- __await: I,
962
- __asyncGenerator: He,
963
- __asyncDelegator: Ue,
964
- __asyncValues: We,
965
- __makeTemplateObject: Ge,
966
- __importStar: Ke,
967
- __importDefault: qe,
968
- __classPrivateFieldGet: Je,
969
- __classPrivateFieldSet: Ye,
970
- __classPrivateFieldIn: Xe,
971
- __addDisposableResource: Ze,
972
- __disposeResources: Qe,
973
- __rewriteRelativeImportExtension: $e
1086
+ }, ut = {
1087
+ __extends: Ne,
1088
+ __assign: F,
1089
+ __rest: Pe,
1090
+ __decorate: Fe,
1091
+ __param: Ie,
1092
+ __esDecorate: Le,
1093
+ __runInitializers: Re,
1094
+ __propKey: ze,
1095
+ __setFunctionName: Be,
1096
+ __metadata: Ve,
1097
+ __awaiter: He,
1098
+ __generator: Ue,
1099
+ __createBinding: I,
1100
+ __exportStar: We,
1101
+ __values: N,
1102
+ __read: Ge,
1103
+ __spread: Ke,
1104
+ __spreadArrays: qe,
1105
+ __spreadArray: Je,
1106
+ __await: P,
1107
+ __asyncGenerator: Ye,
1108
+ __asyncDelegator: Xe,
1109
+ __asyncValues: Ze,
1110
+ __makeTemplateObject: Qe,
1111
+ __importStar: $e,
1112
+ __importDefault: et,
1113
+ __classPrivateFieldGet: tt,
1114
+ __classPrivateFieldSet: nt,
1115
+ __classPrivateFieldIn: rt,
1116
+ __addDisposableResource: it,
1117
+ __disposeResources: at,
1118
+ __rewriteRelativeImportExtension: ot
974
1119
  };
975
- })), rt = p(((e) => {
1120
+ })), dt = p(((e) => {
976
1121
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.ErrorKind = void 0;
977
1122
  var t;
978
1123
  (function(e) {
979
1124
  e[e.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = `EXPECT_ARGUMENT_CLOSING_BRACE`, e[e.EMPTY_ARGUMENT = 2] = `EMPTY_ARGUMENT`, e[e.MALFORMED_ARGUMENT = 3] = `MALFORMED_ARGUMENT`, e[e.EXPECT_ARGUMENT_TYPE = 4] = `EXPECT_ARGUMENT_TYPE`, e[e.INVALID_ARGUMENT_TYPE = 5] = `INVALID_ARGUMENT_TYPE`, e[e.EXPECT_ARGUMENT_STYLE = 6] = `EXPECT_ARGUMENT_STYLE`, e[e.INVALID_NUMBER_SKELETON = 7] = `INVALID_NUMBER_SKELETON`, e[e.INVALID_DATE_TIME_SKELETON = 8] = `INVALID_DATE_TIME_SKELETON`, e[e.EXPECT_NUMBER_SKELETON = 9] = `EXPECT_NUMBER_SKELETON`, e[e.EXPECT_DATE_TIME_SKELETON = 10] = `EXPECT_DATE_TIME_SKELETON`, e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = `UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`, e[e.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = `EXPECT_SELECT_ARGUMENT_OPTIONS`, e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = `EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`, e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = `INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`, e[e.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = `EXPECT_SELECT_ARGUMENT_SELECTOR`, e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = `EXPECT_PLURAL_ARGUMENT_SELECTOR`, e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = `EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`, e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = `EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`, e[e.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = `INVALID_PLURAL_ARGUMENT_SELECTOR`, e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = `DUPLICATE_PLURAL_ARGUMENT_SELECTOR`, e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = `DUPLICATE_SELECT_ARGUMENT_SELECTOR`, e[e.MISSING_OTHER_CLAUSE = 22] = `MISSING_OTHER_CLAUSE`, e[e.INVALID_TAG = 23] = `INVALID_TAG`, e[e.INVALID_TAG_NAME = 25] = `INVALID_TAG_NAME`, e[e.UNMATCHED_CLOSING_TAG = 26] = `UNMATCHED_CLOSING_TAG`, e[e.UNCLOSED_TAG = 27] = `UNCLOSED_TAG`;
980
1125
  })(t || (e.ErrorKind = t = {}));
981
- })), H = p(((e) => {
1126
+ })), z = p(((e) => {
982
1127
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.SKELETON_TYPE = e.TYPE = void 0, e.isLiteralElement = r, e.isArgumentElement = i, e.isNumberElement = a, e.isDateElement = o, e.isTimeElement = s, e.isSelectElement = c, e.isPluralElement = l, e.isPoundElement = u, e.isTagElement = d, e.isNumberSkeleton = f, e.isDateTimeSkeleton = p, e.createLiteralElement = m, e.createNumberElement = h;
983
1128
  var t;
984
1129
  (function(e) {
@@ -1034,9 +1179,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
1034
1179
  style: n
1035
1180
  };
1036
1181
  }
1037
- })), it = p(((e) => {
1182
+ })), ft = p(((e) => {
1038
1183
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.WHITE_SPACE_REGEX = e.SPACE_SEPARATOR_REGEX = void 0, e.SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, e.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/;
1039
- })), at = p(((e) => {
1184
+ })), pt = p(((e) => {
1040
1185
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.parseDateTimeSkeleton = n;
1041
1186
  var t = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
1042
1187
  function n(e) {
@@ -1136,11 +1281,11 @@ var L, R, z, et, B, tt, nt, V = f((() => {
1136
1281
  return ``;
1137
1282
  }), n;
1138
1283
  }
1139
- })), ot = p(((e) => {
1284
+ })), mt = p(((e) => {
1140
1285
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.WHITE_SPACE_REGEX = void 0, e.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
1141
- })), st = p(((e) => {
1286
+ })), ht = p(((e) => {
1142
1287
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.parseNumberSkeletonFromString = r, e.parseNumberSkeleton = p;
1143
- var t = (V(), g(P)), n = ot();
1288
+ var t = (R(), g(M)), n = mt();
1144
1289
  function r(e) {
1145
1290
  if (e.length === 0) throw Error(`Number skeleton cannot be empty`);
1146
1291
  for (var t = e.split(n.WHITE_SPACE_REGEX).filter(function(e) {
@@ -1318,11 +1463,11 @@ var L, R, z, et, B, tt, nt, V = f((() => {
1318
1463
  }
1319
1464
  return n;
1320
1465
  }
1321
- })), ct = p(((e) => {
1466
+ })), gt = p(((e) => {
1322
1467
  Object.defineProperty(e, `__esModule`, { value: !0 });
1323
- var t = (V(), g(P));
1324
- t.__exportStar(at(), e), t.__exportStar(st(), e);
1325
- })), lt = p(((e) => {
1468
+ var t = (R(), g(M));
1469
+ t.__exportStar(pt(), e), t.__exportStar(ht(), e);
1470
+ })), _t = p(((e) => {
1326
1471
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.timeData = void 0, e.timeData = {
1327
1472
  "001": [`H`, `h`],
1328
1473
  419: [
@@ -2479,9 +2624,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2479
2624
  `h`
2480
2625
  ]
2481
2626
  };
2482
- })), ut = p(((e) => {
2627
+ })), vt = p(((e) => {
2483
2628
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.getBestPattern = n;
2484
- var t = lt();
2629
+ var t = _t();
2485
2630
  function n(e, t) {
2486
2631
  for (var n = ``, i = 0; i < e.length; i++) {
2487
2632
  var a = e.charAt(i);
@@ -2506,9 +2651,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2506
2651
  var r = e.language, i;
2507
2652
  return r !== `root` && (i = e.maximize().region), (t.timeData[i || ``] || t.timeData[r || ``] || t.timeData[`${r}-001`] || t.timeData[`001`])[0];
2508
2653
  }
2509
- })), dt = p(((e) => {
2654
+ })), yt = p(((e) => {
2510
2655
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.Parser = void 0;
2511
- var t = (V(), g(P)), n = rt(), r = H(), i = it(), a = ct(), o = ut(), s = RegExp(`^${i.SPACE_SEPARATOR_REGEX.source}*`), c = RegExp(`${i.SPACE_SEPARATOR_REGEX.source}*\$`);
2656
+ var t = (R(), g(M)), n = dt(), r = z(), i = ft(), a = gt(), o = vt(), s = RegExp(`^${i.SPACE_SEPARATOR_REGEX.source}*`), c = RegExp(`${i.SPACE_SEPARATOR_REGEX.source}*\$`);
2512
2657
  function l(e, t) {
2513
2658
  return {
2514
2659
  start: e,
@@ -2519,21 +2664,21 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2519
2664
  return typeof e == `number` && isFinite(e) && Math.floor(e) === e && Math.abs(e) <= 9007199254740991;
2520
2665
  }, v = !0;
2521
2666
  try {
2522
- v = C(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`).exec(`a`)?.[0] === `a`;
2667
+ v = S(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`).exec(`a`)?.[0] === `a`;
2523
2668
  } catch {
2524
2669
  v = !1;
2525
2670
  }
2526
- var y = u ? function(e, t, n) {
2671
+ var ee = u ? function(e, t, n) {
2527
2672
  return e.startsWith(t, n);
2528
2673
  } : function(e, t, n) {
2529
2674
  return e.slice(n, n + t.length) === t;
2530
- }, b = d ? String.fromCodePoint : function() {
2675
+ }, y = d ? String.fromCodePoint : function() {
2531
2676
  for (var e = [...arguments], t = ``, n = e.length, r = 0, i; n > r;) {
2532
2677
  if (i = e[r++], i > 1114111) throw RangeError(i + ` is not a valid code point`);
2533
2678
  t += i < 65536 ? String.fromCharCode(i) : String.fromCharCode(((i -= 65536) >> 10) + 55296, i % 1024 + 56320);
2534
2679
  }
2535
2680
  return t;
2536
- }, ee = f ? Object.fromEntries : function(e) {
2681
+ }, b = f ? Object.fromEntries : function(e) {
2537
2682
  for (var t = {}, n = 0, r = e; n < r.length; n++) {
2538
2683
  var i = r[n], a = i[0];
2539
2684
  t[a] = i[1];
@@ -2547,31 +2692,31 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2547
2692
  var r = e.charCodeAt(t), i;
2548
2693
  return r < 55296 || r > 56319 || t + 1 === n || (i = e.charCodeAt(t + 1)) < 56320 || i > 57343 ? r : (r - 55296 << 10) + (i - 56320) + 65536;
2549
2694
  }
2550
- }, S = m ? function(e) {
2695
+ }, te = m ? function(e) {
2551
2696
  return e.trimStart();
2552
2697
  } : function(e) {
2553
2698
  return e.replace(s, ``);
2554
- }, te = h ? function(e) {
2699
+ }, ne = h ? function(e) {
2555
2700
  return e.trimEnd();
2556
2701
  } : function(e) {
2557
2702
  return e.replace(c, ``);
2558
2703
  };
2559
- function C(e, t) {
2704
+ function S(e, t) {
2560
2705
  return new RegExp(e, t);
2561
2706
  }
2562
- var w;
2707
+ var C;
2563
2708
  if (v) {
2564
- var T = C(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`);
2565
- w = function(e, t) {
2566
- return T.lastIndex = t, T.exec(e)[1] ?? ``;
2709
+ var w = S(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`, `yu`);
2710
+ C = function(e, t) {
2711
+ return w.lastIndex = t, w.exec(e)[1] ?? ``;
2567
2712
  };
2568
- } else w = function(e, t) {
2713
+ } else C = function(e, t) {
2569
2714
  for (var n = [];;) {
2570
2715
  var r = x(e, t);
2571
- if (r === void 0 || k(r) || A(r)) break;
2716
+ if (r === void 0 || ie(r) || D(r)) break;
2572
2717
  n.push(r), t += r >= 65536 ? 2 : 1;
2573
2718
  }
2574
- return b.apply(void 0, n);
2719
+ return y.apply(void 0, n);
2575
2720
  };
2576
2721
  e.Parser = function() {
2577
2722
  function e(e, t) {
@@ -2601,7 +2746,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2601
2746
  } else if (o === 60 && !this.ignoreTag && this.peek() === 47) {
2602
2747
  if (i) break;
2603
2748
  return this.error(n.ErrorKind.UNMATCHED_CLOSING_TAG, l(this.clonePosition(), this.clonePosition()));
2604
- } else if (o === 60 && !this.ignoreTag && E(this.peek() || 0)) {
2749
+ } else if (o === 60 && !this.ignoreTag && T(this.peek() || 0)) {
2605
2750
  var s = this.parseTag(e, t);
2606
2751
  if (s.err) return s;
2607
2752
  a.push(s.val);
@@ -2632,7 +2777,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2632
2777
  if (o.err) return o;
2633
2778
  var s = o.val, c = this.clonePosition();
2634
2779
  if (this.bumpIf(`</`)) {
2635
- if (this.isEOF() || !E(this.char())) return this.error(n.ErrorKind.INVALID_TAG, l(c, this.clonePosition()));
2780
+ if (this.isEOF() || !T(this.char())) return this.error(n.ErrorKind.INVALID_TAG, l(c, this.clonePosition()));
2636
2781
  var u = this.clonePosition();
2637
2782
  return a === this.parseTagName() ? (this.bumpSpace(), this.bumpIf(`>`) ? {
2638
2783
  val: {
@@ -2647,7 +2792,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2647
2792
  } else return this.error(n.ErrorKind.INVALID_TAG, l(i, this.clonePosition()));
2648
2793
  }, e.prototype.parseTagName = function() {
2649
2794
  var e = this.offset();
2650
- for (this.bump(); !this.isEOF() && O(this.char());) this.bump();
2795
+ for (this.bump(); !this.isEOF() && E(this.char());) this.bump();
2651
2796
  return this.message.slice(e, this.offset());
2652
2797
  }, e.prototype.parseLiteral = function(e, t) {
2653
2798
  for (var n = this.clonePosition(), i = ``;;) {
@@ -2678,7 +2823,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2678
2823
  err: null
2679
2824
  };
2680
2825
  }, e.prototype.tryParseLeftAngleBracket = function() {
2681
- return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !D(this.peek() || 0)) ? (this.bump(), `<`) : null;
2826
+ return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !re(this.peek() || 0)) ? (this.bump(), `<`) : null;
2682
2827
  }, e.prototype.tryParseQuote = function(e) {
2683
2828
  if (this.isEOF() || this.char() !== 39) return null;
2684
2829
  switch (this.peek()) {
@@ -2704,11 +2849,11 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2704
2849
  else t.push(n);
2705
2850
  this.bump();
2706
2851
  }
2707
- return b.apply(void 0, t);
2852
+ return y.apply(void 0, t);
2708
2853
  }, e.prototype.tryParseUnquoted = function(e, t) {
2709
2854
  if (this.isEOF()) return null;
2710
2855
  var n = this.char();
2711
- return n === 60 || n === 123 || n === 35 && (t === `plural` || t === `selectordinal`) || n === 125 && e > 0 ? null : (this.bump(), b(n));
2856
+ return n === 60 || n === 123 || n === 35 && (t === `plural` || t === `selectordinal`) || n === 125 && e > 0 ? null : (this.bump(), y(n));
2712
2857
  }, e.prototype.parseArgument = function(e, t) {
2713
2858
  var i = this.clonePosition();
2714
2859
  if (this.bump(), this.bumpSpace(), this.isEOF()) return this.error(n.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, l(i, this.clonePosition()));
@@ -2729,7 +2874,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2729
2874
  default: return this.error(n.ErrorKind.MALFORMED_ARGUMENT, l(i, this.clonePosition()));
2730
2875
  }
2731
2876
  }, e.prototype.parseIdentifierIfPossible = function() {
2732
- var e = this.clonePosition(), t = this.offset(), n = w(this.message, t), r = t + n.length;
2877
+ var e = this.clonePosition(), t = this.offset(), n = C(this.message, t), r = t + n.length;
2733
2878
  return this.bumpTo(r), {
2734
2879
  value: n,
2735
2880
  location: l(e, this.clonePosition())
@@ -2747,7 +2892,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2747
2892
  this.bumpSpace();
2748
2893
  var m = this.clonePosition(), h = this.parseSimpleArgStyleIfPossible();
2749
2894
  if (h.err) return h;
2750
- var g = te(h.val);
2895
+ var g = ne(h.val);
2751
2896
  if (g.length === 0) return this.error(n.ErrorKind.EXPECT_ARGUMENT_STYLE, l(this.clonePosition(), this.clonePosition()));
2752
2897
  p = {
2753
2898
  style: g,
@@ -2757,10 +2902,10 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2757
2902
  var _ = this.tryParseArgumentClose(c);
2758
2903
  if (_.err) return _;
2759
2904
  var v = l(c, this.clonePosition());
2760
- if (p && y(p?.style, `::`, 0)) {
2761
- var b = S(p.style.slice(2));
2905
+ if (p && ee(p?.style, `::`, 0)) {
2906
+ var y = te(p.style.slice(2));
2762
2907
  if (d === `number`) {
2763
- var h = this.parseNumberSkeletonFromString(b, p.styleLocation);
2908
+ var h = this.parseNumberSkeletonFromString(y, p.styleLocation);
2764
2909
  return h.err ? h : {
2765
2910
  val: {
2766
2911
  type: r.TYPE.number,
@@ -2771,9 +2916,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2771
2916
  err: null
2772
2917
  };
2773
2918
  } else {
2774
- if (b.length === 0) return this.error(n.ErrorKind.EXPECT_DATE_TIME_SKELETON, v);
2775
- var x = b;
2776
- this.locale && (x = (0, o.getBestPattern)(b, this.locale));
2919
+ if (y.length === 0) return this.error(n.ErrorKind.EXPECT_DATE_TIME_SKELETON, v);
2920
+ var x = y;
2921
+ this.locale && (x = (0, o.getBestPattern)(y, this.locale));
2777
2922
  var g = {
2778
2923
  type: r.SKELETON_TYPE.dateTime,
2779
2924
  pattern: x,
@@ -2803,38 +2948,38 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2803
2948
  case `plural`:
2804
2949
  case `selectordinal`:
2805
2950
  case `select`:
2806
- var C = this.clonePosition();
2807
- if (this.bumpSpace(), !this.bumpIf(`,`)) return this.error(n.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, l(C, t.__assign({}, C)));
2951
+ var S = this.clonePosition();
2952
+ if (this.bumpSpace(), !this.bumpIf(`,`)) return this.error(n.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, l(S, t.__assign({}, S)));
2808
2953
  this.bumpSpace();
2809
- var w = this.parseIdentifierIfPossible(), T = 0;
2810
- if (d !== `select` && w.value === `offset`) {
2954
+ var C = this.parseIdentifierIfPossible(), w = 0;
2955
+ if (d !== `select` && C.value === `offset`) {
2811
2956
  if (!this.bumpIf(`:`)) return this.error(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, l(this.clonePosition(), this.clonePosition()));
2812
2957
  this.bumpSpace();
2813
2958
  var h = this.tryParseDecimalInteger(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, n.ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
2814
2959
  if (h.err) return h;
2815
- this.bumpSpace(), w = this.parseIdentifierIfPossible(), T = h.val;
2960
+ this.bumpSpace(), C = this.parseIdentifierIfPossible(), w = h.val;
2816
2961
  }
2817
- var E = this.tryParsePluralOrSelectOptions(e, d, i, w);
2818
- if (E.err) return E;
2962
+ var T = this.tryParsePluralOrSelectOptions(e, d, i, C);
2963
+ if (T.err) return T;
2819
2964
  var _ = this.tryParseArgumentClose(c);
2820
2965
  if (_.err) return _;
2821
- var D = l(c, this.clonePosition());
2966
+ var re = l(c, this.clonePosition());
2822
2967
  return d === `select` ? {
2823
2968
  val: {
2824
2969
  type: r.TYPE.select,
2825
2970
  value: s,
2826
- options: ee(E.val),
2827
- location: D
2971
+ options: b(T.val),
2972
+ location: re
2828
2973
  },
2829
2974
  err: null
2830
2975
  } : {
2831
2976
  val: {
2832
2977
  type: r.TYPE.plural,
2833
2978
  value: s,
2834
- options: ee(E.val),
2835
- offset: T,
2979
+ options: b(T.val),
2980
+ offset: w,
2836
2981
  pluralType: d === `plural` ? `cardinal` : `ordinal`,
2837
- location: D
2982
+ location: re
2838
2983
  },
2839
2984
  err: null
2840
2985
  };
@@ -2958,7 +3103,7 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2958
3103
  e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
2959
3104
  }
2960
3105
  }, e.prototype.bumpIf = function(e) {
2961
- if (y(this.message, e, this.offset())) {
3106
+ if (ee(this.message, e, this.offset())) {
2962
3107
  for (var t = 0; t < e.length; t++) this.bump();
2963
3108
  return !0;
2964
3109
  }
@@ -2975,31 +3120,31 @@ var L, R, z, et, B, tt, nt, V = f((() => {
2975
3120
  if (this.bump(), this.isEOF()) break;
2976
3121
  }
2977
3122
  }, e.prototype.bumpSpace = function() {
2978
- for (; !this.isEOF() && k(this.char());) this.bump();
3123
+ for (; !this.isEOF() && ie(this.char());) this.bump();
2979
3124
  }, e.prototype.peek = function() {
2980
3125
  if (this.isEOF()) return null;
2981
3126
  var e = this.char(), t = this.offset();
2982
3127
  return this.message.charCodeAt(t + (e >= 65536 ? 2 : 1)) ?? null;
2983
3128
  }, e;
2984
3129
  }();
2985
- function E(e) {
3130
+ function T(e) {
2986
3131
  return e >= 97 && e <= 122 || e >= 65 && e <= 90;
2987
3132
  }
2988
- function D(e) {
2989
- return E(e) || e === 47;
3133
+ function re(e) {
3134
+ return T(e) || e === 47;
2990
3135
  }
2991
- function O(e) {
3136
+ function E(e) {
2992
3137
  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;
2993
3138
  }
2994
- function k(e) {
3139
+ function ie(e) {
2995
3140
  return e >= 9 && e <= 13 || e === 32 || e === 133 || e >= 8206 && e <= 8207 || e === 8232 || e === 8233;
2996
3141
  }
2997
- function A(e) {
3142
+ function D(e) {
2998
3143
  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;
2999
3144
  }
3000
- })), ft = p(((e) => {
3145
+ })), bt = p(((e) => {
3001
3146
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.hoistSelectors = s, e.isStructurallySame = l;
3002
- var t = (V(), g(P)), n = H();
3147
+ var t = (R(), g(M)), n = z();
3003
3148
  function r(e) {
3004
3149
  return Array.isArray(e) ? t.__spreadArray([], e.map(r), !0) : typeof e == `object` && e ? Object.keys(e).reduce(function(t, n) {
3005
3150
  return t[n] = r(e[n]), t;
@@ -3056,9 +3201,9 @@ var L, R, z, et, B, tt, nt, V = f((() => {
3056
3201
  error: Error(`Different number of variables: [${Array.from(r.keys()).join(`, `)}] vs [${Array.from(i.keys()).join(`, `)}]`)
3057
3202
  };
3058
3203
  }
3059
- })), pt = p(((e) => {
3204
+ })), xt = p(((e) => {
3060
3205
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.isStructurallySame = e._Parser = void 0, e.parse = o;
3061
- var t = (V(), g(P)), n = rt(), r = dt(), i = H();
3206
+ var t = (R(), g(M)), n = dt(), r = yt(), i = z();
3062
3207
  function a(e) {
3063
3208
  e.forEach(function(e) {
3064
3209
  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);
@@ -3077,17 +3222,17 @@ var L, R, z, et, B, tt, nt, V = f((() => {
3077
3222
  }
3078
3223
  return i?.captureLocation || a(o.val), o.val;
3079
3224
  }
3080
- t.__exportStar(H(), e), e._Parser = r.Parser;
3081
- var s = ft();
3225
+ t.__exportStar(z(), e), e._Parser = r.Parser;
3226
+ var s = bt();
3082
3227
  Object.defineProperty(e, `isStructurallySame`, {
3083
3228
  enumerable: !0,
3084
3229
  get: function() {
3085
3230
  return s.isStructurallySame;
3086
3231
  }
3087
3232
  });
3088
- })), mt = p(((e) => {
3233
+ })), St = p(((e) => {
3089
3234
  Object.defineProperty(e, `__esModule`, { value: !0 }), e.printAST = r;
3090
- var t = (V(), g(P)), n = H();
3235
+ var t = (R(), g(M)), n = z();
3091
3236
  function r(e) {
3092
3237
  return i(e, !1);
3093
3238
  }
@@ -3150,128 +3295,167 @@ var L, R, z, et, B, tt, nt, V = f((() => {
3150
3295
  ].join(`,`)}}`;
3151
3296
  }
3152
3297
  }));
3153
- pt();
3154
- H();
3155
- mt();
3156
- const K = `_gt_`;
3157
- RegExp(`^${K}\\d+$`);
3158
- RegExp(`^${K}$`);
3159
- const q = `@generaltranslation/react-core`;
3160
- `${q}`, `${q}`, `${q}`, `${q}`, `${q}`, `${q}`;
3161
- `${q}`, `${q}`, `${q}`, `${q}`;
3162
- `${q}`;
3163
- const sn = `generaltranslation.locale`;
3298
+ xt();
3299
+ z();
3300
+ St();
3301
+ const U = `_gt_`;
3302
+ RegExp(`^${U}\\d+$`);
3303
+ RegExp(`^${U}$`);
3304
+ const Ht = `@generaltranslation/react-core`;
3305
+ function W(e) {
3306
+ return S({
3307
+ source: Ht,
3308
+ ...e
3309
+ });
3310
+ }
3311
+ W({
3312
+ severity: `Error`,
3313
+ whatHappened: `Runtime translation needs a project ID`,
3314
+ fix: `Add projectId to your <GTProvider> configuration or set GT_PROJECT_ID in your environment`,
3315
+ docsUrl: `https://generaltranslation.com/dashboard`
3316
+ }), W({
3317
+ severity: `Error`,
3318
+ whatHappened: `Production environments cannot use a development API key`,
3319
+ fix: `Replace it with a production API key before deploying`
3320
+ }), W({
3321
+ severity: `Error`,
3322
+ whatHappened: `The API key is available to client-side production code`,
3323
+ fix: `Move translation credentials to a server-only environment before deploying`
3324
+ }), W({
3325
+ severity: `Error`,
3326
+ whatHappened: `Runtime translation is not configured`,
3327
+ fix: `Add projectId and devApiKey to your environment, or pass them to <GTProvider> directly`
3328
+ }), W({
3329
+ severity: `Error`,
3330
+ whatHappened: `Runtime translations could not be loaded`,
3331
+ wayOut: `Source content will render as a fallback`,
3332
+ fix: `Check your runtime translation configuration and try again`
3333
+ }), W({
3334
+ severity: `Error`,
3335
+ whatHappened: `Runtime translation could not be completed`
3336
+ });
3337
+ W({
3338
+ severity: `Warning`,
3339
+ whatHappened: `Runtime translation needs a project ID`,
3340
+ fix: `Add projectId to <GTProvider> or set GT_PROJECT_ID in your environment`,
3341
+ docsUrl: `https://generaltranslation.com/dashboard`
3342
+ }), W({
3343
+ severity: `Warning`,
3344
+ whatHappened: `Runtime translation needs a development API key`,
3345
+ fix: `Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation`
3346
+ }), W({
3347
+ severity: `Warning`,
3348
+ whatHappened: `Runtime translation timed out`
3349
+ }), W({
3350
+ severity: `Warning`,
3351
+ whatHappened: `No dictionary was found`,
3352
+ fix: `Pass a dictionary to <GTProvider> or configure a dictionary loader before rendering translations`
3353
+ });
3354
+ `${Ht}`;
3355
+ const pn = `generaltranslation.locale`;
3164
3356
  e.use;
3165
- function Hn({ children: e }) {
3357
+ function Jn({ children: e }) {
3166
3358
  return e;
3167
3359
  }
3168
- function Un(e) {
3169
- return Hn(e);
3360
+ function Yn(e) {
3361
+ return Jn(e);
3170
3362
  }
3171
- Hn._gtt = `derive`, Un._gtt = `derive`;
3363
+ Jn._gtt = `derive`, Yn._gtt = `derive`;
3172
3364
  //#endregion
3173
3365
  //#region src/shared/messages.ts
3174
3366
  const PACKAGE_NAME = "gt-react";
3175
- `${PACKAGE_NAME}${PACKAGE_NAME}`;
3176
- `${PACKAGE_NAME}`;
3177
- `${PACKAGE_NAME}`;
3367
+ createDiagnosticMessage({
3368
+ source: `${PACKAGE_NAME}/browser`,
3369
+ severity: "Error",
3370
+ whatHappened: "This module requires a browser environment",
3371
+ fix: "Import it only from client-side code"
3372
+ });
3373
+ createDiagnosticMessage({
3374
+ source: PACKAGE_NAME,
3375
+ severity: "Error",
3376
+ whatHappened: "A browser-only module was imported outside the browser",
3377
+ fix: "Move this import to client-side code"
3378
+ });
3379
+ createDiagnosticMessage({
3380
+ source: PACKAGE_NAME,
3381
+ severity: "Error",
3382
+ whatHappened: "BrowserI18nManager is not initialized",
3383
+ fix: "Call initializeGT() before using browser translation APIs"
3384
+ });
3178
3385
  //#endregion
3179
3386
  //#region src/react-context/provider/hooks/locales/useDetermineLocale.ts
3180
- function useDetermineLocale({ locale: initialLocale = "", defaultLocale = "en", locales: initialLocales = [], localeCookieName = sn, ssr = true, customMapping, enableI18n, reloadOnLocaleUpdate = false }) {
3387
+ function useDetermineLocale({ locale: initialLocale = "", defaultLocale = "en", locales: initialLocales = [], localeCookieName = pn, ssr = true, customMapping, enableI18n, reloadOnLocaleUpdate = false }) {
3181
3388
  const _locale = useMemo(() => resolveAliasLocale(initialLocale, customMapping), [initialLocale, customMapping]);
3182
3389
  const locales = useMemo(() => initialLocales.map((locale) => resolveAliasLocale(locale, customMapping)), [initialLocales, customMapping]);
3183
- const initializeLocale = () => {
3390
+ /**
3391
+ * Choose a locale to use
3392
+ * (1) use provided locale
3393
+ * (2) use cookie locale
3394
+ * (3) use preferred locale
3395
+ * (5) fallback to defaultLocale
3396
+ * Update the cookie locale to be correct
3397
+ */
3398
+ const getNewLocale = useCallback((locale) => {
3184
3399
  if (!enableI18n) return defaultLocale;
3185
- return resolveAliasLocale(ssr ? _locale ? determineLocale(_locale, locales, customMapping) || "" : "" : getNewLocale({
3186
- _locale,
3187
- locale: _locale,
3188
- locales,
3189
- defaultLocale,
3190
- localeCookieName,
3191
- customMapping,
3192
- enableI18n
3193
- }), customMapping);
3194
- };
3195
- const [locale, _setLocale] = useState(initializeLocale);
3196
- const [setLocale, setLocaleWithoutSettingCookie] = createSetLocale({
3197
- locale,
3198
- locales,
3199
- defaultLocale,
3200
- localeCookieName,
3201
- _setLocale,
3202
- customMapping,
3203
- enableI18n,
3204
- reloadOnLocaleUpdate
3205
- });
3206
- useEffect(() => {
3207
- setLocaleWithoutSettingCookie(getNewLocale({
3208
- _locale,
3209
- locale,
3210
- locales,
3211
- defaultLocale,
3212
- localeCookieName,
3213
- customMapping,
3214
- enableI18n
3215
- }));
3400
+ if (_locale && _locale === locale && determineLocale(_locale, locales, customMapping) === locale) return _locale;
3401
+ let cookieLocale = getCookieValue(localeCookieName);
3402
+ if (cookieLocale) cookieLocale = resolveAliasLocale(cookieLocale, customMapping);
3403
+ const browserLocales = getBrowserLocales(customMapping);
3404
+ let newLocale = determineLocale([
3405
+ ..._locale ? [_locale] : [],
3406
+ ...cookieLocale ? [cookieLocale] : [],
3407
+ ...browserLocales
3408
+ ], locales, customMapping) || defaultLocale;
3409
+ if (newLocale) newLocale = resolveAliasLocale(newLocale, customMapping);
3410
+ if (cookieLocale && cookieLocale !== newLocale) setCookieValue(localeCookieName, newLocale);
3411
+ return newLocale;
3216
3412
  }, [
3217
3413
  _locale,
3218
- locale,
3219
- locales,
3414
+ customMapping,
3220
3415
  defaultLocale,
3416
+ enableI18n,
3221
3417
  localeCookieName,
3222
- enableI18n
3418
+ locales
3223
3419
  ]);
3224
- return [locale, setLocale];
3225
- }
3226
- /**
3227
- * Choose a locale to use
3228
- * (1) use provided locale
3229
- * (2) use cookie locale
3230
- * (3) use preferred locale
3231
- * (5) fallback to defaultLocale
3232
- * Update the cookie locale to be correct
3233
- */
3234
- function getNewLocale({ _locale, locale, locales, defaultLocale, localeCookieName, customMapping, enableI18n }) {
3235
- if (!enableI18n) return defaultLocale;
3236
- if (_locale && _locale === locale && determineLocale(_locale, locales, customMapping) === locale) return resolveAliasLocale(_locale, customMapping);
3237
- let cookieLocale = typeof document !== "undefined" ? document.cookie.split("; ").find((row) => row.startsWith(`${localeCookieName}=`))?.split("=")[1] : void 0;
3238
- if (cookieLocale) cookieLocale = resolveAliasLocale(cookieLocale, customMapping);
3239
- let browserLocales = (() => {
3240
- if (typeof navigator === "undefined") return [];
3241
- if (navigator?.languages) return navigator.languages;
3242
- if (navigator?.language) return [navigator.language];
3243
- const legacyNavigator = navigator;
3244
- if (legacyNavigator.userLanguage) return [legacyNavigator.userLanguage];
3245
- return [];
3246
- })();
3247
- browserLocales = browserLocales.map((locale) => resolveAliasLocale(locale, customMapping));
3248
- let newLocale = determineLocale([
3249
- ..._locale ? [_locale] : [],
3250
- ...cookieLocale ? [cookieLocale] : [],
3251
- ...browserLocales
3252
- ], locales, customMapping) || defaultLocale;
3253
- if (newLocale) newLocale = resolveAliasLocale(newLocale, customMapping);
3254
- if (cookieLocale && cookieLocale !== newLocale && typeof document !== "undefined") document.cookie = `${localeCookieName}=${newLocale};path=/`;
3255
- return newLocale;
3256
- }
3257
- function createSetLocale({ locale, locales, defaultLocale, localeCookieName, _setLocale, customMapping, enableI18n, reloadOnLocaleUpdate }) {
3258
- locale = resolveAliasLocale(locale, customMapping);
3259
- const setLocaleWithoutSettingCookie = (newLocale) => {
3420
+ const initializeLocale = () => {
3421
+ if (!enableI18n) return defaultLocale;
3422
+ return resolveAliasLocale(ssr ? _locale ? determineLocale(_locale, locales, customMapping) || "" : "" : getNewLocale(_locale), customMapping);
3423
+ };
3424
+ const [locale, _setLocale] = useState(initializeLocale);
3425
+ const currentLocale = resolveAliasLocale(locale, customMapping);
3426
+ const setLocaleWithoutSettingCookie = useCallback((newLocale) => {
3260
3427
  if (!enableI18n) return defaultLocale;
3261
- if (newLocale === locale) return locale;
3262
- const validatedLocale = resolveAliasLocale(determineLocale(newLocale, locales, customMapping) || locale || defaultLocale, customMapping);
3263
- if (validatedLocale !== newLocale) console.warn(t(validatedLocale, newLocale, PACKAGE_NAME));
3428
+ if (newLocale === currentLocale) return currentLocale;
3429
+ const validatedLocale = resolveAliasLocale(determineLocale(newLocale, locales, customMapping) || currentLocale || defaultLocale, customMapping);
3430
+ if (validatedLocale !== newLocale) console.warn(s(validatedLocale, newLocale, PACKAGE_NAME));
3264
3431
  _setLocale(validatedLocale);
3265
3432
  return validatedLocale;
3266
- };
3433
+ }, [
3434
+ currentLocale,
3435
+ customMapping,
3436
+ defaultLocale,
3437
+ enableI18n,
3438
+ locales
3439
+ ]);
3267
3440
  const setLocale = (newLocale) => {
3268
3441
  if (!enableI18n) return;
3269
3442
  newLocale = resolveAliasLocale(newLocale);
3270
- const validatedLocale = setLocaleWithoutSettingCookie(newLocale);
3271
- if (typeof document !== "undefined") document.cookie = `${localeCookieName}=${validatedLocale};path=/`;
3272
- if (typeof window !== "undefined" && newLocale !== locale && reloadOnLocaleUpdate) window.location.reload();
3443
+ setCookieValue(localeCookieName, setLocaleWithoutSettingCookie(newLocale));
3444
+ if (typeof window !== "undefined" && newLocale !== currentLocale && reloadOnLocaleUpdate) window.location.reload();
3273
3445
  };
3274
- return [setLocale, setLocaleWithoutSettingCookie];
3446
+ useEffect(() => {
3447
+ setLocaleWithoutSettingCookie(getNewLocale(locale));
3448
+ }, [
3449
+ locale,
3450
+ setLocaleWithoutSettingCookie,
3451
+ getNewLocale
3452
+ ]);
3453
+ return [locale, setLocale];
3454
+ }
3455
+ function getBrowserLocales(customMapping) {
3456
+ if (typeof navigator === "undefined") return [];
3457
+ const legacyNavigator = navigator;
3458
+ return (navigator.languages || (navigator.language ? [navigator.language] : legacyNavigator.userLanguage ? [legacyNavigator.userLanguage] : [])).map((locale) => resolveAliasLocale(locale, customMapping));
3275
3459
  }
3276
3460
  //#endregion
3277
3461
  //#region src/react-context/provider/helpers/isSSREnabled.ts
@@ -3356,13 +3540,12 @@ function _convertCustomNamesToMapping(customNames) {
3356
3540
  */
3357
3541
  function InternalLocaleSelector({ locale, locales, customNames, customMapping = _convertCustomNamesToMapping(customNames), setLocale, getLocaleProperties, ...props }) {
3358
3542
  const getDisplayName = (locale) => {
3359
- if (customMapping && customMapping[locale]) {
3360
- if (typeof customMapping[locale] === "string") return customMapping[locale];
3361
- if (customMapping[locale].name) return customMapping[locale].name;
3362
- }
3543
+ const customLocale = customMapping?.[locale];
3544
+ if (typeof customLocale === "string") return customLocale;
3545
+ if (customLocale?.name) return customLocale.name;
3363
3546
  return capitalizeName(getLocaleProperties(locale).nativeNameWithRegionCode);
3364
3547
  };
3365
- if (!locales || locales.length === 0 || !setLocale) return null;
3548
+ if (!locales?.length || !setLocale) return null;
3366
3549
  return /* @__PURE__ */ jsxs("select", {
3367
3550
  ...props,
3368
3551
  value: locale || "",