@intl-tel-input/vue 28.1.0 → 29.0.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.
|
@@ -1183,8 +1183,8 @@ for (let e of d) f.push({
|
|
|
1183
1183
|
nationalPrefix: e[4] || null
|
|
1184
1184
|
});
|
|
1185
1185
|
var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
1186
|
-
|
|
1187
|
-
|
|
1186
|
+
OPEN_COUNTRY_SELECTOR: "open:countryselector",
|
|
1187
|
+
CLOSE_COUNTRY_SELECTOR: "close:countryselector",
|
|
1188
1188
|
COUNTRY_CHANGE: "countrychange",
|
|
1189
1189
|
INPUT: "input",
|
|
1190
1190
|
STRICT_REJECT: "strict:reject"
|
|
@@ -1219,8 +1219,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1219
1219
|
NEXT_TICK: 0
|
|
1220
1220
|
}, S = {
|
|
1221
1221
|
NARROW_VIEWPORT_WIDTH: 500,
|
|
1222
|
-
|
|
1223
|
-
|
|
1222
|
+
FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH: 78,
|
|
1223
|
+
FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH: 42,
|
|
1224
1224
|
INPUT_PADDING_EXTRA_LEFT: 6,
|
|
1225
1225
|
DROPDOWN_MARGIN: 3,
|
|
1226
1226
|
FALLBACK_DROPDOWN_HEIGHT: 200
|
|
@@ -1236,10 +1236,15 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1236
1236
|
ISO2: "us",
|
|
1237
1237
|
DIAL_CODE: "1"
|
|
1238
1238
|
}, E = {
|
|
1239
|
-
AGGRESSIVE: "
|
|
1240
|
-
POLITE: "
|
|
1241
|
-
OFF: "
|
|
1242
|
-
}, D =
|
|
1239
|
+
AGGRESSIVE: "AGGRESSIVE",
|
|
1240
|
+
POLITE: "POLITE",
|
|
1241
|
+
OFF: "OFF"
|
|
1242
|
+
}, D = [
|
|
1243
|
+
"OFF",
|
|
1244
|
+
"DROPDOWN",
|
|
1245
|
+
"FULLSCREEN",
|
|
1246
|
+
"AUTO"
|
|
1247
|
+
], O = [
|
|
1243
1248
|
"E164",
|
|
1244
1249
|
"INTERNATIONAL",
|
|
1245
1250
|
"NATIONAL",
|
|
@@ -1264,11 +1269,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1264
1269
|
"TOO_LONG",
|
|
1265
1270
|
"IS_POSSIBLE_LOCAL_ONLY",
|
|
1266
1271
|
"INVALID_LENGTH"
|
|
1267
|
-
], j = (e) => Object.fromEntries(e.map((e) => [e, e])), M = j(O), N = j(k), P = j(A), F = {
|
|
1272
|
+
], j = (e) => Object.fromEntries(e.map((e) => [e, e])), M = j(O), N = j(k), P = j(A), F = j(D), I = {
|
|
1268
1273
|
ISO2: "iso2",
|
|
1269
1274
|
DIAL_CODE: "dialCode",
|
|
1270
1275
|
INSTANCE_ID: "intlTelInputId"
|
|
1271
|
-
},
|
|
1276
|
+
}, L = {
|
|
1272
1277
|
EXPANDED: "aria-expanded",
|
|
1273
1278
|
LABEL: "aria-label",
|
|
1274
1279
|
SELECTED: "aria-selected",
|
|
@@ -1288,12 +1293,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1288
1293
|
searchSummaryAria(e) {
|
|
1289
1294
|
return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
|
|
1290
1295
|
}
|
|
1291
|
-
},
|
|
1292
|
-
|
|
1296
|
+
}, R = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, te = () => R(`(max-width: ${S.NARROW_VIEWPORT_WIDTH}px)`), ne = () => {
|
|
1297
|
+
if (typeof navigator < "u" && typeof window < "u") {
|
|
1298
|
+
let e = R("(max-height: 600px)"), t = R("(pointer: coarse)");
|
|
1299
|
+
if (te() || t && e) return F.FULLSCREEN;
|
|
1300
|
+
}
|
|
1301
|
+
return F.DROPDOWN;
|
|
1302
|
+
}, z = {
|
|
1303
|
+
countrySelectorMode: F.AUTO,
|
|
1293
1304
|
allowedNumberTypes: [N.MOBILE, N.FIXED_LINE],
|
|
1294
1305
|
allowNumberExtensions: !1,
|
|
1295
1306
|
allowPhonewords: !1,
|
|
1296
|
-
autoPlaceholder: E.POLITE,
|
|
1297
1307
|
containerClass: "",
|
|
1298
1308
|
countryNameLocale: "en",
|
|
1299
1309
|
countryNameOverrides: {},
|
|
@@ -1301,81 +1311,84 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1301
1311
|
countrySearch: !0,
|
|
1302
1312
|
customPlaceholder: null,
|
|
1303
1313
|
dropdownAlwaysOpen: !1,
|
|
1304
|
-
|
|
1314
|
+
dropdownParent: null,
|
|
1305
1315
|
excludeCountries: null,
|
|
1306
|
-
|
|
1316
|
+
matchDropdownWidth: !0,
|
|
1307
1317
|
formatAsYouType: !0,
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
hiddenInput: null,
|
|
1311
|
-
i18n: {},
|
|
1318
|
+
hiddenInputs: null,
|
|
1319
|
+
uiTranslations: {},
|
|
1312
1320
|
initialCountry: "",
|
|
1321
|
+
initialCountryLookup: null,
|
|
1313
1322
|
loadUtils: null,
|
|
1314
|
-
|
|
1323
|
+
numberDisplayFormat: M.INTERNATIONAL,
|
|
1315
1324
|
onlyCountries: null,
|
|
1325
|
+
placeholderNumberPolicy: E.POLITE,
|
|
1316
1326
|
placeholderNumberType: N.MOBILE,
|
|
1317
1327
|
searchInputClass: "",
|
|
1318
1328
|
separateDialCode: !0,
|
|
1319
1329
|
strictRejectAnimation: !0,
|
|
1320
1330
|
showFlags: !0,
|
|
1321
|
-
strictMode: !0
|
|
1322
|
-
|
|
1323
|
-
if (typeof navigator < "u" && typeof window < "u") {
|
|
1324
|
-
let e = L("(max-height: 600px)"), t = L("(pointer: coarse)");
|
|
1325
|
-
return te() || t && e;
|
|
1326
|
-
}
|
|
1327
|
-
return !1;
|
|
1328
|
-
})()
|
|
1329
|
-
}, ne = (e) => JSON.stringify(e), z = (e) => !!e && typeof e == "object" && !Array.isArray(e), re = (e) => typeof e == "function", ie = (e) => {
|
|
1331
|
+
strictMode: !0
|
|
1332
|
+
}, B = (e) => JSON.stringify(e), V = (e) => !!e && typeof e == "object" && !Array.isArray(e), re = (e) => typeof e == "function", ie = (e) => {
|
|
1330
1333
|
if (!e || typeof e != "object") return !1;
|
|
1331
1334
|
let t = e;
|
|
1332
1335
|
return t.nodeType === 1 && typeof t.tagName == "string" && typeof t.appendChild == "function";
|
|
1333
|
-
},
|
|
1336
|
+
}, ae = new Set(Object.values(E)), H = (e) => {
|
|
1334
1337
|
console.warn(`[intl-tel-input] ${e}`);
|
|
1335
|
-
},
|
|
1336
|
-
|
|
1337
|
-
},
|
|
1338
|
+
}, U = (e, t, n) => {
|
|
1339
|
+
H(`Option '${e}' must be ${t}; got ${B(n)}. Ignoring.`);
|
|
1340
|
+
}, oe = (e, t) => {
|
|
1338
1341
|
let n = "an array of iso2 country code strings";
|
|
1339
|
-
if (!Array.isArray(t)) return
|
|
1342
|
+
if (!Array.isArray(t)) return U(e, n, t), !1;
|
|
1340
1343
|
let r = [];
|
|
1341
1344
|
for (let i of t) {
|
|
1342
|
-
if (typeof i != "string") return
|
|
1343
|
-
m(i.toLowerCase()) ? r.push(i) :
|
|
1345
|
+
if (typeof i != "string") return U(e, n, t), !1;
|
|
1346
|
+
m(i.toLowerCase()) ? r.push(i) : H(`Invalid iso2 code in '${e}': '${i}'. Skipping.`);
|
|
1344
1347
|
}
|
|
1345
1348
|
return r;
|
|
1346
|
-
},
|
|
1349
|
+
}, se = (e) => {
|
|
1347
1350
|
if (e === void 0) return {};
|
|
1348
|
-
if (!
|
|
1351
|
+
if (!V(e)) return H(`The second argument must be an options object; got ${B(e)}. Using defaults.`), {};
|
|
1349
1352
|
let t = {};
|
|
1350
1353
|
for (let [n, r] of Object.entries(e)) {
|
|
1351
|
-
if (!Object.hasOwn(
|
|
1352
|
-
|
|
1354
|
+
if (!Object.hasOwn(z, n)) {
|
|
1355
|
+
H(`Unknown option '${n}'. Ignoring.`);
|
|
1353
1356
|
continue;
|
|
1354
1357
|
}
|
|
1355
1358
|
switch (n) {
|
|
1356
|
-
case "allowDropdown":
|
|
1357
1359
|
case "allowNumberExtensions":
|
|
1358
1360
|
case "allowPhonewords":
|
|
1359
1361
|
case "countrySearch":
|
|
1360
1362
|
case "dropdownAlwaysOpen":
|
|
1361
|
-
case "
|
|
1363
|
+
case "matchDropdownWidth":
|
|
1362
1364
|
case "formatAsYouType":
|
|
1363
|
-
case "formatOnDisplay":
|
|
1364
|
-
case "nationalMode":
|
|
1365
1365
|
case "showFlags":
|
|
1366
1366
|
case "separateDialCode":
|
|
1367
1367
|
case "strictMode":
|
|
1368
1368
|
case "strictRejectAnimation":
|
|
1369
|
-
case "useFullscreenPopup":
|
|
1370
1369
|
if (typeof r != "boolean") {
|
|
1371
|
-
|
|
1370
|
+
U(n, "a boolean", r);
|
|
1371
|
+
break;
|
|
1372
|
+
}
|
|
1373
|
+
t[n] = r;
|
|
1374
|
+
break;
|
|
1375
|
+
case "countrySelectorMode":
|
|
1376
|
+
if (typeof r != "string" || !D.includes(r)) {
|
|
1377
|
+
U("countrySelectorMode", `one of ${D.map((e) => `"${e}"`).join(", ")}`, r);
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
t[n] = r;
|
|
1381
|
+
break;
|
|
1382
|
+
case "numberDisplayFormat":
|
|
1383
|
+
if (typeof r != "string" || r === M.RFC3966 || !(r === M.E164 || r === M.INTERNATIONAL || r === M.NATIONAL)) {
|
|
1384
|
+
U("numberDisplayFormat", "one of \"E164\", \"INTERNATIONAL\", \"NATIONAL\"", r);
|
|
1372
1385
|
break;
|
|
1373
1386
|
}
|
|
1374
1387
|
t[n] = r;
|
|
1375
1388
|
break;
|
|
1376
|
-
case "
|
|
1377
|
-
if (typeof r != "string" || !
|
|
1378
|
-
|
|
1389
|
+
case "placeholderNumberPolicy":
|
|
1390
|
+
if (typeof r != "string" || !ae.has(r)) {
|
|
1391
|
+
U("placeholderNumberPolicy", `one of ${Array.from(ae).join(", ")}`, r);
|
|
1379
1392
|
break;
|
|
1380
1393
|
}
|
|
1381
1394
|
t[n] = r;
|
|
@@ -1384,7 +1397,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1384
1397
|
case "searchInputClass":
|
|
1385
1398
|
case "countryNameLocale":
|
|
1386
1399
|
if (typeof r != "string") {
|
|
1387
|
-
|
|
1400
|
+
U(n, "a string", r);
|
|
1388
1401
|
break;
|
|
1389
1402
|
}
|
|
1390
1403
|
t[n] = r;
|
|
@@ -1392,23 +1405,23 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1392
1405
|
case "countryOrder":
|
|
1393
1406
|
if (r === null) t[n] = r;
|
|
1394
1407
|
else {
|
|
1395
|
-
let e =
|
|
1408
|
+
let e = oe(n, r);
|
|
1396
1409
|
e !== !1 && (t[n] = e);
|
|
1397
1410
|
}
|
|
1398
1411
|
break;
|
|
1399
1412
|
case "customPlaceholder":
|
|
1400
|
-
case "
|
|
1401
|
-
case "
|
|
1413
|
+
case "hiddenInputs":
|
|
1414
|
+
case "initialCountryLookup":
|
|
1402
1415
|
case "loadUtils":
|
|
1403
1416
|
if (r !== null && !re(r)) {
|
|
1404
|
-
|
|
1417
|
+
U(n, "a function or null", r);
|
|
1405
1418
|
break;
|
|
1406
1419
|
}
|
|
1407
1420
|
t[n] = r;
|
|
1408
1421
|
break;
|
|
1409
|
-
case "
|
|
1422
|
+
case "dropdownParent":
|
|
1410
1423
|
if (r !== null && !ie(r)) {
|
|
1411
|
-
|
|
1424
|
+
U("dropdownParent", "an HTMLElement or null", r);
|
|
1412
1425
|
break;
|
|
1413
1426
|
}
|
|
1414
1427
|
t[n] = r;
|
|
@@ -1417,32 +1430,32 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1417
1430
|
case "onlyCountries":
|
|
1418
1431
|
if (r === null) t[n] = r;
|
|
1419
1432
|
else {
|
|
1420
|
-
let e =
|
|
1433
|
+
let e = oe(n, r);
|
|
1421
1434
|
e !== !1 && (t[n] = e);
|
|
1422
1435
|
}
|
|
1423
1436
|
break;
|
|
1424
|
-
case "
|
|
1425
|
-
if (r && !
|
|
1426
|
-
|
|
1437
|
+
case "uiTranslations":
|
|
1438
|
+
if (r && !V(r)) {
|
|
1439
|
+
U("uiTranslations", "an object", r);
|
|
1427
1440
|
break;
|
|
1428
1441
|
}
|
|
1429
1442
|
t[n] = r;
|
|
1430
1443
|
break;
|
|
1431
1444
|
case "countryNameOverrides":
|
|
1432
|
-
if (r && !
|
|
1433
|
-
|
|
1445
|
+
if (r && !V(r)) {
|
|
1446
|
+
U("countryNameOverrides", "an object", r);
|
|
1434
1447
|
break;
|
|
1435
1448
|
}
|
|
1436
1449
|
t[n] = r;
|
|
1437
1450
|
break;
|
|
1438
1451
|
case "initialCountry": {
|
|
1439
1452
|
if (typeof r != "string") {
|
|
1440
|
-
|
|
1453
|
+
U("initialCountry", "a string", r);
|
|
1441
1454
|
break;
|
|
1442
1455
|
}
|
|
1443
1456
|
let e = r.toLowerCase();
|
|
1444
|
-
if (e &&
|
|
1445
|
-
|
|
1457
|
+
if (e && !m(e)) {
|
|
1458
|
+
U("initialCountry", "a valid iso2 country code", r);
|
|
1446
1459
|
break;
|
|
1447
1460
|
}
|
|
1448
1461
|
t[n] = r;
|
|
@@ -1450,7 +1463,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1450
1463
|
}
|
|
1451
1464
|
case "placeholderNumberType":
|
|
1452
1465
|
if (typeof r != "string" || !k.includes(r)) {
|
|
1453
|
-
|
|
1466
|
+
U("placeholderNumberType", `one of ${k.join(", ")}`, r);
|
|
1454
1467
|
break;
|
|
1455
1468
|
}
|
|
1456
1469
|
t[n] = r;
|
|
@@ -1458,12 +1471,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1458
1471
|
case "allowedNumberTypes":
|
|
1459
1472
|
if (r !== null) {
|
|
1460
1473
|
if (!Array.isArray(r)) {
|
|
1461
|
-
|
|
1474
|
+
U("allowedNumberTypes", "an array of number types or null", r);
|
|
1462
1475
|
break;
|
|
1463
1476
|
}
|
|
1464
1477
|
let e = !0;
|
|
1465
1478
|
for (let t of r) if (typeof t != "string" || !k.includes(t)) {
|
|
1466
|
-
|
|
1479
|
+
U("allowedNumberTypes", `an array of valid number types (${k.join(", ")})`, t), e = !1;
|
|
1467
1480
|
break;
|
|
1468
1481
|
}
|
|
1469
1482
|
e && (t[n] = r);
|
|
@@ -1472,22 +1485,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1472
1485
|
}
|
|
1473
1486
|
}
|
|
1474
1487
|
return t;
|
|
1475
|
-
},
|
|
1488
|
+
}, ce = (e) => {
|
|
1476
1489
|
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());
|
|
1477
|
-
},
|
|
1478
|
-
e.
|
|
1490
|
+
}, le = (e) => {
|
|
1491
|
+
e.countrySelectorMode === F.AUTO && (e.countrySelectorMode = ne()), e.dropdownAlwaysOpen && (e.countrySelectorMode = F.DROPDOWN), e.countrySelectorMode === F.FULLSCREEN ? e.matchDropdownWidth = !1 : te() && (e.matchDropdownWidth = !0), e.onlyCountries?.length === 1 && (e.initialCountry = e.onlyCountries[0]), e.separateDialCode && e.numberDisplayFormat === M.NATIONAL && (e.numberDisplayFormat = M.INTERNATIONAL), e.countrySelectorMode !== F.OFF && !e.showFlags && !e.separateDialCode && e.numberDisplayFormat === M.NATIONAL && (e.numberDisplayFormat = M.INTERNATIONAL), e.uiTranslations = {
|
|
1479
1492
|
...ee,
|
|
1480
|
-
...e.
|
|
1493
|
+
...e.uiTranslations
|
|
1481
1494
|
};
|
|
1482
1495
|
}, W = (e) => e.replace(/\D/g, ""), G = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), K = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), q = (e, t, n) => {
|
|
1483
1496
|
let r = document.createElement(e);
|
|
1484
1497
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1485
|
-
},
|
|
1486
|
-
let r = document.createElementNS(
|
|
1498
|
+
}, ue = "http://www.w3.org/2000/svg", J = ([e, t, n]) => {
|
|
1499
|
+
let r = document.createElementNS(ue, e);
|
|
1487
1500
|
if (t) for (let e in t) r.setAttribute(e, String(t[e]));
|
|
1488
1501
|
if (n) for (let e of n) r.appendChild(J(e));
|
|
1489
1502
|
return r;
|
|
1490
|
-
},
|
|
1503
|
+
}, de = () => J([
|
|
1491
1504
|
"svg",
|
|
1492
1505
|
{
|
|
1493
1506
|
class: "iti__search-icon-svg",
|
|
@@ -1495,7 +1508,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1495
1508
|
height: 14,
|
|
1496
1509
|
viewBox: "0 0 24 24",
|
|
1497
1510
|
focusable: "false",
|
|
1498
|
-
[
|
|
1511
|
+
[L.HIDDEN]: "true"
|
|
1499
1512
|
},
|
|
1500
1513
|
[["circle", {
|
|
1501
1514
|
cx: 11,
|
|
@@ -1507,7 +1520,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1507
1520
|
x2: 16.65,
|
|
1508
1521
|
y2: 16.65
|
|
1509
1522
|
}]]
|
|
1510
|
-
]),
|
|
1523
|
+
]), fe = (e) => {
|
|
1511
1524
|
let t = `iti-${e}-clear-mask`;
|
|
1512
1525
|
return J([
|
|
1513
1526
|
"svg",
|
|
@@ -1516,7 +1529,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1516
1529
|
width: 12,
|
|
1517
1530
|
height: 12,
|
|
1518
1531
|
viewBox: "0 0 16 16",
|
|
1519
|
-
[
|
|
1532
|
+
[L.HIDDEN]: "true",
|
|
1520
1533
|
focusable: "false"
|
|
1521
1534
|
},
|
|
1522
1535
|
[[
|
|
@@ -1543,7 +1556,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1543
1556
|
mask: `url(#${t})`
|
|
1544
1557
|
}]]
|
|
1545
1558
|
]);
|
|
1546
|
-
},
|
|
1559
|
+
}, pe = () => J([
|
|
1547
1560
|
"svg",
|
|
1548
1561
|
{
|
|
1549
1562
|
class: "iti__country-check-svg",
|
|
@@ -1552,10 +1565,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1552
1565
|
viewBox: "0 0 16 16",
|
|
1553
1566
|
fill: "currentColor",
|
|
1554
1567
|
focusable: "false",
|
|
1555
|
-
[
|
|
1568
|
+
[L.HIDDEN]: "true"
|
|
1556
1569
|
},
|
|
1557
1570
|
[["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" }]]
|
|
1558
|
-
]),
|
|
1571
|
+
]), me = () => J([
|
|
1559
1572
|
"svg",
|
|
1560
1573
|
{
|
|
1561
1574
|
width: 256,
|
|
@@ -1564,7 +1577,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1564
1577
|
class: "iti__globe-svg"
|
|
1565
1578
|
},
|
|
1566
1579
|
[["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" }]]
|
|
1567
|
-
]), Y = (e) => G(e).replace(/[^\p{L}]+/gu, " ").trim(),
|
|
1580
|
+
]), Y = (e) => G(e).replace(/[^\p{L}]+/gu, " ").trim(), he = (e) => {
|
|
1568
1581
|
let t = /* @__PURE__ */ new Map();
|
|
1569
1582
|
for (let n of e) {
|
|
1570
1583
|
let e = Y(n.name), r = e.split(" ").filter(Boolean), i = r.map((e) => e[0] || "").join("");
|
|
@@ -1576,7 +1589,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1576
1589
|
});
|
|
1577
1590
|
}
|
|
1578
1591
|
return t;
|
|
1579
|
-
},
|
|
1592
|
+
}, ge = (e, t, n) => {
|
|
1580
1593
|
let r = G(n), i = Y(n), a = r !== "" && i === "", o = [], s = [], c = [], l = [], u = [], d = [], f = [];
|
|
1581
1594
|
for (let n of e) {
|
|
1582
1595
|
let e = t.get(n.iso2);
|
|
@@ -1605,14 +1618,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1605
1618
|
...d,
|
|
1606
1619
|
...f
|
|
1607
1620
|
];
|
|
1608
|
-
},
|
|
1621
|
+
}, _e = (e, t, n) => {
|
|
1609
1622
|
let r = Y(n);
|
|
1610
1623
|
for (let n of e) {
|
|
1611
1624
|
let { normalisedName: e } = t.get(n.iso2);
|
|
1612
1625
|
if (e.startsWith(r)) return n;
|
|
1613
1626
|
}
|
|
1614
1627
|
return null;
|
|
1615
|
-
},
|
|
1628
|
+
}, ve = class e {
|
|
1616
1629
|
#e;
|
|
1617
1630
|
static toAscii(e) {
|
|
1618
1631
|
return e ? e.replace(/[٠-٩]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1632))).replace(/[۰-۹]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1776))) : "";
|
|
@@ -1634,7 +1647,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1634
1647
|
isAscii() {
|
|
1635
1648
|
return !this.#e || this.#e === "ascii";
|
|
1636
1649
|
}
|
|
1637
|
-
},
|
|
1650
|
+
}, ye = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --x"), be = class e {
|
|
1638
1651
|
#e;
|
|
1639
1652
|
#t;
|
|
1640
1653
|
#n;
|
|
@@ -1666,7 +1679,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1666
1679
|
telInputEl;
|
|
1667
1680
|
hadInitialPlaceholder;
|
|
1668
1681
|
constructor(e, t, n) {
|
|
1669
|
-
e.dataset[
|
|
1682
|
+
e.dataset[I.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;
|
|
1670
1683
|
}
|
|
1671
1684
|
static validateInput(e) {
|
|
1672
1685
|
let t = e?.tagName;
|
|
@@ -1678,93 +1691,97 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1678
1691
|
buildMarkup(e, t) {
|
|
1679
1692
|
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");
|
|
1680
1693
|
let n = this.#O();
|
|
1681
|
-
this.#k(n), n.appendChild(this.telInputEl), this.#
|
|
1694
|
+
this.#k(n), n.appendChild(this.telInputEl), this.#N(), this.#L(), this.#P(n), this.ensureDropdownWidthSet();
|
|
1682
1695
|
}
|
|
1683
1696
|
#O() {
|
|
1684
|
-
let {
|
|
1697
|
+
let { countrySelectorMode: e, showFlags: t, containerClass: n } = this.#e, r = q("div", { class: K({
|
|
1685
1698
|
iti: !0,
|
|
1686
1699
|
"iti--input-container": !0,
|
|
1687
|
-
"iti--
|
|
1700
|
+
"iti--has-country-selector": e !== F.OFF,
|
|
1688
1701
|
"iti--show-flags": t,
|
|
1689
|
-
"iti--inline-
|
|
1702
|
+
"iti--inline-country-selector": e !== F.FULLSCREEN,
|
|
1690
1703
|
[n]: !!n
|
|
1691
1704
|
}) });
|
|
1692
|
-
return this.#n &&
|
|
1705
|
+
return this.#n && r.setAttribute("dir", "ltr"), this.telInputEl.before(r), r;
|
|
1693
1706
|
}
|
|
1694
1707
|
#k(e) {
|
|
1695
|
-
let {
|
|
1696
|
-
if (!
|
|
1697
|
-
this.#c = q("div", { class: `iti__country-container ${_.V_HIDE}` }, e),
|
|
1708
|
+
let { countrySelectorMode: t, separateDialCode: n, showFlags: r } = this.#e, i = t !== F.OFF;
|
|
1709
|
+
if (!i && !r && !n) return;
|
|
1710
|
+
this.#c = q("div", { class: `iti__country-container ${_.V_HIDE}` }, e), i ? (this.#l = q("button", {
|
|
1698
1711
|
type: "button",
|
|
1699
1712
|
class: "iti__selected-country",
|
|
1700
|
-
[
|
|
1701
|
-
[
|
|
1702
|
-
[
|
|
1703
|
-
[
|
|
1713
|
+
[L.EXPANDED]: "false",
|
|
1714
|
+
[L.LABEL]: this.#e.uiTranslations.noCountrySelected,
|
|
1715
|
+
[L.HASPOPUP]: "dialog",
|
|
1716
|
+
[L.CONTROLS]: `iti-${this.#t}__country-selector`
|
|
1704
1717
|
}, this.#c), this.telInputEl.disabled && this.#l.setAttribute("disabled", "true")) : this.#l = q("div", { class: "iti__selected-country" }, this.#c);
|
|
1705
|
-
let
|
|
1706
|
-
this.#u = q("div", { class: _.FLAG },
|
|
1718
|
+
let a = q("div", { class: "iti__selected-country-primary" }, this.#l);
|
|
1719
|
+
this.#u = q("div", { class: _.FLAG }, a), i && (this.#f = q("div", {
|
|
1707
1720
|
class: "iti__arrow",
|
|
1708
|
-
[
|
|
1709
|
-
},
|
|
1721
|
+
[L.HIDDEN]: "true"
|
|
1722
|
+
}, a)), n && (this.#d = q("div", { class: "iti__selected-dial-code" }, this.#l)), i && this.#A();
|
|
1710
1723
|
}
|
|
1711
1724
|
ensureDropdownWidthSet() {
|
|
1712
|
-
let {
|
|
1713
|
-
if (
|
|
1725
|
+
let { matchDropdownWidth: e, countrySelectorMode: t } = this.#e;
|
|
1726
|
+
if (t === F.OFF || !e || this.#p.style.width) return;
|
|
1714
1727
|
let n = this.telInputEl.offsetWidth;
|
|
1715
1728
|
n > 0 && (this.#p.style.width = `${n}px`);
|
|
1716
1729
|
}
|
|
1717
1730
|
#A() {
|
|
1718
|
-
let {
|
|
1731
|
+
let { matchDropdownWidth: e, countrySelectorMode: t, countrySearch: n, uiTranslations: r, containerClass: i } = this.#e, a = t === F.FULLSCREEN, o = this.#j(), s = e ? "" : "iti--flexible-dropdown-width";
|
|
1719
1732
|
this.#p = q("div", {
|
|
1720
|
-
id: `iti-${this.#t}
|
|
1721
|
-
class: `
|
|
1733
|
+
id: `iti-${this.#t}__country-selector`,
|
|
1734
|
+
class: `iti__country-selector ${_.HIDE} ${s}`,
|
|
1722
1735
|
role: "dialog",
|
|
1723
|
-
[
|
|
1724
|
-
}), this.#n && this.#p.setAttribute("dir", "rtl"), n && this.#
|
|
1736
|
+
[L.MODAL]: "true"
|
|
1737
|
+
}), this.#n && this.#p.setAttribute("dir", "rtl"), n && this.#M(), this.#_ = q("ul", {
|
|
1725
1738
|
class: "iti__country-list",
|
|
1726
1739
|
id: `iti-${this.#t}__country-listbox`,
|
|
1727
1740
|
role: "listbox",
|
|
1728
|
-
[
|
|
1729
|
-
}, this.#p), this.#
|
|
1741
|
+
[L.LABEL]: r.countryListAriaLabel
|
|
1742
|
+
}, this.#p), this.#F(), n && this.#V(), a || (this.#s = this.#B(), n && (this.#p.style.height = `${this.#s}px`)), o ? (this.#S = q("div", { class: K({
|
|
1730
1743
|
iti: !0,
|
|
1731
|
-
"iti--
|
|
1732
|
-
"iti--fullscreen-popup":
|
|
1733
|
-
"iti--inline-
|
|
1734
|
-
[
|
|
1735
|
-
}) }), this.#S.appendChild(this.#p)) : this.#c.appendChild(this.#p);
|
|
1744
|
+
"iti--detached-country-selector": !0,
|
|
1745
|
+
"iti--fullscreen-popup": a,
|
|
1746
|
+
"iti--inline-country-selector": !a,
|
|
1747
|
+
[i]: !!i
|
|
1748
|
+
}) }), this.#S.appendChild(this.#p), a || this.#oe()) : this.#c.appendChild(this.#p);
|
|
1736
1749
|
}
|
|
1737
1750
|
#j() {
|
|
1738
|
-
let {
|
|
1751
|
+
let { countrySelectorMode: e, dropdownParent: t } = this.#e;
|
|
1752
|
+
return e === F.FULLSCREEN ? document.body : e === F.DROPDOWN ? t : null;
|
|
1753
|
+
}
|
|
1754
|
+
#M() {
|
|
1755
|
+
let { uiTranslations: e, searchInputClass: t } = this.#e, n = q("div", { class: "iti__search-input-wrapper" }, this.#p);
|
|
1739
1756
|
this.#m = q("span", {
|
|
1740
1757
|
class: "iti__search-icon",
|
|
1741
|
-
[
|
|
1742
|
-
}, n), this.#m.appendChild(
|
|
1758
|
+
[L.HIDDEN]: "true"
|
|
1759
|
+
}, n), this.#m.appendChild(de()), this.#h = q("input", {
|
|
1743
1760
|
id: `iti-${this.#t}__search-input`,
|
|
1744
1761
|
type: "search",
|
|
1745
1762
|
class: `iti__search-input ${t}`,
|
|
1746
1763
|
placeholder: e.searchPlaceholder,
|
|
1747
1764
|
role: "combobox",
|
|
1748
|
-
[
|
|
1749
|
-
[
|
|
1750
|
-
[
|
|
1751
|
-
[
|
|
1765
|
+
[L.EXPANDED]: "true",
|
|
1766
|
+
[L.LABEL]: e.searchPlaceholder,
|
|
1767
|
+
[L.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1768
|
+
[L.AUTOCOMPLETE]: "list",
|
|
1752
1769
|
autocomplete: "off"
|
|
1753
1770
|
}, n), this.#g = q("button", {
|
|
1754
1771
|
type: "button",
|
|
1755
1772
|
class: `iti__search-clear ${_.HIDE}`,
|
|
1756
|
-
[
|
|
1773
|
+
[L.LABEL]: e.clearSearchAriaLabel,
|
|
1757
1774
|
tabindex: "-1"
|
|
1758
|
-
}, n), this.#g.appendChild(
|
|
1775
|
+
}, n), this.#g.appendChild(fe(this.#t)), this.#x = q("span", { class: "iti__a11y-text" }, this.#p), this.#b = q("div", {
|
|
1759
1776
|
class: `iti__no-results ${_.HIDE}`,
|
|
1760
|
-
[
|
|
1777
|
+
[L.HIDDEN]: "true"
|
|
1761
1778
|
}, this.#p), this.#b.textContent = e.searchEmptyState ?? null;
|
|
1762
1779
|
}
|
|
1763
|
-
#
|
|
1764
|
-
this.#c && (this.#
|
|
1780
|
+
#N() {
|
|
1781
|
+
this.#c && (this.#I(), this.#c.classList.remove(_.V_HIDE));
|
|
1765
1782
|
}
|
|
1766
|
-
#
|
|
1767
|
-
let {
|
|
1783
|
+
#P(e) {
|
|
1784
|
+
let { hiddenInputs: t } = this.#e;
|
|
1768
1785
|
if (!t) return;
|
|
1769
1786
|
let n = t(this.telInputEl.getAttribute("name") || "");
|
|
1770
1787
|
if (n.phone) {
|
|
@@ -1782,7 +1799,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1782
1799
|
}), e.appendChild(this.#y));
|
|
1783
1800
|
}
|
|
1784
1801
|
}
|
|
1785
|
-
#
|
|
1802
|
+
#F() {
|
|
1786
1803
|
let e = document.createDocumentFragment();
|
|
1787
1804
|
for (let t = 0; t < this.#i.length; t++) {
|
|
1788
1805
|
let n = this.#i[t], r = K({ [_.COUNTRY_ITEM]: !0 }), i = q("li", {
|
|
@@ -1790,9 +1807,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1790
1807
|
class: r,
|
|
1791
1808
|
tabindex: "-1",
|
|
1792
1809
|
role: "option",
|
|
1793
|
-
[
|
|
1810
|
+
[L.SELECTED]: "false"
|
|
1794
1811
|
});
|
|
1795
|
-
i.dataset[
|
|
1812
|
+
i.dataset[I.DIAL_CODE] = n.dialCode, i.dataset[I.ISO2] = n.iso2, this.#T.set(n.iso2, i), this.#e.showFlags && q("div", { class: `${_.FLAG} iti__${n.iso2}` }, i);
|
|
1796
1813
|
let a = q("span", { class: "iti__country-name" }, i);
|
|
1797
1814
|
a.textContent = `${n.name} `;
|
|
1798
1815
|
let o = q("span", { class: "iti__dial-code" }, a);
|
|
@@ -1800,18 +1817,18 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1800
1817
|
}
|
|
1801
1818
|
this.#_.appendChild(e);
|
|
1802
1819
|
}
|
|
1803
|
-
#
|
|
1820
|
+
#I() {
|
|
1804
1821
|
if (this.#l) {
|
|
1805
|
-
let e = this.#e.separateDialCode ? S.
|
|
1822
|
+
let e = this.#e.separateDialCode ? S.FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH : S.FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH, t = (this.#l.offsetWidth || this.#z() || e) + S.INPUT_PADDING_EXTRA_LEFT;
|
|
1806
1823
|
this.telInputEl.style.paddingLeft = `${t}px`;
|
|
1807
1824
|
}
|
|
1808
1825
|
}
|
|
1809
|
-
#
|
|
1826
|
+
#L() {
|
|
1810
1827
|
!this.#l || typeof ResizeObserver > "u" || (this.#D = new ResizeObserver(() => {
|
|
1811
|
-
this.#l?.offsetWidth && this.#
|
|
1828
|
+
this.#l?.offsetWidth && this.#I();
|
|
1812
1829
|
}), this.#D.observe(this.#l));
|
|
1813
1830
|
}
|
|
1814
|
-
static #
|
|
1831
|
+
static #R() {
|
|
1815
1832
|
let e;
|
|
1816
1833
|
try {
|
|
1817
1834
|
e = window.top.document.body;
|
|
@@ -1820,9 +1837,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1820
1837
|
}
|
|
1821
1838
|
return e;
|
|
1822
1839
|
}
|
|
1823
|
-
#
|
|
1840
|
+
#z() {
|
|
1824
1841
|
if (!this.telInputEl.parentNode) return 0;
|
|
1825
|
-
let t = e.#
|
|
1842
|
+
let t = e.#R(), n = this.telInputEl.parentNode.cloneNode(!1);
|
|
1826
1843
|
n.style.visibility = "hidden", t.appendChild(n);
|
|
1827
1844
|
let r = this.#c.cloneNode();
|
|
1828
1845
|
n.appendChild(r);
|
|
@@ -1831,53 +1848,53 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1831
1848
|
let a = i.offsetWidth;
|
|
1832
1849
|
return t.removeChild(n), a;
|
|
1833
1850
|
}
|
|
1834
|
-
#
|
|
1835
|
-
let t = e.#
|
|
1851
|
+
#B() {
|
|
1852
|
+
let t = e.#R();
|
|
1836
1853
|
this.#p.classList.remove(_.HIDE);
|
|
1837
|
-
let n = q("div", { class: "iti iti--inline-
|
|
1854
|
+
let n = q("div", { class: "iti iti--inline-country-selector" });
|
|
1838
1855
|
n.appendChild(this.#p), n.style.visibility = "hidden", t.appendChild(n);
|
|
1839
1856
|
let r = this.#p.offsetHeight;
|
|
1840
1857
|
return t.removeChild(n), n.style.visibility = "", this.#p.classList.add(_.HIDE), r > 0 ? r : S.FALLBACK_DROPDOWN_HEIGHT;
|
|
1841
1858
|
}
|
|
1842
|
-
#
|
|
1843
|
-
let {
|
|
1859
|
+
#V() {
|
|
1860
|
+
let { uiTranslations: e } = this.#e, t = this.#_.childElementCount;
|
|
1844
1861
|
this.#x.textContent = e.searchSummaryAria(t);
|
|
1845
1862
|
}
|
|
1846
|
-
#
|
|
1863
|
+
#H(e) {
|
|
1847
1864
|
let t;
|
|
1848
1865
|
if (e === "") t = this.#i;
|
|
1849
1866
|
else {
|
|
1850
|
-
let n =
|
|
1851
|
-
t =
|
|
1867
|
+
let n = ve.toAscii(e);
|
|
1868
|
+
t = ge(this.#i, this.#a, n);
|
|
1852
1869
|
}
|
|
1853
|
-
this.#
|
|
1870
|
+
this.#re(t);
|
|
1854
1871
|
}
|
|
1855
1872
|
prefillSearchWithPlus() {
|
|
1856
|
-
this.#h.value = "+", this.#h.focus(), this.#
|
|
1873
|
+
this.#h.value = "+", this.#h.focus(), this.#H("");
|
|
1857
1874
|
}
|
|
1858
|
-
#
|
|
1875
|
+
#U() {
|
|
1859
1876
|
let e = this.#h.value.trim();
|
|
1860
|
-
this.#
|
|
1877
|
+
this.#H(e), this.#h.value ? this.#g.classList.remove(_.HIDE) : this.#g.classList.add(_.HIDE);
|
|
1861
1878
|
}
|
|
1862
|
-
#
|
|
1879
|
+
#W() {
|
|
1863
1880
|
this.#o && clearTimeout(this.#o), this.#o = setTimeout(() => {
|
|
1864
|
-
this.#
|
|
1881
|
+
this.#U(), this.#o = null;
|
|
1865
1882
|
}, x.SEARCH_DEBOUNCE_MS);
|
|
1866
1883
|
}
|
|
1867
|
-
#
|
|
1868
|
-
this.#h.value = "", this.#h.focus(), this.#
|
|
1884
|
+
#G() {
|
|
1885
|
+
this.#h.value = "", this.#h.focus(), this.#U();
|
|
1869
1886
|
}
|
|
1870
|
-
#
|
|
1887
|
+
#K(e) {
|
|
1871
1888
|
let t = this.#_, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
|
|
1872
1889
|
r.top < n.top ? t.scrollTop = i : r.bottom > n.bottom && (t.scrollTop = i - n.height + r.height);
|
|
1873
1890
|
}
|
|
1874
|
-
#
|
|
1891
|
+
#q(e, t = !0) {
|
|
1875
1892
|
if (this.#w?.classList.remove(_.HIGHLIGHT), e) {
|
|
1876
1893
|
if (e.classList.add(_.HIGHLIGHT), this.#e.countrySearch) {
|
|
1877
1894
|
let t = e.getAttribute("id") || "";
|
|
1878
|
-
this.#h.setAttribute(
|
|
1895
|
+
this.#h.setAttribute(L.ACTIVE_DESCENDANT, t);
|
|
1879
1896
|
}
|
|
1880
|
-
t && this.#
|
|
1897
|
+
t && this.#K(e), this.#w = e;
|
|
1881
1898
|
} else this.#w = null;
|
|
1882
1899
|
}
|
|
1883
1900
|
bindHiddenInputSubmitListener(e, t, n) {
|
|
@@ -1886,12 +1903,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1886
1903
|
this.#v && (this.#v.value = t()), this.#y && (this.#y.value = n());
|
|
1887
1904
|
}, { signal: e });
|
|
1888
1905
|
}
|
|
1889
|
-
|
|
1906
|
+
bindAllInitialCountrySelectorListeners(e, t, n) {
|
|
1890
1907
|
let r = this.telInputEl.closest("label");
|
|
1891
1908
|
r && r.addEventListener("click", (e) => {
|
|
1892
|
-
this.
|
|
1909
|
+
this.isCountrySelectorOpen() ? e.preventDefault() : this.telInputEl.focus();
|
|
1893
1910
|
}, { signal: e }), this.#l.addEventListener("click", () => {
|
|
1894
|
-
!this.
|
|
1911
|
+
!this.isCountrySelectorOpen() && !this.telInputEl.disabled && !this.telInputEl.readOnly && t();
|
|
1895
1912
|
}, { signal: e }), this.#c.addEventListener("keydown", (e) => {
|
|
1896
1913
|
let r = [
|
|
1897
1914
|
v.ARROW_UP,
|
|
@@ -1899,119 +1916,127 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1899
1916
|
v.SPACE,
|
|
1900
1917
|
v.ENTER
|
|
1901
1918
|
];
|
|
1902
|
-
!this.
|
|
1919
|
+
!this.isCountrySelectorOpen() && r.includes(e.key) && (e.preventDefault(), e.stopPropagation(), t()), e.key === v.TAB && n();
|
|
1903
1920
|
}, { signal: e });
|
|
1904
1921
|
}
|
|
1905
|
-
|
|
1906
|
-
let { countrySearch: n, dropdownAlwaysOpen: r
|
|
1907
|
-
if (this.#E = new AbortController(), this.ensureDropdownWidthSet(),
|
|
1922
|
+
openCountrySelector(e, t) {
|
|
1923
|
+
let { countrySearch: n, dropdownAlwaysOpen: r } = this.#e;
|
|
1924
|
+
if (this.#E = new AbortController(), this.ensureDropdownWidthSet(), this.#S) this.#ae();
|
|
1908
1925
|
else {
|
|
1909
|
-
let e = this.#
|
|
1926
|
+
let e = this.#ie(), t = this.telInputEl.offsetHeight + S.DROPDOWN_MARGIN;
|
|
1910
1927
|
e ? this.#p.style.top = `${t}px` : this.#p.style.bottom = `${t}px`;
|
|
1911
1928
|
}
|
|
1912
|
-
this.#p.classList.remove(_.HIDE), this.#l.setAttribute(
|
|
1913
|
-
let
|
|
1914
|
-
|
|
1915
|
-
this.#
|
|
1916
|
-
}, { signal: this.#E.signal }), this.#f.classList.add(_.ARROW_UP), this.#
|
|
1929
|
+
this.#p.classList.remove(_.HIDE), this.#l.setAttribute(L.EXPANDED, "true");
|
|
1930
|
+
let i = this.#C ?? this.#_.firstElementChild;
|
|
1931
|
+
i && this.#q(i), n && !r && this.#h.focus(), this.#e.countrySelectorMode === F.FULLSCREEN && this.#S && window.visualViewport && window.visualViewport.addEventListener("resize", () => {
|
|
1932
|
+
this.#se(), this.#w && this.#K(this.#w);
|
|
1933
|
+
}, { signal: this.#E.signal }), this.#f.classList.add(_.ARROW_UP), this.#J(e, t);
|
|
1917
1934
|
}
|
|
1918
|
-
#
|
|
1935
|
+
#J(e, t) {
|
|
1919
1936
|
let n = this.#E.signal;
|
|
1920
|
-
this.#
|
|
1937
|
+
this.#Y(n), this.#X(n, e), this.#e.dropdownAlwaysOpen || this.#Z(n, t), this.#Q(n, e, t), this.#e.countrySearch && this.#$(n), this.#e.countrySelectorMode === F.DROPDOWN && this.#e.dropdownParent && !ye && document.addEventListener("scroll", t, {
|
|
1938
|
+
signal: n,
|
|
1939
|
+
capture: !0,
|
|
1940
|
+
passive: !0
|
|
1941
|
+
});
|
|
1921
1942
|
}
|
|
1922
|
-
#
|
|
1943
|
+
#Y(e) {
|
|
1923
1944
|
this.#_.addEventListener("mouseover", (e) => {
|
|
1924
1945
|
let t = e.target?.closest(`.${_.COUNTRY_ITEM}`);
|
|
1925
|
-
t && this.#
|
|
1946
|
+
t && this.#q(t, !1);
|
|
1926
1947
|
}, { signal: e });
|
|
1927
1948
|
}
|
|
1928
|
-
#
|
|
1949
|
+
#X(e, t) {
|
|
1929
1950
|
this.#_.addEventListener("click", (e) => {
|
|
1930
1951
|
let n = e.target?.closest(`.${_.COUNTRY_ITEM}`);
|
|
1931
1952
|
n && t(n);
|
|
1932
1953
|
}, { signal: e });
|
|
1933
1954
|
}
|
|
1934
|
-
#
|
|
1955
|
+
#Z(e, t) {
|
|
1935
1956
|
setTimeout(() => {
|
|
1936
1957
|
document.documentElement.addEventListener("click", (e) => {
|
|
1937
1958
|
this.#p.contains(e.target) || t();
|
|
1938
1959
|
}, { signal: e });
|
|
1939
1960
|
}, 0);
|
|
1940
1961
|
}
|
|
1941
|
-
#
|
|
1962
|
+
#Q(e, t, n) {
|
|
1942
1963
|
let r = "", i = null, a = (e) => {
|
|
1943
1964
|
[
|
|
1944
1965
|
v.ARROW_UP,
|
|
1945
1966
|
v.ARROW_DOWN,
|
|
1946
1967
|
v.ENTER,
|
|
1947
1968
|
v.ESC
|
|
1948
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#
|
|
1969
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#te(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#w) : e.key === v.ESC && (n(), this.#l.focus())), !this.#e.countrySearch && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#ee(r), i = setTimeout(() => {
|
|
1949
1970
|
r = "";
|
|
1950
1971
|
}, x.HIDDEN_SEARCH_RESET_MS));
|
|
1951
1972
|
};
|
|
1952
1973
|
this.#l?.addEventListener("keydown", a, { signal: e }), this.#p?.addEventListener("keydown", a, { signal: e });
|
|
1953
1974
|
}
|
|
1954
|
-
#Q(e) {
|
|
1955
|
-
this.#h.addEventListener("input", () => this.#U(), { signal: e }), this.#g.addEventListener("click", () => this.#W(), { signal: e });
|
|
1956
|
-
}
|
|
1957
1975
|
#$(e) {
|
|
1958
|
-
|
|
1976
|
+
this.#h.addEventListener("input", () => this.#W(), { signal: e }), this.#g.addEventListener("click", () => this.#G(), { signal: e });
|
|
1977
|
+
}
|
|
1978
|
+
#ee(e) {
|
|
1979
|
+
let t = _e(this.#i, this.#a, e);
|
|
1959
1980
|
if (t) {
|
|
1960
1981
|
let e = this.#T.get(t.iso2);
|
|
1961
|
-
this.#
|
|
1982
|
+
this.#q(e);
|
|
1962
1983
|
}
|
|
1963
1984
|
}
|
|
1964
|
-
#
|
|
1985
|
+
#te(e) {
|
|
1965
1986
|
let t = e === v.ARROW_UP ? this.#w?.previousElementSibling : this.#w?.nextElementSibling;
|
|
1966
|
-
!t && this.#_.childElementCount > 1 && (t = e === v.ARROW_UP ? this.#_.lastElementChild : this.#_.firstElementChild), t && this.#
|
|
1987
|
+
!t && this.#_.childElementCount > 1 && (t = e === v.ARROW_UP ? this.#_.lastElementChild : this.#_.firstElementChild), t && this.#q(t);
|
|
1967
1988
|
}
|
|
1968
|
-
#
|
|
1969
|
-
if (this.#C && this.#C.dataset[
|
|
1989
|
+
#ne(e) {
|
|
1990
|
+
if (this.#C && this.#C.dataset[I.ISO2] !== e && (this.#C.setAttribute(L.SELECTED, "false"), this.#C.querySelector(".iti__country-check")?.remove(), this.#C = null), e && !this.#C) {
|
|
1970
1991
|
let t = this.#_.querySelector(`[data-iso2="${e}"]`);
|
|
1971
|
-
t && (t.setAttribute(
|
|
1992
|
+
t && (t.setAttribute(L.SELECTED, "true"), q("span", {
|
|
1972
1993
|
class: "iti__country-check",
|
|
1973
|
-
[
|
|
1974
|
-
}, t).appendChild(
|
|
1994
|
+
[L.HIDDEN]: "true"
|
|
1995
|
+
}, t).appendChild(pe()), this.#C = t, this.#e.dropdownAlwaysOpen && this.#q(t));
|
|
1975
1996
|
}
|
|
1976
1997
|
}
|
|
1977
|
-
#
|
|
1998
|
+
#re(e) {
|
|
1978
1999
|
this.#_.replaceChildren();
|
|
1979
2000
|
let t = !0;
|
|
1980
2001
|
for (let n of e) {
|
|
1981
2002
|
let e = this.#T.get(n.iso2);
|
|
1982
|
-
e && (this.#_.appendChild(e), t &&= (this.#
|
|
2003
|
+
e && (this.#_.appendChild(e), t &&= (this.#q(e, !1), !1));
|
|
1983
2004
|
}
|
|
1984
|
-
t ? (this.#
|
|
2005
|
+
t ? (this.#q(null), this.#b && this.#b.classList.remove(_.HIDE)) : this.#b && this.#b.classList.add(_.HIDE), this.#_.scrollTop = 0, this.#V();
|
|
1985
2006
|
}
|
|
1986
|
-
|
|
1987
|
-
let { countrySearch: e
|
|
1988
|
-
this.#E.abort(), this.#E = null, this.#p.classList.add(_.HIDE), this.#l.setAttribute(
|
|
2007
|
+
closeCountrySelector() {
|
|
2008
|
+
let { countrySearch: e } = this.#e;
|
|
2009
|
+
this.#E.abort(), this.#E = null, this.#p.classList.add(_.HIDE), this.#l.setAttribute(L.EXPANDED, "false"), e && (this.#h.removeAttribute(L.ACTIVE_DESCENDANT), this.#h.value = "", this.#U(), this.#w &&= (this.#w.classList.remove(_.HIGHLIGHT), null)), this.#f.classList.remove(_.ARROW_UP), this.#S ? (this.#S.remove(), this.#S.style.top = "", this.#S.style.bottom = "", this.#S.style.paddingLeft = "", this.#S.style.paddingRight = "") : (this.#p.style.top = "", this.#p.style.bottom = "");
|
|
1989
2010
|
}
|
|
1990
|
-
#
|
|
2011
|
+
#ie() {
|
|
1991
2012
|
if (this.#e.dropdownAlwaysOpen) return !0;
|
|
1992
2013
|
let e = this.telInputEl.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
|
|
1993
2014
|
return n >= this.#s || n >= t;
|
|
1994
2015
|
}
|
|
1995
|
-
#
|
|
1996
|
-
let
|
|
1997
|
-
if (
|
|
2016
|
+
#ae() {
|
|
2017
|
+
let e = this.#e.countrySelectorMode === F.FULLSCREEN, t = this.#j();
|
|
2018
|
+
if (e) {
|
|
1998
2019
|
if (window.innerWidth >= S.NARROW_VIEWPORT_WIDTH) {
|
|
1999
2020
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2000
2021
|
this.#S.style.paddingLeft = `${e.left}px`, this.#S.style.paddingRight = `${window.innerWidth - e.right}px`;
|
|
2001
2022
|
}
|
|
2002
|
-
} else {
|
|
2023
|
+
} else if (!ye) {
|
|
2003
2024
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2004
|
-
this.#S.style.left = `${e.left}px`, this.#
|
|
2025
|
+
this.#S.style.left = `${e.left}px`, this.#ie() ? this.#S.style.top = `${e.bottom + S.DROPDOWN_MARGIN}px` : (this.#S.style.top = "unset", this.#S.style.bottom = `${window.innerHeight - e.top + S.DROPDOWN_MARGIN}px`);
|
|
2005
2026
|
}
|
|
2006
|
-
|
|
2027
|
+
t.appendChild(this.#S);
|
|
2007
2028
|
}
|
|
2008
|
-
#
|
|
2029
|
+
#oe() {
|
|
2030
|
+
let e = `--iti-anchor-${this.#t}`, t = getComputedStyle(this.telInputEl).anchorName;
|
|
2031
|
+
this.telInputEl.style.anchorName = t && t !== "none" ? `${t}, ${e}` : e, this.#S.style.positionAnchor = e;
|
|
2032
|
+
}
|
|
2033
|
+
#se() {
|
|
2009
2034
|
let e = window.visualViewport;
|
|
2010
2035
|
if (!e || !this.#S) return;
|
|
2011
2036
|
let t = window.innerHeight - e.height;
|
|
2012
2037
|
this.#S.style.bottom = `${t}px`;
|
|
2013
2038
|
}
|
|
2014
|
-
|
|
2039
|
+
isCountrySelectorOpen() {
|
|
2015
2040
|
return !this.#p.classList.contains(_.HIDE);
|
|
2016
2041
|
}
|
|
2017
2042
|
setLoading(e) {
|
|
@@ -2031,26 +2056,26 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2031
2056
|
setReadonly(e) {
|
|
2032
2057
|
this.telInputEl.readOnly = e, this.#l && (e ? this.#l.setAttribute("disabled", "true") : this.#l.removeAttribute("disabled"));
|
|
2033
2058
|
}
|
|
2034
|
-
|
|
2035
|
-
let {
|
|
2036
|
-
if (t && this.#
|
|
2059
|
+
setSelectedCountry(e) {
|
|
2060
|
+
let { countrySelectorMode: t, showFlags: n, separateDialCode: r, uiTranslations: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
2061
|
+
if (t !== F.OFF && this.#ne(s), this.#l) {
|
|
2037
2062
|
let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c = null;
|
|
2038
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c =
|
|
2063
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c = me())) : (r = i.noCountrySelected, t = i.noCountrySelected, c = me()), this.#u.className = e, this.#l.setAttribute("title", r), this.#l.setAttribute(L.LABEL, t), c ? this.#u.replaceChildren(c) : this.#u.replaceChildren();
|
|
2039
2064
|
}
|
|
2040
2065
|
if (r) {
|
|
2041
2066
|
let e = o ? `+${o}` : "";
|
|
2042
|
-
this.#d.textContent = e, this.#
|
|
2067
|
+
this.#d.textContent = e, this.#I();
|
|
2043
2068
|
}
|
|
2044
2069
|
}
|
|
2045
2070
|
destroy() {
|
|
2046
|
-
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[
|
|
2071
|
+
this.telInputEl.iti = void 0, delete this.telInputEl.dataset[I.INSTANCE_ID], this.#D?.disconnect(), this.telInputEl.style.paddingLeft = this.#r;
|
|
2047
2072
|
let e = this.telInputEl.parentNode;
|
|
2048
2073
|
e && (e.before(this.telInputEl), e.remove()), this.#T.clear();
|
|
2049
2074
|
}
|
|
2050
|
-
},
|
|
2075
|
+
}, xe = (e) => {
|
|
2051
2076
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
2052
2077
|
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
2053
|
-
},
|
|
2078
|
+
}, Se = (e, t) => {
|
|
2054
2079
|
let { countryNameLocale: n, countryNameOverrides: r } = t, i;
|
|
2055
2080
|
try {
|
|
2056
2081
|
i = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -2058,7 +2083,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2058
2083
|
console.error(e), i = null;
|
|
2059
2084
|
}
|
|
2060
2085
|
for (let t of e) t.name = r[t.iso2] || i?.of(t.iso2.toUpperCase()) || "";
|
|
2061
|
-
},
|
|
2086
|
+
}, Ce = (e) => {
|
|
2062
2087
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
2063
2088
|
if (!e || !t) return;
|
|
2064
2089
|
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
@@ -2087,7 +2112,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2087
2112
|
dialCodeMaxLength: n,
|
|
2088
2113
|
dialCodeToIso2Map: r
|
|
2089
2114
|
};
|
|
2090
|
-
},
|
|
2115
|
+
}, we = (e, t) => {
|
|
2091
2116
|
let { countryOrder: n } = t;
|
|
2092
2117
|
e.sort((e, t) => {
|
|
2093
2118
|
if (n) {
|
|
@@ -2096,7 +2121,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2096
2121
|
}
|
|
2097
2122
|
return e.name.localeCompare(t.name);
|
|
2098
2123
|
});
|
|
2099
|
-
},
|
|
2124
|
+
}, Te = /* @__PURE__ */ new Set([
|
|
2100
2125
|
"800",
|
|
2101
2126
|
"808",
|
|
2102
2127
|
"870",
|
|
@@ -2105,17 +2130,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2105
2130
|
"883",
|
|
2106
2131
|
"888",
|
|
2107
2132
|
"979"
|
|
2108
|
-
]),
|
|
2133
|
+
]), Ee = (e) => {
|
|
2109
2134
|
let t = W(e).slice(0, 3);
|
|
2110
|
-
return e.startsWith("+") &&
|
|
2111
|
-
},
|
|
2135
|
+
return e.startsWith("+") && Te.has(t);
|
|
2136
|
+
}, De = (e, t, n, r) => {
|
|
2112
2137
|
if (!n || !t) return e;
|
|
2113
2138
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
2114
2139
|
return e.substring(a);
|
|
2115
|
-
},
|
|
2140
|
+
}, Oe = (e, t, n, r, i) => {
|
|
2116
2141
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
2117
2142
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
2118
|
-
},
|
|
2143
|
+
}, ke = (e, t, n, r) => {
|
|
2119
2144
|
if (n === 0 && !r) return 0;
|
|
2120
2145
|
let i = 0;
|
|
2121
2146
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2123,7 +2148,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2123
2148
|
if (r && i === e + 1) return n;
|
|
2124
2149
|
}
|
|
2125
2150
|
return t.length;
|
|
2126
|
-
},
|
|
2151
|
+
}, Ae = /* @__PURE__ */ new Set([
|
|
2127
2152
|
"800",
|
|
2128
2153
|
"822",
|
|
2129
2154
|
"833",
|
|
@@ -2141,16 +2166,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2141
2166
|
"887",
|
|
2142
2167
|
"888",
|
|
2143
2168
|
"889"
|
|
2144
|
-
]),
|
|
2169
|
+
]), je = (e) => {
|
|
2145
2170
|
let t = W(e);
|
|
2146
2171
|
if (t.startsWith(C.NANP) && t.length >= 4) {
|
|
2147
2172
|
let e = t.substring(1, 4);
|
|
2148
|
-
return
|
|
2173
|
+
return Ae.has(e);
|
|
2149
2174
|
}
|
|
2150
2175
|
return !1;
|
|
2151
|
-
},
|
|
2176
|
+
}, Me = 0, X = (e) => {
|
|
2152
2177
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2153
|
-
},
|
|
2178
|
+
}, Ne = () => {
|
|
2154
2179
|
let e, t;
|
|
2155
2180
|
return {
|
|
2156
2181
|
promise: new Promise((n, r) => {
|
|
@@ -2182,13 +2207,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2182
2207
|
#_;
|
|
2183
2208
|
#v;
|
|
2184
2209
|
constructor(e, t = {}) {
|
|
2185
|
-
this.id =
|
|
2186
|
-
let n =
|
|
2210
|
+
this.id = Me++, be.validateInput(e);
|
|
2211
|
+
let n = se(t);
|
|
2187
2212
|
this.#t = {
|
|
2188
|
-
...
|
|
2213
|
+
...z,
|
|
2189
2214
|
...n
|
|
2190
|
-
},
|
|
2191
|
-
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } =
|
|
2215
|
+
}, ce(this.#t), le(this.#t), this.#e = new be(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new ve(e.value), this.promise = this.#x(this.#t), this.#r = xe(this.#t);
|
|
2216
|
+
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = Ce(this.#r);
|
|
2192
2217
|
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#S();
|
|
2193
2218
|
}
|
|
2194
2219
|
#y() {
|
|
@@ -2199,21 +2224,21 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2199
2224
|
this.#e.telInputEl.value = this.#m.denormalise(e);
|
|
2200
2225
|
}
|
|
2201
2226
|
#x(e) {
|
|
2202
|
-
let { initialCountry: t,
|
|
2203
|
-
return i && (this.#_ =
|
|
2227
|
+
let { initialCountry: t, initialCountryLookup: n, loadUtils: r } = e, i = !t && !!n, a = !!r && !Q.utils;
|
|
2228
|
+
return i && (this.#_ = Ne()), a && (this.#v = Ne()), Promise.all([this.#_?.promise, this.#v?.promise]).then(() => {});
|
|
2204
2229
|
}
|
|
2205
2230
|
#S() {
|
|
2206
|
-
this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this
|
|
2231
|
+
this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this.openCountrySelector();
|
|
2207
2232
|
}
|
|
2208
2233
|
#C() {
|
|
2209
|
-
|
|
2234
|
+
Se(this.#r, this.#t), we(this.#r, this.#t), this.#c = he(this.#r);
|
|
2210
2235
|
}
|
|
2211
2236
|
#w(e = !1) {
|
|
2212
|
-
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.#
|
|
2213
|
-
a ? o ? f ? this.#
|
|
2237
|
+
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 = je(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);
|
|
2238
|
+
a ? o ? f ? this.#X(u) : d || this.#X(T.ISO2) : (f && this.#X(u), this.#K(i)) : f ? this.#X(u) : d || this.#X(""), i && this.#G(i);
|
|
2214
2239
|
}
|
|
2215
2240
|
#T() {
|
|
2216
|
-
this.#A(), this.#t.
|
|
2241
|
+
this.#A(), this.#t.countrySelectorMode !== F.OFF && this.#e.bindAllInitialCountrySelectorListeners(this.#p.signal, () => this.openCountrySelector(), () => this.#ee()), this.#e.bindHiddenInputSubmitListener(this.#p.signal, () => this.getNumber(), () => this.#l?.iso2 || "");
|
|
2217
2242
|
}
|
|
2218
2243
|
#E() {
|
|
2219
2244
|
if (this.#v) {
|
|
@@ -2226,14 +2251,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2226
2251
|
}
|
|
2227
2252
|
async #D() {
|
|
2228
2253
|
if (Q.autoCountry) {
|
|
2229
|
-
this.#
|
|
2254
|
+
this.#se();
|
|
2230
2255
|
return;
|
|
2231
2256
|
}
|
|
2232
|
-
if (this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.
|
|
2257
|
+
if (this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.initialCountryLookup == "function")) {
|
|
2233
2258
|
let t;
|
|
2234
2259
|
try {
|
|
2235
|
-
let n = await Promise.race([this.#t.
|
|
2236
|
-
t = setTimeout(() => n(/* @__PURE__ */ Error("intl-tel-input:
|
|
2260
|
+
let n = await Promise.race([this.#t.initialCountryLookup(), new Promise((e, n) => {
|
|
2261
|
+
t = setTimeout(() => n(/* @__PURE__ */ Error("intl-tel-input: initialCountryLookup timed out after 10s")), 1e4);
|
|
2237
2262
|
})]), r = typeof n == "string" ? n.toLowerCase() : "";
|
|
2238
2263
|
if (!m(r)) {
|
|
2239
2264
|
Q.startedLoadingAutoCountry = !1, e.forEachInstance("handleAutoCountryFailure");
|
|
@@ -2248,7 +2273,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2248
2273
|
}
|
|
2249
2274
|
}
|
|
2250
2275
|
#O() {
|
|
2251
|
-
this
|
|
2276
|
+
this.openCountrySelector(), this.#e.prefillSearchWithPlus();
|
|
2252
2277
|
}
|
|
2253
2278
|
#k(e) {
|
|
2254
2279
|
let t = this.#e.telInputEl.selectionStart || 0, n = e.substring(0, t - 1), r = e.substring(t);
|
|
@@ -2269,12 +2294,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2269
2294
|
});
|
|
2270
2295
|
}
|
|
2271
2296
|
#N(e, t) {
|
|
2272
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i =
|
|
2297
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = Oe(this.#ie(), e, Q.utils, this.#l, this.#t.separateDialCode), a = ke(r, i, n, t);
|
|
2273
2298
|
this.#b(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2274
2299
|
}
|
|
2275
2300
|
#P(e) {
|
|
2276
|
-
if (e.startsWith("+") && this.#l && this.#
|
|
2277
|
-
let t =
|
|
2301
|
+
if (e.startsWith("+") && this.#l && this.#ne(e)) {
|
|
2302
|
+
let t = De(e, !0, !0, this.#l);
|
|
2278
2303
|
this.#b(t);
|
|
2279
2304
|
}
|
|
2280
2305
|
}
|
|
@@ -2282,10 +2307,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2282
2307
|
this.#h = b.ALPHA_UNICODE.test(this.#y()), this.#e.telInputEl.addEventListener("input", this.#I, { signal: this.#p.signal });
|
|
2283
2308
|
}
|
|
2284
2309
|
#I = (e) => {
|
|
2285
|
-
let { strictMode: t, formatAsYouType: n, separateDialCode: r,
|
|
2310
|
+
let { strictMode: t, formatAsYouType: n, separateDialCode: r, countrySelectorMode: i, countrySearch: a } = this.#t, o = e?.detail;
|
|
2286
2311
|
if (o?.isCountryChange) return;
|
|
2287
2312
|
let s = this.#y(), c = e?.inputType === y.PASTE, l = t && c;
|
|
2288
|
-
if (this.#n && !c && e?.data === "+" && r && i && a) {
|
|
2313
|
+
if (this.#n && !c && e?.data === "+" && r && i !== F.OFF && a) {
|
|
2289
2314
|
this.#j(s);
|
|
2290
2315
|
return;
|
|
2291
2316
|
}
|
|
@@ -2297,23 +2322,23 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2297
2322
|
if (this.#V()) return;
|
|
2298
2323
|
s = this.#y();
|
|
2299
2324
|
}
|
|
2300
|
-
this.#
|
|
2325
|
+
this.#K(s) && this.#oe(), !l && e?.data && b.NON_PLUS_NUMERIC.test(e.data) || c && s && !t ? this.#h = !0 : b.NON_PLUS_NUMERIC.test(s) || (this.#h = !1), n && !this.#h && !o?.isSetNumber && this.#m.isAscii() && this.#N(s, e?.inputType === y.DELETE_FORWARD), r && this.#P(s);
|
|
2301
2326
|
};
|
|
2302
2327
|
#L() {
|
|
2303
2328
|
let { strictMode: e, separateDialCode: t } = this.#t;
|
|
2304
2329
|
!e && !t || this.#e.telInputEl.addEventListener("keydown", this.#R, { signal: this.#p.signal });
|
|
2305
2330
|
}
|
|
2306
2331
|
#R = (e) => {
|
|
2307
|
-
let { strictMode: t, separateDialCode: n,
|
|
2332
|
+
let { strictMode: t, separateDialCode: n, countrySelectorMode: r, countrySearch: i } = this.#t;
|
|
2308
2333
|
if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
2309
|
-
if (n && r && i && e.key === "+") {
|
|
2334
|
+
if (n && r !== F.OFF && i && e.key === "+") {
|
|
2310
2335
|
e.preventDefault(), this.#O();
|
|
2311
2336
|
return;
|
|
2312
2337
|
}
|
|
2313
2338
|
if (!t) return;
|
|
2314
|
-
let a = this.#y(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#
|
|
2339
|
+
let a = this.#y(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#re(h), v = !1;
|
|
2315
2340
|
Q.utils && this.#u && (v = Q.utils.getCoreNumber(_, this.#l?.iso2).length > this.#u);
|
|
2316
|
-
let y = this.#
|
|
2341
|
+
let y = this.#J(_) !== null;
|
|
2317
2342
|
(!l || v && !y && !o) && (this.#e.playStrictRejectAnimation(), this.#W(g.STRICT_REJECT, {
|
|
2318
2343
|
source: "key",
|
|
2319
2344
|
rejectedInput: e.key,
|
|
@@ -2381,42 +2406,42 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2381
2406
|
});
|
|
2382
2407
|
this.#e.telInputEl.dispatchEvent(n);
|
|
2383
2408
|
}
|
|
2384
|
-
|
|
2385
|
-
this.#e.
|
|
2409
|
+
openCountrySelector() {
|
|
2410
|
+
this.#e.isCountrySelectorOpen() || (this.#e.openCountrySelector((e) => this.#$(e), () => this.#ee()), this.#W(g.OPEN_COUNTRY_SELECTOR));
|
|
2386
2411
|
}
|
|
2387
|
-
#
|
|
2388
|
-
let {
|
|
2389
|
-
if (
|
|
2390
|
-
let
|
|
2391
|
-
i = Q.utils.formatNumber(
|
|
2412
|
+
#G(e) {
|
|
2413
|
+
let { numberDisplayFormat: t, separateDialCode: n } = this.#t, r = e;
|
|
2414
|
+
if (Q.utils && this.#l) {
|
|
2415
|
+
let i = Ee(e), a = !r.startsWith("+") && !n, o = t === M.NATIONAL && !i || a, s;
|
|
2416
|
+
s = o ? M.NATIONAL : t === M.E164 && !i ? M.E164 : M.INTERNATIONAL, r = Q.utils.formatNumber(r, this.#l?.iso2, s);
|
|
2392
2417
|
}
|
|
2393
|
-
|
|
2418
|
+
r = this.#ae(r), this.#b(r);
|
|
2394
2419
|
}
|
|
2395
|
-
#
|
|
2396
|
-
let t = this.#
|
|
2397
|
-
return t === null ? !1 : this.#
|
|
2420
|
+
#K(e) {
|
|
2421
|
+
let t = this.#J(e);
|
|
2422
|
+
return t === null ? !1 : this.#X(t);
|
|
2398
2423
|
}
|
|
2399
|
-
#
|
|
2424
|
+
#q(e) {
|
|
2400
2425
|
let t = this.#l?.dialCode, n = this.#l?.nationalPrefix;
|
|
2401
2426
|
return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
|
|
2402
2427
|
}
|
|
2403
|
-
#
|
|
2428
|
+
#J(e) {
|
|
2404
2429
|
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#l?.iso2;
|
|
2405
|
-
n = this.#
|
|
2406
|
-
let i = this.#
|
|
2430
|
+
n = this.#q(n);
|
|
2431
|
+
let i = this.#ne(n, !0), a = W(n);
|
|
2407
2432
|
if (i) {
|
|
2408
2433
|
let e = W(i), t = this.#a[e];
|
|
2409
|
-
return t.length === 1 ? t[0] === r ? null : t[0] : this.#
|
|
2434
|
+
return t.length === 1 ? t[0] === r ? null : t[0] : this.#Y(t, e, a);
|
|
2410
2435
|
} else if (n.startsWith("+") && a.length) {
|
|
2411
2436
|
let e = this.#l?.dialCode || "";
|
|
2412
2437
|
return e && e.startsWith(a) ? null : "";
|
|
2413
2438
|
} else if ((!n || n === "+") && !r && this.#d) return this.#d;
|
|
2414
2439
|
return null;
|
|
2415
2440
|
}
|
|
2416
|
-
#
|
|
2441
|
+
#Y(e, t, n) {
|
|
2417
2442
|
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2418
2443
|
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2419
|
-
if (i === C.NANP &&
|
|
2444
|
+
if (i === C.NANP && je(n)) return null;
|
|
2420
2445
|
let a = this.#l?.areaCodes, o = this.#l?.priority;
|
|
2421
2446
|
if (a) {
|
|
2422
2447
|
let e = a.map((e) => `${i}${e}`);
|
|
@@ -2425,11 +2450,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2425
2450
|
let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
|
|
2426
2451
|
return !c && !l ? e[0] : null;
|
|
2427
2452
|
}
|
|
2428
|
-
#
|
|
2453
|
+
#X(e) {
|
|
2429
2454
|
let t = this.#l?.iso2 || "";
|
|
2430
|
-
return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.
|
|
2455
|
+
return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setSelectedCountry(this.#l), this.#Q(), this.#Z(), t !== e;
|
|
2431
2456
|
}
|
|
2432
|
-
#
|
|
2457
|
+
#Z() {
|
|
2433
2458
|
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
|
|
2434
2459
|
if (!e || !Q.utils) return;
|
|
2435
2460
|
let r = this.#l?.iso2;
|
|
@@ -2437,38 +2462,39 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2437
2462
|
this.#u = null;
|
|
2438
2463
|
return;
|
|
2439
2464
|
}
|
|
2440
|
-
let i = Q.utils.getExampleNumber(r,
|
|
2441
|
-
for (; Q.utils.
|
|
2465
|
+
let i = Q.utils.getExampleNumber(r, t, M.E164), a = i;
|
|
2466
|
+
for (; Q.utils.isValidNumber(i, r, n);) a = i, i += "0";
|
|
2442
2467
|
let o = Q.utils.getCoreNumber(a, r);
|
|
2443
2468
|
this.#u = o.length, r === "by" && (this.#u = o.length + 1);
|
|
2444
2469
|
}
|
|
2445
|
-
|
|
2446
|
-
let {
|
|
2470
|
+
#Q() {
|
|
2471
|
+
let { placeholderNumberPolicy: e, placeholderNumberType: t, numberDisplayFormat: n, customPlaceholder: r } = this.#t, i = e === E.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === E.POLITE;
|
|
2447
2472
|
if (!Q.utils || !i) return;
|
|
2448
|
-
let a = this.#l ? Q.utils.getExampleNumber(this.#l.iso2,
|
|
2449
|
-
a = this.#
|
|
2473
|
+
let a = this.#l ? Q.utils.getExampleNumber(this.#l.iso2, t, n) : "";
|
|
2474
|
+
a = this.#ae(a), typeof r == "function" && (a = r(a, this.#l)), this.#e.telInputEl.setAttribute("placeholder", a);
|
|
2450
2475
|
}
|
|
2451
|
-
|
|
2476
|
+
#$(e) {
|
|
2452
2477
|
if (!e) return;
|
|
2453
|
-
let t = e.dataset[
|
|
2454
|
-
this.#
|
|
2455
|
-
let r = e.dataset[
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
}
|
|
2460
|
-
this.#e.telInputEl.focus(), n && (this.#se(), this.#W(g.INPUT, { isCountryChange: !0 }));
|
|
2478
|
+
let t = e.dataset[I.ISO2], n = this.#X(t);
|
|
2479
|
+
this.#ee();
|
|
2480
|
+
let r = e.dataset[I.DIAL_CODE];
|
|
2481
|
+
this.#te(r);
|
|
2482
|
+
let i = this.#y();
|
|
2483
|
+
this.#G(i), this.#e.telInputEl.focus(), n && (this.#oe(), this.#W(g.INPUT, { isCountryChange: !0 }));
|
|
2461
2484
|
}
|
|
2462
|
-
|
|
2463
|
-
|
|
2485
|
+
closeCountrySelector() {
|
|
2486
|
+
this.#ee();
|
|
2464
2487
|
}
|
|
2465
|
-
#
|
|
2488
|
+
#ee(e) {
|
|
2489
|
+
!this.#e.isCountrySelectorOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeCountrySelector(), this.#W(g.CLOSE_COUNTRY_SELECTOR));
|
|
2490
|
+
}
|
|
2491
|
+
#te(e) {
|
|
2466
2492
|
let t = this.#y();
|
|
2467
2493
|
if (!t.startsWith("+")) return;
|
|
2468
|
-
let n = `+${e}`, r = this.#
|
|
2494
|
+
let n = `+${e}`, r = this.#ne(t), i;
|
|
2469
2495
|
i = r ? t.replace(r, n) : n, this.#b(i);
|
|
2470
2496
|
}
|
|
2471
|
-
#
|
|
2497
|
+
#ne(e, t) {
|
|
2472
2498
|
if (!e.startsWith("+")) return "";
|
|
2473
2499
|
let n = "", r = "", i = !1;
|
|
2474
2500
|
for (let a = 0; a < e.length; a++) {
|
|
@@ -2483,38 +2509,38 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2483
2509
|
}
|
|
2484
2510
|
return n;
|
|
2485
2511
|
}
|
|
2486
|
-
#
|
|
2512
|
+
#re(e) {
|
|
2487
2513
|
let t = this.#l?.dialCode, n = W(e);
|
|
2488
2514
|
return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
|
|
2489
2515
|
}
|
|
2490
|
-
#
|
|
2516
|
+
#ie() {
|
|
2491
2517
|
let e = this.#y();
|
|
2492
|
-
return this.#
|
|
2518
|
+
return this.#re(e);
|
|
2493
2519
|
}
|
|
2494
|
-
#
|
|
2495
|
-
let t =
|
|
2520
|
+
#ae(e) {
|
|
2521
|
+
let t = De(e, !!this.#ne(e), this.#t.separateDialCode, this.#l);
|
|
2496
2522
|
return this.#U(t);
|
|
2497
2523
|
}
|
|
2498
|
-
#
|
|
2524
|
+
#oe() {
|
|
2499
2525
|
this.#W(g.COUNTRY_CHANGE, this.#l ?? null);
|
|
2500
2526
|
}
|
|
2501
|
-
#
|
|
2502
|
-
if (!
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
}
|
|
2507
|
-
this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#_.resolve();
|
|
2527
|
+
#se() {
|
|
2528
|
+
if (!this.#_ || !Q.autoCountry) return;
|
|
2529
|
+
if (!this.#f) {
|
|
2530
|
+
this.#_.resolve();
|
|
2531
|
+
return;
|
|
2508
2532
|
}
|
|
2533
|
+
let e = document.activeElement === this.#e.telInputEl, t = !!this.#y();
|
|
2534
|
+
this.#e.isLoading() && !(e && t) ? this.setSelectedCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#_.resolve();
|
|
2509
2535
|
}
|
|
2510
|
-
#
|
|
2536
|
+
#ce() {
|
|
2511
2537
|
if (!this.#f) {
|
|
2512
2538
|
this.#_?.reject();
|
|
2513
2539
|
return;
|
|
2514
2540
|
}
|
|
2515
2541
|
this.#w(!0), this.#e.setLoading(!1), this.#_?.reject();
|
|
2516
2542
|
}
|
|
2517
|
-
#
|
|
2543
|
+
#le() {
|
|
2518
2544
|
if (!this.#f) {
|
|
2519
2545
|
this.#v?.resolve();
|
|
2520
2546
|
return;
|
|
@@ -2523,10 +2549,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2523
2549
|
this.#v?.resolve();
|
|
2524
2550
|
return;
|
|
2525
2551
|
}
|
|
2526
|
-
let e = this.#y();
|
|
2527
|
-
e && this.#
|
|
2552
|
+
let e = this.#y(), t = document.activeElement === this.#e.telInputEl;
|
|
2553
|
+
e && !t && this.#G(e), this.#l && (this.#Q(), this.#Z()), this.#v?.resolve();
|
|
2528
2554
|
}
|
|
2529
|
-
#
|
|
2555
|
+
#ue(e) {
|
|
2530
2556
|
if (!this.#f) {
|
|
2531
2557
|
this.#v?.reject(e);
|
|
2532
2558
|
return;
|
|
@@ -2534,36 +2560,36 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2534
2560
|
this.#v?.reject(e);
|
|
2535
2561
|
}
|
|
2536
2562
|
destroy() {
|
|
2537
|
-
this.#f && (this.#f = !1, this.#t.
|
|
2563
|
+
this.#f && (this.#f = !1, this.#t.countrySelectorMode !== F.OFF && this.#ee(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
|
|
2538
2564
|
}
|
|
2539
2565
|
isActive() {
|
|
2540
2566
|
return this.#f;
|
|
2541
2567
|
}
|
|
2542
2568
|
getExtension() {
|
|
2543
|
-
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#
|
|
2569
|
+
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#ie(), this.#l?.iso2)) : "";
|
|
2544
2570
|
}
|
|
2545
2571
|
getNumber(e) {
|
|
2546
2572
|
if (!this.#f) return "";
|
|
2547
2573
|
X("getNumber");
|
|
2548
|
-
let t = this.#l?.iso2, n = this.#
|
|
2574
|
+
let t = this.#l?.iso2, n = this.#ie(), r = Q.utils.formatNumber(n, t, e);
|
|
2549
2575
|
return this.#m.denormalise(r);
|
|
2550
2576
|
}
|
|
2551
2577
|
getNumberType() {
|
|
2552
|
-
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#
|
|
2578
|
+
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#ie(), this.#l?.iso2)) : null;
|
|
2553
2579
|
}
|
|
2554
|
-
|
|
2580
|
+
getSelectedCountry() {
|
|
2555
2581
|
return this.#l ?? null;
|
|
2556
2582
|
}
|
|
2557
2583
|
getValidationError() {
|
|
2558
2584
|
if (!this.#f) return null;
|
|
2559
2585
|
X("getValidationError");
|
|
2560
2586
|
let e = this.#l?.iso2;
|
|
2561
|
-
return Q.utils.getValidationError(this.#
|
|
2587
|
+
return Q.utils.getValidationError(this.#ie(), e);
|
|
2562
2588
|
}
|
|
2563
2589
|
isValidNumber() {
|
|
2564
2590
|
if (!this.#f) return null;
|
|
2565
2591
|
X("isValidNumber");
|
|
2566
|
-
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#
|
|
2592
|
+
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#ie(), r = Q.utils.getCoreNumber(n, t);
|
|
2567
2593
|
if (r) {
|
|
2568
2594
|
if (e === w.DIAL_CODE && r[0] === w.MOBILE_PREFIX && r.length !== w.MOBILE_CORE_LENGTH) return !1;
|
|
2569
2595
|
if (!b.ALPHA_UNICODE.test(n) && e) {
|
|
@@ -2571,35 +2597,32 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2571
2597
|
if (r.length > t) return !1;
|
|
2572
2598
|
}
|
|
2573
2599
|
}
|
|
2574
|
-
return this.#
|
|
2600
|
+
return this.#de("possible");
|
|
2575
2601
|
}
|
|
2576
2602
|
isValidNumberPrecise() {
|
|
2577
|
-
return this.#f ? (X("isValidNumberPrecise"), this.#
|
|
2603
|
+
return this.#f ? (X("isValidNumberPrecise"), this.#de("precise")) : null;
|
|
2578
2604
|
}
|
|
2579
|
-
#
|
|
2580
|
-
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#
|
|
2581
|
-
return !this.#l && !
|
|
2605
|
+
#de(e) {
|
|
2606
|
+
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#ie();
|
|
2607
|
+
return !this.#l && !Ee(a) || !(e === "precise" ? Q.utils.isValidNumberPrecise : Q.utils.isValidNumber)(a, i, r) ? !1 : b.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
|
|
2582
2608
|
}
|
|
2583
|
-
|
|
2609
|
+
setSelectedCountry(e) {
|
|
2584
2610
|
if (!this.#f) return;
|
|
2585
2611
|
let t = e?.toLowerCase();
|
|
2586
2612
|
if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
|
|
2587
2613
|
let n = this.#l?.iso2;
|
|
2588
|
-
if (e && t !== n || !e && n)
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
}
|
|
2593
|
-
this.#se(), this.#W(g.INPUT, { isCountryChange: !0 });
|
|
2594
|
-
}
|
|
2614
|
+
if (!(e && t !== n || !e && n)) return;
|
|
2615
|
+
this.#X(t), this.#te(this.#l?.dialCode || "");
|
|
2616
|
+
let r = this.#y();
|
|
2617
|
+
this.#G(r), this.#oe(), this.#W(g.INPUT, { isCountryChange: !0 });
|
|
2595
2618
|
}
|
|
2596
2619
|
setNumber(e) {
|
|
2597
2620
|
if (!this.#f) return;
|
|
2598
|
-
let t = this.#m.normalise(e), n = this.#
|
|
2599
|
-
this.#
|
|
2621
|
+
let t = this.#m.normalise(e), n = this.#K(t);
|
|
2622
|
+
this.#G(t), n && this.#oe(), this.#W(g.INPUT, { isSetNumber: !0 });
|
|
2600
2623
|
}
|
|
2601
2624
|
setPlaceholderNumberType(e) {
|
|
2602
|
-
this.#f && (this.#t.placeholderNumberType = e, this
|
|
2625
|
+
this.#f && (this.#t.placeholderNumberType = e, this.#Q());
|
|
2603
2626
|
}
|
|
2604
2627
|
setDisabled(e) {
|
|
2605
2628
|
this.#f && this.#e.setDisabled(e);
|
|
@@ -2612,16 +2635,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2612
2635
|
r.forEach((n) => {
|
|
2613
2636
|
if (n instanceof e) switch (t) {
|
|
2614
2637
|
case "handleUtilsLoaded":
|
|
2615
|
-
n.#
|
|
2638
|
+
n.#le();
|
|
2616
2639
|
break;
|
|
2617
2640
|
case "handleUtilsFailure":
|
|
2618
|
-
n.#
|
|
2641
|
+
n.#ue(i);
|
|
2619
2642
|
break;
|
|
2620
2643
|
case "handleAutoCountryLoaded":
|
|
2621
|
-
n.#
|
|
2644
|
+
n.#se();
|
|
2622
2645
|
break;
|
|
2623
2646
|
case "handleAutoCountryFailure":
|
|
2624
|
-
n.#
|
|
2647
|
+
n.#ce();
|
|
2625
2648
|
break;
|
|
2626
2649
|
}
|
|
2627
2650
|
});
|
|
@@ -2630,11 +2653,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2630
2653
|
let n = new Z(e, t);
|
|
2631
2654
|
return Q.instances.set(String(n.id), n), e.iti = n, n;
|
|
2632
2655
|
}, {
|
|
2633
|
-
defaults:
|
|
2656
|
+
defaults: z,
|
|
2634
2657
|
documentReady: () => document.readyState === "complete",
|
|
2635
|
-
|
|
2658
|
+
getAllCountries: () => h,
|
|
2636
2659
|
getInstance: (e) => {
|
|
2637
|
-
let t = e.dataset[
|
|
2660
|
+
let t = e.dataset[I.INSTANCE_ID];
|
|
2638
2661
|
return t ? Q.instances.get(t) ?? null : null;
|
|
2639
2662
|
},
|
|
2640
2663
|
instances: /* @__PURE__ */ new Map(),
|
|
@@ -2652,11 +2675,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2652
2675
|
},
|
|
2653
2676
|
startedLoadingUtils: !1,
|
|
2654
2677
|
startedLoadingAutoCountry: !1,
|
|
2655
|
-
version: "
|
|
2678
|
+
version: "29.0.1",
|
|
2656
2679
|
NUMBER_FORMAT: M,
|
|
2657
2680
|
NUMBER_TYPE: N,
|
|
2658
|
-
VALIDATION_ERROR: P
|
|
2659
|
-
|
|
2681
|
+
VALIDATION_ERROR: P,
|
|
2682
|
+
PLACEHOLDER_POLICY: E,
|
|
2683
|
+
COUNTRY_SELECTOR_MODE: F
|
|
2684
|
+
}), $ = Q, Pe = /* @__PURE__ */ n({
|
|
2660
2685
|
inheritAttrs: !1,
|
|
2661
2686
|
__name: "IntlTelInput",
|
|
2662
2687
|
props: {
|
|
@@ -2675,11 +2700,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2675
2700
|
inputProps: { default: () => ({}) },
|
|
2676
2701
|
initialValue: {},
|
|
2677
2702
|
modelValue: {},
|
|
2678
|
-
|
|
2703
|
+
countrySelectorMode: {},
|
|
2679
2704
|
allowedNumberTypes: {},
|
|
2680
2705
|
allowNumberExtensions: { type: Boolean },
|
|
2681
2706
|
allowPhonewords: { type: Boolean },
|
|
2682
|
-
autoPlaceholder: {},
|
|
2683
2707
|
containerClass: {},
|
|
2684
2708
|
countryNameLocale: {},
|
|
2685
2709
|
countryNameOverrides: {},
|
|
@@ -2687,33 +2711,32 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2687
2711
|
countrySearch: { type: Boolean },
|
|
2688
2712
|
customPlaceholder: {},
|
|
2689
2713
|
dropdownAlwaysOpen: { type: Boolean },
|
|
2690
|
-
|
|
2714
|
+
dropdownParent: {},
|
|
2691
2715
|
excludeCountries: {},
|
|
2692
|
-
|
|
2716
|
+
matchDropdownWidth: { type: Boolean },
|
|
2693
2717
|
formatAsYouType: { type: Boolean },
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
hiddenInput: {},
|
|
2697
|
-
i18n: {},
|
|
2718
|
+
hiddenInputs: {},
|
|
2719
|
+
uiTranslations: {},
|
|
2698
2720
|
initialCountry: {},
|
|
2721
|
+
initialCountryLookup: {},
|
|
2699
2722
|
loadUtils: {},
|
|
2700
|
-
|
|
2723
|
+
numberDisplayFormat: {},
|
|
2701
2724
|
onlyCountries: {},
|
|
2725
|
+
placeholderNumberPolicy: {},
|
|
2702
2726
|
placeholderNumberType: {},
|
|
2703
2727
|
searchInputClass: {},
|
|
2704
2728
|
separateDialCode: { type: Boolean },
|
|
2705
2729
|
strictRejectAnimation: { type: Boolean },
|
|
2706
2730
|
showFlags: { type: Boolean },
|
|
2707
|
-
strictMode: { type: Boolean }
|
|
2708
|
-
useFullscreenPopup: { type: Boolean }
|
|
2731
|
+
strictMode: { type: Boolean }
|
|
2709
2732
|
},
|
|
2710
2733
|
emits: [
|
|
2711
2734
|
"changeNumber",
|
|
2712
2735
|
"changeCountry",
|
|
2713
2736
|
"changeValidity",
|
|
2714
2737
|
"changeErrorCode",
|
|
2715
|
-
"
|
|
2716
|
-
"
|
|
2738
|
+
"openCountrySelector",
|
|
2739
|
+
"closeCountrySelector",
|
|
2717
2740
|
"strictReject",
|
|
2718
2741
|
"update:modelValue"
|
|
2719
2742
|
],
|
|
@@ -2756,14 +2779,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2756
2779
|
e !== T.value && (T.value = e, m("changeNumber", e), m("update:modelValue", e)), j();
|
|
2757
2780
|
}, N = () => {
|
|
2758
2781
|
if (!w.value?.isActive()) return;
|
|
2759
|
-
let e = w.value.
|
|
2782
|
+
let e = w.value.getSelectedCountry()?.iso2 ?? "";
|
|
2760
2783
|
e !== E.value && (E.value = e, m("changeCountry", e)), M();
|
|
2761
|
-
}, P = () => m("
|
|
2784
|
+
}, P = () => m("openCountrySelector"), F = () => m("closeCountrySelector"), I = (e) => {
|
|
2762
2785
|
let { source: t, rejectedInput: n, reason: r } = e.detail;
|
|
2763
2786
|
m("strictReject", t, n, r);
|
|
2764
2787
|
};
|
|
2765
2788
|
return a(() => {
|
|
2766
|
-
C.value && (w.value = $(C.value, S.value), _.value = C.value.className, C.value.addEventListener("open:
|
|
2789
|
+
C.value && (w.value = $(C.value, S.value), _.value = C.value.className, 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(() => {
|
|
2767
2790
|
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()));
|
|
2768
2791
|
}));
|
|
2769
2792
|
}), u(() => p.disabled, (e) => w.value?.setDisabled(e)), u(() => p.readonly, (e) => w.value?.setReadonly(e)), u(() => y.value, (e) => {
|
|
@@ -2773,7 +2796,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2773
2796
|
document.activeElement === C.value || n === t || (w.value.setNumber(t), j());
|
|
2774
2797
|
});
|
|
2775
2798
|
}, { flush: "post" }), o(() => {
|
|
2776
|
-
C.value && (C.value.removeEventListener("open:
|
|
2799
|
+
C.value && (C.value.removeEventListener("open:countryselector", P), C.value.removeEventListener("close:countryselector", F), C.value.removeEventListener("strict:reject", I)), w.value?.destroy();
|
|
2777
2800
|
}), d({
|
|
2778
2801
|
instance: w,
|
|
2779
2802
|
input: C
|
|
@@ -2786,4 +2809,4 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2786
2809
|
}
|
|
2787
2810
|
});
|
|
2788
2811
|
//#endregion
|
|
2789
|
-
export { $ as n,
|
|
2812
|
+
export { $ as n, Pe as t };
|