intl-tel-input 26.5.1 → 26.5.2

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 CHANGED
@@ -47,4 +47,4 @@ See the [contributing guide](https://github.com/jackocnr/intl-tel-input/blob/mas
47
47
 
48
48
  User testing powered by [BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
49
49
 
50
- Browser testing via <a href="https://www.lambdatest.com/" target="_blank"><img src="https://raw.githubusercontent.com/jackocnr/intl-tel-input/44e0e66d01e260a7c39b3405c3229b9446882cba/screenshots/LambdaTest%20logo%20-blue.svg" style="vertical-align: middle;margin-left:5px" width="147" height="26" /></a>
50
+ Browser testing via <a href="https://www.lambdatest.com/" target="_blank"><img src="https://raw.githubusercontent.com/jackocnr/intl-tel-input/44e0e66d01e260a7c39b3405c3229b9446882cba/screenshots/lambda_test.svg" style="vertical-align: middle;margin-left:5px" width="147" height="26" /></a>
@@ -3975,7 +3975,7 @@ var intlTelInput = Object.assign((input, options) => {
3975
3975
  attachUtils,
3976
3976
  startedLoadingUtilsScript: false,
3977
3977
  startedLoadingAutoCountry: false,
3978
- version: "26.5.1"
3978
+ version: "26.5.2"
3979
3979
  });
3980
3980
  var intl_tel_input_default = intlTelInput;
3981
3981
 
@@ -3975,7 +3975,7 @@ var intlTelInput = Object.assign((input, options) => {
3975
3975
  attachUtils,
3976
3976
  startedLoadingUtilsScript: false,
3977
3977
  startedLoadingAutoCountry: false,
3978
- version: "26.5.1"
3978
+ version: "26.5.2"
3979
3979
  });
3980
3980
  var intl_tel_input_default = intlTelInput;
3981
3981
 
package/build/js/data.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v26.5.1
2
+ * International Telephone Input v26.5.2
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v26.5.1
2
+ * International Telephone Input v26.5.2
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v26.5.1
2
+ * International Telephone Input v26.5.2
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -4208,7 +4208,7 @@ var factoryOutput = (() => {
4208
4208
  attachUtils,
4209
4209
  startedLoadingUtilsScript: false,
4210
4210
  startedLoadingAutoCountry: false,
4211
- version: "26.5.1"
4211
+ version: "26.5.2"
4212
4212
  }
4213
4213
  );
4214
4214
  var intl_tel_input_default = intlTelInput;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v26.5.1
2
+ * International Telephone Input v26.5.2
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -31,7 +31,7 @@ var factoryOutput=(()=>{var Y=Object.defineProperty;var Dt=Object.getOwnProperty
31
31
  <svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
32
32
  <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"/>
33
33
  <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"/>
34
- </svg>`;var O=class{constructor(t,e,i){this.searchKeyupTimer=null;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)}static validateInput(t){let e=t?.tagName;if(!(!!t&&typeof t=="object"&&e==="INPUT"&&typeof t.setAttribute=="function")){let n=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${n}`)}}generateMarkup(t){this.countries=t,this.telInput.classList.add("iti__tel-input"),this.telInput.hasAttribute("autocomplete")||this.telInput.setAttribute("autocomplete","tel"),this.telInput.hasAttribute("inputmode")||this.telInput.setAttribute("inputmode","tel");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:n}=this.options,s=V({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!n,[i]:!!i}),r=m("div",{class:s});return this.isRTL&&r.setAttribute("dir","ltr"),this.telInput.before(r),r}_av(t){let{allowDropdown:e,separateDialCode:i,showFlags:n}=this.options;if(e||n||i){this.countryContainer=m("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=m("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=m("div",{class:"iti__selected-country"},this.countryContainer);let s=m("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=m("div",{class:h.FLAG},s),e&&(this.dropdownArrow=m("div",{class:"iti__arrow",[p.HIDDEN]:"true"},s)),i&&(this.selectedDialCode=m("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:n,dropdownContainer:s,containerClass:r}=this.options,l=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=m("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=m("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:n.countryListAriaLabel},this.dropdownContent),this._ba(),i&&this.updateSearchResultsA11yText(),s){let a=V({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[r]:!!r});this.dropdown=m("div",{class:a}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t}=this.options,e=m("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=m("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},e),this.searchIcon.innerHTML=yt(),this.searchInput=m("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=m("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},e),this.k.innerHTML=ft(this.id),this.l=m("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=m("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")||"",n=e(i);if(n.phone){let s=this.telInput.form?.querySelector(`input[name="${n.phone}"]`);s?this.hiddenInput=s:(this.hiddenInput=m("input",{type:"hidden",name:n.phone}),t.appendChild(this.hiddenInput))}if(n.country){let s=this.telInput.form?.querySelector(`input[name="${n.country}"]`);s?this.m=s:(this.m=m("input",{type:"hidden",name:n.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let i=this.countries[e],n=V({[h.COUNTRY_ITEM]:!0}),s=m("li",{id:`iti-${this.id}__item-${i.iso2}`,class:n,tabindex:"-1",role:"option",[p.SELECTED]:"false"});s.dataset.dialCode=i.dialCode,s.dataset.countryCode=i.iso2,i.nodeById[this.id]=s,this.options.showFlags&&m("div",{class:`${h.FLAG} iti__${i.iso2}`},s);let r=m("span",{class:"iti__country-name"},s);r.textContent=i.name;let l=m("span",{class:"iti__dial-code"},r);this.isRTL&&l.setAttribute("dir","ltr"),l.textContent=`+${i.dialCode}`,t.appendChild(s)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?H.SANE_SELECTED_WITH_DIAL_WIDTH:H.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+H.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 n=this.selectedCountry.cloneNode(!0);i.appendChild(n);let s=n.offsetWidth;return t.removeChild(e),s}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount;this.l.textContent=t.searchSummaryAria(e)}filterCountriesByQuery(t){let e;t===""?e=this.countries:e=mt(this.countries,t),this.filterCountries(e)}doFilter(){let t=this.searchInput.value.trim();this.filterCountriesByQuery(t),this.searchInput.value?this.k.classList.remove(h.HIDE):this.k.classList.add(h.HIDE)}handleSearchChange(){this.searchKeyupTimer&&clearTimeout(this.searchKeyupTimer),this.searchKeyupTimer=setTimeout(()=>{this.doFilter(),this.searchKeyupTimer=null},k.SEARCH_DEBOUNCE_MS)}handleSearchClear(){this.searchInput.value="",this.searchInput.focus(),this.doFilter()}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,r=s+n,l=t.offsetHeight,a=t.getBoundingClientRect().top+i,d=a+l,c=a-s+e.scrollTop;if(a<s)e.scrollTop=c;else if(d>r){let C=n-l;e.scrollTop=c-C}}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 n=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,n)}e&&this.highlightedItem.focus()}handleUpDownKey(t){let e=t===g.ARROW_UP?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t===g.ARROW_UP?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this.scrollTo(e),this.highlightListItem(e,!1))}updateSelectedItem(t){if(this.selectedItem&&this.selectedItem.dataset.countryCode!==t&&(this.selectedItem.setAttribute(p.SELECTED,"false"),this.selectedItem.querySelector(".iti__country-check")?.remove(),this.selectedItem=null),t&&!this.selectedItem){let e=this.countryList.querySelector(`[data-country-code="${t}"]`);if(e){e.setAttribute(p.SELECTED,"true");let i=m("span",{class:"iti__country-check",[p.HIDDEN]:"true"},e);i.innerHTML=gt(),this.selectedItem=e}}}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let i of t){let n=i.nodeById[this.id];n&&(this.countryList.appendChild(n),e&&(this.highlightListItem(n,!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}openDropdown(){let{fixDropdownWidth:t,countrySearch:e,dropdownAlwaysOpen:i}=this.options;if(t&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"true"),this.setDropdownPosition(),e){let n=this.countryList.firstElementChild;n&&(this.highlightListItem(n,!1),this.countryList.scrollTop=0),i||this.searchInput.focus()}this.dropdownArrow.classList.add(h.ARROW_UP)}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.options;this.dropdownContent.classList.add(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"false"),t&&(this.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.highlightedItem&&(this.highlightedItem.classList.remove(h.HIGHLIGHT),this.highlightedItem=null)),this.dropdownArrow.classList.remove(h.ARROW_UP),e&&this.dropdown.remove()}setDropdownPosition(){let{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(t&&t.appendChild(this.dropdown),!e){let i=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;t&&this.dropdown&&(this.dropdown.style.top=`${i.top+n}px`,this.dropdown.style.left=`${i.left}px`)}}isDropdownClosed(){return this.dropdownContent.classList.contains(h.HIDE)}setCountry(t){let{allowDropdown:e,showFlags:i,separateDialCode:n,i18n:s}=this.options,{name:r,dialCode:l,iso2:a=""}=t;if(e&&this.updateSelectedItem(a),this.selectedCountry){let d=a&&i?`${h.FLAG} iti__${a}`:`${h.FLAG} ${h.GLOBE}`,c,C,I;a?(C=r,c=s.selectedCountryAriaLabel.replace("${countryName}",r).replace("${dialCode}",`+${l}`),I=i?"":J()):(C=s.noCountrySelected,c=s.noCountrySelected,I=J()),this.selectedCountryInner.className=d,this.selectedCountry.setAttribute("title",C),this.selectedCountry.setAttribute(p.LABEL,c),this.selectedCountryInner.innerHTML=I}if(n){let d=l?`+${l}`:"";this.selectedDialCode.textContent=d,this.updateInputPadding()}}};var It=o=>{let{onlyCountries:t,excludeCountries:e}=o;if(t?.length){let i=t.map(n=>n.toLowerCase());return L.filter(n=>i.includes(n.iso2))}else if(e?.length){let i=e.map(n=>n.toLowerCase());return L.filter(n=>!i.includes(n.iso2))}return L},bt=(o,t)=>{let{countryNameLocale:e,i18n:i}=t,n;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?n=new Intl.DisplayNames(e,{type:"region"}):n=null}catch(s){console.error(s),n=null}for(let s of o)s.name=i[s.iso2]||n?.of(s.iso2.toUpperCase())||""},Et=o=>{let t=new Set,e=0,i={},n=(r,l)=>{if(!r||!l)return;l.length>e&&(e=l.length),i.hasOwnProperty(l)||(i[l]=[]);let a=i[l];a.includes(r)||a.push(r)},s=[...o].sort((r,l)=>r.priority-l.priority);for(let r of s){t.has(r.dialCode)||t.add(r.dialCode);for(let l=1;l<r.dialCode.length;l++){let a=r.dialCode.substring(0,l);n(r.iso2,a)}if(n(r.iso2,r.dialCode),r.areaCodes){let l=i[r.dialCode][0];for(let a of r.areaCodes){for(let d=1;d<a.length;d++){let c=a.substring(0,d),C=r.dialCode+c;n(l,C),n(r.iso2,C)}n(r.iso2,r.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLen:e,dialCodeToIso2Map:i}},_t=(o,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),o.sort((e,i)=>{let{countryOrder:n}=t;if(n){let s=n.indexOf(e.iso2),r=n.indexOf(i.iso2),l=s>-1,a=r>-1;if(l||a)return l&&a?s-r:l?-1:1}return e.name.localeCompare(i.name)})},vt=o=>{for(let t of o)t.normalisedName=$(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var Wt=new Set(["800","808","870","881","882","883","888","979"]),Z=o=>{let t=A(o).slice(0,3);return o.startsWith("+")&&Wt.has(t)};var tt=(o,t,e,i)=>{let n=o;if(e&&t){let s=`+${i.dialCode}`,r=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substring(r)}return n},Lt=(o,t,e,i,n)=>{let s=e?e.formatNumberAsYouType(o,i.iso2):o,{dialCode:r}=i;return n&&t.charAt(0)!=="+"&&s.includes(`+${r}`)?(s.split(`+${r}`)[1]||"").trim():s};var wt=(o,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===o&&!i)return s+1;if(i&&n===o+1)return s}return t.length};var $t=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],et=o=>{let t=A(o);if(t.startsWith(U.NANP)&&t.length>=4){let e=t.substring(1,4);return $t.includes(e)}return!1};var K=class{constructor(){}updateNumeralSet(t){/[\u0660-\u0669]/.test(t)?this.userNumeralSet="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.userNumeralSet="persian":this.userNumeralSet="ascii"}denormalise(t,e){if(this.userNumeralSet||this.updateNumeralSet(e),this.userNumeralSet==="ascii")return t;let i=this.userNumeralSet==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,n=>String.fromCharCode(i+Number(n)))}normalise(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,n=>String.fromCharCode(48+(n.charCodeAt(0)-e)))}isAscii(){return this.userNumeralSet==="ascii"}};var Vt=0,Kt=new Set(L.map(o=>o.iso2)),it=o=>Kt.has(o),j=class{constructor(t,e={}){this.id=Vt++,O.validateInput(t);let i=ct(e);this.options={...W,...i},ht(this.options),this.ui=new O(t,this.options,this.id),this.i=pt(),this.numerals=new K,this.promise=this._c(this.options),this.countries=It(this.options);let{dialCodes:n,dialCodeMaxLen:s,dialCodeToIso2Map:r}=Et(this.countries);this.dialCodes=n,this.dialCodeMaxLen=s,this.dialCodeToIso2Map=r,this.j=new Map(this.countries.map(l=>[l.iso2,l])),this._init()}_getTelInputValue(){let t=this.ui.telInput.value.trim();return this.numerals.normalise(t)}_setTelInputValue(t){let e=this.ui.telInput.value;this.ui.telInput.value=this.numerals.denormalise(t,e)}_c(t){let{initialCountry:e,geoIpLookup:i,loadUtils:n}=t,s=e===S.AUTO&&!!i,r=!!n&&!u.utils,l;s?l=new Promise((d,c)=>{this.b=d,this.c=c}):(l=Promise.resolve(void 0),this.b=()=>{},this.c=()=>{});let a;return r?a=new Promise((d,c)=>{this.d=d,this.e=c}):(a=Promise.resolve(void 0),this.d=()=>{},this.e=()=>{}),Promise.all([l,a])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h(),this.options.dropdownAlwaysOpen&&this._l()}_a(){bt(this.countries,this.options),_t(this.countries,this.options),vt(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),i=this.numerals.normalise(e),n=this._getTelInputValue(),r=i&&i.startsWith("+")&&(!n||!n.startsWith("+"))?i:n,l=this._ao(r),a=et(r),{initialCountry:d,geoIpLookup:c}=this.options,I=d===S.AUTO&&c&&!t,E=d.toLowerCase(),f=it(E);l?a?f?this._aj(E):I||this._aj(st.ISO2):this._ai(r):f?this._aj(E):I||this._aj(""),r&&this._ah(r)}_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=r=>{this.ui.isDropdownClosed()?this.ui.telInput.focus():r.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let n=()=>{this.ui.isDropdownClosed()&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",n,{signal:t});let s=r=>{let l=[g.ARROW_UP,g.ARROW_DOWN,g.SPACE,g.ENTER];this.ui.isDropdownClosed()&&l.includes(r.key)&&(r.preventDefault(),r.stopPropagation(),this._l()),r.key===g.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",s,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!u.utils){let s=()=>{u.attachUtils(t)?.catch(()=>{})};if(u.documentReady())s();else{let r=()=>{s()};window.addEventListener("load",r,{signal:this.g.signal})}}else this.d();e===S.AUTO&&i&&(this.selectedCountryData.iso2?this.b():this._i())}_i(){if(u.autoCountry)this.handleAutoCountry();else if(this.ui.selectedCountryInner.classList.add(h.LOADING),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function")){let t=(i="")=>{this.ui.selectedCountryInner.classList.remove(h.LOADING);let n=i.toLowerCase();it(n)?(u.autoCountry=n,setTimeout(()=>R("handleAutoCountry"))):R("handleAutoCountryFailure")},e=()=>{this.ui.selectedCountryInner.classList.remove(h.LOADING),R("handleAutoCountryFailure")};this.options.geoIpLookup(t,e)}}_m(){this._l(),this.ui.searchInput.value="+",this.ui.filterCountriesByQuery("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:n,countrySearch:s}=this.options,r=!1;T.ALPHA_UNICODE.test(this._getTelInputValue())&&(r=!0);let l=a=>{let d=this._getTelInputValue();if(this.i&&a?.data==="+"&&i&&n&&s){let f=this.ui.telInput.selectionStart||0,w=d.substring(0,f-1),_=d.substring(f);this._setTelInputValue(w+_),this._m();return}this._ai(d)&&this._ar();let c=a?.data&&T.NON_PLUS_NUMERIC.test(a.data),C=a?.inputType===z.PASTE&&d;c||C&&!t?r=!0:T.NON_PLUS_NUMERIC.test(d)||(r=!1);let I=a?.detail&&a.detail.isSetNumber,E=this.numerals.isAscii();if(e&&!r&&!I&&E){let f=this.ui.telInput.selectionStart||0,_=d.substring(0,f).replace(T.NON_PLUS_NUMERIC_GLOBAL,"").length,N=a?.inputType===z.DELETE_FWD,y=this._ap(),D=Lt(y,d,u.utils,this.selectedCountryData,i),v=wt(_,D,f,N);this._setTelInputValue(D),this.ui.telInput.setSelectionRange(v,v)}if(i&&d.startsWith("+")&&this.selectedCountryData.dialCode){let f=tt(d,!0,i,this.selectedCountryData);this._setTelInputValue(f)}};this.ui.telInput.addEventListener("input",l,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:n}=this.options;if(t||e){let s=r=>{if(r.key&&r.key.length===1&&!r.altKey&&!r.ctrlKey&&!r.metaKey){if(e&&i&&n&&r.key==="+"){r.preventDefault(),this._m();return}if(t){let l=this._getTelInputValue(),d=!l.startsWith("+")&&this.ui.telInput.selectionStart===0&&r.key==="+",c=this.numerals.normalise(r.key),C=/^[0-9]$/.test(c),I=e?C:d||C,E=this.ui.telInput,f=E.selectionStart,w=E.selectionEnd,_=l.slice(0,f),N=l.slice(w),y=_+r.key+N,D=this._ap(y),v=u.utils.getCoreNumber(D,this.selectedCountryData.iso2),G=this.n&&v.length>this.n,Nt=this._s(D)!==null;(!I||G&&!Nt&&!d)&&r.preventDefault()}}};this.ui.telInput.addEventListener("keydown",s,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,n=i.selectionStart,s=i.selectionEnd,r=this._getTelInputValue(),l=r.slice(0,n),a=r.slice(s),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),C=this.numerals.normalise(c),I=n===0&&s>0,E=!r.startsWith("+")||I,f=C.replace(T.NON_PLUS_NUMERIC_GLOBAL,""),w=f.startsWith("+"),_=f.replace(/\+/g,""),N=w&&E?`+${_}`:_,y=l+N+a;if(y.length>5){let v=u.utils.getCoreNumber(y,d);for(;v.length===0&&y.length>0;)y=y.slice(0,-1),v=u.utils.getCoreNumber(y,d);if(!v)return;if(this.n&&v.length>this.n)if(i.selectionEnd===r.length){let G=v.length-this.n;y=y.slice(0,y.length-G)}else return}this._setTelInputValue(y);let D=n+N.length;i.setSelectionRange(D,D),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{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(this.h=new AbortController,this.ui.openDropdown(),!e&&t){let i=()=>this._am();window.addEventListener("scroll",i,{signal:this.h.signal})}this._y(),this._as(M.OPEN_COUNTRY_DROPDOWN)}_y(){let t=this.h.signal;this._z(t),this._aa(t),this.options.dropdownAlwaysOpen||this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=i=>{let n=i.target?.closest(`.${h.COUNTRY_ITEM}`);n&&this.ui.highlightListItem(n,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=i=>{let n=i.target?.closest(`.${h.COUNTRY_ITEM}`);n&&this._al(n)};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,n=s=>{[g.ARROW_UP,g.ARROW_DOWN,g.ENTER,g.ESC].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key===g.ARROW_UP||s.key===g.ARROW_DOWN?this.ui.handleUpDownKey(s.key):s.key===g.ENTER?this._ag():s.key===g.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&T.HIDDEN_SEARCH_CHAR.test(s.key)&&(s.stopPropagation(),i&&clearTimeout(i),e+=s.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},k.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",n,{signal:t})}_ad(t){this.ui.searchInput.addEventListener("input",()=>this.ui.handleSearchChange(),{signal:t}),this.ui.k.addEventListener("click",()=>this.ui.handleSearchClear(),{signal:t})}_q(t){let e=Ct(this.countries,t);if(e){let i=e.nodeById[this.id];this.ui.highlightListItem(i,!1),this.ui.scrollTo(i)}}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let{formatOnDisplay:e,nationalMode:i,separateDialCode:n}=this.options,s=t;if(e&&u.utils&&this.selectedCountryData){let r=Z(t),l=i&&!r||!s.startsWith("+")&&!n,{NATIONAL:a,INTERNATIONAL:d}=u.utils.numberFormat,c=l?a:d;s=u.utils.formatNumber(s,this.selectedCountryData.iso2,c)}s=this._aq(s),this._setTelInputValue(s)}_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 r=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${r}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.iso2,s=this.selectedCountryData.dialCode;i=this._r(i);let r=this._ao(i,!0),l=A(i);if(r){let a=A(r),d=this.dialCodeToIso2Map[a];if(d.length===1)return d[0]===n?null:d[0];if(!n&&this.f&&d.includes(this.f))return this.f;if(s===U.NANP&&et(l))return null;let{areaCodes:C,priority:I}=this.selectedCountryData;if(C){let N=C.map(y=>`${s}${y}`);for(let y of N)if(l.startsWith(y))return null}let f=C&&!(I===0)&&l.length>a.length,w=n&&d.includes(n)&&!f,_=n===d[0];if(!w&&!_)return d[0]}else if(i.startsWith("+")&&l.length){let a=this.selectedCountryData.dialCode||"";return a&&a.startsWith(l)?null:""}else if((!i||i==="+")&&!n&&this.f)return this.f;return null}_aj(t){let e=this.selectedCountryData.iso2||"";return this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.setCountry(this.selectedCountryData),this._ak(),this._t(),e!==t}_t(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.options,{iso2:n}=this.selectedCountryData;if(t&&u.utils)if(n){let s=u.utils.numberType[e],r=u.utils.getExampleNumber(n,!1,s,!0),l=r;for(;u.utils.isPossibleNumber(r,n,i);)l=r,r+="0";let a=u.utils.getCoreNumber(l,n);this.n=a.length,n==="by"&&(this.n=a.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.options,s=t===P.AGGRESSIVE||!this.ui.a&&t===P.POLITE;if(u.utils&&s){let r=u.utils.numberType[e],l=this.selectedCountryData.iso2?u.utils.getExampleNumber(this.selectedCountryData.iso2,i,r):"";l=this._aq(l),typeof n=="function"&&(l=n(l,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",l)}}_al(t){let e=t.dataset[q.COUNTRY_CODE],i=this._aj(e);this._am();let n=t.dataset[q.DIAL_CODE];if(this._an(n),this.options.formatOnDisplay){let s=this._getTelInputValue();this._ah(s)}this.ui.telInput.focus(),i&&this._ar()}_am(){this.ui.isDropdownClosed()||this.options.dropdownAlwaysOpen||(this.ui.closeDropdown(),this.h.abort(),this.h=null,this._as(M.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this._getTelInputValue(),i=`+${t}`,n;if(e.startsWith("+")){let s=this._ao(e);s?n=e.replace(s,i):n=i,this._setTelInputValue(n)}}_ao(t,e){let i="";if(t.startsWith("+")){let n="",s=!1;for(let r=0;r<t.length;r++){let l=t.charAt(r);if(/[0-9]/.test(l)){if(n+=l,!!!this.dialCodeToIso2Map[n])break;if(this.dialCodes.has(n)){if(i=t.substring(0,r+1),s=!0,!e)break}else e&&s&&(i=t.substring(0,r+1));if(n.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t?this.numerals.normalise(t):this._getTelInputValue(),{dialCode:i}=this.selectedCountryData,n,s=A(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&s?n=`+${i}`:n="",n+e}_aq(t){let e=!!this._ao(t),i=tt(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(M.COUNTRY_CHANGE)}handleAutoCountry(){if(!this.ui?.telInput){this.b?.();return}this.options.initialCountry===S.AUTO&&u.autoCountry&&(this.f=u.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleAutoCountryFailure(){if(!this.ui?.telInput){this.c?.();return}this._d(!0),this.c()}handleUtils(){if(!this.ui?.telInput){this.d?.();return}if(u.utils){let t=this._getTelInputValue();t&&this._ah(t),this.selectedCountryData.iso2&&(this._ak(),this._t())}this.d()}handleUtilsFailure(t){if(!this.ui?.telInput){this.e?.(t);return}this.e(t)}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(),n=u.utils.formatNumber(i,e,t),s=this.ui.telInput.value;return this.numerals.denormalise(n,s)}return""}getNumberType(){return u.utils?u.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):X.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(u.utils){let{iso2:t}=this.selectedCountryData;return u.utils.getValidationError(this._ap(),t)}return X.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===B.DIAL_CODE&&u.utils){let i=this._ap(),n=u.utils.getCoreNumber(i,e);if(n[0]===B.MOBILE_PREFIX&&n.length!==B.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;let{allowNumberExtensions:e,allowPhonewords:i}=this.options,n=a=>t?this._w(a):this._u(a),s=this._ap();if(!this.selectedCountryData.iso2&&!Z(s)||!n(s))return!1;if(s.search(T.ALPHA_UNICODE)>-1){let a=this.selectedCountryData.iso2;return u.utils.getExtension(s,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(!it(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 s=this._getTelInputValue();this._ah(s)}this._ar()}}setNumber(t){let e=this.numerals.normalise(t),i=this._ai(e);this._ah(e),i&&this._ar(),this._as(M.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")}},jt=o=>{if(!u.utils&&!u.startedLoadingUtilsScript){let t;if(typeof o=="function")try{t=Promise.resolve(o())}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 o}`));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,R("handleUtils"),!0}).catch(e=>{throw R("handleUtilsFailure",e),e})}return null},R=(o,...t)=>{Object.values(u.instances).forEach(e=>{let i=e[o];typeof i=="function"&&i.apply(e,t)})},u=Object.assign((o,t)=>{let e=new j(o,t);return u.instances[e.id]=e,o.iti=e,e},{defaults:W,documentReady:()=>document.readyState==="complete",getCountryData:()=>L,getInstance:o=>{let t=o.dataset.intlTelInputId;return t?u.instances[t]:null},instances:{},attachUtils:jt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.5.1"}),Gt=u;return Ot(Yt);})();
34
+ </svg>`;var O=class{constructor(t,e,i){this.searchKeyupTimer=null;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)}static validateInput(t){let e=t?.tagName;if(!(!!t&&typeof t=="object"&&e==="INPUT"&&typeof t.setAttribute=="function")){let n=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${n}`)}}generateMarkup(t){this.countries=t,this.telInput.classList.add("iti__tel-input"),this.telInput.hasAttribute("autocomplete")||this.telInput.setAttribute("autocomplete","tel"),this.telInput.hasAttribute("inputmode")||this.telInput.setAttribute("inputmode","tel");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:n}=this.options,s=V({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!n,[i]:!!i}),r=m("div",{class:s});return this.isRTL&&r.setAttribute("dir","ltr"),this.telInput.before(r),r}_av(t){let{allowDropdown:e,separateDialCode:i,showFlags:n}=this.options;if(e||n||i){this.countryContainer=m("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=m("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=m("div",{class:"iti__selected-country"},this.countryContainer);let s=m("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=m("div",{class:h.FLAG},s),e&&(this.dropdownArrow=m("div",{class:"iti__arrow",[p.HIDDEN]:"true"},s)),i&&(this.selectedDialCode=m("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:n,dropdownContainer:s,containerClass:r}=this.options,l=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=m("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=m("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:n.countryListAriaLabel},this.dropdownContent),this._ba(),i&&this.updateSearchResultsA11yText(),s){let a=V({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[r]:!!r});this.dropdown=m("div",{class:a}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t}=this.options,e=m("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=m("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},e),this.searchIcon.innerHTML=yt(),this.searchInput=m("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=m("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},e),this.k.innerHTML=ft(this.id),this.l=m("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=m("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")||"",n=e(i);if(n.phone){let s=this.telInput.form?.querySelector(`input[name="${n.phone}"]`);s?this.hiddenInput=s:(this.hiddenInput=m("input",{type:"hidden",name:n.phone}),t.appendChild(this.hiddenInput))}if(n.country){let s=this.telInput.form?.querySelector(`input[name="${n.country}"]`);s?this.m=s:(this.m=m("input",{type:"hidden",name:n.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let i=this.countries[e],n=V({[h.COUNTRY_ITEM]:!0}),s=m("li",{id:`iti-${this.id}__item-${i.iso2}`,class:n,tabindex:"-1",role:"option",[p.SELECTED]:"false"});s.dataset.dialCode=i.dialCode,s.dataset.countryCode=i.iso2,i.nodeById[this.id]=s,this.options.showFlags&&m("div",{class:`${h.FLAG} iti__${i.iso2}`},s);let r=m("span",{class:"iti__country-name"},s);r.textContent=i.name;let l=m("span",{class:"iti__dial-code"},r);this.isRTL&&l.setAttribute("dir","ltr"),l.textContent=`+${i.dialCode}`,t.appendChild(s)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?H.SANE_SELECTED_WITH_DIAL_WIDTH:H.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+H.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 n=this.selectedCountry.cloneNode(!0);i.appendChild(n);let s=n.offsetWidth;return t.removeChild(e),s}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount;this.l.textContent=t.searchSummaryAria(e)}filterCountriesByQuery(t){let e;t===""?e=this.countries:e=mt(this.countries,t),this.filterCountries(e)}doFilter(){let t=this.searchInput.value.trim();this.filterCountriesByQuery(t),this.searchInput.value?this.k.classList.remove(h.HIDE):this.k.classList.add(h.HIDE)}handleSearchChange(){this.searchKeyupTimer&&clearTimeout(this.searchKeyupTimer),this.searchKeyupTimer=setTimeout(()=>{this.doFilter(),this.searchKeyupTimer=null},k.SEARCH_DEBOUNCE_MS)}handleSearchClear(){this.searchInput.value="",this.searchInput.focus(),this.doFilter()}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,r=s+n,l=t.offsetHeight,a=t.getBoundingClientRect().top+i,d=a+l,c=a-s+e.scrollTop;if(a<s)e.scrollTop=c;else if(d>r){let C=n-l;e.scrollTop=c-C}}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 n=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,n)}e&&this.highlightedItem.focus()}handleUpDownKey(t){let e=t===g.ARROW_UP?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t===g.ARROW_UP?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this.scrollTo(e),this.highlightListItem(e,!1))}updateSelectedItem(t){if(this.selectedItem&&this.selectedItem.dataset.countryCode!==t&&(this.selectedItem.setAttribute(p.SELECTED,"false"),this.selectedItem.querySelector(".iti__country-check")?.remove(),this.selectedItem=null),t&&!this.selectedItem){let e=this.countryList.querySelector(`[data-country-code="${t}"]`);if(e){e.setAttribute(p.SELECTED,"true");let i=m("span",{class:"iti__country-check",[p.HIDDEN]:"true"},e);i.innerHTML=gt(),this.selectedItem=e}}}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let i of t){let n=i.nodeById[this.id];n&&(this.countryList.appendChild(n),e&&(this.highlightListItem(n,!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}openDropdown(){let{fixDropdownWidth:t,countrySearch:e,dropdownAlwaysOpen:i}=this.options;if(t&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"true"),this.setDropdownPosition(),e){let n=this.countryList.firstElementChild;n&&(this.highlightListItem(n,!1),this.countryList.scrollTop=0),i||this.searchInput.focus()}this.dropdownArrow.classList.add(h.ARROW_UP)}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.options;this.dropdownContent.classList.add(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"false"),t&&(this.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.highlightedItem&&(this.highlightedItem.classList.remove(h.HIGHLIGHT),this.highlightedItem=null)),this.dropdownArrow.classList.remove(h.ARROW_UP),e&&this.dropdown.remove()}setDropdownPosition(){let{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(t&&t.appendChild(this.dropdown),!e){let i=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;t&&this.dropdown&&(this.dropdown.style.top=`${i.top+n}px`,this.dropdown.style.left=`${i.left}px`)}}isDropdownClosed(){return this.dropdownContent.classList.contains(h.HIDE)}setCountry(t){let{allowDropdown:e,showFlags:i,separateDialCode:n,i18n:s}=this.options,{name:r,dialCode:l,iso2:a=""}=t;if(e&&this.updateSelectedItem(a),this.selectedCountry){let d=a&&i?`${h.FLAG} iti__${a}`:`${h.FLAG} ${h.GLOBE}`,c,C,I;a?(C=r,c=s.selectedCountryAriaLabel.replace("${countryName}",r).replace("${dialCode}",`+${l}`),I=i?"":J()):(C=s.noCountrySelected,c=s.noCountrySelected,I=J()),this.selectedCountryInner.className=d,this.selectedCountry.setAttribute("title",C),this.selectedCountry.setAttribute(p.LABEL,c),this.selectedCountryInner.innerHTML=I}if(n){let d=l?`+${l}`:"";this.selectedDialCode.textContent=d,this.updateInputPadding()}}};var It=o=>{let{onlyCountries:t,excludeCountries:e}=o;if(t?.length){let i=t.map(n=>n.toLowerCase());return L.filter(n=>i.includes(n.iso2))}else if(e?.length){let i=e.map(n=>n.toLowerCase());return L.filter(n=>!i.includes(n.iso2))}return L},bt=(o,t)=>{let{countryNameLocale:e,i18n:i}=t,n;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?n=new Intl.DisplayNames(e,{type:"region"}):n=null}catch(s){console.error(s),n=null}for(let s of o)s.name=i[s.iso2]||n?.of(s.iso2.toUpperCase())||""},Et=o=>{let t=new Set,e=0,i={},n=(r,l)=>{if(!r||!l)return;l.length>e&&(e=l.length),i.hasOwnProperty(l)||(i[l]=[]);let a=i[l];a.includes(r)||a.push(r)},s=[...o].sort((r,l)=>r.priority-l.priority);for(let r of s){t.has(r.dialCode)||t.add(r.dialCode);for(let l=1;l<r.dialCode.length;l++){let a=r.dialCode.substring(0,l);n(r.iso2,a)}if(n(r.iso2,r.dialCode),r.areaCodes){let l=i[r.dialCode][0];for(let a of r.areaCodes){for(let d=1;d<a.length;d++){let c=a.substring(0,d),C=r.dialCode+c;n(l,C),n(r.iso2,C)}n(r.iso2,r.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLen:e,dialCodeToIso2Map:i}},_t=(o,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),o.sort((e,i)=>{let{countryOrder:n}=t;if(n){let s=n.indexOf(e.iso2),r=n.indexOf(i.iso2),l=s>-1,a=r>-1;if(l||a)return l&&a?s-r:l?-1:1}return e.name.localeCompare(i.name)})},vt=o=>{for(let t of o)t.normalisedName=$(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var Wt=new Set(["800","808","870","881","882","883","888","979"]),Z=o=>{let t=A(o).slice(0,3);return o.startsWith("+")&&Wt.has(t)};var tt=(o,t,e,i)=>{let n=o;if(e&&t){let s=`+${i.dialCode}`,r=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substring(r)}return n},Lt=(o,t,e,i,n)=>{let s=e?e.formatNumberAsYouType(o,i.iso2):o,{dialCode:r}=i;return n&&t.charAt(0)!=="+"&&s.includes(`+${r}`)?(s.split(`+${r}`)[1]||"").trim():s};var wt=(o,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===o&&!i)return s+1;if(i&&n===o+1)return s}return t.length};var $t=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],et=o=>{let t=A(o);if(t.startsWith(U.NANP)&&t.length>=4){let e=t.substring(1,4);return $t.includes(e)}return!1};var K=class{constructor(){}updateNumeralSet(t){/[\u0660-\u0669]/.test(t)?this.userNumeralSet="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.userNumeralSet="persian":this.userNumeralSet="ascii"}denormalise(t,e){if(this.userNumeralSet||this.updateNumeralSet(e),this.userNumeralSet==="ascii")return t;let i=this.userNumeralSet==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,n=>String.fromCharCode(i+Number(n)))}normalise(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,n=>String.fromCharCode(48+(n.charCodeAt(0)-e)))}isAscii(){return this.userNumeralSet==="ascii"}};var Vt=0,Kt=new Set(L.map(o=>o.iso2)),it=o=>Kt.has(o),j=class{constructor(t,e={}){this.id=Vt++,O.validateInput(t);let i=ct(e);this.options={...W,...i},ht(this.options),this.ui=new O(t,this.options,this.id),this.i=pt(),this.numerals=new K,this.promise=this._c(this.options),this.countries=It(this.options);let{dialCodes:n,dialCodeMaxLen:s,dialCodeToIso2Map:r}=Et(this.countries);this.dialCodes=n,this.dialCodeMaxLen=s,this.dialCodeToIso2Map=r,this.j=new Map(this.countries.map(l=>[l.iso2,l])),this._init()}_getTelInputValue(){let t=this.ui.telInput.value.trim();return this.numerals.normalise(t)}_setTelInputValue(t){let e=this.ui.telInput.value;this.ui.telInput.value=this.numerals.denormalise(t,e)}_c(t){let{initialCountry:e,geoIpLookup:i,loadUtils:n}=t,s=e===S.AUTO&&!!i,r=!!n&&!u.utils,l;s?l=new Promise((d,c)=>{this.b=d,this.c=c}):(l=Promise.resolve(void 0),this.b=()=>{},this.c=()=>{});let a;return r?a=new Promise((d,c)=>{this.d=d,this.e=c}):(a=Promise.resolve(void 0),this.d=()=>{},this.e=()=>{}),Promise.all([l,a])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h(),this.options.dropdownAlwaysOpen&&this._l()}_a(){bt(this.countries,this.options),_t(this.countries,this.options),vt(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),i=this.numerals.normalise(e),n=this._getTelInputValue(),r=i&&i.startsWith("+")&&(!n||!n.startsWith("+"))?i:n,l=this._ao(r),a=et(r),{initialCountry:d,geoIpLookup:c}=this.options,I=d===S.AUTO&&c&&!t,E=d.toLowerCase(),f=it(E);l?a?f?this._aj(E):I||this._aj(st.ISO2):this._ai(r):f?this._aj(E):I||this._aj(""),r&&this._ah(r)}_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=r=>{this.ui.isDropdownClosed()?this.ui.telInput.focus():r.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let n=()=>{this.ui.isDropdownClosed()&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",n,{signal:t});let s=r=>{let l=[g.ARROW_UP,g.ARROW_DOWN,g.SPACE,g.ENTER];this.ui.isDropdownClosed()&&l.includes(r.key)&&(r.preventDefault(),r.stopPropagation(),this._l()),r.key===g.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",s,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!u.utils){let s=()=>{u.attachUtils(t)?.catch(()=>{})};if(u.documentReady())s();else{let r=()=>{s()};window.addEventListener("load",r,{signal:this.g.signal})}}else this.d();e===S.AUTO&&i&&(this.selectedCountryData.iso2?this.b():this._i())}_i(){if(u.autoCountry)this.handleAutoCountry();else if(this.ui.selectedCountryInner.classList.add(h.LOADING),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function")){let t=(i="")=>{this.ui.selectedCountryInner.classList.remove(h.LOADING);let n=i.toLowerCase();it(n)?(u.autoCountry=n,setTimeout(()=>R("handleAutoCountry"))):R("handleAutoCountryFailure")},e=()=>{this.ui.selectedCountryInner.classList.remove(h.LOADING),R("handleAutoCountryFailure")};this.options.geoIpLookup(t,e)}}_m(){this._l(),this.ui.searchInput.value="+",this.ui.filterCountriesByQuery("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:n,countrySearch:s}=this.options,r=!1;T.ALPHA_UNICODE.test(this._getTelInputValue())&&(r=!0);let l=a=>{let d=this._getTelInputValue();if(this.i&&a?.data==="+"&&i&&n&&s){let f=this.ui.telInput.selectionStart||0,w=d.substring(0,f-1),_=d.substring(f);this._setTelInputValue(w+_),this._m();return}this._ai(d)&&this._ar();let c=a?.data&&T.NON_PLUS_NUMERIC.test(a.data),C=a?.inputType===z.PASTE&&d;c||C&&!t?r=!0:T.NON_PLUS_NUMERIC.test(d)||(r=!1);let I=a?.detail&&a.detail.isSetNumber,E=this.numerals.isAscii();if(e&&!r&&!I&&E){let f=this.ui.telInput.selectionStart||0,_=d.substring(0,f).replace(T.NON_PLUS_NUMERIC_GLOBAL,"").length,N=a?.inputType===z.DELETE_FWD,y=this._ap(),D=Lt(y,d,u.utils,this.selectedCountryData,i),v=wt(_,D,f,N);this._setTelInputValue(D),this.ui.telInput.setSelectionRange(v,v)}if(i&&d.startsWith("+")&&this.selectedCountryData.dialCode){let f=tt(d,!0,i,this.selectedCountryData);this._setTelInputValue(f)}};this.ui.telInput.addEventListener("input",l,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:n}=this.options;if(t||e){let s=r=>{if(r.key&&r.key.length===1&&!r.altKey&&!r.ctrlKey&&!r.metaKey){if(e&&i&&n&&r.key==="+"){r.preventDefault(),this._m();return}if(t){let l=this._getTelInputValue(),d=!l.startsWith("+")&&this.ui.telInput.selectionStart===0&&r.key==="+",c=this.numerals.normalise(r.key),C=/^[0-9]$/.test(c),I=e?C:d||C,E=this.ui.telInput,f=E.selectionStart,w=E.selectionEnd,_=l.slice(0,f),N=l.slice(w),y=_+r.key+N,D=this._ap(y),v=u.utils.getCoreNumber(D,this.selectedCountryData.iso2),G=this.n&&v.length>this.n,Nt=this._s(D)!==null;(!I||G&&!Nt&&!d)&&r.preventDefault()}}};this.ui.telInput.addEventListener("keydown",s,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,n=i.selectionStart,s=i.selectionEnd,r=this._getTelInputValue(),l=r.slice(0,n),a=r.slice(s),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),C=this.numerals.normalise(c),I=n===0&&s>0,E=!r.startsWith("+")||I,f=C.replace(T.NON_PLUS_NUMERIC_GLOBAL,""),w=f.startsWith("+"),_=f.replace(/\+/g,""),N=w&&E?`+${_}`:_,y=l+N+a;if(y.length>5){let v=u.utils.getCoreNumber(y,d);for(;v.length===0&&y.length>0;)y=y.slice(0,-1),v=u.utils.getCoreNumber(y,d);if(!v)return;if(this.n&&v.length>this.n)if(i.selectionEnd===r.length){let G=v.length-this.n;y=y.slice(0,y.length-G)}else return}this._setTelInputValue(y);let D=n+N.length;i.setSelectionRange(D,D),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{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(this.h=new AbortController,this.ui.openDropdown(),!e&&t){let i=()=>this._am();window.addEventListener("scroll",i,{signal:this.h.signal})}this._y(),this._as(M.OPEN_COUNTRY_DROPDOWN)}_y(){let t=this.h.signal;this._z(t),this._aa(t),this.options.dropdownAlwaysOpen||this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=i=>{let n=i.target?.closest(`.${h.COUNTRY_ITEM}`);n&&this.ui.highlightListItem(n,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=i=>{let n=i.target?.closest(`.${h.COUNTRY_ITEM}`);n&&this._al(n)};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,n=s=>{[g.ARROW_UP,g.ARROW_DOWN,g.ENTER,g.ESC].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key===g.ARROW_UP||s.key===g.ARROW_DOWN?this.ui.handleUpDownKey(s.key):s.key===g.ENTER?this._ag():s.key===g.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&T.HIDDEN_SEARCH_CHAR.test(s.key)&&(s.stopPropagation(),i&&clearTimeout(i),e+=s.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},k.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",n,{signal:t})}_ad(t){this.ui.searchInput.addEventListener("input",()=>this.ui.handleSearchChange(),{signal:t}),this.ui.k.addEventListener("click",()=>this.ui.handleSearchClear(),{signal:t})}_q(t){let e=Ct(this.countries,t);if(e){let i=e.nodeById[this.id];this.ui.highlightListItem(i,!1),this.ui.scrollTo(i)}}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let{formatOnDisplay:e,nationalMode:i,separateDialCode:n}=this.options,s=t;if(e&&u.utils&&this.selectedCountryData){let r=Z(t),l=i&&!r||!s.startsWith("+")&&!n,{NATIONAL:a,INTERNATIONAL:d}=u.utils.numberFormat,c=l?a:d;s=u.utils.formatNumber(s,this.selectedCountryData.iso2,c)}s=this._aq(s),this._setTelInputValue(s)}_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 r=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${r}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.iso2,s=this.selectedCountryData.dialCode;i=this._r(i);let r=this._ao(i,!0),l=A(i);if(r){let a=A(r),d=this.dialCodeToIso2Map[a];if(d.length===1)return d[0]===n?null:d[0];if(!n&&this.f&&d.includes(this.f))return this.f;if(s===U.NANP&&et(l))return null;let{areaCodes:C,priority:I}=this.selectedCountryData;if(C){let N=C.map(y=>`${s}${y}`);for(let y of N)if(l.startsWith(y))return null}let f=C&&!(I===0)&&l.length>a.length,w=n&&d.includes(n)&&!f,_=n===d[0];if(!w&&!_)return d[0]}else if(i.startsWith("+")&&l.length){let a=this.selectedCountryData.dialCode||"";return a&&a.startsWith(l)?null:""}else if((!i||i==="+")&&!n&&this.f)return this.f;return null}_aj(t){let e=this.selectedCountryData.iso2||"";return this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.setCountry(this.selectedCountryData),this._ak(),this._t(),e!==t}_t(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.options,{iso2:n}=this.selectedCountryData;if(t&&u.utils)if(n){let s=u.utils.numberType[e],r=u.utils.getExampleNumber(n,!1,s,!0),l=r;for(;u.utils.isPossibleNumber(r,n,i);)l=r,r+="0";let a=u.utils.getCoreNumber(l,n);this.n=a.length,n==="by"&&(this.n=a.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.options,s=t===P.AGGRESSIVE||!this.ui.a&&t===P.POLITE;if(u.utils&&s){let r=u.utils.numberType[e],l=this.selectedCountryData.iso2?u.utils.getExampleNumber(this.selectedCountryData.iso2,i,r):"";l=this._aq(l),typeof n=="function"&&(l=n(l,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",l)}}_al(t){let e=t.dataset[q.COUNTRY_CODE],i=this._aj(e);this._am();let n=t.dataset[q.DIAL_CODE];if(this._an(n),this.options.formatOnDisplay){let s=this._getTelInputValue();this._ah(s)}this.ui.telInput.focus(),i&&this._ar()}_am(){this.ui.isDropdownClosed()||this.options.dropdownAlwaysOpen||(this.ui.closeDropdown(),this.h.abort(),this.h=null,this._as(M.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this._getTelInputValue(),i=`+${t}`,n;if(e.startsWith("+")){let s=this._ao(e);s?n=e.replace(s,i):n=i,this._setTelInputValue(n)}}_ao(t,e){let i="";if(t.startsWith("+")){let n="",s=!1;for(let r=0;r<t.length;r++){let l=t.charAt(r);if(/[0-9]/.test(l)){if(n+=l,!!!this.dialCodeToIso2Map[n])break;if(this.dialCodes.has(n)){if(i=t.substring(0,r+1),s=!0,!e)break}else e&&s&&(i=t.substring(0,r+1));if(n.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t?this.numerals.normalise(t):this._getTelInputValue(),{dialCode:i}=this.selectedCountryData,n,s=A(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&s?n=`+${i}`:n="",n+e}_aq(t){let e=!!this._ao(t),i=tt(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(M.COUNTRY_CHANGE)}handleAutoCountry(){if(!this.ui?.telInput){this.b?.();return}this.options.initialCountry===S.AUTO&&u.autoCountry&&(this.f=u.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleAutoCountryFailure(){if(!this.ui?.telInput){this.c?.();return}this._d(!0),this.c()}handleUtils(){if(!this.ui?.telInput){this.d?.();return}if(u.utils){let t=this._getTelInputValue();t&&this._ah(t),this.selectedCountryData.iso2&&(this._ak(),this._t())}this.d()}handleUtilsFailure(t){if(!this.ui?.telInput){this.e?.(t);return}this.e(t)}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(),n=u.utils.formatNumber(i,e,t),s=this.ui.telInput.value;return this.numerals.denormalise(n,s)}return""}getNumberType(){return u.utils?u.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):X.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(u.utils){let{iso2:t}=this.selectedCountryData;return u.utils.getValidationError(this._ap(),t)}return X.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===B.DIAL_CODE&&u.utils){let i=this._ap(),n=u.utils.getCoreNumber(i,e);if(n[0]===B.MOBILE_PREFIX&&n.length!==B.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;let{allowNumberExtensions:e,allowPhonewords:i}=this.options,n=a=>t?this._w(a):this._u(a),s=this._ap();if(!this.selectedCountryData.iso2&&!Z(s)||!n(s))return!1;if(s.search(T.ALPHA_UNICODE)>-1){let a=this.selectedCountryData.iso2;return u.utils.getExtension(s,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(!it(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 s=this._getTelInputValue();this._ah(s)}this._ar()}}setNumber(t){let e=this.numerals.normalise(t),i=this._ai(e);this._ah(e),i&&this._ar(),this._as(M.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")}},jt=o=>{if(!u.utils&&!u.startedLoadingUtilsScript){let t;if(typeof o=="function")try{t=Promise.resolve(o())}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 o}`));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,R("handleUtils"),!0}).catch(e=>{throw R("handleUtilsFailure",e),e})}return null},R=(o,...t)=>{Object.values(u.instances).forEach(e=>{let i=e[o];typeof i=="function"&&i.apply(e,t)})},u=Object.assign((o,t)=>{let e=new j(o,t);return u.instances[e.id]=e,o.iti=e,e},{defaults:W,documentReady:()=>document.readyState==="complete",getCountryData:()=>L,getInstance:o=>{let t=o.dataset.intlTelInputId;return t?u.instances[t]:null},instances:{},attachUtils:jt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.5.2"}),Gt=u;return Ot(Yt);})();
35
35
 
36
36
  // UMD
37
37
  return factoryOutput.default;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v26.5.1
2
+ * International Telephone Input v26.5.2
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -4207,7 +4207,7 @@ var factoryOutput = (() => {
4207
4207
  attachUtils,
4208
4208
  startedLoadingUtilsScript: false,
4209
4209
  startedLoadingAutoCountry: false,
4210
- version: "26.5.1"
4210
+ version: "26.5.2"
4211
4211
  }
4212
4212
  );
4213
4213
  var intl_tel_input_default = intlTelInput;