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