intl-tel-input 25.14.1 → 25.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -19
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +1 -1
- package/angular/build/IntlTelInputWithUtils.js +125 -186
- package/build/css/intlTelInput-no-assets.css +1259 -0
- package/build/css/intlTelInput-no-assets.min.css +1 -0
- package/build/css/intlTelInput.css +6 -4
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/i18n/zh-hk/countries.js +245 -0
- package/build/js/i18n/zh-hk/index.js +5 -0
- package/build/js/i18n/zh-hk/interface.js +14 -0
- package/build/js/intlTelInput.js +2 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +126 -187
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +53 -54
- package/package.json +2 -2
- package/react/README.md +4 -2
- package/react/build/IntlTelInput.cjs +1 -1
- package/react/build/IntlTelInput.js +1 -1
- package/react/build/IntlTelInputWithUtils.cjs +125 -186
- package/react/build/IntlTelInputWithUtils.js +125 -186
- package/svelte/README.md +7 -9
- package/svelte/build/IntlTelInput.mjs +1329 -1329
- package/svelte/build/IntlTelInputWithUtils.mjs +1829 -1890
- package/vue/README.md +7 -9
- package/vue/build/IntlTelInput.mjs +1 -1
- package/vue/build/IntlTelInput.vue.d.ts +34 -0
- package/vue/build/IntlTelInputWithUtils.mjs +125 -186
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +34 -0
- package/vue/build/exports/IntlTelInput.d.ts +3 -0
- package/vue/build/exports/IntlTelInput.mjs +66 -0
- package/vue/build/exports/IntlTelInputWithUtils.d.ts +3 -0
- package/vue/build/exports/IntlTelInputWithUtils.mjs +6207 -0
- package/vue/build/intl-tel-input/data.d.ts +18 -0
- package/vue/build/intl-tel-input/i18n/ar/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/bg/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/bn/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/bs/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ca/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/cs/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/da/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/de/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ee/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/el/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/en/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/es/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/fa/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/fi/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/fr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/hi/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/hr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/hu/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/id/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/index.d.ts +43 -0
- package/vue/build/intl-tel-input/i18n/it/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ja/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ko/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/lt/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/mr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/nl/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/no/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/pl/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/pt/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ro/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ru/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sk/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sl/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sq/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/sv/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/te/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/th/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/tr/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/types.d.ts +10 -0
- package/vue/build/intl-tel-input/i18n/uk/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/ur/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/uz/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/vi/index.d.ts +3 -0
- package/vue/build/intl-tel-input/i18n/zh/index.d.ts +3 -0
- package/vue/build/intl-tel-input/intlTelInputWithUtils.d.ts +2 -0
- package/vue/build/intl-tel-input-f0-6rrpA.mjs +3081 -0
- package/vue/build/intl-tel-input.d.ts +97 -0
- package/vue/build/modules/constants.d.ts +85 -0
- package/vue/build/modules/core/countrySearch.d.ts +17 -0
- package/vue/build/modules/core/icons.d.ts +9 -0
- package/vue/build/modules/core/options.d.ts +3 -0
- package/vue/build/modules/core/ui.d.ts +45 -0
- package/vue/build/modules/data/country-data.d.ts +12 -0
- package/vue/build/modules/data/nanp-regionless.d.ts +2 -0
- package/vue/build/modules/format/caret.d.ts +1 -0
- package/vue/build/modules/format/formatting.d.ts +3 -0
- package/vue/build/modules/types/events.d.ts +9 -0
- package/vue/build/modules/types/public-api.d.ts +79 -0
- package/vue/build/modules/utils/dom.d.ts +6 -0
- package/vue/build/modules/utils/string.d.ts +2 -0
|
@@ -0,0 +1,3081 @@
|
|
|
1
|
+
const q = [
|
|
2
|
+
[
|
|
3
|
+
"af",
|
|
4
|
+
// Afghanistan
|
|
5
|
+
"93",
|
|
6
|
+
0,
|
|
7
|
+
null,
|
|
8
|
+
"0"
|
|
9
|
+
],
|
|
10
|
+
[
|
|
11
|
+
"ax",
|
|
12
|
+
// Åland Islands
|
|
13
|
+
"358",
|
|
14
|
+
1,
|
|
15
|
+
["18", "4"],
|
|
16
|
+
// (4 is a mobile range shared with FI)
|
|
17
|
+
"0"
|
|
18
|
+
],
|
|
19
|
+
[
|
|
20
|
+
"al",
|
|
21
|
+
// Albania
|
|
22
|
+
"355",
|
|
23
|
+
0,
|
|
24
|
+
null,
|
|
25
|
+
"0"
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"dz",
|
|
29
|
+
// Algeria
|
|
30
|
+
"213",
|
|
31
|
+
0,
|
|
32
|
+
null,
|
|
33
|
+
"0"
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"as",
|
|
37
|
+
// American Samoa
|
|
38
|
+
"1",
|
|
39
|
+
5,
|
|
40
|
+
["684"],
|
|
41
|
+
"1"
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"ad",
|
|
45
|
+
// Andorra
|
|
46
|
+
"376"
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
"ao",
|
|
50
|
+
// Angola
|
|
51
|
+
"244"
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"ai",
|
|
55
|
+
// Anguilla
|
|
56
|
+
"1",
|
|
57
|
+
6,
|
|
58
|
+
["264"],
|
|
59
|
+
"1"
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"ag",
|
|
63
|
+
// Antigua and Barbuda
|
|
64
|
+
"1",
|
|
65
|
+
7,
|
|
66
|
+
["268"],
|
|
67
|
+
"1"
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
"ar",
|
|
71
|
+
// Argentina
|
|
72
|
+
"54",
|
|
73
|
+
0,
|
|
74
|
+
null,
|
|
75
|
+
"0"
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"am",
|
|
79
|
+
// Armenia
|
|
80
|
+
"374",
|
|
81
|
+
0,
|
|
82
|
+
null,
|
|
83
|
+
"0"
|
|
84
|
+
],
|
|
85
|
+
[
|
|
86
|
+
"aw",
|
|
87
|
+
// Aruba
|
|
88
|
+
"297"
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
"ac",
|
|
92
|
+
// Ascension Island
|
|
93
|
+
"247"
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"au",
|
|
97
|
+
// Australia
|
|
98
|
+
"61",
|
|
99
|
+
0,
|
|
100
|
+
["4"],
|
|
101
|
+
// (mobile range shared with CX and CC)
|
|
102
|
+
"0"
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"at",
|
|
106
|
+
// Austria
|
|
107
|
+
"43",
|
|
108
|
+
0,
|
|
109
|
+
null,
|
|
110
|
+
"0"
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
"az",
|
|
114
|
+
// Azerbaijan
|
|
115
|
+
"994",
|
|
116
|
+
0,
|
|
117
|
+
null,
|
|
118
|
+
"0"
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
"bs",
|
|
122
|
+
// Bahamas
|
|
123
|
+
"1",
|
|
124
|
+
8,
|
|
125
|
+
["242"],
|
|
126
|
+
"1"
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
"bh",
|
|
130
|
+
// Bahrain
|
|
131
|
+
"973"
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"bd",
|
|
135
|
+
// Bangladesh
|
|
136
|
+
"880",
|
|
137
|
+
0,
|
|
138
|
+
null,
|
|
139
|
+
"0"
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"bb",
|
|
143
|
+
// Barbados
|
|
144
|
+
"1",
|
|
145
|
+
9,
|
|
146
|
+
["246"],
|
|
147
|
+
"1"
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
"by",
|
|
151
|
+
// Belarus
|
|
152
|
+
"375",
|
|
153
|
+
0,
|
|
154
|
+
null,
|
|
155
|
+
"8"
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
"be",
|
|
159
|
+
// Belgium
|
|
160
|
+
"32",
|
|
161
|
+
0,
|
|
162
|
+
null,
|
|
163
|
+
"0"
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"bz",
|
|
167
|
+
// Belize
|
|
168
|
+
"501"
|
|
169
|
+
],
|
|
170
|
+
[
|
|
171
|
+
"bj",
|
|
172
|
+
// Benin
|
|
173
|
+
"229"
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"bm",
|
|
177
|
+
// Bermuda
|
|
178
|
+
"1",
|
|
179
|
+
10,
|
|
180
|
+
["441"],
|
|
181
|
+
"1"
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
"bt",
|
|
185
|
+
// Bhutan
|
|
186
|
+
"975"
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
"bo",
|
|
190
|
+
// Bolivia
|
|
191
|
+
"591",
|
|
192
|
+
0,
|
|
193
|
+
null,
|
|
194
|
+
"0"
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"ba",
|
|
198
|
+
// Bosnia and Herzegovina
|
|
199
|
+
"387",
|
|
200
|
+
0,
|
|
201
|
+
null,
|
|
202
|
+
"0"
|
|
203
|
+
],
|
|
204
|
+
[
|
|
205
|
+
"bw",
|
|
206
|
+
// Botswana
|
|
207
|
+
"267"
|
|
208
|
+
],
|
|
209
|
+
[
|
|
210
|
+
"br",
|
|
211
|
+
// Brazil
|
|
212
|
+
"55",
|
|
213
|
+
0,
|
|
214
|
+
null,
|
|
215
|
+
"0"
|
|
216
|
+
],
|
|
217
|
+
[
|
|
218
|
+
"io",
|
|
219
|
+
// British Indian Ocean Territory
|
|
220
|
+
"246"
|
|
221
|
+
],
|
|
222
|
+
[
|
|
223
|
+
"vg",
|
|
224
|
+
// British Virgin Islands
|
|
225
|
+
"1",
|
|
226
|
+
11,
|
|
227
|
+
["284"],
|
|
228
|
+
"1"
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
"bn",
|
|
232
|
+
// Brunei
|
|
233
|
+
"673"
|
|
234
|
+
],
|
|
235
|
+
[
|
|
236
|
+
"bg",
|
|
237
|
+
// Bulgaria
|
|
238
|
+
"359",
|
|
239
|
+
0,
|
|
240
|
+
null,
|
|
241
|
+
"0"
|
|
242
|
+
],
|
|
243
|
+
[
|
|
244
|
+
"bf",
|
|
245
|
+
// Burkina Faso
|
|
246
|
+
"226"
|
|
247
|
+
],
|
|
248
|
+
[
|
|
249
|
+
"bi",
|
|
250
|
+
// Burundi
|
|
251
|
+
"257"
|
|
252
|
+
],
|
|
253
|
+
[
|
|
254
|
+
"kh",
|
|
255
|
+
// Cambodia
|
|
256
|
+
"855",
|
|
257
|
+
0,
|
|
258
|
+
null,
|
|
259
|
+
"0"
|
|
260
|
+
],
|
|
261
|
+
[
|
|
262
|
+
"cm",
|
|
263
|
+
// Cameroon
|
|
264
|
+
"237"
|
|
265
|
+
],
|
|
266
|
+
[
|
|
267
|
+
"ca",
|
|
268
|
+
// Canada
|
|
269
|
+
"1",
|
|
270
|
+
1,
|
|
271
|
+
["204", "226", "236", "249", "250", "257", "263", "289", "306", "343", "354", "365", "367", "368", "382", "403", "416", "418", "428", "431", "437", "438", "450", "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", "942"],
|
|
272
|
+
"1"
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
"cv",
|
|
276
|
+
// Cape Verde
|
|
277
|
+
"238"
|
|
278
|
+
],
|
|
279
|
+
[
|
|
280
|
+
"bq",
|
|
281
|
+
// Caribbean Netherlands
|
|
282
|
+
"599",
|
|
283
|
+
1,
|
|
284
|
+
["3", "4", "7"]
|
|
285
|
+
],
|
|
286
|
+
[
|
|
287
|
+
"ky",
|
|
288
|
+
// Cayman Islands
|
|
289
|
+
"1",
|
|
290
|
+
12,
|
|
291
|
+
["345"],
|
|
292
|
+
"1"
|
|
293
|
+
],
|
|
294
|
+
[
|
|
295
|
+
"cf",
|
|
296
|
+
// Central African Republic
|
|
297
|
+
"236"
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
"td",
|
|
301
|
+
// Chad
|
|
302
|
+
"235"
|
|
303
|
+
],
|
|
304
|
+
[
|
|
305
|
+
"cl",
|
|
306
|
+
// Chile
|
|
307
|
+
"56"
|
|
308
|
+
],
|
|
309
|
+
[
|
|
310
|
+
"cn",
|
|
311
|
+
// China
|
|
312
|
+
"86",
|
|
313
|
+
0,
|
|
314
|
+
null,
|
|
315
|
+
"0"
|
|
316
|
+
],
|
|
317
|
+
[
|
|
318
|
+
"cx",
|
|
319
|
+
// Christmas Island
|
|
320
|
+
"61",
|
|
321
|
+
2,
|
|
322
|
+
["4", "89164"],
|
|
323
|
+
// (4 is a mobile range shared with AU and CC)
|
|
324
|
+
"0"
|
|
325
|
+
],
|
|
326
|
+
[
|
|
327
|
+
"cc",
|
|
328
|
+
// Cocos (Keeling) Islands
|
|
329
|
+
"61",
|
|
330
|
+
1,
|
|
331
|
+
["4", "89162"],
|
|
332
|
+
// (4 is a mobile range shared with AU and CX)
|
|
333
|
+
"0"
|
|
334
|
+
],
|
|
335
|
+
[
|
|
336
|
+
"co",
|
|
337
|
+
// Colombia
|
|
338
|
+
"57",
|
|
339
|
+
0,
|
|
340
|
+
null,
|
|
341
|
+
"0"
|
|
342
|
+
],
|
|
343
|
+
[
|
|
344
|
+
"km",
|
|
345
|
+
// Comoros
|
|
346
|
+
"269"
|
|
347
|
+
],
|
|
348
|
+
[
|
|
349
|
+
"cg",
|
|
350
|
+
// Congo (Brazzaville)
|
|
351
|
+
"242"
|
|
352
|
+
],
|
|
353
|
+
[
|
|
354
|
+
"cd",
|
|
355
|
+
// Congo (Kinshasa)
|
|
356
|
+
"243",
|
|
357
|
+
0,
|
|
358
|
+
null,
|
|
359
|
+
"0"
|
|
360
|
+
],
|
|
361
|
+
[
|
|
362
|
+
"ck",
|
|
363
|
+
// Cook Islands
|
|
364
|
+
"682"
|
|
365
|
+
],
|
|
366
|
+
[
|
|
367
|
+
"cr",
|
|
368
|
+
// Costa Rica
|
|
369
|
+
"506"
|
|
370
|
+
],
|
|
371
|
+
[
|
|
372
|
+
"ci",
|
|
373
|
+
// Côte d'Ivoire
|
|
374
|
+
"225"
|
|
375
|
+
],
|
|
376
|
+
[
|
|
377
|
+
"hr",
|
|
378
|
+
// Croatia
|
|
379
|
+
"385",
|
|
380
|
+
0,
|
|
381
|
+
null,
|
|
382
|
+
"0"
|
|
383
|
+
],
|
|
384
|
+
[
|
|
385
|
+
"cu",
|
|
386
|
+
// Cuba
|
|
387
|
+
"53",
|
|
388
|
+
0,
|
|
389
|
+
null,
|
|
390
|
+
"0"
|
|
391
|
+
],
|
|
392
|
+
[
|
|
393
|
+
"cw",
|
|
394
|
+
// Curaçao
|
|
395
|
+
"599",
|
|
396
|
+
0
|
|
397
|
+
],
|
|
398
|
+
[
|
|
399
|
+
"cy",
|
|
400
|
+
// Cyprus
|
|
401
|
+
"357"
|
|
402
|
+
],
|
|
403
|
+
[
|
|
404
|
+
"cz",
|
|
405
|
+
// Czech Republic
|
|
406
|
+
"420"
|
|
407
|
+
],
|
|
408
|
+
[
|
|
409
|
+
"dk",
|
|
410
|
+
// Denmark
|
|
411
|
+
"45"
|
|
412
|
+
],
|
|
413
|
+
[
|
|
414
|
+
"dj",
|
|
415
|
+
// Djibouti
|
|
416
|
+
"253"
|
|
417
|
+
],
|
|
418
|
+
[
|
|
419
|
+
"dm",
|
|
420
|
+
// Dominica
|
|
421
|
+
"1",
|
|
422
|
+
13,
|
|
423
|
+
["767"],
|
|
424
|
+
"1"
|
|
425
|
+
],
|
|
426
|
+
[
|
|
427
|
+
"do",
|
|
428
|
+
// Dominican Republic
|
|
429
|
+
"1",
|
|
430
|
+
2,
|
|
431
|
+
["809", "829", "849"],
|
|
432
|
+
"1"
|
|
433
|
+
],
|
|
434
|
+
[
|
|
435
|
+
"ec",
|
|
436
|
+
// Ecuador
|
|
437
|
+
"593",
|
|
438
|
+
0,
|
|
439
|
+
null,
|
|
440
|
+
"0"
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
"eg",
|
|
444
|
+
// Egypt
|
|
445
|
+
"20",
|
|
446
|
+
0,
|
|
447
|
+
null,
|
|
448
|
+
"0"
|
|
449
|
+
],
|
|
450
|
+
[
|
|
451
|
+
"sv",
|
|
452
|
+
// El Salvador
|
|
453
|
+
"503"
|
|
454
|
+
],
|
|
455
|
+
[
|
|
456
|
+
"gq",
|
|
457
|
+
// Equatorial Guinea
|
|
458
|
+
"240"
|
|
459
|
+
],
|
|
460
|
+
[
|
|
461
|
+
"er",
|
|
462
|
+
// Eritrea
|
|
463
|
+
"291",
|
|
464
|
+
0,
|
|
465
|
+
null,
|
|
466
|
+
"0"
|
|
467
|
+
],
|
|
468
|
+
[
|
|
469
|
+
"ee",
|
|
470
|
+
// Estonia
|
|
471
|
+
"372"
|
|
472
|
+
],
|
|
473
|
+
[
|
|
474
|
+
"sz",
|
|
475
|
+
// Eswatini
|
|
476
|
+
"268"
|
|
477
|
+
],
|
|
478
|
+
[
|
|
479
|
+
"et",
|
|
480
|
+
// Ethiopia
|
|
481
|
+
"251",
|
|
482
|
+
0,
|
|
483
|
+
null,
|
|
484
|
+
"0"
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
"fk",
|
|
488
|
+
// Falkland Islands (Malvinas)
|
|
489
|
+
"500"
|
|
490
|
+
],
|
|
491
|
+
[
|
|
492
|
+
"fo",
|
|
493
|
+
// Faroe Islands
|
|
494
|
+
"298"
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
"fj",
|
|
498
|
+
// Fiji
|
|
499
|
+
"679"
|
|
500
|
+
],
|
|
501
|
+
[
|
|
502
|
+
"fi",
|
|
503
|
+
// Finland
|
|
504
|
+
"358",
|
|
505
|
+
0,
|
|
506
|
+
["4"],
|
|
507
|
+
// (mobile range shared with AX)
|
|
508
|
+
"0"
|
|
509
|
+
],
|
|
510
|
+
[
|
|
511
|
+
"fr",
|
|
512
|
+
// France
|
|
513
|
+
"33",
|
|
514
|
+
0,
|
|
515
|
+
null,
|
|
516
|
+
"0"
|
|
517
|
+
],
|
|
518
|
+
[
|
|
519
|
+
"gf",
|
|
520
|
+
// French Guiana
|
|
521
|
+
"594",
|
|
522
|
+
0,
|
|
523
|
+
null,
|
|
524
|
+
"0"
|
|
525
|
+
],
|
|
526
|
+
[
|
|
527
|
+
"pf",
|
|
528
|
+
// French Polynesia
|
|
529
|
+
"689"
|
|
530
|
+
],
|
|
531
|
+
[
|
|
532
|
+
"ga",
|
|
533
|
+
// Gabon
|
|
534
|
+
"241"
|
|
535
|
+
],
|
|
536
|
+
[
|
|
537
|
+
"gm",
|
|
538
|
+
// Gambia
|
|
539
|
+
"220"
|
|
540
|
+
],
|
|
541
|
+
[
|
|
542
|
+
"ge",
|
|
543
|
+
// Georgia
|
|
544
|
+
"995",
|
|
545
|
+
0,
|
|
546
|
+
null,
|
|
547
|
+
"0"
|
|
548
|
+
],
|
|
549
|
+
[
|
|
550
|
+
"de",
|
|
551
|
+
// Germany
|
|
552
|
+
"49",
|
|
553
|
+
0,
|
|
554
|
+
null,
|
|
555
|
+
"0"
|
|
556
|
+
],
|
|
557
|
+
[
|
|
558
|
+
"gh",
|
|
559
|
+
// Ghana
|
|
560
|
+
"233",
|
|
561
|
+
0,
|
|
562
|
+
null,
|
|
563
|
+
"0"
|
|
564
|
+
],
|
|
565
|
+
[
|
|
566
|
+
"gi",
|
|
567
|
+
// Gibraltar
|
|
568
|
+
"350"
|
|
569
|
+
],
|
|
570
|
+
[
|
|
571
|
+
"gr",
|
|
572
|
+
// Greece
|
|
573
|
+
"30"
|
|
574
|
+
],
|
|
575
|
+
[
|
|
576
|
+
"gl",
|
|
577
|
+
// Greenland
|
|
578
|
+
"299"
|
|
579
|
+
],
|
|
580
|
+
[
|
|
581
|
+
"gd",
|
|
582
|
+
// Grenada
|
|
583
|
+
"1",
|
|
584
|
+
14,
|
|
585
|
+
["473"],
|
|
586
|
+
"1"
|
|
587
|
+
],
|
|
588
|
+
[
|
|
589
|
+
"gp",
|
|
590
|
+
// Guadeloupe
|
|
591
|
+
"590",
|
|
592
|
+
0,
|
|
593
|
+
null,
|
|
594
|
+
"0"
|
|
595
|
+
],
|
|
596
|
+
[
|
|
597
|
+
"gu",
|
|
598
|
+
// Guam
|
|
599
|
+
"1",
|
|
600
|
+
15,
|
|
601
|
+
["671"],
|
|
602
|
+
"1"
|
|
603
|
+
],
|
|
604
|
+
[
|
|
605
|
+
"gt",
|
|
606
|
+
// Guatemala
|
|
607
|
+
"502"
|
|
608
|
+
],
|
|
609
|
+
[
|
|
610
|
+
"gg",
|
|
611
|
+
// Guernsey
|
|
612
|
+
"44",
|
|
613
|
+
1,
|
|
614
|
+
["1481", "7781", "7839", "7911"],
|
|
615
|
+
"0"
|
|
616
|
+
],
|
|
617
|
+
[
|
|
618
|
+
"gn",
|
|
619
|
+
// Guinea
|
|
620
|
+
"224"
|
|
621
|
+
],
|
|
622
|
+
[
|
|
623
|
+
"gw",
|
|
624
|
+
// Guinea-Bissau
|
|
625
|
+
"245"
|
|
626
|
+
],
|
|
627
|
+
[
|
|
628
|
+
"gy",
|
|
629
|
+
// Guyana
|
|
630
|
+
"592"
|
|
631
|
+
],
|
|
632
|
+
[
|
|
633
|
+
"ht",
|
|
634
|
+
// Haiti
|
|
635
|
+
"509"
|
|
636
|
+
],
|
|
637
|
+
[
|
|
638
|
+
"hn",
|
|
639
|
+
// Honduras
|
|
640
|
+
"504"
|
|
641
|
+
],
|
|
642
|
+
[
|
|
643
|
+
"hk",
|
|
644
|
+
// Hong Kong SAR China
|
|
645
|
+
"852"
|
|
646
|
+
],
|
|
647
|
+
[
|
|
648
|
+
"hu",
|
|
649
|
+
// Hungary
|
|
650
|
+
"36",
|
|
651
|
+
0,
|
|
652
|
+
null,
|
|
653
|
+
"06"
|
|
654
|
+
],
|
|
655
|
+
[
|
|
656
|
+
"is",
|
|
657
|
+
// Iceland
|
|
658
|
+
"354"
|
|
659
|
+
],
|
|
660
|
+
[
|
|
661
|
+
"in",
|
|
662
|
+
// India
|
|
663
|
+
"91",
|
|
664
|
+
0,
|
|
665
|
+
null,
|
|
666
|
+
"0"
|
|
667
|
+
],
|
|
668
|
+
[
|
|
669
|
+
"id",
|
|
670
|
+
// Indonesia
|
|
671
|
+
"62",
|
|
672
|
+
0,
|
|
673
|
+
null,
|
|
674
|
+
"0"
|
|
675
|
+
],
|
|
676
|
+
[
|
|
677
|
+
"ir",
|
|
678
|
+
// Iran
|
|
679
|
+
"98",
|
|
680
|
+
0,
|
|
681
|
+
null,
|
|
682
|
+
"0"
|
|
683
|
+
],
|
|
684
|
+
[
|
|
685
|
+
"iq",
|
|
686
|
+
// Iraq
|
|
687
|
+
"964",
|
|
688
|
+
0,
|
|
689
|
+
null,
|
|
690
|
+
"0"
|
|
691
|
+
],
|
|
692
|
+
[
|
|
693
|
+
"ie",
|
|
694
|
+
// Ireland
|
|
695
|
+
"353",
|
|
696
|
+
0,
|
|
697
|
+
null,
|
|
698
|
+
"0"
|
|
699
|
+
],
|
|
700
|
+
[
|
|
701
|
+
"im",
|
|
702
|
+
// Isle of Man
|
|
703
|
+
"44",
|
|
704
|
+
2,
|
|
705
|
+
["1624", "74576", "7524", "7624", "7924"],
|
|
706
|
+
"0"
|
|
707
|
+
],
|
|
708
|
+
[
|
|
709
|
+
"il",
|
|
710
|
+
// Israel
|
|
711
|
+
"972",
|
|
712
|
+
0,
|
|
713
|
+
null,
|
|
714
|
+
"0"
|
|
715
|
+
],
|
|
716
|
+
[
|
|
717
|
+
"it",
|
|
718
|
+
// Italy
|
|
719
|
+
"39",
|
|
720
|
+
0,
|
|
721
|
+
["3"]
|
|
722
|
+
// (mobile range shared with VA)
|
|
723
|
+
],
|
|
724
|
+
[
|
|
725
|
+
"jm",
|
|
726
|
+
// Jamaica
|
|
727
|
+
"1",
|
|
728
|
+
4,
|
|
729
|
+
["658", "876"],
|
|
730
|
+
"1"
|
|
731
|
+
],
|
|
732
|
+
[
|
|
733
|
+
"jp",
|
|
734
|
+
// Japan
|
|
735
|
+
"81",
|
|
736
|
+
0,
|
|
737
|
+
null,
|
|
738
|
+
"0"
|
|
739
|
+
],
|
|
740
|
+
[
|
|
741
|
+
"je",
|
|
742
|
+
// Jersey
|
|
743
|
+
"44",
|
|
744
|
+
3,
|
|
745
|
+
["1534", "7509", "7700", "7797", "7829", "7937"],
|
|
746
|
+
"0"
|
|
747
|
+
],
|
|
748
|
+
[
|
|
749
|
+
"jo",
|
|
750
|
+
// Jordan
|
|
751
|
+
"962",
|
|
752
|
+
0,
|
|
753
|
+
null,
|
|
754
|
+
"0"
|
|
755
|
+
],
|
|
756
|
+
[
|
|
757
|
+
"kz",
|
|
758
|
+
// Kazakhstan
|
|
759
|
+
"7",
|
|
760
|
+
1,
|
|
761
|
+
["33", "7"],
|
|
762
|
+
// (33 is shared with RU)
|
|
763
|
+
"8"
|
|
764
|
+
],
|
|
765
|
+
[
|
|
766
|
+
"ke",
|
|
767
|
+
// Kenya
|
|
768
|
+
"254",
|
|
769
|
+
0,
|
|
770
|
+
null,
|
|
771
|
+
"0"
|
|
772
|
+
],
|
|
773
|
+
[
|
|
774
|
+
"ki",
|
|
775
|
+
// Kiribati
|
|
776
|
+
"686",
|
|
777
|
+
0,
|
|
778
|
+
null,
|
|
779
|
+
"0"
|
|
780
|
+
],
|
|
781
|
+
[
|
|
782
|
+
"xk",
|
|
783
|
+
// Kosovo
|
|
784
|
+
"383",
|
|
785
|
+
0,
|
|
786
|
+
null,
|
|
787
|
+
"0"
|
|
788
|
+
],
|
|
789
|
+
[
|
|
790
|
+
"kw",
|
|
791
|
+
// Kuwait
|
|
792
|
+
"965"
|
|
793
|
+
],
|
|
794
|
+
[
|
|
795
|
+
"kg",
|
|
796
|
+
// Kyrgyzstan
|
|
797
|
+
"996",
|
|
798
|
+
0,
|
|
799
|
+
null,
|
|
800
|
+
"0"
|
|
801
|
+
],
|
|
802
|
+
[
|
|
803
|
+
"la",
|
|
804
|
+
// Laos
|
|
805
|
+
"856",
|
|
806
|
+
0,
|
|
807
|
+
null,
|
|
808
|
+
"0"
|
|
809
|
+
],
|
|
810
|
+
[
|
|
811
|
+
"lv",
|
|
812
|
+
// Latvia
|
|
813
|
+
"371"
|
|
814
|
+
],
|
|
815
|
+
[
|
|
816
|
+
"lb",
|
|
817
|
+
// Lebanon
|
|
818
|
+
"961",
|
|
819
|
+
0,
|
|
820
|
+
null,
|
|
821
|
+
"0"
|
|
822
|
+
],
|
|
823
|
+
[
|
|
824
|
+
"ls",
|
|
825
|
+
// Lesotho
|
|
826
|
+
"266"
|
|
827
|
+
],
|
|
828
|
+
[
|
|
829
|
+
"lr",
|
|
830
|
+
// Liberia
|
|
831
|
+
"231",
|
|
832
|
+
0,
|
|
833
|
+
null,
|
|
834
|
+
"0"
|
|
835
|
+
],
|
|
836
|
+
[
|
|
837
|
+
"ly",
|
|
838
|
+
// Libya
|
|
839
|
+
"218",
|
|
840
|
+
0,
|
|
841
|
+
null,
|
|
842
|
+
"0"
|
|
843
|
+
],
|
|
844
|
+
[
|
|
845
|
+
"li",
|
|
846
|
+
// Liechtenstein
|
|
847
|
+
"423",
|
|
848
|
+
0,
|
|
849
|
+
null,
|
|
850
|
+
"0"
|
|
851
|
+
],
|
|
852
|
+
[
|
|
853
|
+
"lt",
|
|
854
|
+
// Lithuania
|
|
855
|
+
"370",
|
|
856
|
+
0,
|
|
857
|
+
null,
|
|
858
|
+
"0"
|
|
859
|
+
],
|
|
860
|
+
[
|
|
861
|
+
"lu",
|
|
862
|
+
// Luxembourg
|
|
863
|
+
"352"
|
|
864
|
+
],
|
|
865
|
+
[
|
|
866
|
+
"mo",
|
|
867
|
+
// Macao SAR China
|
|
868
|
+
"853"
|
|
869
|
+
],
|
|
870
|
+
[
|
|
871
|
+
"mg",
|
|
872
|
+
// Madagascar
|
|
873
|
+
"261",
|
|
874
|
+
0,
|
|
875
|
+
null,
|
|
876
|
+
"0"
|
|
877
|
+
],
|
|
878
|
+
[
|
|
879
|
+
"mw",
|
|
880
|
+
// Malawi
|
|
881
|
+
"265",
|
|
882
|
+
0,
|
|
883
|
+
null,
|
|
884
|
+
"0"
|
|
885
|
+
],
|
|
886
|
+
[
|
|
887
|
+
"my",
|
|
888
|
+
// Malaysia
|
|
889
|
+
"60",
|
|
890
|
+
0,
|
|
891
|
+
null,
|
|
892
|
+
"0"
|
|
893
|
+
],
|
|
894
|
+
[
|
|
895
|
+
"mv",
|
|
896
|
+
// Maldives
|
|
897
|
+
"960"
|
|
898
|
+
],
|
|
899
|
+
[
|
|
900
|
+
"ml",
|
|
901
|
+
// Mali
|
|
902
|
+
"223"
|
|
903
|
+
],
|
|
904
|
+
[
|
|
905
|
+
"mt",
|
|
906
|
+
// Malta
|
|
907
|
+
"356"
|
|
908
|
+
],
|
|
909
|
+
[
|
|
910
|
+
"mh",
|
|
911
|
+
// Marshall Islands
|
|
912
|
+
"692",
|
|
913
|
+
0,
|
|
914
|
+
null,
|
|
915
|
+
"1"
|
|
916
|
+
],
|
|
917
|
+
[
|
|
918
|
+
"mq",
|
|
919
|
+
// Martinique
|
|
920
|
+
"596",
|
|
921
|
+
0,
|
|
922
|
+
null,
|
|
923
|
+
"0"
|
|
924
|
+
],
|
|
925
|
+
[
|
|
926
|
+
"mr",
|
|
927
|
+
// Mauritania
|
|
928
|
+
"222"
|
|
929
|
+
],
|
|
930
|
+
[
|
|
931
|
+
"mu",
|
|
932
|
+
// Mauritius
|
|
933
|
+
"230"
|
|
934
|
+
],
|
|
935
|
+
[
|
|
936
|
+
"yt",
|
|
937
|
+
// Mayotte
|
|
938
|
+
"262",
|
|
939
|
+
1,
|
|
940
|
+
["269", "639"],
|
|
941
|
+
"0"
|
|
942
|
+
],
|
|
943
|
+
[
|
|
944
|
+
"mx",
|
|
945
|
+
// Mexico
|
|
946
|
+
"52"
|
|
947
|
+
],
|
|
948
|
+
[
|
|
949
|
+
"fm",
|
|
950
|
+
// Micronesia
|
|
951
|
+
"691"
|
|
952
|
+
],
|
|
953
|
+
[
|
|
954
|
+
"md",
|
|
955
|
+
// Moldova
|
|
956
|
+
"373",
|
|
957
|
+
0,
|
|
958
|
+
null,
|
|
959
|
+
"0"
|
|
960
|
+
],
|
|
961
|
+
[
|
|
962
|
+
"mc",
|
|
963
|
+
// Monaco
|
|
964
|
+
"377",
|
|
965
|
+
0,
|
|
966
|
+
null,
|
|
967
|
+
"0"
|
|
968
|
+
],
|
|
969
|
+
[
|
|
970
|
+
"mn",
|
|
971
|
+
// Mongolia
|
|
972
|
+
"976",
|
|
973
|
+
0,
|
|
974
|
+
null,
|
|
975
|
+
"0"
|
|
976
|
+
],
|
|
977
|
+
[
|
|
978
|
+
"me",
|
|
979
|
+
// Montenegro
|
|
980
|
+
"382",
|
|
981
|
+
0,
|
|
982
|
+
null,
|
|
983
|
+
"0"
|
|
984
|
+
],
|
|
985
|
+
[
|
|
986
|
+
"ms",
|
|
987
|
+
// Montserrat
|
|
988
|
+
"1",
|
|
989
|
+
16,
|
|
990
|
+
["664"],
|
|
991
|
+
"1"
|
|
992
|
+
],
|
|
993
|
+
[
|
|
994
|
+
"ma",
|
|
995
|
+
// Morocco
|
|
996
|
+
"212",
|
|
997
|
+
0,
|
|
998
|
+
["6", "7"],
|
|
999
|
+
// (mobile ranges shared with EH)
|
|
1000
|
+
"0"
|
|
1001
|
+
],
|
|
1002
|
+
[
|
|
1003
|
+
"mz",
|
|
1004
|
+
// Mozambique
|
|
1005
|
+
"258"
|
|
1006
|
+
],
|
|
1007
|
+
[
|
|
1008
|
+
"mm",
|
|
1009
|
+
// Myanmar (Burma)
|
|
1010
|
+
"95",
|
|
1011
|
+
0,
|
|
1012
|
+
null,
|
|
1013
|
+
"0"
|
|
1014
|
+
],
|
|
1015
|
+
[
|
|
1016
|
+
"na",
|
|
1017
|
+
// Namibia
|
|
1018
|
+
"264",
|
|
1019
|
+
0,
|
|
1020
|
+
null,
|
|
1021
|
+
"0"
|
|
1022
|
+
],
|
|
1023
|
+
[
|
|
1024
|
+
"nr",
|
|
1025
|
+
// Nauru
|
|
1026
|
+
"674"
|
|
1027
|
+
],
|
|
1028
|
+
[
|
|
1029
|
+
"np",
|
|
1030
|
+
// Nepal
|
|
1031
|
+
"977",
|
|
1032
|
+
0,
|
|
1033
|
+
null,
|
|
1034
|
+
"0"
|
|
1035
|
+
],
|
|
1036
|
+
[
|
|
1037
|
+
"nl",
|
|
1038
|
+
// Netherlands
|
|
1039
|
+
"31",
|
|
1040
|
+
0,
|
|
1041
|
+
null,
|
|
1042
|
+
"0"
|
|
1043
|
+
],
|
|
1044
|
+
[
|
|
1045
|
+
"nc",
|
|
1046
|
+
// New Caledonia
|
|
1047
|
+
"687"
|
|
1048
|
+
],
|
|
1049
|
+
[
|
|
1050
|
+
"nz",
|
|
1051
|
+
// New Zealand
|
|
1052
|
+
"64",
|
|
1053
|
+
0,
|
|
1054
|
+
null,
|
|
1055
|
+
"0"
|
|
1056
|
+
],
|
|
1057
|
+
[
|
|
1058
|
+
"ni",
|
|
1059
|
+
// Nicaragua
|
|
1060
|
+
"505"
|
|
1061
|
+
],
|
|
1062
|
+
[
|
|
1063
|
+
"ne",
|
|
1064
|
+
// Niger
|
|
1065
|
+
"227"
|
|
1066
|
+
],
|
|
1067
|
+
[
|
|
1068
|
+
"ng",
|
|
1069
|
+
// Nigeria
|
|
1070
|
+
"234",
|
|
1071
|
+
0,
|
|
1072
|
+
null,
|
|
1073
|
+
"0"
|
|
1074
|
+
],
|
|
1075
|
+
[
|
|
1076
|
+
"nu",
|
|
1077
|
+
// Niue
|
|
1078
|
+
"683"
|
|
1079
|
+
],
|
|
1080
|
+
[
|
|
1081
|
+
"nf",
|
|
1082
|
+
// Norfolk Island
|
|
1083
|
+
"672"
|
|
1084
|
+
],
|
|
1085
|
+
[
|
|
1086
|
+
"kp",
|
|
1087
|
+
// North Korea
|
|
1088
|
+
"850",
|
|
1089
|
+
0,
|
|
1090
|
+
null,
|
|
1091
|
+
"0"
|
|
1092
|
+
],
|
|
1093
|
+
[
|
|
1094
|
+
"mk",
|
|
1095
|
+
// North Macedonia
|
|
1096
|
+
"389",
|
|
1097
|
+
0,
|
|
1098
|
+
null,
|
|
1099
|
+
"0"
|
|
1100
|
+
],
|
|
1101
|
+
[
|
|
1102
|
+
"mp",
|
|
1103
|
+
// Northern Mariana Islands
|
|
1104
|
+
"1",
|
|
1105
|
+
17,
|
|
1106
|
+
["670"],
|
|
1107
|
+
"1"
|
|
1108
|
+
],
|
|
1109
|
+
[
|
|
1110
|
+
"no",
|
|
1111
|
+
// Norway
|
|
1112
|
+
"47",
|
|
1113
|
+
0,
|
|
1114
|
+
["4", "9"]
|
|
1115
|
+
// (mobile ranges shared with SJ)
|
|
1116
|
+
],
|
|
1117
|
+
[
|
|
1118
|
+
"om",
|
|
1119
|
+
// Oman
|
|
1120
|
+
"968"
|
|
1121
|
+
],
|
|
1122
|
+
[
|
|
1123
|
+
"pk",
|
|
1124
|
+
// Pakistan
|
|
1125
|
+
"92",
|
|
1126
|
+
0,
|
|
1127
|
+
null,
|
|
1128
|
+
"0"
|
|
1129
|
+
],
|
|
1130
|
+
[
|
|
1131
|
+
"pw",
|
|
1132
|
+
// Palau
|
|
1133
|
+
"680"
|
|
1134
|
+
],
|
|
1135
|
+
[
|
|
1136
|
+
"ps",
|
|
1137
|
+
// Palestinian Territories
|
|
1138
|
+
"970",
|
|
1139
|
+
0,
|
|
1140
|
+
null,
|
|
1141
|
+
"0"
|
|
1142
|
+
],
|
|
1143
|
+
[
|
|
1144
|
+
"pa",
|
|
1145
|
+
// Panama
|
|
1146
|
+
"507"
|
|
1147
|
+
],
|
|
1148
|
+
[
|
|
1149
|
+
"pg",
|
|
1150
|
+
// Papua New Guinea
|
|
1151
|
+
"675"
|
|
1152
|
+
],
|
|
1153
|
+
[
|
|
1154
|
+
"py",
|
|
1155
|
+
// Paraguay
|
|
1156
|
+
"595",
|
|
1157
|
+
0,
|
|
1158
|
+
null,
|
|
1159
|
+
"0"
|
|
1160
|
+
],
|
|
1161
|
+
[
|
|
1162
|
+
"pe",
|
|
1163
|
+
// Peru
|
|
1164
|
+
"51",
|
|
1165
|
+
0,
|
|
1166
|
+
null,
|
|
1167
|
+
"0"
|
|
1168
|
+
],
|
|
1169
|
+
[
|
|
1170
|
+
"ph",
|
|
1171
|
+
// Philippines
|
|
1172
|
+
"63",
|
|
1173
|
+
0,
|
|
1174
|
+
null,
|
|
1175
|
+
"0"
|
|
1176
|
+
],
|
|
1177
|
+
[
|
|
1178
|
+
"pl",
|
|
1179
|
+
// Poland
|
|
1180
|
+
"48"
|
|
1181
|
+
],
|
|
1182
|
+
[
|
|
1183
|
+
"pt",
|
|
1184
|
+
// Portugal
|
|
1185
|
+
"351"
|
|
1186
|
+
],
|
|
1187
|
+
[
|
|
1188
|
+
"pr",
|
|
1189
|
+
// Puerto Rico
|
|
1190
|
+
"1",
|
|
1191
|
+
3,
|
|
1192
|
+
["787", "939"],
|
|
1193
|
+
"1"
|
|
1194
|
+
],
|
|
1195
|
+
[
|
|
1196
|
+
"qa",
|
|
1197
|
+
// Qatar
|
|
1198
|
+
"974"
|
|
1199
|
+
],
|
|
1200
|
+
[
|
|
1201
|
+
"re",
|
|
1202
|
+
// Réunion
|
|
1203
|
+
"262",
|
|
1204
|
+
0,
|
|
1205
|
+
null,
|
|
1206
|
+
"0"
|
|
1207
|
+
],
|
|
1208
|
+
[
|
|
1209
|
+
"ro",
|
|
1210
|
+
// Romania
|
|
1211
|
+
"40",
|
|
1212
|
+
0,
|
|
1213
|
+
null,
|
|
1214
|
+
"0"
|
|
1215
|
+
],
|
|
1216
|
+
[
|
|
1217
|
+
"ru",
|
|
1218
|
+
// Russia
|
|
1219
|
+
"7",
|
|
1220
|
+
0,
|
|
1221
|
+
["33"],
|
|
1222
|
+
// (shared with KZ)
|
|
1223
|
+
"8"
|
|
1224
|
+
],
|
|
1225
|
+
[
|
|
1226
|
+
"rw",
|
|
1227
|
+
// Rwanda
|
|
1228
|
+
"250",
|
|
1229
|
+
0,
|
|
1230
|
+
null,
|
|
1231
|
+
"0"
|
|
1232
|
+
],
|
|
1233
|
+
[
|
|
1234
|
+
"ws",
|
|
1235
|
+
// Samoa
|
|
1236
|
+
"685"
|
|
1237
|
+
],
|
|
1238
|
+
[
|
|
1239
|
+
"sm",
|
|
1240
|
+
// San Marino
|
|
1241
|
+
"378"
|
|
1242
|
+
],
|
|
1243
|
+
[
|
|
1244
|
+
"st",
|
|
1245
|
+
// São Tomé & Príncipe
|
|
1246
|
+
"239"
|
|
1247
|
+
],
|
|
1248
|
+
[
|
|
1249
|
+
"sa",
|
|
1250
|
+
// Saudi Arabia
|
|
1251
|
+
"966",
|
|
1252
|
+
0,
|
|
1253
|
+
null,
|
|
1254
|
+
"0"
|
|
1255
|
+
],
|
|
1256
|
+
[
|
|
1257
|
+
"sn",
|
|
1258
|
+
// Senegal
|
|
1259
|
+
"221"
|
|
1260
|
+
],
|
|
1261
|
+
[
|
|
1262
|
+
"rs",
|
|
1263
|
+
// Serbia
|
|
1264
|
+
"381",
|
|
1265
|
+
0,
|
|
1266
|
+
null,
|
|
1267
|
+
"0"
|
|
1268
|
+
],
|
|
1269
|
+
[
|
|
1270
|
+
"sc",
|
|
1271
|
+
// Seychelles
|
|
1272
|
+
"248"
|
|
1273
|
+
],
|
|
1274
|
+
[
|
|
1275
|
+
"sl",
|
|
1276
|
+
// Sierra Leone
|
|
1277
|
+
"232",
|
|
1278
|
+
0,
|
|
1279
|
+
null,
|
|
1280
|
+
"0"
|
|
1281
|
+
],
|
|
1282
|
+
[
|
|
1283
|
+
"sg",
|
|
1284
|
+
// Singapore
|
|
1285
|
+
"65"
|
|
1286
|
+
],
|
|
1287
|
+
[
|
|
1288
|
+
"sx",
|
|
1289
|
+
// Sint Maarten
|
|
1290
|
+
"1",
|
|
1291
|
+
21,
|
|
1292
|
+
["721"],
|
|
1293
|
+
"1"
|
|
1294
|
+
],
|
|
1295
|
+
[
|
|
1296
|
+
"sk",
|
|
1297
|
+
// Slovakia
|
|
1298
|
+
"421",
|
|
1299
|
+
0,
|
|
1300
|
+
null,
|
|
1301
|
+
"0"
|
|
1302
|
+
],
|
|
1303
|
+
[
|
|
1304
|
+
"si",
|
|
1305
|
+
// Slovenia
|
|
1306
|
+
"386",
|
|
1307
|
+
0,
|
|
1308
|
+
null,
|
|
1309
|
+
"0"
|
|
1310
|
+
],
|
|
1311
|
+
[
|
|
1312
|
+
"sb",
|
|
1313
|
+
// Solomon Islands
|
|
1314
|
+
"677"
|
|
1315
|
+
],
|
|
1316
|
+
[
|
|
1317
|
+
"so",
|
|
1318
|
+
// Somalia
|
|
1319
|
+
"252",
|
|
1320
|
+
0,
|
|
1321
|
+
null,
|
|
1322
|
+
"0"
|
|
1323
|
+
],
|
|
1324
|
+
[
|
|
1325
|
+
"za",
|
|
1326
|
+
// South Africa
|
|
1327
|
+
"27",
|
|
1328
|
+
0,
|
|
1329
|
+
null,
|
|
1330
|
+
"0"
|
|
1331
|
+
],
|
|
1332
|
+
[
|
|
1333
|
+
"kr",
|
|
1334
|
+
// South Korea
|
|
1335
|
+
"82",
|
|
1336
|
+
0,
|
|
1337
|
+
null,
|
|
1338
|
+
"0"
|
|
1339
|
+
],
|
|
1340
|
+
[
|
|
1341
|
+
"ss",
|
|
1342
|
+
// South Sudan
|
|
1343
|
+
"211",
|
|
1344
|
+
0,
|
|
1345
|
+
null,
|
|
1346
|
+
"0"
|
|
1347
|
+
],
|
|
1348
|
+
[
|
|
1349
|
+
"es",
|
|
1350
|
+
// Spain
|
|
1351
|
+
"34"
|
|
1352
|
+
],
|
|
1353
|
+
[
|
|
1354
|
+
"lk",
|
|
1355
|
+
// Sri Lanka
|
|
1356
|
+
"94",
|
|
1357
|
+
0,
|
|
1358
|
+
null,
|
|
1359
|
+
"0"
|
|
1360
|
+
],
|
|
1361
|
+
[
|
|
1362
|
+
"bl",
|
|
1363
|
+
// St. Barthélemy
|
|
1364
|
+
"590",
|
|
1365
|
+
1,
|
|
1366
|
+
null,
|
|
1367
|
+
"0"
|
|
1368
|
+
],
|
|
1369
|
+
[
|
|
1370
|
+
"sh",
|
|
1371
|
+
// St. Helena
|
|
1372
|
+
"290"
|
|
1373
|
+
],
|
|
1374
|
+
[
|
|
1375
|
+
"kn",
|
|
1376
|
+
// St. Kitts & Nevis
|
|
1377
|
+
"1",
|
|
1378
|
+
18,
|
|
1379
|
+
["869"],
|
|
1380
|
+
"1"
|
|
1381
|
+
],
|
|
1382
|
+
[
|
|
1383
|
+
"lc",
|
|
1384
|
+
// St. Lucia
|
|
1385
|
+
"1",
|
|
1386
|
+
19,
|
|
1387
|
+
["758"],
|
|
1388
|
+
"1"
|
|
1389
|
+
],
|
|
1390
|
+
[
|
|
1391
|
+
"mf",
|
|
1392
|
+
// St. Martin
|
|
1393
|
+
"590",
|
|
1394
|
+
2,
|
|
1395
|
+
null,
|
|
1396
|
+
"0"
|
|
1397
|
+
],
|
|
1398
|
+
[
|
|
1399
|
+
"pm",
|
|
1400
|
+
// St. Pierre & Miquelon
|
|
1401
|
+
"508",
|
|
1402
|
+
0,
|
|
1403
|
+
null,
|
|
1404
|
+
"0"
|
|
1405
|
+
],
|
|
1406
|
+
[
|
|
1407
|
+
"vc",
|
|
1408
|
+
// St. Vincent & Grenadines
|
|
1409
|
+
"1",
|
|
1410
|
+
20,
|
|
1411
|
+
["784"],
|
|
1412
|
+
"1"
|
|
1413
|
+
],
|
|
1414
|
+
[
|
|
1415
|
+
"sd",
|
|
1416
|
+
// Sudan
|
|
1417
|
+
"249",
|
|
1418
|
+
0,
|
|
1419
|
+
null,
|
|
1420
|
+
"0"
|
|
1421
|
+
],
|
|
1422
|
+
[
|
|
1423
|
+
"sr",
|
|
1424
|
+
// Suriname
|
|
1425
|
+
"597"
|
|
1426
|
+
],
|
|
1427
|
+
[
|
|
1428
|
+
"sj",
|
|
1429
|
+
// Svalbard & Jan Mayen
|
|
1430
|
+
"47",
|
|
1431
|
+
1,
|
|
1432
|
+
["4", "79", "9"]
|
|
1433
|
+
// (4 and 9 are mobile ranges shared with NO)
|
|
1434
|
+
],
|
|
1435
|
+
[
|
|
1436
|
+
"se",
|
|
1437
|
+
// Sweden
|
|
1438
|
+
"46",
|
|
1439
|
+
0,
|
|
1440
|
+
null,
|
|
1441
|
+
"0"
|
|
1442
|
+
],
|
|
1443
|
+
[
|
|
1444
|
+
"ch",
|
|
1445
|
+
// Switzerland
|
|
1446
|
+
"41",
|
|
1447
|
+
0,
|
|
1448
|
+
null,
|
|
1449
|
+
"0"
|
|
1450
|
+
],
|
|
1451
|
+
[
|
|
1452
|
+
"sy",
|
|
1453
|
+
// Syria
|
|
1454
|
+
"963",
|
|
1455
|
+
0,
|
|
1456
|
+
null,
|
|
1457
|
+
"0"
|
|
1458
|
+
],
|
|
1459
|
+
[
|
|
1460
|
+
"tw",
|
|
1461
|
+
// Taiwan
|
|
1462
|
+
"886",
|
|
1463
|
+
0,
|
|
1464
|
+
null,
|
|
1465
|
+
"0"
|
|
1466
|
+
],
|
|
1467
|
+
[
|
|
1468
|
+
"tj",
|
|
1469
|
+
// Tajikistan
|
|
1470
|
+
"992"
|
|
1471
|
+
],
|
|
1472
|
+
[
|
|
1473
|
+
"tz",
|
|
1474
|
+
// Tanzania
|
|
1475
|
+
"255",
|
|
1476
|
+
0,
|
|
1477
|
+
null,
|
|
1478
|
+
"0"
|
|
1479
|
+
],
|
|
1480
|
+
[
|
|
1481
|
+
"th",
|
|
1482
|
+
// Thailand
|
|
1483
|
+
"66",
|
|
1484
|
+
0,
|
|
1485
|
+
null,
|
|
1486
|
+
"0"
|
|
1487
|
+
],
|
|
1488
|
+
[
|
|
1489
|
+
"tl",
|
|
1490
|
+
// Timor-Leste
|
|
1491
|
+
"670"
|
|
1492
|
+
],
|
|
1493
|
+
[
|
|
1494
|
+
"tg",
|
|
1495
|
+
// Togo
|
|
1496
|
+
"228"
|
|
1497
|
+
],
|
|
1498
|
+
[
|
|
1499
|
+
"tk",
|
|
1500
|
+
// Tokelau
|
|
1501
|
+
"690"
|
|
1502
|
+
],
|
|
1503
|
+
[
|
|
1504
|
+
"to",
|
|
1505
|
+
// Tonga
|
|
1506
|
+
"676"
|
|
1507
|
+
],
|
|
1508
|
+
[
|
|
1509
|
+
"tt",
|
|
1510
|
+
// Trinidad & Tobago
|
|
1511
|
+
"1",
|
|
1512
|
+
22,
|
|
1513
|
+
["868"],
|
|
1514
|
+
"1"
|
|
1515
|
+
],
|
|
1516
|
+
[
|
|
1517
|
+
"tn",
|
|
1518
|
+
// Tunisia
|
|
1519
|
+
"216"
|
|
1520
|
+
],
|
|
1521
|
+
[
|
|
1522
|
+
"tr",
|
|
1523
|
+
// Turkey
|
|
1524
|
+
"90",
|
|
1525
|
+
0,
|
|
1526
|
+
null,
|
|
1527
|
+
"0"
|
|
1528
|
+
],
|
|
1529
|
+
[
|
|
1530
|
+
"tm",
|
|
1531
|
+
// Turkmenistan
|
|
1532
|
+
"993",
|
|
1533
|
+
0,
|
|
1534
|
+
null,
|
|
1535
|
+
"8"
|
|
1536
|
+
],
|
|
1537
|
+
[
|
|
1538
|
+
"tc",
|
|
1539
|
+
// Turks & Caicos Islands
|
|
1540
|
+
"1",
|
|
1541
|
+
23,
|
|
1542
|
+
["649"],
|
|
1543
|
+
"1"
|
|
1544
|
+
],
|
|
1545
|
+
[
|
|
1546
|
+
"tv",
|
|
1547
|
+
// Tuvalu
|
|
1548
|
+
"688"
|
|
1549
|
+
],
|
|
1550
|
+
[
|
|
1551
|
+
"vi",
|
|
1552
|
+
// U.S. Virgin Islands
|
|
1553
|
+
"1",
|
|
1554
|
+
24,
|
|
1555
|
+
["340"],
|
|
1556
|
+
"1"
|
|
1557
|
+
],
|
|
1558
|
+
[
|
|
1559
|
+
"ug",
|
|
1560
|
+
// Uganda
|
|
1561
|
+
"256",
|
|
1562
|
+
0,
|
|
1563
|
+
null,
|
|
1564
|
+
"0"
|
|
1565
|
+
],
|
|
1566
|
+
[
|
|
1567
|
+
"ua",
|
|
1568
|
+
// Ukraine
|
|
1569
|
+
"380",
|
|
1570
|
+
0,
|
|
1571
|
+
null,
|
|
1572
|
+
"0"
|
|
1573
|
+
],
|
|
1574
|
+
[
|
|
1575
|
+
"ae",
|
|
1576
|
+
// United Arab Emirates
|
|
1577
|
+
"971",
|
|
1578
|
+
0,
|
|
1579
|
+
null,
|
|
1580
|
+
"0"
|
|
1581
|
+
],
|
|
1582
|
+
[
|
|
1583
|
+
"gb",
|
|
1584
|
+
// United Kingdom
|
|
1585
|
+
"44",
|
|
1586
|
+
0,
|
|
1587
|
+
null,
|
|
1588
|
+
"0"
|
|
1589
|
+
],
|
|
1590
|
+
[
|
|
1591
|
+
"us",
|
|
1592
|
+
// United States
|
|
1593
|
+
"1",
|
|
1594
|
+
0,
|
|
1595
|
+
null,
|
|
1596
|
+
"1"
|
|
1597
|
+
],
|
|
1598
|
+
[
|
|
1599
|
+
"uy",
|
|
1600
|
+
// Uruguay
|
|
1601
|
+
"598",
|
|
1602
|
+
0,
|
|
1603
|
+
null,
|
|
1604
|
+
"0"
|
|
1605
|
+
],
|
|
1606
|
+
[
|
|
1607
|
+
"uz",
|
|
1608
|
+
// Uzbekistan
|
|
1609
|
+
"998"
|
|
1610
|
+
],
|
|
1611
|
+
[
|
|
1612
|
+
"vu",
|
|
1613
|
+
// Vanuatu
|
|
1614
|
+
"678"
|
|
1615
|
+
],
|
|
1616
|
+
[
|
|
1617
|
+
"va",
|
|
1618
|
+
// Vatican City
|
|
1619
|
+
"39",
|
|
1620
|
+
1,
|
|
1621
|
+
["06698", "3"]
|
|
1622
|
+
// (3 is a mobile range shared with IT)
|
|
1623
|
+
],
|
|
1624
|
+
[
|
|
1625
|
+
"ve",
|
|
1626
|
+
// Venezuela
|
|
1627
|
+
"58",
|
|
1628
|
+
0,
|
|
1629
|
+
null,
|
|
1630
|
+
"0"
|
|
1631
|
+
],
|
|
1632
|
+
[
|
|
1633
|
+
"vn",
|
|
1634
|
+
// Vietnam
|
|
1635
|
+
"84",
|
|
1636
|
+
0,
|
|
1637
|
+
null,
|
|
1638
|
+
"0"
|
|
1639
|
+
],
|
|
1640
|
+
[
|
|
1641
|
+
"wf",
|
|
1642
|
+
// Wallis & Futuna
|
|
1643
|
+
"681"
|
|
1644
|
+
],
|
|
1645
|
+
[
|
|
1646
|
+
"eh",
|
|
1647
|
+
// Western Sahara
|
|
1648
|
+
"212",
|
|
1649
|
+
1,
|
|
1650
|
+
["5288", "5289", "6", "7"],
|
|
1651
|
+
// (6 and 7 are mobile ranges shared with MA)
|
|
1652
|
+
"0"
|
|
1653
|
+
],
|
|
1654
|
+
[
|
|
1655
|
+
"ye",
|
|
1656
|
+
// Yemen
|
|
1657
|
+
"967",
|
|
1658
|
+
0,
|
|
1659
|
+
null,
|
|
1660
|
+
"0"
|
|
1661
|
+
],
|
|
1662
|
+
[
|
|
1663
|
+
"zm",
|
|
1664
|
+
// Zambia
|
|
1665
|
+
"260",
|
|
1666
|
+
0,
|
|
1667
|
+
null,
|
|
1668
|
+
"0"
|
|
1669
|
+
],
|
|
1670
|
+
[
|
|
1671
|
+
"zw",
|
|
1672
|
+
// Zimbabwe
|
|
1673
|
+
"263",
|
|
1674
|
+
0,
|
|
1675
|
+
null,
|
|
1676
|
+
"0"
|
|
1677
|
+
]
|
|
1678
|
+
], A = [];
|
|
1679
|
+
for (const l of q)
|
|
1680
|
+
A.push({
|
|
1681
|
+
name: "",
|
|
1682
|
+
// populated in the plugin
|
|
1683
|
+
iso2: l[0],
|
|
1684
|
+
dialCode: l[1],
|
|
1685
|
+
priority: l[2] || 0,
|
|
1686
|
+
areaCodes: l[3] || null,
|
|
1687
|
+
nodeById: {},
|
|
1688
|
+
// populated by the plugin
|
|
1689
|
+
nationalPrefix: l[4] || null,
|
|
1690
|
+
normalisedName: "",
|
|
1691
|
+
// populated in the plugin
|
|
1692
|
+
initials: "",
|
|
1693
|
+
// populated in the plugin
|
|
1694
|
+
dialCodePlus: ""
|
|
1695
|
+
// populated in the plugin
|
|
1696
|
+
});
|
|
1697
|
+
const S = {
|
|
1698
|
+
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
1699
|
+
CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
|
|
1700
|
+
COUNTRY_CHANGE: "countrychange",
|
|
1701
|
+
INPUT: "input"
|
|
1702
|
+
// used for synthetic input trigger
|
|
1703
|
+
}, h = {
|
|
1704
|
+
HIDE: "iti__hide",
|
|
1705
|
+
V_HIDE: "iti__v-hide",
|
|
1706
|
+
ARROW_UP: "iti__arrow--up",
|
|
1707
|
+
GLOBE: "iti__globe",
|
|
1708
|
+
FLAG: "iti__flag",
|
|
1709
|
+
COUNTRY_ITEM: "iti__country",
|
|
1710
|
+
HIGHLIGHT: "iti__highlight"
|
|
1711
|
+
}, y = {
|
|
1712
|
+
ARROW_UP: "ArrowUp",
|
|
1713
|
+
ARROW_DOWN: "ArrowDown",
|
|
1714
|
+
SPACE: " ",
|
|
1715
|
+
ENTER: "Enter",
|
|
1716
|
+
ESC: "Escape",
|
|
1717
|
+
TAB: "Tab"
|
|
1718
|
+
}, B = {
|
|
1719
|
+
PASTE: "insertFromPaste",
|
|
1720
|
+
DELETE_FWD: "deleteContentForward"
|
|
1721
|
+
}, L = {
|
|
1722
|
+
ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
|
|
1723
|
+
// any kind of letter from any language
|
|
1724
|
+
NON_PLUS_NUMERIC: /[^+0-9]/,
|
|
1725
|
+
// chars that are NOT + or digit
|
|
1726
|
+
NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
|
|
1727
|
+
// chars that are NOT + or digit (global)
|
|
1728
|
+
HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
|
|
1729
|
+
// single acceptable hidden-search char
|
|
1730
|
+
}, X = {
|
|
1731
|
+
HIDDEN_SEARCH_RESET_MS: 1e3
|
|
1732
|
+
}, F = {
|
|
1733
|
+
UNKNOWN_NUMBER_TYPE: -99,
|
|
1734
|
+
UNKNOWN_VALIDATION_ERROR: -99
|
|
1735
|
+
}, v = {
|
|
1736
|
+
SANE_SELECTED_WITH_DIAL_WIDTH: 78,
|
|
1737
|
+
// px width fallback when separateDialCode enabled
|
|
1738
|
+
SANE_SELECTED_NO_DIAL_WIDTH: 42,
|
|
1739
|
+
// px width fallback when no separate dial code
|
|
1740
|
+
INPUT_PADDING_EXTRA_LEFT: 6
|
|
1741
|
+
// px gap between selected country container and input text
|
|
1742
|
+
}, j = {
|
|
1743
|
+
NANP: "1"
|
|
1744
|
+
// North American Numbering Plan
|
|
1745
|
+
}, R = {
|
|
1746
|
+
DIAL_CODE: "44",
|
|
1747
|
+
// +44 United Kingdom
|
|
1748
|
+
MOBILE_PREFIX: "7",
|
|
1749
|
+
// UK mobile numbers start with 7 after national trunk (0) or core section
|
|
1750
|
+
MOBILE_CORE_LENGTH: 10
|
|
1751
|
+
// core number length (excluding dial code / national prefix) for mobiles
|
|
1752
|
+
}, Q = {
|
|
1753
|
+
ISO2: "us"
|
|
1754
|
+
}, M = {
|
|
1755
|
+
AGGRESSIVE: "aggressive",
|
|
1756
|
+
POLITE: "polite"
|
|
1757
|
+
}, x = {
|
|
1758
|
+
AUTO: "auto"
|
|
1759
|
+
}, V = {
|
|
1760
|
+
COUNTRY_CODE: "countryCode",
|
|
1761
|
+
DIAL_CODE: "dialCode"
|
|
1762
|
+
}, p = {
|
|
1763
|
+
EXPANDED: "aria-expanded",
|
|
1764
|
+
LABEL: "aria-label",
|
|
1765
|
+
SELECTED: "aria-selected",
|
|
1766
|
+
ACTIVE_DESCENDANT: "aria-activedescendant",
|
|
1767
|
+
HASPOPUP: "aria-haspopup",
|
|
1768
|
+
CONTROLS: "aria-controls",
|
|
1769
|
+
HIDDEN: "aria-hidden",
|
|
1770
|
+
AUTOCOMPLETE: "aria-autocomplete",
|
|
1771
|
+
MODAL: "aria-modal"
|
|
1772
|
+
}, Z = {
|
|
1773
|
+
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
1774
|
+
noCountrySelected: "Select country",
|
|
1775
|
+
countryListAriaLabel: "List of countries",
|
|
1776
|
+
searchPlaceholder: "Search",
|
|
1777
|
+
clearSearchAriaLabel: "Clear search",
|
|
1778
|
+
searchEmptyState: "No results found",
|
|
1779
|
+
searchSummaryAria(l) {
|
|
1780
|
+
return l === 0 ? "No results found" : l === 1 ? "1 result found" : `${l} results found`;
|
|
1781
|
+
}
|
|
1782
|
+
}, U = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, J = () => {
|
|
1783
|
+
if (typeof navigator < "u" && typeof window < "u") {
|
|
1784
|
+
const l = U("(max-width: 500px)"), t = U("(max-height: 600px)"), e = U("(pointer: coarse)");
|
|
1785
|
+
return l || e && t;
|
|
1786
|
+
}
|
|
1787
|
+
return !1;
|
|
1788
|
+
}, K = {
|
|
1789
|
+
//* Whether or not to allow the dropdown.
|
|
1790
|
+
allowDropdown: !0,
|
|
1791
|
+
//* Whether or not to allow extensions after the main number.
|
|
1792
|
+
allowNumberExtensions: !1,
|
|
1793
|
+
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1794
|
+
allowPhonewords: !1,
|
|
1795
|
+
//* Add a placeholder in the input with an example number for the selected country.
|
|
1796
|
+
autoPlaceholder: M.POLITE,
|
|
1797
|
+
//* Modify the parentClass.
|
|
1798
|
+
containerClass: "",
|
|
1799
|
+
//* Locale for localising country names via Intl.DisplayNames.
|
|
1800
|
+
countryNameLocale: "en",
|
|
1801
|
+
//* The order of the countries in the dropdown. Defaults to alphabetical.
|
|
1802
|
+
countryOrder: null,
|
|
1803
|
+
//* Add a country search input at the top of the dropdown.
|
|
1804
|
+
countrySearch: !0,
|
|
1805
|
+
//* Modify the auto placeholder.
|
|
1806
|
+
customPlaceholder: null,
|
|
1807
|
+
//* Append menu to specified element.
|
|
1808
|
+
dropdownContainer: null,
|
|
1809
|
+
//* Don't display these countries.
|
|
1810
|
+
excludeCountries: [],
|
|
1811
|
+
//* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
|
|
1812
|
+
fixDropdownWidth: !0,
|
|
1813
|
+
//* Format the number as the user types
|
|
1814
|
+
formatAsYouType: !0,
|
|
1815
|
+
//* Format the input value during initialisation and on setNumber.
|
|
1816
|
+
formatOnDisplay: !0,
|
|
1817
|
+
//* geoIp lookup function.
|
|
1818
|
+
geoIpLookup: null,
|
|
1819
|
+
//* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
|
|
1820
|
+
hiddenInput: null,
|
|
1821
|
+
//* Internationalise the plugin text e.g. search input placeholder, country names.
|
|
1822
|
+
i18n: {},
|
|
1823
|
+
//* Initial country.
|
|
1824
|
+
initialCountry: "",
|
|
1825
|
+
//* A function to load the utils script.
|
|
1826
|
+
loadUtils: null,
|
|
1827
|
+
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1828
|
+
nationalMode: !0,
|
|
1829
|
+
//* Display only these countries.
|
|
1830
|
+
onlyCountries: [],
|
|
1831
|
+
//* Number type to use for placeholders.
|
|
1832
|
+
placeholderNumberType: "MOBILE",
|
|
1833
|
+
//* Show flags - for both the selected country, and in the country dropdown
|
|
1834
|
+
showFlags: !0,
|
|
1835
|
+
//* Display the international dial code next to the selected flag.
|
|
1836
|
+
separateDialCode: !1,
|
|
1837
|
+
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
1838
|
+
strictMode: !1,
|
|
1839
|
+
//* Use full screen popup instead of dropdown for country list.
|
|
1840
|
+
useFullscreenPopup: J(),
|
|
1841
|
+
//* The number type to enforce during validation.
|
|
1842
|
+
allowedNumberTypes: ["MOBILE", "FIXED_LINE"]
|
|
1843
|
+
}, tt = (l) => {
|
|
1844
|
+
l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...Z, ...l.i18n };
|
|
1845
|
+
}, P = (l) => l.replace(/\D/g, ""), Y = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), et = (l, t) => {
|
|
1846
|
+
const e = Y(t), s = [], i = [], o = [], n = [], r = [], a = [];
|
|
1847
|
+
for (const c of l)
|
|
1848
|
+
c.iso2 === e ? s.push(c) : c.normalisedName.startsWith(e) ? i.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ? r.push(c) : c.initials.includes(e) && a.push(c);
|
|
1849
|
+
const d = (c, m) => c.priority - m.priority;
|
|
1850
|
+
return [
|
|
1851
|
+
...s.sort(d),
|
|
1852
|
+
...i.sort(d),
|
|
1853
|
+
...o.sort(d),
|
|
1854
|
+
...n.sort(d),
|
|
1855
|
+
...r.sort(d),
|
|
1856
|
+
...a.sort(d)
|
|
1857
|
+
];
|
|
1858
|
+
}, st = (l, t) => {
|
|
1859
|
+
const e = t.toLowerCase();
|
|
1860
|
+
for (const s of l)
|
|
1861
|
+
if (s.name.toLowerCase().startsWith(e))
|
|
1862
|
+
return s;
|
|
1863
|
+
return null;
|
|
1864
|
+
}, H = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), C = (l, t, e) => {
|
|
1865
|
+
const s = document.createElement(l);
|
|
1866
|
+
return t && Object.entries(t).forEach(
|
|
1867
|
+
([i, o]) => s.setAttribute(i, o)
|
|
1868
|
+
), e && e.appendChild(s), s;
|
|
1869
|
+
}, it = () => `
|
|
1870
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
|
|
1871
|
+
<circle cx="11" cy="11" r="7" />
|
|
1872
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1873
|
+
</svg>`, nt = (l) => {
|
|
1874
|
+
const t = `iti-${l}-clear-mask`;
|
|
1875
|
+
return `
|
|
1876
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
|
|
1877
|
+
<mask id="${t}" maskUnits="userSpaceOnUse">
|
|
1878
|
+
<rect width="16" height="16" fill="white" />
|
|
1879
|
+
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
|
1880
|
+
</mask>
|
|
1881
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
|
|
1882
|
+
</svg>`;
|
|
1883
|
+
}, ot = () => `
|
|
1884
|
+
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
1885
|
+
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
1886
|
+
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
1887
|
+
</svg>`;
|
|
1888
|
+
class lt {
|
|
1889
|
+
constructor(t, e, s) {
|
|
1890
|
+
this.highlightedItem = null, this.selectedItem = null, t.dataset.intlTelInputId = s.toString(), this.telInput = t, this.options = e, this.id = s, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
|
|
1891
|
+
}
|
|
1892
|
+
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1893
|
+
generateMarkup(t) {
|
|
1894
|
+
this.countries = t, this.telInput.classList.add("iti__tel-input");
|
|
1895
|
+
const e = this._createWrapperAndInsert();
|
|
1896
|
+
this._maybeBuildCountryContainer(e), e.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(e);
|
|
1897
|
+
}
|
|
1898
|
+
_createWrapperAndInsert() {
|
|
1899
|
+
const { allowDropdown: t, showFlags: e, containerClass: s, useFullscreenPopup: i } = this.options, o = H({
|
|
1900
|
+
iti: !0,
|
|
1901
|
+
"iti--allow-dropdown": t,
|
|
1902
|
+
"iti--show-flags": e,
|
|
1903
|
+
"iti--inline-dropdown": !i,
|
|
1904
|
+
[s]: !!s
|
|
1905
|
+
}), n = C("div", { class: o });
|
|
1906
|
+
return this.isRTL && n.setAttribute("dir", "ltr"), this.telInput.before(n), n;
|
|
1907
|
+
}
|
|
1908
|
+
_maybeBuildCountryContainer(t) {
|
|
1909
|
+
const { allowDropdown: e, separateDialCode: s, showFlags: i } = this.options;
|
|
1910
|
+
if (e || i || s) {
|
|
1911
|
+
this.countryContainer = C(
|
|
1912
|
+
"div",
|
|
1913
|
+
// visibly hidden until we measure it's width to set the input padding correctly
|
|
1914
|
+
{ class: `iti__country-container ${h.V_HIDE}` },
|
|
1915
|
+
t
|
|
1916
|
+
), e ? (this.selectedCountry = C(
|
|
1917
|
+
"button",
|
|
1918
|
+
{
|
|
1919
|
+
type: "button",
|
|
1920
|
+
class: "iti__selected-country",
|
|
1921
|
+
[p.EXPANDED]: "false",
|
|
1922
|
+
[p.LABEL]: this.options.i18n.noCountrySelected,
|
|
1923
|
+
[p.HASPOPUP]: "dialog",
|
|
1924
|
+
[p.CONTROLS]: `iti-${this.id}__dropdown-content`
|
|
1925
|
+
},
|
|
1926
|
+
this.countryContainer
|
|
1927
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = C(
|
|
1928
|
+
"div",
|
|
1929
|
+
{ class: "iti__selected-country" },
|
|
1930
|
+
this.countryContainer
|
|
1931
|
+
);
|
|
1932
|
+
const o = C(
|
|
1933
|
+
"div",
|
|
1934
|
+
{ class: "iti__selected-country-primary" },
|
|
1935
|
+
this.selectedCountry
|
|
1936
|
+
);
|
|
1937
|
+
this.selectedCountryInner = C(
|
|
1938
|
+
"div",
|
|
1939
|
+
{ class: h.FLAG },
|
|
1940
|
+
o
|
|
1941
|
+
), e && (this.dropdownArrow = C(
|
|
1942
|
+
"div",
|
|
1943
|
+
{ class: "iti__arrow", [p.HIDDEN]: "true" },
|
|
1944
|
+
o
|
|
1945
|
+
)), s && (this.selectedDialCode = C(
|
|
1946
|
+
"div",
|
|
1947
|
+
{ class: "iti__selected-dial-code" },
|
|
1948
|
+
this.selectedCountry
|
|
1949
|
+
)), e && this._buildDropdownContent();
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
_buildDropdownContent() {
|
|
1953
|
+
const {
|
|
1954
|
+
fixDropdownWidth: t,
|
|
1955
|
+
useFullscreenPopup: e,
|
|
1956
|
+
countrySearch: s,
|
|
1957
|
+
i18n: i,
|
|
1958
|
+
dropdownContainer: o,
|
|
1959
|
+
containerClass: n
|
|
1960
|
+
} = this.options, r = t ? "" : "iti--flexible-dropdown-width";
|
|
1961
|
+
if (this.dropdownContent = C("div", {
|
|
1962
|
+
id: `iti-${this.id}__dropdown-content`,
|
|
1963
|
+
class: `iti__dropdown-content ${h.HIDE} ${r}`,
|
|
1964
|
+
role: "dialog",
|
|
1965
|
+
[p.MODAL]: "true"
|
|
1966
|
+
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), s && this._buildSearchUI(), this.countryList = C(
|
|
1967
|
+
"ul",
|
|
1968
|
+
{
|
|
1969
|
+
class: "iti__country-list",
|
|
1970
|
+
id: `iti-${this.id}__country-listbox`,
|
|
1971
|
+
role: "listbox",
|
|
1972
|
+
[p.LABEL]: i.countryListAriaLabel
|
|
1973
|
+
},
|
|
1974
|
+
this.dropdownContent
|
|
1975
|
+
), this._appendListItems(), s && this.updateSearchResultsA11yText(), o) {
|
|
1976
|
+
const a = H({
|
|
1977
|
+
iti: !0,
|
|
1978
|
+
"iti--container": !0,
|
|
1979
|
+
"iti--fullscreen-popup": e,
|
|
1980
|
+
"iti--inline-dropdown": !e,
|
|
1981
|
+
[n]: !!n
|
|
1982
|
+
});
|
|
1983
|
+
this.dropdown = C("div", { class: a }), this.dropdown.appendChild(this.dropdownContent);
|
|
1984
|
+
} else
|
|
1985
|
+
this.countryContainer.appendChild(this.dropdownContent);
|
|
1986
|
+
}
|
|
1987
|
+
_buildSearchUI() {
|
|
1988
|
+
const { i18n: t } = this.options, e = C(
|
|
1989
|
+
"div",
|
|
1990
|
+
{ class: "iti__search-input-wrapper" },
|
|
1991
|
+
this.dropdownContent
|
|
1992
|
+
);
|
|
1993
|
+
this.searchIcon = C(
|
|
1994
|
+
"span",
|
|
1995
|
+
{
|
|
1996
|
+
class: "iti__search-icon",
|
|
1997
|
+
[p.HIDDEN]: "true"
|
|
1998
|
+
},
|
|
1999
|
+
e
|
|
2000
|
+
), this.searchIcon.innerHTML = it(), this.searchInput = C(
|
|
2001
|
+
"input",
|
|
2002
|
+
{
|
|
2003
|
+
id: `iti-${this.id}__search-input`,
|
|
2004
|
+
// Chrome says inputs need either a name or an id
|
|
2005
|
+
type: "search",
|
|
2006
|
+
class: "iti__search-input",
|
|
2007
|
+
placeholder: t.searchPlaceholder,
|
|
2008
|
+
// role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
|
|
2009
|
+
role: "combobox",
|
|
2010
|
+
[p.EXPANDED]: "true",
|
|
2011
|
+
[p.LABEL]: t.searchPlaceholder,
|
|
2012
|
+
[p.CONTROLS]: `iti-${this.id}__country-listbox`,
|
|
2013
|
+
[p.AUTOCOMPLETE]: "list",
|
|
2014
|
+
autocomplete: "off"
|
|
2015
|
+
},
|
|
2016
|
+
e
|
|
2017
|
+
), this.searchClearButton = C(
|
|
2018
|
+
"button",
|
|
2019
|
+
{
|
|
2020
|
+
type: "button",
|
|
2021
|
+
class: `iti__search-clear ${h.HIDE}`,
|
|
2022
|
+
[p.LABEL]: t.clearSearchAriaLabel,
|
|
2023
|
+
tabindex: "-1"
|
|
2024
|
+
},
|
|
2025
|
+
e
|
|
2026
|
+
), this.searchClearButton.innerHTML = nt(this.id), this.searchResultsA11yText = C(
|
|
2027
|
+
"span",
|
|
2028
|
+
{ class: "iti__a11y-text" },
|
|
2029
|
+
this.dropdownContent
|
|
2030
|
+
), this.searchNoResults = C(
|
|
2031
|
+
"div",
|
|
2032
|
+
{
|
|
2033
|
+
class: `iti__no-results ${h.HIDE}`,
|
|
2034
|
+
[p.HIDDEN]: "true"
|
|
2035
|
+
// all a11y messaging happens in this.searchResultsA11yText
|
|
2036
|
+
},
|
|
2037
|
+
this.dropdownContent
|
|
2038
|
+
), this.searchNoResults.textContent = t.searchEmptyState;
|
|
2039
|
+
}
|
|
2040
|
+
_maybeUpdateInputPaddingAndReveal() {
|
|
2041
|
+
this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(h.V_HIDE));
|
|
2042
|
+
}
|
|
2043
|
+
_maybeBuildHiddenInputs(t) {
|
|
2044
|
+
var s, i;
|
|
2045
|
+
const { hiddenInput: e } = this.options;
|
|
2046
|
+
if (e) {
|
|
2047
|
+
const o = this.telInput.getAttribute("name") || "", n = e(o);
|
|
2048
|
+
if (n.phone) {
|
|
2049
|
+
const r = (s = this.telInput.form) == null ? void 0 : s.querySelector(
|
|
2050
|
+
`input[name="${n.phone}"]`
|
|
2051
|
+
);
|
|
2052
|
+
r ? this.hiddenInput = r : (this.hiddenInput = C("input", {
|
|
2053
|
+
type: "hidden",
|
|
2054
|
+
name: n.phone
|
|
2055
|
+
}), t.appendChild(this.hiddenInput));
|
|
2056
|
+
}
|
|
2057
|
+
if (n.country) {
|
|
2058
|
+
const r = (i = this.telInput.form) == null ? void 0 : i.querySelector(
|
|
2059
|
+
`input[name="${n.country}"]`
|
|
2060
|
+
);
|
|
2061
|
+
r ? this.hiddenInputCountry = r : (this.hiddenInputCountry = C("input", {
|
|
2062
|
+
type: "hidden",
|
|
2063
|
+
name: n.country
|
|
2064
|
+
}), t.appendChild(this.hiddenInputCountry));
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
2069
|
+
_appendListItems() {
|
|
2070
|
+
const t = document.createDocumentFragment();
|
|
2071
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
2072
|
+
const s = this.countries[e], i = H({
|
|
2073
|
+
[h.COUNTRY_ITEM]: !0
|
|
2074
|
+
}), o = C("li", {
|
|
2075
|
+
id: `iti-${this.id}__item-${s.iso2}`,
|
|
2076
|
+
class: i,
|
|
2077
|
+
tabindex: "-1",
|
|
2078
|
+
role: "option",
|
|
2079
|
+
[p.SELECTED]: "false"
|
|
2080
|
+
});
|
|
2081
|
+
o.dataset.dialCode = s.dialCode, o.dataset.countryCode = s.iso2, s.nodeById[this.id] = o, this.options.showFlags && C("div", { class: `${h.FLAG} iti__${s.iso2}` }, o);
|
|
2082
|
+
const n = C("span", { class: "iti__country-name" }, o);
|
|
2083
|
+
n.textContent = s.name;
|
|
2084
|
+
const r = C("span", { class: "iti__dial-code" }, o);
|
|
2085
|
+
this.isRTL && r.setAttribute("dir", "ltr"), r.textContent = `+${s.dialCode}`, t.appendChild(o);
|
|
2086
|
+
}
|
|
2087
|
+
this.countryList.appendChild(t);
|
|
2088
|
+
}
|
|
2089
|
+
//* Update the input padding to make space for the selected country/dial code.
|
|
2090
|
+
updateInputPadding() {
|
|
2091
|
+
if (this.selectedCountry) {
|
|
2092
|
+
const t = this.options.separateDialCode ? v.SANE_SELECTED_WITH_DIAL_WIDTH : v.SANE_SELECTED_NO_DIAL_WIDTH, s = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + v.INPUT_PADDING_EXTRA_LEFT;
|
|
2093
|
+
this.telInput.style.paddingLeft = `${s}px`;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2097
|
+
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2098
|
+
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2099
|
+
//* and then to inject a deep clone of the selectedCountry element.
|
|
2100
|
+
_getHiddenSelectedCountryWidth() {
|
|
2101
|
+
if (this.telInput.parentNode) {
|
|
2102
|
+
let t;
|
|
2103
|
+
try {
|
|
2104
|
+
t = window.top.document.body;
|
|
2105
|
+
} catch {
|
|
2106
|
+
t = document.body;
|
|
2107
|
+
}
|
|
2108
|
+
const e = this.telInput.parentNode.cloneNode(
|
|
2109
|
+
!1
|
|
2110
|
+
);
|
|
2111
|
+
e.style.visibility = "hidden", t.appendChild(e);
|
|
2112
|
+
const s = this.countryContainer.cloneNode();
|
|
2113
|
+
e.appendChild(s);
|
|
2114
|
+
const i = this.selectedCountry.cloneNode(
|
|
2115
|
+
!0
|
|
2116
|
+
);
|
|
2117
|
+
s.appendChild(i);
|
|
2118
|
+
const o = i.offsetWidth;
|
|
2119
|
+
return t.removeChild(e), o;
|
|
2120
|
+
}
|
|
2121
|
+
return 0;
|
|
2122
|
+
}
|
|
2123
|
+
//* Update search results text (for a11y).
|
|
2124
|
+
updateSearchResultsA11yText() {
|
|
2125
|
+
const { i18n: t } = this.options, e = this.countryList.childElementCount;
|
|
2126
|
+
this.searchResultsA11yText.textContent = t.searchSummaryAria(e);
|
|
2127
|
+
}
|
|
2128
|
+
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2129
|
+
scrollTo(t) {
|
|
2130
|
+
const e = this.countryList, s = document.documentElement.scrollTop, i = e.offsetHeight, o = e.getBoundingClientRect().top + s, n = o + i, r = t.offsetHeight, a = t.getBoundingClientRect().top + s, d = a + r, c = a - o + e.scrollTop;
|
|
2131
|
+
if (a < o)
|
|
2132
|
+
e.scrollTop = c;
|
|
2133
|
+
else if (d > n) {
|
|
2134
|
+
const m = i - r;
|
|
2135
|
+
e.scrollTop = c - m;
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
//* Remove highlighting from the previous list item and highlight the new one.
|
|
2139
|
+
highlightListItem(t, e) {
|
|
2140
|
+
const s = this.highlightedItem;
|
|
2141
|
+
if (s && s.classList.remove(h.HIGHLIGHT), this.highlightedItem = t, this.highlightedItem && (this.highlightedItem.classList.add(h.HIGHLIGHT), this.options.countrySearch)) {
|
|
2142
|
+
const i = this.highlightedItem.getAttribute("id") || "";
|
|
2143
|
+
this.searchInput.setAttribute(p.ACTIVE_DESCENDANT, i);
|
|
2144
|
+
}
|
|
2145
|
+
e && this.highlightedItem.focus();
|
|
2146
|
+
}
|
|
2147
|
+
updateSelectedItem(t) {
|
|
2148
|
+
if (this.selectedItem && this.selectedItem.dataset.countryCode !== t && (this.selectedItem.setAttribute(p.SELECTED, "false"), this.selectedItem = null), t && !this.selectedItem) {
|
|
2149
|
+
const e = this.countryList.querySelector(
|
|
2150
|
+
`[data-country-code="${t}"]`
|
|
2151
|
+
);
|
|
2152
|
+
e && (e.setAttribute(p.SELECTED, "true"), this.selectedItem = e);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
//* Country search: Filter the country list to the given array of countries.
|
|
2156
|
+
filterCountries(t) {
|
|
2157
|
+
this.countryList.innerHTML = "";
|
|
2158
|
+
let e = !0;
|
|
2159
|
+
for (const s of t) {
|
|
2160
|
+
const i = s.nodeById[this.id];
|
|
2161
|
+
i && (this.countryList.appendChild(i), e && (this.highlightListItem(i, !1), e = !1));
|
|
2162
|
+
}
|
|
2163
|
+
e ? (this.highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove(h.HIDE)) : this.searchNoResults && this.searchNoResults.classList.add(h.HIDE), this.countryList.scrollTop = 0, this.updateSearchResultsA11yText();
|
|
2164
|
+
}
|
|
2165
|
+
destroy() {
|
|
2166
|
+
this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2167
|
+
const t = this.telInput.parentNode;
|
|
2168
|
+
t.before(this.telInput), t.remove(), this.telInput = null, this.countryContainer = null, this.selectedCountry = null, this.selectedCountryInner = null, this.selectedDialCode = null, this.dropdownArrow = null, this.dropdownContent = null, this.searchInput = null, this.searchIcon = null, this.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null, this.selectedItem = null;
|
|
2169
|
+
for (const e of this.countries)
|
|
2170
|
+
delete e.nodeById[this.id];
|
|
2171
|
+
this.countries = null;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
const rt = (l) => {
|
|
2175
|
+
const { onlyCountries: t, excludeCountries: e } = l;
|
|
2176
|
+
if (t.length) {
|
|
2177
|
+
const s = t.map(
|
|
2178
|
+
(i) => i.toLowerCase()
|
|
2179
|
+
);
|
|
2180
|
+
return A.filter(
|
|
2181
|
+
(i) => s.includes(i.iso2)
|
|
2182
|
+
);
|
|
2183
|
+
} else if (e.length) {
|
|
2184
|
+
const s = e.map(
|
|
2185
|
+
(i) => i.toLowerCase()
|
|
2186
|
+
);
|
|
2187
|
+
return A.filter(
|
|
2188
|
+
(i) => !s.includes(i.iso2)
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
return A;
|
|
2192
|
+
}, at = (l, t) => {
|
|
2193
|
+
const { countryNameLocale: e, i18n: s } = t, o = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(e, {
|
|
2194
|
+
type: "region"
|
|
2195
|
+
}) : null;
|
|
2196
|
+
for (const n of l)
|
|
2197
|
+
n.name = s[n.iso2] || (o == null ? void 0 : o.of(n.iso2.toUpperCase()));
|
|
2198
|
+
}, ut = (l) => {
|
|
2199
|
+
const t = /* @__PURE__ */ new Set();
|
|
2200
|
+
let e = 0;
|
|
2201
|
+
const s = {}, i = (n, r) => {
|
|
2202
|
+
if (!n || !r)
|
|
2203
|
+
return;
|
|
2204
|
+
r.length > e && (e = r.length), s.hasOwnProperty(r) || (s[r] = []);
|
|
2205
|
+
const a = s[r];
|
|
2206
|
+
a.includes(n) || a.push(n);
|
|
2207
|
+
}, o = [...l].sort((n, r) => n.priority - r.priority);
|
|
2208
|
+
for (const n of o) {
|
|
2209
|
+
t.has(n.dialCode) || t.add(n.dialCode);
|
|
2210
|
+
for (let r = 1; r < n.dialCode.length; r++) {
|
|
2211
|
+
const a = n.dialCode.substring(0, r);
|
|
2212
|
+
i(n.iso2, a);
|
|
2213
|
+
}
|
|
2214
|
+
if (i(n.iso2, n.dialCode), n.areaCodes) {
|
|
2215
|
+
const r = s[n.dialCode][0];
|
|
2216
|
+
for (const a of n.areaCodes) {
|
|
2217
|
+
for (let d = 1; d < a.length; d++) {
|
|
2218
|
+
const c = a.substring(0, d), m = n.dialCode + c;
|
|
2219
|
+
i(r, m), i(n.iso2, m);
|
|
2220
|
+
}
|
|
2221
|
+
i(n.iso2, n.dialCode + a);
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return { dialCodes: t, dialCodeMaxLen: e, dialCodeToIso2Map: s };
|
|
2226
|
+
}, dt = (l, t) => {
|
|
2227
|
+
t.countryOrder && (t.countryOrder = t.countryOrder.map(
|
|
2228
|
+
(e) => e.toLowerCase()
|
|
2229
|
+
)), l.sort((e, s) => {
|
|
2230
|
+
const { countryOrder: i } = t;
|
|
2231
|
+
if (i) {
|
|
2232
|
+
const o = i.indexOf(e.iso2), n = i.indexOf(s.iso2), r = o > -1, a = n > -1;
|
|
2233
|
+
if (r || a)
|
|
2234
|
+
return r && a ? o - n : r ? -1 : 1;
|
|
2235
|
+
}
|
|
2236
|
+
return e.name.localeCompare(s.name);
|
|
2237
|
+
});
|
|
2238
|
+
}, ct = (l) => {
|
|
2239
|
+
for (const t of l)
|
|
2240
|
+
t.normalisedName = Y(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
|
|
2241
|
+
}, $ = (l, t, e, s) => {
|
|
2242
|
+
let i = l;
|
|
2243
|
+
if (e && t) {
|
|
2244
|
+
const o = `+${s.dialCode}`, n = i[o.length] === " " || i[o.length] === "-" ? o.length + 1 : o.length;
|
|
2245
|
+
i = i.substring(n);
|
|
2246
|
+
}
|
|
2247
|
+
return i;
|
|
2248
|
+
}, ht = (l, t, e, s, i) => {
|
|
2249
|
+
const o = e ? e.formatNumberAsYouType(l, s.iso2) : l, { dialCode: n } = s;
|
|
2250
|
+
return i && t.charAt(0) !== "+" && o.includes(`+${n}`) ? (o.split(`+${n}`)[1] || "").trim() : o;
|
|
2251
|
+
}, pt = (l, t, e, s) => {
|
|
2252
|
+
if (e === 0 && !s)
|
|
2253
|
+
return 0;
|
|
2254
|
+
let i = 0;
|
|
2255
|
+
for (let o = 0; o < t.length; o++) {
|
|
2256
|
+
if (/[+0-9]/.test(t[o]) && i++, i === l && !s)
|
|
2257
|
+
return o + 1;
|
|
2258
|
+
if (s && i === l + 1)
|
|
2259
|
+
return o;
|
|
2260
|
+
}
|
|
2261
|
+
return t.length;
|
|
2262
|
+
}, Ct = [
|
|
2263
|
+
"800",
|
|
2264
|
+
"822",
|
|
2265
|
+
"833",
|
|
2266
|
+
"844",
|
|
2267
|
+
"855",
|
|
2268
|
+
"866",
|
|
2269
|
+
"877",
|
|
2270
|
+
"880",
|
|
2271
|
+
"881",
|
|
2272
|
+
"882",
|
|
2273
|
+
"883",
|
|
2274
|
+
"884",
|
|
2275
|
+
"885",
|
|
2276
|
+
"886",
|
|
2277
|
+
"887",
|
|
2278
|
+
"888",
|
|
2279
|
+
"889"
|
|
2280
|
+
], G = (l) => {
|
|
2281
|
+
const t = P(l);
|
|
2282
|
+
if (t.startsWith(j.NANP) && t.length >= 4) {
|
|
2283
|
+
const e = t.substring(1, 4);
|
|
2284
|
+
return Ct.includes(e);
|
|
2285
|
+
}
|
|
2286
|
+
return !1;
|
|
2287
|
+
};
|
|
2288
|
+
let mt = 0;
|
|
2289
|
+
const ft = new Set(A.map((l) => l.iso2)), k = (l) => ft.has(l);
|
|
2290
|
+
class W {
|
|
2291
|
+
constructor(t, e = {}) {
|
|
2292
|
+
this.id = mt++, this.options = { ...K, ...e }, tt(this.options), this.ui = new lt(t, this.options, this.id), this.isAndroid = W._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = rt(this.options);
|
|
2293
|
+
const { dialCodes: s, dialCodeMaxLen: i, dialCodeToIso2Map: o } = ut(
|
|
2294
|
+
this.countries
|
|
2295
|
+
);
|
|
2296
|
+
this.dialCodes = s, this.dialCodeMaxLen = i, this.dialCodeToIso2Map = o, this.countryByIso2 = new Map(this.countries.map((n) => [n.iso2, n])), this._init();
|
|
2297
|
+
}
|
|
2298
|
+
static _getIsAndroid() {
|
|
2299
|
+
return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
|
|
2300
|
+
}
|
|
2301
|
+
_updateNumeralSet(t) {
|
|
2302
|
+
/[\u0660-\u0669]/.test(t) ? this.userNumeralSet = "arabic-indic" : /[\u06F0-\u06F9]/.test(t) ? this.userNumeralSet = "persian" : this.userNumeralSet = "ascii";
|
|
2303
|
+
}
|
|
2304
|
+
_mapAsciiToUserNumerals(t) {
|
|
2305
|
+
if (this.userNumeralSet || this._updateNumeralSet(this.ui.telInput.value), this.userNumeralSet === "ascii")
|
|
2306
|
+
return t;
|
|
2307
|
+
const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776;
|
|
2308
|
+
return t.replace(/[0-9]/g, (s) => String.fromCharCode(e + Number(s)));
|
|
2309
|
+
}
|
|
2310
|
+
// Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
|
|
2311
|
+
_normaliseNumerals(t) {
|
|
2312
|
+
if (!t)
|
|
2313
|
+
return "";
|
|
2314
|
+
if (this._updateNumeralSet(t), this.userNumeralSet === "ascii")
|
|
2315
|
+
return t;
|
|
2316
|
+
const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776, s = this.userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
|
|
2317
|
+
return t.replace(s, (i) => String.fromCharCode(48 + (i.charCodeAt(0) - e)));
|
|
2318
|
+
}
|
|
2319
|
+
_getTelInputValue() {
|
|
2320
|
+
const t = this.ui.telInput.value.trim();
|
|
2321
|
+
return this._normaliseNumerals(t);
|
|
2322
|
+
}
|
|
2323
|
+
_setTelInputValue(t) {
|
|
2324
|
+
this.ui.telInput.value = this._mapAsciiToUserNumerals(t);
|
|
2325
|
+
}
|
|
2326
|
+
_createInitPromises() {
|
|
2327
|
+
const t = new Promise((s, i) => {
|
|
2328
|
+
this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = i;
|
|
2329
|
+
}), e = new Promise((s, i) => {
|
|
2330
|
+
this.resolveUtilsScriptPromise = s, this.rejectUtilsScriptPromise = i;
|
|
2331
|
+
});
|
|
2332
|
+
return Promise.all([t, e]);
|
|
2333
|
+
}
|
|
2334
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
2335
|
+
_init() {
|
|
2336
|
+
this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
2337
|
+
}
|
|
2338
|
+
//********************
|
|
2339
|
+
//* PRIVATE METHODS
|
|
2340
|
+
//********************
|
|
2341
|
+
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
2342
|
+
_processCountryData() {
|
|
2343
|
+
at(this.countries, this.options), dt(this.countries, this.options), ct(this.countries);
|
|
2344
|
+
}
|
|
2345
|
+
//* Set the initial state of the input value and the selected country by:
|
|
2346
|
+
//* 1. Extracting a dial code from the given number
|
|
2347
|
+
//* 2. Using explicit initialCountry
|
|
2348
|
+
_setInitialState(t = !1) {
|
|
2349
|
+
const e = this.ui.telInput.getAttribute("value"), s = this._normaliseNumerals(e), i = this._getTelInputValue(), n = s && s.startsWith("+") && (!i || !i.startsWith("+")) ? s : i, r = this._getDialCode(n), a = G(n), { initialCountry: d, geoIpLookup: c } = this.options, m = d === x.AUTO && c;
|
|
2350
|
+
if (r && !a)
|
|
2351
|
+
this._updateCountryFromNumber(n);
|
|
2352
|
+
else if (!m || t) {
|
|
2353
|
+
const g = d ? d.toLowerCase() : "";
|
|
2354
|
+
k(g) ? this._setCountry(g) : r && a ? this._setCountry(Q.ISO2) : this._setCountry("");
|
|
2355
|
+
}
|
|
2356
|
+
n && this._updateValFromNumber(n);
|
|
2357
|
+
}
|
|
2358
|
+
//* Initialise the main event listeners: input keyup, and click selected country.
|
|
2359
|
+
_initListeners() {
|
|
2360
|
+
this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
|
|
2361
|
+
}
|
|
2362
|
+
//* Update hidden input on form submit.
|
|
2363
|
+
_initHiddenInputListener() {
|
|
2364
|
+
var e;
|
|
2365
|
+
const t = () => {
|
|
2366
|
+
this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
|
|
2367
|
+
};
|
|
2368
|
+
(e = this.ui.telInput.form) == null || e.addEventListener("submit", t, {
|
|
2369
|
+
signal: this.abortController.signal
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
//* initialise the dropdown listeners.
|
|
2373
|
+
_initDropdownListeners() {
|
|
2374
|
+
const t = this.abortController.signal, e = (n) => {
|
|
2375
|
+
this.ui.dropdownContent.classList.contains(h.HIDE) ? this.ui.telInput.focus() : n.preventDefault();
|
|
2376
|
+
}, s = this.ui.telInput.closest("label");
|
|
2377
|
+
s && s.addEventListener("click", e, { signal: t });
|
|
2378
|
+
const i = () => {
|
|
2379
|
+
this.ui.dropdownContent.classList.contains(
|
|
2380
|
+
h.HIDE
|
|
2381
|
+
) && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
|
|
2382
|
+
};
|
|
2383
|
+
this.ui.selectedCountry.addEventListener(
|
|
2384
|
+
"click",
|
|
2385
|
+
i,
|
|
2386
|
+
{
|
|
2387
|
+
signal: t
|
|
2388
|
+
}
|
|
2389
|
+
);
|
|
2390
|
+
const o = (n) => {
|
|
2391
|
+
this.ui.dropdownContent.classList.contains(
|
|
2392
|
+
h.HIDE
|
|
2393
|
+
) && [y.ARROW_UP, y.ARROW_DOWN, y.SPACE, y.ENTER].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === y.TAB && this._closeDropdown();
|
|
2394
|
+
};
|
|
2395
|
+
this.ui.countryContainer.addEventListener(
|
|
2396
|
+
"keydown",
|
|
2397
|
+
o,
|
|
2398
|
+
{ signal: t }
|
|
2399
|
+
);
|
|
2400
|
+
}
|
|
2401
|
+
//* Init many requests: utils script / geo ip lookup.
|
|
2402
|
+
_initRequests() {
|
|
2403
|
+
const { loadUtils: t, initialCountry: e, geoIpLookup: s } = this.options;
|
|
2404
|
+
if (t && !u.utils) {
|
|
2405
|
+
const o = () => {
|
|
2406
|
+
var n;
|
|
2407
|
+
(n = u.attachUtils(t)) == null || n.catch(() => {
|
|
2408
|
+
});
|
|
2409
|
+
};
|
|
2410
|
+
if (u.documentReady())
|
|
2411
|
+
o();
|
|
2412
|
+
else {
|
|
2413
|
+
const n = () => {
|
|
2414
|
+
o();
|
|
2415
|
+
};
|
|
2416
|
+
window.addEventListener("load", n, {
|
|
2417
|
+
signal: this.abortController.signal
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
} else
|
|
2421
|
+
this.resolveUtilsScriptPromise();
|
|
2422
|
+
e === x.AUTO && s && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
2423
|
+
}
|
|
2424
|
+
//* Perform the geo ip lookup.
|
|
2425
|
+
_loadAutoCountry() {
|
|
2426
|
+
u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
2427
|
+
(t = "") => {
|
|
2428
|
+
const e = t.toLowerCase();
|
|
2429
|
+
k(e) ? (u.autoCountry = e, setTimeout(() => T("handleAutoCountry"))) : (this._setInitialState(!0), T("rejectAutoCountryPromise"));
|
|
2430
|
+
},
|
|
2431
|
+
() => {
|
|
2432
|
+
this._setInitialState(!0), T("rejectAutoCountryPromise");
|
|
2433
|
+
}
|
|
2434
|
+
));
|
|
2435
|
+
}
|
|
2436
|
+
_openDropdownWithPlus() {
|
|
2437
|
+
this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
|
|
2438
|
+
}
|
|
2439
|
+
//* Initialize the tel input listeners.
|
|
2440
|
+
_initTelInputListeners() {
|
|
2441
|
+
this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
|
|
2442
|
+
}
|
|
2443
|
+
_bindInputListener() {
|
|
2444
|
+
const {
|
|
2445
|
+
strictMode: t,
|
|
2446
|
+
formatAsYouType: e,
|
|
2447
|
+
separateDialCode: s,
|
|
2448
|
+
allowDropdown: i,
|
|
2449
|
+
countrySearch: o
|
|
2450
|
+
} = this.options;
|
|
2451
|
+
let n = !1;
|
|
2452
|
+
L.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
|
|
2453
|
+
const r = (a) => {
|
|
2454
|
+
const d = this._getTelInputValue();
|
|
2455
|
+
if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && s && i && o) {
|
|
2456
|
+
const _ = this.ui.telInput.selectionStart || 0, N = d.substring(0, _ - 1), I = d.substring(_);
|
|
2457
|
+
this._setTelInputValue(N + I), this._openDropdownWithPlus();
|
|
2458
|
+
return;
|
|
2459
|
+
}
|
|
2460
|
+
this._updateCountryFromNumber(d) && this._triggerCountryChange();
|
|
2461
|
+
const c = (a == null ? void 0 : a.data) && L.NON_PLUS_NUMERIC.test(a.data), m = (a == null ? void 0 : a.inputType) === B.PASTE && d;
|
|
2462
|
+
c || m && !t ? n = !0 : L.NON_PLUS_NUMERIC.test(d) || (n = !1);
|
|
2463
|
+
const g = (a == null ? void 0 : a.detail) && a.detail.isSetNumber, E = this.userNumeralSet === "ascii";
|
|
2464
|
+
if (e && !n && !g && E) {
|
|
2465
|
+
const _ = this.ui.telInput.selectionStart || 0, I = d.substring(
|
|
2466
|
+
0,
|
|
2467
|
+
_
|
|
2468
|
+
).replace(
|
|
2469
|
+
L.NON_PLUS_NUMERIC_GLOBAL,
|
|
2470
|
+
""
|
|
2471
|
+
).length, D = (a == null ? void 0 : a.inputType) === B.DELETE_FWD, f = this._getFullNumber(), w = ht(
|
|
2472
|
+
f,
|
|
2473
|
+
d,
|
|
2474
|
+
u.utils,
|
|
2475
|
+
this.selectedCountryData,
|
|
2476
|
+
s
|
|
2477
|
+
), b = pt(
|
|
2478
|
+
I,
|
|
2479
|
+
w,
|
|
2480
|
+
_,
|
|
2481
|
+
D
|
|
2482
|
+
);
|
|
2483
|
+
this._setTelInputValue(w), this.ui.telInput.setSelectionRange(b, b);
|
|
2484
|
+
}
|
|
2485
|
+
if (s && d.startsWith("+") && this.selectedCountryData.dialCode) {
|
|
2486
|
+
const _ = $(d, !0, s, this.selectedCountryData);
|
|
2487
|
+
this._setTelInputValue(_);
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
this.ui.telInput.addEventListener(
|
|
2491
|
+
"input",
|
|
2492
|
+
r,
|
|
2493
|
+
{
|
|
2494
|
+
signal: this.abortController.signal
|
|
2495
|
+
}
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
_maybeBindKeydownListener() {
|
|
2499
|
+
const { strictMode: t, separateDialCode: e, allowDropdown: s, countrySearch: i } = this.options;
|
|
2500
|
+
if (t || e) {
|
|
2501
|
+
const o = (n) => {
|
|
2502
|
+
if (n.key && n.key.length === 1 && !n.altKey && !n.ctrlKey && !n.metaKey) {
|
|
2503
|
+
if (e && s && i && n.key === "+") {
|
|
2504
|
+
n.preventDefault(), this._openDropdownWithPlus();
|
|
2505
|
+
return;
|
|
2506
|
+
}
|
|
2507
|
+
if (t) {
|
|
2508
|
+
const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), m = /^[0-9]$/.test(c), g = e ? m : d || m, E = this.ui.telInput, _ = E.selectionStart, N = E.selectionEnd, I = r.slice(0, _), D = r.slice(N), f = I + n.key + D, w = this._getFullNumber(f), b = u.utils.getCoreNumber(
|
|
2509
|
+
w,
|
|
2510
|
+
this.selectedCountryData.iso2
|
|
2511
|
+
), O = this.maxCoreNumberLength && b.length > this.maxCoreNumberLength, z = this._getNewCountryFromNumber(w) !== null;
|
|
2512
|
+
(!g || O && !z && !d) && n.preventDefault();
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
};
|
|
2516
|
+
this.ui.telInput.addEventListener("keydown", o, {
|
|
2517
|
+
signal: this.abortController.signal
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
_maybeBindPasteListener() {
|
|
2522
|
+
if (this.options.strictMode) {
|
|
2523
|
+
const t = (e) => {
|
|
2524
|
+
e.preventDefault();
|
|
2525
|
+
const s = this.ui.telInput, i = s.selectionStart, o = s.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, i), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), m = this._normaliseNumerals(c), g = i === 0 && o > 0, E = !n.startsWith("+") || g, _ = m.replace(L.NON_PLUS_NUMERIC_GLOBAL, ""), N = _.startsWith("+"), I = _.replace(/\+/g, ""), D = N && E ? `+${I}` : I;
|
|
2526
|
+
let f = r + D + a;
|
|
2527
|
+
if (f.length > 5) {
|
|
2528
|
+
let b = u.utils.getCoreNumber(f, d);
|
|
2529
|
+
for (; b.length === 0 && f.length > 0; )
|
|
2530
|
+
f = f.slice(0, -1), b = u.utils.getCoreNumber(f, d);
|
|
2531
|
+
if (!b)
|
|
2532
|
+
return;
|
|
2533
|
+
if (this.maxCoreNumberLength && b.length > this.maxCoreNumberLength)
|
|
2534
|
+
if (s.selectionEnd === n.length) {
|
|
2535
|
+
const O = b.length - this.maxCoreNumberLength;
|
|
2536
|
+
f = f.slice(0, f.length - O);
|
|
2537
|
+
} else
|
|
2538
|
+
return;
|
|
2539
|
+
}
|
|
2540
|
+
this._setTelInputValue(f);
|
|
2541
|
+
const w = i + D.length;
|
|
2542
|
+
s.setSelectionRange(w, w), s.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
|
|
2543
|
+
};
|
|
2544
|
+
this.ui.telInput.addEventListener("paste", t, {
|
|
2545
|
+
signal: this.abortController.signal
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
//* Adhere to the input's maxlength attr.
|
|
2550
|
+
_cap(t) {
|
|
2551
|
+
const e = Number(this.ui.telInput.getAttribute("maxlength"));
|
|
2552
|
+
return e && t.length > e ? t.substring(0, e) : t;
|
|
2553
|
+
}
|
|
2554
|
+
//* Trigger a custom event on the input (typed via ItiEventMap).
|
|
2555
|
+
_trigger(t, e = {}) {
|
|
2556
|
+
const s = new CustomEvent(t, {
|
|
2557
|
+
bubbles: !0,
|
|
2558
|
+
cancelable: !0,
|
|
2559
|
+
detail: e
|
|
2560
|
+
});
|
|
2561
|
+
this.ui.telInput.dispatchEvent(s);
|
|
2562
|
+
}
|
|
2563
|
+
//* Open the dropdown.
|
|
2564
|
+
_openDropdown() {
|
|
2565
|
+
const { fixDropdownWidth: t, countrySearch: e } = this.options;
|
|
2566
|
+
if (this.dropdownAbortController = new AbortController(), t && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(h.HIDE), this.ui.selectedCountry.setAttribute(p.EXPANDED, "true"), this._setDropdownPosition(), e) {
|
|
2567
|
+
const s = this.ui.countryList.firstElementChild;
|
|
2568
|
+
s && (this.ui.highlightListItem(s, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
|
|
2569
|
+
}
|
|
2570
|
+
this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(S.OPEN_COUNTRY_DROPDOWN);
|
|
2571
|
+
}
|
|
2572
|
+
//* Set the dropdown position
|
|
2573
|
+
_setDropdownPosition() {
|
|
2574
|
+
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
|
|
2575
|
+
const t = this.ui.telInput.getBoundingClientRect(), e = this.ui.telInput.offsetHeight;
|
|
2576
|
+
if (this.options.dropdownContainer) {
|
|
2577
|
+
this.ui.dropdown.style.top = `${t.top + e}px`, this.ui.dropdown.style.left = `${t.left}px`;
|
|
2578
|
+
const s = () => this._closeDropdown();
|
|
2579
|
+
window.addEventListener("scroll", s, {
|
|
2580
|
+
signal: this.dropdownAbortController.signal
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
//* We only bind dropdown listeners when the dropdown is open.
|
|
2586
|
+
_bindDropdownListeners() {
|
|
2587
|
+
const t = this.dropdownAbortController.signal;
|
|
2588
|
+
this._bindDropdownMouseoverListener(t), this._bindDropdownCountryClickListener(t), this._bindDropdownClickOffListener(t), this._bindDropdownKeydownListener(t), this.options.countrySearch && this._bindDropdownSearchListeners(t);
|
|
2589
|
+
}
|
|
2590
|
+
//* When mouse over a list item, just highlight that one
|
|
2591
|
+
//* we add the class "highlight", so if they hit "enter" we know which one to select.
|
|
2592
|
+
_bindDropdownMouseoverListener(t) {
|
|
2593
|
+
const e = (s) => {
|
|
2594
|
+
var o;
|
|
2595
|
+
const i = (o = s.target) == null ? void 0 : o.closest(
|
|
2596
|
+
`.${h.COUNTRY_ITEM}`
|
|
2597
|
+
);
|
|
2598
|
+
i && this.ui.highlightListItem(i, !1);
|
|
2599
|
+
};
|
|
2600
|
+
this.ui.countryList.addEventListener(
|
|
2601
|
+
"mouseover",
|
|
2602
|
+
e,
|
|
2603
|
+
{
|
|
2604
|
+
signal: t
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
//* Listen for country selection.
|
|
2609
|
+
_bindDropdownCountryClickListener(t) {
|
|
2610
|
+
const e = (s) => {
|
|
2611
|
+
var o;
|
|
2612
|
+
const i = (o = s.target) == null ? void 0 : o.closest(
|
|
2613
|
+
`.${h.COUNTRY_ITEM}`
|
|
2614
|
+
);
|
|
2615
|
+
i && this._selectListItem(i);
|
|
2616
|
+
};
|
|
2617
|
+
this.ui.countryList.addEventListener("click", e, {
|
|
2618
|
+
signal: t
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
//* Click off to close (except when this initial opening click is bubbling up).
|
|
2622
|
+
//* We cannot just stopPropagation as it may be needed to close another instance.
|
|
2623
|
+
_bindDropdownClickOffListener(t) {
|
|
2624
|
+
const e = (s) => {
|
|
2625
|
+
!!s.target.closest(
|
|
2626
|
+
`#iti-${this.id}__dropdown-content`
|
|
2627
|
+
) || this._closeDropdown();
|
|
2628
|
+
};
|
|
2629
|
+
setTimeout(() => {
|
|
2630
|
+
document.documentElement.addEventListener(
|
|
2631
|
+
"click",
|
|
2632
|
+
e,
|
|
2633
|
+
{ signal: t }
|
|
2634
|
+
);
|
|
2635
|
+
}, 0);
|
|
2636
|
+
}
|
|
2637
|
+
//* Listen for up/down scrolling, enter to select, or escape to close.
|
|
2638
|
+
//* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
|
|
2639
|
+
//* just hit down and hold it to scroll down (no keyup event).
|
|
2640
|
+
//* Listen on the document because that's where key events are triggered if no input has focus.
|
|
2641
|
+
_bindDropdownKeydownListener(t) {
|
|
2642
|
+
let e = "", s = null;
|
|
2643
|
+
const i = (o) => {
|
|
2644
|
+
[
|
|
2645
|
+
y.ARROW_UP,
|
|
2646
|
+
y.ARROW_DOWN,
|
|
2647
|
+
y.ENTER,
|
|
2648
|
+
y.ESC
|
|
2649
|
+
].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === y.ARROW_UP || o.key === y.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === y.ENTER ? this._handleEnterKey() : o.key === y.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && L.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), s && clearTimeout(s), e += o.key.toLowerCase(), this._searchForCountry(e), s = setTimeout(() => {
|
|
2650
|
+
e = "";
|
|
2651
|
+
}, X.HIDDEN_SEARCH_RESET_MS));
|
|
2652
|
+
};
|
|
2653
|
+
document.addEventListener("keydown", i, { signal: t });
|
|
2654
|
+
}
|
|
2655
|
+
//* Search input listeners when countrySearch enabled.
|
|
2656
|
+
_bindDropdownSearchListeners(t) {
|
|
2657
|
+
const e = () => {
|
|
2658
|
+
const n = this.ui.searchInput.value.trim();
|
|
2659
|
+
this._filterCountriesByQuery(n), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove(h.HIDE) : this.ui.searchClearButton.classList.add(h.HIDE);
|
|
2660
|
+
};
|
|
2661
|
+
let s = null;
|
|
2662
|
+
const i = () => {
|
|
2663
|
+
s && clearTimeout(s), s = setTimeout(() => {
|
|
2664
|
+
e(), s = null;
|
|
2665
|
+
}, 100);
|
|
2666
|
+
};
|
|
2667
|
+
this.ui.searchInput.addEventListener("input", i, {
|
|
2668
|
+
signal: t
|
|
2669
|
+
});
|
|
2670
|
+
const o = () => {
|
|
2671
|
+
this.ui.searchInput.value = "", this.ui.searchInput.focus(), e();
|
|
2672
|
+
};
|
|
2673
|
+
this.ui.searchClearButton.addEventListener("click", o, {
|
|
2674
|
+
signal: t
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2678
|
+
_searchForCountry(t) {
|
|
2679
|
+
const e = st(this.countries, t);
|
|
2680
|
+
if (e) {
|
|
2681
|
+
const s = e.nodeById[this.id];
|
|
2682
|
+
this.ui.highlightListItem(s, !1), this.ui.scrollTo(s);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
//* Country search: Filter the countries according to the search query.
|
|
2686
|
+
_filterCountriesByQuery(t) {
|
|
2687
|
+
let e;
|
|
2688
|
+
t === "" ? e = this.countries : e = et(this.countries, t), this.ui.filterCountries(e);
|
|
2689
|
+
}
|
|
2690
|
+
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2691
|
+
_handleUpDownKey(t) {
|
|
2692
|
+
var s, i;
|
|
2693
|
+
let e = t === y.ARROW_UP ? (s = this.ui.highlightedItem) == null ? void 0 : s.previousElementSibling : (i = this.ui.highlightedItem) == null ? void 0 : i.nextElementSibling;
|
|
2694
|
+
!e && this.ui.countryList.childElementCount > 1 && (e = t === y.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), e && (this.ui.scrollTo(e), this.ui.highlightListItem(e, !1));
|
|
2695
|
+
}
|
|
2696
|
+
//* Select the currently highlighted item.
|
|
2697
|
+
_handleEnterKey() {
|
|
2698
|
+
this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
|
|
2699
|
+
}
|
|
2700
|
+
//* Update the input's value to the given val (format first if possible)
|
|
2701
|
+
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2702
|
+
_updateValFromNumber(t) {
|
|
2703
|
+
let e = t;
|
|
2704
|
+
if (this.options.formatOnDisplay && u.utils && this.selectedCountryData) {
|
|
2705
|
+
const s = this.options.nationalMode || !e.startsWith("+") && !this.options.separateDialCode, { NATIONAL: i, INTERNATIONAL: o } = u.utils.numberFormat, n = s ? i : o;
|
|
2706
|
+
e = u.utils.formatNumber(
|
|
2707
|
+
e,
|
|
2708
|
+
this.selectedCountryData.iso2,
|
|
2709
|
+
n
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
e = this._beforeSetNumber(e), this._setTelInputValue(e);
|
|
2713
|
+
}
|
|
2714
|
+
//* Check if need to select a new country based on the given number
|
|
2715
|
+
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2716
|
+
_updateCountryFromNumber(t) {
|
|
2717
|
+
const e = this._getNewCountryFromNumber(t);
|
|
2718
|
+
return e !== null ? this._setCountry(e) : !1;
|
|
2719
|
+
}
|
|
2720
|
+
// if there is a selected country, and the number doesn't start with a dial code, then add it
|
|
2721
|
+
_ensureHasDialCode(t) {
|
|
2722
|
+
const { dialCode: e, nationalPrefix: s } = this.selectedCountryData;
|
|
2723
|
+
if (t.startsWith("+") || !e)
|
|
2724
|
+
return t;
|
|
2725
|
+
const n = s && t.startsWith(s) && !this.options.separateDialCode ? t.substring(1) : t;
|
|
2726
|
+
return `+${e}${n}`;
|
|
2727
|
+
}
|
|
2728
|
+
// Get the country ISO2 code from the given number
|
|
2729
|
+
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
2730
|
+
// NOTE: consider refactoring this to be more clear
|
|
2731
|
+
_getNewCountryFromNumber(t) {
|
|
2732
|
+
const e = t.indexOf("+");
|
|
2733
|
+
let s = e ? t.substring(e) : t;
|
|
2734
|
+
const i = this.selectedCountryData.iso2, o = this.selectedCountryData.dialCode;
|
|
2735
|
+
s = this._ensureHasDialCode(s);
|
|
2736
|
+
const n = this._getDialCode(s, !0), r = P(s);
|
|
2737
|
+
if (n) {
|
|
2738
|
+
const a = P(n), d = this.dialCodeToIso2Map[a];
|
|
2739
|
+
if (d.length === 1)
|
|
2740
|
+
return d[0] === i ? null : d[0];
|
|
2741
|
+
if (!i && this.defaultCountry && d.includes(this.defaultCountry))
|
|
2742
|
+
return this.defaultCountry;
|
|
2743
|
+
if (o === j.NANP && G(r))
|
|
2744
|
+
return null;
|
|
2745
|
+
const { areaCodes: m, priority: g } = this.selectedCountryData;
|
|
2746
|
+
if (m) {
|
|
2747
|
+
const D = m.map(
|
|
2748
|
+
(f) => `${o}${f}`
|
|
2749
|
+
);
|
|
2750
|
+
for (const f of D)
|
|
2751
|
+
if (r.startsWith(f))
|
|
2752
|
+
return null;
|
|
2753
|
+
}
|
|
2754
|
+
const _ = m && !(g === 0) && r.length > a.length, N = i && d.includes(i) && !_, I = i === d[0];
|
|
2755
|
+
if (!N && !I)
|
|
2756
|
+
return d[0];
|
|
2757
|
+
} else if (s.startsWith("+") && r.length) {
|
|
2758
|
+
const a = this.selectedCountryData.dialCode || "";
|
|
2759
|
+
return a && a.startsWith(r) ? null : "";
|
|
2760
|
+
} else if ((!s || s === "+") && !i)
|
|
2761
|
+
return this.defaultCountry;
|
|
2762
|
+
return null;
|
|
2763
|
+
}
|
|
2764
|
+
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
|
|
2765
|
+
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2766
|
+
_setCountry(t) {
|
|
2767
|
+
const { separateDialCode: e, showFlags: s, i18n: i, allowDropdown: o } = this.options, n = this.selectedCountryData.iso2 || "";
|
|
2768
|
+
if (o && this.ui.updateSelectedItem(t), this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
|
|
2769
|
+
const r = t && s ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
|
|
2770
|
+
let a, d, c;
|
|
2771
|
+
if (t) {
|
|
2772
|
+
const { name: m, dialCode: g } = this.selectedCountryData;
|
|
2773
|
+
d = m, a = i.selectedCountryAriaLabel.replace("${countryName}", m).replace("${dialCode}", `+${g}`), c = "";
|
|
2774
|
+
} else
|
|
2775
|
+
d = i.noCountrySelected, a = i.noCountrySelected, c = ot();
|
|
2776
|
+
this.ui.selectedCountryInner.className = r, this.ui.selectedCountry.setAttribute("title", d), this.ui.selectedCountry.setAttribute(p.LABEL, a), this.ui.selectedCountryInner.innerHTML = c;
|
|
2777
|
+
}
|
|
2778
|
+
if (e) {
|
|
2779
|
+
const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2780
|
+
this.ui.selectedDialCode.textContent = r, this.ui.updateInputPadding();
|
|
2781
|
+
}
|
|
2782
|
+
return this._updatePlaceholder(), this._updateMaxLength(), n !== t;
|
|
2783
|
+
}
|
|
2784
|
+
//* Update the maximum valid number length for the currently selected country.
|
|
2785
|
+
_updateMaxLength() {
|
|
2786
|
+
const { strictMode: t, placeholderNumberType: e, allowedNumberTypes: s } = this.options, { iso2: i } = this.selectedCountryData;
|
|
2787
|
+
if (t && u.utils)
|
|
2788
|
+
if (i) {
|
|
2789
|
+
const o = u.utils.numberType[e];
|
|
2790
|
+
let n = u.utils.getExampleNumber(
|
|
2791
|
+
i,
|
|
2792
|
+
!1,
|
|
2793
|
+
o,
|
|
2794
|
+
!0
|
|
2795
|
+
), r = n;
|
|
2796
|
+
for (; u.utils.isPossibleNumber(
|
|
2797
|
+
n,
|
|
2798
|
+
i,
|
|
2799
|
+
s
|
|
2800
|
+
); )
|
|
2801
|
+
r = n, n += "0";
|
|
2802
|
+
const a = u.utils.getCoreNumber(r, i);
|
|
2803
|
+
this.maxCoreNumberLength = a.length, i === "by" && (this.maxCoreNumberLength = a.length + 1);
|
|
2804
|
+
} else
|
|
2805
|
+
this.maxCoreNumberLength = null;
|
|
2806
|
+
}
|
|
2807
|
+
//* Update the input placeholder to an example number from the currently selected country.
|
|
2808
|
+
_updatePlaceholder() {
|
|
2809
|
+
const {
|
|
2810
|
+
autoPlaceholder: t,
|
|
2811
|
+
placeholderNumberType: e,
|
|
2812
|
+
nationalMode: s,
|
|
2813
|
+
customPlaceholder: i
|
|
2814
|
+
} = this.options, o = t === M.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === M.POLITE;
|
|
2815
|
+
if (u.utils && o) {
|
|
2816
|
+
const n = u.utils.numberType[e];
|
|
2817
|
+
let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
|
|
2818
|
+
this.selectedCountryData.iso2,
|
|
2819
|
+
s,
|
|
2820
|
+
n
|
|
2821
|
+
) : "";
|
|
2822
|
+
r = this._beforeSetNumber(r), typeof i == "function" && (r = i(r, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", r);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
//* Called when the user selects a list item from the dropdown.
|
|
2826
|
+
_selectListItem(t) {
|
|
2827
|
+
const e = t.dataset[V.COUNTRY_CODE], s = this._setCountry(e);
|
|
2828
|
+
this._closeDropdown();
|
|
2829
|
+
const i = t.dataset[V.DIAL_CODE];
|
|
2830
|
+
if (this._updateDialCode(i), this.options.formatOnDisplay) {
|
|
2831
|
+
const o = this._getTelInputValue();
|
|
2832
|
+
this._updateValFromNumber(o);
|
|
2833
|
+
}
|
|
2834
|
+
this.ui.telInput.focus(), s && this._triggerCountryChange();
|
|
2835
|
+
}
|
|
2836
|
+
//* Close the dropdown and unbind any listeners.
|
|
2837
|
+
_closeDropdown() {
|
|
2838
|
+
this.ui.dropdownContent.classList.contains(h.HIDE) || (this.ui.dropdownContent.classList.add(h.HIDE), this.ui.selectedCountry.setAttribute(p.EXPANDED, "false"), this.options.countrySearch && (this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT), this.ui.highlightedItem && (this.ui.highlightedItem.classList.remove(h.HIGHLIGHT), this.ui.highlightedItem = null)), this.ui.dropdownArrow.classList.remove(h.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(S.CLOSE_COUNTRY_DROPDOWN));
|
|
2839
|
+
}
|
|
2840
|
+
//* Replace any existing dial code with the new one
|
|
2841
|
+
//* Note: called from _selectListItem and setCountry
|
|
2842
|
+
_updateDialCode(t) {
|
|
2843
|
+
const e = this._getTelInputValue(), s = `+${t}`;
|
|
2844
|
+
let i;
|
|
2845
|
+
if (e.startsWith("+")) {
|
|
2846
|
+
const o = this._getDialCode(e);
|
|
2847
|
+
o ? i = e.replace(o, s) : i = s, this._setTelInputValue(i);
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
//* Try and extract a valid international dial code from a full telephone number.
|
|
2851
|
+
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2852
|
+
_getDialCode(t, e) {
|
|
2853
|
+
let s = "";
|
|
2854
|
+
if (t.startsWith("+")) {
|
|
2855
|
+
let i = "", o = !1;
|
|
2856
|
+
for (let n = 0; n < t.length; n++) {
|
|
2857
|
+
const r = t.charAt(n);
|
|
2858
|
+
if (/[0-9]/.test(r)) {
|
|
2859
|
+
if (i += r, !!!this.dialCodeToIso2Map[i])
|
|
2860
|
+
break;
|
|
2861
|
+
if (this.dialCodes.has(i)) {
|
|
2862
|
+
if (s = t.substring(0, n + 1), o = !0, !e)
|
|
2863
|
+
break;
|
|
2864
|
+
} else e && o && (s = t.substring(0, n + 1));
|
|
2865
|
+
if (i.length === this.dialCodeMaxLen)
|
|
2866
|
+
break;
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
return s;
|
|
2871
|
+
}
|
|
2872
|
+
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2873
|
+
_getFullNumber(t) {
|
|
2874
|
+
const e = t ? this._normaliseNumerals(t) : this._getTelInputValue(), { dialCode: s } = this.selectedCountryData;
|
|
2875
|
+
let i;
|
|
2876
|
+
const o = P(e);
|
|
2877
|
+
return this.options.separateDialCode && !e.startsWith("+") && s && o ? i = `+${s}` : i = "", i + e;
|
|
2878
|
+
}
|
|
2879
|
+
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2880
|
+
_beforeSetNumber(t) {
|
|
2881
|
+
const e = !!this._getDialCode(t), s = $(
|
|
2882
|
+
t,
|
|
2883
|
+
e,
|
|
2884
|
+
this.options.separateDialCode,
|
|
2885
|
+
this.selectedCountryData
|
|
2886
|
+
);
|
|
2887
|
+
return this._cap(s);
|
|
2888
|
+
}
|
|
2889
|
+
//* Trigger the 'countrychange' event.
|
|
2890
|
+
_triggerCountryChange() {
|
|
2891
|
+
this._trigger(S.COUNTRY_CHANGE);
|
|
2892
|
+
}
|
|
2893
|
+
//**************************
|
|
2894
|
+
//* SECRET PUBLIC METHODS
|
|
2895
|
+
//**************************
|
|
2896
|
+
//* This is called when the geoip call returns.
|
|
2897
|
+
handleAutoCountry() {
|
|
2898
|
+
this.options.initialCountry === x.AUTO && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(h.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2899
|
+
}
|
|
2900
|
+
//* This is called when the utils request completes.
|
|
2901
|
+
handleUtils() {
|
|
2902
|
+
if (u.utils) {
|
|
2903
|
+
const t = this._getTelInputValue();
|
|
2904
|
+
t && this._updateValFromNumber(t), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength());
|
|
2905
|
+
}
|
|
2906
|
+
this.resolveUtilsScriptPromise();
|
|
2907
|
+
}
|
|
2908
|
+
//********************
|
|
2909
|
+
//* PUBLIC METHODS
|
|
2910
|
+
//********************
|
|
2911
|
+
//* Remove plugin.
|
|
2912
|
+
destroy() {
|
|
2913
|
+
this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), u.instances instanceof Map ? u.instances.delete(this.id) : delete u.instances[this.id]);
|
|
2914
|
+
}
|
|
2915
|
+
//* Get the extension from the current number.
|
|
2916
|
+
getExtension() {
|
|
2917
|
+
return u.utils ? u.utils.getExtension(
|
|
2918
|
+
this._getFullNumber(),
|
|
2919
|
+
this.selectedCountryData.iso2
|
|
2920
|
+
) : "";
|
|
2921
|
+
}
|
|
2922
|
+
//* Format the number to the given format.
|
|
2923
|
+
getNumber(t) {
|
|
2924
|
+
if (u.utils) {
|
|
2925
|
+
const { iso2: e } = this.selectedCountryData, s = this._getFullNumber(), i = u.utils.formatNumber(
|
|
2926
|
+
s,
|
|
2927
|
+
e,
|
|
2928
|
+
t
|
|
2929
|
+
);
|
|
2930
|
+
return this._mapAsciiToUserNumerals(i);
|
|
2931
|
+
}
|
|
2932
|
+
return "";
|
|
2933
|
+
}
|
|
2934
|
+
//* Get the type of the entered number e.g. landline/mobile.
|
|
2935
|
+
getNumberType() {
|
|
2936
|
+
return u.utils ? u.utils.getNumberType(
|
|
2937
|
+
this._getFullNumber(),
|
|
2938
|
+
this.selectedCountryData.iso2
|
|
2939
|
+
) : F.UNKNOWN_NUMBER_TYPE;
|
|
2940
|
+
}
|
|
2941
|
+
//* Get the country data for the currently selected country.
|
|
2942
|
+
getSelectedCountryData() {
|
|
2943
|
+
return this.selectedCountryData;
|
|
2944
|
+
}
|
|
2945
|
+
//* Get the validation error.
|
|
2946
|
+
getValidationError() {
|
|
2947
|
+
if (u.utils) {
|
|
2948
|
+
const { iso2: t } = this.selectedCountryData;
|
|
2949
|
+
return u.utils.getValidationError(this._getFullNumber(), t);
|
|
2950
|
+
}
|
|
2951
|
+
return F.UNKNOWN_VALIDATION_ERROR;
|
|
2952
|
+
}
|
|
2953
|
+
//* Validate the input val using number length only
|
|
2954
|
+
isValidNumber() {
|
|
2955
|
+
const { dialCode: t, iso2: e } = this.selectedCountryData;
|
|
2956
|
+
if (t === R.DIAL_CODE && u.utils) {
|
|
2957
|
+
const s = this._getFullNumber(), i = u.utils.getCoreNumber(s, e);
|
|
2958
|
+
if (i[0] === R.MOBILE_PREFIX && i.length !== R.MOBILE_CORE_LENGTH)
|
|
2959
|
+
return !1;
|
|
2960
|
+
}
|
|
2961
|
+
return this._validateNumber(!1);
|
|
2962
|
+
}
|
|
2963
|
+
//* Validate the input val with precise validation
|
|
2964
|
+
isValidNumberPrecise() {
|
|
2965
|
+
return this._validateNumber(!0);
|
|
2966
|
+
}
|
|
2967
|
+
_utilsIsPossibleNumber(t) {
|
|
2968
|
+
return u.utils ? u.utils.isPossibleNumber(
|
|
2969
|
+
t,
|
|
2970
|
+
this.selectedCountryData.iso2,
|
|
2971
|
+
this.options.allowedNumberTypes
|
|
2972
|
+
) : null;
|
|
2973
|
+
}
|
|
2974
|
+
//* Shared internal validation logic to handle alpha character extension rules.
|
|
2975
|
+
_validateNumber(t) {
|
|
2976
|
+
if (!u.utils)
|
|
2977
|
+
return null;
|
|
2978
|
+
if (!this.selectedCountryData.iso2)
|
|
2979
|
+
return !1;
|
|
2980
|
+
const { allowNumberExtensions: e, allowPhonewords: s } = this.options, i = (a) => t ? this._utilsIsValidNumber(a) : this._utilsIsPossibleNumber(a), o = this._getFullNumber();
|
|
2981
|
+
if (!i(o))
|
|
2982
|
+
return !1;
|
|
2983
|
+
if (o.search(L.ALPHA_UNICODE) > -1) {
|
|
2984
|
+
const a = this.selectedCountryData.iso2;
|
|
2985
|
+
return u.utils.getExtension(o, a) ? e : s;
|
|
2986
|
+
}
|
|
2987
|
+
return !0;
|
|
2988
|
+
}
|
|
2989
|
+
_utilsIsValidNumber(t) {
|
|
2990
|
+
return u.utils ? u.utils.isValidNumber(
|
|
2991
|
+
t,
|
|
2992
|
+
this.selectedCountryData.iso2,
|
|
2993
|
+
this.options.allowedNumberTypes
|
|
2994
|
+
) : null;
|
|
2995
|
+
}
|
|
2996
|
+
//* Update the selected country, and update the input val accordingly.
|
|
2997
|
+
setCountry(t) {
|
|
2998
|
+
const e = t == null ? void 0 : t.toLowerCase();
|
|
2999
|
+
if (!k(e))
|
|
3000
|
+
throw new Error(`Invalid country code: '${e}'`);
|
|
3001
|
+
const s = this.selectedCountryData.iso2;
|
|
3002
|
+
if (t && e !== s || !t && s) {
|
|
3003
|
+
if (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay) {
|
|
3004
|
+
const o = this._getTelInputValue();
|
|
3005
|
+
this._updateValFromNumber(o);
|
|
3006
|
+
}
|
|
3007
|
+
this._triggerCountryChange();
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
//* Set the input value and update the country.
|
|
3011
|
+
setNumber(t) {
|
|
3012
|
+
const e = this._normaliseNumerals(t), s = this._updateCountryFromNumber(e);
|
|
3013
|
+
this._updateValFromNumber(e), s && this._triggerCountryChange(), this._trigger(S.INPUT, { isSetNumber: !0 });
|
|
3014
|
+
}
|
|
3015
|
+
//* Set the placeholder number typ
|
|
3016
|
+
setPlaceholderNumberType(t) {
|
|
3017
|
+
this.options.placeholderNumberType = t, this._updatePlaceholder();
|
|
3018
|
+
}
|
|
3019
|
+
setDisabled(t) {
|
|
3020
|
+
this.ui.telInput.disabled = t, t ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
const yt = (l) => {
|
|
3024
|
+
if (!u.utils && !u.startedLoadingUtilsScript) {
|
|
3025
|
+
let t;
|
|
3026
|
+
if (typeof l == "function")
|
|
3027
|
+
try {
|
|
3028
|
+
t = Promise.resolve(l());
|
|
3029
|
+
} catch (e) {
|
|
3030
|
+
return Promise.reject(e);
|
|
3031
|
+
}
|
|
3032
|
+
else
|
|
3033
|
+
return Promise.reject(
|
|
3034
|
+
new TypeError(
|
|
3035
|
+
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof l}`
|
|
3036
|
+
)
|
|
3037
|
+
);
|
|
3038
|
+
return u.startedLoadingUtilsScript = !0, t.then((e) => {
|
|
3039
|
+
const s = e == null ? void 0 : e.default;
|
|
3040
|
+
if (!s || typeof s != "object")
|
|
3041
|
+
throw new TypeError(
|
|
3042
|
+
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
3043
|
+
);
|
|
3044
|
+
return u.utils = s, T("handleUtils"), !0;
|
|
3045
|
+
}).catch((e) => {
|
|
3046
|
+
throw T("rejectUtilsScriptPromise", e), e;
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
return null;
|
|
3050
|
+
}, T = (l, ...t) => {
|
|
3051
|
+
Object.values(u.instances).forEach((e) => {
|
|
3052
|
+
const s = e[l];
|
|
3053
|
+
typeof s == "function" && s.apply(e, t);
|
|
3054
|
+
});
|
|
3055
|
+
}, u = Object.assign(
|
|
3056
|
+
(l, t) => {
|
|
3057
|
+
const e = new W(l, t);
|
|
3058
|
+
return u.instances[e.id] = e, l.iti = e, e;
|
|
3059
|
+
},
|
|
3060
|
+
{
|
|
3061
|
+
defaults: K,
|
|
3062
|
+
//* Using a static var like this allows us to mock it in the tests.
|
|
3063
|
+
documentReady: () => document.readyState === "complete",
|
|
3064
|
+
//* Get the country data object.
|
|
3065
|
+
getCountryData: () => A,
|
|
3066
|
+
//* A getter for the plugin instance.
|
|
3067
|
+
getInstance: (l) => {
|
|
3068
|
+
const t = l.dataset.intlTelInputId;
|
|
3069
|
+
return t ? u.instances[t] : null;
|
|
3070
|
+
},
|
|
3071
|
+
//* A map from instance ID to instance object.
|
|
3072
|
+
instances: {},
|
|
3073
|
+
attachUtils: yt,
|
|
3074
|
+
startedLoadingUtilsScript: !1,
|
|
3075
|
+
startedLoadingAutoCountry: !1,
|
|
3076
|
+
version: "26.0.0-beta.1"
|
|
3077
|
+
}
|
|
3078
|
+
);
|
|
3079
|
+
export {
|
|
3080
|
+
u as i
|
|
3081
|
+
};
|