@formatjs/intl-relativetimeformat 12.3.1 → 12.3.3

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/polyfill.js CHANGED
@@ -1,5 +1,1003 @@
1
- import RelativeTimeFormat from "./index.js";
2
- import { shouldPolyfill } from "./should-polyfill.js";
1
+ import { LookupSupportedLocales, ResolveLocale, match } from "@formatjs/intl-localematcher";
2
+ //#region packages/ecma262-abstract/ToString.js
3
+ /**
4
+ * https://tc39.es/ecma262/#sec-tostring
5
+ */
6
+ function ToString(o) {
7
+ if (typeof o === "symbol") throw TypeError("Cannot convert a Symbol value to a string");
8
+ return String(o);
9
+ }
10
+ //#endregion
11
+ //#region packages/ecma402-abstract/CanonicalizeLocaleList.js
12
+ /**
13
+ * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
14
+ * @param locales
15
+ */
16
+ function CanonicalizeLocaleList(locales) {
17
+ return Intl.getCanonicalLocales(locales);
18
+ }
19
+ //#endregion
20
+ //#region packages/ecma262-abstract/ToObject.js
21
+ /**
22
+ * https://tc39.es/ecma262/#sec-toobject
23
+ */
24
+ function ToObject(arg) {
25
+ if (arg == null) throw new TypeError("undefined/null cannot be converted to object");
26
+ return Object(arg);
27
+ }
28
+ //#endregion
29
+ //#region packages/ecma402-abstract/GetOption.js
30
+ /**
31
+ * https://tc39.es/ecma402/#sec-getoption
32
+ * @param opts
33
+ * @param prop
34
+ * @param type
35
+ * @param values
36
+ * @param fallback
37
+ */
38
+ function GetOption(opts, prop, type, values, fallback) {
39
+ if (typeof opts !== "object") throw new TypeError("Options must be an object");
40
+ let value = opts[prop];
41
+ if (value !== void 0) {
42
+ if (type !== "boolean" && type !== "string") throw new TypeError("invalid type");
43
+ if (type === "boolean") value = Boolean(value);
44
+ if (type === "string") value = ToString(value);
45
+ if (values !== void 0 && !values.filter((val) => val == value).length) throw new RangeError(`${value} is not within ${values.join(", ")}`);
46
+ return value;
47
+ }
48
+ return fallback;
49
+ }
50
+ //#endregion
51
+ //#region packages/ecma402-abstract/SupportedLocales.js
52
+ /**
53
+ * https://tc39.es/ecma402/#sec-supportedlocales
54
+ * @param availableLocales
55
+ * @param requestedLocales
56
+ * @param options
57
+ */
58
+ function SupportedLocales(availableLocales, requestedLocales, options) {
59
+ let matcher = "best fit";
60
+ if (options !== void 0) {
61
+ options = ToObject(options);
62
+ matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
63
+ }
64
+ if (matcher === "best fit") return LookupSupportedLocales(Array.from(availableLocales), requestedLocales);
65
+ return LookupSupportedLocales(Array.from(availableLocales), requestedLocales);
66
+ }
67
+ //#endregion
68
+ //#region packages/ecma402-abstract/CoerceOptionsToObject.js
69
+ /**
70
+ * https://tc39.es/ecma402/#sec-coerceoptionstoobject
71
+ * @param options
72
+ * @returns
73
+ */
74
+ function CoerceOptionsToObject(options) {
75
+ if (typeof options === "undefined") return Object.create(null);
76
+ return ToObject(options);
77
+ }
78
+ //#endregion
79
+ //#region node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
80
+ function memoize(fn, options) {
81
+ const cache = options && options.cache ? options.cache : cacheDefault;
82
+ const serializer = options && options.serializer ? options.serializer : serializerDefault;
83
+ return (options && options.strategy ? options.strategy : strategyDefault)(fn, {
84
+ cache,
85
+ serializer
86
+ });
87
+ }
88
+ function isPrimitive(value) {
89
+ return value == null || typeof value === "number" || typeof value === "boolean";
90
+ }
91
+ function monadic(fn, cache, serializer, arg) {
92
+ const cacheKey = isPrimitive(arg) ? arg : serializer(arg);
93
+ let computedValue = cache.get(cacheKey);
94
+ if (typeof computedValue === "undefined") {
95
+ computedValue = fn.call(this, arg);
96
+ cache.set(cacheKey, computedValue);
97
+ }
98
+ return computedValue;
99
+ }
100
+ function variadic(fn, cache, serializer) {
101
+ const args = Array.prototype.slice.call(arguments, 3);
102
+ const cacheKey = serializer(args);
103
+ let computedValue = cache.get(cacheKey);
104
+ if (typeof computedValue === "undefined") {
105
+ computedValue = fn.apply(this, args);
106
+ cache.set(cacheKey, computedValue);
107
+ }
108
+ return computedValue;
109
+ }
110
+ function assemble(fn, context, strategy, cache, serialize) {
111
+ return strategy.bind(context, fn, cache, serialize);
112
+ }
113
+ function strategyDefault(fn, options) {
114
+ const strategy = fn.length === 1 ? monadic : variadic;
115
+ return assemble(fn, this, strategy, options.cache.create(), options.serializer);
116
+ }
117
+ function strategyVariadic(fn, options) {
118
+ return assemble(fn, this, variadic, options.cache.create(), options.serializer);
119
+ }
120
+ function strategyMonadic(fn, options) {
121
+ return assemble(fn, this, monadic, options.cache.create(), options.serializer);
122
+ }
123
+ const serializerDefault = function() {
124
+ return JSON.stringify(arguments);
125
+ };
126
+ var ObjectWithoutPrototypeCache = class {
127
+ constructor() {
128
+ this.cache = Object.create(null);
129
+ }
130
+ get(key) {
131
+ return this.cache[key];
132
+ }
133
+ set(key, value) {
134
+ this.cache[key] = value;
135
+ }
136
+ };
137
+ const cacheDefault = { create: function create() {
138
+ return new ObjectWithoutPrototypeCache();
139
+ } };
140
+ const strategies = {
141
+ variadic: strategyVariadic,
142
+ monadic: strategyMonadic
143
+ };
144
+ //#endregion
145
+ //#region packages/ecma402-abstract/utils.js
146
+ function invariant(condition, message, Err = Error) {
147
+ if (!condition) throw new Err(message);
148
+ }
149
+ const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
150
+ const createMemoizedPluralRules = memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
151
+ memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
152
+ memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
153
+ //#endregion
154
+ //#region packages/ecma402-abstract/RelativeTimeFormat/InitializeRelativeTimeFormat.js
155
+ const NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
156
+ function InitializeRelativeTimeFormat(rtf, locales, options, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale }) {
157
+ const internalSlots = getInternalSlots(rtf);
158
+ internalSlots.initializedRelativeTimeFormat = true;
159
+ const requestedLocales = CanonicalizeLocaleList(locales);
160
+ const opt = Object.create(null);
161
+ const opts = CoerceOptionsToObject(options);
162
+ opt.localeMatcher = GetOption(opts, "localeMatcher", "string", ["best fit", "lookup"], "best fit");
163
+ const numberingSystem = GetOption(opts, "numberingSystem", "string", void 0, void 0);
164
+ if (numberingSystem !== void 0) {
165
+ if (!NUMBERING_SYSTEM_REGEX.test(numberingSystem)) throw new RangeError(`Invalid numbering system ${numberingSystem}`);
166
+ }
167
+ opt.nu = numberingSystem;
168
+ const r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
169
+ const { locale, nu } = r;
170
+ internalSlots.locale = locale;
171
+ internalSlots.style = GetOption(opts, "style", "string", [
172
+ "long",
173
+ "narrow",
174
+ "short"
175
+ ], "long");
176
+ internalSlots.numeric = GetOption(opts, "numeric", "string", ["always", "auto"], "always");
177
+ const fields = localeData[r.dataLocale];
178
+ invariant(!!fields, `Missing locale data for ${r.dataLocale}`);
179
+ internalSlots.fields = fields;
180
+ internalSlots.numberFormat = createMemoizedNumberFormat(locales);
181
+ internalSlots.pluralRules = createMemoizedPluralRules(locales);
182
+ internalSlots.numberingSystem = nu;
183
+ return rtf;
184
+ }
185
+ //#endregion
186
+ //#region packages/ecma262-abstract/SameValue.js
187
+ /**
188
+ * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-samevalue
189
+ */
190
+ function SameValue(x, y) {
191
+ if (Object.is) return Object.is(x, y);
192
+ if (x === y) return x !== 0 || 1 / x === 1 / y;
193
+ return x !== x && y !== y;
194
+ }
195
+ //#endregion
196
+ //#region packages/ecma262-abstract/Type.js
197
+ /**
198
+ * https://www.ecma-international.org/ecma-262/11.0/index.html#sec-type
199
+ */
200
+ function Type(x) {
201
+ if (x === null) return "Null";
202
+ if (typeof x === "undefined") return "Undefined";
203
+ if (typeof x === "function" || typeof x === "object") return "Object";
204
+ if (typeof x === "number") return "Number";
205
+ if (typeof x === "boolean") return "Boolean";
206
+ if (typeof x === "string") return "String";
207
+ if (typeof x === "symbol") return "Symbol";
208
+ if (typeof x === "bigint") return "BigInt";
209
+ }
210
+ //#endregion
211
+ //#region packages/ecma402-abstract/RelativeTimeFormat/SingularRelativeTimeUnit.js
212
+ /**
213
+ * https://tc39.es/proposal-intl-relative-time/#sec-singularrelativetimeunit
214
+ * @param unit
215
+ */
216
+ function SingularRelativeTimeUnit(unit) {
217
+ invariant(Type(unit) === "String", "unit must be a string");
218
+ if (unit === "seconds") return "second";
219
+ if (unit === "minutes") return "minute";
220
+ if (unit === "hours") return "hour";
221
+ if (unit === "days") return "day";
222
+ if (unit === "weeks") return "week";
223
+ if (unit === "months") return "month";
224
+ if (unit === "quarters") return "quarter";
225
+ if (unit === "years") return "year";
226
+ if (unit !== "second" && unit !== "minute" && unit !== "hour" && unit !== "day" && unit !== "week" && unit !== "month" && unit !== "quarter" && unit !== "year") throw new RangeError("invalid unit");
227
+ return unit;
228
+ }
229
+ //#endregion
230
+ //#region packages/ecma402-abstract/PartitionPattern.js
231
+ /**
232
+ * Partition a pattern into a list of literals and placeholders
233
+ * https://tc39.es/ecma402/#sec-partitionpattern
234
+ * @param pattern
235
+ */
236
+ function PartitionPattern(pattern) {
237
+ const result = [];
238
+ let beginIndex = pattern.indexOf("{");
239
+ let endIndex = 0;
240
+ let nextIndex = 0;
241
+ const length = pattern.length;
242
+ while (beginIndex < pattern.length && beginIndex > -1) {
243
+ endIndex = pattern.indexOf("}", beginIndex);
244
+ invariant(endIndex > beginIndex, `Invalid pattern ${pattern}`);
245
+ if (beginIndex > nextIndex) result.push({
246
+ type: "literal",
247
+ value: pattern.substring(nextIndex, beginIndex)
248
+ });
249
+ result.push({
250
+ type: pattern.substring(beginIndex + 1, endIndex),
251
+ value: void 0
252
+ });
253
+ nextIndex = endIndex + 1;
254
+ beginIndex = pattern.indexOf("{", nextIndex);
255
+ }
256
+ if (nextIndex < length) result.push({
257
+ type: "literal",
258
+ value: pattern.substring(nextIndex, length)
259
+ });
260
+ return result;
261
+ }
262
+ //#endregion
263
+ //#region packages/ecma402-abstract/RelativeTimeFormat/MakePartsList.js
264
+ function MakePartsList(pattern, unit, parts) {
265
+ const patternParts = PartitionPattern(pattern);
266
+ const result = [];
267
+ for (const patternPart of patternParts) if (patternPart.type === "literal") result.push({
268
+ type: "literal",
269
+ value: patternPart.value
270
+ });
271
+ else {
272
+ invariant(patternPart.type === "0", `Malformed pattern ${pattern}`);
273
+ for (const part of parts) result.push({
274
+ type: part.type,
275
+ value: part.value,
276
+ unit
277
+ });
278
+ }
279
+ return result;
280
+ }
281
+ //#endregion
282
+ //#region packages/ecma402-abstract/RelativeTimeFormat/PartitionRelativeTimePattern.js
283
+ function PartitionRelativeTimePattern(rtf, value, unit, { getInternalSlots }) {
284
+ invariant(Type(value) === "Number", `value must be number, instead got ${typeof value}`, TypeError);
285
+ invariant(Type(unit) === "String", `unit must be number, instead got ${typeof value}`, TypeError);
286
+ if (isNaN(value) || !isFinite(value)) throw new RangeError(`Invalid value ${value}`);
287
+ const resolvedUnit = SingularRelativeTimeUnit(unit);
288
+ const { fields, style, numeric, pluralRules, numberFormat } = getInternalSlots(rtf);
289
+ let entry = resolvedUnit;
290
+ if (style === "short") entry = `${resolvedUnit}-short`;
291
+ else if (style === "narrow") entry = `${resolvedUnit}-narrow`;
292
+ if (!(entry in fields)) entry = resolvedUnit;
293
+ const patterns = fields[entry];
294
+ if (numeric === "auto") {
295
+ if (ToString(value) in patterns) return [{
296
+ type: "literal",
297
+ value: patterns[ToString(value)]
298
+ }];
299
+ }
300
+ let tl = "future";
301
+ if (SameValue(value, -0) || value < 0) tl = "past";
302
+ const po = patterns[tl];
303
+ const fv = typeof numberFormat.formatToParts === "function" ? numberFormat.formatToParts(Math.abs(value)) : [{
304
+ type: "literal",
305
+ value: numberFormat.format(Math.abs(value)),
306
+ unit
307
+ }];
308
+ const pattern = po[pluralRules.select(value)];
309
+ return MakePartsList(pattern, resolvedUnit, fv);
310
+ }
311
+ //#endregion
312
+ //#region packages/intl-relativetimeformat/get_internal_slots.ts
313
+ const internalSlotMap = /* @__PURE__ */ new WeakMap();
314
+ function getInternalSlots(x) {
315
+ let internalSlots = internalSlotMap.get(x);
316
+ if (!internalSlots) {
317
+ internalSlots = Object.create(null);
318
+ internalSlotMap.set(x, internalSlots);
319
+ }
320
+ return internalSlots;
321
+ }
322
+ //#endregion
323
+ //#region packages/intl-relativetimeformat/index.ts
324
+ var RelativeTimeFormat = class RelativeTimeFormat {
325
+ constructor(locales, options) {
326
+ if (!(this && this instanceof RelativeTimeFormat ? this.constructor : void 0)) throw new TypeError("Intl.RelativeTimeFormat must be called with 'new'");
327
+ return InitializeRelativeTimeFormat(this, locales, options, {
328
+ getInternalSlots,
329
+ availableLocales: RelativeTimeFormat.availableLocales,
330
+ relevantExtensionKeys: RelativeTimeFormat.relevantExtensionKeys,
331
+ localeData: RelativeTimeFormat.localeData,
332
+ getDefaultLocale: RelativeTimeFormat.getDefaultLocale
333
+ });
334
+ }
335
+ format(value, unit) {
336
+ if (typeof this !== "object") throw new TypeError("format was called on a non-object");
337
+ if (!getInternalSlots(this).initializedRelativeTimeFormat) throw new TypeError("format was called on a invalid context");
338
+ return PartitionRelativeTimePattern(this, Number(value), ToString(unit), { getInternalSlots }).map((el) => el.value).join("");
339
+ }
340
+ formatToParts(value, unit) {
341
+ if (typeof this !== "object") throw new TypeError("formatToParts was called on a non-object");
342
+ if (!getInternalSlots(this).initializedRelativeTimeFormat) throw new TypeError("formatToParts was called on a invalid context");
343
+ return PartitionRelativeTimePattern(this, Number(value), ToString(unit), { getInternalSlots });
344
+ }
345
+ resolvedOptions() {
346
+ if (typeof this !== "object") throw new TypeError("resolvedOptions was called on a non-object");
347
+ const internalSlots = getInternalSlots(this);
348
+ if (!internalSlots.initializedRelativeTimeFormat) throw new TypeError("resolvedOptions was called on a invalid context");
349
+ return {
350
+ locale: internalSlots.locale,
351
+ style: internalSlots.style,
352
+ numeric: internalSlots.numeric,
353
+ numberingSystem: internalSlots.numberingSystem
354
+ };
355
+ }
356
+ static supportedLocalesOf(locales, options) {
357
+ return SupportedLocales(RelativeTimeFormat.availableLocales, CanonicalizeLocaleList(locales), options);
358
+ }
359
+ static __addLocaleData(...data) {
360
+ for (const { data: d, locale } of data) {
361
+ const minimizedLocale = new Intl.Locale(locale).minimize().toString();
362
+ RelativeTimeFormat.localeData[locale] = RelativeTimeFormat.localeData[minimizedLocale] = d;
363
+ RelativeTimeFormat.availableLocales.add(minimizedLocale);
364
+ RelativeTimeFormat.availableLocales.add(locale);
365
+ if (!RelativeTimeFormat.__defaultLocale) RelativeTimeFormat.__defaultLocale = minimizedLocale;
366
+ }
367
+ }
368
+ static {
369
+ this.localeData = {};
370
+ }
371
+ static {
372
+ this.availableLocales = /* @__PURE__ */ new Set();
373
+ }
374
+ static {
375
+ this.__defaultLocale = "";
376
+ }
377
+ static getDefaultLocale() {
378
+ return RelativeTimeFormat.__defaultLocale;
379
+ }
380
+ static {
381
+ this.relevantExtensionKeys = ["nu"];
382
+ }
383
+ static {
384
+ this.polyfilled = true;
385
+ }
386
+ };
387
+ try {
388
+ if (typeof Symbol !== "undefined") Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, {
389
+ value: "Intl.RelativeTimeFormat",
390
+ writable: false,
391
+ enumerable: false,
392
+ configurable: true
393
+ });
394
+ Object.defineProperty(RelativeTimeFormat.prototype.constructor, "length", {
395
+ value: 0,
396
+ writable: false,
397
+ enumerable: false,
398
+ configurable: true
399
+ });
400
+ Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, "length", {
401
+ value: 1,
402
+ writable: false,
403
+ enumerable: false,
404
+ configurable: true
405
+ });
406
+ } catch {}
407
+ //#endregion
408
+ //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/intl-relativetimeformat.js
409
+ const supportedLocales = [
410
+ "af",
411
+ "af-NA",
412
+ "agq",
413
+ "ak",
414
+ "am",
415
+ "ar",
416
+ "ar-AE",
417
+ "ar-BH",
418
+ "ar-DJ",
419
+ "ar-DZ",
420
+ "ar-EG",
421
+ "ar-EH",
422
+ "ar-ER",
423
+ "ar-IL",
424
+ "ar-IQ",
425
+ "ar-JO",
426
+ "ar-KM",
427
+ "ar-KW",
428
+ "ar-LB",
429
+ "ar-LY",
430
+ "ar-MA",
431
+ "ar-MR",
432
+ "ar-OM",
433
+ "ar-PS",
434
+ "ar-QA",
435
+ "ar-SA",
436
+ "ar-SD",
437
+ "ar-SO",
438
+ "ar-SS",
439
+ "ar-SY",
440
+ "ar-TD",
441
+ "ar-TN",
442
+ "ar-YE",
443
+ "as",
444
+ "asa",
445
+ "ast",
446
+ "az",
447
+ "az-Cyrl",
448
+ "az-Latn",
449
+ "bas",
450
+ "be",
451
+ "be-tarask",
452
+ "bem",
453
+ "bez",
454
+ "bg",
455
+ "bm",
456
+ "bn",
457
+ "bn-IN",
458
+ "bo",
459
+ "bo-IN",
460
+ "br",
461
+ "brx",
462
+ "bs",
463
+ "bs-Cyrl",
464
+ "bs-Latn",
465
+ "ca",
466
+ "ca-AD",
467
+ "ca-ES-valencia",
468
+ "ca-FR",
469
+ "ca-IT",
470
+ "ccp",
471
+ "ccp-IN",
472
+ "ce",
473
+ "ceb",
474
+ "cgg",
475
+ "chr",
476
+ "ckb",
477
+ "ckb-IR",
478
+ "cs",
479
+ "cy",
480
+ "da",
481
+ "da-GL",
482
+ "dav",
483
+ "de",
484
+ "de-AT",
485
+ "de-BE",
486
+ "de-CH",
487
+ "de-IT",
488
+ "de-LI",
489
+ "de-LU",
490
+ "dje",
491
+ "doi",
492
+ "dsb",
493
+ "dua",
494
+ "dyo",
495
+ "dz",
496
+ "ebu",
497
+ "ee",
498
+ "ee-TG",
499
+ "el",
500
+ "el-CY",
501
+ "en",
502
+ "en-001",
503
+ "en-150",
504
+ "en-AE",
505
+ "en-AG",
506
+ "en-AI",
507
+ "en-AS",
508
+ "en-AT",
509
+ "en-AU",
510
+ "en-BB",
511
+ "en-BE",
512
+ "en-BI",
513
+ "en-BM",
514
+ "en-BS",
515
+ "en-BW",
516
+ "en-BZ",
517
+ "en-CA",
518
+ "en-CC",
519
+ "en-CH",
520
+ "en-CK",
521
+ "en-CM",
522
+ "en-CX",
523
+ "en-CY",
524
+ "en-DE",
525
+ "en-DG",
526
+ "en-DK",
527
+ "en-DM",
528
+ "en-ER",
529
+ "en-FI",
530
+ "en-FJ",
531
+ "en-FK",
532
+ "en-FM",
533
+ "en-GB",
534
+ "en-GD",
535
+ "en-GG",
536
+ "en-GH",
537
+ "en-GI",
538
+ "en-GM",
539
+ "en-GU",
540
+ "en-GY",
541
+ "en-HK",
542
+ "en-IE",
543
+ "en-IL",
544
+ "en-IM",
545
+ "en-IN",
546
+ "en-IO",
547
+ "en-JE",
548
+ "en-JM",
549
+ "en-KE",
550
+ "en-KI",
551
+ "en-KN",
552
+ "en-KY",
553
+ "en-LC",
554
+ "en-LR",
555
+ "en-LS",
556
+ "en-MG",
557
+ "en-MH",
558
+ "en-MO",
559
+ "en-MP",
560
+ "en-MS",
561
+ "en-MT",
562
+ "en-MU",
563
+ "en-MW",
564
+ "en-MY",
565
+ "en-NA",
566
+ "en-NF",
567
+ "en-NG",
568
+ "en-NL",
569
+ "en-NR",
570
+ "en-NU",
571
+ "en-NZ",
572
+ "en-PG",
573
+ "en-PH",
574
+ "en-PK",
575
+ "en-PN",
576
+ "en-PR",
577
+ "en-PW",
578
+ "en-RW",
579
+ "en-SB",
580
+ "en-SC",
581
+ "en-SD",
582
+ "en-SE",
583
+ "en-SG",
584
+ "en-SH",
585
+ "en-SI",
586
+ "en-SL",
587
+ "en-SS",
588
+ "en-SX",
589
+ "en-SZ",
590
+ "en-TC",
591
+ "en-TK",
592
+ "en-TO",
593
+ "en-TT",
594
+ "en-TV",
595
+ "en-TZ",
596
+ "en-UG",
597
+ "en-UM",
598
+ "en-VC",
599
+ "en-VG",
600
+ "en-VI",
601
+ "en-VU",
602
+ "en-WS",
603
+ "en-ZA",
604
+ "en-ZM",
605
+ "en-ZW",
606
+ "eo",
607
+ "es",
608
+ "es-419",
609
+ "es-AR",
610
+ "es-BO",
611
+ "es-BR",
612
+ "es-BZ",
613
+ "es-CL",
614
+ "es-CO",
615
+ "es-CR",
616
+ "es-CU",
617
+ "es-DO",
618
+ "es-EA",
619
+ "es-EC",
620
+ "es-GQ",
621
+ "es-GT",
622
+ "es-HN",
623
+ "es-IC",
624
+ "es-MX",
625
+ "es-NI",
626
+ "es-PA",
627
+ "es-PE",
628
+ "es-PH",
629
+ "es-PR",
630
+ "es-PY",
631
+ "es-SV",
632
+ "es-US",
633
+ "es-UY",
634
+ "es-VE",
635
+ "et",
636
+ "eu",
637
+ "ewo",
638
+ "fa",
639
+ "fa-AF",
640
+ "ff",
641
+ "ff-Adlm",
642
+ "ff-Adlm-BF",
643
+ "ff-Adlm-CM",
644
+ "ff-Adlm-GH",
645
+ "ff-Adlm-GM",
646
+ "ff-Adlm-GW",
647
+ "ff-Adlm-LR",
648
+ "ff-Adlm-MR",
649
+ "ff-Adlm-NE",
650
+ "ff-Adlm-NG",
651
+ "ff-Adlm-SL",
652
+ "ff-Adlm-SN",
653
+ "ff-Latn",
654
+ "ff-Latn-BF",
655
+ "ff-Latn-CM",
656
+ "ff-Latn-GH",
657
+ "ff-Latn-GM",
658
+ "ff-Latn-GN",
659
+ "ff-Latn-GW",
660
+ "ff-Latn-LR",
661
+ "ff-Latn-MR",
662
+ "ff-Latn-NE",
663
+ "ff-Latn-NG",
664
+ "ff-Latn-SL",
665
+ "fi",
666
+ "fil",
667
+ "fo",
668
+ "fo-DK",
669
+ "fr",
670
+ "fr-BE",
671
+ "fr-BF",
672
+ "fr-BI",
673
+ "fr-BJ",
674
+ "fr-BL",
675
+ "fr-CA",
676
+ "fr-CD",
677
+ "fr-CF",
678
+ "fr-CG",
679
+ "fr-CH",
680
+ "fr-CI",
681
+ "fr-CM",
682
+ "fr-DJ",
683
+ "fr-DZ",
684
+ "fr-GA",
685
+ "fr-GF",
686
+ "fr-GN",
687
+ "fr-GP",
688
+ "fr-GQ",
689
+ "fr-HT",
690
+ "fr-KM",
691
+ "fr-LU",
692
+ "fr-MA",
693
+ "fr-MC",
694
+ "fr-MF",
695
+ "fr-MG",
696
+ "fr-ML",
697
+ "fr-MQ",
698
+ "fr-MR",
699
+ "fr-MU",
700
+ "fr-NC",
701
+ "fr-NE",
702
+ "fr-PF",
703
+ "fr-PM",
704
+ "fr-RE",
705
+ "fr-RW",
706
+ "fr-SC",
707
+ "fr-SN",
708
+ "fr-SY",
709
+ "fr-TD",
710
+ "fr-TG",
711
+ "fr-TN",
712
+ "fr-VU",
713
+ "fr-WF",
714
+ "fr-YT",
715
+ "fur",
716
+ "fy",
717
+ "ga",
718
+ "ga-GB",
719
+ "gd",
720
+ "gl",
721
+ "gsw",
722
+ "gsw-FR",
723
+ "gsw-LI",
724
+ "gu",
725
+ "guz",
726
+ "gv",
727
+ "ha",
728
+ "ha-GH",
729
+ "ha-NE",
730
+ "haw",
731
+ "he",
732
+ "hi",
733
+ "hr",
734
+ "hr-BA",
735
+ "hsb",
736
+ "hu",
737
+ "hy",
738
+ "ia",
739
+ "id",
740
+ "ig",
741
+ "ii",
742
+ "is",
743
+ "it",
744
+ "it-CH",
745
+ "it-SM",
746
+ "it-VA",
747
+ "ja",
748
+ "jgo",
749
+ "jmc",
750
+ "jv",
751
+ "ka",
752
+ "kab",
753
+ "kam",
754
+ "kde",
755
+ "kea",
756
+ "kgp",
757
+ "khq",
758
+ "ki",
759
+ "kk",
760
+ "kkj",
761
+ "kl",
762
+ "kln",
763
+ "km",
764
+ "kn",
765
+ "ko",
766
+ "ko-KP",
767
+ "kok",
768
+ "ks",
769
+ "ks-Arab",
770
+ "ksb",
771
+ "ksf",
772
+ "ksh",
773
+ "ku",
774
+ "kw",
775
+ "ky",
776
+ "lag",
777
+ "lb",
778
+ "lg",
779
+ "lkt",
780
+ "ln",
781
+ "ln-AO",
782
+ "ln-CF",
783
+ "ln-CG",
784
+ "lo",
785
+ "lrc",
786
+ "lrc-IQ",
787
+ "lt",
788
+ "lu",
789
+ "luo",
790
+ "luy",
791
+ "lv",
792
+ "mai",
793
+ "mas",
794
+ "mas-TZ",
795
+ "mer",
796
+ "mfe",
797
+ "mg",
798
+ "mgh",
799
+ "mgo",
800
+ "mi",
801
+ "mk",
802
+ "ml",
803
+ "mn",
804
+ "mni",
805
+ "mni-Beng",
806
+ "mr",
807
+ "ms",
808
+ "ms-BN",
809
+ "ms-ID",
810
+ "ms-SG",
811
+ "mt",
812
+ "mua",
813
+ "my",
814
+ "mzn",
815
+ "naq",
816
+ "nb",
817
+ "nb-SJ",
818
+ "nd",
819
+ "nds",
820
+ "nds-NL",
821
+ "ne",
822
+ "ne-IN",
823
+ "nl",
824
+ "nl-AW",
825
+ "nl-BE",
826
+ "nl-BQ",
827
+ "nl-CW",
828
+ "nl-SR",
829
+ "nl-SX",
830
+ "nmg",
831
+ "nn",
832
+ "nnh",
833
+ "no",
834
+ "nus",
835
+ "nyn",
836
+ "om",
837
+ "om-KE",
838
+ "or",
839
+ "os",
840
+ "os-RU",
841
+ "pa",
842
+ "pa-Arab",
843
+ "pa-Guru",
844
+ "pcm",
845
+ "pl",
846
+ "ps",
847
+ "ps-PK",
848
+ "pt",
849
+ "pt-AO",
850
+ "pt-CH",
851
+ "pt-CV",
852
+ "pt-GQ",
853
+ "pt-GW",
854
+ "pt-LU",
855
+ "pt-MO",
856
+ "pt-MZ",
857
+ "pt-PT",
858
+ "pt-ST",
859
+ "pt-TL",
860
+ "qu",
861
+ "qu-BO",
862
+ "qu-EC",
863
+ "rm",
864
+ "rn",
865
+ "ro",
866
+ "ro-MD",
867
+ "rof",
868
+ "ru",
869
+ "ru-BY",
870
+ "ru-KG",
871
+ "ru-KZ",
872
+ "ru-MD",
873
+ "ru-UA",
874
+ "rw",
875
+ "rwk",
876
+ "sa",
877
+ "sah",
878
+ "saq",
879
+ "sat",
880
+ "sat-Olck",
881
+ "sbp",
882
+ "sc",
883
+ "sd",
884
+ "sd-Arab",
885
+ "sd-Deva",
886
+ "se",
887
+ "se-FI",
888
+ "se-SE",
889
+ "seh",
890
+ "ses",
891
+ "sg",
892
+ "shi",
893
+ "shi-Latn",
894
+ "shi-Tfng",
895
+ "si",
896
+ "sk",
897
+ "sl",
898
+ "smn",
899
+ "sn",
900
+ "so",
901
+ "so-DJ",
902
+ "so-ET",
903
+ "so-KE",
904
+ "sq",
905
+ "sq-MK",
906
+ "sq-XK",
907
+ "sr",
908
+ "sr-Cyrl",
909
+ "sr-Cyrl-BA",
910
+ "sr-Cyrl-ME",
911
+ "sr-Cyrl-XK",
912
+ "sr-Latn",
913
+ "sr-Latn-BA",
914
+ "sr-Latn-ME",
915
+ "sr-Latn-XK",
916
+ "su",
917
+ "su-Latn",
918
+ "sv",
919
+ "sv-AX",
920
+ "sv-FI",
921
+ "sw",
922
+ "sw-CD",
923
+ "sw-KE",
924
+ "sw-UG",
925
+ "ta",
926
+ "ta-LK",
927
+ "ta-MY",
928
+ "ta-SG",
929
+ "te",
930
+ "teo",
931
+ "teo-KE",
932
+ "tg",
933
+ "th",
934
+ "ti",
935
+ "ti-ER",
936
+ "tk",
937
+ "to",
938
+ "tr",
939
+ "tr-CY",
940
+ "tt",
941
+ "twq",
942
+ "tzm",
943
+ "ug",
944
+ "uk",
945
+ "und",
946
+ "ur",
947
+ "ur-IN",
948
+ "uz",
949
+ "uz-Arab",
950
+ "uz-Cyrl",
951
+ "uz-Latn",
952
+ "vai",
953
+ "vai-Latn",
954
+ "vai-Vaii",
955
+ "vi",
956
+ "vun",
957
+ "wae",
958
+ "wo",
959
+ "xh",
960
+ "xog",
961
+ "yav",
962
+ "yi",
963
+ "yo",
964
+ "yo-BJ",
965
+ "yrl",
966
+ "yrl-CO",
967
+ "yrl-VE",
968
+ "yue",
969
+ "yue-Hans",
970
+ "yue-Hant",
971
+ "zgh",
972
+ "zh",
973
+ "zh-Hans",
974
+ "zh-Hans-HK",
975
+ "zh-Hans-MO",
976
+ "zh-Hans-SG",
977
+ "zh-Hant",
978
+ "zh-Hant-HK",
979
+ "zh-Hant-MO",
980
+ "zu"
981
+ ];
982
+ //#endregion
983
+ //#region packages/intl-relativetimeformat/should-polyfill.ts
984
+ function supportedLocalesOf(locale) {
985
+ if (!locale) return true;
986
+ const locales = Array.isArray(locale) ? locale : [locale];
987
+ return Intl.RelativeTimeFormat.supportedLocalesOf(locales).length === locales.length;
988
+ }
989
+ function hasResolvedOptionsNumberingSystem(locale) {
990
+ try {
991
+ return "numberingSystem" in new Intl.RelativeTimeFormat(locale || "en", { numeric: "auto" }).resolvedOptions();
992
+ } catch {
993
+ return false;
994
+ }
995
+ }
996
+ function shouldPolyfill(locale = "en") {
997
+ if (!("RelativeTimeFormat" in Intl) || !supportedLocalesOf(locale) || !hasResolvedOptionsNumberingSystem(locale)) return match([locale], supportedLocales, "en");
998
+ }
999
+ //#endregion
1000
+ //#region packages/intl-relativetimeformat/polyfill.ts
3
1001
  if (shouldPolyfill()) {
4
1002
  Object.defineProperty(Intl, "RelativeTimeFormat", {
5
1003
  value: RelativeTimeFormat,
@@ -7,10 +1005,12 @@ if (shouldPolyfill()) {
7
1005
  enumerable: false,
8
1006
  configurable: true
9
1007
  });
10
- // Drain any locale data that was buffered before polyfill loaded
11
1008
  const buf = globalThis.__FORMATJS_RELATIVETIMEFORMAT_DATA__;
12
1009
  if (buf) {
13
1010
  for (const d of buf) RelativeTimeFormat.__addLocaleData(d);
14
1011
  delete globalThis.__FORMATJS_RELATIVETIMEFORMAT_DATA__;
15
1012
  }
16
1013
  }
1014
+ //#endregion
1015
+
1016
+ //# sourceMappingURL=polyfill.js.map