@formatjs/intl-supportedvaluesof 3.1.0 → 3.1.2

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/index.js CHANGED
@@ -1,22 +1,153 @@
1
1
  import { memoize, strategies } from "@formatjs/fast-memoize";
2
2
  // packages/ecma262-abstract/ToString.js
3
+ const StringConstructor = String;
4
+ const TypeErrorConstructor = TypeError;
3
5
  /**
4
6
  * https://tc39.es/ecma262/#sec-tostring
5
7
  */
6
8
  function ToString(o) {
7
- if (typeof o === "symbol") throw TypeError("Cannot convert a Symbol value to a string");
8
- return String(o);
9
+ if (typeof o === "symbol") throw TypeErrorConstructor("Cannot convert a Symbol value to a string");
10
+ return StringConstructor(o);
11
+ }
12
+ Number.isInteger;
13
+ Number.isFinite;
14
+ Number.isSafeInteger;
15
+ const RangeErrorConstructor = RangeError;
16
+ const arrayApply = Reflect.apply;
17
+ Array.prototype.every;
18
+ const some = Array.prototype.some;
19
+ function arraySome(values, predicate) {
20
+ return arrayApply(some, values, [predicate]);
21
+ }
22
+ Array.prototype.includes;
23
+ const indexOf = Array.prototype.indexOf;
24
+ function arrayIndexOf(values, search) {
25
+ return arrayApply(indexOf, values, [search]);
26
+ }
27
+ const defineProperty = Object.defineProperty;
28
+ function setDataProperty(target, key, value) {
29
+ defineProperty(target, key, {
30
+ __proto__: null,
31
+ value,
32
+ writable: true,
33
+ enumerable: true,
34
+ configurable: true
35
+ });
36
+ }
37
+ // packages/intl-supportedvaluesof/supported-entries.ts
38
+ const apply$2 = Reflect.apply;
39
+ const sort = Array.prototype.sort;
40
+ function supportedEntries(candidates, supported) {
41
+ const result = [];
42
+ for (let index = 0; index < candidates.length; index++) {
43
+ const entry = candidates[index];
44
+ if (supported(entry)) setDataProperty(result, `${result.length}`, entry);
45
+ }
46
+ apply$2(sort, result, []);
47
+ return result;
9
48
  }
10
49
  // packages/intl-supportedvaluesof/memoize.ts
11
- /**
12
- * Implementation: Memoized factory for Intl.DateTimeFormat instances
13
- *
14
- * Creates and caches DateTimeFormat instances to avoid repeated instantiation overhead.
15
- * This is critical for performance since we test many candidate values against formatters.
16
- *
17
- * Uses variadic memoization strategy to handle varying numbers of constructor arguments.
18
- */
19
- const createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
50
+ const descriptor = Object.getOwnPropertyDescriptor;
51
+ const getPrototypeOf = Object.getPrototypeOf;
52
+ const objectPrototype = Object.prototype;
53
+ const apply$1 = Reflect.apply;
54
+ const memoizeOptions = {
55
+ __proto__: null,
56
+ strategy: strategies.variadic
57
+ };
58
+ const availableCalendarsKey = Symbol.for("@formatjs/intl-datetimeformat/availableCalendars");
59
+ const hasTimeZoneKey = Symbol.for("@formatjs/intl-datetimeformat/hasTimeZone");
60
+ function ownValue(object, key) {
61
+ const property = descriptor(object, key);
62
+ return property && descriptor(property, "value")?.value;
63
+ }
64
+ function findProperty(owner, key) {
65
+ while (owner !== null && (typeof owner === "object" || typeof owner === "function") && owner !== objectPrototype) {
66
+ const property = descriptor(owner, key);
67
+ if (property) return property;
68
+ owner = getPrototypeOf(owner);
69
+ }
70
+ }
71
+ function resolvedOptions(Constructor) {
72
+ const property = findProperty(ownValue(Constructor, "prototype"), "resolvedOptions");
73
+ const method = property && ownValue(property, "value");
74
+ if (typeof method === "function") return (formatter) => apply$1(method, formatter, []);
75
+ }
76
+ let intl = ownValue(globalThis, "Intl");
77
+ function retainProbe(name, createProbe) {
78
+ const probes = /* @__PURE__ */ new WeakMap();
79
+ const readProbe = probes.get.bind(probes);
80
+ const writeProbe = probes.set.bind(probes);
81
+ let currentProbe;
82
+ const getProbe = () => {
83
+ intl ??= ownValue(globalThis, "Intl");
84
+ const property = intl && descriptor(intl, name);
85
+ const data = property && descriptor(property, "value");
86
+ if (!data) return currentProbe;
87
+ const candidate = data.value;
88
+ if (typeof candidate !== "function") return void 0;
89
+ const Constructor = candidate;
90
+ let probe = readProbe(Constructor);
91
+ if (probe === void 0) {
92
+ probe = createProbe(Constructor);
93
+ writeProbe(Constructor, probe);
94
+ }
95
+ currentProbe = probe;
96
+ return probe;
97
+ };
98
+ getProbe();
99
+ return getProbe;
100
+ }
101
+ function memoizeHost(Constructor, construct) {
102
+ const marker = findProperty(Constructor, "polyfilled");
103
+ return marker && ownValue(marker, "value") ? construct : memoize(construct, memoizeOptions);
104
+ }
105
+ const getDateTimeFormatProbe = retainProbe("DateTimeFormat", (Constructor) => {
106
+ const availableCalendars = ownValue(Constructor, availableCalendarsKey);
107
+ const hasTimeZone = ownValue(Constructor, hasTimeZoneKey);
108
+ return {
109
+ create: memoizeHost(Constructor, (locales, options) => new Constructor(locales, options)),
110
+ resolve: resolvedOptions(Constructor),
111
+ availableCalendars: typeof availableCalendars === "function" ? () => apply$1(availableCalendars, Constructor, []) : void 0,
112
+ hasTimeZone: typeof hasTimeZone === "function" ? (name) => apply$1(hasTimeZone, Constructor, [name]) : void 0
113
+ };
114
+ });
115
+ const getNumberFormatProbe = retainProbe("NumberFormat", (Constructor) => {
116
+ const property = findProperty(ownValue(Constructor, "prototype"), "format");
117
+ const getter = property && ownValue(property, "get");
118
+ const method = property && ownValue(property, "value");
119
+ const partsProperty = findProperty(ownValue(Constructor, "prototype"), "formatToParts");
120
+ const parts = partsProperty && ownValue(partsProperty, "value");
121
+ let format;
122
+ if (typeof getter === "function") format = (formatter, value) => apply$1(apply$1(getter, formatter, []), void 0, [value]);
123
+ else if (typeof method === "function") format = (formatter, value) => apply$1(method, formatter, [value]);
124
+ return {
125
+ create: memoizeHost(Constructor, (locales, options) => new Constructor(locales, options)),
126
+ resolve: resolvedOptions(Constructor),
127
+ format,
128
+ formatToParts: typeof parts === "function" ? (formatter, value) => apply$1(parts, formatter, [value]) : void 0
129
+ };
130
+ });
131
+ const getCollatorProbe = retainProbe("Collator", (Constructor) => ({
132
+ create: (locale) => new Constructor(locale),
133
+ resolve: resolvedOptions(Constructor)
134
+ }));
135
+ const getRelativeTimeFormatProbe = retainProbe("RelativeTimeFormat", (Constructor) => ({
136
+ create: (locale) => new Constructor(locale),
137
+ resolve: resolvedOptions(Constructor)
138
+ }));
139
+ const getCurrencyDisplayNamesProbe = retainProbe("DisplayNames", (Constructor) => {
140
+ const property = findProperty(ownValue(Constructor, "prototype"), "of");
141
+ const of = property && ownValue(property, "value");
142
+ return {
143
+ create: (locale) => new Constructor(locale, {
144
+ __proto__: null,
145
+ type: "currency",
146
+ fallback: "none"
147
+ }),
148
+ hasName: typeof of === "function" ? (formatter, code) => apply$1(of, formatter, [code]) !== void 0 : void 0
149
+ };
150
+ });
20
151
  // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/calendars.js
21
152
  const calendars = [
22
153
  "buddhist",
@@ -33,33 +164,548 @@ const calendars = [
33
164
  "islamic-rgsa",
34
165
  "islamic-tbla",
35
166
  "islamic-umalqura",
36
- "islamicc",
37
167
  "iso8601",
38
168
  "japanese",
39
169
  "persian",
40
170
  "roc"
41
171
  ];
172
+ const calendarCandidateLocales = {
173
+ "buddhist": [
174
+ "en",
175
+ "th",
176
+ "th-TH",
177
+ "th-Thai-TH"
178
+ ],
179
+ "chinese": [
180
+ "en",
181
+ "zh",
182
+ "zh-CN",
183
+ "zh-Hans-CN",
184
+ "zh-HK",
185
+ "zh-Hant-HK",
186
+ "zh-MO",
187
+ "zh-Hant-MO",
188
+ "zh-TW",
189
+ "zh-Hant-TW"
190
+ ],
191
+ "coptic": [
192
+ "en",
193
+ "ar",
194
+ "ar-EG",
195
+ "ar-Arab-EG"
196
+ ],
197
+ "dangi": [
198
+ "en",
199
+ "ko",
200
+ "ko-KR",
201
+ "ko-Kore-KR"
202
+ ],
203
+ "ethioaa": [
204
+ "en",
205
+ "ar",
206
+ "fa",
207
+ "sq",
208
+ "az",
209
+ "bn",
210
+ "zh",
211
+ "fr",
212
+ "ti",
213
+ "am",
214
+ "id",
215
+ "he",
216
+ "hi",
217
+ "ja",
218
+ "ko",
219
+ "dv",
220
+ "ms",
221
+ "ha",
222
+ "ur",
223
+ "th",
224
+ "tg",
225
+ "tk",
226
+ "tr",
227
+ "uz"
228
+ ],
229
+ "ethiopic": [
230
+ "en",
231
+ "am",
232
+ "am-ET",
233
+ "am-Ethi-ET"
234
+ ],
235
+ "gregory": [
236
+ "en",
237
+ "ar",
238
+ "ar-AE",
239
+ "ar-Arab-AE",
240
+ "fa",
241
+ "fa-AF",
242
+ "fa-Arab-AF",
243
+ "sq",
244
+ "sq-AL",
245
+ "sq-Latn-AL",
246
+ "az",
247
+ "az-AZ",
248
+ "az-Latn-AZ",
249
+ "bn",
250
+ "bn-BD",
251
+ "bn-Beng-BD",
252
+ "ar-BH",
253
+ "ar-Arab-BH",
254
+ "zh",
255
+ "zh-CN",
256
+ "zh-Hans-CN",
257
+ "fr",
258
+ "fr-DJ",
259
+ "fr-Latn-DJ",
260
+ "ar-DZ",
261
+ "ar-Arab-DZ",
262
+ "ar-EG",
263
+ "ar-Arab-EG",
264
+ "ar-EH",
265
+ "ar-Arab-EH",
266
+ "ti",
267
+ "ti-ER",
268
+ "ti-Ethi-ER",
269
+ "am",
270
+ "am-ET",
271
+ "am-Ethi-ET",
272
+ "zh-HK",
273
+ "zh-Hant-HK",
274
+ "id",
275
+ "id-ID",
276
+ "id-Latn-ID",
277
+ "he",
278
+ "he-IL",
279
+ "he-Hebr-IL",
280
+ "hi",
281
+ "hi-IN",
282
+ "hi-Deva-IN",
283
+ "ar-IQ",
284
+ "ar-Arab-IQ",
285
+ "fa-IR",
286
+ "fa-Arab-IR",
287
+ "ar-JO",
288
+ "ar-Arab-JO",
289
+ "ja",
290
+ "ja-JP",
291
+ "ja-Jpan-JP",
292
+ "ar-KM",
293
+ "ar-Arab-KM",
294
+ "ko",
295
+ "ko-KR",
296
+ "ko-Kore-KR",
297
+ "ar-KW",
298
+ "ar-Arab-KW",
299
+ "ar-LB",
300
+ "ar-Arab-LB",
301
+ "ar-LY",
302
+ "ar-Arab-LY",
303
+ "ar-MA",
304
+ "ar-Arab-MA",
305
+ "zh-MO",
306
+ "zh-Hant-MO",
307
+ "ar-MR",
308
+ "ar-Arab-MR",
309
+ "dv",
310
+ "dv-MV",
311
+ "dv-Thaa-MV",
312
+ "ms",
313
+ "ms-MY",
314
+ "ms-Latn-MY",
315
+ "ha",
316
+ "ha-NE",
317
+ "ha-Latn-NE",
318
+ "ar-OM",
319
+ "ar-Arab-OM",
320
+ "ur",
321
+ "ur-PK",
322
+ "ur-Arab-PK",
323
+ "ar-PS",
324
+ "ar-Arab-PS",
325
+ "ar-QA",
326
+ "ar-Arab-QA",
327
+ "ar-SA",
328
+ "ar-Arab-SA",
329
+ "ar-SD",
330
+ "ar-Arab-SD",
331
+ "ar-SY",
332
+ "ar-Arab-SY",
333
+ "ar-TD",
334
+ "ar-Arab-TD",
335
+ "th",
336
+ "th-TH",
337
+ "th-Thai-TH",
338
+ "tg",
339
+ "tg-TJ",
340
+ "tg-Cyrl-TJ",
341
+ "tk",
342
+ "tk-TM",
343
+ "tk-Latn-TM",
344
+ "ar-TN",
345
+ "ar-Arab-TN",
346
+ "tr",
347
+ "tr-TR",
348
+ "tr-Latn-TR",
349
+ "zh-TW",
350
+ "zh-Hant-TW",
351
+ "uz",
352
+ "uz-UZ",
353
+ "uz-Latn-UZ",
354
+ "sq-XK",
355
+ "sq-Latn-XK",
356
+ "ar-YE",
357
+ "ar-Arab-YE"
358
+ ],
359
+ "hebrew": [
360
+ "en",
361
+ "he",
362
+ "he-IL",
363
+ "he-Hebr-IL"
364
+ ],
365
+ "indian": [
366
+ "en",
367
+ "hi",
368
+ "hi-IN",
369
+ "hi-Deva-IN"
370
+ ],
371
+ "islamic": [
372
+ "en",
373
+ "ar",
374
+ "ar-AE",
375
+ "ar-Arab-AE",
376
+ "fa",
377
+ "fa-AF",
378
+ "fa-Arab-AF",
379
+ "bn",
380
+ "bn-BD",
381
+ "bn-Beng-BD",
382
+ "ar-BH",
383
+ "ar-Arab-BH",
384
+ "fr",
385
+ "fr-DJ",
386
+ "fr-Latn-DJ",
387
+ "ar-DZ",
388
+ "ar-Arab-DZ",
389
+ "ar-EG",
390
+ "ar-Arab-EG",
391
+ "ar-EH",
392
+ "ar-Arab-EH",
393
+ "ti",
394
+ "ti-ER",
395
+ "ti-Ethi-ER",
396
+ "id",
397
+ "id-ID",
398
+ "id-Latn-ID",
399
+ "he",
400
+ "he-IL",
401
+ "he-Hebr-IL",
402
+ "ar-IQ",
403
+ "ar-Arab-IQ",
404
+ "fa-IR",
405
+ "fa-Arab-IR",
406
+ "ar-JO",
407
+ "ar-Arab-JO",
408
+ "ar-KM",
409
+ "ar-Arab-KM",
410
+ "ar-KW",
411
+ "ar-Arab-KW",
412
+ "ar-LB",
413
+ "ar-Arab-LB",
414
+ "ar-LY",
415
+ "ar-Arab-LY",
416
+ "ar-MA",
417
+ "ar-Arab-MA",
418
+ "ar-MR",
419
+ "ar-Arab-MR",
420
+ "ms",
421
+ "ms-MY",
422
+ "ms-Latn-MY",
423
+ "ha",
424
+ "ha-NE",
425
+ "ha-Latn-NE",
426
+ "ar-OM",
427
+ "ar-Arab-OM",
428
+ "ur",
429
+ "ur-PK",
430
+ "ur-Arab-PK",
431
+ "ar-PS",
432
+ "ar-Arab-PS",
433
+ "ar-QA",
434
+ "ar-Arab-QA",
435
+ "ar-SA",
436
+ "ar-Arab-SA",
437
+ "ar-SD",
438
+ "ar-Arab-SD",
439
+ "ar-SY",
440
+ "ar-Arab-SY",
441
+ "ar-TD",
442
+ "ar-Arab-TD",
443
+ "ar-TN",
444
+ "ar-Arab-TN",
445
+ "ar-YE",
446
+ "ar-Arab-YE"
447
+ ],
448
+ "islamic-civil": [
449
+ "en",
450
+ "ar",
451
+ "ar-AE",
452
+ "ar-Arab-AE",
453
+ "fa",
454
+ "fa-AF",
455
+ "fa-Arab-AF",
456
+ "sq",
457
+ "sq-AL",
458
+ "sq-Latn-AL",
459
+ "az",
460
+ "az-AZ",
461
+ "az-Latn-AZ",
462
+ "bn",
463
+ "bn-BD",
464
+ "bn-Beng-BD",
465
+ "ar-BH",
466
+ "ar-Arab-BH",
467
+ "fr",
468
+ "fr-DJ",
469
+ "fr-Latn-DJ",
470
+ "ar-DZ",
471
+ "ar-Arab-DZ",
472
+ "ar-EG",
473
+ "ar-Arab-EG",
474
+ "ar-EH",
475
+ "ar-Arab-EH",
476
+ "ti",
477
+ "ti-ER",
478
+ "ti-Ethi-ER",
479
+ "id",
480
+ "id-ID",
481
+ "id-Latn-ID",
482
+ "he",
483
+ "he-IL",
484
+ "he-Hebr-IL",
485
+ "ar-IQ",
486
+ "ar-Arab-IQ",
487
+ "fa-IR",
488
+ "fa-Arab-IR",
489
+ "ar-JO",
490
+ "ar-Arab-JO",
491
+ "ar-KM",
492
+ "ar-Arab-KM",
493
+ "ar-KW",
494
+ "ar-Arab-KW",
495
+ "ar-LB",
496
+ "ar-Arab-LB",
497
+ "ar-LY",
498
+ "ar-Arab-LY",
499
+ "ar-MA",
500
+ "ar-Arab-MA",
501
+ "ar-MR",
502
+ "ar-Arab-MR",
503
+ "dv",
504
+ "dv-MV",
505
+ "dv-Thaa-MV",
506
+ "ms",
507
+ "ms-MY",
508
+ "ms-Latn-MY",
509
+ "ha",
510
+ "ha-NE",
511
+ "ha-Latn-NE",
512
+ "ar-OM",
513
+ "ar-Arab-OM",
514
+ "ur",
515
+ "ur-PK",
516
+ "ur-Arab-PK",
517
+ "ar-PS",
518
+ "ar-Arab-PS",
519
+ "ar-QA",
520
+ "ar-Arab-QA",
521
+ "ar-SD",
522
+ "ar-Arab-SD",
523
+ "ar-SY",
524
+ "ar-Arab-SY",
525
+ "ar-TD",
526
+ "ar-Arab-TD",
527
+ "tg",
528
+ "tg-TJ",
529
+ "tg-Cyrl-TJ",
530
+ "tk",
531
+ "tk-TM",
532
+ "tk-Latn-TM",
533
+ "ar-TN",
534
+ "ar-Arab-TN",
535
+ "tr",
536
+ "tr-TR",
537
+ "tr-Latn-TR",
538
+ "uz",
539
+ "uz-UZ",
540
+ "uz-Latn-UZ",
541
+ "sq-XK",
542
+ "sq-Latn-XK",
543
+ "ar-YE",
544
+ "ar-Arab-YE"
545
+ ],
546
+ "islamic-rgsa": [
547
+ "en",
548
+ "ar",
549
+ "ar-SA",
550
+ "ar-Arab-SA"
551
+ ],
552
+ "islamic-tbla": [
553
+ "en",
554
+ "ar",
555
+ "ar-AE",
556
+ "ar-Arab-AE",
557
+ "fa",
558
+ "fa-AF",
559
+ "fa-Arab-AF",
560
+ "sq",
561
+ "sq-AL",
562
+ "sq-Latn-AL",
563
+ "az",
564
+ "az-AZ",
565
+ "az-Latn-AZ",
566
+ "bn",
567
+ "bn-BD",
568
+ "bn-Beng-BD",
569
+ "ar-BH",
570
+ "ar-Arab-BH",
571
+ "fr",
572
+ "fr-DJ",
573
+ "fr-Latn-DJ",
574
+ "ar-DZ",
575
+ "ar-Arab-DZ",
576
+ "ar-EG",
577
+ "ar-Arab-EG",
578
+ "ar-EH",
579
+ "ar-Arab-EH",
580
+ "ti",
581
+ "ti-ER",
582
+ "ti-Ethi-ER",
583
+ "id",
584
+ "id-ID",
585
+ "id-Latn-ID",
586
+ "he",
587
+ "he-IL",
588
+ "he-Hebr-IL",
589
+ "ar-IQ",
590
+ "ar-Arab-IQ",
591
+ "fa-IR",
592
+ "fa-Arab-IR",
593
+ "ar-JO",
594
+ "ar-Arab-JO",
595
+ "ar-KM",
596
+ "ar-Arab-KM",
597
+ "ar-KW",
598
+ "ar-Arab-KW",
599
+ "ar-LB",
600
+ "ar-Arab-LB",
601
+ "ar-LY",
602
+ "ar-Arab-LY",
603
+ "ar-MA",
604
+ "ar-Arab-MA",
605
+ "ar-MR",
606
+ "ar-Arab-MR",
607
+ "dv",
608
+ "dv-MV",
609
+ "dv-Thaa-MV",
610
+ "ms",
611
+ "ms-MY",
612
+ "ms-Latn-MY",
613
+ "ha",
614
+ "ha-NE",
615
+ "ha-Latn-NE",
616
+ "ar-OM",
617
+ "ar-Arab-OM",
618
+ "ur",
619
+ "ur-PK",
620
+ "ur-Arab-PK",
621
+ "ar-PS",
622
+ "ar-Arab-PS",
623
+ "ar-QA",
624
+ "ar-Arab-QA",
625
+ "ar-SD",
626
+ "ar-Arab-SD",
627
+ "ar-SY",
628
+ "ar-Arab-SY",
629
+ "ar-TD",
630
+ "ar-Arab-TD",
631
+ "tg",
632
+ "tg-TJ",
633
+ "tg-Cyrl-TJ",
634
+ "tk",
635
+ "tk-TM",
636
+ "tk-Latn-TM",
637
+ "ar-TN",
638
+ "ar-Arab-TN",
639
+ "tr",
640
+ "tr-TR",
641
+ "tr-Latn-TR",
642
+ "uz",
643
+ "uz-UZ",
644
+ "uz-Latn-UZ",
645
+ "sq-XK",
646
+ "sq-Latn-XK",
647
+ "ar-YE",
648
+ "ar-Arab-YE"
649
+ ],
650
+ "islamic-umalqura": [
651
+ "en",
652
+ "ar",
653
+ "ar-AE",
654
+ "ar-Arab-AE",
655
+ "ar-BH",
656
+ "ar-Arab-BH",
657
+ "ar-KW",
658
+ "ar-Arab-KW",
659
+ "ar-QA",
660
+ "ar-Arab-QA",
661
+ "ar-SA",
662
+ "ar-Arab-SA"
663
+ ],
664
+ "iso8601": ["en"],
665
+ "japanese": [
666
+ "en",
667
+ "ja",
668
+ "ja-JP",
669
+ "ja-Jpan-JP"
670
+ ],
671
+ "persian": [
672
+ "en",
673
+ "fa",
674
+ "fa-AF",
675
+ "fa-Arab-AF",
676
+ "fa-IR",
677
+ "fa-Arab-IR"
678
+ ],
679
+ "roc": [
680
+ "en",
681
+ "zh",
682
+ "zh-TW",
683
+ "zh-Hant-TW"
684
+ ]
685
+ };
42
686
  // packages/intl-supportedvaluesof/get-supported-calendars.ts
43
- /**
44
- * Implementation: Tests if a calendar is supported by attempting to create
45
- * a DateTimeFormat with that calendar and verifying it was accepted.
46
- *
47
- * CLDR Data: Candidate values come from CLDR calendar types
48
- */
49
- function isSupportedCalendar(item) {
50
- try {
51
- return createMemoizedDateTimeFormat(`en-u-ca-${item}`).resolvedOptions().calendar === item;
52
- } catch {}
53
- return false;
54
- }
55
- /**
56
- * ECMA-402 Spec: Returns supported calendar identifiers
57
- * ECMA-402 Spec: Results must be sorted lexicographically
58
- *
59
- * Implementation: Filters CLDR list against actual runtime support
60
- */
61
687
  function getSupportedCalendars() {
62
- return calendars.filter(isSupportedCalendar).sort();
688
+ const probe = getDateTimeFormatProbe();
689
+ if (probe?.availableCalendars) try {
690
+ const available = probe.availableCalendars();
691
+ return supportedEntries(calendars, (calendar) => calendar === "iso8601" || arrayIndexOf(available, calendar) >= 0);
692
+ } catch {}
693
+ if (!probe?.resolve) return ["iso8601"];
694
+ const { create, resolve } = probe;
695
+ return supportedEntries(calendars, (calendar) => {
696
+ if (calendar === "iso8601") return true;
697
+ const options = {
698
+ __proto__: null,
699
+ calendar
700
+ };
701
+ return arraySome(calendarCandidateLocales[calendar], (locale) => {
702
+ try {
703
+ return resolve(create(`${locale}-u-ca-${calendar}`, options)).calendar === calendar;
704
+ } catch {
705
+ return false;
706
+ }
707
+ });
708
+ });
63
709
  }
64
710
  // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/collations.js
65
711
  const collations = [
@@ -383,20 +1029,26 @@ const collationCandidateLocales = {
383
1029
  "zhuyin": ["zh", "zh-Hant"]
384
1030
  };
385
1031
  // packages/intl-supportedvaluesof/get-supported-collations.ts
386
- function isSupportedCollation(collation) {
387
- const candidates = collationCandidateLocales[collation] || ["en"];
388
- for (const locale of candidates) try {
389
- if (new Intl.Collator(`${locale}-u-co-${collation}`).resolvedOptions().collation === collation) return true;
390
- } catch {}
391
- return false;
392
- }
393
1032
  function getSupportedCollations() {
394
- return collations.filter(isSupportedCollation).sort();
1033
+ const probe = getCollatorProbe();
1034
+ if (!probe?.resolve) return [];
1035
+ const { create, resolve } = probe;
1036
+ return supportedEntries(collations, (collation) => {
1037
+ const candidates = collationCandidateLocales[collation] || ["en"];
1038
+ for (let index = 0; index < candidates.length; index++) {
1039
+ const locale = candidates[index];
1040
+ try {
1041
+ if (resolve(create(`${locale}-u-co-${collation}`)).collation === collation) return true;
1042
+ } catch {}
1043
+ }
1044
+ return false;
1045
+ });
1046
+ }
1047
+ // packages/ecma262-abstract/HasOwnProperty.js
1048
+ const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
1049
+ function HasOwnProperty(o, prop) {
1050
+ return hasOwn(o, prop);
395
1051
  }
396
- // packages/ecma402-abstract/utils.js
397
- const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
398
- memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
399
- memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
400
1052
  // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
401
1053
  const currencies = [
402
1054
  "ADP",
@@ -465,6 +1117,7 @@ const currencies = [
465
1117
  "CLF",
466
1118
  "CLP",
467
1119
  "CNH",
1120
+ "CNX",
468
1121
  "CNY",
469
1122
  "COP",
470
1123
  "COU",
@@ -667,6 +1320,7 @@ const currencies = [
667
1320
  "VNN",
668
1321
  "VUV",
669
1322
  "WST",
1323
+ "XAD",
670
1324
  "XAF",
671
1325
  "XAG",
672
1326
  "XAU",
@@ -706,44 +1360,64 @@ const currencies = [
706
1360
  "ZWL",
707
1361
  "ZWR"
708
1362
  ];
1363
+ const currencyCandidateLocales = { "XAD": ["en", "cv"] };
709
1364
  // packages/intl-supportedvaluesof/get-supported-currencies.ts
710
- /**
711
- * Implementation: Tests if a currency is supported by attempting to create
712
- * a NumberFormat with that currency and verifying it was accepted.
713
- *
714
- * CLDR Data: Candidate values come from CLDR currency codes (ISO 4217)
715
- */
716
- function isSupportedCurrency(currency) {
717
- try {
718
- const format = createMemoizedNumberFormat("en", {
719
- style: "currency",
720
- currencyDisplay: "name",
721
- currency
722
- }).format(123);
723
- if (format.substring(0, 3) !== currency && format.substring(format.length - 3) !== currency) return true;
724
- } catch {}
725
- return false;
726
- }
727
- /**
728
- * ECMA-402 Spec: Returns supported currency identifiers
729
- * ECMA-402 Spec: Results must be sorted lexicographically
730
- *
731
- * Implementation: Filters CLDR list against actual runtime support
732
- */
1365
+ const apply = Reflect.apply;
1366
+ const createObject = Object.create;
1367
+ const stringIndexOf = String.prototype.indexOf;
1368
+ const stringSlice = String.prototype.slice;
1369
+ const english = ["en"];
733
1370
  function getSupportedCurrencies() {
1371
+ const probe = getNumberFormatProbe();
1372
+ if (!probe || !probe.formatToParts && !probe.format) return [];
1373
+ const { create, format, formatToParts } = probe;
1374
+ const namesProbe = getCurrencyDisplayNamesProbe();
1375
+ if (namesProbe && !namesProbe.hasName) return [];
1376
+ const namesByLocale = createObject(null);
734
1377
  const ATOZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
735
- const supportedCurrencies = [];
736
- for (const currency of currencies) if (currency.length === 3) {
737
- if (isSupportedCurrency(currency)) supportedCurrencies.push(currency);
738
- } else if (currency.length === 5 && currency[3] === "~") {
739
- const start = ATOZ.indexOf(currency[2]);
740
- const end = ATOZ.indexOf(currency[4]);
741
- for (let i = start; i <= end; i++) {
742
- const currentCurrency = currency.substring(0, 2) + ATOZ[i];
743
- if (isSupportedCurrency(currentCurrency)) supportedCurrencies.push(currentCurrency);
1378
+ const candidates = [];
1379
+ for (let index = 0; index < currencies.length; index++) {
1380
+ const currency = currencies[index];
1381
+ if (currency.length === 3) setDataProperty(candidates, `${candidates.length}`, currency);
1382
+ else if (currency.length === 5 && currency[3] === "~") {
1383
+ const start = apply(stringIndexOf, ATOZ, [currency[2]]);
1384
+ const end = apply(stringIndexOf, ATOZ, [currency[4]]);
1385
+ const prefix = currency[0] + currency[1];
1386
+ for (let i = start; i <= end; i++) setDataProperty(candidates, `${candidates.length}`, prefix + ATOZ[i]);
744
1387
  }
745
1388
  }
746
- return supportedCurrencies.sort();
1389
+ return supportedEntries(candidates, (currency) => {
1390
+ return arraySome(HasOwnProperty(currencyCandidateLocales, currency) ? currencyCandidateLocales[currency] : english, (locale) => {
1391
+ try {
1392
+ if (namesProbe) {
1393
+ let names = namesByLocale[locale];
1394
+ if (names === void 0) {
1395
+ namesByLocale[locale] = null;
1396
+ names = namesByLocale[locale] = namesProbe.create(locale);
1397
+ }
1398
+ if (!names || !namesProbe.hasName?.(names, currency)) return false;
1399
+ }
1400
+ const formatter = create(locale, {
1401
+ __proto__: null,
1402
+ style: "currency",
1403
+ currencyDisplay: "name",
1404
+ currency
1405
+ });
1406
+ if (formatToParts) {
1407
+ const parts = formatToParts(formatter, 123);
1408
+ for (let i = 0; i < parts.length; i++) {
1409
+ const part = parts[i];
1410
+ if (part.type === "currency" && part.value !== currency) return true;
1411
+ }
1412
+ return false;
1413
+ }
1414
+ const text = format(formatter, 123);
1415
+ return apply(stringSlice, text, [0, 3]) !== currency && apply(stringSlice, text, [-3]) !== currency;
1416
+ } catch {
1417
+ return false;
1418
+ }
1419
+ });
1420
+ });
747
1421
  }
748
1422
  // node_modules/.aspect_rules_js/@formatjs_generated+cldr.number@0.0.0/node_modules/@formatjs_generated/cldr.number/numbering-systems.js
749
1423
  const numberingSystemNames = [
@@ -845,28 +1519,183 @@ const numberingSystemNames = [
845
1519
  "wara",
846
1520
  "wcho"
847
1521
  ];
1522
+ const numericNumberingSystemNames = [
1523
+ "adlm",
1524
+ "ahom",
1525
+ "arab",
1526
+ "arabext",
1527
+ "bali",
1528
+ "beng",
1529
+ "bhks",
1530
+ "brah",
1531
+ "cakm",
1532
+ "cham",
1533
+ "deva",
1534
+ "diak",
1535
+ "fullwide",
1536
+ "gara",
1537
+ "gong",
1538
+ "gonm",
1539
+ "gujr",
1540
+ "gukh",
1541
+ "guru",
1542
+ "hanidec",
1543
+ "hmng",
1544
+ "hmnp",
1545
+ "java",
1546
+ "kali",
1547
+ "kawi",
1548
+ "khmr",
1549
+ "knda",
1550
+ "krai",
1551
+ "lana",
1552
+ "lanatham",
1553
+ "laoo",
1554
+ "latn",
1555
+ "lepc",
1556
+ "limb",
1557
+ "mathbold",
1558
+ "mathdbl",
1559
+ "mathmono",
1560
+ "mathsanb",
1561
+ "mathsans",
1562
+ "mlym",
1563
+ "modi",
1564
+ "mong",
1565
+ "mroo",
1566
+ "mtei",
1567
+ "mymr",
1568
+ "mymrepka",
1569
+ "mymrpao",
1570
+ "mymrshan",
1571
+ "mymrtlng",
1572
+ "nagm",
1573
+ "newa",
1574
+ "nkoo",
1575
+ "olck",
1576
+ "onao",
1577
+ "orya",
1578
+ "osma",
1579
+ "outlined",
1580
+ "rohg",
1581
+ "saur",
1582
+ "segment",
1583
+ "shrd",
1584
+ "sind",
1585
+ "sinh",
1586
+ "sora",
1587
+ "sund",
1588
+ "sunu",
1589
+ "takr",
1590
+ "talu",
1591
+ "tamldec",
1592
+ "telu",
1593
+ "thai",
1594
+ "tibt",
1595
+ "tirh",
1596
+ "tnsa",
1597
+ "tols",
1598
+ "vaii",
1599
+ "wara",
1600
+ "wcho"
1601
+ ];
1602
+ const numberingSystemCandidateLocales = {
1603
+ "armn": ["en", "hy"],
1604
+ "armnlow": ["en"],
1605
+ "cyrl": ["en"],
1606
+ "ethi": [
1607
+ "en",
1608
+ "am",
1609
+ "om",
1610
+ "om-KE",
1611
+ "ti",
1612
+ "ti-ER"
1613
+ ],
1614
+ "geor": ["en", "ka"],
1615
+ "grek": [
1616
+ "en",
1617
+ "el",
1618
+ "el-CY",
1619
+ "el-polyton"
1620
+ ],
1621
+ "greklow": ["en"],
1622
+ "hanidays": ["en", "zh"],
1623
+ "hans": [
1624
+ "en",
1625
+ "zh",
1626
+ "zh-Hans",
1627
+ "zh-Hans-HK",
1628
+ "zh-Hans-MO",
1629
+ "zh-Hans-MY",
1630
+ "zh-Hans-SG"
1631
+ ],
1632
+ "hansfin": [
1633
+ "en",
1634
+ "zh",
1635
+ "zh-Hans",
1636
+ "zh-Hans-HK",
1637
+ "zh-Hans-MO",
1638
+ "zh-Hans-MY",
1639
+ "zh-Hans-SG"
1640
+ ],
1641
+ "hant": [
1642
+ "en",
1643
+ "zh-Hant",
1644
+ "yue",
1645
+ "yue-Hans",
1646
+ "yue-Hant",
1647
+ "yue-Hant-CN",
1648
+ "yue-Hant-MO",
1649
+ "zh-Hant-HK",
1650
+ "zh-Hant-MO",
1651
+ "zh-Hant-MY"
1652
+ ],
1653
+ "hantfin": [
1654
+ "en",
1655
+ "zh-Hant",
1656
+ "yue",
1657
+ "yue-Hans",
1658
+ "yue-Hant",
1659
+ "yue-Hant-CN",
1660
+ "yue-Hant-MO",
1661
+ "zh-Hant-HK",
1662
+ "zh-Hant-MO",
1663
+ "zh-Hant-MY"
1664
+ ],
1665
+ "hebr": [
1666
+ "en",
1667
+ "he",
1668
+ "yi"
1669
+ ],
1670
+ "jpan": ["en", "ja"],
1671
+ "jpanfin": ["en", "ja"],
1672
+ "jpanyear": ["en", "ja"],
1673
+ "roman": ["en"],
1674
+ "romanlow": ["en"],
1675
+ "taml": [
1676
+ "en",
1677
+ "ta",
1678
+ "ta-LK",
1679
+ "ta-MY",
1680
+ "ta-SG"
1681
+ ]
1682
+ };
848
1683
  // packages/intl-supportedvaluesof/get-supported-numbering-systems.ts
849
- /**
850
- * Implementation: Tests if a numbering system is supported by attempting to create
851
- * a NumberFormat with that numbering system and verifying it was accepted.
852
- *
853
- * CLDR Data: Candidate values come from CLDR numbering system types
854
- */
855
- function isSupportedNumberingSystem(system) {
856
- try {
857
- const numberFormat = createMemoizedNumberFormat(`en-u-nu-${system}`);
858
- if (numberFormat.resolvedOptions().numberingSystem === system && system === "latn" || numberFormat.format(123) !== "123") return true;
859
- } catch {}
860
- return false;
861
- }
862
- /**
863
- * ECMA-402 Spec: Returns supported numbering system identifiers
864
- * ECMA-402 Spec: Results must be sorted lexicographically
865
- *
866
- * Implementation: Filters CLDR list against actual runtime support
867
- */
868
1684
  function getSupportedNumberingSystems() {
869
- return numberingSystemNames.filter(isSupportedNumberingSystem).sort();
1685
+ const number = getNumberFormatProbe();
1686
+ const date = getDateTimeFormatProbe();
1687
+ const relative = getRelativeTimeFormatProbe();
1688
+ return supportedEntries(numberingSystemNames, (system) => {
1689
+ if (arrayIndexOf(numericNumberingSystemNames, system) >= 0) return true;
1690
+ return arraySome(numberingSystemCandidateLocales[system], (candidate) => {
1691
+ const locale = `${candidate}-u-nu-${system}`;
1692
+ try {
1693
+ return number?.resolve?.(number.create(locale)).numberingSystem === system && date?.resolve?.(date.create(locale)).numberingSystem === system && relative?.resolve?.(relative.create(locale)).numberingSystem === system;
1694
+ } catch {
1695
+ return false;
1696
+ }
1697
+ });
1698
+ });
870
1699
  }
871
1700
  // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/timezones.js
872
1701
  const timezones = [
@@ -1321,27 +2150,25 @@ const timezones = [
1321
2150
  "UTC"
1322
2151
  ];
1323
2152
  // packages/intl-supportedvaluesof/get-supported-timezones.ts
1324
- /**
1325
- * Implementation: Tests if a timezone is supported by attempting to create
1326
- * a DateTimeFormat with that timezone and verifying it was accepted.
1327
- *
1328
- * CLDR Data: Candidate values come from IANA Time Zone Database
1329
- */
1330
- function isSupportedTimeZone(timeZone) {
1331
- try {
1332
- createMemoizedDateTimeFormat("en", { timeZone });
1333
- return true;
1334
- } catch {}
1335
- return false;
1336
- }
1337
- /**
1338
- * ECMA-402 Spec: Returns supported timezone identifiers
1339
- * ECMA-402 Spec: Results must be sorted lexicographically
1340
- *
1341
- * Implementation: Filters CLDR list against actual runtime support
1342
- */
1343
2153
  function getSupportedTimeZones() {
1344
- return timezones.filter(isSupportedTimeZone).sort();
2154
+ const probe = getDateTimeFormatProbe();
2155
+ if (!probe) return ["UTC"];
2156
+ return supportedEntries(timezones, (timeZone) => {
2157
+ if (timeZone === "UTC") return true;
2158
+ if (probe.hasTimeZone) try {
2159
+ return probe.hasTimeZone(timeZone);
2160
+ } catch {}
2161
+ try {
2162
+ const options = {
2163
+ __proto__: null,
2164
+ timeZone
2165
+ };
2166
+ probe.create("en", options);
2167
+ return true;
2168
+ } catch {
2169
+ return false;
2170
+ }
2171
+ });
1345
2172
  }
1346
2173
  // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/units.js
1347
2174
  const units = [
@@ -1392,47 +2219,22 @@ const units = [
1392
2219
  "milliliter"
1393
2220
  ];
1394
2221
  // packages/intl-supportedvaluesof/get-supported-units.ts
1395
- /**
1396
- * Implementation: Tests if a unit is supported by attempting to create
1397
- * a NumberFormat with that unit and verifying it was accepted.
1398
- *
1399
- * CLDR Data: Candidate values come from CLDR unit types
1400
- */
1401
- function isSupportedUnit(unit) {
1402
- try {
1403
- return createMemoizedNumberFormat("en", {
1404
- style: "unit",
1405
- unit
1406
- }).resolvedOptions().unit === unit;
1407
- } catch {}
1408
- return false;
1409
- }
1410
- /**
1411
- * ECMA-402 Spec: Returns supported unit identifiers
1412
- * ECMA-402 Spec: Results must be sorted lexicographically
1413
- *
1414
- * Implementation: Filters CLDR list against actual runtime support
1415
- */
1416
2222
  function getSupportedUnits() {
1417
- return units.filter(isSupportedUnit).sort();
2223
+ return supportedEntries(units, () => true);
1418
2224
  }
1419
2225
  // packages/intl-supportedvaluesof/should-polyfill.ts
1420
2226
  function shouldPolyfill() {
1421
- return typeof Intl === "undefined" || !("supportedValuesOf" in Intl);
2227
+ return typeof Intl === "undefined" || typeof Intl.supportedValuesOf !== "function";
1422
2228
  }
1423
2229
  // packages/intl-supportedvaluesof/index.ts
1424
2230
  /**
1425
- * ECMA-402 Spec: Intl.supportedValuesOf(key)
1426
- * ECMA-402 §8.3.2 Intl.supportedValuesOf, step 1.
2231
+ * ECMA-402 §8.3.2 Intl.supportedValuesOf.
1427
2232
  * https://tc39.es/ecma402/#sec-intl.supportedvaluesof
1428
- * https://github.com/tc39/ecma402/blob/b1c961988b9a07894b1dc3dc2b5626ea48387d61/spec/intl.html#L103
1429
2233
  *
1430
2234
  * Returns an array containing the supported calendar, collation, currency,
1431
2235
  * numbering systems, time zone, or unit values supported by the implementation.
1432
2236
  *
1433
- * Implementation: We validate candidate values from CLDR against the actual
1434
- * Intl formatters to determine runtime support rather than using static lists.
1435
- * This ensures accuracy across different JavaScript engines and runtimes.
2237
+ * Units come from the spec. Other categories probe the installed formatters.
1436
2238
  *
1437
2239
  * @param key - The category of values to return
1438
2240
  * @returns A sorted array of unique string values
@@ -1446,7 +2248,7 @@ const supportedValuesOf = { supportedValuesOf(key) {
1446
2248
  case "numberingSystem": return getSupportedNumberingSystems();
1447
2249
  case "timeZone": return getSupportedTimeZones();
1448
2250
  case "unit": return getSupportedUnits();
1449
- default: throw RangeError("Invalid key: " + key);
2251
+ default: throw new RangeErrorConstructor("Invalid key: " + key);
1450
2252
  }
1451
2253
  } }.supportedValuesOf;
1452
2254
  export { shouldPolyfill, supportedValuesOf };