intl-tel-input 25.4.8 → 25.5.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.
@@ -1323,9 +1323,9 @@ const N = [
1323
1323
  "263"
1324
1324
  ]
1325
1325
  ], I = [];
1326
- for (let u = 0; u < N.length; u++) {
1327
- const t = N[u];
1328
- I[u] = {
1326
+ for (let h = 0; h < N.length; h++) {
1327
+ const t = N[h];
1328
+ I[h] = {
1329
1329
  name: "",
1330
1330
  // this is now populated in the plugin
1331
1331
  iso2: t[0],
@@ -1591,8 +1591,8 @@ const j = {
1591
1591
  ac: "Ascension Island",
1592
1592
  xk: "Kosovo"
1593
1593
  }, k = { ...j, ...$ };
1594
- for (let u = 0; u < I.length; u++)
1595
- I[u].name = k[I[u].iso2];
1594
+ for (let h = 0; h < I.length; h++)
1595
+ I[h].name = k[I[h].iso2];
1596
1596
  let U = 0;
1597
1597
  const T = {
1598
1598
  //* Whether or not to allow the dropdown.
@@ -1667,32 +1667,32 @@ const T = {
1667
1667
  "887",
1668
1668
  "888",
1669
1669
  "889"
1670
- ], v = (u) => u.replace(/\D/g, ""), A = (u = "") => u.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (u) => {
1671
- const t = v(u);
1670
+ ], v = (h) => h.replace(/\D/g, ""), A = (h = "") => h.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), S = (h) => {
1671
+ const t = v(h);
1672
1672
  if (t.charAt(0) === "1") {
1673
1673
  const e = t.substr(1, 3);
1674
1674
  return H.includes(e);
1675
1675
  }
1676
1676
  return !1;
1677
- }, K = (u, t, e, i) => {
1677
+ }, K = (h, t, e, i) => {
1678
1678
  if (e === 0 && !i)
1679
1679
  return 0;
1680
1680
  let s = 0;
1681
1681
  for (let n = 0; n < t.length; n++) {
1682
- if (/[+0-9]/.test(t[n]) && s++, s === u && !i)
1682
+ if (/[+0-9]/.test(t[n]) && s++, s === h && !i)
1683
1683
  return n + 1;
1684
- if (i && s === u + 1)
1684
+ if (i && s === h + 1)
1685
1685
  return n;
1686
1686
  }
1687
1687
  return t.length;
1688
- }, y = (u, t, e) => {
1689
- const i = document.createElement(u);
1688
+ }, m = (h, t, e) => {
1689
+ const i = document.createElement(h);
1690
1690
  return t && Object.entries(t).forEach(([s, n]) => i.setAttribute(s, n)), e && e.appendChild(i), i;
1691
- }, w = (u, ...t) => {
1692
- const { instances: e } = l;
1693
- Object.values(e).forEach((i) => i[u](...t));
1691
+ }, w = (h, ...t) => {
1692
+ const { instances: e } = u;
1693
+ Object.values(e).forEach((i) => i[h](...t));
1694
1694
  };
1695
- class G {
1695
+ class W {
1696
1696
  constructor(t, e = {}) {
1697
1697
  this.id = U++, this.telInput = t, this.highlightedItem = null, this.options = Object.assign({}, T, e), this.hadInitialPlaceholder = !!t.getAttribute("placeholder");
1698
1698
  }
@@ -1787,7 +1787,7 @@ class G {
1787
1787
  }
1788
1788
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
1789
1789
  _generateMarkup() {
1790
- var d, m, b;
1790
+ var l, d, g;
1791
1791
  this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
1792
1792
  const {
1793
1793
  allowDropdown: t,
@@ -1798,18 +1798,18 @@ class G {
1798
1798
  dropdownContainer: o,
1799
1799
  fixDropdownWidth: r,
1800
1800
  useFullscreenPopup: a,
1801
- countrySearch: h,
1802
- i18n: c
1801
+ countrySearch: c,
1802
+ i18n: y
1803
1803
  } = this.options;
1804
1804
  let p = "iti";
1805
1805
  t && (p += " iti--allow-dropdown"), i && (p += " iti--show-flags"), s && (p += ` ${s}`), a || (p += " iti--inline-dropdown");
1806
- const C = y("div", { class: p });
1807
- if ((d = this.telInput.parentNode) == null || d.insertBefore(C, this.telInput), t || i || e) {
1808
- this.countryContainer = y(
1806
+ const C = m("div", { class: p });
1807
+ if ((l = this.telInput.parentNode) == null || l.insertBefore(C, this.telInput), t || i || e) {
1808
+ this.countryContainer = m(
1809
1809
  "div",
1810
1810
  { class: "iti__country-container" },
1811
1811
  C
1812
- ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = y(
1812
+ ), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", t ? (this.selectedCountry = m(
1813
1813
  "button",
1814
1814
  {
1815
1815
  type: "button",
@@ -1821,75 +1821,75 @@ class G {
1821
1821
  role: "combobox"
1822
1822
  },
1823
1823
  this.countryContainer
1824
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = y(
1824
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
1825
1825
  "div",
1826
1826
  { class: "iti__selected-country" },
1827
1827
  this.countryContainer
1828
1828
  );
1829
- const _ = y("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
1830
- if (this.selectedCountryInner = y("div", { class: "iti__flag" }, _), this.selectedCountryA11yText = y(
1829
+ const b = m("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
1830
+ if (this.selectedCountryInner = m("div", { class: "iti__flag" }, b), this.selectedCountryA11yText = m(
1831
1831
  "span",
1832
1832
  { class: "iti__a11y-text" },
1833
1833
  this.selectedCountryInner
1834
- ), t && (this.dropdownArrow = y(
1834
+ ), t && (this.dropdownArrow = m(
1835
1835
  "div",
1836
1836
  { class: "iti__arrow", "aria-hidden": "true" },
1837
- _
1838
- )), e && (this.selectedDialCode = y(
1837
+ b
1838
+ )), e && (this.selectedDialCode = m(
1839
1839
  "div",
1840
1840
  { class: "iti__selected-dial-code" },
1841
1841
  this.selectedCountry
1842
1842
  )), t) {
1843
1843
  const f = r ? "" : "iti--flexible-dropdown-width";
1844
- if (this.dropdownContent = y("div", {
1844
+ if (this.dropdownContent = m("div", {
1845
1845
  id: `iti-${this.id}__dropdown-content`,
1846
1846
  class: `iti__dropdown-content iti__hide ${f}`
1847
- }), h && (this.searchInput = y(
1847
+ }), c && (this.searchInput = m(
1848
1848
  "input",
1849
1849
  {
1850
1850
  type: "text",
1851
1851
  class: "iti__search-input",
1852
- placeholder: c.searchPlaceholder,
1852
+ placeholder: y.searchPlaceholder,
1853
1853
  role: "combobox",
1854
1854
  "aria-expanded": "true",
1855
- "aria-label": c.searchPlaceholder,
1855
+ "aria-label": y.searchPlaceholder,
1856
1856
  "aria-controls": `iti-${this.id}__country-listbox`,
1857
1857
  "aria-autocomplete": "list",
1858
1858
  autocomplete: "off"
1859
1859
  },
1860
1860
  this.dropdownContent
1861
- ), this.searchResultsA11yText = y(
1861
+ ), this.searchResultsA11yText = m(
1862
1862
  "span",
1863
1863
  { class: "iti__a11y-text" },
1864
1864
  this.dropdownContent
1865
- )), this.countryList = y(
1865
+ )), this.countryList = m(
1866
1866
  "ul",
1867
1867
  {
1868
1868
  class: "iti__country-list",
1869
1869
  id: `iti-${this.id}__country-listbox`,
1870
1870
  role: "listbox",
1871
- "aria-label": c.countryListAriaLabel
1871
+ "aria-label": y.countryListAriaLabel
1872
1872
  },
1873
1873
  this.dropdownContent
1874
- ), this._appendListItems(), h && this._updateSearchResultsText(), o) {
1875
- let g = "iti iti--container";
1876
- s && (g += ` ${s}`), a ? g += " iti--fullscreen-popup" : g += " iti--inline-dropdown", this.dropdown = y("div", { class: g }), this.dropdown.appendChild(this.dropdownContent);
1874
+ ), this._appendListItems(), c && this._updateSearchResultsText(), o) {
1875
+ let _ = "iti iti--container";
1876
+ s && (_ += ` ${s}`), a ? _ += " iti--fullscreen-popup" : _ += " iti--inline-dropdown", this.dropdown = m("div", { class: _ }), this.dropdown.appendChild(this.dropdownContent);
1877
1877
  } else
1878
1878
  this.countryContainer.appendChild(this.dropdownContent);
1879
1879
  }
1880
1880
  }
1881
1881
  if (C.appendChild(this.telInput), this._updateInputPadding(), n) {
1882
- const _ = this.telInput.getAttribute("name") || "", f = n(_);
1882
+ const b = this.telInput.getAttribute("name") || "", f = n(b);
1883
1883
  if (f.phone) {
1884
- const g = (m = this.telInput.form) == null ? void 0 : m.querySelector(`input[name="${f.phone}"]`);
1885
- g ? this.hiddenInput = g : (this.hiddenInput = y("input", {
1884
+ const _ = (d = this.telInput.form) == null ? void 0 : d.querySelector(`input[name="${f.phone}"]`);
1885
+ _ ? this.hiddenInput = _ : (this.hiddenInput = m("input", {
1886
1886
  type: "hidden",
1887
1887
  name: f.phone
1888
1888
  }), C.appendChild(this.hiddenInput));
1889
1889
  }
1890
1890
  if (f.country) {
1891
- const g = (b = this.telInput.form) == null ? void 0 : b.querySelector(`input[name="${f.country}"]`);
1892
- g ? this.hiddenInputCountry = g : (this.hiddenInputCountry = y("input", {
1891
+ const _ = (g = this.telInput.form) == null ? void 0 : g.querySelector(`input[name="${f.country}"]`);
1892
+ _ ? this.hiddenInputCountry = _ : (this.hiddenInputCountry = m("input", {
1893
1893
  type: "hidden",
1894
1894
  name: f.country
1895
1895
  }), C.appendChild(this.hiddenInputCountry));
@@ -1899,7 +1899,7 @@ class G {
1899
1899
  //* For each country: add a country list item <li> to the countryList <ul> container.
1900
1900
  _appendListItems() {
1901
1901
  for (let t = 0; t < this.countries.length; t++) {
1902
- const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = y(
1902
+ const e = this.countries[t], i = t === 0 ? "iti__highlight" : "", s = m(
1903
1903
  "li",
1904
1904
  {
1905
1905
  id: `iti-${this.id}__item-${e.iso2}`,
@@ -1921,10 +1921,10 @@ class G {
1921
1921
  //* 1. Extracting a dial code from the given number
1922
1922
  //* 2. Using explicit initialCountry
1923
1923
  _setInitialState(t = !1) {
1924
- 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), r = S(n), { initialCountry: a, geoIpLookup: h } = this.options, c = a === "auto" && h;
1924
+ 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), r = S(n), { initialCountry: a, geoIpLookup: c } = this.options, y = a === "auto" && c;
1925
1925
  if (o && !r)
1926
1926
  this._updateCountryFromNumber(n);
1927
- else if (!c || t) {
1927
+ else if (!y || t) {
1928
1928
  const p = a ? a.toLowerCase() : "";
1929
1929
  p && this._getCountryData(p, !0) ? this._setCountry(p) : o && r ? this._setCountry("us") : this._setCountry();
1930
1930
  }
@@ -1962,18 +1962,18 @@ class G {
1962
1962
  //* Init many requests: utils script / geo ip lookup.
1963
1963
  _initRequests() {
1964
1964
  let { loadUtils: t, initialCountry: e, geoIpLookup: i } = this.options;
1965
- t && !l.utils ? (this._handlePageLoad = () => {
1965
+ t && !u.utils ? (this._handlePageLoad = () => {
1966
1966
  var n;
1967
- window.removeEventListener("load", this._handlePageLoad), (n = l.attachUtils(t)) == null || n.catch(() => {
1967
+ window.removeEventListener("load", this._handlePageLoad), (n = u.attachUtils(t)) == null || n.catch(() => {
1968
1968
  });
1969
- }, l.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
1969
+ }, u.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), e === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
1970
1970
  }
1971
1971
  //* Perform the geo ip lookup.
1972
1972
  _loadAutoCountry() {
1973
- l.autoCountry ? this.handleAutoCountry() : l.startedLoadingAutoCountry || (l.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
1973
+ u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
1974
1974
  (t = "") => {
1975
1975
  const e = t.toLowerCase();
1976
- e && this._getCountryData(e, !0) ? (l.autoCountry = e, setTimeout(() => w("handleAutoCountry"))) : (this._setInitialState(!0), w("rejectAutoCountryPromise"));
1976
+ e && this._getCountryData(e, !0) ? (u.autoCountry = e, setTimeout(() => w("handleAutoCountry"))) : (this._setInitialState(!0), w("rejectAutoCountryPromise"));
1977
1977
  },
1978
1978
  () => {
1979
1979
  this._setInitialState(!0), w("rejectAutoCountryPromise");
@@ -1989,17 +1989,17 @@ class G {
1989
1989
  let r = !1;
1990
1990
  new RegExp("\\p{L}", "u").test(this.telInput.value) && (r = !0), this._handleInputEvent = (a) => {
1991
1991
  if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && n && o) {
1992
- const C = this.telInput.selectionStart || 0, d = this.telInput.value.substring(0, C - 1), m = this.telInput.value.substring(C);
1993
- this.telInput.value = d + m, this._openDropdownWithPlus();
1992
+ const C = this.telInput.selectionStart || 0, l = this.telInput.value.substring(0, C - 1), d = this.telInput.value.substring(C);
1993
+ this.telInput.value = l + d, this._openDropdownWithPlus();
1994
1994
  return;
1995
1995
  }
1996
1996
  this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
1997
- const h = (a == null ? void 0 : a.data) && /[^+0-9]/.test(a.data), c = (a == null ? void 0 : a.inputType) === "insertFromPaste" && this.telInput.value;
1998
- h || c && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
1997
+ const c = (a == null ? void 0 : a.data) && /[^+0-9]/.test(a.data), y = (a == null ? void 0 : a.inputType) === "insertFromPaste" && this.telInput.value;
1998
+ c || y && !t ? r = !0 : /[^+0-9]/.test(this.telInput.value) || (r = !1);
1999
1999
  const p = (a == null ? void 0 : a.detail) && a.detail.isSetNumber && !s;
2000
2000
  if (e && !r && !p) {
2001
- const C = this.telInput.selectionStart || 0, m = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, b = (a == null ? void 0 : a.inputType) === "deleteContentForward", _ = this._formatNumberAsYouType(), f = K(m, _, C, b);
2002
- this.telInput.value = _, this.telInput.setSelectionRange(f, f);
2001
+ const C = this.telInput.selectionStart || 0, d = this.telInput.value.substring(0, C).replace(/[^+0-9]/g, "").length, g = (a == null ? void 0 : a.inputType) === "deleteContentForward", b = this._formatNumberAsYouType(), f = K(d, b, C, g);
2002
+ this.telInput.value = b, this.telInput.setSelectionRange(f, f);
2003
2003
  }
2004
2004
  }, this.telInput.addEventListener("input", this._handleInputEvent), (t || i) && (this._handleKeydownEvent = (a) => {
2005
2005
  if (a.key && a.key.length === 1 && !a.altKey && !a.ctrlKey && !a.metaKey) {
@@ -2008,8 +2008,8 @@ class G {
2008
2008
  return;
2009
2009
  }
2010
2010
  if (t) {
2011
- const h = this.telInput.value, p = !(h.charAt(0) === "+") && this.telInput.selectionStart === 0 && a.key === "+", C = /^[0-9]$/.test(a.key), d = i ? C : p || C, m = h.slice(0, this.telInput.selectionStart) + a.key + h.slice(this.telInput.selectionEnd), b = this._getFullNumber(m), _ = l.utils.getCoreNumber(b, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && _.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(b) !== null;
2012
- (!d || f && !P && !p) && a.preventDefault();
2011
+ const c = this.telInput.value, p = !(c.charAt(0) === "+") && this.telInput.selectionStart === 0 && a.key === "+", C = /^[0-9]$/.test(a.key), l = i ? C : p || C, d = c.slice(0, this.telInput.selectionStart) + a.key + c.slice(this.telInput.selectionEnd), g = this._getFullNumber(d), b = u.utils.getCoreNumber(g, this.selectedCountryData.iso2), f = this.maxCoreNumberLength && b.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(g) !== null;
2012
+ (!l || f && !P && !p) && a.preventDefault();
2013
2013
  }
2014
2014
  }
2015
2015
  }, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
@@ -2098,13 +2098,22 @@ class G {
2098
2098
  _filterCountries(t, e = !1) {
2099
2099
  let i = !0;
2100
2100
  this.countryList.innerHTML = "";
2101
- const s = A(t);
2102
- for (let n = 0; n < this.countries.length; n++) {
2103
- const o = this.countries[n], r = A(o.name), a = o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((c) => c[0]).join("").toLowerCase(), h = `+${o.dialCode}`;
2104
- if (e || r.includes(s) || h.includes(s) || o.iso2.includes(s) || a.includes(s)) {
2105
- const c = o.nodeById[this.id];
2106
- c && this.countryList.appendChild(c), i && (this._highlightListItem(c, !1), i = !1);
2107
- }
2101
+ const s = A(t), n = s.length, o = [], r = [], a = [], c = [], y = [], p = [];
2102
+ for (let l = 0; l < this.countries.length; l++) {
2103
+ const d = this.countries[l], g = A(d.name), b = d.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((f) => f[0]).join("").toLowerCase();
2104
+ e || n === 0 ? a.push(d) : d.iso2.toLowerCase() === s ? o.push(d) : g.startsWith(s) ? r.push(d) : g.includes(s) ? a.push(d) : s === d.dialCode || s === `+${d.dialCode}` ? c.push(d) : `+${d.dialCode}`.includes(s) ? y.push(d) : b.includes(s) && p.push(d);
2105
+ }
2106
+ const C = [
2107
+ ...o.sort((l, d) => l.priority - d.priority),
2108
+ ...r.sort((l, d) => l.priority - d.priority),
2109
+ ...a.sort((l, d) => l.priority - d.priority),
2110
+ ...c.sort((l, d) => l.priority - d.priority),
2111
+ ...y.sort((l, d) => l.priority - d.priority),
2112
+ ...p.sort((l, d) => l.priority - d.priority)
2113
+ ];
2114
+ for (const l of C) {
2115
+ const d = l.nodeById[this.id];
2116
+ d && (this.countryList.appendChild(d), i && (this._highlightListItem(d, !1), i = !1));
2108
2117
  }
2109
2118
  i && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
2110
2119
  }
@@ -2128,9 +2137,9 @@ class G {
2128
2137
  //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2129
2138
  _updateValFromNumber(t) {
2130
2139
  let e = t;
2131
- if (this.options.formatOnDisplay && l.utils && this.selectedCountryData) {
2132
- const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = l.utils.numberFormat, o = i ? s : n;
2133
- e = l.utils.formatNumber(
2140
+ if (this.options.formatOnDisplay && u.utils && this.selectedCountryData) {
2141
+ const i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: n } = u.utils.numberFormat, o = i ? s : n;
2142
+ e = u.utils.formatNumber(
2134
2143
  e,
2135
2144
  this.selectedCountryData.iso2,
2136
2145
  o
@@ -2161,14 +2170,14 @@ class G {
2161
2170
  i = this._ensureHasDialCode(i);
2162
2171
  const o = this._getDialCode(i, !0), r = v(i);
2163
2172
  if (o) {
2164
- const a = v(o), h = this.dialCodeToIso2Map[a];
2165
- if (!s && this.defaultCountry && h.includes(this.defaultCountry))
2173
+ const a = v(o), c = this.dialCodeToIso2Map[a];
2174
+ if (!s && this.defaultCountry && c.includes(this.defaultCountry))
2166
2175
  return this.defaultCountry;
2167
- const c = this.selectedCountryData.areaCodes && r.length > a.length, p = s && h.includes(s) && !c;
2176
+ const y = this.selectedCountryData.areaCodes && r.length > a.length, p = s && c.includes(s) && !y;
2168
2177
  if (!(n === "1" && S(r)) && !p) {
2169
- for (let d = 0; d < h.length; d++)
2170
- if (h[d])
2171
- return h[d];
2178
+ for (let l = 0; l < c.length; l++)
2179
+ if (c[l])
2180
+ return c[l];
2172
2181
  }
2173
2182
  } else {
2174
2183
  if (i.charAt(0) === "+" && r.length)
@@ -2222,18 +2231,18 @@ class G {
2222
2231
  //* Update the maximum valid number length for the currently selected country.
2223
2232
  _updateMaxLength() {
2224
2233
  const { strictMode: t, placeholderNumberType: e, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
2225
- if (t && l.utils)
2234
+ if (t && u.utils)
2226
2235
  if (s) {
2227
- const n = l.utils.numberType[e];
2228
- let o = l.utils.getExampleNumber(
2236
+ const n = u.utils.numberType[e];
2237
+ let o = u.utils.getExampleNumber(
2229
2238
  s,
2230
2239
  !1,
2231
2240
  n,
2232
2241
  !0
2233
2242
  ), r = o;
2234
- for (; l.utils.isPossibleNumber(o, s, i); )
2243
+ for (; u.utils.isPossibleNumber(o, s, i); )
2235
2244
  r = o, o += "0";
2236
- const a = l.utils.getCoreNumber(r, s);
2245
+ const a = u.utils.getCoreNumber(r, s);
2237
2246
  this.maxCoreNumberLength = a.length, s === "by" && (this.maxCoreNumberLength = a.length + 1);
2238
2247
  } else
2239
2248
  this.maxCoreNumberLength = null;
@@ -2269,9 +2278,9 @@ class G {
2269
2278
  nationalMode: i,
2270
2279
  customPlaceholder: s
2271
2280
  } = this.options, n = t === "aggressive" || !this.hadInitialPlaceholder && t === "polite";
2272
- if (l.utils && n) {
2273
- const o = l.utils.numberType[e];
2274
- let r = this.selectedCountryData.iso2 ? l.utils.getExampleNumber(
2281
+ if (u.utils && n) {
2282
+ const o = u.utils.numberType[e];
2283
+ let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
2275
2284
  this.selectedCountryData.iso2,
2276
2285
  i,
2277
2286
  o
@@ -2298,12 +2307,12 @@ class G {
2298
2307
  }
2299
2308
  //* Check if an element is visible within it's container, else scroll until it is.
2300
2309
  _scrollTo(t) {
2301
- const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, h = a + r, c = a - n + e.scrollTop;
2310
+ const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, n = e.getBoundingClientRect().top + i, o = n + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, c = a + r, y = a - n + e.scrollTop;
2302
2311
  if (a < n)
2303
- e.scrollTop = c;
2304
- else if (h > o) {
2312
+ e.scrollTop = y;
2313
+ else if (c > o) {
2305
2314
  const p = s - r;
2306
- e.scrollTop = c - p;
2315
+ e.scrollTop = y - p;
2307
2316
  }
2308
2317
  }
2309
2318
  //* Replace any existing dial code with the new one
@@ -2364,7 +2373,7 @@ class G {
2364
2373
  }
2365
2374
  //* Format the number as the user types.
2366
2375
  _formatNumberAsYouType() {
2367
- const t = this._getFullNumber(), e = l.utils ? l.utils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, { dialCode: i } = this.selectedCountryData;
2376
+ const t = this._getFullNumber(), e = u.utils ? u.utils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, { dialCode: i } = this.selectedCountryData;
2368
2377
  return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && e.includes(`+${i}`) ? (e.split(`+${i}`)[1] || "").trim() : e;
2369
2378
  }
2370
2379
  //**************************
@@ -2372,11 +2381,11 @@ class G {
2372
2381
  //**************************
2373
2382
  //* This is called when the geoip call returns.
2374
2383
  handleAutoCountry() {
2375
- this.options.initialCountry === "auto" && l.autoCountry && (this.defaultCountry = l.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2384
+ this.options.initialCountry === "auto" && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2376
2385
  }
2377
2386
  //* This is called when the utils request completes.
2378
2387
  handleUtils() {
2379
- l.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
2388
+ u.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
2380
2389
  }
2381
2390
  //********************
2382
2391
  //* PUBLIC METHODS
@@ -2400,20 +2409,20 @@ class G {
2400
2409
  const { form: i } = this.telInput;
2401
2410
  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);
2402
2411
  const s = this.telInput.parentNode;
2403
- (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];
2412
+ (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 u.instances[this.id];
2404
2413
  }
2405
2414
  //* Get the extension from the current number.
2406
2415
  getExtension() {
2407
- return l.utils ? l.utils.getExtension(
2416
+ return u.utils ? u.utils.getExtension(
2408
2417
  this._getFullNumber(),
2409
2418
  this.selectedCountryData.iso2
2410
2419
  ) : "";
2411
2420
  }
2412
2421
  //* Format the number to the given format.
2413
2422
  getNumber(t) {
2414
- if (l.utils) {
2423
+ if (u.utils) {
2415
2424
  const { iso2: e } = this.selectedCountryData;
2416
- return l.utils.formatNumber(
2425
+ return u.utils.formatNumber(
2417
2426
  this._getFullNumber(),
2418
2427
  e,
2419
2428
  t
@@ -2423,7 +2432,7 @@ class G {
2423
2432
  }
2424
2433
  //* Get the type of the entered number e.g. landline/mobile.
2425
2434
  getNumberType() {
2426
- return l.utils ? l.utils.getNumberType(
2435
+ return u.utils ? u.utils.getNumberType(
2427
2436
  this._getFullNumber(),
2428
2437
  this.selectedCountryData.iso2
2429
2438
  ) : -99;
@@ -2434,9 +2443,9 @@ class G {
2434
2443
  }
2435
2444
  //* Get the validation error.
2436
2445
  getValidationError() {
2437
- if (l.utils) {
2446
+ if (u.utils) {
2438
2447
  const { iso2: t } = this.selectedCountryData;
2439
- return l.utils.getValidationError(this._getFullNumber(), t);
2448
+ return u.utils.getValidationError(this._getFullNumber(), t);
2440
2449
  }
2441
2450
  return -99;
2442
2451
  }
@@ -2452,7 +2461,7 @@ class G {
2452
2461
  return this._utilsIsPossibleNumber(t);
2453
2462
  }
2454
2463
  _utilsIsPossibleNumber(t) {
2455
- return l.utils ? l.utils.isPossibleNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2464
+ return u.utils ? u.utils.isPossibleNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2456
2465
  }
2457
2466
  //* Validate the input val (precise)
2458
2467
  isValidNumberPrecise() {
@@ -2466,7 +2475,7 @@ class G {
2466
2475
  return this._utilsIsValidNumber(t);
2467
2476
  }
2468
2477
  _utilsIsValidNumber(t) {
2469
- return l.utils ? l.utils.isValidNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2478
+ return u.utils ? u.utils.isValidNumber(t, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
2470
2479
  }
2471
2480
  //* Update the selected country, and update the input val accordingly.
2472
2481
  setCountry(t) {
@@ -2486,31 +2495,31 @@ class G {
2486
2495
  this.telInput.disabled = t, t ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
2487
2496
  }
2488
2497
  }
2489
- const W = (u) => {
2490
- if (!l.utils && !l.startedLoadingUtilsScript) {
2498
+ const G = (h) => {
2499
+ if (!u.utils && !u.startedLoadingUtilsScript) {
2491
2500
  let t;
2492
- if (typeof u == "function")
2501
+ if (typeof h == "function")
2493
2502
  try {
2494
- t = Promise.resolve(u());
2503
+ t = Promise.resolve(h());
2495
2504
  } catch (e) {
2496
2505
  return Promise.reject(e);
2497
2506
  }
2498
2507
  else
2499
- 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}`));
2500
- return l.startedLoadingUtilsScript = !0, t.then((e) => {
2508
+ return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof h}`));
2509
+ return u.startedLoadingUtilsScript = !0, t.then((e) => {
2501
2510
  const i = e == null ? void 0 : e.default;
2502
2511
  if (!i || typeof i != "object")
2503
2512
  throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
2504
- return l.utils = i, w("handleUtils"), !0;
2513
+ return u.utils = i, w("handleUtils"), !0;
2505
2514
  }).catch((e) => {
2506
2515
  throw w("rejectUtilsScriptPromise", e), e;
2507
2516
  });
2508
2517
  }
2509
2518
  return null;
2510
- }, l = Object.assign(
2511
- (u, t) => {
2512
- const e = new G(u, t);
2513
- return e._init(), u.setAttribute("data-intl-tel-input-id", e.id.toString()), l.instances[e.id] = e, u.iti = e, e;
2519
+ }, u = Object.assign(
2520
+ (h, t) => {
2521
+ const e = new W(h, t);
2522
+ return e._init(), h.setAttribute("data-intl-tel-input-id", e.id.toString()), u.instances[e.id] = e, h.iti = e, e;
2514
2523
  },
2515
2524
  {
2516
2525
  defaults: T,
@@ -2519,16 +2528,16 @@ const W = (u) => {
2519
2528
  //* Get the country data object.
2520
2529
  getCountryData: () => I,
2521
2530
  //* A getter for the plugin instance.
2522
- getInstance: (u) => {
2523
- const t = u.getAttribute("data-intl-tel-input-id");
2524
- return t ? l.instances[t] : null;
2531
+ getInstance: (h) => {
2532
+ const t = h.getAttribute("data-intl-tel-input-id");
2533
+ return t ? u.instances[t] : null;
2525
2534
  },
2526
2535
  //* A map from instance ID to instance object.
2527
2536
  instances: {},
2528
- attachUtils: W,
2537
+ attachUtils: G,
2529
2538
  startedLoadingUtilsScript: !1,
2530
2539
  startedLoadingAutoCountry: !1,
2531
- version: "25.4.8"
2540
+ version: "25.5.0"
2532
2541
  }
2533
2542
  ), Y = {
2534
2543
  __name: "IntlTelInput",
@@ -2562,39 +2571,39 @@ const W = (u) => {
2562
2571
  "changeValidity",
2563
2572
  "changeErrorCode"
2564
2573
  ], ["update:modelValue"]),
2565
- setup(u, { expose: t, emit: e }) {
2566
- const i = x(u, "modelValue"), s = u, n = e, o = L(), r = L(), a = L(!1), h = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, c = () => {
2567
- let d = h();
2568
- a.value !== d && (a.value = d, n("changeValidity", !!d), n(
2574
+ setup(h, { expose: t, emit: e }) {
2575
+ const i = x(h, "modelValue"), s = h, n = e, o = L(), r = L(), a = L(!1), c = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, y = () => {
2576
+ let l = c();
2577
+ a.value !== l && (a.value = l, n("changeValidity", !!l), n(
2569
2578
  "changeErrorCode",
2570
- d ? null : r.value.getValidationError()
2579
+ l ? null : r.value.getValidationError()
2571
2580
  ));
2572
2581
  }, p = () => {
2573
- var d;
2574
- n("changeNumber", ((d = r.value) == null ? void 0 : d.getNumber()) ?? ""), c();
2582
+ var l;
2583
+ n("changeNumber", ((l = r.value) == null ? void 0 : l.getNumber()) ?? ""), y();
2575
2584
  }, C = () => {
2576
- var d;
2577
- n("changeCountry", ((d = r.value) == null ? void 0 : d.getSelectedCountryData().iso2) ?? ""), p(), c();
2585
+ var l;
2586
+ n("changeCountry", ((l = r.value) == null ? void 0 : l.getSelectedCountryData().iso2) ?? ""), p(), y();
2578
2587
  };
2579
2588
  return E(() => {
2580
- o.value && (r.value = l(o.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = h());
2589
+ o.value && (r.value = u(o.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = c());
2581
2590
  }), M(
2582
2591
  () => s.disabled,
2583
- (d) => {
2584
- var m;
2585
- return (m = r.value) == null ? void 0 : m.setDisabled(d);
2592
+ (l) => {
2593
+ var d;
2594
+ return (d = r.value) == null ? void 0 : d.setDisabled(l);
2586
2595
  }
2587
2596
  ), F(() => {
2588
- var d;
2589
- return (d = r.value) == null ? void 0 : d.destroy();
2590
- }), t({ instance: r, input: o }), (d, m) => B((z(), V("input", R({
2597
+ var l;
2598
+ return (l = r.value) == null ? void 0 : l.destroy();
2599
+ }), t({ instance: r, input: o }), (l, d) => B((z(), V("input", R({
2591
2600
  ref_key: "input",
2592
2601
  ref: o,
2593
- "onUpdate:modelValue": m[0] || (m[0] = (b) => i.value = b),
2602
+ "onUpdate:modelValue": d[0] || (d[0] = (g) => i.value = g),
2594
2603
  type: "tel",
2595
2604
  onCountrychange: C,
2596
2605
  onInput: p
2597
- }, u.inputProps), null, 16)), [
2606
+ }, h.inputProps), null, 16)), [
2598
2607
  [
2599
2608
  O,
2600
2609
  i.value,