intl-tel-input 26.9.2 → 27.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/angular/README.md +1 -1
- package/angular/dist/IntlTelInput.d.ts +97 -0
- package/angular/dist/IntlTelInput.js +4812 -0
- package/angular/dist/IntlTelInputWithUtils.d.ts +3 -0
- package/angular/{build → dist}/IntlTelInputWithUtils.js +2342 -2096
- package/{build → dist}/css/demo.css +1 -1
- package/dist/css/intlTelInput-no-assets.css +1 -0
- package/dist/css/intlTelInput-no-assets.min.css +1 -0
- package/dist/css/intlTelInput.css +1 -0
- package/dist/css/intlTelInput.min.css +1 -0
- package/dist/img/flags.png +0 -0
- package/dist/img/flags.webp +0 -0
- package/dist/img/flags@2x.png +0 -0
- package/dist/img/flags@2x.webp +0 -0
- package/dist/js/data.d.ts +1616 -0
- package/{build → dist}/js/data.js +5 -17
- package/dist/js/data.min.js +7 -0
- package/dist/js/data.mjs +1708 -0
- package/{build/js/i18n/ar/index.js → dist/js/i18n/ar.js} +1 -0
- package/{build/js/i18n/bg/index.js → dist/js/i18n/bg.js} +1 -0
- package/{build/js/i18n/bn/index.js → dist/js/i18n/bn.js} +1 -0
- package/{build/js/i18n/bs/index.js → dist/js/i18n/bs.js} +1 -0
- package/{build/js/i18n/ca/index.js → dist/js/i18n/ca.js} +1 -0
- package/{build/js/i18n/cs/index.js → dist/js/i18n/cs.js} +1 -0
- package/{build/js/i18n/da/index.js → dist/js/i18n/da.js} +1 -0
- package/{build/js/i18n/de/index.js → dist/js/i18n/de.js} +1 -0
- package/{build/js/i18n/el/index.js → dist/js/i18n/el.js} +1 -0
- package/{build/js/i18n/en/index.js → dist/js/i18n/en.js} +3 -2
- package/{build/js/i18n/es/index.js → dist/js/i18n/es.js} +1 -0
- package/{build/js/i18n/et/index.js → dist/js/i18n/et.js} +1 -0
- package/{build/js/i18n/fa/index.js → dist/js/i18n/fa.js} +1 -0
- package/{build/js/i18n/fi/index.js → dist/js/i18n/fi.js} +1 -0
- package/{build/js/i18n/fr/index.js → dist/js/i18n/fr.js} +1 -0
- package/{build/js/i18n/hi/index.js → dist/js/i18n/hi.js} +1 -0
- package/{build/js/i18n/hr/index.js → dist/js/i18n/hr.js} +1 -0
- package/{build/js/i18n/hu/index.js → dist/js/i18n/hu.js} +1 -0
- package/{build/js/i18n/id/index.js → dist/js/i18n/id.js} +1 -0
- package/{build → dist}/js/i18n/index.js +1 -0
- package/{build/js/i18n/it/index.js → dist/js/i18n/it.js} +1 -0
- package/{build/js/i18n/ja/index.js → dist/js/i18n/ja.js} +1 -0
- package/{build/js/i18n/kn/index.js → dist/js/i18n/kn.js} +1 -0
- package/{build/js/i18n/ko/index.js → dist/js/i18n/ko.js} +1 -0
- package/{build/js/i18n/lt/index.js → dist/js/i18n/lt.js} +1 -0
- package/{build/js/i18n/mr/index.js → dist/js/i18n/mr.js} +1 -0
- package/{build/js/i18n/nl/index.js → dist/js/i18n/nl.js} +1 -0
- package/{build/js/i18n/no/index.js → dist/js/i18n/no.js} +1 -0
- package/{build/js/i18n/pl/index.js → dist/js/i18n/pl.js} +1 -0
- package/{build/js/i18n/pt/index.js → dist/js/i18n/pt.js} +1 -0
- package/{build/js/i18n/ro/index.js → dist/js/i18n/ro.js} +1 -0
- package/{build/js/i18n/ru/index.js → dist/js/i18n/ru.js} +1 -0
- package/{build/js/i18n/sk/index.js → dist/js/i18n/sk.js} +1 -0
- package/{build/js/i18n/sl/index.js → dist/js/i18n/sl.js} +1 -0
- package/{build/js/i18n/sq/index.js → dist/js/i18n/sq.js} +1 -0
- package/{build/js/i18n/sr/index.js → dist/js/i18n/sr.js} +1 -0
- package/{build/js/i18n/sv/index.js → dist/js/i18n/sv.js} +1 -0
- package/{build/js/i18n/te/index.js → dist/js/i18n/te.js} +1 -0
- package/{build/js/i18n/th/index.js → dist/js/i18n/th.js} +1 -0
- package/{build/js/i18n/tr/index.js → dist/js/i18n/tr.js} +1 -0
- package/dist/js/i18n/types.js +1 -0
- package/{build/js/i18n/uk/index.js → dist/js/i18n/uk.js} +1 -0
- package/{build/js/i18n/ur/index.js → dist/js/i18n/ur.js} +1 -0
- package/{build/js/i18n/uz/index.js → dist/js/i18n/uz.js} +1 -0
- package/{build/js/i18n/vi/index.js → dist/js/i18n/vi.js} +1 -0
- package/{build/js/i18n/zh-hk/index.js → dist/js/i18n/zh-hk.js} +1 -0
- package/{build/js/i18n/zh/index.js → dist/js/i18n/zh.js} +1 -0
- package/dist/js/i18n.d.ts +1697 -0
- package/dist/js/intlTelInput.d.ts +1773 -0
- package/{build → dist}/js/intlTelInput.js +228 -215
- package/dist/js/intlTelInput.min.js +25 -0
- package/{react/build/IntlTelInput.cjs → dist/js/intlTelInput.mjs} +230 -340
- package/{build → dist}/js/intlTelInputWithUtils.js +531 -498
- package/dist/js/intlTelInputWithUtils.min.js +25 -0
- package/{react/build/IntlTelInputWithUtils.cjs → dist/js/intlTelInputWithUtils.mjs} +530 -621
- package/{build → dist}/js/utils.js +46 -47
- package/package.json +122 -122
- package/react/README.md +1 -1
- package/react/dist/IntlTelInput.d.ts +20 -0
- package/react/{build → dist}/IntlTelInput.js +274 -255
- package/react/dist/IntlTelInputWithUtils.d.ts +4 -0
- package/react/{build → dist}/IntlTelInputWithUtils.js +580 -542
- package/svelte/README.md +1 -1
- package/svelte/src/IntlTelInput.svelte +199 -0
- package/svelte/src/IntlTelInputWithUtils.svelte +15 -0
- package/svelte/src/shims.d.ts +4 -0
- package/vue/README.md +1 -1
- package/vue/dist/IntlTelInput-D7r449B2.js +2577 -0
- package/vue/dist/IntlTelInput.js +5 -0
- package/vue/dist/IntlTelInputWithUtils.js +49385 -0
- package/vue/dist/src/IntlTelInput.vue.d.ts +35 -0
- package/vue/dist/src/index.d.ts +4 -0
- package/vue/dist/src/indexWithUtils.d.ts +3 -0
- package/angular/build/IntlTelInput.js +0 -4501
- package/angular/build/types/intl-tel-input/angular.d.ts +0 -65
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +0 -65
- package/angular/build/types/intl-tel-input/data.d.ts +0 -20
- package/angular/build/types/intl-tel-input/i18n/ar/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bg/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bn/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/bs/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ca/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/cs/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/da/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/de/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/el/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/en/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/es/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/et/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fa/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fi/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/fr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hi/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/hu/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/id/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/index.d.ts +0 -45
- package/angular/build/types/intl-tel-input/i18n/it/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ja/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/kn/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ko/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/lt/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/mr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/nl/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/no/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pl/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/pt/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ro/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ru/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sk/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sl/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sq/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/sv/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/te/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/th/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/tr/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/types.d.ts +0 -10
- package/angular/build/types/intl-tel-input/i18n/uk/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/ur/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/uz/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/vi/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/zh/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/i18n/zh-hk/index.d.ts +0 -3
- package/angular/build/types/intl-tel-input/intlTelInputWithUtils.d.ts +0 -2
- package/angular/build/types/intl-tel-input/utils.d.ts +0 -2
- package/angular/build/types/intl-tel-input.d.ts +0 -46
- package/angular/build/types/modules/constants.d.ts +0 -94
- package/angular/build/types/modules/core/countrySearch.d.ts +0 -17
- package/angular/build/types/modules/core/icons.d.ts +0 -11
- package/angular/build/types/modules/core/numerals.d.ts +0 -7
- package/angular/build/types/modules/core/options.d.ts +0 -8
- package/angular/build/types/modules/core/ui.d.ts +0 -30
- package/angular/build/types/modules/data/country-data.d.ts +0 -12
- package/angular/build/types/modules/data/intl-regionless.d.ts +0 -2
- package/angular/build/types/modules/data/nanp-regionless.d.ts +0 -2
- package/angular/build/types/modules/format/caret.d.ts +0 -1
- package/angular/build/types/modules/format/formatting.d.ts +0 -3
- package/angular/build/types/modules/types/events.d.ts +0 -10
- package/angular/build/types/modules/types/forEachInstanceArgsMap.d.ts +0 -6
- package/angular/build/types/modules/types/public-api.d.ts +0 -65
- package/angular/build/types/modules/utils/dom.d.ts +0 -6
- package/angular/build/types/modules/utils/isAndroid.d.ts +0 -1
- package/angular/build/types/modules/utils/string.d.ts +0 -2
- package/build/css/intlTelInput-no-assets.css +0 -1323
- package/build/css/intlTelInput-no-assets.min.css +0 -1
- package/build/css/intlTelInput.css +0 -1327
- package/build/css/intlTelInput.min.css +0 -1
- package/build/img/flags.png +0 -0
- package/build/img/flags.webp +0 -0
- package/build/img/flags@2x.png +0 -0
- package/build/img/flags@2x.webp +0 -0
- package/build/js/data.min.js +0 -20
- package/build/js/i18n/types.js +0 -0
- package/build/js/intlTelInput.d.ts +0 -671
- package/build/js/intlTelInput.min.js +0 -38
- package/build/js/intlTelInputWithUtils.min.js +0 -38
- package/index.js +0 -1
- package/react/build/IntlTelInput.d.ts +0 -721
- package/svelte/build/IntlTelInput.mjs +0 -5294
- package/svelte/build/IntlTelInputWithUtils.mjs +0 -11381
- package/vue/build/IntlTelInput.vue.d.ts +0 -34
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +0 -34
- package/vue/build/exports/IntlTelInput.d.ts +0 -3
- package/vue/build/exports/IntlTelInput.mjs +0 -86
- package/vue/build/exports/IntlTelInputWithUtils.d.ts +0 -3
- package/vue/build/exports/IntlTelInputWithUtils.mjs +0 -6173
- package/vue/build/intl-tel-input/data.d.ts +0 -20
- package/vue/build/intl-tel-input/i18n/ar/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/bg/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/bn/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/bs/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ca/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/cs/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/da/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/de/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/el/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/en/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/es/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/et/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/fa/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/fi/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/fr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/hi/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/hr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/hu/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/id/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/index.d.ts +0 -45
- package/vue/build/intl-tel-input/i18n/it/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ja/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/kn/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ko/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/lt/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/mr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/nl/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/no/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/pl/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/pt/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ro/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ru/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sk/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sl/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sq/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/sv/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/te/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/th/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/tr/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/types.d.ts +0 -10
- package/vue/build/intl-tel-input/i18n/uk/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/ur/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/uz/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/vi/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/zh/index.d.ts +0 -3
- package/vue/build/intl-tel-input/i18n/zh-hk/index.d.ts +0 -3
- package/vue/build/intl-tel-input/intlTelInputWithUtils.d.ts +0 -2
- package/vue/build/intl-tel-input-MeSkUgHd.mjs +0 -3438
- package/vue/build/intl-tel-input.d.ts +0 -46
- package/vue/build/modules/constants.d.ts +0 -94
- package/vue/build/modules/core/countrySearch.d.ts +0 -17
- package/vue/build/modules/core/icons.d.ts +0 -11
- package/vue/build/modules/core/numerals.d.ts +0 -7
- package/vue/build/modules/core/options.d.ts +0 -8
- package/vue/build/modules/core/ui.d.ts +0 -30
- package/vue/build/modules/data/country-data.d.ts +0 -12
- package/vue/build/modules/data/intl-regionless.d.ts +0 -2
- package/vue/build/modules/data/nanp-regionless.d.ts +0 -2
- package/vue/build/modules/format/caret.d.ts +0 -1
- package/vue/build/modules/format/formatting.d.ts +0 -3
- package/vue/build/modules/types/events.d.ts +0 -10
- package/vue/build/modules/types/forEachInstanceArgsMap.d.ts +0 -6
- package/vue/build/modules/types/public-api.d.ts +0 -65
- package/vue/build/modules/utils/dom.d.ts +0 -6
- package/vue/build/modules/utils/isAndroid.d.ts +0 -1
- package/vue/build/modules/utils/string.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// dist/js/intlTelInput.mjs
|
|
2
2
|
var rawCountryData = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
@@ -1700,8 +1700,6 @@ for (const c of rawCountryData) {
|
|
|
1700
1700
|
var iso2Set = new Set(allCountries.map((c) => c.iso2));
|
|
1701
1701
|
var isIso2 = (val) => iso2Set.has(val);
|
|
1702
1702
|
var data_default = allCountries;
|
|
1703
|
-
|
|
1704
|
-
// src/js/modules/constants.ts
|
|
1705
1703
|
var EVENTS = {
|
|
1706
1704
|
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
1707
1705
|
CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
|
|
@@ -1821,11 +1819,9 @@ var ARIA = {
|
|
|
1821
1819
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
1822
1820
|
MODAL: "aria-modal"
|
|
1823
1821
|
};
|
|
1824
|
-
|
|
1825
|
-
// src/js/intl-tel-input/i18n/en/index.ts
|
|
1826
1822
|
var interfaceTranslations = {
|
|
1827
|
-
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
1828
|
-
noCountrySelected: "Select country",
|
|
1823
|
+
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1824
|
+
noCountrySelected: "Select country for phone number",
|
|
1829
1825
|
countryListAriaLabel: "List of countries",
|
|
1830
1826
|
searchPlaceholder: "Search",
|
|
1831
1827
|
clearSearchAriaLabel: "Clear search",
|
|
@@ -1841,8 +1837,6 @@ var interfaceTranslations = {
|
|
|
1841
1837
|
}
|
|
1842
1838
|
};
|
|
1843
1839
|
var en_default = interfaceTranslations;
|
|
1844
|
-
|
|
1845
|
-
// src/js/modules/core/options.ts
|
|
1846
1840
|
var mq = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
|
|
1847
1841
|
var isNarrowViewport = () => mq(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
|
|
1848
1842
|
var computeDefaultUseFullscreenPopup = () => {
|
|
@@ -1879,7 +1873,7 @@ var defaults = {
|
|
|
1879
1873
|
//* Append menu to specified element.
|
|
1880
1874
|
dropdownContainer: null,
|
|
1881
1875
|
//* Don't display these countries.
|
|
1882
|
-
excludeCountries:
|
|
1876
|
+
excludeCountries: null,
|
|
1883
1877
|
//* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
|
|
1884
1878
|
fixDropdownWidth: true,
|
|
1885
1879
|
//* Format the number as the user types
|
|
@@ -1899,7 +1893,7 @@ var defaults = {
|
|
|
1899
1893
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1900
1894
|
nationalMode: true,
|
|
1901
1895
|
//* Display only these countries.
|
|
1902
|
-
onlyCountries:
|
|
1896
|
+
onlyCountries: null,
|
|
1903
1897
|
//* Number type to use for placeholders.
|
|
1904
1898
|
placeholderNumberType: "MOBILE",
|
|
1905
1899
|
//* Add custom classes to the search input element.
|
|
@@ -1917,7 +1911,9 @@ var toString = (val) => JSON.stringify(val);
|
|
|
1917
1911
|
var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
|
|
1918
1912
|
var isFn = (val) => typeof val === "function";
|
|
1919
1913
|
var isElLike = (val) => {
|
|
1920
|
-
if (!val || typeof val !== "object")
|
|
1914
|
+
if (!val || typeof val !== "object") {
|
|
1915
|
+
return false;
|
|
1916
|
+
}
|
|
1921
1917
|
const v = val;
|
|
1922
1918
|
return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
|
|
1923
1919
|
};
|
|
@@ -2032,9 +2028,13 @@ var validateOptions = (customOptions) => {
|
|
|
2032
2028
|
break;
|
|
2033
2029
|
case "excludeCountries":
|
|
2034
2030
|
case "onlyCountries": {
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2031
|
+
if (value === null) {
|
|
2032
|
+
validatedOptions[key] = value;
|
|
2033
|
+
} else {
|
|
2034
|
+
const filtered = validateIso2Array(key, value);
|
|
2035
|
+
if (filtered !== false) {
|
|
2036
|
+
validatedOptions[key] = filtered;
|
|
2037
|
+
}
|
|
2038
2038
|
}
|
|
2039
2039
|
break;
|
|
2040
2040
|
}
|
|
@@ -2118,7 +2118,7 @@ var applyOptionSideEffects = (o) => {
|
|
|
2118
2118
|
o.fixDropdownWidth = true;
|
|
2119
2119
|
}
|
|
2120
2120
|
}
|
|
2121
|
-
if (o.onlyCountries
|
|
2121
|
+
if (o.onlyCountries?.length === 1) {
|
|
2122
2122
|
o.initialCountry = o.onlyCountries[0];
|
|
2123
2123
|
}
|
|
2124
2124
|
if (o.separateDialCode) {
|
|
@@ -2132,15 +2132,9 @@ var applyOptionSideEffects = (o) => {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
o.i18n = { ...en_default, ...o.i18n };
|
|
2134
2134
|
};
|
|
2135
|
-
|
|
2136
|
-
// src/js/modules/utils/string.ts
|
|
2137
2135
|
var getNumeric = (s) => s.replace(/\D/g, "");
|
|
2138
2136
|
var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
2139
|
-
|
|
2140
|
-
// src/js/modules/utils/isAndroid.ts
|
|
2141
2137
|
var getIsAndroid = () => typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
2142
|
-
|
|
2143
|
-
// src/js/modules/core/countrySearch.ts
|
|
2144
2138
|
var getMatchedCountries = (countries, query) => {
|
|
2145
2139
|
const normalisedQuery = normaliseString(query);
|
|
2146
2140
|
const iso2Matches = [];
|
|
@@ -2184,8 +2178,6 @@ var findFirstCountryStartingWith = (countries, query) => {
|
|
|
2184
2178
|
}
|
|
2185
2179
|
return null;
|
|
2186
2180
|
};
|
|
2187
|
-
|
|
2188
|
-
// src/js/modules/utils/dom.ts
|
|
2189
2181
|
var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
|
|
2190
2182
|
var createEl = (tagName, attrs, container) => {
|
|
2191
2183
|
const el = document.createElement(tagName);
|
|
@@ -2199,8 +2191,6 @@ var createEl = (tagName, attrs, container) => {
|
|
|
2199
2191
|
}
|
|
2200
2192
|
return el;
|
|
2201
2193
|
};
|
|
2202
|
-
|
|
2203
|
-
// src/js/modules/core/icons.ts
|
|
2204
2194
|
var buildSearchIcon = () => `
|
|
2205
2195
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
|
|
2206
2196
|
<circle cx="11" cy="11" r="7" />
|
|
@@ -2226,32 +2216,14 @@ var buildGlobeIcon = () => `
|
|
|
2226
2216
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
2227
2217
|
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
2228
2218
|
</svg>`;
|
|
2229
|
-
|
|
2230
|
-
// src/js/modules/core/ui.ts
|
|
2231
2219
|
var UI = class _UI {
|
|
2232
|
-
constructor(input, options, id2) {
|
|
2233
|
-
this.#searchKeyupTimer = null;
|
|
2234
|
-
this.#inlineDropdownHeight = null;
|
|
2235
|
-
this.#dropdownForContainer = null;
|
|
2236
|
-
this.#selectedItem = null;
|
|
2237
|
-
this.highlightedItem = null;
|
|
2238
|
-
input.dataset.intlTelInputId = id2.toString();
|
|
2239
|
-
this.telInput = input;
|
|
2240
|
-
this.#options = options;
|
|
2241
|
-
this.#id = id2;
|
|
2242
|
-
this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
|
|
2243
|
-
this.#isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2244
|
-
if (this.#options.separateDialCode) {
|
|
2245
|
-
this.#originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
2220
|
// private
|
|
2249
2221
|
#options;
|
|
2250
2222
|
#id;
|
|
2251
2223
|
#isRTL;
|
|
2252
|
-
#originalPaddingLeft;
|
|
2224
|
+
#originalPaddingLeft = "";
|
|
2253
2225
|
#countries;
|
|
2254
|
-
#searchKeyupTimer;
|
|
2226
|
+
#searchKeyupTimer = null;
|
|
2255
2227
|
#inlineDropdownHeight;
|
|
2256
2228
|
#selectedDialCode;
|
|
2257
2229
|
#dropdownArrow;
|
|
@@ -2260,7 +2232,30 @@ var UI = class _UI {
|
|
|
2260
2232
|
#searchNoResults;
|
|
2261
2233
|
#searchResultsA11yText;
|
|
2262
2234
|
#dropdownForContainer;
|
|
2263
|
-
#selectedItem;
|
|
2235
|
+
#selectedItem = null;
|
|
2236
|
+
// public
|
|
2237
|
+
telInput;
|
|
2238
|
+
countryContainer;
|
|
2239
|
+
selectedCountry;
|
|
2240
|
+
selectedCountryInner;
|
|
2241
|
+
searchInput;
|
|
2242
|
+
searchClearButton;
|
|
2243
|
+
countryList;
|
|
2244
|
+
hiddenInputPhone;
|
|
2245
|
+
hiddenInputCountry;
|
|
2246
|
+
highlightedItem = null;
|
|
2247
|
+
hadInitialPlaceholder;
|
|
2248
|
+
constructor(input, options, id2) {
|
|
2249
|
+
input.dataset.intlTelInputId = id2.toString();
|
|
2250
|
+
this.telInput = input;
|
|
2251
|
+
this.#options = options;
|
|
2252
|
+
this.#id = id2;
|
|
2253
|
+
this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
|
|
2254
|
+
this.#isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
2255
|
+
if (this.#options.separateDialCode) {
|
|
2256
|
+
this.#originalPaddingLeft = this.telInput.style.paddingLeft;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2264
2259
|
// Validate that the provided element is an HTMLInputElement.
|
|
2265
2260
|
static validateInput(input) {
|
|
2266
2261
|
const tagName = input?.tagName;
|
|
@@ -2276,6 +2271,9 @@ var UI = class _UI {
|
|
|
2276
2271
|
generateMarkup(countries) {
|
|
2277
2272
|
this.#countries = countries;
|
|
2278
2273
|
this.telInput.classList.add("iti__tel-input");
|
|
2274
|
+
if (!this.telInput.hasAttribute("type")) {
|
|
2275
|
+
this.telInput.setAttribute("type", "tel");
|
|
2276
|
+
}
|
|
2279
2277
|
if (!this.telInput.hasAttribute("autocomplete")) {
|
|
2280
2278
|
this.telInput.setAttribute("autocomplete", "tel");
|
|
2281
2279
|
}
|
|
@@ -2495,7 +2493,7 @@ var UI = class _UI {
|
|
|
2495
2493
|
},
|
|
2496
2494
|
this.#dropdownContent
|
|
2497
2495
|
);
|
|
2498
|
-
this.#searchNoResults.textContent = i18n.searchEmptyState;
|
|
2496
|
+
this.#searchNoResults.textContent = i18n.searchEmptyState ?? null;
|
|
2499
2497
|
}
|
|
2500
2498
|
#maybeUpdateInputPaddingAndReveal() {
|
|
2501
2499
|
if (this.countryContainer) {
|
|
@@ -2513,13 +2511,13 @@ var UI = class _UI {
|
|
|
2513
2511
|
`input[name="${names.phone}"]`
|
|
2514
2512
|
);
|
|
2515
2513
|
if (existingInput) {
|
|
2516
|
-
this.
|
|
2514
|
+
this.hiddenInputPhone = existingInput;
|
|
2517
2515
|
} else {
|
|
2518
|
-
this.
|
|
2516
|
+
this.hiddenInputPhone = createEl("input", {
|
|
2519
2517
|
type: "hidden",
|
|
2520
2518
|
name: names.phone
|
|
2521
2519
|
});
|
|
2522
|
-
wrapper.appendChild(this.
|
|
2520
|
+
wrapper.appendChild(this.hiddenInputPhone);
|
|
2523
2521
|
}
|
|
2524
2522
|
}
|
|
2525
2523
|
if (names.country) {
|
|
@@ -2764,28 +2762,9 @@ var UI = class _UI {
|
|
|
2764
2762
|
const wrapper = this.telInput.parentNode;
|
|
2765
2763
|
wrapper.before(this.telInput);
|
|
2766
2764
|
wrapper.remove();
|
|
2767
|
-
this.telInput = null;
|
|
2768
|
-
this.countryContainer = null;
|
|
2769
|
-
this.selectedCountry = null;
|
|
2770
|
-
this.selectedCountryInner = null;
|
|
2771
|
-
this.searchInput = null;
|
|
2772
|
-
this.searchClearButton = null;
|
|
2773
|
-
this.countryList = null;
|
|
2774
|
-
this.hiddenInput = null;
|
|
2775
|
-
this.hiddenInputCountry = null;
|
|
2776
|
-
this.highlightedItem = null;
|
|
2777
|
-
this.#selectedDialCode = null;
|
|
2778
|
-
this.#dropdownArrow = null;
|
|
2779
|
-
this.#dropdownContent = null;
|
|
2780
|
-
this.#searchIcon = null;
|
|
2781
|
-
this.#searchNoResults = null;
|
|
2782
|
-
this.#searchResultsA11yText = null;
|
|
2783
|
-
this.#dropdownForContainer = null;
|
|
2784
|
-
this.#selectedItem = null;
|
|
2785
2765
|
for (const c of this.#countries) {
|
|
2786
2766
|
delete c.nodeById[this.#id];
|
|
2787
2767
|
}
|
|
2788
|
-
this.#countries = null;
|
|
2789
2768
|
}
|
|
2790
2769
|
// UI: Open the dropdown (DOM only).
|
|
2791
2770
|
openDropdown() {
|
|
@@ -2809,10 +2788,10 @@ var UI = class _UI {
|
|
|
2809
2788
|
this.#dropdownContent.classList.remove(CLASSES.HIDE);
|
|
2810
2789
|
this.selectedCountry.setAttribute(ARIA.EXPANDED, "true");
|
|
2811
2790
|
if (countrySearch) {
|
|
2812
|
-
const
|
|
2813
|
-
if (
|
|
2814
|
-
this.highlightListItem(
|
|
2815
|
-
this.
|
|
2791
|
+
const itemToHighlight = this.#selectedItem ?? this.countryList.firstElementChild;
|
|
2792
|
+
if (itemToHighlight) {
|
|
2793
|
+
this.highlightListItem(itemToHighlight, false);
|
|
2794
|
+
this.scrollCountryListToItem(itemToHighlight);
|
|
2816
2795
|
}
|
|
2817
2796
|
if (!dropdownAlwaysOpen) {
|
|
2818
2797
|
this.searchInput.focus();
|
|
@@ -2827,6 +2806,8 @@ var UI = class _UI {
|
|
|
2827
2806
|
this.selectedCountry.setAttribute(ARIA.EXPANDED, "false");
|
|
2828
2807
|
if (countrySearch) {
|
|
2829
2808
|
this.searchInput.removeAttribute(ARIA.ACTIVE_DESCENDANT);
|
|
2809
|
+
this.searchInput.value = "";
|
|
2810
|
+
this.#doFilter();
|
|
2830
2811
|
if (this.highlightedItem) {
|
|
2831
2812
|
this.highlightedItem.classList.remove(CLASSES.HIGHLIGHT);
|
|
2832
2813
|
this.highlightedItem = null;
|
|
@@ -2881,7 +2862,9 @@ var UI = class _UI {
|
|
|
2881
2862
|
}
|
|
2882
2863
|
setCountry(selectedCountryData) {
|
|
2883
2864
|
const { allowDropdown, showFlags, separateDialCode, i18n } = this.#options;
|
|
2884
|
-
const
|
|
2865
|
+
const name = selectedCountryData?.name;
|
|
2866
|
+
const dialCode = selectedCountryData?.dialCode;
|
|
2867
|
+
const iso2 = selectedCountryData?.iso2 ?? "";
|
|
2885
2868
|
if (allowDropdown) {
|
|
2886
2869
|
this.#updateSelectedItem(iso2);
|
|
2887
2870
|
}
|
|
@@ -2909,8 +2892,6 @@ var UI = class _UI {
|
|
|
2909
2892
|
}
|
|
2910
2893
|
}
|
|
2911
2894
|
};
|
|
2912
|
-
|
|
2913
|
-
// src/js/modules/data/country-data.ts
|
|
2914
2895
|
var processAllCountries = (options) => {
|
|
2915
2896
|
const { onlyCountries, excludeCountries } = options;
|
|
2916
2897
|
if (onlyCountries?.length) {
|
|
@@ -3014,8 +2995,6 @@ var cacheSearchTokens = (countries) => {
|
|
|
3014
2995
|
c.dialCodePlus = `+${c.dialCode}`;
|
|
3015
2996
|
}
|
|
3016
2997
|
};
|
|
3017
|
-
|
|
3018
|
-
// src/js/modules/data/intl-regionless.ts
|
|
3019
2998
|
var REGIONLESS_DIAL_CODES = /* @__PURE__ */ new Set([
|
|
3020
2999
|
"800",
|
|
3021
3000
|
"808",
|
|
@@ -3030,8 +3009,6 @@ var hasRegionlessDialCode = (number) => {
|
|
|
3030
3009
|
const dialCode = getNumeric(number).slice(0, 3);
|
|
3031
3010
|
return number.startsWith("+") && REGIONLESS_DIAL_CODES.has(dialCode);
|
|
3032
3011
|
};
|
|
3033
|
-
|
|
3034
|
-
// src/js/modules/format/formatting.ts
|
|
3035
3012
|
var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
|
|
3036
3013
|
let number = fullNumber;
|
|
3037
3014
|
if (separateDialCode) {
|
|
@@ -3043,17 +3020,15 @@ var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedC
|
|
|
3043
3020
|
}
|
|
3044
3021
|
return number;
|
|
3045
3022
|
};
|
|
3046
|
-
var formatNumberAsYouType = (fullNumber, telInputValue,
|
|
3047
|
-
const result =
|
|
3048
|
-
const
|
|
3023
|
+
var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryData, separateDialCode) => {
|
|
3024
|
+
const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData?.iso2) : fullNumber;
|
|
3025
|
+
const dialCode = selectedCountryData?.dialCode;
|
|
3049
3026
|
if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
|
|
3050
3027
|
const afterDialCode = result.split(`+${dialCode}`)[1] || "";
|
|
3051
3028
|
return afterDialCode.trim();
|
|
3052
3029
|
}
|
|
3053
3030
|
return result;
|
|
3054
3031
|
};
|
|
3055
|
-
|
|
3056
|
-
// src/js/modules/format/caret.ts
|
|
3057
3032
|
var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
|
|
3058
3033
|
if (prevCaretPos === 0 && !isDeleteForwards) {
|
|
3059
3034
|
return 0;
|
|
@@ -3072,8 +3047,6 @@ var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDe
|
|
|
3072
3047
|
}
|
|
3073
3048
|
return formattedValue.length;
|
|
3074
3049
|
};
|
|
3075
|
-
|
|
3076
|
-
// src/js/modules/data/nanp-regionless.ts
|
|
3077
3050
|
var regionlessNanpNumbers = /* @__PURE__ */ new Set([
|
|
3078
3051
|
"800",
|
|
3079
3052
|
"822",
|
|
@@ -3101,8 +3074,6 @@ var isRegionlessNanp = (number) => {
|
|
|
3101
3074
|
}
|
|
3102
3075
|
return false;
|
|
3103
3076
|
};
|
|
3104
|
-
|
|
3105
|
-
// src/js/modules/core/numerals.ts
|
|
3106
3077
|
var Numerals = class {
|
|
3107
3078
|
#userNumeralSet;
|
|
3108
3079
|
constructor(initialValue) {
|
|
@@ -3146,10 +3117,27 @@ var Numerals = class {
|
|
|
3146
3117
|
return !this.#userNumeralSet || this.#userNumeralSet === "ascii";
|
|
3147
3118
|
}
|
|
3148
3119
|
};
|
|
3149
|
-
|
|
3150
|
-
// src/js/intl-tel-input.ts
|
|
3151
3120
|
var id = 0;
|
|
3121
|
+
var ensureUtils = (methodName) => {
|
|
3122
|
+
if (!intlTelInput.utils) {
|
|
3123
|
+
throw new Error(`intlTelInput.utils is required for ${methodName}(). See: https://intl-tel-input.com/docs/utils`);
|
|
3124
|
+
}
|
|
3125
|
+
};
|
|
3126
|
+
var createDeferred = () => {
|
|
3127
|
+
let resolve;
|
|
3128
|
+
let reject;
|
|
3129
|
+
const promise = new Promise((res, rej) => {
|
|
3130
|
+
resolve = res;
|
|
3131
|
+
reject = rej;
|
|
3132
|
+
});
|
|
3133
|
+
return { promise, resolve, reject };
|
|
3134
|
+
};
|
|
3152
3135
|
var Iti = class _Iti {
|
|
3136
|
+
//* PUBLIC FIELDS - READONLY
|
|
3137
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
3138
|
+
id;
|
|
3139
|
+
// accessed externally via iti.promise.then(...)
|
|
3140
|
+
promise;
|
|
3153
3141
|
//* PRIVATE FIELDS
|
|
3154
3142
|
#ui;
|
|
3155
3143
|
#options;
|
|
@@ -3160,16 +3148,15 @@ var Iti = class _Iti {
|
|
|
3160
3148
|
#dialCodeToIso2Map;
|
|
3161
3149
|
#dialCodes;
|
|
3162
3150
|
#countryByIso2;
|
|
3163
|
-
#selectedCountryData;
|
|
3164
|
-
#maxCoreNumberLength;
|
|
3151
|
+
#selectedCountryData = null;
|
|
3152
|
+
#maxCoreNumberLength = null;
|
|
3165
3153
|
#defaultCountry;
|
|
3154
|
+
#destroyed = false;
|
|
3166
3155
|
#abortController;
|
|
3167
|
-
#dropdownAbortController;
|
|
3156
|
+
#dropdownAbortController = null;
|
|
3168
3157
|
#numerals;
|
|
3169
|
-
#
|
|
3170
|
-
#
|
|
3171
|
-
#resolveUtilsScriptPromise;
|
|
3172
|
-
#rejectUtilsScriptPromise;
|
|
3158
|
+
#autoCountryDeferred;
|
|
3159
|
+
#utilsScriptDeferred;
|
|
3173
3160
|
constructor(input, customOptions = {}) {
|
|
3174
3161
|
this.id = id++;
|
|
3175
3162
|
UI.validateInput(input);
|
|
@@ -3202,37 +3189,19 @@ var Iti = class _Iti {
|
|
|
3202
3189
|
const { initialCountry, geoIpLookup, loadUtils } = options;
|
|
3203
3190
|
const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
|
|
3204
3191
|
const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
|
|
3205
|
-
let autoCountryPromise;
|
|
3206
3192
|
if (needsAutoCountryPromise) {
|
|
3207
|
-
|
|
3208
|
-
this.#resolveAutoCountryPromise = resolve;
|
|
3209
|
-
this.#rejectAutoCountryPromise = reject;
|
|
3210
|
-
});
|
|
3211
|
-
} else {
|
|
3212
|
-
autoCountryPromise = Promise.resolve(void 0);
|
|
3213
|
-
this.#resolveAutoCountryPromise = () => {
|
|
3214
|
-
};
|
|
3215
|
-
this.#rejectAutoCountryPromise = () => {
|
|
3216
|
-
};
|
|
3193
|
+
this.#autoCountryDeferred = createDeferred();
|
|
3217
3194
|
}
|
|
3218
|
-
let utilsScriptPromise;
|
|
3219
3195
|
if (needsUtilsScriptPromise) {
|
|
3220
|
-
|
|
3221
|
-
this.#resolveUtilsScriptPromise = resolve;
|
|
3222
|
-
this.#rejectUtilsScriptPromise = reject;
|
|
3223
|
-
});
|
|
3224
|
-
} else {
|
|
3225
|
-
utilsScriptPromise = Promise.resolve(void 0);
|
|
3226
|
-
this.#resolveUtilsScriptPromise = () => {
|
|
3227
|
-
};
|
|
3228
|
-
this.#rejectUtilsScriptPromise = () => {
|
|
3229
|
-
};
|
|
3196
|
+
this.#utilsScriptDeferred = createDeferred();
|
|
3230
3197
|
}
|
|
3231
|
-
return Promise.all([
|
|
3198
|
+
return Promise.all([
|
|
3199
|
+
this.#autoCountryDeferred?.promise,
|
|
3200
|
+
this.#utilsScriptDeferred?.promise
|
|
3201
|
+
]).then(() => {
|
|
3232
3202
|
});
|
|
3233
3203
|
}
|
|
3234
3204
|
#init() {
|
|
3235
|
-
this.#selectedCountryData = null;
|
|
3236
3205
|
this.#abortController = new AbortController();
|
|
3237
3206
|
this.#processCountryData();
|
|
3238
3207
|
this.#ui.generateMarkup(this.#countries);
|
|
@@ -3257,7 +3226,7 @@ var Iti = class _Iti {
|
|
|
3257
3226
|
//* 2. Using explicit initialCountry
|
|
3258
3227
|
#setInitialState(overrideAutoCountry = false) {
|
|
3259
3228
|
const attributeValueRaw = this.#ui.telInput.getAttribute("value");
|
|
3260
|
-
const attributeValue = this.#numerals.normalise(attributeValueRaw);
|
|
3229
|
+
const attributeValue = this.#numerals.normalise(attributeValueRaw ?? "");
|
|
3261
3230
|
const inputValue = this.#getTelInputValue();
|
|
3262
3231
|
const useAttribute = attributeValue && attributeValue.startsWith("+") && (!inputValue || !inputValue.startsWith("+"));
|
|
3263
3232
|
const val = useAttribute ? attributeValue : inputValue;
|
|
@@ -3292,15 +3261,15 @@ var Iti = class _Iti {
|
|
|
3292
3261
|
if (this.#options.allowDropdown) {
|
|
3293
3262
|
this.#initDropdownListeners();
|
|
3294
3263
|
}
|
|
3295
|
-
if ((this.#ui.
|
|
3264
|
+
if ((this.#ui.hiddenInputPhone || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
|
|
3296
3265
|
this.#initHiddenInputListener();
|
|
3297
3266
|
}
|
|
3298
3267
|
}
|
|
3299
3268
|
//* Update hidden input on form submit.
|
|
3300
3269
|
#initHiddenInputListener() {
|
|
3301
3270
|
const handleHiddenInputSubmit = () => {
|
|
3302
|
-
if (this.#ui.
|
|
3303
|
-
this.#ui.
|
|
3271
|
+
if (this.#ui.hiddenInputPhone) {
|
|
3272
|
+
this.#ui.hiddenInputPhone.value = this.getNumber();
|
|
3304
3273
|
}
|
|
3305
3274
|
if (this.#ui.hiddenInputCountry) {
|
|
3306
3275
|
this.#ui.hiddenInputCountry.value = this.#selectedCountryData?.iso2 || "";
|
|
@@ -3369,12 +3338,12 @@ var Iti = class _Iti {
|
|
|
3369
3338
|
});
|
|
3370
3339
|
}
|
|
3371
3340
|
} else {
|
|
3372
|
-
this.#
|
|
3341
|
+
this.#utilsScriptDeferred?.resolve();
|
|
3373
3342
|
}
|
|
3374
3343
|
const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
|
|
3375
3344
|
if (isAutoCountry) {
|
|
3376
|
-
if (this.#selectedCountryData
|
|
3377
|
-
this.#
|
|
3345
|
+
if (this.#selectedCountryData) {
|
|
3346
|
+
this.#autoCountryDeferred?.resolve();
|
|
3378
3347
|
} else {
|
|
3379
3348
|
this.#loadAutoCountry();
|
|
3380
3349
|
}
|
|
@@ -3469,7 +3438,7 @@ var Iti = class _Iti {
|
|
|
3469
3438
|
fullNumber,
|
|
3470
3439
|
inputValue,
|
|
3471
3440
|
intlTelInput.utils,
|
|
3472
|
-
this.#selectedCountryData
|
|
3441
|
+
this.#selectedCountryData,
|
|
3473
3442
|
separateDialCode
|
|
3474
3443
|
);
|
|
3475
3444
|
const newCaretPos = translateCursorPosition(
|
|
@@ -3486,7 +3455,7 @@ var Iti = class _Iti {
|
|
|
3486
3455
|
inputValue,
|
|
3487
3456
|
true,
|
|
3488
3457
|
separateDialCode,
|
|
3489
|
-
this.#selectedCountryData
|
|
3458
|
+
this.#selectedCountryData
|
|
3490
3459
|
);
|
|
3491
3460
|
this.#setTelInputValue(cleanNumber);
|
|
3492
3461
|
}
|
|
@@ -3519,8 +3488,8 @@ var Iti = class _Iti {
|
|
|
3519
3488
|
const input = this.#ui.telInput;
|
|
3520
3489
|
const selStart = input.selectionStart;
|
|
3521
3490
|
const selEnd = input.selectionEnd;
|
|
3522
|
-
const before = inputValue.slice(0, selStart);
|
|
3523
|
-
const after = inputValue.slice(selEnd);
|
|
3491
|
+
const before = inputValue.slice(0, selStart ?? void 0);
|
|
3492
|
+
const after = inputValue.slice(selEnd ?? void 0);
|
|
3524
3493
|
const newValue = before + e.key + after;
|
|
3525
3494
|
const newFullNumber = this.#getFullNumber(newValue);
|
|
3526
3495
|
let hasExceededMaxLength = false;
|
|
@@ -3552,8 +3521,8 @@ var Iti = class _Iti {
|
|
|
3552
3521
|
const selStart = input.selectionStart;
|
|
3553
3522
|
const selEnd = input.selectionEnd;
|
|
3554
3523
|
const inputValue = this.#getTelInputValue();
|
|
3555
|
-
const before = inputValue.slice(0, selStart);
|
|
3556
|
-
const after = inputValue.slice(selEnd);
|
|
3524
|
+
const before = inputValue.slice(0, selStart ?? void 0);
|
|
3525
|
+
const after = inputValue.slice(selEnd ?? void 0);
|
|
3557
3526
|
const iso2 = this.#selectedCountryData?.iso2;
|
|
3558
3527
|
const pastedRaw = e.clipboardData.getData("text");
|
|
3559
3528
|
const pasted = this.#numerals.normalise(pastedRaw);
|
|
@@ -3564,7 +3533,7 @@ var Iti = class _Iti {
|
|
|
3564
3533
|
const numerics = allowedChars.replace(/\+/g, "");
|
|
3565
3534
|
const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
|
|
3566
3535
|
let newVal = before + sanitised + after;
|
|
3567
|
-
if (newVal.length > 5) {
|
|
3536
|
+
if (newVal.length > 5 && intlTelInput.utils) {
|
|
3568
3537
|
let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
|
|
3569
3538
|
while (coreNumber.length === 0 && newVal.length > 0) {
|
|
3570
3539
|
newVal = newVal.slice(0, -1);
|
|
@@ -3854,10 +3823,10 @@ var Iti = class _Iti {
|
|
|
3854
3823
|
#setCountry(iso2) {
|
|
3855
3824
|
const prevIso2 = this.#selectedCountryData?.iso2 || "";
|
|
3856
3825
|
this.#selectedCountryData = iso2 ? this.#countryByIso2.get(iso2) : null;
|
|
3857
|
-
if (this.#selectedCountryData
|
|
3826
|
+
if (this.#selectedCountryData) {
|
|
3858
3827
|
this.#defaultCountry = this.#selectedCountryData.iso2;
|
|
3859
3828
|
}
|
|
3860
|
-
this.#ui.setCountry(this.#selectedCountryData
|
|
3829
|
+
this.#ui.setCountry(this.#selectedCountryData);
|
|
3861
3830
|
this.#updatePlaceholder();
|
|
3862
3831
|
this.#updateMaxLength();
|
|
3863
3832
|
return prevIso2 !== iso2;
|
|
@@ -3905,14 +3874,14 @@ var Iti = class _Iti {
|
|
|
3905
3874
|
const shouldSetPlaceholder = autoPlaceholder === PLACEHOLDER_MODES.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && autoPlaceholder === PLACEHOLDER_MODES.POLITE;
|
|
3906
3875
|
if (intlTelInput.utils && shouldSetPlaceholder) {
|
|
3907
3876
|
const numberType = intlTelInput.utils.numberType[placeholderNumberType];
|
|
3908
|
-
let placeholder = this.#selectedCountryData
|
|
3877
|
+
let placeholder = this.#selectedCountryData ? intlTelInput.utils.getExampleNumber(
|
|
3909
3878
|
this.#selectedCountryData.iso2,
|
|
3910
3879
|
nationalMode,
|
|
3911
3880
|
numberType
|
|
3912
3881
|
) : "";
|
|
3913
3882
|
placeholder = this.#beforeSetNumber(placeholder);
|
|
3914
3883
|
if (typeof customPlaceholder === "function") {
|
|
3915
|
-
placeholder = customPlaceholder(placeholder, this.#selectedCountryData
|
|
3884
|
+
placeholder = customPlaceholder(placeholder, this.#selectedCountryData);
|
|
3916
3885
|
}
|
|
3917
3886
|
this.#ui.telInput.setAttribute("placeholder", placeholder);
|
|
3918
3887
|
}
|
|
@@ -4011,14 +3980,16 @@ var Iti = class _Iti {
|
|
|
4011
3980
|
fullNumber,
|
|
4012
3981
|
hasValidDialCode,
|
|
4013
3982
|
this.#options.separateDialCode,
|
|
4014
|
-
this.#selectedCountryData
|
|
3983
|
+
this.#selectedCountryData
|
|
4015
3984
|
);
|
|
4016
3985
|
return this.#cap(number);
|
|
4017
3986
|
}
|
|
4018
3987
|
//* Return only the public-facing subset of the selected country data.
|
|
4019
3988
|
#getPublicCountryData() {
|
|
4020
3989
|
const d = this.#selectedCountryData;
|
|
4021
|
-
if (!d)
|
|
3990
|
+
if (!d) {
|
|
3991
|
+
return null;
|
|
3992
|
+
}
|
|
4022
3993
|
const { iso2, dialCode, name } = d;
|
|
4023
3994
|
return { iso2, dialCode, name };
|
|
4024
3995
|
}
|
|
@@ -4032,32 +4003,32 @@ var Iti = class _Iti {
|
|
|
4032
4003
|
//**************************
|
|
4033
4004
|
//* Called when the geoip call returns.
|
|
4034
4005
|
#handleAutoCountry() {
|
|
4035
|
-
if (
|
|
4036
|
-
this.#
|
|
4006
|
+
if (this.#destroyed) {
|
|
4007
|
+
this.#autoCountryDeferred?.resolve();
|
|
4037
4008
|
return;
|
|
4038
4009
|
}
|
|
4039
4010
|
if (this.#options.initialCountry === INITIAL_COUNTRY.AUTO && intlTelInput.autoCountry) {
|
|
4040
4011
|
this.#defaultCountry = intlTelInput.autoCountry;
|
|
4041
|
-
const hasSelectedCountryOrGlobe = this.#selectedCountryData
|
|
4012
|
+
const hasSelectedCountryOrGlobe = this.#selectedCountryData || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
|
|
4042
4013
|
if (!hasSelectedCountryOrGlobe) {
|
|
4043
4014
|
this.setCountry(this.#defaultCountry);
|
|
4044
4015
|
}
|
|
4045
|
-
this.#
|
|
4016
|
+
this.#autoCountryDeferred?.resolve();
|
|
4046
4017
|
}
|
|
4047
4018
|
}
|
|
4048
4019
|
//* Called when the geoip call fails or times out.
|
|
4049
4020
|
#handleAutoCountryFailure() {
|
|
4050
|
-
if (
|
|
4051
|
-
this.#
|
|
4021
|
+
if (this.#destroyed) {
|
|
4022
|
+
this.#autoCountryDeferred?.reject();
|
|
4052
4023
|
return;
|
|
4053
4024
|
}
|
|
4054
4025
|
this.#setInitialState(true);
|
|
4055
|
-
this.#
|
|
4026
|
+
this.#autoCountryDeferred?.reject();
|
|
4056
4027
|
}
|
|
4057
4028
|
//* Called when the utils request completes.
|
|
4058
4029
|
#handleUtils() {
|
|
4059
|
-
if (
|
|
4060
|
-
this.#
|
|
4030
|
+
if (this.#destroyed) {
|
|
4031
|
+
this.#utilsScriptDeferred?.resolve();
|
|
4061
4032
|
return;
|
|
4062
4033
|
}
|
|
4063
4034
|
if (intlTelInput.utils) {
|
|
@@ -4065,74 +4036,77 @@ var Iti = class _Iti {
|
|
|
4065
4036
|
if (inputValue) {
|
|
4066
4037
|
this.#updateValFromNumber(inputValue);
|
|
4067
4038
|
}
|
|
4068
|
-
if (this.#selectedCountryData
|
|
4039
|
+
if (this.#selectedCountryData) {
|
|
4069
4040
|
this.#updatePlaceholder();
|
|
4070
4041
|
this.#updateMaxLength();
|
|
4071
4042
|
}
|
|
4072
4043
|
}
|
|
4073
|
-
this.#
|
|
4044
|
+
this.#utilsScriptDeferred?.resolve();
|
|
4074
4045
|
}
|
|
4075
4046
|
//* Called when the utils request fails or times out.
|
|
4076
4047
|
#handleUtilsFailure(error) {
|
|
4077
|
-
if (
|
|
4078
|
-
this.#
|
|
4048
|
+
if (this.#destroyed) {
|
|
4049
|
+
this.#utilsScriptDeferred?.reject(error);
|
|
4079
4050
|
return;
|
|
4080
4051
|
}
|
|
4081
|
-
this.#
|
|
4052
|
+
this.#utilsScriptDeferred?.reject(error);
|
|
4082
4053
|
}
|
|
4083
4054
|
//********************
|
|
4084
4055
|
//* PUBLIC METHODS
|
|
4085
4056
|
//********************
|
|
4086
4057
|
//* Remove plugin.
|
|
4087
4058
|
destroy() {
|
|
4088
|
-
if (
|
|
4059
|
+
if (this.#destroyed) {
|
|
4089
4060
|
return;
|
|
4090
4061
|
}
|
|
4062
|
+
this.#destroyed = true;
|
|
4091
4063
|
if (this.#options.allowDropdown) {
|
|
4092
4064
|
this.#closeDropdown(true);
|
|
4093
4065
|
}
|
|
4094
4066
|
this.#abortController.abort();
|
|
4095
|
-
this.#abortController = null;
|
|
4096
4067
|
this.#ui.destroy();
|
|
4097
|
-
|
|
4068
|
+
intlTelInput.instances.delete(String(this.id));
|
|
4098
4069
|
}
|
|
4099
|
-
// check if the instance is still valid (not destroyed
|
|
4070
|
+
// check if the instance is still valid (not destroyed)
|
|
4100
4071
|
isActive() {
|
|
4101
|
-
return
|
|
4072
|
+
return !this.#destroyed;
|
|
4102
4073
|
}
|
|
4103
4074
|
//* Get the extension from the current number.
|
|
4104
4075
|
getExtension() {
|
|
4105
|
-
if (
|
|
4106
|
-
return
|
|
4107
|
-
this.#getFullNumber(),
|
|
4108
|
-
this.#selectedCountryData?.iso2
|
|
4109
|
-
);
|
|
4076
|
+
if (this.#destroyed) {
|
|
4077
|
+
return "";
|
|
4110
4078
|
}
|
|
4111
|
-
|
|
4079
|
+
ensureUtils("getExtension");
|
|
4080
|
+
return intlTelInput.utils.getExtension(
|
|
4081
|
+
this.#getFullNumber(),
|
|
4082
|
+
this.#selectedCountryData?.iso2
|
|
4083
|
+
);
|
|
4112
4084
|
}
|
|
4113
4085
|
//* Format the number to the given format.
|
|
4114
4086
|
getNumber(format) {
|
|
4115
|
-
if (
|
|
4116
|
-
|
|
4117
|
-
const fullNumber = this.#getFullNumber();
|
|
4118
|
-
const formattedNumber = intlTelInput.utils.formatNumber(
|
|
4119
|
-
fullNumber,
|
|
4120
|
-
iso2,
|
|
4121
|
-
format
|
|
4122
|
-
);
|
|
4123
|
-
return this.#numerals.denormalise(formattedNumber);
|
|
4087
|
+
if (this.#destroyed) {
|
|
4088
|
+
return "";
|
|
4124
4089
|
}
|
|
4125
|
-
|
|
4090
|
+
ensureUtils("getNumber");
|
|
4091
|
+
const iso2 = this.#selectedCountryData?.iso2;
|
|
4092
|
+
const fullNumber = this.#getFullNumber();
|
|
4093
|
+
const formattedNumber = intlTelInput.utils.formatNumber(
|
|
4094
|
+
fullNumber,
|
|
4095
|
+
iso2,
|
|
4096
|
+
format
|
|
4097
|
+
);
|
|
4098
|
+
return this.#numerals.denormalise(formattedNumber);
|
|
4126
4099
|
}
|
|
4127
4100
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
4128
4101
|
getNumberType() {
|
|
4129
|
-
if (
|
|
4130
|
-
return
|
|
4131
|
-
this.#getFullNumber(),
|
|
4132
|
-
this.#selectedCountryData?.iso2
|
|
4133
|
-
);
|
|
4102
|
+
if (this.#destroyed) {
|
|
4103
|
+
return SENTINELS.UNKNOWN_NUMBER_TYPE;
|
|
4134
4104
|
}
|
|
4135
|
-
|
|
4105
|
+
ensureUtils("getNumberType");
|
|
4106
|
+
return intlTelInput.utils.getNumberType(
|
|
4107
|
+
this.#getFullNumber(),
|
|
4108
|
+
this.#selectedCountryData?.iso2
|
|
4109
|
+
);
|
|
4136
4110
|
}
|
|
4137
4111
|
//* Get the country data for the currently selected country.
|
|
4138
4112
|
getSelectedCountryData() {
|
|
@@ -4140,32 +4114,35 @@ var Iti = class _Iti {
|
|
|
4140
4114
|
}
|
|
4141
4115
|
//* Get the validation error.
|
|
4142
4116
|
getValidationError() {
|
|
4143
|
-
if (
|
|
4144
|
-
|
|
4145
|
-
return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
|
|
4117
|
+
if (this.#destroyed) {
|
|
4118
|
+
return SENTINELS.UNKNOWN_VALIDATION_ERROR;
|
|
4146
4119
|
}
|
|
4147
|
-
|
|
4120
|
+
ensureUtils("getValidationError");
|
|
4121
|
+
const iso2 = this.#selectedCountryData?.iso2;
|
|
4122
|
+
return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
|
|
4148
4123
|
}
|
|
4149
4124
|
//* Validate the input val using number length only
|
|
4150
4125
|
isValidNumber() {
|
|
4126
|
+
if (this.#destroyed) {
|
|
4127
|
+
return null;
|
|
4128
|
+
}
|
|
4129
|
+
ensureUtils("isValidNumber");
|
|
4151
4130
|
const dialCode = this.#selectedCountryData?.dialCode;
|
|
4152
4131
|
const iso2 = this.#selectedCountryData?.iso2;
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
if (
|
|
4157
|
-
if (
|
|
4158
|
-
|
|
4159
|
-
return false;
|
|
4160
|
-
}
|
|
4132
|
+
const number = this.#getFullNumber();
|
|
4133
|
+
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
4134
|
+
if (coreNumber) {
|
|
4135
|
+
if (dialCode === UK.DIAL_CODE) {
|
|
4136
|
+
if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
4137
|
+
return false;
|
|
4161
4138
|
}
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4139
|
+
}
|
|
4140
|
+
const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
|
|
4141
|
+
if (!hasAlphaChar && dialCode) {
|
|
4142
|
+
const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
|
|
4143
|
+
const nationalDigitCount = getNumeric(nationalPortion).length;
|
|
4144
|
+
if (coreNumber.length > nationalDigitCount) {
|
|
4145
|
+
return false;
|
|
4169
4146
|
}
|
|
4170
4147
|
}
|
|
4171
4148
|
}
|
|
@@ -4173,6 +4150,10 @@ var Iti = class _Iti {
|
|
|
4173
4150
|
}
|
|
4174
4151
|
//* Validate the input val with precise validation
|
|
4175
4152
|
isValidNumberPrecise() {
|
|
4153
|
+
if (this.#destroyed) {
|
|
4154
|
+
return null;
|
|
4155
|
+
}
|
|
4156
|
+
ensureUtils("isValidNumberPrecise");
|
|
4176
4157
|
return this.#validateNumber(true);
|
|
4177
4158
|
}
|
|
4178
4159
|
#utilsIsPossibleNumber(val) {
|
|
@@ -4184,13 +4165,10 @@ var Iti = class _Iti {
|
|
|
4184
4165
|
}
|
|
4185
4166
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
4186
4167
|
#validateNumber(precise) {
|
|
4187
|
-
if (!intlTelInput.utils || !this.#ui.telInput) {
|
|
4188
|
-
return null;
|
|
4189
|
-
}
|
|
4190
4168
|
const { allowNumberExtensions, allowPhonewords } = this.#options;
|
|
4191
4169
|
const testValidity = (s) => precise ? this.#utilsIsValidNumber(s) : this.#utilsIsPossibleNumber(s);
|
|
4192
4170
|
const val = this.#getFullNumber();
|
|
4193
|
-
if (!this.#selectedCountryData
|
|
4171
|
+
if (!this.#selectedCountryData) {
|
|
4194
4172
|
const isRegionlessDialCode = hasRegionlessDialCode(val);
|
|
4195
4173
|
if (!isRegionlessDialCode) {
|
|
4196
4174
|
return false;
|
|
@@ -4220,7 +4198,7 @@ var Iti = class _Iti {
|
|
|
4220
4198
|
}
|
|
4221
4199
|
//* Update the selected country, and update the input val accordingly.
|
|
4222
4200
|
setCountry(iso2) {
|
|
4223
|
-
if (
|
|
4201
|
+
if (this.#destroyed) {
|
|
4224
4202
|
return;
|
|
4225
4203
|
}
|
|
4226
4204
|
const iso2Lower = iso2?.toLowerCase();
|
|
@@ -4241,7 +4219,7 @@ var Iti = class _Iti {
|
|
|
4241
4219
|
}
|
|
4242
4220
|
//* Set the input value and update the country.
|
|
4243
4221
|
setNumber(number) {
|
|
4244
|
-
if (
|
|
4222
|
+
if (this.#destroyed) {
|
|
4245
4223
|
return;
|
|
4246
4224
|
}
|
|
4247
4225
|
const normalisedNumber = this.#numerals.normalise(number);
|
|
@@ -4252,16 +4230,17 @@ var Iti = class _Iti {
|
|
|
4252
4230
|
}
|
|
4253
4231
|
this.#trigger(EVENTS.INPUT, { isSetNumber: true });
|
|
4254
4232
|
}
|
|
4255
|
-
//* Set the placeholder number
|
|
4233
|
+
//* Set the placeholder number type
|
|
4256
4234
|
setPlaceholderNumberType(type) {
|
|
4257
|
-
if (
|
|
4235
|
+
if (this.#destroyed) {
|
|
4258
4236
|
return;
|
|
4259
4237
|
}
|
|
4260
4238
|
this.#options.placeholderNumberType = type;
|
|
4261
4239
|
this.#updatePlaceholder();
|
|
4262
4240
|
}
|
|
4241
|
+
// Set the disabled state of the input and dropdown.
|
|
4263
4242
|
setDisabled(disabled) {
|
|
4264
|
-
if (
|
|
4243
|
+
if (this.#destroyed) {
|
|
4265
4244
|
return;
|
|
4266
4245
|
}
|
|
4267
4246
|
this.#ui.telInput.disabled = disabled;
|
|
@@ -4273,6 +4252,20 @@ var Iti = class _Iti {
|
|
|
4273
4252
|
}
|
|
4274
4253
|
}
|
|
4275
4254
|
}
|
|
4255
|
+
// Set the readonly state of the input and dropdown.
|
|
4256
|
+
setReadonly(readonly) {
|
|
4257
|
+
if (!this.#ui.telInput) {
|
|
4258
|
+
return;
|
|
4259
|
+
}
|
|
4260
|
+
this.#ui.telInput.readOnly = readonly;
|
|
4261
|
+
if (this.#ui.selectedCountry) {
|
|
4262
|
+
if (readonly) {
|
|
4263
|
+
this.#ui.selectedCountry.setAttribute("disabled", "true");
|
|
4264
|
+
} else {
|
|
4265
|
+
this.#ui.selectedCountry.removeAttribute("disabled");
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4268
|
+
}
|
|
4276
4269
|
//********************
|
|
4277
4270
|
//* STATIC METHODS
|
|
4278
4271
|
//********************
|
|
@@ -4280,7 +4273,7 @@ var Iti = class _Iti {
|
|
|
4280
4273
|
// Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
|
|
4281
4274
|
// access to private instance methods.
|
|
4282
4275
|
static forEachInstance(method, ...args) {
|
|
4283
|
-
const values =
|
|
4276
|
+
const values = [...intlTelInput.instances.values()];
|
|
4284
4277
|
const arg = args[0];
|
|
4285
4278
|
values.forEach((instance) => {
|
|
4286
4279
|
if (!(instance instanceof _Iti)) {
|
|
@@ -4321,13 +4314,13 @@ var attachUtils = (source) => {
|
|
|
4321
4314
|
}
|
|
4322
4315
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
4323
4316
|
return loadCall.then((module) => {
|
|
4324
|
-
const
|
|
4325
|
-
if (!
|
|
4317
|
+
const utils = module?.default;
|
|
4318
|
+
if (!utils || typeof utils !== "object") {
|
|
4326
4319
|
throw new TypeError(
|
|
4327
4320
|
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
4328
4321
|
);
|
|
4329
4322
|
}
|
|
4330
|
-
intlTelInput.utils =
|
|
4323
|
+
intlTelInput.utils = utils;
|
|
4331
4324
|
Iti.forEachInstance("handleUtils");
|
|
4332
4325
|
return true;
|
|
4333
4326
|
}).catch((error) => {
|
|
@@ -4340,7 +4333,7 @@ var attachUtils = (source) => {
|
|
|
4340
4333
|
var intlTelInput = Object.assign(
|
|
4341
4334
|
(input, options) => {
|
|
4342
4335
|
const iti = new Iti(input, options);
|
|
4343
|
-
intlTelInput.instances
|
|
4336
|
+
intlTelInput.instances.set(String(iti.id), iti);
|
|
4344
4337
|
input.iti = iti;
|
|
4345
4338
|
return iti;
|
|
4346
4339
|
},
|
|
@@ -4353,35 +4346,36 @@ var intlTelInput = Object.assign(
|
|
|
4353
4346
|
//* A getter for the plugin instance.
|
|
4354
4347
|
getInstance: (input) => {
|
|
4355
4348
|
const id2 = input.dataset.intlTelInputId;
|
|
4356
|
-
return id2 ? intlTelInput.instances
|
|
4349
|
+
return id2 ? intlTelInput.instances.get(id2) ?? null : null;
|
|
4357
4350
|
},
|
|
4358
4351
|
//* A map from instance ID to instance object.
|
|
4359
|
-
instances:
|
|
4352
|
+
instances: /* @__PURE__ */ new Map(),
|
|
4360
4353
|
attachUtils,
|
|
4361
4354
|
startedLoadingUtilsScript: false,
|
|
4362
4355
|
startedLoadingAutoCountry: false,
|
|
4363
|
-
version: "
|
|
4356
|
+
version: "27.0.0"
|
|
4364
4357
|
}
|
|
4365
4358
|
);
|
|
4366
4359
|
var intl_tel_input_default = intlTelInput;
|
|
4367
4360
|
|
|
4368
|
-
//
|
|
4361
|
+
// dist/js/utils.js
|
|
4362
|
+
var _scope = {};
|
|
4369
4363
|
(function() {
|
|
4370
4364
|
var k = this || self;
|
|
4371
4365
|
function m(a, b) {
|
|
4372
4366
|
a = a.split(".");
|
|
4373
4367
|
var c = k;
|
|
4374
|
-
a[0] in c ||
|
|
4375
|
-
for (var d; a.length && (d = a.shift()); ) a.length || void 0
|
|
4368
|
+
a[0] in c || typeof c.execScript == "undefined" || c.execScript("var " + a[0]);
|
|
4369
|
+
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;
|
|
4376
4370
|
}
|
|
4377
4371
|
function n(a, b) {
|
|
4378
4372
|
function c() {
|
|
4379
4373
|
}
|
|
4380
4374
|
c.prototype = b.prototype;
|
|
4381
|
-
a.
|
|
4375
|
+
a.na = b.prototype;
|
|
4382
4376
|
a.prototype = new c();
|
|
4383
4377
|
a.prototype.constructor = a;
|
|
4384
|
-
a.
|
|
4378
|
+
a.ta = function(d, e, f) {
|
|
4385
4379
|
for (var g = Array(arguments.length - 2), h = 2; h < arguments.length; h++) g[h - 2] = arguments[h];
|
|
4386
4380
|
return b.prototype[e].apply(d, g);
|
|
4387
4381
|
};
|
|
@@ -4439,9 +4433,9 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4439
4433
|
new ka();
|
|
4440
4434
|
function la(a, b) {
|
|
4441
4435
|
this.g = a;
|
|
4442
|
-
this.l = !!b.
|
|
4436
|
+
this.l = !!b.ca;
|
|
4443
4437
|
this.h = b.i;
|
|
4444
|
-
this.
|
|
4438
|
+
this.u = b.type;
|
|
4445
4439
|
this.o = false;
|
|
4446
4440
|
switch (this.h) {
|
|
4447
4441
|
case ma:
|
|
@@ -4489,16 +4483,35 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4489
4483
|
p.prototype.add = function(a, b) {
|
|
4490
4484
|
va(this, a.g, b);
|
|
4491
4485
|
};
|
|
4486
|
+
p.prototype.equals = function(a) {
|
|
4487
|
+
if (!a || this.constructor != a.constructor) return false;
|
|
4488
|
+
for (var b = ua(this.m()), c = 0; c < b.length; c++) {
|
|
4489
|
+
var d = b[c], e = d.g;
|
|
4490
|
+
if (q(this, e) != q(a, e)) return false;
|
|
4491
|
+
if (q(this, e)) {
|
|
4492
|
+
var f = d.h == 11 || d.h == 10, g = u(this, e);
|
|
4493
|
+
e = u(a, e);
|
|
4494
|
+
if (d.l) {
|
|
4495
|
+
if (g.length != e.length) return false;
|
|
4496
|
+
for (d = 0; d < g.length; d++) {
|
|
4497
|
+
var h = g[d], l = e[d];
|
|
4498
|
+
if (f ? !h.equals(l) : h != l) return false;
|
|
4499
|
+
}
|
|
4500
|
+
} else if (f ? !g.equals(e) : g != e) return false;
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
return true;
|
|
4504
|
+
};
|
|
4492
4505
|
function wa(a, b) {
|
|
4493
4506
|
for (var c = ua(a.m()), d = 0; d < c.length; d++) {
|
|
4494
4507
|
var e = c[d], f = e.g;
|
|
4495
4508
|
if (q(b, f)) {
|
|
4496
4509
|
a.g && delete a.g[e.g];
|
|
4497
|
-
var g =
|
|
4510
|
+
var g = e.h == 11 || e.h == 10;
|
|
4498
4511
|
if (e.l) {
|
|
4499
|
-
e = u(b, f);
|
|
4512
|
+
e = u(b, f) || [];
|
|
4500
4513
|
for (var h = 0; h < e.length; h++) va(a, f, g ? e[h].clone() : e[h]);
|
|
4501
|
-
} else e =
|
|
4514
|
+
} else e = u(b, f), g ? (g = u(a, f)) ? wa(g, e) : t(a, f, e.clone()) : t(a, f, e);
|
|
4502
4515
|
}
|
|
4503
4516
|
}
|
|
4504
4517
|
}
|
|
@@ -4508,15 +4521,15 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4508
4521
|
return a;
|
|
4509
4522
|
};
|
|
4510
4523
|
function q(a, b) {
|
|
4511
|
-
return
|
|
4524
|
+
return a.h[b] != null;
|
|
4512
4525
|
}
|
|
4513
|
-
function
|
|
4526
|
+
function u(a, b) {
|
|
4514
4527
|
var c = a.h[b];
|
|
4515
|
-
if (
|
|
4528
|
+
if (c == null) return null;
|
|
4516
4529
|
if (a.l) {
|
|
4517
4530
|
if (!(b in a.g)) {
|
|
4518
4531
|
var d = a.l, e = a.j[b];
|
|
4519
|
-
if (
|
|
4532
|
+
if (c != null) if (e.l) {
|
|
4520
4533
|
for (var f = [], g = 0; g < c.length; g++) f[g] = d.h(e, c[g]);
|
|
4521
4534
|
c = f;
|
|
4522
4535
|
} else c = d.h(e, c);
|
|
@@ -4527,14 +4540,14 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4527
4540
|
return c;
|
|
4528
4541
|
}
|
|
4529
4542
|
function r(a, b, c) {
|
|
4530
|
-
var d =
|
|
4543
|
+
var d = u(a, b);
|
|
4531
4544
|
return a.j[b].l ? d[c || 0] : d;
|
|
4532
4545
|
}
|
|
4533
|
-
function
|
|
4546
|
+
function v(a, b) {
|
|
4534
4547
|
if (q(a, b)) a = r(a, b);
|
|
4535
4548
|
else a: {
|
|
4536
4549
|
a = a.j[b];
|
|
4537
|
-
if (void 0
|
|
4550
|
+
if (a.j === void 0) if (b = a.u, b === Boolean) a.j = false;
|
|
4538
4551
|
else if (b === Number) a.j = 0;
|
|
4539
4552
|
else if (b === String) a.j = a.o ? "0" : "";
|
|
4540
4553
|
else {
|
|
@@ -4545,10 +4558,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4545
4558
|
}
|
|
4546
4559
|
return a;
|
|
4547
4560
|
}
|
|
4548
|
-
function
|
|
4549
|
-
return v(a, b) || [];
|
|
4550
|
-
}
|
|
4551
|
-
function x(a, b) {
|
|
4561
|
+
function w(a, b) {
|
|
4552
4562
|
return a.j[b].l ? q(a, b) ? a.h[b].length : 0 : q(a, b) ? 1 : 0;
|
|
4553
4563
|
}
|
|
4554
4564
|
function t(a, b, c) {
|
|
@@ -4560,114 +4570,117 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4560
4570
|
a.h[b].push(c);
|
|
4561
4571
|
a.g && delete a.g[b];
|
|
4562
4572
|
}
|
|
4563
|
-
function
|
|
4573
|
+
function x(a, b) {
|
|
4564
4574
|
var c = [], d;
|
|
4565
|
-
for (d in b)
|
|
4575
|
+
for (d in b) d != 0 && c.push(new la(d, b[d]));
|
|
4566
4576
|
return new ta(a, c);
|
|
4567
4577
|
}
|
|
4568
4578
|
;
|
|
4569
|
-
function
|
|
4579
|
+
function y() {
|
|
4570
4580
|
}
|
|
4571
|
-
|
|
4581
|
+
y.prototype.g = function(a) {
|
|
4572
4582
|
new a.h();
|
|
4573
4583
|
throw Error("Unimplemented");
|
|
4574
4584
|
};
|
|
4575
|
-
|
|
4576
|
-
if (
|
|
4577
|
-
if (
|
|
4585
|
+
y.prototype.h = function(a, b) {
|
|
4586
|
+
if (a.h == 11 || a.h == 10) return b instanceof p ? b : this.g(a.u.prototype.m(), b);
|
|
4587
|
+
if (a.h == 14) return typeof b === "string" && xa.test(b) && (a = Number(b), a > 0) ? a : b;
|
|
4578
4588
|
if (!a.o) return b;
|
|
4579
|
-
a = a.
|
|
4589
|
+
a = a.u;
|
|
4580
4590
|
if (a === String) {
|
|
4581
|
-
if ("number"
|
|
4582
|
-
} else if (a === Number && "string"
|
|
4591
|
+
if (typeof b === "number") return String(b);
|
|
4592
|
+
} else if (a === Number && typeof b === "string" && (b === "Infinity" || b === "-Infinity" || b === "NaN" || xa.test(b))) return Number(b);
|
|
4583
4593
|
return b;
|
|
4584
4594
|
};
|
|
4585
4595
|
var xa = /^-?[0-9]+$/;
|
|
4586
|
-
function
|
|
4596
|
+
function z() {
|
|
4587
4597
|
}
|
|
4588
|
-
n(
|
|
4589
|
-
|
|
4598
|
+
n(z, y);
|
|
4599
|
+
z.prototype.g = function(a, b) {
|
|
4590
4600
|
a = new a.h();
|
|
4591
4601
|
a.l = this;
|
|
4592
4602
|
a.h = b;
|
|
4593
4603
|
a.g = {};
|
|
4594
4604
|
return a;
|
|
4595
4605
|
};
|
|
4596
|
-
function
|
|
4606
|
+
function B() {
|
|
4597
4607
|
}
|
|
4598
|
-
n(
|
|
4599
|
-
|
|
4600
|
-
return
|
|
4608
|
+
n(B, z);
|
|
4609
|
+
B.prototype.h = function(a, b) {
|
|
4610
|
+
return a.h == 8 ? !!b : y.prototype.h.apply(this, arguments);
|
|
4601
4611
|
};
|
|
4602
|
-
|
|
4603
|
-
return
|
|
4612
|
+
B.prototype.g = function(a, b) {
|
|
4613
|
+
return B.na.g.call(this, a, b);
|
|
4604
4614
|
};
|
|
4605
|
-
function
|
|
4606
|
-
|
|
4615
|
+
function C(a, b) {
|
|
4616
|
+
a != null && this.g.apply(this, arguments);
|
|
4607
4617
|
}
|
|
4608
|
-
|
|
4609
|
-
|
|
4618
|
+
C.prototype.h = "";
|
|
4619
|
+
C.prototype.set = function(a) {
|
|
4610
4620
|
this.h = "" + a;
|
|
4611
4621
|
};
|
|
4612
|
-
|
|
4622
|
+
C.prototype.g = function(a, b, c) {
|
|
4613
4623
|
this.h += String(a);
|
|
4614
|
-
if (
|
|
4624
|
+
if (b != null) for (let d = 1; d < arguments.length; d++) this.h += arguments[d];
|
|
4615
4625
|
return this;
|
|
4616
4626
|
};
|
|
4617
|
-
function
|
|
4627
|
+
function D(a) {
|
|
4618
4628
|
a.h = "";
|
|
4619
4629
|
}
|
|
4620
|
-
|
|
4630
|
+
C.prototype.toString = function() {
|
|
4621
4631
|
return this.h;
|
|
4622
4632
|
};
|
|
4623
|
-
function
|
|
4633
|
+
function E() {
|
|
4624
4634
|
p.call(this);
|
|
4625
4635
|
}
|
|
4626
|
-
n(
|
|
4636
|
+
n(E, p);
|
|
4627
4637
|
var ya = null;
|
|
4628
|
-
function
|
|
4638
|
+
function F() {
|
|
4629
4639
|
p.call(this);
|
|
4630
4640
|
}
|
|
4631
|
-
n(
|
|
4641
|
+
n(F, p);
|
|
4632
4642
|
var za = null;
|
|
4643
|
+
function G(a) {
|
|
4644
|
+
return u(a, 9) || [];
|
|
4645
|
+
}
|
|
4633
4646
|
function H() {
|
|
4634
4647
|
p.call(this);
|
|
4635
4648
|
}
|
|
4636
4649
|
n(H, p);
|
|
4637
4650
|
var Aa = null;
|
|
4638
|
-
|
|
4651
|
+
E.prototype.m = function() {
|
|
4639
4652
|
var a = ya;
|
|
4640
|
-
a || (ya = a =
|
|
4653
|
+
a || (ya = a = x(E, { 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 } }));
|
|
4641
4654
|
return a;
|
|
4642
4655
|
};
|
|
4643
|
-
|
|
4644
|
-
|
|
4656
|
+
E.m = E.prototype.m;
|
|
4657
|
+
F.prototype.m = function() {
|
|
4645
4658
|
var a = za;
|
|
4646
|
-
a || (za = a =
|
|
4659
|
+
a || (za = a = x(F, { 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 } }));
|
|
4647
4660
|
return a;
|
|
4648
4661
|
};
|
|
4649
|
-
|
|
4662
|
+
F.m = F.prototype.m;
|
|
4650
4663
|
H.prototype.m = function() {
|
|
4651
4664
|
var a = Aa;
|
|
4652
|
-
a || (Aa = a =
|
|
4653
|
-
0: { name: "PhoneMetadata",
|
|
4654
|
-
1: { name: "general_desc", i: 11, type:
|
|
4655
|
-
2: { name: "fixed_line", i: 11, type:
|
|
4656
|
-
3: { name: "mobile", i: 11, type:
|
|
4657
|
-
4: { name: "toll_free", i: 11, type:
|
|
4658
|
-
5: { name: "premium_rate", i: 11, type:
|
|
4659
|
-
6: { name: "shared_cost", i: 11, type:
|
|
4660
|
-
7: { name: "personal_number", i: 11, type:
|
|
4661
|
-
8: { name: "voip", i: 11, type:
|
|
4662
|
-
21: { name: "pager", i: 11, type:
|
|
4663
|
-
25: { name: "uan", i: 11, type:
|
|
4664
|
-
27: { name: "emergency", i: 11, type:
|
|
4665
|
-
28: { name: "voicemail", i: 11, type:
|
|
4666
|
-
29: { name: "short_code", i: 11, type:
|
|
4667
|
-
30: { name: "standard_rate", i: 11, type:
|
|
4668
|
-
31: { name: "carrier_specific", i: 11, type:
|
|
4669
|
-
33: { name: "sms_services", i: 11, type:
|
|
4670
|
-
24: { name: "no_international_dialling", i: 11, type:
|
|
4665
|
+
a || (Aa = a = x(H, {
|
|
4666
|
+
0: { name: "PhoneMetadata", ja: "i18n.phonenumbers.PhoneMetadata" },
|
|
4667
|
+
1: { name: "general_desc", i: 11, type: F },
|
|
4668
|
+
2: { name: "fixed_line", i: 11, type: F },
|
|
4669
|
+
3: { name: "mobile", i: 11, type: F },
|
|
4670
|
+
4: { name: "toll_free", i: 11, type: F },
|
|
4671
|
+
5: { name: "premium_rate", i: 11, type: F },
|
|
4672
|
+
6: { name: "shared_cost", i: 11, type: F },
|
|
4673
|
+
7: { name: "personal_number", i: 11, type: F },
|
|
4674
|
+
8: { name: "voip", i: 11, type: F },
|
|
4675
|
+
21: { name: "pager", i: 11, type: F },
|
|
4676
|
+
25: { name: "uan", i: 11, type: F },
|
|
4677
|
+
27: { name: "emergency", i: 11, type: F },
|
|
4678
|
+
28: { name: "voicemail", i: 11, type: F },
|
|
4679
|
+
29: { name: "short_code", i: 11, type: F },
|
|
4680
|
+
30: { name: "standard_rate", i: 11, type: F },
|
|
4681
|
+
31: { name: "carrier_specific", i: 11, type: F },
|
|
4682
|
+
33: { name: "sms_services", i: 11, type: F },
|
|
4683
|
+
24: { name: "no_international_dialling", i: 11, type: F },
|
|
4671
4684
|
9: { name: "id", required: true, i: 9, type: String },
|
|
4672
4685
|
10: { name: "country_code", i: 5, type: Number },
|
|
4673
4686
|
11: { name: "international_prefix", i: 9, type: String },
|
|
@@ -4681,8 +4694,8 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4681
4694
|
},
|
|
4682
4695
|
16: { name: "national_prefix_transform_rule", i: 9, type: String },
|
|
4683
4696
|
18: { name: "same_mobile_and_fixed_line_pattern", i: 8, defaultValue: false, type: Boolean },
|
|
4684
|
-
19: { name: "number_format",
|
|
4685
|
-
20: { name: "intl_number_format",
|
|
4697
|
+
19: { name: "number_format", ca: true, i: 11, type: E },
|
|
4698
|
+
20: { name: "intl_number_format", ca: true, i: 11, type: E },
|
|
4686
4699
|
22: { name: "main_country_for_code", i: 8, defaultValue: false, type: Boolean },
|
|
4687
4700
|
23: { name: "leading_digits", i: 9, type: String }
|
|
4688
4701
|
}));
|
|
@@ -4693,10 +4706,10 @@ var intl_tel_input_default = intlTelInput;
|
|
|
4693
4706
|
p.call(this);
|
|
4694
4707
|
}
|
|
4695
4708
|
n(I, p);
|
|
4696
|
-
var Ba = null, Ca = {
|
|
4709
|
+
var Ba = null, Ca = { sa: 0, ra: 1, qa: 5, pa: 10, oa: 20 };
|
|
4697
4710
|
I.prototype.m = function() {
|
|
4698
4711
|
var a = Ba;
|
|
4699
|
-
a || (Ba = a =
|
|
4712
|
+
a || (Ba = a = x(I, { 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: Ca }, 7: {
|
|
4700
4713
|
name: "preferred_domestic_carrier_code",
|
|
4701
4714
|
i: 9,
|
|
4702
4715
|
type: String
|
|
@@ -10047,46 +10060,46 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10047
10060
|
}
|
|
10048
10061
|
var Qa = new RegExp("(?:" + Pa() + ")$", "i"), Ra = 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]*(?:" + Pa() + ")?$", "i"), Sa = /(\$\d)/, Ta = /^\(?\$1\)?$/;
|
|
10049
10062
|
function Ua(a) {
|
|
10050
|
-
return
|
|
10063
|
+
return a.length < 2 ? false : N(Ra, a);
|
|
10051
10064
|
}
|
|
10052
10065
|
function Va(a) {
|
|
10053
10066
|
return N(Ma, a) ? O(a, Ga) : O(a, Ea);
|
|
10054
10067
|
}
|
|
10055
10068
|
function Wa(a) {
|
|
10056
10069
|
var b = Va(a.toString());
|
|
10057
|
-
|
|
10070
|
+
D(a);
|
|
10058
10071
|
a.g(b);
|
|
10059
10072
|
}
|
|
10060
10073
|
function Xa(a) {
|
|
10061
|
-
return
|
|
10074
|
+
return a != null && (w(a, 9) != 1 || G(a)[0] != -1);
|
|
10062
10075
|
}
|
|
10063
10076
|
function O(a, b) {
|
|
10064
|
-
for (var c = new
|
|
10077
|
+
for (var c = new C(), d, e = a.length, f = 0; f < e; ++f) d = a.charAt(f), d = b[d.toUpperCase()], d != null && c.g(d);
|
|
10065
10078
|
return c.toString();
|
|
10066
10079
|
}
|
|
10067
10080
|
function Ya(a) {
|
|
10068
|
-
return
|
|
10081
|
+
return a.length == 0 || Ta.test(a);
|
|
10069
10082
|
}
|
|
10070
10083
|
function P(a) {
|
|
10071
|
-
return
|
|
10084
|
+
return a != null && isNaN(a) && a.toUpperCase() in Da;
|
|
10072
10085
|
}
|
|
10073
10086
|
K.prototype.format = function(a, b) {
|
|
10074
|
-
if (
|
|
10075
|
-
var c =
|
|
10076
|
-
if (
|
|
10087
|
+
if (r(a, 2) == 0 && q(a, 5)) {
|
|
10088
|
+
var c = v(a, 5);
|
|
10089
|
+
if (c.length > 0) return c;
|
|
10077
10090
|
}
|
|
10078
|
-
c =
|
|
10091
|
+
c = v(a, 1);
|
|
10079
10092
|
var d = Q(a);
|
|
10080
|
-
if (
|
|
10093
|
+
if (b == 0) return Za(c, 0, d, "");
|
|
10081
10094
|
if (!(c in J)) return d;
|
|
10082
10095
|
var e = R(this, c, S(c));
|
|
10083
|
-
a = q(a, 3) &&
|
|
10096
|
+
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) : "";
|
|
10084
10097
|
a: {
|
|
10085
|
-
e =
|
|
10098
|
+
e = (u(e, 20) || []).length == 0 || b == 2 ? u(e, 19) || [] : u(e, 20) || [];
|
|
10086
10099
|
for (var f, g = e.length, h = 0; h < g; ++h) {
|
|
10087
10100
|
f = e[h];
|
|
10088
|
-
var l =
|
|
10089
|
-
if (
|
|
10101
|
+
var l = w(f, 3);
|
|
10102
|
+
if (l == 0 || d.search(r(f, 3, l - 1)) == 0) {
|
|
10090
10103
|
if (l = new RegExp(r(f, 1)), N(l, d)) {
|
|
10091
10104
|
e = f;
|
|
10092
10105
|
break a;
|
|
@@ -10095,10 +10108,10 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10095
10108
|
}
|
|
10096
10109
|
e = null;
|
|
10097
10110
|
}
|
|
10098
|
-
|
|
10111
|
+
e != null && (g = e, e = v(g, 2), f = new RegExp(r(
|
|
10099
10112
|
g,
|
|
10100
|
-
|
|
10101
|
-
), g =
|
|
10113
|
+
1
|
|
10114
|
+
)), v(g, 5), g = v(g, 4), d = b == 2 && g != null && g.length > 0 ? d.replace(f, e.replace(Sa, 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"), "-")));
|
|
10102
10115
|
return Za(c, b, d, a);
|
|
10103
10116
|
};
|
|
10104
10117
|
function R(a, b, c) {
|
|
@@ -10107,7 +10120,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10107
10120
|
function Q(a) {
|
|
10108
10121
|
if (!q(a, 2)) return "";
|
|
10109
10122
|
var b = "" + r(a, 2);
|
|
10110
|
-
return q(a, 4) && r(a, 4) &&
|
|
10123
|
+
return q(a, 4) && r(a, 4) && v(a, 8) > 0 ? Array(v(a, 8) + 1).join("0") + b : b;
|
|
10111
10124
|
}
|
|
10112
10125
|
function Za(a, b, c, d) {
|
|
10113
10126
|
switch (b) {
|
|
@@ -10150,8 +10163,8 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10150
10163
|
}
|
|
10151
10164
|
function $a(a, b) {
|
|
10152
10165
|
var c = ab(a, b);
|
|
10153
|
-
a = R(a,
|
|
10154
|
-
if (
|
|
10166
|
+
a = R(a, v(b, 1), c);
|
|
10167
|
+
if (a == null) return -1;
|
|
10155
10168
|
b = Q(b);
|
|
10156
10169
|
return bb(b, a);
|
|
10157
10170
|
}
|
|
@@ -10159,45 +10172,45 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10159
10172
|
return V(a, r(b, 1)) ? V(a, r(b, 5)) ? 4 : V(a, r(b, 4)) ? 3 : V(a, r(b, 6)) ? 5 : V(a, r(b, 8)) ? 6 : V(a, r(b, 7)) ? 7 : V(a, r(b, 21)) ? 8 : V(a, r(b, 25)) ? 9 : V(a, r(b, 28)) ? 10 : V(a, r(b, 2)) ? r(b, 18) || V(a, r(b, 3)) ? 2 : 0 : !r(b, 18) && V(a, r(b, 3)) ? 1 : -1 : -1;
|
|
10160
10173
|
}
|
|
10161
10174
|
function T(a, b) {
|
|
10162
|
-
if (
|
|
10175
|
+
if (b == null) return null;
|
|
10163
10176
|
b = b.toUpperCase();
|
|
10164
10177
|
var c = a.g[b];
|
|
10165
|
-
if (
|
|
10178
|
+
if (c == null) {
|
|
10166
10179
|
c = Da[b];
|
|
10167
|
-
if (
|
|
10168
|
-
c = new
|
|
10180
|
+
if (c == null) return null;
|
|
10181
|
+
c = new B().g(H.m(), c);
|
|
10169
10182
|
a.g[b] = c;
|
|
10170
10183
|
}
|
|
10171
10184
|
return c;
|
|
10172
10185
|
}
|
|
10173
10186
|
function V(a, b) {
|
|
10174
10187
|
var c = a.length;
|
|
10175
|
-
return
|
|
10188
|
+
return w(b, 9) > 0 && G(b).indexOf(c) == -1 ? false : N(v(b, 2), a);
|
|
10176
10189
|
}
|
|
10177
10190
|
function cb(a, b) {
|
|
10178
10191
|
var c = ab(a, b);
|
|
10179
|
-
var d =
|
|
10192
|
+
var d = v(b, 1);
|
|
10180
10193
|
var e = R(a, d, c);
|
|
10181
|
-
|
|
10194
|
+
e == null || "001" != c && d != db(a, c) ? e = false : (a = Q(b), e = bb(a, e) != -1);
|
|
10182
10195
|
return e;
|
|
10183
10196
|
}
|
|
10184
10197
|
function ab(a, b) {
|
|
10185
|
-
if (
|
|
10186
|
-
var c =
|
|
10198
|
+
if (b == null) return null;
|
|
10199
|
+
var c = v(b, 1);
|
|
10187
10200
|
c = J[c];
|
|
10188
|
-
if (
|
|
10189
|
-
else if (
|
|
10201
|
+
if (c == null) a = null;
|
|
10202
|
+
else if (c.length == 1) a = c[0];
|
|
10190
10203
|
else a: {
|
|
10191
10204
|
b = Q(b);
|
|
10192
10205
|
for (var d, e = c.length, f = 0; f < e; f++) {
|
|
10193
10206
|
d = c[f];
|
|
10194
10207
|
var g = T(a, d);
|
|
10195
10208
|
if (q(g, 23)) {
|
|
10196
|
-
if (
|
|
10209
|
+
if (b.search(r(g, 23)) == 0) {
|
|
10197
10210
|
a = d;
|
|
10198
10211
|
break a;
|
|
10199
10212
|
}
|
|
10200
|
-
} else if (
|
|
10213
|
+
} else if (bb(b, g) != -1) {
|
|
10201
10214
|
a = d;
|
|
10202
10215
|
break a;
|
|
10203
10216
|
}
|
|
@@ -10208,116 +10221,117 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10208
10221
|
}
|
|
10209
10222
|
function S(a) {
|
|
10210
10223
|
a = J[a];
|
|
10211
|
-
return
|
|
10224
|
+
return a == null ? "ZZ" : a[0];
|
|
10212
10225
|
}
|
|
10213
10226
|
function db(a, b) {
|
|
10214
10227
|
a = T(a, b);
|
|
10215
|
-
if (
|
|
10216
|
-
return
|
|
10228
|
+
if (a == null) throw Error("Invalid region code: " + b);
|
|
10229
|
+
return v(a, 10);
|
|
10217
10230
|
}
|
|
10218
10231
|
function W(a, b, c, d) {
|
|
10219
|
-
var e = U(c, d), f =
|
|
10220
|
-
e = u(e, 10);
|
|
10221
|
-
if (
|
|
10232
|
+
var e = U(c, d), f = w(e, 9) == 0 ? G(r(c, 1)) : G(e);
|
|
10233
|
+
e = u(e, 10) || [];
|
|
10234
|
+
if (d == 2) if (Xa(U(c, 0))) a = U(c, 1), Xa(a) && (f = f.concat(w(a, 9) == 0 ? G(r(c, 1)) : G(a)), f.sort(), e.length == 0 ? e = u(a, 10) || [] : (e = e.concat(u(a, 10) || []), e.sort()));
|
|
10222
10235
|
else return W(a, b, c, 1);
|
|
10223
|
-
if (
|
|
10236
|
+
if (f[0] == -1) return 5;
|
|
10224
10237
|
b = b.length;
|
|
10225
|
-
if (
|
|
10238
|
+
if (e.indexOf(b) > -1) return 4;
|
|
10226
10239
|
c = f[0];
|
|
10227
|
-
return c == b ? 0 : c > b ? 2 : f[f.length - 1] < b ? 3 :
|
|
10240
|
+
return c == b ? 0 : c > b ? 2 : f[f.length - 1] < b ? 3 : f.indexOf(b, 1) > -1 ? 0 : 5;
|
|
10228
10241
|
}
|
|
10229
10242
|
function X(a, b, c) {
|
|
10230
10243
|
var d = Q(b);
|
|
10231
|
-
b =
|
|
10244
|
+
b = v(b, 1);
|
|
10232
10245
|
if (!(b in J)) return 1;
|
|
10233
10246
|
b = R(a, b, S(b));
|
|
10234
10247
|
return W(a, d, b, c);
|
|
10235
10248
|
}
|
|
10236
10249
|
function eb(a, b) {
|
|
10237
10250
|
a = a.toString();
|
|
10238
|
-
if (
|
|
10239
|
-
for (var c, d = a.length, e = 1;
|
|
10251
|
+
if (a.length == 0 || a.charAt(0) == "0") return 0;
|
|
10252
|
+
for (var c, d = a.length, e = 1; e <= 3 && e <= d; ++e) if (c = parseInt(a.substring(0, e), 10), c in J) return b.g(a.substring(e)), c;
|
|
10240
10253
|
return 0;
|
|
10241
10254
|
}
|
|
10242
10255
|
function fb(a, b, c, d, e, f) {
|
|
10243
|
-
if (
|
|
10244
|
-
b = new
|
|
10256
|
+
if (b.length == 0) return 0;
|
|
10257
|
+
b = new C(b);
|
|
10245
10258
|
var g;
|
|
10246
|
-
|
|
10247
|
-
|
|
10259
|
+
c != null && (g = r(c, 11));
|
|
10260
|
+
g == null && (g = "NonMatch");
|
|
10248
10261
|
var h = b.toString();
|
|
10249
|
-
if (
|
|
10250
|
-
else if (L.test(h)) h = h.replace(L, ""),
|
|
10262
|
+
if (h.length == 0) g = 20;
|
|
10263
|
+
else if (L.test(h)) h = h.replace(L, ""), D(b), b.g(Va(h)), g = 1;
|
|
10251
10264
|
else {
|
|
10252
10265
|
h = new RegExp(g);
|
|
10253
10266
|
Wa(b);
|
|
10254
10267
|
g = b.toString();
|
|
10255
|
-
if (
|
|
10268
|
+
if (g.search(h) == 0) {
|
|
10256
10269
|
h = g.match(h)[0].length;
|
|
10257
10270
|
var l = g.substring(h).match(Ia);
|
|
10258
|
-
l &&
|
|
10271
|
+
l && l[1] != null && l[1].length > 0 && O(l[1], Ea) == "0" ? g = false : (D(b), b.g(g.substring(h)), g = true);
|
|
10259
10272
|
} else g = false;
|
|
10260
10273
|
g = g ? 5 : 20;
|
|
10261
10274
|
}
|
|
10262
10275
|
e && t(f, 6, g);
|
|
10263
|
-
if (
|
|
10264
|
-
if (
|
|
10276
|
+
if (g != 20) {
|
|
10277
|
+
if (b.h.length <= 2) throw Error("Phone number too short after IDD");
|
|
10265
10278
|
a = eb(b, d);
|
|
10266
|
-
if (
|
|
10279
|
+
if (a != 0) return t(f, 1, a), a;
|
|
10267
10280
|
throw Error("Invalid country calling code");
|
|
10268
10281
|
}
|
|
10269
|
-
if (
|
|
10282
|
+
if (c != null && (g = v(c, 10), h = "" + g, l = b.toString(), l.lastIndexOf(h, 0) == 0 && (h = new C(l.substring(h.length)), l = r(c, 1), l = new RegExp(v(l, 2)), gb(h, c, null), h = h.toString(), !N(l, b.toString()) && N(l, h) || W(a, b.toString(), c, -1) == 3))) return d.g(h), e && t(f, 6, 10), t(f, 1, g), g;
|
|
10270
10283
|
t(f, 1, 0);
|
|
10271
10284
|
return 0;
|
|
10272
10285
|
}
|
|
10273
10286
|
function gb(a, b, c) {
|
|
10274
10287
|
var d = a.toString(), e = d.length, f = r(b, 15);
|
|
10275
|
-
if (
|
|
10276
|
-
var g =
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10288
|
+
if (e != 0 && f != null && f.length != 0 && (f = new RegExp("^(?:" + f + ")"), e = f.exec(d))) {
|
|
10289
|
+
var g = RegExp;
|
|
10290
|
+
var h = r(b, 1);
|
|
10291
|
+
h = v(h, 2);
|
|
10292
|
+
g = new g(h);
|
|
10293
|
+
h = N(g, d);
|
|
10294
|
+
var l = e.length - 1;
|
|
10295
|
+
b = r(b, 16);
|
|
10296
|
+
if (b == null || b.length == 0 || e[l] == null || e[l].length == 0) {
|
|
10297
|
+
if (!h || N(g, d.substring(e[0].length))) c != null && l > 0 && e[l] != null && c.g(e[1]), a.set(d.substring(e[0].length));
|
|
10298
|
+
} else if (d = d.replace(f, b), !h || N(g, d)) c != null && l > 0 && c.g(e[1]), a.set(d);
|
|
10285
10299
|
}
|
|
10286
10300
|
}
|
|
10287
10301
|
function Y(a, b, c) {
|
|
10288
|
-
if (!P(c) &&
|
|
10302
|
+
if (!P(c) && b.length > 0 && b.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
10289
10303
|
return hb(a, b, c, true);
|
|
10290
10304
|
}
|
|
10291
10305
|
function hb(a, b, c, d) {
|
|
10292
|
-
if (
|
|
10293
|
-
if (
|
|
10294
|
-
var e = new
|
|
10306
|
+
if (b == null) throw Error("The string supplied did not seem to be a phone number");
|
|
10307
|
+
if (b.length > 250) throw Error("The string supplied is too long to be a phone number");
|
|
10308
|
+
var e = new C();
|
|
10295
10309
|
var f = b.indexOf(";phone-context=");
|
|
10296
|
-
if (
|
|
10310
|
+
if (f === -1) f = null;
|
|
10297
10311
|
else if (f += 15, f >= b.length) f = "";
|
|
10298
10312
|
else {
|
|
10299
10313
|
var g = b.indexOf(";", f);
|
|
10300
|
-
f =
|
|
10314
|
+
f = g !== -1 ? b.substring(f, g) : b.substring(f);
|
|
10301
10315
|
}
|
|
10302
10316
|
var h = f;
|
|
10303
|
-
|
|
10317
|
+
h == null ? g = true : h.length === 0 ? g = false : (g = Na.exec(h), h = Oa.exec(h), g = g !== null || h !== null);
|
|
10304
10318
|
if (!g) throw Error("The string supplied did not seem to be a phone number");
|
|
10305
|
-
|
|
10319
|
+
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(Ja), h >= 0 ? (g = g.substring(h), g = g.replace(La, ""), h = g.search(Ka), h >= 0 && (g = g.substring(0, h))) : g = "", f.call(e, g));
|
|
10306
10320
|
f = e.toString();
|
|
10307
10321
|
g = f.indexOf(";isub=");
|
|
10308
|
-
|
|
10322
|
+
g > 0 && (D(e), e.g(f.substring(0, g)));
|
|
10309
10323
|
if (!Ua(e.toString())) throw Error("The string supplied did not seem to be a phone number");
|
|
10310
10324
|
f = e.toString();
|
|
10311
|
-
if (!(P(c) ||
|
|
10325
|
+
if (!(P(c) || f != null && f.length > 0 && L.test(f))) throw Error("Invalid country calling code");
|
|
10312
10326
|
f = new I();
|
|
10313
10327
|
d && t(f, 5, b);
|
|
10314
10328
|
a: {
|
|
10315
10329
|
b = e.toString();
|
|
10316
10330
|
g = b.search(Qa);
|
|
10317
|
-
if (
|
|
10331
|
+
if (g >= 0 && Ua(b.substring(0, g))) {
|
|
10318
10332
|
h = b.match(Qa);
|
|
10319
|
-
for (var l = h.length, A = 1; A < l; ++A) if (
|
|
10320
|
-
|
|
10333
|
+
for (var l = h.length, A = 1; A < l; ++A) if (h[A] != null && h[A].length > 0) {
|
|
10334
|
+
D(e);
|
|
10321
10335
|
e.g(b.substring(0, g));
|
|
10322
10336
|
b = h[A];
|
|
10323
10337
|
break a;
|
|
@@ -10325,204 +10339,204 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10325
10339
|
}
|
|
10326
10340
|
b = "";
|
|
10327
10341
|
}
|
|
10328
|
-
|
|
10342
|
+
b.length > 0 && t(f, 3, b);
|
|
10329
10343
|
g = T(a, c);
|
|
10330
|
-
b = new
|
|
10344
|
+
b = new C();
|
|
10331
10345
|
h = 0;
|
|
10332
10346
|
l = e.toString();
|
|
10333
10347
|
try {
|
|
10334
10348
|
h = fb(a, l, g, b, d, f);
|
|
10335
10349
|
} catch (ca) {
|
|
10336
|
-
if ("Invalid country calling code"
|
|
10337
|
-
if (l = l.replace(L, ""), h = fb(a, l, g, b, d, f),
|
|
10350
|
+
if (ca.message == "Invalid country calling code" && L.test(l)) {
|
|
10351
|
+
if (l = l.replace(L, ""), h = fb(a, l, g, b, d, f), h == 0) throw ca;
|
|
10338
10352
|
} else throw ca;
|
|
10339
10353
|
}
|
|
10340
|
-
|
|
10354
|
+
h != 0 ? (e = S(h), e != c && (g = R(a, h, e))) : (Wa(e), b.g(e.toString()), c != null ? (h = v(g, 10), t(
|
|
10341
10355
|
f,
|
|
10342
10356
|
1,
|
|
10343
10357
|
h
|
|
10344
10358
|
)) : d && (delete f.h[6], f.g && delete f.g[6]));
|
|
10345
|
-
if (
|
|
10346
|
-
|
|
10359
|
+
if (b.h.length < 2) throw Error("The string supplied is too short to be a phone number");
|
|
10360
|
+
g != null && (c = new C(), e = new C(b.toString()), gb(e, g, c), a = W(a, e.toString(), g, -1), a != 2 && a != 4 && a != 5 && (b = e, d && c.toString().length > 0 && t(f, 7, c.toString())));
|
|
10347
10361
|
d = b.toString();
|
|
10348
10362
|
a = d.length;
|
|
10349
|
-
if (
|
|
10350
|
-
if (
|
|
10351
|
-
if (
|
|
10363
|
+
if (a < 2) throw Error("The string supplied is too short to be a phone number");
|
|
10364
|
+
if (a > 17) throw Error("The string supplied is too long to be a phone number");
|
|
10365
|
+
if (d.length > 1 && d.charAt(0) == "0") {
|
|
10352
10366
|
t(f, 4, true);
|
|
10353
|
-
for (a = 1; a < d.length - 1 &&
|
|
10354
|
-
|
|
10367
|
+
for (a = 1; a < d.length - 1 && d.charAt(a) == "0"; ) a++;
|
|
10368
|
+
a != 1 && t(f, 8, a);
|
|
10355
10369
|
}
|
|
10356
10370
|
t(f, 2, parseInt(d, 10));
|
|
10357
10371
|
return f;
|
|
10358
10372
|
}
|
|
10359
10373
|
function N(a, b) {
|
|
10360
|
-
return (a = b.match(new RegExp("^(?:" + ("string"
|
|
10374
|
+
return (a = b.match(new RegExp("^(?:" + (typeof a == "string" ? a : a.source) + ")$", "i"))) && a[0].length == b.length ? true : false;
|
|
10361
10375
|
}
|
|
10362
10376
|
;
|
|
10363
10377
|
function ib(a) {
|
|
10364
|
-
this.
|
|
10365
|
-
this.
|
|
10366
|
-
this
|
|
10367
|
-
this.
|
|
10368
|
-
this.
|
|
10369
|
-
this.
|
|
10370
|
-
this.
|
|
10371
|
-
this.
|
|
10372
|
-
this.
|
|
10373
|
-
this
|
|
10374
|
-
this.h = new
|
|
10375
|
-
this.
|
|
10378
|
+
this.ga = RegExp("\u2008");
|
|
10379
|
+
this.ka = "";
|
|
10380
|
+
this.$ = new C();
|
|
10381
|
+
this.ea = "";
|
|
10382
|
+
this.u = new C();
|
|
10383
|
+
this.da = new C();
|
|
10384
|
+
this.v = true;
|
|
10385
|
+
this.fa = this.aa = this.ma = false;
|
|
10386
|
+
this.ha = K.g();
|
|
10387
|
+
this.ba = 0;
|
|
10388
|
+
this.h = new C();
|
|
10389
|
+
this.ia = false;
|
|
10376
10390
|
this.o = "";
|
|
10377
|
-
this.g = new
|
|
10391
|
+
this.g = new C();
|
|
10378
10392
|
this.j = [];
|
|
10379
|
-
this.
|
|
10380
|
-
this.l = jb(this, this.
|
|
10393
|
+
this.la = a;
|
|
10394
|
+
this.l = jb(this, this.la);
|
|
10381
10395
|
}
|
|
10382
10396
|
var kb = new H();
|
|
10383
10397
|
t(kb, 11, "NA");
|
|
10384
10398
|
var lb = 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]*)*$"), mb = /[- ]/;
|
|
10385
10399
|
function jb(a, b) {
|
|
10386
|
-
var c = a.
|
|
10400
|
+
var c = a.ha;
|
|
10387
10401
|
b = P(b) ? db(c, b) : 0;
|
|
10388
|
-
a = T(a.
|
|
10389
|
-
return
|
|
10402
|
+
a = T(a.ha, S(b));
|
|
10403
|
+
return a != null ? a : kb;
|
|
10390
10404
|
}
|
|
10391
10405
|
function nb(a) {
|
|
10392
10406
|
for (var b = a.j.length, c = 0; c < b; ++c) {
|
|
10393
|
-
var d = a.j[c], e =
|
|
10394
|
-
if (a.
|
|
10407
|
+
var d = a.j[c], e = v(d, 1);
|
|
10408
|
+
if (a.ea == e) return false;
|
|
10395
10409
|
var f = a;
|
|
10396
|
-
var g = d, h =
|
|
10397
|
-
|
|
10410
|
+
var g = d, h = v(g, 1);
|
|
10411
|
+
D(f.$);
|
|
10398
10412
|
var l = f;
|
|
10399
|
-
g =
|
|
10413
|
+
g = v(g, 2);
|
|
10400
10414
|
var A = "999999999999999".match(h)[0];
|
|
10401
10415
|
A.length < l.g.h.length ? l = "" : (l = A.replace(new RegExp(h, "g"), g), l = l.replace(RegExp("9", "g"), "\u2008"));
|
|
10402
|
-
|
|
10403
|
-
if (f) return a.
|
|
10416
|
+
l.length > 0 ? (f.$.g(l), f = true) : f = false;
|
|
10417
|
+
if (f) return a.ea = e, a.ia = mb.test(r(d, 4)), a.ba = 0, true;
|
|
10404
10418
|
}
|
|
10405
|
-
return a.
|
|
10419
|
+
return a.v = false;
|
|
10406
10420
|
}
|
|
10407
10421
|
function ob(a, b) {
|
|
10408
10422
|
for (var c = [], d = b.length - 3, e = a.j.length, f = 0; f < e; ++f) {
|
|
10409
10423
|
var g = a.j[f];
|
|
10410
|
-
|
|
10424
|
+
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]));
|
|
10411
10425
|
}
|
|
10412
10426
|
a.j = c;
|
|
10413
10427
|
}
|
|
10414
10428
|
function pb(a, b) {
|
|
10415
|
-
a.
|
|
10429
|
+
a.u.g(b);
|
|
10416
10430
|
var c = b;
|
|
10417
|
-
Ia.test(c) ||
|
|
10418
|
-
if (!a.
|
|
10419
|
-
if (!a.
|
|
10431
|
+
Ia.test(c) || a.u.h.length == 1 && Ha.test(c) ? (b == "+" ? (c = b, a.da.g(b)) : (c = Ea[b], a.da.g(c), a.g.g(c)), b = c) : (a.v = false, a.ma = true);
|
|
10432
|
+
if (!a.v) {
|
|
10433
|
+
if (!a.ma) {
|
|
10420
10434
|
if (qb(a)) {
|
|
10421
10435
|
if (rb(a)) return sb(a);
|
|
10422
|
-
} else if (
|
|
10436
|
+
} else if (a.o.length > 0 && (b = a.g.toString(), D(a.g), a.g.g(a.o), a.g.g(b), b = a.h.toString(), c = b.lastIndexOf(a.o), D(a.h), a.h.g(b.substring(0, c))), a.o != tb(a)) return a.h.g(" "), sb(a);
|
|
10423
10437
|
}
|
|
10424
|
-
return a.
|
|
10438
|
+
return a.u.toString();
|
|
10425
10439
|
}
|
|
10426
|
-
switch (a.
|
|
10440
|
+
switch (a.da.h.length) {
|
|
10427
10441
|
case 0:
|
|
10428
10442
|
case 1:
|
|
10429
10443
|
case 2:
|
|
10430
|
-
return a.
|
|
10444
|
+
return a.u.toString();
|
|
10431
10445
|
case 3:
|
|
10432
|
-
if (qb(a)) a.
|
|
10446
|
+
if (qb(a)) a.fa = true;
|
|
10433
10447
|
else return a.o = tb(a), ub(a);
|
|
10434
10448
|
default:
|
|
10435
|
-
if (a.
|
|
10436
|
-
if (
|
|
10449
|
+
if (a.fa) return rb(a) && (a.fa = false), a.h.toString() + a.g.toString();
|
|
10450
|
+
if (a.j.length > 0) {
|
|
10437
10451
|
b = vb(a, b);
|
|
10438
10452
|
c = wb(a);
|
|
10439
|
-
if (
|
|
10453
|
+
if (c.length > 0) return c;
|
|
10440
10454
|
ob(a, a.g.toString());
|
|
10441
|
-
return nb(a) ? xb(a) : a.
|
|
10455
|
+
return nb(a) ? xb(a) : a.v ? Z(a, b) : a.u.toString();
|
|
10442
10456
|
}
|
|
10443
10457
|
return ub(a);
|
|
10444
10458
|
}
|
|
10445
10459
|
}
|
|
10446
10460
|
function sb(a) {
|
|
10447
|
-
a.
|
|
10448
|
-
a.
|
|
10461
|
+
a.v = true;
|
|
10462
|
+
a.fa = false;
|
|
10449
10463
|
a.j = [];
|
|
10450
|
-
a
|
|
10451
|
-
|
|
10452
|
-
a.
|
|
10464
|
+
a.ba = 0;
|
|
10465
|
+
D(a.$);
|
|
10466
|
+
a.ea = "";
|
|
10453
10467
|
return ub(a);
|
|
10454
10468
|
}
|
|
10455
10469
|
function wb(a) {
|
|
10456
10470
|
for (var b = a.g.toString(), c = a.j.length, d = 0; d < c; ++d) {
|
|
10457
|
-
var e = a.j[d], f =
|
|
10458
|
-
if (new RegExp("^(?:" + f + ")$").test(b) && (a.
|
|
10471
|
+
var e = a.j[d], f = v(e, 1);
|
|
10472
|
+
if (new RegExp("^(?:" + f + ")$").test(b) && (a.ia = mb.test(r(e, 4)), e = b.replace(new RegExp(f, "g"), r(e, 2)), e = Z(a, e), O(e, Fa) == a.da)) return e;
|
|
10459
10473
|
}
|
|
10460
10474
|
return "";
|
|
10461
10475
|
}
|
|
10462
10476
|
function Z(a, b) {
|
|
10463
10477
|
var c = a.h.h.length;
|
|
10464
|
-
return a.
|
|
10478
|
+
return a.ia && c > 0 && a.h.toString().charAt(c - 1) != " " ? a.h + " " + b : a.h + b;
|
|
10465
10479
|
}
|
|
10466
10480
|
function ub(a) {
|
|
10467
10481
|
var b = a.g.toString();
|
|
10468
|
-
if (
|
|
10469
|
-
for (var c = a.
|
|
10482
|
+
if (b.length >= 3) {
|
|
10483
|
+
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) {
|
|
10470
10484
|
var f = c[e];
|
|
10471
|
-
|
|
10485
|
+
a.o.length > 0 && Ya(v(f, 4)) && !r(f, 6) && !q(f, 5) || (a.o.length != 0 || a.aa || Ya(v(f, 4)) || r(f, 6)) && lb.test(v(f, 2)) && a.j.push(f);
|
|
10472
10486
|
}
|
|
10473
10487
|
ob(a, b);
|
|
10474
10488
|
b = wb(a);
|
|
10475
|
-
return
|
|
10489
|
+
return b.length > 0 ? b : nb(a) ? xb(a) : a.u.toString();
|
|
10476
10490
|
}
|
|
10477
10491
|
return Z(a, b);
|
|
10478
10492
|
}
|
|
10479
10493
|
function xb(a) {
|
|
10480
10494
|
var b = a.g.toString(), c = b.length;
|
|
10481
|
-
if (
|
|
10495
|
+
if (c > 0) {
|
|
10482
10496
|
for (var d = "", e = 0; e < c; e++) d = vb(a, b.charAt(e));
|
|
10483
|
-
return a.
|
|
10497
|
+
return a.v ? Z(a, d) : a.u.toString();
|
|
10484
10498
|
}
|
|
10485
10499
|
return a.h.toString();
|
|
10486
10500
|
}
|
|
10487
10501
|
function tb(a) {
|
|
10488
10502
|
var b = a.g.toString(), c = 0;
|
|
10489
|
-
if (
|
|
10490
|
-
else d = a.g.toString(), d =
|
|
10491
|
-
d ? (c = 1, a.h.g("1").g(" "), a.
|
|
10492
|
-
|
|
10503
|
+
if (r(a.l, 10) != 1) var d = false;
|
|
10504
|
+
else d = a.g.toString(), d = d.charAt(0) == "1" && d.charAt(1) != "0" && d.charAt(1) != "1";
|
|
10505
|
+
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))));
|
|
10506
|
+
D(a.g);
|
|
10493
10507
|
a.g.g(b.substring(c));
|
|
10494
10508
|
return b.substring(0, c);
|
|
10495
10509
|
}
|
|
10496
10510
|
function qb(a) {
|
|
10497
|
-
var b = a.
|
|
10511
|
+
var b = a.da.toString(), c = new RegExp("^(?:\\+|" + r(a.l, 11) + ")");
|
|
10498
10512
|
c = b.match(c);
|
|
10499
|
-
return
|
|
10513
|
+
return c != null && c[0] != null && c[0].length > 0 ? (a.aa = true, c = c[0].length, D(a.g), a.g.g(b.substring(c)), D(a.h), a.h.g(b.substring(0, c)), b.charAt(0) != "+" && a.h.g(" "), true) : false;
|
|
10500
10514
|
}
|
|
10501
10515
|
function rb(a) {
|
|
10502
|
-
if (
|
|
10503
|
-
var b = new
|
|
10504
|
-
if (
|
|
10505
|
-
|
|
10516
|
+
if (a.g.h.length == 0) return false;
|
|
10517
|
+
var b = new C(), c = eb(a.g, b);
|
|
10518
|
+
if (c == 0) return false;
|
|
10519
|
+
D(a.g);
|
|
10506
10520
|
a.g.g(b.toString());
|
|
10507
10521
|
b = S(c);
|
|
10508
|
-
"001" == b ? a.l = T(a.
|
|
10522
|
+
"001" == b ? a.l = T(a.ha, "" + c) : b != a.la && (a.l = jb(a, b));
|
|
10509
10523
|
a.h.g("" + c).g(" ");
|
|
10510
10524
|
a.o = "";
|
|
10511
10525
|
return true;
|
|
10512
10526
|
}
|
|
10513
10527
|
function vb(a, b) {
|
|
10514
|
-
var c = a
|
|
10515
|
-
if (
|
|
10516
|
-
var d = c.search(a.
|
|
10517
|
-
b = c.replace(a.
|
|
10518
|
-
|
|
10519
|
-
a
|
|
10520
|
-
a
|
|
10521
|
-
return b.substring(0, a
|
|
10522
|
-
}
|
|
10523
|
-
|
|
10524
|
-
a.
|
|
10525
|
-
return a.
|
|
10528
|
+
var c = a.$.toString();
|
|
10529
|
+
if (c.substring(a.ba).search(a.ga) >= 0) {
|
|
10530
|
+
var d = c.search(a.ga);
|
|
10531
|
+
b = c.replace(a.ga, b);
|
|
10532
|
+
D(a.$);
|
|
10533
|
+
a.$.g(b);
|
|
10534
|
+
a.ba = d;
|
|
10535
|
+
return b.substring(0, a.ba + 1);
|
|
10536
|
+
}
|
|
10537
|
+
a.j.length == 1 && (a.v = false);
|
|
10538
|
+
a.ea = "";
|
|
10539
|
+
return a.u.toString();
|
|
10526
10540
|
}
|
|
10527
10541
|
;
|
|
10528
10542
|
const yb = (a) => {
|
|
@@ -10530,27 +10544,27 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10530
10544
|
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");
|
|
10531
10545
|
return a.concat(b);
|
|
10532
10546
|
}, zb = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
|
|
10533
|
-
m("
|
|
10534
|
-
m("
|
|
10547
|
+
m("utils", {});
|
|
10548
|
+
m("utils.formatNumberAsYouType", (a, b) => {
|
|
10535
10549
|
try {
|
|
10536
10550
|
const c = a.replace(/[^+0-9]/g, ""), d = new ib(b);
|
|
10537
10551
|
b = "";
|
|
10538
|
-
for (let e = 0; e < c.length; e++) d.
|
|
10552
|
+
for (let e = 0; e < c.length; e++) d.ka = pb(d, c.charAt(e)), b = d.ka;
|
|
10539
10553
|
return b;
|
|
10540
10554
|
} catch {
|
|
10541
10555
|
return a;
|
|
10542
10556
|
}
|
|
10543
10557
|
});
|
|
10544
|
-
m("
|
|
10558
|
+
m("utils.formatNumber", (a, b, c) => {
|
|
10545
10559
|
try {
|
|
10546
10560
|
const e = K.g(), f = Y(e, a, b);
|
|
10547
10561
|
var d = X(e, f, -1);
|
|
10548
|
-
return
|
|
10562
|
+
return d == 0 || d == 4 ? e.format(f, typeof c === "undefined" ? 0 : c) : a;
|
|
10549
10563
|
} catch {
|
|
10550
10564
|
return a;
|
|
10551
10565
|
}
|
|
10552
10566
|
});
|
|
10553
|
-
m("
|
|
10567
|
+
m("utils.getExampleNumber", (a, b, c, d) => {
|
|
10554
10568
|
try {
|
|
10555
10569
|
const l = K.g();
|
|
10556
10570
|
a: {
|
|
@@ -10573,14 +10587,15 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10573
10587
|
return "";
|
|
10574
10588
|
}
|
|
10575
10589
|
});
|
|
10576
|
-
m("
|
|
10590
|
+
m("utils.getExtension", (a, b) => {
|
|
10577
10591
|
try {
|
|
10578
|
-
|
|
10592
|
+
var c = Y(K.g(), a, b);
|
|
10593
|
+
return r(c, 3);
|
|
10579
10594
|
} catch {
|
|
10580
10595
|
return "";
|
|
10581
10596
|
}
|
|
10582
10597
|
});
|
|
10583
|
-
m("
|
|
10598
|
+
m("utils.getNumberType", (a, b) => {
|
|
10584
10599
|
try {
|
|
10585
10600
|
const c = K.g(), d = Y(c, a, b);
|
|
10586
10601
|
return $a(c, d);
|
|
@@ -10588,16 +10603,16 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10588
10603
|
return -99;
|
|
10589
10604
|
}
|
|
10590
10605
|
});
|
|
10591
|
-
m("
|
|
10606
|
+
m("utils.getValidationError", (a, b) => {
|
|
10592
10607
|
if (!b) return 1;
|
|
10593
10608
|
try {
|
|
10594
10609
|
const c = K.g(), d = Y(c, a, b);
|
|
10595
10610
|
return X(c, d, -1);
|
|
10596
10611
|
} catch (c) {
|
|
10597
|
-
return "Invalid country calling code"
|
|
10612
|
+
return c.message === "Invalid country calling code" ? 1 : a.length <= 3 || c.message === "Phone number too short after IDD" || c.message === "The string supplied is too short to be a phone number" ? 2 : c.message === "The string supplied is too long to be a phone number" ? 3 : -99;
|
|
10598
10613
|
}
|
|
10599
10614
|
});
|
|
10600
|
-
m("
|
|
10615
|
+
m("utils.isValidNumber", (a, b, c) => {
|
|
10601
10616
|
try {
|
|
10602
10617
|
const d = K.g(), e = Y(d, a, b), f = cb(d, e);
|
|
10603
10618
|
if (c) {
|
|
@@ -10609,40 +10624,34 @@ var intl_tel_input_default = intlTelInput;
|
|
|
10609
10624
|
return false;
|
|
10610
10625
|
}
|
|
10611
10626
|
});
|
|
10612
|
-
m("
|
|
10627
|
+
m("utils.isPossibleNumber", (a, b, c) => {
|
|
10613
10628
|
try {
|
|
10614
10629
|
const d = K.g(), e = Y(d, a, b);
|
|
10615
10630
|
if (c) {
|
|
10616
10631
|
const f = yb(c);
|
|
10617
|
-
for (let g of f) if (
|
|
10632
|
+
for (let g of f) if (X(d, e, zb[g]) === 0) return true;
|
|
10618
10633
|
return false;
|
|
10619
10634
|
}
|
|
10620
|
-
return
|
|
10635
|
+
return X(d, e, -1) === 0;
|
|
10621
10636
|
} catch {
|
|
10622
10637
|
return false;
|
|
10623
10638
|
}
|
|
10624
10639
|
});
|
|
10625
|
-
m("
|
|
10640
|
+
m("utils.getCoreNumber", (a, b) => {
|
|
10626
10641
|
try {
|
|
10627
|
-
|
|
10642
|
+
var c = Y(K.g(), a, b);
|
|
10643
|
+
return r(c, 2).toString();
|
|
10628
10644
|
} catch {
|
|
10629
10645
|
return "";
|
|
10630
10646
|
}
|
|
10631
10647
|
});
|
|
10632
|
-
m("
|
|
10633
|
-
m("
|
|
10634
|
-
m("
|
|
10635
|
-
})();
|
|
10636
|
-
var
|
|
10637
|
-
var utils = globalContext.intlTelInputUtilsTemp;
|
|
10638
|
-
delete globalContext.intlTelInputUtilsTemp;
|
|
10639
|
-
var utils_default = utils;
|
|
10640
|
-
|
|
10641
|
-
// src/js/intl-tel-input/intlTelInputWithUtils.ts
|
|
10642
|
-
intl_tel_input_default.utils = utils_default;
|
|
10643
|
-
var intlTelInputWithUtils_default = intl_tel_input_default;
|
|
10648
|
+
m("utils.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 });
|
|
10649
|
+
m("utils.numberType", zb);
|
|
10650
|
+
m("utils.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
10651
|
+
}).call(_scope);
|
|
10652
|
+
var utils_default = _scope.utils;
|
|
10644
10653
|
|
|
10645
|
-
// react/src/
|
|
10654
|
+
// react/src/IntlTelInput.tsx
|
|
10646
10655
|
import React, {
|
|
10647
10656
|
useRef,
|
|
10648
10657
|
useEffect,
|
|
@@ -10650,27 +10659,29 @@ import React, {
|
|
|
10650
10659
|
useImperativeHandle,
|
|
10651
10660
|
useCallback
|
|
10652
10661
|
} from "react";
|
|
10662
|
+
var warnInputProp = (prop) => {
|
|
10663
|
+
console.warn(`intl-tel-input: ignoring inputProps.${prop} - see docs for more info.`);
|
|
10664
|
+
};
|
|
10665
|
+
var noop = () => {
|
|
10666
|
+
};
|
|
10653
10667
|
var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
},
|
|
10659
|
-
onChangeValidity = () => {
|
|
10660
|
-
},
|
|
10661
|
-
onChangeErrorCode = () => {
|
|
10662
|
-
},
|
|
10668
|
+
onChangeNumber = noop,
|
|
10669
|
+
onChangeCountry = noop,
|
|
10670
|
+
onChangeValidity = noop,
|
|
10671
|
+
onChangeErrorCode = noop,
|
|
10663
10672
|
usePreciseValidation = false,
|
|
10664
|
-
initOptions = {},
|
|
10665
10673
|
inputProps = {},
|
|
10666
|
-
disabled = void 0
|
|
10674
|
+
disabled = void 0,
|
|
10675
|
+
readOnly = void 0,
|
|
10676
|
+
value = void 0,
|
|
10677
|
+
...initOptions
|
|
10667
10678
|
}, ref) {
|
|
10668
10679
|
const inputRef = useRef(null);
|
|
10669
10680
|
const itiRef = useRef(null);
|
|
10670
|
-
const lastEmittedNumberRef = useRef();
|
|
10671
|
-
const lastEmittedCountryRef = useRef();
|
|
10672
|
-
const lastEmittedValidityRef = useRef();
|
|
10673
|
-
const lastEmittedErrorCodeRef = useRef();
|
|
10681
|
+
const lastEmittedNumberRef = useRef(void 0);
|
|
10682
|
+
const lastEmittedCountryRef = useRef(void 0);
|
|
10683
|
+
const lastEmittedValidityRef = useRef(void 0);
|
|
10684
|
+
const lastEmittedErrorCodeRef = useRef(void 0);
|
|
10674
10685
|
useImperativeHandle(ref, () => ({
|
|
10675
10686
|
getInstance: () => itiRef.current,
|
|
10676
10687
|
getInput: () => inputRef.current
|
|
@@ -10679,8 +10690,8 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
10679
10690
|
if (!itiRef.current?.isActive()) {
|
|
10680
10691
|
return;
|
|
10681
10692
|
}
|
|
10682
|
-
const num = itiRef.current
|
|
10683
|
-
const countryIso = itiRef.current
|
|
10693
|
+
const num = itiRef.current.getNumber() ?? "";
|
|
10694
|
+
const countryIso = itiRef.current.getSelectedCountryData()?.iso2 ?? "";
|
|
10684
10695
|
if (num !== lastEmittedNumberRef.current) {
|
|
10685
10696
|
lastEmittedNumberRef.current = num;
|
|
10686
10697
|
onChangeNumber(num);
|
|
@@ -10689,17 +10700,15 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
10689
10700
|
lastEmittedCountryRef.current = countryIso;
|
|
10690
10701
|
onChangeCountry(countryIso);
|
|
10691
10702
|
}
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
onChangeErrorCode(errorCode);
|
|
10702
|
-
}
|
|
10703
|
+
const isValid = (usePreciseValidation ? itiRef.current.isValidNumberPrecise() : itiRef.current.isValidNumber()) ?? false;
|
|
10704
|
+
const errorCode = isValid ? null : itiRef.current.getValidationError();
|
|
10705
|
+
if (isValid !== lastEmittedValidityRef.current) {
|
|
10706
|
+
lastEmittedValidityRef.current = isValid;
|
|
10707
|
+
onChangeValidity(isValid);
|
|
10708
|
+
}
|
|
10709
|
+
if (errorCode !== lastEmittedErrorCodeRef.current) {
|
|
10710
|
+
lastEmittedErrorCodeRef.current = errorCode;
|
|
10711
|
+
onChangeErrorCode(errorCode);
|
|
10703
10712
|
}
|
|
10704
10713
|
}, [
|
|
10705
10714
|
onChangeCountry,
|
|
@@ -10710,7 +10719,7 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
10710
10719
|
]);
|
|
10711
10720
|
useEffect(() => {
|
|
10712
10721
|
if (inputRef.current) {
|
|
10713
|
-
itiRef.current =
|
|
10722
|
+
itiRef.current = intl_tel_input_default(inputRef.current, initOptions);
|
|
10714
10723
|
}
|
|
10715
10724
|
return () => {
|
|
10716
10725
|
itiRef.current?.destroy();
|
|
@@ -10720,7 +10729,7 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
10720
10729
|
const inputRefCurrent = inputRef.current;
|
|
10721
10730
|
if (inputRefCurrent) {
|
|
10722
10731
|
inputRefCurrent.addEventListener("countrychange", update);
|
|
10723
|
-
itiRef.current
|
|
10732
|
+
itiRef.current?.promise.then(update);
|
|
10724
10733
|
}
|
|
10725
10734
|
return () => {
|
|
10726
10735
|
if (inputRefCurrent) {
|
|
@@ -10733,24 +10742,53 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
|
10733
10742
|
itiRef.current.setDisabled(disabled);
|
|
10734
10743
|
}
|
|
10735
10744
|
}, [disabled]);
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
}
|
|
10745
|
+
useEffect(() => {
|
|
10746
|
+
if (itiRef.current && readOnly !== void 0) {
|
|
10747
|
+
itiRef.current.setReadonly(readOnly);
|
|
10748
|
+
}
|
|
10749
|
+
}, [readOnly]);
|
|
10750
|
+
useEffect(() => {
|
|
10751
|
+
if (!itiRef.current || value === void 0) {
|
|
10752
|
+
return;
|
|
10753
|
+
}
|
|
10754
|
+
itiRef.current.promise.then(() => {
|
|
10755
|
+
if (!itiRef.current?.isActive()) {
|
|
10756
|
+
return;
|
|
10757
|
+
}
|
|
10758
|
+
const next = value ?? "";
|
|
10759
|
+
const currentCanonical = itiRef.current.getNumber() ?? "";
|
|
10760
|
+
const isFocused = document.activeElement === inputRef.current;
|
|
10761
|
+
if (isFocused || currentCanonical === next) {
|
|
10762
|
+
return;
|
|
10763
|
+
}
|
|
10764
|
+
itiRef.current.setNumber(next);
|
|
10765
|
+
update();
|
|
10766
|
+
});
|
|
10767
|
+
}, [value, update]);
|
|
10768
|
+
const ignoredInputProps = /* @__PURE__ */ new Set(["type", "ref", "value", "disabled", "readOnly", "onInput"]);
|
|
10769
|
+
const sanitizedInputProps = {};
|
|
10770
|
+
for (const [key, val] of Object.entries(inputProps)) {
|
|
10771
|
+
if (ignoredInputProps.has(key)) {
|
|
10772
|
+
warnInputProp(key);
|
|
10773
|
+
} else {
|
|
10774
|
+
sanitizedInputProps[key] = val;
|
|
10775
|
+
}
|
|
10776
|
+
}
|
|
10741
10777
|
return /* @__PURE__ */ React.createElement(
|
|
10742
10778
|
"input",
|
|
10743
10779
|
{
|
|
10744
10780
|
...sanitizedInputProps,
|
|
10745
10781
|
type: "tel",
|
|
10746
10782
|
ref: inputRef,
|
|
10747
|
-
onInput: update
|
|
10748
|
-
defaultValue: initialValue
|
|
10783
|
+
onInput: update
|
|
10749
10784
|
}
|
|
10750
10785
|
);
|
|
10751
10786
|
});
|
|
10752
|
-
var
|
|
10787
|
+
var IntlTelInput_default = IntlTelInput;
|
|
10788
|
+
|
|
10789
|
+
// react/src/IntlTelInputWithUtils.tsx
|
|
10790
|
+
intl_tel_input_default.utils = utils_default;
|
|
10753
10791
|
export {
|
|
10754
|
-
|
|
10755
|
-
|
|
10792
|
+
IntlTelInput_default as default,
|
|
10793
|
+
intl_tel_input_default as intlTelInput
|
|
10756
10794
|
};
|