intl-tel-input 24.5.1 → 24.6.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 +51 -12
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +10 -5
- package/build/js/intlTelInput.js +78 -46
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +75 -47
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +6 -8
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +77 -45
- package/react/build/IntlTelInput.d.ts +10 -5
- package/react/build/IntlTelInput.js +77 -45
- package/react/build/IntlTelInputWithUtils.cjs +74 -46
- package/react/build/IntlTelInputWithUtils.js +74 -46
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +95 -74
- package/vue/build/IntlTelInputWithUtils.mjs +668 -651
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as
|
|
1
|
+
import { mergeModels as i2, useModel as T2, ref as I1, onMounted as N2, watch as A2, onUnmounted as E2, withDirectives as D2, openBlock as M2, createElementBlock as P2, mergeProps as x2, vModelText as R2 } from "vue";
|
|
2
2
|
const n2 = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
@@ -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
|
+
}, o2 = { ...B2, ...k2 };
|
|
1576
1576
|
for (let y = 0; y < H.length; y++)
|
|
1577
|
-
H[y].name =
|
|
1577
|
+
H[y].name = o2[H[y].iso2];
|
|
1578
1578
|
let O2 = 0;
|
|
1579
|
-
const
|
|
1579
|
+
const u2 = {
|
|
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,6 +1607,8 @@ const o2 = {
|
|
|
1607
1607
|
i18n: {},
|
|
1608
1608
|
//* Initial country.
|
|
1609
1609
|
initialCountry: "",
|
|
1610
|
+
//* Specify the path to the libphonenumber script to enable validation/formatting.
|
|
1611
|
+
loadUtilsOnInit: "",
|
|
1610
1612
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1611
1613
|
nationalMode: !0,
|
|
1612
1614
|
//* Display only these countries.
|
|
@@ -1627,7 +1629,7 @@ const o2 = {
|
|
|
1627
1629
|
navigator.userAgent
|
|
1628
1630
|
) || window.innerWidth <= 500
|
|
1629
1631
|
) : !1,
|
|
1630
|
-
//*
|
|
1632
|
+
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1631
1633
|
utilsScript: "",
|
|
1632
1634
|
//* The number type to enforce during validation.
|
|
1633
1635
|
validationNumberType: "MOBILE"
|
|
@@ -1649,46 +1651,46 @@ const o2 = {
|
|
|
1649
1651
|
"887",
|
|
1650
1652
|
"888",
|
|
1651
1653
|
"889"
|
|
1652
|
-
],
|
|
1653
|
-
const e =
|
|
1654
|
+
], f1 = (y) => y.replace(/\D/g, ""), r2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), s2 = (y) => {
|
|
1655
|
+
const e = f1(y);
|
|
1654
1656
|
if (e.charAt(0) === "1") {
|
|
1655
|
-
const
|
|
1656
|
-
return G2.indexOf(
|
|
1657
|
+
const i = e.substr(1, 3);
|
|
1658
|
+
return G2.indexOf(i) !== -1;
|
|
1657
1659
|
}
|
|
1658
1660
|
return !1;
|
|
1659
|
-
},
|
|
1660
|
-
if (
|
|
1661
|
+
}, U2 = (y, e, i, n) => {
|
|
1662
|
+
if (i === 0 && !n)
|
|
1661
1663
|
return 0;
|
|
1662
|
-
let
|
|
1664
|
+
let o = 0;
|
|
1663
1665
|
for (let a = 0; a < e.length; a++) {
|
|
1664
|
-
if (/[+0-9]/.test(e[a]) &&
|
|
1666
|
+
if (/[+0-9]/.test(e[a]) && o++, o === y && !n)
|
|
1665
1667
|
return a + 1;
|
|
1666
|
-
if (
|
|
1668
|
+
if (n && o === y + 1)
|
|
1667
1669
|
return a;
|
|
1668
1670
|
}
|
|
1669
1671
|
return e.length;
|
|
1670
|
-
},
|
|
1671
|
-
const
|
|
1672
|
-
return e && Object.entries(e).forEach(([
|
|
1673
|
-
}, $1 = (y) => {
|
|
1674
|
-
const { instances:
|
|
1675
|
-
Object.values(
|
|
1672
|
+
}, A = (y, e, i) => {
|
|
1673
|
+
const n = document.createElement(y);
|
|
1674
|
+
return e && Object.entries(e).forEach(([o, a]) => n.setAttribute(o, a)), i && i.appendChild(n), n;
|
|
1675
|
+
}, $1 = (y, ...e) => {
|
|
1676
|
+
const { instances: i } = m;
|
|
1677
|
+
Object.values(i).forEach((n) => n[y](...e));
|
|
1676
1678
|
};
|
|
1677
|
-
class
|
|
1678
|
-
constructor(e,
|
|
1679
|
-
this.id = O2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({},
|
|
1679
|
+
class F2 {
|
|
1680
|
+
constructor(e, i = {}) {
|
|
1681
|
+
this.id = O2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u2, i), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
|
|
1680
1682
|
}
|
|
1681
1683
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1682
1684
|
_init() {
|
|
1683
1685
|
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]");
|
|
1684
1686
|
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
1685
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !e : e, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...
|
|
1686
|
-
const
|
|
1687
|
-
this.resolveAutoCountryPromise =
|
|
1688
|
-
}),
|
|
1689
|
-
this.resolveUtilsScriptPromise =
|
|
1687
|
+
this.showSelectedCountryOnLeft = this.isRTL ? !e : e, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...o2, ...this.options.i18n };
|
|
1688
|
+
const i = new Promise((o, a) => {
|
|
1689
|
+
this.resolveAutoCountryPromise = o, this.rejectAutoCountryPromise = a;
|
|
1690
|
+
}), n = new Promise((o, a) => {
|
|
1691
|
+
this.resolveUtilsScriptPromise = o, this.rejectUtilsScriptPromise = a;
|
|
1690
1692
|
});
|
|
1691
|
-
this.promise = Promise.all([
|
|
1693
|
+
this.promise = Promise.all([i, n]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1692
1694
|
}
|
|
1693
1695
|
//********************
|
|
1694
1696
|
//* PRIVATE METHODS
|
|
@@ -1699,41 +1701,41 @@ class U2 {
|
|
|
1699
1701
|
}
|
|
1700
1702
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1701
1703
|
_sortCountries() {
|
|
1702
|
-
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e,
|
|
1703
|
-
const { countryOrder:
|
|
1704
|
-
if (
|
|
1705
|
-
const
|
|
1706
|
-
if (c ||
|
|
1707
|
-
return c &&
|
|
1704
|
+
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, i) => {
|
|
1705
|
+
const { countryOrder: n } = this.options;
|
|
1706
|
+
if (n) {
|
|
1707
|
+
const o = n.indexOf(e.iso2), a = n.indexOf(i.iso2), c = o > -1, g = a > -1;
|
|
1708
|
+
if (c || g)
|
|
1709
|
+
return c && g ? o - a : c ? -1 : 1;
|
|
1708
1710
|
}
|
|
1709
|
-
return e.name.localeCompare(
|
|
1711
|
+
return e.name.localeCompare(i.name);
|
|
1710
1712
|
});
|
|
1711
1713
|
}
|
|
1712
1714
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1713
|
-
_addToDialCodeMap(e,
|
|
1714
|
-
|
|
1715
|
-
for (let a = 0; a < this.dialCodeToIso2Map[
|
|
1716
|
-
if (this.dialCodeToIso2Map[
|
|
1715
|
+
_addToDialCodeMap(e, i, n) {
|
|
1716
|
+
i.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = i.length), this.dialCodeToIso2Map.hasOwnProperty(i) || (this.dialCodeToIso2Map[i] = []);
|
|
1717
|
+
for (let a = 0; a < this.dialCodeToIso2Map[i].length; a++)
|
|
1718
|
+
if (this.dialCodeToIso2Map[i][a] === e)
|
|
1717
1719
|
return;
|
|
1718
|
-
const
|
|
1719
|
-
this.dialCodeToIso2Map[
|
|
1720
|
+
const o = n !== void 0 ? n : this.dialCodeToIso2Map[i].length;
|
|
1721
|
+
this.dialCodeToIso2Map[i][o] = e;
|
|
1720
1722
|
}
|
|
1721
1723
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1722
1724
|
_processAllCountries() {
|
|
1723
|
-
const { onlyCountries: e, excludeCountries:
|
|
1725
|
+
const { onlyCountries: e, excludeCountries: i } = this.options;
|
|
1724
1726
|
if (e.length) {
|
|
1725
|
-
const
|
|
1726
|
-
(
|
|
1727
|
+
const n = e.map(
|
|
1728
|
+
(o) => o.toLowerCase()
|
|
1727
1729
|
);
|
|
1728
1730
|
this.countries = H.filter(
|
|
1729
|
-
(
|
|
1731
|
+
(o) => n.indexOf(o.iso2) > -1
|
|
1730
1732
|
);
|
|
1731
|
-
} else if (
|
|
1732
|
-
const
|
|
1733
|
-
(
|
|
1733
|
+
} else if (i.length) {
|
|
1734
|
+
const n = i.map(
|
|
1735
|
+
(o) => o.toLowerCase()
|
|
1734
1736
|
);
|
|
1735
1737
|
this.countries = H.filter(
|
|
1736
|
-
(
|
|
1738
|
+
(o) => n.indexOf(o.iso2) === -1
|
|
1737
1739
|
);
|
|
1738
1740
|
} else
|
|
1739
1741
|
this.countries = H;
|
|
@@ -1741,57 +1743,57 @@ class U2 {
|
|
|
1741
1743
|
//* Translate Countries by object literal provided on config.
|
|
1742
1744
|
_translateCountryNames() {
|
|
1743
1745
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1744
|
-
const
|
|
1745
|
-
this.options.i18n.hasOwnProperty(
|
|
1746
|
+
const i = this.countries[e].iso2.toLowerCase();
|
|
1747
|
+
this.options.i18n.hasOwnProperty(i) && (this.countries[e].name = this.options.i18n[i]);
|
|
1746
1748
|
}
|
|
1747
1749
|
}
|
|
1748
1750
|
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1749
1751
|
_processDialCodes() {
|
|
1750
1752
|
this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
|
|
1751
1753
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1752
|
-
const
|
|
1753
|
-
this.dialCodes[
|
|
1754
|
+
const i = this.countries[e];
|
|
1755
|
+
this.dialCodes[i.dialCode] || (this.dialCodes[i.dialCode] = !0), this._addToDialCodeMap(i.iso2, i.dialCode, i.priority);
|
|
1754
1756
|
}
|
|
1755
1757
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1756
|
-
const
|
|
1757
|
-
if (
|
|
1758
|
-
const
|
|
1759
|
-
for (let
|
|
1760
|
-
const a =
|
|
1758
|
+
const i = this.countries[e];
|
|
1759
|
+
if (i.areaCodes) {
|
|
1760
|
+
const n = this.dialCodeToIso2Map[i.dialCode][0];
|
|
1761
|
+
for (let o = 0; o < i.areaCodes.length; o++) {
|
|
1762
|
+
const a = i.areaCodes[o];
|
|
1761
1763
|
for (let c = 1; c < a.length; c++) {
|
|
1762
|
-
const
|
|
1763
|
-
this._addToDialCodeMap(
|
|
1764
|
+
const g = i.dialCode + a.substr(0, c);
|
|
1765
|
+
this._addToDialCodeMap(n, g), this._addToDialCodeMap(i.iso2, g);
|
|
1764
1766
|
}
|
|
1765
|
-
this._addToDialCodeMap(
|
|
1767
|
+
this._addToDialCodeMap(i.iso2, i.dialCode + a);
|
|
1766
1768
|
}
|
|
1767
1769
|
}
|
|
1768
1770
|
}
|
|
1769
1771
|
}
|
|
1770
1772
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1771
1773
|
_generateMarkup() {
|
|
1772
|
-
var
|
|
1774
|
+
var v;
|
|
1773
1775
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1774
1776
|
const {
|
|
1775
1777
|
allowDropdown: e,
|
|
1776
|
-
separateDialCode:
|
|
1777
|
-
showFlags:
|
|
1778
|
-
containerClass:
|
|
1778
|
+
separateDialCode: i,
|
|
1779
|
+
showFlags: n,
|
|
1780
|
+
containerClass: o,
|
|
1779
1781
|
hiddenInput: a,
|
|
1780
1782
|
dropdownContainer: c,
|
|
1781
|
-
fixDropdownWidth:
|
|
1782
|
-
useFullscreenPopup:
|
|
1783
|
+
fixDropdownWidth: g,
|
|
1784
|
+
useFullscreenPopup: f,
|
|
1783
1785
|
countrySearch: b,
|
|
1784
|
-
i18n:
|
|
1786
|
+
i18n: _
|
|
1785
1787
|
} = this.options;
|
|
1786
|
-
let
|
|
1787
|
-
e && (
|
|
1788
|
-
const
|
|
1789
|
-
if ((
|
|
1790
|
-
this.countryContainer =
|
|
1788
|
+
let I = "iti";
|
|
1789
|
+
e && (I += " iti--allow-dropdown"), n && (I += " iti--show-flags"), o && (I += ` ${o}`), f || (I += " iti--inline-dropdown");
|
|
1790
|
+
const L = A("div", { class: I });
|
|
1791
|
+
if ((v = this.telInput.parentNode) == null || v.insertBefore(L, this.telInput), e || n || i) {
|
|
1792
|
+
this.countryContainer = A(
|
|
1791
1793
|
"div",
|
|
1792
1794
|
{ class: "iti__country-container" },
|
|
1793
|
-
|
|
1794
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry =
|
|
1795
|
+
L
|
|
1796
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = A(
|
|
1795
1797
|
"button",
|
|
1796
1798
|
{
|
|
1797
1799
|
type: "button",
|
|
@@ -1803,105 +1805,105 @@ class U2 {
|
|
|
1803
1805
|
role: "combobox"
|
|
1804
1806
|
},
|
|
1805
1807
|
this.countryContainer
|
|
1806
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1808
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = A(
|
|
1807
1809
|
"div",
|
|
1808
1810
|
{ class: "iti__selected-country" },
|
|
1809
1811
|
this.countryContainer
|
|
1810
1812
|
);
|
|
1811
|
-
const
|
|
1812
|
-
if (this.selectedCountryInner =
|
|
1813
|
+
const T = A("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1814
|
+
if (this.selectedCountryInner = A("div", { class: "iti__flag" }, T), this.selectedCountryA11yText = A(
|
|
1813
1815
|
"span",
|
|
1814
1816
|
{ class: "iti__a11y-text" },
|
|
1815
1817
|
this.selectedCountryInner
|
|
1816
|
-
), e && (this.dropdownArrow =
|
|
1818
|
+
), e && (this.dropdownArrow = A(
|
|
1817
1819
|
"div",
|
|
1818
1820
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1819
|
-
|
|
1820
|
-
)),
|
|
1821
|
+
T
|
|
1822
|
+
)), i && (this.selectedDialCode = A(
|
|
1821
1823
|
"div",
|
|
1822
1824
|
{ class: "iti__selected-dial-code" },
|
|
1823
1825
|
this.selectedCountry
|
|
1824
1826
|
)), e) {
|
|
1825
|
-
const
|
|
1826
|
-
if (this.dropdownContent =
|
|
1827
|
+
const M = g ? "" : "iti--flexible-dropdown-width";
|
|
1828
|
+
if (this.dropdownContent = A("div", {
|
|
1827
1829
|
id: `iti-${this.id}__dropdown-content`,
|
|
1828
|
-
class: `iti__dropdown-content iti__hide ${
|
|
1829
|
-
}), b && (this.searchInput =
|
|
1830
|
+
class: `iti__dropdown-content iti__hide ${M}`
|
|
1831
|
+
}), b && (this.searchInput = A(
|
|
1830
1832
|
"input",
|
|
1831
1833
|
{
|
|
1832
1834
|
type: "text",
|
|
1833
1835
|
class: "iti__search-input",
|
|
1834
|
-
placeholder:
|
|
1836
|
+
placeholder: _.searchPlaceholder,
|
|
1835
1837
|
role: "combobox",
|
|
1836
1838
|
"aria-expanded": "true",
|
|
1837
|
-
"aria-label":
|
|
1839
|
+
"aria-label": _.searchPlaceholder,
|
|
1838
1840
|
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1839
1841
|
"aria-autocomplete": "list",
|
|
1840
1842
|
autocomplete: "off"
|
|
1841
1843
|
},
|
|
1842
1844
|
this.dropdownContent
|
|
1843
|
-
), this.searchResultsA11yText =
|
|
1845
|
+
), this.searchResultsA11yText = A(
|
|
1844
1846
|
"span",
|
|
1845
1847
|
{ class: "iti__a11y-text" },
|
|
1846
1848
|
this.dropdownContent
|
|
1847
|
-
)), this.countryList =
|
|
1849
|
+
)), this.countryList = A(
|
|
1848
1850
|
"ul",
|
|
1849
1851
|
{
|
|
1850
1852
|
class: "iti__country-list",
|
|
1851
1853
|
id: `iti-${this.id}__country-listbox`,
|
|
1852
1854
|
role: "listbox",
|
|
1853
|
-
"aria-label":
|
|
1855
|
+
"aria-label": _.countryListAriaLabel
|
|
1854
1856
|
},
|
|
1855
1857
|
this.dropdownContent
|
|
1856
1858
|
), this._appendListItems(), b && this._updateSearchResultsText(), c) {
|
|
1857
1859
|
let O = "iti iti--container";
|
|
1858
|
-
|
|
1860
|
+
f ? O += " iti--fullscreen-popup" : O += " iti--inline-dropdown", this.dropdown = A("div", { class: O }), this.dropdown.appendChild(this.dropdownContent);
|
|
1859
1861
|
} else
|
|
1860
1862
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1861
1863
|
}
|
|
1862
1864
|
}
|
|
1863
|
-
if (
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1865
|
+
if (L.appendChild(this.telInput), this._updateInputPadding(), a) {
|
|
1866
|
+
const T = this.telInput.getAttribute("name") || "", M = a(T);
|
|
1867
|
+
M.phone && (this.hiddenInput = A("input", {
|
|
1866
1868
|
type: "hidden",
|
|
1867
|
-
name:
|
|
1868
|
-
}),
|
|
1869
|
+
name: M.phone
|
|
1870
|
+
}), L.appendChild(this.hiddenInput)), M.country && (this.hiddenInputCountry = A("input", {
|
|
1869
1871
|
type: "hidden",
|
|
1870
|
-
name:
|
|
1871
|
-
}),
|
|
1872
|
+
name: M.country
|
|
1873
|
+
}), L.appendChild(this.hiddenInputCountry));
|
|
1872
1874
|
}
|
|
1873
1875
|
}
|
|
1874
1876
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1875
1877
|
_appendListItems() {
|
|
1876
1878
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1877
|
-
const
|
|
1879
|
+
const i = this.countries[e], n = e === 0 ? "iti__highlight" : "", o = A(
|
|
1878
1880
|
"li",
|
|
1879
1881
|
{
|
|
1880
|
-
id: `iti-${this.id}__item-${
|
|
1881
|
-
class: `iti__country ${
|
|
1882
|
+
id: `iti-${this.id}__item-${i.iso2}`,
|
|
1883
|
+
class: `iti__country ${n}`,
|
|
1882
1884
|
tabindex: "-1",
|
|
1883
1885
|
role: "option",
|
|
1884
|
-
"data-dial-code":
|
|
1885
|
-
"data-country-code":
|
|
1886
|
+
"data-dial-code": i.dialCode,
|
|
1887
|
+
"data-country-code": i.iso2,
|
|
1886
1888
|
"aria-selected": "false"
|
|
1887
1889
|
},
|
|
1888
1890
|
this.countryList
|
|
1889
1891
|
);
|
|
1890
|
-
|
|
1892
|
+
i.nodeById[this.id] = o;
|
|
1891
1893
|
let a = "";
|
|
1892
|
-
this.options.showFlags && (a += `<div class='iti__flag iti__${
|
|
1894
|
+
this.options.showFlags && (a += `<div class='iti__flag iti__${i.iso2}'></div>`), a += `<span class='iti__country-name'>${i.name}</span>`, a += `<span class='iti__dial-code'>+${i.dialCode}</span>`, o.insertAdjacentHTML("beforeend", a);
|
|
1893
1895
|
}
|
|
1894
1896
|
}
|
|
1895
1897
|
//* Set the initial state of the input value and the selected country by:
|
|
1896
1898
|
//* 1. Extracting a dial code from the given number
|
|
1897
1899
|
//* 2. Using explicit initialCountry
|
|
1898
1900
|
_setInitialState(e = !1) {
|
|
1899
|
-
const
|
|
1900
|
-
if (c && !
|
|
1901
|
+
const i = this.telInput.getAttribute("value"), n = this.telInput.value, a = i && i.charAt(0) === "+" && (!n || n.charAt(0) !== "+") ? i : n, c = this._getDialCode(a), g = s2(a), { initialCountry: f, geoIpLookup: b } = this.options, _ = f === "auto" && b;
|
|
1902
|
+
if (c && !g)
|
|
1901
1903
|
this._updateCountryFromNumber(a);
|
|
1902
|
-
else if (!
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1904
|
+
else if (!_ || e) {
|
|
1905
|
+
const I = f ? f.toLowerCase() : "";
|
|
1906
|
+
I && this._getCountryData(I, !0) ? this._setCountry(I) : c && g ? this._setCountry("us") : this._setCountry();
|
|
1905
1907
|
}
|
|
1906
1908
|
a && this._updateValFromNumber(a);
|
|
1907
1909
|
}
|
|
@@ -1921,14 +1923,14 @@ class U2 {
|
|
|
1921
1923
|
}
|
|
1922
1924
|
//* initialise the dropdown listeners.
|
|
1923
1925
|
_initDropdownListeners() {
|
|
1924
|
-
this._handleLabelClick = (
|
|
1925
|
-
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() :
|
|
1926
|
+
this._handleLabelClick = (i) => {
|
|
1927
|
+
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : i.preventDefault();
|
|
1926
1928
|
};
|
|
1927
1929
|
const e = this.telInput.closest("label");
|
|
1928
1930
|
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
1929
1931
|
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
1930
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (
|
|
1931
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(
|
|
1932
|
+
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (i) => {
|
|
1933
|
+
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), this._openDropdown()), i.key === "Tab" && this._closeDropdown();
|
|
1932
1934
|
}, this.countryContainer.addEventListener(
|
|
1933
1935
|
"keydown",
|
|
1934
1936
|
this._handleCountryContainerKeydown
|
|
@@ -1936,17 +1938,19 @@ class U2 {
|
|
|
1936
1938
|
}
|
|
1937
1939
|
//* Init many requests: utils script / geo ip lookup.
|
|
1938
1940
|
_initRequests() {
|
|
1939
|
-
|
|
1940
|
-
e &&
|
|
1941
|
-
|
|
1942
|
-
|
|
1941
|
+
let { loadUtilsOnInit: e, utilsScript: i, initialCountry: n, geoIpLookup: o } = this.options;
|
|
1942
|
+
!e && i && (console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."), e = i), e && !m.utils ? (this._handlePageLoad = () => {
|
|
1943
|
+
var c;
|
|
1944
|
+
window.removeEventListener("load", this._handlePageLoad), (c = m.loadUtils(e)) == null || c.catch(() => {
|
|
1945
|
+
});
|
|
1946
|
+
}, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), n === "auto" && o && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1943
1947
|
}
|
|
1944
1948
|
//* Perform the geo ip lookup.
|
|
1945
1949
|
_loadAutoCountry() {
|
|
1946
|
-
|
|
1950
|
+
m.autoCountry ? this.handleAutoCountry() : m.startedLoadingAutoCountry || (m.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1947
1951
|
(e = "") => {
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1952
|
+
const i = e.toLowerCase();
|
|
1953
|
+
i && this._getCountryData(i, !0) ? (m.autoCountry = i, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
|
|
1950
1954
|
},
|
|
1951
1955
|
() => {
|
|
1952
1956
|
this._setInitialState(!0), $1("rejectAutoCountryPromise");
|
|
@@ -1958,85 +1962,82 @@ class U2 {
|
|
|
1958
1962
|
}
|
|
1959
1963
|
//* Initialize the tel input listeners.
|
|
1960
1964
|
_initTelInputListeners() {
|
|
1961
|
-
const { strictMode: e, formatAsYouType:
|
|
1962
|
-
let
|
|
1963
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (
|
|
1964
|
-
if (this.isAndroid && (
|
|
1965
|
-
const
|
|
1966
|
-
this.telInput.value =
|
|
1965
|
+
const { strictMode: e, formatAsYouType: i, separateDialCode: n, formatOnDisplay: o, allowDropdown: a, countrySearch: c } = this.options;
|
|
1966
|
+
let g = !1;
|
|
1967
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (g = !0), this._handleInputEvent = (f) => {
|
|
1968
|
+
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && n && a && c) {
|
|
1969
|
+
const L = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, L - 1), T = this.telInput.value.substring(L);
|
|
1970
|
+
this.telInput.value = v + T, this._openDropdownWithPlus();
|
|
1967
1971
|
return;
|
|
1968
1972
|
}
|
|
1969
1973
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1970
|
-
const b = (
|
|
1971
|
-
b ||
|
|
1972
|
-
const
|
|
1973
|
-
if (
|
|
1974
|
-
const
|
|
1974
|
+
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 || _ && !e ? g = !0 : /[^+0-9]/.test(this.telInput.value) || (g = !1);
|
|
1976
|
+
const I = (f == null ? void 0 : f.detail) && f.detail.isSetNumber && !o;
|
|
1977
|
+
if (i && !g && !I) {
|
|
1978
|
+
const L = this.telInput.selectionStart || 0, T = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, M = (f == null ? void 0 : f.inputType) === "deleteContentForward", O = this._formatNumberAsYouType(), Z = U2(T, O, L, M);
|
|
1975
1979
|
this.telInput.value = O, this.telInput.setSelectionRange(Z, Z);
|
|
1976
1980
|
}
|
|
1977
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (e ||
|
|
1978
|
-
if (
|
|
1979
|
-
if (
|
|
1980
|
-
|
|
1981
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (e || n) && (this._handleKeydownEvent = (f) => {
|
|
1982
|
+
if (f.key && f.key.length === 1 && !f.altKey && !f.ctrlKey && !f.metaKey) {
|
|
1983
|
+
if (n && a && c && f.key === "+") {
|
|
1984
|
+
f.preventDefault(), this._openDropdownWithPlus();
|
|
1981
1985
|
return;
|
|
1982
1986
|
}
|
|
1983
1987
|
if (e) {
|
|
1984
|
-
const b = this.telInput.value, _ =
|
|
1985
|
-
|
|
1988
|
+
const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+", L = /^[0-9]$/.test(f.key), v = n ? L : I || L, T = b.slice(0, this.telInput.selectionStart) + f.key + b.slice(this.telInput.selectionEnd), M = this._getFullNumber(T), O = m.utils.getCoreNumber(M, this.selectedCountryData.iso2), Z = this.maxCoreNumberLength && O.length > this.maxCoreNumberLength;
|
|
1989
|
+
let i1 = !1;
|
|
1990
|
+
if (_) {
|
|
1991
|
+
const p1 = this.selectedCountryData.iso2;
|
|
1992
|
+
i1 = this._getCountryFromNumber(M) !== p1;
|
|
1993
|
+
}
|
|
1994
|
+
(!v || Z && !i1 && !I) && f.preventDefault();
|
|
1986
1995
|
}
|
|
1987
1996
|
}
|
|
1988
1997
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
1989
1998
|
}
|
|
1990
|
-
_isChangingDialCode(e) {
|
|
1991
|
-
const n = this.telInput.value;
|
|
1992
|
-
if (n.charAt(0) === "+") {
|
|
1993
|
-
const i = this.selectedCountryData.iso2, u = n.slice(0, this.telInput.selectionStart) + e + n.slice(this.telInput.selectionEnd), a = this._getFullNumber(u);
|
|
1994
|
-
return this._getCountryFromNumber(a) !== i;
|
|
1995
|
-
}
|
|
1996
|
-
return !1;
|
|
1997
|
-
}
|
|
1998
1999
|
//* Adhere to the input's maxlength attr.
|
|
1999
2000
|
_cap(e) {
|
|
2000
|
-
const
|
|
2001
|
-
return
|
|
2001
|
+
const i = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
2002
|
+
return i && e.length > i ? e.substr(0, i) : e;
|
|
2002
2003
|
}
|
|
2003
2004
|
//* Trigger a custom event on the input.
|
|
2004
|
-
_trigger(e,
|
|
2005
|
-
const
|
|
2005
|
+
_trigger(e, i = {}) {
|
|
2006
|
+
const n = new CustomEvent(e, {
|
|
2006
2007
|
bubbles: !0,
|
|
2007
2008
|
cancelable: !0,
|
|
2008
|
-
detail:
|
|
2009
|
+
detail: i
|
|
2009
2010
|
});
|
|
2010
|
-
this.telInput.dispatchEvent(
|
|
2011
|
+
this.telInput.dispatchEvent(n);
|
|
2011
2012
|
}
|
|
2012
2013
|
//* Open the dropdown.
|
|
2013
2014
|
_openDropdown() {
|
|
2014
|
-
const { fixDropdownWidth: e, countrySearch:
|
|
2015
|
-
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(),
|
|
2016
|
-
const
|
|
2017
|
-
|
|
2015
|
+
const { fixDropdownWidth: e, countrySearch: i } = this.options;
|
|
2016
|
+
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), i) {
|
|
2017
|
+
const n = this.countryList.firstElementChild;
|
|
2018
|
+
n && (this._highlightListItem(n, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2018
2019
|
}
|
|
2019
2020
|
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2020
2021
|
}
|
|
2021
2022
|
//* Set the dropdown position
|
|
2022
2023
|
_setDropdownPosition() {
|
|
2023
2024
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2024
|
-
const e = this.telInput.getBoundingClientRect(),
|
|
2025
|
-
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top +
|
|
2025
|
+
const e = this.telInput.getBoundingClientRect(), i = this.telInput.offsetHeight;
|
|
2026
|
+
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + i}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
|
|
2026
2027
|
}
|
|
2027
2028
|
}
|
|
2028
2029
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2029
2030
|
_bindDropdownListeners() {
|
|
2030
|
-
this._handleMouseoverCountryList = (
|
|
2031
|
+
this._handleMouseoverCountryList = (o) => {
|
|
2031
2032
|
var c;
|
|
2032
|
-
const a = (c =
|
|
2033
|
+
const a = (c = o.target) == null ? void 0 : c.closest(".iti__country");
|
|
2033
2034
|
a && this._highlightListItem(a, !1);
|
|
2034
2035
|
}, this.countryList.addEventListener(
|
|
2035
2036
|
"mouseover",
|
|
2036
2037
|
this._handleMouseoverCountryList
|
|
2037
|
-
), this._handleClickCountryList = (
|
|
2038
|
+
), this._handleClickCountryList = (o) => {
|
|
2038
2039
|
var c;
|
|
2039
|
-
const a = (c =
|
|
2040
|
+
const a = (c = o.target) == null ? void 0 : c.closest(".iti__country");
|
|
2040
2041
|
a && this._selectListItem(a);
|
|
2041
2042
|
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2042
2043
|
let e = !0;
|
|
@@ -2046,60 +2047,60 @@ class U2 {
|
|
|
2046
2047
|
"click",
|
|
2047
2048
|
this._handleClickOffToClose
|
|
2048
2049
|
);
|
|
2049
|
-
let
|
|
2050
|
-
if (this._handleKeydownOnDropdown = (
|
|
2051
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(
|
|
2052
|
-
|
|
2050
|
+
let i = "", n = null;
|
|
2051
|
+
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(), n && clearTimeout(n), i += o.key.toLowerCase(), this._searchForCountry(i), n = setTimeout(() => {
|
|
2053
|
+
i = "";
|
|
2053
2054
|
}, 1e3));
|
|
2054
2055
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2055
|
-
const
|
|
2056
|
+
const o = () => {
|
|
2056
2057
|
const c = this.searchInput.value.trim();
|
|
2057
2058
|
c ? this._filterCountries(c) : this._filterCountries("", !0);
|
|
2058
2059
|
};
|
|
2059
2060
|
let a = null;
|
|
2060
2061
|
this._handleSearchChange = () => {
|
|
2061
2062
|
a && clearTimeout(a), a = setTimeout(() => {
|
|
2062
|
-
|
|
2063
|
+
o(), a = null;
|
|
2063
2064
|
}, 100);
|
|
2064
2065
|
}, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", (c) => c.stopPropagation());
|
|
2065
2066
|
}
|
|
2066
2067
|
}
|
|
2067
2068
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2068
2069
|
_searchForCountry(e) {
|
|
2069
|
-
for (let
|
|
2070
|
-
const
|
|
2071
|
-
if (
|
|
2072
|
-
const a =
|
|
2070
|
+
for (let i = 0; i < this.countries.length; i++) {
|
|
2071
|
+
const n = this.countries[i];
|
|
2072
|
+
if (n.name.substr(0, e.length).toLowerCase() === e) {
|
|
2073
|
+
const a = n.nodeById[this.id];
|
|
2073
2074
|
this._highlightListItem(a, !1), this._scrollTo(a);
|
|
2074
2075
|
break;
|
|
2075
2076
|
}
|
|
2076
2077
|
}
|
|
2077
2078
|
}
|
|
2078
2079
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2079
|
-
_filterCountries(e,
|
|
2080
|
-
let
|
|
2080
|
+
_filterCountries(e, i = !1) {
|
|
2081
|
+
let n = !0;
|
|
2081
2082
|
this.countryList.innerHTML = "";
|
|
2082
|
-
const
|
|
2083
|
+
const o = r2(e);
|
|
2083
2084
|
for (let a = 0; a < this.countries.length; a++) {
|
|
2084
|
-
const c = this.countries[a],
|
|
2085
|
-
if (
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2085
|
+
const c = this.countries[a], g = r2(c.name), f = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((_) => _[0]).join("").toLowerCase(), b = `+${c.dialCode}`;
|
|
2086
|
+
if (i || g.includes(o) || b.includes(o) || c.iso2.includes(o) || f.includes(o)) {
|
|
2087
|
+
const _ = c.nodeById[this.id];
|
|
2088
|
+
_ && this.countryList.appendChild(_), n && (this._highlightListItem(_, !1), n = !1);
|
|
2088
2089
|
}
|
|
2089
2090
|
}
|
|
2090
|
-
|
|
2091
|
+
n && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
2091
2092
|
}
|
|
2092
2093
|
//* Update search results text (for a11y).
|
|
2093
2094
|
_updateSearchResultsText() {
|
|
2094
|
-
const { i18n: e } = this.options,
|
|
2095
|
-
let
|
|
2096
|
-
|
|
2095
|
+
const { i18n: e } = this.options, i = this.countryList.childElementCount;
|
|
2096
|
+
let n;
|
|
2097
|
+
i === 0 ? n = e.zeroSearchResults : i === 1 ? n = e.oneSearchResult : n = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = n;
|
|
2097
2098
|
}
|
|
2098
2099
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2099
2100
|
_handleUpDownKey(e) {
|
|
2100
|
-
var
|
|
2101
|
-
let
|
|
2102
|
-
!
|
|
2101
|
+
var n, o;
|
|
2102
|
+
let i = e === "ArrowUp" ? (n = this.highlightedItem) == null ? void 0 : n.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
|
|
2103
|
+
!i && this.countryList.childElementCount > 1 && (i = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), i && (this._scrollTo(i), this._highlightListItem(i, !1));
|
|
2103
2104
|
}
|
|
2104
2105
|
//* Select the currently highlighted item.
|
|
2105
2106
|
_handleEnterKey() {
|
|
@@ -2108,73 +2109,73 @@ class U2 {
|
|
|
2108
2109
|
//* Update the input's value to the given val (format first if possible)
|
|
2109
2110
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2110
2111
|
_updateValFromNumber(e) {
|
|
2111
|
-
let
|
|
2112
|
-
if (this.options.formatOnDisplay &&
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2115
|
-
|
|
2112
|
+
let i = e;
|
|
2113
|
+
if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
|
|
2114
|
+
const n = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: a } = m.utils.numberFormat, c = n ? o : a;
|
|
2115
|
+
i = m.utils.formatNumber(
|
|
2116
|
+
i,
|
|
2116
2117
|
this.selectedCountryData.iso2,
|
|
2117
2118
|
c
|
|
2118
2119
|
);
|
|
2119
2120
|
}
|
|
2120
|
-
|
|
2121
|
+
i = this._beforeSetNumber(i), this.telInput.value = i;
|
|
2121
2122
|
}
|
|
2122
2123
|
//* Check if need to select a new country based on the given number
|
|
2123
2124
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2124
2125
|
_updateCountryFromNumber(e) {
|
|
2125
|
-
const
|
|
2126
|
-
return
|
|
2126
|
+
const i = this._getCountryFromNumber(e);
|
|
2127
|
+
return i !== null ? this._setCountry(i) : !1;
|
|
2127
2128
|
}
|
|
2128
2129
|
_getCountryFromNumber(e) {
|
|
2129
|
-
const
|
|
2130
|
-
let
|
|
2131
|
-
const
|
|
2132
|
-
|
|
2133
|
-
const c = this._getDialCode(
|
|
2130
|
+
const i = e.indexOf("+");
|
|
2131
|
+
let n = i ? e.substring(i) : e;
|
|
2132
|
+
const o = this.selectedCountryData.dialCode;
|
|
2133
|
+
n && o === "1" && n.charAt(0) !== "+" && (n.charAt(0) !== "1" && (n = `1${n}`), n = `+${n}`), this.options.separateDialCode && o && n.charAt(0) !== "+" && (n = `+${o}${n}`);
|
|
2134
|
+
const c = this._getDialCode(n, !0), g = f1(n);
|
|
2134
2135
|
if (c) {
|
|
2135
|
-
const
|
|
2136
|
-
if (!(
|
|
2137
|
-
for (let
|
|
2138
|
-
if (
|
|
2139
|
-
return
|
|
2136
|
+
const f = this.dialCodeToIso2Map[f1(c)], b = f.indexOf(this.selectedCountryData.iso2) !== -1 && g.length <= c.length - 1;
|
|
2137
|
+
if (!(o === "1" && s2(g)) && !b) {
|
|
2138
|
+
for (let I = 0; I < f.length; I++)
|
|
2139
|
+
if (f[I])
|
|
2140
|
+
return f[I];
|
|
2140
2141
|
}
|
|
2141
2142
|
} else {
|
|
2142
|
-
if (
|
|
2143
|
+
if (n.charAt(0) === "+" && g.length)
|
|
2143
2144
|
return "";
|
|
2144
|
-
if ((!
|
|
2145
|
+
if ((!n || n === "+") && !this.selectedCountryData.iso2)
|
|
2145
2146
|
return this.defaultCountry;
|
|
2146
2147
|
}
|
|
2147
2148
|
return null;
|
|
2148
2149
|
}
|
|
2149
2150
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2150
|
-
_highlightListItem(e,
|
|
2151
|
-
const
|
|
2152
|
-
if (
|
|
2151
|
+
_highlightListItem(e, i) {
|
|
2152
|
+
const n = this.highlightedItem;
|
|
2153
|
+
if (n && (n.classList.remove("iti__highlight"), n.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
|
|
2153
2154
|
this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
|
|
2154
|
-
const
|
|
2155
|
-
this.selectedCountry.setAttribute("aria-activedescendant",
|
|
2155
|
+
const o = this.highlightedItem.getAttribute("id") || "";
|
|
2156
|
+
this.selectedCountry.setAttribute("aria-activedescendant", o), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", o);
|
|
2156
2157
|
}
|
|
2157
|
-
|
|
2158
|
+
i && this.highlightedItem.focus();
|
|
2158
2159
|
}
|
|
2159
2160
|
//* Find the country data for the given iso2 code
|
|
2160
2161
|
//* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
|
2161
|
-
_getCountryData(e,
|
|
2162
|
-
for (let
|
|
2163
|
-
if (this.countries[
|
|
2164
|
-
return this.countries[
|
|
2165
|
-
if (
|
|
2162
|
+
_getCountryData(e, i) {
|
|
2163
|
+
for (let n = 0; n < this.countries.length; n++)
|
|
2164
|
+
if (this.countries[n].iso2 === e)
|
|
2165
|
+
return this.countries[n];
|
|
2166
|
+
if (i)
|
|
2166
2167
|
return null;
|
|
2167
2168
|
throw new Error(`No country data for '${e}'`);
|
|
2168
2169
|
}
|
|
2169
2170
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2170
2171
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2171
2172
|
_setCountry(e) {
|
|
2172
|
-
const { separateDialCode:
|
|
2173
|
+
const { separateDialCode: i, showFlags: n, i18n: o } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2173
2174
|
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2174
|
-
let c = "",
|
|
2175
|
-
e &&
|
|
2175
|
+
let c = "", g = "";
|
|
2176
|
+
e && n ? (c = `iti__flag iti__${e}`, g = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (c = "iti__flag iti__globe", g = o.noCountrySelected), this.selectedCountryInner.className = c, this.selectedCountryA11yText.textContent = g;
|
|
2176
2177
|
}
|
|
2177
|
-
if (this._setSelectedCountryTitleAttribute(e,
|
|
2178
|
+
if (this._setSelectedCountryTitleAttribute(e, i), i) {
|
|
2178
2179
|
const c = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2179
2180
|
this.selectedDialCode.innerHTML = c, this._updateInputPadding();
|
|
2180
2181
|
}
|
|
@@ -2183,34 +2184,34 @@ class U2 {
|
|
|
2183
2184
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2184
2185
|
_updateInputPadding() {
|
|
2185
2186
|
if (this.selectedCountry) {
|
|
2186
|
-
const
|
|
2187
|
-
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${
|
|
2187
|
+
const i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
|
|
2188
|
+
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`;
|
|
2188
2189
|
}
|
|
2189
2190
|
}
|
|
2190
2191
|
//* Update the maximum valid number length for the currently selected country.
|
|
2191
2192
|
_updateMaxLength() {
|
|
2192
|
-
const { strictMode: e, placeholderNumberType:
|
|
2193
|
-
if (e &&
|
|
2194
|
-
if (
|
|
2195
|
-
const
|
|
2196
|
-
let
|
|
2197
|
-
|
|
2193
|
+
const { strictMode: e, placeholderNumberType: i, validationNumberType: n } = this.options, { iso2: o } = this.selectedCountryData;
|
|
2194
|
+
if (e && m.utils)
|
|
2195
|
+
if (o) {
|
|
2196
|
+
const a = m.utils.numberType[i];
|
|
2197
|
+
let c = m.utils.getExampleNumber(
|
|
2198
|
+
o,
|
|
2198
2199
|
!1,
|
|
2199
|
-
|
|
2200
|
+
a,
|
|
2200
2201
|
!0
|
|
2201
|
-
),
|
|
2202
|
-
for (;
|
|
2203
|
-
|
|
2204
|
-
const
|
|
2205
|
-
this.maxCoreNumberLength =
|
|
2202
|
+
), g = c;
|
|
2203
|
+
for (; m.utils.isPossibleNumber(c, o, n); )
|
|
2204
|
+
g = c, c += "0";
|
|
2205
|
+
const f = m.utils.getCoreNumber(g, o);
|
|
2206
|
+
this.maxCoreNumberLength = f.length, o === "by" && (this.maxCoreNumberLength = f.length + 1);
|
|
2206
2207
|
} else
|
|
2207
2208
|
this.maxCoreNumberLength = null;
|
|
2208
2209
|
}
|
|
2209
|
-
_setSelectedCountryTitleAttribute(e = null,
|
|
2210
|
+
_setSelectedCountryTitleAttribute(e = null, i) {
|
|
2210
2211
|
if (!this.selectedCountry)
|
|
2211
2212
|
return;
|
|
2212
|
-
let
|
|
2213
|
-
e && !
|
|
2213
|
+
let n;
|
|
2214
|
+
e && !i ? n = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? n = this.selectedCountryData.name : n = "Unknown", this.selectedCountry.setAttribute("title", n);
|
|
2214
2215
|
}
|
|
2215
2216
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2216
2217
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2220,12 +2221,12 @@ class U2 {
|
|
|
2220
2221
|
if (this.telInput.parentNode) {
|
|
2221
2222
|
const e = this.telInput.parentNode.cloneNode(!1);
|
|
2222
2223
|
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2223
|
-
const
|
|
2224
|
-
e.appendChild(
|
|
2225
|
-
const
|
|
2226
|
-
|
|
2227
|
-
const
|
|
2228
|
-
return document.body.removeChild(e),
|
|
2224
|
+
const i = this.countryContainer.cloneNode();
|
|
2225
|
+
e.appendChild(i);
|
|
2226
|
+
const n = this.selectedCountry.cloneNode(!0);
|
|
2227
|
+
i.appendChild(n);
|
|
2228
|
+
const o = n.offsetWidth;
|
|
2229
|
+
return document.body.removeChild(e), o;
|
|
2229
2230
|
}
|
|
2230
2231
|
return 0;
|
|
2231
2232
|
}
|
|
@@ -2233,26 +2234,26 @@ class U2 {
|
|
|
2233
2234
|
_updatePlaceholder() {
|
|
2234
2235
|
const {
|
|
2235
2236
|
autoPlaceholder: e,
|
|
2236
|
-
placeholderNumberType:
|
|
2237
|
-
nationalMode:
|
|
2238
|
-
customPlaceholder:
|
|
2237
|
+
placeholderNumberType: i,
|
|
2238
|
+
nationalMode: n,
|
|
2239
|
+
customPlaceholder: o
|
|
2239
2240
|
} = this.options, a = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2240
|
-
if (
|
|
2241
|
-
const c =
|
|
2242
|
-
let
|
|
2241
|
+
if (m.utils && a) {
|
|
2242
|
+
const c = m.utils.numberType[i];
|
|
2243
|
+
let g = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
|
|
2243
2244
|
this.selectedCountryData.iso2,
|
|
2244
|
-
|
|
2245
|
+
n,
|
|
2245
2246
|
c
|
|
2246
2247
|
) : "";
|
|
2247
|
-
|
|
2248
|
+
g = this._beforeSetNumber(g), typeof o == "function" && (g = o(g, this.selectedCountryData)), this.telInput.setAttribute("placeholder", g);
|
|
2248
2249
|
}
|
|
2249
2250
|
}
|
|
2250
2251
|
//* Called when the user selects a list item from the dropdown.
|
|
2251
2252
|
_selectListItem(e) {
|
|
2252
|
-
const
|
|
2253
|
+
const i = this._setCountry(
|
|
2253
2254
|
e.getAttribute("data-country-code")
|
|
2254
2255
|
);
|
|
2255
|
-
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(),
|
|
2256
|
+
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), i && this._triggerCountryChange();
|
|
2256
2257
|
}
|
|
2257
2258
|
//* Close the dropdown and unbind any listeners.
|
|
2258
2259
|
_closeDropdown() {
|
|
@@ -2262,69 +2263,69 @@ class U2 {
|
|
|
2262
2263
|
), this.countryList.removeEventListener(
|
|
2263
2264
|
"mouseover",
|
|
2264
2265
|
this._handleMouseoverCountryList
|
|
2265
|
-
), 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._trigger("close:countrydropdown");
|
|
2266
|
+
), 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");
|
|
2266
2267
|
}
|
|
2267
2268
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2268
2269
|
_scrollTo(e) {
|
|
2269
|
-
const
|
|
2270
|
-
if (
|
|
2271
|
-
|
|
2270
|
+
const i = this.countryList, n = document.documentElement.scrollTop, o = i.offsetHeight, a = i.getBoundingClientRect().top + n, c = a + o, g = e.offsetHeight, f = e.getBoundingClientRect().top + n, b = f + g, _ = f - a + i.scrollTop;
|
|
2271
|
+
if (f < a)
|
|
2272
|
+
i.scrollTop = _;
|
|
2272
2273
|
else if (b > c) {
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2274
|
+
const I = o - g;
|
|
2275
|
+
i.scrollTop = _ - I;
|
|
2275
2276
|
}
|
|
2276
2277
|
}
|
|
2277
2278
|
//* Replace any existing dial code with the new one
|
|
2278
2279
|
//* Note: called from _selectListItem and setCountry
|
|
2279
2280
|
_updateDialCode(e) {
|
|
2280
|
-
const
|
|
2281
|
-
let
|
|
2282
|
-
if (
|
|
2283
|
-
const a = this._getDialCode(
|
|
2284
|
-
a ?
|
|
2281
|
+
const i = this.telInput.value, n = `+${e}`;
|
|
2282
|
+
let o;
|
|
2283
|
+
if (i.charAt(0) === "+") {
|
|
2284
|
+
const a = this._getDialCode(i);
|
|
2285
|
+
a ? o = i.replace(a, n) : o = n, this.telInput.value = o;
|
|
2285
2286
|
}
|
|
2286
2287
|
}
|
|
2287
2288
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2288
2289
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2289
|
-
_getDialCode(e,
|
|
2290
|
-
let
|
|
2290
|
+
_getDialCode(e, i) {
|
|
2291
|
+
let n = "";
|
|
2291
2292
|
if (e.charAt(0) === "+") {
|
|
2292
|
-
let
|
|
2293
|
+
let o = "";
|
|
2293
2294
|
for (let a = 0; a < e.length; a++) {
|
|
2294
2295
|
const c = e.charAt(a);
|
|
2295
2296
|
if (!isNaN(parseInt(c, 10))) {
|
|
2296
|
-
if (
|
|
2297
|
-
this.dialCodeToIso2Map[
|
|
2298
|
-
else if (this.dialCodes[
|
|
2299
|
-
|
|
2297
|
+
if (o += c, i)
|
|
2298
|
+
this.dialCodeToIso2Map[o] && (n = e.substr(0, a + 1));
|
|
2299
|
+
else if (this.dialCodes[o]) {
|
|
2300
|
+
n = e.substr(0, a + 1);
|
|
2300
2301
|
break;
|
|
2301
2302
|
}
|
|
2302
|
-
if (
|
|
2303
|
+
if (o.length === this.dialCodeMaxLen)
|
|
2303
2304
|
break;
|
|
2304
2305
|
}
|
|
2305
2306
|
}
|
|
2306
2307
|
}
|
|
2307
|
-
return
|
|
2308
|
+
return n;
|
|
2308
2309
|
}
|
|
2309
2310
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2310
2311
|
_getFullNumber(e) {
|
|
2311
|
-
const
|
|
2312
|
-
let
|
|
2313
|
-
const a =
|
|
2314
|
-
return this.options.separateDialCode &&
|
|
2312
|
+
const i = e || this.telInput.value.trim(), { dialCode: n } = this.selectedCountryData;
|
|
2313
|
+
let o;
|
|
2314
|
+
const a = f1(i);
|
|
2315
|
+
return this.options.separateDialCode && i.charAt(0) !== "+" && n && a ? o = `+${n}` : o = "", o + i;
|
|
2315
2316
|
}
|
|
2316
2317
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2317
2318
|
_beforeSetNumber(e) {
|
|
2318
|
-
let
|
|
2319
|
+
let i = e;
|
|
2319
2320
|
if (this.options.separateDialCode) {
|
|
2320
|
-
let
|
|
2321
|
-
if (
|
|
2322
|
-
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2321
|
+
let n = this._getDialCode(i);
|
|
2322
|
+
if (n) {
|
|
2323
|
+
n = `+${this.selectedCountryData.dialCode}`;
|
|
2324
|
+
const o = i[n.length] === " " || i[n.length] === "-" ? n.length + 1 : n.length;
|
|
2325
|
+
i = i.substr(o);
|
|
2325
2326
|
}
|
|
2326
2327
|
}
|
|
2327
|
-
return this._cap(
|
|
2328
|
+
return this._cap(i);
|
|
2328
2329
|
}
|
|
2329
2330
|
//* Trigger the 'countrychange' event.
|
|
2330
2331
|
_triggerCountryChange() {
|
|
@@ -2332,19 +2333,19 @@ class U2 {
|
|
|
2332
2333
|
}
|
|
2333
2334
|
//* Format the number as the user types.
|
|
2334
2335
|
_formatNumberAsYouType() {
|
|
2335
|
-
const e = this._getFullNumber(),
|
|
2336
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" &&
|
|
2336
|
+
const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: n } = this.selectedCountryData;
|
|
2337
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${n}`) ? (i.split(`+${n}`)[1] || "").trim() : i;
|
|
2337
2338
|
}
|
|
2338
2339
|
//**************************
|
|
2339
2340
|
//* SECRET PUBLIC METHODS
|
|
2340
2341
|
//**************************
|
|
2341
2342
|
//* This is called when the geoip call returns.
|
|
2342
2343
|
handleAutoCountry() {
|
|
2343
|
-
this.options.initialCountry === "auto" &&
|
|
2344
|
+
this.options.initialCountry === "auto" && m.autoCountry && (this.defaultCountry = m.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2344
2345
|
}
|
|
2345
2346
|
//* This is called when the utils request completes.
|
|
2346
2347
|
handleUtils() {
|
|
2347
|
-
|
|
2348
|
+
m.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2348
2349
|
}
|
|
2349
2350
|
//********************
|
|
2350
2351
|
//* PUBLIC METHODS
|
|
@@ -2352,7 +2353,7 @@ class U2 {
|
|
|
2352
2353
|
//* Remove plugin.
|
|
2353
2354
|
destroy() {
|
|
2354
2355
|
var a, c;
|
|
2355
|
-
const { allowDropdown: e, separateDialCode:
|
|
2356
|
+
const { allowDropdown: e, separateDialCode: i } = this.options;
|
|
2356
2357
|
if (e) {
|
|
2357
2358
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2358
2359
|
"click",
|
|
@@ -2361,28 +2362,28 @@ class U2 {
|
|
|
2361
2362
|
"keydown",
|
|
2362
2363
|
this._handleCountryContainerKeydown
|
|
2363
2364
|
);
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2365
|
+
const g = this.telInput.closest("label");
|
|
2366
|
+
g && g.removeEventListener("click", this._handleLabelClick);
|
|
2366
2367
|
}
|
|
2367
|
-
const { form:
|
|
2368
|
-
this._handleHiddenInputSubmit &&
|
|
2369
|
-
const
|
|
2370
|
-
(a =
|
|
2368
|
+
const { form: n } = this.telInput;
|
|
2369
|
+
this._handleHiddenInputSubmit && n && n.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"), i && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2370
|
+
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 m.instances[this.id];
|
|
2371
2372
|
}
|
|
2372
2373
|
//* Get the extension from the current number.
|
|
2373
2374
|
getExtension() {
|
|
2374
|
-
return
|
|
2375
|
+
return m.utils ? m.utils.getExtension(
|
|
2375
2376
|
this._getFullNumber(),
|
|
2376
2377
|
this.selectedCountryData.iso2
|
|
2377
2378
|
) : "";
|
|
2378
2379
|
}
|
|
2379
2380
|
//* Format the number to the given format.
|
|
2380
2381
|
getNumber(e) {
|
|
2381
|
-
if (
|
|
2382
|
-
const { iso2:
|
|
2383
|
-
return
|
|
2382
|
+
if (m.utils) {
|
|
2383
|
+
const { iso2: i } = this.selectedCountryData;
|
|
2384
|
+
return m.utils.formatNumber(
|
|
2384
2385
|
this._getFullNumber(),
|
|
2385
|
-
|
|
2386
|
+
i,
|
|
2386
2387
|
e
|
|
2387
2388
|
);
|
|
2388
2389
|
}
|
|
@@ -2390,7 +2391,7 @@ class U2 {
|
|
|
2390
2391
|
}
|
|
2391
2392
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
2392
2393
|
getNumberType() {
|
|
2393
|
-
return
|
|
2394
|
+
return m.utils ? m.utils.getNumberType(
|
|
2394
2395
|
this._getFullNumber(),
|
|
2395
2396
|
this.selectedCountryData.iso2
|
|
2396
2397
|
) : -99;
|
|
@@ -2401,9 +2402,9 @@ class U2 {
|
|
|
2401
2402
|
}
|
|
2402
2403
|
//* Get the validation error.
|
|
2403
2404
|
getValidationError() {
|
|
2404
|
-
if (
|
|
2405
|
+
if (m.utils) {
|
|
2405
2406
|
const { iso2: e } = this.selectedCountryData;
|
|
2406
|
-
return
|
|
2407
|
+
return m.utils.getValidationError(this._getFullNumber(), e);
|
|
2407
2408
|
}
|
|
2408
2409
|
return -99;
|
|
2409
2410
|
}
|
|
@@ -2411,39 +2412,39 @@ class U2 {
|
|
|
2411
2412
|
isValidNumber() {
|
|
2412
2413
|
if (!this.selectedCountryData.iso2)
|
|
2413
2414
|
return !1;
|
|
2414
|
-
const e = this._getFullNumber(),
|
|
2415
|
-
if (
|
|
2416
|
-
const
|
|
2417
|
-
return
|
|
2415
|
+
const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u"));
|
|
2416
|
+
if (i > -1) {
|
|
2417
|
+
const n = e.substring(0, i), o = this._utilsIsPossibleNumber(n), a = this._utilsIsPossibleNumber(e);
|
|
2418
|
+
return o && a;
|
|
2418
2419
|
}
|
|
2419
2420
|
return this._utilsIsPossibleNumber(e);
|
|
2420
2421
|
}
|
|
2421
2422
|
_utilsIsPossibleNumber(e) {
|
|
2422
|
-
return
|
|
2423
|
+
return m.utils ? m.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberType) : null;
|
|
2423
2424
|
}
|
|
2424
2425
|
//* Validate the input val (precise)
|
|
2425
2426
|
isValidNumberPrecise() {
|
|
2426
2427
|
if (!this.selectedCountryData.iso2)
|
|
2427
2428
|
return !1;
|
|
2428
|
-
const e = this._getFullNumber(),
|
|
2429
|
-
if (
|
|
2430
|
-
const
|
|
2431
|
-
return
|
|
2429
|
+
const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u"));
|
|
2430
|
+
if (i > -1) {
|
|
2431
|
+
const n = e.substring(0, i), o = this._utilsIsValidNumber(n), a = this._utilsIsValidNumber(e);
|
|
2432
|
+
return o && a;
|
|
2432
2433
|
}
|
|
2433
2434
|
return this._utilsIsValidNumber(e);
|
|
2434
2435
|
}
|
|
2435
2436
|
_utilsIsValidNumber(e) {
|
|
2436
|
-
return
|
|
2437
|
+
return m.utils ? m.utils.isValidNumber(e, this.selectedCountryData.iso2) : null;
|
|
2437
2438
|
}
|
|
2438
2439
|
//* Update the selected country, and update the input val accordingly.
|
|
2439
2440
|
setCountry(e) {
|
|
2440
|
-
const
|
|
2441
|
-
(e &&
|
|
2441
|
+
const i = e == null ? void 0 : e.toLowerCase(), n = this.selectedCountryData.iso2;
|
|
2442
|
+
(e && i !== n || !e && n) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2442
2443
|
}
|
|
2443
2444
|
//* Set the input value and update the country.
|
|
2444
2445
|
setNumber(e) {
|
|
2445
|
-
const
|
|
2446
|
-
this._updateValFromNumber(e),
|
|
2446
|
+
const i = this._updateCountryFromNumber(e);
|
|
2447
|
+
this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
|
|
2447
2448
|
}
|
|
2448
2449
|
//* Set the placeholder number typ
|
|
2449
2450
|
setPlaceholderNumberType(e) {
|
|
@@ -2453,23 +2454,37 @@ class U2 {
|
|
|
2453
2454
|
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2454
2455
|
}
|
|
2455
2456
|
}
|
|
2456
|
-
const V2 = (y) =>
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2457
|
+
const V2 = (y) => {
|
|
2458
|
+
if (!m.utils && !m.startedLoadingUtilsScript) {
|
|
2459
|
+
let e;
|
|
2460
|
+
if (typeof y == "string")
|
|
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")
|
|
2463
|
+
try {
|
|
2464
|
+
if (e = y(), !(e instanceof Promise))
|
|
2465
|
+
throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof e}`);
|
|
2466
|
+
} catch (i) {
|
|
2467
|
+
return Promise.reject(i);
|
|
2468
|
+
}
|
|
2469
|
+
else
|
|
2470
|
+
return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof y}`));
|
|
2471
|
+
return m.startedLoadingUtilsScript = !0, e.then((i) => {
|
|
2472
|
+
const n = i == null ? void 0 : i.default;
|
|
2473
|
+
if (!n || typeof n != "object")
|
|
2474
|
+
throw typeof y == "string" ? new TypeError(`The module loaded from ${y} did not set utils as its default export.`) : new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
|
|
2475
|
+
return m.utils = n, $1("handleUtils"), !0;
|
|
2476
|
+
}).catch((i) => {
|
|
2477
|
+
throw $1("rejectUtilsScriptPromise", i), i;
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
return null;
|
|
2481
|
+
}, m = Object.assign(
|
|
2467
2482
|
(y, e) => {
|
|
2468
|
-
const
|
|
2469
|
-
return
|
|
2483
|
+
const i = new F2(y, e);
|
|
2484
|
+
return i._init(), y.setAttribute("data-intl-tel-input-id", i.id.toString()), m.instances[i.id] = i, i;
|
|
2470
2485
|
},
|
|
2471
2486
|
{
|
|
2472
|
-
defaults:
|
|
2487
|
+
defaults: u2,
|
|
2473
2488
|
//* Using a static var like this allows us to mock it in the tests.
|
|
2474
2489
|
documentReady: () => document.readyState === "complete",
|
|
2475
2490
|
//* Get the country data object.
|
|
@@ -2477,12 +2492,14 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2477
2492
|
//* A getter for the plugin instance.
|
|
2478
2493
|
getInstance: (y) => {
|
|
2479
2494
|
const e = y.getAttribute("data-intl-tel-input-id");
|
|
2480
|
-
return e ?
|
|
2495
|
+
return e ? m.instances[e] : null;
|
|
2481
2496
|
},
|
|
2482
2497
|
//* A map from instance ID to instance object.
|
|
2483
2498
|
instances: {},
|
|
2484
2499
|
loadUtils: V2,
|
|
2485
|
-
|
|
2500
|
+
startedLoadingUtilsScript: !1,
|
|
2501
|
+
startedLoadingAutoCountry: !1,
|
|
2502
|
+
version: "24.6.0"
|
|
2486
2503
|
}
|
|
2487
2504
|
);
|
|
2488
2505
|
(function() {
|
|
@@ -2491,23 +2508,23 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2491
2508
|
d = d.split(".");
|
|
2492
2509
|
var $ = y;
|
|
2493
2510
|
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
|
|
2494
|
-
for (var
|
|
2511
|
+
for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? $[r] && $[r] !== Object.prototype[r] ? $ = $[r] : $ = $[r] = {} : $[r] = t;
|
|
2495
2512
|
}
|
|
2496
|
-
function
|
|
2513
|
+
function i(d, t) {
|
|
2497
2514
|
function $() {
|
|
2498
2515
|
}
|
|
2499
|
-
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(
|
|
2516
|
+
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(r, s, u) {
|
|
2500
2517
|
for (var l = Array(arguments.length - 2), h = 2; h < arguments.length; h++) l[h - 2] = arguments[h];
|
|
2501
|
-
return t.prototype[
|
|
2518
|
+
return t.prototype[s].apply(r, l);
|
|
2502
2519
|
};
|
|
2503
2520
|
}
|
|
2504
|
-
function
|
|
2521
|
+
function n(d) {
|
|
2505
2522
|
const t = [];
|
|
2506
2523
|
let $ = 0;
|
|
2507
|
-
for (const
|
|
2524
|
+
for (const r in d) t[$++] = d[r];
|
|
2508
2525
|
return t;
|
|
2509
2526
|
}
|
|
2510
|
-
var
|
|
2527
|
+
var o = class {
|
|
2511
2528
|
constructor(d) {
|
|
2512
2529
|
if (a !== a) throw Error("SafeUrl is not meant to be built directly");
|
|
2513
2530
|
this.g = d;
|
|
@@ -2516,9 +2533,9 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2516
2533
|
return this.g.toString();
|
|
2517
2534
|
}
|
|
2518
2535
|
}, a = {};
|
|
2519
|
-
new
|
|
2536
|
+
new o("about:invalid#zClosurez"), new o("about:blank");
|
|
2520
2537
|
const c = {};
|
|
2521
|
-
class
|
|
2538
|
+
class g {
|
|
2522
2539
|
constructor() {
|
|
2523
2540
|
if (c !== c) throw Error("SafeStyle is not meant to be built directly");
|
|
2524
2541
|
}
|
|
@@ -2526,51 +2543,51 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2526
2543
|
return "";
|
|
2527
2544
|
}
|
|
2528
2545
|
}
|
|
2529
|
-
new
|
|
2530
|
-
const
|
|
2546
|
+
new g();
|
|
2547
|
+
const f = {};
|
|
2531
2548
|
class b {
|
|
2532
2549
|
constructor() {
|
|
2533
|
-
if (
|
|
2550
|
+
if (f !== f) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2534
2551
|
}
|
|
2535
2552
|
toString() {
|
|
2536
2553
|
return "";
|
|
2537
2554
|
}
|
|
2538
2555
|
}
|
|
2539
2556
|
new b();
|
|
2540
|
-
const
|
|
2541
|
-
class
|
|
2557
|
+
const _ = {};
|
|
2558
|
+
class I {
|
|
2542
2559
|
constructor() {
|
|
2543
2560
|
var t = y.trustedTypes && y.trustedTypes.emptyHTML || "";
|
|
2544
|
-
if (
|
|
2561
|
+
if (_ !== _) throw Error("SafeHtml is not meant to be built directly");
|
|
2545
2562
|
this.g = t;
|
|
2546
2563
|
}
|
|
2547
2564
|
toString() {
|
|
2548
2565
|
return this.g.toString();
|
|
2549
2566
|
}
|
|
2550
2567
|
}
|
|
2551
|
-
new
|
|
2552
|
-
function
|
|
2568
|
+
new I();
|
|
2569
|
+
function L(d, t) {
|
|
2553
2570
|
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
|
|
2554
|
-
case
|
|
2571
|
+
case M:
|
|
2555
2572
|
case O:
|
|
2556
2573
|
case Z:
|
|
2557
|
-
case
|
|
2574
|
+
case i1:
|
|
2558
2575
|
case p1:
|
|
2559
|
-
case
|
|
2560
|
-
case
|
|
2576
|
+
case T:
|
|
2577
|
+
case v:
|
|
2561
2578
|
this.o = !0;
|
|
2562
2579
|
}
|
|
2563
2580
|
this.j = t.defaultValue;
|
|
2564
2581
|
}
|
|
2565
|
-
var
|
|
2566
|
-
function
|
|
2582
|
+
var v = 1, T = 2, M = 3, O = 4, Z = 6, i1 = 16, p1 = 18;
|
|
2583
|
+
function v1(d, t) {
|
|
2567
2584
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2568
2585
|
var $ = t[d];
|
|
2569
2586
|
this.g[$.g] = $;
|
|
2570
2587
|
}
|
|
2571
2588
|
}
|
|
2572
2589
|
function l2(d) {
|
|
2573
|
-
return d =
|
|
2590
|
+
return d = n(d.g), d.sort(function(t, $) {
|
|
2574
2591
|
return t.g - $.g;
|
|
2575
2592
|
}), d;
|
|
2576
2593
|
}
|
|
@@ -2580,28 +2597,28 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2580
2597
|
x.prototype.has = function(d) {
|
|
2581
2598
|
return R(this, d.g);
|
|
2582
2599
|
}, x.prototype.get = function(d, t) {
|
|
2583
|
-
return
|
|
2600
|
+
return p(this, d.g, t);
|
|
2584
2601
|
}, x.prototype.set = function(d, t) {
|
|
2585
2602
|
E(this, d.g, t);
|
|
2586
2603
|
}, x.prototype.add = function(d, t) {
|
|
2587
|
-
|
|
2604
|
+
w1(this, d.g, t);
|
|
2588
2605
|
};
|
|
2589
|
-
function
|
|
2590
|
-
for (var $ = l2(d.m()),
|
|
2591
|
-
var
|
|
2592
|
-
if (R(t,
|
|
2593
|
-
d.g && delete d.g[
|
|
2594
|
-
var l =
|
|
2595
|
-
if (
|
|
2596
|
-
|
|
2597
|
-
for (var h = 0; h <
|
|
2598
|
-
} else
|
|
2606
|
+
function S1(d, t) {
|
|
2607
|
+
for (var $ = l2(d.m()), r = 0; r < $.length; r++) {
|
|
2608
|
+
var s = $[r], u = s.g;
|
|
2609
|
+
if (R(t, u)) {
|
|
2610
|
+
d.g && delete d.g[s.g];
|
|
2611
|
+
var l = s.h == 11 || s.h == 10;
|
|
2612
|
+
if (s.l) {
|
|
2613
|
+
s = P(t, u);
|
|
2614
|
+
for (var h = 0; h < s.length; h++) w1(d, u, l ? s[h].clone() : s[h]);
|
|
2615
|
+
} else s = n1(t, u), l ? (l = n1(d, u)) ? S1(l, s) : E(d, u, s.clone()) : E(d, u, s);
|
|
2599
2616
|
}
|
|
2600
2617
|
}
|
|
2601
2618
|
}
|
|
2602
2619
|
x.prototype.clone = function() {
|
|
2603
2620
|
var d = new this.constructor();
|
|
2604
|
-
return d != this && (d.h = {}, d.g && (d.g = {}),
|
|
2621
|
+
return d != this && (d.h = {}, d.g && (d.g = {}), S1(d, this)), d;
|
|
2605
2622
|
};
|
|
2606
2623
|
function R(d, t) {
|
|
2607
2624
|
return d.h[t] != null;
|
|
@@ -2611,23 +2628,23 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2611
2628
|
if ($ == null) return null;
|
|
2612
2629
|
if (d.l) {
|
|
2613
2630
|
if (!(t in d.g)) {
|
|
2614
|
-
var
|
|
2615
|
-
if ($ != null) if (
|
|
2616
|
-
for (var
|
|
2617
|
-
$ =
|
|
2618
|
-
} else $ =
|
|
2631
|
+
var r = d.l, s = d.j[t];
|
|
2632
|
+
if ($ != null) if (s.l) {
|
|
2633
|
+
for (var u = [], l = 0; l < $.length; l++) u[l] = r.h(s, $[l]);
|
|
2634
|
+
$ = u;
|
|
2635
|
+
} else $ = r.h(s, $);
|
|
2619
2636
|
return d.g[t] = $;
|
|
2620
2637
|
}
|
|
2621
2638
|
return d.g[t];
|
|
2622
2639
|
}
|
|
2623
2640
|
return $;
|
|
2624
2641
|
}
|
|
2625
|
-
function
|
|
2626
|
-
var
|
|
2627
|
-
return d.j[t].l ?
|
|
2642
|
+
function p(d, t, $) {
|
|
2643
|
+
var r = n1(d, t);
|
|
2644
|
+
return d.j[t].l ? r[$ || 0] : r;
|
|
2628
2645
|
}
|
|
2629
|
-
function
|
|
2630
|
-
if (R(d, t)) d =
|
|
2646
|
+
function S(d, t) {
|
|
2647
|
+
if (R(d, t)) d = p(d, t);
|
|
2631
2648
|
else d: {
|
|
2632
2649
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
2633
2650
|
else if (t === Number) d.j = 0;
|
|
@@ -2640,22 +2657,22 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2640
2657
|
}
|
|
2641
2658
|
return d;
|
|
2642
2659
|
}
|
|
2643
|
-
function
|
|
2660
|
+
function P(d, t) {
|
|
2644
2661
|
return n1(d, t) || [];
|
|
2645
2662
|
}
|
|
2646
|
-
function
|
|
2663
|
+
function F(d, t) {
|
|
2647
2664
|
return d.j[t].l ? R(d, t) ? d.h[t].length : 0 : R(d, t) ? 1 : 0;
|
|
2648
2665
|
}
|
|
2649
2666
|
function E(d, t, $) {
|
|
2650
2667
|
d.h[t] = $, d.g && (d.g[t] = $);
|
|
2651
2668
|
}
|
|
2652
|
-
function
|
|
2669
|
+
function w1(d, t, $) {
|
|
2653
2670
|
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
|
|
2654
2671
|
}
|
|
2655
|
-
function
|
|
2656
|
-
var $ = [],
|
|
2657
|
-
for (
|
|
2658
|
-
return new
|
|
2672
|
+
function r1(d, t) {
|
|
2673
|
+
var $ = [], r;
|
|
2674
|
+
for (r in t) r != 0 && $.push(new L(r, t[r]));
|
|
2675
|
+
return new v1(d, $);
|
|
2659
2676
|
}
|
|
2660
2677
|
function s1() {
|
|
2661
2678
|
}
|
|
@@ -2663,65 +2680,65 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2663
2680
|
throw new d.h(), Error("Unimplemented");
|
|
2664
2681
|
}, s1.prototype.h = function(d, t) {
|
|
2665
2682
|
if (d.h == 11 || d.h == 10) return t instanceof x ? t : this.g(d.s.prototype.m(), t);
|
|
2666
|
-
if (d.h == 14) return typeof t == "string" &&
|
|
2683
|
+
if (d.h == 14) return typeof t == "string" && b1.test(t) && (d = Number(t), 0 < d) ? d : t;
|
|
2667
2684
|
if (!d.o) return t;
|
|
2668
2685
|
if (d = d.s, d === String) {
|
|
2669
2686
|
if (typeof t == "number") return String(t);
|
|
2670
|
-
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" ||
|
|
2687
|
+
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || b1.test(t))) return Number(t);
|
|
2671
2688
|
return t;
|
|
2672
2689
|
};
|
|
2673
|
-
var
|
|
2690
|
+
var b1 = /^-?[0-9]+$/;
|
|
2674
2691
|
function g1() {
|
|
2675
2692
|
}
|
|
2676
|
-
|
|
2693
|
+
i(g1, s1), g1.prototype.g = function(d, t) {
|
|
2677
2694
|
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
|
|
2678
2695
|
};
|
|
2679
2696
|
function q() {
|
|
2680
2697
|
}
|
|
2681
|
-
|
|
2698
|
+
i(q, g1), q.prototype.h = function(d, t) {
|
|
2682
2699
|
return d.h == 8 ? !!t : s1.prototype.h.apply(this, arguments);
|
|
2683
2700
|
}, q.prototype.g = function(d, t) {
|
|
2684
2701
|
return q.ma.g.call(this, d, t);
|
|
2685
2702
|
};
|
|
2686
|
-
function
|
|
2703
|
+
function N(d, t) {
|
|
2687
2704
|
d != null && this.g.apply(this, arguments);
|
|
2688
2705
|
}
|
|
2689
|
-
|
|
2706
|
+
N.prototype.h = "", N.prototype.set = function(d) {
|
|
2690
2707
|
this.h = "" + d;
|
|
2691
|
-
},
|
|
2692
|
-
if (this.h += String(d), t != null) for (let
|
|
2708
|
+
}, N.prototype.g = function(d, t, $) {
|
|
2709
|
+
if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
|
|
2693
2710
|
return this;
|
|
2694
2711
|
};
|
|
2695
2712
|
function B(d) {
|
|
2696
2713
|
d.h = "";
|
|
2697
2714
|
}
|
|
2698
|
-
|
|
2715
|
+
N.prototype.toString = function() {
|
|
2699
2716
|
return this.h;
|
|
2700
2717
|
};
|
|
2701
2718
|
function j() {
|
|
2702
2719
|
x.call(this);
|
|
2703
2720
|
}
|
|
2704
|
-
|
|
2705
|
-
var
|
|
2721
|
+
i(j, x);
|
|
2722
|
+
var L1 = null;
|
|
2706
2723
|
function w() {
|
|
2707
2724
|
x.call(this);
|
|
2708
2725
|
}
|
|
2709
|
-
|
|
2710
|
-
var
|
|
2726
|
+
i(w, x);
|
|
2727
|
+
var T1 = null;
|
|
2711
2728
|
function W() {
|
|
2712
2729
|
x.call(this);
|
|
2713
2730
|
}
|
|
2714
|
-
|
|
2715
|
-
var
|
|
2731
|
+
i(W, x);
|
|
2732
|
+
var N1 = null;
|
|
2716
2733
|
j.prototype.m = function() {
|
|
2717
|
-
var d =
|
|
2718
|
-
return d || (
|
|
2734
|
+
var d = L1;
|
|
2735
|
+
return d || (L1 = d = r1(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;
|
|
2719
2736
|
}, j.m = j.prototype.m, w.prototype.m = function() {
|
|
2720
|
-
var d =
|
|
2721
|
-
return d || (
|
|
2737
|
+
var d = T1;
|
|
2738
|
+
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;
|
|
2722
2739
|
}, w.m = w.prototype.m, W.prototype.m = function() {
|
|
2723
|
-
var d =
|
|
2724
|
-
return d || (
|
|
2740
|
+
var d = N1;
|
|
2741
|
+
return d || (N1 = d = r1(W, {
|
|
2725
2742
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
2726
2743
|
1: { name: "general_desc", i: 11, type: w },
|
|
2727
2744
|
2: { name: "fixed_line", i: 11, type: w },
|
|
@@ -2762,11 +2779,11 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2762
2779
|
function V() {
|
|
2763
2780
|
x.call(this);
|
|
2764
2781
|
}
|
|
2765
|
-
|
|
2766
|
-
var
|
|
2782
|
+
i(V, x);
|
|
2783
|
+
var A1 = null, a2 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
|
|
2767
2784
|
V.prototype.m = function() {
|
|
2768
|
-
var d =
|
|
2769
|
-
return d || (
|
|
2785
|
+
var d = A1;
|
|
2786
|
+
return d || (A1 = d = r1(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: a2 }, 7: {
|
|
2770
2787
|
name: "preferred_domestic_carrier_code",
|
|
2771
2788
|
i: 9,
|
|
2772
2789
|
type: String
|
|
@@ -2988,7 +3005,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2988
3005
|
995: ["GE"],
|
|
2989
3006
|
996: ["KG"],
|
|
2990
3007
|
998: ["UZ"]
|
|
2991
|
-
},
|
|
3008
|
+
}, E1 = {
|
|
2992
3009
|
AC: [, [
|
|
2993
3010
|
,
|
|
2994
3011
|
,
|
|
@@ -8011,146 +8028,146 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8011
8028
|
X: "9",
|
|
8012
8029
|
Y: "9",
|
|
8013
8030
|
Z: "9"
|
|
8014
|
-
}, f2 = RegExp("[++]+"), Q = RegExp("^[++]+"),
|
|
8031
|
+
}, f2 = RegExp("[++]+"), Q = RegExp("^[++]+"), D1 = RegExp("([0-90-9٠-٩۰-۹])"), p2 = RegExp("[++0-90-9٠-٩۰-۹]"), g2 = /[\\\/] *x/, C2 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), m2 = /(?:.*?[A-Za-z]){3}.*/, y2 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), _2 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
|
|
8015
8032
|
function Y(d) {
|
|
8016
8033
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
8017
8034
|
}
|
|
8018
|
-
function
|
|
8035
|
+
function M1() {
|
|
8019
8036
|
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") + "#?");
|
|
8020
8037
|
}
|
|
8021
|
-
var
|
|
8022
|
-
function P1(d) {
|
|
8023
|
-
return 2 > d.length ? !1 : G(I2, d);
|
|
8024
|
-
}
|
|
8038
|
+
var P1 = new RegExp("(?:" + M1() + ")$", "i"), I2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + M1() + ")?$", "i"), v2 = /(\$\d)/, S2 = /^\(?\$1\)?$/;
|
|
8025
8039
|
function x1(d) {
|
|
8026
|
-
return
|
|
8040
|
+
return 2 > d.length ? !1 : G(I2, d);
|
|
8027
8041
|
}
|
|
8028
8042
|
function R1(d) {
|
|
8029
|
-
|
|
8030
|
-
B(d), d.g(t);
|
|
8043
|
+
return G(m2, d) ? o1(d, c2) : o1(d, C1);
|
|
8031
8044
|
}
|
|
8032
8045
|
function B1(d) {
|
|
8033
|
-
|
|
8046
|
+
var t = R1(d.toString());
|
|
8047
|
+
B(d), d.g(t);
|
|
8034
8048
|
}
|
|
8035
|
-
function
|
|
8036
|
-
|
|
8049
|
+
function k1(d) {
|
|
8050
|
+
return d != null && (F(d, 9) != 1 || P(d, 9)[0] != -1);
|
|
8051
|
+
}
|
|
8052
|
+
function o1(d, t) {
|
|
8053
|
+
for (var $ = new N(), r, s = d.length, u = 0; u < s; ++u) r = d.charAt(u), r = t[r.toUpperCase()], r != null && $.g(r);
|
|
8037
8054
|
return $.toString();
|
|
8038
8055
|
}
|
|
8039
|
-
function
|
|
8056
|
+
function O1(d) {
|
|
8040
8057
|
return d.length == 0 || S2.test(d);
|
|
8041
8058
|
}
|
|
8042
|
-
function
|
|
8043
|
-
return d != null && isNaN(d) && d.toUpperCase() in
|
|
8059
|
+
function u1(d) {
|
|
8060
|
+
return d != null && isNaN(d) && d.toUpperCase() in E1;
|
|
8044
8061
|
}
|
|
8045
8062
|
D.prototype.format = function(d, t) {
|
|
8046
|
-
if (
|
|
8047
|
-
var $ =
|
|
8063
|
+
if (p(d, 2) == 0 && R(d, 5)) {
|
|
8064
|
+
var $ = S(d, 5);
|
|
8048
8065
|
if (0 < $.length) return $;
|
|
8049
8066
|
}
|
|
8050
|
-
$ =
|
|
8051
|
-
var
|
|
8052
|
-
if (t == 0) return
|
|
8053
|
-
if (!($ in X)) return
|
|
8054
|
-
var
|
|
8055
|
-
d = R(d, 3) &&
|
|
8067
|
+
$ = S(d, 1);
|
|
8068
|
+
var r = t1(d);
|
|
8069
|
+
if (t == 0) return G1($, 0, r, "");
|
|
8070
|
+
if (!($ in X)) return r;
|
|
8071
|
+
var s = d1(this, $, e1($));
|
|
8072
|
+
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) : "";
|
|
8056
8073
|
d: {
|
|
8057
|
-
|
|
8058
|
-
for (var
|
|
8059
|
-
|
|
8060
|
-
var
|
|
8061
|
-
if ((
|
|
8062
|
-
|
|
8074
|
+
s = P(s, 20).length == 0 || t == 2 ? P(s, 19) : P(s, 20);
|
|
8075
|
+
for (var u, l = s.length, h = 0; h < l; ++h) {
|
|
8076
|
+
u = s[h];
|
|
8077
|
+
var C = F(u, 3);
|
|
8078
|
+
if ((C == 0 || r.search(p(u, 3, C - 1)) == 0) && (C = new RegExp(p(u, 1)), G(C, r))) {
|
|
8079
|
+
s = u;
|
|
8063
8080
|
break d;
|
|
8064
8081
|
}
|
|
8065
8082
|
}
|
|
8066
|
-
|
|
8083
|
+
s = null;
|
|
8067
8084
|
}
|
|
8068
|
-
return
|
|
8085
|
+
return s != null && (l = s, s = S(l, 2), u = new RegExp(p(l, 1)), S(
|
|
8069
8086
|
l,
|
|
8070
8087
|
5
|
|
8071
|
-
), l =
|
|
8088
|
+
), l = S(l, 4), r = t == 2 && l != null && 0 < l.length ? r.replace(u, s.replace(v2, l)) : r.replace(u, s), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), G1($, t, r, d);
|
|
8072
8089
|
};
|
|
8073
8090
|
function d1(d, t, $) {
|
|
8074
8091
|
return $ == "001" ? K(d, "" + t) : K(d, $);
|
|
8075
8092
|
}
|
|
8076
8093
|
function t1(d) {
|
|
8077
8094
|
if (!R(d, 2)) return "";
|
|
8078
|
-
var t = "" +
|
|
8079
|
-
return R(d, 4) &&
|
|
8095
|
+
var t = "" + p(d, 2);
|
|
8096
|
+
return R(d, 4) && p(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
|
|
8080
8097
|
}
|
|
8081
|
-
function
|
|
8098
|
+
function G1(d, t, $, r) {
|
|
8082
8099
|
switch (t) {
|
|
8083
8100
|
case 0:
|
|
8084
|
-
return "+" + d + $ +
|
|
8101
|
+
return "+" + d + $ + r;
|
|
8085
8102
|
case 1:
|
|
8086
|
-
return "+" + d + " " + $ +
|
|
8103
|
+
return "+" + d + " " + $ + r;
|
|
8087
8104
|
case 3:
|
|
8088
|
-
return "tel:+" + d + "-" + $ +
|
|
8105
|
+
return "tel:+" + d + "-" + $ + r;
|
|
8089
8106
|
default:
|
|
8090
|
-
return $ +
|
|
8107
|
+
return $ + r;
|
|
8091
8108
|
}
|
|
8092
8109
|
}
|
|
8093
|
-
function
|
|
8110
|
+
function l1(d, t) {
|
|
8094
8111
|
switch (t) {
|
|
8095
8112
|
case 4:
|
|
8096
|
-
return
|
|
8113
|
+
return p(d, 5);
|
|
8097
8114
|
case 3:
|
|
8098
|
-
return
|
|
8115
|
+
return p(d, 4);
|
|
8099
8116
|
case 1:
|
|
8100
|
-
return
|
|
8117
|
+
return p(d, 3);
|
|
8101
8118
|
case 0:
|
|
8102
8119
|
case 2:
|
|
8103
|
-
return
|
|
8120
|
+
return p(d, 2);
|
|
8104
8121
|
case 5:
|
|
8105
|
-
return
|
|
8122
|
+
return p(d, 6);
|
|
8106
8123
|
case 6:
|
|
8107
|
-
return
|
|
8124
|
+
return p(d, 8);
|
|
8108
8125
|
case 7:
|
|
8109
|
-
return
|
|
8126
|
+
return p(d, 7);
|
|
8110
8127
|
case 8:
|
|
8111
|
-
return
|
|
8128
|
+
return p(d, 21);
|
|
8112
8129
|
case 9:
|
|
8113
|
-
return
|
|
8130
|
+
return p(d, 25);
|
|
8114
8131
|
case 10:
|
|
8115
|
-
return
|
|
8132
|
+
return p(d, 28);
|
|
8116
8133
|
default:
|
|
8117
|
-
return
|
|
8134
|
+
return p(d, 1);
|
|
8118
8135
|
}
|
|
8119
8136
|
}
|
|
8120
8137
|
function m1(d, t) {
|
|
8121
|
-
return k(d,
|
|
8138
|
+
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;
|
|
8122
8139
|
}
|
|
8123
8140
|
function K(d, t) {
|
|
8124
8141
|
if (t == null) return null;
|
|
8125
8142
|
t = t.toUpperCase();
|
|
8126
8143
|
var $ = d.g[t];
|
|
8127
8144
|
if ($ == null) {
|
|
8128
|
-
if ($ =
|
|
8145
|
+
if ($ = E1[t], $ == null) return null;
|
|
8129
8146
|
$ = new q().g(W.m(), $), d.g[t] = $;
|
|
8130
8147
|
}
|
|
8131
8148
|
return $;
|
|
8132
8149
|
}
|
|
8133
8150
|
function k(d, t) {
|
|
8134
8151
|
var $ = d.length;
|
|
8135
|
-
return 0 <
|
|
8152
|
+
return 0 < F(t, 9) && P(t, 9).indexOf($) == -1 ? !1 : G(S(t, 2), d);
|
|
8136
8153
|
}
|
|
8137
|
-
function
|
|
8154
|
+
function U1(d, t) {
|
|
8138
8155
|
if (t == null) return null;
|
|
8139
|
-
var $ =
|
|
8156
|
+
var $ = S(t, 1);
|
|
8140
8157
|
if ($ = X[$], $ == null) d = null;
|
|
8141
8158
|
else if ($.length == 1) d = $[0];
|
|
8142
8159
|
else d: {
|
|
8143
8160
|
t = t1(t);
|
|
8144
|
-
for (var
|
|
8145
|
-
|
|
8146
|
-
var l = K(d,
|
|
8161
|
+
for (var r, s = $.length, u = 0; u < s; u++) {
|
|
8162
|
+
r = $[u];
|
|
8163
|
+
var l = K(d, r);
|
|
8147
8164
|
if (R(l, 23)) {
|
|
8148
|
-
if (t.search(
|
|
8149
|
-
d =
|
|
8165
|
+
if (t.search(p(l, 23)) == 0) {
|
|
8166
|
+
d = r;
|
|
8150
8167
|
break d;
|
|
8151
8168
|
}
|
|
8152
8169
|
} else if (m1(t, l) != -1) {
|
|
8153
|
-
d =
|
|
8170
|
+
d = r;
|
|
8154
8171
|
break d;
|
|
8155
8172
|
}
|
|
8156
8173
|
}
|
|
@@ -8163,146 +8180,146 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8163
8180
|
}
|
|
8164
8181
|
function F1(d, t) {
|
|
8165
8182
|
if (d = K(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8166
|
-
return
|
|
8183
|
+
return S(d, 10);
|
|
8167
8184
|
}
|
|
8168
|
-
function
|
|
8169
|
-
var
|
|
8170
|
-
if (
|
|
8171
|
-
else return
|
|
8172
|
-
return
|
|
8185
|
+
function a1(d, t, $, r) {
|
|
8186
|
+
var s = l1($, r), u = F(s, 9) == 0 ? P(p($, 1), 9) : P(s, 9);
|
|
8187
|
+
if (s = P(s, 10), r == 2) if (k1(l1($, 0))) d = l1($, 1), k1(d) && (u = u.concat(F(d, 9) == 0 ? P(p($, 1), 9) : P(d, 9)), u.sort(), s.length == 0 ? s = P(d, 10) : (s = s.concat(P(d, 10)), s.sort()));
|
|
8188
|
+
else return a1(d, t, $, 1);
|
|
8189
|
+
return u[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : ($ = u[0], $ == t ? 0 : $ > t ? 2 : u[u.length - 1] < t ? 3 : -1 < u.indexOf(t, 1) ? 0 : 5));
|
|
8173
8190
|
}
|
|
8174
8191
|
function J(d, t, $) {
|
|
8175
|
-
var
|
|
8176
|
-
return t =
|
|
8192
|
+
var r = t1(t);
|
|
8193
|
+
return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), a1(d, r, t, $)) : 1;
|
|
8177
8194
|
}
|
|
8178
|
-
function
|
|
8195
|
+
function V1(d, t) {
|
|
8179
8196
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8180
|
-
for (var $,
|
|
8197
|
+
for (var $, r = d.length, s = 1; 3 >= s && s <= r; ++s) if ($ = parseInt(d.substring(0, s), 10), $ in X) return t.g(d.substring(s)), $;
|
|
8181
8198
|
return 0;
|
|
8182
8199
|
}
|
|
8183
|
-
function
|
|
8200
|
+
function K1(d, t, $, r, s, u) {
|
|
8184
8201
|
if (t.length == 0) return 0;
|
|
8185
|
-
t = new
|
|
8202
|
+
t = new N(t);
|
|
8186
8203
|
var l;
|
|
8187
|
-
$ != null && (l =
|
|
8204
|
+
$ != null && (l = p($, 11)), l == null && (l = "NonMatch");
|
|
8188
8205
|
var h = t.toString();
|
|
8189
8206
|
if (h.length == 0) l = 20;
|
|
8190
|
-
else if (Q.test(h)) h = h.replace(Q, ""), B(t), t.g(
|
|
8207
|
+
else if (Q.test(h)) h = h.replace(Q, ""), B(t), t.g(R1(h)), l = 1;
|
|
8191
8208
|
else {
|
|
8192
|
-
if (h = new RegExp(l),
|
|
8209
|
+
if (h = new RegExp(l), B1(t), l = t.toString(), l.search(h) == 0) {
|
|
8193
8210
|
h = l.match(h)[0].length;
|
|
8194
|
-
var
|
|
8195
|
-
|
|
8211
|
+
var C = l.substring(h).match(D1);
|
|
8212
|
+
C && C[1] != null && 0 < C[1].length && o1(C[1], C1) == "0" ? l = !1 : (B(t), t.g(l.substring(h)), l = !0);
|
|
8196
8213
|
} else l = !1;
|
|
8197
8214
|
l = l ? 5 : 20;
|
|
8198
8215
|
}
|
|
8199
|
-
if (
|
|
8216
|
+
if (s && E(u, 6, l), l != 20) {
|
|
8200
8217
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8201
|
-
if (d =
|
|
8218
|
+
if (d = V1(t, r), d != 0) return E(u, 1, d), d;
|
|
8202
8219
|
throw Error("Invalid country calling code");
|
|
8203
8220
|
}
|
|
8204
|
-
return $ != null && (l =
|
|
8205
|
-
}
|
|
8206
|
-
function
|
|
8207
|
-
var
|
|
8208
|
-
if (
|
|
8209
|
-
var l = new RegExp("^(?:" +
|
|
8210
|
-
if (
|
|
8211
|
-
|
|
8212
|
-
var h = G(
|
|
8213
|
-
t =
|
|
8221
|
+
return $ != null && (l = S($, 10), h = "" + l, C = t.toString(), C.lastIndexOf(h, 0) == 0 && (h = new N(C.substring(h.length)), C = p($, 1), C = new RegExp(S(C, 2)), H1(h, $, null), h = h.toString(), !G(C, t.toString()) && G(C, h) || a1(d, t.toString(), $, -1) == 3)) ? (r.g(h), s && E(u, 6, 10), E(u, 1, l), l) : (E(u, 1, 0), 0);
|
|
8222
|
+
}
|
|
8223
|
+
function H1(d, t, $) {
|
|
8224
|
+
var r = d.toString(), s = r.length, u = p(t, 15);
|
|
8225
|
+
if (s != 0 && u != null && u.length != 0) {
|
|
8226
|
+
var l = new RegExp("^(?:" + u + ")");
|
|
8227
|
+
if (s = l.exec(r)) {
|
|
8228
|
+
u = new RegExp(S(p(t, 1), 2));
|
|
8229
|
+
var h = G(u, r), C = s.length - 1;
|
|
8230
|
+
t = p(t, 16), t == null || t.length == 0 || s[C] == null || s[C].length == 0 ? (!h || G(u, r.substring(s[0].length))) && ($ != null && 0 < C && s[C] != null && $.g(s[1]), d.set(r.substring(s[0].length))) : (r = r.replace(l, t), (!h || G(u, r)) && ($ != null && 0 < C && $.g(s[1]), d.set(r)));
|
|
8214
8231
|
}
|
|
8215
8232
|
}
|
|
8216
8233
|
}
|
|
8217
8234
|
function z(d, t, $) {
|
|
8218
|
-
if (!
|
|
8219
|
-
return
|
|
8235
|
+
if (!u1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8236
|
+
return j1(d, t, $, !0);
|
|
8220
8237
|
}
|
|
8221
|
-
function
|
|
8238
|
+
function j1(d, t, $, r) {
|
|
8222
8239
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8223
8240
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8224
|
-
var
|
|
8225
|
-
if (
|
|
8226
|
-
else if (
|
|
8241
|
+
var s = new N(), u = t.indexOf(";phone-context=");
|
|
8242
|
+
if (u === -1) u = null;
|
|
8243
|
+
else if (u += 15, u >= t.length) u = "";
|
|
8227
8244
|
else {
|
|
8228
|
-
var l = t.indexOf(";",
|
|
8229
|
-
|
|
8245
|
+
var l = t.indexOf(";", u);
|
|
8246
|
+
u = l !== -1 ? t.substring(u, l) : t.substring(u);
|
|
8230
8247
|
}
|
|
8231
|
-
var h =
|
|
8232
|
-
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = y2.exec(h), h = _2.exec(h), l = l !== null || h !== null), !l || (
|
|
8233
|
-
if (
|
|
8234
|
-
|
|
8248
|
+
var h = u;
|
|
8249
|
+
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = y2.exec(h), h = _2.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(p2), 0 <= h ? (l = l.substring(h), l = l.replace(C2, ""), h = l.search(g2), 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");
|
|
8250
|
+
if (u = s.toString(), !(u1($) || u != null && 0 < u.length && Q.test(u))) throw Error("Invalid country calling code");
|
|
8251
|
+
u = new V(), r && E(u, 5, t);
|
|
8235
8252
|
d: {
|
|
8236
|
-
if (t =
|
|
8237
|
-
h = t.match(
|
|
8238
|
-
for (var
|
|
8239
|
-
B(
|
|
8253
|
+
if (t = s.toString(), l = t.search(P1), 0 <= l && x1(t.substring(0, l))) {
|
|
8254
|
+
h = t.match(P1);
|
|
8255
|
+
for (var C = h.length, U = 1; U < C; ++U) if (h[U] != null && 0 < h[U].length) {
|
|
8256
|
+
B(s), s.g(t.substring(0, l)), t = h[U];
|
|
8240
8257
|
break d;
|
|
8241
8258
|
}
|
|
8242
8259
|
}
|
|
8243
8260
|
t = "";
|
|
8244
8261
|
}
|
|
8245
|
-
0 < t.length && E(
|
|
8262
|
+
0 < t.length && E(u, 3, t), l = K(d, $), t = new N(), h = 0, C = s.toString();
|
|
8246
8263
|
try {
|
|
8247
|
-
h =
|
|
8264
|
+
h = K1(d, C, l, t, r, u);
|
|
8248
8265
|
} catch (_1) {
|
|
8249
|
-
if (_1.message == "Invalid country calling code" && Q.test(
|
|
8250
|
-
if (
|
|
8266
|
+
if (_1.message == "Invalid country calling code" && Q.test(C)) {
|
|
8267
|
+
if (C = C.replace(Q, ""), h = K1(d, C, l, t, r, u), h == 0) throw _1;
|
|
8251
8268
|
} else throw _1;
|
|
8252
8269
|
}
|
|
8253
|
-
if (h != 0 ? (
|
|
8254
|
-
|
|
8270
|
+
if (h != 0 ? (s = e1(h), s != $ && (l = d1(d, h, s))) : (B1(s), t.g(s.toString()), $ != null ? (h = S(l, 10), E(
|
|
8271
|
+
u,
|
|
8255
8272
|
1,
|
|
8256
8273
|
h
|
|
8257
|
-
)) :
|
|
8274
|
+
)) : r && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && ($ = new N(), s = new N(t.toString()), H1(s, l, $), d = a1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, r && 0 < $.toString().length && E(u, 7, $.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
8258
8275
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
8259
|
-
if (1 <
|
|
8260
|
-
for (E(
|
|
8261
|
-
d != 1 && E(
|
|
8276
|
+
if (1 < r.length && r.charAt(0) == "0") {
|
|
8277
|
+
for (E(u, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
|
|
8278
|
+
d != 1 && E(u, 8, d);
|
|
8262
8279
|
}
|
|
8263
|
-
return E(
|
|
8280
|
+
return E(u, 2, parseInt(r, 10)), u;
|
|
8264
8281
|
}
|
|
8265
8282
|
function G(d, t) {
|
|
8266
8283
|
return !!((d = typeof d == "string" ? t.match("^(?:" + d + ")$") : t.match(d)) && d[0].length == t.length);
|
|
8267
8284
|
}
|
|
8268
8285
|
function w2(d) {
|
|
8269
|
-
this.fa = RegExp(" "), this.ja = "", this.v = new
|
|
8286
|
+
this.fa = RegExp(" "), this.ja = "", this.v = new N(), this.da = "", this.s = new N(), this.ba = new N(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new N(), this.ha = !1, this.o = "", this.g = new N(), this.j = [], this.ka = d, this.l = Z1(this, this.ka);
|
|
8270
8287
|
}
|
|
8271
|
-
var
|
|
8272
|
-
E(
|
|
8273
|
-
var b2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"),
|
|
8274
|
-
function
|
|
8288
|
+
var W1 = new W();
|
|
8289
|
+
E(W1, 11, "NA");
|
|
8290
|
+
var b2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), z1 = /[- ]/;
|
|
8291
|
+
function Z1(d, t) {
|
|
8275
8292
|
var $ = d.ga;
|
|
8276
|
-
return t =
|
|
8293
|
+
return t = u1(t) ? F1($, t) : 0, d = K(d.ga, e1(t)), d ?? W1;
|
|
8277
8294
|
}
|
|
8278
|
-
function
|
|
8295
|
+
function Y1(d) {
|
|
8279
8296
|
for (var t = d.j.length, $ = 0; $ < t; ++$) {
|
|
8280
|
-
var
|
|
8281
|
-
if (d.da ==
|
|
8282
|
-
var
|
|
8283
|
-
B(
|
|
8284
|
-
var
|
|
8285
|
-
l =
|
|
8286
|
-
var
|
|
8287
|
-
if (
|
|
8297
|
+
var r = d.j[$], s = S(r, 1);
|
|
8298
|
+
if (d.da == s) return !1;
|
|
8299
|
+
var u = d, l = r, h = S(l, 1);
|
|
8300
|
+
B(u.v);
|
|
8301
|
+
var C = u;
|
|
8302
|
+
l = S(l, 2);
|
|
8303
|
+
var U = "999999999999999".match(h)[0];
|
|
8304
|
+
if (U.length < C.g.h.length ? C = "" : (C = U.replace(new RegExp(h, "g"), l), C = C.replace(RegExp("9", "g"), " ")), 0 < C.length ? (u.v.g(C), u = !0) : u = !1, u) return d.da = s, d.ha = z1.test(p(r, 4)), d.$ = 0, !0;
|
|
8288
8305
|
}
|
|
8289
8306
|
return d.u = !1;
|
|
8290
8307
|
}
|
|
8291
|
-
function
|
|
8292
|
-
for (var $ = [],
|
|
8293
|
-
var l = d.j[
|
|
8294
|
-
|
|
8308
|
+
function J1(d, t) {
|
|
8309
|
+
for (var $ = [], r = t.length - 3, s = d.j.length, u = 0; u < s; ++u) {
|
|
8310
|
+
var l = d.j[u];
|
|
8311
|
+
F(l, 3) == 0 ? $.push(d.j[u]) : (l = p(l, 3, Math.min(r, F(l, 3) - 1)), t.search(l) == 0 && $.push(d.j[u]));
|
|
8295
8312
|
}
|
|
8296
8313
|
d.j = $;
|
|
8297
8314
|
}
|
|
8298
|
-
function
|
|
8315
|
+
function L2(d, t) {
|
|
8299
8316
|
d.s.g(t);
|
|
8300
8317
|
var $ = t;
|
|
8301
|
-
if (
|
|
8318
|
+
if (D1.test($) || d.s.h.length == 1 && f2.test($) ? (t == "+" ? ($ = t, d.ba.g(t)) : ($ = C1[t], d.ba.g($), d.g.g($)), t = $) : (d.u = !1, d.la = !0), !d.u) {
|
|
8302
8319
|
if (!d.la) {
|
|
8303
|
-
if (
|
|
8304
|
-
if (
|
|
8305
|
-
} 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(), $ = t.lastIndexOf(d.o), B(d.h), d.h.g(t.substring(0, $))), d.o !=
|
|
8320
|
+
if (t2(d)) {
|
|
8321
|
+
if (e2(d)) return q1(d);
|
|
8322
|
+
} 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(), $ = t.lastIndexOf(d.o), B(d.h), d.h.g(t.substring(0, $))), d.o != d2(d)) return d.h.g(" "), q1(d);
|
|
8306
8323
|
}
|
|
8307
8324
|
return d.s.toString();
|
|
8308
8325
|
}
|
|
@@ -8312,96 +8329,96 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8312
8329
|
case 2:
|
|
8313
8330
|
return d.s.toString();
|
|
8314
8331
|
case 3:
|
|
8315
|
-
if (
|
|
8316
|
-
else return d.o =
|
|
8332
|
+
if (t2(d)) d.ea = !0;
|
|
8333
|
+
else return d.o = d2(d), y1(d);
|
|
8317
8334
|
default:
|
|
8318
|
-
return d.ea ? (
|
|
8335
|
+
return d.ea ? (e2(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = $2(d, t), $ = X1(d), 0 < $.length ? $ : (J1(d, d.g.toString()), Y1(d) ? Q1(d) : d.u ? h1(d, t) : d.s.toString())) : y1(d);
|
|
8319
8336
|
}
|
|
8320
8337
|
}
|
|
8321
|
-
function
|
|
8338
|
+
function q1(d) {
|
|
8322
8339
|
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, B(d.v), d.da = "", y1(d);
|
|
8323
8340
|
}
|
|
8324
|
-
function
|
|
8325
|
-
for (var t = d.g.toString(), $ = d.j.length,
|
|
8326
|
-
var
|
|
8327
|
-
if (new RegExp("^(?:" +
|
|
8341
|
+
function X1(d) {
|
|
8342
|
+
for (var t = d.g.toString(), $ = d.j.length, r = 0; r < $; ++r) {
|
|
8343
|
+
var s = d.j[r], u = S(s, 1);
|
|
8344
|
+
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), o1(s, h2) == d.ba)) return s;
|
|
8328
8345
|
}
|
|
8329
8346
|
return "";
|
|
8330
8347
|
}
|
|
8331
|
-
function
|
|
8348
|
+
function h1(d, t) {
|
|
8332
8349
|
var $ = d.h.h.length;
|
|
8333
8350
|
return d.ha && 0 < $ && d.h.toString().charAt($ - 1) != " " ? d.h + " " + t : d.h + t;
|
|
8334
8351
|
}
|
|
8335
8352
|
function y1(d) {
|
|
8336
8353
|
var t = d.g.toString();
|
|
8337
8354
|
if (3 <= t.length) {
|
|
8338
|
-
for (var $ = d.ca && d.o.length == 0 && 0 <
|
|
8339
|
-
var
|
|
8340
|
-
0 < d.o.length &&
|
|
8355
|
+
for (var $ = d.ca && d.o.length == 0 && 0 < F(d.l, 20) ? P(d.l, 20) : P(d.l, 19), r = $.length, s = 0; s < r; ++s) {
|
|
8356
|
+
var u = $[s];
|
|
8357
|
+
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)) && b2.test(S(u, 2)) && d.j.push(u);
|
|
8341
8358
|
}
|
|
8342
|
-
return
|
|
8359
|
+
return J1(d, t), t = X1(d), 0 < t.length ? t : Y1(d) ? Q1(d) : d.s.toString();
|
|
8343
8360
|
}
|
|
8344
|
-
return
|
|
8361
|
+
return h1(d, t);
|
|
8345
8362
|
}
|
|
8346
|
-
function
|
|
8363
|
+
function Q1(d) {
|
|
8347
8364
|
var t = d.g.toString(), $ = t.length;
|
|
8348
8365
|
if (0 < $) {
|
|
8349
|
-
for (var
|
|
8350
|
-
return d.u ?
|
|
8366
|
+
for (var r = "", s = 0; s < $; s++) r = $2(d, t.charAt(s));
|
|
8367
|
+
return d.u ? h1(d, r) : d.s.toString();
|
|
8351
8368
|
}
|
|
8352
8369
|
return d.h.toString();
|
|
8353
8370
|
}
|
|
8354
|
-
function
|
|
8371
|
+
function d2(d) {
|
|
8355
8372
|
var t = d.g.toString(), $ = 0;
|
|
8356
|
-
if (
|
|
8357
|
-
else
|
|
8358
|
-
return
|
|
8373
|
+
if (p(d.l, 10) != 1) var r = !1;
|
|
8374
|
+
else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
|
|
8375
|
+
return r ? ($ = 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, $ = r[0].length, d.h.g(t.substring(0, $)))), B(d.g), d.g.g(t.substring($)), t.substring(0, $);
|
|
8359
8376
|
}
|
|
8360
|
-
function
|
|
8361
|
-
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" +
|
|
8377
|
+
function t2(d) {
|
|
8378
|
+
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
8362
8379
|
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;
|
|
8363
8380
|
}
|
|
8364
|
-
function
|
|
8381
|
+
function e2(d) {
|
|
8365
8382
|
if (d.g.h.length == 0) return !1;
|
|
8366
|
-
var t = new
|
|
8367
|
-
return $ == 0 ? !1 : (B(d.g), d.g.g(t.toString()), t = e1($), t == "001" ? d.l = K(d.ga, "" + $) : t != d.ka && (d.l =
|
|
8383
|
+
var t = new N(), $ = V1(d.g, t);
|
|
8384
|
+
return $ == 0 ? !1 : (B(d.g), d.g.g(t.toString()), t = e1($), t == "001" ? d.l = K(d.ga, "" + $) : t != d.ka && (d.l = Z1(d, t)), d.h.g("" + $).g(" "), d.o = "", !0);
|
|
8368
8385
|
}
|
|
8369
|
-
function
|
|
8386
|
+
function $2(d, t) {
|
|
8370
8387
|
var $ = d.v.toString();
|
|
8371
8388
|
if (0 <= $.substring(d.$).search(d.fa)) {
|
|
8372
|
-
var
|
|
8373
|
-
return t = $.replace(d.fa, t), B(d.v), d.v.g(t), d.$ =
|
|
8389
|
+
var r = $.search(d.fa);
|
|
8390
|
+
return t = $.replace(d.fa, t), B(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
|
|
8374
8391
|
}
|
|
8375
8392
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8376
8393
|
}
|
|
8377
|
-
const
|
|
8394
|
+
const c1 = { 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 };
|
|
8378
8395
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8379
8396
|
try {
|
|
8380
|
-
const $ = d.replace(/[^+0-9]/g, ""),
|
|
8397
|
+
const $ = d.replace(/[^+0-9]/g, ""), r = new w2(t);
|
|
8381
8398
|
t = "";
|
|
8382
|
-
for (let
|
|
8399
|
+
for (let s = 0; s < $.length; s++) r.ja = L2(r, $.charAt(s)), t = r.ja;
|
|
8383
8400
|
return t;
|
|
8384
8401
|
} catch {
|
|
8385
8402
|
return d;
|
|
8386
8403
|
}
|
|
8387
8404
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
|
|
8388
8405
|
try {
|
|
8389
|
-
const
|
|
8390
|
-
var
|
|
8391
|
-
return
|
|
8406
|
+
const s = D.g(), u = z(s, d, t);
|
|
8407
|
+
var r = J(s, u, -1);
|
|
8408
|
+
return r == 0 || r == 4 ? s.format(u, typeof $ > "u" ? 0 : $) : d;
|
|
8392
8409
|
} catch {
|
|
8393
8410
|
return d;
|
|
8394
8411
|
}
|
|
8395
|
-
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $,
|
|
8412
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, r) => {
|
|
8396
8413
|
try {
|
|
8397
|
-
const
|
|
8414
|
+
const C = D.g();
|
|
8398
8415
|
d: {
|
|
8399
|
-
var
|
|
8400
|
-
if (
|
|
8401
|
-
var
|
|
8416
|
+
var s = C;
|
|
8417
|
+
if (u1(d)) {
|
|
8418
|
+
var u = l1(K(s, d), $);
|
|
8402
8419
|
try {
|
|
8403
|
-
if (R(
|
|
8404
|
-
var l =
|
|
8420
|
+
if (R(u, 6)) {
|
|
8421
|
+
var l = p(u, 6), h = j1(s, l, d, !1);
|
|
8405
8422
|
break d;
|
|
8406
8423
|
}
|
|
8407
8424
|
} catch {
|
|
@@ -8409,47 +8426,47 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8409
8426
|
}
|
|
8410
8427
|
h = null;
|
|
8411
8428
|
}
|
|
8412
|
-
return
|
|
8429
|
+
return C.format(h, r ? 0 : t ? 2 : 1);
|
|
8413
8430
|
} catch {
|
|
8414
8431
|
return "";
|
|
8415
8432
|
}
|
|
8416
8433
|
}), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
8417
8434
|
try {
|
|
8418
|
-
return
|
|
8435
|
+
return p(z(D.g(), d, t), 3);
|
|
8419
8436
|
} catch {
|
|
8420
8437
|
return "";
|
|
8421
8438
|
}
|
|
8422
8439
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8423
8440
|
try {
|
|
8424
8441
|
const l = D.g(), h = z(l, d, t);
|
|
8425
|
-
var $ =
|
|
8426
|
-
if (
|
|
8442
|
+
var $ = U1(l, h), r = d1(l, S(h, 1), $);
|
|
8443
|
+
if (r == null) var s = -1;
|
|
8427
8444
|
else {
|
|
8428
|
-
var
|
|
8429
|
-
|
|
8445
|
+
var u = t1(h);
|
|
8446
|
+
s = m1(u, r);
|
|
8430
8447
|
}
|
|
8431
|
-
return
|
|
8448
|
+
return s;
|
|
8432
8449
|
} catch {
|
|
8433
8450
|
return -99;
|
|
8434
8451
|
}
|
|
8435
8452
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8436
8453
|
if (!t) return 1;
|
|
8437
8454
|
try {
|
|
8438
|
-
const $ = D.g(),
|
|
8439
|
-
return J($,
|
|
8455
|
+
const $ = D.g(), r = z($, d, t);
|
|
8456
|
+
return J($, r, -1);
|
|
8440
8457
|
} catch ($) {
|
|
8441
8458
|
return $.message === "Invalid country calling code" ? 1 : 3 >= d.length || $.message === "Phone number too short after IDD" || $.message === "The string supplied is too short to be a phone number" ? 2 : $.message === "The string supplied is too long to be a phone number" ? 3 : -99;
|
|
8442
8459
|
}
|
|
8443
8460
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t) => {
|
|
8444
8461
|
try {
|
|
8445
|
-
const
|
|
8446
|
-
var $ = z(
|
|
8447
|
-
d =
|
|
8448
|
-
var
|
|
8449
|
-
if (
|
|
8462
|
+
const C = D.g();
|
|
8463
|
+
var $ = z(C, d, t), r = U1(C, $);
|
|
8464
|
+
d = C;
|
|
8465
|
+
var s = S($, 1), u = d1(d, s, r);
|
|
8466
|
+
if (u == null || r != "001" && s != F1(d, r)) var l = !1;
|
|
8450
8467
|
else {
|
|
8451
8468
|
var h = t1($);
|
|
8452
|
-
l = m1(h,
|
|
8469
|
+
l = m1(h, u) != -1;
|
|
8453
8470
|
}
|
|
8454
8471
|
return l;
|
|
8455
8472
|
} catch {
|
|
@@ -8457,33 +8474,33 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8457
8474
|
}
|
|
8458
8475
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
|
|
8459
8476
|
try {
|
|
8460
|
-
const
|
|
8477
|
+
const r = D.g(), s = z(r, d, t);
|
|
8461
8478
|
if ($) {
|
|
8462
|
-
const
|
|
8479
|
+
const u = J(r, s, c1[$]) === 0;
|
|
8463
8480
|
if ($ === "FIXED_LINE_OR_MOBILE") {
|
|
8464
|
-
const l = J(
|
|
8465
|
-
return l || h ||
|
|
8481
|
+
const l = J(r, s, c1.MOBILE) === 0, h = J(r, s, c1.FIXED_LINE) === 0;
|
|
8482
|
+
return l || h || u;
|
|
8466
8483
|
}
|
|
8467
|
-
return
|
|
8484
|
+
return u;
|
|
8468
8485
|
}
|
|
8469
|
-
return J(
|
|
8486
|
+
return J(r, s, -1) === 0;
|
|
8470
8487
|
} catch {
|
|
8471
8488
|
return !1;
|
|
8472
8489
|
}
|
|
8473
8490
|
}), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
8474
8491
|
try {
|
|
8475
|
-
return
|
|
8492
|
+
return p(z(D.g(), d, t), 2).toString();
|
|
8476
8493
|
} catch {
|
|
8477
8494
|
return "";
|
|
8478
8495
|
}
|
|
8479
|
-
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType",
|
|
8496
|
+
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", c1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
8480
8497
|
})();
|
|
8481
8498
|
const K2 = window.intlTelInputUtilsTemp;
|
|
8482
8499
|
delete window.intlTelInputUtilsTemp;
|
|
8483
|
-
|
|
8500
|
+
m.utils = K2;
|
|
8484
8501
|
const j2 = {
|
|
8485
8502
|
__name: "IntlTelInputWithUtils",
|
|
8486
|
-
props: /* @__PURE__ */
|
|
8503
|
+
props: /* @__PURE__ */ i2({
|
|
8487
8504
|
disabled: {
|
|
8488
8505
|
type: Boolean,
|
|
8489
8506
|
default: !1
|
|
@@ -8507,46 +8524,46 @@ const j2 = {
|
|
|
8507
8524
|
},
|
|
8508
8525
|
modelModifiers: {}
|
|
8509
8526
|
}),
|
|
8510
|
-
emits: /* @__PURE__ */
|
|
8527
|
+
emits: /* @__PURE__ */ i2([
|
|
8511
8528
|
"changeNumber",
|
|
8512
8529
|
"changeCountry",
|
|
8513
8530
|
"changeValidity",
|
|
8514
8531
|
"changeErrorCode"
|
|
8515
8532
|
], ["update:modelValue"]),
|
|
8516
|
-
setup(y, { expose: e, emit:
|
|
8517
|
-
const
|
|
8518
|
-
let
|
|
8519
|
-
|
|
8533
|
+
setup(y, { expose: e, emit: i }) {
|
|
8534
|
+
const n = T2(y, "modelValue"), o = y, a = i, c = I1(), g = I1(), f = I1(!1), b = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, _ = () => {
|
|
8535
|
+
let v = b();
|
|
8536
|
+
f.value !== v && (f.value = v, a("changeValidity", !!v), a(
|
|
8520
8537
|
"changeErrorCode",
|
|
8521
|
-
|
|
8538
|
+
v ? null : g.value.getValidationError()
|
|
8522
8539
|
));
|
|
8523
|
-
},
|
|
8524
|
-
var
|
|
8525
|
-
a("changeNumber", ((
|
|
8526
|
-
},
|
|
8527
|
-
var
|
|
8528
|
-
a("changeCountry", ((
|
|
8540
|
+
}, I = () => {
|
|
8541
|
+
var v;
|
|
8542
|
+
a("changeNumber", ((v = g.value) == null ? void 0 : v.getNumber()) ?? ""), _();
|
|
8543
|
+
}, L = () => {
|
|
8544
|
+
var v;
|
|
8545
|
+
a("changeCountry", ((v = g.value) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), I(), _();
|
|
8529
8546
|
};
|
|
8530
|
-
return
|
|
8531
|
-
c.value && (
|
|
8532
|
-
}),
|
|
8533
|
-
() =>
|
|
8534
|
-
(
|
|
8535
|
-
var
|
|
8536
|
-
return (
|
|
8547
|
+
return N2(() => {
|
|
8548
|
+
c.value && (g.value = m(c.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled));
|
|
8549
|
+
}), A2(
|
|
8550
|
+
() => o.disabled,
|
|
8551
|
+
(v) => {
|
|
8552
|
+
var T;
|
|
8553
|
+
return (T = g.value) == null ? void 0 : T.setDisabled(v);
|
|
8537
8554
|
}
|
|
8538
8555
|
), E2(() => {
|
|
8539
|
-
var
|
|
8540
|
-
return (
|
|
8541
|
-
}), e({ instance:
|
|
8556
|
+
var v;
|
|
8557
|
+
return (v = g.value) == null ? void 0 : v.destroy();
|
|
8558
|
+
}), e({ instance: g, input: c }), (v, T) => D2((M2(), P2("input", x2({
|
|
8542
8559
|
ref_key: "input",
|
|
8543
8560
|
ref: c,
|
|
8544
|
-
"onUpdate:modelValue":
|
|
8561
|
+
"onUpdate:modelValue": T[0] || (T[0] = (M) => n.value = M),
|
|
8545
8562
|
type: "tel",
|
|
8546
|
-
onCountrychange:
|
|
8547
|
-
onInput:
|
|
8563
|
+
onCountrychange: L,
|
|
8564
|
+
onInput: I
|
|
8548
8565
|
}, y.inputProps), null, 16)), [
|
|
8549
|
-
[R2,
|
|
8566
|
+
[R2, n.value]
|
|
8550
8567
|
]);
|
|
8551
8568
|
}
|
|
8552
8569
|
};
|