intl-tel-input 24.8.2 → 25.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.
- package/README.md +56 -47
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +6 -8
- package/build/js/intlTelInput.js +17 -33
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +281 -292
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +51 -52
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +16 -32
- package/react/build/IntlTelInput.d.ts +6 -8
- package/react/build/IntlTelInput.js +16 -32
- package/react/build/IntlTelInputWithUtils.cjs +280 -291
- package/react/build/IntlTelInputWithUtils.js +280 -291
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +19 -27
- package/vue/build/IntlTelInputWithUtils.mjs +603 -612
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as i2, useModel as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as i2, useModel as A2, ref as I1, onMounted as E2, watch as D2, onUnmounted as M2, withDirectives as P2, openBlock as x2, createElementBlock as R2, mergeProps as B2, vModelText as k2 } from "vue";
|
|
2
|
+
const r2 = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1306,19 +1306,19 @@ const n2 = [
|
|
|
1306
1306
|
"263"
|
|
1307
1307
|
]
|
|
1308
1308
|
], H = [];
|
|
1309
|
-
for (let y = 0; y <
|
|
1310
|
-
const
|
|
1309
|
+
for (let y = 0; y < r2.length; y++) {
|
|
1310
|
+
const $ = r2[y];
|
|
1311
1311
|
H[y] = {
|
|
1312
1312
|
name: "",
|
|
1313
1313
|
// this is now populated in the plugin
|
|
1314
|
-
iso2:
|
|
1315
|
-
dialCode:
|
|
1316
|
-
priority:
|
|
1317
|
-
areaCodes:
|
|
1314
|
+
iso2: $[0],
|
|
1315
|
+
dialCode: $[1],
|
|
1316
|
+
priority: $[2] || 0,
|
|
1317
|
+
areaCodes: $[3] || null,
|
|
1318
1318
|
nodeById: {}
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
|
-
const
|
|
1321
|
+
const O2 = {
|
|
1322
1322
|
ad: "Andorra",
|
|
1323
1323
|
ae: "United Arab Emirates",
|
|
1324
1324
|
af: "Afghanistan",
|
|
@@ -1561,7 +1561,7 @@ const B2 = {
|
|
|
1561
1561
|
za: "South Africa",
|
|
1562
1562
|
zm: "Zambia",
|
|
1563
1563
|
zw: "Zimbabwe"
|
|
1564
|
-
},
|
|
1564
|
+
}, G2 = {
|
|
1565
1565
|
selectedCountryAriaLabel: "Selected country",
|
|
1566
1566
|
noCountrySelected: "No country selected",
|
|
1567
1567
|
countryListAriaLabel: "List of countries",
|
|
@@ -1572,11 +1572,11 @@ const B2 = {
|
|
|
1572
1572
|
// additional countries (not supported by country-list library)
|
|
1573
1573
|
ac: "Ascension Island",
|
|
1574
1574
|
xk: "Kosovo"
|
|
1575
|
-
},
|
|
1575
|
+
}, u2 = { ...O2, ...G2 };
|
|
1576
1576
|
for (let y = 0; y < H.length; y++)
|
|
1577
|
-
H[y].name =
|
|
1578
|
-
let
|
|
1579
|
-
const
|
|
1577
|
+
H[y].name = u2[H[y].iso2];
|
|
1578
|
+
let F2 = 0;
|
|
1579
|
+
const l2 = {
|
|
1580
1580
|
//* Whether or not to allow the dropdown.
|
|
1581
1581
|
allowDropdown: !0,
|
|
1582
1582
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
@@ -1607,8 +1607,8 @@ const u2 = {
|
|
|
1607
1607
|
i18n: {},
|
|
1608
1608
|
//* Initial country.
|
|
1609
1609
|
initialCountry: "",
|
|
1610
|
-
//*
|
|
1611
|
-
|
|
1610
|
+
//* A function to load the utils script.
|
|
1611
|
+
loadUtils: null,
|
|
1612
1612
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1613
1613
|
nationalMode: !0,
|
|
1614
1614
|
//* Display only these countries.
|
|
@@ -1629,11 +1629,9 @@ const u2 = {
|
|
|
1629
1629
|
navigator.userAgent
|
|
1630
1630
|
) || window.innerWidth <= 500
|
|
1631
1631
|
) : !1,
|
|
1632
|
-
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1633
|
-
utilsScript: "",
|
|
1634
1632
|
//* The number type to enforce during validation.
|
|
1635
|
-
|
|
1636
|
-
},
|
|
1633
|
+
validationNumberTypes: ["MOBILE"]
|
|
1634
|
+
}, U2 = [
|
|
1637
1635
|
"800",
|
|
1638
1636
|
"822",
|
|
1639
1637
|
"833",
|
|
@@ -1651,46 +1649,46 @@ const u2 = {
|
|
|
1651
1649
|
"887",
|
|
1652
1650
|
"888",
|
|
1653
1651
|
"889"
|
|
1654
|
-
],
|
|
1655
|
-
const
|
|
1656
|
-
if (
|
|
1657
|
-
const
|
|
1658
|
-
return
|
|
1652
|
+
], c1 = (y) => y.replace(/\D/g, ""), s2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), o2 = (y) => {
|
|
1653
|
+
const $ = c1(y);
|
|
1654
|
+
if ($.charAt(0) === "1") {
|
|
1655
|
+
const n = $.substr(1, 3);
|
|
1656
|
+
return U2.indexOf(n) !== -1;
|
|
1659
1657
|
}
|
|
1660
1658
|
return !1;
|
|
1661
|
-
},
|
|
1662
|
-
if (
|
|
1659
|
+
}, V2 = (y, $, n, i) => {
|
|
1660
|
+
if (n === 0 && !i)
|
|
1663
1661
|
return 0;
|
|
1664
1662
|
let o = 0;
|
|
1665
|
-
for (let a = 0; a <
|
|
1666
|
-
if (/[+0-9]/.test(
|
|
1663
|
+
for (let a = 0; a < $.length; a++) {
|
|
1664
|
+
if (/[+0-9]/.test($[a]) && o++, o === y && !i)
|
|
1667
1665
|
return a + 1;
|
|
1668
|
-
if (
|
|
1666
|
+
if (i && o === y + 1)
|
|
1669
1667
|
return a;
|
|
1670
1668
|
}
|
|
1671
|
-
return
|
|
1672
|
-
}, A = (y,
|
|
1673
|
-
const
|
|
1674
|
-
return
|
|
1675
|
-
},
|
|
1676
|
-
const { instances:
|
|
1677
|
-
Object.values(
|
|
1669
|
+
return $.length;
|
|
1670
|
+
}, A = (y, $, n) => {
|
|
1671
|
+
const i = document.createElement(y);
|
|
1672
|
+
return $ && Object.entries($).forEach(([o, a]) => i.setAttribute(o, a)), n && n.appendChild(i), i;
|
|
1673
|
+
}, e1 = (y, ...$) => {
|
|
1674
|
+
const { instances: n } = C;
|
|
1675
|
+
Object.values(n).forEach((i) => i[y](...$));
|
|
1678
1676
|
};
|
|
1679
|
-
class
|
|
1680
|
-
constructor(
|
|
1681
|
-
this.id =
|
|
1677
|
+
class K2 {
|
|
1678
|
+
constructor($, n = {}) {
|
|
1679
|
+
this.id = F2++, this.telInput = $, this.highlightedItem = null, this.options = Object.assign({}, l2, n), this.hadInitialPlaceholder = !!$.getAttribute("placeholder");
|
|
1682
1680
|
}
|
|
1683
1681
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1684
1682
|
_init() {
|
|
1685
1683
|
this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1686
|
-
const
|
|
1687
|
-
this.showSelectedCountryOnLeft = this.isRTL ?
|
|
1688
|
-
const
|
|
1684
|
+
const $ = this.options.allowDropdown || this.options.separateDialCode;
|
|
1685
|
+
this.showSelectedCountryOnLeft = this.isRTL ? !$ : $, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...u2, ...this.options.i18n };
|
|
1686
|
+
const n = new Promise((o, a) => {
|
|
1689
1687
|
this.resolveAutoCountryPromise = o, this.rejectAutoCountryPromise = a;
|
|
1690
|
-
}),
|
|
1688
|
+
}), i = new Promise((o, a) => {
|
|
1691
1689
|
this.resolveUtilsScriptPromise = o, this.rejectUtilsScriptPromise = a;
|
|
1692
1690
|
});
|
|
1693
|
-
this.promise = Promise.all([
|
|
1691
|
+
this.promise = Promise.all([n, i]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1694
1692
|
}
|
|
1695
1693
|
//********************
|
|
1696
1694
|
//* PRIVATE METHODS
|
|
@@ -1701,70 +1699,70 @@ class F2 {
|
|
|
1701
1699
|
}
|
|
1702
1700
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1703
1701
|
_sortCountries() {
|
|
1704
|
-
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((
|
|
1705
|
-
const { countryOrder:
|
|
1706
|
-
if (
|
|
1707
|
-
const o =
|
|
1702
|
+
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map(($) => $.toLowerCase())), this.countries.sort(($, n) => {
|
|
1703
|
+
const { countryOrder: i } = this.options;
|
|
1704
|
+
if (i) {
|
|
1705
|
+
const o = i.indexOf($.iso2), a = i.indexOf(n.iso2), c = o > -1, g = a > -1;
|
|
1708
1706
|
if (c || g)
|
|
1709
1707
|
return c && g ? o - a : c ? -1 : 1;
|
|
1710
1708
|
}
|
|
1711
|
-
return
|
|
1709
|
+
return $.name.localeCompare(n.name);
|
|
1712
1710
|
});
|
|
1713
1711
|
}
|
|
1714
1712
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1715
|
-
_addToDialCodeMap(
|
|
1716
|
-
|
|
1717
|
-
for (let a = 0; a < this.dialCodeToIso2Map[
|
|
1718
|
-
if (this.dialCodeToIso2Map[
|
|
1713
|
+
_addToDialCodeMap($, n, i) {
|
|
1714
|
+
n.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = n.length), this.dialCodeToIso2Map.hasOwnProperty(n) || (this.dialCodeToIso2Map[n] = []);
|
|
1715
|
+
for (let a = 0; a < this.dialCodeToIso2Map[n].length; a++)
|
|
1716
|
+
if (this.dialCodeToIso2Map[n][a] === $)
|
|
1719
1717
|
return;
|
|
1720
|
-
const o =
|
|
1721
|
-
this.dialCodeToIso2Map[
|
|
1718
|
+
const o = i !== void 0 ? i : this.dialCodeToIso2Map[n].length;
|
|
1719
|
+
this.dialCodeToIso2Map[n][o] = $;
|
|
1722
1720
|
}
|
|
1723
1721
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1724
1722
|
_processAllCountries() {
|
|
1725
|
-
const { onlyCountries:
|
|
1726
|
-
if (
|
|
1727
|
-
const
|
|
1723
|
+
const { onlyCountries: $, excludeCountries: n } = this.options;
|
|
1724
|
+
if ($.length) {
|
|
1725
|
+
const i = $.map(
|
|
1728
1726
|
(o) => o.toLowerCase()
|
|
1729
1727
|
);
|
|
1730
1728
|
this.countries = H.filter(
|
|
1731
|
-
(o) =>
|
|
1729
|
+
(o) => i.indexOf(o.iso2) > -1
|
|
1732
1730
|
);
|
|
1733
|
-
} else if (
|
|
1734
|
-
const
|
|
1731
|
+
} else if (n.length) {
|
|
1732
|
+
const i = n.map(
|
|
1735
1733
|
(o) => o.toLowerCase()
|
|
1736
1734
|
);
|
|
1737
1735
|
this.countries = H.filter(
|
|
1738
|
-
(o) =>
|
|
1736
|
+
(o) => i.indexOf(o.iso2) === -1
|
|
1739
1737
|
);
|
|
1740
1738
|
} else
|
|
1741
1739
|
this.countries = H;
|
|
1742
1740
|
}
|
|
1743
1741
|
//* Translate Countries by object literal provided on config.
|
|
1744
1742
|
_translateCountryNames() {
|
|
1745
|
-
for (let
|
|
1746
|
-
const
|
|
1747
|
-
this.options.i18n.hasOwnProperty(
|
|
1743
|
+
for (let $ = 0; $ < this.countries.length; $++) {
|
|
1744
|
+
const n = this.countries[$].iso2.toLowerCase();
|
|
1745
|
+
this.options.i18n.hasOwnProperty(n) && (this.countries[$].name = this.options.i18n[n]);
|
|
1748
1746
|
}
|
|
1749
1747
|
}
|
|
1750
1748
|
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1751
1749
|
_processDialCodes() {
|
|
1752
1750
|
this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
|
|
1753
|
-
for (let
|
|
1754
|
-
const
|
|
1755
|
-
this.dialCodes[
|
|
1751
|
+
for (let $ = 0; $ < this.countries.length; $++) {
|
|
1752
|
+
const n = this.countries[$];
|
|
1753
|
+
this.dialCodes[n.dialCode] || (this.dialCodes[n.dialCode] = !0), this._addToDialCodeMap(n.iso2, n.dialCode, n.priority);
|
|
1756
1754
|
}
|
|
1757
|
-
for (let
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1760
|
-
const
|
|
1761
|
-
for (let o = 0; o <
|
|
1762
|
-
const a =
|
|
1755
|
+
for (let $ = 0; $ < this.countries.length; $++) {
|
|
1756
|
+
const n = this.countries[$];
|
|
1757
|
+
if (n.areaCodes) {
|
|
1758
|
+
const i = this.dialCodeToIso2Map[n.dialCode][0];
|
|
1759
|
+
for (let o = 0; o < n.areaCodes.length; o++) {
|
|
1760
|
+
const a = n.areaCodes[o];
|
|
1763
1761
|
for (let c = 1; c < a.length; c++) {
|
|
1764
|
-
const g =
|
|
1765
|
-
this._addToDialCodeMap(
|
|
1762
|
+
const g = n.dialCode + a.substr(0, c);
|
|
1763
|
+
this._addToDialCodeMap(i, g), this._addToDialCodeMap(n.iso2, g);
|
|
1766
1764
|
}
|
|
1767
|
-
this._addToDialCodeMap(
|
|
1765
|
+
this._addToDialCodeMap(n.iso2, n.dialCode + a);
|
|
1768
1766
|
}
|
|
1769
1767
|
}
|
|
1770
1768
|
}
|
|
@@ -1774,9 +1772,9 @@ class F2 {
|
|
|
1774
1772
|
var v;
|
|
1775
1773
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1776
1774
|
const {
|
|
1777
|
-
allowDropdown:
|
|
1778
|
-
separateDialCode:
|
|
1779
|
-
showFlags:
|
|
1775
|
+
allowDropdown: $,
|
|
1776
|
+
separateDialCode: n,
|
|
1777
|
+
showFlags: i,
|
|
1780
1778
|
containerClass: o,
|
|
1781
1779
|
hiddenInput: a,
|
|
1782
1780
|
dropdownContainer: c,
|
|
@@ -1786,14 +1784,14 @@ class F2 {
|
|
|
1786
1784
|
i18n: _
|
|
1787
1785
|
} = this.options;
|
|
1788
1786
|
let I = "iti";
|
|
1789
|
-
|
|
1787
|
+
$ && (I += " iti--allow-dropdown"), i && (I += " iti--show-flags"), o && (I += ` ${o}`), f || (I += " iti--inline-dropdown");
|
|
1790
1788
|
const L = A("div", { class: I });
|
|
1791
|
-
if ((v = this.telInput.parentNode) == null || v.insertBefore(L, this.telInput),
|
|
1789
|
+
if ((v = this.telInput.parentNode) == null || v.insertBefore(L, this.telInput), $ || i || n) {
|
|
1792
1790
|
this.countryContainer = A(
|
|
1793
1791
|
"div",
|
|
1794
1792
|
{ class: "iti__country-container" },
|
|
1795
1793
|
L
|
|
1796
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px",
|
|
1794
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", $ ? (this.selectedCountry = A(
|
|
1797
1795
|
"button",
|
|
1798
1796
|
{
|
|
1799
1797
|
type: "button",
|
|
@@ -1810,20 +1808,20 @@ class F2 {
|
|
|
1810
1808
|
{ class: "iti__selected-country" },
|
|
1811
1809
|
this.countryContainer
|
|
1812
1810
|
);
|
|
1813
|
-
const
|
|
1814
|
-
if (this.selectedCountryInner = A("div", { class: "iti__flag" },
|
|
1811
|
+
const N = A("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1812
|
+
if (this.selectedCountryInner = A("div", { class: "iti__flag" }, N), this.selectedCountryA11yText = A(
|
|
1815
1813
|
"span",
|
|
1816
1814
|
{ class: "iti__a11y-text" },
|
|
1817
1815
|
this.selectedCountryInner
|
|
1818
|
-
),
|
|
1816
|
+
), $ && (this.dropdownArrow = A(
|
|
1819
1817
|
"div",
|
|
1820
1818
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1821
|
-
|
|
1822
|
-
)),
|
|
1819
|
+
N
|
|
1820
|
+
)), n && (this.selectedDialCode = A(
|
|
1823
1821
|
"div",
|
|
1824
1822
|
{ class: "iti__selected-dial-code" },
|
|
1825
1823
|
this.selectedCountry
|
|
1826
|
-
)),
|
|
1824
|
+
)), $) {
|
|
1827
1825
|
const M = g ? "" : "iti--flexible-dropdown-width";
|
|
1828
1826
|
if (this.dropdownContent = A("div", {
|
|
1829
1827
|
id: `iti-${this.id}__dropdown-content`,
|
|
@@ -1863,7 +1861,7 @@ class F2 {
|
|
|
1863
1861
|
}
|
|
1864
1862
|
}
|
|
1865
1863
|
if (L.appendChild(this.telInput), this._updateInputPadding(), a) {
|
|
1866
|
-
const
|
|
1864
|
+
const N = this.telInput.getAttribute("name") || "", M = a(N);
|
|
1867
1865
|
M.phone && (this.hiddenInput = A("input", {
|
|
1868
1866
|
type: "hidden",
|
|
1869
1867
|
name: M.phone
|
|
@@ -1875,33 +1873,33 @@ class F2 {
|
|
|
1875
1873
|
}
|
|
1876
1874
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1877
1875
|
_appendListItems() {
|
|
1878
|
-
for (let
|
|
1879
|
-
const
|
|
1876
|
+
for (let $ = 0; $ < this.countries.length; $++) {
|
|
1877
|
+
const n = this.countries[$], i = $ === 0 ? "iti__highlight" : "", o = A(
|
|
1880
1878
|
"li",
|
|
1881
1879
|
{
|
|
1882
|
-
id: `iti-${this.id}__item-${
|
|
1883
|
-
class: `iti__country ${
|
|
1880
|
+
id: `iti-${this.id}__item-${n.iso2}`,
|
|
1881
|
+
class: `iti__country ${i}`,
|
|
1884
1882
|
tabindex: "-1",
|
|
1885
1883
|
role: "option",
|
|
1886
|
-
"data-dial-code":
|
|
1887
|
-
"data-country-code":
|
|
1884
|
+
"data-dial-code": n.dialCode,
|
|
1885
|
+
"data-country-code": n.iso2,
|
|
1888
1886
|
"aria-selected": "false"
|
|
1889
1887
|
},
|
|
1890
1888
|
this.countryList
|
|
1891
1889
|
);
|
|
1892
|
-
|
|
1890
|
+
n.nodeById[this.id] = o;
|
|
1893
1891
|
let a = "";
|
|
1894
|
-
this.options.showFlags && (a += `<div class='iti__flag iti__${
|
|
1892
|
+
this.options.showFlags && (a += `<div class='iti__flag iti__${n.iso2}'></div>`), a += `<span class='iti__country-name'>${n.name}</span>`, a += `<span class='iti__dial-code'>+${n.dialCode}</span>`, o.insertAdjacentHTML("beforeend", a);
|
|
1895
1893
|
}
|
|
1896
1894
|
}
|
|
1897
1895
|
//* Set the initial state of the input value and the selected country by:
|
|
1898
1896
|
//* 1. Extracting a dial code from the given number
|
|
1899
1897
|
//* 2. Using explicit initialCountry
|
|
1900
|
-
_setInitialState(
|
|
1901
|
-
const
|
|
1898
|
+
_setInitialState($ = !1) {
|
|
1899
|
+
const n = this.telInput.getAttribute("value"), i = this.telInput.value, a = n && n.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? n : i, c = this._getDialCode(a), g = o2(a), { initialCountry: f, geoIpLookup: b } = this.options, _ = f === "auto" && b;
|
|
1902
1900
|
if (c && !g)
|
|
1903
1901
|
this._updateCountryFromNumber(a);
|
|
1904
|
-
else if (!_ ||
|
|
1902
|
+
else if (!_ || $) {
|
|
1905
1903
|
const I = f ? f.toLowerCase() : "";
|
|
1906
1904
|
I && this._getCountryData(I, !0) ? this._setCountry(I) : c && g ? this._setCountry("us") : this._setCountry();
|
|
1907
1905
|
}
|
|
@@ -1913,24 +1911,24 @@ class F2 {
|
|
|
1913
1911
|
}
|
|
1914
1912
|
//* Update hidden input on form submit.
|
|
1915
1913
|
_initHiddenInputListener() {
|
|
1916
|
-
var
|
|
1914
|
+
var $;
|
|
1917
1915
|
this._handleHiddenInputSubmit = () => {
|
|
1918
1916
|
this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
|
|
1919
|
-
}, (
|
|
1917
|
+
}, ($ = this.telInput.form) == null || $.addEventListener(
|
|
1920
1918
|
"submit",
|
|
1921
1919
|
this._handleHiddenInputSubmit
|
|
1922
1920
|
);
|
|
1923
1921
|
}
|
|
1924
1922
|
//* initialise the dropdown listeners.
|
|
1925
1923
|
_initDropdownListeners() {
|
|
1926
|
-
this._handleLabelClick = (
|
|
1927
|
-
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() :
|
|
1924
|
+
this._handleLabelClick = (n) => {
|
|
1925
|
+
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : n.preventDefault();
|
|
1928
1926
|
};
|
|
1929
|
-
const
|
|
1930
|
-
|
|
1927
|
+
const $ = this.telInput.closest("label");
|
|
1928
|
+
$ && $.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
1931
1929
|
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
1932
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (
|
|
1933
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(
|
|
1930
|
+
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (n) => {
|
|
1931
|
+
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === "Tab" && this._closeDropdown();
|
|
1934
1932
|
}, this.countryContainer.addEventListener(
|
|
1935
1933
|
"keydown",
|
|
1936
1934
|
this._handleCountryContainerKeydown
|
|
@@ -1938,22 +1936,22 @@ class F2 {
|
|
|
1938
1936
|
}
|
|
1939
1937
|
//* Init many requests: utils script / geo ip lookup.
|
|
1940
1938
|
_initRequests() {
|
|
1941
|
-
let {
|
|
1942
|
-
|
|
1943
|
-
var
|
|
1944
|
-
window.removeEventListener("load", this._handlePageLoad), (
|
|
1939
|
+
let { loadUtils: $, initialCountry: n, geoIpLookup: i } = this.options;
|
|
1940
|
+
$ && !C.utils ? (this._handlePageLoad = () => {
|
|
1941
|
+
var a;
|
|
1942
|
+
window.removeEventListener("load", this._handlePageLoad), (a = C.attachUtils($)) == null || a.catch(() => {
|
|
1945
1943
|
});
|
|
1946
|
-
},
|
|
1944
|
+
}, C.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), n === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1947
1945
|
}
|
|
1948
1946
|
//* Perform the geo ip lookup.
|
|
1949
1947
|
_loadAutoCountry() {
|
|
1950
|
-
|
|
1951
|
-
(
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1948
|
+
C.autoCountry ? this.handleAutoCountry() : C.startedLoadingAutoCountry || (C.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1949
|
+
($ = "") => {
|
|
1950
|
+
const n = $.toLowerCase();
|
|
1951
|
+
n && this._getCountryData(n, !0) ? (C.autoCountry = n, setTimeout(() => e1("handleAutoCountry"))) : (this._setInitialState(!0), e1("rejectAutoCountryPromise"));
|
|
1954
1952
|
},
|
|
1955
1953
|
() => {
|
|
1956
|
-
this._setInitialState(!0),
|
|
1954
|
+
this._setInitialState(!0), e1("rejectAutoCountryPromise");
|
|
1957
1955
|
}
|
|
1958
1956
|
));
|
|
1959
1957
|
}
|
|
@@ -1962,68 +1960,68 @@ class F2 {
|
|
|
1962
1960
|
}
|
|
1963
1961
|
//* Initialize the tel input listeners.
|
|
1964
1962
|
_initTelInputListeners() {
|
|
1965
|
-
const { strictMode:
|
|
1963
|
+
const { strictMode: $, formatAsYouType: n, separateDialCode: i, formatOnDisplay: o, allowDropdown: a, countrySearch: c } = this.options;
|
|
1966
1964
|
let g = !1;
|
|
1967
1965
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (g = !0), this._handleInputEvent = (f) => {
|
|
1968
|
-
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" &&
|
|
1969
|
-
const L = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, L - 1),
|
|
1970
|
-
this.telInput.value = v +
|
|
1966
|
+
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && i && a && c) {
|
|
1967
|
+
const L = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, L - 1), N = this.telInput.value.substring(L);
|
|
1968
|
+
this.telInput.value = v + N, this._openDropdownWithPlus();
|
|
1971
1969
|
return;
|
|
1972
1970
|
}
|
|
1973
1971
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1974
1972
|
const b = (f == null ? void 0 : f.data) && /[^+0-9]/.test(f.data), _ = (f == null ? void 0 : f.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1975
|
-
b || _ &&
|
|
1973
|
+
b || _ && !$ ? g = !0 : /[^+0-9]/.test(this.telInput.value) || (g = !1);
|
|
1976
1974
|
const I = (f == null ? void 0 : f.detail) && f.detail.isSetNumber && !o;
|
|
1977
|
-
if (
|
|
1978
|
-
const L = this.telInput.selectionStart || 0,
|
|
1975
|
+
if (n && !g && !I) {
|
|
1976
|
+
const L = this.telInput.selectionStart || 0, N = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, M = (f == null ? void 0 : f.inputType) === "deleteContentForward", O = this._formatNumberAsYouType(), Z = V2(N, O, L, M);
|
|
1979
1977
|
this.telInput.value = O, this.telInput.setSelectionRange(Z, Z);
|
|
1980
1978
|
}
|
|
1981
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (
|
|
1979
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), ($ || i) && (this._handleKeydownEvent = (f) => {
|
|
1982
1980
|
if (f.key && f.key.length === 1 && !f.altKey && !f.ctrlKey && !f.metaKey) {
|
|
1983
|
-
if (
|
|
1981
|
+
if (i && a && c && f.key === "+") {
|
|
1984
1982
|
f.preventDefault(), this._openDropdownWithPlus();
|
|
1985
1983
|
return;
|
|
1986
1984
|
}
|
|
1987
|
-
if (
|
|
1988
|
-
const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+", L = /^[0-9]$/.test(f.key), v =
|
|
1989
|
-
let
|
|
1985
|
+
if ($) {
|
|
1986
|
+
const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+", L = /^[0-9]$/.test(f.key), v = i ? L : I || L, N = b.slice(0, this.telInput.selectionStart) + f.key + b.slice(this.telInput.selectionEnd), M = this._getFullNumber(N), O = C.utils.getCoreNumber(M, this.selectedCountryData.iso2), Z = this.maxCoreNumberLength && O.length > this.maxCoreNumberLength;
|
|
1987
|
+
let $1 = !1;
|
|
1990
1988
|
if (_) {
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1989
|
+
const f1 = this.selectedCountryData.iso2;
|
|
1990
|
+
$1 = this._getCountryFromNumber(M) !== f1;
|
|
1993
1991
|
}
|
|
1994
|
-
(!v || Z &&
|
|
1992
|
+
(!v || Z && !$1 && !I) && f.preventDefault();
|
|
1995
1993
|
}
|
|
1996
1994
|
}
|
|
1997
1995
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
1998
1996
|
}
|
|
1999
1997
|
//* Adhere to the input's maxlength attr.
|
|
2000
|
-
_cap(
|
|
2001
|
-
const
|
|
2002
|
-
return
|
|
1998
|
+
_cap($) {
|
|
1999
|
+
const n = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
2000
|
+
return n && $.length > n ? $.substr(0, n) : $;
|
|
2003
2001
|
}
|
|
2004
2002
|
//* Trigger a custom event on the input.
|
|
2005
|
-
_trigger(
|
|
2006
|
-
const
|
|
2003
|
+
_trigger($, n = {}) {
|
|
2004
|
+
const i = new CustomEvent($, {
|
|
2007
2005
|
bubbles: !0,
|
|
2008
2006
|
cancelable: !0,
|
|
2009
|
-
detail:
|
|
2007
|
+
detail: n
|
|
2010
2008
|
});
|
|
2011
|
-
this.telInput.dispatchEvent(
|
|
2009
|
+
this.telInput.dispatchEvent(i);
|
|
2012
2010
|
}
|
|
2013
2011
|
//* Open the dropdown.
|
|
2014
2012
|
_openDropdown() {
|
|
2015
|
-
const { fixDropdownWidth:
|
|
2016
|
-
if (
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2013
|
+
const { fixDropdownWidth: $, countrySearch: n } = this.options;
|
|
2014
|
+
if ($ && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), n) {
|
|
2015
|
+
const i = this.countryList.firstElementChild;
|
|
2016
|
+
i && (this._highlightListItem(i, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2019
2017
|
}
|
|
2020
2018
|
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2021
2019
|
}
|
|
2022
2020
|
//* Set the dropdown position
|
|
2023
2021
|
_setDropdownPosition() {
|
|
2024
2022
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2025
|
-
const
|
|
2026
|
-
this.options.dropdownContainer && (this.dropdown.style.top = `${
|
|
2023
|
+
const $ = this.telInput.getBoundingClientRect(), n = this.telInput.offsetHeight;
|
|
2024
|
+
this.options.dropdownContainer && (this.dropdown.style.top = `${$.top + n}px`, this.dropdown.style.left = `${$.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
|
|
2027
2025
|
}
|
|
2028
2026
|
}
|
|
2029
2027
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
@@ -2040,17 +2038,17 @@ class F2 {
|
|
|
2040
2038
|
const a = (c = o.target) == null ? void 0 : c.closest(".iti__country");
|
|
2041
2039
|
a && this._selectListItem(a);
|
|
2042
2040
|
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2043
|
-
let
|
|
2041
|
+
let $ = !0;
|
|
2044
2042
|
this._handleClickOffToClose = () => {
|
|
2045
|
-
|
|
2043
|
+
$ || this._closeDropdown(), $ = !1;
|
|
2046
2044
|
}, document.documentElement.addEventListener(
|
|
2047
2045
|
"click",
|
|
2048
2046
|
this._handleClickOffToClose
|
|
2049
2047
|
);
|
|
2050
|
-
let
|
|
2048
|
+
let n = "", i = null;
|
|
2051
2049
|
if (this._handleKeydownOnDropdown = (o) => {
|
|
2052
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === "ArrowUp" || o.key === "ArrowDown" ? this._handleUpDownKey(o.key) : o.key === "Enter" ? this._handleEnterKey() : o.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(o.key) && (o.stopPropagation(),
|
|
2053
|
-
|
|
2050
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === "ArrowUp" || o.key === "ArrowDown" ? this._handleUpDownKey(o.key) : o.key === "Enter" ? this._handleEnterKey() : o.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(o.key) && (o.stopPropagation(), i && clearTimeout(i), n += o.key.toLowerCase(), this._searchForCountry(n), i = setTimeout(() => {
|
|
2051
|
+
n = "";
|
|
2054
2052
|
}, 1e3));
|
|
2055
2053
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2056
2054
|
const o = () => {
|
|
@@ -2066,41 +2064,41 @@ class F2 {
|
|
|
2066
2064
|
}
|
|
2067
2065
|
}
|
|
2068
2066
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2069
|
-
_searchForCountry(
|
|
2070
|
-
for (let
|
|
2071
|
-
const
|
|
2072
|
-
if (
|
|
2073
|
-
const a =
|
|
2067
|
+
_searchForCountry($) {
|
|
2068
|
+
for (let n = 0; n < this.countries.length; n++) {
|
|
2069
|
+
const i = this.countries[n];
|
|
2070
|
+
if (i.name.substr(0, $.length).toLowerCase() === $) {
|
|
2071
|
+
const a = i.nodeById[this.id];
|
|
2074
2072
|
this._highlightListItem(a, !1), this._scrollTo(a);
|
|
2075
2073
|
break;
|
|
2076
2074
|
}
|
|
2077
2075
|
}
|
|
2078
2076
|
}
|
|
2079
2077
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2080
|
-
_filterCountries(
|
|
2081
|
-
let
|
|
2078
|
+
_filterCountries($, n = !1) {
|
|
2079
|
+
let i = !0;
|
|
2082
2080
|
this.countryList.innerHTML = "";
|
|
2083
|
-
const o =
|
|
2081
|
+
const o = s2($);
|
|
2084
2082
|
for (let a = 0; a < this.countries.length; a++) {
|
|
2085
|
-
const c = this.countries[a], g =
|
|
2086
|
-
if (
|
|
2083
|
+
const c = this.countries[a], g = s2(c.name), f = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((_) => _[0]).join("").toLowerCase(), b = `+${c.dialCode}`;
|
|
2084
|
+
if (n || g.includes(o) || b.includes(o) || c.iso2.includes(o) || f.includes(o)) {
|
|
2087
2085
|
const _ = c.nodeById[this.id];
|
|
2088
|
-
_ && this.countryList.appendChild(_),
|
|
2086
|
+
_ && this.countryList.appendChild(_), i && (this._highlightListItem(_, !1), i = !1);
|
|
2089
2087
|
}
|
|
2090
2088
|
}
|
|
2091
|
-
|
|
2089
|
+
i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
2092
2090
|
}
|
|
2093
2091
|
//* Update search results text (for a11y).
|
|
2094
2092
|
_updateSearchResultsText() {
|
|
2095
|
-
const { i18n:
|
|
2096
|
-
let
|
|
2097
|
-
|
|
2093
|
+
const { i18n: $ } = this.options, n = this.countryList.childElementCount;
|
|
2094
|
+
let i;
|
|
2095
|
+
n === 0 ? i = $.zeroSearchResults : n === 1 ? i = $.oneSearchResult : i = $.multipleSearchResults.replace("${count}", n.toString()), this.searchResultsA11yText.textContent = i;
|
|
2098
2096
|
}
|
|
2099
2097
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2100
|
-
_handleUpDownKey(
|
|
2101
|
-
var
|
|
2102
|
-
let
|
|
2103
|
-
!
|
|
2098
|
+
_handleUpDownKey($) {
|
|
2099
|
+
var i, o;
|
|
2100
|
+
let n = $ === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
|
|
2101
|
+
!n && this.countryList.childElementCount > 1 && (n = $ === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), n && (this._scrollTo(n), this._highlightListItem(n, !1));
|
|
2104
2102
|
}
|
|
2105
2103
|
//* Select the currently highlighted item.
|
|
2106
2104
|
_handleEnterKey() {
|
|
@@ -2108,110 +2106,110 @@ class F2 {
|
|
|
2108
2106
|
}
|
|
2109
2107
|
//* Update the input's value to the given val (format first if possible)
|
|
2110
2108
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2111
|
-
_updateValFromNumber(
|
|
2112
|
-
let
|
|
2113
|
-
if (this.options.formatOnDisplay &&
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2116
|
-
|
|
2109
|
+
_updateValFromNumber($) {
|
|
2110
|
+
let n = $;
|
|
2111
|
+
if (this.options.formatOnDisplay && C.utils && this.selectedCountryData) {
|
|
2112
|
+
const i = this.options.nationalMode || n.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: a } = C.utils.numberFormat, c = i ? o : a;
|
|
2113
|
+
n = C.utils.formatNumber(
|
|
2114
|
+
n,
|
|
2117
2115
|
this.selectedCountryData.iso2,
|
|
2118
2116
|
c
|
|
2119
2117
|
);
|
|
2120
2118
|
}
|
|
2121
|
-
|
|
2119
|
+
n = this._beforeSetNumber(n), this.telInput.value = n;
|
|
2122
2120
|
}
|
|
2123
2121
|
//* Check if need to select a new country based on the given number
|
|
2124
2122
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2125
|
-
_updateCountryFromNumber(
|
|
2126
|
-
const
|
|
2127
|
-
return
|
|
2123
|
+
_updateCountryFromNumber($) {
|
|
2124
|
+
const n = this._getCountryFromNumber($);
|
|
2125
|
+
return n !== null ? this._setCountry(n) : !1;
|
|
2128
2126
|
}
|
|
2129
|
-
_getCountryFromNumber(
|
|
2130
|
-
const
|
|
2131
|
-
let
|
|
2127
|
+
_getCountryFromNumber($) {
|
|
2128
|
+
const n = $.indexOf("+");
|
|
2129
|
+
let i = n ? $.substring(n) : $;
|
|
2132
2130
|
const o = this.selectedCountryData.dialCode;
|
|
2133
|
-
|
|
2134
|
-
const c = this._getDialCode(
|
|
2131
|
+
i && o === "1" && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = `1${i}`), i = `+${i}`), this.options.separateDialCode && o && i.charAt(0) !== "+" && (i = `+${o}${i}`);
|
|
2132
|
+
const c = this._getDialCode(i, !0), g = c1(i);
|
|
2135
2133
|
if (c) {
|
|
2136
|
-
const f = this.dialCodeToIso2Map[
|
|
2137
|
-
if (!(o === "1" &&
|
|
2134
|
+
const f = this.dialCodeToIso2Map[c1(c)], b = f.indexOf(this.selectedCountryData.iso2) !== -1 && g.length <= c.length - 1;
|
|
2135
|
+
if (!(o === "1" && o2(g)) && !b) {
|
|
2138
2136
|
for (let I = 0; I < f.length; I++)
|
|
2139
2137
|
if (f[I])
|
|
2140
2138
|
return f[I];
|
|
2141
2139
|
}
|
|
2142
2140
|
} else {
|
|
2143
|
-
if (
|
|
2141
|
+
if (i.charAt(0) === "+" && g.length)
|
|
2144
2142
|
return "";
|
|
2145
|
-
if ((!
|
|
2143
|
+
if ((!i || i === "+") && !this.selectedCountryData.iso2)
|
|
2146
2144
|
return this.defaultCountry;
|
|
2147
2145
|
}
|
|
2148
2146
|
return null;
|
|
2149
2147
|
}
|
|
2150
2148
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2151
|
-
_highlightListItem(
|
|
2152
|
-
const
|
|
2153
|
-
if (
|
|
2149
|
+
_highlightListItem($, n) {
|
|
2150
|
+
const i = this.highlightedItem;
|
|
2151
|
+
if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = $, this.highlightedItem) {
|
|
2154
2152
|
this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
|
|
2155
2153
|
const o = this.highlightedItem.getAttribute("id") || "";
|
|
2156
2154
|
this.selectedCountry.setAttribute("aria-activedescendant", o), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", o);
|
|
2157
2155
|
}
|
|
2158
|
-
|
|
2156
|
+
n && this.highlightedItem.focus();
|
|
2159
2157
|
}
|
|
2160
2158
|
//* Find the country data for the given iso2 code
|
|
2161
2159
|
//* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
|
2162
|
-
_getCountryData(
|
|
2163
|
-
for (let
|
|
2164
|
-
if (this.countries[
|
|
2165
|
-
return this.countries[
|
|
2166
|
-
if (
|
|
2160
|
+
_getCountryData($, n) {
|
|
2161
|
+
for (let i = 0; i < this.countries.length; i++)
|
|
2162
|
+
if (this.countries[i].iso2 === $)
|
|
2163
|
+
return this.countries[i];
|
|
2164
|
+
if (n)
|
|
2167
2165
|
return null;
|
|
2168
|
-
throw new Error(`No country data for '${
|
|
2166
|
+
throw new Error(`No country data for '${$}'`);
|
|
2169
2167
|
}
|
|
2170
2168
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2171
2169
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2172
|
-
_setCountry(
|
|
2173
|
-
const { separateDialCode:
|
|
2174
|
-
if (this.selectedCountryData =
|
|
2170
|
+
_setCountry($) {
|
|
2171
|
+
const { separateDialCode: n, showFlags: i, i18n: o } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2172
|
+
if (this.selectedCountryData = $ ? this._getCountryData($, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2175
2173
|
let c = "", g = "";
|
|
2176
|
-
|
|
2174
|
+
$ && i ? (c = `iti__flag iti__${$}`, g = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (c = "iti__flag iti__globe", g = o.noCountrySelected), this.selectedCountryInner.className = c, this.selectedCountryA11yText.textContent = g;
|
|
2177
2175
|
}
|
|
2178
|
-
if (this._setSelectedCountryTitleAttribute(
|
|
2176
|
+
if (this._setSelectedCountryTitleAttribute($, n), n) {
|
|
2179
2177
|
const c = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2180
2178
|
this.selectedDialCode.innerHTML = c, this._updateInputPadding();
|
|
2181
2179
|
}
|
|
2182
|
-
return this._updatePlaceholder(), this._updateMaxLength(), a.iso2 !==
|
|
2180
|
+
return this._updatePlaceholder(), this._updateMaxLength(), a.iso2 !== $;
|
|
2183
2181
|
}
|
|
2184
2182
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2185
2183
|
_updateInputPadding() {
|
|
2186
2184
|
if (this.selectedCountry) {
|
|
2187
|
-
const
|
|
2188
|
-
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${
|
|
2185
|
+
const n = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
|
|
2186
|
+
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${n}px` : this.telInput.style.paddingRight = `${n}px`;
|
|
2189
2187
|
}
|
|
2190
2188
|
}
|
|
2191
2189
|
//* Update the maximum valid number length for the currently selected country.
|
|
2192
2190
|
_updateMaxLength() {
|
|
2193
|
-
const { strictMode:
|
|
2194
|
-
if (
|
|
2191
|
+
const { strictMode: $, placeholderNumberType: n, validationNumberTypes: i } = this.options, { iso2: o } = this.selectedCountryData;
|
|
2192
|
+
if ($ && C.utils)
|
|
2195
2193
|
if (o) {
|
|
2196
|
-
const a =
|
|
2197
|
-
let c =
|
|
2194
|
+
const a = C.utils.numberType[n];
|
|
2195
|
+
let c = C.utils.getExampleNumber(
|
|
2198
2196
|
o,
|
|
2199
2197
|
!1,
|
|
2200
2198
|
a,
|
|
2201
2199
|
!0
|
|
2202
2200
|
), g = c;
|
|
2203
|
-
for (;
|
|
2201
|
+
for (; C.utils.isPossibleNumber(c, o, i); )
|
|
2204
2202
|
g = c, c += "0";
|
|
2205
|
-
const f =
|
|
2203
|
+
const f = C.utils.getCoreNumber(g, o);
|
|
2206
2204
|
this.maxCoreNumberLength = f.length, o === "by" && (this.maxCoreNumberLength = f.length + 1);
|
|
2207
2205
|
} else
|
|
2208
2206
|
this.maxCoreNumberLength = null;
|
|
2209
2207
|
}
|
|
2210
|
-
_setSelectedCountryTitleAttribute(
|
|
2208
|
+
_setSelectedCountryTitleAttribute($ = null, n) {
|
|
2211
2209
|
if (!this.selectedCountry)
|
|
2212
2210
|
return;
|
|
2213
|
-
let
|
|
2214
|
-
|
|
2211
|
+
let i;
|
|
2212
|
+
$ && !n ? i = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : $ ? i = this.selectedCountryData.name : i = "Unknown", this.selectedCountry.setAttribute("title", i);
|
|
2215
2213
|
}
|
|
2216
2214
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2217
2215
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2219,41 +2217,41 @@ class F2 {
|
|
|
2219
2217
|
//* will definitely exist.
|
|
2220
2218
|
_getHiddenSelectedCountryWidth() {
|
|
2221
2219
|
if (this.telInput.parentNode) {
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2224
|
-
const
|
|
2225
|
-
|
|
2226
|
-
const
|
|
2227
|
-
|
|
2228
|
-
const o =
|
|
2229
|
-
return document.body.removeChild(
|
|
2220
|
+
const $ = this.telInput.parentNode.cloneNode(!1);
|
|
2221
|
+
$.style.visibility = "hidden", document.body.appendChild($);
|
|
2222
|
+
const n = this.countryContainer.cloneNode();
|
|
2223
|
+
$.appendChild(n);
|
|
2224
|
+
const i = this.selectedCountry.cloneNode(!0);
|
|
2225
|
+
n.appendChild(i);
|
|
2226
|
+
const o = i.offsetWidth;
|
|
2227
|
+
return document.body.removeChild($), o;
|
|
2230
2228
|
}
|
|
2231
2229
|
return 0;
|
|
2232
2230
|
}
|
|
2233
2231
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2234
2232
|
_updatePlaceholder() {
|
|
2235
2233
|
const {
|
|
2236
|
-
autoPlaceholder:
|
|
2237
|
-
placeholderNumberType:
|
|
2238
|
-
nationalMode:
|
|
2234
|
+
autoPlaceholder: $,
|
|
2235
|
+
placeholderNumberType: n,
|
|
2236
|
+
nationalMode: i,
|
|
2239
2237
|
customPlaceholder: o
|
|
2240
|
-
} = this.options, a =
|
|
2241
|
-
if (
|
|
2242
|
-
const c =
|
|
2243
|
-
let g = this.selectedCountryData.iso2 ?
|
|
2238
|
+
} = this.options, a = $ === "aggressive" || !this.hadInitialPlaceholder && $ === "polite";
|
|
2239
|
+
if (C.utils && a) {
|
|
2240
|
+
const c = C.utils.numberType[n];
|
|
2241
|
+
let g = this.selectedCountryData.iso2 ? C.utils.getExampleNumber(
|
|
2244
2242
|
this.selectedCountryData.iso2,
|
|
2245
|
-
|
|
2243
|
+
i,
|
|
2246
2244
|
c
|
|
2247
2245
|
) : "";
|
|
2248
2246
|
g = this._beforeSetNumber(g), typeof o == "function" && (g = o(g, this.selectedCountryData)), this.telInput.setAttribute("placeholder", g);
|
|
2249
2247
|
}
|
|
2250
2248
|
}
|
|
2251
2249
|
//* Called when the user selects a list item from the dropdown.
|
|
2252
|
-
_selectListItem(
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2250
|
+
_selectListItem($) {
|
|
2251
|
+
const n = this._setCountry(
|
|
2252
|
+
$.getAttribute("data-country-code")
|
|
2255
2253
|
);
|
|
2256
|
-
this._closeDropdown(), this._updateDialCode(
|
|
2254
|
+
this._closeDropdown(), this._updateDialCode($.getAttribute("data-dial-code")), this.telInput.focus(), n && this._triggerCountryChange();
|
|
2257
2255
|
}
|
|
2258
2256
|
//* Close the dropdown and unbind any listeners.
|
|
2259
2257
|
_closeDropdown() {
|
|
@@ -2266,38 +2264,38 @@ class F2 {
|
|
|
2266
2264
|
), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this._trigger("close:countrydropdown");
|
|
2267
2265
|
}
|
|
2268
2266
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2269
|
-
_scrollTo(
|
|
2270
|
-
const
|
|
2267
|
+
_scrollTo($) {
|
|
2268
|
+
const n = this.countryList, i = document.documentElement.scrollTop, o = n.offsetHeight, a = n.getBoundingClientRect().top + i, c = a + o, g = $.offsetHeight, f = $.getBoundingClientRect().top + i, b = f + g, _ = f - a + n.scrollTop;
|
|
2271
2269
|
if (f < a)
|
|
2272
|
-
|
|
2270
|
+
n.scrollTop = _;
|
|
2273
2271
|
else if (b > c) {
|
|
2274
2272
|
const I = o - g;
|
|
2275
|
-
|
|
2273
|
+
n.scrollTop = _ - I;
|
|
2276
2274
|
}
|
|
2277
2275
|
}
|
|
2278
2276
|
//* Replace any existing dial code with the new one
|
|
2279
2277
|
//* Note: called from _selectListItem and setCountry
|
|
2280
|
-
_updateDialCode(
|
|
2281
|
-
const
|
|
2278
|
+
_updateDialCode($) {
|
|
2279
|
+
const n = this.telInput.value, i = `+${$}`;
|
|
2282
2280
|
let o;
|
|
2283
|
-
if (
|
|
2284
|
-
const a = this._getDialCode(
|
|
2285
|
-
a ? o =
|
|
2281
|
+
if (n.charAt(0) === "+") {
|
|
2282
|
+
const a = this._getDialCode(n);
|
|
2283
|
+
a ? o = n.replace(a, i) : o = i, this.telInput.value = o;
|
|
2286
2284
|
}
|
|
2287
2285
|
}
|
|
2288
2286
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2289
2287
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2290
|
-
_getDialCode(
|
|
2291
|
-
let
|
|
2292
|
-
if (
|
|
2288
|
+
_getDialCode($, n) {
|
|
2289
|
+
let i = "";
|
|
2290
|
+
if ($.charAt(0) === "+") {
|
|
2293
2291
|
let o = "";
|
|
2294
|
-
for (let a = 0; a <
|
|
2295
|
-
const c =
|
|
2292
|
+
for (let a = 0; a < $.length; a++) {
|
|
2293
|
+
const c = $.charAt(a);
|
|
2296
2294
|
if (!isNaN(parseInt(c, 10))) {
|
|
2297
|
-
if (o += c,
|
|
2298
|
-
this.dialCodeToIso2Map[o] && (
|
|
2295
|
+
if (o += c, n)
|
|
2296
|
+
this.dialCodeToIso2Map[o] && (i = $.substr(0, a + 1));
|
|
2299
2297
|
else if (this.dialCodes[o]) {
|
|
2300
|
-
|
|
2298
|
+
i = $.substr(0, a + 1);
|
|
2301
2299
|
break;
|
|
2302
2300
|
}
|
|
2303
2301
|
if (o.length === this.dialCodeMaxLen)
|
|
@@ -2305,27 +2303,27 @@ class F2 {
|
|
|
2305
2303
|
}
|
|
2306
2304
|
}
|
|
2307
2305
|
}
|
|
2308
|
-
return
|
|
2306
|
+
return i;
|
|
2309
2307
|
}
|
|
2310
2308
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2311
|
-
_getFullNumber(
|
|
2312
|
-
const
|
|
2309
|
+
_getFullNumber($) {
|
|
2310
|
+
const n = $ || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
2313
2311
|
let o;
|
|
2314
|
-
const a =
|
|
2315
|
-
return this.options.separateDialCode &&
|
|
2312
|
+
const a = c1(n);
|
|
2313
|
+
return this.options.separateDialCode && n.charAt(0) !== "+" && i && a ? o = `+${i}` : o = "", o + n;
|
|
2316
2314
|
}
|
|
2317
2315
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2318
|
-
_beforeSetNumber(
|
|
2319
|
-
let
|
|
2316
|
+
_beforeSetNumber($) {
|
|
2317
|
+
let n = $;
|
|
2320
2318
|
if (this.options.separateDialCode) {
|
|
2321
|
-
let
|
|
2322
|
-
if (
|
|
2323
|
-
|
|
2324
|
-
const o = i
|
|
2325
|
-
|
|
2319
|
+
let i = this._getDialCode(n);
|
|
2320
|
+
if (i) {
|
|
2321
|
+
i = `+${this.selectedCountryData.dialCode}`;
|
|
2322
|
+
const o = n[i.length] === " " || n[i.length] === "-" ? i.length + 1 : i.length;
|
|
2323
|
+
n = n.substr(o);
|
|
2326
2324
|
}
|
|
2327
2325
|
}
|
|
2328
|
-
return this._cap(
|
|
2326
|
+
return this._cap(n);
|
|
2329
2327
|
}
|
|
2330
2328
|
//* Trigger the 'countrychange' event.
|
|
2331
2329
|
_triggerCountryChange() {
|
|
@@ -2333,19 +2331,19 @@ class F2 {
|
|
|
2333
2331
|
}
|
|
2334
2332
|
//* Format the number as the user types.
|
|
2335
2333
|
_formatNumberAsYouType() {
|
|
2336
|
-
const
|
|
2337
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" &&
|
|
2334
|
+
const $ = this._getFullNumber(), n = C.utils ? C.utils.formatNumberAsYouType($, this.selectedCountryData.iso2) : $, { dialCode: i } = this.selectedCountryData;
|
|
2335
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && n.includes(`+${i}`) ? (n.split(`+${i}`)[1] || "").trim() : n;
|
|
2338
2336
|
}
|
|
2339
2337
|
//**************************
|
|
2340
2338
|
//* SECRET PUBLIC METHODS
|
|
2341
2339
|
//**************************
|
|
2342
2340
|
//* This is called when the geoip call returns.
|
|
2343
2341
|
handleAutoCountry() {
|
|
2344
|
-
this.options.initialCountry === "auto" &&
|
|
2342
|
+
this.options.initialCountry === "auto" && C.autoCountry && (this.defaultCountry = C.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2345
2343
|
}
|
|
2346
2344
|
//* This is called when the utils request completes.
|
|
2347
2345
|
handleUtils() {
|
|
2348
|
-
|
|
2346
|
+
C.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2349
2347
|
}
|
|
2350
2348
|
//********************
|
|
2351
2349
|
//* PUBLIC METHODS
|
|
@@ -2353,8 +2351,8 @@ class F2 {
|
|
|
2353
2351
|
//* Remove plugin.
|
|
2354
2352
|
destroy() {
|
|
2355
2353
|
var a, c;
|
|
2356
|
-
const { allowDropdown:
|
|
2357
|
-
if (
|
|
2354
|
+
const { allowDropdown: $, separateDialCode: n } = this.options;
|
|
2355
|
+
if ($) {
|
|
2358
2356
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2359
2357
|
"click",
|
|
2360
2358
|
this._handleClickSelectedCountry
|
|
@@ -2365,33 +2363,33 @@ class F2 {
|
|
|
2365
2363
|
const g = this.telInput.closest("label");
|
|
2366
2364
|
g && g.removeEventListener("click", this._handleLabelClick);
|
|
2367
2365
|
}
|
|
2368
|
-
const { form:
|
|
2369
|
-
this._handleHiddenInputSubmit &&
|
|
2366
|
+
const { form: i } = this.telInput;
|
|
2367
|
+
this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), n && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2370
2368
|
const o = this.telInput.parentNode;
|
|
2371
|
-
(a = o == null ? void 0 : o.parentNode) == null || a.insertBefore(this.telInput, o), (c = o == null ? void 0 : o.parentNode) == null || c.removeChild(o), delete
|
|
2369
|
+
(a = o == null ? void 0 : o.parentNode) == null || a.insertBefore(this.telInput, o), (c = o == null ? void 0 : o.parentNode) == null || c.removeChild(o), delete C.instances[this.id];
|
|
2372
2370
|
}
|
|
2373
2371
|
//* Get the extension from the current number.
|
|
2374
2372
|
getExtension() {
|
|
2375
|
-
return
|
|
2373
|
+
return C.utils ? C.utils.getExtension(
|
|
2376
2374
|
this._getFullNumber(),
|
|
2377
2375
|
this.selectedCountryData.iso2
|
|
2378
2376
|
) : "";
|
|
2379
2377
|
}
|
|
2380
2378
|
//* Format the number to the given format.
|
|
2381
|
-
getNumber(
|
|
2382
|
-
if (
|
|
2383
|
-
const { iso2:
|
|
2384
|
-
return
|
|
2379
|
+
getNumber($) {
|
|
2380
|
+
if (C.utils) {
|
|
2381
|
+
const { iso2: n } = this.selectedCountryData;
|
|
2382
|
+
return C.utils.formatNumber(
|
|
2385
2383
|
this._getFullNumber(),
|
|
2386
|
-
|
|
2387
|
-
|
|
2384
|
+
n,
|
|
2385
|
+
$
|
|
2388
2386
|
);
|
|
2389
2387
|
}
|
|
2390
2388
|
return "";
|
|
2391
2389
|
}
|
|
2392
2390
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
2393
2391
|
getNumberType() {
|
|
2394
|
-
return
|
|
2392
|
+
return C.utils ? C.utils.getNumberType(
|
|
2395
2393
|
this._getFullNumber(),
|
|
2396
2394
|
this.selectedCountryData.iso2
|
|
2397
2395
|
) : -99;
|
|
@@ -2402,9 +2400,9 @@ class F2 {
|
|
|
2402
2400
|
}
|
|
2403
2401
|
//* Get the validation error.
|
|
2404
2402
|
getValidationError() {
|
|
2405
|
-
if (
|
|
2406
|
-
const { iso2:
|
|
2407
|
-
return
|
|
2403
|
+
if (C.utils) {
|
|
2404
|
+
const { iso2: $ } = this.selectedCountryData;
|
|
2405
|
+
return C.utils.getValidationError(this._getFullNumber(), $);
|
|
2408
2406
|
}
|
|
2409
2407
|
return -99;
|
|
2410
2408
|
}
|
|
@@ -2412,115 +2410,113 @@ class F2 {
|
|
|
2412
2410
|
isValidNumber() {
|
|
2413
2411
|
if (!this.selectedCountryData.iso2)
|
|
2414
2412
|
return !1;
|
|
2415
|
-
const
|
|
2416
|
-
if (
|
|
2417
|
-
const
|
|
2413
|
+
const $ = this._getFullNumber(), n = $.search(new RegExp("\\p{L}", "u"));
|
|
2414
|
+
if (n > -1) {
|
|
2415
|
+
const i = $.substring(0, n), o = this._utilsIsPossibleNumber(i), a = this._utilsIsPossibleNumber($);
|
|
2418
2416
|
return o && a;
|
|
2419
2417
|
}
|
|
2420
|
-
return this._utilsIsPossibleNumber(
|
|
2418
|
+
return this._utilsIsPossibleNumber($);
|
|
2421
2419
|
}
|
|
2422
|
-
_utilsIsPossibleNumber(
|
|
2423
|
-
return
|
|
2420
|
+
_utilsIsPossibleNumber($) {
|
|
2421
|
+
return C.utils ? C.utils.isPossibleNumber($, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2424
2422
|
}
|
|
2425
2423
|
//* Validate the input val (precise)
|
|
2426
2424
|
isValidNumberPrecise() {
|
|
2427
2425
|
if (!this.selectedCountryData.iso2)
|
|
2428
2426
|
return !1;
|
|
2429
|
-
const
|
|
2430
|
-
if (
|
|
2431
|
-
const
|
|
2427
|
+
const $ = this._getFullNumber(), n = $.search(new RegExp("\\p{L}", "u"));
|
|
2428
|
+
if (n > -1) {
|
|
2429
|
+
const i = $.substring(0, n), o = this._utilsIsValidNumber(i), a = this._utilsIsValidNumber($);
|
|
2432
2430
|
return o && a;
|
|
2433
2431
|
}
|
|
2434
|
-
return this._utilsIsValidNumber(
|
|
2432
|
+
return this._utilsIsValidNumber($);
|
|
2435
2433
|
}
|
|
2436
|
-
_utilsIsValidNumber(
|
|
2437
|
-
return
|
|
2434
|
+
_utilsIsValidNumber($) {
|
|
2435
|
+
return C.utils ? C.utils.isValidNumber($, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2438
2436
|
}
|
|
2439
2437
|
//* Update the selected country, and update the input val accordingly.
|
|
2440
|
-
setCountry(
|
|
2441
|
-
const
|
|
2442
|
-
(
|
|
2438
|
+
setCountry($) {
|
|
2439
|
+
const n = $ == null ? void 0 : $.toLowerCase(), i = this.selectedCountryData.iso2;
|
|
2440
|
+
($ && n !== i || !$ && i) && (this._setCountry(n), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2443
2441
|
}
|
|
2444
2442
|
//* Set the input value and update the country.
|
|
2445
|
-
setNumber(
|
|
2446
|
-
const
|
|
2447
|
-
this._updateValFromNumber(
|
|
2443
|
+
setNumber($) {
|
|
2444
|
+
const n = this._updateCountryFromNumber($);
|
|
2445
|
+
this._updateValFromNumber($), n && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
|
|
2448
2446
|
}
|
|
2449
2447
|
//* Set the placeholder number typ
|
|
2450
|
-
setPlaceholderNumberType(
|
|
2451
|
-
this.options.placeholderNumberType =
|
|
2448
|
+
setPlaceholderNumberType($) {
|
|
2449
|
+
this.options.placeholderNumberType = $, this._updatePlaceholder();
|
|
2452
2450
|
}
|
|
2453
|
-
setDisabled(
|
|
2454
|
-
this.telInput.disabled =
|
|
2451
|
+
setDisabled($) {
|
|
2452
|
+
this.telInput.disabled = $, $ ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2455
2453
|
}
|
|
2456
2454
|
}
|
|
2457
|
-
const
|
|
2458
|
-
if (!
|
|
2459
|
-
let
|
|
2460
|
-
if (typeof y == "
|
|
2461
|
-
e = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
|
|
2462
|
-
else if (typeof y == "function")
|
|
2455
|
+
const H2 = (y) => {
|
|
2456
|
+
if (!C.utils && !C.startedLoadingUtilsScript) {
|
|
2457
|
+
let $;
|
|
2458
|
+
if (typeof y == "function")
|
|
2463
2459
|
try {
|
|
2464
|
-
|
|
2465
|
-
} catch (
|
|
2466
|
-
return Promise.reject(
|
|
2460
|
+
$ = Promise.resolve(y());
|
|
2461
|
+
} catch (n) {
|
|
2462
|
+
return Promise.reject(n);
|
|
2467
2463
|
}
|
|
2468
2464
|
else
|
|
2469
|
-
return Promise.reject(new TypeError(`The argument passed to
|
|
2470
|
-
return
|
|
2471
|
-
const
|
|
2472
|
-
if (!
|
|
2473
|
-
throw
|
|
2474
|
-
return
|
|
2475
|
-
}).catch((
|
|
2476
|
-
throw
|
|
2465
|
+
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof y}`));
|
|
2466
|
+
return C.startedLoadingUtilsScript = !0, $.then((n) => {
|
|
2467
|
+
const i = n == null ? void 0 : n.default;
|
|
2468
|
+
if (!i || typeof i != "object")
|
|
2469
|
+
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
2470
|
+
return C.utils = i, e1("handleUtils"), !0;
|
|
2471
|
+
}).catch((n) => {
|
|
2472
|
+
throw e1("rejectUtilsScriptPromise", n), n;
|
|
2477
2473
|
});
|
|
2478
2474
|
}
|
|
2479
2475
|
return null;
|
|
2480
|
-
},
|
|
2481
|
-
(y,
|
|
2482
|
-
const
|
|
2483
|
-
return
|
|
2476
|
+
}, C = Object.assign(
|
|
2477
|
+
(y, $) => {
|
|
2478
|
+
const n = new K2(y, $);
|
|
2479
|
+
return n._init(), y.setAttribute("data-intl-tel-input-id", n.id.toString()), C.instances[n.id] = n, n;
|
|
2484
2480
|
},
|
|
2485
2481
|
{
|
|
2486
|
-
defaults:
|
|
2482
|
+
defaults: l2,
|
|
2487
2483
|
//* Using a static var like this allows us to mock it in the tests.
|
|
2488
2484
|
documentReady: () => document.readyState === "complete",
|
|
2489
2485
|
//* Get the country data object.
|
|
2490
2486
|
getCountryData: () => H,
|
|
2491
2487
|
//* A getter for the plugin instance.
|
|
2492
2488
|
getInstance: (y) => {
|
|
2493
|
-
const
|
|
2494
|
-
return
|
|
2489
|
+
const $ = y.getAttribute("data-intl-tel-input-id");
|
|
2490
|
+
return $ ? C.instances[$] : null;
|
|
2495
2491
|
},
|
|
2496
2492
|
//* A map from instance ID to instance object.
|
|
2497
2493
|
instances: {},
|
|
2498
|
-
|
|
2494
|
+
attachUtils: H2,
|
|
2499
2495
|
startedLoadingUtilsScript: !1,
|
|
2500
2496
|
startedLoadingAutoCountry: !1,
|
|
2501
|
-
version: "
|
|
2497
|
+
version: "25.0.0"
|
|
2502
2498
|
}
|
|
2503
2499
|
);
|
|
2504
2500
|
(function() {
|
|
2505
2501
|
var y = this || self;
|
|
2506
|
-
function
|
|
2502
|
+
function $(d, t) {
|
|
2507
2503
|
d = d.split(".");
|
|
2508
|
-
var
|
|
2509
|
-
d[0] in
|
|
2510
|
-
for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ?
|
|
2504
|
+
var e = y;
|
|
2505
|
+
d[0] in e || typeof e.execScript > "u" || e.execScript("var " + d[0]);
|
|
2506
|
+
for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? e[r] && e[r] !== Object.prototype[r] ? e = e[r] : e = e[r] = {} : e[r] = t;
|
|
2511
2507
|
}
|
|
2512
|
-
function
|
|
2513
|
-
function
|
|
2508
|
+
function n(d, t) {
|
|
2509
|
+
function e() {
|
|
2514
2510
|
}
|
|
2515
|
-
|
|
2511
|
+
e.prototype = t.prototype, d.ma = t.prototype, d.prototype = new e(), d.prototype.constructor = d, d.sa = function(r, s, u) {
|
|
2516
2512
|
for (var l = Array(arguments.length - 2), h = 2; h < arguments.length; h++) l[h - 2] = arguments[h];
|
|
2517
2513
|
return t.prototype[s].apply(r, l);
|
|
2518
2514
|
};
|
|
2519
2515
|
}
|
|
2520
|
-
function
|
|
2516
|
+
function i(d) {
|
|
2521
2517
|
const t = [];
|
|
2522
|
-
let
|
|
2523
|
-
for (const r in d) t[
|
|
2518
|
+
let e = 0;
|
|
2519
|
+
for (const r in d) t[e++] = d[r];
|
|
2524
2520
|
return t;
|
|
2525
2521
|
}
|
|
2526
2522
|
var o = class {
|
|
@@ -2570,24 +2566,24 @@ const V2 = (y) => {
|
|
|
2570
2566
|
case M:
|
|
2571
2567
|
case O:
|
|
2572
2568
|
case Z:
|
|
2573
|
-
case
|
|
2574
|
-
case
|
|
2575
|
-
case
|
|
2569
|
+
case $1:
|
|
2570
|
+
case f1:
|
|
2571
|
+
case N:
|
|
2576
2572
|
case v:
|
|
2577
2573
|
this.o = !0;
|
|
2578
2574
|
}
|
|
2579
2575
|
this.j = t.defaultValue;
|
|
2580
2576
|
}
|
|
2581
|
-
var v = 1,
|
|
2577
|
+
var v = 1, N = 2, M = 3, O = 4, Z = 6, $1 = 16, f1 = 18;
|
|
2582
2578
|
function v1(d, t) {
|
|
2583
2579
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2584
|
-
var
|
|
2585
|
-
this.g[
|
|
2580
|
+
var e = t[d];
|
|
2581
|
+
this.g[e.g] = e;
|
|
2586
2582
|
}
|
|
2587
2583
|
}
|
|
2588
|
-
function
|
|
2589
|
-
return d =
|
|
2590
|
-
return t.g -
|
|
2584
|
+
function a2(d) {
|
|
2585
|
+
return d = i(d.g), d.sort(function(t, e) {
|
|
2586
|
+
return t.g - e.g;
|
|
2591
2587
|
}), d;
|
|
2592
2588
|
}
|
|
2593
2589
|
function x() {
|
|
@@ -2603,8 +2599,8 @@ const V2 = (y) => {
|
|
|
2603
2599
|
w1(this, d.g, t);
|
|
2604
2600
|
};
|
|
2605
2601
|
function S1(d, t) {
|
|
2606
|
-
for (var
|
|
2607
|
-
var s =
|
|
2602
|
+
for (var e = a2(d.m()), r = 0; r < e.length; r++) {
|
|
2603
|
+
var s = e[r], u = s.g;
|
|
2608
2604
|
if (R(t, u)) {
|
|
2609
2605
|
d.g && delete d.g[s.g];
|
|
2610
2606
|
var l = s.h == 11 || s.h == 10;
|
|
@@ -2623,24 +2619,24 @@ const V2 = (y) => {
|
|
|
2623
2619
|
return d.h[t] != null;
|
|
2624
2620
|
}
|
|
2625
2621
|
function n1(d, t) {
|
|
2626
|
-
var
|
|
2627
|
-
if (
|
|
2622
|
+
var e = d.h[t];
|
|
2623
|
+
if (e == null) return null;
|
|
2628
2624
|
if (d.l) {
|
|
2629
2625
|
if (!(t in d.g)) {
|
|
2630
2626
|
var r = d.l, s = d.j[t];
|
|
2631
|
-
if (
|
|
2632
|
-
for (var u = [], l = 0; l <
|
|
2633
|
-
|
|
2634
|
-
} else
|
|
2635
|
-
return d.g[t] =
|
|
2627
|
+
if (e != null) if (s.l) {
|
|
2628
|
+
for (var u = [], l = 0; l < e.length; l++) u[l] = r.h(s, e[l]);
|
|
2629
|
+
e = u;
|
|
2630
|
+
} else e = r.h(s, e);
|
|
2631
|
+
return d.g[t] = e;
|
|
2636
2632
|
}
|
|
2637
2633
|
return d.g[t];
|
|
2638
2634
|
}
|
|
2639
|
-
return
|
|
2635
|
+
return e;
|
|
2640
2636
|
}
|
|
2641
|
-
function p(d, t,
|
|
2637
|
+
function p(d, t, e) {
|
|
2642
2638
|
var r = n1(d, t);
|
|
2643
|
-
return d.j[t].l ? r[
|
|
2639
|
+
return d.j[t].l ? r[e || 0] : r;
|
|
2644
2640
|
}
|
|
2645
2641
|
function S(d, t) {
|
|
2646
2642
|
if (R(d, t)) d = p(d, t);
|
|
@@ -2659,25 +2655,25 @@ const V2 = (y) => {
|
|
|
2659
2655
|
function P(d, t) {
|
|
2660
2656
|
return n1(d, t) || [];
|
|
2661
2657
|
}
|
|
2662
|
-
function
|
|
2658
|
+
function U(d, t) {
|
|
2663
2659
|
return d.j[t].l ? R(d, t) ? d.h[t].length : 0 : R(d, t) ? 1 : 0;
|
|
2664
2660
|
}
|
|
2665
|
-
function E(d, t,
|
|
2666
|
-
d.h[t] =
|
|
2661
|
+
function E(d, t, e) {
|
|
2662
|
+
d.h[t] = e, d.g && (d.g[t] = e);
|
|
2667
2663
|
}
|
|
2668
|
-
function w1(d, t,
|
|
2669
|
-
d.h[t] || (d.h[t] = []), d.h[t].push(
|
|
2664
|
+
function w1(d, t, e) {
|
|
2665
|
+
d.h[t] || (d.h[t] = []), d.h[t].push(e), d.g && delete d.g[t];
|
|
2670
2666
|
}
|
|
2671
|
-
function
|
|
2672
|
-
var
|
|
2673
|
-
for (r in t) r != 0 &&
|
|
2674
|
-
return new v1(d,
|
|
2667
|
+
function i1(d, t) {
|
|
2668
|
+
var e = [], r;
|
|
2669
|
+
for (r in t) r != 0 && e.push(new L(r, t[r]));
|
|
2670
|
+
return new v1(d, e);
|
|
2675
2671
|
}
|
|
2676
|
-
function
|
|
2672
|
+
function r1() {
|
|
2677
2673
|
}
|
|
2678
|
-
|
|
2674
|
+
r1.prototype.g = function(d) {
|
|
2679
2675
|
throw new d.h(), Error("Unimplemented");
|
|
2680
|
-
},
|
|
2676
|
+
}, r1.prototype.h = function(d, t) {
|
|
2681
2677
|
if (d.h == 11 || d.h == 10) return t instanceof x ? t : this.g(d.s.prototype.m(), t);
|
|
2682
2678
|
if (d.h == 14) return typeof t == "string" && b1.test(t) && (d = Number(t), 0 < d) ? d : t;
|
|
2683
2679
|
if (!d.o) return t;
|
|
@@ -2687,57 +2683,57 @@ const V2 = (y) => {
|
|
|
2687
2683
|
return t;
|
|
2688
2684
|
};
|
|
2689
2685
|
var b1 = /^-?[0-9]+$/;
|
|
2690
|
-
function
|
|
2686
|
+
function p1() {
|
|
2691
2687
|
}
|
|
2692
|
-
|
|
2688
|
+
n(p1, r1), p1.prototype.g = function(d, t) {
|
|
2693
2689
|
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
|
|
2694
2690
|
};
|
|
2695
|
-
function
|
|
2691
|
+
function J() {
|
|
2696
2692
|
}
|
|
2697
|
-
|
|
2698
|
-
return d.h == 8 ? !!t :
|
|
2699
|
-
},
|
|
2700
|
-
return
|
|
2693
|
+
n(J, p1), J.prototype.h = function(d, t) {
|
|
2694
|
+
return d.h == 8 ? !!t : r1.prototype.h.apply(this, arguments);
|
|
2695
|
+
}, J.prototype.g = function(d, t) {
|
|
2696
|
+
return J.ma.g.call(this, d, t);
|
|
2701
2697
|
};
|
|
2702
|
-
function
|
|
2698
|
+
function T(d, t) {
|
|
2703
2699
|
d != null && this.g.apply(this, arguments);
|
|
2704
2700
|
}
|
|
2705
|
-
|
|
2701
|
+
T.prototype.h = "", T.prototype.set = function(d) {
|
|
2706
2702
|
this.h = "" + d;
|
|
2707
|
-
},
|
|
2703
|
+
}, T.prototype.g = function(d, t, e) {
|
|
2708
2704
|
if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
|
|
2709
2705
|
return this;
|
|
2710
2706
|
};
|
|
2711
2707
|
function B(d) {
|
|
2712
2708
|
d.h = "";
|
|
2713
2709
|
}
|
|
2714
|
-
|
|
2710
|
+
T.prototype.toString = function() {
|
|
2715
2711
|
return this.h;
|
|
2716
2712
|
};
|
|
2717
2713
|
function j() {
|
|
2718
2714
|
x.call(this);
|
|
2719
2715
|
}
|
|
2720
|
-
|
|
2716
|
+
n(j, x);
|
|
2721
2717
|
var L1 = null;
|
|
2722
2718
|
function w() {
|
|
2723
2719
|
x.call(this);
|
|
2724
2720
|
}
|
|
2725
|
-
|
|
2726
|
-
var
|
|
2721
|
+
n(w, x);
|
|
2722
|
+
var N1 = null;
|
|
2727
2723
|
function W() {
|
|
2728
2724
|
x.call(this);
|
|
2729
2725
|
}
|
|
2730
|
-
|
|
2731
|
-
var
|
|
2726
|
+
n(W, x);
|
|
2727
|
+
var T1 = null;
|
|
2732
2728
|
j.prototype.m = function() {
|
|
2733
2729
|
var d = L1;
|
|
2734
|
-
return d || (L1 = d =
|
|
2730
|
+
return d || (L1 = d = i1(j, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
|
|
2735
2731
|
}, j.m = j.prototype.m, w.prototype.m = function() {
|
|
2736
|
-
var d = T1;
|
|
2737
|
-
return d || (T1 = d = r1(w, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
|
|
2738
|
-
}, w.m = w.prototype.m, W.prototype.m = function() {
|
|
2739
2732
|
var d = N1;
|
|
2740
|
-
return d || (N1 = d =
|
|
2733
|
+
return d || (N1 = d = i1(w, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
|
|
2734
|
+
}, w.m = w.prototype.m, W.prototype.m = function() {
|
|
2735
|
+
var d = T1;
|
|
2736
|
+
return d || (T1 = d = i1(W, {
|
|
2741
2737
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
2742
2738
|
1: { name: "general_desc", i: 11, type: w },
|
|
2743
2739
|
2: { name: "fixed_line", i: 11, type: w },
|
|
@@ -2778,17 +2774,17 @@ const V2 = (y) => {
|
|
|
2778
2774
|
function V() {
|
|
2779
2775
|
x.call(this);
|
|
2780
2776
|
}
|
|
2781
|
-
|
|
2782
|
-
var A1 = null,
|
|
2777
|
+
n(V, x);
|
|
2778
|
+
var A1 = null, h2 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
|
|
2783
2779
|
V.prototype.m = function() {
|
|
2784
2780
|
var d = A1;
|
|
2785
|
-
return d || (A1 = d =
|
|
2781
|
+
return d || (A1 = d = i1(V, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: h2 }, 7: {
|
|
2786
2782
|
name: "preferred_domestic_carrier_code",
|
|
2787
2783
|
i: 9,
|
|
2788
2784
|
type: String
|
|
2789
2785
|
} })), d;
|
|
2790
2786
|
}, V.ctor = V, V.ctor.m = V.prototype.m;
|
|
2791
|
-
var
|
|
2787
|
+
var q = {
|
|
2792
2788
|
1: "US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),
|
|
2793
2789
|
7: ["RU", "KZ"],
|
|
2794
2790
|
20: ["EG"],
|
|
@@ -7875,7 +7871,7 @@ const V2 = (y) => {
|
|
|
7875
7871
|
D.h = void 0, D.g = function() {
|
|
7876
7872
|
return D.h ? D.h : D.h = new D();
|
|
7877
7873
|
};
|
|
7878
|
-
var
|
|
7874
|
+
var g1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" }, c2 = {
|
|
7879
7875
|
0: "0",
|
|
7880
7876
|
1: "1",
|
|
7881
7877
|
2: "2",
|
|
@@ -7889,7 +7885,7 @@ const V2 = (y) => {
|
|
|
7889
7885
|
"+": "+",
|
|
7890
7886
|
"*": "*",
|
|
7891
7887
|
"#": "#"
|
|
7892
|
-
},
|
|
7888
|
+
}, f2 = {
|
|
7893
7889
|
0: "0",
|
|
7894
7890
|
1: "1",
|
|
7895
7891
|
2: "2",
|
|
@@ -7956,54 +7952,54 @@ const V2 = (y) => {
|
|
|
7956
7952
|
X: "9",
|
|
7957
7953
|
Y: "9",
|
|
7958
7954
|
Z: "9"
|
|
7959
|
-
},
|
|
7955
|
+
}, p2 = RegExp("[++]+"), X = RegExp("^[++]+"), D1 = RegExp("([0-90-9٠-٩۰-۹])"), g2 = RegExp("[++0-90-9٠-٩۰-۹]"), C2 = /[\\\/] *x/, m2 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), y2 = /(?:.*?[A-Za-z]){3}.*/, _2 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), I2 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
|
|
7960
7956
|
function Y(d) {
|
|
7961
7957
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
7962
7958
|
}
|
|
7963
7959
|
function M1() {
|
|
7964
7960
|
return ";ext=" + Y("20") + "|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[ \\t,-]*" + (Y("20") + "#?|[ \\t,]*(?:[xx##~~]|int|int)[:\\..]?[ \\t,-]*") + (Y("9") + "#?|[- ]+") + (Y("6") + "#|[ \\t]*(?:,{2}|;)[:\\..]?[ \\t,-]*") + (Y("15") + "#?|[ \\t]*(?:,)+[:\\..]?[ \\t,-]*") + (Y("9") + "#?");
|
|
7965
7961
|
}
|
|
7966
|
-
var P1 = new RegExp("(?:" + M1() + ")$", "i"),
|
|
7962
|
+
var P1 = new RegExp("(?:" + M1() + ")$", "i"), v2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + M1() + ")?$", "i"), S2 = /(\$\d)/, w2 = /^\(?\$1\)?$/;
|
|
7967
7963
|
function x1(d) {
|
|
7968
|
-
return 2 > d.length ? !1 : G(
|
|
7964
|
+
return 2 > d.length ? !1 : G(v2, d);
|
|
7969
7965
|
}
|
|
7970
7966
|
function R1(d) {
|
|
7971
|
-
return G(
|
|
7967
|
+
return G(y2, d) ? s1(d, f2) : s1(d, g1);
|
|
7972
7968
|
}
|
|
7973
7969
|
function B1(d) {
|
|
7974
7970
|
var t = R1(d.toString());
|
|
7975
7971
|
B(d), d.g(t);
|
|
7976
7972
|
}
|
|
7977
7973
|
function k1(d) {
|
|
7978
|
-
return d != null && (
|
|
7974
|
+
return d != null && (U(d, 9) != 1 || P(d, 9)[0] != -1);
|
|
7979
7975
|
}
|
|
7980
|
-
function
|
|
7981
|
-
for (var
|
|
7982
|
-
return
|
|
7976
|
+
function s1(d, t) {
|
|
7977
|
+
for (var e = new T(), r, s = d.length, u = 0; u < s; ++u) r = d.charAt(u), r = t[r.toUpperCase()], r != null && e.g(r);
|
|
7978
|
+
return e.toString();
|
|
7983
7979
|
}
|
|
7984
7980
|
function O1(d) {
|
|
7985
|
-
return d.length == 0 ||
|
|
7981
|
+
return d.length == 0 || w2.test(d);
|
|
7986
7982
|
}
|
|
7987
|
-
function
|
|
7983
|
+
function o1(d) {
|
|
7988
7984
|
return d != null && isNaN(d) && d.toUpperCase() in E1;
|
|
7989
7985
|
}
|
|
7990
7986
|
D.prototype.format = function(d, t) {
|
|
7991
7987
|
if (p(d, 2) == 0 && R(d, 5)) {
|
|
7992
|
-
var
|
|
7993
|
-
if (0 <
|
|
7988
|
+
var e = S(d, 5);
|
|
7989
|
+
if (0 < e.length) return e;
|
|
7994
7990
|
}
|
|
7995
|
-
|
|
7996
|
-
var r =
|
|
7997
|
-
if (t == 0) return G1(
|
|
7998
|
-
if (!(
|
|
7999
|
-
var s =
|
|
7991
|
+
e = S(d, 1);
|
|
7992
|
+
var r = d1(d);
|
|
7993
|
+
if (t == 0) return G1(e, 0, r, "");
|
|
7994
|
+
if (!(e in q)) return r;
|
|
7995
|
+
var s = Q(this, e, t1(e));
|
|
8000
7996
|
d = R(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : R(s, 13) ? p(s, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
|
|
8001
7997
|
d: {
|
|
8002
7998
|
s = P(s, 20).length == 0 || t == 2 ? P(s, 19) : P(s, 20);
|
|
8003
7999
|
for (var u, l = s.length, h = 0; h < l; ++h) {
|
|
8004
8000
|
u = s[h];
|
|
8005
|
-
var
|
|
8006
|
-
if ((
|
|
8001
|
+
var m = U(u, 3);
|
|
8002
|
+
if ((m == 0 || r.search(p(u, 3, m - 1)) == 0) && (m = new RegExp(p(u, 1)), G(m, r))) {
|
|
8007
8003
|
s = u;
|
|
8008
8004
|
break d;
|
|
8009
8005
|
}
|
|
@@ -8013,29 +8009,29 @@ const V2 = (y) => {
|
|
|
8013
8009
|
return s != null && (l = s, s = S(l, 2), u = new RegExp(p(l, 1)), S(
|
|
8014
8010
|
l,
|
|
8015
8011
|
5
|
|
8016
|
-
), l = S(l, 4), r = t == 2 && l != null && 0 < l.length ? r.replace(u, s.replace(
|
|
8012
|
+
), l = S(l, 4), r = t == 2 && l != null && 0 < l.length ? r.replace(u, s.replace(S2, l)) : r.replace(u, s), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), G1(e, t, r, d);
|
|
8017
8013
|
};
|
|
8018
|
-
function
|
|
8019
|
-
return
|
|
8014
|
+
function Q(d, t, e) {
|
|
8015
|
+
return e == "001" ? K(d, "" + t) : K(d, e);
|
|
8020
8016
|
}
|
|
8021
|
-
function
|
|
8017
|
+
function d1(d) {
|
|
8022
8018
|
if (!R(d, 2)) return "";
|
|
8023
8019
|
var t = "" + p(d, 2);
|
|
8024
8020
|
return R(d, 4) && p(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
|
|
8025
8021
|
}
|
|
8026
|
-
function G1(d, t,
|
|
8022
|
+
function G1(d, t, e, r) {
|
|
8027
8023
|
switch (t) {
|
|
8028
8024
|
case 0:
|
|
8029
|
-
return "+" + d +
|
|
8025
|
+
return "+" + d + e + r;
|
|
8030
8026
|
case 1:
|
|
8031
|
-
return "+" + d + " " +
|
|
8027
|
+
return "+" + d + " " + e + r;
|
|
8032
8028
|
case 3:
|
|
8033
|
-
return "tel:+" + d + "-" +
|
|
8029
|
+
return "tel:+" + d + "-" + e + r;
|
|
8034
8030
|
default:
|
|
8035
|
-
return
|
|
8031
|
+
return e + r;
|
|
8036
8032
|
}
|
|
8037
8033
|
}
|
|
8038
|
-
function
|
|
8034
|
+
function u1(d, t) {
|
|
8039
8035
|
switch (t) {
|
|
8040
8036
|
case 4:
|
|
8041
8037
|
return p(d, 5);
|
|
@@ -8062,39 +8058,47 @@ const V2 = (y) => {
|
|
|
8062
8058
|
return p(d, 1);
|
|
8063
8059
|
}
|
|
8064
8060
|
}
|
|
8065
|
-
function
|
|
8061
|
+
function F1(d, t) {
|
|
8062
|
+
var e = U1(d, t);
|
|
8063
|
+
return d = Q(d, S(t, 1), e), d == null ? -1 : (t = d1(t), C1(t, d));
|
|
8064
|
+
}
|
|
8065
|
+
function C1(d, t) {
|
|
8066
8066
|
return k(d, p(t, 1)) ? k(d, p(t, 5)) ? 4 : k(d, p(t, 4)) ? 3 : k(d, p(t, 6)) ? 5 : k(d, p(t, 8)) ? 6 : k(d, p(t, 7)) ? 7 : k(d, p(t, 21)) ? 8 : k(d, p(t, 25)) ? 9 : k(d, p(t, 28)) ? 10 : k(d, p(t, 2)) ? p(t, 18) || k(d, p(t, 3)) ? 2 : 0 : !p(t, 18) && k(d, p(t, 3)) ? 1 : -1 : -1;
|
|
8067
8067
|
}
|
|
8068
8068
|
function K(d, t) {
|
|
8069
8069
|
if (t == null) return null;
|
|
8070
8070
|
t = t.toUpperCase();
|
|
8071
|
-
var
|
|
8072
|
-
if (
|
|
8073
|
-
if (
|
|
8074
|
-
|
|
8071
|
+
var e = d.g[t];
|
|
8072
|
+
if (e == null) {
|
|
8073
|
+
if (e = E1[t], e == null) return null;
|
|
8074
|
+
e = new J().g(W.m(), e), d.g[t] = e;
|
|
8075
8075
|
}
|
|
8076
|
-
return
|
|
8076
|
+
return e;
|
|
8077
8077
|
}
|
|
8078
8078
|
function k(d, t) {
|
|
8079
|
-
var
|
|
8080
|
-
return 0 <
|
|
8079
|
+
var e = d.length;
|
|
8080
|
+
return 0 < U(t, 9) && P(t, 9).indexOf(e) == -1 ? !1 : G(S(t, 2), d);
|
|
8081
|
+
}
|
|
8082
|
+
function b2(d, t) {
|
|
8083
|
+
var e = U1(d, t), r = S(t, 1), s = Q(d, r, e);
|
|
8084
|
+
return s == null || e != "001" && r != V1(d, e) ? s = !1 : (d = d1(t), s = C1(d, s) != -1), s;
|
|
8081
8085
|
}
|
|
8082
8086
|
function U1(d, t) {
|
|
8083
8087
|
if (t == null) return null;
|
|
8084
|
-
var
|
|
8085
|
-
if (
|
|
8086
|
-
else if (
|
|
8088
|
+
var e = S(t, 1);
|
|
8089
|
+
if (e = q[e], e == null) d = null;
|
|
8090
|
+
else if (e.length == 1) d = e[0];
|
|
8087
8091
|
else d: {
|
|
8088
|
-
t =
|
|
8089
|
-
for (var r, s =
|
|
8090
|
-
r =
|
|
8092
|
+
t = d1(t);
|
|
8093
|
+
for (var r, s = e.length, u = 0; u < s; u++) {
|
|
8094
|
+
r = e[u];
|
|
8091
8095
|
var l = K(d, r);
|
|
8092
8096
|
if (R(l, 23)) {
|
|
8093
8097
|
if (t.search(p(l, 23)) == 0) {
|
|
8094
8098
|
d = r;
|
|
8095
8099
|
break d;
|
|
8096
8100
|
}
|
|
8097
|
-
} else if (
|
|
8101
|
+
} else if (C1(t, l) != -1) {
|
|
8098
8102
|
d = r;
|
|
8099
8103
|
break d;
|
|
8100
8104
|
}
|
|
@@ -8103,70 +8107,70 @@ const V2 = (y) => {
|
|
|
8103
8107
|
}
|
|
8104
8108
|
return d;
|
|
8105
8109
|
}
|
|
8106
|
-
function
|
|
8107
|
-
return d =
|
|
8110
|
+
function t1(d) {
|
|
8111
|
+
return d = q[d], d == null ? "ZZ" : d[0];
|
|
8108
8112
|
}
|
|
8109
|
-
function
|
|
8113
|
+
function V1(d, t) {
|
|
8110
8114
|
if (d = K(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8111
8115
|
return S(d, 10);
|
|
8112
8116
|
}
|
|
8113
|
-
function
|
|
8114
|
-
var s =
|
|
8115
|
-
if (s = P(s, 10), r == 2) if (k1(
|
|
8116
|
-
else return
|
|
8117
|
-
return u[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : (
|
|
8117
|
+
function l1(d, t, e, r) {
|
|
8118
|
+
var s = u1(e, r), u = U(s, 9) == 0 ? P(p(e, 1), 9) : P(s, 9);
|
|
8119
|
+
if (s = P(s, 10), r == 2) if (k1(u1(e, 0))) d = u1(e, 1), k1(d) && (u = u.concat(U(d, 9) == 0 ? P(p(e, 1), 9) : P(d, 9)), u.sort(), s.length == 0 ? s = P(d, 10) : (s = s.concat(P(d, 10)), s.sort()));
|
|
8120
|
+
else return l1(d, t, e, 1);
|
|
8121
|
+
return u[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : (e = u[0], e == t ? 0 : e > t ? 2 : u[u.length - 1] < t ? 3 : -1 < u.indexOf(t, 1) ? 0 : 5));
|
|
8118
8122
|
}
|
|
8119
|
-
function
|
|
8120
|
-
var r =
|
|
8121
|
-
return t = S(t, 1), t in
|
|
8123
|
+
function a1(d, t, e) {
|
|
8124
|
+
var r = d1(t);
|
|
8125
|
+
return t = S(t, 1), t in q ? (t = Q(d, t, t1(t)), l1(d, r, t, e)) : 1;
|
|
8122
8126
|
}
|
|
8123
|
-
function
|
|
8127
|
+
function K1(d, t) {
|
|
8124
8128
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8125
|
-
for (var
|
|
8129
|
+
for (var e, r = d.length, s = 1; 3 >= s && s <= r; ++s) if (e = parseInt(d.substring(0, s), 10), e in q) return t.g(d.substring(s)), e;
|
|
8126
8130
|
return 0;
|
|
8127
8131
|
}
|
|
8128
|
-
function
|
|
8132
|
+
function H1(d, t, e, r, s, u) {
|
|
8129
8133
|
if (t.length == 0) return 0;
|
|
8130
|
-
t = new
|
|
8134
|
+
t = new T(t);
|
|
8131
8135
|
var l;
|
|
8132
|
-
|
|
8136
|
+
e != null && (l = p(e, 11)), l == null && (l = "NonMatch");
|
|
8133
8137
|
var h = t.toString();
|
|
8134
8138
|
if (h.length == 0) l = 20;
|
|
8135
|
-
else if (
|
|
8139
|
+
else if (X.test(h)) h = h.replace(X, ""), B(t), t.g(R1(h)), l = 1;
|
|
8136
8140
|
else {
|
|
8137
8141
|
if (h = new RegExp(l), B1(t), l = t.toString(), l.search(h) == 0) {
|
|
8138
8142
|
h = l.match(h)[0].length;
|
|
8139
|
-
var
|
|
8140
|
-
|
|
8143
|
+
var m = l.substring(h).match(D1);
|
|
8144
|
+
m && m[1] != null && 0 < m[1].length && s1(m[1], g1) == "0" ? l = !1 : (B(t), t.g(l.substring(h)), l = !0);
|
|
8141
8145
|
} else l = !1;
|
|
8142
8146
|
l = l ? 5 : 20;
|
|
8143
8147
|
}
|
|
8144
8148
|
if (s && E(u, 6, l), l != 20) {
|
|
8145
8149
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8146
|
-
if (d =
|
|
8150
|
+
if (d = K1(t, r), d != 0) return E(u, 1, d), d;
|
|
8147
8151
|
throw Error("Invalid country calling code");
|
|
8148
8152
|
}
|
|
8149
|
-
return
|
|
8153
|
+
return e != null && (l = S(e, 10), h = "" + l, m = t.toString(), m.lastIndexOf(h, 0) == 0 && (h = new T(m.substring(h.length)), m = p(e, 1), m = new RegExp(S(m, 2)), j1(h, e, null), h = h.toString(), !G(m, t.toString()) && G(m, h) || l1(d, t.toString(), e, -1) == 3)) ? (r.g(h), s && E(u, 6, 10), E(u, 1, l), l) : (E(u, 1, 0), 0);
|
|
8150
8154
|
}
|
|
8151
|
-
function
|
|
8155
|
+
function j1(d, t, e) {
|
|
8152
8156
|
var r = d.toString(), s = r.length, u = p(t, 15);
|
|
8153
8157
|
if (s != 0 && u != null && u.length != 0) {
|
|
8154
8158
|
var l = new RegExp("^(?:" + u + ")");
|
|
8155
8159
|
if (s = l.exec(r)) {
|
|
8156
8160
|
u = new RegExp(S(p(t, 1), 2));
|
|
8157
|
-
var h = G(u, r),
|
|
8158
|
-
t = p(t, 16), t == null || t.length == 0 || s[
|
|
8161
|
+
var h = G(u, r), m = s.length - 1;
|
|
8162
|
+
t = p(t, 16), t == null || t.length == 0 || s[m] == null || s[m].length == 0 ? (!h || G(u, r.substring(s[0].length))) && (e != null && 0 < m && s[m] != null && e.g(s[1]), d.set(r.substring(s[0].length))) : (r = r.replace(l, t), (!h || G(u, r)) && (e != null && 0 < m && e.g(s[1]), d.set(r)));
|
|
8159
8163
|
}
|
|
8160
8164
|
}
|
|
8161
8165
|
}
|
|
8162
|
-
function z(d, t,
|
|
8163
|
-
if (!
|
|
8164
|
-
return
|
|
8166
|
+
function z(d, t, e) {
|
|
8167
|
+
if (!o1(e) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8168
|
+
return W1(d, t, e, !0);
|
|
8165
8169
|
}
|
|
8166
|
-
function
|
|
8170
|
+
function W1(d, t, e, r) {
|
|
8167
8171
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8168
8172
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8169
|
-
var s = new
|
|
8173
|
+
var s = new T(), u = t.indexOf(";phone-context=");
|
|
8170
8174
|
if (u === -1) u = null;
|
|
8171
8175
|
else if (u += 15, u >= t.length) u = "";
|
|
8172
8176
|
else {
|
|
@@ -8174,32 +8178,32 @@ const V2 = (y) => {
|
|
|
8174
8178
|
u = l !== -1 ? t.substring(u, l) : t.substring(u);
|
|
8175
8179
|
}
|
|
8176
8180
|
var h = u;
|
|
8177
|
-
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l =
|
|
8178
|
-
if (u = s.toString(), !(
|
|
8181
|
+
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = _2.exec(h), h = I2.exec(h), l = l !== null || h !== null), !l || (u != null ? (u.charAt(0) === "+" && s.g(u), u = t.indexOf("tel:"), s.g(t.substring(0 <= u ? u + 4 : 0, t.indexOf(";phone-context=")))) : (u = s.g, l = t ?? "", h = l.search(g2), 0 <= h ? (l = l.substring(h), l = l.replace(m2, ""), h = l.search(C2), 0 <= h && (l = l.substring(0, h))) : l = "", u.call(s, l)), u = s.toString(), l = u.indexOf(";isub="), 0 < l && (B(s), s.g(u.substring(0, l))), !x1(s.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
8182
|
+
if (u = s.toString(), !(o1(e) || u != null && 0 < u.length && X.test(u))) throw Error("Invalid country calling code");
|
|
8179
8183
|
u = new V(), r && E(u, 5, t);
|
|
8180
8184
|
d: {
|
|
8181
8185
|
if (t = s.toString(), l = t.search(P1), 0 <= l && x1(t.substring(0, l))) {
|
|
8182
8186
|
h = t.match(P1);
|
|
8183
|
-
for (var
|
|
8184
|
-
B(s), s.g(t.substring(0, l)), t = h[
|
|
8187
|
+
for (var m = h.length, F = 1; F < m; ++F) if (h[F] != null && 0 < h[F].length) {
|
|
8188
|
+
B(s), s.g(t.substring(0, l)), t = h[F];
|
|
8185
8189
|
break d;
|
|
8186
8190
|
}
|
|
8187
8191
|
}
|
|
8188
8192
|
t = "";
|
|
8189
8193
|
}
|
|
8190
|
-
0 < t.length && E(u, 3, t), l = K(d,
|
|
8194
|
+
0 < t.length && E(u, 3, t), l = K(d, e), t = new T(), h = 0, m = s.toString();
|
|
8191
8195
|
try {
|
|
8192
|
-
h =
|
|
8196
|
+
h = H1(d, m, l, t, r, u);
|
|
8193
8197
|
} catch (_1) {
|
|
8194
|
-
if (_1.message == "Invalid country calling code" &&
|
|
8195
|
-
if (
|
|
8198
|
+
if (_1.message == "Invalid country calling code" && X.test(m)) {
|
|
8199
|
+
if (m = m.replace(X, ""), h = H1(d, m, l, t, r, u), h == 0) throw _1;
|
|
8196
8200
|
} else throw _1;
|
|
8197
8201
|
}
|
|
8198
|
-
if (h != 0 ? (s =
|
|
8202
|
+
if (h != 0 ? (s = t1(h), s != e && (l = Q(d, h, s))) : (B1(s), t.g(s.toString()), e != null ? (h = S(l, 10), E(
|
|
8199
8203
|
u,
|
|
8200
8204
|
1,
|
|
8201
8205
|
h
|
|
8202
|
-
)) : r && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && (
|
|
8206
|
+
)) : r && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && (e = new T(), s = new T(t.toString()), j1(s, l, e), d = l1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, r && 0 < e.toString().length && E(u, 7, e.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
8203
8207
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
8204
8208
|
if (1 < r.length && r.charAt(0) == "0") {
|
|
8205
8209
|
for (E(u, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
|
|
@@ -8210,44 +8214,44 @@ const V2 = (y) => {
|
|
|
8210
8214
|
function G(d, t) {
|
|
8211
8215
|
return !!((d = typeof d == "string" ? t.match("^(?:" + d + ")$") : t.match(d)) && d[0].length == t.length);
|
|
8212
8216
|
}
|
|
8213
|
-
function
|
|
8214
|
-
this.fa = RegExp(" "), this.ja = "", this.v = new
|
|
8217
|
+
function L2(d) {
|
|
8218
|
+
this.fa = RegExp(" "), this.ja = "", this.v = new T(), this.da = "", this.s = new T(), this.ba = new T(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new T(), this.ha = !1, this.o = "", this.g = new T(), this.j = [], this.ka = d, this.l = Y1(this, this.ka);
|
|
8215
8219
|
}
|
|
8216
|
-
var
|
|
8217
|
-
E(
|
|
8218
|
-
var
|
|
8219
|
-
function
|
|
8220
|
-
var
|
|
8221
|
-
return t =
|
|
8220
|
+
var z1 = new W();
|
|
8221
|
+
E(z1, 11, "NA");
|
|
8222
|
+
var N2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), Z1 = /[- ]/;
|
|
8223
|
+
function Y1(d, t) {
|
|
8224
|
+
var e = d.ga;
|
|
8225
|
+
return t = o1(t) ? V1(e, t) : 0, d = K(d.ga, t1(t)), d ?? z1;
|
|
8222
8226
|
}
|
|
8223
|
-
function
|
|
8224
|
-
for (var t = d.j.length,
|
|
8225
|
-
var r = d.j[
|
|
8227
|
+
function J1(d) {
|
|
8228
|
+
for (var t = d.j.length, e = 0; e < t; ++e) {
|
|
8229
|
+
var r = d.j[e], s = S(r, 1);
|
|
8226
8230
|
if (d.da == s) return !1;
|
|
8227
8231
|
var u = d, l = r, h = S(l, 1);
|
|
8228
8232
|
B(u.v);
|
|
8229
|
-
var
|
|
8233
|
+
var m = u;
|
|
8230
8234
|
l = S(l, 2);
|
|
8231
|
-
var
|
|
8232
|
-
if (
|
|
8235
|
+
var F = "999999999999999".match(h)[0];
|
|
8236
|
+
if (F.length < m.g.h.length ? m = "" : (m = F.replace(new RegExp(h, "g"), l), m = m.replace(RegExp("9", "g"), " ")), 0 < m.length ? (u.v.g(m), u = !0) : u = !1, u) return d.da = s, d.ha = Z1.test(p(r, 4)), d.$ = 0, !0;
|
|
8233
8237
|
}
|
|
8234
8238
|
return d.u = !1;
|
|
8235
8239
|
}
|
|
8236
|
-
function
|
|
8237
|
-
for (var
|
|
8240
|
+
function q1(d, t) {
|
|
8241
|
+
for (var e = [], r = t.length - 3, s = d.j.length, u = 0; u < s; ++u) {
|
|
8238
8242
|
var l = d.j[u];
|
|
8239
|
-
|
|
8243
|
+
U(l, 3) == 0 ? e.push(d.j[u]) : (l = p(l, 3, Math.min(r, U(l, 3) - 1)), t.search(l) == 0 && e.push(d.j[u]));
|
|
8240
8244
|
}
|
|
8241
|
-
d.j =
|
|
8245
|
+
d.j = e;
|
|
8242
8246
|
}
|
|
8243
|
-
function
|
|
8247
|
+
function T2(d, t) {
|
|
8244
8248
|
d.s.g(t);
|
|
8245
|
-
var
|
|
8246
|
-
if (D1.test(
|
|
8249
|
+
var e = t;
|
|
8250
|
+
if (D1.test(e) || d.s.h.length == 1 && p2.test(e) ? (t == "+" ? (e = t, d.ba.g(t)) : (e = g1[t], d.ba.g(e), d.g.g(e)), t = e) : (d.u = !1, d.la = !0), !d.u) {
|
|
8247
8251
|
if (!d.la) {
|
|
8248
|
-
if (
|
|
8249
|
-
if (
|
|
8250
|
-
} else if (0 < d.o.length && (t = d.g.toString(), B(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(),
|
|
8252
|
+
if (e2(d)) {
|
|
8253
|
+
if ($2(d)) return X1(d);
|
|
8254
|
+
} else if (0 < d.o.length && (t = d.g.toString(), B(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), e = t.lastIndexOf(d.o), B(d.h), d.h.g(t.substring(0, e))), d.o != t2(d)) return d.h.g(" "), X1(d);
|
|
8251
8255
|
}
|
|
8252
8256
|
return d.s.toString();
|
|
8253
8257
|
}
|
|
@@ -8257,96 +8261,96 @@ const V2 = (y) => {
|
|
|
8257
8261
|
case 2:
|
|
8258
8262
|
return d.s.toString();
|
|
8259
8263
|
case 3:
|
|
8260
|
-
if (
|
|
8261
|
-
else return d.o =
|
|
8264
|
+
if (e2(d)) d.ea = !0;
|
|
8265
|
+
else return d.o = t2(d), m1(d);
|
|
8262
8266
|
default:
|
|
8263
|
-
return d.ea ? (
|
|
8267
|
+
return d.ea ? ($2(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = n2(d, t), e = Q1(d), 0 < e.length ? e : (q1(d, d.g.toString()), J1(d) ? d2(d) : d.u ? h1(d, t) : d.s.toString())) : m1(d);
|
|
8264
8268
|
}
|
|
8265
8269
|
}
|
|
8266
|
-
function q1(d) {
|
|
8267
|
-
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, B(d.v), d.da = "", y1(d);
|
|
8268
|
-
}
|
|
8269
8270
|
function X1(d) {
|
|
8270
|
-
|
|
8271
|
+
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, B(d.v), d.da = "", m1(d);
|
|
8272
|
+
}
|
|
8273
|
+
function Q1(d) {
|
|
8274
|
+
for (var t = d.g.toString(), e = d.j.length, r = 0; r < e; ++r) {
|
|
8271
8275
|
var s = d.j[r], u = S(s, 1);
|
|
8272
|
-
if (new RegExp("^(?:" + u + ")$").test(t) && (d.ha =
|
|
8276
|
+
if (new RegExp("^(?:" + u + ")$").test(t) && (d.ha = Z1.test(p(s, 4)), s = t.replace(new RegExp(u, "g"), p(s, 2)), s = h1(d, s), s1(s, c2) == d.ba)) return s;
|
|
8273
8277
|
}
|
|
8274
8278
|
return "";
|
|
8275
8279
|
}
|
|
8276
8280
|
function h1(d, t) {
|
|
8277
|
-
var
|
|
8278
|
-
return d.ha && 0 <
|
|
8281
|
+
var e = d.h.h.length;
|
|
8282
|
+
return d.ha && 0 < e && d.h.toString().charAt(e - 1) != " " ? d.h + " " + t : d.h + t;
|
|
8279
8283
|
}
|
|
8280
|
-
function
|
|
8284
|
+
function m1(d) {
|
|
8281
8285
|
var t = d.g.toString();
|
|
8282
8286
|
if (3 <= t.length) {
|
|
8283
|
-
for (var
|
|
8284
|
-
var u =
|
|
8285
|
-
0 < d.o.length && O1(S(u, 4)) && !p(u, 6) && !R(u, 5) || (d.o.length != 0 || d.ca || O1(S(u, 4)) || p(u, 6)) &&
|
|
8287
|
+
for (var e = d.ca && d.o.length == 0 && 0 < U(d.l, 20) ? P(d.l, 20) : P(d.l, 19), r = e.length, s = 0; s < r; ++s) {
|
|
8288
|
+
var u = e[s];
|
|
8289
|
+
0 < d.o.length && O1(S(u, 4)) && !p(u, 6) && !R(u, 5) || (d.o.length != 0 || d.ca || O1(S(u, 4)) || p(u, 6)) && N2.test(S(u, 2)) && d.j.push(u);
|
|
8286
8290
|
}
|
|
8287
|
-
return
|
|
8291
|
+
return q1(d, t), t = Q1(d), 0 < t.length ? t : J1(d) ? d2(d) : d.s.toString();
|
|
8288
8292
|
}
|
|
8289
8293
|
return h1(d, t);
|
|
8290
8294
|
}
|
|
8291
|
-
function
|
|
8292
|
-
var t = d.g.toString(),
|
|
8293
|
-
if (0 <
|
|
8294
|
-
for (var r = "", s = 0; s <
|
|
8295
|
+
function d2(d) {
|
|
8296
|
+
var t = d.g.toString(), e = t.length;
|
|
8297
|
+
if (0 < e) {
|
|
8298
|
+
for (var r = "", s = 0; s < e; s++) r = n2(d, t.charAt(s));
|
|
8295
8299
|
return d.u ? h1(d, r) : d.s.toString();
|
|
8296
8300
|
}
|
|
8297
8301
|
return d.h.toString();
|
|
8298
8302
|
}
|
|
8299
|
-
function
|
|
8300
|
-
var t = d.g.toString(),
|
|
8303
|
+
function t2(d) {
|
|
8304
|
+
var t = d.g.toString(), e = 0;
|
|
8301
8305
|
if (p(d.l, 10) != 1) var r = !1;
|
|
8302
8306
|
else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
|
|
8303
|
-
return r ? (
|
|
8304
|
-
}
|
|
8305
|
-
function t2(d) {
|
|
8306
|
-
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
8307
|
-
return $ = t.match($), $ != null && $[0] != null && 0 < $[0].length ? (d.ca = !0, $ = $[0].length, B(d.g), d.g.g(t.substring($)), B(d.h), d.h.g(t.substring(0, $)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
|
|
8307
|
+
return r ? (e = 1, d.h.g("1").g(" "), d.ca = !0) : R(d.l, 15) && (r = new RegExp("^(?:" + p(d.l, 15) + ")"), r = t.match(r), r != null && r[0] != null && 0 < r[0].length && (d.ca = !0, e = r[0].length, d.h.g(t.substring(0, e)))), B(d.g), d.g.g(t.substring(e)), t.substring(0, e);
|
|
8308
8308
|
}
|
|
8309
8309
|
function e2(d) {
|
|
8310
|
+
var t = d.ba.toString(), e = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
8311
|
+
return e = t.match(e), e != null && e[0] != null && 0 < e[0].length ? (d.ca = !0, e = e[0].length, B(d.g), d.g.g(t.substring(e)), B(d.h), d.h.g(t.substring(0, e)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
|
|
8312
|
+
}
|
|
8313
|
+
function $2(d) {
|
|
8310
8314
|
if (d.g.h.length == 0) return !1;
|
|
8311
|
-
var t = new
|
|
8312
|
-
return
|
|
8313
|
-
}
|
|
8314
|
-
function
|
|
8315
|
-
var
|
|
8316
|
-
if (0 <=
|
|
8317
|
-
var r =
|
|
8318
|
-
return t =
|
|
8315
|
+
var t = new T(), e = K1(d.g, t);
|
|
8316
|
+
return e == 0 ? !1 : (B(d.g), d.g.g(t.toString()), t = t1(e), t == "001" ? d.l = K(d.ga, "" + e) : t != d.ka && (d.l = Y1(d, t)), d.h.g("" + e).g(" "), d.o = "", !0);
|
|
8317
|
+
}
|
|
8318
|
+
function n2(d, t) {
|
|
8319
|
+
var e = d.v.toString();
|
|
8320
|
+
if (0 <= e.substring(d.$).search(d.fa)) {
|
|
8321
|
+
var r = e.search(d.fa);
|
|
8322
|
+
return t = e.replace(d.fa, t), B(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
|
|
8319
8323
|
}
|
|
8320
8324
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8321
8325
|
}
|
|
8322
|
-
const
|
|
8323
|
-
|
|
8326
|
+
const y1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
|
|
8327
|
+
$("intlTelInputUtilsTemp", {}), $("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8324
8328
|
try {
|
|
8325
|
-
const
|
|
8329
|
+
const e = d.replace(/[^+0-9]/g, ""), r = new L2(t);
|
|
8326
8330
|
t = "";
|
|
8327
|
-
for (let s = 0; s <
|
|
8331
|
+
for (let s = 0; s < e.length; s++) r.ja = T2(r, e.charAt(s)), t = r.ja;
|
|
8328
8332
|
return t;
|
|
8329
8333
|
} catch {
|
|
8330
8334
|
return d;
|
|
8331
8335
|
}
|
|
8332
|
-
}),
|
|
8336
|
+
}), $("intlTelInputUtilsTemp.formatNumber", (d, t, e) => {
|
|
8333
8337
|
try {
|
|
8334
8338
|
const s = D.g(), u = z(s, d, t);
|
|
8335
|
-
var r =
|
|
8336
|
-
return r == 0 || r == 4 ? s.format(u, typeof
|
|
8339
|
+
var r = a1(s, u, -1);
|
|
8340
|
+
return r == 0 || r == 4 ? s.format(u, typeof e > "u" ? 0 : e) : d;
|
|
8337
8341
|
} catch {
|
|
8338
8342
|
return d;
|
|
8339
8343
|
}
|
|
8340
|
-
}),
|
|
8344
|
+
}), $("intlTelInputUtilsTemp.getExampleNumber", (d, t, e, r) => {
|
|
8341
8345
|
try {
|
|
8342
|
-
const
|
|
8346
|
+
const m = D.g();
|
|
8343
8347
|
d: {
|
|
8344
|
-
var s =
|
|
8345
|
-
if (
|
|
8346
|
-
var u =
|
|
8348
|
+
var s = m;
|
|
8349
|
+
if (o1(d)) {
|
|
8350
|
+
var u = u1(K(s, d), e);
|
|
8347
8351
|
try {
|
|
8348
8352
|
if (R(u, 6)) {
|
|
8349
|
-
var l = p(u, 6), h =
|
|
8353
|
+
var l = p(u, 6), h = W1(s, l, d, !1);
|
|
8350
8354
|
break d;
|
|
8351
8355
|
}
|
|
8352
8356
|
} catch {
|
|
@@ -8354,79 +8358,66 @@ const V2 = (y) => {
|
|
|
8354
8358
|
}
|
|
8355
8359
|
h = null;
|
|
8356
8360
|
}
|
|
8357
|
-
return
|
|
8361
|
+
return m.format(h, r ? 0 : t ? 2 : 1);
|
|
8358
8362
|
} catch {
|
|
8359
8363
|
return "";
|
|
8360
8364
|
}
|
|
8361
|
-
}),
|
|
8365
|
+
}), $("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
8362
8366
|
try {
|
|
8363
8367
|
return p(z(D.g(), d, t), 3);
|
|
8364
8368
|
} catch {
|
|
8365
8369
|
return "";
|
|
8366
8370
|
}
|
|
8367
|
-
}),
|
|
8371
|
+
}), $("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8368
8372
|
try {
|
|
8369
|
-
const
|
|
8370
|
-
|
|
8371
|
-
if (r == null) var s = -1;
|
|
8372
|
-
else {
|
|
8373
|
-
var u = t1(h);
|
|
8374
|
-
s = m1(u, r);
|
|
8375
|
-
}
|
|
8376
|
-
return s;
|
|
8373
|
+
const e = D.g(), r = z(e, d, t);
|
|
8374
|
+
return F1(e, r);
|
|
8377
8375
|
} catch {
|
|
8378
8376
|
return -99;
|
|
8379
8377
|
}
|
|
8380
|
-
}),
|
|
8378
|
+
}), $("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8381
8379
|
if (!t) return 1;
|
|
8382
8380
|
try {
|
|
8383
|
-
const
|
|
8384
|
-
return
|
|
8385
|
-
} catch (
|
|
8386
|
-
return
|
|
8381
|
+
const e = D.g(), r = z(e, d, t);
|
|
8382
|
+
return a1(e, r, -1);
|
|
8383
|
+
} catch (e) {
|
|
8384
|
+
return e.message === "Invalid country calling code" ? 1 : 3 >= d.length || e.message === "Phone number too short after IDD" || e.message === "The string supplied is too short to be a phone number" ? 2 : e.message === "The string supplied is too long to be a phone number" ? 3 : -99;
|
|
8387
8385
|
}
|
|
8388
|
-
}),
|
|
8386
|
+
}), $("intlTelInputUtilsTemp.isValidNumber", (d, t, e) => {
|
|
8389
8387
|
try {
|
|
8390
|
-
const
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
if (u == null || r != "001" && s != F1(d, r)) var l = !1;
|
|
8395
|
-
else {
|
|
8396
|
-
var h = t1($);
|
|
8397
|
-
l = m1(h, u) != -1;
|
|
8388
|
+
const r = D.g(), s = z(r, d, t), u = b2(r, s);
|
|
8389
|
+
if (e) {
|
|
8390
|
+
const l = e.map((h) => y1[h]);
|
|
8391
|
+
return u && l.includes(F1(r, s));
|
|
8398
8392
|
}
|
|
8399
|
-
return
|
|
8393
|
+
return u;
|
|
8400
8394
|
} catch {
|
|
8401
8395
|
return !1;
|
|
8402
8396
|
}
|
|
8403
|
-
}),
|
|
8397
|
+
}), $("intlTelInputUtilsTemp.isPossibleNumber", (d, t, e) => {
|
|
8404
8398
|
try {
|
|
8405
8399
|
const r = D.g(), s = z(r, d, t);
|
|
8406
|
-
if (
|
|
8407
|
-
|
|
8408
|
-
if (
|
|
8409
|
-
|
|
8410
|
-
return l || h || u;
|
|
8411
|
-
}
|
|
8412
|
-
return u;
|
|
8400
|
+
if (e) {
|
|
8401
|
+
e.includes("FIXED_LINE_OR_MOBILE") && (e.includes("MOBILE") || e.push("MOBILE"), e.includes("FIXED_LINE") || e.push("FIXED_LINE"));
|
|
8402
|
+
for (let u of e) if (a1(r, s, y1[u]) === 0) return !0;
|
|
8403
|
+
return !1;
|
|
8413
8404
|
}
|
|
8414
|
-
return
|
|
8405
|
+
return a1(r, s, -1) === 0;
|
|
8415
8406
|
} catch {
|
|
8416
8407
|
return !1;
|
|
8417
8408
|
}
|
|
8418
|
-
}),
|
|
8409
|
+
}), $("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
8419
8410
|
try {
|
|
8420
8411
|
return p(z(D.g(), d, t), 2).toString();
|
|
8421
8412
|
} catch {
|
|
8422
8413
|
return "";
|
|
8423
8414
|
}
|
|
8424
|
-
}),
|
|
8415
|
+
}), $("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), $("intlTelInputUtilsTemp.numberType", y1), $("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
8425
8416
|
})();
|
|
8426
|
-
const
|
|
8417
|
+
const j2 = window.intlTelInputUtilsTemp;
|
|
8427
8418
|
delete window.intlTelInputUtilsTemp;
|
|
8428
|
-
|
|
8429
|
-
const
|
|
8419
|
+
C.utils = j2;
|
|
8420
|
+
const z2 = {
|
|
8430
8421
|
__name: "IntlTelInputWithUtils",
|
|
8431
8422
|
props: /* @__PURE__ */ i2({
|
|
8432
8423
|
disabled: {
|
|
@@ -8458,8 +8449,8 @@ const j2 = {
|
|
|
8458
8449
|
"changeValidity",
|
|
8459
8450
|
"changeErrorCode"
|
|
8460
8451
|
], ["update:modelValue"]),
|
|
8461
|
-
setup(y, { expose:
|
|
8462
|
-
const
|
|
8452
|
+
setup(y, { expose: $, emit: n }) {
|
|
8453
|
+
const i = A2(y, "modelValue"), o = y, a = n, c = I1(), g = I1(), f = I1(!1), b = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, _ = () => {
|
|
8463
8454
|
let v = b();
|
|
8464
8455
|
f.value !== v && (f.value = v, a("changeValidity", !!v), a(
|
|
8465
8456
|
"changeErrorCode",
|
|
@@ -8472,29 +8463,29 @@ const j2 = {
|
|
|
8472
8463
|
var v;
|
|
8473
8464
|
a("changeCountry", ((v = g.value) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), I(), _();
|
|
8474
8465
|
};
|
|
8475
|
-
return
|
|
8476
|
-
c.value && (g.value =
|
|
8477
|
-
}),
|
|
8466
|
+
return E2(() => {
|
|
8467
|
+
c.value && (g.value = C(c.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled));
|
|
8468
|
+
}), D2(
|
|
8478
8469
|
() => o.disabled,
|
|
8479
8470
|
(v) => {
|
|
8480
|
-
var
|
|
8481
|
-
return (
|
|
8471
|
+
var N;
|
|
8472
|
+
return (N = g.value) == null ? void 0 : N.setDisabled(v);
|
|
8482
8473
|
}
|
|
8483
|
-
),
|
|
8474
|
+
), M2(() => {
|
|
8484
8475
|
var v;
|
|
8485
8476
|
return (v = g.value) == null ? void 0 : v.destroy();
|
|
8486
|
-
}),
|
|
8477
|
+
}), $({ instance: g, input: c }), (v, N) => P2((x2(), R2("input", B2({
|
|
8487
8478
|
ref_key: "input",
|
|
8488
8479
|
ref: c,
|
|
8489
|
-
"onUpdate:modelValue":
|
|
8480
|
+
"onUpdate:modelValue": N[0] || (N[0] = (M) => i.value = M),
|
|
8490
8481
|
type: "tel",
|
|
8491
8482
|
onCountrychange: L,
|
|
8492
8483
|
onInput: I
|
|
8493
8484
|
}, y.inputProps), null, 16)), [
|
|
8494
|
-
[
|
|
8485
|
+
[k2, i.value]
|
|
8495
8486
|
]);
|
|
8496
8487
|
}
|
|
8497
8488
|
};
|
|
8498
8489
|
export {
|
|
8499
|
-
|
|
8490
|
+
z2 as default
|
|
8500
8491
|
};
|