intl-tel-input 28.0.9 → 29.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/intlTelInput-no-assets.css +20 -11
- package/dist/css/intlTelInput-no-assets.min.css +1 -1
- package/dist/css/intlTelInput.css +20 -11
- package/dist/css/intlTelInput.min.css +1 -1
- package/dist/js/data.js +1 -1
- package/dist/js/data.min.js +1 -1
- package/dist/js/intlTelInput.d.ts +38 -23
- package/dist/js/intlTelInput.js +392 -324
- package/dist/js/intlTelInput.min.js +2 -2
- package/dist/js/intlTelInput.mjs +391 -323
- package/dist/js/intlTelInputWithUtils.js +680 -614
- package/dist/js/intlTelInputWithUtils.min.js +2 -2
- package/dist/js/intlTelInputWithUtils.mjs +679 -613
- package/dist/js/{i18n → locale}/ar.js +3 -3
- package/dist/js/{i18n → locale}/bg.js +2 -2
- package/dist/js/{i18n → locale}/bn.js +2 -2
- package/dist/js/{i18n → locale}/bs.js +2 -2
- package/dist/js/{i18n → locale}/ca.js +2 -2
- package/dist/js/{i18n → locale}/cs.js +2 -2
- package/dist/js/{i18n → locale}/da.js +2 -2
- package/dist/js/{i18n → locale}/de.js +2 -2
- package/dist/js/{i18n → locale}/el.js +2 -2
- package/dist/js/{i18n → locale}/es.js +2 -2
- package/dist/js/{i18n → locale}/et.js +2 -2
- package/dist/js/{i18n → locale}/fa.js +2 -5
- package/dist/js/{i18n → locale}/fi.js +2 -2
- package/dist/js/locale/fil.js +16 -0
- package/dist/js/{i18n → locale}/fr.js +2 -2
- package/dist/js/locale/he.js +19 -0
- package/dist/js/{i18n → locale}/hi.js +2 -2
- package/dist/js/{i18n → locale}/hr.js +2 -2
- package/dist/js/{i18n → locale}/hu.js +2 -5
- package/dist/js/locale/hy.js +19 -0
- package/dist/js/{i18n → locale}/id.js +2 -5
- package/dist/js/{i18n → locale}/index.js +9 -0
- package/dist/js/locale/is.js +21 -0
- package/dist/js/{i18n → locale}/it.js +2 -2
- package/dist/js/{i18n → locale}/ja.js +2 -5
- package/dist/js/{i18n → locale}/kn.js +2 -2
- package/dist/js/{i18n → locale}/ko.js +2 -5
- package/dist/js/{i18n → locale}/lt.js +2 -2
- package/dist/js/locale/lv.js +24 -0
- package/dist/js/locale/mk.js +21 -0
- package/dist/js/{i18n → locale}/mr.js +2 -2
- package/dist/js/locale/ms.js +16 -0
- package/dist/js/{i18n → locale}/nl.js +2 -2
- package/dist/js/{i18n → locale}/no.js +2 -2
- package/dist/js/{i18n → locale}/pl.js +2 -2
- package/dist/js/{i18n → locale}/pt.js +2 -2
- package/dist/js/{i18n → locale}/ro.js +4 -4
- package/dist/js/{i18n → locale}/ru.js +2 -2
- package/dist/js/{i18n → locale}/sk.js +5 -8
- package/dist/js/{i18n → locale}/sl.js +2 -2
- package/dist/js/{i18n → locale}/sq.js +2 -2
- package/dist/js/{i18n → locale}/sr.js +2 -2
- package/dist/js/{i18n → locale}/sv.js +2 -5
- package/dist/js/locale/sw.js +19 -0
- package/dist/js/locale/ta.js +19 -0
- package/dist/js/{i18n → locale}/te.js +2 -2
- package/dist/js/{i18n → locale}/th.js +2 -5
- package/dist/js/{i18n → locale}/tr.js +2 -5
- package/dist/js/{i18n → locale}/uk.js +2 -2
- package/dist/js/{i18n → locale}/ur.js +2 -2
- package/dist/js/{i18n → locale}/uz.js +2 -5
- package/dist/js/{i18n → locale}/vi.js +2 -5
- package/dist/js/{i18n → locale}/zh-hk.js +2 -5
- package/dist/js/{i18n → locale}/zh.js +2 -5
- package/dist/js/locale.d.ts +124 -0
- package/dist/js/utils.js +51 -51
- package/package.json +7 -7
- package/dist/js/i18n.d.ts +0 -106
- /package/dist/js/{i18n → locale}/en.js +0 -0
- /package/dist/js/{i18n → locale}/types.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input
|
|
2
|
+
* International Telephone Input v29.0.0
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1783,8 +1783,8 @@ var _factory = (() => {
|
|
|
1783
1783
|
|
|
1784
1784
|
// packages/core/src/js/constants.ts
|
|
1785
1785
|
var EVENTS = {
|
|
1786
|
-
|
|
1787
|
-
|
|
1786
|
+
OPEN_COUNTRY_SELECTOR: "open:countryselector",
|
|
1787
|
+
CLOSE_COUNTRY_SELECTOR: "close:countryselector",
|
|
1788
1788
|
COUNTRY_CHANGE: "countrychange",
|
|
1789
1789
|
INPUT: "input",
|
|
1790
1790
|
// used for synthetic input trigger
|
|
@@ -1798,7 +1798,8 @@ var _factory = (() => {
|
|
|
1798
1798
|
FLAG: "iti__flag",
|
|
1799
1799
|
LOADING: "iti__loading",
|
|
1800
1800
|
COUNTRY_ITEM: "iti__country",
|
|
1801
|
-
HIGHLIGHT: "iti__highlight"
|
|
1801
|
+
HIGHLIGHT: "iti__highlight",
|
|
1802
|
+
STRICT_REJECT_ANIMATION: "iti__strict-reject-animation"
|
|
1802
1803
|
};
|
|
1803
1804
|
var KEYS = {
|
|
1804
1805
|
ARROW_UP: "ArrowUp",
|
|
@@ -1830,9 +1831,9 @@ var _factory = (() => {
|
|
|
1830
1831
|
var LAYOUT = {
|
|
1831
1832
|
NARROW_VIEWPORT_WIDTH: 500,
|
|
1832
1833
|
// keep in sync with .iti__country-list CSS media query
|
|
1833
|
-
|
|
1834
|
+
FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH: 78,
|
|
1834
1835
|
// px width fallback when separateDialCode enabled
|
|
1835
|
-
|
|
1836
|
+
FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH: 42,
|
|
1836
1837
|
// px width fallback when no separate dial code
|
|
1837
1838
|
INPUT_PADDING_EXTRA_LEFT: 6,
|
|
1838
1839
|
// px gap between selected country container and input text
|
|
@@ -1860,14 +1861,17 @@ var _factory = (() => {
|
|
|
1860
1861
|
DIAL_CODE: "1"
|
|
1861
1862
|
// +1 United States
|
|
1862
1863
|
};
|
|
1863
|
-
var
|
|
1864
|
-
AGGRESSIVE: "
|
|
1865
|
-
POLITE: "
|
|
1866
|
-
OFF: "
|
|
1867
|
-
};
|
|
1868
|
-
var INITIAL_COUNTRY = {
|
|
1869
|
-
AUTO: "auto"
|
|
1864
|
+
var PLACEHOLDER_POLICY = {
|
|
1865
|
+
AGGRESSIVE: "AGGRESSIVE",
|
|
1866
|
+
POLITE: "POLITE",
|
|
1867
|
+
OFF: "OFF"
|
|
1870
1868
|
};
|
|
1869
|
+
var COUNTRY_SELECTOR_MODES = [
|
|
1870
|
+
"OFF",
|
|
1871
|
+
"DROPDOWN",
|
|
1872
|
+
"FULLSCREEN",
|
|
1873
|
+
"AUTO"
|
|
1874
|
+
];
|
|
1871
1875
|
var NUMBER_FORMATS = [
|
|
1872
1876
|
"E164",
|
|
1873
1877
|
"INTERNATIONAL",
|
|
@@ -1900,8 +1904,9 @@ var _factory = (() => {
|
|
|
1900
1904
|
var NUMBER_FORMAT = toEnumObject(NUMBER_FORMATS);
|
|
1901
1905
|
var NUMBER_TYPE = toEnumObject(NUMBER_TYPES);
|
|
1902
1906
|
var VALIDATION_ERROR = toEnumObject(VALIDATION_ERRORS);
|
|
1907
|
+
var COUNTRY_SELECTOR_MODE = toEnumObject(COUNTRY_SELECTOR_MODES);
|
|
1903
1908
|
var DATA_KEYS = {
|
|
1904
|
-
// e.g. <li data-iso2="us"> for country items in
|
|
1909
|
+
// e.g. <li data-iso2="us"> for country items in the country list
|
|
1905
1910
|
ISO2: "iso2",
|
|
1906
1911
|
DIAL_CODE: "dialCode",
|
|
1907
1912
|
// e.g. <input data-intl-tel-input-id="0"> on the input element
|
|
@@ -1919,7 +1924,7 @@ var _factory = (() => {
|
|
|
1919
1924
|
MODAL: "aria-modal"
|
|
1920
1925
|
};
|
|
1921
1926
|
|
|
1922
|
-
// packages/core/src/js/
|
|
1927
|
+
// packages/core/src/js/locale/en.ts
|
|
1923
1928
|
var interfaceTranslations = {
|
|
1924
1929
|
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1925
1930
|
noCountrySelected: "Select country for phone number",
|
|
@@ -1942,63 +1947,63 @@ var _factory = (() => {
|
|
|
1942
1947
|
// packages/core/src/js/core/options.ts
|
|
1943
1948
|
var mediaQuery = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
|
|
1944
1949
|
var isNarrowViewport = () => mediaQuery(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
|
|
1945
|
-
var
|
|
1950
|
+
var resolveAutoCountrySelectorMode = () => {
|
|
1946
1951
|
if (typeof navigator !== "undefined" && typeof window !== "undefined") {
|
|
1947
1952
|
const isShortViewport = mediaQuery("(max-height: 600px)");
|
|
1948
1953
|
const isCoarsePointer = mediaQuery("(pointer: coarse)");
|
|
1949
|
-
|
|
1954
|
+
if (isNarrowViewport() || isCoarsePointer && isShortViewport) {
|
|
1955
|
+
return COUNTRY_SELECTOR_MODE.FULLSCREEN;
|
|
1956
|
+
}
|
|
1950
1957
|
}
|
|
1951
|
-
return
|
|
1958
|
+
return COUNTRY_SELECTOR_MODE.DROPDOWN;
|
|
1952
1959
|
};
|
|
1953
1960
|
var defaults = {
|
|
1954
|
-
//*
|
|
1955
|
-
|
|
1961
|
+
//* How the country selector is displayed. "DROPDOWN" vs "FULLSCREEN", or "AUTO" to decide itself, or "OFF".
|
|
1962
|
+
countrySelectorMode: COUNTRY_SELECTOR_MODE.AUTO,
|
|
1956
1963
|
//* The number type to enforce during validation.
|
|
1957
1964
|
allowedNumberTypes: [NUMBER_TYPE.MOBILE, NUMBER_TYPE.FIXED_LINE],
|
|
1958
1965
|
//* Whether or not to allow extensions after the main number.
|
|
1959
1966
|
allowNumberExtensions: false,
|
|
1960
1967
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1961
1968
|
allowPhonewords: false,
|
|
1962
|
-
//* Add a placeholder in the input with an example number for the selected country.
|
|
1963
|
-
autoPlaceholder: PLACEHOLDER_MODES.POLITE,
|
|
1964
1969
|
//* Add a custom class to the (injected) container element.
|
|
1965
1970
|
containerClass: "",
|
|
1966
1971
|
//* Locale for localising country names via Intl.DisplayNames.
|
|
1967
1972
|
countryNameLocale: "en",
|
|
1968
1973
|
//* Override individual country names by iso2 code.
|
|
1969
1974
|
countryNameOverrides: {},
|
|
1970
|
-
//* The order of the countries in the
|
|
1975
|
+
//* The order of the countries in the country list. Defaults to alphabetical.
|
|
1971
1976
|
countryOrder: null,
|
|
1972
|
-
//* Add a country search input at the top of the
|
|
1977
|
+
//* Add a country search input at the top of the country selector.
|
|
1973
1978
|
countrySearch: true,
|
|
1974
1979
|
//* Modify the auto placeholder.
|
|
1975
1980
|
customPlaceholder: null,
|
|
1976
1981
|
//* Always show the dropdown
|
|
1977
1982
|
dropdownAlwaysOpen: false,
|
|
1978
|
-
//*
|
|
1979
|
-
|
|
1983
|
+
//* Optional DOM element to append the dropdown to (used to escape ancestors with overflow:hidden, or to mount in a custom container). Only consulted in dropdown rendering; ignored when the country selector renders as a fullscreen popup.
|
|
1984
|
+
dropdownParent: null,
|
|
1980
1985
|
//* Don't display these countries.
|
|
1981
1986
|
excludeCountries: null,
|
|
1982
1987
|
//* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
|
|
1983
|
-
|
|
1988
|
+
matchDropdownWidth: true,
|
|
1984
1989
|
//* Format the number as the user types
|
|
1985
1990
|
formatAsYouType: true,
|
|
1986
|
-
//*
|
|
1987
|
-
|
|
1988
|
-
//*
|
|
1989
|
-
|
|
1990
|
-
//* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
|
|
1991
|
-
hiddenInput: null,
|
|
1992
|
-
//* Internationalise the core library text e.g. search input placeholder, country names.
|
|
1993
|
-
i18n: {},
|
|
1991
|
+
//* Inject hidden inputs with the names returned from this function, and on submit, populate them with the full number and selected country iso2.
|
|
1992
|
+
hiddenInputs: null,
|
|
1993
|
+
//* Translations for the core library UI strings e.g. search input placeholder, country names.
|
|
1994
|
+
uiTranslations: {},
|
|
1994
1995
|
//* Initial country.
|
|
1995
1996
|
initialCountry: "",
|
|
1997
|
+
//* Async lookup function used to determine the initial country (e.g. via IP). Ignored if initialCountry is set.
|
|
1998
|
+
initialCountryLookup: null,
|
|
1996
1999
|
//* A function to load the utils script.
|
|
1997
2000
|
loadUtils: null,
|
|
1998
|
-
//*
|
|
1999
|
-
|
|
2001
|
+
//* Format used when displaying numbers (placeholder examples and stored values). One of "E164", "INTERNATIONAL", "NATIONAL".
|
|
2002
|
+
numberDisplayFormat: NUMBER_FORMAT.INTERNATIONAL,
|
|
2000
2003
|
//* Display only these countries.
|
|
2001
2004
|
onlyCountries: null,
|
|
2005
|
+
//* When to set the placeholder to an example number for the selected country: "POLITE" only when the input has no manually-set placeholder, "AGGRESSIVE" always, "OFF" never.
|
|
2006
|
+
placeholderNumberPolicy: PLACEHOLDER_POLICY.POLITE,
|
|
2002
2007
|
//* Number type to use for placeholders.
|
|
2003
2008
|
placeholderNumberType: NUMBER_TYPE.MOBILE,
|
|
2004
2009
|
//* Add custom classes to the search input element.
|
|
@@ -2007,12 +2012,10 @@ var _factory = (() => {
|
|
|
2007
2012
|
separateDialCode: true,
|
|
2008
2013
|
//* When strictMode rejects a key (etc), play a short feedback animation
|
|
2009
2014
|
strictRejectAnimation: true,
|
|
2010
|
-
//* Show flags - for both the selected country, and in the country
|
|
2015
|
+
//* Show flags - for both the selected country, and in the country list
|
|
2011
2016
|
showFlags: true,
|
|
2012
2017
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
2013
|
-
strictMode: true
|
|
2014
|
-
//* Use full screen popup instead of dropdown for country list.
|
|
2015
|
-
useFullscreenPopup: computeDefaultUseFullscreenPopup()
|
|
2018
|
+
strictMode: true
|
|
2016
2019
|
};
|
|
2017
2020
|
var toString = (val) => JSON.stringify(val);
|
|
2018
2021
|
var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
|
|
@@ -2024,7 +2027,7 @@ var _factory = (() => {
|
|
|
2024
2027
|
const v = val;
|
|
2025
2028
|
return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
|
|
2026
2029
|
};
|
|
2027
|
-
var
|
|
2030
|
+
var placeholderPolicySet = new Set(Object.values(PLACEHOLDER_POLICY));
|
|
2028
2031
|
var warn = (message) => {
|
|
2029
2032
|
console.warn(`[intl-tel-input] ${message}`);
|
|
2030
2033
|
};
|
|
@@ -2070,30 +2073,48 @@ var _factory = (() => {
|
|
|
2070
2073
|
continue;
|
|
2071
2074
|
}
|
|
2072
2075
|
switch (key) {
|
|
2073
|
-
case "allowDropdown":
|
|
2074
2076
|
case "allowNumberExtensions":
|
|
2075
2077
|
case "allowPhonewords":
|
|
2076
2078
|
case "countrySearch":
|
|
2077
2079
|
case "dropdownAlwaysOpen":
|
|
2078
|
-
case "
|
|
2080
|
+
case "matchDropdownWidth":
|
|
2079
2081
|
case "formatAsYouType":
|
|
2080
|
-
case "formatOnDisplay":
|
|
2081
|
-
case "nationalMode":
|
|
2082
2082
|
case "showFlags":
|
|
2083
2083
|
case "separateDialCode":
|
|
2084
2084
|
case "strictMode":
|
|
2085
2085
|
case "strictRejectAnimation":
|
|
2086
|
-
case "useFullscreenPopup":
|
|
2087
2086
|
if (typeof value !== "boolean") {
|
|
2088
2087
|
warnOption(key, "a boolean", value);
|
|
2089
2088
|
break;
|
|
2090
2089
|
}
|
|
2091
2090
|
validatedOptions[key] = value;
|
|
2092
2091
|
break;
|
|
2093
|
-
case "
|
|
2094
|
-
if (typeof value !== "string" || !
|
|
2095
|
-
|
|
2096
|
-
|
|
2092
|
+
case "countrySelectorMode":
|
|
2093
|
+
if (typeof value !== "string" || !COUNTRY_SELECTOR_MODES.includes(value)) {
|
|
2094
|
+
warnOption(
|
|
2095
|
+
"countrySelectorMode",
|
|
2096
|
+
`one of ${COUNTRY_SELECTOR_MODES.map((m) => `"${m}"`).join(", ")}`,
|
|
2097
|
+
value
|
|
2098
|
+
);
|
|
2099
|
+
break;
|
|
2100
|
+
}
|
|
2101
|
+
validatedOptions[key] = value;
|
|
2102
|
+
break;
|
|
2103
|
+
case "numberDisplayFormat":
|
|
2104
|
+
if (typeof value !== "string" || value === NUMBER_FORMAT.RFC3966 || !(value === NUMBER_FORMAT.E164 || value === NUMBER_FORMAT.INTERNATIONAL || value === NUMBER_FORMAT.NATIONAL)) {
|
|
2105
|
+
warnOption(
|
|
2106
|
+
"numberDisplayFormat",
|
|
2107
|
+
'one of "E164", "INTERNATIONAL", "NATIONAL"',
|
|
2108
|
+
value
|
|
2109
|
+
);
|
|
2110
|
+
break;
|
|
2111
|
+
}
|
|
2112
|
+
validatedOptions[key] = value;
|
|
2113
|
+
break;
|
|
2114
|
+
case "placeholderNumberPolicy":
|
|
2115
|
+
if (typeof value !== "string" || !placeholderPolicySet.has(value)) {
|
|
2116
|
+
const validPolicies = Array.from(placeholderPolicySet).join(", ");
|
|
2117
|
+
warnOption("placeholderNumberPolicy", `one of ${validPolicies}`, value);
|
|
2097
2118
|
break;
|
|
2098
2119
|
}
|
|
2099
2120
|
validatedOptions[key] = value;
|
|
@@ -2119,8 +2140,8 @@ var _factory = (() => {
|
|
|
2119
2140
|
break;
|
|
2120
2141
|
}
|
|
2121
2142
|
case "customPlaceholder":
|
|
2122
|
-
case "
|
|
2123
|
-
case "
|
|
2143
|
+
case "hiddenInputs":
|
|
2144
|
+
case "initialCountryLookup":
|
|
2124
2145
|
case "loadUtils":
|
|
2125
2146
|
if (value !== null && !isFunction(value)) {
|
|
2126
2147
|
warnOption(key, "a function or null", value);
|
|
@@ -2128,9 +2149,9 @@ var _factory = (() => {
|
|
|
2128
2149
|
}
|
|
2129
2150
|
validatedOptions[key] = value;
|
|
2130
2151
|
break;
|
|
2131
|
-
case "
|
|
2152
|
+
case "dropdownParent":
|
|
2132
2153
|
if (value !== null && !isElLike(value)) {
|
|
2133
|
-
warnOption("
|
|
2154
|
+
warnOption("dropdownParent", "an HTMLElement or null", value);
|
|
2134
2155
|
break;
|
|
2135
2156
|
}
|
|
2136
2157
|
validatedOptions[key] = value;
|
|
@@ -2147,9 +2168,9 @@ var _factory = (() => {
|
|
|
2147
2168
|
}
|
|
2148
2169
|
break;
|
|
2149
2170
|
}
|
|
2150
|
-
case "
|
|
2171
|
+
case "uiTranslations":
|
|
2151
2172
|
if (value && !isPlainObject(value)) {
|
|
2152
|
-
warnOption("
|
|
2173
|
+
warnOption("uiTranslations", "an object", value);
|
|
2153
2174
|
break;
|
|
2154
2175
|
}
|
|
2155
2176
|
validatedOptions[key] = value;
|
|
@@ -2167,12 +2188,8 @@ var _factory = (() => {
|
|
|
2167
2188
|
break;
|
|
2168
2189
|
}
|
|
2169
2190
|
const lower = value.toLowerCase();
|
|
2170
|
-
if (lower &&
|
|
2171
|
-
warnOption(
|
|
2172
|
-
"initialCountry",
|
|
2173
|
-
"a valid iso2 country code or 'auto'",
|
|
2174
|
-
value
|
|
2175
|
-
);
|
|
2191
|
+
if (lower && !isIso2(lower)) {
|
|
2192
|
+
warnOption("initialCountry", "a valid iso2 country code", value);
|
|
2176
2193
|
break;
|
|
2177
2194
|
}
|
|
2178
2195
|
validatedOptions[key] = value;
|
|
@@ -2235,30 +2252,29 @@ var _factory = (() => {
|
|
|
2235
2252
|
}
|
|
2236
2253
|
};
|
|
2237
2254
|
var applyOptionSideEffects = (o) => {
|
|
2255
|
+
if (o.countrySelectorMode === COUNTRY_SELECTOR_MODE.AUTO) {
|
|
2256
|
+
o.countrySelectorMode = resolveAutoCountrySelectorMode();
|
|
2257
|
+
}
|
|
2238
2258
|
if (o.dropdownAlwaysOpen) {
|
|
2239
|
-
o.
|
|
2240
|
-
o.allowDropdown = true;
|
|
2259
|
+
o.countrySelectorMode = COUNTRY_SELECTOR_MODE.DROPDOWN;
|
|
2241
2260
|
}
|
|
2242
|
-
if (o.
|
|
2243
|
-
o.
|
|
2261
|
+
if (o.countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN) {
|
|
2262
|
+
o.matchDropdownWidth = false;
|
|
2244
2263
|
} else {
|
|
2245
2264
|
if (isNarrowViewport()) {
|
|
2246
|
-
o.
|
|
2265
|
+
o.matchDropdownWidth = true;
|
|
2247
2266
|
}
|
|
2248
2267
|
}
|
|
2249
2268
|
if (o.onlyCountries?.length === 1) {
|
|
2250
2269
|
o.initialCountry = o.onlyCountries[0];
|
|
2251
2270
|
}
|
|
2252
|
-
if (o.separateDialCode) {
|
|
2253
|
-
o.
|
|
2254
|
-
}
|
|
2255
|
-
if (o.allowDropdown && !o.showFlags && !o.separateDialCode) {
|
|
2256
|
-
o.nationalMode = false;
|
|
2271
|
+
if (o.separateDialCode && o.numberDisplayFormat === NUMBER_FORMAT.NATIONAL) {
|
|
2272
|
+
o.numberDisplayFormat = NUMBER_FORMAT.INTERNATIONAL;
|
|
2257
2273
|
}
|
|
2258
|
-
if (o.
|
|
2259
|
-
o.
|
|
2274
|
+
if (o.countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF && !o.showFlags && !o.separateDialCode && o.numberDisplayFormat === NUMBER_FORMAT.NATIONAL) {
|
|
2275
|
+
o.numberDisplayFormat = NUMBER_FORMAT.INTERNATIONAL;
|
|
2260
2276
|
}
|
|
2261
|
-
o.
|
|
2277
|
+
o.uiTranslations = { ...en_default, ...o.uiTranslations };
|
|
2262
2278
|
};
|
|
2263
2279
|
|
|
2264
2280
|
// packages/core/src/js/helpers/string.ts
|
|
@@ -2469,6 +2485,7 @@ var _factory = (() => {
|
|
|
2469
2485
|
};
|
|
2470
2486
|
|
|
2471
2487
|
// packages/core/src/js/core/ui.ts
|
|
2488
|
+
var supportsCssAnchor = typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("anchor-name: --x");
|
|
2472
2489
|
var UI = class _UI {
|
|
2473
2490
|
// private
|
|
2474
2491
|
#options;
|
|
@@ -2483,8 +2500,8 @@ var _factory = (() => {
|
|
|
2483
2500
|
#selectedCountryEl;
|
|
2484
2501
|
#selectedFlagEl;
|
|
2485
2502
|
#selectedDialCodeEl;
|
|
2486
|
-
#
|
|
2487
|
-
#
|
|
2503
|
+
#arrowEl;
|
|
2504
|
+
#countrySelectorEl;
|
|
2488
2505
|
#searchIconEl;
|
|
2489
2506
|
#searchInputEl;
|
|
2490
2507
|
#searchClearButtonEl;
|
|
@@ -2493,11 +2510,11 @@ var _factory = (() => {
|
|
|
2493
2510
|
#hiddenInputCountryEl;
|
|
2494
2511
|
#noResultsMessageEl;
|
|
2495
2512
|
#searchResultsLiveRegionEl;
|
|
2496
|
-
#
|
|
2513
|
+
#detachedCountrySelectorEl;
|
|
2497
2514
|
#selectedListItemEl = null;
|
|
2498
2515
|
#highlightedListItemEl = null;
|
|
2499
2516
|
#listItemByIso2 = /* @__PURE__ */ new Map();
|
|
2500
|
-
#
|
|
2517
|
+
#countrySelectorAbortController = null;
|
|
2501
2518
|
#resizeObserver;
|
|
2502
2519
|
// public
|
|
2503
2520
|
telInputEl;
|
|
@@ -2522,7 +2539,7 @@ var _factory = (() => {
|
|
|
2522
2539
|
);
|
|
2523
2540
|
}
|
|
2524
2541
|
}
|
|
2525
|
-
//* Generate all of the markup for the core library: the selected country overlay, and the
|
|
2542
|
+
//* Generate all of the markup for the core library: the selected country overlay, and the country selector.
|
|
2526
2543
|
buildMarkup(countries, searchTokens) {
|
|
2527
2544
|
this.#countries = countries;
|
|
2528
2545
|
this.#searchTokens = searchTokens;
|
|
@@ -2545,13 +2562,13 @@ var _factory = (() => {
|
|
|
2545
2562
|
this.ensureDropdownWidthSet();
|
|
2546
2563
|
}
|
|
2547
2564
|
#createWrapperAndInsert() {
|
|
2548
|
-
const {
|
|
2565
|
+
const { countrySelectorMode, showFlags, containerClass } = this.#options;
|
|
2549
2566
|
const parentClasses = buildClassNames({
|
|
2550
2567
|
iti: true,
|
|
2551
2568
|
"iti--input-container": true,
|
|
2552
|
-
"iti--
|
|
2569
|
+
"iti--has-country-selector": countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF,
|
|
2553
2570
|
"iti--show-flags": showFlags,
|
|
2554
|
-
"iti--inline-
|
|
2571
|
+
"iti--inline-country-selector": countrySelectorMode !== COUNTRY_SELECTOR_MODE.FULLSCREEN,
|
|
2555
2572
|
[containerClass]: Boolean(containerClass)
|
|
2556
2573
|
});
|
|
2557
2574
|
const wrapper = createEl("div", { class: parentClasses });
|
|
@@ -2562,8 +2579,9 @@ var _factory = (() => {
|
|
|
2562
2579
|
return wrapper;
|
|
2563
2580
|
}
|
|
2564
2581
|
#buildCountryContainer(wrapper) {
|
|
2565
|
-
const {
|
|
2566
|
-
|
|
2582
|
+
const { countrySelectorMode, separateDialCode, showFlags } = this.#options;
|
|
2583
|
+
const enableCountrySelector = countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF;
|
|
2584
|
+
if (!enableCountrySelector && !showFlags && !separateDialCode) {
|
|
2567
2585
|
return;
|
|
2568
2586
|
}
|
|
2569
2587
|
this.#countryContainerEl = createEl(
|
|
@@ -2572,16 +2590,16 @@ var _factory = (() => {
|
|
|
2572
2590
|
{ class: `iti__country-container ${CLASSES.V_HIDE}` },
|
|
2573
2591
|
wrapper
|
|
2574
2592
|
);
|
|
2575
|
-
if (
|
|
2593
|
+
if (enableCountrySelector) {
|
|
2576
2594
|
this.#selectedCountryEl = createEl(
|
|
2577
2595
|
"button",
|
|
2578
2596
|
{
|
|
2579
2597
|
type: "button",
|
|
2580
2598
|
class: "iti__selected-country",
|
|
2581
2599
|
[ARIA.EXPANDED]: "false",
|
|
2582
|
-
[ARIA.LABEL]: this.#options.
|
|
2600
|
+
[ARIA.LABEL]: this.#options.uiTranslations.noCountrySelected,
|
|
2583
2601
|
[ARIA.HASPOPUP]: "dialog",
|
|
2584
|
-
[ARIA.CONTROLS]: `iti-${this.#id}
|
|
2602
|
+
[ARIA.CONTROLS]: `iti-${this.#id}__country-selector`
|
|
2585
2603
|
},
|
|
2586
2604
|
this.#countryContainerEl
|
|
2587
2605
|
);
|
|
@@ -2605,8 +2623,8 @@ var _factory = (() => {
|
|
|
2605
2623
|
{ class: CLASSES.FLAG },
|
|
2606
2624
|
selectedCountryPrimary
|
|
2607
2625
|
);
|
|
2608
|
-
if (
|
|
2609
|
-
this.#
|
|
2626
|
+
if (enableCountrySelector) {
|
|
2627
|
+
this.#arrowEl = createEl(
|
|
2610
2628
|
"div",
|
|
2611
2629
|
{ class: "iti__arrow", [ARIA.HIDDEN]: "true" },
|
|
2612
2630
|
selectedCountryPrimary
|
|
@@ -2619,38 +2637,39 @@ var _factory = (() => {
|
|
|
2619
2637
|
this.#selectedCountryEl
|
|
2620
2638
|
);
|
|
2621
2639
|
}
|
|
2622
|
-
if (
|
|
2623
|
-
this.#
|
|
2640
|
+
if (enableCountrySelector) {
|
|
2641
|
+
this.#buildCountrySelector();
|
|
2624
2642
|
}
|
|
2625
2643
|
}
|
|
2626
2644
|
ensureDropdownWidthSet() {
|
|
2627
|
-
const {
|
|
2628
|
-
if (
|
|
2645
|
+
const { matchDropdownWidth, countrySelectorMode } = this.#options;
|
|
2646
|
+
if (countrySelectorMode === COUNTRY_SELECTOR_MODE.OFF || !matchDropdownWidth || this.#countrySelectorEl.style.width) {
|
|
2629
2647
|
return;
|
|
2630
2648
|
}
|
|
2631
2649
|
const inputWidth = this.telInputEl.offsetWidth;
|
|
2632
2650
|
if (inputWidth > 0) {
|
|
2633
|
-
this.#
|
|
2651
|
+
this.#countrySelectorEl.style.width = `${inputWidth}px`;
|
|
2634
2652
|
}
|
|
2635
2653
|
}
|
|
2636
|
-
#
|
|
2654
|
+
#buildCountrySelector() {
|
|
2637
2655
|
const {
|
|
2638
|
-
|
|
2639
|
-
|
|
2656
|
+
matchDropdownWidth,
|
|
2657
|
+
countrySelectorMode,
|
|
2640
2658
|
countrySearch,
|
|
2641
|
-
|
|
2642
|
-
dropdownContainer,
|
|
2659
|
+
uiTranslations,
|
|
2643
2660
|
containerClass
|
|
2644
2661
|
} = this.#options;
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2662
|
+
const isFullscreen = countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN;
|
|
2663
|
+
const detachedParent = this.#getDetachedParent();
|
|
2664
|
+
const extraClasses = matchDropdownWidth ? "" : "iti--flexible-dropdown-width";
|
|
2665
|
+
this.#countrySelectorEl = createEl("div", {
|
|
2666
|
+
id: `iti-${this.#id}__country-selector`,
|
|
2667
|
+
class: `iti__country-selector ${CLASSES.HIDE} ${extraClasses}`,
|
|
2649
2668
|
role: "dialog",
|
|
2650
2669
|
[ARIA.MODAL]: "true"
|
|
2651
2670
|
});
|
|
2652
2671
|
if (this.#isRTL) {
|
|
2653
|
-
this.#
|
|
2672
|
+
this.#countrySelectorEl.setAttribute("dir", "rtl");
|
|
2654
2673
|
}
|
|
2655
2674
|
if (countrySearch) {
|
|
2656
2675
|
this.#buildSearchUI();
|
|
@@ -2661,40 +2680,54 @@ var _factory = (() => {
|
|
|
2661
2680
|
class: "iti__country-list",
|
|
2662
2681
|
id: `iti-${this.#id}__country-listbox`,
|
|
2663
2682
|
role: "listbox",
|
|
2664
|
-
[ARIA.LABEL]:
|
|
2683
|
+
[ARIA.LABEL]: uiTranslations.countryListAriaLabel
|
|
2665
2684
|
},
|
|
2666
|
-
this.#
|
|
2685
|
+
this.#countrySelectorEl
|
|
2667
2686
|
);
|
|
2668
2687
|
this.#appendListItems();
|
|
2669
2688
|
if (countrySearch) {
|
|
2670
2689
|
this.#updateSearchResultsA11yText();
|
|
2671
2690
|
}
|
|
2672
|
-
if (!
|
|
2691
|
+
if (!isFullscreen) {
|
|
2673
2692
|
this.#inlineDropdownHeight = this.#getHiddenInlineDropdownHeight();
|
|
2674
2693
|
if (countrySearch) {
|
|
2675
|
-
this.#
|
|
2694
|
+
this.#countrySelectorEl.style.height = `${this.#inlineDropdownHeight}px`;
|
|
2676
2695
|
}
|
|
2677
2696
|
}
|
|
2678
|
-
if (
|
|
2679
|
-
const
|
|
2697
|
+
if (detachedParent) {
|
|
2698
|
+
const wrapperClasses = buildClassNames({
|
|
2680
2699
|
iti: true,
|
|
2681
|
-
"iti--
|
|
2682
|
-
"iti--fullscreen-popup":
|
|
2683
|
-
"iti--inline-
|
|
2700
|
+
"iti--detached-country-selector": true,
|
|
2701
|
+
"iti--fullscreen-popup": isFullscreen,
|
|
2702
|
+
"iti--inline-country-selector": !isFullscreen,
|
|
2684
2703
|
[containerClass]: Boolean(containerClass)
|
|
2685
2704
|
});
|
|
2686
|
-
this.#
|
|
2687
|
-
this.#
|
|
2705
|
+
this.#detachedCountrySelectorEl = createEl("div", { class: wrapperClasses });
|
|
2706
|
+
this.#detachedCountrySelectorEl.appendChild(this.#countrySelectorEl);
|
|
2707
|
+
if (!isFullscreen) {
|
|
2708
|
+
this.#setupCssAnchorPositioning();
|
|
2709
|
+
}
|
|
2688
2710
|
} else {
|
|
2689
|
-
this.#countryContainerEl.appendChild(this.#
|
|
2711
|
+
this.#countryContainerEl.appendChild(this.#countrySelectorEl);
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
//* Resolve the DOM element to attach the country selector to. Fullscreen always uses document.body; dropdown uses the consumer-supplied dropdownParent (if any); otherwise the country selector renders inline within the input wrapper (no detached element).
|
|
2715
|
+
#getDetachedParent() {
|
|
2716
|
+
const { countrySelectorMode, dropdownParent } = this.#options;
|
|
2717
|
+
if (countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN) {
|
|
2718
|
+
return document.body;
|
|
2690
2719
|
}
|
|
2720
|
+
if (countrySelectorMode === COUNTRY_SELECTOR_MODE.DROPDOWN) {
|
|
2721
|
+
return dropdownParent;
|
|
2722
|
+
}
|
|
2723
|
+
return null;
|
|
2691
2724
|
}
|
|
2692
2725
|
#buildSearchUI() {
|
|
2693
|
-
const {
|
|
2726
|
+
const { uiTranslations, searchInputClass } = this.#options;
|
|
2694
2727
|
const searchWrapper = createEl(
|
|
2695
2728
|
"div",
|
|
2696
2729
|
{ class: "iti__search-input-wrapper" },
|
|
2697
|
-
this.#
|
|
2730
|
+
this.#countrySelectorEl
|
|
2698
2731
|
);
|
|
2699
2732
|
this.#searchIconEl = createEl(
|
|
2700
2733
|
"span",
|
|
@@ -2712,11 +2745,11 @@ var _factory = (() => {
|
|
|
2712
2745
|
// Chrome says inputs need either a name or an id
|
|
2713
2746
|
type: "search",
|
|
2714
2747
|
class: `iti__search-input ${searchInputClass}`,
|
|
2715
|
-
placeholder:
|
|
2748
|
+
placeholder: uiTranslations.searchPlaceholder,
|
|
2716
2749
|
// 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
|
|
2717
2750
|
role: "combobox",
|
|
2718
2751
|
[ARIA.EXPANDED]: "true",
|
|
2719
|
-
[ARIA.LABEL]:
|
|
2752
|
+
[ARIA.LABEL]: uiTranslations.searchPlaceholder,
|
|
2720
2753
|
[ARIA.CONTROLS]: `iti-${this.#id}__country-listbox`,
|
|
2721
2754
|
[ARIA.AUTOCOMPLETE]: "list",
|
|
2722
2755
|
autocomplete: "off"
|
|
@@ -2728,7 +2761,7 @@ var _factory = (() => {
|
|
|
2728
2761
|
{
|
|
2729
2762
|
type: "button",
|
|
2730
2763
|
class: `iti__search-clear ${CLASSES.HIDE}`,
|
|
2731
|
-
[ARIA.LABEL]:
|
|
2764
|
+
[ARIA.LABEL]: uiTranslations.clearSearchAriaLabel,
|
|
2732
2765
|
tabindex: "-1"
|
|
2733
2766
|
},
|
|
2734
2767
|
searchWrapper
|
|
@@ -2737,7 +2770,7 @@ var _factory = (() => {
|
|
|
2737
2770
|
this.#searchResultsLiveRegionEl = createEl(
|
|
2738
2771
|
"span",
|
|
2739
2772
|
{ class: "iti__a11y-text" },
|
|
2740
|
-
this.#
|
|
2773
|
+
this.#countrySelectorEl
|
|
2741
2774
|
);
|
|
2742
2775
|
this.#noResultsMessageEl = createEl(
|
|
2743
2776
|
"div",
|
|
@@ -2746,9 +2779,9 @@ var _factory = (() => {
|
|
|
2746
2779
|
[ARIA.HIDDEN]: "true"
|
|
2747
2780
|
// all a11y messaging happens in this.#searchResultsLiveRegionEl
|
|
2748
2781
|
},
|
|
2749
|
-
this.#
|
|
2782
|
+
this.#countrySelectorEl
|
|
2750
2783
|
);
|
|
2751
|
-
this.#noResultsMessageEl.textContent =
|
|
2784
|
+
this.#noResultsMessageEl.textContent = uiTranslations.searchEmptyState ?? null;
|
|
2752
2785
|
}
|
|
2753
2786
|
#updateInputPaddingAndReveal() {
|
|
2754
2787
|
if (!this.#countryContainerEl) {
|
|
@@ -2758,12 +2791,12 @@ var _factory = (() => {
|
|
|
2758
2791
|
this.#countryContainerEl.classList.remove(CLASSES.V_HIDE);
|
|
2759
2792
|
}
|
|
2760
2793
|
#buildHiddenInputs(wrapper) {
|
|
2761
|
-
const {
|
|
2762
|
-
if (!
|
|
2794
|
+
const { hiddenInputs } = this.#options;
|
|
2795
|
+
if (!hiddenInputs) {
|
|
2763
2796
|
return;
|
|
2764
2797
|
}
|
|
2765
2798
|
const telInputName = this.telInputEl.getAttribute("name") || "";
|
|
2766
|
-
const names =
|
|
2799
|
+
const names = hiddenInputs(telInputName);
|
|
2767
2800
|
if (names.phone) {
|
|
2768
2801
|
const existingInput = this.telInputEl.form?.querySelector(
|
|
2769
2802
|
`input[name="${names.phone}"]`
|
|
@@ -2828,7 +2861,7 @@ var _factory = (() => {
|
|
|
2828
2861
|
//* Update the input padding to make space for (1) the selected country/globe, (2) the arrow, and (3) the separate dial code, all of which are optional, hence handling this in the JS rather than CSS.
|
|
2829
2862
|
#updateInputPadding() {
|
|
2830
2863
|
if (this.#selectedCountryEl) {
|
|
2831
|
-
const fallbackWidth = this.#options.separateDialCode ? LAYOUT.
|
|
2864
|
+
const fallbackWidth = this.#options.separateDialCode ? LAYOUT.FALLBACK_SELECTED_COUNTRY_WITH_DIAL_WIDTH : LAYOUT.FALLBACK_SELECTED_COUNTRY_NO_DIAL_WIDTH;
|
|
2832
2865
|
const selectedCountryWidth = this.#selectedCountryEl.offsetWidth || this.#getHiddenSelectedCountryWidth() || fallbackWidth;
|
|
2833
2866
|
const inputPadding = selectedCountryWidth + LAYOUT.INPUT_PADDING_EXTRA_LEFT;
|
|
2834
2867
|
this.telInputEl.style.paddingLeft = `${inputPadding}px`;
|
|
@@ -2882,24 +2915,24 @@ var _factory = (() => {
|
|
|
2882
2915
|
// Get the dropdown height (before it is added to the DOM)
|
|
2883
2916
|
#getHiddenInlineDropdownHeight() {
|
|
2884
2917
|
const body = _UI.#getBody();
|
|
2885
|
-
this.#
|
|
2918
|
+
this.#countrySelectorEl.classList.remove(CLASSES.HIDE);
|
|
2886
2919
|
const tempContainer = createEl("div", {
|
|
2887
|
-
class: "iti iti--inline-
|
|
2920
|
+
class: "iti iti--inline-country-selector"
|
|
2888
2921
|
});
|
|
2889
|
-
tempContainer.appendChild(this.#
|
|
2922
|
+
tempContainer.appendChild(this.#countrySelectorEl);
|
|
2890
2923
|
tempContainer.style.visibility = "hidden";
|
|
2891
2924
|
body.appendChild(tempContainer);
|
|
2892
|
-
const height = this.#
|
|
2925
|
+
const height = this.#countrySelectorEl.offsetHeight;
|
|
2893
2926
|
body.removeChild(tempContainer);
|
|
2894
2927
|
tempContainer.style.visibility = "";
|
|
2895
|
-
this.#
|
|
2928
|
+
this.#countrySelectorEl.classList.add(CLASSES.HIDE);
|
|
2896
2929
|
return height > 0 ? height : LAYOUT.FALLBACK_DROPDOWN_HEIGHT;
|
|
2897
2930
|
}
|
|
2898
2931
|
//* Update search results text (for a11y).
|
|
2899
2932
|
#updateSearchResultsA11yText() {
|
|
2900
|
-
const {
|
|
2933
|
+
const { uiTranslations } = this.#options;
|
|
2901
2934
|
const count = this.#countryListEl.childElementCount;
|
|
2902
|
-
this.#searchResultsLiveRegionEl.textContent =
|
|
2935
|
+
this.#searchResultsLiveRegionEl.textContent = uiTranslations.searchSummaryAria(count);
|
|
2903
2936
|
}
|
|
2904
2937
|
//* Country search: Filter the countries according to the search query.
|
|
2905
2938
|
#filterCountriesByQuery(query) {
|
|
@@ -2917,8 +2950,8 @@ var _factory = (() => {
|
|
|
2917
2950
|
this.#showFilteredCountries(matchedCountries);
|
|
2918
2951
|
}
|
|
2919
2952
|
//* Pre-fill the search input with "+" and show all countries
|
|
2920
|
-
//* (used when user types "+" in the phone input to open the
|
|
2921
|
-
//* Explicitly focus the search input (
|
|
2953
|
+
//* (used when user types "+" in the phone input to open the country selector).
|
|
2954
|
+
//* Explicitly focus the search input (openCountrySelector skips this when
|
|
2922
2955
|
//* dropdownAlwaysOpen, but here we need focus to redirect subsequent keystrokes).
|
|
2923
2956
|
prefillSearchWithPlus() {
|
|
2924
2957
|
this.#searchInputEl.value = "+";
|
|
@@ -3001,15 +3034,15 @@ var _factory = (() => {
|
|
|
3001
3034
|
{ signal }
|
|
3002
3035
|
);
|
|
3003
3036
|
}
|
|
3004
|
-
//* Wire up triggers that open/close the
|
|
3037
|
+
//* Wire up triggers that open/close the country selector: label click (focus input or swallow repeat click),
|
|
3005
3038
|
//* selected-country click (open), and keydown on countryContainer (open on arrow/space/enter, close on tab).
|
|
3006
|
-
|
|
3039
|
+
bindAllInitialCountrySelectorListeners(signal, onOpen, onClose) {
|
|
3007
3040
|
const label = this.telInputEl.closest("label");
|
|
3008
3041
|
if (label) {
|
|
3009
3042
|
label.addEventListener(
|
|
3010
3043
|
"click",
|
|
3011
3044
|
(e) => {
|
|
3012
|
-
if (!this.
|
|
3045
|
+
if (!this.isCountrySelectorOpen()) {
|
|
3013
3046
|
this.telInputEl.focus();
|
|
3014
3047
|
} else {
|
|
3015
3048
|
e.preventDefault();
|
|
@@ -3021,7 +3054,7 @@ var _factory = (() => {
|
|
|
3021
3054
|
this.#selectedCountryEl.addEventListener(
|
|
3022
3055
|
"click",
|
|
3023
3056
|
() => {
|
|
3024
|
-
if (!this.
|
|
3057
|
+
if (!this.isCountrySelectorOpen() && !this.telInputEl.disabled && !this.telInputEl.readOnly) {
|
|
3025
3058
|
onOpen();
|
|
3026
3059
|
}
|
|
3027
3060
|
},
|
|
@@ -3036,7 +3069,7 @@ var _factory = (() => {
|
|
|
3036
3069
|
KEYS.SPACE,
|
|
3037
3070
|
KEYS.ENTER
|
|
3038
3071
|
];
|
|
3039
|
-
if (!this.
|
|
3072
|
+
if (!this.isCountrySelectorOpen() && openKeys.includes(e.key)) {
|
|
3040
3073
|
e.preventDefault();
|
|
3041
3074
|
e.stopPropagation();
|
|
3042
3075
|
onOpen();
|
|
@@ -3048,24 +3081,24 @@ var _factory = (() => {
|
|
|
3048
3081
|
{ signal }
|
|
3049
3082
|
);
|
|
3050
3083
|
}
|
|
3051
|
-
//* Open the
|
|
3052
|
-
//*
|
|
3053
|
-
|
|
3054
|
-
const { countrySearch, dropdownAlwaysOpen
|
|
3055
|
-
this.#
|
|
3084
|
+
//* Open the country selector: create a fresh AbortController, do the DOM work, and wire up all
|
|
3085
|
+
//* open-state listeners (which invoke the caller's onSelect / onClose callbacks).
|
|
3086
|
+
openCountrySelector(onSelect, onClose) {
|
|
3087
|
+
const { countrySearch, dropdownAlwaysOpen } = this.#options;
|
|
3088
|
+
this.#countrySelectorAbortController = new AbortController();
|
|
3056
3089
|
this.ensureDropdownWidthSet();
|
|
3057
|
-
if (
|
|
3058
|
-
this.#
|
|
3090
|
+
if (this.#detachedCountrySelectorEl) {
|
|
3091
|
+
this.#injectAndPositionDetachedCountrySelector();
|
|
3059
3092
|
} else {
|
|
3060
|
-
const positionBelow = this.#
|
|
3093
|
+
const positionBelow = this.#shouldPositionDropdownBelowInput();
|
|
3061
3094
|
const distance = this.telInputEl.offsetHeight + LAYOUT.DROPDOWN_MARGIN;
|
|
3062
3095
|
if (positionBelow) {
|
|
3063
|
-
this.#
|
|
3096
|
+
this.#countrySelectorEl.style.top = `${distance}px`;
|
|
3064
3097
|
} else {
|
|
3065
|
-
this.#
|
|
3098
|
+
this.#countrySelectorEl.style.bottom = `${distance}px`;
|
|
3066
3099
|
}
|
|
3067
3100
|
}
|
|
3068
|
-
this.#
|
|
3101
|
+
this.#countrySelectorEl.classList.remove(CLASSES.HIDE);
|
|
3069
3102
|
this.#selectedCountryEl.setAttribute(ARIA.EXPANDED, "true");
|
|
3070
3103
|
const itemToHighlight = this.#selectedListItemEl ?? this.#countryListEl.firstElementChild;
|
|
3071
3104
|
if (itemToHighlight) {
|
|
@@ -3074,7 +3107,7 @@ var _factory = (() => {
|
|
|
3074
3107
|
if (countrySearch && !dropdownAlwaysOpen) {
|
|
3075
3108
|
this.#searchInputEl.focus();
|
|
3076
3109
|
}
|
|
3077
|
-
if (this.#options.
|
|
3110
|
+
if (this.#options.countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN && this.#detachedCountrySelectorEl && window.visualViewport) {
|
|
3078
3111
|
window.visualViewport.addEventListener(
|
|
3079
3112
|
"resize",
|
|
3080
3113
|
() => {
|
|
@@ -3083,29 +3116,29 @@ var _factory = (() => {
|
|
|
3083
3116
|
this.#scrollCountryListToItem(this.#highlightedListItemEl);
|
|
3084
3117
|
}
|
|
3085
3118
|
},
|
|
3086
|
-
{ signal: this.#
|
|
3119
|
+
{ signal: this.#countrySelectorAbortController.signal }
|
|
3087
3120
|
);
|
|
3088
3121
|
}
|
|
3089
|
-
this.#
|
|
3090
|
-
this.#
|
|
3122
|
+
this.#arrowEl.classList.add(CLASSES.ARROW_UP);
|
|
3123
|
+
this.#bindCountrySelectorOpenListeners(onSelect, onClose);
|
|
3091
3124
|
}
|
|
3092
|
-
//* Wire up all listeners needed while the
|
|
3125
|
+
//* Wire up all listeners needed while the country selector is open: list-item hover (highlight),
|
|
3093
3126
|
//* list-item click & enter key (select), click-off & escape (close), search input (filter),
|
|
3094
|
-
//* (when countrySearch disabled) typed-char hidden search, and (when
|
|
3095
|
-
//* container)
|
|
3096
|
-
#
|
|
3097
|
-
const signal = this.#
|
|
3127
|
+
//* (when countrySearch disabled) typed-char hidden search, and (when the country selector is in an
|
|
3128
|
+
//* external container) update (fixed) position on scroll/resize.
|
|
3129
|
+
#bindCountrySelectorOpenListeners(onSelect, onClose) {
|
|
3130
|
+
const signal = this.#countrySelectorAbortController.signal;
|
|
3098
3131
|
this.#bindListItemHover(signal);
|
|
3099
3132
|
this.#bindListItemClick(signal, onSelect);
|
|
3100
3133
|
if (!this.#options.dropdownAlwaysOpen) {
|
|
3101
3134
|
this.#bindOutsideClickToClose(signal, onClose);
|
|
3102
3135
|
}
|
|
3103
|
-
this.#
|
|
3136
|
+
this.#bindCountrySelectorKeydownListener(signal, onSelect, onClose);
|
|
3104
3137
|
if (this.#options.countrySearch) {
|
|
3105
3138
|
this.#bindSearchInputListener(signal);
|
|
3106
3139
|
}
|
|
3107
|
-
if (
|
|
3108
|
-
|
|
3140
|
+
if (this.#options.countrySelectorMode === COUNTRY_SELECTOR_MODE.DROPDOWN && this.#options.dropdownParent && !supportsCssAnchor) {
|
|
3141
|
+
document.addEventListener("scroll", onClose, { signal, capture: true, passive: true });
|
|
3109
3142
|
}
|
|
3110
3143
|
}
|
|
3111
3144
|
//* When mouse over a list item, just highlight that one (so if they hit "enter" we know which to select).
|
|
@@ -3138,13 +3171,13 @@ var _factory = (() => {
|
|
|
3138
3171
|
{ signal }
|
|
3139
3172
|
);
|
|
3140
3173
|
}
|
|
3141
|
-
//* Invoke onClickOff when the user clicks anywhere outside the
|
|
3174
|
+
//* Invoke onClickOff when the user clicks anywhere outside the country selector.
|
|
3142
3175
|
#bindOutsideClickToClose(signal, onClickOff) {
|
|
3143
3176
|
setTimeout(() => {
|
|
3144
3177
|
document.documentElement.addEventListener(
|
|
3145
3178
|
"click",
|
|
3146
3179
|
(e) => {
|
|
3147
|
-
if (!this.#
|
|
3180
|
+
if (!this.#countrySelectorEl.contains(e.target)) {
|
|
3148
3181
|
onClickOff();
|
|
3149
3182
|
}
|
|
3150
3183
|
},
|
|
@@ -3152,11 +3185,10 @@ var _factory = (() => {
|
|
|
3152
3185
|
);
|
|
3153
3186
|
}, 0);
|
|
3154
3187
|
}
|
|
3155
|
-
//* Keyboard navigation while the
|
|
3156
|
-
//* and enter/escape invoke the caller's callbacks (which handle country selection /
|
|
3157
|
-
//* Listens on document because key events go there when no input has focus.
|
|
3188
|
+
//* Keyboard navigation while the country selector is open: arrow keys navigate, hidden-search keys filter,
|
|
3189
|
+
//* and enter/escape invoke the caller's callbacks (which handle country selection / close).
|
|
3158
3190
|
//* Uses keydown rather than keypress so non-char keys (arrow, esc) fire and so holding a key repeats.
|
|
3159
|
-
#
|
|
3191
|
+
#bindCountrySelectorKeydownListener(signal, onEnter, onEscape) {
|
|
3160
3192
|
let query = "";
|
|
3161
3193
|
let queryTimer = null;
|
|
3162
3194
|
const handleKeydown = (e) => {
|
|
@@ -3178,7 +3210,7 @@ var _factory = (() => {
|
|
|
3178
3210
|
this.#selectedCountryEl.focus();
|
|
3179
3211
|
}
|
|
3180
3212
|
}
|
|
3181
|
-
if (!this.#options.countrySearch &&
|
|
3213
|
+
if (!this.#options.countrySearch && REGEX.HIDDEN_SEARCH_CHAR.test(e.key)) {
|
|
3182
3214
|
e.stopPropagation();
|
|
3183
3215
|
if (queryTimer) {
|
|
3184
3216
|
clearTimeout(queryTimer);
|
|
@@ -3190,7 +3222,8 @@ var _factory = (() => {
|
|
|
3190
3222
|
}, TIMINGS.HIDDEN_SEARCH_RESET_MS);
|
|
3191
3223
|
}
|
|
3192
3224
|
};
|
|
3193
|
-
|
|
3225
|
+
this.#selectedCountryEl?.addEventListener("keydown", handleKeydown, { signal });
|
|
3226
|
+
this.#countrySelectorEl?.addEventListener("keydown", handleKeydown, { signal });
|
|
3194
3227
|
}
|
|
3195
3228
|
//* Wire up country search input listener: typing filters the list, the clear button resets it.
|
|
3196
3229
|
#bindSearchInputListener(signal) {
|
|
@@ -3227,7 +3260,7 @@ var _factory = (() => {
|
|
|
3227
3260
|
this.#highlightListItem(next);
|
|
3228
3261
|
}
|
|
3229
3262
|
}
|
|
3230
|
-
// Update the selected list item in the
|
|
3263
|
+
// Update the selected list item in the country list
|
|
3231
3264
|
#updateSelectedListItem(iso2) {
|
|
3232
3265
|
if (this.#selectedListItemEl && this.#selectedListItemEl.dataset[DATA_KEYS.ISO2] !== iso2) {
|
|
3233
3266
|
this.#selectedListItemEl.setAttribute(ARIA.SELECTED, "false");
|
|
@@ -3278,12 +3311,12 @@ var _factory = (() => {
|
|
|
3278
3311
|
this.#countryListEl.scrollTop = 0;
|
|
3279
3312
|
this.#updateSearchResultsA11yText();
|
|
3280
3313
|
}
|
|
3281
|
-
// UI: Close the
|
|
3282
|
-
|
|
3283
|
-
const { countrySearch
|
|
3284
|
-
this.#
|
|
3285
|
-
this.#
|
|
3286
|
-
this.#
|
|
3314
|
+
// UI: Close the country selector (DOM + abort scoped listeners).
|
|
3315
|
+
closeCountrySelector() {
|
|
3316
|
+
const { countrySearch } = this.#options;
|
|
3317
|
+
this.#countrySelectorAbortController.abort();
|
|
3318
|
+
this.#countrySelectorAbortController = null;
|
|
3319
|
+
this.#countrySelectorEl.classList.add(CLASSES.HIDE);
|
|
3287
3320
|
this.#selectedCountryEl.setAttribute(ARIA.EXPANDED, "false");
|
|
3288
3321
|
if (countrySearch) {
|
|
3289
3322
|
this.#searchInputEl.removeAttribute(ARIA.ACTIVE_DESCENDANT);
|
|
@@ -3294,19 +3327,19 @@ var _factory = (() => {
|
|
|
3294
3327
|
this.#highlightedListItemEl = null;
|
|
3295
3328
|
}
|
|
3296
3329
|
}
|
|
3297
|
-
this.#
|
|
3298
|
-
if (
|
|
3299
|
-
this.#
|
|
3300
|
-
this.#
|
|
3301
|
-
this.#
|
|
3302
|
-
this.#
|
|
3303
|
-
this.#
|
|
3330
|
+
this.#arrowEl.classList.remove(CLASSES.ARROW_UP);
|
|
3331
|
+
if (this.#detachedCountrySelectorEl) {
|
|
3332
|
+
this.#detachedCountrySelectorEl.remove();
|
|
3333
|
+
this.#detachedCountrySelectorEl.style.top = "";
|
|
3334
|
+
this.#detachedCountrySelectorEl.style.bottom = "";
|
|
3335
|
+
this.#detachedCountrySelectorEl.style.paddingLeft = "";
|
|
3336
|
+
this.#detachedCountrySelectorEl.style.paddingRight = "";
|
|
3304
3337
|
} else {
|
|
3305
|
-
this.#
|
|
3306
|
-
this.#
|
|
3338
|
+
this.#countrySelectorEl.style.top = "";
|
|
3339
|
+
this.#countrySelectorEl.style.bottom = "";
|
|
3307
3340
|
}
|
|
3308
3341
|
}
|
|
3309
|
-
#
|
|
3342
|
+
#shouldPositionDropdownBelowInput() {
|
|
3310
3343
|
if (this.#options.dropdownAlwaysOpen) {
|
|
3311
3344
|
return true;
|
|
3312
3345
|
}
|
|
@@ -3315,50 +3348,83 @@ var _factory = (() => {
|
|
|
3315
3348
|
const spaceBelow = window.innerHeight - inputPos.bottom;
|
|
3316
3349
|
return spaceBelow >= this.#inlineDropdownHeight || spaceBelow >= spaceAbove;
|
|
3317
3350
|
}
|
|
3318
|
-
// inject
|
|
3319
|
-
#
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3351
|
+
// inject the country selector into its detached wrapper and apply positioning styles
|
|
3352
|
+
#injectAndPositionDetachedCountrySelector() {
|
|
3353
|
+
const isFullscreen = this.#options.countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN;
|
|
3354
|
+
const detachedParent = this.#getDetachedParent();
|
|
3355
|
+
if (isFullscreen) {
|
|
3322
3356
|
if (window.innerWidth >= LAYOUT.NARROW_VIEWPORT_WIDTH) {
|
|
3323
3357
|
const inputPos = this.telInputEl.getBoundingClientRect();
|
|
3324
|
-
this.#
|
|
3325
|
-
this.#
|
|
3358
|
+
this.#detachedCountrySelectorEl.style.paddingLeft = `${inputPos.left}px`;
|
|
3359
|
+
this.#detachedCountrySelectorEl.style.paddingRight = `${window.innerWidth - inputPos.right}px`;
|
|
3326
3360
|
}
|
|
3327
|
-
} else {
|
|
3361
|
+
} else if (!supportsCssAnchor) {
|
|
3328
3362
|
const inputPos = this.telInputEl.getBoundingClientRect();
|
|
3329
|
-
this.#
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
this.#detachedDropdownEl.style.top = `${inputPos.bottom + LAYOUT.DROPDOWN_MARGIN}px`;
|
|
3363
|
+
this.#detachedCountrySelectorEl.style.left = `${inputPos.left}px`;
|
|
3364
|
+
if (this.#shouldPositionDropdownBelowInput()) {
|
|
3365
|
+
this.#detachedCountrySelectorEl.style.top = `${inputPos.bottom + LAYOUT.DROPDOWN_MARGIN}px`;
|
|
3333
3366
|
} else {
|
|
3334
|
-
this.#
|
|
3335
|
-
this.#
|
|
3367
|
+
this.#detachedCountrySelectorEl.style.top = "unset";
|
|
3368
|
+
this.#detachedCountrySelectorEl.style.bottom = `${window.innerHeight - inputPos.top + LAYOUT.DROPDOWN_MARGIN}px`;
|
|
3336
3369
|
}
|
|
3337
3370
|
}
|
|
3338
|
-
|
|
3371
|
+
detachedParent.appendChild(this.#detachedCountrySelectorEl);
|
|
3372
|
+
}
|
|
3373
|
+
//* Wire up CSS Anchor Positioning between the input and the detached country selector using a
|
|
3374
|
+
//* unique anchor name per instance. Called once at build time — the matching styles in
|
|
3375
|
+
//* intlTelInput.css only take effect in browsers that support anchor(); elsewhere these
|
|
3376
|
+
//* properties are inert. We append our name to any existing anchor-name (read via
|
|
3377
|
+
//* getComputedStyle so we pick up CSS-defined values), so consumer-set anchors on the input
|
|
3378
|
+
//* are preserved. Caveat: this snapshots the consumer's value once — if they later change
|
|
3379
|
+
//* anchor-name via CSS (e.g. a class swap), our inline write will shadow the change.
|
|
3380
|
+
#setupCssAnchorPositioning() {
|
|
3381
|
+
const anchorName = `--iti-anchor-${this.#id}`;
|
|
3382
|
+
const existing = getComputedStyle(this.telInputEl).anchorName;
|
|
3383
|
+
this.telInputEl.style.anchorName = existing && existing !== "none" ? `${existing}, ${anchorName}` : anchorName;
|
|
3384
|
+
this.#detachedCountrySelectorEl.style.positionAnchor = anchorName;
|
|
3339
3385
|
}
|
|
3340
3386
|
// Adjust the fullscreen popup dimensions to match the visual viewport,
|
|
3341
3387
|
// so it stays above the virtual keyboard on mobile devices.
|
|
3342
3388
|
#adjustFullscreenPopupToViewport() {
|
|
3343
3389
|
const vv = window.visualViewport;
|
|
3344
|
-
if (!vv || !this.#
|
|
3390
|
+
if (!vv || !this.#detachedCountrySelectorEl) {
|
|
3345
3391
|
return;
|
|
3346
3392
|
}
|
|
3347
3393
|
const virtualKeyboardHeight = window.innerHeight - vv.height;
|
|
3348
|
-
this.#
|
|
3394
|
+
this.#detachedCountrySelectorEl.style.bottom = `${virtualKeyboardHeight}px`;
|
|
3349
3395
|
}
|
|
3350
|
-
// UI: Whether the
|
|
3351
|
-
|
|
3352
|
-
return !this.#
|
|
3396
|
+
// UI: Whether the country selector is currently open (visible).
|
|
3397
|
+
isCountrySelectorOpen() {
|
|
3398
|
+
return !this.#countrySelectorEl.classList.contains(CLASSES.HIDE);
|
|
3353
3399
|
}
|
|
3354
3400
|
// Toggle the loading spinner on the selected flag (used during auto-country geoIP lookup).
|
|
3355
3401
|
setLoading(isLoading) {
|
|
3356
3402
|
this.#selectedFlagEl.classList.toggle(CLASSES.LOADING, isLoading);
|
|
3357
3403
|
}
|
|
3404
|
+
//* Play the strict-reject animation (shake, or background-colour flash under prefers-reduced-motion) on the wrapper.
|
|
3405
|
+
//* Called when strictMode rejects the whole input (keystroke, or whole paste).
|
|
3406
|
+
//* Uses the wrapper (not the input) so any separateDialCode / country button move together with the input.
|
|
3407
|
+
playStrictRejectAnimation() {
|
|
3408
|
+
if (!this.#options.strictRejectAnimation) {
|
|
3409
|
+
return;
|
|
3410
|
+
}
|
|
3411
|
+
const wrapperEl = this.telInputEl.parentElement;
|
|
3412
|
+
if (!wrapperEl) {
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
wrapperEl.classList.remove(CLASSES.STRICT_REJECT_ANIMATION);
|
|
3416
|
+
void wrapperEl.offsetWidth;
|
|
3417
|
+
wrapperEl.classList.add(CLASSES.STRICT_REJECT_ANIMATION);
|
|
3418
|
+
wrapperEl.addEventListener(
|
|
3419
|
+
"animationend",
|
|
3420
|
+
() => wrapperEl.classList.remove(CLASSES.STRICT_REJECT_ANIMATION),
|
|
3421
|
+
{ once: true }
|
|
3422
|
+
);
|
|
3423
|
+
}
|
|
3358
3424
|
isLoading() {
|
|
3359
3425
|
return this.#selectedFlagEl.classList.contains(CLASSES.LOADING);
|
|
3360
3426
|
}
|
|
3361
|
-
// Set the disabled state of the input and
|
|
3427
|
+
// Set the disabled state of the input and country selector.
|
|
3362
3428
|
setDisabled(disabled) {
|
|
3363
3429
|
this.telInputEl.disabled = disabled;
|
|
3364
3430
|
if (this.#selectedCountryEl) {
|
|
@@ -3369,7 +3435,7 @@ var _factory = (() => {
|
|
|
3369
3435
|
}
|
|
3370
3436
|
}
|
|
3371
3437
|
}
|
|
3372
|
-
// Set the readonly state of the input and
|
|
3438
|
+
// Set the readonly state of the input and country selector.
|
|
3373
3439
|
setReadonly(readonly) {
|
|
3374
3440
|
this.telInputEl.readOnly = readonly;
|
|
3375
3441
|
if (this.#selectedCountryEl) {
|
|
@@ -3380,12 +3446,12 @@ var _factory = (() => {
|
|
|
3380
3446
|
}
|
|
3381
3447
|
}
|
|
3382
3448
|
}
|
|
3383
|
-
|
|
3384
|
-
const {
|
|
3385
|
-
const name =
|
|
3386
|
-
const dialCode =
|
|
3387
|
-
const iso2 =
|
|
3388
|
-
if (
|
|
3449
|
+
setSelectedCountry(selectedCountry) {
|
|
3450
|
+
const { countrySelectorMode, showFlags, separateDialCode, uiTranslations } = this.#options;
|
|
3451
|
+
const name = selectedCountry?.name;
|
|
3452
|
+
const dialCode = selectedCountry?.dialCode;
|
|
3453
|
+
const iso2 = selectedCountry?.iso2 ?? "";
|
|
3454
|
+
if (countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF) {
|
|
3389
3455
|
this.#updateSelectedListItem(iso2);
|
|
3390
3456
|
}
|
|
3391
3457
|
if (this.#selectedCountryEl) {
|
|
@@ -3394,13 +3460,13 @@ var _factory = (() => {
|
|
|
3394
3460
|
let flagContent = null;
|
|
3395
3461
|
if (iso2) {
|
|
3396
3462
|
title = name;
|
|
3397
|
-
ariaLabel =
|
|
3463
|
+
ariaLabel = uiTranslations.selectedCountryAriaLabel.replace("${countryName}", name).replace("${dialCode}", `+${dialCode}`);
|
|
3398
3464
|
if (!showFlags) {
|
|
3399
3465
|
flagContent = buildGlobeIcon();
|
|
3400
3466
|
}
|
|
3401
3467
|
} else {
|
|
3402
|
-
title =
|
|
3403
|
-
ariaLabel =
|
|
3468
|
+
title = uiTranslations.noCountrySelected;
|
|
3469
|
+
ariaLabel = uiTranslations.noCountrySelected;
|
|
3404
3470
|
flagContent = buildGlobeIcon();
|
|
3405
3471
|
}
|
|
3406
3472
|
this.#selectedFlagEl.className = flagClass;
|
|
@@ -3549,17 +3615,17 @@ var _factory = (() => {
|
|
|
3549
3615
|
};
|
|
3550
3616
|
|
|
3551
3617
|
// packages/core/src/js/format/formatting.ts
|
|
3552
|
-
var stripSeparateDialCode = (fullNumber, hasValidDialCode, separateDialCode,
|
|
3618
|
+
var stripSeparateDialCode = (fullNumber, hasValidDialCode, separateDialCode, selectedCountry) => {
|
|
3553
3619
|
if (!separateDialCode || !hasValidDialCode) {
|
|
3554
3620
|
return fullNumber;
|
|
3555
3621
|
}
|
|
3556
|
-
const dialCode = `+${
|
|
3622
|
+
const dialCode = `+${selectedCountry.dialCode}`;
|
|
3557
3623
|
const start = fullNumber[dialCode.length] === " " || fullNumber[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
|
|
3558
3624
|
return fullNumber.substring(start);
|
|
3559
3625
|
};
|
|
3560
|
-
var formatNumberAsYouType = (fullNumber, telInputValue, utils,
|
|
3561
|
-
const result = utils ? utils.formatNumberAsYouType(fullNumber,
|
|
3562
|
-
const dialCode =
|
|
3626
|
+
var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountry, separateDialCode) => {
|
|
3627
|
+
const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountry?.iso2) : fullNumber;
|
|
3628
|
+
const dialCode = selectedCountry?.dialCode;
|
|
3563
3629
|
if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
3564
3630
|
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
3565
3631
|
return afterDialCode.trim();
|
|
@@ -3690,8 +3756,8 @@ var _factory = (() => {
|
|
|
3690
3756
|
this.#ui.telInputEl.value = this.#numerals.denormalise(asciiValue);
|
|
3691
3757
|
}
|
|
3692
3758
|
#createInitPromise(options) {
|
|
3693
|
-
const { initialCountry,
|
|
3694
|
-
const needsAutoCountryDeferred = initialCountry
|
|
3759
|
+
const { initialCountry, initialCountryLookup, loadUtils } = options;
|
|
3760
|
+
const needsAutoCountryDeferred = !initialCountry && Boolean(initialCountryLookup);
|
|
3695
3761
|
const needsUtilsDeferred = Boolean(loadUtils) && !intlTelInput.utils;
|
|
3696
3762
|
if (needsAutoCountryDeferred) {
|
|
3697
3763
|
this.#autoCountryDeferred = createDeferred();
|
|
@@ -3713,7 +3779,7 @@ var _factory = (() => {
|
|
|
3713
3779
|
this.#initListeners();
|
|
3714
3780
|
this.#startAsyncLoads();
|
|
3715
3781
|
if (this.#options.dropdownAlwaysOpen) {
|
|
3716
|
-
this
|
|
3782
|
+
this.openCountrySelector();
|
|
3717
3783
|
}
|
|
3718
3784
|
}
|
|
3719
3785
|
//********************
|
|
@@ -3736,8 +3802,8 @@ var _factory = (() => {
|
|
|
3736
3802
|
const value = useAttribute ? attributeValue : inputValue;
|
|
3737
3803
|
const dialCode = this.#getDialCode(value);
|
|
3738
3804
|
const isRegionlessNanpNumber = isRegionlessNanp(value);
|
|
3739
|
-
const { initialCountry,
|
|
3740
|
-
const isAutoCountry = initialCountry
|
|
3805
|
+
const { initialCountry, initialCountryLookup } = this.#options;
|
|
3806
|
+
const isAutoCountry = !initialCountry && Boolean(initialCountryLookup);
|
|
3741
3807
|
const resolvedInitialCountry = isAutoCountry && intlTelInput.autoCountry ? intlTelInput.autoCountry : initialCountry;
|
|
3742
3808
|
const doingAutoCountryLookup = isAutoCountry && !overrideAutoCountry && !intlTelInput.autoCountry;
|
|
3743
3809
|
const isValidInitialCountry = isIso2(resolvedInitialCountry);
|
|
@@ -3766,11 +3832,11 @@ var _factory = (() => {
|
|
|
3766
3832
|
//* Initialise the main event listeners: input keyup, and click selected country.
|
|
3767
3833
|
#initListeners() {
|
|
3768
3834
|
this.#bindAllTelInputListeners();
|
|
3769
|
-
if (this.#options.
|
|
3770
|
-
this.#ui.
|
|
3835
|
+
if (this.#options.countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF) {
|
|
3836
|
+
this.#ui.bindAllInitialCountrySelectorListeners(
|
|
3771
3837
|
this.#abortController.signal,
|
|
3772
|
-
() => this
|
|
3773
|
-
() => this.#
|
|
3838
|
+
() => this.openCountrySelector(),
|
|
3839
|
+
() => this.#closeCountrySelectorInternal()
|
|
3774
3840
|
);
|
|
3775
3841
|
}
|
|
3776
3842
|
this.#ui.bindHiddenInputSubmitListener(
|
|
@@ -3779,7 +3845,7 @@ var _factory = (() => {
|
|
|
3779
3845
|
() => this.#selectedCountry?.iso2 || ""
|
|
3780
3846
|
);
|
|
3781
3847
|
}
|
|
3782
|
-
//* Init requests: utils script /
|
|
3848
|
+
//* Init requests: utils script / initial country lookup.
|
|
3783
3849
|
#startAsyncLoads() {
|
|
3784
3850
|
if (this.#utilsDeferred) {
|
|
3785
3851
|
const { loadUtils } = this.#options;
|
|
@@ -3803,7 +3869,7 @@ var _factory = (() => {
|
|
|
3803
3869
|
}
|
|
3804
3870
|
}
|
|
3805
3871
|
}
|
|
3806
|
-
//* Perform the
|
|
3872
|
+
//* Perform the initial country lookup.
|
|
3807
3873
|
async #loadAutoCountry() {
|
|
3808
3874
|
if (intlTelInput.autoCountry) {
|
|
3809
3875
|
this.#handleAutoCountryLoaded();
|
|
@@ -3814,14 +3880,14 @@ var _factory = (() => {
|
|
|
3814
3880
|
return;
|
|
3815
3881
|
}
|
|
3816
3882
|
intlTelInput.startedLoadingAutoCountry = true;
|
|
3817
|
-
if (typeof this.#options.
|
|
3883
|
+
if (typeof this.#options.initialCountryLookup === "function") {
|
|
3818
3884
|
let timeoutId;
|
|
3819
3885
|
try {
|
|
3820
3886
|
const iso2 = await Promise.race([
|
|
3821
|
-
this.#options.
|
|
3887
|
+
this.#options.initialCountryLookup(),
|
|
3822
3888
|
new Promise((_, reject) => {
|
|
3823
3889
|
timeoutId = setTimeout(
|
|
3824
|
-
() => reject(new Error("intl-tel-input:
|
|
3890
|
+
() => reject(new Error("intl-tel-input: initialCountryLookup timed out after 10s")),
|
|
3825
3891
|
1e4
|
|
3826
3892
|
);
|
|
3827
3893
|
})
|
|
@@ -3844,8 +3910,8 @@ var _factory = (() => {
|
|
|
3844
3910
|
}
|
|
3845
3911
|
}
|
|
3846
3912
|
}
|
|
3847
|
-
#
|
|
3848
|
-
this
|
|
3913
|
+
#openCountrySelectorWithPlus() {
|
|
3914
|
+
this.openCountrySelector();
|
|
3849
3915
|
this.#ui.prefillSearchWithPlus();
|
|
3850
3916
|
}
|
|
3851
3917
|
//* Delete the character just typed (the one immediately before the caret). Used by Android workarounds where we can't preventDefault on keydown.
|
|
@@ -3865,13 +3931,13 @@ var _factory = (() => {
|
|
|
3865
3931
|
//* Android workaround for handling plus when separateDialCode enabled (as impossible to handle with keydown/keyup, for which e.key always returns "Unidentified", see https://stackoverflow.com/q/59584061/217866)
|
|
3866
3932
|
#handleAndroidPlusKey(inputValue) {
|
|
3867
3933
|
this.#removeJustTypedChar(inputValue);
|
|
3868
|
-
this.#
|
|
3934
|
+
this.#openCountrySelectorWithPlus();
|
|
3869
3935
|
}
|
|
3870
3936
|
//* Android strictMode workaround: the keydown-based filter can't block these because e.key is "Unidentified" on Android virtual keyboards, so strip them here on input.
|
|
3871
3937
|
#handleAndroidStrictReject(inputValue, rejectedInput) {
|
|
3872
3938
|
const newCaretPos = this.#removeJustTypedChar(inputValue);
|
|
3873
3939
|
this.#ui.telInputEl.setSelectionRange(newCaretPos, newCaretPos);
|
|
3874
|
-
this.#playStrictRejectAnimation();
|
|
3940
|
+
this.#ui.playStrictRejectAnimation();
|
|
3875
3941
|
this.#dispatchEvent(EVENTS.STRICT_REJECT, {
|
|
3876
3942
|
source: "key",
|
|
3877
3943
|
rejectedInput,
|
|
@@ -3935,7 +4001,7 @@ var _factory = (() => {
|
|
|
3935
4001
|
strictMode,
|
|
3936
4002
|
formatAsYouType,
|
|
3937
4003
|
separateDialCode,
|
|
3938
|
-
|
|
4004
|
+
countrySelectorMode,
|
|
3939
4005
|
countrySearch
|
|
3940
4006
|
} = this.#options;
|
|
3941
4007
|
const detail = e?.detail;
|
|
@@ -3945,7 +4011,7 @@ var _factory = (() => {
|
|
|
3945
4011
|
let inputValue = this.#getTelInputValue();
|
|
3946
4012
|
const isPaste = e?.inputType === INPUT_TYPES.PASTE;
|
|
3947
4013
|
const isStrictPaste = strictMode && isPaste;
|
|
3948
|
-
if (this.#isAndroid && !isPaste && e?.data === "+" && separateDialCode &&
|
|
4014
|
+
if (this.#isAndroid && !isPaste && e?.data === "+" && separateDialCode && countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF && countrySearch) {
|
|
3949
4015
|
this.#handleAndroidPlusKey(inputValue);
|
|
3950
4016
|
return;
|
|
3951
4017
|
}
|
|
@@ -3992,13 +4058,13 @@ var _factory = (() => {
|
|
|
3992
4058
|
//* On keydown event: (1) if strictMode then prevent invalid characters, (2) if separateDialCode then handle plus key
|
|
3993
4059
|
//* Note that this fires BEFORE the input is updated.
|
|
3994
4060
|
#handleKeydownEvent = (e) => {
|
|
3995
|
-
const { strictMode, separateDialCode,
|
|
4061
|
+
const { strictMode, separateDialCode, countrySelectorMode, countrySearch } = this.#options;
|
|
3996
4062
|
if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) {
|
|
3997
4063
|
return;
|
|
3998
4064
|
}
|
|
3999
|
-
if (separateDialCode &&
|
|
4065
|
+
if (separateDialCode && countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF && countrySearch && e.key === "+") {
|
|
4000
4066
|
e.preventDefault();
|
|
4001
|
-
this.#
|
|
4067
|
+
this.#openCountrySelectorWithPlus();
|
|
4002
4068
|
return;
|
|
4003
4069
|
}
|
|
4004
4070
|
if (!strictMode) {
|
|
@@ -4028,7 +4094,7 @@ var _factory = (() => {
|
|
|
4028
4094
|
const newCountry = this.#resolveCountryChangeFromNumber(newFullNumber);
|
|
4029
4095
|
const isChangingDialCode = newCountry !== null;
|
|
4030
4096
|
if (!isAllowedChar || hasExceededMaxLength && !isChangingDialCode && !isInitialPlus) {
|
|
4031
|
-
this.#playStrictRejectAnimation();
|
|
4097
|
+
this.#ui.playStrictRejectAnimation();
|
|
4032
4098
|
this.#dispatchEvent(EVENTS.STRICT_REJECT, {
|
|
4033
4099
|
source: "key",
|
|
4034
4100
|
rejectedInput: e.key,
|
|
@@ -4083,7 +4149,7 @@ var _factory = (() => {
|
|
|
4083
4149
|
let newValue = before + sanitised + after;
|
|
4084
4150
|
let rejectReason = sanitised !== pasted ? "invalid" : null;
|
|
4085
4151
|
if (newValue.length > 30) {
|
|
4086
|
-
this.#playStrictRejectAnimation();
|
|
4152
|
+
this.#ui.playStrictRejectAnimation();
|
|
4087
4153
|
this.#dispatchEvent(EVENTS.STRICT_REJECT, {
|
|
4088
4154
|
source: "paste",
|
|
4089
4155
|
rejectedInput: pastedRaw,
|
|
@@ -4099,7 +4165,7 @@ var _factory = (() => {
|
|
|
4099
4165
|
coreNumber = intlTelInput.utils.getCoreNumber(newValue, iso2);
|
|
4100
4166
|
}
|
|
4101
4167
|
if (!coreNumber) {
|
|
4102
|
-
this.#playStrictRejectAnimation();
|
|
4168
|
+
this.#ui.playStrictRejectAnimation();
|
|
4103
4169
|
this.#dispatchEvent(EVENTS.STRICT_REJECT, {
|
|
4104
4170
|
source: "paste",
|
|
4105
4171
|
rejectedInput: pastedRaw,
|
|
@@ -4114,7 +4180,7 @@ var _factory = (() => {
|
|
|
4114
4180
|
newValue = newValue.slice(0, newValue.length - trimLength);
|
|
4115
4181
|
rejectReason = "max-length";
|
|
4116
4182
|
} else {
|
|
4117
|
-
this.#playStrictRejectAnimation();
|
|
4183
|
+
this.#ui.playStrictRejectAnimation();
|
|
4118
4184
|
this.#dispatchEvent(EVENTS.STRICT_REJECT, {
|
|
4119
4185
|
source: "paste",
|
|
4120
4186
|
rejectedInput: pastedRaw,
|
|
@@ -4130,7 +4196,7 @@ var _factory = (() => {
|
|
|
4130
4196
|
input.setSelectionRange(caretPos, caretPos);
|
|
4131
4197
|
if (rejectReason) {
|
|
4132
4198
|
if (pasted.length > 0 && sanitised.length === 0) {
|
|
4133
|
-
this.#playStrictRejectAnimation();
|
|
4199
|
+
this.#ui.playStrictRejectAnimation();
|
|
4134
4200
|
}
|
|
4135
4201
|
this.#dispatchEvent(EVENTS.STRICT_REJECT, {
|
|
4136
4202
|
source: "paste",
|
|
@@ -4152,21 +4218,6 @@ var _factory = (() => {
|
|
|
4152
4218
|
const max = Number(this.#ui.telInputEl.getAttribute("maxlength"));
|
|
4153
4219
|
return max && number.length > max ? number.substring(0, max) : number;
|
|
4154
4220
|
}
|
|
4155
|
-
//* Play the strict-reject animation (shake, or background-colour flash under prefers-reduced-motion) on the wrapper.
|
|
4156
|
-
//* Called when strictMode rejects the whole input (keystroke, or whole paste).
|
|
4157
|
-
//* Uses the wrapper (not the input) so any separateDialCode / country button move together with the input.
|
|
4158
|
-
#playStrictRejectAnimation() {
|
|
4159
|
-
if (!this.#options.strictRejectAnimation) {
|
|
4160
|
-
return;
|
|
4161
|
-
}
|
|
4162
|
-
const wrapperEl = this.#ui.telInputEl.parentElement;
|
|
4163
|
-
if (!wrapperEl) {
|
|
4164
|
-
return;
|
|
4165
|
-
}
|
|
4166
|
-
wrapperEl.classList.remove("iti__strict-reject-animation");
|
|
4167
|
-
void wrapperEl.offsetWidth;
|
|
4168
|
-
wrapperEl.classList.add("iti__strict-reject-animation");
|
|
4169
|
-
}
|
|
4170
4221
|
//* Trigger a custom event on the input (typed via ItiEventMap).
|
|
4171
4222
|
#dispatchEvent(name, detailProps = {}) {
|
|
4172
4223
|
const e = new CustomEvent(name, {
|
|
@@ -4176,27 +4227,36 @@ var _factory = (() => {
|
|
|
4176
4227
|
});
|
|
4177
4228
|
this.#ui.telInputEl.dispatchEvent(e);
|
|
4178
4229
|
}
|
|
4179
|
-
//* Open the
|
|
4180
|
-
//* and its listeners leak. Reachable via
|
|
4181
|
-
|
|
4182
|
-
|
|
4230
|
+
//* Open the country selector. Bail if already open — otherwise the existing AbortController gets overwritten
|
|
4231
|
+
//* and its listeners leak. Reachable via openCountrySelectorWithPlus when dropdownAlwaysOpen is set.
|
|
4232
|
+
//* Public so consumers can programmatically open the country selector.
|
|
4233
|
+
openCountrySelector() {
|
|
4234
|
+
if (this.#ui.isCountrySelectorOpen()) {
|
|
4183
4235
|
return;
|
|
4184
4236
|
}
|
|
4185
|
-
this.#ui.
|
|
4237
|
+
this.#ui.openCountrySelector(
|
|
4186
4238
|
(li) => this.#selectListItem(li),
|
|
4187
|
-
() => this.#
|
|
4239
|
+
() => this.#closeCountrySelectorInternal()
|
|
4188
4240
|
);
|
|
4189
|
-
this.#dispatchEvent(EVENTS.
|
|
4241
|
+
this.#dispatchEvent(EVENTS.OPEN_COUNTRY_SELECTOR);
|
|
4190
4242
|
}
|
|
4191
4243
|
//* Update the input's value to the given number (format first if possible)
|
|
4192
4244
|
//* NOTE: this is called from setInitialState, handleUtilsLoaded and setNumber.
|
|
4193
4245
|
#updateValueFromNumber(fullNumber) {
|
|
4194
|
-
const {
|
|
4246
|
+
const { numberDisplayFormat, separateDialCode } = this.#options;
|
|
4195
4247
|
let number = fullNumber;
|
|
4196
|
-
if (
|
|
4248
|
+
if (intlTelInput.utils && this.#selectedCountry) {
|
|
4197
4249
|
const isRegionless = hasRegionlessDialCode(fullNumber);
|
|
4198
|
-
const
|
|
4199
|
-
const
|
|
4250
|
+
const preserveUserNational = !number.startsWith("+") && !separateDialCode;
|
|
4251
|
+
const useNational = numberDisplayFormat === NUMBER_FORMAT.NATIONAL && !isRegionless || preserveUserNational;
|
|
4252
|
+
let format;
|
|
4253
|
+
if (useNational) {
|
|
4254
|
+
format = NUMBER_FORMAT.NATIONAL;
|
|
4255
|
+
} else if (numberDisplayFormat === NUMBER_FORMAT.E164 && !isRegionless) {
|
|
4256
|
+
format = NUMBER_FORMAT.E164;
|
|
4257
|
+
} else {
|
|
4258
|
+
format = NUMBER_FORMAT.INTERNATIONAL;
|
|
4259
|
+
}
|
|
4200
4260
|
number = intlTelInput.utils.formatNumber(
|
|
4201
4261
|
number,
|
|
4202
4262
|
this.#selectedCountry?.iso2,
|
|
@@ -4293,14 +4353,14 @@ var _factory = (() => {
|
|
|
4293
4353
|
return null;
|
|
4294
4354
|
}
|
|
4295
4355
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
|
|
4296
|
-
//* Note: called from setInitialState, updateCountryFromNumber, selectListItem,
|
|
4356
|
+
//* Note: called from setInitialState, updateCountryFromNumber, selectListItem, setSelectedCountry.
|
|
4297
4357
|
#updateSelectedCountry(iso2) {
|
|
4298
4358
|
const prevIso2 = this.#selectedCountry?.iso2 || "";
|
|
4299
4359
|
this.#selectedCountry = iso2 ? this.#countryByIso2.get(iso2) : null;
|
|
4300
4360
|
if (this.#selectedCountry) {
|
|
4301
4361
|
this.#fallbackCountryIso2 = this.#selectedCountry.iso2;
|
|
4302
4362
|
}
|
|
4303
|
-
this.#ui.
|
|
4363
|
+
this.#ui.setSelectedCountry(this.#selectedCountry);
|
|
4304
4364
|
this.#updatePlaceholder();
|
|
4305
4365
|
this.#updateMaxCoreNumberLength();
|
|
4306
4366
|
return prevIso2 !== iso2;
|
|
@@ -4318,12 +4378,11 @@ var _factory = (() => {
|
|
|
4318
4378
|
}
|
|
4319
4379
|
let exampleNumber = intlTelInput.utils.getExampleNumber(
|
|
4320
4380
|
iso2,
|
|
4321
|
-
false,
|
|
4322
4381
|
placeholderNumberType,
|
|
4323
|
-
|
|
4382
|
+
NUMBER_FORMAT.E164
|
|
4324
4383
|
);
|
|
4325
4384
|
let validNumber = exampleNumber;
|
|
4326
|
-
while (intlTelInput.utils.
|
|
4385
|
+
while (intlTelInput.utils.isValidNumber(
|
|
4327
4386
|
exampleNumber,
|
|
4328
4387
|
iso2,
|
|
4329
4388
|
allowedNumberTypes
|
|
@@ -4340,19 +4399,19 @@ var _factory = (() => {
|
|
|
4340
4399
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
4341
4400
|
#updatePlaceholder() {
|
|
4342
4401
|
const {
|
|
4343
|
-
|
|
4402
|
+
placeholderNumberPolicy,
|
|
4344
4403
|
placeholderNumberType,
|
|
4345
|
-
|
|
4404
|
+
numberDisplayFormat,
|
|
4346
4405
|
customPlaceholder
|
|
4347
4406
|
} = this.#options;
|
|
4348
|
-
const shouldSetPlaceholder =
|
|
4407
|
+
const shouldSetPlaceholder = placeholderNumberPolicy === PLACEHOLDER_POLICY.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && placeholderNumberPolicy === PLACEHOLDER_POLICY.POLITE;
|
|
4349
4408
|
if (!intlTelInput.utils || !shouldSetPlaceholder) {
|
|
4350
4409
|
return;
|
|
4351
4410
|
}
|
|
4352
4411
|
let placeholder = this.#selectedCountry ? intlTelInput.utils.getExampleNumber(
|
|
4353
4412
|
this.#selectedCountry.iso2,
|
|
4354
|
-
|
|
4355
|
-
|
|
4413
|
+
placeholderNumberType,
|
|
4414
|
+
numberDisplayFormat
|
|
4356
4415
|
) : "";
|
|
4357
4416
|
placeholder = this.#prepareNumberForInput(placeholder);
|
|
4358
4417
|
if (typeof customPlaceholder === "function") {
|
|
@@ -4360,36 +4419,40 @@ var _factory = (() => {
|
|
|
4360
4419
|
}
|
|
4361
4420
|
this.#ui.telInputEl.setAttribute("placeholder", placeholder);
|
|
4362
4421
|
}
|
|
4363
|
-
//* Called when the user selects a list item from the
|
|
4422
|
+
//* Called when the user selects a list item from the country list (no-op if listItem is null).
|
|
4364
4423
|
#selectListItem(listItem) {
|
|
4365
4424
|
if (!listItem) {
|
|
4366
4425
|
return;
|
|
4367
4426
|
}
|
|
4368
4427
|
const iso2 = listItem.dataset[DATA_KEYS.ISO2];
|
|
4369
4428
|
const countryChanged = this.#updateSelectedCountry(iso2);
|
|
4370
|
-
this.#
|
|
4429
|
+
this.#closeCountrySelectorInternal();
|
|
4371
4430
|
const dialCode = listItem.dataset[DATA_KEYS.DIAL_CODE];
|
|
4372
4431
|
this.#updateDialCode(dialCode);
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
this.#updateValueFromNumber(inputValue);
|
|
4376
|
-
}
|
|
4432
|
+
const inputValue = this.#getTelInputValue();
|
|
4433
|
+
this.#updateValueFromNumber(inputValue);
|
|
4377
4434
|
this.#ui.telInputEl.focus();
|
|
4378
4435
|
if (countryChanged) {
|
|
4379
4436
|
this.#dispatchCountryChangeEvent();
|
|
4380
4437
|
this.#dispatchEvent(EVENTS.INPUT, { isCountryChange: true });
|
|
4381
4438
|
}
|
|
4382
4439
|
}
|
|
4383
|
-
//*
|
|
4384
|
-
|
|
4385
|
-
|
|
4440
|
+
//* Public: close the country selector (consumer-callable; delegates to the internal helper
|
|
4441
|
+
//* without the destroy-specific path).
|
|
4442
|
+
closeCountrySelector() {
|
|
4443
|
+
this.#closeCountrySelectorInternal();
|
|
4444
|
+
}
|
|
4445
|
+
//* Close the country selector and unbind any listeners. The isDestroy flag forces close even
|
|
4446
|
+
//* when dropdownAlwaysOpen is set, so destroy() can fully tear down.
|
|
4447
|
+
#closeCountrySelectorInternal(isDestroy) {
|
|
4448
|
+
if (!this.#ui.isCountrySelectorOpen() || this.#options.dropdownAlwaysOpen && !isDestroy) {
|
|
4386
4449
|
return;
|
|
4387
4450
|
}
|
|
4388
|
-
this.#ui.
|
|
4389
|
-
this.#dispatchEvent(EVENTS.
|
|
4451
|
+
this.#ui.closeCountrySelector();
|
|
4452
|
+
this.#dispatchEvent(EVENTS.CLOSE_COUNTRY_SELECTOR);
|
|
4390
4453
|
}
|
|
4391
4454
|
//* Replace any existing dial code with the new one
|
|
4392
|
-
//* Note: called from selectListItem and
|
|
4455
|
+
//* Note: called from selectListItem and setSelectedCountry
|
|
4393
4456
|
#updateDialCode(newDialCodeDigits) {
|
|
4394
4457
|
const inputValue = this.#getTelInputValue();
|
|
4395
4458
|
if (!inputValue.startsWith("+")) {
|
|
@@ -4469,7 +4532,7 @@ var _factory = (() => {
|
|
|
4469
4532
|
//**************************
|
|
4470
4533
|
//* INTERNAL METHODS
|
|
4471
4534
|
//**************************
|
|
4472
|
-
//* Called when the
|
|
4535
|
+
//* Called when the initial country lookup returns.
|
|
4473
4536
|
#handleAutoCountryLoaded() {
|
|
4474
4537
|
if (!this.#autoCountryDeferred || !intlTelInput.autoCountry) {
|
|
4475
4538
|
return;
|
|
@@ -4478,15 +4541,17 @@ var _factory = (() => {
|
|
|
4478
4541
|
this.#autoCountryDeferred.resolve();
|
|
4479
4542
|
return;
|
|
4480
4543
|
}
|
|
4481
|
-
|
|
4482
|
-
|
|
4544
|
+
const isFocused = document.activeElement === this.#ui.telInputEl;
|
|
4545
|
+
const hasTypedValue = Boolean(this.#getTelInputValue());
|
|
4546
|
+
if (this.#ui.isLoading() && !(isFocused && hasTypedValue)) {
|
|
4547
|
+
this.setSelectedCountry(intlTelInput.autoCountry);
|
|
4483
4548
|
} else {
|
|
4484
4549
|
this.#fallbackCountryIso2 = intlTelInput.autoCountry;
|
|
4485
4550
|
}
|
|
4486
4551
|
this.#ui.setLoading(false);
|
|
4487
4552
|
this.#autoCountryDeferred.resolve();
|
|
4488
4553
|
}
|
|
4489
|
-
//* Called when the
|
|
4554
|
+
//* Called when the initial country lookup fails or times out.
|
|
4490
4555
|
#handleAutoCountryFailure() {
|
|
4491
4556
|
if (!this.#isActive) {
|
|
4492
4557
|
this.#autoCountryDeferred?.reject();
|
|
@@ -4507,7 +4572,8 @@ var _factory = (() => {
|
|
|
4507
4572
|
return;
|
|
4508
4573
|
}
|
|
4509
4574
|
const inputValue = this.#getTelInputValue();
|
|
4510
|
-
|
|
4575
|
+
const isFocused = document.activeElement === this.#ui.telInputEl;
|
|
4576
|
+
if (inputValue && !isFocused) {
|
|
4511
4577
|
this.#updateValueFromNumber(inputValue);
|
|
4512
4578
|
}
|
|
4513
4579
|
if (this.#selectedCountry) {
|
|
@@ -4533,8 +4599,8 @@ var _factory = (() => {
|
|
|
4533
4599
|
return;
|
|
4534
4600
|
}
|
|
4535
4601
|
this.#isActive = false;
|
|
4536
|
-
if (this.#options.
|
|
4537
|
-
this.#
|
|
4602
|
+
if (this.#options.countrySelectorMode !== COUNTRY_SELECTOR_MODE.OFF) {
|
|
4603
|
+
this.#closeCountrySelectorInternal(true);
|
|
4538
4604
|
}
|
|
4539
4605
|
this.#abortController.abort();
|
|
4540
4606
|
this.#ui.destroy();
|
|
@@ -4582,7 +4648,7 @@ var _factory = (() => {
|
|
|
4582
4648
|
);
|
|
4583
4649
|
}
|
|
4584
4650
|
//* Get the country data for the currently selected country.
|
|
4585
|
-
|
|
4651
|
+
getSelectedCountry() {
|
|
4586
4652
|
return this.#selectedCountry ?? null;
|
|
4587
4653
|
}
|
|
4588
4654
|
//* Get the validation error e.g. "TOO_SHORT" / "TOO_LONG", or null if it can't be determined / instance is destroyed.
|
|
@@ -4637,7 +4703,7 @@ var _factory = (() => {
|
|
|
4637
4703
|
if (!this.#selectedCountry && !hasRegionlessDialCode(value)) {
|
|
4638
4704
|
return false;
|
|
4639
4705
|
}
|
|
4640
|
-
const check = mode === "precise" ? intlTelInput.utils.
|
|
4706
|
+
const check = mode === "precise" ? intlTelInput.utils.isValidNumberPrecise : intlTelInput.utils.isValidNumber;
|
|
4641
4707
|
if (!check(value, iso2, allowedNumberTypes)) {
|
|
4642
4708
|
return false;
|
|
4643
4709
|
}
|
|
@@ -4650,7 +4716,7 @@ var _factory = (() => {
|
|
|
4650
4716
|
return true;
|
|
4651
4717
|
}
|
|
4652
4718
|
//* Update the selected country, and update the input value accordingly.
|
|
4653
|
-
|
|
4719
|
+
setSelectedCountry(iso2) {
|
|
4654
4720
|
if (!this.#isActive) {
|
|
4655
4721
|
return;
|
|
4656
4722
|
}
|
|
@@ -4665,10 +4731,8 @@ var _factory = (() => {
|
|
|
4665
4731
|
}
|
|
4666
4732
|
this.#updateSelectedCountry(iso2Lower);
|
|
4667
4733
|
this.#updateDialCode(this.#selectedCountry?.dialCode || "");
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
this.#updateValueFromNumber(inputValue);
|
|
4671
|
-
}
|
|
4734
|
+
const inputValue = this.#getTelInputValue();
|
|
4735
|
+
this.#updateValueFromNumber(inputValue);
|
|
4672
4736
|
this.#dispatchCountryChangeEvent();
|
|
4673
4737
|
this.#dispatchEvent(EVENTS.INPUT, { isCountryChange: true });
|
|
4674
4738
|
}
|
|
@@ -4693,14 +4757,14 @@ var _factory = (() => {
|
|
|
4693
4757
|
this.#options.placeholderNumberType = type;
|
|
4694
4758
|
this.#updatePlaceholder();
|
|
4695
4759
|
}
|
|
4696
|
-
// Set the disabled state of the input and
|
|
4760
|
+
// Set the disabled state of the input and country selector.
|
|
4697
4761
|
setDisabled(disabled) {
|
|
4698
4762
|
if (!this.#isActive) {
|
|
4699
4763
|
return;
|
|
4700
4764
|
}
|
|
4701
4765
|
this.#ui.setDisabled(disabled);
|
|
4702
4766
|
}
|
|
4703
|
-
// Set the readonly state of the input and
|
|
4767
|
+
// Set the readonly state of the input and country selector.
|
|
4704
4768
|
setReadonly(readonly) {
|
|
4705
4769
|
if (!this.#isActive) {
|
|
4706
4770
|
return;
|
|
@@ -4710,7 +4774,7 @@ var _factory = (() => {
|
|
|
4710
4774
|
//********************
|
|
4711
4775
|
//* STATIC METHODS
|
|
4712
4776
|
//********************
|
|
4713
|
-
// Internal instance notification used by utils/
|
|
4777
|
+
// Internal instance notification used by utils/initial-country loaders.
|
|
4714
4778
|
// Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
|
|
4715
4779
|
// access to private instance methods.
|
|
4716
4780
|
static forEachInstance(method, ...args) {
|
|
@@ -4774,8 +4838,8 @@ var _factory = (() => {
|
|
|
4774
4838
|
defaults,
|
|
4775
4839
|
//* Using a static var like this allows us to mock it in the tests.
|
|
4776
4840
|
documentReady: () => document.readyState === "complete",
|
|
4777
|
-
//* Get the
|
|
4778
|
-
|
|
4841
|
+
//* Get the full list of all countries the library knows about.
|
|
4842
|
+
getAllCountries: () => data_default,
|
|
4779
4843
|
//* A getter for the core library instance.
|
|
4780
4844
|
getInstance: (input) => {
|
|
4781
4845
|
const id = input.dataset[DATA_KEYS.INSTANCE_ID];
|
|
@@ -4786,10 +4850,12 @@ var _factory = (() => {
|
|
|
4786
4850
|
attachUtils,
|
|
4787
4851
|
startedLoadingUtils: false,
|
|
4788
4852
|
startedLoadingAutoCountry: false,
|
|
4789
|
-
version: "
|
|
4853
|
+
version: "29.0.0",
|
|
4790
4854
|
NUMBER_FORMAT,
|
|
4791
4855
|
NUMBER_TYPE,
|
|
4792
|
-
VALIDATION_ERROR
|
|
4856
|
+
VALIDATION_ERROR,
|
|
4857
|
+
PLACEHOLDER_POLICY,
|
|
4858
|
+
COUNTRY_SELECTOR_MODE
|
|
4793
4859
|
}
|
|
4794
4860
|
);
|
|
4795
4861
|
var intlTelInput_default = intlTelInput;
|
|
@@ -4797,14 +4863,14 @@ var _factory = (() => {
|
|
|
4797
4863
|
// packages/core/dist/js/utils.js
|
|
4798
4864
|
var _scope = {};
|
|
4799
4865
|
(function() {
|
|
4800
|
-
var
|
|
4801
|
-
function
|
|
4866
|
+
var k = this || self;
|
|
4867
|
+
function m(a, b) {
|
|
4802
4868
|
a = a.split(".");
|
|
4803
|
-
var c =
|
|
4869
|
+
var c = k;
|
|
4804
4870
|
a[0] in c || typeof c.execScript == "undefined" || c.execScript("var " + a[0]);
|
|
4805
4871
|
for (var d; a.length && (d = a.shift()); ) a.length || b === void 0 ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b;
|
|
4806
4872
|
}
|
|
4807
|
-
function
|
|
4873
|
+
function n(a, b) {
|
|
4808
4874
|
function c() {
|
|
4809
4875
|
}
|
|
4810
4876
|
c.prototype = b.prototype;
|
|
@@ -4817,24 +4883,24 @@ var _factory = (() => {
|
|
|
4817
4883
|
};
|
|
4818
4884
|
}
|
|
4819
4885
|
;
|
|
4820
|
-
function
|
|
4886
|
+
function aa(a) {
|
|
4821
4887
|
const b = [];
|
|
4822
4888
|
let c = 0;
|
|
4823
4889
|
for (const d in a) b[c++] = a[d];
|
|
4824
4890
|
return b;
|
|
4825
4891
|
}
|
|
4826
4892
|
;
|
|
4827
|
-
var
|
|
4893
|
+
var ca = class {
|
|
4828
4894
|
constructor(a) {
|
|
4829
|
-
if (
|
|
4895
|
+
if (ba !== ba) throw Error("SafeUrl is not meant to be built directly");
|
|
4830
4896
|
this.g = a;
|
|
4831
4897
|
}
|
|
4832
4898
|
toString() {
|
|
4833
4899
|
return this.g.toString();
|
|
4834
4900
|
}
|
|
4835
|
-
},
|
|
4836
|
-
new
|
|
4837
|
-
new
|
|
4901
|
+
}, ba = {};
|
|
4902
|
+
new ca("about:invalid#zClosurez");
|
|
4903
|
+
new ca("about:blank");
|
|
4838
4904
|
const ea = {};
|
|
4839
4905
|
class fa {
|
|
4840
4906
|
constructor() {
|
|
@@ -4858,7 +4924,7 @@ var _factory = (() => {
|
|
|
4858
4924
|
const ja = {};
|
|
4859
4925
|
class ka {
|
|
4860
4926
|
constructor() {
|
|
4861
|
-
var a =
|
|
4927
|
+
var a = k.trustedTypes && k.trustedTypes.emptyHTML || "";
|
|
4862
4928
|
if (ja !== ja) throw Error("SafeHtml is not meant to be built directly");
|
|
4863
4929
|
this.g = a;
|
|
4864
4930
|
}
|
|
@@ -4895,38 +4961,38 @@ var _factory = (() => {
|
|
|
4895
4961
|
}
|
|
4896
4962
|
}
|
|
4897
4963
|
function ua(a) {
|
|
4898
|
-
a =
|
|
4964
|
+
a = aa(a.g);
|
|
4899
4965
|
a.sort(function(b, c) {
|
|
4900
4966
|
return b.g - c.g;
|
|
4901
4967
|
});
|
|
4902
4968
|
return a;
|
|
4903
4969
|
}
|
|
4904
4970
|
;
|
|
4905
|
-
function
|
|
4971
|
+
function p() {
|
|
4906
4972
|
this.h = {};
|
|
4907
4973
|
this.j = this.m().g;
|
|
4908
4974
|
this.g = this.l = null;
|
|
4909
4975
|
}
|
|
4910
|
-
|
|
4911
|
-
return
|
|
4976
|
+
p.prototype.has = function(a) {
|
|
4977
|
+
return q(this, a.g);
|
|
4912
4978
|
};
|
|
4913
|
-
|
|
4914
|
-
return
|
|
4979
|
+
p.prototype.get = function(a, b) {
|
|
4980
|
+
return r(this, a.g, b);
|
|
4915
4981
|
};
|
|
4916
|
-
|
|
4917
|
-
|
|
4982
|
+
p.prototype.set = function(a, b) {
|
|
4983
|
+
t(this, a.g, b);
|
|
4918
4984
|
};
|
|
4919
|
-
|
|
4985
|
+
p.prototype.add = function(a, b) {
|
|
4920
4986
|
va(this, a.g, b);
|
|
4921
4987
|
};
|
|
4922
|
-
|
|
4988
|
+
p.prototype.equals = function(a) {
|
|
4923
4989
|
if (!a || this.constructor != a.constructor) return false;
|
|
4924
4990
|
for (var b = ua(this.m()), c = 0; c < b.length; c++) {
|
|
4925
4991
|
var d = b[c], e = d.g;
|
|
4926
|
-
if (
|
|
4927
|
-
if (
|
|
4928
|
-
var f = d.h == 11 || d.h == 10, g =
|
|
4929
|
-
e =
|
|
4992
|
+
if (q(this, e) != q(a, e)) return false;
|
|
4993
|
+
if (q(this, e)) {
|
|
4994
|
+
var f = d.h == 11 || d.h == 10, g = u(this, e);
|
|
4995
|
+
e = u(a, e);
|
|
4930
4996
|
if (d.l) {
|
|
4931
4997
|
if (g.length != e.length) return false;
|
|
4932
4998
|
for (d = 0; d < g.length; d++) {
|
|
@@ -4941,25 +5007,25 @@ var _factory = (() => {
|
|
|
4941
5007
|
function wa(a, b) {
|
|
4942
5008
|
for (var c = ua(a.m()), d = 0; d < c.length; d++) {
|
|
4943
5009
|
var e = c[d], f = e.g;
|
|
4944
|
-
if (
|
|
5010
|
+
if (q(b, f)) {
|
|
4945
5011
|
a.g && delete a.g[e.g];
|
|
4946
5012
|
var g = e.h == 11 || e.h == 10;
|
|
4947
5013
|
if (e.l) {
|
|
4948
|
-
e =
|
|
5014
|
+
e = u(b, f) || [];
|
|
4949
5015
|
for (var h = 0; h < e.length; h++) va(a, f, g ? e[h].clone() : e[h]);
|
|
4950
|
-
} else e =
|
|
5016
|
+
} else e = u(b, f), g ? (g = u(a, f)) ? wa(g, e) : t(a, f, e.clone()) : t(a, f, e);
|
|
4951
5017
|
}
|
|
4952
5018
|
}
|
|
4953
5019
|
}
|
|
4954
|
-
|
|
5020
|
+
p.prototype.clone = function() {
|
|
4955
5021
|
var a = new this.constructor();
|
|
4956
5022
|
a != this && (a.h = {}, a.g && (a.g = {}), wa(a, this));
|
|
4957
5023
|
return a;
|
|
4958
5024
|
};
|
|
4959
|
-
function
|
|
5025
|
+
function q(a, b) {
|
|
4960
5026
|
return a.h[b] != null;
|
|
4961
5027
|
}
|
|
4962
|
-
function
|
|
5028
|
+
function u(a, b) {
|
|
4963
5029
|
var c = a.h[b];
|
|
4964
5030
|
if (c == null) return null;
|
|
4965
5031
|
if (a.l) {
|
|
@@ -4975,12 +5041,12 @@ var _factory = (() => {
|
|
|
4975
5041
|
}
|
|
4976
5042
|
return c;
|
|
4977
5043
|
}
|
|
4978
|
-
function
|
|
4979
|
-
var d =
|
|
5044
|
+
function r(a, b, c) {
|
|
5045
|
+
var d = u(a, b);
|
|
4980
5046
|
return a.j[b].l ? d[c || 0] : d;
|
|
4981
5047
|
}
|
|
4982
|
-
function
|
|
4983
|
-
if (
|
|
5048
|
+
function v(a, b) {
|
|
5049
|
+
if (q(a, b)) a = r(a, b);
|
|
4984
5050
|
else a: {
|
|
4985
5051
|
a = a.j[b];
|
|
4986
5052
|
if (a.j === void 0) if (b = a.u, b === Boolean) a.j = false;
|
|
@@ -4994,10 +5060,10 @@ var _factory = (() => {
|
|
|
4994
5060
|
}
|
|
4995
5061
|
return a;
|
|
4996
5062
|
}
|
|
4997
|
-
function
|
|
4998
|
-
return a.j[b].l ?
|
|
5063
|
+
function w(a, b) {
|
|
5064
|
+
return a.j[b].l ? q(a, b) ? a.h[b].length : 0 : q(a, b) ? 1 : 0;
|
|
4999
5065
|
}
|
|
5000
|
-
function
|
|
5066
|
+
function t(a, b, c) {
|
|
5001
5067
|
a.h[b] = c;
|
|
5002
5068
|
a.g && (a.g[b] = c);
|
|
5003
5069
|
}
|
|
@@ -5006,20 +5072,20 @@ var _factory = (() => {
|
|
|
5006
5072
|
a.h[b].push(c);
|
|
5007
5073
|
a.g && delete a.g[b];
|
|
5008
5074
|
}
|
|
5009
|
-
function
|
|
5075
|
+
function x(a, b) {
|
|
5010
5076
|
var c = [], d;
|
|
5011
5077
|
for (d in b) d != 0 && c.push(new la(d, b[d]));
|
|
5012
5078
|
return new ta(a, c);
|
|
5013
5079
|
}
|
|
5014
5080
|
;
|
|
5015
|
-
function
|
|
5081
|
+
function y() {
|
|
5016
5082
|
}
|
|
5017
|
-
|
|
5083
|
+
y.prototype.g = function(a) {
|
|
5018
5084
|
new a.h();
|
|
5019
5085
|
throw Error("Unimplemented");
|
|
5020
5086
|
};
|
|
5021
|
-
|
|
5022
|
-
if (a.h == 11 || a.h == 10) return b instanceof
|
|
5087
|
+
y.prototype.h = function(a, b) {
|
|
5088
|
+
if (a.h == 11 || a.h == 10) return b instanceof p ? b : this.g(a.u.prototype.m(), b);
|
|
5023
5089
|
if (a.h == 14) return typeof b === "string" && xa.test(b) && (a = Number(b), a > 0) ? a : b;
|
|
5024
5090
|
if (!a.o) return b;
|
|
5025
5091
|
a = a.u;
|
|
@@ -5031,7 +5097,7 @@ var _factory = (() => {
|
|
|
5031
5097
|
var xa = /^-?[0-9]+$/;
|
|
5032
5098
|
function ya() {
|
|
5033
5099
|
}
|
|
5034
|
-
|
|
5100
|
+
n(ya, y);
|
|
5035
5101
|
ya.prototype.g = function(a, b) {
|
|
5036
5102
|
a = new a.h();
|
|
5037
5103
|
a.l = this;
|
|
@@ -5041,82 +5107,82 @@ var _factory = (() => {
|
|
|
5041
5107
|
};
|
|
5042
5108
|
function z() {
|
|
5043
5109
|
}
|
|
5044
|
-
|
|
5110
|
+
n(z, ya);
|
|
5045
5111
|
z.prototype.h = function(a, b) {
|
|
5046
|
-
return a.h == 8 ? !!b :
|
|
5112
|
+
return a.h == 8 ? !!b : y.prototype.h.apply(this, arguments);
|
|
5047
5113
|
};
|
|
5048
5114
|
z.prototype.g = function(a, b) {
|
|
5049
5115
|
return z.na.g.call(this, a, b);
|
|
5050
5116
|
};
|
|
5051
|
-
function
|
|
5117
|
+
function B(a, b) {
|
|
5052
5118
|
a != null && this.g.apply(this, arguments);
|
|
5053
5119
|
}
|
|
5054
|
-
|
|
5055
|
-
|
|
5120
|
+
B.prototype.h = "";
|
|
5121
|
+
B.prototype.set = function(a) {
|
|
5056
5122
|
this.h = "" + a;
|
|
5057
5123
|
};
|
|
5058
|
-
|
|
5124
|
+
B.prototype.g = function(a, b, c) {
|
|
5059
5125
|
this.h += String(a);
|
|
5060
5126
|
if (b != null) for (let d = 1; d < arguments.length; d++) this.h += arguments[d];
|
|
5061
5127
|
return this;
|
|
5062
5128
|
};
|
|
5063
|
-
function
|
|
5129
|
+
function C(a) {
|
|
5064
5130
|
a.h = "";
|
|
5065
5131
|
}
|
|
5066
|
-
|
|
5132
|
+
B.prototype.toString = function() {
|
|
5067
5133
|
return this.h;
|
|
5068
5134
|
};
|
|
5069
|
-
function
|
|
5070
|
-
|
|
5135
|
+
function D() {
|
|
5136
|
+
p.call(this);
|
|
5071
5137
|
}
|
|
5072
|
-
|
|
5138
|
+
n(D, p);
|
|
5073
5139
|
var za = null;
|
|
5074
|
-
function
|
|
5075
|
-
|
|
5140
|
+
function E() {
|
|
5141
|
+
p.call(this);
|
|
5076
5142
|
}
|
|
5077
|
-
|
|
5143
|
+
n(E, p);
|
|
5078
5144
|
var Aa = null;
|
|
5079
|
-
function
|
|
5080
|
-
return
|
|
5145
|
+
function F(a) {
|
|
5146
|
+
return u(a, 9) || [];
|
|
5081
5147
|
}
|
|
5082
|
-
function
|
|
5083
|
-
|
|
5148
|
+
function G() {
|
|
5149
|
+
p.call(this);
|
|
5084
5150
|
}
|
|
5085
|
-
|
|
5151
|
+
n(G, p);
|
|
5086
5152
|
var Ba = null;
|
|
5087
|
-
|
|
5153
|
+
D.prototype.m = function() {
|
|
5088
5154
|
var a = za;
|
|
5089
|
-
a || (za = a =
|
|
5155
|
+
a || (za = a = x(D, { 0: { name: "NumberFormat", ja: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: true, i: 9, type: String }, 2: { name: "format", required: true, i: 9, type: String }, 3: { name: "leading_digits_pattern", ca: true, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: false, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } }));
|
|
5090
5156
|
return a;
|
|
5091
5157
|
};
|
|
5092
|
-
|
|
5093
|
-
|
|
5158
|
+
D.m = D.prototype.m;
|
|
5159
|
+
E.prototype.m = function() {
|
|
5094
5160
|
var a = Aa;
|
|
5095
|
-
a || (Aa = a =
|
|
5161
|
+
a || (Aa = a = x(E, { 0: { name: "PhoneNumberDesc", ja: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", ca: true, i: 5, type: Number }, 10: { name: "possible_length_local_only", ca: true, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } }));
|
|
5096
5162
|
return a;
|
|
5097
5163
|
};
|
|
5098
|
-
|
|
5099
|
-
|
|
5164
|
+
E.m = E.prototype.m;
|
|
5165
|
+
G.prototype.m = function() {
|
|
5100
5166
|
var a = Ba;
|
|
5101
|
-
a || (Ba = a =
|
|
5167
|
+
a || (Ba = a = x(G, {
|
|
5102
5168
|
0: { name: "PhoneMetadata", ja: "i18n.phonenumbers.PhoneMetadata" },
|
|
5103
|
-
1: { name: "general_desc", i: 11, type:
|
|
5104
|
-
2: { name: "fixed_line", i: 11, type:
|
|
5105
|
-
3: { name: "mobile", i: 11, type:
|
|
5106
|
-
4: { name: "toll_free", i: 11, type:
|
|
5107
|
-
5: { name: "premium_rate", i: 11, type:
|
|
5108
|
-
6: { name: "shared_cost", i: 11, type:
|
|
5109
|
-
7: { name: "personal_number", i: 11, type:
|
|
5110
|
-
8: { name: "voip", i: 11, type:
|
|
5111
|
-
21: { name: "pager", i: 11, type:
|
|
5112
|
-
25: { name: "uan", i: 11, type:
|
|
5113
|
-
27: { name: "emergency", i: 11, type:
|
|
5114
|
-
28: { name: "voicemail", i: 11, type:
|
|
5115
|
-
29: { name: "short_code", i: 11, type:
|
|
5116
|
-
30: { name: "standard_rate", i: 11, type:
|
|
5117
|
-
31: { name: "carrier_specific", i: 11, type:
|
|
5118
|
-
33: { name: "sms_services", i: 11, type:
|
|
5119
|
-
24: { name: "no_international_dialling", i: 11, type:
|
|
5169
|
+
1: { name: "general_desc", i: 11, type: E },
|
|
5170
|
+
2: { name: "fixed_line", i: 11, type: E },
|
|
5171
|
+
3: { name: "mobile", i: 11, type: E },
|
|
5172
|
+
4: { name: "toll_free", i: 11, type: E },
|
|
5173
|
+
5: { name: "premium_rate", i: 11, type: E },
|
|
5174
|
+
6: { name: "shared_cost", i: 11, type: E },
|
|
5175
|
+
7: { name: "personal_number", i: 11, type: E },
|
|
5176
|
+
8: { name: "voip", i: 11, type: E },
|
|
5177
|
+
21: { name: "pager", i: 11, type: E },
|
|
5178
|
+
25: { name: "uan", i: 11, type: E },
|
|
5179
|
+
27: { name: "emergency", i: 11, type: E },
|
|
5180
|
+
28: { name: "voicemail", i: 11, type: E },
|
|
5181
|
+
29: { name: "short_code", i: 11, type: E },
|
|
5182
|
+
30: { name: "standard_rate", i: 11, type: E },
|
|
5183
|
+
31: { name: "carrier_specific", i: 11, type: E },
|
|
5184
|
+
33: { name: "sms_services", i: 11, type: E },
|
|
5185
|
+
24: { name: "no_international_dialling", i: 11, type: E },
|
|
5120
5186
|
9: { name: "id", required: true, i: 9, type: String },
|
|
5121
5187
|
10: { name: "country_code", i: 5, type: Number },
|
|
5122
5188
|
11: { name: "international_prefix", i: 9, type: String },
|
|
@@ -5130,31 +5196,31 @@ var _factory = (() => {
|
|
|
5130
5196
|
},
|
|
5131
5197
|
16: { name: "national_prefix_transform_rule", i: 9, type: String },
|
|
5132
5198
|
18: { name: "same_mobile_and_fixed_line_pattern", i: 8, defaultValue: false, type: Boolean },
|
|
5133
|
-
19: { name: "number_format", ca: true, i: 11, type:
|
|
5134
|
-
20: { name: "intl_number_format", ca: true, i: 11, type:
|
|
5199
|
+
19: { name: "number_format", ca: true, i: 11, type: D },
|
|
5200
|
+
20: { name: "intl_number_format", ca: true, i: 11, type: D },
|
|
5135
5201
|
22: { name: "main_country_for_code", i: 8, defaultValue: false, type: Boolean },
|
|
5136
5202
|
23: { name: "leading_digits", i: 9, type: String }
|
|
5137
5203
|
}));
|
|
5138
5204
|
return a;
|
|
5139
5205
|
};
|
|
5140
|
-
|
|
5141
|
-
function
|
|
5142
|
-
|
|
5206
|
+
G.m = G.prototype.m;
|
|
5207
|
+
function H() {
|
|
5208
|
+
p.call(this);
|
|
5143
5209
|
}
|
|
5144
|
-
|
|
5210
|
+
n(H, p);
|
|
5145
5211
|
var Ca = null, Da = { sa: 0, ra: 1, qa: 5, pa: 10, oa: 20 };
|
|
5146
|
-
|
|
5212
|
+
H.prototype.m = function() {
|
|
5147
5213
|
var a = Ca;
|
|
5148
|
-
a || (Ca = a =
|
|
5214
|
+
a || (Ca = a = x(H, { 0: { name: "PhoneNumber", ja: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: true, i: 5, type: Number }, 2: { name: "national_number", required: true, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: Da }, 7: {
|
|
5149
5215
|
name: "preferred_domestic_carrier_code",
|
|
5150
5216
|
i: 9,
|
|
5151
5217
|
type: String
|
|
5152
5218
|
} }));
|
|
5153
5219
|
return a;
|
|
5154
5220
|
};
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
var
|
|
5221
|
+
H.ctor = H;
|
|
5222
|
+
H.ctor.m = H.prototype.m;
|
|
5223
|
+
var I = {
|
|
5158
5224
|
1: "US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),
|
|
5159
5225
|
7: ["RU", "KZ"],
|
|
5160
5226
|
20: ["EG"],
|
|
@@ -10421,12 +10487,12 @@ var _factory = (() => {
|
|
|
10421
10487
|
], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 888, , , , , , , , 1, [[, "(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "\\d{11}", , , , "12345678901"], , , [, , , , , , , , , [-1]]],
|
|
10422
10488
|
979: [, [, , "[1359]\\d{8}", , , , , , , [9], [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "[1359]\\d{8}", , , , "123456789", , , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 979, , , , , , , , 1, [[, "(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]]
|
|
10423
10489
|
};
|
|
10424
|
-
function
|
|
10490
|
+
function J() {
|
|
10425
10491
|
this.g = {};
|
|
10426
10492
|
}
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
return
|
|
10493
|
+
J.h = void 0;
|
|
10494
|
+
J.g = function() {
|
|
10495
|
+
return J.h ? J.h : J.h = new J();
|
|
10430
10496
|
};
|
|
10431
10497
|
var Fa = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "\uFF10": "0", "\uFF11": "1", "\uFF12": "2", "\uFF13": "3", "\uFF14": "4", "\uFF15": "5", "\uFF16": "6", "\uFF17": "7", "\uFF18": "8", "\uFF19": "9", "\u0660": "0", "\u0661": "1", "\u0662": "2", "\u0663": "3", "\u0664": "4", "\u0665": "5", "\u0666": "6", "\u0667": "7", "\u0668": "8", "\u0669": "9", "\u06F0": "0", "\u06F1": "1", "\u06F2": "2", "\u06F3": "3", "\u06F4": "4", "\u06F5": "5", "\u06F6": "6", "\u06F7": "7", "\u06F8": "8", "\u06F9": "9" }, Ga = {
|
|
10432
10498
|
0: "0",
|
|
@@ -10509,56 +10575,56 @@ var _factory = (() => {
|
|
|
10509
10575
|
X: "9",
|
|
10510
10576
|
Y: "9",
|
|
10511
10577
|
Z: "9"
|
|
10512
|
-
}, Ia = RegExp("[+\uFF0B]+"),
|
|
10513
|
-
function
|
|
10578
|
+
}, Ia = RegExp("[+\uFF0B]+"), K = RegExp("^[+\uFF0B]+"), Ja = RegExp("([0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9])"), Ka = RegExp("[+\uFF0B0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]"), La = /[\\\/] *x/, Ma = RegExp("[^0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9A-Za-z#]+$"), Na = /(?:.*?[A-Za-z]){3}.*/, Oa = RegExp("^\\+([0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]|[\\-\\.\\(\\)]?)*[0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]([0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]|[\\-\\.\\(\\)]?)*$"), Pa = RegExp("^([A-Za-z0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]+((\\-)*[A-Za-z0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9])*\\.?$");
|
|
10579
|
+
function L(a) {
|
|
10514
10580
|
return "([0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]{1," + a + "})";
|
|
10515
10581
|
}
|
|
10516
10582
|
function Qa() {
|
|
10517
|
-
return ";ext=" +
|
|
10583
|
+
return ";ext=" + L("20") + "|[ \xA0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)[:\\.\uFF0E]?[ \xA0\\t,-]*" + (L("20") + "#?|[ \xA0\\t,]*(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)[:\\.\uFF0E]?[ \xA0\\t,-]*") + (L("9") + "#?|[- ]+") + (L("6") + "#|[ \xA0\\t]*(?:,{2}|;)[:\\.\uFF0E]?[ \xA0\\t,-]*") + (L("15") + "#?|[ \xA0\\t]*(?:,)+[:\\.\uFF0E]?[ \xA0\\t,-]*") + (L("9") + "#?");
|
|
10518
10584
|
}
|
|
10519
10585
|
var Ra = new RegExp("(?:" + Qa() + ")$", "i"), Sa = new RegExp("^[0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]{2}$|^[+\uFF0B]*(?:[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E*]*[0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]){3,}[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E*A-Za-z0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9]*(?:" + Qa() + ")?$", "i"), Ta = /(\$\d)/, Ua = /^\(?\$1\)?$/;
|
|
10520
10586
|
function Va(a) {
|
|
10521
|
-
return a.length < 2 ? false :
|
|
10587
|
+
return a.length < 2 ? false : M(Sa, a);
|
|
10522
10588
|
}
|
|
10523
10589
|
function Wa(a) {
|
|
10524
|
-
return
|
|
10590
|
+
return M(Na, a) ? N(a, Ha) : N(a, Fa);
|
|
10525
10591
|
}
|
|
10526
10592
|
function Xa(a) {
|
|
10527
10593
|
var b = Wa(a.toString());
|
|
10528
|
-
|
|
10594
|
+
C(a);
|
|
10529
10595
|
a.g(b);
|
|
10530
10596
|
}
|
|
10531
10597
|
function Ya(a) {
|
|
10532
|
-
return a != null && (
|
|
10598
|
+
return a != null && (w(a, 9) != 1 || F(a)[0] != -1);
|
|
10533
10599
|
}
|
|
10534
|
-
function
|
|
10535
|
-
for (var c = new
|
|
10600
|
+
function N(a, b) {
|
|
10601
|
+
for (var c = new B(), d, e = a.length, f = 0; f < e; ++f) d = a.charAt(f), d = b[d.toUpperCase()], d != null && c.g(d);
|
|
10536
10602
|
return c.toString();
|
|
10537
10603
|
}
|
|
10538
10604
|
function Za(a) {
|
|
10539
10605
|
return a.length == 0 || Ua.test(a);
|
|
10540
10606
|
}
|
|
10541
|
-
function
|
|
10607
|
+
function O(a) {
|
|
10542
10608
|
return a != null && isNaN(a) && a.toUpperCase() in Ea;
|
|
10543
10609
|
}
|
|
10544
|
-
|
|
10545
|
-
if (
|
|
10546
|
-
var c =
|
|
10610
|
+
J.prototype.format = function(a, b) {
|
|
10611
|
+
if (r(a, 2) == 0 && q(a, 5)) {
|
|
10612
|
+
var c = v(a, 5);
|
|
10547
10613
|
if (c.length > 0) return c;
|
|
10548
10614
|
}
|
|
10549
|
-
c =
|
|
10550
|
-
var d =
|
|
10615
|
+
c = v(a, 1);
|
|
10616
|
+
var d = P(a);
|
|
10551
10617
|
if (b == 0) return $a(c, 0, d, "");
|
|
10552
|
-
if (!(c in
|
|
10553
|
-
var e =
|
|
10554
|
-
a =
|
|
10618
|
+
if (!(c in I)) return d;
|
|
10619
|
+
var e = Q(this, c, R(c));
|
|
10620
|
+
a = q(a, 3) && r(a, 3).length != 0 ? b == 3 ? ";ext=" + r(a, 3) : q(e, 13) ? r(e, 13) + v(a, 3) : " ext. " + v(a, 3) : "";
|
|
10555
10621
|
a: {
|
|
10556
|
-
e = (
|
|
10622
|
+
e = (u(e, 20) || []).length == 0 || b == 2 ? u(e, 19) || [] : u(e, 20) || [];
|
|
10557
10623
|
for (var f, g = e.length, h = 0; h < g; ++h) {
|
|
10558
10624
|
f = e[h];
|
|
10559
|
-
var l =
|
|
10560
|
-
if (l == 0 || d.search(
|
|
10561
|
-
if (l = new RegExp(
|
|
10625
|
+
var l = w(f, 3);
|
|
10626
|
+
if (l == 0 || d.search(r(f, 3, l - 1)) == 0) {
|
|
10627
|
+
if (l = new RegExp(r(f, 1)), M(l, d)) {
|
|
10562
10628
|
e = f;
|
|
10563
10629
|
break a;
|
|
10564
10630
|
}
|
|
@@ -10566,19 +10632,19 @@ var _factory = (() => {
|
|
|
10566
10632
|
}
|
|
10567
10633
|
e = null;
|
|
10568
10634
|
}
|
|
10569
|
-
e != null && (g = e, e =
|
|
10635
|
+
e != null && (g = e, e = v(g, 2), f = new RegExp(r(
|
|
10570
10636
|
g,
|
|
10571
10637
|
1
|
|
10572
|
-
)),
|
|
10638
|
+
)), v(g, 5), g = v(g, 4), d = b == 2 && g != null && g.length > 0 ? d.replace(f, e.replace(Ta, g)) : d.replace(f, e), b == 3 && (d = d.replace(RegExp("^[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E]+"), ""), d = d.replace(RegExp("[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E]+", "g"), "-")));
|
|
10573
10639
|
return $a(c, b, d, a);
|
|
10574
10640
|
};
|
|
10575
|
-
function
|
|
10576
|
-
return "001" == c ?
|
|
10641
|
+
function Q(a, b, c) {
|
|
10642
|
+
return "001" == c ? S(a, "" + b) : S(a, c);
|
|
10577
10643
|
}
|
|
10578
|
-
function
|
|
10579
|
-
if (!
|
|
10580
|
-
var b = "" +
|
|
10581
|
-
return
|
|
10644
|
+
function P(a) {
|
|
10645
|
+
if (!q(a, 2)) return "";
|
|
10646
|
+
var b = "" + r(a, 2);
|
|
10647
|
+
return q(a, 4) && r(a, 4) && v(a, 8) > 0 ? Array(v(a, 8) + 1).join("0") + b : b;
|
|
10582
10648
|
}
|
|
10583
10649
|
function $a(a, b, c, d) {
|
|
10584
10650
|
switch (b) {
|
|
@@ -10592,79 +10658,79 @@ var _factory = (() => {
|
|
|
10592
10658
|
return c + d;
|
|
10593
10659
|
}
|
|
10594
10660
|
}
|
|
10595
|
-
function
|
|
10661
|
+
function T(a, b) {
|
|
10596
10662
|
switch (b) {
|
|
10597
10663
|
case 4:
|
|
10598
|
-
return
|
|
10664
|
+
return r(a, 5);
|
|
10599
10665
|
case 3:
|
|
10600
|
-
return
|
|
10666
|
+
return r(a, 4);
|
|
10601
10667
|
case 1:
|
|
10602
|
-
return
|
|
10668
|
+
return r(a, 3);
|
|
10603
10669
|
case 0:
|
|
10604
10670
|
case 2:
|
|
10605
|
-
return
|
|
10671
|
+
return r(a, 2);
|
|
10606
10672
|
case 5:
|
|
10607
|
-
return
|
|
10673
|
+
return r(a, 6);
|
|
10608
10674
|
case 6:
|
|
10609
|
-
return
|
|
10675
|
+
return r(a, 8);
|
|
10610
10676
|
case 7:
|
|
10611
|
-
return
|
|
10677
|
+
return r(a, 7);
|
|
10612
10678
|
case 8:
|
|
10613
|
-
return
|
|
10679
|
+
return r(a, 21);
|
|
10614
10680
|
case 9:
|
|
10615
|
-
return
|
|
10681
|
+
return r(a, 25);
|
|
10616
10682
|
case 10:
|
|
10617
|
-
return
|
|
10683
|
+
return r(a, 28);
|
|
10618
10684
|
default:
|
|
10619
|
-
return
|
|
10685
|
+
return r(a, 1);
|
|
10620
10686
|
}
|
|
10621
10687
|
}
|
|
10622
10688
|
function ab(a, b) {
|
|
10623
10689
|
var c = bb(a, b);
|
|
10624
|
-
a =
|
|
10690
|
+
a = Q(a, v(b, 1), c);
|
|
10625
10691
|
if (a == null) return -1;
|
|
10626
|
-
b =
|
|
10692
|
+
b = P(b);
|
|
10627
10693
|
return cb(b, a);
|
|
10628
10694
|
}
|
|
10629
10695
|
function cb(a, b) {
|
|
10630
|
-
return
|
|
10696
|
+
return U(a, r(b, 1)) ? U(a, r(b, 5)) ? 4 : U(a, r(b, 4)) ? 3 : U(a, r(b, 6)) ? 5 : U(a, r(b, 8)) ? 6 : U(a, r(b, 7)) ? 7 : U(a, r(b, 21)) ? 8 : U(a, r(b, 25)) ? 9 : U(a, r(b, 28)) ? 10 : U(a, r(b, 2)) ? r(b, 18) || U(a, r(b, 3)) ? 2 : 0 : !r(b, 18) && U(a, r(b, 3)) ? 1 : -1 : -1;
|
|
10631
10697
|
}
|
|
10632
|
-
function
|
|
10698
|
+
function S(a, b) {
|
|
10633
10699
|
if (b == null) return null;
|
|
10634
10700
|
b = b.toUpperCase();
|
|
10635
10701
|
var c = a.g[b];
|
|
10636
10702
|
if (c == null) {
|
|
10637
10703
|
c = Ea[b];
|
|
10638
10704
|
if (c == null) return null;
|
|
10639
|
-
c = new z().g(
|
|
10705
|
+
c = new z().g(G.m(), c);
|
|
10640
10706
|
a.g[b] = c;
|
|
10641
10707
|
}
|
|
10642
10708
|
return c;
|
|
10643
10709
|
}
|
|
10644
|
-
function
|
|
10710
|
+
function U(a, b) {
|
|
10645
10711
|
var c = a.length;
|
|
10646
|
-
return
|
|
10712
|
+
return w(b, 9) > 0 && F(b).indexOf(c) == -1 ? false : M(v(b, 2), a);
|
|
10647
10713
|
}
|
|
10648
10714
|
function db(a, b) {
|
|
10649
10715
|
var c = bb(a, b);
|
|
10650
|
-
var d =
|
|
10651
|
-
var e =
|
|
10652
|
-
e == null || "001" != c && d != eb(a, c) ? e = false : (a =
|
|
10716
|
+
var d = v(b, 1);
|
|
10717
|
+
var e = Q(a, d, c);
|
|
10718
|
+
e == null || "001" != c && d != eb(a, c) ? e = false : (a = P(b), e = cb(a, e) != -1);
|
|
10653
10719
|
return e;
|
|
10654
10720
|
}
|
|
10655
10721
|
function bb(a, b) {
|
|
10656
10722
|
if (b == null) return null;
|
|
10657
|
-
var c =
|
|
10658
|
-
c =
|
|
10723
|
+
var c = v(b, 1);
|
|
10724
|
+
c = I[c];
|
|
10659
10725
|
if (c == null) a = null;
|
|
10660
10726
|
else if (c.length == 1) a = c[0];
|
|
10661
10727
|
else a: {
|
|
10662
|
-
b =
|
|
10728
|
+
b = P(b);
|
|
10663
10729
|
for (var d, e = c.length, f = 0; f < e; f++) {
|
|
10664
10730
|
d = c[f];
|
|
10665
|
-
var g =
|
|
10666
|
-
if (
|
|
10667
|
-
if (b.search(
|
|
10731
|
+
var g = S(a, d);
|
|
10732
|
+
if (q(g, 23)) {
|
|
10733
|
+
if (b.search(r(g, 23)) == 0) {
|
|
10668
10734
|
a = d;
|
|
10669
10735
|
break a;
|
|
10670
10736
|
}
|
|
@@ -10677,48 +10743,48 @@ var _factory = (() => {
|
|
|
10677
10743
|
}
|
|
10678
10744
|
return a;
|
|
10679
10745
|
}
|
|
10680
|
-
function
|
|
10681
|
-
a =
|
|
10746
|
+
function R(a) {
|
|
10747
|
+
a = I[a];
|
|
10682
10748
|
return a == null ? "ZZ" : a[0];
|
|
10683
10749
|
}
|
|
10684
10750
|
function eb(a, b) {
|
|
10685
|
-
a =
|
|
10751
|
+
a = S(a, b);
|
|
10686
10752
|
if (a == null) throw Error("Invalid region code: " + b);
|
|
10687
|
-
return
|
|
10753
|
+
return v(a, 10);
|
|
10688
10754
|
}
|
|
10689
|
-
function
|
|
10690
|
-
var e =
|
|
10691
|
-
e =
|
|
10692
|
-
if (d == 2) if (Ya(
|
|
10693
|
-
else return
|
|
10755
|
+
function V(a, b, c, d) {
|
|
10756
|
+
var e = T(c, d), f = w(e, 9) == 0 ? F(r(c, 1)) : F(e);
|
|
10757
|
+
e = u(e, 10) || [];
|
|
10758
|
+
if (d == 2) if (Ya(T(c, 0))) a = T(c, 1), Ya(a) && (f = f.concat(w(a, 9) == 0 ? F(r(c, 1)) : F(a)), f.sort(), e.length == 0 ? e = u(a, 10) || [] : (e = e.concat(u(a, 10) || []), e.sort()));
|
|
10759
|
+
else return V(a, b, c, 1);
|
|
10694
10760
|
if (f[0] == -1) return 5;
|
|
10695
10761
|
b = b.length;
|
|
10696
10762
|
if (e.indexOf(b) > -1) return 4;
|
|
10697
10763
|
c = f[0];
|
|
10698
10764
|
return c == b ? 0 : c > b ? 2 : f[f.length - 1] < b ? 3 : f.indexOf(b, 1) > -1 ? 0 : 5;
|
|
10699
10765
|
}
|
|
10700
|
-
function
|
|
10701
|
-
var d =
|
|
10702
|
-
b =
|
|
10703
|
-
if (!(b in
|
|
10704
|
-
b =
|
|
10705
|
-
return
|
|
10766
|
+
function W(a, b, c) {
|
|
10767
|
+
var d = P(b);
|
|
10768
|
+
b = v(b, 1);
|
|
10769
|
+
if (!(b in I)) return 1;
|
|
10770
|
+
b = Q(a, b, R(b));
|
|
10771
|
+
return V(a, d, b, c);
|
|
10706
10772
|
}
|
|
10707
10773
|
function fb(a, b) {
|
|
10708
10774
|
a = a.toString();
|
|
10709
10775
|
if (a.length == 0 || a.charAt(0) == "0") return 0;
|
|
10710
|
-
for (var c, d = a.length, e = 1; e <= 3 && e <= d; ++e) if (c = parseInt(a.substring(0, e), 10), c in
|
|
10776
|
+
for (var c, d = a.length, e = 1; e <= 3 && e <= d; ++e) if (c = parseInt(a.substring(0, e), 10), c in I) return b.g(a.substring(e)), c;
|
|
10711
10777
|
return 0;
|
|
10712
10778
|
}
|
|
10713
10779
|
function gb(a, b, c, d, e, f) {
|
|
10714
10780
|
if (b.length == 0) return 0;
|
|
10715
|
-
b = new
|
|
10781
|
+
b = new B(b);
|
|
10716
10782
|
var g;
|
|
10717
|
-
c != null && (g =
|
|
10783
|
+
c != null && (g = r(c, 11));
|
|
10718
10784
|
g == null && (g = "NonMatch");
|
|
10719
10785
|
var h = b.toString();
|
|
10720
10786
|
if (h.length == 0) g = 20;
|
|
10721
|
-
else if (
|
|
10787
|
+
else if (K.test(h)) h = h.replace(K, ""), C(b), b.g(Wa(h)), g = 1;
|
|
10722
10788
|
else {
|
|
10723
10789
|
h = new RegExp(g);
|
|
10724
10790
|
Xa(b);
|
|
@@ -10726,44 +10792,44 @@ var _factory = (() => {
|
|
|
10726
10792
|
if (g.search(h) == 0) {
|
|
10727
10793
|
h = g.match(h)[0].length;
|
|
10728
10794
|
var l = g.substring(h).match(Ja);
|
|
10729
|
-
l && l[1] != null && l[1].length > 0 &&
|
|
10795
|
+
l && l[1] != null && l[1].length > 0 && N(l[1], Fa) == "0" ? g = false : (C(b), b.g(g.substring(h)), g = true);
|
|
10730
10796
|
} else g = false;
|
|
10731
10797
|
g = g ? 5 : 20;
|
|
10732
10798
|
}
|
|
10733
|
-
e &&
|
|
10799
|
+
e && t(f, 6, g);
|
|
10734
10800
|
if (g != 20) {
|
|
10735
10801
|
if (b.h.length <= 2) throw Error("Phone number too short after IDD");
|
|
10736
10802
|
a = fb(b, d);
|
|
10737
|
-
if (a != 0) return
|
|
10803
|
+
if (a != 0) return t(f, 1, a), a;
|
|
10738
10804
|
throw Error("Invalid country calling code");
|
|
10739
10805
|
}
|
|
10740
|
-
if (c != null && (g =
|
|
10741
|
-
|
|
10806
|
+
if (c != null && (g = v(c, 10), h = "" + g, l = b.toString(), l.lastIndexOf(h, 0) == 0 && (h = new B(l.substring(h.length)), l = r(c, 1), l = new RegExp(v(l, 2)), hb(h, c, null), h = h.toString(), !M(l, b.toString()) && M(l, h) || V(a, b.toString(), c, -1) == 3))) return d.g(h), e && t(f, 6, 10), t(f, 1, g), g;
|
|
10807
|
+
t(f, 1, 0);
|
|
10742
10808
|
return 0;
|
|
10743
10809
|
}
|
|
10744
10810
|
function hb(a, b, c) {
|
|
10745
|
-
var d = a.toString(), e = d.length, f =
|
|
10811
|
+
var d = a.toString(), e = d.length, f = r(b, 15);
|
|
10746
10812
|
if (e != 0 && f != null && f.length != 0 && (f = new RegExp("^(?:" + f + ")"), e = f.exec(d))) {
|
|
10747
10813
|
var g = RegExp;
|
|
10748
|
-
var h =
|
|
10749
|
-
h =
|
|
10814
|
+
var h = r(b, 1);
|
|
10815
|
+
h = v(h, 2);
|
|
10750
10816
|
g = new g(h);
|
|
10751
|
-
h =
|
|
10817
|
+
h = M(g, d);
|
|
10752
10818
|
var l = e.length - 1;
|
|
10753
|
-
b =
|
|
10819
|
+
b = r(b, 16);
|
|
10754
10820
|
if (b == null || b.length == 0 || e[l] == null || e[l].length == 0) {
|
|
10755
|
-
if (!h ||
|
|
10756
|
-
} else if (d = d.replace(f, b), !h ||
|
|
10821
|
+
if (!h || M(g, d.substring(e[0].length))) c != null && l > 0 && e[l] != null && c.g(e[1]), a.set(d.substring(e[0].length));
|
|
10822
|
+
} else if (d = d.replace(f, b), !h || M(g, d)) c != null && l > 0 && c.g(e[1]), a.set(d);
|
|
10757
10823
|
}
|
|
10758
10824
|
}
|
|
10759
|
-
function
|
|
10760
|
-
if (!
|
|
10825
|
+
function X(a, b, c) {
|
|
10826
|
+
if (!O(c) && b.length > 0 && b.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
10761
10827
|
return ib(a, b, c, true);
|
|
10762
10828
|
}
|
|
10763
10829
|
function ib(a, b, c, d) {
|
|
10764
10830
|
if (b == null) throw Error("The string supplied did not seem to be a phone number");
|
|
10765
10831
|
if (b.length > 250) throw Error("The string supplied is too long to be a phone number");
|
|
10766
|
-
var e = new
|
|
10832
|
+
var e = new B();
|
|
10767
10833
|
var f = b.indexOf(";phone-context=");
|
|
10768
10834
|
if (f === -1) f = null;
|
|
10769
10835
|
else if (f += 15, f >= b.length) f = "";
|
|
@@ -10777,109 +10843,109 @@ var _factory = (() => {
|
|
|
10777
10843
|
f != null ? (f.charAt(0) === "+" && e.g(f), f = b.indexOf("tel:"), e.g(b.substring(f >= 0 ? f + 4 : 0, b.indexOf(";phone-context=")))) : (f = e.g, g = b ?? "", h = g.search(Ka), h >= 0 ? (g = g.substring(h), g = g.replace(Ma, ""), h = g.search(La), h >= 0 && (g = g.substring(0, h))) : g = "", f.call(e, g));
|
|
10778
10844
|
f = e.toString();
|
|
10779
10845
|
g = f.indexOf(";isub=");
|
|
10780
|
-
g > 0 && (
|
|
10846
|
+
g > 0 && (C(e), e.g(f.substring(0, g)));
|
|
10781
10847
|
if (!Va(e.toString())) throw Error("The string supplied did not seem to be a phone number");
|
|
10782
10848
|
f = e.toString();
|
|
10783
|
-
if (!(
|
|
10784
|
-
f = new
|
|
10785
|
-
d &&
|
|
10849
|
+
if (!(O(c) || f != null && f.length > 0 && K.test(f))) throw Error("Invalid country calling code");
|
|
10850
|
+
f = new H();
|
|
10851
|
+
d && t(f, 5, b);
|
|
10786
10852
|
a: {
|
|
10787
10853
|
b = e.toString();
|
|
10788
10854
|
g = b.search(Ra);
|
|
10789
10855
|
if (g >= 0 && Va(b.substring(0, g))) {
|
|
10790
10856
|
h = b.match(Ra);
|
|
10791
|
-
for (var l = h.length,
|
|
10792
|
-
|
|
10857
|
+
for (var l = h.length, A = 1; A < l; ++A) if (h[A] != null && h[A].length > 0) {
|
|
10858
|
+
C(e);
|
|
10793
10859
|
e.g(b.substring(0, g));
|
|
10794
|
-
b = h[
|
|
10860
|
+
b = h[A];
|
|
10795
10861
|
break a;
|
|
10796
10862
|
}
|
|
10797
10863
|
}
|
|
10798
10864
|
b = "";
|
|
10799
10865
|
}
|
|
10800
|
-
b.length > 0 &&
|
|
10801
|
-
g =
|
|
10802
|
-
b = new
|
|
10866
|
+
b.length > 0 && t(f, 3, b);
|
|
10867
|
+
g = S(a, c);
|
|
10868
|
+
b = new B();
|
|
10803
10869
|
h = 0;
|
|
10804
10870
|
l = e.toString();
|
|
10805
10871
|
try {
|
|
10806
10872
|
h = gb(a, l, g, b, d, f);
|
|
10807
|
-
} catch (
|
|
10808
|
-
if (
|
|
10809
|
-
if (l = l.replace(
|
|
10810
|
-
} else throw
|
|
10873
|
+
} catch (da) {
|
|
10874
|
+
if (da.message == "Invalid country calling code" && K.test(l)) {
|
|
10875
|
+
if (l = l.replace(K, ""), h = gb(a, l, g, b, d, f), h == 0) throw da;
|
|
10876
|
+
} else throw da;
|
|
10811
10877
|
}
|
|
10812
|
-
h != 0 ? (e =
|
|
10878
|
+
h != 0 ? (e = R(h), e != c && (g = Q(a, h, e))) : (Xa(e), b.g(e.toString()), c != null ? (h = v(g, 10), t(
|
|
10813
10879
|
f,
|
|
10814
10880
|
1,
|
|
10815
10881
|
h
|
|
10816
10882
|
)) : d && (delete f.h[6], f.g && delete f.g[6]));
|
|
10817
10883
|
if (b.h.length < 2) throw Error("The string supplied is too short to be a phone number");
|
|
10818
|
-
g != null && (c = new
|
|
10884
|
+
g != null && (c = new B(), e = new B(b.toString()), hb(e, g, c), a = V(a, e.toString(), g, -1), a != 2 && a != 4 && a != 5 && (b = e, d && c.toString().length > 0 && t(f, 7, c.toString())));
|
|
10819
10885
|
d = b.toString();
|
|
10820
10886
|
a = d.length;
|
|
10821
10887
|
if (a < 2) throw Error("The string supplied is too short to be a phone number");
|
|
10822
10888
|
if (a > 17) throw Error("The string supplied is too long to be a phone number");
|
|
10823
10889
|
if (d.length > 1 && d.charAt(0) == "0") {
|
|
10824
|
-
|
|
10890
|
+
t(f, 4, true);
|
|
10825
10891
|
for (a = 1; a < d.length - 1 && d.charAt(a) == "0"; ) a++;
|
|
10826
|
-
a != 1 &&
|
|
10892
|
+
a != 1 && t(f, 8, a);
|
|
10827
10893
|
}
|
|
10828
|
-
|
|
10894
|
+
t(f, 2, parseInt(d, 10));
|
|
10829
10895
|
return f;
|
|
10830
10896
|
}
|
|
10831
|
-
function
|
|
10897
|
+
function M(a, b) {
|
|
10832
10898
|
return (a = b.match(new RegExp("^(?:" + (typeof a == "string" ? a : a.source) + ")$", "i"))) && a[0].length == b.length ? true : false;
|
|
10833
10899
|
}
|
|
10834
10900
|
;
|
|
10835
10901
|
function jb(a) {
|
|
10836
10902
|
this.ga = RegExp("\u2008");
|
|
10837
10903
|
this.ka = "";
|
|
10838
|
-
this.$ = new
|
|
10904
|
+
this.$ = new B();
|
|
10839
10905
|
this.ea = "";
|
|
10840
|
-
this.u = new
|
|
10841
|
-
this.da = new
|
|
10906
|
+
this.u = new B();
|
|
10907
|
+
this.da = new B();
|
|
10842
10908
|
this.v = true;
|
|
10843
10909
|
this.fa = this.aa = this.ma = false;
|
|
10844
|
-
this.ha =
|
|
10910
|
+
this.ha = J.g();
|
|
10845
10911
|
this.ba = 0;
|
|
10846
|
-
this.h = new
|
|
10912
|
+
this.h = new B();
|
|
10847
10913
|
this.ia = false;
|
|
10848
10914
|
this.o = "";
|
|
10849
|
-
this.g = new
|
|
10915
|
+
this.g = new B();
|
|
10850
10916
|
this.j = [];
|
|
10851
10917
|
this.la = a;
|
|
10852
10918
|
this.l = kb(this, this.la);
|
|
10853
10919
|
}
|
|
10854
|
-
var lb = new
|
|
10855
|
-
|
|
10920
|
+
var lb = new G();
|
|
10921
|
+
t(lb, 11, "NA");
|
|
10856
10922
|
var mb = RegExp("^[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E]*\\$1[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E]*(\\$\\d[-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F \xA0\xAD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E]*)*$"), nb = /[- ]/;
|
|
10857
10923
|
function kb(a, b) {
|
|
10858
10924
|
var c = a.ha;
|
|
10859
|
-
b =
|
|
10860
|
-
a =
|
|
10925
|
+
b = O(b) ? eb(c, b) : 0;
|
|
10926
|
+
a = S(a.ha, R(b));
|
|
10861
10927
|
return a != null ? a : lb;
|
|
10862
10928
|
}
|
|
10863
10929
|
function ob(a) {
|
|
10864
10930
|
for (var b = a.j.length, c = 0; c < b; ++c) {
|
|
10865
|
-
var d = a.j[c], e =
|
|
10931
|
+
var d = a.j[c], e = v(d, 1);
|
|
10866
10932
|
if (a.ea == e) return false;
|
|
10867
10933
|
var f = a;
|
|
10868
|
-
var g = d, h =
|
|
10869
|
-
|
|
10934
|
+
var g = d, h = v(g, 1);
|
|
10935
|
+
C(f.$);
|
|
10870
10936
|
var l = f;
|
|
10871
|
-
g =
|
|
10872
|
-
var
|
|
10873
|
-
|
|
10937
|
+
g = v(g, 2);
|
|
10938
|
+
var A = "999999999999999".match(h)[0];
|
|
10939
|
+
A.length < l.g.h.length ? l = "" : (l = A.replace(new RegExp(h, "g"), g), l = l.replace(RegExp("9", "g"), "\u2008"));
|
|
10874
10940
|
l.length > 0 ? (f.$.g(l), f = true) : f = false;
|
|
10875
|
-
if (f) return a.ea = e, a.ia = nb.test(
|
|
10941
|
+
if (f) return a.ea = e, a.ia = nb.test(r(d, 4)), a.ba = 0, true;
|
|
10876
10942
|
}
|
|
10877
10943
|
return a.v = false;
|
|
10878
10944
|
}
|
|
10879
10945
|
function pb(a, b) {
|
|
10880
10946
|
for (var c = [], d = b.length - 3, e = a.j.length, f = 0; f < e; ++f) {
|
|
10881
10947
|
var g = a.j[f];
|
|
10882
|
-
|
|
10948
|
+
w(g, 3) == 0 ? c.push(a.j[f]) : (g = r(g, 3, Math.min(d, w(g, 3) - 1)), b.search(g) == 0 && c.push(a.j[f]));
|
|
10883
10949
|
}
|
|
10884
10950
|
a.j = c;
|
|
10885
10951
|
}
|
|
@@ -10891,7 +10957,7 @@ var _factory = (() => {
|
|
|
10891
10957
|
if (!a.ma) {
|
|
10892
10958
|
if (rb(a)) {
|
|
10893
10959
|
if (sb(a)) return tb(a);
|
|
10894
|
-
} else if (a.o.length > 0 && (b = a.g.toString(),
|
|
10960
|
+
} else if (a.o.length > 0 && (b = a.g.toString(), C(a.g), a.g.g(a.o), a.g.g(b), b = a.h.toString(), c = b.lastIndexOf(a.o), C(a.h), a.h.g(b.substring(0, c))), a.o != ub(a)) return a.h.g(" "), tb(a);
|
|
10895
10961
|
}
|
|
10896
10962
|
return a.u.toString();
|
|
10897
10963
|
}
|
|
@@ -10910,7 +10976,7 @@ var _factory = (() => {
|
|
|
10910
10976
|
c = xb(a);
|
|
10911
10977
|
if (c.length > 0) return c;
|
|
10912
10978
|
pb(a, a.g.toString());
|
|
10913
|
-
return ob(a) ? yb(a) : a.v ?
|
|
10979
|
+
return ob(a) ? yb(a) : a.v ? Y(a, b) : a.u.toString();
|
|
10914
10980
|
}
|
|
10915
10981
|
return vb(a);
|
|
10916
10982
|
}
|
|
@@ -10920,64 +10986,64 @@ var _factory = (() => {
|
|
|
10920
10986
|
a.fa = false;
|
|
10921
10987
|
a.j = [];
|
|
10922
10988
|
a.ba = 0;
|
|
10923
|
-
|
|
10989
|
+
C(a.$);
|
|
10924
10990
|
a.ea = "";
|
|
10925
10991
|
return vb(a);
|
|
10926
10992
|
}
|
|
10927
10993
|
function xb(a) {
|
|
10928
10994
|
for (var b = a.g.toString(), c = a.j.length, d = 0; d < c; ++d) {
|
|
10929
|
-
var e = a.j[d], f =
|
|
10930
|
-
if (new RegExp("^(?:" + f + ")$").test(b) && (a.ia = nb.test(
|
|
10995
|
+
var e = a.j[d], f = v(e, 1);
|
|
10996
|
+
if (new RegExp("^(?:" + f + ")$").test(b) && (a.ia = nb.test(r(e, 4)), e = b.replace(new RegExp(f, "g"), r(e, 2)), e = Y(a, e), N(e, Ga) == a.da)) return e;
|
|
10931
10997
|
}
|
|
10932
10998
|
return "";
|
|
10933
10999
|
}
|
|
10934
|
-
function
|
|
11000
|
+
function Y(a, b) {
|
|
10935
11001
|
var c = a.h.h.length;
|
|
10936
11002
|
return a.ia && c > 0 && a.h.toString().charAt(c - 1) != " " ? a.h + " " + b : a.h + b;
|
|
10937
11003
|
}
|
|
10938
11004
|
function vb(a) {
|
|
10939
11005
|
var b = a.g.toString();
|
|
10940
11006
|
if (b.length >= 3) {
|
|
10941
|
-
for (var c = a.aa && a.o.length == 0 &&
|
|
11007
|
+
for (var c = a.aa && a.o.length == 0 && w(a.l, 20) > 0 ? u(a.l, 20) || [] : u(a.l, 19) || [], d = c.length, e = 0; e < d; ++e) {
|
|
10942
11008
|
var f = c[e];
|
|
10943
|
-
a.o.length > 0 && Za(
|
|
11009
|
+
a.o.length > 0 && Za(v(f, 4)) && !r(f, 6) && !q(f, 5) || (a.o.length != 0 || a.aa || Za(v(f, 4)) || r(f, 6)) && mb.test(v(f, 2)) && a.j.push(f);
|
|
10944
11010
|
}
|
|
10945
11011
|
pb(a, b);
|
|
10946
11012
|
b = xb(a);
|
|
10947
11013
|
return b.length > 0 ? b : ob(a) ? yb(a) : a.u.toString();
|
|
10948
11014
|
}
|
|
10949
|
-
return
|
|
11015
|
+
return Y(a, b);
|
|
10950
11016
|
}
|
|
10951
11017
|
function yb(a) {
|
|
10952
11018
|
var b = a.g.toString(), c = b.length;
|
|
10953
11019
|
if (c > 0) {
|
|
10954
11020
|
for (var d = "", e = 0; e < c; e++) d = wb(a, b.charAt(e));
|
|
10955
|
-
return a.v ?
|
|
11021
|
+
return a.v ? Y(a, d) : a.u.toString();
|
|
10956
11022
|
}
|
|
10957
11023
|
return a.h.toString();
|
|
10958
11024
|
}
|
|
10959
11025
|
function ub(a) {
|
|
10960
11026
|
var b = a.g.toString(), c = 0;
|
|
10961
|
-
if (
|
|
11027
|
+
if (r(a.l, 10) != 1) var d = false;
|
|
10962
11028
|
else d = a.g.toString(), d = d.charAt(0) == "1" && d.charAt(1) != "0" && d.charAt(1) != "1";
|
|
10963
|
-
d ? (c = 1, a.h.g("1").g(" "), a.aa = true) :
|
|
10964
|
-
|
|
11029
|
+
d ? (c = 1, a.h.g("1").g(" "), a.aa = true) : q(a.l, 15) && (d = new RegExp("^(?:" + r(a.l, 15) + ")"), d = b.match(d), d != null && d[0] != null && d[0].length > 0 && (a.aa = true, c = d[0].length, a.h.g(b.substring(0, c))));
|
|
11030
|
+
C(a.g);
|
|
10965
11031
|
a.g.g(b.substring(c));
|
|
10966
11032
|
return b.substring(0, c);
|
|
10967
11033
|
}
|
|
10968
11034
|
function rb(a) {
|
|
10969
|
-
var b = a.da.toString(), c = new RegExp("^(?:\\+|" +
|
|
11035
|
+
var b = a.da.toString(), c = new RegExp("^(?:\\+|" + r(a.l, 11) + ")");
|
|
10970
11036
|
c = b.match(c);
|
|
10971
|
-
return c != null && c[0] != null && c[0].length > 0 ? (a.aa = true, c = c[0].length,
|
|
11037
|
+
return c != null && c[0] != null && c[0].length > 0 ? (a.aa = true, c = c[0].length, C(a.g), a.g.g(b.substring(c)), C(a.h), a.h.g(b.substring(0, c)), b.charAt(0) != "+" && a.h.g(" "), true) : false;
|
|
10972
11038
|
}
|
|
10973
11039
|
function sb(a) {
|
|
10974
11040
|
if (a.g.h.length == 0) return false;
|
|
10975
|
-
var b = new
|
|
11041
|
+
var b = new B(), c = fb(a.g, b);
|
|
10976
11042
|
if (c == 0) return false;
|
|
10977
|
-
|
|
11043
|
+
C(a.g);
|
|
10978
11044
|
a.g.g(b.toString());
|
|
10979
|
-
b =
|
|
10980
|
-
"001" == b ? a.l =
|
|
11045
|
+
b = R(c);
|
|
11046
|
+
"001" == b ? a.l = S(a.ha, "" + c) : b != a.la && (a.l = kb(a, b));
|
|
10981
11047
|
a.h.g("" + c).g(" ");
|
|
10982
11048
|
a.o = "";
|
|
10983
11049
|
return true;
|
|
@@ -10987,7 +11053,7 @@ var _factory = (() => {
|
|
|
10987
11053
|
if (c.substring(a.ba).search(a.ga) >= 0) {
|
|
10988
11054
|
var d = c.search(a.ga);
|
|
10989
11055
|
b = c.replace(a.ga, b);
|
|
10990
|
-
|
|
11056
|
+
C(a.$);
|
|
10991
11057
|
a.$.g(b);
|
|
10992
11058
|
a.ba = d;
|
|
10993
11059
|
return b.substring(0, a.ba + 1);
|
|
@@ -11023,8 +11089,8 @@ var _factory = (() => {
|
|
|
11023
11089
|
a.includes("FIXED_LINE_OR_MOBILE") ? (a.includes("MOBILE") || b.push("MOBILE"), a.includes("FIXED_LINE") || b.push("FIXED_LINE")) : (a.includes("MOBILE") || a.includes("FIXED_LINE")) && b.push("FIXED_LINE_OR_MOBILE");
|
|
11024
11090
|
return a.concat(b);
|
|
11025
11091
|
};
|
|
11026
|
-
|
|
11027
|
-
|
|
11092
|
+
m("utils", {});
|
|
11093
|
+
m("utils.formatNumberAsYouType", (a, b) => {
|
|
11028
11094
|
try {
|
|
11029
11095
|
const c = a.replace(/[^+0-9]/g, ""), d = new jb(b);
|
|
11030
11096
|
b = "";
|
|
@@ -11034,92 +11100,92 @@ var _factory = (() => {
|
|
|
11034
11100
|
return a;
|
|
11035
11101
|
}
|
|
11036
11102
|
});
|
|
11037
|
-
|
|
11103
|
+
m("utils.formatNumber", (a, b, c) => {
|
|
11038
11104
|
try {
|
|
11039
|
-
const e =
|
|
11040
|
-
var d =
|
|
11105
|
+
const e = J.g(), f = X(e, a, b);
|
|
11106
|
+
var d = W(e, f, -1);
|
|
11041
11107
|
return d == 0 || d == 4 ? e.format(f, typeof c === "undefined" ? 0 : zb[c]) : a;
|
|
11042
11108
|
} catch {
|
|
11043
11109
|
return a;
|
|
11044
11110
|
}
|
|
11045
11111
|
});
|
|
11046
|
-
|
|
11112
|
+
m("utils.getExampleNumber", (a, b, c) => {
|
|
11047
11113
|
try {
|
|
11048
|
-
const
|
|
11114
|
+
const l = J.g();
|
|
11049
11115
|
a: {
|
|
11050
|
-
var
|
|
11051
|
-
if (
|
|
11052
|
-
var
|
|
11116
|
+
var d = l, e = Z[b];
|
|
11117
|
+
if (O(a)) {
|
|
11118
|
+
var f = T(S(d, a), e);
|
|
11053
11119
|
try {
|
|
11054
|
-
if (
|
|
11055
|
-
var
|
|
11056
|
-
var
|
|
11120
|
+
if (q(f, 6)) {
|
|
11121
|
+
var g = r(f, 6);
|
|
11122
|
+
var h = ib(d, g, a, false);
|
|
11057
11123
|
break a;
|
|
11058
11124
|
}
|
|
11059
|
-
} catch (
|
|
11125
|
+
} catch (A) {
|
|
11060
11126
|
}
|
|
11061
11127
|
}
|
|
11062
|
-
|
|
11128
|
+
h = null;
|
|
11063
11129
|
}
|
|
11064
|
-
return
|
|
11130
|
+
return l.format(h, zb[c]);
|
|
11065
11131
|
} catch {
|
|
11066
11132
|
return "";
|
|
11067
11133
|
}
|
|
11068
11134
|
});
|
|
11069
|
-
|
|
11135
|
+
m("utils.getExtension", (a, b) => {
|
|
11070
11136
|
try {
|
|
11071
|
-
var c =
|
|
11072
|
-
return
|
|
11137
|
+
var c = X(J.g(), a, b);
|
|
11138
|
+
return r(c, 3);
|
|
11073
11139
|
} catch {
|
|
11074
11140
|
return "";
|
|
11075
11141
|
}
|
|
11076
11142
|
});
|
|
11077
|
-
|
|
11143
|
+
m("utils.getNumberType", (a, b) => {
|
|
11078
11144
|
try {
|
|
11079
|
-
const c =
|
|
11145
|
+
const c = J.g(), d = X(c, a, b), e = ab(c, d);
|
|
11080
11146
|
return Bb[e] || null;
|
|
11081
11147
|
} catch {
|
|
11082
11148
|
return null;
|
|
11083
11149
|
}
|
|
11084
11150
|
});
|
|
11085
|
-
|
|
11151
|
+
m("utils.getValidationError", (a, b) => {
|
|
11086
11152
|
if (!b) return "INVALID_COUNTRY_CODE";
|
|
11087
11153
|
try {
|
|
11088
|
-
const c =
|
|
11154
|
+
const c = J.g(), d = X(c, a, b), e = W(c, d, -1);
|
|
11089
11155
|
return Cb[e] || null;
|
|
11090
11156
|
} catch (c) {
|
|
11091
11157
|
return c.message === "Invalid country calling code" ? "INVALID_COUNTRY_CODE" : a.length <= 3 || c.message === "Phone number too short after IDD" || c.message === "The string supplied is too short to be a phone number" ? "TOO_SHORT" : c.message === "The string supplied is too long to be a phone number" ? "TOO_LONG" : null;
|
|
11092
11158
|
}
|
|
11093
11159
|
});
|
|
11094
|
-
|
|
11160
|
+
m("utils.isValidNumber", (a, b, c) => {
|
|
11095
11161
|
try {
|
|
11096
|
-
const d =
|
|
11162
|
+
const d = J.g(), e = X(d, a, b);
|
|
11097
11163
|
if (c) {
|
|
11098
|
-
const
|
|
11099
|
-
|
|
11164
|
+
const f = Db(c);
|
|
11165
|
+
for (let g of f) if (W(d, e, Z[g]) === 0) return true;
|
|
11166
|
+
return false;
|
|
11100
11167
|
}
|
|
11101
|
-
return
|
|
11168
|
+
return W(d, e, -1) === 0;
|
|
11102
11169
|
} catch {
|
|
11103
11170
|
return false;
|
|
11104
11171
|
}
|
|
11105
11172
|
});
|
|
11106
|
-
|
|
11173
|
+
m("utils.isValidNumberPrecise", (a, b, c) => {
|
|
11107
11174
|
try {
|
|
11108
|
-
const d =
|
|
11175
|
+
const d = J.g(), e = X(d, a, b), f = db(d, e);
|
|
11109
11176
|
if (c) {
|
|
11110
|
-
const
|
|
11111
|
-
|
|
11112
|
-
return false;
|
|
11177
|
+
const g = Db(c).map((h) => Z[h]);
|
|
11178
|
+
return f && g.includes(ab(d, e));
|
|
11113
11179
|
}
|
|
11114
|
-
return
|
|
11180
|
+
return f;
|
|
11115
11181
|
} catch {
|
|
11116
11182
|
return false;
|
|
11117
11183
|
}
|
|
11118
11184
|
});
|
|
11119
|
-
|
|
11185
|
+
m("utils.getCoreNumber", (a, b) => {
|
|
11120
11186
|
try {
|
|
11121
|
-
var c =
|
|
11122
|
-
return
|
|
11187
|
+
var c = X(J.g(), a, b);
|
|
11188
|
+
return r(c, 2).toString();
|
|
11123
11189
|
} catch {
|
|
11124
11190
|
return "";
|
|
11125
11191
|
}
|