@intl-tel-input/vue 29.1.2 → 29.2.0
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.
|
@@ -12,7 +12,11 @@ var d = [
|
|
|
12
12
|
"ax",
|
|
13
13
|
"358",
|
|
14
14
|
1,
|
|
15
|
-
[
|
|
15
|
+
[
|
|
16
|
+
"18",
|
|
17
|
+
"4",
|
|
18
|
+
"50"
|
|
19
|
+
],
|
|
16
20
|
"0"
|
|
17
21
|
],
|
|
18
22
|
[
|
|
@@ -331,7 +335,7 @@ var d = [
|
|
|
331
335
|
"fi",
|
|
332
336
|
"358",
|
|
333
337
|
0,
|
|
334
|
-
["4"],
|
|
338
|
+
["4", "50"],
|
|
335
339
|
"0"
|
|
336
340
|
],
|
|
337
341
|
[
|
|
@@ -405,7 +409,8 @@ var d = [
|
|
|
405
409
|
"1481",
|
|
406
410
|
"7781",
|
|
407
411
|
"7839",
|
|
408
|
-
"
|
|
412
|
+
"79111",
|
|
413
|
+
"79117"
|
|
409
414
|
],
|
|
410
415
|
"0"
|
|
411
416
|
],
|
|
@@ -505,7 +510,9 @@ var d = [
|
|
|
505
510
|
[
|
|
506
511
|
"1534",
|
|
507
512
|
"7509",
|
|
508
|
-
"
|
|
513
|
+
"77003",
|
|
514
|
+
"77007",
|
|
515
|
+
"77008",
|
|
509
516
|
"7797",
|
|
510
517
|
"7829",
|
|
511
518
|
"7937"
|
|
@@ -645,7 +652,12 @@ var d = [
|
|
|
645
652
|
"yt",
|
|
646
653
|
"262",
|
|
647
654
|
1,
|
|
648
|
-
[
|
|
655
|
+
[
|
|
656
|
+
"2689",
|
|
657
|
+
"269",
|
|
658
|
+
"639",
|
|
659
|
+
"7093"
|
|
660
|
+
],
|
|
649
661
|
"0"
|
|
650
662
|
],
|
|
651
663
|
["mx", "52"],
|
|
@@ -1188,7 +1200,29 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1188
1200
|
COUNTRY_CHANGE: "countrychange",
|
|
1189
1201
|
INPUT: "input",
|
|
1190
1202
|
STRICT_REJECT: "strict:reject"
|
|
1191
|
-
}, _ =
|
|
1203
|
+
}, _ = [
|
|
1204
|
+
"container",
|
|
1205
|
+
"input",
|
|
1206
|
+
"countryContainer",
|
|
1207
|
+
"selectedCountry",
|
|
1208
|
+
"selectedCountryPrimary",
|
|
1209
|
+
"selectedFlag",
|
|
1210
|
+
"arrow",
|
|
1211
|
+
"selectedDialCode",
|
|
1212
|
+
"countrySelector",
|
|
1213
|
+
"countrySelectorContainer",
|
|
1214
|
+
"searchWrapper",
|
|
1215
|
+
"searchIcon",
|
|
1216
|
+
"searchInput",
|
|
1217
|
+
"searchClear",
|
|
1218
|
+
"countryList",
|
|
1219
|
+
"countryListItem",
|
|
1220
|
+
"countryListItemFlag",
|
|
1221
|
+
"countryName",
|
|
1222
|
+
"dialCode",
|
|
1223
|
+
"countryCheck",
|
|
1224
|
+
"noResults"
|
|
1225
|
+
], v = {
|
|
1192
1226
|
HIDE: "iti__hide",
|
|
1193
1227
|
V_HIDE: "iti__v-hide",
|
|
1194
1228
|
ARROW_UP: "iti__arrow--up",
|
|
@@ -1198,58 +1232,58 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1198
1232
|
COUNTRY_ITEM: "iti__country",
|
|
1199
1233
|
HIGHLIGHT: "iti__highlight",
|
|
1200
1234
|
STRICT_REJECT_ANIMATION: "iti__strict-reject-animation"
|
|
1201
|
-
},
|
|
1235
|
+
}, y = {
|
|
1202
1236
|
ARROW_UP: "ArrowUp",
|
|
1203
1237
|
ARROW_DOWN: "ArrowDown",
|
|
1204
1238
|
SPACE: " ",
|
|
1205
1239
|
ENTER: "Enter",
|
|
1206
1240
|
ESC: "Escape",
|
|
1207
1241
|
TAB: "Tab"
|
|
1208
|
-
},
|
|
1242
|
+
}, b = {
|
|
1209
1243
|
PASTE: "insertFromPaste",
|
|
1210
1244
|
DELETE_FORWARD: "deleteContentForward"
|
|
1211
|
-
},
|
|
1245
|
+
}, x = {
|
|
1212
1246
|
ALPHA_UNICODE: /\p{L}/u,
|
|
1213
1247
|
NON_PLUS_NUMERIC: /[^+0-9]/,
|
|
1214
1248
|
NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
|
|
1215
1249
|
HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
|
|
1216
|
-
},
|
|
1250
|
+
}, S = {
|
|
1217
1251
|
SEARCH_DEBOUNCE_MS: 100,
|
|
1218
1252
|
HIDDEN_SEARCH_RESET_MS: 1e3,
|
|
1219
1253
|
NEXT_TICK: 0
|
|
1220
|
-
},
|
|
1254
|
+
}, C = {
|
|
1221
1255
|
NARROW_VIEWPORT_WIDTH: 500,
|
|
1222
1256
|
FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH: 78,
|
|
1223
1257
|
FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH: 42,
|
|
1224
1258
|
INPUT_PADDING_EXTRA_LEFT: 6,
|
|
1225
1259
|
DROPDOWN_MARGIN: 3,
|
|
1226
1260
|
FALLBACK_DROPDOWN_HEIGHT: 200
|
|
1227
|
-
},
|
|
1261
|
+
}, w = {
|
|
1228
1262
|
PLUS: "+",
|
|
1229
1263
|
NANP: "1"
|
|
1230
|
-
},
|
|
1264
|
+
}, T = {
|
|
1231
1265
|
ISO2: "gb",
|
|
1232
1266
|
DIAL_CODE: "44",
|
|
1233
1267
|
MOBILE_PREFIX: "7",
|
|
1234
1268
|
MOBILE_CORE_LENGTH: 10
|
|
1235
|
-
},
|
|
1269
|
+
}, E = {
|
|
1236
1270
|
ISO2: "us",
|
|
1237
1271
|
DIAL_CODE: "1"
|
|
1238
|
-
},
|
|
1272
|
+
}, D = {
|
|
1239
1273
|
AGGRESSIVE: "AGGRESSIVE",
|
|
1240
1274
|
POLITE: "POLITE",
|
|
1241
1275
|
OFF: "OFF"
|
|
1242
|
-
},
|
|
1276
|
+
}, O = [
|
|
1243
1277
|
"OFF",
|
|
1244
1278
|
"DROPDOWN",
|
|
1245
1279
|
"FULLSCREEN",
|
|
1246
1280
|
"AUTO"
|
|
1247
|
-
],
|
|
1281
|
+
], k = [
|
|
1248
1282
|
"E164",
|
|
1249
1283
|
"INTERNATIONAL",
|
|
1250
1284
|
"NATIONAL",
|
|
1251
1285
|
"RFC3966"
|
|
1252
|
-
],
|
|
1286
|
+
], A = [
|
|
1253
1287
|
"FIXED_LINE",
|
|
1254
1288
|
"MOBILE",
|
|
1255
1289
|
"FIXED_LINE_OR_MOBILE",
|
|
@@ -1262,18 +1296,18 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1262
1296
|
"UAN",
|
|
1263
1297
|
"VOICEMAIL",
|
|
1264
1298
|
"UNKNOWN"
|
|
1265
|
-
],
|
|
1299
|
+
], j = [
|
|
1266
1300
|
"IS_POSSIBLE",
|
|
1267
1301
|
"INVALID_COUNTRY_CODE",
|
|
1268
1302
|
"TOO_SHORT",
|
|
1269
1303
|
"TOO_LONG",
|
|
1270
1304
|
"IS_POSSIBLE_LOCAL_ONLY",
|
|
1271
1305
|
"INVALID_LENGTH"
|
|
1272
|
-
],
|
|
1306
|
+
], M = (e) => Object.fromEntries(e.map((e) => [e, e])), N = M(k), P = M(A), F = M(j), I = M(O), L = {
|
|
1273
1307
|
ISO2: "iso2",
|
|
1274
1308
|
DIAL_CODE: "dialCode",
|
|
1275
1309
|
INSTANCE_ID: "intlTelInputId"
|
|
1276
|
-
},
|
|
1310
|
+
}, R = {
|
|
1277
1311
|
EXPANDED: "aria-expanded",
|
|
1278
1312
|
LABEL: "aria-label",
|
|
1279
1313
|
SELECTED: "aria-selected",
|
|
@@ -1293,17 +1327,18 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1293
1327
|
searchSummaryAria(e) {
|
|
1294
1328
|
return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
|
|
1295
1329
|
}
|
|
1296
|
-
},
|
|
1330
|
+
}, z = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, te = () => z(`(max-width: ${C.NARROW_VIEWPORT_WIDTH}px)`), ne = () => {
|
|
1297
1331
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1298
|
-
let e =
|
|
1299
|
-
if (te() || t && e) return
|
|
1332
|
+
let e = z("(max-height: 600px)"), t = z("(pointer: coarse)");
|
|
1333
|
+
if (te() || t && e) return I.FULLSCREEN;
|
|
1300
1334
|
}
|
|
1301
|
-
return
|
|
1302
|
-
},
|
|
1303
|
-
countrySelectorMode:
|
|
1304
|
-
allowedNumberTypes: [
|
|
1335
|
+
return I.DROPDOWN;
|
|
1336
|
+
}, B = {
|
|
1337
|
+
countrySelectorMode: I.AUTO,
|
|
1338
|
+
allowedNumberTypes: [P.MOBILE, P.FIXED_LINE],
|
|
1305
1339
|
allowNumberExtensions: !1,
|
|
1306
1340
|
allowPhonewords: !1,
|
|
1341
|
+
classNames: {},
|
|
1307
1342
|
containerClass: "",
|
|
1308
1343
|
countryNameLocale: "en",
|
|
1309
1344
|
countryNameOverrides: {},
|
|
@@ -1320,39 +1355,39 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1320
1355
|
initialCountry: "",
|
|
1321
1356
|
initialCountryLookup: null,
|
|
1322
1357
|
loadUtils: null,
|
|
1323
|
-
numberDisplayFormat:
|
|
1358
|
+
numberDisplayFormat: N.INTERNATIONAL,
|
|
1324
1359
|
onlyCountries: null,
|
|
1325
|
-
placeholderNumberPolicy:
|
|
1326
|
-
placeholderNumberType:
|
|
1360
|
+
placeholderNumberPolicy: D.POLITE,
|
|
1361
|
+
placeholderNumberType: P.MOBILE,
|
|
1327
1362
|
searchInputClass: "",
|
|
1328
1363
|
separateDialCode: !0,
|
|
1329
1364
|
strictRejectAnimation: !0,
|
|
1330
1365
|
showFlags: !0,
|
|
1331
1366
|
strictMode: !0
|
|
1332
|
-
},
|
|
1367
|
+
}, re = (e) => JSON.stringify(e), V = (e) => !!e && typeof e == "object" && !Array.isArray(e), ie = (e) => typeof e == "function", ae = (e) => {
|
|
1333
1368
|
if (!e || typeof e != "object") return !1;
|
|
1334
1369
|
let t = e;
|
|
1335
1370
|
return t.nodeType === 1 && typeof t.tagName == "string" && typeof t.appendChild == "function";
|
|
1336
|
-
},
|
|
1371
|
+
}, H = new Set(Object.values(D)), oe = new Set(_), U = (e) => {
|
|
1337
1372
|
console.warn(`[intl-tel-input] ${e}`);
|
|
1338
|
-
},
|
|
1339
|
-
|
|
1340
|
-
},
|
|
1373
|
+
}, W = (e, t, n) => {
|
|
1374
|
+
U(`Option '${e}' must be ${t}; got ${re(n)}. Ignoring.`);
|
|
1375
|
+
}, G = (e, t) => {
|
|
1341
1376
|
let n = "an array of iso2 country code strings";
|
|
1342
|
-
if (!Array.isArray(t)) return
|
|
1377
|
+
if (!Array.isArray(t)) return W(e, n, t), !1;
|
|
1343
1378
|
let r = [];
|
|
1344
1379
|
for (let i of t) {
|
|
1345
|
-
if (typeof i != "string") return
|
|
1346
|
-
m(i.toLowerCase()) ? r.push(i) :
|
|
1380
|
+
if (typeof i != "string") return W(e, n, t), !1;
|
|
1381
|
+
m(i.toLowerCase()) ? r.push(i) : U(`Invalid iso2 code in '${e}': '${i}'. Skipping.`);
|
|
1347
1382
|
}
|
|
1348
1383
|
return r;
|
|
1349
1384
|
}, se = (e) => {
|
|
1350
1385
|
if (e === void 0) return {};
|
|
1351
|
-
if (!V(e)) return
|
|
1386
|
+
if (!V(e)) return U(`The second argument must be an options object; got ${re(e)}. Using defaults.`), {};
|
|
1352
1387
|
let t = {};
|
|
1353
1388
|
for (let [n, r] of Object.entries(e)) {
|
|
1354
|
-
if (!Object.hasOwn(
|
|
1355
|
-
|
|
1389
|
+
if (!Object.hasOwn(B, n)) {
|
|
1390
|
+
U(`Unknown option '${n}'. Ignoring.`);
|
|
1356
1391
|
continue;
|
|
1357
1392
|
}
|
|
1358
1393
|
switch (n) {
|
|
@@ -1367,28 +1402,28 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1367
1402
|
case "strictMode":
|
|
1368
1403
|
case "strictRejectAnimation":
|
|
1369
1404
|
if (typeof r != "boolean") {
|
|
1370
|
-
|
|
1405
|
+
W(n, "a boolean", r);
|
|
1371
1406
|
break;
|
|
1372
1407
|
}
|
|
1373
1408
|
t[n] = r;
|
|
1374
1409
|
break;
|
|
1375
1410
|
case "countrySelectorMode":
|
|
1376
|
-
if (typeof r != "string" || !
|
|
1377
|
-
|
|
1411
|
+
if (typeof r != "string" || !O.includes(r)) {
|
|
1412
|
+
W("countrySelectorMode", `one of ${O.map((e) => `"${e}"`).join(", ")}`, r);
|
|
1378
1413
|
break;
|
|
1379
1414
|
}
|
|
1380
1415
|
t[n] = r;
|
|
1381
1416
|
break;
|
|
1382
1417
|
case "numberDisplayFormat":
|
|
1383
|
-
if (typeof r != "string" || r ===
|
|
1384
|
-
|
|
1418
|
+
if (typeof r != "string" || r === N.RFC3966 || !(r === N.E164 || r === N.INTERNATIONAL || r === N.NATIONAL)) {
|
|
1419
|
+
W("numberDisplayFormat", "one of \"E164\", \"INTERNATIONAL\", \"NATIONAL\"", r);
|
|
1385
1420
|
break;
|
|
1386
1421
|
}
|
|
1387
1422
|
t[n] = r;
|
|
1388
1423
|
break;
|
|
1389
1424
|
case "placeholderNumberPolicy":
|
|
1390
|
-
if (typeof r != "string" || !
|
|
1391
|
-
|
|
1425
|
+
if (typeof r != "string" || !H.has(r)) {
|
|
1426
|
+
W("placeholderNumberPolicy", `one of ${Array.from(H).join(", ")}`, r);
|
|
1392
1427
|
break;
|
|
1393
1428
|
}
|
|
1394
1429
|
t[n] = r;
|
|
@@ -1397,15 +1432,25 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1397
1432
|
case "searchInputClass":
|
|
1398
1433
|
case "countryNameLocale":
|
|
1399
1434
|
if (typeof r != "string") {
|
|
1400
|
-
|
|
1435
|
+
W(n, "a string", r);
|
|
1401
1436
|
break;
|
|
1402
1437
|
}
|
|
1403
1438
|
t[n] = r;
|
|
1404
1439
|
break;
|
|
1440
|
+
case "classNames": {
|
|
1441
|
+
if (!V(r)) {
|
|
1442
|
+
W("classNames", "an object", r);
|
|
1443
|
+
break;
|
|
1444
|
+
}
|
|
1445
|
+
let e = {};
|
|
1446
|
+
for (let [t, n] of Object.entries(r)) oe.has(t) ? typeof n == "string" ? e[t] = n.trim().replace(/\s+/g, " ") : W(`classNames.${t}`, "a string", n) : U(`Unknown slot '${t}' in 'classNames'. Valid slots: ${_.join(", ")}. Skipping.`);
|
|
1447
|
+
t[n] = e;
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1405
1450
|
case "countryOrder":
|
|
1406
1451
|
if (r === null) t[n] = r;
|
|
1407
1452
|
else {
|
|
1408
|
-
let e =
|
|
1453
|
+
let e = G(n, r);
|
|
1409
1454
|
e !== !1 && (t[n] = e);
|
|
1410
1455
|
}
|
|
1411
1456
|
break;
|
|
@@ -1413,15 +1458,15 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1413
1458
|
case "hiddenInputs":
|
|
1414
1459
|
case "initialCountryLookup":
|
|
1415
1460
|
case "loadUtils":
|
|
1416
|
-
if (r !== null && !
|
|
1417
|
-
|
|
1461
|
+
if (r !== null && !ie(r)) {
|
|
1462
|
+
W(n, "a function or null", r);
|
|
1418
1463
|
break;
|
|
1419
1464
|
}
|
|
1420
1465
|
t[n] = r;
|
|
1421
1466
|
break;
|
|
1422
1467
|
case "dropdownParent":
|
|
1423
|
-
if (r !== null && !
|
|
1424
|
-
|
|
1468
|
+
if (r !== null && !ae(r)) {
|
|
1469
|
+
W("dropdownParent", "an HTMLElement or null", r);
|
|
1425
1470
|
break;
|
|
1426
1471
|
}
|
|
1427
1472
|
t[n] = r;
|
|
@@ -1430,40 +1475,40 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1430
1475
|
case "onlyCountries":
|
|
1431
1476
|
if (r === null) t[n] = r;
|
|
1432
1477
|
else {
|
|
1433
|
-
let e =
|
|
1478
|
+
let e = G(n, r);
|
|
1434
1479
|
e !== !1 && (t[n] = e);
|
|
1435
1480
|
}
|
|
1436
1481
|
break;
|
|
1437
1482
|
case "uiTranslations":
|
|
1438
1483
|
if (r && !V(r)) {
|
|
1439
|
-
|
|
1484
|
+
W("uiTranslations", "an object", r);
|
|
1440
1485
|
break;
|
|
1441
1486
|
}
|
|
1442
1487
|
t[n] = r;
|
|
1443
1488
|
break;
|
|
1444
1489
|
case "countryNameOverrides":
|
|
1445
1490
|
if (r && !V(r)) {
|
|
1446
|
-
|
|
1491
|
+
W("countryNameOverrides", "an object", r);
|
|
1447
1492
|
break;
|
|
1448
1493
|
}
|
|
1449
1494
|
t[n] = r;
|
|
1450
1495
|
break;
|
|
1451
1496
|
case "initialCountry": {
|
|
1452
1497
|
if (typeof r != "string") {
|
|
1453
|
-
|
|
1498
|
+
W("initialCountry", "a string", r);
|
|
1454
1499
|
break;
|
|
1455
1500
|
}
|
|
1456
1501
|
let e = r.toLowerCase();
|
|
1457
1502
|
if (e && !m(e)) {
|
|
1458
|
-
|
|
1503
|
+
W("initialCountry", "a valid iso2 country code", r);
|
|
1459
1504
|
break;
|
|
1460
1505
|
}
|
|
1461
1506
|
t[n] = r;
|
|
1462
1507
|
break;
|
|
1463
1508
|
}
|
|
1464
1509
|
case "placeholderNumberType":
|
|
1465
|
-
if (typeof r != "string" || !
|
|
1466
|
-
|
|
1510
|
+
if (typeof r != "string" || !A.includes(r)) {
|
|
1511
|
+
W("placeholderNumberType", `one of ${A.join(", ")}`, r);
|
|
1467
1512
|
break;
|
|
1468
1513
|
}
|
|
1469
1514
|
t[n] = r;
|
|
@@ -1471,12 +1516,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1471
1516
|
case "allowedNumberTypes":
|
|
1472
1517
|
if (r !== null) {
|
|
1473
1518
|
if (!Array.isArray(r)) {
|
|
1474
|
-
|
|
1519
|
+
W("allowedNumberTypes", "an array of number types or null", r);
|
|
1475
1520
|
break;
|
|
1476
1521
|
}
|
|
1477
1522
|
let e = !0;
|
|
1478
|
-
for (let t of r) if (typeof t != "string" || !
|
|
1479
|
-
|
|
1523
|
+
for (let t of r) if (typeof t != "string" || !A.includes(t)) {
|
|
1524
|
+
W("allowedNumberTypes", `an array of valid number types (${A.join(", ")})`, t), e = !1;
|
|
1480
1525
|
break;
|
|
1481
1526
|
}
|
|
1482
1527
|
e && (t[n] = r);
|
|
@@ -1488,19 +1533,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1488
1533
|
}, ce = (e) => {
|
|
1489
1534
|
e.initialCountry &&= e.initialCountry.toLowerCase(), e.onlyCountries?.length && (e.onlyCountries = e.onlyCountries.map((e) => e.toLowerCase())), e.excludeCountries?.length && (e.excludeCountries = e.excludeCountries.map((e) => e.toLowerCase())), e.countryOrder &&= e.countryOrder.map((e) => e.toLowerCase());
|
|
1490
1535
|
}, le = (e) => {
|
|
1491
|
-
e.countrySelectorMode ===
|
|
1536
|
+
e.countrySelectorMode === I.AUTO && (e.countrySelectorMode = ne()), e.dropdownAlwaysOpen && (e.countrySelectorMode = I.DROPDOWN), e.countrySelectorMode === I.FULLSCREEN ? e.matchDropdownWidth = !1 : te() && (e.matchDropdownWidth = !0), e.onlyCountries?.length === 1 && (e.initialCountry = e.onlyCountries[0]), e.separateDialCode && e.numberDisplayFormat === N.NATIONAL && (e.numberDisplayFormat = N.INTERNATIONAL), e.countrySelectorMode !== I.OFF && !e.showFlags && !e.separateDialCode && e.numberDisplayFormat === N.NATIONAL && (e.numberDisplayFormat = N.INTERNATIONAL), e.uiTranslations = {
|
|
1492
1537
|
...ee,
|
|
1493
1538
|
...e.uiTranslations
|
|
1494
1539
|
};
|
|
1495
|
-
},
|
|
1540
|
+
}, K = (e) => e.replace(/\D/g, ""), ue = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), de = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), q = (e, t, n) => {
|
|
1496
1541
|
let r = document.createElement(e);
|
|
1497
1542
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1498
|
-
},
|
|
1499
|
-
let r = document.createElementNS(
|
|
1543
|
+
}, fe = "http://www.w3.org/2000/svg", J = ([e, t, n]) => {
|
|
1544
|
+
let r = document.createElementNS(fe, e);
|
|
1500
1545
|
if (t) for (let e in t) r.setAttribute(e, String(t[e]));
|
|
1501
1546
|
if (n) for (let e of n) r.appendChild(J(e));
|
|
1502
1547
|
return r;
|
|
1503
|
-
},
|
|
1548
|
+
}, pe = () => J([
|
|
1504
1549
|
"svg",
|
|
1505
1550
|
{
|
|
1506
1551
|
class: "iti__search-icon-svg",
|
|
@@ -1508,7 +1553,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1508
1553
|
height: 14,
|
|
1509
1554
|
viewBox: "0 0 24 24",
|
|
1510
1555
|
focusable: "false",
|
|
1511
|
-
[
|
|
1556
|
+
[R.HIDDEN]: "true"
|
|
1512
1557
|
},
|
|
1513
1558
|
[["circle", {
|
|
1514
1559
|
cx: 11,
|
|
@@ -1520,7 +1565,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1520
1565
|
x2: 16.65,
|
|
1521
1566
|
y2: 16.65
|
|
1522
1567
|
}]]
|
|
1523
|
-
]),
|
|
1568
|
+
]), me = (e) => {
|
|
1524
1569
|
let t = `iti-${e}-clear-mask`;
|
|
1525
1570
|
return J([
|
|
1526
1571
|
"svg",
|
|
@@ -1529,7 +1574,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1529
1574
|
width: 12,
|
|
1530
1575
|
height: 12,
|
|
1531
1576
|
viewBox: "0 0 16 16",
|
|
1532
|
-
[
|
|
1577
|
+
[R.HIDDEN]: "true",
|
|
1533
1578
|
focusable: "false"
|
|
1534
1579
|
},
|
|
1535
1580
|
[[
|
|
@@ -1556,7 +1601,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1556
1601
|
mask: `url(#${t})`
|
|
1557
1602
|
}]]
|
|
1558
1603
|
]);
|
|
1559
|
-
},
|
|
1604
|
+
}, he = () => J([
|
|
1560
1605
|
"svg",
|
|
1561
1606
|
{
|
|
1562
1607
|
class: "iti__country-check-svg",
|
|
@@ -1565,10 +1610,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1565
1610
|
viewBox: "0 0 16 16",
|
|
1566
1611
|
fill: "currentColor",
|
|
1567
1612
|
focusable: "false",
|
|
1568
|
-
[
|
|
1613
|
+
[R.HIDDEN]: "true"
|
|
1569
1614
|
},
|
|
1570
1615
|
[["path", { d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" }]]
|
|
1571
|
-
]),
|
|
1616
|
+
]), ge = () => J([
|
|
1572
1617
|
"svg",
|
|
1573
1618
|
{
|
|
1574
1619
|
width: 256,
|
|
@@ -1577,7 +1622,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1577
1622
|
class: "iti__globe-svg"
|
|
1578
1623
|
},
|
|
1579
1624
|
[["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" }], ["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" }]]
|
|
1580
|
-
]), Y = (e) =>
|
|
1625
|
+
]), Y = (e) => ue(e).replace(/[^\p{L}]+/gu, " ").trim(), _e = (e) => {
|
|
1581
1626
|
let t = /* @__PURE__ */ new Map();
|
|
1582
1627
|
for (let n of e) {
|
|
1583
1628
|
let e = Y(n.name), r = e.split(" ").filter(Boolean), i = r.map((e) => e[0] || "").join("");
|
|
@@ -1589,8 +1634,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1589
1634
|
});
|
|
1590
1635
|
}
|
|
1591
1636
|
return t;
|
|
1592
|
-
},
|
|
1593
|
-
let r =
|
|
1637
|
+
}, ve = (e, t, n) => {
|
|
1638
|
+
let r = ue(n), i = Y(n), a = r !== "" && i === "", o = [], s = [], c = [], l = [], u = [], d = [], f = [];
|
|
1594
1639
|
for (let n of e) {
|
|
1595
1640
|
let e = t.get(n.iso2);
|
|
1596
1641
|
n.iso2 === r ? o.push(n) : !a && e.normalisedName.startsWith(i) ? s.push(n) : !a && e.normalisedName.includes(i) ? c.push(n) : r === n.dialCode || r === e.dialCodePlus ? l.push(n) : e.dialCodePlus.includes(r) ? u.push(n) : e.initials.includes(r) && d.push(n);
|
|
@@ -1618,14 +1663,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1618
1663
|
...d,
|
|
1619
1664
|
...f
|
|
1620
1665
|
];
|
|
1621
|
-
},
|
|
1666
|
+
}, ye = (e, t, n) => {
|
|
1622
1667
|
let r = Y(n);
|
|
1623
1668
|
for (let n of e) {
|
|
1624
1669
|
let { normalisedName: e } = t.get(n.iso2);
|
|
1625
1670
|
if (e.startsWith(r)) return n;
|
|
1626
1671
|
}
|
|
1627
1672
|
return null;
|
|
1628
|
-
},
|
|
1673
|
+
}, be = class e {
|
|
1629
1674
|
#e;
|
|
1630
1675
|
static toAscii(e) {
|
|
1631
1676
|
return e ? e.replace(/[٠-٩]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1632))).replace(/[۰-۹]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1776))) : "";
|
|
@@ -1647,7 +1692,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1647
1692
|
isAscii() {
|
|
1648
1693
|
return !this.#e || this.#e === "ascii";
|
|
1649
1694
|
}
|
|
1650
|
-
},
|
|
1695
|
+
}, xe = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --x"), Se = class {
|
|
1651
1696
|
#e;
|
|
1652
1697
|
#t;
|
|
1653
1698
|
#n;
|
|
@@ -1680,7 +1725,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1680
1725
|
telInputEl;
|
|
1681
1726
|
hadInitialPlaceholder;
|
|
1682
1727
|
constructor(e, t, n) {
|
|
1683
|
-
e.dataset[
|
|
1728
|
+
e.dataset[L.INSTANCE_ID] = n.toString(), this.telInputEl = e, this.#e = t, this.#t = n, this.hadInitialPlaceholder = !!e.getAttribute("placeholder"), this.#n = !!this.telInputEl.closest("[dir=rtl]"), this.#r = this.telInputEl.style.paddingLeft;
|
|
1684
1729
|
}
|
|
1685
1730
|
static validateInput(e) {
|
|
1686
1731
|
let t = e?.tagName;
|
|
@@ -1689,99 +1734,106 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1689
1734
|
throw TypeError(`The first argument must be an HTMLInputElement, not ${t}`);
|
|
1690
1735
|
}
|
|
1691
1736
|
}
|
|
1737
|
+
#k(e, t) {
|
|
1738
|
+
let n = this.#e.classNames[e];
|
|
1739
|
+
return n ? `${t} ${n}` : t;
|
|
1740
|
+
}
|
|
1692
1741
|
buildMarkup(e, t) {
|
|
1693
|
-
this.#i = e, this.#a = t, this.telInputEl.classList.add("iti__tel-input"), this.telInputEl.hasAttribute("type") || this.telInputEl.setAttribute("type", "tel"), this.telInputEl.hasAttribute("autocomplete") || this.telInputEl.setAttribute("autocomplete", "tel"), this.telInputEl.hasAttribute("inputmode") || this.telInputEl.setAttribute("inputmode", "tel");
|
|
1694
|
-
let n = this.#
|
|
1695
|
-
this.#
|
|
1742
|
+
this.#i = e, this.#a = t, this.telInputEl.classList.add(...this.#k("input", "iti__tel-input").split(" ")), this.telInputEl.hasAttribute("type") || this.telInputEl.setAttribute("type", "tel"), this.telInputEl.hasAttribute("autocomplete") || this.telInputEl.setAttribute("autocomplete", "tel"), this.telInputEl.hasAttribute("inputmode") || this.telInputEl.setAttribute("inputmode", "tel");
|
|
1743
|
+
let n = this.#A();
|
|
1744
|
+
this.#j(n), n.appendChild(this.telInputEl), this.#F(), this.#z(), this.#I(n), this.ensureDropdownWidthSet();
|
|
1696
1745
|
}
|
|
1697
|
-
#
|
|
1698
|
-
let { countrySelectorMode: e, showFlags: t, containerClass: n } = this.#e, r =
|
|
1746
|
+
#A() {
|
|
1747
|
+
let { countrySelectorMode: e, showFlags: t, containerClass: n } = this.#e, r = de({
|
|
1699
1748
|
iti: !0,
|
|
1700
1749
|
"iti--input-container": !0,
|
|
1701
|
-
"iti--has-country-selector": e !==
|
|
1750
|
+
"iti--has-country-selector": e !== I.OFF,
|
|
1702
1751
|
"iti--show-flags": t,
|
|
1703
|
-
"iti--inline-country-selector": e !==
|
|
1752
|
+
"iti--inline-country-selector": e !== I.FULLSCREEN,
|
|
1704
1753
|
[n]: !!n
|
|
1705
|
-
}) });
|
|
1706
|
-
return this.#n &&
|
|
1754
|
+
}), i = q("div", { class: this.#k("container", r) });
|
|
1755
|
+
return this.#n && i.setAttribute("dir", "ltr"), this.telInputEl.before(i), i;
|
|
1707
1756
|
}
|
|
1708
|
-
#
|
|
1709
|
-
let { countrySelectorMode: t, separateDialCode: n, showFlags: r } = this.#e, i = t !==
|
|
1757
|
+
#j(e) {
|
|
1758
|
+
let { countrySelectorMode: t, separateDialCode: n, showFlags: r } = this.#e, i = t !== I.OFF;
|
|
1710
1759
|
if (!i && !r && !n) return;
|
|
1711
|
-
this.#l = q("div", { class: `iti__country-container ${
|
|
1760
|
+
this.#l = q("div", { class: this.#k("countryContainer", `iti__country-container ${v.V_HIDE}`) }, e), i ? (this.#u = q("button", {
|
|
1712
1761
|
type: "button",
|
|
1713
|
-
class: "iti__selected-country",
|
|
1714
|
-
[
|
|
1715
|
-
[
|
|
1716
|
-
[
|
|
1717
|
-
[
|
|
1718
|
-
}, this.#l), this.telInputEl.disabled && this.#u.setAttribute("disabled", "true")) : this.#u = q("div", { class: "iti__selected-country" }, this.#l);
|
|
1719
|
-
let a = q("div", { class: "iti__selected-country-primary" }, this.#u);
|
|
1720
|
-
this.#d = q("div", { class:
|
|
1721
|
-
class: "iti__arrow",
|
|
1722
|
-
[
|
|
1723
|
-
}, a)), n && (this.#f = q("div", { class: "iti__selected-dial-code" }, this.#u)), i && this.#
|
|
1762
|
+
class: this.#k("selectedCountry", "iti__selected-country"),
|
|
1763
|
+
[R.EXPANDED]: "false",
|
|
1764
|
+
[R.LABEL]: this.#e.uiTranslations.noCountrySelected,
|
|
1765
|
+
[R.HASPOPUP]: "dialog",
|
|
1766
|
+
[R.CONTROLS]: `iti-${this.#t}__country-selector`
|
|
1767
|
+
}, this.#l), this.telInputEl.disabled && this.#u.setAttribute("disabled", "true")) : this.#u = q("div", { class: this.#k("selectedCountry", "iti__selected-country") }, this.#l);
|
|
1768
|
+
let a = q("div", { class: this.#k("selectedCountryPrimary", "iti__selected-country-primary") }, this.#u);
|
|
1769
|
+
this.#d = q("div", { class: this.#k("selectedFlag", v.FLAG) }, a), i && (this.#p = q("div", {
|
|
1770
|
+
class: this.#k("arrow", "iti__arrow"),
|
|
1771
|
+
[R.HIDDEN]: "true"
|
|
1772
|
+
}, a)), n && (this.#f = q("div", { class: this.#k("selectedDialCode", "iti__selected-dial-code") }, this.#u)), i && this.#M();
|
|
1724
1773
|
}
|
|
1725
1774
|
ensureDropdownWidthSet() {
|
|
1726
1775
|
let { matchDropdownWidth: e, countrySelectorMode: t } = this.#e;
|
|
1727
|
-
if (t ===
|
|
1776
|
+
if (t === I.OFF || !e || this.#m.style.width) return;
|
|
1728
1777
|
let n = this.telInputEl.offsetWidth;
|
|
1729
1778
|
n > 0 && (this.#m.style.width = `${n}px`);
|
|
1730
1779
|
}
|
|
1731
|
-
#
|
|
1732
|
-
let { matchDropdownWidth: e, countrySelectorMode: t, countrySearch: n, uiTranslations: r, containerClass: i } = this.#e, a = t ===
|
|
1733
|
-
this.#m = q("div", {
|
|
1780
|
+
#M() {
|
|
1781
|
+
let { matchDropdownWidth: e, countrySelectorMode: t, countrySearch: n, uiTranslations: r, containerClass: i } = this.#e, a = t === I.FULLSCREEN, o = this.#N(), s = e ? "" : "iti--flexible-dropdown-width";
|
|
1782
|
+
if (this.#m = q("div", {
|
|
1734
1783
|
id: `iti-${this.#t}__country-selector`,
|
|
1735
|
-
class: `iti__country-selector ${
|
|
1784
|
+
class: this.#k("countrySelector", `iti__country-selector ${v.HIDE} ${s}`),
|
|
1736
1785
|
role: "dialog",
|
|
1737
|
-
[
|
|
1738
|
-
}), this.#n && this.#m.setAttribute("dir", "rtl"), n && this.#
|
|
1739
|
-
class: "iti__country-list",
|
|
1786
|
+
[R.MODAL]: "true"
|
|
1787
|
+
}), this.#n && this.#m.setAttribute("dir", "rtl"), n && this.#P(), this.#v = q("ul", {
|
|
1788
|
+
class: this.#k("countryList", "iti__country-list"),
|
|
1740
1789
|
id: `iti-${this.#t}__country-listbox`,
|
|
1741
1790
|
role: "listbox",
|
|
1742
|
-
[
|
|
1743
|
-
}, this.#m), this.#
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1791
|
+
[R.LABEL]: r.countryListAriaLabel
|
|
1792
|
+
}, this.#m), this.#L(), n && this.#U(), o) {
|
|
1793
|
+
let e = de({
|
|
1794
|
+
iti: !0,
|
|
1795
|
+
"iti--detached-country-selector": !0,
|
|
1796
|
+
"iti--fullscreen-popup": a,
|
|
1797
|
+
"iti--inline-country-selector": !a,
|
|
1798
|
+
[i]: !!i
|
|
1799
|
+
});
|
|
1800
|
+
this.#C = q("div", { class: this.#k("countrySelectorContainer", e) }), this.#C.appendChild(this.#m);
|
|
1801
|
+
} else this.#l.appendChild(this.#m);
|
|
1750
1802
|
}
|
|
1751
|
-
#
|
|
1803
|
+
#N() {
|
|
1752
1804
|
let { countrySelectorMode: e, dropdownParent: t } = this.#e;
|
|
1753
|
-
return e ===
|
|
1805
|
+
return e === I.FULLSCREEN ? document.body : e === I.DROPDOWN ? t : null;
|
|
1754
1806
|
}
|
|
1755
|
-
#
|
|
1756
|
-
let { uiTranslations: e, searchInputClass: t } = this.#e, n = q("div", { class: "iti__search-input-wrapper" }, this.#m);
|
|
1807
|
+
#P() {
|
|
1808
|
+
let { uiTranslations: e, searchInputClass: t } = this.#e, n = q("div", { class: this.#k("searchWrapper", "iti__search-input-wrapper") }, this.#m);
|
|
1757
1809
|
this.#h = q("span", {
|
|
1758
|
-
class: "iti__search-icon",
|
|
1759
|
-
[
|
|
1760
|
-
}, n), this.#h.appendChild(
|
|
1810
|
+
class: this.#k("searchIcon", "iti__search-icon"),
|
|
1811
|
+
[R.HIDDEN]: "true"
|
|
1812
|
+
}, n), this.#h.appendChild(pe()), this.#g = q("input", {
|
|
1761
1813
|
id: `iti-${this.#t}__search-input`,
|
|
1762
1814
|
type: "search",
|
|
1763
|
-
class: `iti__search-input ${t}
|
|
1815
|
+
class: this.#k("searchInput", `iti__search-input ${t}`),
|
|
1764
1816
|
placeholder: e.searchPlaceholder,
|
|
1765
1817
|
role: "combobox",
|
|
1766
|
-
[
|
|
1767
|
-
[
|
|
1768
|
-
[
|
|
1769
|
-
[
|
|
1818
|
+
[R.EXPANDED]: "true",
|
|
1819
|
+
[R.LABEL]: e.searchPlaceholder,
|
|
1820
|
+
[R.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1821
|
+
[R.AUTOCOMPLETE]: "list",
|
|
1770
1822
|
autocomplete: "off"
|
|
1771
1823
|
}, n), this.#_ = q("button", {
|
|
1772
1824
|
type: "button",
|
|
1773
|
-
class: `iti__search-clear ${
|
|
1774
|
-
[
|
|
1825
|
+
class: this.#k("searchClear", `iti__search-clear ${v.HIDE}`),
|
|
1826
|
+
[R.LABEL]: e.clearSearchAriaLabel,
|
|
1775
1827
|
tabindex: "-1"
|
|
1776
|
-
}, n), this.#_.appendChild(
|
|
1777
|
-
class: `iti__no-results ${
|
|
1778
|
-
[
|
|
1828
|
+
}, n), this.#_.appendChild(me(this.#t)), this.#S = q("span", { class: "iti__a11y-text" }, this.#m), this.#x = q("div", {
|
|
1829
|
+
class: this.#k("noResults", `iti__no-results ${v.HIDE}`),
|
|
1830
|
+
[R.HIDDEN]: "true"
|
|
1779
1831
|
}, this.#m), this.#x.textContent = e.searchEmptyState ?? null;
|
|
1780
1832
|
}
|
|
1781
|
-
#
|
|
1782
|
-
this.#l && (this.#
|
|
1833
|
+
#F() {
|
|
1834
|
+
this.#l && (this.#R(), this.#l.classList.remove(v.V_HIDE));
|
|
1783
1835
|
}
|
|
1784
|
-
#
|
|
1836
|
+
#I(e) {
|
|
1785
1837
|
let { hiddenInputs: t } = this.#e;
|
|
1786
1838
|
if (!t) return;
|
|
1787
1839
|
let n = t(this.telInputEl.getAttribute("name") || "");
|
|
@@ -1800,36 +1852,36 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1800
1852
|
}), e.appendChild(this.#b));
|
|
1801
1853
|
}
|
|
1802
1854
|
}
|
|
1803
|
-
#
|
|
1804
|
-
let e = document.createDocumentFragment();
|
|
1805
|
-
for (let
|
|
1806
|
-
let
|
|
1807
|
-
id: `iti-${this.#t}__item-${
|
|
1808
|
-
class:
|
|
1855
|
+
#L() {
|
|
1856
|
+
let e = document.createDocumentFragment(), t = this.#k("countryListItem", v.COUNTRY_ITEM);
|
|
1857
|
+
for (let n = 0; n < this.#i.length; n++) {
|
|
1858
|
+
let r = this.#i[n], i = q("li", {
|
|
1859
|
+
id: `iti-${this.#t}__item-${r.iso2}`,
|
|
1860
|
+
class: t,
|
|
1809
1861
|
tabindex: "-1",
|
|
1810
1862
|
role: "option",
|
|
1811
|
-
[
|
|
1863
|
+
[R.SELECTED]: "false"
|
|
1812
1864
|
});
|
|
1813
|
-
i.dataset[
|
|
1814
|
-
let a = q("span", { class: "iti__country-name" }, i);
|
|
1815
|
-
a.textContent = `${
|
|
1816
|
-
let o = q("span", { class: "iti__dial-code" }, a);
|
|
1817
|
-
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${
|
|
1865
|
+
i.dataset[L.DIAL_CODE] = r.dialCode, i.dataset[L.ISO2] = r.iso2, this.#E.set(r.iso2, i), this.#e.showFlags && q("div", { class: this.#k("countryListItemFlag", `${v.FLAG} iti__${r.iso2}`) }, i);
|
|
1866
|
+
let a = q("span", { class: this.#k("countryName", "iti__country-name") }, i);
|
|
1867
|
+
a.textContent = `${r.name} `;
|
|
1868
|
+
let o = q("span", { class: this.#k("dialCode", "iti__dial-code") }, a);
|
|
1869
|
+
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${r.dialCode})`, e.appendChild(i);
|
|
1818
1870
|
}
|
|
1819
1871
|
this.#v.appendChild(e);
|
|
1820
1872
|
}
|
|
1821
|
-
#
|
|
1873
|
+
#R() {
|
|
1822
1874
|
if (this.#u) {
|
|
1823
|
-
let e = this.#e.separateDialCode ?
|
|
1875
|
+
let e = this.#e.separateDialCode ? C.FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH : C.FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH, t = (this.#u.offsetWidth || this.#B() || e) + C.INPUT_PADDING_EXTRA_LEFT;
|
|
1824
1876
|
this.telInputEl.style.paddingLeft = `${t}px`;
|
|
1825
1877
|
}
|
|
1826
1878
|
}
|
|
1827
|
-
#
|
|
1879
|
+
#z() {
|
|
1828
1880
|
!this.#u || typeof ResizeObserver > "u" || (this.#O = new ResizeObserver(() => {
|
|
1829
|
-
this.#u?.offsetWidth && this.#
|
|
1881
|
+
this.#u?.offsetWidth && this.#R();
|
|
1830
1882
|
}), this.#O.observe(this.#u));
|
|
1831
1883
|
}
|
|
1832
|
-
#
|
|
1884
|
+
#B() {
|
|
1833
1885
|
if (!this.telInputEl.parentNode) return 0;
|
|
1834
1886
|
let e = document.body, t = this.telInputEl.parentNode.cloneNode(!1);
|
|
1835
1887
|
t.style.visibility = "hidden", e.appendChild(t);
|
|
@@ -1840,61 +1892,61 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1840
1892
|
let i = r.offsetWidth;
|
|
1841
1893
|
return e.removeChild(t), i;
|
|
1842
1894
|
}
|
|
1843
|
-
#
|
|
1895
|
+
#V() {
|
|
1844
1896
|
if (this.#s !== void 0) return;
|
|
1845
|
-
let { countrySearch: e, matchDropdownWidth: t } = this.#e, { height: n, width: r } = this.#
|
|
1897
|
+
let { countrySearch: e, matchDropdownWidth: t } = this.#e, { height: n, width: r } = this.#H();
|
|
1846
1898
|
this.#s = n, e && (this.#m.style.height = `${n}px`, !t && r > 0 && (this.#m.style.width = `${r}px`));
|
|
1847
1899
|
}
|
|
1848
|
-
#
|
|
1900
|
+
#H() {
|
|
1849
1901
|
let e = document.body, t = this.#m, n = t.parentNode, r = t.nextSibling;
|
|
1850
|
-
t.classList.remove(
|
|
1902
|
+
t.classList.remove(v.HIDE);
|
|
1851
1903
|
let i = q("div", { class: "iti iti--inline-country-selector" });
|
|
1852
1904
|
i.appendChild(t), i.style.visibility = "hidden", e.appendChild(i);
|
|
1853
1905
|
let a = t.offsetHeight, o = t.offsetWidth;
|
|
1854
|
-
return e.removeChild(i), t.classList.add(
|
|
1855
|
-
height: a > 0 ? a :
|
|
1906
|
+
return e.removeChild(i), t.classList.add(v.HIDE), n && n.insertBefore(t, r), {
|
|
1907
|
+
height: a > 0 ? a : C.FALLBACK_DROPDOWN_HEIGHT,
|
|
1856
1908
|
width: o
|
|
1857
1909
|
};
|
|
1858
1910
|
}
|
|
1859
|
-
#
|
|
1911
|
+
#U() {
|
|
1860
1912
|
let { uiTranslations: e } = this.#e, t = this.#v.childElementCount;
|
|
1861
1913
|
this.#S.textContent = e.searchSummaryAria(t);
|
|
1862
1914
|
}
|
|
1863
|
-
#
|
|
1915
|
+
#W(e) {
|
|
1864
1916
|
let t;
|
|
1865
1917
|
if (e === "") t = this.#i;
|
|
1866
1918
|
else {
|
|
1867
|
-
let n =
|
|
1868
|
-
t =
|
|
1919
|
+
let n = be.toAscii(e);
|
|
1920
|
+
t = ve(this.#i, this.#a, n);
|
|
1869
1921
|
}
|
|
1870
|
-
this.#
|
|
1922
|
+
this.#ae(t);
|
|
1871
1923
|
}
|
|
1872
1924
|
prefillSearchWithPlus() {
|
|
1873
|
-
this.#g.value = "+", this.#g.focus(), this.#
|
|
1925
|
+
this.#g.value = "+", this.#g.focus(), this.#W("");
|
|
1874
1926
|
}
|
|
1875
|
-
#
|
|
1927
|
+
#G() {
|
|
1876
1928
|
let e = this.#g.value.trim();
|
|
1877
|
-
this.#
|
|
1929
|
+
this.#W(e), this.#g.value ? this.#_.classList.remove(v.HIDE) : this.#_.classList.add(v.HIDE);
|
|
1878
1930
|
}
|
|
1879
|
-
#
|
|
1931
|
+
#K() {
|
|
1880
1932
|
this.#o && clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
1881
|
-
this.#
|
|
1882
|
-
},
|
|
1933
|
+
this.#G(), this.#o = null;
|
|
1934
|
+
}, S.SEARCH_DEBOUNCE_MS);
|
|
1883
1935
|
}
|
|
1884
|
-
#
|
|
1885
|
-
this.#g.value = "", this.#g.focus(), this.#
|
|
1936
|
+
#q() {
|
|
1937
|
+
this.#g.value = "", this.#g.focus(), this.#G();
|
|
1886
1938
|
}
|
|
1887
|
-
#
|
|
1939
|
+
#J(e) {
|
|
1888
1940
|
let t = this.#v, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
|
|
1889
1941
|
r.top < n.top ? t.scrollTop = i : r.bottom > n.bottom && (t.scrollTop = i - n.height + r.height);
|
|
1890
1942
|
}
|
|
1891
|
-
#
|
|
1892
|
-
if (this.#T?.classList.remove(
|
|
1893
|
-
if (e.classList.add(
|
|
1943
|
+
#Y(e, t = !0) {
|
|
1944
|
+
if (this.#T?.classList.remove(v.HIGHLIGHT), e) {
|
|
1945
|
+
if (e.classList.add(v.HIGHLIGHT), this.#e.countrySearch) {
|
|
1894
1946
|
let t = e.getAttribute("id") || "";
|
|
1895
|
-
this.#g.setAttribute(
|
|
1947
|
+
this.#g.setAttribute(R.ACTIVE_DESCENDANT, t);
|
|
1896
1948
|
}
|
|
1897
|
-
t && this.#
|
|
1949
|
+
t && this.#J(e), this.#T = e;
|
|
1898
1950
|
} else this.#T = null;
|
|
1899
1951
|
}
|
|
1900
1952
|
bindHiddenInputSubmitListener(e, t, n) {
|
|
@@ -1911,147 +1963,147 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1911
1963
|
!this.isCountrySelectorOpen() && !this.telInputEl.disabled && !this.telInputEl.readOnly && t();
|
|
1912
1964
|
}, { signal: e }), this.#l.addEventListener("keydown", (e) => {
|
|
1913
1965
|
let r = [
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1966
|
+
y.ARROW_UP,
|
|
1967
|
+
y.ARROW_DOWN,
|
|
1968
|
+
y.SPACE,
|
|
1969
|
+
y.ENTER
|
|
1918
1970
|
];
|
|
1919
|
-
!this.isCountrySelectorOpen() && r.includes(e.key) && (e.preventDefault(), e.stopPropagation(), t()), e.key ===
|
|
1971
|
+
!this.isCountrySelectorOpen() && r.includes(e.key) && (e.preventDefault(), e.stopPropagation(), t()), e.key === y.TAB && n();
|
|
1920
1972
|
}, { signal: e });
|
|
1921
1973
|
}
|
|
1922
1974
|
openCountrySelector(e, t) {
|
|
1923
1975
|
let { countrySearch: n, dropdownAlwaysOpen: r } = this.#e;
|
|
1924
|
-
if (this.#D = new AbortController(), this.#e.countrySelectorMode !==
|
|
1976
|
+
if (this.#D = new AbortController(), this.#e.countrySelectorMode !== I.FULLSCREEN && this.#V(), this.ensureDropdownWidthSet(), this.#C) this.#se();
|
|
1925
1977
|
else {
|
|
1926
|
-
let e = this.#
|
|
1978
|
+
let e = this.#oe(), t = this.telInputEl.offsetHeight + C.DROPDOWN_MARGIN;
|
|
1927
1979
|
e ? this.#m.style.top = `${t}px` : this.#m.style.bottom = `${t}px`;
|
|
1928
1980
|
}
|
|
1929
|
-
this.#m.classList.remove(
|
|
1981
|
+
this.#m.classList.remove(v.HIDE), this.#u.setAttribute(R.EXPANDED, "true");
|
|
1930
1982
|
let i = this.#w ?? this.#v.firstElementChild;
|
|
1931
|
-
i && this.#
|
|
1932
|
-
this.#
|
|
1933
|
-
}, { signal: this.#D.signal }), this.#p.classList.add(
|
|
1983
|
+
i && this.#Y(i), n && !r && this.#g.focus(), this.#e.countrySelectorMode === I.FULLSCREEN && this.#C && window.visualViewport && window.visualViewport.addEventListener("resize", () => {
|
|
1984
|
+
this.#le(), this.#T && this.#J(this.#T);
|
|
1985
|
+
}, { signal: this.#D.signal }), this.#p.classList.add(v.ARROW_UP), this.#X(e, t);
|
|
1934
1986
|
}
|
|
1935
|
-
#
|
|
1987
|
+
#X(e, t) {
|
|
1936
1988
|
let n = this.#D.signal;
|
|
1937
|
-
this.#
|
|
1989
|
+
this.#Z(n), this.#Q(n, e), this.#e.dropdownAlwaysOpen || this.#$(n, t), this.#ee(n, e, t), this.#e.countrySearch && this.#te(n), this.#e.countrySelectorMode === I.DROPDOWN && this.#e.dropdownParent && !xe && document.addEventListener("scroll", t, {
|
|
1938
1990
|
signal: n,
|
|
1939
1991
|
capture: !0,
|
|
1940
1992
|
passive: !0
|
|
1941
1993
|
});
|
|
1942
1994
|
}
|
|
1943
|
-
#
|
|
1995
|
+
#Z(e) {
|
|
1944
1996
|
this.#v.addEventListener("mouseover", (e) => {
|
|
1945
|
-
let t = e.target?.closest(`.${
|
|
1946
|
-
t && this.#
|
|
1997
|
+
let t = e.target?.closest(`.${v.COUNTRY_ITEM}`);
|
|
1998
|
+
t && this.#Y(t, !1);
|
|
1947
1999
|
}, { signal: e });
|
|
1948
2000
|
}
|
|
1949
|
-
#
|
|
2001
|
+
#Q(e, t) {
|
|
1950
2002
|
this.#v.addEventListener("click", (e) => {
|
|
1951
|
-
let n = e.target?.closest(`.${
|
|
2003
|
+
let n = e.target?.closest(`.${v.COUNTRY_ITEM}`);
|
|
1952
2004
|
n && t(n);
|
|
1953
2005
|
}, { signal: e });
|
|
1954
2006
|
}
|
|
1955
|
-
|
|
2007
|
+
#$(e, t) {
|
|
1956
2008
|
setTimeout(() => {
|
|
1957
2009
|
document.documentElement.addEventListener("click", (e) => {
|
|
1958
2010
|
this.#m.contains(e.target) || t();
|
|
1959
2011
|
}, { signal: e });
|
|
1960
2012
|
}, 0);
|
|
1961
2013
|
}
|
|
1962
|
-
|
|
2014
|
+
#ee(e, t, n) {
|
|
1963
2015
|
let r = "", i = null, a = (e) => {
|
|
1964
2016
|
[
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key ===
|
|
2017
|
+
y.ARROW_UP,
|
|
2018
|
+
y.ARROW_DOWN,
|
|
2019
|
+
y.ENTER,
|
|
2020
|
+
y.ESC
|
|
2021
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === y.ARROW_UP || e.key === y.ARROW_DOWN ? this.#re(e.key) : e.key === y.ENTER && !e.isComposing ? t(this.#T) : e.key === y.ESC && (n(), this.#u.focus())), !this.#e.countrySearch && x.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#ne(r), i = setTimeout(() => {
|
|
1970
2022
|
r = "";
|
|
1971
|
-
},
|
|
2023
|
+
}, S.HIDDEN_SEARCH_RESET_MS));
|
|
1972
2024
|
};
|
|
1973
2025
|
this.#u?.addEventListener("keydown", a, { signal: e }), this.#m?.addEventListener("keydown", a, { signal: e });
|
|
1974
2026
|
}
|
|
1975
|
-
#ee(e) {
|
|
1976
|
-
this.#g.addEventListener("input", () => this.#G(), { signal: e }), this.#_.addEventListener("click", () => this.#K(), { signal: e });
|
|
1977
|
-
}
|
|
1978
2027
|
#te(e) {
|
|
1979
|
-
|
|
2028
|
+
this.#g.addEventListener("input", () => this.#K(), { signal: e }), this.#_.addEventListener("click", () => this.#q(), { signal: e });
|
|
2029
|
+
}
|
|
2030
|
+
#ne(e) {
|
|
2031
|
+
let t = ye(this.#i, this.#a, e);
|
|
1980
2032
|
if (t) {
|
|
1981
2033
|
let e = this.#E.get(t.iso2);
|
|
1982
|
-
this.#
|
|
2034
|
+
this.#Y(e);
|
|
1983
2035
|
}
|
|
1984
2036
|
}
|
|
1985
|
-
#ne(e) {
|
|
1986
|
-
let t = e === v.ARROW_UP ? this.#T?.previousElementSibling : this.#T?.nextElementSibling;
|
|
1987
|
-
!t && this.#v.childElementCount > 1 && (t = e === v.ARROW_UP ? this.#v.lastElementChild : this.#v.firstElementChild), t && this.#J(t);
|
|
1988
|
-
}
|
|
1989
2037
|
#re(e) {
|
|
1990
|
-
|
|
2038
|
+
let t = e === y.ARROW_UP ? this.#T?.previousElementSibling : this.#T?.nextElementSibling;
|
|
2039
|
+
!t && this.#v.childElementCount > 1 && (t = e === y.ARROW_UP ? this.#v.lastElementChild : this.#v.firstElementChild), t && this.#Y(t);
|
|
2040
|
+
}
|
|
2041
|
+
#ie(e) {
|
|
2042
|
+
if (this.#w && this.#w.dataset[L.ISO2] !== e && (this.#w.setAttribute(R.SELECTED, "false"), this.#w.querySelector(".iti__country-check")?.remove(), this.#w = null), e && !this.#w) {
|
|
1991
2043
|
let t = this.#v.querySelector(`[data-iso2="${e}"]`);
|
|
1992
|
-
t && (t.setAttribute(
|
|
1993
|
-
class: "iti__country-check",
|
|
1994
|
-
[
|
|
1995
|
-
}, t).appendChild(
|
|
2044
|
+
t && (t.setAttribute(R.SELECTED, "true"), q("span", {
|
|
2045
|
+
class: this.#k("countryCheck", "iti__country-check"),
|
|
2046
|
+
[R.HIDDEN]: "true"
|
|
2047
|
+
}, t).appendChild(he()), this.#w = t, this.#e.dropdownAlwaysOpen && this.#Y(t));
|
|
1996
2048
|
}
|
|
1997
2049
|
}
|
|
1998
|
-
#
|
|
2050
|
+
#ae(e) {
|
|
1999
2051
|
this.#v.replaceChildren();
|
|
2000
2052
|
let t = !0;
|
|
2001
2053
|
for (let n of e) {
|
|
2002
2054
|
let e = this.#E.get(n.iso2);
|
|
2003
|
-
e && (this.#v.appendChild(e), t &&= (this.#
|
|
2055
|
+
e && (this.#v.appendChild(e), t &&= (this.#Y(e, !1), !1));
|
|
2004
2056
|
}
|
|
2005
|
-
t ? (this.#
|
|
2057
|
+
t ? (this.#Y(null), this.#x && this.#x.classList.remove(v.HIDE)) : this.#x && this.#x.classList.add(v.HIDE), this.#v.scrollTop = 0, this.#U();
|
|
2006
2058
|
}
|
|
2007
2059
|
closeCountrySelector() {
|
|
2008
2060
|
let { countrySearch: e } = this.#e;
|
|
2009
|
-
this.#D.abort(), this.#D = null, this.#m.classList.add(
|
|
2061
|
+
this.#D.abort(), this.#D = null, this.#m.classList.add(v.HIDE), this.#u.setAttribute(R.EXPANDED, "false"), e && (this.#g.removeAttribute(R.ACTIVE_DESCENDANT), this.#g.value = "", this.#G(), this.#T &&= (this.#T.classList.remove(v.HIGHLIGHT), null)), this.#p.classList.remove(v.ARROW_UP), this.#C ? (this.#C.remove(), this.#C.style.top = "", this.#C.style.bottom = "", this.#C.style.paddingLeft = "", this.#C.style.paddingRight = "") : (this.#m.style.top = "", this.#m.style.bottom = "");
|
|
2010
2062
|
}
|
|
2011
|
-
#
|
|
2063
|
+
#oe() {
|
|
2012
2064
|
if (this.#e.dropdownAlwaysOpen) return !0;
|
|
2013
2065
|
let e = this.telInputEl.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
|
|
2014
2066
|
return n >= this.#s || n >= t;
|
|
2015
2067
|
}
|
|
2016
|
-
#
|
|
2017
|
-
let e = this.#e.countrySelectorMode ===
|
|
2068
|
+
#se() {
|
|
2069
|
+
let e = this.#e.countrySelectorMode === I.FULLSCREEN, t = this.#N();
|
|
2018
2070
|
if (e) {
|
|
2019
|
-
if (window.innerWidth >=
|
|
2071
|
+
if (window.innerWidth >= C.NARROW_VIEWPORT_WIDTH) {
|
|
2020
2072
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2021
2073
|
this.#C.style.paddingLeft = `${e.left}px`, this.#C.style.paddingRight = `${window.innerWidth - e.right}px`;
|
|
2022
2074
|
}
|
|
2023
|
-
} else this.#
|
|
2024
|
-
if (!e && !
|
|
2075
|
+
} else this.#ce();
|
|
2076
|
+
if (!e && !xe) {
|
|
2025
2077
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2026
|
-
this.#C.style.left = `${e.left}px`, this.#
|
|
2078
|
+
this.#C.style.left = `${e.left}px`, this.#oe() ? this.#C.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#C.style.top = "unset", this.#C.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
|
|
2027
2079
|
}
|
|
2028
2080
|
t.appendChild(this.#C);
|
|
2029
2081
|
}
|
|
2030
|
-
#
|
|
2082
|
+
#ce() {
|
|
2031
2083
|
if (this.#c) return;
|
|
2032
2084
|
this.#c = !0;
|
|
2033
2085
|
let e = `--iti-anchor-${this.#t}`, t = getComputedStyle(this.telInputEl).anchorName;
|
|
2034
2086
|
this.telInputEl.style.anchorName = t && t !== "none" ? `${t}, ${e}` : e, this.#C.style.positionAnchor = e;
|
|
2035
2087
|
}
|
|
2036
|
-
#
|
|
2088
|
+
#le() {
|
|
2037
2089
|
let e = window.visualViewport;
|
|
2038
2090
|
if (!e || !this.#C) return;
|
|
2039
2091
|
let t = window.innerHeight - e.height;
|
|
2040
2092
|
this.#C.style.bottom = `${t}px`;
|
|
2041
2093
|
}
|
|
2042
2094
|
isCountrySelectorOpen() {
|
|
2043
|
-
return !this.#m.classList.contains(
|
|
2095
|
+
return !this.#m.classList.contains(v.HIDE);
|
|
2044
2096
|
}
|
|
2045
2097
|
setLoading(e) {
|
|
2046
|
-
this.#d.classList.toggle(
|
|
2098
|
+
this.#d.classList.toggle(v.LOADING, e);
|
|
2047
2099
|
}
|
|
2048
2100
|
playStrictRejectAnimation() {
|
|
2049
2101
|
if (!this.#e.strictRejectAnimation) return;
|
|
2050
2102
|
let e = this.telInputEl.parentElement;
|
|
2051
|
-
e && (e.classList.remove(
|
|
2103
|
+
e && (e.classList.remove(v.STRICT_REJECT_ANIMATION), e.offsetWidth, e.classList.add(v.STRICT_REJECT_ANIMATION), e.addEventListener("animationend", () => e.classList.remove(v.STRICT_REJECT_ANIMATION), { once: !0 }));
|
|
2052
2104
|
}
|
|
2053
2105
|
isLoading() {
|
|
2054
|
-
return this.#d.classList.contains(
|
|
2106
|
+
return this.#d.classList.contains(v.LOADING);
|
|
2055
2107
|
}
|
|
2056
2108
|
setDisabled(e) {
|
|
2057
2109
|
this.telInputEl.disabled = e, this.#u && (e ? this.#u.setAttribute("disabled", "true") : this.#u.removeAttribute("disabled"));
|
|
@@ -2061,24 +2113,24 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2061
2113
|
}
|
|
2062
2114
|
setSelectedCountry(e) {
|
|
2063
2115
|
let { countrySelectorMode: t, showFlags: n, separateDialCode: r, uiTranslations: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
2064
|
-
if (t !==
|
|
2065
|
-
let e = s && n ? `${
|
|
2066
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c =
|
|
2116
|
+
if (t !== I.OFF && this.#ie(s), this.#u) {
|
|
2117
|
+
let e = this.#k("selectedFlag", s && n ? `${v.FLAG} iti__${s}` : `${v.FLAG} ${v.GLOBE}`), t, r, c = null;
|
|
2118
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c = ge())) : (r = i.noCountrySelected, t = i.noCountrySelected, c = ge()), this.#d.className = e, this.#u.setAttribute("title", r), this.#u.setAttribute(R.LABEL, t), c ? this.#d.replaceChildren(c) : this.#d.replaceChildren();
|
|
2067
2119
|
}
|
|
2068
2120
|
if (r) {
|
|
2069
2121
|
let e = o ? `+${o}` : "";
|
|
2070
|
-
this.#f.textContent = e, this.#
|
|
2122
|
+
this.#f.textContent = e, this.#R();
|
|
2071
2123
|
}
|
|
2072
2124
|
}
|
|
2073
2125
|
destroy() {
|
|
2074
|
-
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[
|
|
2126
|
+
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[L.INSTANCE_ID], this.#O?.disconnect(), this.telInputEl.style.paddingLeft = this.#r;
|
|
2075
2127
|
let e = this.telInputEl.parentNode;
|
|
2076
2128
|
e && (e.before(this.telInputEl), e.remove()), this.#E.clear();
|
|
2077
2129
|
}
|
|
2078
|
-
},
|
|
2130
|
+
}, Ce = (e) => {
|
|
2079
2131
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
2080
2132
|
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
2081
|
-
},
|
|
2133
|
+
}, we = (e, t) => {
|
|
2082
2134
|
let { countryNameLocale: n, countryNameOverrides: r, uiTranslations: i } = t, a = i?.countryNames, o;
|
|
2083
2135
|
try {
|
|
2084
2136
|
o = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -2086,7 +2138,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2086
2138
|
console.error(e), o = null;
|
|
2087
2139
|
}
|
|
2088
2140
|
for (let t of e) t.name = r[t.iso2] || a?.[t.iso2] || o?.of(t.iso2.toUpperCase()) || "";
|
|
2089
|
-
},
|
|
2141
|
+
}, Te = (e) => {
|
|
2090
2142
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
2091
2143
|
if (!e || !t) return;
|
|
2092
2144
|
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
@@ -2115,7 +2167,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2115
2167
|
dialCodeMaxLength: n,
|
|
2116
2168
|
dialCodeToIso2Map: r
|
|
2117
2169
|
};
|
|
2118
|
-
},
|
|
2170
|
+
}, Ee = (e, t) => {
|
|
2119
2171
|
let { countryOrder: n } = t;
|
|
2120
2172
|
e.sort((e, t) => {
|
|
2121
2173
|
if (n) {
|
|
@@ -2124,7 +2176,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2124
2176
|
}
|
|
2125
2177
|
return e.name.localeCompare(t.name);
|
|
2126
2178
|
});
|
|
2127
|
-
},
|
|
2179
|
+
}, De = /* @__PURE__ */ new Set([
|
|
2128
2180
|
"800",
|
|
2129
2181
|
"808",
|
|
2130
2182
|
"870",
|
|
@@ -2133,17 +2185,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2133
2185
|
"883",
|
|
2134
2186
|
"888",
|
|
2135
2187
|
"979"
|
|
2136
|
-
]),
|
|
2137
|
-
let t =
|
|
2138
|
-
return e.startsWith("+") &&
|
|
2139
|
-
},
|
|
2188
|
+
]), Oe = (e) => {
|
|
2189
|
+
let t = K(e).slice(0, 3);
|
|
2190
|
+
return e.startsWith("+") && De.has(t);
|
|
2191
|
+
}, ke = (e, t, n, r) => {
|
|
2140
2192
|
if (!n || !t) return e;
|
|
2141
2193
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
2142
2194
|
return e.substring(a);
|
|
2143
|
-
},
|
|
2195
|
+
}, Ae = (e, t, n, r, i) => {
|
|
2144
2196
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
2145
2197
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
2146
|
-
},
|
|
2198
|
+
}, je = (e, t, n, r) => {
|
|
2147
2199
|
if (n === 0 && !r) return 0;
|
|
2148
2200
|
let i = 0;
|
|
2149
2201
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2151,7 +2203,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2151
2203
|
if (r && i === e + 1) return n;
|
|
2152
2204
|
}
|
|
2153
2205
|
return t.length;
|
|
2154
|
-
},
|
|
2206
|
+
}, Me = /* @__PURE__ */ new Set([
|
|
2155
2207
|
"800",
|
|
2156
2208
|
"822",
|
|
2157
2209
|
"833",
|
|
@@ -2169,16 +2221,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2169
2221
|
"887",
|
|
2170
2222
|
"888",
|
|
2171
2223
|
"889"
|
|
2172
|
-
]),
|
|
2173
|
-
let t =
|
|
2174
|
-
if (t.startsWith(
|
|
2224
|
+
]), Ne = (e) => {
|
|
2225
|
+
let t = K(e);
|
|
2226
|
+
if (t.startsWith(w.NANP) && t.length >= 4) {
|
|
2175
2227
|
let e = t.substring(1, 4);
|
|
2176
|
-
return
|
|
2228
|
+
return Me.has(e);
|
|
2177
2229
|
}
|
|
2178
2230
|
return !1;
|
|
2179
|
-
},
|
|
2231
|
+
}, Pe = 0, X = (e) => {
|
|
2180
2232
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2181
|
-
},
|
|
2233
|
+
}, Fe = () => {
|
|
2182
2234
|
let e, t;
|
|
2183
2235
|
return {
|
|
2184
2236
|
promise: new Promise((n, r) => {
|
|
@@ -2210,13 +2262,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2210
2262
|
#_;
|
|
2211
2263
|
#v;
|
|
2212
2264
|
constructor(e, t = {}) {
|
|
2213
|
-
this.id =
|
|
2265
|
+
this.id = Pe++, Se.validateInput(e);
|
|
2214
2266
|
let n = se(t);
|
|
2215
2267
|
this.#t = {
|
|
2216
|
-
...
|
|
2268
|
+
...B,
|
|
2217
2269
|
...n
|
|
2218
|
-
}, ce(this.#t), le(this.#t), this.#e = new
|
|
2219
|
-
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } =
|
|
2270
|
+
}, ce(this.#t), le(this.#t), this.#e = new Se(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new be(e.value), this.promise = this.#x(this.#t), this.#r = Ce(this.#t);
|
|
2271
|
+
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = Te(this.#r);
|
|
2220
2272
|
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#S();
|
|
2221
2273
|
}
|
|
2222
2274
|
#y() {
|
|
@@ -2228,20 +2280,20 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2228
2280
|
}
|
|
2229
2281
|
#x(e) {
|
|
2230
2282
|
let { initialCountry: t, initialCountryLookup: n, loadUtils: r } = e, i = !t && !!n, a = !!r && !Q.utils;
|
|
2231
|
-
return i && (this.#_ =
|
|
2283
|
+
return i && (this.#_ = Fe()), a && (this.#v = Fe()), Promise.all([this.#_?.promise, this.#v?.promise]).then(() => {});
|
|
2232
2284
|
}
|
|
2233
2285
|
#S() {
|
|
2234
2286
|
this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this.openCountrySelector();
|
|
2235
2287
|
}
|
|
2236
2288
|
#C() {
|
|
2237
|
-
|
|
2289
|
+
we(this.#r, this.#t), Ee(this.#r, this.#t), this.#c = _e(this.#r);
|
|
2238
2290
|
}
|
|
2239
2291
|
#w(e = !1) {
|
|
2240
|
-
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#ne(i), o =
|
|
2241
|
-
a ? o ? f ? this.#X(u) : d || this.#X(
|
|
2292
|
+
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#ne(i), o = Ne(i), { initialCountry: s, initialCountryLookup: c } = this.#t, l = !s && !!c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
|
|
2293
|
+
a ? o ? f ? this.#X(u) : d || this.#X(E.ISO2) : (f && this.#X(u), this.#K(i)) : f ? this.#X(u) : d || this.#X(""), i && this.#G(i);
|
|
2242
2294
|
}
|
|
2243
2295
|
#T() {
|
|
2244
|
-
this.#A(), this.#t.countrySelectorMode !==
|
|
2296
|
+
this.#A(), this.#t.countrySelectorMode !== I.OFF && this.#e.bindAllInitialCountrySelectorListeners(this.#p.signal, () => this.openCountrySelector(), () => this.#ee()), this.#e.bindHiddenInputSubmitListener(this.#p.signal, () => this.getNumber(), () => this.#l?.iso2 || "");
|
|
2245
2297
|
}
|
|
2246
2298
|
#E() {
|
|
2247
2299
|
if (this.#v) {
|
|
@@ -2297,23 +2349,23 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2297
2349
|
});
|
|
2298
2350
|
}
|
|
2299
2351
|
#N(e, t) {
|
|
2300
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(
|
|
2352
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(x.NON_PLUS_NUMERIC_GLOBAL, "").length, i = Ae(this.#ie(), e, Q.utils, this.#l, this.#t.separateDialCode), a = je(r, i, n, t);
|
|
2301
2353
|
this.#b(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2302
2354
|
}
|
|
2303
2355
|
#P(e) {
|
|
2304
2356
|
if (e.startsWith("+") && this.#l && this.#ne(e)) {
|
|
2305
|
-
let t =
|
|
2357
|
+
let t = ke(e, !0, !0, this.#l);
|
|
2306
2358
|
this.#b(t);
|
|
2307
2359
|
}
|
|
2308
2360
|
}
|
|
2309
2361
|
#F() {
|
|
2310
|
-
this.#h =
|
|
2362
|
+
this.#h = x.ALPHA_UNICODE.test(this.#y()), this.#e.telInputEl.addEventListener("input", this.#I, { signal: this.#p.signal });
|
|
2311
2363
|
}
|
|
2312
2364
|
#I = (e) => {
|
|
2313
2365
|
let { strictMode: t, formatAsYouType: n, separateDialCode: r, countrySelectorMode: i, countrySearch: a } = this.#t, o = e?.detail;
|
|
2314
2366
|
if (o?.isCountryChange) return;
|
|
2315
|
-
let s = this.#y(), c = e?.inputType ===
|
|
2316
|
-
if (this.#n && !c && e?.data === "+" && r && i !==
|
|
2367
|
+
let s = this.#y(), c = e?.inputType === b.PASTE, l = t && c;
|
|
2368
|
+
if (this.#n && !c && e?.data === "+" && r && i !== I.OFF && a) {
|
|
2317
2369
|
this.#j(s);
|
|
2318
2370
|
return;
|
|
2319
2371
|
}
|
|
@@ -2325,7 +2377,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2325
2377
|
if (this.#V()) return;
|
|
2326
2378
|
s = this.#y();
|
|
2327
2379
|
}
|
|
2328
|
-
this.#K(s) && (this.#oe(), this.#W(g.INPUT, { isCountryChange: !0 })), !l && e?.data &&
|
|
2380
|
+
this.#K(s) && (this.#oe(), this.#W(g.INPUT, { isCountryChange: !0 })), !l && e?.data && x.NON_PLUS_NUMERIC.test(e.data) || c && s && !t ? this.#h = !0 : x.NON_PLUS_NUMERIC.test(s) || (this.#h = !1), n && !this.#h && !o?.isSetNumber && this.#m.isAscii() && this.#N(s, e?.inputType === b.DELETE_FORWARD), r && this.#P(s);
|
|
2329
2381
|
};
|
|
2330
2382
|
#L() {
|
|
2331
2383
|
let { strictMode: e, separateDialCode: t } = this.#t;
|
|
@@ -2334,7 +2386,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2334
2386
|
#R = (e) => {
|
|
2335
2387
|
let { strictMode: t, separateDialCode: n, countrySelectorMode: r, countrySearch: i } = this.#t;
|
|
2336
2388
|
if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
2337
|
-
if (n && r !==
|
|
2389
|
+
if (n && r !== I.OFF && i && e.key === "+") {
|
|
2338
2390
|
e.preventDefault(), this.#O();
|
|
2339
2391
|
return;
|
|
2340
2392
|
}
|
|
@@ -2363,7 +2415,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2363
2415
|
#V() {
|
|
2364
2416
|
let e = this.#e.telInputEl, t = this.#g;
|
|
2365
2417
|
if (this.#g = null, !t) return !1;
|
|
2366
|
-
let n = t.pastedRaw, r = t.value, i = t.selectionStart, a = t.selectionEnd, o = r.slice(0, i), s = r.slice(a), c = this.#l?.iso2, l = this.#m.normalise(n), u = i === 0 && a > 0, d = !r.startsWith("+") || u, f = l.replace(
|
|
2418
|
+
let n = t.pastedRaw, r = t.value, i = t.selectionStart, a = t.selectionEnd, o = r.slice(0, i), s = r.slice(a), c = this.#l?.iso2, l = this.#m.normalise(n), u = i === 0 && a > 0, d = !r.startsWith("+") || u, f = l.replace(x.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = o + h + s, v = h === l ? null : "invalid";
|
|
2367
2419
|
if (_.length > 30) return this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2368
2420
|
source: "paste",
|
|
2369
2421
|
rejectedInput: n,
|
|
@@ -2415,8 +2467,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2415
2467
|
#G(e) {
|
|
2416
2468
|
let { numberDisplayFormat: t, separateDialCode: n } = this.#t, r = e;
|
|
2417
2469
|
if (Q.utils && this.#l) {
|
|
2418
|
-
let i =
|
|
2419
|
-
s = o ?
|
|
2470
|
+
let i = Oe(e), a = !r.startsWith("+") && !n, o = t === N.NATIONAL && !i || a, s;
|
|
2471
|
+
s = o ? N.NATIONAL : t === N.E164 && !i ? N.E164 : N.INTERNATIONAL, r = Q.utils.formatNumber(r, this.#l?.iso2, s);
|
|
2420
2472
|
}
|
|
2421
2473
|
r = this.#ae(r), this.#b(r);
|
|
2422
2474
|
}
|
|
@@ -2431,9 +2483,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2431
2483
|
#J(e) {
|
|
2432
2484
|
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#l?.iso2;
|
|
2433
2485
|
n = this.#q(n);
|
|
2434
|
-
let i = this.#ne(n, !0), a =
|
|
2486
|
+
let i = this.#ne(n, !0), a = K(n);
|
|
2435
2487
|
if (i) {
|
|
2436
|
-
let e =
|
|
2488
|
+
let e = K(i), t = this.#a[e];
|
|
2437
2489
|
return t.length === 1 ? t[0] === r ? null : t[0] : this.#Y(t, e, a);
|
|
2438
2490
|
} else if (n.startsWith("+") && a.length) {
|
|
2439
2491
|
let e = this.#l?.dialCode || "";
|
|
@@ -2444,7 +2496,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2444
2496
|
#Y(e, t, n) {
|
|
2445
2497
|
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2446
2498
|
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2447
|
-
if (i ===
|
|
2499
|
+
if (i === w.NANP && Ne(n)) return null;
|
|
2448
2500
|
let a = this.#l?.areaCodes, o = this.#l?.priority;
|
|
2449
2501
|
if (a) {
|
|
2450
2502
|
let e = a.map((e) => `${i}${e}`);
|
|
@@ -2465,22 +2517,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2465
2517
|
this.#u = null;
|
|
2466
2518
|
return;
|
|
2467
2519
|
}
|
|
2468
|
-
let i = Q.utils.getExampleNumber(r, t,
|
|
2520
|
+
let i = Q.utils.getExampleNumber(r, t, N.E164), a = i;
|
|
2469
2521
|
for (; Q.utils.isValidNumber(i, r, n);) a = i, i += "0";
|
|
2470
2522
|
let o = Q.utils.getCoreNumber(a, r);
|
|
2471
2523
|
this.#u = o.length, r === "by" && (this.#u = o.length + 1);
|
|
2472
2524
|
}
|
|
2473
2525
|
#Q() {
|
|
2474
|
-
let { placeholderNumberPolicy: e, placeholderNumberType: t, numberDisplayFormat: n, customPlaceholder: r } = this.#t, i = e ===
|
|
2526
|
+
let { placeholderNumberPolicy: e, placeholderNumberType: t, numberDisplayFormat: n, customPlaceholder: r } = this.#t, i = e === D.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === D.POLITE;
|
|
2475
2527
|
if (!Q.utils || !i) return;
|
|
2476
2528
|
let a = this.#l ? Q.utils.getExampleNumber(this.#l.iso2, t, n) : "";
|
|
2477
2529
|
a = this.#ae(a), typeof r == "function" && (a = r(a, this.#l)), this.#e.telInputEl.setAttribute("placeholder", a);
|
|
2478
2530
|
}
|
|
2479
2531
|
#$(e) {
|
|
2480
2532
|
if (!e) return;
|
|
2481
|
-
let t = e.dataset[
|
|
2533
|
+
let t = e.dataset[L.ISO2], n = this.#X(t);
|
|
2482
2534
|
this.#ee();
|
|
2483
|
-
let r = e.dataset[
|
|
2535
|
+
let r = e.dataset[L.DIAL_CODE];
|
|
2484
2536
|
this.#te(r);
|
|
2485
2537
|
let i = this.#y();
|
|
2486
2538
|
this.#G(i), this.#e.telInputEl.focus(), n && (this.#oe(), this.#W(g.INPUT, { isCountryChange: !0 }));
|
|
@@ -2513,7 +2565,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2513
2565
|
return n;
|
|
2514
2566
|
}
|
|
2515
2567
|
#re(e) {
|
|
2516
|
-
let t = this.#l?.dialCode, n =
|
|
2568
|
+
let t = this.#l?.dialCode, n = K(e);
|
|
2517
2569
|
return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
|
|
2518
2570
|
}
|
|
2519
2571
|
#ie() {
|
|
@@ -2521,7 +2573,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2521
2573
|
return this.#re(e);
|
|
2522
2574
|
}
|
|
2523
2575
|
#ae(e) {
|
|
2524
|
-
let t =
|
|
2576
|
+
let t = ke(e, !!this.#ne(e), this.#t.separateDialCode, this.#l);
|
|
2525
2577
|
return this.#U(t);
|
|
2526
2578
|
}
|
|
2527
2579
|
#oe() {
|
|
@@ -2563,7 +2615,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2563
2615
|
this.#v?.reject(e);
|
|
2564
2616
|
}
|
|
2565
2617
|
destroy() {
|
|
2566
|
-
this.#f && (this.#f = !1, this.#t.countrySelectorMode !==
|
|
2618
|
+
this.#f && (this.#f = !1, this.#t.countrySelectorMode !== I.OFF && this.#ee(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
|
|
2567
2619
|
}
|
|
2568
2620
|
isActive() {
|
|
2569
2621
|
return this.#f;
|
|
@@ -2594,9 +2646,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2594
2646
|
X("isValidNumber");
|
|
2595
2647
|
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#ie(), r = Q.utils.getCoreNumber(n, t);
|
|
2596
2648
|
if (r) {
|
|
2597
|
-
if (e ===
|
|
2598
|
-
if (!
|
|
2599
|
-
let t =
|
|
2649
|
+
if (e === T.DIAL_CODE && r[0] === T.MOBILE_PREFIX && r.length !== T.MOBILE_CORE_LENGTH) return !1;
|
|
2650
|
+
if (!x.ALPHA_UNICODE.test(n) && e) {
|
|
2651
|
+
let t = K(n.startsWith("+") ? n.slice(1 + e.length) : n).length;
|
|
2600
2652
|
if (r.length > t) return !1;
|
|
2601
2653
|
}
|
|
2602
2654
|
}
|
|
@@ -2607,7 +2659,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2607
2659
|
}
|
|
2608
2660
|
#de(e) {
|
|
2609
2661
|
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#ie();
|
|
2610
|
-
return !this.#l && !
|
|
2662
|
+
return !this.#l && !Oe(a) || !(e === "precise" ? Q.utils.isValidNumberPrecise : Q.utils.isValidNumber)(a, i, r) ? !1 : x.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
|
|
2611
2663
|
}
|
|
2612
2664
|
setSelectedCountry(e) {
|
|
2613
2665
|
if (!this.#f) return;
|
|
@@ -2656,11 +2708,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2656
2708
|
let n = new Z(e, t);
|
|
2657
2709
|
return Q.instances.set(String(n.id), n), e.iti = n, n;
|
|
2658
2710
|
}, {
|
|
2659
|
-
defaults:
|
|
2711
|
+
defaults: B,
|
|
2660
2712
|
documentReady: () => document.readyState === "complete",
|
|
2661
2713
|
getAllCountries: () => h,
|
|
2662
2714
|
getInstance: (e) => {
|
|
2663
|
-
let t = e.dataset[
|
|
2715
|
+
let t = e.dataset[L.INSTANCE_ID];
|
|
2664
2716
|
return t ? Q.instances.get(t) ?? null : null;
|
|
2665
2717
|
},
|
|
2666
2718
|
instances: /* @__PURE__ */ new Map(),
|
|
@@ -2678,13 +2730,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2678
2730
|
},
|
|
2679
2731
|
startedLoadingUtils: !1,
|
|
2680
2732
|
startedLoadingAutoCountry: !1,
|
|
2681
|
-
version: "29.
|
|
2682
|
-
NUMBER_FORMAT:
|
|
2683
|
-
NUMBER_TYPE:
|
|
2684
|
-
VALIDATION_ERROR:
|
|
2685
|
-
PLACEHOLDER_POLICY:
|
|
2686
|
-
COUNTRY_SELECTOR_MODE:
|
|
2687
|
-
}), $ = Q,
|
|
2733
|
+
version: "29.2.0",
|
|
2734
|
+
NUMBER_FORMAT: N,
|
|
2735
|
+
NUMBER_TYPE: P,
|
|
2736
|
+
VALIDATION_ERROR: F,
|
|
2737
|
+
PLACEHOLDER_POLICY: D,
|
|
2738
|
+
COUNTRY_SELECTOR_MODE: I
|
|
2739
|
+
}), $ = Q, Ie = /* @__PURE__ */ n({
|
|
2688
2740
|
inheritAttrs: !1,
|
|
2689
2741
|
__name: "IntlTelInput",
|
|
2690
2742
|
props: {
|
|
@@ -2707,6 +2759,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2707
2759
|
allowedNumberTypes: {},
|
|
2708
2760
|
allowNumberExtensions: { type: Boolean },
|
|
2709
2761
|
allowPhonewords: { type: Boolean },
|
|
2762
|
+
classNames: {},
|
|
2710
2763
|
containerClass: {},
|
|
2711
2764
|
countryNameLocale: {},
|
|
2712
2765
|
countryNameOverrides: {},
|
|
@@ -2755,7 +2808,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2755
2808
|
"oninput"
|
|
2756
2809
|
]), _ = c(""), v = e(() => {
|
|
2757
2810
|
let e = p.inputProps ?? {}, t = {};
|
|
2758
|
-
for (let [n, r] of Object.entries(e)) g.has(n) ? h(n) : n === "class" ? t[n] =
|
|
2811
|
+
for (let [n, r] of Object.entries(e)) g.has(n) ? h(n) : n === "class" ? t[n] = [_.value, r].filter(Boolean).join(" ") : t[n] = r;
|
|
2759
2812
|
return t;
|
|
2760
2813
|
}), y = e(() => p.modelValue ?? p.initialValue ?? ""), b = r(), x = Object.keys($.defaults), S = e(() => {
|
|
2761
2814
|
let e = b?.vnode.props ?? {}, t = new Set(Object.keys(e).map((e) => e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()))), n = {};
|
|
@@ -2789,9 +2842,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2789
2842
|
m("strictReject", t, n, r);
|
|
2790
2843
|
};
|
|
2791
2844
|
return a(() => {
|
|
2792
|
-
|
|
2845
|
+
if (!C.value) return;
|
|
2846
|
+
let e = new Set(C.value.classList);
|
|
2847
|
+
w.value = $(C.value, S.value), _.value = Array.from(C.value.classList).filter((t) => !e.has(t)).join(" "), C.value.addEventListener("input", N), C.value.addEventListener("open:countryselector", P), C.value.addEventListener("close:countryselector", F), C.value.addEventListener("strict:reject", I), p.disabled && w.value.setDisabled(p.disabled), p.readonly && w.value.setReadonly(p.readonly), E.value = w.value.getSelectedCountry()?.iso2 ?? "", w.value.promise.then(() => {
|
|
2793
2848
|
w.value?.isActive() && (y.value && w.value.setNumber(y.value), k ? (k = !1, N()) : (T.value = w.value.getNumber() ?? "", D.value = A(), O.value = D.value ? null : w.value.getValidationError()));
|
|
2794
|
-
})
|
|
2849
|
+
});
|
|
2795
2850
|
}), u(() => p.disabled, (e) => w.value?.setDisabled(e)), u(() => p.readonly, (e) => w.value?.setReadonly(e)), u(() => y.value, (e) => {
|
|
2796
2851
|
w.value && w.value.promise.then(() => {
|
|
2797
2852
|
if (!w.value?.isActive()) return;
|
|
@@ -2811,4 +2866,4 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2811
2866
|
}
|
|
2812
2867
|
});
|
|
2813
2868
|
//#endregion
|
|
2814
|
-
export { $ as n,
|
|
2869
|
+
export { $ as n, Ie as t };
|