intl-tel-input 26.0.4 → 26.0.5
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/README.md +5 -5
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +1 -1
- package/angular/build/IntlTelInputWithUtils.js +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +2 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +2 -2
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +1 -1
- package/react/build/IntlTelInput.js +1 -1
- package/react/build/IntlTelInputWithUtils.cjs +1 -1
- package/react/build/IntlTelInputWithUtils.js +1 -1
- package/svelte/README.md +1 -1
- package/svelte/build/IntlTelInput.mjs +1 -1
- package/svelte/build/IntlTelInputWithUtils.mjs +1 -1
- package/vue/README.md +1 -1
- package/vue/build/exports/IntlTelInput.mjs +1 -1
- package/vue/build/exports/IntlTelInputWithUtils.mjs +1 -1
- package/vue/build/{intl-tel-input-UemlYcBr.mjs → intl-tel-input-D-7G5iQL.mjs} +1 -1
package/README.md
CHANGED
|
@@ -83,16 +83,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
83
83
|
## Getting Started (Using a CDN)
|
|
84
84
|
1. Add the CSS
|
|
85
85
|
```html
|
|
86
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.
|
|
86
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.5/build/css/intlTelInput.css">
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
2. Add the plugin script and initialise it on your input element
|
|
90
90
|
```html
|
|
91
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.
|
|
91
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.5/build/js/intlTelInput.min.js"></script>
|
|
92
92
|
<script>
|
|
93
93
|
const input = document.querySelector("#phone");
|
|
94
94
|
window.intlTelInput(input, {
|
|
95
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.
|
|
95
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.5/build/js/utils.js"),
|
|
96
96
|
});
|
|
97
97
|
</script>
|
|
98
98
|
```
|
|
@@ -324,12 +324,12 @@ Set the initial country selection by specifying its country code, e.g. `"us"` fo
|
|
|
324
324
|
Type: `() => Promise<module>` Default: `null`
|
|
325
325
|
This is one way to lazy load the included utils.js (to enable formatting/validation, etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options.
|
|
326
326
|
|
|
327
|
-
The `loadUtils` option takes a function that returns a Promise resolving to the utils module. You can `import` the utils module in different ways (examples below): (A) from a CDN, (B) from your own hosted version of [utils.js](https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.
|
|
327
|
+
The `loadUtils` option takes a function that returns a Promise resolving to the utils module. You can `import` the utils module in different ways (examples below): (A) from a CDN, (B) from your own hosted version of [utils.js](https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.5/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package. _Note: this replaces the `utilsScript` option (now removed)._
|
|
328
328
|
|
|
329
329
|
```js
|
|
330
330
|
// (A) import utils module from a CDN
|
|
331
331
|
intlTelInput(htmlInputElement, {
|
|
332
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.
|
|
332
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.5/build/js/utils.js"),
|
|
333
333
|
});
|
|
334
334
|
|
|
335
335
|
// (B) import utils module from your own hosted version of utils.js
|
package/angular/README.md
CHANGED
|
@@ -54,7 +54,7 @@ import "intl-tel-input/styles";
|
|
|
54
54
|
|
|
55
55
|
See the [validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/validation/validation.component.ts) for a more fleshed-out example of how to handle validation, or check out the [form demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/form/form.component.ts) for an alternative approach using `ReactiveFormsModule`.
|
|
56
56
|
|
|
57
|
-
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just `import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.
|
|
57
|
+
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just `import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@26.0.5/build/js/utils.js"`.
|
|
58
58
|
|
|
59
59
|
## Props
|
|
60
60
|
|
|
@@ -3639,7 +3639,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3639
3639
|
attachUtils,
|
|
3640
3640
|
startedLoadingUtilsScript: false,
|
|
3641
3641
|
startedLoadingAutoCountry: false,
|
|
3642
|
-
version: "26.0.
|
|
3642
|
+
version: "26.0.5"
|
|
3643
3643
|
});
|
|
3644
3644
|
var intl_tel_input_default = intlTelInput;
|
|
3645
3645
|
|
|
@@ -3639,7 +3639,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3639
3639
|
attachUtils,
|
|
3640
3640
|
startedLoadingUtilsScript: false,
|
|
3641
3641
|
startedLoadingAutoCountry: false,
|
|
3642
|
-
version: "26.0.
|
|
3642
|
+
version: "26.0.5"
|
|
3643
3643
|
});
|
|
3644
3644
|
var intl_tel_input_default = intlTelInput;
|
|
3645
3645
|
|
package/build/js/data.js
CHANGED
package/build/js/data.min.js
CHANGED
package/build/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v26.0.
|
|
2
|
+
* International Telephone Input v26.0.5
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -3871,7 +3871,7 @@ var factoryOutput = (() => {
|
|
|
3871
3871
|
attachUtils,
|
|
3872
3872
|
startedLoadingUtilsScript: false,
|
|
3873
3873
|
startedLoadingAutoCountry: false,
|
|
3874
|
-
version: "26.0.
|
|
3874
|
+
version: "26.0.5"
|
|
3875
3875
|
}
|
|
3876
3876
|
);
|
|
3877
3877
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v26.0.
|
|
2
|
+
* International Telephone Input v26.0.5
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -28,7 +28,7 @@ var factoryOutput=(()=>{var F=Object.defineProperty;var Ct=Object.getOwnProperty
|
|
|
28
28
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
29
29
|
<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"/>
|
|
30
30
|
<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"/>
|
|
31
|
-
</svg>`;var P=class{constructor(t,e,i){this.highlightedItem=null;this.selectedItem=null;t.dataset.intlTelInputId=i.toString(),this.telInput=t,this.options=e,this.id=i,this.a=!!t.getAttribute("placeholder"),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.o=this.telInput.style.paddingLeft)}generateMarkup(t){this.countries=t,this.telInput.classList.add("iti__tel-input");let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_au(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:s}=this.options,n=k({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!s,[i]:!!i}),o=C("div",{class:n});return this.isRTL&&o.setAttribute("dir","ltr"),this.telInput.before(o),o}_av(t){let{allowDropdown:e,separateDialCode:i,showFlags:s}=this.options;if(e||s||i){this.countryContainer=C("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=C("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.options.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.id}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=C("div",{class:"iti__selected-country"},this.countryContainer);let n=C("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=C("div",{class:h.FLAG},n),e&&(this.dropdownArrow=C("div",{class:"iti__arrow",[p.HIDDEN]:"true"},n)),i&&(this.selectedDialCode=C("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:s,dropdownContainer:n,containerClass:o}=this.options,l=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=C("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${l}`,role:"dialog",[p.MODAL]:"true"}),this.isRTL&&this.dropdownContent.setAttribute("dir","rtl"),i&&this._ax(),this.countryList=C("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:s.countryListAriaLabel},this.dropdownContent),this._ba(),i&&this.updateSearchResultsA11yText(),n){let a=k({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[o]:!!o});this.dropdown=C("div",{class:a}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t}=this.options,e=C("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=C("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},e),this.searchIcon.innerHTML=nt(),this.searchInput=C("input",{id:`iti-${this.id}__search-input`,type:"search",class:"iti__search-input",placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.id}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},e),this.k=C("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},e),this.k.innerHTML=ot(this.id),this.l=C("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=C("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.dropdownContent),this.searchNoResults.textContent=t.searchEmptyState}_ay(){this.countryContainer&&(this.updateInputPadding(),this.countryContainer.classList.remove(h.V_HIDE))}_az(t){let{hiddenInput:e}=this.options;if(e){let i=this.telInput.getAttribute("name")||"",s=e(i);if(s.phone){let n=this.telInput.form?.querySelector(`input[name="${s.phone}"]`);n?this.hiddenInput=n:(this.hiddenInput=C("input",{type:"hidden",name:s.phone}),t.appendChild(this.hiddenInput))}if(s.country){let n=this.telInput.form?.querySelector(`input[name="${s.country}"]`);n?this.m=n:(this.m=C("input",{type:"hidden",name:s.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let i=this.countries[e],s=k({[h.COUNTRY_ITEM]:!0}),n=C("li",{id:`iti-${this.id}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[p.SELECTED]:"false"});n.dataset.dialCode=i.dialCode,n.dataset.countryCode=i.iso2,i.nodeById[this.id]=n,this.options.showFlags&&C("div",{class:`${h.FLAG} iti__${i.iso2}`},n);let o=C("span",{class:"iti__country-name"},n);o.textContent=i.name;let l=C("span",{class:"iti__dial-code"},n);this.isRTL&&l.setAttribute("dir","ltr"),l.textContent=`+${i.dialCode}`,t.appendChild(n)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?x.SANE_SELECTED_WITH_DIAL_WIDTH:x.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+x.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${i}px`}}_bb(){if(this.telInput.parentNode){let t;try{t=window.top.document.body}catch{t=document.body}let e=this.telInput.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.countryContainer.cloneNode();e.appendChild(i);let s=this.selectedCountry.cloneNode(!0);i.appendChild(s);let n=s.offsetWidth;return t.removeChild(e),n}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount;this.l.textContent=t.searchSummaryAria(e)}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,s=e.offsetHeight,n=e.getBoundingClientRect().top+i,o=n+s,l=t.offsetHeight,a=t.getBoundingClientRect().top+i,d=a+l,c=a-n+e.scrollTop;if(a<n)e.scrollTop=c;else if(d>o){let m=s-l;e.scrollTop=c-m}}highlightListItem(t,e){let i=this.highlightedItem;if(i&&i.classList.remove(h.HIGHLIGHT),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.options.countrySearch)){let s=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,s)}e&&this.highlightedItem.focus()}updateSelectedItem(t){if(this.selectedItem&&this.selectedItem.dataset.countryCode!==t&&(this.selectedItem.setAttribute(p.SELECTED,"false"),this.selectedItem=null),t&&!this.selectedItem){let e=this.countryList.querySelector(`[data-country-code="${t}"]`);e&&(e.setAttribute(p.SELECTED,"true"),this.selectedItem=e)}}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let i of t){let s=i.nodeById[this.id];s&&(this.countryList.appendChild(s),e&&(this.highlightListItem(s,!1),e=!1))}e?(this.highlightListItem(null,!1),this.searchNoResults&&this.searchNoResults.classList.remove(h.HIDE)):this.searchNoResults&&this.searchNoResults.classList.add(h.HIDE),this.countryList.scrollTop=0,this.updateSearchResultsA11yText()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.options.separateDialCode&&(this.telInput.style.paddingLeft=this.o);let t=this.telInput.parentNode;t.before(this.telInput),t.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.selectedDialCode=null,this.dropdownArrow=null,this.dropdownContent=null,this.searchInput=null,this.searchIcon=null,this.k=null,this.searchNoResults=null,this.l=null,this.countryList=null,this.dropdown=null,this.hiddenInput=null,this.m=null,this.highlightedItem=null,this.selectedItem=null;for(let e of this.countries)delete e.nodeById[this.id];this.countries=null}};var rt=r=>{let{onlyCountries:t,excludeCountries:e}=r;if(t.length){let i=t.map(s=>s.toLowerCase());return w.filter(s=>i.includes(s.iso2))}else if(e.length){let i=e.map(s=>s.toLowerCase());return w.filter(s=>!i.includes(s.iso2))}return w},lt=(r,t)=>{let{countryNameLocale:e,i18n:i}=t,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(e,{type:"region"}):s=null}catch(n){console.error(n),s=null}for(let n of r)n.name=i[n.iso2]||s?.of(n.iso2.toUpperCase())||""},at=r=>{let t=new Set,e=0,i={},s=(o,l)=>{if(!o||!l)return;l.length>e&&(e=l.length),i.hasOwnProperty(l)||(i[l]=[]);let a=i[l];a.includes(o)||a.push(o)},n=[...r].sort((o,l)=>o.priority-l.priority);for(let o of n){t.has(o.dialCode)||t.add(o.dialCode);for(let l=1;l<o.dialCode.length;l++){let a=o.dialCode.substring(0,l);s(o.iso2,a)}if(s(o.iso2,o.dialCode),o.areaCodes){let l=i[o.dialCode][0];for(let a of o.areaCodes){for(let d=1;d<a.length;d++){let c=a.substring(0,d),m=o.dialCode+c;s(l,m),s(o.iso2,m)}s(o.iso2,o.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLen:e,dialCodeToIso2Map:i}},ut=(r,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),r.sort((e,i)=>{let{countryOrder:s}=t;if(s){let n=s.indexOf(e.iso2),o=s.indexOf(i.iso2),l=n>-1,a=o>-1;if(l||a)return l&&a?n-o:l?-1:1}return e.name.localeCompare(i.name)})},dt=r=>{for(let t of r)t.normalisedName=U(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var z=(r,t,e,i)=>{let s=r;if(e&&t){let n=`+${i.dialCode}`,o=s[n.length]===" "||s[n.length]==="-"?n.length+1:n.length;s=s.substring(o)}return s},ct=(r,t,e,i,s)=>{let n=e?e.formatNumberAsYouType(r,i.iso2):r,{dialCode:o}=i;return s&&t.charAt(0)!=="+"&&n.includes(`+${o}`)?(n.split(`+${o}`)[1]||"").trim():n};var ht=(r,t,e,i)=>{if(e===0&&!i)return 0;let s=0;for(let n=0;n<t.length;n++){if(/[+0-9]/.test(t[n])&&s++,s===r&&!i)return n+1;if(i&&s===r+1)return n}return t.length};var Lt=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],X=r=>{let t=T(r);if(t.startsWith(M.NANP)&&t.length>=4){let e=t.substring(1,4);return Lt.includes(e)}return!1};var vt=0,Nt=new Set(w.map(r=>r.iso2)),q=r=>Nt.has(r),B=class r{constructor(t,e={}){this.id=vt++,this.options={...Y,...e},et(this.options),this.ui=new P(t,this.options,this.id),this.i=r._b(),this.promise=this._c(),this.countries=rt(this.options);let{dialCodes:i,dialCodeMaxLen:s,dialCodeToIso2Map:n}=at(this.countries);this.dialCodes=i,this.dialCodeMaxLen=s,this.dialCodeToIso2Map=n,this.j=new Map(this.countries.map(o=>[o.iso2,o])),this._init()}static _b(){return typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1}_updateNumeralSet(t){/[\u0660-\u0669]/.test(t)?this.userNumeralSet="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.userNumeralSet="persian":this.userNumeralSet="ascii"}_mapAsciiToUserNumerals(t){if(this.userNumeralSet||this._updateNumeralSet(this.ui.telInput.value),this.userNumeralSet==="ascii")return t;let e=this.userNumeralSet==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,i=>String.fromCharCode(e+Number(i)))}_normaliseNumerals(t){if(!t)return"";if(this._updateNumeralSet(t),this.userNumeralSet==="ascii")return t;let e=this.userNumeralSet==="arabic-indic"?1632:1776,i=this.userNumeralSet==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace(i,s=>String.fromCharCode(48+(s.charCodeAt(0)-e)))}_getTelInputValue(){let t=this.ui.telInput.value.trim();return this._normaliseNumerals(t)}_setTelInputValue(t){this.ui.telInput.value=this._mapAsciiToUserNumerals(t)}_c(){let t=new Promise((i,s)=>{this.b=i,this.c=s}),e=new Promise((i,s)=>{this.d=i,this.e=s});return Promise.all([t,e])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h()}_a(){lt(this.countries,this.options),ut(this.countries,this.options),dt(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),i=this._normaliseNumerals(e),s=this._getTelInputValue(),o=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,l=this._ao(o),a=X(o),{initialCountry:d,geoIpLookup:c}=this.options,m=d===R.AUTO&&c;if(l&&!a)this._ai(o);else if(!m||t){let I=d?d.toLowerCase():"";q(I)?this._aj(I):l&&a?this._aj(J.ISO2):this._aj("")}o&&this._ah(o)}_e(){this._j(),this.options.allowDropdown&&this._g(),(this.ui.hiddenInput||this.ui.m)&&this.ui.telInput.form&&this._f()}_f(){let t=()=>{this.ui.hiddenInput&&(this.ui.hiddenInput.value=this.getNumber()),this.ui.m&&(this.ui.m.value=this.selectedCountryData.iso2||"")};this.ui.telInput.form?.addEventListener("submit",t,{signal:this.g.signal})}_g(){let t=this.g.signal,e=o=>{this.ui.dropdownContent.classList.contains(h.HIDE)?this.ui.telInput.focus():o.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let s=()=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",s,{signal:t});let n=o=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&[f.ARROW_UP,f.ARROW_DOWN,f.SPACE,f.ENTER].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),this._l()),o.key===f.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",n,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!u.utils){let n=()=>{u.attachUtils(t)?.catch(()=>{})};if(u.documentReady())n();else{let o=()=>{n()};window.addEventListener("load",o,{signal:this.g.signal})}}else this.d();e===R.AUTO&&i&&!this.selectedCountryData.iso2?this._i():this.b()}_i(){u.autoCountry?this.handleAutoCountry():u.startedLoadingAutoCountry||(u.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();q(e)?(u.autoCountry=e,setTimeout(()=>O("handleAutoCountry"))):(this._d(!0),O("rejectAutoCountryPromise"))},()=>{this._d(!0),O("rejectAutoCountryPromise")}))}_m(){this._l(),this.ui.searchInput.value="+",this._ae("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:s,countrySearch:n}=this.options,o=!1;N.ALPHA_UNICODE.test(this._getTelInputValue())&&(o=!0);let l=a=>{let d=this._getTelInputValue();if(this.i&&a?.data==="+"&&i&&s&&n){let g=this.ui.telInput.selectionStart||0,E=d.substring(0,g-1),_=d.substring(g);this._setTelInputValue(E+_),this._m();return}this._ai(d)&&this._ar();let c=a?.data&&N.NON_PLUS_NUMERIC.test(a.data),m=a?.inputType===V.PASTE&&d;c||m&&!t?o=!0:N.NON_PLUS_NUMERIC.test(d)||(o=!1);let I=a?.detail&&a.detail.isSetNumber,D=this.userNumeralSet==="ascii";if(e&&!o&&!I&&D){let g=this.ui.telInput.selectionStart||0,_=d.substring(0,g).replace(N.NON_PLUS_NUMERIC_GLOBAL,"").length,L=a?.inputType===V.DELETE_FWD,y=this._ap(),v=ct(y,d,u.utils,this.selectedCountryData,i),b=ht(_,v,g,L);this._setTelInputValue(v),this.ui.telInput.setSelectionRange(b,b)}if(i&&d.startsWith("+")&&this.selectedCountryData.dialCode){let g=z(d,!0,i,this.selectedCountryData);this._setTelInputValue(g)}};this.ui.telInput.addEventListener("input",l,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:s}=this.options;if(t||e){let n=o=>{if(o.key&&o.key.length===1&&!o.altKey&&!o.ctrlKey&&!o.metaKey){if(e&&i&&s&&o.key==="+"){o.preventDefault(),this._m();return}if(t){let l=this._getTelInputValue(),d=!l.startsWith("+")&&this.ui.telInput.selectionStart===0&&o.key==="+",c=this._normaliseNumerals(o.key),m=/^[0-9]$/.test(c),I=e?m:d||m,D=this.ui.telInput,g=D.selectionStart,E=D.selectionEnd,_=l.slice(0,g),L=l.slice(E),y=_+o.key+L,v=this._ap(y),b=u.utils.getCoreNumber(v,this.selectedCountryData.iso2),W=this.n&&b.length>this.n,pt=this._s(v)!==null;(!I||W&&!pt&&!d)&&o.preventDefault()}}};this.ui.telInput.addEventListener("keydown",n,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,s=i.selectionStart,n=i.selectionEnd,o=this._getTelInputValue(),l=o.slice(0,s),a=o.slice(n),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),m=this._normaliseNumerals(c),I=s===0&&n>0,D=!o.startsWith("+")||I,g=m.replace(N.NON_PLUS_NUMERIC_GLOBAL,""),E=g.startsWith("+"),_=g.replace(/\+/g,""),L=E&&D?`+${_}`:_,y=l+L+a;if(y.length>5){let b=u.utils.getCoreNumber(y,d);for(;b.length===0&&y.length>0;)y=y.slice(0,-1),b=u.utils.getCoreNumber(y,d);if(!b)return;if(this.n&&b.length>this.n)if(i.selectionEnd===o.length){let W=b.length-this.n;y=y.slice(0,y.length-W)}else return}this._setTelInputValue(y);let v=s+L.length;i.setSelectionRange(v,v),i.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.ui.telInput.addEventListener("paste",t,{signal:this.g.signal})}}_k(t){let e=Number(this.ui.telInput.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}_as(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.ui.telInput.dispatchEvent(i)}_l(){let{fixDropdownWidth:t,countrySearch:e}=this.options;if(this.h=new AbortController,t&&(this.ui.dropdownContent.style.width=`${this.ui.telInput.offsetWidth}px`),this.ui.dropdownContent.classList.remove(h.HIDE),this.ui.selectedCountry.setAttribute(p.EXPANDED,"true"),this._x(),e){let i=this.ui.countryList.firstElementChild;i&&(this.ui.highlightListItem(i,!1),this.ui.countryList.scrollTop=0),this.ui.searchInput.focus()}this._y(),this.ui.dropdownArrow.classList.add(h.ARROW_UP),this._as(A.OPEN_COUNTRY_DROPDOWN)}_x(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.ui.dropdown),!this.options.useFullscreenPopup){let t=this.ui.telInput.getBoundingClientRect(),e=this.ui.telInput.offsetHeight;if(this.options.dropdownContainer){this.ui.dropdown.style.top=`${t.top+e}px`,this.ui.dropdown.style.left=`${t.left}px`;let i=()=>this._am();window.addEventListener("scroll",i,{signal:this.h.signal})}}}_y(){let t=this.h.signal;this._z(t),this._aa(t),this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=i=>{let s=i.target?.closest(`.${h.COUNTRY_ITEM}`);s&&this.ui.highlightListItem(s,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=i=>{let s=i.target?.closest(`.${h.COUNTRY_ITEM}`);s&&this._al(s)};this.ui.countryList.addEventListener("click",e,{signal:t})}_ab(t){let e=i=>{!!i.target.closest(`#iti-${this.id}__dropdown-content`)||this._am()};setTimeout(()=>{document.documentElement.addEventListener("click",e,{signal:t})},0)}_ac(t){let e="",i=null,s=n=>{[f.ARROW_UP,f.ARROW_DOWN,f.ENTER,f.ESC].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key===f.ARROW_UP||n.key===f.ARROW_DOWN?this._af(n.key):n.key===f.ENTER?this._ag():n.key===f.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&N.HIDDEN_SEARCH_CHAR.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},Z.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",s,{signal:t})}_ad(t){let e=()=>{let o=this.ui.searchInput.value.trim();this._ae(o),this.ui.searchInput.value?this.ui.k.classList.remove(h.HIDE):this.ui.k.classList.add(h.HIDE)},i=null,s=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)};this.ui.searchInput.addEventListener("input",s,{signal:t});let n=()=>{this.ui.searchInput.value="",this.ui.searchInput.focus(),e()};this.ui.k.addEventListener("click",n,{signal:t})}_q(t){let e=st(this.countries,t);if(e){let i=e.nodeById[this.id];this.ui.highlightListItem(i,!1),this.ui.scrollTo(i)}}_ae(t){let e;t===""?e=this.countries:e=it(this.countries,t),this.ui.filterCountries(e)}_af(t){let e=t===f.ARROW_UP?this.ui.highlightedItem?.previousElementSibling:this.ui.highlightedItem?.nextElementSibling;!e&&this.ui.countryList.childElementCount>1&&(e=t===f.ARROW_UP?this.ui.countryList.lastElementChild:this.ui.countryList.firstElementChild),e&&(this.ui.scrollTo(e),this.ui.highlightListItem(e,!1))}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let e=t;if(this.options.formatOnDisplay&&u.utils&&this.selectedCountryData){let i=this.options.nationalMode||!e.startsWith("+")&&!this.options.separateDialCode,{NATIONAL:s,INTERNATIONAL:n}=u.utils.numberFormat,o=i?s:n;e=u.utils.formatNumber(e,this.selectedCountryData.iso2,o)}e=this._aq(e),this._setTelInputValue(e)}_ai(t){let e=this._s(t);return e!==null?this._aj(e):!1}_r(t){let{dialCode:e,nationalPrefix:i}=this.selectedCountryData;if(t.startsWith("+")||!e)return t;let o=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${o}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,s=this.selectedCountryData.iso2,n=this.selectedCountryData.dialCode;i=this._r(i);let o=this._ao(i,!0),l=T(i);if(o){let a=T(o),d=this.dialCodeToIso2Map[a];if(d.length===1)return d[0]===s?null:d[0];if(!s&&this.f&&d.includes(this.f))return this.f;if(n===M.NANP&&X(l))return null;let{areaCodes:m,priority:I}=this.selectedCountryData;if(m){let L=m.map(y=>`${n}${y}`);for(let y of L)if(l.startsWith(y))return null}let g=m&&!(I===0)&&l.length>a.length,E=s&&d.includes(s)&&!g,_=s===d[0];if(!E&&!_)return d[0]}else if(i.startsWith("+")&&l.length){let a=this.selectedCountryData.dialCode||"";return a&&a.startsWith(l)?null:""}else if((!i||i==="+")&&!s)return this.f;return null}_aj(t){let{separateDialCode:e,showFlags:i,i18n:s,allowDropdown:n}=this.options,o=this.selectedCountryData.iso2||"";if(n&&this.ui.updateSelectedItem(t),this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.selectedCountry){let l=t&&i?`${h.FLAG} iti__${t}`:`${h.FLAG} ${h.GLOBE}`,a,d,c;if(t){let{name:m,dialCode:I}=this.selectedCountryData;d=m,a=s.selectedCountryAriaLabel.replace("${countryName}",m).replace("${dialCode}",`+${I}`),c=i?"":j()}else d=s.noCountrySelected,a=s.noCountrySelected,c=j();this.ui.selectedCountryInner.className=l,this.ui.selectedCountry.setAttribute("title",d),this.ui.selectedCountry.setAttribute(p.LABEL,a),this.ui.selectedCountryInner.innerHTML=c}if(e){let l=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.ui.selectedDialCode.textContent=l,this.ui.updateInputPadding()}return this._ak(),this._t(),o!==t}_t(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.options,{iso2:s}=this.selectedCountryData;if(t&&u.utils)if(s){let n=u.utils.numberType[e],o=u.utils.getExampleNumber(s,!1,n,!0),l=o;for(;u.utils.isPossibleNumber(o,s,i);)l=o,o+="0";let a=u.utils.getCoreNumber(l,s);this.n=a.length,s==="by"&&(this.n=a.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:s}=this.options,n=t===S.AGGRESSIVE||!this.ui.a&&t===S.POLITE;if(u.utils&&n){let o=u.utils.numberType[e],l=this.selectedCountryData.iso2?u.utils.getExampleNumber(this.selectedCountryData.iso2,i,o):"";l=this._aq(l),typeof s=="function"&&(l=s(l,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",l)}}_al(t){let e=t.dataset[K.COUNTRY_CODE],i=this._aj(e);this._am();let s=t.dataset[K.DIAL_CODE];if(this._an(s),this.options.formatOnDisplay){let n=this._getTelInputValue();this._ah(n)}this.ui.telInput.focus(),i&&this._ar()}_am(){this.ui.dropdownContent.classList.contains(h.HIDE)||(this.ui.dropdownContent.classList.add(h.HIDE),this.ui.selectedCountry.setAttribute(p.EXPANDED,"false"),this.options.countrySearch&&(this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.ui.highlightedItem&&(this.ui.highlightedItem.classList.remove(h.HIGHLIGHT),this.ui.highlightedItem=null)),this.ui.dropdownArrow.classList.remove(h.ARROW_UP),this.h.abort(),this.h=null,this.options.dropdownContainer&&this.ui.dropdown.remove(),this._as(A.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this._getTelInputValue(),i=`+${t}`,s;if(e.startsWith("+")){let n=this._ao(e);n?s=e.replace(n,i):s=i,this._setTelInputValue(s)}}_ao(t,e){let i="";if(t.startsWith("+")){let s="",n=!1;for(let o=0;o<t.length;o++){let l=t.charAt(o);if(/[0-9]/.test(l)){if(s+=l,!!!this.dialCodeToIso2Map[s])break;if(this.dialCodes.has(s)){if(i=t.substring(0,o+1),n=!0,!e)break}else e&&n&&(i=t.substring(0,o+1));if(s.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t?this._normaliseNumerals(t):this._getTelInputValue(),{dialCode:i}=this.selectedCountryData,s,n=T(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&n?s=`+${i}`:s="",s+e}_aq(t){let e=!!this._ao(t),i=z(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(A.COUNTRY_CHANGE)}handleAutoCountry(){this.options.initialCountry===R.AUTO&&u.autoCountry&&(this.f=u.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleUtils(){if(u.utils){let t=this._getTelInputValue();t&&this._ah(t),this.selectedCountryData.iso2&&(this._ak(),this._t())}this.d()}destroy(){this.ui.telInput&&(this.options.allowDropdown&&this._am(),this.g.abort(),this.g=null,this.ui.destroy(),u.instances instanceof Map?u.instances.delete(this.id):delete u.instances[this.id])}getExtension(){return u.utils?u.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(u.utils){let{iso2:e}=this.selectedCountryData,i=this._ap(),s=u.utils.formatNumber(i,e,t);return this._mapAsciiToUserNumerals(s)}return""}getNumberType(){return u.utils?u.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):$.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(u.utils){let{iso2:t}=this.selectedCountryData;return u.utils.getValidationError(this._ap(),t)}return $.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===H.DIAL_CODE&&u.utils){let i=this._ap(),s=u.utils.getCoreNumber(i,e);if(s[0]===H.MOBILE_PREFIX&&s.length!==H.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return u.utils?u.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}_v(t){if(!u.utils)return null;if(!this.selectedCountryData.iso2)return!1;let{allowNumberExtensions:e,allowPhonewords:i}=this.options,s=a=>t?this._w(a):this._u(a),n=this._ap();if(!s(n))return!1;if(n.search(N.ALPHA_UNICODE)>-1){let a=this.selectedCountryData.iso2;return u.utils.getExtension(n,a)?e:i}return!0}_w(t){return u.utils?u.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}setCountry(t){let e=t?.toLowerCase();if(!q(e))throw new Error(`Invalid country code: '${e}'`);let i=this.selectedCountryData.iso2;if(t&&e!==i||!t&&i){if(this._aj(e),this._an(this.selectedCountryData.dialCode),this.options.formatOnDisplay){let n=this._getTelInputValue();this._ah(n)}this._ar()}}setNumber(t){let e=this._normaliseNumerals(t),i=this._ai(e);this._ah(e),i&&this._ar(),this._as(A.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.options.placeholderNumberType=t,this._ak()}setDisabled(t){this.ui.telInput.disabled=t,t?this.ui.selectedCountry.setAttribute("disabled","true"):this.ui.selectedCountry.removeAttribute("disabled")}},Dt=r=>{if(!u.utils&&!u.startedLoadingUtilsScript){let t;if(typeof r=="function")try{t=Promise.resolve(r())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof r}`));return u.startedLoadingUtilsScript=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return u.utils=i,O("handleUtils"),!0}).catch(e=>{throw O("rejectUtilsScriptPromise",e),e})}return null},O=(r,...t)=>{Object.values(u.instances).forEach(e=>{let i=e[r];typeof i=="function"&&i.apply(e,t)})},u=Object.assign((r,t)=>{let e=new B(r,t);return u.instances[e.id]=e,r.iti=e,e},{defaults:Y,documentReady:()=>document.readyState==="complete",getCountryData:()=>w,getInstance:r=>{let t=r.dataset.intlTelInputId;return t?u.instances[t]:null},instances:{},attachUtils:Dt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.0.4"}),wt=u;return It(Tt);})();
|
|
31
|
+
</svg>`;var P=class{constructor(t,e,i){this.highlightedItem=null;this.selectedItem=null;t.dataset.intlTelInputId=i.toString(),this.telInput=t,this.options=e,this.id=i,this.a=!!t.getAttribute("placeholder"),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.o=this.telInput.style.paddingLeft)}generateMarkup(t){this.countries=t,this.telInput.classList.add("iti__tel-input");let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_au(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:s}=this.options,n=k({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!s,[i]:!!i}),o=C("div",{class:n});return this.isRTL&&o.setAttribute("dir","ltr"),this.telInput.before(o),o}_av(t){let{allowDropdown:e,separateDialCode:i,showFlags:s}=this.options;if(e||s||i){this.countryContainer=C("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=C("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.options.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.id}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=C("div",{class:"iti__selected-country"},this.countryContainer);let n=C("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=C("div",{class:h.FLAG},n),e&&(this.dropdownArrow=C("div",{class:"iti__arrow",[p.HIDDEN]:"true"},n)),i&&(this.selectedDialCode=C("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:s,dropdownContainer:n,containerClass:o}=this.options,l=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=C("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${l}`,role:"dialog",[p.MODAL]:"true"}),this.isRTL&&this.dropdownContent.setAttribute("dir","rtl"),i&&this._ax(),this.countryList=C("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:s.countryListAriaLabel},this.dropdownContent),this._ba(),i&&this.updateSearchResultsA11yText(),n){let a=k({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[o]:!!o});this.dropdown=C("div",{class:a}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t}=this.options,e=C("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=C("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},e),this.searchIcon.innerHTML=nt(),this.searchInput=C("input",{id:`iti-${this.id}__search-input`,type:"search",class:"iti__search-input",placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.id}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},e),this.k=C("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},e),this.k.innerHTML=ot(this.id),this.l=C("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=C("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.dropdownContent),this.searchNoResults.textContent=t.searchEmptyState}_ay(){this.countryContainer&&(this.updateInputPadding(),this.countryContainer.classList.remove(h.V_HIDE))}_az(t){let{hiddenInput:e}=this.options;if(e){let i=this.telInput.getAttribute("name")||"",s=e(i);if(s.phone){let n=this.telInput.form?.querySelector(`input[name="${s.phone}"]`);n?this.hiddenInput=n:(this.hiddenInput=C("input",{type:"hidden",name:s.phone}),t.appendChild(this.hiddenInput))}if(s.country){let n=this.telInput.form?.querySelector(`input[name="${s.country}"]`);n?this.m=n:(this.m=C("input",{type:"hidden",name:s.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let i=this.countries[e],s=k({[h.COUNTRY_ITEM]:!0}),n=C("li",{id:`iti-${this.id}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[p.SELECTED]:"false"});n.dataset.dialCode=i.dialCode,n.dataset.countryCode=i.iso2,i.nodeById[this.id]=n,this.options.showFlags&&C("div",{class:`${h.FLAG} iti__${i.iso2}`},n);let o=C("span",{class:"iti__country-name"},n);o.textContent=i.name;let l=C("span",{class:"iti__dial-code"},n);this.isRTL&&l.setAttribute("dir","ltr"),l.textContent=`+${i.dialCode}`,t.appendChild(n)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?x.SANE_SELECTED_WITH_DIAL_WIDTH:x.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+x.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${i}px`}}_bb(){if(this.telInput.parentNode){let t;try{t=window.top.document.body}catch{t=document.body}let e=this.telInput.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.countryContainer.cloneNode();e.appendChild(i);let s=this.selectedCountry.cloneNode(!0);i.appendChild(s);let n=s.offsetWidth;return t.removeChild(e),n}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount;this.l.textContent=t.searchSummaryAria(e)}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,s=e.offsetHeight,n=e.getBoundingClientRect().top+i,o=n+s,l=t.offsetHeight,a=t.getBoundingClientRect().top+i,d=a+l,c=a-n+e.scrollTop;if(a<n)e.scrollTop=c;else if(d>o){let m=s-l;e.scrollTop=c-m}}highlightListItem(t,e){let i=this.highlightedItem;if(i&&i.classList.remove(h.HIGHLIGHT),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.options.countrySearch)){let s=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,s)}e&&this.highlightedItem.focus()}updateSelectedItem(t){if(this.selectedItem&&this.selectedItem.dataset.countryCode!==t&&(this.selectedItem.setAttribute(p.SELECTED,"false"),this.selectedItem=null),t&&!this.selectedItem){let e=this.countryList.querySelector(`[data-country-code="${t}"]`);e&&(e.setAttribute(p.SELECTED,"true"),this.selectedItem=e)}}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let i of t){let s=i.nodeById[this.id];s&&(this.countryList.appendChild(s),e&&(this.highlightListItem(s,!1),e=!1))}e?(this.highlightListItem(null,!1),this.searchNoResults&&this.searchNoResults.classList.remove(h.HIDE)):this.searchNoResults&&this.searchNoResults.classList.add(h.HIDE),this.countryList.scrollTop=0,this.updateSearchResultsA11yText()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.options.separateDialCode&&(this.telInput.style.paddingLeft=this.o);let t=this.telInput.parentNode;t.before(this.telInput),t.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.selectedDialCode=null,this.dropdownArrow=null,this.dropdownContent=null,this.searchInput=null,this.searchIcon=null,this.k=null,this.searchNoResults=null,this.l=null,this.countryList=null,this.dropdown=null,this.hiddenInput=null,this.m=null,this.highlightedItem=null,this.selectedItem=null;for(let e of this.countries)delete e.nodeById[this.id];this.countries=null}};var rt=r=>{let{onlyCountries:t,excludeCountries:e}=r;if(t.length){let i=t.map(s=>s.toLowerCase());return w.filter(s=>i.includes(s.iso2))}else if(e.length){let i=e.map(s=>s.toLowerCase());return w.filter(s=>!i.includes(s.iso2))}return w},lt=(r,t)=>{let{countryNameLocale:e,i18n:i}=t,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(e,{type:"region"}):s=null}catch(n){console.error(n),s=null}for(let n of r)n.name=i[n.iso2]||s?.of(n.iso2.toUpperCase())||""},at=r=>{let t=new Set,e=0,i={},s=(o,l)=>{if(!o||!l)return;l.length>e&&(e=l.length),i.hasOwnProperty(l)||(i[l]=[]);let a=i[l];a.includes(o)||a.push(o)},n=[...r].sort((o,l)=>o.priority-l.priority);for(let o of n){t.has(o.dialCode)||t.add(o.dialCode);for(let l=1;l<o.dialCode.length;l++){let a=o.dialCode.substring(0,l);s(o.iso2,a)}if(s(o.iso2,o.dialCode),o.areaCodes){let l=i[o.dialCode][0];for(let a of o.areaCodes){for(let d=1;d<a.length;d++){let c=a.substring(0,d),m=o.dialCode+c;s(l,m),s(o.iso2,m)}s(o.iso2,o.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLen:e,dialCodeToIso2Map:i}},ut=(r,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),r.sort((e,i)=>{let{countryOrder:s}=t;if(s){let n=s.indexOf(e.iso2),o=s.indexOf(i.iso2),l=n>-1,a=o>-1;if(l||a)return l&&a?n-o:l?-1:1}return e.name.localeCompare(i.name)})},dt=r=>{for(let t of r)t.normalisedName=U(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var z=(r,t,e,i)=>{let s=r;if(e&&t){let n=`+${i.dialCode}`,o=s[n.length]===" "||s[n.length]==="-"?n.length+1:n.length;s=s.substring(o)}return s},ct=(r,t,e,i,s)=>{let n=e?e.formatNumberAsYouType(r,i.iso2):r,{dialCode:o}=i;return s&&t.charAt(0)!=="+"&&n.includes(`+${o}`)?(n.split(`+${o}`)[1]||"").trim():n};var ht=(r,t,e,i)=>{if(e===0&&!i)return 0;let s=0;for(let n=0;n<t.length;n++){if(/[+0-9]/.test(t[n])&&s++,s===r&&!i)return n+1;if(i&&s===r+1)return n}return t.length};var Lt=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],X=r=>{let t=T(r);if(t.startsWith(M.NANP)&&t.length>=4){let e=t.substring(1,4);return Lt.includes(e)}return!1};var vt=0,Nt=new Set(w.map(r=>r.iso2)),q=r=>Nt.has(r),B=class r{constructor(t,e={}){this.id=vt++,this.options={...Y,...e},et(this.options),this.ui=new P(t,this.options,this.id),this.i=r._b(),this.promise=this._c(),this.countries=rt(this.options);let{dialCodes:i,dialCodeMaxLen:s,dialCodeToIso2Map:n}=at(this.countries);this.dialCodes=i,this.dialCodeMaxLen=s,this.dialCodeToIso2Map=n,this.j=new Map(this.countries.map(o=>[o.iso2,o])),this._init()}static _b(){return typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1}_updateNumeralSet(t){/[\u0660-\u0669]/.test(t)?this.userNumeralSet="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.userNumeralSet="persian":this.userNumeralSet="ascii"}_mapAsciiToUserNumerals(t){if(this.userNumeralSet||this._updateNumeralSet(this.ui.telInput.value),this.userNumeralSet==="ascii")return t;let e=this.userNumeralSet==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,i=>String.fromCharCode(e+Number(i)))}_normaliseNumerals(t){if(!t)return"";if(this._updateNumeralSet(t),this.userNumeralSet==="ascii")return t;let e=this.userNumeralSet==="arabic-indic"?1632:1776,i=this.userNumeralSet==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace(i,s=>String.fromCharCode(48+(s.charCodeAt(0)-e)))}_getTelInputValue(){let t=this.ui.telInput.value.trim();return this._normaliseNumerals(t)}_setTelInputValue(t){this.ui.telInput.value=this._mapAsciiToUserNumerals(t)}_c(){let t=new Promise((i,s)=>{this.b=i,this.c=s}),e=new Promise((i,s)=>{this.d=i,this.e=s});return Promise.all([t,e])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h()}_a(){lt(this.countries,this.options),ut(this.countries,this.options),dt(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),i=this._normaliseNumerals(e),s=this._getTelInputValue(),o=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,l=this._ao(o),a=X(o),{initialCountry:d,geoIpLookup:c}=this.options,m=d===R.AUTO&&c;if(l&&!a)this._ai(o);else if(!m||t){let I=d?d.toLowerCase():"";q(I)?this._aj(I):l&&a?this._aj(J.ISO2):this._aj("")}o&&this._ah(o)}_e(){this._j(),this.options.allowDropdown&&this._g(),(this.ui.hiddenInput||this.ui.m)&&this.ui.telInput.form&&this._f()}_f(){let t=()=>{this.ui.hiddenInput&&(this.ui.hiddenInput.value=this.getNumber()),this.ui.m&&(this.ui.m.value=this.selectedCountryData.iso2||"")};this.ui.telInput.form?.addEventListener("submit",t,{signal:this.g.signal})}_g(){let t=this.g.signal,e=o=>{this.ui.dropdownContent.classList.contains(h.HIDE)?this.ui.telInput.focus():o.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let s=()=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",s,{signal:t});let n=o=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&[f.ARROW_UP,f.ARROW_DOWN,f.SPACE,f.ENTER].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),this._l()),o.key===f.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",n,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!u.utils){let n=()=>{u.attachUtils(t)?.catch(()=>{})};if(u.documentReady())n();else{let o=()=>{n()};window.addEventListener("load",o,{signal:this.g.signal})}}else this.d();e===R.AUTO&&i&&!this.selectedCountryData.iso2?this._i():this.b()}_i(){u.autoCountry?this.handleAutoCountry():u.startedLoadingAutoCountry||(u.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();q(e)?(u.autoCountry=e,setTimeout(()=>O("handleAutoCountry"))):(this._d(!0),O("rejectAutoCountryPromise"))},()=>{this._d(!0),O("rejectAutoCountryPromise")}))}_m(){this._l(),this.ui.searchInput.value="+",this._ae("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:s,countrySearch:n}=this.options,o=!1;N.ALPHA_UNICODE.test(this._getTelInputValue())&&(o=!0);let l=a=>{let d=this._getTelInputValue();if(this.i&&a?.data==="+"&&i&&s&&n){let g=this.ui.telInput.selectionStart||0,E=d.substring(0,g-1),_=d.substring(g);this._setTelInputValue(E+_),this._m();return}this._ai(d)&&this._ar();let c=a?.data&&N.NON_PLUS_NUMERIC.test(a.data),m=a?.inputType===V.PASTE&&d;c||m&&!t?o=!0:N.NON_PLUS_NUMERIC.test(d)||(o=!1);let I=a?.detail&&a.detail.isSetNumber,D=this.userNumeralSet==="ascii";if(e&&!o&&!I&&D){let g=this.ui.telInput.selectionStart||0,_=d.substring(0,g).replace(N.NON_PLUS_NUMERIC_GLOBAL,"").length,L=a?.inputType===V.DELETE_FWD,y=this._ap(),v=ct(y,d,u.utils,this.selectedCountryData,i),b=ht(_,v,g,L);this._setTelInputValue(v),this.ui.telInput.setSelectionRange(b,b)}if(i&&d.startsWith("+")&&this.selectedCountryData.dialCode){let g=z(d,!0,i,this.selectedCountryData);this._setTelInputValue(g)}};this.ui.telInput.addEventListener("input",l,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:s}=this.options;if(t||e){let n=o=>{if(o.key&&o.key.length===1&&!o.altKey&&!o.ctrlKey&&!o.metaKey){if(e&&i&&s&&o.key==="+"){o.preventDefault(),this._m();return}if(t){let l=this._getTelInputValue(),d=!l.startsWith("+")&&this.ui.telInput.selectionStart===0&&o.key==="+",c=this._normaliseNumerals(o.key),m=/^[0-9]$/.test(c),I=e?m:d||m,D=this.ui.telInput,g=D.selectionStart,E=D.selectionEnd,_=l.slice(0,g),L=l.slice(E),y=_+o.key+L,v=this._ap(y),b=u.utils.getCoreNumber(v,this.selectedCountryData.iso2),W=this.n&&b.length>this.n,pt=this._s(v)!==null;(!I||W&&!pt&&!d)&&o.preventDefault()}}};this.ui.telInput.addEventListener("keydown",n,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,s=i.selectionStart,n=i.selectionEnd,o=this._getTelInputValue(),l=o.slice(0,s),a=o.slice(n),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),m=this._normaliseNumerals(c),I=s===0&&n>0,D=!o.startsWith("+")||I,g=m.replace(N.NON_PLUS_NUMERIC_GLOBAL,""),E=g.startsWith("+"),_=g.replace(/\+/g,""),L=E&&D?`+${_}`:_,y=l+L+a;if(y.length>5){let b=u.utils.getCoreNumber(y,d);for(;b.length===0&&y.length>0;)y=y.slice(0,-1),b=u.utils.getCoreNumber(y,d);if(!b)return;if(this.n&&b.length>this.n)if(i.selectionEnd===o.length){let W=b.length-this.n;y=y.slice(0,y.length-W)}else return}this._setTelInputValue(y);let v=s+L.length;i.setSelectionRange(v,v),i.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.ui.telInput.addEventListener("paste",t,{signal:this.g.signal})}}_k(t){let e=Number(this.ui.telInput.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}_as(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.ui.telInput.dispatchEvent(i)}_l(){let{fixDropdownWidth:t,countrySearch:e}=this.options;if(this.h=new AbortController,t&&(this.ui.dropdownContent.style.width=`${this.ui.telInput.offsetWidth}px`),this.ui.dropdownContent.classList.remove(h.HIDE),this.ui.selectedCountry.setAttribute(p.EXPANDED,"true"),this._x(),e){let i=this.ui.countryList.firstElementChild;i&&(this.ui.highlightListItem(i,!1),this.ui.countryList.scrollTop=0),this.ui.searchInput.focus()}this._y(),this.ui.dropdownArrow.classList.add(h.ARROW_UP),this._as(A.OPEN_COUNTRY_DROPDOWN)}_x(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.ui.dropdown),!this.options.useFullscreenPopup){let t=this.ui.telInput.getBoundingClientRect(),e=this.ui.telInput.offsetHeight;if(this.options.dropdownContainer){this.ui.dropdown.style.top=`${t.top+e}px`,this.ui.dropdown.style.left=`${t.left}px`;let i=()=>this._am();window.addEventListener("scroll",i,{signal:this.h.signal})}}}_y(){let t=this.h.signal;this._z(t),this._aa(t),this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=i=>{let s=i.target?.closest(`.${h.COUNTRY_ITEM}`);s&&this.ui.highlightListItem(s,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=i=>{let s=i.target?.closest(`.${h.COUNTRY_ITEM}`);s&&this._al(s)};this.ui.countryList.addEventListener("click",e,{signal:t})}_ab(t){let e=i=>{!!i.target.closest(`#iti-${this.id}__dropdown-content`)||this._am()};setTimeout(()=>{document.documentElement.addEventListener("click",e,{signal:t})},0)}_ac(t){let e="",i=null,s=n=>{[f.ARROW_UP,f.ARROW_DOWN,f.ENTER,f.ESC].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key===f.ARROW_UP||n.key===f.ARROW_DOWN?this._af(n.key):n.key===f.ENTER?this._ag():n.key===f.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&N.HIDDEN_SEARCH_CHAR.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},Z.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",s,{signal:t})}_ad(t){let e=()=>{let o=this.ui.searchInput.value.trim();this._ae(o),this.ui.searchInput.value?this.ui.k.classList.remove(h.HIDE):this.ui.k.classList.add(h.HIDE)},i=null,s=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)};this.ui.searchInput.addEventListener("input",s,{signal:t});let n=()=>{this.ui.searchInput.value="",this.ui.searchInput.focus(),e()};this.ui.k.addEventListener("click",n,{signal:t})}_q(t){let e=st(this.countries,t);if(e){let i=e.nodeById[this.id];this.ui.highlightListItem(i,!1),this.ui.scrollTo(i)}}_ae(t){let e;t===""?e=this.countries:e=it(this.countries,t),this.ui.filterCountries(e)}_af(t){let e=t===f.ARROW_UP?this.ui.highlightedItem?.previousElementSibling:this.ui.highlightedItem?.nextElementSibling;!e&&this.ui.countryList.childElementCount>1&&(e=t===f.ARROW_UP?this.ui.countryList.lastElementChild:this.ui.countryList.firstElementChild),e&&(this.ui.scrollTo(e),this.ui.highlightListItem(e,!1))}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let e=t;if(this.options.formatOnDisplay&&u.utils&&this.selectedCountryData){let i=this.options.nationalMode||!e.startsWith("+")&&!this.options.separateDialCode,{NATIONAL:s,INTERNATIONAL:n}=u.utils.numberFormat,o=i?s:n;e=u.utils.formatNumber(e,this.selectedCountryData.iso2,o)}e=this._aq(e),this._setTelInputValue(e)}_ai(t){let e=this._s(t);return e!==null?this._aj(e):!1}_r(t){let{dialCode:e,nationalPrefix:i}=this.selectedCountryData;if(t.startsWith("+")||!e)return t;let o=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${o}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,s=this.selectedCountryData.iso2,n=this.selectedCountryData.dialCode;i=this._r(i);let o=this._ao(i,!0),l=T(i);if(o){let a=T(o),d=this.dialCodeToIso2Map[a];if(d.length===1)return d[0]===s?null:d[0];if(!s&&this.f&&d.includes(this.f))return this.f;if(n===M.NANP&&X(l))return null;let{areaCodes:m,priority:I}=this.selectedCountryData;if(m){let L=m.map(y=>`${n}${y}`);for(let y of L)if(l.startsWith(y))return null}let g=m&&!(I===0)&&l.length>a.length,E=s&&d.includes(s)&&!g,_=s===d[0];if(!E&&!_)return d[0]}else if(i.startsWith("+")&&l.length){let a=this.selectedCountryData.dialCode||"";return a&&a.startsWith(l)?null:""}else if((!i||i==="+")&&!s)return this.f;return null}_aj(t){let{separateDialCode:e,showFlags:i,i18n:s,allowDropdown:n}=this.options,o=this.selectedCountryData.iso2||"";if(n&&this.ui.updateSelectedItem(t),this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.selectedCountry){let l=t&&i?`${h.FLAG} iti__${t}`:`${h.FLAG} ${h.GLOBE}`,a,d,c;if(t){let{name:m,dialCode:I}=this.selectedCountryData;d=m,a=s.selectedCountryAriaLabel.replace("${countryName}",m).replace("${dialCode}",`+${I}`),c=i?"":j()}else d=s.noCountrySelected,a=s.noCountrySelected,c=j();this.ui.selectedCountryInner.className=l,this.ui.selectedCountry.setAttribute("title",d),this.ui.selectedCountry.setAttribute(p.LABEL,a),this.ui.selectedCountryInner.innerHTML=c}if(e){let l=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.ui.selectedDialCode.textContent=l,this.ui.updateInputPadding()}return this._ak(),this._t(),o!==t}_t(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.options,{iso2:s}=this.selectedCountryData;if(t&&u.utils)if(s){let n=u.utils.numberType[e],o=u.utils.getExampleNumber(s,!1,n,!0),l=o;for(;u.utils.isPossibleNumber(o,s,i);)l=o,o+="0";let a=u.utils.getCoreNumber(l,s);this.n=a.length,s==="by"&&(this.n=a.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:s}=this.options,n=t===S.AGGRESSIVE||!this.ui.a&&t===S.POLITE;if(u.utils&&n){let o=u.utils.numberType[e],l=this.selectedCountryData.iso2?u.utils.getExampleNumber(this.selectedCountryData.iso2,i,o):"";l=this._aq(l),typeof s=="function"&&(l=s(l,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",l)}}_al(t){let e=t.dataset[K.COUNTRY_CODE],i=this._aj(e);this._am();let s=t.dataset[K.DIAL_CODE];if(this._an(s),this.options.formatOnDisplay){let n=this._getTelInputValue();this._ah(n)}this.ui.telInput.focus(),i&&this._ar()}_am(){this.ui.dropdownContent.classList.contains(h.HIDE)||(this.ui.dropdownContent.classList.add(h.HIDE),this.ui.selectedCountry.setAttribute(p.EXPANDED,"false"),this.options.countrySearch&&(this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.ui.highlightedItem&&(this.ui.highlightedItem.classList.remove(h.HIGHLIGHT),this.ui.highlightedItem=null)),this.ui.dropdownArrow.classList.remove(h.ARROW_UP),this.h.abort(),this.h=null,this.options.dropdownContainer&&this.ui.dropdown.remove(),this._as(A.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this._getTelInputValue(),i=`+${t}`,s;if(e.startsWith("+")){let n=this._ao(e);n?s=e.replace(n,i):s=i,this._setTelInputValue(s)}}_ao(t,e){let i="";if(t.startsWith("+")){let s="",n=!1;for(let o=0;o<t.length;o++){let l=t.charAt(o);if(/[0-9]/.test(l)){if(s+=l,!!!this.dialCodeToIso2Map[s])break;if(this.dialCodes.has(s)){if(i=t.substring(0,o+1),n=!0,!e)break}else e&&n&&(i=t.substring(0,o+1));if(s.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t?this._normaliseNumerals(t):this._getTelInputValue(),{dialCode:i}=this.selectedCountryData,s,n=T(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&n?s=`+${i}`:s="",s+e}_aq(t){let e=!!this._ao(t),i=z(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(A.COUNTRY_CHANGE)}handleAutoCountry(){this.options.initialCountry===R.AUTO&&u.autoCountry&&(this.f=u.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleUtils(){if(u.utils){let t=this._getTelInputValue();t&&this._ah(t),this.selectedCountryData.iso2&&(this._ak(),this._t())}this.d()}destroy(){this.ui.telInput&&(this.options.allowDropdown&&this._am(),this.g.abort(),this.g=null,this.ui.destroy(),u.instances instanceof Map?u.instances.delete(this.id):delete u.instances[this.id])}getExtension(){return u.utils?u.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(u.utils){let{iso2:e}=this.selectedCountryData,i=this._ap(),s=u.utils.formatNumber(i,e,t);return this._mapAsciiToUserNumerals(s)}return""}getNumberType(){return u.utils?u.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):$.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(u.utils){let{iso2:t}=this.selectedCountryData;return u.utils.getValidationError(this._ap(),t)}return $.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===H.DIAL_CODE&&u.utils){let i=this._ap(),s=u.utils.getCoreNumber(i,e);if(s[0]===H.MOBILE_PREFIX&&s.length!==H.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return u.utils?u.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}_v(t){if(!u.utils)return null;if(!this.selectedCountryData.iso2)return!1;let{allowNumberExtensions:e,allowPhonewords:i}=this.options,s=a=>t?this._w(a):this._u(a),n=this._ap();if(!s(n))return!1;if(n.search(N.ALPHA_UNICODE)>-1){let a=this.selectedCountryData.iso2;return u.utils.getExtension(n,a)?e:i}return!0}_w(t){return u.utils?u.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}setCountry(t){let e=t?.toLowerCase();if(!q(e))throw new Error(`Invalid country code: '${e}'`);let i=this.selectedCountryData.iso2;if(t&&e!==i||!t&&i){if(this._aj(e),this._an(this.selectedCountryData.dialCode),this.options.formatOnDisplay){let n=this._getTelInputValue();this._ah(n)}this._ar()}}setNumber(t){let e=this._normaliseNumerals(t),i=this._ai(e);this._ah(e),i&&this._ar(),this._as(A.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.options.placeholderNumberType=t,this._ak()}setDisabled(t){this.ui.telInput.disabled=t,t?this.ui.selectedCountry.setAttribute("disabled","true"):this.ui.selectedCountry.removeAttribute("disabled")}},Dt=r=>{if(!u.utils&&!u.startedLoadingUtilsScript){let t;if(typeof r=="function")try{t=Promise.resolve(r())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof r}`));return u.startedLoadingUtilsScript=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return u.utils=i,O("handleUtils"),!0}).catch(e=>{throw O("rejectUtilsScriptPromise",e),e})}return null},O=(r,...t)=>{Object.values(u.instances).forEach(e=>{let i=e[r];typeof i=="function"&&i.apply(e,t)})},u=Object.assign((r,t)=>{let e=new B(r,t);return u.instances[e.id]=e,r.iti=e,e},{defaults:Y,documentReady:()=>document.readyState==="complete",getCountryData:()=>w,getInstance:r=>{let t=r.dataset.intlTelInputId;return t?u.instances[t]:null},instances:{},attachUtils:Dt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.0.5"}),wt=u;return It(Tt);})();
|
|
32
32
|
|
|
33
33
|
// UMD
|
|
34
34
|
return factoryOutput.default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v26.0.
|
|
2
|
+
* International Telephone Input v26.0.5
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -3870,7 +3870,7 @@ var factoryOutput = (() => {
|
|
|
3870
3870
|
attachUtils,
|
|
3871
3871
|
startedLoadingUtilsScript: false,
|
|
3872
3872
|
startedLoadingAutoCountry: false,
|
|
3873
|
-
version: "26.0.
|
|
3873
|
+
version: "26.0.5"
|
|
3874
3874
|
}
|
|
3875
3875
|
);
|
|
3876
3876
|
var intl_tel_input_default = intlTelInput;
|