intl-tel-input 25.0.0 → 25.0.2

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.
@@ -1,5 +1,5 @@
1
- import { mergeModels as D, useModel as x, ref as v, onMounted as E, watch as M, onUnmounted as F, withDirectives as B, openBlock as O, createElementBlock as V, mergeProps as z, vModelText as R } from "vue";
2
- const N = [
1
+ import { mergeModels as D, useModel as x, ref as L, onMounted as E, watch as M, onUnmounted as F, withDirectives as B, openBlock as V, createElementBlock as O, mergeProps as z, vModelText as R } from "vue";
2
+ const A = [
3
3
  [
4
4
  "af",
5
5
  // Afghanistan
@@ -9,8 +9,7 @@ const N = [
9
9
  "ax",
10
10
  // Åland Islands
11
11
  "358",
12
- 1,
13
- ["18"]
12
+ 1
14
13
  ],
15
14
  [
16
15
  "al",
@@ -1305,16 +1304,17 @@ const N = [
1305
1304
  // Zimbabwe
1306
1305
  "263"
1307
1306
  ]
1308
- ], b = [];
1309
- for (let u = 0; u < N.length; u++) {
1310
- const t = N[u];
1311
- b[u] = {
1307
+ ], I = [];
1308
+ for (let u = 0; u < A.length; u++) {
1309
+ const e = A[u];
1310
+ I[u] = {
1312
1311
  name: "",
1313
1312
  // this is now populated in the plugin
1314
- iso2: t[0],
1315
- dialCode: t[1],
1316
- priority: t[2] || 0,
1317
- areaCodes: t[3] || null,
1313
+ iso2: e[0],
1314
+ dialCode: e[1],
1315
+ priority: e[2] || 0,
1316
+ areaCodes: e[3] || null,
1317
+ partialAreaCodes: null,
1318
1318
  nodeById: {}
1319
1319
  };
1320
1320
  }
@@ -1573,8 +1573,8 @@ const j = {
1573
1573
  ac: "Ascension Island",
1574
1574
  xk: "Kosovo"
1575
1575
  }, k = { ...j, ...$ };
1576
- for (let u = 0; u < b.length; u++)
1577
- b[u].name = k[b[u].iso2];
1576
+ for (let u = 0; u < I.length; u++)
1577
+ I[u].name = k[I[u].iso2];
1578
1578
  let U = 0;
1579
1579
  const T = {
1580
1580
  //* Whether or not to allow the dropdown.
@@ -1649,46 +1649,46 @@ const T = {
1649
1649
  "887",
1650
1650
  "888",
1651
1651
  "889"
1652
- ], I = (u) => u.replace(/\D/g, ""), A = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
1653
- const t = I(u);
1654
- if (t.charAt(0) === "1") {
1655
- const e = t.substr(1, 3);
1656
- return K.indexOf(e) !== -1;
1652
+ ], v = (u) => u.replace(/\D/g, ""), N = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
1653
+ const e = v(u);
1654
+ if (e.charAt(0) === "1") {
1655
+ const t = e.substr(1, 3);
1656
+ return K.indexOf(t) !== -1;
1657
1657
  }
1658
1658
  return !1;
1659
- }, H = (u, t, e, i) => {
1660
- if (e === 0 && !i)
1659
+ }, H = (u, e, t, i) => {
1660
+ if (t === 0 && !i)
1661
1661
  return 0;
1662
1662
  let s = 0;
1663
- for (let n = 0; n < t.length; n++) {
1664
- if (/[+0-9]/.test(t[n]) && s++, s === u && !i)
1663
+ for (let n = 0; n < e.length; n++) {
1664
+ if (/[+0-9]/.test(e[n]) && s++, s === u && !i)
1665
1665
  return n + 1;
1666
1666
  if (i && s === u + 1)
1667
1667
  return n;
1668
1668
  }
1669
- return t.length;
1670
- }, y = (u, t, e) => {
1669
+ return e.length;
1670
+ }, y = (u, e, t) => {
1671
1671
  const i = document.createElement(u);
1672
- return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
1673
- }, _ = (u, ...t) => {
1674
- const { instances: e } = l;
1675
- Object.values(e).forEach((i) => i[u](...t));
1672
+ return e && Object.entries(e).forEach(([s, n]) => i.setAttribute(s, n)), t && t.appendChild(i), i;
1673
+ }, w = (u, ...e) => {
1674
+ const { instances: t } = l;
1675
+ Object.values(t).forEach((i) => i[u](...e));
1676
1676
  };
1677
1677
  class G {
1678
- constructor(t, e = {}) {
1679
- this.id = U++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, T, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
1678
+ constructor(e, t = {}) {
1679
+ this.id = U++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, T, t), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
1680
1680
  }
1681
1681
  //* Can't be private as it's called from intlTelInput convenience wrapper.
1682
1682
  _init() {
1683
1683
  this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]");
1684
- const t = this.options.allowDropdown || this.options.separateDialCode;
1685
- this.showSelectedCountryOnLeft = this.isRTL ? !t : t, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...k, ...this.options.i18n };
1686
- const e = new Promise((s, n) => {
1684
+ 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 = { ...k, ...this.options.i18n };
1686
+ const t = new Promise((s, n) => {
1687
1687
  this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = n;
1688
1688
  }), i = new Promise((s, n) => {
1689
1689
  this.resolveUtilsScriptPromise = s, this.rejectUtilsScriptPromise = n;
1690
1690
  });
1691
- this.promise = Promise.all([e, i]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
1691
+ this.promise = Promise.all([t, i]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
1692
1692
  }
1693
1693
  //********************
1694
1694
  //* PRIVATE METHODS
@@ -1699,81 +1699,81 @@ class G {
1699
1699
  }
1700
1700
  //* Sort countries by countryOrder option (if present), then name.
1701
1701
  _sortCountries() {
1702
- this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((t) => t.toLowerCase())), this.countries.sort((t, e) => {
1702
+ this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, t) => {
1703
1703
  const { countryOrder: i } = this.options;
1704
1704
  if (i) {
1705
- const s = i.indexOf(t.iso2), n = i.indexOf(e.iso2), o = s > -1, a = n > -1;
1705
+ const s = i.indexOf(e.iso2), n = i.indexOf(t.iso2), o = s > -1, a = n > -1;
1706
1706
  if (o || a)
1707
1707
  return o && a ? s - n : o ? -1 : 1;
1708
1708
  }
1709
- return t.name.localeCompare(e.name);
1709
+ return e.name.localeCompare(t.name);
1710
1710
  });
1711
1711
  }
1712
1712
  //* Add a dial code to this.dialCodeToIso2Map.
1713
- _addToDialCodeMap(t, e, i) {
1714
- e.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = e.length), this.dialCodeToIso2Map.hasOwnProperty(e) || (this.dialCodeToIso2Map[e] = []);
1715
- for (let n = 0; n < this.dialCodeToIso2Map[e].length; n++)
1716
- if (this.dialCodeToIso2Map[e][n] === t)
1713
+ _addToDialCodeMap(e, t, i) {
1714
+ t.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = t.length), this.dialCodeToIso2Map.hasOwnProperty(t) || (this.dialCodeToIso2Map[t] = []);
1715
+ for (let n = 0; n < this.dialCodeToIso2Map[t].length; n++)
1716
+ if (this.dialCodeToIso2Map[t][n] === e)
1717
1717
  return;
1718
- const s = i !== void 0 ? i : this.dialCodeToIso2Map[e].length;
1719
- this.dialCodeToIso2Map[e][s] = t;
1718
+ const s = i !== void 0 ? i : this.dialCodeToIso2Map[t].length;
1719
+ this.dialCodeToIso2Map[t][s] = e;
1720
1720
  }
1721
1721
  //* Process onlyCountries or excludeCountries array if present.
1722
1722
  _processAllCountries() {
1723
- const { onlyCountries: t, excludeCountries: e } = this.options;
1724
- if (t.length) {
1725
- const i = t.map(
1723
+ const { onlyCountries: e, excludeCountries: t } = this.options;
1724
+ if (e.length) {
1725
+ const i = e.map(
1726
1726
  (s) => s.toLowerCase()
1727
1727
  );
1728
- this.countries = b.filter(
1728
+ this.countries = I.filter(
1729
1729
  (s) => i.indexOf(s.iso2) > -1
1730
1730
  );
1731
- } else if (e.length) {
1732
- const i = e.map(
1731
+ } else if (t.length) {
1732
+ const i = t.map(
1733
1733
  (s) => s.toLowerCase()
1734
1734
  );
1735
- this.countries = b.filter(
1735
+ this.countries = I.filter(
1736
1736
  (s) => i.indexOf(s.iso2) === -1
1737
1737
  );
1738
1738
  } else
1739
- this.countries = b;
1739
+ this.countries = I;
1740
1740
  }
1741
1741
  //* Translate Countries by object literal provided on config.
1742
1742
  _translateCountryNames() {
1743
- for (let t = 0; t < this.countries.length; t++) {
1744
- const e = this.countries[t].iso2.toLowerCase();
1745
- this.options.i18n.hasOwnProperty(e) && (this.countries[t].name = this.options.i18n[e]);
1743
+ for (let e = 0; e < this.countries.length; e++) {
1744
+ const t = this.countries[e].iso2.toLowerCase();
1745
+ this.options.i18n.hasOwnProperty(t) && (this.countries[e].name = this.options.i18n[t]);
1746
1746
  }
1747
1747
  }
1748
- //* Generate this.dialCodes and this.dialCodeToIso2Map.
1748
+ //* Generate this.dialCodes and this.dialCodeToIso2Map and country.partialAreaCodes.
1749
1749
  _processDialCodes() {
1750
1750
  this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
1751
- for (let t = 0; t < this.countries.length; t++) {
1752
- const e = this.countries[t];
1753
- this.dialCodes[e.dialCode] || (this.dialCodes[e.dialCode] = !0), this._addToDialCodeMap(e.iso2, e.dialCode, e.priority);
1751
+ for (let e = 0; e < this.countries.length; e++) {
1752
+ const t = this.countries[e];
1753
+ this.dialCodes[t.dialCode] || (this.dialCodes[t.dialCode] = !0), this._addToDialCodeMap(t.iso2, t.dialCode, t.priority);
1754
1754
  }
1755
- for (let t = 0; t < this.countries.length; t++) {
1756
- const e = this.countries[t];
1757
- if (e.areaCodes) {
1758
- const i = this.dialCodeToIso2Map[e.dialCode][0];
1759
- for (let s = 0; s < e.areaCodes.length; s++) {
1760
- const n = e.areaCodes[s];
1755
+ for (let e = 0; e < this.countries.length; e++) {
1756
+ const t = this.countries[e];
1757
+ if (t.areaCodes) {
1758
+ const i = this.dialCodeToIso2Map[t.dialCode][0];
1759
+ for (let s = 0; s < t.areaCodes.length; s++) {
1760
+ const n = t.areaCodes[s];
1761
1761
  for (let o = 1; o < n.length; o++) {
1762
- const a = e.dialCode + n.substr(0, o);
1763
- this._addToDialCodeMap(i, a), this._addToDialCodeMap(e.iso2, a);
1762
+ const a = n.substr(0, o), r = t.dialCode + a;
1763
+ this._addToDialCodeMap(i, r), this._addToDialCodeMap(t.iso2, r), t.partialAreaCodes || (t.partialAreaCodes = []), t.partialAreaCodes.includes(a) || t.partialAreaCodes.push(a);
1764
1764
  }
1765
- this._addToDialCodeMap(e.iso2, e.dialCode + n);
1765
+ this._addToDialCodeMap(t.iso2, t.dialCode + n);
1766
1766
  }
1767
1767
  }
1768
1768
  }
1769
1769
  }
1770
1770
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
1771
1771
  _generateMarkup() {
1772
- var h;
1772
+ var d, m, b;
1773
1773
  this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
1774
1774
  const {
1775
- allowDropdown: t,
1776
- separateDialCode: e,
1775
+ allowDropdown: e,
1776
+ separateDialCode: t,
1777
1777
  showFlags: i,
1778
1778
  containerClass: s,
1779
1779
  hiddenInput: n,
@@ -1781,17 +1781,17 @@ class G {
1781
1781
  fixDropdownWidth: a,
1782
1782
  useFullscreenPopup: r,
1783
1783
  countrySearch: p,
1784
- i18n: c
1784
+ i18n: h
1785
1785
  } = this.options;
1786
- let d = "iti";
1787
- t && (d += " iti--allow-dropdown"), i && (d += " iti--show-flags"), s && (d += ` ${s}`), r || (d += " iti--inline-dropdown");
1788
- const C = y("div", { class: d });
1789
- if ((h = this.telInput.parentNode) == null || h.insertBefore(C, this.telInput), t || i || e) {
1786
+ let c = "iti";
1787
+ e && (c += " iti--allow-dropdown"), i && (c += " iti--show-flags"), s && (c += ` ${s}`), r || (c += " iti--inline-dropdown");
1788
+ const C = y("div", { class: c });
1789
+ if ((d = this.telInput.parentNode) == null || d.insertBefore(C, this.telInput), e || i || t) {
1790
1790
  this.countryContainer = y(
1791
1791
  "div",
1792
1792
  { class: "iti__country-container" },
1793
1793
  C
1794
- ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = y(
1794
+ ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = y(
1795
1795
  "button",
1796
1796
  {
1797
1797
  type: "button",
@@ -1808,20 +1808,20 @@ class G {
1808
1808
  { class: "iti__selected-country" },
1809
1809
  this.countryContainer
1810
1810
  );
1811
- const m = y("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
1812
- if (this.selectedCountryInner = y("div", { class: "iti__flag" }, m), this.selectedCountryA11yText = y(
1811
+ const _ = y("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
1812
+ if (this.selectedCountryInner = y("div", { class: "iti__flag" }, _), this.selectedCountryA11yText = y(
1813
1813
  "span",
1814
1814
  { class: "iti__a11y-text" },
1815
1815
  this.selectedCountryInner
1816
- ), t && (this.dropdownArrow = y(
1816
+ ), e && (this.dropdownArrow = y(
1817
1817
  "div",
1818
1818
  { class: "iti__arrow", "aria-hidden": "true" },
1819
- m
1820
- )), e && (this.selectedDialCode = y(
1819
+ _
1820
+ )), t && (this.selectedDialCode = y(
1821
1821
  "div",
1822
1822
  { class: "iti__selected-dial-code" },
1823
1823
  this.selectedCountry
1824
- )), t) {
1824
+ )), e) {
1825
1825
  const f = a ? "" : "iti--flexible-dropdown-width";
1826
1826
  if (this.dropdownContent = y("div", {
1827
1827
  id: `iti-${this.id}__dropdown-content`,
@@ -1831,10 +1831,10 @@ class G {
1831
1831
  {
1832
1832
  type: "text",
1833
1833
  class: "iti__search-input",
1834
- placeholder: c.searchPlaceholder,
1834
+ placeholder: h.searchPlaceholder,
1835
1835
  role: "combobox",
1836
1836
  "aria-expanded": "true",
1837
- "aria-label": c.searchPlaceholder,
1837
+ "aria-label": h.searchPlaceholder,
1838
1838
  "aria-controls": `iti-${this.id}__country-listbox`,
1839
1839
  "aria-autocomplete": "list",
1840
1840
  autocomplete: "off"
@@ -1850,7 +1850,7 @@ class G {
1850
1850
  class: "iti__country-list",
1851
1851
  id: `iti-${this.id}__country-listbox`,
1852
1852
  role: "listbox",
1853
- "aria-label": c.countryListAriaLabel
1853
+ "aria-label": h.countryListAriaLabel
1854
1854
  },
1855
1855
  this.dropdownContent
1856
1856
  ), this._appendListItems(), p && this._updateSearchResultsText(), o) {
@@ -1861,47 +1861,54 @@ class G {
1861
1861
  }
1862
1862
  }
1863
1863
  if (C.appendChild(this.telInput), this._updateInputPadding(), n) {
1864
- const m = this.telInput.getAttribute("name") || "", f = n(m);
1865
- f.phone && (this.hiddenInput = y("input", {
1866
- type: "hidden",
1867
- name: f.phone
1868
- }), C.appendChild(this.hiddenInput)), f.country && (this.hiddenInputCountry = y("input", {
1869
- type: "hidden",
1870
- name: f.country
1871
- }), C.appendChild(this.hiddenInputCountry));
1864
+ const _ = this.telInput.getAttribute("name") || "", f = n(_);
1865
+ if (f.phone) {
1866
+ const g = (m = this.telInput.form) == null ? void 0 : m.querySelector(`input[name="${f.phone}"]`);
1867
+ g ? this.hiddenInput = g : (this.hiddenInput = y("input", {
1868
+ type: "hidden",
1869
+ name: f.phone
1870
+ }), C.appendChild(this.hiddenInput));
1871
+ }
1872
+ if (f.country) {
1873
+ const g = (b = this.telInput.form) == null ? void 0 : b.querySelector(`input[name="${f.country}"]`);
1874
+ g ? this.hiddenInputCountry = g : (this.hiddenInputCountry = y("input", {
1875
+ type: "hidden",
1876
+ name: f.country
1877
+ }), C.appendChild(this.hiddenInputCountry));
1878
+ }
1872
1879
  }
1873
1880
  }
1874
1881
  //* For each country: add a country list item <li> to the countryList <ul> container.
1875
1882
  _appendListItems() {
1876
- for (let t = 0; t < this.countries.length; t++) {
1877
- const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = y(
1883
+ for (let e = 0; e < this.countries.length; e++) {
1884
+ const t = this.countries[e], i = e === 0 ? "iti__highlight" : "", s = y(
1878
1885
  "li",
1879
1886
  {
1880
- id: `iti-${this.id}__item-${e.iso2}`,
1887
+ id: `iti-${this.id}__item-${t.iso2}`,
1881
1888
  class: `iti__country ${i}`,
1882
1889
  tabindex: "-1",
1883
1890
  role: "option",
1884
- "data-dial-code": e.dialCode,
1885
- "data-country-code": e.iso2,
1891
+ "data-dial-code": t.dialCode,
1892
+ "data-country-code": t.iso2,
1886
1893
  "aria-selected": "false"
1887
1894
  },
1888
1895
  this.countryList
1889
1896
  );
1890
- e.nodeById[this.id] = s;
1897
+ t.nodeById[this.id] = s;
1891
1898
  let n = "";
1892
- this.options.showFlags && (n += `<div class='iti__flag iti__${e.iso2}'></div>`), n += `<span class='iti__country-name'>${e.name}</span>`, n += `<span class='iti__dial-code'>+${e.dialCode}</span>`, s.insertAdjacentHTML("beforeend", n);
1899
+ this.options.showFlags && (n += `<div class='iti__flag iti__${t.iso2}'></div>`), n += `<span class='iti__country-name'>${t.name}</span>`, n += `<span class='iti__dial-code'>+${t.dialCode}</span>`, s.insertAdjacentHTML("beforeend", n);
1893
1900
  }
1894
1901
  }
1895
1902
  //* Set the initial state of the input value and the selected country by:
1896
1903
  //* 1. Extracting a dial code from the given number
1897
1904
  //* 2. Using explicit initialCountry
1898
- _setInitialState(t = !1) {
1899
- const e = this.telInput.getAttribute("value"), i = this.telInput.value, n = e && e.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? e : i, o = this._getDialCode(n), a = S(n), { initialCountry: r, geoIpLookup: p } = this.options, c = r === "auto" && p;
1905
+ _setInitialState(e = !1) {
1906
+ const t = this.telInput.getAttribute("value"), i = this.telInput.value, n = t && t.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? t : i, o = this._getDialCode(n), a = S(n), { initialCountry: r, geoIpLookup: p } = this.options, h = r === "auto" && p;
1900
1907
  if (o && !a)
1901
1908
  this._updateCountryFromNumber(n);
1902
- else if (!c || t) {
1903
- const d = r ? r.toLowerCase() : "";
1904
- d && this._getCountryData(d, !0) ? this._setCountry(d) : o && a ? this._setCountry("us") : this._setCountry();
1909
+ else if (!h || e) {
1910
+ const c = r ? r.toLowerCase() : "";
1911
+ c && this._getCountryData(c, !0) ? this._setCountry(c) : o && a ? this._setCountry("us") : this._setCountry();
1905
1912
  }
1906
1913
  n && this._updateValFromNumber(n);
1907
1914
  }
@@ -1911,24 +1918,24 @@ class G {
1911
1918
  }
1912
1919
  //* Update hidden input on form submit.
1913
1920
  _initHiddenInputListener() {
1914
- var t;
1921
+ var e;
1915
1922
  this._handleHiddenInputSubmit = () => {
1916
1923
  this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
1917
- }, (t = this.telInput.form) == null || t.addEventListener(
1924
+ }, (e = this.telInput.form) == null || e.addEventListener(
1918
1925
  "submit",
1919
1926
  this._handleHiddenInputSubmit
1920
1927
  );
1921
1928
  }
1922
1929
  //* initialise the dropdown listeners.
1923
1930
  _initDropdownListeners() {
1924
- this._handleLabelClick = (e) => {
1925
- this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : e.preventDefault();
1931
+ this._handleLabelClick = (t) => {
1932
+ this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : t.preventDefault();
1926
1933
  };
1927
- const t = this.telInput.closest("label");
1928
- t && t.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
1934
+ const e = this.telInput.closest("label");
1935
+ e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
1929
1936
  this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
1930
- }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (e) => {
1931
- this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(e.key) && (e.preventDefault(), e.stopPropagation(), this._openDropdown()), e.key === "Tab" && this._closeDropdown();
1937
+ }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (t) => {
1938
+ this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(t.key) && (t.preventDefault(), t.stopPropagation(), this._openDropdown()), t.key === "Tab" && this._closeDropdown();
1932
1939
  }, this.countryContainer.addEventListener(
1933
1940
  "keydown",
1934
1941
  this._handleCountryContainerKeydown
@@ -1936,22 +1943,22 @@ class G {
1936
1943
  }
1937
1944
  //* Init many requests: utils script / geo ip lookup.
1938
1945
  _initRequests() {
1939
- let { loadUtils: t, initialCountry: e, geoIpLookup: i } = this.options;
1940
- t && !l.utils ? (this._handlePageLoad = () => {
1946
+ let { loadUtils: e, initialCountry: t, geoIpLookup: i } = this.options;
1947
+ e && !l.utils ? (this._handlePageLoad = () => {
1941
1948
  var n;
1942
- window.removeEventListener("load", this._handlePageLoad), (n = l.attachUtils(t)) == null || n.catch(() => {
1949
+ window.removeEventListener("load", this._handlePageLoad), (n = l.attachUtils(e)) == null || n.catch(() => {
1943
1950
  });
1944
- }, l.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
1951
+ }, l.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), t === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
1945
1952
  }
1946
1953
  //* Perform the geo ip lookup.
1947
1954
  _loadAutoCountry() {
1948
1955
  l.autoCountry ? this.handleAutoCountry() : l.startedLoadingAutoCountry || (l.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
1949
- (t = "") => {
1950
- const e = t.toLowerCase();
1951
- e && this._getCountryData(e, !0) ? (l.autoCountry = e, setTimeout(() => _("handleAutoCountry"))) : (this._setInitialState(!0), _("rejectAutoCountryPromise"));
1956
+ (e = "") => {
1957
+ const t = e.toLowerCase();
1958
+ t && this._getCountryData(t, !0) ? (l.autoCountry = t, setTimeout(() => w("handleAutoCountry"))) : (this._setInitialState(!0), w("rejectAutoCountryPromise"));
1952
1959
  },
1953
1960
  () => {
1954
- this._setInitialState(!0), _("rejectAutoCountryPromise");
1961
+ this._setInitialState(!0), w("rejectAutoCountryPromise");
1955
1962
  }
1956
1963
  ));
1957
1964
  }
@@ -1960,58 +1967,58 @@ class G {
1960
1967
  }
1961
1968
  //* Initialize the tel input listeners.
1962
1969
  _initTelInputListeners() {
1963
- const { strictMode: t, formatAsYouType: e, separateDialCode: i, formatOnDisplay: s, allowDropdown: n, countrySearch: o } = this.options;
1970
+ const { strictMode: e, formatAsYouType: t, separateDialCode: i, formatOnDisplay: s, allowDropdown: n, countrySearch: o } = this.options;
1964
1971
  let a = !1;
1965
1972
  new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0), this._handleInputEvent = (r) => {
1966
1973
  if (this.isAndroid && (r == null ? void 0 : r.data) === "+" && i && n && o) {
1967
- const C = this.telInput.selectionStart || 0, h = this.telInput.value.substring(0, C - 1), m = this.telInput.value.substring(C);
1968
- this.telInput.value = h + m, this._openDropdownWithPlus();
1974
+ const C = this.telInput.selectionStart || 0, d = this.telInput.value.substring(0, C - 1), m = this.telInput.value.substring(C);
1975
+ this.telInput.value = d + m, this._openDropdownWithPlus();
1969
1976
  return;
1970
1977
  }
1971
1978
  this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
1972
- const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data), c = (r == null ? void 0 : r.inputType) === "insertFromPaste" && this.telInput.value;
1973
- p || c && !t ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
1974
- const d = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
1975
- if (e && !a && !d) {
1976
- const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, f = (r == null ? void 0 : r.inputType) === "deleteContentForward", g = this._formatNumberAsYouType(), w = H(m, g, C, f);
1977
- this.telInput.value = g, this.telInput.setSelectionRange(w, w);
1979
+ const p = (r == null ? void 0 : r.data) && /[^+0-9]/.test(r.data), h = (r == null ? void 0 : r.inputType) === "insertFromPaste" && this.telInput.value;
1980
+ p || h && !e ? a = !0 : /[^+0-9]/.test(this.telInput.value) || (a = !1);
1981
+ const c = (r == null ? void 0 : r.detail) && r.detail.isSetNumber && !s;
1982
+ if (t && !a && !c) {
1983
+ const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, b = (r == null ? void 0 : r.inputType) === "deleteContentForward", _ = this._formatNumberAsYouType(), f = H(m, _, C, b);
1984
+ this.telInput.value = _, this.telInput.setSelectionRange(f, f);
1978
1985
  }
1979
- }, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (r) => {
1986
+ }, this.telInput.addEventListener("input", this._handleInputEvent), (e || i) && (this._handleKeydownEvent = (r) => {
1980
1987
  if (r.key && r.key.length === 1 && !r.altKey && !r.ctrlKey && !r.metaKey) {
1981
1988
  if (i && n && o && r.key === "+") {
1982
1989
  r.preventDefault(), this._openDropdownWithPlus();
1983
1990
  return;
1984
1991
  }
1985
- if (t) {
1986
- const p = this.telInput.value, c = p.charAt(0) === "+", d = !c && this.telInput.selectionStart === 0 && r.key === "+", C = /^[0-9]$/.test(r.key), h = i ? C : d || C, m = p.slice(0, this.telInput.selectionStart) + r.key + p.slice(this.telInput.selectionEnd), f = this._getFullNumber(m), g = l.utils.getCoreNumber(f, this.selectedCountryData.iso2), w = this.maxCoreNumberLength && g.length > this.maxCoreNumberLength;
1987
- let L = !1;
1988
- if (c) {
1992
+ if (e) {
1993
+ const p = this.telInput.value, h = p.charAt(0) === "+", c = !h && this.telInput.selectionStart === 0 && r.key === "+", C = /^[0-9]$/.test(r.key), d = i ? C : c || C, m = p.slice(0, this.telInput.selectionStart) + r.key + p.slice(this.telInput.selectionEnd), b = this._getFullNumber(m), _ = l.utils.getCoreNumber(b, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && _.length > this.maxCoreNumberLength;
1994
+ let g = !1;
1995
+ if (h) {
1989
1996
  const P = this.selectedCountryData.iso2;
1990
- L = this._getCountryFromNumber(f) !== P;
1997
+ g = this._getCountryFromNumber(b) !== P;
1991
1998
  }
1992
- (!h || w && !L && !d) && r.preventDefault();
1999
+ (!d || f && !g && !c) && r.preventDefault();
1993
2000
  }
1994
2001
  }
1995
2002
  }, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
1996
2003
  }
1997
2004
  //* Adhere to the input's maxlength attr.
1998
- _cap(t) {
1999
- const e = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
2000
- return e && t.length > e ? t.substr(0, e) : t;
2005
+ _cap(e) {
2006
+ const t = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
2007
+ return t && e.length > t ? e.substr(0, t) : e;
2001
2008
  }
2002
2009
  //* Trigger a custom event on the input.
2003
- _trigger(t, e = {}) {
2004
- const i = new CustomEvent(t, {
2010
+ _trigger(e, t = {}) {
2011
+ const i = new CustomEvent(e, {
2005
2012
  bubbles: !0,
2006
2013
  cancelable: !0,
2007
- detail: e
2014
+ detail: t
2008
2015
  });
2009
2016
  this.telInput.dispatchEvent(i);
2010
2017
  }
2011
2018
  //* Open the dropdown.
2012
2019
  _openDropdown() {
2013
- const { fixDropdownWidth: t, countrySearch: e } = this.options;
2014
- if (t && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), e) {
2020
+ const { fixDropdownWidth: e, countrySearch: t } = this.options;
2021
+ if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), t) {
2015
2022
  const i = this.countryList.firstElementChild;
2016
2023
  i && (this._highlightListItem(i, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
2017
2024
  }
@@ -2020,8 +2027,8 @@ class G {
2020
2027
  //* Set the dropdown position
2021
2028
  _setDropdownPosition() {
2022
2029
  if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
2023
- const t = this.telInput.getBoundingClientRect(), e = this.telInput.offsetHeight;
2024
- this.options.dropdownContainer && (this.dropdown.style.top = `${t.top + e}px`, this.dropdown.style.left = `${t.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
2030
+ const e = this.telInput.getBoundingClientRect(), t = this.telInput.offsetHeight;
2031
+ this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + t}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
2025
2032
  }
2026
2033
  }
2027
2034
  //* We only bind dropdown listeners when the dropdown is open.
@@ -2038,17 +2045,17 @@ class G {
2038
2045
  const n = (o = s.target) == null ? void 0 : o.closest(".iti__country");
2039
2046
  n && this._selectListItem(n);
2040
2047
  }, this.countryList.addEventListener("click", this._handleClickCountryList);
2041
- let t = !0;
2048
+ let e = !0;
2042
2049
  this._handleClickOffToClose = () => {
2043
- t || this._closeDropdown(), t = !1;
2050
+ e || this._closeDropdown(), e = !1;
2044
2051
  }, document.documentElement.addEventListener(
2045
2052
  "click",
2046
2053
  this._handleClickOffToClose
2047
2054
  );
2048
- let e = "", i = null;
2055
+ let t = "", i = null;
2049
2056
  if (this._handleKeydownOnDropdown = (s) => {
2050
- ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(s.key) && (s.preventDefault(), s.stopPropagation(), s.key === "ArrowUp" || s.key === "ArrowDown" ? this._handleUpDownKey(s.key) : s.key === "Enter" ? this._handleEnterKey() : s.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key) && (s.stopPropagation(), i && clearTimeout(i), e += s.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2051
- e = "";
2057
+ ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(s.key) && (s.preventDefault(), s.stopPropagation(), s.key === "ArrowUp" || s.key === "ArrowDown" ? this._handleUpDownKey(s.key) : s.key === "Enter" ? this._handleEnterKey() : s.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key) && (s.stopPropagation(), i && clearTimeout(i), t += s.key.toLowerCase(), this._searchForCountry(t), i = setTimeout(() => {
2058
+ t = "";
2052
2059
  }, 1e3));
2053
2060
  }, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
2054
2061
  const s = () => {
@@ -2064,10 +2071,10 @@ class G {
2064
2071
  }
2065
2072
  }
2066
2073
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2067
- _searchForCountry(t) {
2068
- for (let e = 0; e < this.countries.length; e++) {
2069
- const i = this.countries[e];
2070
- if (i.name.substr(0, t.length).toLowerCase() === t) {
2074
+ _searchForCountry(e) {
2075
+ for (let t = 0; t < this.countries.length; t++) {
2076
+ const i = this.countries[t];
2077
+ if (i.name.substr(0, e.length).toLowerCase() === e) {
2071
2078
  const n = i.nodeById[this.id];
2072
2079
  this._highlightListItem(n, !1), this._scrollTo(n);
2073
2080
  break;
@@ -2075,30 +2082,30 @@ class G {
2075
2082
  }
2076
2083
  }
2077
2084
  //* Country search enabled: Filter the countries according to the search query.
2078
- _filterCountries(t, e = !1) {
2085
+ _filterCountries(e, t = !1) {
2079
2086
  let i = !0;
2080
2087
  this.countryList.innerHTML = "";
2081
- const s = A(t);
2088
+ const s = N(e);
2082
2089
  for (let n = 0; n < this.countries.length; n++) {
2083
- const o = this.countries[n], a = A(o.name), r = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((c) => c[0]).join("").toLowerCase(), p = `+${o.dialCode}`;
2084
- if (e || a.includes(s) || p.includes(s) || o.iso2.includes(s) || r.includes(s)) {
2085
- const c = o.nodeById[this.id];
2086
- c && this.countryList.appendChild(c), i && (this._highlightListItem(c, !1), i = !1);
2090
+ const o = this.countries[n], a = N(o.name), r = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((h) => h[0]).join("").toLowerCase(), p = `+${o.dialCode}`;
2091
+ if (t || a.includes(s) || p.includes(s) || o.iso2.includes(s) || r.includes(s)) {
2092
+ const h = o.nodeById[this.id];
2093
+ h && this.countryList.appendChild(h), i && (this._highlightListItem(h, !1), i = !1);
2087
2094
  }
2088
2095
  }
2089
2096
  i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
2090
2097
  }
2091
2098
  //* Update search results text (for a11y).
2092
2099
  _updateSearchResultsText() {
2093
- const { i18n: t } = this.options, e = this.countryList.childElementCount;
2100
+ const { i18n: e } = this.options, t = this.countryList.childElementCount;
2094
2101
  let i;
2095
- e === 0 ? i = t.zeroSearchResults : e === 1 ? i = t.oneSearchResult : i = t.multipleSearchResults.replace("${count}", e.toString()), this.searchResultsA11yText.textContent = i;
2102
+ t === 0 ? i = e.zeroSearchResults : t === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace("${count}", t.toString()), this.searchResultsA11yText.textContent = i;
2096
2103
  }
2097
2104
  //* Highlight the next/prev item in the list (and ensure it is visible).
2098
- _handleUpDownKey(t) {
2105
+ _handleUpDownKey(e) {
2099
2106
  var i, s;
2100
- let e = t === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.highlightedItem) == null ? void 0 : s.nextElementSibling;
2101
- !e && this.countryList.childElementCount > 1 && (e = t === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), e && (this._scrollTo(e), this._highlightListItem(e, !1));
2107
+ let t = e === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.highlightedItem) == null ? void 0 : s.nextElementSibling;
2108
+ !t && this.countryList.childElementCount > 1 && (t = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), t && (this._scrollTo(t), this._highlightListItem(t, !1));
2102
2109
  }
2103
2110
  //* Select the currently highlighted item.
2104
2111
  _handleEnterKey() {
@@ -2106,36 +2113,42 @@ class G {
2106
2113
  }
2107
2114
  //* Update the input's value to the given val (format first if possible)
2108
2115
  //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2109
- _updateValFromNumber(t) {
2110
- let e = t;
2116
+ _updateValFromNumber(e) {
2117
+ let t = e;
2111
2118
  if (this.options.formatOnDisplay && l.utils && this.selectedCountryData) {
2112
- const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = l.utils.numberFormat, o = i ? s : n;
2113
- e = l.utils.formatNumber(
2114
- e,
2119
+ const i = this.options.nationalMode || t.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = l.utils.numberFormat, o = i ? s : n;
2120
+ t = l.utils.formatNumber(
2121
+ t,
2115
2122
  this.selectedCountryData.iso2,
2116
2123
  o
2117
2124
  );
2118
2125
  }
2119
- e = this._beforeSetNumber(e), this.telInput.value = e;
2126
+ t = this._beforeSetNumber(t), this.telInput.value = t;
2120
2127
  }
2121
2128
  //* Check if need to select a new country based on the given number
2122
2129
  //* Note: called from _setInitialState, keyup handler, setNumber.
2123
- _updateCountryFromNumber(t) {
2124
- const e = this._getCountryFromNumber(t);
2125
- return e !== null ? this._setCountry(e) : !1;
2126
- }
2127
- _getCountryFromNumber(t) {
2128
- const e = t.indexOf("+");
2129
- let i = e ? t.substring(e) : t;
2130
+ _updateCountryFromNumber(e) {
2131
+ const t = this._getCountryFromNumber(e);
2132
+ return t !== null ? this._setCountry(t) : !1;
2133
+ }
2134
+ //* Check if the given number matches an area code from the selected country.
2135
+ _isAreaCodeMatch(e, t) {
2136
+ const { areaCodes: i, partialAreaCodes: s, dialCode: n } = this.selectedCountryData, o = e.substring(n.length), a = t.substring(n.length);
2137
+ return !!(i.includes(a) || s.includes(o));
2138
+ }
2139
+ _getCountryFromNumber(e) {
2140
+ const t = e.indexOf("+");
2141
+ let i = t ? e.substring(t) : e;
2130
2142
  const s = this.selectedCountryData.dialCode;
2131
2143
  i && s === "1" && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = `1${i}`), i = `+${i}`), this.options.separateDialCode && s && i.charAt(0) !== "+" && (i = `+${s}${i}`);
2132
- const o = this._getDialCode(i, !0), a = I(i);
2144
+ const o = this._getDialCode(i, !0), a = v(i);
2133
2145
  if (o) {
2134
- const r = this.dialCodeToIso2Map[I(o)], p = r.indexOf(this.selectedCountryData.iso2) !== -1 && a.length <= o.length - 1;
2135
- if (!(s === "1" && S(a)) && !p) {
2136
- for (let d = 0; d < r.length; d++)
2137
- if (r[d])
2138
- return r[d];
2146
+ const r = v(o), p = this.dialCodeToIso2Map[r], h = this.selectedCountryData.iso2 && p.includes(this.selectedCountryData.iso2);
2147
+ let c = !1;
2148
+ if (h && (this.selectedCountryData.areaCodes && a.length > s.length ? c = this._isAreaCodeMatch(a, r) : c = !0), !(s === "1" && S(a)) && (!h || !c)) {
2149
+ for (let d = 0; d < p.length; d++)
2150
+ if (p[d])
2151
+ return p[d];
2139
2152
  }
2140
2153
  } else {
2141
2154
  if (i.charAt(0) === "+" && a.length)
@@ -2146,52 +2159,52 @@ class G {
2146
2159
  return null;
2147
2160
  }
2148
2161
  //* Remove highlighting from other list items and highlight the given item.
2149
- _highlightListItem(t, e) {
2162
+ _highlightListItem(e, t) {
2150
2163
  const i = this.highlightedItem;
2151
- if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = t, this.highlightedItem) {
2164
+ if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
2152
2165
  this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
2153
2166
  const s = this.highlightedItem.getAttribute("id") || "";
2154
2167
  this.selectedCountry.setAttribute("aria-activedescendant", s), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", s);
2155
2168
  }
2156
- e && this.highlightedItem.focus();
2169
+ t && this.highlightedItem.focus();
2157
2170
  }
2158
2171
  //* Find the country data for the given iso2 code
2159
2172
  //* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
2160
- _getCountryData(t, e) {
2173
+ _getCountryData(e, t) {
2161
2174
  for (let i = 0; i < this.countries.length; i++)
2162
- if (this.countries[i].iso2 === t)
2175
+ if (this.countries[i].iso2 === e)
2163
2176
  return this.countries[i];
2164
- if (e)
2177
+ if (t)
2165
2178
  return null;
2166
- throw new Error(`No country data for '${t}'`);
2179
+ throw new Error(`No country data for '${e}'`);
2167
2180
  }
2168
2181
  //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
2169
2182
  //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2170
- _setCountry(t) {
2171
- const { separateDialCode: e, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
2172
- if (this.selectedCountryData = t ? this._getCountryData(t, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
2183
+ _setCountry(e) {
2184
+ const { separateDialCode: t, showFlags: i, i18n: s } = this.options, n = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
2185
+ if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
2173
2186
  let o = "", a = "";
2174
- t && i ? (o = `iti__flag iti__${t}`, a = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (o = "iti__flag iti__globe", a = s.noCountrySelected), this.selectedCountryInner.className = o, this.selectedCountryA11yText.textContent = a;
2187
+ e && i ? (o = `iti__flag iti__${e}`, a = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (o = "iti__flag iti__globe", a = s.noCountrySelected), this.selectedCountryInner.className = o, this.selectedCountryA11yText.textContent = a;
2175
2188
  }
2176
- if (this._setSelectedCountryTitleAttribute(t, e), e) {
2189
+ if (this._setSelectedCountryTitleAttribute(e, t), t) {
2177
2190
  const o = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2178
2191
  this.selectedDialCode.innerHTML = o, this._updateInputPadding();
2179
2192
  }
2180
- return this._updatePlaceholder(), this._updateMaxLength(), n.iso2 !== t;
2193
+ return this._updatePlaceholder(), this._updateMaxLength(), n.iso2 !== e;
2181
2194
  }
2182
2195
  //* Update the input padding to make space for the selected country/dial code.
2183
2196
  _updateInputPadding() {
2184
2197
  if (this.selectedCountry) {
2185
- const e = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
2186
- this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${e}px` : this.telInput.style.paddingRight = `${e}px`;
2198
+ const t = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
2199
+ this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${t}px` : this.telInput.style.paddingRight = `${t}px`;
2187
2200
  }
2188
2201
  }
2189
2202
  //* Update the maximum valid number length for the currently selected country.
2190
2203
  _updateMaxLength() {
2191
- const { strictMode: t, placeholderNumberType: e, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
2192
- if (t && l.utils)
2204
+ const { strictMode: e, placeholderNumberType: t, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
2205
+ if (e && l.utils)
2193
2206
  if (s) {
2194
- const n = l.utils.numberType[e];
2207
+ const n = l.utils.numberType[t];
2195
2208
  let o = l.utils.getExampleNumber(
2196
2209
  s,
2197
2210
  !1,
@@ -2205,11 +2218,11 @@ class G {
2205
2218
  } else
2206
2219
  this.maxCoreNumberLength = null;
2207
2220
  }
2208
- _setSelectedCountryTitleAttribute(t = null, e) {
2221
+ _setSelectedCountryTitleAttribute(e = null, t) {
2209
2222
  if (!this.selectedCountry)
2210
2223
  return;
2211
2224
  let i;
2212
- t && !e ? i = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : t ? i = this.selectedCountryData.name : i = "Unknown", this.selectedCountry.setAttribute("title", i);
2225
+ e && !t ? i = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? i = this.selectedCountryData.name : i = "Unknown", this.selectedCountry.setAttribute("title", i);
2213
2226
  }
2214
2227
  //* When the input is in a hidden container during initialisation, we must inject some markup
2215
2228
  //* into the end of the DOM to calculate the correct offsetWidth.
@@ -2217,27 +2230,27 @@ class G {
2217
2230
  //* will definitely exist.
2218
2231
  _getHiddenSelectedCountryWidth() {
2219
2232
  if (this.telInput.parentNode) {
2220
- const t = this.telInput.parentNode.cloneNode(!1);
2221
- t.style.visibility = "hidden", document.body.appendChild(t);
2222
- const e = this.countryContainer.cloneNode();
2223
- t.appendChild(e);
2233
+ const e = this.telInput.parentNode.cloneNode(!1);
2234
+ e.style.visibility = "hidden", document.body.appendChild(e);
2235
+ const t = this.countryContainer.cloneNode();
2236
+ e.appendChild(t);
2224
2237
  const i = this.selectedCountry.cloneNode(!0);
2225
- e.appendChild(i);
2238
+ t.appendChild(i);
2226
2239
  const s = i.offsetWidth;
2227
- return document.body.removeChild(t), s;
2240
+ return document.body.removeChild(e), s;
2228
2241
  }
2229
2242
  return 0;
2230
2243
  }
2231
2244
  //* Update the input placeholder to an example number from the currently selected country.
2232
2245
  _updatePlaceholder() {
2233
2246
  const {
2234
- autoPlaceholder: t,
2235
- placeholderNumberType: e,
2247
+ autoPlaceholder: e,
2248
+ placeholderNumberType: t,
2236
2249
  nationalMode: i,
2237
2250
  customPlaceholder: s
2238
- } = this.options, n = t === "aggressive" || !this.hadInitialPlaceholder && t === "polite";
2251
+ } = this.options, n = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
2239
2252
  if (l.utils && n) {
2240
- const o = l.utils.numberType[e];
2253
+ const o = l.utils.numberType[t];
2241
2254
  let a = this.selectedCountryData.iso2 ? l.utils.getExampleNumber(
2242
2255
  this.selectedCountryData.iso2,
2243
2256
  i,
@@ -2247,11 +2260,11 @@ class G {
2247
2260
  }
2248
2261
  }
2249
2262
  //* Called when the user selects a list item from the dropdown.
2250
- _selectListItem(t) {
2251
- const e = this._setCountry(
2252
- t.getAttribute("data-country-code")
2263
+ _selectListItem(e) {
2264
+ const t = this._setCountry(
2265
+ e.getAttribute("data-country-code")
2253
2266
  );
2254
- this._closeDropdown(), this._updateDialCode(t.getAttribute("data-dial-code")), this.telInput.focus(), e && this._triggerCountryChange();
2267
+ this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), t && this._triggerCountryChange();
2255
2268
  }
2256
2269
  //* Close the dropdown and unbind any listeners.
2257
2270
  _closeDropdown() {
@@ -2264,38 +2277,38 @@ class G {
2264
2277
  ), 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");
2265
2278
  }
2266
2279
  //* Check if an element is visible within it's container, else scroll until it is.
2267
- _scrollTo(t) {
2268
- const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, a = t.offsetHeight, r = t.getBoundingClientRect().top + i, p = r + a, c = r - n + e.scrollTop;
2280
+ _scrollTo(e) {
2281
+ const t = this.countryList, i = document.documentElement.scrollTop, s = t.offsetHeight, n = t.getBoundingClientRect().top + i, o = n + s, a = e.offsetHeight, r = e.getBoundingClientRect().top + i, p = r + a, h = r - n + t.scrollTop;
2269
2282
  if (r < n)
2270
- e.scrollTop = c;
2283
+ t.scrollTop = h;
2271
2284
  else if (p > o) {
2272
- const d = s - a;
2273
- e.scrollTop = c - d;
2285
+ const c = s - a;
2286
+ t.scrollTop = h - c;
2274
2287
  }
2275
2288
  }
2276
2289
  //* Replace any existing dial code with the new one
2277
2290
  //* Note: called from _selectListItem and setCountry
2278
- _updateDialCode(t) {
2279
- const e = this.telInput.value, i = `+${t}`;
2291
+ _updateDialCode(e) {
2292
+ const t = this.telInput.value, i = `+${e}`;
2280
2293
  let s;
2281
- if (e.charAt(0) === "+") {
2282
- const n = this._getDialCode(e);
2283
- n ? s = e.replace(n, i) : s = i, this.telInput.value = s;
2294
+ if (t.charAt(0) === "+") {
2295
+ const n = this._getDialCode(t);
2296
+ n ? s = t.replace(n, i) : s = i, this.telInput.value = s;
2284
2297
  }
2285
2298
  }
2286
2299
  //* Try and extract a valid international dial code from a full telephone number.
2287
2300
  //* Note: returns the raw string inc plus character and any whitespace/dots etc.
2288
- _getDialCode(t, e) {
2301
+ _getDialCode(e, t) {
2289
2302
  let i = "";
2290
- if (t.charAt(0) === "+") {
2303
+ if (e.charAt(0) === "+") {
2291
2304
  let s = "";
2292
- for (let n = 0; n < t.length; n++) {
2293
- const o = t.charAt(n);
2305
+ for (let n = 0; n < e.length; n++) {
2306
+ const o = e.charAt(n);
2294
2307
  if (!isNaN(parseInt(o, 10))) {
2295
- if (s += o, e)
2296
- this.dialCodeToIso2Map[s] && (i = t.substr(0, n + 1));
2308
+ if (s += o, t)
2309
+ this.dialCodeToIso2Map[s] && (i = e.substr(0, n + 1));
2297
2310
  else if (this.dialCodes[s]) {
2298
- i = t.substr(0, n + 1);
2311
+ i = e.substr(0, n + 1);
2299
2312
  break;
2300
2313
  }
2301
2314
  if (s.length === this.dialCodeMaxLen)
@@ -2306,24 +2319,24 @@ class G {
2306
2319
  return i;
2307
2320
  }
2308
2321
  //* Get the input val, adding the dial code if separateDialCode is enabled.
2309
- _getFullNumber(t) {
2310
- const e = t || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
2322
+ _getFullNumber(e) {
2323
+ const t = e || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
2311
2324
  let s;
2312
- const n = I(e);
2313
- return this.options.separateDialCode && e.charAt(0) !== "+" && i && n ? s = `+${i}` : s = "", s + e;
2325
+ const n = v(t);
2326
+ return this.options.separateDialCode && t.charAt(0) !== "+" && i && n ? s = `+${i}` : s = "", s + t;
2314
2327
  }
2315
2328
  //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
2316
- _beforeSetNumber(t) {
2317
- let e = t;
2329
+ _beforeSetNumber(e) {
2330
+ let t = e;
2318
2331
  if (this.options.separateDialCode) {
2319
- let i = this._getDialCode(e);
2332
+ let i = this._getDialCode(t);
2320
2333
  if (i) {
2321
2334
  i = `+${this.selectedCountryData.dialCode}`;
2322
- const s = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
2323
- e = e.substr(s);
2335
+ const s = t[i.length] === " " || t[i.length] === "-" ? i.length + 1 : i.length;
2336
+ t = t.substr(s);
2324
2337
  }
2325
2338
  }
2326
- return this._cap(e);
2339
+ return this._cap(t);
2327
2340
  }
2328
2341
  //* Trigger the 'countrychange' event.
2329
2342
  _triggerCountryChange() {
@@ -2331,8 +2344,8 @@ class G {
2331
2344
  }
2332
2345
  //* Format the number as the user types.
2333
2346
  _formatNumberAsYouType() {
2334
- const t = this._getFullNumber(), e = l.utils ? l.utils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, { dialCode: i } = this.selectedCountryData;
2335
- return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && e.includes(`+${i}`) ? (e.split(`+${i}`)[1] || "").trim() : e;
2347
+ const e = this._getFullNumber(), t = l.utils ? l.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: i } = this.selectedCountryData;
2348
+ return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && t.includes(`+${i}`) ? (t.split(`+${i}`)[1] || "").trim() : t;
2336
2349
  }
2337
2350
  //**************************
2338
2351
  //* SECRET PUBLIC METHODS
@@ -2351,8 +2364,8 @@ class G {
2351
2364
  //* Remove plugin.
2352
2365
  destroy() {
2353
2366
  var n, o;
2354
- const { allowDropdown: t, separateDialCode: e } = this.options;
2355
- if (t) {
2367
+ const { allowDropdown: e, separateDialCode: t } = this.options;
2368
+ if (e) {
2356
2369
  this._closeDropdown(), this.selectedCountry.removeEventListener(
2357
2370
  "click",
2358
2371
  this._handleClickSelectedCountry
@@ -2364,7 +2377,7 @@ class G {
2364
2377
  a && a.removeEventListener("click", this._handleLabelClick);
2365
2378
  }
2366
2379
  const { form: i } = this.telInput;
2367
- this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), e && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
2380
+ this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), t && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
2368
2381
  const s = this.telInput.parentNode;
2369
2382
  (n = s == null ? void 0 : s.parentNode) == null || n.insertBefore(this.telInput, s), (o = s == null ? void 0 : s.parentNode) == null || o.removeChild(s), delete l.instances[this.id];
2370
2383
  }
@@ -2376,13 +2389,13 @@ class G {
2376
2389
  ) : "";
2377
2390
  }
2378
2391
  //* Format the number to the given format.
2379
- getNumber(t) {
2392
+ getNumber(e) {
2380
2393
  if (l.utils) {
2381
- const { iso2: e } = this.selectedCountryData;
2394
+ const { iso2: t } = this.selectedCountryData;
2382
2395
  return l.utils.formatNumber(
2383
2396
  this._getFullNumber(),
2384
- e,
2385
- t
2397
+ t,
2398
+ e
2386
2399
  );
2387
2400
  }
2388
2401
  return "";
@@ -2401,8 +2414,8 @@ class G {
2401
2414
  //* Get the validation error.
2402
2415
  getValidationError() {
2403
2416
  if (l.utils) {
2404
- const { iso2: t } = this.selectedCountryData;
2405
- return l.utils.getValidationError(this._getFullNumber(), t);
2417
+ const { iso2: e } = this.selectedCountryData;
2418
+ return l.utils.getValidationError(this._getFullNumber(), e);
2406
2419
  }
2407
2420
  return -99;
2408
2421
  }
@@ -2410,91 +2423,91 @@ class G {
2410
2423
  isValidNumber() {
2411
2424
  if (!this.selectedCountryData.iso2)
2412
2425
  return !1;
2413
- const t = this._getFullNumber(), e = t.search(new RegExp("\\p{L}", "u"));
2414
- if (e > -1) {
2415
- const i = t.substring(0, e), s = this._utilsIsPossibleNumber(i), n = this._utilsIsPossibleNumber(t);
2426
+ const e = this._getFullNumber(), t = e.search(new RegExp("\\p{L}", "u"));
2427
+ if (t > -1) {
2428
+ const i = e.substring(0, t), s = this._utilsIsPossibleNumber(i), n = this._utilsIsPossibleNumber(e);
2416
2429
  return s && n;
2417
2430
  }
2418
- return this._utilsIsPossibleNumber(t);
2431
+ return this._utilsIsPossibleNumber(e);
2419
2432
  }
2420
- _utilsIsPossibleNumber(t) {
2421
- return l.utils ? l.utils.isPossibleNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2433
+ _utilsIsPossibleNumber(e) {
2434
+ return l.utils ? l.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2422
2435
  }
2423
2436
  //* Validate the input val (precise)
2424
2437
  isValidNumberPrecise() {
2425
2438
  if (!this.selectedCountryData.iso2)
2426
2439
  return !1;
2427
- const t = this._getFullNumber(), e = t.search(new RegExp("\\p{L}", "u"));
2428
- if (e > -1) {
2429
- const i = t.substring(0, e), s = this._utilsIsValidNumber(i), n = this._utilsIsValidNumber(t);
2440
+ const e = this._getFullNumber(), t = e.search(new RegExp("\\p{L}", "u"));
2441
+ if (t > -1) {
2442
+ const i = e.substring(0, t), s = this._utilsIsValidNumber(i), n = this._utilsIsValidNumber(e);
2430
2443
  return s && n;
2431
2444
  }
2432
- return this._utilsIsValidNumber(t);
2445
+ return this._utilsIsValidNumber(e);
2433
2446
  }
2434
- _utilsIsValidNumber(t) {
2435
- return l.utils ? l.utils.isValidNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2447
+ _utilsIsValidNumber(e) {
2448
+ return l.utils ? l.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2436
2449
  }
2437
2450
  //* Update the selected country, and update the input val accordingly.
2438
- setCountry(t) {
2439
- const e = t == null ? void 0 : t.toLowerCase(), i = this.selectedCountryData.iso2;
2440
- (t && e !== i || !t && i) && (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
2451
+ setCountry(e) {
2452
+ const t = e == null ? void 0 : e.toLowerCase(), i = this.selectedCountryData.iso2;
2453
+ (e && t !== i || !e && i) && (this._setCountry(t), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
2441
2454
  }
2442
2455
  //* Set the input value and update the country.
2443
- setNumber(t) {
2444
- const e = this._updateCountryFromNumber(t);
2445
- this._updateValFromNumber(t), e && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
2456
+ setNumber(e) {
2457
+ const t = this._updateCountryFromNumber(e);
2458
+ this._updateValFromNumber(e), t && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
2446
2459
  }
2447
2460
  //* Set the placeholder number typ
2448
- setPlaceholderNumberType(t) {
2449
- this.options.placeholderNumberType = t, this._updatePlaceholder();
2461
+ setPlaceholderNumberType(e) {
2462
+ this.options.placeholderNumberType = e, this._updatePlaceholder();
2450
2463
  }
2451
- setDisabled(t) {
2452
- this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
2464
+ setDisabled(e) {
2465
+ this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
2453
2466
  }
2454
2467
  }
2455
2468
  const W = (u) => {
2456
2469
  if (!l.utils && !l.startedLoadingUtilsScript) {
2457
- let t;
2470
+ let e;
2458
2471
  if (typeof u == "function")
2459
2472
  try {
2460
- t = Promise.resolve(u());
2461
- } catch (e) {
2462
- return Promise.reject(e);
2473
+ e = Promise.resolve(u());
2474
+ } catch (t) {
2475
+ return Promise.reject(t);
2463
2476
  }
2464
2477
  else
2465
2478
  return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof u}`));
2466
- return l.startedLoadingUtilsScript = !0, t.then((e) => {
2467
- const i = e == null ? void 0 : e.default;
2479
+ return l.startedLoadingUtilsScript = !0, e.then((t) => {
2480
+ const i = t == null ? void 0 : t.default;
2468
2481
  if (!i || typeof i != "object")
2469
2482
  throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
2470
- return l.utils = i, _("handleUtils"), !0;
2471
- }).catch((e) => {
2472
- throw _("rejectUtilsScriptPromise", e), e;
2483
+ return l.utils = i, w("handleUtils"), !0;
2484
+ }).catch((t) => {
2485
+ throw w("rejectUtilsScriptPromise", t), t;
2473
2486
  });
2474
2487
  }
2475
2488
  return null;
2476
2489
  }, l = Object.assign(
2477
- (u, t) => {
2478
- const e = new G(u, t);
2479
- return e._init(), u.setAttribute("data-intl-tel-input-id", e.id.toString()), l.instances[e.id] = e, e;
2490
+ (u, e) => {
2491
+ const t = new G(u, e);
2492
+ return t._init(), u.setAttribute("data-intl-tel-input-id", t.id.toString()), l.instances[t.id] = t, t;
2480
2493
  },
2481
2494
  {
2482
2495
  defaults: T,
2483
2496
  //* Using a static var like this allows us to mock it in the tests.
2484
2497
  documentReady: () => document.readyState === "complete",
2485
2498
  //* Get the country data object.
2486
- getCountryData: () => b,
2499
+ getCountryData: () => I,
2487
2500
  //* A getter for the plugin instance.
2488
2501
  getInstance: (u) => {
2489
- const t = u.getAttribute("data-intl-tel-input-id");
2490
- return t ? l.instances[t] : null;
2502
+ const e = u.getAttribute("data-intl-tel-input-id");
2503
+ return e ? l.instances[e] : null;
2491
2504
  },
2492
2505
  //* A map from instance ID to instance object.
2493
2506
  instances: {},
2494
2507
  attachUtils: W,
2495
2508
  startedLoadingUtilsScript: !1,
2496
2509
  startedLoadingAutoCountry: !1,
2497
- version: "25.0.0"
2510
+ version: "25.0.2"
2498
2511
  }
2499
2512
  ), J = {
2500
2513
  __name: "IntlTelInput",
@@ -2528,38 +2541,38 @@ const W = (u) => {
2528
2541
  "changeValidity",
2529
2542
  "changeErrorCode"
2530
2543
  ], ["update:modelValue"]),
2531
- setup(u, { expose: t, emit: e }) {
2532
- const i = x(u, "modelValue"), s = u, n = e, o = v(), a = v(), r = v(!1), p = () => a.value ? s.options.strictMode ? a.value.isValidNumberPrecise() : a.value.isValidNumber() : null, c = () => {
2533
- let h = p();
2534
- r.value !== h && (r.value = h, n("changeValidity", !!h), n(
2544
+ setup(u, { expose: e, emit: t }) {
2545
+ const i = x(u, "modelValue"), s = u, n = t, o = L(), a = L(), r = L(!1), p = () => a.value ? s.options.strictMode ? a.value.isValidNumberPrecise() : a.value.isValidNumber() : null, h = () => {
2546
+ let d = p();
2547
+ r.value !== d && (r.value = d, n("changeValidity", !!d), n(
2535
2548
  "changeErrorCode",
2536
- h ? null : a.value.getValidationError()
2549
+ d ? null : a.value.getValidationError()
2537
2550
  ));
2538
- }, d = () => {
2539
- var h;
2540
- n("changeNumber", ((h = a.value) == null ? void 0 : h.getNumber()) ?? ""), c();
2551
+ }, c = () => {
2552
+ var d;
2553
+ n("changeNumber", ((d = a.value) == null ? void 0 : d.getNumber()) ?? ""), h();
2541
2554
  }, C = () => {
2542
- var h;
2543
- n("changeCountry", ((h = a.value) == null ? void 0 : h.getSelectedCountryData().iso2) ?? ""), d(), c();
2555
+ var d;
2556
+ n("changeCountry", ((d = a.value) == null ? void 0 : d.getSelectedCountryData().iso2) ?? ""), c(), h();
2544
2557
  };
2545
2558
  return E(() => {
2546
2559
  o.value && (a.value = l(o.value, s.options), s.value && a.value.setNumber(s.value), s.disabled && a.value.setDisabled(s.disabled));
2547
2560
  }), M(
2548
2561
  () => s.disabled,
2549
- (h) => {
2562
+ (d) => {
2550
2563
  var m;
2551
- return (m = a.value) == null ? void 0 : m.setDisabled(h);
2564
+ return (m = a.value) == null ? void 0 : m.setDisabled(d);
2552
2565
  }
2553
2566
  ), F(() => {
2554
- var h;
2555
- return (h = a.value) == null ? void 0 : h.destroy();
2556
- }), t({ instance: a, input: o }), (h, m) => B((O(), V("input", z({
2567
+ var d;
2568
+ return (d = a.value) == null ? void 0 : d.destroy();
2569
+ }), e({ instance: a, input: o }), (d, m) => B((V(), O("input", z({
2557
2570
  ref_key: "input",
2558
2571
  ref: o,
2559
- "onUpdate:modelValue": m[0] || (m[0] = (f) => i.value = f),
2572
+ "onUpdate:modelValue": m[0] || (m[0] = (b) => i.value = b),
2560
2573
  type: "tel",
2561
2574
  onCountrychange: C,
2562
- onInput: d
2575
+ onInput: c
2563
2576
  }, u.inputProps), null, 16)), [
2564
2577
  [R, i.value]
2565
2578
  ]);