@clerk/shared 4.43.1 → 4.43.2-canary.v20261030213133

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.
Files changed (97) hide show
  1. package/dist/alternativePhoneCode.js +1 -2
  2. package/dist/apiUrlFromPublishableKey.js +1 -2
  3. package/dist/authorization-errors.js +1 -2
  4. package/dist/authorization.js +1 -2
  5. package/dist/browser.js +1 -2
  6. package/dist/buildAccountsBaseUrl.js +1 -2
  7. package/dist/clerkEventBus.js +1 -2
  8. package/dist/color.js +1 -2
  9. package/dist/constants.js +1 -2
  10. package/dist/cookie.js +3 -4
  11. package/dist/date.js +1 -2
  12. package/dist/deprecated.js +2 -3
  13. package/dist/deriveState.js +1 -2
  14. package/dist/devBrowser.js +1 -2
  15. package/dist/dom/waitForElement.js +1 -2
  16. package/dist/error.js +42 -32
  17. package/dist/eventBus.js +1 -2
  18. package/dist/file.js +1 -2
  19. package/dist/getEnvVariable.js +1 -2
  20. package/dist/getToken.js +2 -3
  21. package/dist/globs.js +3 -4
  22. package/dist/handleValueOrFn.js +2 -3
  23. package/dist/htmlSafeJson.js +1 -2
  24. package/dist/index.js +1 -2
  25. package/dist/inert.js +1 -2
  26. package/dist/internal/clerk-js/completeSignUpFlow.js +1 -2
  27. package/dist/internal/clerk-js/componentGuards.js +1 -2
  28. package/dist/internal/clerk-js/constants.js +1 -2
  29. package/dist/internal/clerk-js/email.js +1 -2
  30. package/dist/internal/clerk-js/encoders.js +1 -2
  31. package/dist/internal/clerk-js/enterpriseSSOFactors.js +1 -2
  32. package/dist/internal/clerk-js/errors.js +1 -2
  33. package/dist/internal/clerk-js/hex.js +1 -2
  34. package/dist/internal/clerk-js/injectedWeb3EthProviders.js +1 -2
  35. package/dist/internal/clerk-js/injectedWeb3SolanaProviders.js +2 -3
  36. package/dist/internal/clerk-js/navigateToNextStepSignUp.js +1 -2
  37. package/dist/internal/clerk-js/organization.js +1 -2
  38. package/dist/internal/clerk-js/passkeys.js +10 -10
  39. package/dist/internal/clerk-js/passwords/complexity.js +1 -2
  40. package/dist/internal/clerk-js/passwords/loadZxcvbn.js +1 -2
  41. package/dist/internal/clerk-js/passwords/password.js +2 -3
  42. package/dist/internal/clerk-js/passwords/strength.js +1 -2
  43. package/dist/internal/clerk-js/path.js +1 -2
  44. package/dist/internal/clerk-js/protectCheck.js +3 -4
  45. package/dist/internal/clerk-js/protectCheckRunner.js +5 -5
  46. package/dist/internal/clerk-js/queryParams.js +1 -2
  47. package/dist/internal/clerk-js/queryStateParams.js +1 -2
  48. package/dist/internal/clerk-js/querystring.js +1 -2
  49. package/dist/internal/clerk-js/redirectUrls.js +1 -2
  50. package/dist/internal/clerk-js/runtime.js +1 -2
  51. package/dist/internal/clerk-js/sessionTasks.js +1 -2
  52. package/dist/internal/clerk-js/thirdPartyDomains.js +1 -2
  53. package/dist/internal/clerk-js/url.js +1 -2
  54. package/dist/internal/clerk-js/user.js +1 -2
  55. package/dist/internal/clerk-js/warnings.js +1 -2
  56. package/dist/internal/clerk-js/web3.js +5 -5
  57. package/dist/internal/clerk-js/windowNavigate.js +1 -2
  58. package/dist/isomorphicAtob.js +1 -2
  59. package/dist/isomorphicBtoa.js +1 -2
  60. package/dist/jwtPayloadParser.js +1 -2
  61. package/dist/keyless/index.js +12 -369
  62. package/dist/keys.js +2 -3
  63. package/dist/loadClerkJsScript.js +6 -6
  64. package/dist/loadClerkJsScript.js.map +1 -1
  65. package/dist/loadClerkJsScript.mjs +1 -1
  66. package/dist/loadClerkJsScript.mjs.map +1 -1
  67. package/dist/loadScript.js +1 -2
  68. package/dist/localStorageBroadcastChannel.js +1 -2
  69. package/dist/logger.js +1 -2
  70. package/dist/netlifyCacheHandler.js +1 -2
  71. package/dist/oauth.js +1 -2
  72. package/dist/object.js +1 -2
  73. package/dist/organization.js +1 -2
  74. package/dist/patchRequest.js +1 -2
  75. package/dist/pathMatcher.js +2 -3
  76. package/dist/pathToRegexp.js +23 -3
  77. package/dist/phone/index.js +14 -1649
  78. package/dist/poller.js +3 -4
  79. package/dist/proxy.js +1 -2
  80. package/dist/react/index.js +111 -4379
  81. package/dist/retry.js +1 -2
  82. package/dist/router.js +9 -150
  83. package/dist/safeImport.js +1 -2
  84. package/dist/saml.js +1 -2
  85. package/dist/telemetry.js +16 -11
  86. package/dist/underscore.js +1 -2
  87. package/dist/url.js +2 -3
  88. package/dist/utils/index.js +16 -12
  89. package/dist/versionCheck.js +1 -2
  90. package/dist/versionSelector.js +2 -3
  91. package/dist/versionSelector.js.map +1 -1
  92. package/dist/versionSelector.mjs +1 -1
  93. package/dist/versionSelector.mjs.map +1 -1
  94. package/dist/web3.js +1 -2
  95. package/dist/webauthn.js +1 -2
  96. package/dist/workerTimers/index.js +2 -2
  97. package/package.json +1 -1
@@ -1,1651 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_countryCodeData = require('./countryCodeData.js');
3
+ const require_phoneUtils = require('./phoneUtils.js');
2
4
 
3
- //#region src/phone/countryCodeData.ts
4
- const data = [
5
- [
6
- "United States",
7
- "us",
8
- "1",
9
- "(...) ...-....",
10
- 100
11
- ],
12
- [
13
- "United Kingdom",
14
- "gb",
15
- "44",
16
- ".... ......",
17
- 100
18
- ],
19
- [
20
- "India",
21
- "in",
22
- "91",
23
- ".....-.....",
24
- 100
25
- ],
26
- [
27
- "Canada",
28
- "ca",
29
- "1",
30
- "(...) ...-....",
31
- 100
32
- ],
33
- [
34
- "Germany",
35
- "de",
36
- "49",
37
- "... .......",
38
- 100
39
- ],
40
- [
41
- "France",
42
- "fr",
43
- "33",
44
- ". .. .. .. ..",
45
- 100
46
- ],
47
- [
48
- "Russia",
49
- "ru",
50
- "7",
51
- "... ...-..-..",
52
- 100
53
- ],
54
- [
55
- "Afghanistan",
56
- "af",
57
- "93"
58
- ],
59
- [
60
- "Åland Islands",
61
- "ax",
62
- "358"
63
- ],
64
- [
65
- "Albania",
66
- "al",
67
- "355"
68
- ],
69
- [
70
- "Algeria",
71
- "dz",
72
- "213"
73
- ],
74
- [
75
- "American Samoa",
76
- "as",
77
- "1684"
78
- ],
79
- [
80
- "Andorra",
81
- "ad",
82
- "376"
83
- ],
84
- [
85
- "Angola",
86
- "ao",
87
- "244"
88
- ],
89
- [
90
- "Anguilla",
91
- "ai",
92
- "1264"
93
- ],
94
- [
95
- "Antigua and Barbuda",
96
- "ag",
97
- "1268"
98
- ],
99
- [
100
- "Argentina",
101
- "ar",
102
- "54"
103
- ],
104
- [
105
- "Armenia",
106
- "am",
107
- "374"
108
- ],
109
- [
110
- "Aruba",
111
- "aw",
112
- "297"
113
- ],
114
- [
115
- "Ascension Island",
116
- "ac",
117
- "247"
118
- ],
119
- [
120
- "Australia",
121
- "au",
122
- "61",
123
- "... ... ..."
124
- ],
125
- [
126
- "Austria",
127
- "at",
128
- "43"
129
- ],
130
- [
131
- "Azerbaijan",
132
- "az",
133
- "994"
134
- ],
135
- [
136
- "Bahamas",
137
- "bs",
138
- "1242"
139
- ],
140
- [
141
- "Bahrain",
142
- "bh",
143
- "973"
144
- ],
145
- [
146
- "Bangladesh",
147
- "bd",
148
- "880"
149
- ],
150
- [
151
- "Barbados",
152
- "bb",
153
- "1246"
154
- ],
155
- [
156
- "Belarus",
157
- "by",
158
- "375"
159
- ],
160
- [
161
- "Belgium",
162
- "be",
163
- "32",
164
- "... .. .. .."
165
- ],
166
- [
167
- "Belize",
168
- "bz",
169
- "501"
170
- ],
171
- [
172
- "Benin",
173
- "bj",
174
- "229"
175
- ],
176
- [
177
- "Bermuda",
178
- "bm",
179
- "1441"
180
- ],
181
- [
182
- "Bhutan",
183
- "bt",
184
- "975"
185
- ],
186
- [
187
- "Bolivia",
188
- "bo",
189
- "591"
190
- ],
191
- [
192
- "Bosnia and Herzegovina",
193
- "ba",
194
- "387"
195
- ],
196
- [
197
- "Botswana",
198
- "bw",
199
- "267"
200
- ],
201
- [
202
- "Brazil",
203
- "br",
204
- "55"
205
- ],
206
- [
207
- "British Indian Ocean Territory",
208
- "io",
209
- "246"
210
- ],
211
- [
212
- "British Virgin Islands",
213
- "vg",
214
- "1284"
215
- ],
216
- [
217
- "Brunei",
218
- "bn",
219
- "673"
220
- ],
221
- [
222
- "Bulgaria",
223
- "bg",
224
- "359"
225
- ],
226
- [
227
- "Burkina Faso",
228
- "bf",
229
- "226"
230
- ],
231
- [
232
- "Burundi",
233
- "bi",
234
- "257"
235
- ],
236
- [
237
- "Cambodia",
238
- "kh",
239
- "855"
240
- ],
241
- [
242
- "Cameroon",
243
- "cm",
244
- "237"
245
- ],
246
- [
247
- "Cape Verde",
248
- "cv",
249
- "238"
250
- ],
251
- [
252
- "Caribbean Netherlands",
253
- "bq",
254
- "599"
255
- ],
256
- [
257
- "Cayman Islands",
258
- "ky",
259
- "1345"
260
- ],
261
- [
262
- "Central African Republic",
263
- "cf",
264
- "236"
265
- ],
266
- [
267
- "Chad",
268
- "td",
269
- "235"
270
- ],
271
- [
272
- "Chile",
273
- "cl",
274
- "56"
275
- ],
276
- [
277
- "China",
278
- "cn",
279
- "86",
280
- "...-....-...."
281
- ],
282
- [
283
- "Colombia",
284
- "co",
285
- "57"
286
- ],
287
- [
288
- "Comoros",
289
- "km",
290
- "269"
291
- ],
292
- [
293
- "Democratic Republic of the Congo",
294
- "cd",
295
- "243"
296
- ],
297
- [
298
- "Republic of the Congo",
299
- "cg",
300
- "242"
301
- ],
302
- [
303
- "Cook Islands",
304
- "ck",
305
- "682"
306
- ],
307
- [
308
- "Costa Rica",
309
- "cr",
310
- "506",
311
- "....-...."
312
- ],
313
- [
314
- "Côte d’Ivoire",
315
- "ci",
316
- "225"
317
- ],
318
- [
319
- "Croatia",
320
- "hr",
321
- "385"
322
- ],
323
- [
324
- "Cuba",
325
- "cu",
326
- "53"
327
- ],
328
- [
329
- "Curaçao",
330
- "cw",
331
- "599"
332
- ],
333
- [
334
- "Cyprus",
335
- "cy",
336
- "357"
337
- ],
338
- [
339
- "Czech Republic",
340
- "cz",
341
- "420"
342
- ],
343
- [
344
- "Denmark",
345
- "dk",
346
- "45",
347
- ".. .. .. .."
348
- ],
349
- [
350
- "Djibouti",
351
- "dj",
352
- "253"
353
- ],
354
- [
355
- "Dominica",
356
- "dm",
357
- "1767"
358
- ],
359
- [
360
- "Dominican Republic",
361
- "do",
362
- "1"
363
- ],
364
- [
365
- "Ecuador",
366
- "ec",
367
- "593"
368
- ],
369
- [
370
- "Egypt",
371
- "eg",
372
- "20"
373
- ],
374
- [
375
- "El Salvador",
376
- "sv",
377
- "503",
378
- "....-...."
379
- ],
380
- [
381
- "Equatorial Guinea",
382
- "gq",
383
- "240"
384
- ],
385
- [
386
- "Eritrea",
387
- "er",
388
- "291"
389
- ],
390
- [
391
- "Estonia",
392
- "ee",
393
- "372"
394
- ],
395
- [
396
- "Ethiopia",
397
- "et",
398
- "251"
399
- ],
400
- [
401
- "Falkland Islands",
402
- "fk",
403
- "500"
404
- ],
405
- [
406
- "Faroe Islands",
407
- "fo",
408
- "298"
409
- ],
410
- [
411
- "Fiji",
412
- "fj",
413
- "679"
414
- ],
415
- [
416
- "Finland",
417
- "fi",
418
- "358",
419
- ".. ... .. .."
420
- ],
421
- [
422
- "French Guiana",
423
- "gf",
424
- "594"
425
- ],
426
- [
427
- "French Polynesia",
428
- "pf",
429
- "689"
430
- ],
431
- [
432
- "Gabon",
433
- "ga",
434
- "241"
435
- ],
436
- [
437
- "Gambia",
438
- "gm",
439
- "220"
440
- ],
441
- [
442
- "Georgia",
443
- "ge",
444
- "995"
445
- ],
446
- [
447
- "Ghana",
448
- "gh",
449
- "233"
450
- ],
451
- [
452
- "Gibraltar",
453
- "gi",
454
- "350"
455
- ],
456
- [
457
- "Greece",
458
- "gr",
459
- "30",
460
- "... ......."
461
- ],
462
- [
463
- "Greenland",
464
- "gl",
465
- "299"
466
- ],
467
- [
468
- "Grenada",
469
- "gd",
470
- "1473"
471
- ],
472
- [
473
- "Guadeloupe",
474
- "gp",
475
- "590"
476
- ],
477
- [
478
- "Guam",
479
- "gu",
480
- "1671"
481
- ],
482
- [
483
- "Guatemala",
484
- "gt",
485
- "502",
486
- "....-...."
487
- ],
488
- [
489
- "Guinea",
490
- "gn",
491
- "224"
492
- ],
493
- [
494
- "Guinea-Bissau",
495
- "gw",
496
- "245"
497
- ],
498
- [
499
- "Guyana",
500
- "gy",
501
- "592"
502
- ],
503
- [
504
- "Haiti",
505
- "ht",
506
- "509",
507
- "....-...."
508
- ],
509
- [
510
- "Honduras",
511
- "hn",
512
- "504"
513
- ],
514
- [
515
- "Hong Kong",
516
- "hk",
517
- "852",
518
- ".... ...."
519
- ],
520
- [
521
- "Hungary",
522
- "hu",
523
- "36"
524
- ],
525
- [
526
- "Iceland",
527
- "is",
528
- "354",
529
- "... ...."
530
- ],
531
- [
532
- "Indonesia",
533
- "id",
534
- "62"
535
- ],
536
- [
537
- "Iran",
538
- "ir",
539
- "98"
540
- ],
541
- [
542
- "Iraq",
543
- "iq",
544
- "964"
545
- ],
546
- [
547
- "Ireland",
548
- "ie",
549
- "353",
550
- ".. ......."
551
- ],
552
- [
553
- "Israel",
554
- "il",
555
- "972"
556
- ],
557
- [
558
- "Italy",
559
- "it",
560
- "39",
561
- "... ......"
562
- ],
563
- [
564
- "Jamaica",
565
- "jm",
566
- "1876"
567
- ],
568
- [
569
- "Japan",
570
- "jp",
571
- "81",
572
- "... .. ...."
573
- ],
574
- [
575
- "Jordan",
576
- "jo",
577
- "962"
578
- ],
579
- [
580
- "Kazakhstan",
581
- "kz",
582
- "7",
583
- "... ...-..-.."
584
- ],
585
- [
586
- "Kenya",
587
- "ke",
588
- "254"
589
- ],
590
- [
591
- "Kiribati",
592
- "ki",
593
- "686"
594
- ],
595
- [
596
- "Kosovo",
597
- "xk",
598
- "383"
599
- ],
600
- [
601
- "Kuwait",
602
- "kw",
603
- "965"
604
- ],
605
- [
606
- "Kyrgyzstan",
607
- "kg",
608
- "996"
609
- ],
610
- [
611
- "Laos",
612
- "la",
613
- "856"
614
- ],
615
- [
616
- "Latvia",
617
- "lv",
618
- "371"
619
- ],
620
- [
621
- "Lebanon",
622
- "lb",
623
- "961"
624
- ],
625
- [
626
- "Lesotho",
627
- "ls",
628
- "266"
629
- ],
630
- [
631
- "Liberia",
632
- "lr",
633
- "231"
634
- ],
635
- [
636
- "Libya",
637
- "ly",
638
- "218"
639
- ],
640
- [
641
- "Liechtenstein",
642
- "li",
643
- "423"
644
- ],
645
- [
646
- "Lithuania",
647
- "lt",
648
- "370"
649
- ],
650
- [
651
- "Luxembourg",
652
- "lu",
653
- "352"
654
- ],
655
- [
656
- "Macau",
657
- "mo",
658
- "853"
659
- ],
660
- [
661
- "Madagascar",
662
- "mg",
663
- "261"
664
- ],
665
- [
666
- "Malawi",
667
- "mw",
668
- "265"
669
- ],
670
- [
671
- "Malaysia",
672
- "my",
673
- "60",
674
- "..-....-...."
675
- ],
676
- [
677
- "Maldives",
678
- "mv",
679
- "960"
680
- ],
681
- [
682
- "Mali",
683
- "ml",
684
- "223"
685
- ],
686
- [
687
- "Malta",
688
- "mt",
689
- "356"
690
- ],
691
- [
692
- "Marshall Islands",
693
- "mh",
694
- "692"
695
- ],
696
- [
697
- "Martinique",
698
- "mq",
699
- "596"
700
- ],
701
- [
702
- "Mauritania",
703
- "mr",
704
- "222"
705
- ],
706
- [
707
- "Mauritius",
708
- "mu",
709
- "230"
710
- ],
711
- [
712
- "Mayotte",
713
- "yt",
714
- "262"
715
- ],
716
- [
717
- "Mexico",
718
- "mx",
719
- "52"
720
- ],
721
- [
722
- "Micronesia",
723
- "fm",
724
- "691"
725
- ],
726
- [
727
- "Moldova",
728
- "md",
729
- "373"
730
- ],
731
- [
732
- "Monaco",
733
- "mc",
734
- "377"
735
- ],
736
- [
737
- "Mongolia",
738
- "mn",
739
- "976"
740
- ],
741
- [
742
- "Montenegro",
743
- "me",
744
- "382"
745
- ],
746
- [
747
- "Montserrat",
748
- "ms",
749
- "1664"
750
- ],
751
- [
752
- "Morocco",
753
- "ma",
754
- "212"
755
- ],
756
- [
757
- "Mozambique",
758
- "mz",
759
- "258"
760
- ],
761
- [
762
- "Myanmar",
763
- "mm",
764
- "95"
765
- ],
766
- [
767
- "Namibia",
768
- "na",
769
- "264"
770
- ],
771
- [
772
- "Nauru",
773
- "nr",
774
- "674"
775
- ],
776
- [
777
- "Nepal",
778
- "np",
779
- "977"
780
- ],
781
- [
782
- "Netherlands",
783
- "nl",
784
- "31",
785
- ".. ........"
786
- ],
787
- [
788
- "New Caledonia",
789
- "nc",
790
- "687"
791
- ],
792
- [
793
- "New Zealand",
794
- "nz",
795
- "64",
796
- "...-...-...."
797
- ],
798
- [
799
- "Nicaragua",
800
- "ni",
801
- "505"
802
- ],
803
- [
804
- "Niger",
805
- "ne",
806
- "227"
807
- ],
808
- [
809
- "Nigeria",
810
- "ng",
811
- "234"
812
- ],
813
- [
814
- "Niue",
815
- "nu",
816
- "683"
817
- ],
818
- [
819
- "Norfolk Island",
820
- "nf",
821
- "672"
822
- ],
823
- [
824
- "North Korea",
825
- "kp",
826
- "850"
827
- ],
828
- [
829
- "North Macedonia",
830
- "mk",
831
- "389"
832
- ],
833
- [
834
- "Northern Mariana Islands",
835
- "mp",
836
- "1670"
837
- ],
838
- [
839
- "Norway",
840
- "no",
841
- "47",
842
- "... .. ..."
843
- ],
844
- [
845
- "Oman",
846
- "om",
847
- "968"
848
- ],
849
- [
850
- "Pakistan",
851
- "pk",
852
- "92",
853
- "...-......."
854
- ],
855
- [
856
- "Palau",
857
- "pw",
858
- "680"
859
- ],
860
- [
861
- "Palestine",
862
- "ps",
863
- "970"
864
- ],
865
- [
866
- "Panama",
867
- "pa",
868
- "507"
869
- ],
870
- [
871
- "Papua New Guinea",
872
- "pg",
873
- "675"
874
- ],
875
- [
876
- "Paraguay",
877
- "py",
878
- "595"
879
- ],
880
- [
881
- "Peru",
882
- "pe",
883
- "51"
884
- ],
885
- [
886
- "Philippines",
887
- "ph",
888
- "63",
889
- "... ...."
890
- ],
891
- [
892
- "Poland",
893
- "pl",
894
- "48",
895
- "...-...-..."
896
- ],
897
- [
898
- "Portugal",
899
- "pt",
900
- "351"
901
- ],
902
- [
903
- "Puerto Rico",
904
- "pr",
905
- "1"
906
- ],
907
- [
908
- "Qatar",
909
- "qa",
910
- "974"
911
- ],
912
- [
913
- "Réunion",
914
- "re",
915
- "262"
916
- ],
917
- [
918
- "Romania",
919
- "ro",
920
- "40"
921
- ],
922
- [
923
- "Rwanda",
924
- "rw",
925
- "250"
926
- ],
927
- [
928
- "Saint Barthélemy",
929
- "bl",
930
- "590"
931
- ],
932
- [
933
- "Saint Helena",
934
- "sh",
935
- "290"
936
- ],
937
- [
938
- "Saint Kitts and Nevis",
939
- "kn",
940
- "1869"
941
- ],
942
- [
943
- "Saint Lucia",
944
- "lc",
945
- "1758"
946
- ],
947
- [
948
- "Saint Martin",
949
- "mf",
950
- "590"
951
- ],
952
- [
953
- "Saint Pierre and Miquelon",
954
- "pm",
955
- "508"
956
- ],
957
- [
958
- "Saint Vincent and the Grenadines",
959
- "vc",
960
- "1784"
961
- ],
962
- [
963
- "Samoa",
964
- "ws",
965
- "685"
966
- ],
967
- [
968
- "San Marino",
969
- "sm",
970
- "378"
971
- ],
972
- [
973
- "São Tomé and Príncipe",
974
- "st",
975
- "239"
976
- ],
977
- [
978
- "Saudi Arabia",
979
- "sa",
980
- "966"
981
- ],
982
- [
983
- "Senegal",
984
- "sn",
985
- "221"
986
- ],
987
- [
988
- "Serbia",
989
- "rs",
990
- "381"
991
- ],
992
- [
993
- "Seychelles",
994
- "sc",
995
- "248"
996
- ],
997
- [
998
- "Sierra Leone",
999
- "sl",
1000
- "232"
1001
- ],
1002
- [
1003
- "Singapore",
1004
- "sg",
1005
- "65",
1006
- "....-...."
1007
- ],
1008
- [
1009
- "Sint Maarten",
1010
- "sx",
1011
- "1721"
1012
- ],
1013
- [
1014
- "Slovakia",
1015
- "sk",
1016
- "421"
1017
- ],
1018
- [
1019
- "Slovenia",
1020
- "si",
1021
- "386"
1022
- ],
1023
- [
1024
- "Solomon Islands",
1025
- "sb",
1026
- "677"
1027
- ],
1028
- [
1029
- "Somalia",
1030
- "so",
1031
- "252"
1032
- ],
1033
- [
1034
- "South Africa",
1035
- "za",
1036
- "27"
1037
- ],
1038
- [
1039
- "South Korea",
1040
- "kr",
1041
- "82"
1042
- ],
1043
- [
1044
- "South Sudan",
1045
- "ss",
1046
- "211"
1047
- ],
1048
- [
1049
- "Spain",
1050
- "es",
1051
- "34",
1052
- "... ... ..."
1053
- ],
1054
- [
1055
- "Sri Lanka",
1056
- "lk",
1057
- "94"
1058
- ],
1059
- [
1060
- "Sudan",
1061
- "sd",
1062
- "249"
1063
- ],
1064
- [
1065
- "Suriname",
1066
- "sr",
1067
- "597"
1068
- ],
1069
- [
1070
- "Eswatini",
1071
- "sz",
1072
- "268"
1073
- ],
1074
- [
1075
- "Sweden",
1076
- "se",
1077
- "46",
1078
- ".. ... .. .."
1079
- ],
1080
- [
1081
- "Switzerland",
1082
- "ch",
1083
- "41",
1084
- ".. ... .. .."
1085
- ],
1086
- [
1087
- "Syria",
1088
- "sy",
1089
- "963"
1090
- ],
1091
- [
1092
- "Taiwan",
1093
- "tw",
1094
- "886"
1095
- ],
1096
- [
1097
- "Tajikistan",
1098
- "tj",
1099
- "992"
1100
- ],
1101
- [
1102
- "Tanzania",
1103
- "tz",
1104
- "255"
1105
- ],
1106
- [
1107
- "Thailand",
1108
- "th",
1109
- "66"
1110
- ],
1111
- [
1112
- "Timor-Leste",
1113
- "tl",
1114
- "670"
1115
- ],
1116
- [
1117
- "Togo",
1118
- "tg",
1119
- "228"
1120
- ],
1121
- [
1122
- "Tokelau",
1123
- "tk",
1124
- "690"
1125
- ],
1126
- [
1127
- "Tonga",
1128
- "to",
1129
- "676"
1130
- ],
1131
- [
1132
- "Trinidad and Tobago",
1133
- "tt",
1134
- "1868"
1135
- ],
1136
- [
1137
- "Tunisia",
1138
- "tn",
1139
- "216"
1140
- ],
1141
- [
1142
- "Turkey",
1143
- "tr",
1144
- "90",
1145
- "... ... .. .."
1146
- ],
1147
- [
1148
- "Turkmenistan",
1149
- "tm",
1150
- "993"
1151
- ],
1152
- [
1153
- "Turks and Caicos Islands",
1154
- "tc",
1155
- "1649"
1156
- ],
1157
- [
1158
- "Tuvalu",
1159
- "tv",
1160
- "688"
1161
- ],
1162
- [
1163
- "U.S. Virgin Islands",
1164
- "vi",
1165
- "1340"
1166
- ],
1167
- [
1168
- "Uganda",
1169
- "ug",
1170
- "256"
1171
- ],
1172
- [
1173
- "Ukraine",
1174
- "ua",
1175
- "380"
1176
- ],
1177
- [
1178
- "United Arab Emirates",
1179
- "ae",
1180
- "971"
1181
- ],
1182
- [
1183
- "Uruguay",
1184
- "uy",
1185
- "598"
1186
- ],
1187
- [
1188
- "Uzbekistan",
1189
- "uz",
1190
- "998"
1191
- ],
1192
- [
1193
- "Vanuatu",
1194
- "vu",
1195
- "678"
1196
- ],
1197
- [
1198
- "Vatican City",
1199
- "va",
1200
- "39",
1201
- ".. .... ...."
1202
- ],
1203
- [
1204
- "Venezuela",
1205
- "ve",
1206
- "58"
1207
- ],
1208
- [
1209
- "Vietnam",
1210
- "vn",
1211
- "84"
1212
- ],
1213
- [
1214
- "Wallis and Futuna",
1215
- "wf",
1216
- "681"
1217
- ],
1218
- [
1219
- "Western Sahara",
1220
- "eh",
1221
- "212"
1222
- ],
1223
- [
1224
- "Yemen",
1225
- "ye",
1226
- "967"
1227
- ],
1228
- [
1229
- "Zambia",
1230
- "zm",
1231
- "260"
1232
- ],
1233
- [
1234
- "Zimbabwe",
1235
- "zw",
1236
- "263"
1237
- ]
1238
- ];
1239
- const UnitedStatesSubAreasSet = new Set([
1240
- "907",
1241
- "205",
1242
- "251",
1243
- "256",
1244
- "334",
1245
- "479",
1246
- "501",
1247
- "870",
1248
- "480",
1249
- "520",
1250
- "602",
1251
- "623",
1252
- "928",
1253
- "209",
1254
- "213",
1255
- "310",
1256
- "323",
1257
- "408",
1258
- "415",
1259
- "510",
1260
- "530",
1261
- "559",
1262
- "562",
1263
- "619",
1264
- "626",
1265
- "650",
1266
- "661",
1267
- "707",
1268
- "714",
1269
- "760",
1270
- "805",
1271
- "818",
1272
- "831",
1273
- "858",
1274
- "909",
1275
- "916",
1276
- "925",
1277
- "949",
1278
- "951",
1279
- "303",
1280
- "719",
1281
- "970",
1282
- "203",
1283
- "860",
1284
- "202",
1285
- "302",
1286
- "239",
1287
- "305",
1288
- "321",
1289
- "352",
1290
- "386",
1291
- "407",
1292
- "561",
1293
- "727",
1294
- "772",
1295
- "813",
1296
- "850",
1297
- "863",
1298
- "904",
1299
- "941",
1300
- "954",
1301
- "229",
1302
- "404",
1303
- "478",
1304
- "706",
1305
- "770",
1306
- "912",
1307
- "808",
1308
- "319",
1309
- "515",
1310
- "563",
1311
- "641",
1312
- "712",
1313
- "208",
1314
- "217",
1315
- "309",
1316
- "312",
1317
- "618",
1318
- "630",
1319
- "708",
1320
- "773",
1321
- "815",
1322
- "847",
1323
- "219",
1324
- "260",
1325
- "317",
1326
- "574",
1327
- "765",
1328
- "812",
1329
- "316",
1330
- "620",
1331
- "785",
1332
- "913",
1333
- "270",
1334
- "502",
1335
- "606",
1336
- "859",
1337
- "225",
1338
- "318",
1339
- "337",
1340
- "504",
1341
- "985",
1342
- "413",
1343
- "508",
1344
- "617",
1345
- "781",
1346
- "978",
1347
- "301",
1348
- "410",
1349
- "207",
1350
- "231",
1351
- "248",
1352
- "269",
1353
- "313",
1354
- "517",
1355
- "586",
1356
- "616",
1357
- "734",
1358
- "810",
1359
- "906",
1360
- "989",
1361
- "218",
1362
- "320",
1363
- "507",
1364
- "612",
1365
- "651",
1366
- "763",
1367
- "952",
1368
- "314",
1369
- "417",
1370
- "573",
1371
- "636",
1372
- "660",
1373
- "816",
1374
- "228",
1375
- "601",
1376
- "662",
1377
- "406",
1378
- "252",
1379
- "336",
1380
- "704",
1381
- "828",
1382
- "910",
1383
- "919",
1384
- "701",
1385
- "308",
1386
- "402",
1387
- "603",
1388
- "201",
1389
- "609",
1390
- "732",
1391
- "856",
1392
- "908",
1393
- "973",
1394
- "505",
1395
- "575",
1396
- "702",
1397
- "775",
1398
- "212",
1399
- "315",
1400
- "516",
1401
- "518",
1402
- "585",
1403
- "607",
1404
- "631",
1405
- "716",
1406
- "718",
1407
- "845",
1408
- "914",
1409
- "216",
1410
- "330",
1411
- "419",
1412
- "440",
1413
- "513",
1414
- "614",
1415
- "740",
1416
- "937",
1417
- "405",
1418
- "580",
1419
- "918",
1420
- "503",
1421
- "541",
1422
- "215",
1423
- "412",
1424
- "570",
1425
- "610",
1426
- "717",
1427
- "724",
1428
- "814",
1429
- "401",
1430
- "803",
1431
- "843",
1432
- "864",
1433
- "605",
1434
- "423",
1435
- "615",
1436
- "731",
1437
- "865",
1438
- "901",
1439
- "931",
1440
- "210",
1441
- "214",
1442
- "254",
1443
- "281",
1444
- "325",
1445
- "361",
1446
- "409",
1447
- "432",
1448
- "512",
1449
- "713",
1450
- "806",
1451
- "817",
1452
- "830",
1453
- "903",
1454
- "915",
1455
- "936",
1456
- "940",
1457
- "956",
1458
- "972",
1459
- "979",
1460
- "435",
1461
- "801",
1462
- "276",
1463
- "434",
1464
- "540",
1465
- "703",
1466
- "757",
1467
- "804",
1468
- "802",
1469
- "206",
1470
- "253",
1471
- "360",
1472
- "425",
1473
- "509",
1474
- "262",
1475
- "414",
1476
- "608",
1477
- "715",
1478
- "920",
1479
- "304",
1480
- "307"
1481
- ]);
1482
- const CanadaSubAreaSet = new Set([
1483
- "204",
1484
- "226",
1485
- "236",
1486
- "249",
1487
- "250",
1488
- "289",
1489
- "306",
1490
- "343",
1491
- "365",
1492
- "387",
1493
- "403",
1494
- "416",
1495
- "418",
1496
- "431",
1497
- "437",
1498
- "438",
1499
- "450",
1500
- "506",
1501
- "514",
1502
- "519",
1503
- "548",
1504
- "579",
1505
- "581",
1506
- "587",
1507
- "604",
1508
- "613",
1509
- "639",
1510
- "647",
1511
- "672",
1512
- "705",
1513
- "709",
1514
- "742",
1515
- "778",
1516
- "780",
1517
- "782",
1518
- "807",
1519
- "819",
1520
- "825",
1521
- "867",
1522
- "873",
1523
- "902",
1524
- "905"
1525
- ]);
1526
- const SubAreaCodeSets = {
1527
- us: UnitedStatesSubAreasSet,
1528
- ca: CanadaSubAreaSet
1529
- };
1530
- const createEntry = ([name, iso, code, pattern = "", priority = 0]) => ({
1531
- name,
1532
- iso,
1533
- code,
1534
- pattern,
1535
- priority
1536
- });
1537
- const IsoToCountryMap = data.reduce((acc, cur) => acc.set(cur[1], createEntry(cur)), /* @__PURE__ */ new Map());
1538
- const CodeToCountriesMap = data.reduce((acc, cur) => {
1539
- const code = cur[2];
1540
- const country = createEntry(cur);
1541
- if (acc.has(code)) acc.get(code)?.push(country);
1542
- else acc.set(code, [country]);
1543
- return acc;
1544
- }, /* @__PURE__ */ new Map());
1545
-
1546
- //#endregion
1547
- //#region src/phone/phoneUtils.ts
1548
- const OFFSET = 127397;
1549
- const emojiCache = {};
1550
- function getFlagEmojiFromCountryIso(iso, fallbackIso = "us") {
1551
- iso = iso || fallbackIso;
1552
- if (emojiCache[iso]) return emojiCache[iso];
1553
- const codePoints = [...iso.toUpperCase()].map((c) => c.codePointAt(0) + OFFSET);
1554
- const res = String.fromCodePoint(...codePoints);
1555
- emojiCache[iso] = res;
1556
- return res;
1557
- }
1558
- function getCountryIsoFromFormattedNumber(formattedNumber, fallbackIso = "us") {
1559
- const number = extractDigits(formattedNumber);
1560
- if (!number || number.length < 4) return fallbackIso;
1561
- if (number.startsWith("1") && phoneNumberBelongsTo("us", number)) return "us";
1562
- if (number.startsWith("1") && phoneNumberBelongsTo("ca", number)) return "ca";
1563
- return getCountryFromPhoneString(number).country.iso;
1564
- }
1565
- function formatPhoneNumber(phoneNumber, pattern, countryCode) {
1566
- if (!phoneNumber || !pattern) return phoneNumber;
1567
- const digits = [...extractDigits(phoneNumber)].slice(0, maxE164CompliantLength(countryCode));
1568
- if (digits.length <= 3) return digits.join("");
1569
- let res = "";
1570
- for (let i = 0; digits.length > 0; i++) if (i > pattern.length - 1) res += digits.shift();
1571
- else res += pattern[i] === "." ? digits.shift() : pattern[i];
1572
- return res;
1573
- }
1574
- function extractDigits(formattedPhone) {
1575
- return (formattedPhone || "").replace(/[^\d]/g, "");
1576
- }
1577
- function phoneNumberBelongsTo(iso, phoneWithCode) {
1578
- if (!iso || !IsoToCountryMap.get(iso) || !phoneWithCode) return false;
1579
- const code = phoneWithCode[0];
1580
- const subArea = phoneWithCode.substring(1, 4);
1581
- return code === IsoToCountryMap.get(iso)?.code && phoneWithCode.length - 1 === maxDigitCountForPattern(IsoToCountryMap.get(iso)?.pattern || "") && SubAreaCodeSets[iso].has(subArea);
1582
- }
1583
- function maxDigitCountForPattern(pattern) {
1584
- return (pattern.match(/\./g) || []).length;
1585
- }
1586
- const MAX_PHONE_NUMBER_LENGTH = 15;
1587
- function maxE164CompliantLength(countryCode) {
1588
- countryCode = countryCode || "1";
1589
- return MAX_PHONE_NUMBER_LENGTH - (countryCode.includes("+") ? countryCode : "+" + countryCode).length;
1590
- }
1591
- function parsePhoneString(str) {
1592
- const digits = extractDigits(str);
1593
- const iso = getCountryIsoFromFormattedNumber(digits);
1594
- const pattern = IsoToCountryMap.get(iso)?.pattern || "";
1595
- const code = IsoToCountryMap.get(iso)?.code || "";
1596
- const number = digits.slice(code.length);
1597
- return {
1598
- iso,
1599
- pattern,
1600
- code,
1601
- number,
1602
- formattedNumberWithCode: `+${code} ${formatPhoneNumber(number, pattern, code)}`
1603
- };
1604
- }
1605
- function stringToFormattedPhoneString(str) {
1606
- const parsed = parsePhoneString(str);
1607
- return `+${parsed.code} ${formatPhoneNumber(parsed.number, parsed.pattern, parsed.code)}`;
1608
- }
1609
- const byPriority = (a, b) => {
1610
- return b.priority - a.priority;
1611
- };
1612
- function getCountryFromPhoneString(phone) {
1613
- const phoneWithCode = extractDigits(phone);
1614
- const matchingCountries = [];
1615
- for (const i of [
1616
- 4,
1617
- 3,
1618
- 2,
1619
- 1
1620
- ]) {
1621
- const potentialCode = phoneWithCode.substring(0, i);
1622
- const countries = CodeToCountriesMap.get(potentialCode) || [];
1623
- if (countries.length) matchingCountries.push(...countries);
1624
- }
1625
- const fallbackCountry = IsoToCountryMap.get("us");
1626
- const country = matchingCountries.sort(byPriority)[0] || fallbackCountry;
1627
- return {
1628
- number: phoneWithCode.slice(country?.code.length || 0),
1629
- country
1630
- };
1631
- }
1632
- function getPreferredPhoneCodeChannelByCountry(phoneNumber, preferredChannels) {
1633
- if (!preferredChannels) return null;
1634
- const { country } = getCountryFromPhoneString(phoneNumber);
1635
- return preferredChannels[country.iso.toUpperCase()] || null;
1636
- }
1637
-
1638
- //#endregion
1639
- exports.CodeToCountriesMap = CodeToCountriesMap;
1640
- exports.IsoToCountryMap = IsoToCountryMap;
1641
- exports.SubAreaCodeSets = SubAreaCodeSets;
1642
- exports.byPriority = byPriority;
1643
- exports.extractDigits = extractDigits;
1644
- exports.formatPhoneNumber = formatPhoneNumber;
1645
- exports.getCountryFromPhoneString = getCountryFromPhoneString;
1646
- exports.getCountryIsoFromFormattedNumber = getCountryIsoFromFormattedNumber;
1647
- exports.getFlagEmojiFromCountryIso = getFlagEmojiFromCountryIso;
1648
- exports.getPreferredPhoneCodeChannelByCountry = getPreferredPhoneCodeChannelByCountry;
1649
- exports.parsePhoneString = parsePhoneString;
1650
- exports.stringToFormattedPhoneString = stringToFormattedPhoneString;
1651
- //# sourceMappingURL=index.js.map
5
+ exports.CodeToCountriesMap = require_countryCodeData.CodeToCountriesMap;
6
+ exports.IsoToCountryMap = require_countryCodeData.IsoToCountryMap;
7
+ exports.SubAreaCodeSets = require_countryCodeData.SubAreaCodeSets;
8
+ exports.byPriority = require_phoneUtils.byPriority;
9
+ exports.extractDigits = require_phoneUtils.extractDigits;
10
+ exports.formatPhoneNumber = require_phoneUtils.formatPhoneNumber;
11
+ exports.getCountryFromPhoneString = require_phoneUtils.getCountryFromPhoneString;
12
+ exports.getCountryIsoFromFormattedNumber = require_phoneUtils.getCountryIsoFromFormattedNumber;
13
+ exports.getFlagEmojiFromCountryIso = require_phoneUtils.getFlagEmojiFromCountryIso;
14
+ exports.getPreferredPhoneCodeChannelByCountry = require_phoneUtils.getPreferredPhoneCodeChannelByCountry;
15
+ exports.parsePhoneString = require_phoneUtils.parsePhoneString;
16
+ exports.stringToFormattedPhoneString = require_phoneUtils.stringToFormattedPhoneString;