intl-tel-input 24.3.1 → 24.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.
@@ -0,0 +1,2534 @@
1
+ import { mergeModels as v, useModel as k, ref as w, onMounted as T, watch as P, onUnmounted as x, withDirectives as E, openBlock as M, createElementBlock as B, vModelText as O } from "vue";
2
+ const L = [
3
+ [
4
+ "af",
5
+ // Afghanistan
6
+ "93"
7
+ ],
8
+ [
9
+ "ax",
10
+ // Åland Islands
11
+ "358",
12
+ 1,
13
+ ["18"]
14
+ ],
15
+ [
16
+ "al",
17
+ // Albania
18
+ "355"
19
+ ],
20
+ [
21
+ "dz",
22
+ // Algeria
23
+ "213"
24
+ ],
25
+ [
26
+ "as",
27
+ // American Samoa
28
+ "1",
29
+ 5,
30
+ ["684"]
31
+ ],
32
+ [
33
+ "ad",
34
+ // Andorra
35
+ "376"
36
+ ],
37
+ [
38
+ "ao",
39
+ // Angola
40
+ "244"
41
+ ],
42
+ [
43
+ "ai",
44
+ // Anguilla
45
+ "1",
46
+ 6,
47
+ ["264"]
48
+ ],
49
+ [
50
+ "ag",
51
+ // Antigua and Barbuda
52
+ "1",
53
+ 7,
54
+ ["268"]
55
+ ],
56
+ [
57
+ "ar",
58
+ // Argentina
59
+ "54"
60
+ ],
61
+ [
62
+ "am",
63
+ // Armenia
64
+ "374"
65
+ ],
66
+ [
67
+ "aw",
68
+ // Aruba
69
+ "297"
70
+ ],
71
+ [
72
+ "ac",
73
+ // Ascension Island
74
+ "247"
75
+ ],
76
+ [
77
+ "au",
78
+ // Australia
79
+ "61",
80
+ 0
81
+ ],
82
+ [
83
+ "at",
84
+ // Austria
85
+ "43"
86
+ ],
87
+ [
88
+ "az",
89
+ // Azerbaijan
90
+ "994"
91
+ ],
92
+ [
93
+ "bs",
94
+ // Bahamas
95
+ "1",
96
+ 8,
97
+ ["242"]
98
+ ],
99
+ [
100
+ "bh",
101
+ // Bahrain
102
+ "973"
103
+ ],
104
+ [
105
+ "bd",
106
+ // Bangladesh
107
+ "880"
108
+ ],
109
+ [
110
+ "bb",
111
+ // Barbados
112
+ "1",
113
+ 9,
114
+ ["246"]
115
+ ],
116
+ [
117
+ "by",
118
+ // Belarus
119
+ "375"
120
+ ],
121
+ [
122
+ "be",
123
+ // Belgium
124
+ "32"
125
+ ],
126
+ [
127
+ "bz",
128
+ // Belize
129
+ "501"
130
+ ],
131
+ [
132
+ "bj",
133
+ // Benin
134
+ "229"
135
+ ],
136
+ [
137
+ "bm",
138
+ // Bermuda
139
+ "1",
140
+ 10,
141
+ ["441"]
142
+ ],
143
+ [
144
+ "bt",
145
+ // Bhutan
146
+ "975"
147
+ ],
148
+ [
149
+ "bo",
150
+ // Bolivia
151
+ "591"
152
+ ],
153
+ [
154
+ "ba",
155
+ // Bosnia and Herzegovina
156
+ "387"
157
+ ],
158
+ [
159
+ "bw",
160
+ // Botswana
161
+ "267"
162
+ ],
163
+ [
164
+ "br",
165
+ // Brazil
166
+ "55"
167
+ ],
168
+ [
169
+ "io",
170
+ // British Indian Ocean Territory
171
+ "246"
172
+ ],
173
+ [
174
+ "vg",
175
+ // British Virgin Islands
176
+ "1",
177
+ 11,
178
+ ["284"]
179
+ ],
180
+ [
181
+ "bn",
182
+ // Brunei
183
+ "673"
184
+ ],
185
+ [
186
+ "bg",
187
+ // Bulgaria
188
+ "359"
189
+ ],
190
+ [
191
+ "bf",
192
+ // Burkina Faso
193
+ "226"
194
+ ],
195
+ [
196
+ "bi",
197
+ // Burundi
198
+ "257"
199
+ ],
200
+ [
201
+ "kh",
202
+ // Cambodia
203
+ "855"
204
+ ],
205
+ [
206
+ "cm",
207
+ // Cameroon
208
+ "237"
209
+ ],
210
+ [
211
+ "ca",
212
+ // Canada
213
+ "1",
214
+ 1,
215
+ ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "879", "902", "905"]
216
+ ],
217
+ [
218
+ "cv",
219
+ // Cape Verde
220
+ "238"
221
+ ],
222
+ [
223
+ "bq",
224
+ // Caribbean Netherlands
225
+ "599",
226
+ 1,
227
+ ["3", "4", "7"]
228
+ ],
229
+ [
230
+ "ky",
231
+ // Cayman Islands
232
+ "1",
233
+ 12,
234
+ ["345"]
235
+ ],
236
+ [
237
+ "cf",
238
+ // Central African Republic
239
+ "236"
240
+ ],
241
+ [
242
+ "td",
243
+ // Chad
244
+ "235"
245
+ ],
246
+ [
247
+ "cl",
248
+ // Chile
249
+ "56"
250
+ ],
251
+ [
252
+ "cn",
253
+ // China
254
+ "86"
255
+ ],
256
+ [
257
+ "cx",
258
+ // Christmas Island
259
+ "61",
260
+ 2,
261
+ ["89164"]
262
+ ],
263
+ [
264
+ "cc",
265
+ // Cocos (Keeling) Islands
266
+ "61",
267
+ 1,
268
+ ["89162"]
269
+ ],
270
+ [
271
+ "co",
272
+ // Colombia
273
+ "57"
274
+ ],
275
+ [
276
+ "km",
277
+ // Comoros
278
+ "269"
279
+ ],
280
+ [
281
+ "cg",
282
+ // Congo (Brazzaville)
283
+ "242"
284
+ ],
285
+ [
286
+ "cd",
287
+ // Congo (Kinshasa)
288
+ "243"
289
+ ],
290
+ [
291
+ "ck",
292
+ // Cook Islands
293
+ "682"
294
+ ],
295
+ [
296
+ "cr",
297
+ // Costa Rica
298
+ "506"
299
+ ],
300
+ [
301
+ "ci",
302
+ // Côte d'Ivoire
303
+ "225"
304
+ ],
305
+ [
306
+ "hr",
307
+ // Croatia
308
+ "385"
309
+ ],
310
+ [
311
+ "cu",
312
+ // Cuba
313
+ "53"
314
+ ],
315
+ [
316
+ "cw",
317
+ // Curaçao
318
+ "599",
319
+ 0
320
+ ],
321
+ [
322
+ "cy",
323
+ // Cyprus
324
+ "357"
325
+ ],
326
+ [
327
+ "cz",
328
+ // Czech Republic
329
+ "420"
330
+ ],
331
+ [
332
+ "dk",
333
+ // Denmark
334
+ "45"
335
+ ],
336
+ [
337
+ "dj",
338
+ // Djibouti
339
+ "253"
340
+ ],
341
+ [
342
+ "dm",
343
+ // Dominica
344
+ "1",
345
+ 13,
346
+ ["767"]
347
+ ],
348
+ [
349
+ "do",
350
+ // Dominican Republic
351
+ "1",
352
+ 2,
353
+ ["809", "829", "849"]
354
+ ],
355
+ [
356
+ "ec",
357
+ // Ecuador
358
+ "593"
359
+ ],
360
+ [
361
+ "eg",
362
+ // Egypt
363
+ "20"
364
+ ],
365
+ [
366
+ "sv",
367
+ // El Salvador
368
+ "503"
369
+ ],
370
+ [
371
+ "gq",
372
+ // Equatorial Guinea
373
+ "240"
374
+ ],
375
+ [
376
+ "er",
377
+ // Eritrea
378
+ "291"
379
+ ],
380
+ [
381
+ "ee",
382
+ // Estonia
383
+ "372"
384
+ ],
385
+ [
386
+ "sz",
387
+ // Eswatini
388
+ "268"
389
+ ],
390
+ [
391
+ "et",
392
+ // Ethiopia
393
+ "251"
394
+ ],
395
+ [
396
+ "fk",
397
+ // Falkland Islands (Malvinas)
398
+ "500"
399
+ ],
400
+ [
401
+ "fo",
402
+ // Faroe Islands
403
+ "298"
404
+ ],
405
+ [
406
+ "fj",
407
+ // Fiji
408
+ "679"
409
+ ],
410
+ [
411
+ "fi",
412
+ // Finland
413
+ "358",
414
+ 0
415
+ ],
416
+ [
417
+ "fr",
418
+ // France
419
+ "33"
420
+ ],
421
+ [
422
+ "gf",
423
+ // French Guiana
424
+ "594"
425
+ ],
426
+ [
427
+ "pf",
428
+ // French Polynesia
429
+ "689"
430
+ ],
431
+ [
432
+ "ga",
433
+ // Gabon
434
+ "241"
435
+ ],
436
+ [
437
+ "gm",
438
+ // Gambia
439
+ "220"
440
+ ],
441
+ [
442
+ "ge",
443
+ // Georgia
444
+ "995"
445
+ ],
446
+ [
447
+ "de",
448
+ // Germany
449
+ "49"
450
+ ],
451
+ [
452
+ "gh",
453
+ // Ghana
454
+ "233"
455
+ ],
456
+ [
457
+ "gi",
458
+ // Gibraltar
459
+ "350"
460
+ ],
461
+ [
462
+ "gr",
463
+ // Greece
464
+ "30"
465
+ ],
466
+ [
467
+ "gl",
468
+ // Greenland
469
+ "299"
470
+ ],
471
+ [
472
+ "gd",
473
+ // Grenada
474
+ "1",
475
+ 14,
476
+ ["473"]
477
+ ],
478
+ [
479
+ "gp",
480
+ // Guadeloupe
481
+ "590",
482
+ 0
483
+ ],
484
+ [
485
+ "gu",
486
+ // Guam
487
+ "1",
488
+ 15,
489
+ ["671"]
490
+ ],
491
+ [
492
+ "gt",
493
+ // Guatemala
494
+ "502"
495
+ ],
496
+ [
497
+ "gg",
498
+ // Guernsey
499
+ "44",
500
+ 1,
501
+ ["1481", "7781", "7839", "7911"]
502
+ ],
503
+ [
504
+ "gn",
505
+ // Guinea
506
+ "224"
507
+ ],
508
+ [
509
+ "gw",
510
+ // Guinea-Bissau
511
+ "245"
512
+ ],
513
+ [
514
+ "gy",
515
+ // Guyana
516
+ "592"
517
+ ],
518
+ [
519
+ "ht",
520
+ // Haiti
521
+ "509"
522
+ ],
523
+ [
524
+ "hn",
525
+ // Honduras
526
+ "504"
527
+ ],
528
+ [
529
+ "hk",
530
+ // Hong Kong SAR China
531
+ "852"
532
+ ],
533
+ [
534
+ "hu",
535
+ // Hungary
536
+ "36"
537
+ ],
538
+ [
539
+ "is",
540
+ // Iceland
541
+ "354"
542
+ ],
543
+ [
544
+ "in",
545
+ // India
546
+ "91"
547
+ ],
548
+ [
549
+ "id",
550
+ // Indonesia
551
+ "62"
552
+ ],
553
+ [
554
+ "ir",
555
+ // Iran
556
+ "98"
557
+ ],
558
+ [
559
+ "iq",
560
+ // Iraq
561
+ "964"
562
+ ],
563
+ [
564
+ "ie",
565
+ // Ireland
566
+ "353"
567
+ ],
568
+ [
569
+ "im",
570
+ // Isle of Man
571
+ "44",
572
+ 2,
573
+ ["1624", "74576", "7524", "7924", "7624"]
574
+ ],
575
+ [
576
+ "il",
577
+ // Israel
578
+ "972"
579
+ ],
580
+ [
581
+ "it",
582
+ // Italy
583
+ "39",
584
+ 0
585
+ ],
586
+ [
587
+ "jm",
588
+ // Jamaica
589
+ "1",
590
+ 4,
591
+ ["876", "658"]
592
+ ],
593
+ [
594
+ "jp",
595
+ // Japan
596
+ "81"
597
+ ],
598
+ [
599
+ "je",
600
+ // Jersey
601
+ "44",
602
+ 3,
603
+ ["1534", "7509", "7700", "7797", "7829", "7937"]
604
+ ],
605
+ [
606
+ "jo",
607
+ // Jordan
608
+ "962"
609
+ ],
610
+ [
611
+ "kz",
612
+ // Kazakhstan
613
+ "7",
614
+ 1,
615
+ ["33", "7"]
616
+ ],
617
+ [
618
+ "ke",
619
+ // Kenya
620
+ "254"
621
+ ],
622
+ [
623
+ "ki",
624
+ // Kiribati
625
+ "686"
626
+ ],
627
+ [
628
+ "xk",
629
+ // Kosovo
630
+ "383"
631
+ ],
632
+ [
633
+ "kw",
634
+ // Kuwait
635
+ "965"
636
+ ],
637
+ [
638
+ "kg",
639
+ // Kyrgyzstan
640
+ "996"
641
+ ],
642
+ [
643
+ "la",
644
+ // Laos
645
+ "856"
646
+ ],
647
+ [
648
+ "lv",
649
+ // Latvia
650
+ "371"
651
+ ],
652
+ [
653
+ "lb",
654
+ // Lebanon
655
+ "961"
656
+ ],
657
+ [
658
+ "ls",
659
+ // Lesotho
660
+ "266"
661
+ ],
662
+ [
663
+ "lr",
664
+ // Liberia
665
+ "231"
666
+ ],
667
+ [
668
+ "ly",
669
+ // Libya
670
+ "218"
671
+ ],
672
+ [
673
+ "li",
674
+ // Liechtenstein
675
+ "423"
676
+ ],
677
+ [
678
+ "lt",
679
+ // Lithuania
680
+ "370"
681
+ ],
682
+ [
683
+ "lu",
684
+ // Luxembourg
685
+ "352"
686
+ ],
687
+ [
688
+ "mo",
689
+ // Macao SAR China
690
+ "853"
691
+ ],
692
+ [
693
+ "mg",
694
+ // Madagascar
695
+ "261"
696
+ ],
697
+ [
698
+ "mw",
699
+ // Malawi
700
+ "265"
701
+ ],
702
+ [
703
+ "my",
704
+ // Malaysia
705
+ "60"
706
+ ],
707
+ [
708
+ "mv",
709
+ // Maldives
710
+ "960"
711
+ ],
712
+ [
713
+ "ml",
714
+ // Mali
715
+ "223"
716
+ ],
717
+ [
718
+ "mt",
719
+ // Malta
720
+ "356"
721
+ ],
722
+ [
723
+ "mh",
724
+ // Marshall Islands
725
+ "692"
726
+ ],
727
+ [
728
+ "mq",
729
+ // Martinique
730
+ "596"
731
+ ],
732
+ [
733
+ "mr",
734
+ // Mauritania
735
+ "222"
736
+ ],
737
+ [
738
+ "mu",
739
+ // Mauritius
740
+ "230"
741
+ ],
742
+ [
743
+ "yt",
744
+ // Mayotte
745
+ "262",
746
+ 1,
747
+ ["269", "639"]
748
+ ],
749
+ [
750
+ "mx",
751
+ // Mexico
752
+ "52"
753
+ ],
754
+ [
755
+ "fm",
756
+ // Micronesia
757
+ "691"
758
+ ],
759
+ [
760
+ "md",
761
+ // Moldova
762
+ "373"
763
+ ],
764
+ [
765
+ "mc",
766
+ // Monaco
767
+ "377"
768
+ ],
769
+ [
770
+ "mn",
771
+ // Mongolia
772
+ "976"
773
+ ],
774
+ [
775
+ "me",
776
+ // Montenegro
777
+ "382"
778
+ ],
779
+ [
780
+ "ms",
781
+ // Montserrat
782
+ "1",
783
+ 16,
784
+ ["664"]
785
+ ],
786
+ [
787
+ "ma",
788
+ // Morocco
789
+ "212",
790
+ 0
791
+ ],
792
+ [
793
+ "mz",
794
+ // Mozambique
795
+ "258"
796
+ ],
797
+ [
798
+ "mm",
799
+ // Myanmar (Burma)
800
+ "95"
801
+ ],
802
+ [
803
+ "na",
804
+ // Namibia
805
+ "264"
806
+ ],
807
+ [
808
+ "nr",
809
+ // Nauru
810
+ "674"
811
+ ],
812
+ [
813
+ "np",
814
+ // Nepal
815
+ "977"
816
+ ],
817
+ [
818
+ "nl",
819
+ // Netherlands
820
+ "31"
821
+ ],
822
+ [
823
+ "nc",
824
+ // New Caledonia
825
+ "687"
826
+ ],
827
+ [
828
+ "nz",
829
+ // New Zealand
830
+ "64"
831
+ ],
832
+ [
833
+ "ni",
834
+ // Nicaragua
835
+ "505"
836
+ ],
837
+ [
838
+ "ne",
839
+ // Niger
840
+ "227"
841
+ ],
842
+ [
843
+ "ng",
844
+ // Nigeria
845
+ "234"
846
+ ],
847
+ [
848
+ "nu",
849
+ // Niue
850
+ "683"
851
+ ],
852
+ [
853
+ "nf",
854
+ // Norfolk Island
855
+ "672"
856
+ ],
857
+ [
858
+ "kp",
859
+ // North Korea
860
+ "850"
861
+ ],
862
+ [
863
+ "mk",
864
+ // North Macedonia
865
+ "389"
866
+ ],
867
+ [
868
+ "mp",
869
+ // Northern Mariana Islands
870
+ "1",
871
+ 17,
872
+ ["670"]
873
+ ],
874
+ [
875
+ "no",
876
+ // Norway
877
+ "47",
878
+ 0
879
+ ],
880
+ [
881
+ "om",
882
+ // Oman
883
+ "968"
884
+ ],
885
+ [
886
+ "pk",
887
+ // Pakistan
888
+ "92"
889
+ ],
890
+ [
891
+ "pw",
892
+ // Palau
893
+ "680"
894
+ ],
895
+ [
896
+ "ps",
897
+ // Palestinian Territories
898
+ "970"
899
+ ],
900
+ [
901
+ "pa",
902
+ // Panama
903
+ "507"
904
+ ],
905
+ [
906
+ "pg",
907
+ // Papua New Guinea
908
+ "675"
909
+ ],
910
+ [
911
+ "py",
912
+ // Paraguay
913
+ "595"
914
+ ],
915
+ [
916
+ "pe",
917
+ // Peru
918
+ "51"
919
+ ],
920
+ [
921
+ "ph",
922
+ // Philippines
923
+ "63"
924
+ ],
925
+ [
926
+ "pl",
927
+ // Poland
928
+ "48"
929
+ ],
930
+ [
931
+ "pt",
932
+ // Portugal
933
+ "351"
934
+ ],
935
+ [
936
+ "pr",
937
+ // Puerto Rico
938
+ "1",
939
+ 3,
940
+ ["787", "939"]
941
+ ],
942
+ [
943
+ "qa",
944
+ // Qatar
945
+ "974"
946
+ ],
947
+ [
948
+ "re",
949
+ // Réunion
950
+ "262",
951
+ 0
952
+ ],
953
+ [
954
+ "ro",
955
+ // Romania
956
+ "40"
957
+ ],
958
+ [
959
+ "ru",
960
+ // Russia
961
+ "7",
962
+ 0
963
+ ],
964
+ [
965
+ "rw",
966
+ // Rwanda
967
+ "250"
968
+ ],
969
+ [
970
+ "ws",
971
+ // Samoa
972
+ "685"
973
+ ],
974
+ [
975
+ "sm",
976
+ // San Marino
977
+ "378"
978
+ ],
979
+ [
980
+ "st",
981
+ // São Tomé & Príncipe
982
+ "239"
983
+ ],
984
+ [
985
+ "sa",
986
+ // Saudi Arabia
987
+ "966"
988
+ ],
989
+ [
990
+ "sn",
991
+ // Senegal
992
+ "221"
993
+ ],
994
+ [
995
+ "rs",
996
+ // Serbia
997
+ "381"
998
+ ],
999
+ [
1000
+ "sc",
1001
+ // Seychelles
1002
+ "248"
1003
+ ],
1004
+ [
1005
+ "sl",
1006
+ // Sierra Leone
1007
+ "232"
1008
+ ],
1009
+ [
1010
+ "sg",
1011
+ // Singapore
1012
+ "65"
1013
+ ],
1014
+ [
1015
+ "sx",
1016
+ // Sint Maarten
1017
+ "1",
1018
+ 21,
1019
+ ["721"]
1020
+ ],
1021
+ [
1022
+ "sk",
1023
+ // Slovakia
1024
+ "421"
1025
+ ],
1026
+ [
1027
+ "si",
1028
+ // Slovenia
1029
+ "386"
1030
+ ],
1031
+ [
1032
+ "sb",
1033
+ // Solomon Islands
1034
+ "677"
1035
+ ],
1036
+ [
1037
+ "so",
1038
+ // Somalia
1039
+ "252"
1040
+ ],
1041
+ [
1042
+ "za",
1043
+ // South Africa
1044
+ "27"
1045
+ ],
1046
+ [
1047
+ "kr",
1048
+ // South Korea
1049
+ "82"
1050
+ ],
1051
+ [
1052
+ "ss",
1053
+ // South Sudan
1054
+ "211"
1055
+ ],
1056
+ [
1057
+ "es",
1058
+ // Spain
1059
+ "34"
1060
+ ],
1061
+ [
1062
+ "lk",
1063
+ // Sri Lanka
1064
+ "94"
1065
+ ],
1066
+ [
1067
+ "bl",
1068
+ // St. Barthélemy
1069
+ "590",
1070
+ 1
1071
+ ],
1072
+ [
1073
+ "sh",
1074
+ // St. Helena
1075
+ "290"
1076
+ ],
1077
+ [
1078
+ "kn",
1079
+ // St. Kitts & Nevis
1080
+ "1",
1081
+ 18,
1082
+ ["869"]
1083
+ ],
1084
+ [
1085
+ "lc",
1086
+ // St. Lucia
1087
+ "1",
1088
+ 19,
1089
+ ["758"]
1090
+ ],
1091
+ [
1092
+ "mf",
1093
+ // St. Martin
1094
+ "590",
1095
+ 2
1096
+ ],
1097
+ [
1098
+ "pm",
1099
+ // St. Pierre & Miquelon
1100
+ "508"
1101
+ ],
1102
+ [
1103
+ "vc",
1104
+ // St. Vincent & Grenadines
1105
+ "1",
1106
+ 20,
1107
+ ["784"]
1108
+ ],
1109
+ [
1110
+ "sd",
1111
+ // Sudan
1112
+ "249"
1113
+ ],
1114
+ [
1115
+ "sr",
1116
+ // Suriname
1117
+ "597"
1118
+ ],
1119
+ [
1120
+ "sj",
1121
+ // Svalbard & Jan Mayen
1122
+ "47",
1123
+ 1,
1124
+ ["79"]
1125
+ ],
1126
+ [
1127
+ "se",
1128
+ // Sweden
1129
+ "46"
1130
+ ],
1131
+ [
1132
+ "ch",
1133
+ // Switzerland
1134
+ "41"
1135
+ ],
1136
+ [
1137
+ "sy",
1138
+ // Syria
1139
+ "963"
1140
+ ],
1141
+ [
1142
+ "tw",
1143
+ // Taiwan
1144
+ "886"
1145
+ ],
1146
+ [
1147
+ "tj",
1148
+ // Tajikistan
1149
+ "992"
1150
+ ],
1151
+ [
1152
+ "tz",
1153
+ // Tanzania
1154
+ "255"
1155
+ ],
1156
+ [
1157
+ "th",
1158
+ // Thailand
1159
+ "66"
1160
+ ],
1161
+ [
1162
+ "tl",
1163
+ // Timor-Leste
1164
+ "670"
1165
+ ],
1166
+ [
1167
+ "tg",
1168
+ // Togo
1169
+ "228"
1170
+ ],
1171
+ [
1172
+ "tk",
1173
+ // Tokelau
1174
+ "690"
1175
+ ],
1176
+ [
1177
+ "to",
1178
+ // Tonga
1179
+ "676"
1180
+ ],
1181
+ [
1182
+ "tt",
1183
+ // Trinidad & Tobago
1184
+ "1",
1185
+ 22,
1186
+ ["868"]
1187
+ ],
1188
+ [
1189
+ "tn",
1190
+ // Tunisia
1191
+ "216"
1192
+ ],
1193
+ [
1194
+ "tr",
1195
+ // Turkey
1196
+ "90"
1197
+ ],
1198
+ [
1199
+ "tm",
1200
+ // Turkmenistan
1201
+ "993"
1202
+ ],
1203
+ [
1204
+ "tc",
1205
+ // Turks & Caicos Islands
1206
+ "1",
1207
+ 23,
1208
+ ["649"]
1209
+ ],
1210
+ [
1211
+ "tv",
1212
+ // Tuvalu
1213
+ "688"
1214
+ ],
1215
+ [
1216
+ "ug",
1217
+ // Uganda
1218
+ "256"
1219
+ ],
1220
+ [
1221
+ "ua",
1222
+ // Ukraine
1223
+ "380"
1224
+ ],
1225
+ [
1226
+ "ae",
1227
+ // United Arab Emirates
1228
+ "971"
1229
+ ],
1230
+ [
1231
+ "gb",
1232
+ // United Kingdom
1233
+ "44",
1234
+ 0
1235
+ ],
1236
+ [
1237
+ "us",
1238
+ // United States
1239
+ "1",
1240
+ 0
1241
+ ],
1242
+ [
1243
+ "uy",
1244
+ // Uruguay
1245
+ "598"
1246
+ ],
1247
+ [
1248
+ "vi",
1249
+ // U.S. Virgin Islands
1250
+ "1",
1251
+ 24,
1252
+ ["340"]
1253
+ ],
1254
+ [
1255
+ "uz",
1256
+ // Uzbekistan
1257
+ "998"
1258
+ ],
1259
+ [
1260
+ "vu",
1261
+ // Vanuatu
1262
+ "678"
1263
+ ],
1264
+ [
1265
+ "va",
1266
+ // Vatican City
1267
+ "39",
1268
+ 1,
1269
+ ["06698"]
1270
+ ],
1271
+ [
1272
+ "ve",
1273
+ // Venezuela
1274
+ "58"
1275
+ ],
1276
+ [
1277
+ "vn",
1278
+ // Vietnam
1279
+ "84"
1280
+ ],
1281
+ [
1282
+ "wf",
1283
+ // Wallis & Futuna
1284
+ "681"
1285
+ ],
1286
+ [
1287
+ "eh",
1288
+ // Western Sahara
1289
+ "212",
1290
+ 1,
1291
+ ["5288", "5289"]
1292
+ ],
1293
+ [
1294
+ "ye",
1295
+ // Yemen
1296
+ "967"
1297
+ ],
1298
+ [
1299
+ "zm",
1300
+ // Zambia
1301
+ "260"
1302
+ ],
1303
+ [
1304
+ "zw",
1305
+ // Zimbabwe
1306
+ "263"
1307
+ ]
1308
+ ], g = [];
1309
+ for (let l = 0; l < L.length; l++) {
1310
+ const t = L[l];
1311
+ g[l] = {
1312
+ name: "",
1313
+ // this is now populated in the plugin
1314
+ iso2: t[0],
1315
+ dialCode: t[1],
1316
+ priority: t[2] || 0,
1317
+ areaCodes: t[3] || null,
1318
+ nodeById: {}
1319
+ };
1320
+ }
1321
+ const V = {
1322
+ ad: "Andorra",
1323
+ ae: "United Arab Emirates",
1324
+ af: "Afghanistan",
1325
+ ag: "Antigua & Barbuda",
1326
+ ai: "Anguilla",
1327
+ al: "Albania",
1328
+ am: "Armenia",
1329
+ ao: "Angola",
1330
+ ar: "Argentina",
1331
+ as: "American Samoa",
1332
+ at: "Austria",
1333
+ au: "Australia",
1334
+ aw: "Aruba",
1335
+ ax: "Åland Islands",
1336
+ az: "Azerbaijan",
1337
+ ba: "Bosnia & Herzegovina",
1338
+ bb: "Barbados",
1339
+ bd: "Bangladesh",
1340
+ be: "Belgium",
1341
+ bf: "Burkina Faso",
1342
+ bg: "Bulgaria",
1343
+ bh: "Bahrain",
1344
+ bi: "Burundi",
1345
+ bj: "Benin",
1346
+ bl: "St. Barthélemy",
1347
+ bm: "Bermuda",
1348
+ bn: "Brunei",
1349
+ bo: "Bolivia",
1350
+ bq: "Caribbean Netherlands",
1351
+ br: "Brazil",
1352
+ bs: "Bahamas",
1353
+ bt: "Bhutan",
1354
+ bw: "Botswana",
1355
+ by: "Belarus",
1356
+ bz: "Belize",
1357
+ ca: "Canada",
1358
+ cc: "Cocos (Keeling) Islands",
1359
+ cd: "Congo - Kinshasa",
1360
+ cf: "Central African Republic",
1361
+ cg: "Congo - Brazzaville",
1362
+ ch: "Switzerland",
1363
+ ci: "Côte d’Ivoire",
1364
+ ck: "Cook Islands",
1365
+ cl: "Chile",
1366
+ cm: "Cameroon",
1367
+ cn: "China",
1368
+ co: "Colombia",
1369
+ cr: "Costa Rica",
1370
+ cu: "Cuba",
1371
+ cv: "Cape Verde",
1372
+ cw: "Curaçao",
1373
+ cx: "Christmas Island",
1374
+ cy: "Cyprus",
1375
+ cz: "Czechia",
1376
+ de: "Germany",
1377
+ dj: "Djibouti",
1378
+ dk: "Denmark",
1379
+ dm: "Dominica",
1380
+ do: "Dominican Republic",
1381
+ dz: "Algeria",
1382
+ ec: "Ecuador",
1383
+ ee: "Estonia",
1384
+ eg: "Egypt",
1385
+ eh: "Western Sahara",
1386
+ er: "Eritrea",
1387
+ es: "Spain",
1388
+ et: "Ethiopia",
1389
+ fi: "Finland",
1390
+ fj: "Fiji",
1391
+ fk: "Falkland Islands",
1392
+ fm: "Micronesia",
1393
+ fo: "Faroe Islands",
1394
+ fr: "France",
1395
+ ga: "Gabon",
1396
+ gb: "United Kingdom",
1397
+ gd: "Grenada",
1398
+ ge: "Georgia",
1399
+ gf: "French Guiana",
1400
+ gg: "Guernsey",
1401
+ gh: "Ghana",
1402
+ gi: "Gibraltar",
1403
+ gl: "Greenland",
1404
+ gm: "Gambia",
1405
+ gn: "Guinea",
1406
+ gp: "Guadeloupe",
1407
+ gq: "Equatorial Guinea",
1408
+ gr: "Greece",
1409
+ gt: "Guatemala",
1410
+ gu: "Guam",
1411
+ gw: "Guinea-Bissau",
1412
+ gy: "Guyana",
1413
+ hk: "Hong Kong SAR China",
1414
+ hn: "Honduras",
1415
+ hr: "Croatia",
1416
+ ht: "Haiti",
1417
+ hu: "Hungary",
1418
+ id: "Indonesia",
1419
+ ie: "Ireland",
1420
+ il: "Israel",
1421
+ im: "Isle of Man",
1422
+ in: "India",
1423
+ io: "British Indian Ocean Territory",
1424
+ iq: "Iraq",
1425
+ ir: "Iran",
1426
+ is: "Iceland",
1427
+ it: "Italy",
1428
+ je: "Jersey",
1429
+ jm: "Jamaica",
1430
+ jo: "Jordan",
1431
+ jp: "Japan",
1432
+ ke: "Kenya",
1433
+ kg: "Kyrgyzstan",
1434
+ kh: "Cambodia",
1435
+ ki: "Kiribati",
1436
+ km: "Comoros",
1437
+ kn: "St. Kitts & Nevis",
1438
+ kp: "North Korea",
1439
+ kr: "South Korea",
1440
+ kw: "Kuwait",
1441
+ ky: "Cayman Islands",
1442
+ kz: "Kazakhstan",
1443
+ la: "Laos",
1444
+ lb: "Lebanon",
1445
+ lc: "St. Lucia",
1446
+ li: "Liechtenstein",
1447
+ lk: "Sri Lanka",
1448
+ lr: "Liberia",
1449
+ ls: "Lesotho",
1450
+ lt: "Lithuania",
1451
+ lu: "Luxembourg",
1452
+ lv: "Latvia",
1453
+ ly: "Libya",
1454
+ ma: "Morocco",
1455
+ mc: "Monaco",
1456
+ md: "Moldova",
1457
+ me: "Montenegro",
1458
+ mf: "St. Martin",
1459
+ mg: "Madagascar",
1460
+ mh: "Marshall Islands",
1461
+ mk: "North Macedonia",
1462
+ ml: "Mali",
1463
+ mm: "Myanmar (Burma)",
1464
+ mn: "Mongolia",
1465
+ mo: "Macao SAR China",
1466
+ mp: "Northern Mariana Islands",
1467
+ mq: "Martinique",
1468
+ mr: "Mauritania",
1469
+ ms: "Montserrat",
1470
+ mt: "Malta",
1471
+ mu: "Mauritius",
1472
+ mv: "Maldives",
1473
+ mw: "Malawi",
1474
+ mx: "Mexico",
1475
+ my: "Malaysia",
1476
+ mz: "Mozambique",
1477
+ na: "Namibia",
1478
+ nc: "New Caledonia",
1479
+ ne: "Niger",
1480
+ nf: "Norfolk Island",
1481
+ ng: "Nigeria",
1482
+ ni: "Nicaragua",
1483
+ nl: "Netherlands",
1484
+ no: "Norway",
1485
+ np: "Nepal",
1486
+ nr: "Nauru",
1487
+ nu: "Niue",
1488
+ nz: "New Zealand",
1489
+ om: "Oman",
1490
+ pa: "Panama",
1491
+ pe: "Peru",
1492
+ pf: "French Polynesia",
1493
+ pg: "Papua New Guinea",
1494
+ ph: "Philippines",
1495
+ pk: "Pakistan",
1496
+ pl: "Poland",
1497
+ pm: "St. Pierre & Miquelon",
1498
+ pr: "Puerto Rico",
1499
+ ps: "Palestinian Territories",
1500
+ pt: "Portugal",
1501
+ pw: "Palau",
1502
+ py: "Paraguay",
1503
+ qa: "Qatar",
1504
+ re: "Réunion",
1505
+ ro: "Romania",
1506
+ rs: "Serbia",
1507
+ ru: "Russia",
1508
+ rw: "Rwanda",
1509
+ sa: "Saudi Arabia",
1510
+ sb: "Solomon Islands",
1511
+ sc: "Seychelles",
1512
+ sd: "Sudan",
1513
+ se: "Sweden",
1514
+ sg: "Singapore",
1515
+ sh: "St. Helena",
1516
+ si: "Slovenia",
1517
+ sj: "Svalbard & Jan Mayen",
1518
+ sk: "Slovakia",
1519
+ sl: "Sierra Leone",
1520
+ sm: "San Marino",
1521
+ sn: "Senegal",
1522
+ so: "Somalia",
1523
+ sr: "Suriname",
1524
+ ss: "South Sudan",
1525
+ st: "São Tomé & Príncipe",
1526
+ sv: "El Salvador",
1527
+ sx: "Sint Maarten",
1528
+ sy: "Syria",
1529
+ sz: "Eswatini",
1530
+ tc: "Turks & Caicos Islands",
1531
+ td: "Chad",
1532
+ tg: "Togo",
1533
+ th: "Thailand",
1534
+ tj: "Tajikistan",
1535
+ tk: "Tokelau",
1536
+ tl: "Timor-Leste",
1537
+ tm: "Turkmenistan",
1538
+ tn: "Tunisia",
1539
+ to: "Tonga",
1540
+ tr: "Turkey",
1541
+ tt: "Trinidad & Tobago",
1542
+ tv: "Tuvalu",
1543
+ tw: "Taiwan",
1544
+ tz: "Tanzania",
1545
+ ua: "Ukraine",
1546
+ ug: "Uganda",
1547
+ us: "United States",
1548
+ uy: "Uruguay",
1549
+ uz: "Uzbekistan",
1550
+ va: "Vatican City",
1551
+ vc: "St. Vincent & Grenadines",
1552
+ ve: "Venezuela",
1553
+ vg: "British Virgin Islands",
1554
+ vi: "U.S. Virgin Islands",
1555
+ vn: "Vietnam",
1556
+ vu: "Vanuatu",
1557
+ wf: "Wallis & Futuna",
1558
+ ws: "Samoa",
1559
+ ye: "Yemen",
1560
+ yt: "Mayotte",
1561
+ za: "South Africa",
1562
+ zm: "Zambia",
1563
+ zw: "Zimbabwe"
1564
+ }, F = {
1565
+ selectedCountryAriaLabel: "Selected country",
1566
+ noCountrySelected: "No country selected",
1567
+ countryListAriaLabel: "List of countries",
1568
+ searchPlaceholder: "Search",
1569
+ zeroSearchResults: "No results found",
1570
+ oneSearchResult: "1 result found",
1571
+ multipleSearchResults: "${count} results found",
1572
+ // additional countries (not supported by country-list library)
1573
+ ac: "Ascension Island",
1574
+ xk: "Kosovo"
1575
+ }, A = { ...V, ...F };
1576
+ for (let l = 0; l < g.length; l++)
1577
+ g[l].name = A[g[l].iso2];
1578
+ let R = 0;
1579
+ const S = {
1580
+ //* Whether or not to allow the dropdown.
1581
+ allowDropdown: !0,
1582
+ //* Add a placeholder in the input with an example number for the selected country.
1583
+ autoPlaceholder: "polite",
1584
+ //* Modify the parentClass.
1585
+ containerClass: "",
1586
+ //* The order of the countries in the dropdown. Defaults to alphabetical.
1587
+ countryOrder: null,
1588
+ //* Add a country search input at the top of the dropdown.
1589
+ countrySearch: !0,
1590
+ //* Modify the auto placeholder.
1591
+ customPlaceholder: null,
1592
+ //* Append menu to specified element.
1593
+ dropdownContainer: null,
1594
+ //* Don't display these countries.
1595
+ excludeCountries: [],
1596
+ //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
1597
+ fixDropdownWidth: !0,
1598
+ //* Format the number as the user types
1599
+ formatAsYouType: !0,
1600
+ //* Format the input value during initialisation and on setNumber.
1601
+ formatOnDisplay: !0,
1602
+ //* geoIp lookup function.
1603
+ geoIpLookup: null,
1604
+ //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
1605
+ hiddenInput: null,
1606
+ //* Internationalise the plugin text e.g. search input placeholder, country names.
1607
+ i18n: {},
1608
+ //* Initial country.
1609
+ initialCountry: "",
1610
+ //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
1611
+ nationalMode: !0,
1612
+ //* Display only these countries.
1613
+ onlyCountries: [],
1614
+ //* Number type to use for placeholders.
1615
+ placeholderNumberType: "MOBILE",
1616
+ //* Show flags - for both the selected country, and in the country dropdown
1617
+ showFlags: !0,
1618
+ //* Display the international dial code next to the selected flag.
1619
+ separateDialCode: !1,
1620
+ //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
1621
+ strictMode: !1,
1622
+ //* Use full screen popup instead of dropdown for country list.
1623
+ useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? (
1624
+ //* We cannot just test screen size as some smartphones/website meta tags will report desktop resolutions.
1625
+ //* Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
1626
+ /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
1627
+ navigator.userAgent
1628
+ ) || window.innerWidth <= 500
1629
+ ) : !1,
1630
+ //* Specify the path to the libphonenumber script to enable validation/formatting.
1631
+ utilsScript: "",
1632
+ //* The number type to enforce during validation.
1633
+ validationNumberType: "MOBILE"
1634
+ }, z = [
1635
+ "800",
1636
+ "822",
1637
+ "833",
1638
+ "844",
1639
+ "855",
1640
+ "866",
1641
+ "877",
1642
+ "880",
1643
+ "881",
1644
+ "882",
1645
+ "883",
1646
+ "884",
1647
+ "885",
1648
+ "886",
1649
+ "887",
1650
+ "888",
1651
+ "889"
1652
+ ], I = (l) => l.replace(/\D/g, ""), D = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), N = (l) => {
1653
+ const t = I(l);
1654
+ if (t.charAt(0) === "1") {
1655
+ const e = t.substr(1, 3);
1656
+ return z.indexOf(e) !== -1;
1657
+ }
1658
+ return !1;
1659
+ }, $ = (l, t, e, i) => {
1660
+ if (e === 0 && !i)
1661
+ return 0;
1662
+ let s = 0;
1663
+ for (let n = 0; n < t.length; n++) {
1664
+ if (/[+0-9]/.test(t[n]) && s++, s === l && !i)
1665
+ return n + 1;
1666
+ if (i && s === l + 1)
1667
+ return n;
1668
+ }
1669
+ return t.length;
1670
+ }, m = (l, t, e) => {
1671
+ const i = document.createElement(l);
1672
+ return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
1673
+ }, _ = (l) => {
1674
+ const { instances: t } = r;
1675
+ Object.values(t).forEach((e) => e[l]());
1676
+ };
1677
+ class j {
1678
+ constructor(t, e = {}) {
1679
+ this.id = R++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, S, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
1680
+ }
1681
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
1682
+ _init() {
1683
+ this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1, this.options.countrySearch = !0), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]");
1684
+ const t = this.options.allowDropdown || this.options.separateDialCode;
1685
+ this.showSelectedCountryOnLeft = this.isRTL ? !t : t, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...A, ...this.options.i18n };
1686
+ const e = new Promise((s, n) => {
1687
+ this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = n;
1688
+ }), i = new Promise((s, n) => {
1689
+ this.resolveUtilsScriptPromise = s, this.rejectUtilsScriptPromise = n;
1690
+ });
1691
+ this.promise = Promise.all([e, i]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
1692
+ }
1693
+ //********************
1694
+ //* PRIVATE METHODS
1695
+ //********************
1696
+ //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
1697
+ _processCountryData() {
1698
+ this._processAllCountries(), this._processDialCodes(), this._translateCountryNames(), this._sortCountries();
1699
+ }
1700
+ //* Sort countries by countryOrder option (if present), then name.
1701
+ _sortCountries() {
1702
+ this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((t) => t.toLowerCase())), this.countries.sort((t, e) => {
1703
+ const { countryOrder: i } = this.options;
1704
+ if (i) {
1705
+ const s = i.indexOf(t.iso2), n = i.indexOf(e.iso2), a = s > -1, o = n > -1;
1706
+ if (a || o)
1707
+ return a && o ? s - n : a ? -1 : 1;
1708
+ }
1709
+ return t.name.localeCompare(e.name);
1710
+ });
1711
+ }
1712
+ //* Add a dial code to this.dialCodeToIso2Map.
1713
+ _addToDialCodeMap(t, e, i) {
1714
+ e.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = e.length), this.dialCodeToIso2Map.hasOwnProperty(e) || (this.dialCodeToIso2Map[e] = []);
1715
+ for (let n = 0; n < this.dialCodeToIso2Map[e].length; n++)
1716
+ if (this.dialCodeToIso2Map[e][n] === t)
1717
+ return;
1718
+ const s = i !== void 0 ? i : this.dialCodeToIso2Map[e].length;
1719
+ this.dialCodeToIso2Map[e][s] = t;
1720
+ }
1721
+ //* Process onlyCountries or excludeCountries array if present.
1722
+ _processAllCountries() {
1723
+ const { onlyCountries: t, excludeCountries: e } = this.options;
1724
+ if (t.length) {
1725
+ const i = t.map(
1726
+ (s) => s.toLowerCase()
1727
+ );
1728
+ this.countries = g.filter(
1729
+ (s) => i.indexOf(s.iso2) > -1
1730
+ );
1731
+ } else if (e.length) {
1732
+ const i = e.map(
1733
+ (s) => s.toLowerCase()
1734
+ );
1735
+ this.countries = g.filter(
1736
+ (s) => i.indexOf(s.iso2) === -1
1737
+ );
1738
+ } else
1739
+ this.countries = g;
1740
+ }
1741
+ //* Translate Countries by object literal provided on config.
1742
+ _translateCountryNames() {
1743
+ for (let t = 0; t < this.countries.length; t++) {
1744
+ const e = this.countries[t].iso2.toLowerCase();
1745
+ this.options.i18n.hasOwnProperty(e) && (this.countries[t].name = this.options.i18n[e]);
1746
+ }
1747
+ }
1748
+ //* Generate this.dialCodes and this.dialCodeToIso2Map.
1749
+ _processDialCodes() {
1750
+ this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
1751
+ for (let t = 0; t < this.countries.length; t++) {
1752
+ const e = this.countries[t];
1753
+ this.dialCodes[e.dialCode] || (this.dialCodes[e.dialCode] = !0), this._addToDialCodeMap(e.iso2, e.dialCode, e.priority);
1754
+ }
1755
+ for (let t = 0; t < this.countries.length; t++) {
1756
+ const e = this.countries[t];
1757
+ if (e.areaCodes) {
1758
+ const i = this.dialCodeToIso2Map[e.dialCode][0];
1759
+ for (let s = 0; s < e.areaCodes.length; s++) {
1760
+ const n = e.areaCodes[s];
1761
+ for (let a = 1; a < n.length; a++) {
1762
+ const o = e.dialCode + n.substr(0, a);
1763
+ this._addToDialCodeMap(i, o), this._addToDialCodeMap(e.iso2, o);
1764
+ }
1765
+ this._addToDialCodeMap(e.iso2, e.dialCode + n);
1766
+ }
1767
+ }
1768
+ }
1769
+ }
1770
+ //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
1771
+ _generateMarkup() {
1772
+ var d;
1773
+ this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
1774
+ const {
1775
+ allowDropdown: t,
1776
+ separateDialCode: e,
1777
+ showFlags: i,
1778
+ containerClass: s,
1779
+ hiddenInput: n,
1780
+ dropdownContainer: a,
1781
+ fixDropdownWidth: o,
1782
+ useFullscreenPopup: u,
1783
+ countrySearch: p,
1784
+ i18n: h
1785
+ } = this.options;
1786
+ let c = "iti";
1787
+ t && (c += " iti--allow-dropdown"), i && (c += " iti--show-flags"), s && (c += ` ${s}`), u || (c += " iti--inline-dropdown");
1788
+ const C = m("div", { class: c });
1789
+ if ((d = this.telInput.parentNode) == null || d.insertBefore(C, this.telInput), t || i || e) {
1790
+ this.countryContainer = m(
1791
+ "div",
1792
+ {
1793
+ class: "iti__country-container",
1794
+ style: this.showSelectedCountryOnLeft ? "left: 0" : "right: 0"
1795
+ },
1796
+ C
1797
+ ), t ? (this.selectedCountry = m(
1798
+ "button",
1799
+ {
1800
+ type: "button",
1801
+ class: "iti__selected-country",
1802
+ "aria-expanded": "false",
1803
+ "aria-label": this.options.i18n.selectedCountryAriaLabel,
1804
+ "aria-haspopup": "true",
1805
+ "aria-controls": `iti-${this.id}__dropdown-content`,
1806
+ role: "combobox"
1807
+ },
1808
+ this.countryContainer
1809
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
1810
+ "div",
1811
+ { class: "iti__selected-country" },
1812
+ this.countryContainer
1813
+ );
1814
+ const y = m("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
1815
+ if (this.selectedCountryInner = m("div", { class: "iti__flag" }, y), this.selectedCountryA11yText = m(
1816
+ "span",
1817
+ { class: "iti__a11y-text" },
1818
+ this.selectedCountryInner
1819
+ ), t && (this.dropdownArrow = m(
1820
+ "div",
1821
+ { class: "iti__arrow", "aria-hidden": "true" },
1822
+ y
1823
+ )), e && (this.selectedDialCode = m(
1824
+ "div",
1825
+ { class: "iti__selected-dial-code" },
1826
+ this.selectedCountry
1827
+ )), t) {
1828
+ const f = o ? "" : "iti--flexible-dropdown-width";
1829
+ if (this.dropdownContent = m("div", {
1830
+ id: `iti-${this.id}__dropdown-content`,
1831
+ class: `iti__dropdown-content iti__hide ${f}`
1832
+ }), p && (this.searchInput = m(
1833
+ "input",
1834
+ {
1835
+ type: "text",
1836
+ class: "iti__search-input",
1837
+ placeholder: h.searchPlaceholder,
1838
+ role: "combobox",
1839
+ "aria-expanded": "true",
1840
+ "aria-label": h.searchPlaceholder,
1841
+ "aria-controls": `iti-${this.id}__country-listbox`,
1842
+ "aria-autocomplete": "list",
1843
+ autocomplete: "off"
1844
+ },
1845
+ this.dropdownContent
1846
+ ), this.searchResultsA11yText = m(
1847
+ "span",
1848
+ { class: "iti__a11y-text" },
1849
+ this.dropdownContent
1850
+ )), this.countryList = m(
1851
+ "ul",
1852
+ {
1853
+ class: "iti__country-list",
1854
+ id: `iti-${this.id}__country-listbox`,
1855
+ role: "listbox",
1856
+ "aria-label": h.countryListAriaLabel
1857
+ },
1858
+ this.dropdownContent
1859
+ ), this._appendListItems(), p && this._updateSearchResultsText(), a) {
1860
+ let b = "iti iti--container";
1861
+ u ? b += " iti--fullscreen-popup" : b += " iti--inline-dropdown", this.dropdown = m("div", { class: b }), this.dropdown.appendChild(this.dropdownContent);
1862
+ } else
1863
+ this.countryContainer.appendChild(this.dropdownContent);
1864
+ }
1865
+ }
1866
+ if (C.appendChild(this.telInput), this._updateInputPadding(), n) {
1867
+ const y = this.telInput.getAttribute("name") || "", f = n(y);
1868
+ f.phone && (this.hiddenInput = m("input", {
1869
+ type: "hidden",
1870
+ name: f.phone
1871
+ }), C.appendChild(this.hiddenInput)), f.country && (this.hiddenInputCountry = m("input", {
1872
+ type: "hidden",
1873
+ name: f.country
1874
+ }), C.appendChild(this.hiddenInputCountry));
1875
+ }
1876
+ }
1877
+ //* For each country: add a country list item <li> to the countryList <ul> container.
1878
+ _appendListItems() {
1879
+ for (let t = 0; t < this.countries.length; t++) {
1880
+ const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = m(
1881
+ "li",
1882
+ {
1883
+ id: `iti-${this.id}__item-${e.iso2}`,
1884
+ class: `iti__country ${i}`,
1885
+ tabindex: "-1",
1886
+ role: "option",
1887
+ "data-dial-code": e.dialCode,
1888
+ "data-country-code": e.iso2,
1889
+ "aria-selected": "false"
1890
+ },
1891
+ this.countryList
1892
+ );
1893
+ e.nodeById[this.id] = s;
1894
+ let n = "";
1895
+ this.options.showFlags && (n += `<div class='iti__flag iti__${e.iso2}'></div>`), n += `<span class='iti__country-name'>${e.name}</span>`, n += `<span class='iti__dial-code'>+${e.dialCode}</span>`, s.insertAdjacentHTML("beforeend", n);
1896
+ }
1897
+ }
1898
+ //* Set the initial state of the input value and the selected country by:
1899
+ //* 1. Extracting a dial code from the given number
1900
+ //* 2. Using explicit initialCountry
1901
+ _setInitialState(t = !1) {
1902
+ const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, a = this._getDialCode(n), o = N(n), { initialCountry: u, geoIpLookup: p } = this.options, h = u === "auto" && p;
1903
+ if (a && !o)
1904
+ this._updateCountryFromNumber(n);
1905
+ else if (!h || t) {
1906
+ const c = u ? u.toLowerCase() : "";
1907
+ c && this._getCountryData(c, !0) ? this._setCountry(c) : a && o ? this._setCountry("us") : this._setCountry();
1908
+ }
1909
+ n && this._updateValFromNumber(n);
1910
+ }
1911
+ //* Initialise the main event listeners: input keyup, and click selected country.
1912
+ _initListeners() {
1913
+ this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.hiddenInput || this.hiddenInputCountry) && this.telInput.form && this._initHiddenInputListener();
1914
+ }
1915
+ //* Update hidden input on form submit.
1916
+ _initHiddenInputListener() {
1917
+ var t;
1918
+ this._handleHiddenInputSubmit = () => {
1919
+ this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
1920
+ }, (t = this.telInput.form) == null || t.addEventListener(
1921
+ "submit",
1922
+ this._handleHiddenInputSubmit
1923
+ );
1924
+ }
1925
+ //* initialise the dropdown listeners.
1926
+ _initDropdownListeners() {
1927
+ this._handleLabelClick = (e) => {
1928
+ this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : e.preventDefault();
1929
+ };
1930
+ const t = this.telInput.closest("label");
1931
+ t && t.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
1932
+ this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
1933
+ }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (e) => {
1934
+ this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(e.key) && (e.preventDefault(), e.stopPropagation(), this._openDropdown()), e.key === "Tab" && this._closeDropdown();
1935
+ }, this.countryContainer.addEventListener(
1936
+ "keydown",
1937
+ this._handleCountryContainerKeydown
1938
+ );
1939
+ }
1940
+ //* Init many requests: utils script / geo ip lookup.
1941
+ _initRequests() {
1942
+ const { utilsScript: t, initialCountry: e, geoIpLookup: i } = this.options;
1943
+ t && !r.utils ? r.documentReady() ? r.loadUtils(t) : window.addEventListener("load", () => {
1944
+ r.loadUtils(t);
1945
+ }) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
1946
+ }
1947
+ //* Perform the geo ip lookup.
1948
+ _loadAutoCountry() {
1949
+ r.autoCountry ? this.handleAutoCountry() : r.startedLoadingAutoCountry || (r.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
1950
+ (t = "") => {
1951
+ const e = t.toLowerCase();
1952
+ e && this._getCountryData(e, !0) ? (r.autoCountry = e, setTimeout(() => _("handleAutoCountry"))) : (this._setInitialState(!0), _("rejectAutoCountryPromise"));
1953
+ },
1954
+ () => {
1955
+ this._setInitialState(!0), _("rejectAutoCountryPromise");
1956
+ }
1957
+ ));
1958
+ }
1959
+ _openDropdownWithPlus() {
1960
+ this._openDropdown(), this.searchInput.value = "+", this._filterCountries("", !0);
1961
+ }
1962
+ //* Initialize the tel input listeners.
1963
+ _initTelInputListeners() {
1964
+ const { strictMode: t, formatAsYouType: e, separateDialCode: i, formatOnDisplay: s, allowDropdown: n } = this.options;
1965
+ let a = !1;
1966
+ new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (o) => {
1967
+ if (this.isAndroid && (o == null ? void 0 : o.data) === "+" && i && n) {
1968
+ const c = this.telInput.selectionStart || 0, C = this.telInput.value.substring(0, c - 1), d = this.telInput.value.substring(c);
1969
+ this.telInput.value = C + d, this._openDropdownWithPlus();
1970
+ return;
1971
+ }
1972
+ this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
1973
+ const u = (o == null ? void 0 : o.data) && /[^+0-9]/.test(o.data), p = (o == null ? void 0 : o.inputType) === "insertFromPaste" && this.telInput.value;
1974
+ u || p && !t ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
1975
+ const h = (o == null ? void 0 : o.detail) && o.detail.isSetNumber && !s;
1976
+ if (e && !a && !h) {
1977
+ const c = this.telInput.selectionStart || 0, d = this.telInput.value.substring(0, c).replace(/[^+0-9]/g, "").length, y = (o == null ? void 0 : o.inputType) === "deleteContentForward", f = this._formatNumberAsYouType(), b = $(d, f, c, y);
1978
+ this.telInput.value = f, this.telInput.setSelectionRange(b, b);
1979
+ }
1980
+ }, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (o) => {
1981
+ if (o.key && o.key.length === 1 && !o.altKey && !o.ctrlKey && !o.metaKey) {
1982
+ if (i && n && o.key === "+") {
1983
+ o.preventDefault(), this._openDropdownWithPlus();
1984
+ return;
1985
+ }
1986
+ if (t) {
1987
+ const u = this.telInput.selectionStart === 0 && o.key === "+", p = /^[0-9]$/.test(o.key), h = i ? p : u || p, c = this._getFullNumber(), C = r.utils.getCoreNumber(c, this.selectedCountryData.iso2), d = this.maxCoreNumberLength && C.length >= this.maxCoreNumberLength, y = this.telInput.value.substring(this.telInput.selectionStart, this.telInput.selectionEnd), f = /\d/.test(y);
1988
+ (!h || d && !f) && o.preventDefault();
1989
+ }
1990
+ }
1991
+ }, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
1992
+ }
1993
+ //* Adhere to the input's maxlength attr.
1994
+ _cap(t) {
1995
+ const e = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
1996
+ return e && t.length > e ? t.substr(0, e) : t;
1997
+ }
1998
+ //* Trigger a custom event on the input.
1999
+ _trigger(t, e = {}) {
2000
+ const i = new CustomEvent(t, {
2001
+ bubbles: !0,
2002
+ cancelable: !0,
2003
+ detail: e
2004
+ });
2005
+ this.telInput.dispatchEvent(i);
2006
+ }
2007
+ //* Open the dropdown.
2008
+ _openDropdown() {
2009
+ const { fixDropdownWidth: t, countrySearch: e } = this.options;
2010
+ if (t && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), e) {
2011
+ const i = this.countryList.firstElementChild;
2012
+ i && (this._highlightListItem(i, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
2013
+ }
2014
+ this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
2015
+ }
2016
+ //* Set the dropdown position
2017
+ _setDropdownPosition() {
2018
+ if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
2019
+ const t = this.telInput.getBoundingClientRect(), e = this.telInput.offsetHeight;
2020
+ this.options.dropdownContainer && (this.dropdown.style.top = `${t.top + e}px`, this.dropdown.style.left = `${t.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
2021
+ }
2022
+ }
2023
+ //* We only bind dropdown listeners when the dropdown is open.
2024
+ _bindDropdownListeners() {
2025
+ this._handleMouseoverCountryList = (s) => {
2026
+ var a;
2027
+ const n = (a = s.target) == null ? void 0 : a.closest(".iti__country");
2028
+ n && this._highlightListItem(n, !1);
2029
+ }, this.countryList.addEventListener(
2030
+ "mouseover",
2031
+ this._handleMouseoverCountryList
2032
+ ), this._handleClickCountryList = (s) => {
2033
+ var a;
2034
+ const n = (a = s.target) == null ? void 0 : a.closest(".iti__country");
2035
+ n && this._selectListItem(n);
2036
+ }, this.countryList.addEventListener("click", this._handleClickCountryList);
2037
+ let t = !0;
2038
+ this._handleClickOffToClose = () => {
2039
+ t || this._closeDropdown(), t = !1;
2040
+ }, document.documentElement.addEventListener(
2041
+ "click",
2042
+ this._handleClickOffToClose
2043
+ );
2044
+ let e = "", i = null;
2045
+ if (this._handleKeydownOnDropdown = (s) => {
2046
+ ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(s.key) && (s.preventDefault(), s.stopPropagation(), s.key === "ArrowUp" || s.key === "ArrowDown" ? this._handleUpDownKey(s.key) : s.key === "Enter" ? this._handleEnterKey() : s.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key) && (s.stopPropagation(), i && clearTimeout(i), e += s.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2047
+ e = "";
2048
+ }, 1e3));
2049
+ }, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
2050
+ const s = () => {
2051
+ const a = this.searchInput.value.trim();
2052
+ a ? this._filterCountries(a) : this._filterCountries("", !0);
2053
+ };
2054
+ let n = null;
2055
+ this._handleSearchChange = () => {
2056
+ n && clearTimeout(n), n = setTimeout(() => {
2057
+ s(), n = null;
2058
+ }, 100);
2059
+ }, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", (a) => a.stopPropagation());
2060
+ }
2061
+ }
2062
+ //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2063
+ _searchForCountry(t) {
2064
+ for (let e = 0; e < this.countries.length; e++) {
2065
+ const i = this.countries[e];
2066
+ if (i.name.substr(0, t.length).toLowerCase() === t) {
2067
+ const n = i.nodeById[this.id];
2068
+ this._highlightListItem(n, !1), this._scrollTo(n);
2069
+ break;
2070
+ }
2071
+ }
2072
+ }
2073
+ //* Country search enabled: Filter the countries according to the search query.
2074
+ _filterCountries(t, e = !1) {
2075
+ let i = !0;
2076
+ this.countryList.innerHTML = "";
2077
+ const s = D(t);
2078
+ for (let n = 0; n < this.countries.length; n++) {
2079
+ const a = this.countries[n], o = D(a.name), u = a.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((h) => h[0]).join("").toLowerCase(), p = `+${a.dialCode}`;
2080
+ if (e || o.includes(s) || p.includes(s) || a.iso2.includes(s) || u.includes(s)) {
2081
+ const h = a.nodeById[this.id];
2082
+ h && this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1);
2083
+ }
2084
+ }
2085
+ i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
2086
+ }
2087
+ //* Update search results text (for a11y).
2088
+ _updateSearchResultsText() {
2089
+ const { i18n: t } = this.options, e = this.countryList.childElementCount;
2090
+ let i;
2091
+ e === 0 ? i = t.zeroSearchResults : e === 1 ? i = t.oneSearchResult : i = t.multipleSearchResults.replace("${count}", e.toString()), this.searchResultsA11yText.textContent = i;
2092
+ }
2093
+ //* Highlight the next/prev item in the list (and ensure it is visible).
2094
+ _handleUpDownKey(t) {
2095
+ var i, s;
2096
+ let e = t === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.highlightedItem) == null ? void 0 : s.nextElementSibling;
2097
+ !e && this.countryList.childElementCount > 1 && (e = t === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), e && (this._scrollTo(e), this._highlightListItem(e, !1));
2098
+ }
2099
+ //* Select the currently highlighted item.
2100
+ _handleEnterKey() {
2101
+ this.highlightedItem && this._selectListItem(this.highlightedItem);
2102
+ }
2103
+ //* Update the input's value to the given val (format first if possible)
2104
+ //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2105
+ _updateValFromNumber(t) {
2106
+ let e = t;
2107
+ if (this.options.formatOnDisplay && r.utils && this.selectedCountryData) {
2108
+ const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = r.utils.numberFormat, a = i ? s : n;
2109
+ e = r.utils.formatNumber(
2110
+ e,
2111
+ this.selectedCountryData.iso2,
2112
+ a
2113
+ );
2114
+ }
2115
+ e = this._beforeSetNumber(e), this.telInput.value = e;
2116
+ }
2117
+ //* Check if need to select a new country based on the given number
2118
+ //* Note: called from _setInitialState, keyup handler, setNumber.
2119
+ _updateCountryFromNumber(t) {
2120
+ const e = t.indexOf("+");
2121
+ let i = e ? t.substring(e) : t;
2122
+ const s = this.selectedCountryData.dialCode;
2123
+ i && s === "1" && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = `1${i}`), i = `+${i}`), this.options.separateDialCode && s && i.charAt(0) !== "+" && (i = `+${s}${i}`);
2124
+ const a = this._getDialCode(i, !0), o = I(i);
2125
+ let u = null;
2126
+ if (a) {
2127
+ const p = this.dialCodeToIso2Map[I(a)], h = p.indexOf(this.selectedCountryData.iso2) !== -1 && o.length <= a.length - 1;
2128
+ if (!(s === "1" && N(o)) && !h) {
2129
+ for (let C = 0; C < p.length; C++)
2130
+ if (p[C]) {
2131
+ u = p[C];
2132
+ break;
2133
+ }
2134
+ }
2135
+ } else i.charAt(0) === "+" && o.length ? u = "" : (!i || i === "+") && !this.selectedCountryData.iso2 && (u = this.defaultCountry);
2136
+ return u !== null ? this._setCountry(u) : !1;
2137
+ }
2138
+ //* Remove highlighting from other list items and highlight the given item.
2139
+ _highlightListItem(t, e) {
2140
+ const i = this.highlightedItem;
2141
+ if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = t, this.highlightedItem) {
2142
+ this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
2143
+ const s = this.highlightedItem.getAttribute("id") || "";
2144
+ this.selectedCountry.setAttribute("aria-activedescendant", s), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", s);
2145
+ }
2146
+ e && this.highlightedItem.focus();
2147
+ }
2148
+ //* Find the country data for the given iso2 code
2149
+ //* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
2150
+ _getCountryData(t, e) {
2151
+ for (let i = 0; i < this.countries.length; i++)
2152
+ if (this.countries[i].iso2 === t)
2153
+ return this.countries[i];
2154
+ if (e)
2155
+ return null;
2156
+ throw new Error(`No country data for '${t}'`);
2157
+ }
2158
+ //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
2159
+ //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2160
+ _setCountry(t) {
2161
+ const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
2162
+ if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
2163
+ let a = "", o = "";
2164
+ t && i ? (a = `iti__flag iti__${t}`, o = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (a = "iti__flag iti__globe", o = s.noCountrySelected), this.selectedCountryInner.className = a, this.selectedCountryA11yText.textContent = o;
2165
+ }
2166
+ if (this._setSelectedCountryTitleAttribute(t, e), e) {
2167
+ const a = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2168
+ this.selectedDialCode.innerHTML = a, this._updateInputPadding();
2169
+ }
2170
+ return this._updatePlaceholder(), this._updateMaxLength(), n.iso2 !== t;
2171
+ }
2172
+ //* Update the input padding to make space for the selected country/dial code.
2173
+ _updateInputPadding() {
2174
+ if (this.selectedCountry) {
2175
+ const e = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
2176
+ this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${e}px` : this.telInput.style.paddingRight = `${e}px`;
2177
+ }
2178
+ }
2179
+ //* Update the maximum valid number length for the currently selected country.
2180
+ _updateMaxLength() {
2181
+ const { strictMode: t, placeholderNumberType: e, validationNumberType: i } = this.options;
2182
+ if (t && r.utils)
2183
+ if (this.selectedCountryData.iso2) {
2184
+ const s = r.utils.numberType[e];
2185
+ let n = r.utils.getExampleNumber(
2186
+ this.selectedCountryData.iso2,
2187
+ !1,
2188
+ s,
2189
+ !0
2190
+ ), a = n;
2191
+ for (; r.utils.isPossibleNumber(n, this.selectedCountryData.iso2, i); )
2192
+ a = n, n += "0";
2193
+ const o = r.utils.getCoreNumber(a, this.selectedCountryData.iso2);
2194
+ this.maxCoreNumberLength = o.length;
2195
+ } else
2196
+ this.maxCoreNumberLength = null;
2197
+ }
2198
+ _setSelectedCountryTitleAttribute(t = null, e) {
2199
+ if (!this.selectedCountry)
2200
+ return;
2201
+ let i;
2202
+ t && !e ? i = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : t ? i = this.selectedCountryData.name : i = "Unknown", this.selectedCountry.setAttribute("title", i);
2203
+ }
2204
+ //* When the input is in a hidden container during initialisation, we must inject some markup
2205
+ //* into the end of the DOM to calculate the correct offsetWidth.
2206
+ //* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
2207
+ //* will definitely exist.
2208
+ _getHiddenSelectedCountryWidth() {
2209
+ if (this.telInput.parentNode) {
2210
+ const t = this.telInput.parentNode.cloneNode(!1);
2211
+ t.style.visibility = "hidden", document.body.appendChild(t);
2212
+ const e = this.countryContainer.cloneNode();
2213
+ t.appendChild(e);
2214
+ const i = this.selectedCountry.cloneNode(!0);
2215
+ e.appendChild(i);
2216
+ const s = i.offsetWidth;
2217
+ return document.body.removeChild(t), s;
2218
+ }
2219
+ return 0;
2220
+ }
2221
+ //* Update the input placeholder to an example number from the currently selected country.
2222
+ _updatePlaceholder() {
2223
+ const {
2224
+ autoPlaceholder: t,
2225
+ placeholderNumberType: e,
2226
+ nationalMode: i,
2227
+ customPlaceholder: s
2228
+ } = this.options, n = t === "aggressive" || !this.hadInitialPlaceholder && t === "polite";
2229
+ if (r.utils && n) {
2230
+ const a = r.utils.numberType[e];
2231
+ let o = this.selectedCountryData.iso2 ? r.utils.getExampleNumber(
2232
+ this.selectedCountryData.iso2,
2233
+ i,
2234
+ a
2235
+ ) : "";
2236
+ o = this._beforeSetNumber(o), typeof s == "function" && (o = s(o, this.selectedCountryData)), this.telInput.setAttribute("placeholder", o);
2237
+ }
2238
+ }
2239
+ //* Called when the user selects a list item from the dropdown.
2240
+ _selectListItem(t) {
2241
+ const e = this._setCountry(
2242
+ t.getAttribute("data-country-code")
2243
+ );
2244
+ this._closeDropdown(), this._updateDialCode(t.getAttribute("data-dial-code")), this.telInput.focus(), e && this._triggerCountryChange();
2245
+ }
2246
+ //* Close the dropdown and unbind any listeners.
2247
+ _closeDropdown() {
2248
+ this.dropdownContent.classList.add("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "false"), this.selectedCountry.removeAttribute("aria-activedescendant"), this.highlightedItem && this.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.searchInput.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), document.removeEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch && this.searchInput.removeEventListener("input", this._handleSearchChange), document.documentElement.removeEventListener(
2249
+ "click",
2250
+ this._handleClickOffToClose
2251
+ ), this.countryList.removeEventListener(
2252
+ "mouseover",
2253
+ this._handleMouseoverCountryList
2254
+ ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
2255
+ }
2256
+ //* Check if an element is visible within it's container, else scroll until it is.
2257
+ _scrollTo(t) {
2258
+ const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, a = n + s, o = t.offsetHeight, u = t.getBoundingClientRect().top + i, p = u + o, h = u - n + e.scrollTop;
2259
+ if (u < n)
2260
+ e.scrollTop = h;
2261
+ else if (p > a) {
2262
+ const c = s - o;
2263
+ e.scrollTop = h - c;
2264
+ }
2265
+ }
2266
+ //* Replace any existing dial code with the new one
2267
+ //* Note: called from _selectListItem and setCountry
2268
+ _updateDialCode(t) {
2269
+ const e = this.telInput.value, i = `+${t}`;
2270
+ let s;
2271
+ if (e.charAt(0) === "+") {
2272
+ const n = this._getDialCode(e);
2273
+ n ? s = e.replace(n, i) : s = i, this.telInput.value = s;
2274
+ }
2275
+ }
2276
+ //* Try and extract a valid international dial code from a full telephone number.
2277
+ //* Note: returns the raw string inc plus character and any whitespace/dots etc.
2278
+ _getDialCode(t, e) {
2279
+ let i = "";
2280
+ if (t.charAt(0) === "+") {
2281
+ let s = "";
2282
+ for (let n = 0; n < t.length; n++) {
2283
+ const a = t.charAt(n);
2284
+ if (!isNaN(parseInt(a, 10))) {
2285
+ if (s += a, e)
2286
+ this.dialCodeToIso2Map[s] && (i = t.substr(0, n + 1));
2287
+ else if (this.dialCodes[s]) {
2288
+ i = t.substr(0, n + 1);
2289
+ break;
2290
+ }
2291
+ if (s.length === this.dialCodeMaxLen)
2292
+ break;
2293
+ }
2294
+ }
2295
+ }
2296
+ return i;
2297
+ }
2298
+ //* Get the input val, adding the dial code if separateDialCode is enabled.
2299
+ _getFullNumber() {
2300
+ const t = this.telInput.value.trim(), { dialCode: e } = this.selectedCountryData;
2301
+ let i;
2302
+ const s = I(t);
2303
+ return this.options.separateDialCode && t.charAt(0) !== "+" && e && s ? i = `+${e}` : i = "", i + t;
2304
+ }
2305
+ //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
2306
+ _beforeSetNumber(t) {
2307
+ let e = t;
2308
+ if (this.options.separateDialCode) {
2309
+ let i = this._getDialCode(e);
2310
+ if (i) {
2311
+ i = `+${this.selectedCountryData.dialCode}`;
2312
+ const s = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
2313
+ e = e.substr(s);
2314
+ }
2315
+ }
2316
+ return this._cap(e);
2317
+ }
2318
+ //* Trigger the 'countrychange' event.
2319
+ _triggerCountryChange() {
2320
+ this._trigger("countrychange");
2321
+ }
2322
+ //* Format the number as the user types.
2323
+ _formatNumberAsYouType() {
2324
+ const t = this._getFullNumber(), e = r.utils ? r.utils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, { dialCode: i } = this.selectedCountryData;
2325
+ return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && e.includes(`+${i}`) ? (e.split(`+${i}`)[1] || "").trim() : e;
2326
+ }
2327
+ //**************************
2328
+ //* SECRET PUBLIC METHODS
2329
+ //**************************
2330
+ //* This is called when the geoip call returns.
2331
+ handleAutoCountry() {
2332
+ this.options.initialCountry === "auto" && r.autoCountry && (this.defaultCountry = r.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2333
+ }
2334
+ //* This is called when the utils request completes.
2335
+ handleUtils() {
2336
+ r.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
2337
+ }
2338
+ //********************
2339
+ //* PUBLIC METHODS
2340
+ //********************
2341
+ //* Remove plugin.
2342
+ destroy() {
2343
+ var n, a;
2344
+ const { allowDropdown: t, separateDialCode: e } = this.options;
2345
+ if (t) {
2346
+ this._closeDropdown(), this.selectedCountry.removeEventListener(
2347
+ "click",
2348
+ this._handleClickSelectedCountry
2349
+ ), this.countryContainer.removeEventListener(
2350
+ "keydown",
2351
+ this._handleCountryContainerKeydown
2352
+ );
2353
+ const o = this.telInput.closest("label");
2354
+ o && o.removeEventListener("click", this._handleLabelClick);
2355
+ }
2356
+ const { form: i } = this.telInput;
2357
+ this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), e && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
2358
+ const s = this.telInput.parentNode;
2359
+ (n = s == null ? void 0 : s.parentNode) == null || n.insertBefore(this.telInput, s), (a = s == null ? void 0 : s.parentNode) == null || a.removeChild(s), delete r.instances[this.id];
2360
+ }
2361
+ //* Get the extension from the current number.
2362
+ getExtension() {
2363
+ return r.utils ? r.utils.getExtension(
2364
+ this._getFullNumber(),
2365
+ this.selectedCountryData.iso2
2366
+ ) : "";
2367
+ }
2368
+ //* Format the number to the given format.
2369
+ getNumber(t) {
2370
+ if (r.utils) {
2371
+ const { iso2: e } = this.selectedCountryData;
2372
+ return r.utils.formatNumber(
2373
+ this._getFullNumber(),
2374
+ e,
2375
+ t
2376
+ );
2377
+ }
2378
+ return "";
2379
+ }
2380
+ //* Get the type of the entered number e.g. landline/mobile.
2381
+ getNumberType() {
2382
+ return r.utils ? r.utils.getNumberType(
2383
+ this._getFullNumber(),
2384
+ this.selectedCountryData.iso2
2385
+ ) : -99;
2386
+ }
2387
+ //* Get the country data for the currently selected country.
2388
+ getSelectedCountryData() {
2389
+ return this.selectedCountryData;
2390
+ }
2391
+ //* Get the validation error.
2392
+ getValidationError() {
2393
+ if (r.utils) {
2394
+ const { iso2: t } = this.selectedCountryData;
2395
+ return r.utils.getValidationError(this._getFullNumber(), t);
2396
+ }
2397
+ return -99;
2398
+ }
2399
+ //* Validate the input val
2400
+ isValidNumber() {
2401
+ if (!this.selectedCountryData.iso2)
2402
+ return !1;
2403
+ const t = this._getFullNumber(), e = t.search(new RegExp("\\p{L}", "u"));
2404
+ if (e > -1) {
2405
+ const i = t.substring(0, e), s = this._utilsIsPossibleNumber(i), n = this._utilsIsPossibleNumber(t);
2406
+ return s && n;
2407
+ }
2408
+ return this._utilsIsPossibleNumber(t);
2409
+ }
2410
+ _utilsIsPossibleNumber(t) {
2411
+ return r.utils ? r.utils.isPossibleNumber(t, this.selectedCountryData.iso2, this.options.validationNumberType) : null;
2412
+ }
2413
+ //* Validate the input val (precise)
2414
+ isValidNumberPrecise() {
2415
+ if (!this.selectedCountryData.iso2)
2416
+ return !1;
2417
+ const t = this._getFullNumber(), e = t.search(new RegExp("\\p{L}", "u"));
2418
+ if (e > -1) {
2419
+ const i = t.substring(0, e), s = this._utilsIsValidNumber(i), n = this._utilsIsValidNumber(t);
2420
+ return s && n;
2421
+ }
2422
+ return this._utilsIsValidNumber(t);
2423
+ }
2424
+ _utilsIsValidNumber(t) {
2425
+ return r.utils ? r.utils.isValidNumber(t, this.selectedCountryData.iso2) : null;
2426
+ }
2427
+ //* Update the selected country, and update the input val accordingly.
2428
+ setCountry(t) {
2429
+ const e = t == null ? void 0 : t.toLowerCase(), i = this.selectedCountryData.iso2;
2430
+ (t && e !== i || !t && i) && (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
2431
+ }
2432
+ //* Set the input value and update the country.
2433
+ setNumber(t) {
2434
+ const e = this._updateCountryFromNumber(t);
2435
+ this._updateValFromNumber(t), e && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
2436
+ }
2437
+ //* Set the placeholder number typ
2438
+ setPlaceholderNumberType(t) {
2439
+ this.options.placeholderNumberType = t, this._updatePlaceholder();
2440
+ }
2441
+ setDisabled(t) {
2442
+ this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
2443
+ }
2444
+ }
2445
+ const K = (l) => !r.utils && !r.startedLoadingUtilsScript ? (r.startedLoadingUtilsScript = !0, new Promise((t, e) => {
2446
+ import(
2447
+ /* webpackIgnore: true */
2448
+ /* @vite-ignore */
2449
+ l
2450
+ ).then(({ default: i }) => {
2451
+ r.utils = i, _("handleUtils"), t(!0);
2452
+ }).catch(() => {
2453
+ _("rejectUtilsScriptPromise"), e();
2454
+ });
2455
+ })) : null, r = Object.assign(
2456
+ (l, t) => {
2457
+ const e = new j(l, t);
2458
+ return e._init(), l.setAttribute("data-intl-tel-input-id", e.id.toString()), r.instances[e.id] = e, e;
2459
+ },
2460
+ {
2461
+ defaults: S,
2462
+ //* Using a static var like this allows us to mock it in the tests.
2463
+ documentReady: () => document.readyState === "complete",
2464
+ //* Get the country data object.
2465
+ getCountryData: () => g,
2466
+ //* A getter for the plugin instance.
2467
+ getInstance: (l) => {
2468
+ const t = l.getAttribute("data-intl-tel-input-id");
2469
+ return t ? r.instances[t] : null;
2470
+ },
2471
+ //* A map from instance ID to instance object.
2472
+ instances: {},
2473
+ loadUtils: K,
2474
+ version: process.env.VERSION
2475
+ }
2476
+ ), H = {
2477
+ __name: "IntlTelInput",
2478
+ props: /* @__PURE__ */ v({
2479
+ options: {
2480
+ type: Object,
2481
+ default: () => ({})
2482
+ },
2483
+ value: {
2484
+ type: String,
2485
+ default: ""
2486
+ },
2487
+ disabled: {
2488
+ type: Boolean
2489
+ }
2490
+ }, {
2491
+ modelValue: {
2492
+ type: String,
2493
+ default: ""
2494
+ },
2495
+ modelModifiers: {}
2496
+ }),
2497
+ emits: /* @__PURE__ */ v(["changeNumber", "changeCountry", "changeValidity", "changeErrorCode"], ["update:modelValue"]),
2498
+ setup(l, { expose: t, emit: e }) {
2499
+ const i = k(l, "modelValue"), s = l, n = e, a = w(), o = w(), u = w(!1), p = () => o.value ? s.options.strictMode ? o.value.isValidNumberPrecise() : o.value.isValidNumber() : null, h = () => {
2500
+ let d = p();
2501
+ u.value !== d && (u.value = d, n("changeValidity", !!d), n("changeErrorCode", d ? null : o.value.getValidationError()));
2502
+ }, c = () => {
2503
+ var d;
2504
+ n("changeNumber", ((d = o.value) == null ? void 0 : d.getNumber()) ?? ""), h();
2505
+ }, C = () => {
2506
+ var d;
2507
+ n("changeCountry", ((d = o.value) == null ? void 0 : d.getSelectedCountryData().iso2) ?? ""), c(), h();
2508
+ };
2509
+ return T(() => {
2510
+ a.value && (o.value = r(a.value, s.options), s.value && o.value.setNumber(s.value), s.disabled && o.value.setDisabled(s.disabled));
2511
+ }), P(
2512
+ () => s.disabled,
2513
+ (d) => {
2514
+ var y;
2515
+ return (y = o.value) == null ? void 0 : y.setDisabled(d);
2516
+ }
2517
+ ), x(() => {
2518
+ var d;
2519
+ return (d = o.value) == null ? void 0 : d.destroy();
2520
+ }), t({ instance: o, input: a }), (d, y) => E((M(), B("input", {
2521
+ ref_key: "input",
2522
+ ref: a,
2523
+ "onUpdate:modelValue": y[0] || (y[0] = (f) => i.value = f),
2524
+ type: "tel",
2525
+ onCountrychange: C,
2526
+ onInput: c
2527
+ }, null, 544)), [
2528
+ [O, i.value]
2529
+ ]);
2530
+ }
2531
+ };
2532
+ export {
2533
+ H as default
2534
+ };