intl-tel-input 25.10.6 → 25.10.8

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.
Files changed (35) hide show
  1. package/README.md +5 -5
  2. package/angular/README.md +1 -1
  3. package/angular/build/IntlTelInput.js +415 -316
  4. package/angular/build/IntlTelInputWithUtils.js +466 -338
  5. package/angular/build/types/intl-tel-input/angular.d.ts +2 -1
  6. package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +2 -1
  7. package/angular/build/types/intl-tel-input/data.d.ts +3 -1
  8. package/angular/build/types/intl-tel-input/i18n/types.d.ts +2 -245
  9. package/angular/build/types/intl-tel-input.d.ts +17 -87
  10. package/angular/build/types/modules/core/options.d.ts +3 -0
  11. package/angular/build/types/modules/data/country-data.d.ts +12 -0
  12. package/angular/build/types/modules/data/nanp-regionless.d.ts +2 -0
  13. package/angular/build/types/modules/format/caret.d.ts +1 -0
  14. package/angular/build/types/modules/format/formatting.d.ts +3 -0
  15. package/angular/build/types/modules/types/public-api.d.ts +79 -0
  16. package/angular/build/types/modules/utils/dom.d.ts +1 -0
  17. package/angular/build/types/modules/utils/string.d.ts +2 -0
  18. package/build/js/data.js +3 -2
  19. package/build/js/data.min.js +2 -2
  20. package/build/js/intlTelInput.d.ts +100 -292
  21. package/build/js/intlTelInput.js +461 -357
  22. package/build/js/intlTelInput.min.js +13 -13
  23. package/build/js/intlTelInputWithUtils.js +512 -379
  24. package/build/js/intlTelInputWithUtils.min.js +13 -13
  25. package/build/js/utils.js +18 -15
  26. package/package.json +1 -1
  27. package/react/README.md +1 -1
  28. package/react/build/IntlTelInput.cjs +460 -356
  29. package/react/build/IntlTelInput.d.ts +104 -294
  30. package/react/build/IntlTelInput.js +460 -356
  31. package/react/build/IntlTelInputWithUtils.cjs +511 -378
  32. package/react/build/IntlTelInputWithUtils.js +511 -378
  33. package/vue/README.md +1 -1
  34. package/vue/build/IntlTelInput.mjs +506 -452
  35. package/vue/build/IntlTelInputWithUtils.mjs +1096 -1013
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.10.6
2
+ * International Telephone Input v25.10.8
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1646,11 +1646,7 @@ var factoryOutput = (() => {
1646
1646
  var allTranslations = { ...countries_default, ...interface_default };
1647
1647
  var en_default = allTranslations;
1648
1648
 
1649
- // src/js/intl-tel-input.ts
1650
- for (const c of data_default) {
1651
- c.name = en_default[c.iso2];
1652
- }
1653
- var id = 0;
1649
+ // src/js/modules/core/options.ts
1654
1650
  var mq = (q) => {
1655
1651
  return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
1656
1652
  };
@@ -1716,6 +1712,181 @@ var factoryOutput = (() => {
1716
1712
  //* The number type to enforce during validation.
1717
1713
  validationNumberTypes: ["MOBILE"]
1718
1714
  };
1715
+ function applyOptionSideEffects(o) {
1716
+ if (o.useFullscreenPopup) {
1717
+ o.fixDropdownWidth = false;
1718
+ }
1719
+ if (o.onlyCountries.length === 1) {
1720
+ o.initialCountry = o.onlyCountries[0];
1721
+ }
1722
+ if (o.separateDialCode) {
1723
+ o.nationalMode = false;
1724
+ }
1725
+ if (o.allowDropdown && !o.showFlags && !o.separateDialCode) {
1726
+ o.nationalMode = false;
1727
+ }
1728
+ if (o.useFullscreenPopup && !o.dropdownContainer) {
1729
+ o.dropdownContainer = document.body;
1730
+ }
1731
+ o.i18n = { ...en_default, ...o.i18n };
1732
+ }
1733
+
1734
+ // src/js/modules/utils/string.ts
1735
+ var getNumeric = (s) => s.replace(/\D/g, "");
1736
+ var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
1737
+
1738
+ // src/js/modules/utils/dom.ts
1739
+ var createEl = (tagName, attrs, container) => {
1740
+ const el = document.createElement(tagName);
1741
+ if (attrs) {
1742
+ Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value));
1743
+ }
1744
+ if (container) {
1745
+ container.appendChild(el);
1746
+ }
1747
+ return el;
1748
+ };
1749
+
1750
+ // src/js/modules/data/country-data.ts
1751
+ function processAllCountries(options) {
1752
+ const { onlyCountries, excludeCountries } = options;
1753
+ if (onlyCountries.length) {
1754
+ const lowerCaseOnlyCountries = onlyCountries.map((country) => country.toLowerCase());
1755
+ return data_default.filter((country) => lowerCaseOnlyCountries.includes(country.iso2));
1756
+ } else if (excludeCountries.length) {
1757
+ const lowerCaseExcludeCountries = excludeCountries.map((country) => country.toLowerCase());
1758
+ return data_default.filter((country) => !lowerCaseExcludeCountries.includes(country.iso2));
1759
+ }
1760
+ return data_default;
1761
+ }
1762
+ function translateCountryNames(countries, options) {
1763
+ for (const c of countries) {
1764
+ const iso2 = c.iso2.toLowerCase();
1765
+ if (options.i18n[iso2]) {
1766
+ c.name = options.i18n[iso2];
1767
+ }
1768
+ }
1769
+ }
1770
+ function processDialCodes(countries, options) {
1771
+ const dialCodes = /* @__PURE__ */ new Set();
1772
+ let dialCodeMaxLen = 0;
1773
+ const dialCodeToIso2Map = {};
1774
+ const _addToDialCodeMap = (iso2, dialCode, priority) => {
1775
+ if (!iso2 || !dialCode) {
1776
+ return;
1777
+ }
1778
+ if (dialCode.length > dialCodeMaxLen) {
1779
+ dialCodeMaxLen = dialCode.length;
1780
+ }
1781
+ if (!dialCodeToIso2Map.hasOwnProperty(dialCode)) {
1782
+ dialCodeToIso2Map[dialCode] = [];
1783
+ }
1784
+ const iso2List = dialCodeToIso2Map[dialCode];
1785
+ if (iso2List.includes(iso2)) {
1786
+ return;
1787
+ }
1788
+ const index = priority !== void 0 ? priority : iso2List.length;
1789
+ iso2List[index] = iso2;
1790
+ };
1791
+ for (const c of countries) {
1792
+ if (!dialCodes.has(c.dialCode)) {
1793
+ dialCodes.add(c.dialCode);
1794
+ }
1795
+ _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
1796
+ }
1797
+ if (options.onlyCountries.length || options.excludeCountries.length) {
1798
+ dialCodes.forEach((dialCode) => {
1799
+ dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
1800
+ });
1801
+ }
1802
+ for (const c of countries) {
1803
+ if (c.areaCodes) {
1804
+ const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
1805
+ for (const areaCode of c.areaCodes) {
1806
+ for (let k = 1; k < areaCode.length; k++) {
1807
+ const partialAreaCode = areaCode.substring(0, k);
1808
+ const partialDialCode = c.dialCode + partialAreaCode;
1809
+ _addToDialCodeMap(rootIso2Code, partialDialCode);
1810
+ _addToDialCodeMap(c.iso2, partialDialCode);
1811
+ }
1812
+ _addToDialCodeMap(c.iso2, c.dialCode + areaCode);
1813
+ }
1814
+ }
1815
+ }
1816
+ return { dialCodes, dialCodeMaxLen, dialCodeToIso2Map };
1817
+ }
1818
+ function sortCountries(countries, options) {
1819
+ if (options.countryOrder) {
1820
+ options.countryOrder = options.countryOrder.map((iso2) => iso2.toLowerCase());
1821
+ }
1822
+ countries.sort((a, b) => {
1823
+ const { countryOrder } = options;
1824
+ if (countryOrder) {
1825
+ const aIndex = countryOrder.indexOf(a.iso2);
1826
+ const bIndex = countryOrder.indexOf(b.iso2);
1827
+ const aIndexExists = aIndex > -1;
1828
+ const bIndexExists = bIndex > -1;
1829
+ if (aIndexExists || bIndexExists) {
1830
+ if (aIndexExists && bIndexExists) {
1831
+ return aIndex - bIndex;
1832
+ }
1833
+ return aIndexExists ? -1 : 1;
1834
+ }
1835
+ }
1836
+ return a.name.localeCompare(b.name);
1837
+ });
1838
+ }
1839
+ function cacheSearchTokens(countries) {
1840
+ for (const c of countries) {
1841
+ c.normalisedName = normaliseString(c.name);
1842
+ c.initials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
1843
+ c.dialCodePlus = `+${c.dialCode}`;
1844
+ }
1845
+ }
1846
+
1847
+ // src/js/modules/format/formatting.ts
1848
+ function beforeSetNumber(fullNumber, dialCode, separateDialCode, selectedCountryData) {
1849
+ let number = fullNumber;
1850
+ if (separateDialCode) {
1851
+ if (dialCode) {
1852
+ dialCode = `+${selectedCountryData.dialCode}`;
1853
+ const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
1854
+ number = number.substring(start);
1855
+ }
1856
+ }
1857
+ return number;
1858
+ }
1859
+ function formatNumberAsYouType(fullNumber, telInputValue, utils2, selectedCountryData, separateDialCode) {
1860
+ const result = utils2 ? utils2.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
1861
+ const { dialCode } = selectedCountryData;
1862
+ if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
1863
+ const afterDialCode = result.split(`+${dialCode}`)[1] || "";
1864
+ return afterDialCode.trim();
1865
+ }
1866
+ return result;
1867
+ }
1868
+
1869
+ // src/js/modules/format/caret.ts
1870
+ function translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) {
1871
+ if (prevCaretPos === 0 && !isDeleteForwards) {
1872
+ return 0;
1873
+ }
1874
+ let relevantCharCount = 0;
1875
+ for (let i = 0; i < formattedValue.length; i++) {
1876
+ if (/[+0-9]/.test(formattedValue[i])) {
1877
+ relevantCharCount++;
1878
+ }
1879
+ if (relevantCharCount === relevantChars && !isDeleteForwards) {
1880
+ return i + 1;
1881
+ }
1882
+ if (isDeleteForwards && relevantCharCount === relevantChars + 1) {
1883
+ return i;
1884
+ }
1885
+ }
1886
+ return formattedValue.length;
1887
+ }
1888
+
1889
+ // src/js/modules/data/nanp-regionless.ts
1719
1890
  var regionlessNanpNumbers = [
1720
1891
  "800",
1721
1892
  "822",
@@ -1735,8 +1906,6 @@ var factoryOutput = (() => {
1735
1906
  "888",
1736
1907
  "889"
1737
1908
  ];
1738
- var getNumeric = (s) => s.replace(/\D/g, "");
1739
- var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
1740
1909
  var isRegionlessNanp = (number) => {
1741
1910
  const numeric = getNumeric(number);
1742
1911
  if (numeric.charAt(0) === "1") {
@@ -1745,34 +1914,14 @@ var factoryOutput = (() => {
1745
1914
  }
1746
1915
  return false;
1747
1916
  };
1748
- var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
1749
- if (prevCaretPos === 0 && !isDeleteForwards) {
1750
- return 0;
1751
- }
1752
- let count = 0;
1753
- for (let i = 0; i < formattedValue.length; i++) {
1754
- if (/[+0-9]/.test(formattedValue[i])) {
1755
- count++;
1756
- }
1757
- if (count === relevantChars && !isDeleteForwards) {
1758
- return i + 1;
1759
- }
1760
- if (isDeleteForwards && count === relevantChars + 1) {
1761
- return i;
1762
- }
1763
- }
1764
- return formattedValue.length;
1765
- };
1766
- var createEl = (tagName, attrs, container) => {
1767
- const el = document.createElement(tagName);
1768
- if (attrs) {
1769
- Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value));
1770
- }
1771
- if (container) {
1772
- container.appendChild(el);
1773
- }
1774
- return el;
1775
- };
1917
+
1918
+ // src/js/intl-tel-input.ts
1919
+ for (const c of data_default) {
1920
+ c.name = en_default[c.iso2];
1921
+ }
1922
+ var id = 0;
1923
+ var iso2Set = new Set(data_default.map((c) => c.iso2));
1924
+ var isIso2 = (val) => iso2Set.has(val);
1776
1925
  var forEachInstance = (method, ...args) => {
1777
1926
  const { instances } = intlTelInput;
1778
1927
  Object.values(instances).forEach((instance) => instance[method](...args));
@@ -1792,23 +1941,7 @@ var factoryOutput = (() => {
1792
1941
  this.options = Object.assign({}, defaults, customOptions);
1793
1942
  this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
1794
1943
  }
1795
- //* Can't be private as it's called from intlTelInput convenience wrapper.
1796
- _init() {
1797
- if (this.options.useFullscreenPopup) {
1798
- this.options.fixDropdownWidth = false;
1799
- }
1800
- if (this.options.onlyCountries.length === 1) {
1801
- this.options.initialCountry = this.options.onlyCountries[0];
1802
- }
1803
- if (this.options.separateDialCode) {
1804
- this.options.nationalMode = false;
1805
- }
1806
- if (this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode) {
1807
- this.options.nationalMode = false;
1808
- }
1809
- if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
1810
- this.options.dropdownContainer = document.body;
1811
- }
1944
+ _detectEnvironmentAndLayout() {
1812
1945
  this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
1813
1946
  this.isRTL = !!this.telInput.closest("[dir=rtl]");
1814
1947
  this.telInput.dir = "ltr";
@@ -1821,7 +1954,8 @@ var factoryOutput = (() => {
1821
1954
  this.originalPaddingLeft = this.telInput.style.paddingLeft;
1822
1955
  }
1823
1956
  }
1824
- this.options.i18n = { ...en_default, ...this.options.i18n };
1957
+ }
1958
+ _createInitPromises() {
1825
1959
  const autoCountryPromise = new Promise((resolve, reject) => {
1826
1960
  this.resolveAutoCountryPromise = resolve;
1827
1961
  this.rejectAutoCountryPromise = reject;
@@ -1831,6 +1965,12 @@ var factoryOutput = (() => {
1831
1965
  this.rejectUtilsScriptPromise = reject;
1832
1966
  });
1833
1967
  this.promise = Promise.all([autoCountryPromise, utilsScriptPromise]);
1968
+ }
1969
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
1970
+ _init() {
1971
+ applyOptionSideEffects(this.options);
1972
+ this._detectEnvironmentAndLayout();
1973
+ this._createInitPromises();
1834
1974
  this.selectedCountryData = {};
1835
1975
  this._processCountryData();
1836
1976
  this._generateMarkup();
@@ -1843,139 +1983,37 @@ var factoryOutput = (() => {
1843
1983
  //********************
1844
1984
  //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
1845
1985
  _processCountryData() {
1846
- this._processAllCountries();
1847
- this._processDialCodes();
1848
- this._translateCountryNames();
1849
- this._sortCountries();
1986
+ this.countries = processAllCountries(this.options);
1987
+ const dialRes = processDialCodes(this.countries, this.options);
1988
+ this.dialCodes = dialRes.dialCodes;
1989
+ this.dialCodeMaxLen = dialRes.dialCodeMaxLen;
1990
+ this.dialCodeToIso2Map = dialRes.dialCodeToIso2Map;
1991
+ translateCountryNames(this.countries, this.options);
1992
+ sortCountries(this.countries, this.options);
1850
1993
  this.countryByIso2 = new Map(this.countries.map((c) => [c.iso2, c]));
1851
- this._cacheSearchTokens();
1852
- }
1853
- //* Precompute and cache country search tokens to speed up filtering
1854
- _cacheSearchTokens() {
1855
- for (const c of this.countries) {
1856
- c.normalisedName = normaliseString(c.name);
1857
- c.initials = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((word) => word[0]).join("").toLowerCase();
1858
- c.dialCodePlus = `+${c.dialCode}`;
1859
- }
1860
- }
1861
- //* Sort countries by countryOrder option (if present), then name.
1862
- _sortCountries() {
1863
- if (this.options.countryOrder) {
1864
- this.options.countryOrder = this.options.countryOrder.map((country) => country.toLowerCase());
1865
- }
1866
- this.countries.sort((a, b) => {
1867
- const { countryOrder } = this.options;
1868
- if (countryOrder) {
1869
- const aIndex = countryOrder.indexOf(a.iso2);
1870
- const bIndex = countryOrder.indexOf(b.iso2);
1871
- const aIndexExists = aIndex > -1;
1872
- const bIndexExists = bIndex > -1;
1873
- if (aIndexExists || bIndexExists) {
1874
- if (aIndexExists && bIndexExists) {
1875
- return aIndex - bIndex;
1876
- }
1877
- return aIndexExists ? -1 : 1;
1878
- }
1879
- }
1880
- return a.name.localeCompare(b.name);
1881
- });
1882
- }
1883
- //* Add a dial code to this.dialCodeToIso2Map.
1884
- _addToDialCodeMap(iso2, dialCode, priority) {
1885
- if (!iso2 || !dialCode) {
1886
- return;
1887
- }
1888
- if (dialCode.length > this.dialCodeMaxLen) {
1889
- this.dialCodeMaxLen = dialCode.length;
1890
- }
1891
- if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) {
1892
- this.dialCodeToIso2Map[dialCode] = [];
1893
- }
1894
- const iso2List = this.dialCodeToIso2Map[dialCode];
1895
- if (iso2List.includes(iso2)) {
1896
- return;
1897
- }
1898
- const index = priority !== void 0 ? priority : iso2List.length;
1899
- iso2List[index] = iso2;
1900
- }
1901
- //* Process onlyCountries or excludeCountries array if present.
1902
- _processAllCountries() {
1903
- const { onlyCountries, excludeCountries } = this.options;
1904
- if (onlyCountries.length) {
1905
- const lowerCaseOnlyCountries = onlyCountries.map(
1906
- (country) => country.toLowerCase()
1907
- );
1908
- this.countries = data_default.filter(
1909
- (country) => lowerCaseOnlyCountries.includes(country.iso2)
1910
- );
1911
- } else if (excludeCountries.length) {
1912
- const lowerCaseExcludeCountries = excludeCountries.map(
1913
- (country) => country.toLowerCase()
1914
- );
1915
- this.countries = data_default.filter(
1916
- (country) => !lowerCaseExcludeCountries.includes(country.iso2)
1917
- );
1918
- } else {
1919
- this.countries = data_default;
1920
- }
1921
- }
1922
- //* Translate Countries by object literal provided on config.
1923
- _translateCountryNames() {
1924
- for (const c of this.countries) {
1925
- const iso2 = c.iso2.toLowerCase();
1926
- if (this.options.i18n.hasOwnProperty(iso2)) {
1927
- c.name = this.options.i18n[iso2];
1928
- }
1929
- }
1930
- }
1931
- //* Generate this.dialCodes and this.dialCodeToIso2Map.
1932
- _processDialCodes() {
1933
- this.dialCodes = /* @__PURE__ */ new Set();
1934
- this.dialCodeMaxLen = 0;
1935
- this.dialCodeToIso2Map = {};
1936
- for (const c of this.countries) {
1937
- if (!this.dialCodes.has(c.dialCode)) {
1938
- this.dialCodes.add(c.dialCode);
1939
- }
1940
- this._addToDialCodeMap(c.iso2, c.dialCode, c.priority);
1941
- }
1942
- if (this.options.onlyCountries.length || this.options.excludeCountries.length) {
1943
- this.dialCodes.forEach((dialCode) => {
1944
- this.dialCodeToIso2Map[dialCode] = this.dialCodeToIso2Map[dialCode].filter(Boolean);
1945
- });
1946
- }
1947
- for (const c of this.countries) {
1948
- if (c.areaCodes) {
1949
- const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0];
1950
- for (const areaCode of c.areaCodes) {
1951
- for (let k = 1; k < areaCode.length; k++) {
1952
- const partialAreaCode = areaCode.substring(0, k);
1953
- const partialDialCode = c.dialCode + partialAreaCode;
1954
- this._addToDialCodeMap(rootIso2Code, partialDialCode);
1955
- this._addToDialCodeMap(c.iso2, partialDialCode);
1956
- }
1957
- this._addToDialCodeMap(c.iso2, c.dialCode + areaCode);
1958
- }
1959
- }
1960
- }
1994
+ cacheSearchTokens(this.countries);
1961
1995
  }
1962
1996
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
1963
1997
  _generateMarkup() {
1998
+ this._prepareTelInput();
1999
+ const wrapper = this._createWrapperAndInsert();
2000
+ this._maybeBuildCountryContainer(wrapper);
2001
+ wrapper.appendChild(this.telInput);
2002
+ this._maybeUpdateInputPaddingAndReveal();
2003
+ this._maybeBuildHiddenInputs(wrapper);
2004
+ }
2005
+ _prepareTelInput() {
1964
2006
  this.telInput.classList.add("iti__tel-input");
1965
2007
  if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
1966
2008
  this.telInput.setAttribute("autocomplete", "off");
1967
2009
  }
2010
+ }
2011
+ _createWrapperAndInsert() {
1968
2012
  const {
1969
2013
  allowDropdown,
1970
- separateDialCode,
1971
2014
  showFlags,
1972
2015
  containerClass,
1973
- hiddenInput,
1974
- dropdownContainer,
1975
- fixDropdownWidth,
1976
- useFullscreenPopup,
1977
- countrySearch,
1978
- i18n
2016
+ useFullscreenPopup
1979
2017
  } = this.options;
1980
2018
  const parentClasses = _Iti._buildClassNames({
1981
2019
  "iti": true,
@@ -1986,6 +2024,14 @@ var factoryOutput = (() => {
1986
2024
  });
1987
2025
  const wrapper = createEl("div", { class: parentClasses });
1988
2026
  this.telInput.parentNode?.insertBefore(wrapper, this.telInput);
2027
+ return wrapper;
2028
+ }
2029
+ _maybeBuildCountryContainer(wrapper) {
2030
+ const {
2031
+ allowDropdown,
2032
+ separateDialCode,
2033
+ showFlags
2034
+ } = this.options;
1989
2035
  if (allowDropdown || showFlags || separateDialCode) {
1990
2036
  this.countryContainer = createEl(
1991
2037
  "div",
@@ -2046,119 +2092,138 @@ var factoryOutput = (() => {
2046
2092
  );
2047
2093
  }
2048
2094
  if (allowDropdown) {
2049
- const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
2050
- this.dropdownContent = createEl("div", {
2051
- id: `iti-${this.id}__dropdown-content`,
2052
- class: `iti__dropdown-content iti__hide ${extraClasses}`,
2053
- role: "dialog",
2054
- "aria-modal": "true"
2055
- });
2056
- if (countrySearch) {
2057
- const searchWrapper = createEl(
2058
- "div",
2059
- { class: "iti__search-input-wrapper" },
2060
- this.dropdownContent
2061
- );
2062
- this.searchIcon = createEl(
2063
- "span",
2064
- {
2065
- class: "iti__search-icon",
2066
- "aria-hidden": "true"
2067
- },
2068
- searchWrapper
2069
- );
2070
- this.searchIcon.innerHTML = `
2071
- <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
2072
- <circle cx="11" cy="11" r="7" />
2073
- <line x1="21" y1="21" x2="16.65" y2="16.65" />
2074
- </svg>`;
2075
- this.searchInput = createEl(
2076
- "input",
2077
- {
2078
- id: `iti-${this.id}__search-input`,
2079
- // Chrome says inputs need either a name or an id
2080
- type: "search",
2081
- class: "iti__search-input",
2082
- placeholder: i18n.searchPlaceholder,
2083
- // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2084
- role: "combobox",
2085
- "aria-expanded": "true",
2086
- "aria-label": i18n.searchPlaceholder,
2087
- "aria-controls": `iti-${this.id}__country-listbox`,
2088
- "aria-autocomplete": "list",
2089
- "autocomplete": "off"
2090
- },
2091
- searchWrapper
2092
- );
2093
- this.searchClearButton = createEl(
2094
- "button",
2095
- {
2096
- type: "button",
2097
- class: "iti__search-clear iti__hide",
2098
- "aria-label": i18n.clearSearchAriaLabel,
2099
- tabindex: "-1"
2100
- },
2101
- searchWrapper
2102
- );
2103
- const maskId = `iti-${this.id}-clear-mask`;
2104
- this.searchClearButton.innerHTML = `
2105
- <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
2106
- <mask id="${maskId}" maskUnits="userSpaceOnUse">
2107
- <rect width="16" height="16" fill="white" />
2108
- <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
2109
- </mask>
2110
- <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
2111
- </svg>`;
2112
- this.searchResultsA11yText = createEl(
2113
- "span",
2114
- { class: "iti__a11y-text" },
2115
- this.dropdownContent
2116
- );
2117
- this.searchNoResults = createEl(
2118
- "div",
2119
- {
2120
- class: "iti__no-results iti__hide",
2121
- "aria-hidden": "true"
2122
- // all a11y messaging happens in this.searchResultsA11yText
2123
- },
2124
- this.dropdownContent
2125
- );
2126
- this.searchNoResults.textContent = i18n.zeroSearchResults;
2127
- }
2128
- this.countryList = createEl(
2129
- "ul",
2130
- {
2131
- class: "iti__country-list",
2132
- id: `iti-${this.id}__country-listbox`,
2133
- role: "listbox",
2134
- "aria-label": i18n.countryListAriaLabel
2135
- },
2136
- this.dropdownContent
2137
- );
2138
- this._appendListItems();
2139
- if (countrySearch) {
2140
- this._updateSearchResultsA11yText();
2141
- }
2142
- if (dropdownContainer) {
2143
- const dropdownClasses = _Iti._buildClassNames({
2144
- "iti": true,
2145
- "iti--container": true,
2146
- "iti--fullscreen-popup": useFullscreenPopup,
2147
- "iti--inline-dropdown": !useFullscreenPopup,
2148
- [containerClass]: Boolean(containerClass)
2149
- });
2150
- this.dropdown = createEl("div", { class: dropdownClasses });
2151
- this.dropdown.appendChild(this.dropdownContent);
2152
- } else {
2153
- this.countryContainer.appendChild(this.dropdownContent);
2154
- }
2095
+ this._buildDropdownContent();
2155
2096
  }
2156
2097
  }
2157
- wrapper.appendChild(this.telInput);
2098
+ }
2099
+ _buildDropdownContent() {
2100
+ const {
2101
+ fixDropdownWidth,
2102
+ useFullscreenPopup,
2103
+ countrySearch,
2104
+ i18n,
2105
+ dropdownContainer,
2106
+ containerClass
2107
+ } = this.options;
2108
+ const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
2109
+ this.dropdownContent = createEl("div", {
2110
+ id: `iti-${this.id}__dropdown-content`,
2111
+ class: `iti__dropdown-content iti__hide ${extraClasses}`,
2112
+ role: "dialog",
2113
+ "aria-modal": "true"
2114
+ });
2115
+ if (countrySearch) {
2116
+ this._buildSearchUI();
2117
+ }
2118
+ this.countryList = createEl(
2119
+ "ul",
2120
+ {
2121
+ class: "iti__country-list",
2122
+ id: `iti-${this.id}__country-listbox`,
2123
+ role: "listbox",
2124
+ "aria-label": i18n.countryListAriaLabel
2125
+ },
2126
+ this.dropdownContent
2127
+ );
2128
+ this._appendListItems();
2129
+ if (countrySearch) {
2130
+ this._updateSearchResultsA11yText();
2131
+ }
2132
+ if (dropdownContainer) {
2133
+ const dropdownClasses = _Iti._buildClassNames({
2134
+ "iti": true,
2135
+ "iti--container": true,
2136
+ "iti--fullscreen-popup": useFullscreenPopup,
2137
+ "iti--inline-dropdown": !useFullscreenPopup,
2138
+ [containerClass]: Boolean(containerClass)
2139
+ });
2140
+ this.dropdown = createEl("div", { class: dropdownClasses });
2141
+ this.dropdown.appendChild(this.dropdownContent);
2142
+ } else {
2143
+ this.countryContainer.appendChild(this.dropdownContent);
2144
+ }
2145
+ }
2146
+ _buildSearchUI() {
2147
+ const { i18n } = this.options;
2148
+ const searchWrapper = createEl(
2149
+ "div",
2150
+ { class: "iti__search-input-wrapper" },
2151
+ this.dropdownContent
2152
+ );
2153
+ this.searchIcon = createEl(
2154
+ "span",
2155
+ {
2156
+ class: "iti__search-icon",
2157
+ "aria-hidden": "true"
2158
+ },
2159
+ searchWrapper
2160
+ );
2161
+ this.searchIcon.innerHTML = `
2162
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
2163
+ <circle cx="11" cy="11" r="7" />
2164
+ <line x1="21" y1="21" x2="16.65" y2="16.65" />
2165
+ </svg>`;
2166
+ this.searchInput = createEl(
2167
+ "input",
2168
+ {
2169
+ id: `iti-${this.id}__search-input`,
2170
+ // Chrome says inputs need either a name or an id
2171
+ type: "search",
2172
+ class: "iti__search-input",
2173
+ placeholder: i18n.searchPlaceholder,
2174
+ // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2175
+ role: "combobox",
2176
+ "aria-expanded": "true",
2177
+ "aria-label": i18n.searchPlaceholder,
2178
+ "aria-controls": `iti-${this.id}__country-listbox`,
2179
+ "aria-autocomplete": "list",
2180
+ "autocomplete": "off"
2181
+ },
2182
+ searchWrapper
2183
+ );
2184
+ this.searchClearButton = createEl(
2185
+ "button",
2186
+ {
2187
+ type: "button",
2188
+ class: "iti__search-clear iti__hide",
2189
+ "aria-label": i18n.clearSearchAriaLabel,
2190
+ tabindex: "-1"
2191
+ },
2192
+ searchWrapper
2193
+ );
2194
+ const maskId = `iti-${this.id}-clear-mask`;
2195
+ this.searchClearButton.innerHTML = `
2196
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
2197
+ <mask id="${maskId}" maskUnits="userSpaceOnUse">
2198
+ <rect width="16" height="16" fill="white" />
2199
+ <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
2200
+ </mask>
2201
+ <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
2202
+ </svg>`;
2203
+ this.searchResultsA11yText = createEl(
2204
+ "span",
2205
+ { class: "iti__a11y-text" },
2206
+ this.dropdownContent
2207
+ );
2208
+ this.searchNoResults = createEl(
2209
+ "div",
2210
+ {
2211
+ class: "iti__no-results iti__hide",
2212
+ "aria-hidden": "true"
2213
+ // all a11y messaging happens in this.searchResultsA11yText
2214
+ },
2215
+ this.dropdownContent
2216
+ );
2217
+ this.searchNoResults.textContent = i18n.zeroSearchResults;
2218
+ }
2219
+ _maybeUpdateInputPaddingAndReveal() {
2158
2220
  if (this.countryContainer) {
2159
2221
  this._updateInputPadding();
2160
2222
  this.countryContainer.classList.remove("iti__v-hide");
2161
2223
  }
2224
+ }
2225
+ _maybeBuildHiddenInputs(wrapper) {
2226
+ const { hiddenInput } = this.options;
2162
2227
  if (hiddenInput) {
2163
2228
  const telInputName = this.telInput.getAttribute("name") || "";
2164
2229
  const names = hiddenInput(telInputName);
@@ -2232,14 +2297,13 @@ var factoryOutput = (() => {
2232
2297
  this._updateCountryFromNumber(val);
2233
2298
  } else if (!isAutoCountry || overrideAutoCountry) {
2234
2299
  const lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : "";
2235
- const isValidInitialCountry = lowerInitialCountry && this._getCountryData(lowerInitialCountry, true);
2236
- if (isValidInitialCountry) {
2300
+ if (isIso2(lowerInitialCountry)) {
2237
2301
  this._setCountry(lowerInitialCountry);
2238
2302
  } else {
2239
2303
  if (dialCode && isRegionlessNanpNumber) {
2240
2304
  this._setCountry("us");
2241
2305
  } else {
2242
- this._setCountry();
2306
+ this._setCountry("");
2243
2307
  }
2244
2308
  }
2245
2309
  }
@@ -2342,8 +2406,7 @@ var factoryOutput = (() => {
2342
2406
  this.options.geoIpLookup(
2343
2407
  (iso2 = "") => {
2344
2408
  const iso2Lower = iso2.toLowerCase();
2345
- const isValidIso2 = iso2Lower && this._getCountryData(iso2Lower, true);
2346
- if (isValidIso2) {
2409
+ if (isIso2(iso2Lower)) {
2347
2410
  intlTelInput.autoCountry = iso2Lower;
2348
2411
  setTimeout(() => forEachInstance("handleAutoCountry"));
2349
2412
  } else {
@@ -2366,6 +2429,11 @@ var factoryOutput = (() => {
2366
2429
  }
2367
2430
  //* Initialize the tel input listeners.
2368
2431
  _initTelInputListeners() {
2432
+ this._bindInputListener();
2433
+ this._maybeBindKeydownListener();
2434
+ this._maybeBindPasteListener();
2435
+ }
2436
+ _bindInputListener() {
2369
2437
  const { strictMode, formatAsYouType, separateDialCode, allowDropdown, countrySearch } = this.options;
2370
2438
  let userOverrideFormatting = false;
2371
2439
  if (/\p{L}/u.test(this.telInput.value)) {
@@ -2396,13 +2464,23 @@ var factoryOutput = (() => {
2396
2464
  const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos);
2397
2465
  const relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
2398
2466
  const isDeleteForwards = e?.inputType === "deleteContentForward";
2399
- const formattedValue = this._formatNumberAsYouType();
2467
+ const fullNumber = this._getFullNumber();
2468
+ const formattedValue = formatNumberAsYouType(
2469
+ fullNumber,
2470
+ this.telInput.value,
2471
+ intlTelInput.utils,
2472
+ this.selectedCountryData,
2473
+ this.options.separateDialCode
2474
+ );
2400
2475
  const newCaretPos = translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
2401
2476
  this.telInput.value = formattedValue;
2402
2477
  this.telInput.setSelectionRange(newCaretPos, newCaretPos);
2403
2478
  }
2404
2479
  };
2405
2480
  this.telInput.addEventListener("input", this._handleInputEvent);
2481
+ }
2482
+ _maybeBindKeydownListener() {
2483
+ const { strictMode, separateDialCode, allowDropdown, countrySearch } = this.options;
2406
2484
  if (strictMode || separateDialCode) {
2407
2485
  this._handleKeydownEvent = (e) => {
2408
2486
  if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
@@ -2432,6 +2510,48 @@ var factoryOutput = (() => {
2432
2510
  this.telInput.addEventListener("keydown", this._handleKeydownEvent);
2433
2511
  }
2434
2512
  }
2513
+ _maybeBindPasteListener() {
2514
+ if (this.options.strictMode) {
2515
+ this._handlePasteEvent = (e) => {
2516
+ e.preventDefault();
2517
+ const input = this.telInput;
2518
+ const selStart = input.selectionStart;
2519
+ const selEnd = input.selectionEnd;
2520
+ const before = input.value.slice(0, selStart);
2521
+ const after = input.value.slice(selEnd);
2522
+ const iso2 = this.selectedCountryData.iso2;
2523
+ const pasted = e.clipboardData.getData("text");
2524
+ const initialCharSelected = selStart === 0 && selEnd > 0;
2525
+ const allowLeadingPlus = !input.value.startsWith("+") || initialCharSelected;
2526
+ const allowedChars = pasted.replace(/[^0-9+]/g, "");
2527
+ const hasLeadingPlus = allowedChars.startsWith("+");
2528
+ const numerics = allowedChars.replace(/\+/g, "");
2529
+ const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
2530
+ let newVal = before + sanitised + after;
2531
+ let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
2532
+ while (coreNumber.length === 0 && newVal.length > 0) {
2533
+ newVal = newVal.slice(0, -1);
2534
+ coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
2535
+ }
2536
+ if (!coreNumber) {
2537
+ return;
2538
+ }
2539
+ if (this.maxCoreNumberLength && coreNumber.length > this.maxCoreNumberLength) {
2540
+ if (input.selectionEnd === input.value.length) {
2541
+ const trimLength = coreNumber.length - this.maxCoreNumberLength;
2542
+ newVal = newVal.slice(0, newVal.length - trimLength);
2543
+ } else {
2544
+ return;
2545
+ }
2546
+ }
2547
+ input.value = newVal;
2548
+ const caretPos = selStart + sanitised.length;
2549
+ input.setSelectionRange(caretPos, caretPos);
2550
+ input.dispatchEvent(new InputEvent("input", { bubbles: true }));
2551
+ };
2552
+ this.telInput.addEventListener("paste", this._handlePasteEvent);
2553
+ }
2554
+ }
2435
2555
  //* Adhere to the input's maxlength attr.
2436
2556
  _cap(number) {
2437
2557
  const max = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
@@ -2585,43 +2705,14 @@ var factoryOutput = (() => {
2585
2705
  }
2586
2706
  //* Country search enabled: Filter the countries according to the search query.
2587
2707
  _filterCountries(query) {
2588
- let noCountriesAddedYet = true;
2589
2708
  this.countryList.innerHTML = "";
2590
- const normalisedQuery = normaliseString(query);
2591
2709
  let matchedCountries;
2592
2710
  if (query === "") {
2593
2711
  matchedCountries = this.countries;
2594
2712
  } else {
2595
- const iso2Matches = [];
2596
- const nameStartWith = [];
2597
- const nameContains = [];
2598
- const dialCodeMatches = [];
2599
- const dialCodeContains = [];
2600
- const initialsMatches = [];
2601
- for (const c of this.countries) {
2602
- if (c.iso2 === normalisedQuery) {
2603
- iso2Matches.push(c);
2604
- } else if (c.normalisedName.startsWith(normalisedQuery)) {
2605
- nameStartWith.push(c);
2606
- } else if (c.normalisedName.includes(normalisedQuery)) {
2607
- nameContains.push(c);
2608
- } else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
2609
- dialCodeMatches.push(c);
2610
- } else if (c.dialCodePlus.includes(normalisedQuery)) {
2611
- dialCodeContains.push(c);
2612
- } else if (c.initials.includes(normalisedQuery)) {
2613
- initialsMatches.push(c);
2614
- }
2615
- }
2616
- matchedCountries = [
2617
- ...iso2Matches.sort((a, b) => a.priority - b.priority),
2618
- ...nameStartWith.sort((a, b) => a.priority - b.priority),
2619
- ...nameContains.sort((a, b) => a.priority - b.priority),
2620
- ...dialCodeMatches.sort((a, b) => a.priority - b.priority),
2621
- ...dialCodeContains.sort((a, b) => a.priority - b.priority),
2622
- ...initialsMatches.sort((a, b) => a.priority - b.priority)
2623
- ];
2713
+ matchedCountries = this._getMatchedCountries(query);
2624
2714
  }
2715
+ let noCountriesAddedYet = true;
2625
2716
  for (const c of matchedCountries) {
2626
2717
  const listItem = c.nodeById[this.id];
2627
2718
  if (listItem) {
@@ -2643,6 +2734,38 @@ var factoryOutput = (() => {
2643
2734
  this.countryList.scrollTop = 0;
2644
2735
  this._updateSearchResultsA11yText();
2645
2736
  }
2737
+ _getMatchedCountries(query) {
2738
+ const normalisedQuery = normaliseString(query);
2739
+ const iso2Matches = [];
2740
+ const nameStartWith = [];
2741
+ const nameContains = [];
2742
+ const dialCodeMatches = [];
2743
+ const dialCodeContains = [];
2744
+ const initialsMatches = [];
2745
+ for (const c of this.countries) {
2746
+ if (c.iso2 === normalisedQuery) {
2747
+ iso2Matches.push(c);
2748
+ } else if (c.normalisedName.startsWith(normalisedQuery)) {
2749
+ nameStartWith.push(c);
2750
+ } else if (c.normalisedName.includes(normalisedQuery)) {
2751
+ nameContains.push(c);
2752
+ } else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
2753
+ dialCodeMatches.push(c);
2754
+ } else if (c.dialCodePlus.includes(normalisedQuery)) {
2755
+ dialCodeContains.push(c);
2756
+ } else if (c.initials.includes(normalisedQuery)) {
2757
+ initialsMatches.push(c);
2758
+ }
2759
+ }
2760
+ return [
2761
+ ...iso2Matches.sort((a, b) => a.priority - b.priority),
2762
+ ...nameStartWith.sort((a, b) => a.priority - b.priority),
2763
+ ...nameContains.sort((a, b) => a.priority - b.priority),
2764
+ ...dialCodeMatches.sort((a, b) => a.priority - b.priority),
2765
+ ...dialCodeContains.sort((a, b) => a.priority - b.priority),
2766
+ ...initialsMatches.sort((a, b) => a.priority - b.priority)
2767
+ ];
2768
+ }
2646
2769
  //* Update search results text (for a11y).
2647
2770
  _updateSearchResultsA11yText() {
2648
2771
  const { i18n } = this.options;
@@ -2773,24 +2896,12 @@ var factoryOutput = (() => {
2773
2896
  this.highlightedItem.focus();
2774
2897
  }
2775
2898
  }
2776
- //* Find the country data for the given iso2 code
2777
- //* the allowFail option is only used during init() for the initialCountry option, and for the iso2 returned from geoIpLookup - in these 2 cases we don't want to error out
2778
- _getCountryData(iso2, allowFail) {
2779
- const country = this.countryByIso2.get(iso2);
2780
- if (country) {
2781
- return country;
2782
- }
2783
- if (allowFail) {
2784
- return null;
2785
- }
2786
- throw new Error(`No country data for '${iso2}'`);
2787
- }
2788
2899
  //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
2789
2900
  //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2790
2901
  _setCountry(iso2) {
2791
2902
  const { separateDialCode, showFlags, i18n } = this.options;
2792
2903
  const prevIso2 = this.selectedCountryData.iso2 || "";
2793
- this.selectedCountryData = iso2 ? this._getCountryData(iso2, false) || {} : {};
2904
+ this.selectedCountryData = iso2 ? this.countryByIso2.get(iso2) : {};
2794
2905
  if (this.selectedCountryData.iso2) {
2795
2906
  this.defaultCountry = this.selectedCountryData.iso2;
2796
2907
  }
@@ -2909,11 +3020,11 @@ var factoryOutput = (() => {
2909
3020
  }
2910
3021
  //* Called when the user selects a list item from the dropdown.
2911
3022
  _selectListItem(listItem) {
2912
- const countryChanged = this._setCountry(
2913
- listItem.getAttribute("data-country-code")
2914
- );
3023
+ const iso2 = listItem.getAttribute("data-country-code");
3024
+ const countryChanged = this._setCountry(iso2);
2915
3025
  this._closeDropdown();
2916
- this._updateDialCode(listItem.getAttribute("data-dial-code"));
3026
+ const dialCode = listItem.getAttribute("data-dial-code");
3027
+ this._updateDialCode(dialCode);
2917
3028
  if (this.options.formatOnDisplay) {
2918
3029
  this._updateValFromNumber(this.telInput.value);
2919
3030
  }
@@ -3036,32 +3147,19 @@ var factoryOutput = (() => {
3036
3147
  }
3037
3148
  //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
3038
3149
  _beforeSetNumber(fullNumber) {
3039
- let number = fullNumber;
3040
- if (this.options.separateDialCode) {
3041
- let dialCode = this._getDialCode(number);
3042
- if (dialCode) {
3043
- dialCode = `+${this.selectedCountryData.dialCode}`;
3044
- const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
3045
- number = number.substring(start);
3046
- }
3047
- }
3150
+ const dialCode = this._getDialCode(fullNumber);
3151
+ const number = beforeSetNumber(
3152
+ fullNumber,
3153
+ dialCode,
3154
+ this.options.separateDialCode,
3155
+ this.selectedCountryData
3156
+ );
3048
3157
  return this._cap(number);
3049
3158
  }
3050
3159
  //* Trigger the 'countrychange' event.
3051
3160
  _triggerCountryChange() {
3052
3161
  this._trigger("countrychange");
3053
3162
  }
3054
- //* Format the number as the user types.
3055
- _formatNumberAsYouType() {
3056
- const val = this._getFullNumber();
3057
- const result = intlTelInput.utils ? intlTelInput.utils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val;
3058
- const { dialCode } = this.selectedCountryData;
3059
- if (this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
3060
- const afterDialCode = result.split(`+${dialCode}`)[1] || "";
3061
- return afterDialCode.trim();
3062
- }
3063
- return result;
3064
- }
3065
3163
  //**************************
3066
3164
  //* SECRET PUBLIC METHODS
3067
3165
  //**************************
@@ -3119,6 +3217,9 @@ var factoryOutput = (() => {
3119
3217
  if (this._handleKeydownEvent) {
3120
3218
  this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
3121
3219
  }
3220
+ if (this._handlePasteEvent) {
3221
+ this.telInput.removeEventListener("paste", this._handlePasteEvent);
3222
+ }
3122
3223
  this.telInput.removeAttribute("data-intl-tel-input-id");
3123
3224
  if (separateDialCode) {
3124
3225
  if (this.isRTL) {
@@ -3210,6 +3311,9 @@ var factoryOutput = (() => {
3210
3311
  //* Update the selected country, and update the input val accordingly.
3211
3312
  setCountry(iso2) {
3212
3313
  const iso2Lower = iso2?.toLowerCase();
3314
+ if (!isIso2(iso2Lower)) {
3315
+ throw new Error(`Invalid country code: '${iso2Lower}'`);
3316
+ }
3213
3317
  const currentCountry = this.selectedCountryData.iso2;
3214
3318
  const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
3215
3319
  if (isCountryChange) {
@@ -3297,7 +3401,7 @@ var factoryOutput = (() => {
3297
3401
  attachUtils,
3298
3402
  startedLoadingUtilsScript: false,
3299
3403
  startedLoadingAutoCountry: false,
3300
- version: "25.10.6"
3404
+ version: "25.10.8"
3301
3405
  }
3302
3406
  );
3303
3407
  var intl_tel_input_default = intlTelInput;
@@ -5046,12 +5150,12 @@ var factoryOutput = (() => {
5046
5150
  ,
5047
5151
  ,
5048
5152
  [9]
5049
- ], [, , "(?:60[1-8]\\d|7(?:0(?:[2-5]\\d|60)|19[0-4]|[2379]\\d\\d))\\d{5}", , , , "601123456", , , [9]], [, , "800\\d{6}", , , , "800123456", , , [9]], [, , "9(?:0[05689]|76)\\d{6}", , , , "900123456", , , [9]], [, , "8[134]\\d{7}", , , , "811234567", , , [9]], [, , "70[01]\\d{6}", , , , "700123456", , , [9]], [, , "9[17]0\\d{6}", , , , "910123456", , , [9]], "CZ", 420, "00", , , , , , , , [
5050
- [, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]],
5051
- [, "(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]],
5052
- [, "(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]],
5053
- [, "(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]
5054
- ], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "9(?:5\\d|7[2-4])\\d{6}", , , , "972123456", , , [9]], , , [, , "9(?:3\\d{9}|6\\d{7,10})", , , , "93123456789"]],
5153
+ ], [, , "7(?:060\\d|19(?:[0-4]\\d|50))\\d{4}|(?:60[1-8]|7(?:0[2-5]|[2379]\\d))\\d{6}", , , , "601123456", , , [9]], [, , "800\\d{6}", , , , "800123456", , , [9]], [, , "9(?:0[05689]|76)\\d{6}", , , , "900123456", , , [9]], [, , "8[134]\\d{7}", , , , "811234567", , , [9]], [, , "70[01]\\d{6}", , , , "700123456", , , [9]], [, , "9[17]0\\d{6}", , , , "910123456", , , [9]], "CZ", 420, "00", , , , , , , , [[, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], [, "(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], [
5154
+ ,
5155
+ "(\\d{2})(\\d{3})(\\d{3})(\\d{3})",
5156
+ "$1 $2 $3 $4",
5157
+ ["9"]
5158
+ ], [, "(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "9(?:5\\d|7[2-4])\\d{6}", , , , "972123456", , , [9]], , , [, , "9(?:3\\d{9}|6\\d{7,10})", , , , "93123456789"]],
5055
5159
  DE: [, [, , "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", , , , , , , [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3]], [
5056
5160
  ,
5057
5161
  ,
@@ -5072,6 +5176,7 @@ var factoryOutput = (() => {
5072
5176
  ["3[02]|40|[68]9"],
5073
5177
  "0$1"
5074
5178
  ],
5179
+ [, "(\\d{6})", "$1", ["227", "2277"]],
5075
5180
  [, "(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"],
5076
5181
  [
5077
5182
  ,
@@ -5095,7 +5200,38 @@ var factoryOutput = (() => {
5095
5200
  [, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
5096
5201
  [, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
5097
5202
  [, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
5098
- ], , [, , "16(?:4\\d{1,10}|[89]\\d{1,11})", , , , "16412345", , , [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]], , , [, , , , , , , , , [-1]], [, , "18(?:1\\d{5,11}|[2-9]\\d{8})", , , , "18500123456", , , [8, 9, 10, 11, 12, 13, 14]], , , [
5203
+ ], [
5204
+ [, "(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"],
5205
+ [
5206
+ ,
5207
+ "(\\d{3})(\\d{3,12})",
5208
+ "$1 $2",
5209
+ ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],
5210
+ "0$1"
5211
+ ],
5212
+ [
5213
+ ,
5214
+ "(\\d{4})(\\d{2,11})",
5215
+ "$1 $2",
5216
+ ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],
5217
+ "0$1"
5218
+ ],
5219
+ [, "(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"],
5220
+ [, "(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"],
5221
+ [, "(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"],
5222
+ [, "(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"],
5223
+ [, "(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"],
5224
+ [, "(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"],
5225
+ [, "(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"],
5226
+ [, "(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"],
5227
+ [, "(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"],
5228
+ [, "(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"],
5229
+ [, "(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|3[13])"], "0$1"],
5230
+ [, "(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"],
5231
+ [, "(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"],
5232
+ [, "(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"],
5233
+ [, "(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]
5234
+ ], [, , "16(?:4\\d{1,10}|[89]\\d{1,11})", , , , "16412345", , , [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]], , , [, , , , , , , , , [-1]], [, , "18(?:1\\d{5,11}|[2-9]\\d{8})", , , , "18500123456", , , [8, 9, 10, 11, 12, 13, 14]], , , [
5099
5235
  ,
5100
5236
  ,
5101
5237
  "1(?:6(?:013|255|399)|7(?:(?:[015]1|[69]3)3|[2-4]55|[78]99))\\d{7,8}|15(?:(?:[03-68]00|113)\\d|2\\d55|7\\d99|9\\d33)\\d{7}",
@@ -6193,17 +6329,14 @@ var factoryOutput = (() => {
6193
6329
  ,
6194
6330
  [7]
6195
6331
  ], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "49[0-24-79]\\d{4}", , , , "4921234", , , [7]], "IS", 354, "00|1(?:0(?:01|[12]0)|100)", , , , , , "00", , [[, "(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], [, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "809\\d{4}", , , , "8091234", , , [7]], , , [, , "(?:689|8(?:7[18]|80)|95[48])\\d{4}", , , , "6891234", , , [7]]],
6196
- IT: [, [, , "0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", , , , , , , [6, 7, 8, 9, 10, 11, 12]], [
6197
- ,
6198
- ,
6199
- "0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",
6332
+ IT: [, [, , "0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", , , , , , , [6, 7, 8, 9, 10, 11, 12]], [
6200
6333
  ,
6201
6334
  ,
6335
+ "0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",
6202
6336
  ,
6203
- "0212345678",
6204
6337
  ,
6205
6338
  ,
6206
- [6, 7, 8, 9, 10, 11]
6339
+ "0212345678"
6207
6340
  ], [, , "3[2-9]\\d{7,8}|(?:31|43)\\d{8}", , , , "3123456789", , , [9, 10]], [, , "80(?:0\\d{3}|3)\\d{3}", , , , "800123456", , , [6, 9]], [, , "(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", , , , "899123456", , , [6, 8, 9, 10]], [, , "84(?:[08]\\d{3}|[17])\\d{3}", , , , "848123456", , , [6, 9]], [, , "1(?:78\\d|99)\\d{6}", , , , "1781234567", , , [9, 10]], [, , "55\\d{8}", , , , "5512345678", , , [10]], "IT", 39, "00", , , , , , , , [
6208
6341
  [, "(\\d{4,5})", "$1", ["1(?:0|9[246])", "1(?:0|9(?:2[2-9]|[46]))"]],
6209
6342
  [, "(\\d{6})", "$1", ["1(?:1|92)"]],
@@ -6216,13 +6349,13 @@ var factoryOutput = (() => {
6216
6349
  [, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]],
6217
6350
  [, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]],
6218
6351
  [, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]],
6219
- [, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["3"]]
6352
+ [, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]
6220
6353
  ], [[, "(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], [, "(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], [, "(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], [, "(\\d{4})(\\d{4})", "$1 $2", ["894"]], [, "(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], [
6221
6354
  ,
6222
6355
  "(\\d{3})(\\d{3})(\\d{3,4})",
6223
6356
  "$1 $2 $3",
6224
6357
  ["1(?:44|[679])|[378]|43"]
6225
- ], [, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], [, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], [, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], [, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["3"]]], [, , , , , , , , , [-1]], 1, , [, , "848\\d{6}", , , , , , , [9]], [, , , , , , , , , [-1]], , , [, , "3[2-8]\\d{9,10}", , , , "33101234501", , , [11, 12]]],
6358
+ ], [, "(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], [, "(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], [, "(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], [, "(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[03]"]]], [, , , , , , , , , [-1]], 1, , [, , "848\\d{6}", , , , , , , [9]], [, , , , , , , , , [-1]], , , [, , "3[2-8]\\d{9,10}", , , , "33101234501", , , [11, 12]]],
6226
6359
  JE: [, [, , "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", , , , , , , [10], [6]], [, , "1534[0-24-8]\\d{5}", , , , "1534456789", , , , [6]], [
6227
6360
  ,
6228
6361
  ,
@@ -6605,7 +6738,7 @@ var factoryOutput = (() => {
6605
6738
  ,
6606
6739
  "5002345678"
6607
6740
  ], [, , , , , , , , , [-1]], "LC", 1, "011", "1", , , "([2-8]\\d{6})$|1", "758$1", , , , , [, , , , , , , , , [-1]], , "758", [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6608
- LI: [, [, , "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", , , , , , , [7, 9]], [, , "(?:2(?:01|1[27]|2[024]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}", , , , "2345678", , , [7]], [, , "(?:6(?:(?:4[5-9]|5[0-46-9])\\d|6(?:[024-6]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}", , , , "660234567"], [, , "8002[28]\\d\\d|80(?:05\\d|9)\\d{4}", , , , "8002222"], [
6741
+ LI: [, [, , "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", , , , , , , [7, 9]], [, , "(?:2(?:01|1[27]|2[024]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}", , , , "2345678", , , [7]], [, , "(?:6(?:(?:4[5-9]|5\\d)\\d|6(?:[024-6]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}", , , , "660234567"], [, , "8002[28]\\d\\d|80(?:05\\d|9)\\d{4}", , , , "8002222"], [
6609
6742
  ,
6610
6743
  ,
6611
6744
  "90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d",
@@ -6714,7 +6847,7 @@ var factoryOutput = (() => {
6714
6847
  ,
6715
6848
  "$CC $1"
6716
6849
  ], [, "(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"], , "$CC $1"], [, "(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"], , "$CC $1"], [, "(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["2(?:[0367]|4[3-8])"], , "$CC $1"], [, "(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"], , "$CC $1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6717
- LV: [, [, , "(?:[268]\\d|90)\\d{6}", , , , , , , [8]], [
6850
+ LV: [, [, , "(?:[268]\\d|78|90)\\d{6}", , , , , , , [8]], [
6718
6851
  ,
6719
6852
  ,
6720
6853
  "6\\d{7}",
@@ -6722,7 +6855,7 @@ var factoryOutput = (() => {
6722
6855
  ,
6723
6856
  ,
6724
6857
  "63123456"
6725
- ], [, , "2333[0-8]\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[02-9]|3[0-24-9]))\\d{4}", , , , "21234567"], [, , "80\\d{6}", , , , "80123456"], [, , "90\\d{6}", , , , "90123456"], [, , "81\\d{6}", , , , "81123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "LV", 371, "00", , , , , , , , [[, "(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[269]|8[01]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6858
+ ], [, , "2333[0-8]\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[02-9]|3[0-24-9]))\\d{4}", , , , "21234567"], [, , "80\\d{6}", , , , "80123456"], [, , "90\\d{6}", , , , "90123456"], [, , "81\\d{6}", , , , "81123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "LV", 371, "00", , , , , , , , [[, "(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2679]|8[01]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6726
6859
  LY: [, [, , "[2-9]\\d{8}", , , , , , , [9], [7]], [
6727
6860
  ,
6728
6861
  ,
@@ -6784,7 +6917,7 @@ var factoryOutput = (() => {
6784
6917
  ,
6785
6918
  [8],
6786
6919
  [6]
6787
- ], [, , "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", , , , "67622901", , , [8]], [, , "80(?:[0-2578]|9\\d)\\d{5}", , , , "80080002"], [, , "9(?:4[1568]|5[178])\\d{5}", , , , "94515151", , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "78[1-49]\\d{5}", , , , "78108780", , , [8]], "ME", 382, "00", "0", , , "0", , , , [[, "(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "77[1-9]\\d{5}", , , , "77273012", , , [8]], , , [, , , , , , , , , [-1]]],
6920
+ ], [, , "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", , , , "60123456", , , [8]], [, , "80(?:[0-2578]|9\\d)\\d{5}", , , , "80080002"], [, , "9(?:4[1568]|5[178])\\d{5}", , , , "94515151", , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "78[1-49]\\d{5}", , , , "78108780", , , [8]], "ME", 382, "00", "0", , , "0", , , , [[, "(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "77[1-9]\\d{5}", , , , "77273012", , , [8]], , , [, , , , , , , , , [-1]]],
6788
6921
  MF: [
6789
6922
  ,
6790
6923
  [, , "(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}", , , , , , , [9]],
@@ -7872,7 +8005,7 @@ var factoryOutput = (() => {
7872
8005
  ,
7873
8006
  ,
7874
8007
  [8]
7875
- ], [, , "8980\\d{4}|(?:8(?:0[1-9]|[1-8]\\d|9[0-7])|9[0-8]\\d)\\d{5}", , , , "81234567", , , [8]], [, , "(?:18|8)00\\d{7}", , , , "18001234567", , , [10, 11]], [, , "1900\\d{7}", , , , "19001234567", , , [11]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "(?:3[12]\\d|666)\\d{5}", , , , "31234567", , , [8]], "SG", 65, "0[0-3]\\d", , , , , , , , [[, "(\\d{4,5})", "$1", ["1[013-9]|77", "1(?:[013-8]|9(?:0[1-9]|[1-9]))|77"]], [, "(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-9]|[1-9])"]], [, "(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], [
8008
+ ], [, , "898[02-8]\\d{4}|(?:8(?:0[1-9]|[1-8]\\d|9[0-7])|9[0-8]\\d)\\d{5}", , , , "81234567", , , [8]], [, , "(?:18|8)00\\d{7}", , , , "18001234567", , , [10, 11]], [, , "1900\\d{7}", , , , "19001234567", , , [11]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "(?:3[12]\\d|666)\\d{5}", , , , "31234567", , , [8]], "SG", 65, "0[0-3]\\d", , , , , , , , [[, "(\\d{4,5})", "$1", ["1[013-9]|77", "1(?:[013-8]|9(?:0[1-9]|[1-9]))|77"]], [, "(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-9]|[1-9])"]], [, "(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], [
7876
8009
  ,
7877
8010
  "(\\d{4})(\\d{4})(\\d{3})",
7878
8011
  "$1 $2 $3",
@@ -8450,7 +8583,7 @@ var factoryOutput = (() => {
8450
8583
  ], [
8451
8584
  ,
8452
8585
  ,
8453
- "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8586
+ "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8454
8587
  ,
8455
8588
  ,
8456
8589
  ,
@@ -8462,7 +8595,7 @@ var factoryOutput = (() => {
8462
8595
  ], [
8463
8596
  ,
8464
8597
  ,
8465
- "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8598
+ "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8466
8599
  ,
8467
8600
  ,
8468
8601
  ,