intl-tel-input 25.13.0 → 25.13.1

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
@@ -81,16 +81,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
81
81
  ## Getting Started (Using a CDN)
82
82
  1. Add the CSS
83
83
  ```html
84
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.0/build/css/intlTelInput.css">
84
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.1/build/css/intlTelInput.css">
85
85
  ```
86
86
 
87
87
  2. Add the plugin script and initialise it on your input element
88
88
  ```html
89
- <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.0/build/js/intlTelInput.min.js"></script>
89
+ <script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.1/build/js/intlTelInput.min.js"></script>
90
90
  <script>
91
91
  const input = document.querySelector("#phone");
92
92
  window.intlTelInput(input, {
93
- loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.0/build/js/utils.js"),
93
+ loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.1/build/js/utils.js"),
94
94
  });
95
95
  </script>
96
96
  ```
@@ -328,12 +328,12 @@ Set the initial country selection by specifying its country code, e.g. `"us"` fo
328
328
  Type: `() => Promise<module>` Default: `null`
329
329
  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.
330
330
 
331
- The `loadUtils` option takes a function that returns a Promise resolving to the utils module (see example code below). You can `import` the utils module in different ways: (A) from a CDN, (B) from your own hosted version of [utils.js](https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.0/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package.
331
+ The `loadUtils` option takes a function that returns a Promise resolving to the utils module (see example code below). You can `import` the utils module in different ways: (A) from a CDN, (B) from your own hosted version of [utils.js](https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.1/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package.
332
332
 
333
333
  ```js
334
334
  // (A) import utils module from a CDN
335
335
  intlTelInput(htmlInputElement, {
336
- loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.0/build/js/utils.js"),
336
+ loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.13.1/build/js/utils.js"),
337
337
  });
338
338
 
339
339
  // (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@25.13.0/build/js/utils.js"`.
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@25.13.1/build/js/utils.js"`.
58
58
 
59
59
  ## Props
60
60
 
@@ -2627,11 +2627,11 @@ var translateCountryNames = (countries, options) => {
2627
2627
  }
2628
2628
  }
2629
2629
  };
2630
- var processDialCodes = (countries, options) => {
2630
+ var processDialCodes = (countries) => {
2631
2631
  const dialCodes = /* @__PURE__ */ new Set();
2632
2632
  let dialCodeMaxLen = 0;
2633
2633
  const dialCodeToIso2Map = {};
2634
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2634
+ const _addToDialCodeMap = (iso2, dialCode) => {
2635
2635
  if (!iso2 || !dialCode) {
2636
2636
  return;
2637
2637
  }
@@ -2645,10 +2645,10 @@ var processDialCodes = (countries, options) => {
2645
2645
  if (iso2List.includes(iso2)) {
2646
2646
  return;
2647
2647
  }
2648
- const index = priority !== void 0 ? priority : iso2List.length;
2649
- iso2List[index] = iso2;
2648
+ iso2List.push(iso2);
2650
2649
  };
2651
- for (const c of countries) {
2650
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2651
+ for (const c of countriesSortedByPriority) {
2652
2652
  if (!dialCodes.has(c.dialCode)) {
2653
2653
  dialCodes.add(c.dialCode);
2654
2654
  }
@@ -2656,14 +2656,7 @@ var processDialCodes = (countries, options) => {
2656
2656
  const partialDialCode = c.dialCode.substring(0, k);
2657
2657
  _addToDialCodeMap(c.iso2, partialDialCode);
2658
2658
  }
2659
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2660
- }
2661
- if (options.onlyCountries.length || options.excludeCountries.length) {
2662
- dialCodes.forEach((dialCode) => {
2663
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2664
- });
2665
- }
2666
- for (const c of countries) {
2659
+ _addToDialCodeMap(c.iso2, c.dialCode);
2667
2660
  if (c.areaCodes) {
2668
2661
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2669
2662
  for (const areaCode of c.areaCodes) {
@@ -2795,7 +2788,7 @@ var Iti = class _Iti {
2795
2788
  this.isAndroid = _Iti._getIsAndroid();
2796
2789
  this.promise = this._createInitPromises();
2797
2790
  this.countries = processAllCountries(this.options);
2798
- const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(this.countries, this.options);
2791
+ const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(this.countries);
2799
2792
  this.dialCodes = dialCodes;
2800
2793
  this.dialCodeMaxLen = dialCodeMaxLen;
2801
2794
  this.dialCodeToIso2Map = dialCodeToIso2Map;
@@ -3866,7 +3859,7 @@ var intlTelInput = Object.assign((input, options) => {
3866
3859
  attachUtils,
3867
3860
  startedLoadingUtilsScript: false,
3868
3861
  startedLoadingAutoCountry: false,
3869
- version: "25.13.0"
3862
+ version: "25.13.1"
3870
3863
  });
3871
3864
  var intl_tel_input_default = intlTelInput;
3872
3865
 
@@ -2627,11 +2627,11 @@ var translateCountryNames = (countries, options) => {
2627
2627
  }
2628
2628
  }
2629
2629
  };
2630
- var processDialCodes = (countries, options) => {
2630
+ var processDialCodes = (countries) => {
2631
2631
  const dialCodes = /* @__PURE__ */ new Set();
2632
2632
  let dialCodeMaxLen = 0;
2633
2633
  const dialCodeToIso2Map = {};
2634
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2634
+ const _addToDialCodeMap = (iso2, dialCode) => {
2635
2635
  if (!iso2 || !dialCode) {
2636
2636
  return;
2637
2637
  }
@@ -2645,10 +2645,10 @@ var processDialCodes = (countries, options) => {
2645
2645
  if (iso2List.includes(iso2)) {
2646
2646
  return;
2647
2647
  }
2648
- const index = priority !== void 0 ? priority : iso2List.length;
2649
- iso2List[index] = iso2;
2648
+ iso2List.push(iso2);
2650
2649
  };
2651
- for (const c of countries) {
2650
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2651
+ for (const c of countriesSortedByPriority) {
2652
2652
  if (!dialCodes.has(c.dialCode)) {
2653
2653
  dialCodes.add(c.dialCode);
2654
2654
  }
@@ -2656,14 +2656,7 @@ var processDialCodes = (countries, options) => {
2656
2656
  const partialDialCode = c.dialCode.substring(0, k);
2657
2657
  _addToDialCodeMap(c.iso2, partialDialCode);
2658
2658
  }
2659
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2660
- }
2661
- if (options.onlyCountries.length || options.excludeCountries.length) {
2662
- dialCodes.forEach((dialCode) => {
2663
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2664
- });
2665
- }
2666
- for (const c of countries) {
2659
+ _addToDialCodeMap(c.iso2, c.dialCode);
2667
2660
  if (c.areaCodes) {
2668
2661
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2669
2662
  for (const areaCode of c.areaCodes) {
@@ -2795,7 +2788,7 @@ var Iti = class _Iti {
2795
2788
  this.isAndroid = _Iti._getIsAndroid();
2796
2789
  this.promise = this._createInitPromises();
2797
2790
  this.countries = processAllCountries(this.options);
2798
- const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(this.countries, this.options);
2791
+ const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(this.countries);
2799
2792
  this.dialCodes = dialCodes;
2800
2793
  this.dialCodeMaxLen = dialCodeMaxLen;
2801
2794
  this.dialCodeToIso2Map = dialCodeToIso2Map;
@@ -3866,7 +3859,7 @@ var intlTelInput = Object.assign((input, options) => {
3866
3859
  attachUtils,
3867
3860
  startedLoadingUtilsScript: false,
3868
3861
  startedLoadingAutoCountry: false,
3869
- version: "25.13.0"
3862
+ version: "25.13.1"
3870
3863
  });
3871
3864
  var intl_tel_input_default = intlTelInput;
3872
3865
 
@@ -7,6 +7,6 @@ export interface DialCodeProcessingResult {
7
7
  }
8
8
  export declare const processAllCountries: (options: AllOptions) => Country[];
9
9
  export declare const translateCountryNames: (countries: Country[], options: AllOptions) => void;
10
- export declare const processDialCodes: (countries: Country[], options: AllOptions) => DialCodeProcessingResult;
10
+ export declare const processDialCodes: (countries: Country[]) => DialCodeProcessingResult;
11
11
  export declare const sortCountries: (countries: Country[], options: AllOptions) => void;
12
12
  export declare const cacheSearchTokens: (countries: Country[]) => void;
package/build/js/data.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.13.0
2
+ * International Telephone Input v25.13.1
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 v25.13.0
2
+ * International Telephone Input v25.13.1
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -317,7 +317,7 @@ declare module "modules/data/country-data" {
317
317
  }
318
318
  export const processAllCountries: (options: AllOptions) => Country[];
319
319
  export const translateCountryNames: (countries: Country[], options: AllOptions) => void;
320
- export const processDialCodes: (countries: Country[], options: AllOptions) => DialCodeProcessingResult;
320
+ export const processDialCodes: (countries: Country[]) => DialCodeProcessingResult;
321
321
  export const sortCountries: (countries: Country[], options: AllOptions) => void;
322
322
  export const cacheSearchTokens: (countries: Country[]) => void;
323
323
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.13.0
2
+ * International Telephone Input v25.13.1
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -2748,11 +2748,11 @@ var factoryOutput = (() => {
2748
2748
  }
2749
2749
  }
2750
2750
  };
2751
- var processDialCodes = (countries, options) => {
2751
+ var processDialCodes = (countries) => {
2752
2752
  const dialCodes = /* @__PURE__ */ new Set();
2753
2753
  let dialCodeMaxLen = 0;
2754
2754
  const dialCodeToIso2Map = {};
2755
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2755
+ const _addToDialCodeMap = (iso2, dialCode) => {
2756
2756
  if (!iso2 || !dialCode) {
2757
2757
  return;
2758
2758
  }
@@ -2766,10 +2766,10 @@ var factoryOutput = (() => {
2766
2766
  if (iso2List.includes(iso2)) {
2767
2767
  return;
2768
2768
  }
2769
- const index = priority !== void 0 ? priority : iso2List.length;
2770
- iso2List[index] = iso2;
2769
+ iso2List.push(iso2);
2771
2770
  };
2772
- for (const c of countries) {
2771
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2772
+ for (const c of countriesSortedByPriority) {
2773
2773
  if (!dialCodes.has(c.dialCode)) {
2774
2774
  dialCodes.add(c.dialCode);
2775
2775
  }
@@ -2777,14 +2777,7 @@ var factoryOutput = (() => {
2777
2777
  const partialDialCode = c.dialCode.substring(0, k);
2778
2778
  _addToDialCodeMap(c.iso2, partialDialCode);
2779
2779
  }
2780
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2781
- }
2782
- if (options.onlyCountries.length || options.excludeCountries.length) {
2783
- dialCodes.forEach((dialCode) => {
2784
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2785
- });
2786
- }
2787
- for (const c of countries) {
2780
+ _addToDialCodeMap(c.iso2, c.dialCode);
2788
2781
  if (c.areaCodes) {
2789
2782
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2790
2783
  for (const areaCode of c.areaCodes) {
@@ -2919,8 +2912,7 @@ var factoryOutput = (() => {
2919
2912
  this.promise = this._createInitPromises();
2920
2913
  this.countries = processAllCountries(this.options);
2921
2914
  const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
2922
- this.countries,
2923
- this.options
2915
+ this.countries
2924
2916
  );
2925
2917
  this.dialCodes = dialCodes;
2926
2918
  this.dialCodeMaxLen = dialCodeMaxLen;
@@ -4101,7 +4093,7 @@ var factoryOutput = (() => {
4101
4093
  attachUtils,
4102
4094
  startedLoadingUtilsScript: false,
4103
4095
  startedLoadingAutoCountry: false,
4104
- version: "25.13.0"
4096
+ version: "25.13.1"
4105
4097
  }
4106
4098
  );
4107
4099
  var intl_tel_input_default = intlTelInput;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.13.0
2
+ * International Telephone Input v25.13.1
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -24,7 +24,7 @@ var factoryOutput=(()=>{var F=Object.defineProperty;var Ct=Object.getOwnProperty
24
24
  <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
25
25
  </mask>
26
26
  <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
27
- </svg>`};var P=class{constructor(t,e,i){this.highlightedItem=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._at();let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_at(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!this.telInput.form?.hasAttribute("autocomplete")&&this.telInput.setAttribute("autocomplete","off")}_au(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:n}=this.options,o=U({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!n,[i]:!!i}),s=m("div",{class:o});return this.isRTL&&s.setAttribute("dir","ltr"),this.telInput.before(s),s}_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 o=m("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=m("div",{class:h.FLAG},o),e&&(this.dropdownArrow=m("div",{class:"iti__arrow",[p.HIDDEN]:"true"},o)),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:o,containerClass:s}=this.options,a=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=m("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${a}`,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(),o){let u=U({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[s]:!!s});this.dropdown=m("div",{class:u}),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=st(),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=ot(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.zeroSearchResults}_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 o=this.telInput.form?.querySelector(`input[name="${n.phone}"]`);o?this.hiddenInput=o:(this.hiddenInput=m("input",{type:"hidden",name:n.phone}),t.appendChild(this.hiddenInput))}if(n.country){let o=this.telInput.form?.querySelector(`input[name="${n.country}"]`);o?this.m=o:(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=U({[h.COUNTRY_ITEM]:!0,[h.HIGHLIGHT]:e===0}),o=m("li",{id:`iti-${this.id}__item-${i.iso2}`,class:n,tabindex:"-1",role:"option",[p.SELECTED]:"false"});o.dataset.dialCode=i.dialCode,o.dataset.countryCode=i.iso2,i.nodeById[this.id]=o,this.options.showFlags&&m("div",{class:`${h.FLAG} iti__${i.iso2}`},o);let s=m("span",{class:"iti__country-name"},o);s.textContent=i.name;let a=m("span",{class:"iti__dial-code"},o);this.isRTL&&a.setAttribute("dir","ltr"),a.textContent=`+${i.dialCode}`,t.appendChild(o)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?O.SANE_SELECTED_WITH_DIAL_WIDTH:O.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+O.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 o=n.offsetWidth;return t.removeChild(e),o}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:t.searchResultsText?i=t.searchResultsText(e):e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.l.textContent=i}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,o=e.getBoundingClientRect().top+i,s=o+n,a=t.offsetHeight,u=t.getBoundingClientRect().top+i,d=u+a,c=u-o+e.scrollTop;if(u<o)e.scrollTop=c;else if(d>s){let C=n-a;e.scrollTop=c-C}}highlightListItem(t,e){let i=this.highlightedItem;if(i&&(i.classList.remove(h.HIGHLIGHT),i.setAttribute(p.SELECTED,"false")),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.highlightedItem.setAttribute(p.SELECTED,"true"),this.options.countrySearch)){let n=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,n)}e&&this.highlightedItem.focus()}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;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(n=>n.toLowerCase());return N.filter(n=>i.includes(n.iso2))}else if(e.length){let i=e.map(n=>n.toLowerCase());return N.filter(n=>!i.includes(n.iso2))}return N},at=(r,t)=>{for(let e of r){let i=e.iso2.toLowerCase();t.i18n[i]&&(e.name=t.i18n[i])}},lt=(r,t)=>{let e=new Set,i=0,n={},o=(s,a,u)=>{if(!s||!a)return;a.length>i&&(i=a.length),n.hasOwnProperty(a)||(n[a]=[]);let d=n[a];if(d.includes(s))return;let c=u!==void 0?u:d.length;d[c]=s};for(let s of r){e.has(s.dialCode)||e.add(s.dialCode);for(let a=1;a<s.dialCode.length;a++){let u=s.dialCode.substring(0,a);o(s.iso2,u)}o(s.iso2,s.dialCode,s.priority)}(t.onlyCountries.length||t.excludeCountries.length)&&e.forEach(s=>{n[s]=n[s].filter(Boolean)});for(let s of r)if(s.areaCodes){let a=n[s.dialCode][0];for(let u of s.areaCodes){for(let d=1;d<u.length;d++){let c=u.substring(0,d),C=s.dialCode+c;o(a,C),o(s.iso2,C)}o(s.iso2,s.dialCode+u)}}return{dialCodes:e,dialCodeMaxLen:i,dialCodeToIso2Map:n}},ut=(r,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),r.sort((e,i)=>{let{countryOrder:n}=t;if(n){let o=n.indexOf(e.iso2),s=n.indexOf(i.iso2),a=o>-1,u=s>-1;if(a||u)return a&&u?o-s:a?-1:1}return e.name.localeCompare(i.name)})},dt=r=>{for(let t of r)t.normalisedName=k(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var ct=(r,t,e,i)=>{let n=r;if(e&&t){t=`+${i.dialCode}`;let o=n[t.length]===" "||n[t.length]==="-"?t.length+1:t.length;n=n.substring(o)}return n},ht=(r,t,e,i,n)=>{let o=e?e.formatNumberAsYouType(r,i.iso2):r,{dialCode:s}=i;return n&&t.charAt(0)!=="+"&&o.includes(`+${s}`)?(o.split(`+${s}`)[1]||"").trim():o};var pt=(r,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let o=0;o<t.length;o++){if(/[+0-9]/.test(t[o])&&n++,n===r&&!i)return o+1;if(i&&n===r+1)return o}return t.length};var Dt=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],Y=r=>{let t=T(r);if(t.startsWith(x.NANP)&&t.length>=4){let e=t.substring(1,4);return Dt.includes(e)}return!1};for(let r of N)r.name=V[r.iso2];var wt=0,Tt=new Set(N.map(r=>r.iso2)),q=r=>Tt.has(r),B=class r{constructor(t,e={}){this.id=wt++,this.options={...j,...e},et(this.options,V),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:n,dialCodeToIso2Map:o}=lt(this.countries,this.options);this.dialCodes=i,this.dialCodeMaxLen=n,this.dialCodeToIso2Map=o,this.j=new Map(this.countries.map(s=>[s.iso2,s])),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,n=>String.fromCharCode(48+(n.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,n)=>{this.b=i,this.c=n}),e=new Promise((i,n)=>{this.d=i,this.e=n});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(){at(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),n=this._getTelInputValue(),s=i&&i.startsWith("+")&&(!n||!n.startsWith("+"))?i:n,a=this._ao(s),u=Y(s),{initialCountry:d,geoIpLookup:c}=this.options,C=d===H.AUTO&&c;if(a&&!u)this._ai(s);else if(!C||t){let I=d?d.toLowerCase():"";q(I)?this._aj(I):a&&u?this._aj(tt.ISO2):this._aj("")}s&&this._ah(s)}_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=s=>{this.ui.dropdownContent.classList.contains(h.HIDE)?this.ui.telInput.focus():s.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let n=()=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",n,{signal:t});let o=s=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&[f.ARROW_UP,f.ARROW_DOWN,f.SPACE,f.ENTER].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),this._l()),s.key===f.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",o,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!l.utils){let o=()=>{l.attachUtils(t)?.catch(()=>{})};if(l.documentReady())o();else{let s=()=>{o()};window.addEventListener("load",s,{signal:this.g.signal})}}else this.d();e===H.AUTO&&i&&!this.selectedCountryData.iso2?this._i():this.b()}_i(){l.autoCountry?this.handleAutoCountry():l.startedLoadingAutoCountry||(l.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();q(e)?(l.autoCountry=e,setTimeout(()=>M("handleAutoCountry"))):(this._d(!0),M("rejectAutoCountryPromise"))},()=>{this._d(!0),M("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:n,countrySearch:o}=this.options,s=!1;D.ALPHA_UNICODE.test(this._getTelInputValue())&&(s=!0);let a=u=>{let d=this._getTelInputValue();if(this.i&&u?.data==="+"&&i&&n&&o){let g=this.ui.telInput.selectionStart||0,E=d.substring(0,g-1),b=d.substring(g);this._setTelInputValue(E+b),this._m();return}this._ai(d)&&this._ar();let c=u?.data&&D.NON_PLUS_NUMERIC.test(u.data),C=u?.inputType===$.PASTE&&d;c||C&&!t?s=!0:D.NON_PLUS_NUMERIC.test(d)||(s=!1);let I=u?.detail&&u.detail.isSetNumber,w=this.userNumeralSet==="ascii";if(e&&!s&&!I&&w){let g=this.ui.telInput.selectionStart||0,b=d.substring(0,g).replace(D.NON_PLUS_NUMERIC_GLOBAL,"").length,v=u?.inputType===$.DELETE_FWD,y=this._ap(),L=ht(y,d,l.utils,this.selectedCountryData,this.options.separateDialCode),_=pt(b,L,g,v);this._setTelInputValue(L),this.ui.telInput.setSelectionRange(_,_)}};this.ui.telInput.addEventListener("input",a,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:n}=this.options;if(t||e){let o=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(e&&i&&n&&s.key==="+"){s.preventDefault(),this._m();return}if(t){let a=this._getTelInputValue(),d=!a.startsWith("+")&&this.ui.telInput.selectionStart===0&&s.key==="+",c=this._normaliseNumerals(s.key),C=/^[0-9]$/.test(c),I=e?C:d||C,w=this.ui.telInput,g=w.selectionStart,E=w.selectionEnd,b=a.slice(0,g),v=a.slice(E),y=b+s.key+v,L=this._ap(y),_=l.utils.getCoreNumber(L,this.selectedCountryData.iso2),W=this.n&&_.length>this.n,mt=this._s(L)!==null;(!I||W&&!mt&&!d)&&s.preventDefault()}}};this.ui.telInput.addEventListener("keydown",o,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,n=i.selectionStart,o=i.selectionEnd,s=this._getTelInputValue(),a=s.slice(0,n),u=s.slice(o),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),C=this._normaliseNumerals(c),I=n===0&&o>0,w=!s.startsWith("+")||I,g=C.replace(D.NON_PLUS_NUMERIC_GLOBAL,""),E=g.startsWith("+"),b=g.replace(/\+/g,""),v=E&&w?`+${b}`:b,y=a+v+u;if(y.length>5){let _=l.utils.getCoreNumber(y,d);for(;_.length===0&&y.length>0;)y=y.slice(0,-1),_=l.utils.getCoreNumber(y,d);if(!_)return;if(this.n&&_.length>this.n)if(i.selectionEnd===s.length){let W=_.length-this.n;y=y.slice(0,y.length-W)}else return}this._setTelInputValue(y);let L=n+v.length;i.setSelectionRange(L,L),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 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=o=>{[f.ARROW_UP,f.ARROW_DOWN,f.ENTER,f.ESC].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),o.key===f.ARROW_UP||o.key===f.ARROW_DOWN?this._af(o.key):o.key===f.ENTER?this._ag():o.key===f.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&D.HIDDEN_SEARCH_CHAR.test(o.key)&&(o.stopPropagation(),i&&clearTimeout(i),e+=o.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},Z.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",n,{signal:t})}_ad(t){let e=()=>{let s=this.ui.searchInput.value.trim();this._ae(s),this.ui.searchInput.value?this.ui.k.classList.remove(h.HIDE):this.ui.k.classList.add(h.HIDE)},i=null,n=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)};this.ui.searchInput.addEventListener("input",n,{signal:t});let o=()=>{this.ui.searchInput.value="",this.ui.searchInput.focus(),e()};this.ui.k.addEventListener("click",o,{signal:t})}_q(t){let e=nt(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&&l.utils&&this.selectedCountryData){let i=this.options.nationalMode||!e.startsWith("+")&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:o}=l.utils.numberFormat,s=i?n:o;e=l.utils.formatNumber(e,this.selectedCountryData.iso2,s)}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 s=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${s}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.iso2,o=this.selectedCountryData.dialCode;i=this._r(i);let s=this._ao(i,!0),a=T(i);if(s){let u=T(s),d=this.dialCodeToIso2Map[u];if(d.length===1)return d[0]===n?null:d[0];if(!n&&this.f&&d.includes(this.f))return this.f;if(o===x.NANP&&Y(a))return null;let{areaCodes:C,priority:I}=this.selectedCountryData;if(C){let v=C.map(y=>`${o}${y}`);for(let y of v)if(a.startsWith(y))return null}let g=C&&!(I===0)&&a.length>u.length,E=n&&d.includes(n)&&!g,b=n===d[0];if(!E&&!b)return d[0]}else if(i.startsWith("+")&&a.length){let u=this.selectedCountryData.dialCode||"";return u&&u.startsWith(a)?null:""}else if((!i||i==="+")&&!n)return this.f;return null}_aj(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.options,o=this.selectedCountryData.iso2||"";if(this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.selectedCountry){let s=t&&i?`${h.FLAG} iti__${t}`:`${h.FLAG} ${h.GLOBE}`,a,u;if(t){let{name:d,dialCode:c}=this.selectedCountryData;u=d,a=n.selectedCountryAriaLabel.replace("${countryName}",d).replace("${dialCode}",`+${c}`)}else u=n.noCountrySelected,a=n.noCountrySelected;this.ui.selectedCountryInner.className=s,this.ui.selectedCountry.setAttribute("title",u),this.ui.selectedCountry.setAttribute(p.LABEL,a)}if(e){let s=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.ui.selectedDialCode.textContent=s,this.ui.updateInputPadding()}return this._ak(),this._t(),o!==t}_t(){let{strictMode:t,placeholderNumberType:e,validationNumberTypes:i}=this.options,{iso2:n}=this.selectedCountryData;if(t&&l.utils)if(n){let o=l.utils.numberType[e],s=l.utils.getExampleNumber(n,!1,o,!0),a=s;for(;l.utils.isPossibleNumber(s,n,i);)a=s,s+="0";let u=l.utils.getCoreNumber(a,n);this.n=u.length,n==="by"&&(this.n=u.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.options,o=t===S.AGGRESSIVE||!this.ui.a&&t===S.POLITE;if(l.utils&&o){let s=l.utils.numberType[e],a=this.selectedCountryData.iso2?l.utils.getExampleNumber(this.selectedCountryData.iso2,i,s):"";a=this._aq(a),typeof n=="function"&&(a=n(a,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",a)}}_al(t){let e=t.dataset[K.COUNTRY_CODE],i=this._aj(e);this._am();let n=t.dataset[K.DIAL_CODE];if(this._an(n),this.options.formatOnDisplay){let o=this._getTelInputValue();this._ah(o)}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.ui.highlightedItem&&this.ui.highlightedItem.setAttribute(p.SELECTED,"false"),this.options.countrySearch&&this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),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}`,n;if(e.startsWith("+")){let o=this._ao(e);o?n=e.replace(o,i):n=i,this._setTelInputValue(n)}}_ao(t,e){let i="";if(t.startsWith("+")){let n="",o=!1;for(let s=0;s<t.length;s++){let a=t.charAt(s);if(/[0-9]/.test(a)){if(n+=a,!!!this.dialCodeToIso2Map[n])break;if(this.dialCodes.has(n)){if(i=t.substring(0,s+1),o=!0,!e)break}else e&&o&&(i=t.substring(0,s+1));if(n.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t?this._normaliseNumerals(t):this._getTelInputValue(),{dialCode:i}=this.selectedCountryData,n,o=T(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&o?n=`+${i}`:n="",n+e}_aq(t){let e=this._ao(t),i=ct(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(A.COUNTRY_CHANGE)}handleAutoCountry(){this.options.initialCountry===H.AUTO&&l.autoCountry&&(this.f=l.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleUtils(){if(l.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(),l.instances instanceof Map?l.instances.delete(this.id):delete l.instances[this.id])}getExtension(){return l.utils?l.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(l.utils){let{iso2:e}=this.selectedCountryData,i=this._ap(),n=l.utils.formatNumber(i,e,t);return this._mapAsciiToUserNumerals(n)}return""}getNumberType(){return l.utils?l.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):G.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(l.utils){let{iso2:t}=this.selectedCountryData;return l.utils.getValidationError(this._ap(),t)}return G.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===R.DIAL_CODE&&l.utils){let i=this._ap(),n=l.utils.getCoreNumber(i,e);if(n[0]===R.MOBILE_PREFIX&&n.length!==R.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return l.utils?l.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.validationNumberTypes):null}_v(t){if(!l.utils)return null;if(!this.selectedCountryData.iso2)return!1;let e=s=>t?this._w(s):this._u(s),i=this._ap(),n=i.search(D.ALPHA_UNICODE);if(n>-1&&!this.options.allowPhonewords){let s=i.substring(0,n),a=e(s),u=e(i);return a&&u}return e(i)}_w(t){return l.utils?l.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.validationNumberTypes):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 o=this._getTelInputValue();this._ah(o)}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")}},At=r=>{if(!l.utils&&!l.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 l.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 l.utils=i,M("handleUtils"),!0}).catch(e=>{throw M("rejectUtilsScriptPromise",e),e})}return null},M=(r,...t)=>{Object.values(l.instances).forEach(e=>{let i=e[r];typeof i=="function"&&i.apply(e,t)})},l=Object.assign((r,t)=>{let e=new B(r,t);return l.instances[e.id]=e,r.iti=e,e},{defaults:j,documentReady:()=>document.readyState==="complete",getCountryData:()=>N,getInstance:r=>{let t=r.dataset.intlTelInputId;return t?l.instances[t]:null},instances:{},attachUtils:At,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"25.13.0"}),St=l;return bt(Pt);})();
27
+ </svg>`};var P=class{constructor(t,e,i){this.highlightedItem=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._at();let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_at(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!this.telInput.form?.hasAttribute("autocomplete")&&this.telInput.setAttribute("autocomplete","off")}_au(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:n}=this.options,o=U({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!n,[i]:!!i}),s=m("div",{class:o});return this.isRTL&&s.setAttribute("dir","ltr"),this.telInput.before(s),s}_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 o=m("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=m("div",{class:h.FLAG},o),e&&(this.dropdownArrow=m("div",{class:"iti__arrow",[p.HIDDEN]:"true"},o)),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:o,containerClass:s}=this.options,a=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=m("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${a}`,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(),o){let u=U({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[s]:!!s});this.dropdown=m("div",{class:u}),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=st(),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=ot(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.zeroSearchResults}_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 o=this.telInput.form?.querySelector(`input[name="${n.phone}"]`);o?this.hiddenInput=o:(this.hiddenInput=m("input",{type:"hidden",name:n.phone}),t.appendChild(this.hiddenInput))}if(n.country){let o=this.telInput.form?.querySelector(`input[name="${n.country}"]`);o?this.m=o:(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=U({[h.COUNTRY_ITEM]:!0,[h.HIGHLIGHT]:e===0}),o=m("li",{id:`iti-${this.id}__item-${i.iso2}`,class:n,tabindex:"-1",role:"option",[p.SELECTED]:"false"});o.dataset.dialCode=i.dialCode,o.dataset.countryCode=i.iso2,i.nodeById[this.id]=o,this.options.showFlags&&m("div",{class:`${h.FLAG} iti__${i.iso2}`},o);let s=m("span",{class:"iti__country-name"},o);s.textContent=i.name;let a=m("span",{class:"iti__dial-code"},o);this.isRTL&&a.setAttribute("dir","ltr"),a.textContent=`+${i.dialCode}`,t.appendChild(o)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?O.SANE_SELECTED_WITH_DIAL_WIDTH:O.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._bb()||t)+O.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 o=n.offsetWidth;return t.removeChild(e),o}return 0}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:t.searchResultsText?i=t.searchResultsText(e):e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.l.textContent=i}scrollTo(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,o=e.getBoundingClientRect().top+i,s=o+n,a=t.offsetHeight,u=t.getBoundingClientRect().top+i,d=u+a,c=u-o+e.scrollTop;if(u<o)e.scrollTop=c;else if(d>s){let C=n-a;e.scrollTop=c-C}}highlightListItem(t,e){let i=this.highlightedItem;if(i&&(i.classList.remove(h.HIGHLIGHT),i.setAttribute(p.SELECTED,"false")),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.highlightedItem.setAttribute(p.SELECTED,"true"),this.options.countrySearch)){let n=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,n)}e&&this.highlightedItem.focus()}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;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(n=>n.toLowerCase());return N.filter(n=>i.includes(n.iso2))}else if(e.length){let i=e.map(n=>n.toLowerCase());return N.filter(n=>!i.includes(n.iso2))}return N},at=(r,t)=>{for(let e of r){let i=e.iso2.toLowerCase();t.i18n[i]&&(e.name=t.i18n[i])}},lt=r=>{let t=new Set,e=0,i={},n=(s,a)=>{if(!s||!a)return;a.length>e&&(e=a.length),i.hasOwnProperty(a)||(i[a]=[]);let u=i[a];u.includes(s)||u.push(s)},o=[...r].sort((s,a)=>s.priority-a.priority);for(let s of o){t.has(s.dialCode)||t.add(s.dialCode);for(let a=1;a<s.dialCode.length;a++){let u=s.dialCode.substring(0,a);n(s.iso2,u)}if(n(s.iso2,s.dialCode),s.areaCodes){let a=i[s.dialCode][0];for(let u of s.areaCodes){for(let d=1;d<u.length;d++){let c=u.substring(0,d),C=s.dialCode+c;n(a,C),n(s.iso2,C)}n(s.iso2,s.dialCode+u)}}}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:n}=t;if(n){let o=n.indexOf(e.iso2),s=n.indexOf(i.iso2),a=o>-1,u=s>-1;if(a||u)return a&&u?o-s:a?-1:1}return e.name.localeCompare(i.name)})},dt=r=>{for(let t of r)t.normalisedName=k(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var ct=(r,t,e,i)=>{let n=r;if(e&&t){t=`+${i.dialCode}`;let o=n[t.length]===" "||n[t.length]==="-"?t.length+1:t.length;n=n.substring(o)}return n},ht=(r,t,e,i,n)=>{let o=e?e.formatNumberAsYouType(r,i.iso2):r,{dialCode:s}=i;return n&&t.charAt(0)!=="+"&&o.includes(`+${s}`)?(o.split(`+${s}`)[1]||"").trim():o};var pt=(r,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let o=0;o<t.length;o++){if(/[+0-9]/.test(t[o])&&n++,n===r&&!i)return o+1;if(i&&n===r+1)return o}return t.length};var Dt=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],Y=r=>{let t=T(r);if(t.startsWith(x.NANP)&&t.length>=4){let e=t.substring(1,4);return Dt.includes(e)}return!1};for(let r of N)r.name=V[r.iso2];var wt=0,Tt=new Set(N.map(r=>r.iso2)),q=r=>Tt.has(r),B=class r{constructor(t,e={}){this.id=wt++,this.options={...j,...e},et(this.options,V),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:n,dialCodeToIso2Map:o}=lt(this.countries);this.dialCodes=i,this.dialCodeMaxLen=n,this.dialCodeToIso2Map=o,this.j=new Map(this.countries.map(s=>[s.iso2,s])),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,n=>String.fromCharCode(48+(n.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,n)=>{this.b=i,this.c=n}),e=new Promise((i,n)=>{this.d=i,this.e=n});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(){at(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),n=this._getTelInputValue(),s=i&&i.startsWith("+")&&(!n||!n.startsWith("+"))?i:n,a=this._ao(s),u=Y(s),{initialCountry:d,geoIpLookup:c}=this.options,C=d===H.AUTO&&c;if(a&&!u)this._ai(s);else if(!C||t){let I=d?d.toLowerCase():"";q(I)?this._aj(I):a&&u?this._aj(tt.ISO2):this._aj("")}s&&this._ah(s)}_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=s=>{this.ui.dropdownContent.classList.contains(h.HIDE)?this.ui.telInput.focus():s.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",e,{signal:t});let n=()=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",n,{signal:t});let o=s=>{this.ui.dropdownContent.classList.contains(h.HIDE)&&[f.ARROW_UP,f.ARROW_DOWN,f.SPACE,f.ENTER].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),this._l()),s.key===f.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",o,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.options;if(t&&!l.utils){let o=()=>{l.attachUtils(t)?.catch(()=>{})};if(l.documentReady())o();else{let s=()=>{o()};window.addEventListener("load",s,{signal:this.g.signal})}}else this.d();e===H.AUTO&&i&&!this.selectedCountryData.iso2?this._i():this.b()}_i(){l.autoCountry?this.handleAutoCountry():l.startedLoadingAutoCountry||(l.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();q(e)?(l.autoCountry=e,setTimeout(()=>M("handleAutoCountry"))):(this._d(!0),M("rejectAutoCountryPromise"))},()=>{this._d(!0),M("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:n,countrySearch:o}=this.options,s=!1;D.ALPHA_UNICODE.test(this._getTelInputValue())&&(s=!0);let a=u=>{let d=this._getTelInputValue();if(this.i&&u?.data==="+"&&i&&n&&o){let g=this.ui.telInput.selectionStart||0,E=d.substring(0,g-1),b=d.substring(g);this._setTelInputValue(E+b),this._m();return}this._ai(d)&&this._ar();let c=u?.data&&D.NON_PLUS_NUMERIC.test(u.data),C=u?.inputType===$.PASTE&&d;c||C&&!t?s=!0:D.NON_PLUS_NUMERIC.test(d)||(s=!1);let I=u?.detail&&u.detail.isSetNumber,w=this.userNumeralSet==="ascii";if(e&&!s&&!I&&w){let g=this.ui.telInput.selectionStart||0,b=d.substring(0,g).replace(D.NON_PLUS_NUMERIC_GLOBAL,"").length,v=u?.inputType===$.DELETE_FWD,y=this._ap(),L=ht(y,d,l.utils,this.selectedCountryData,this.options.separateDialCode),_=pt(b,L,g,v);this._setTelInputValue(L),this.ui.telInput.setSelectionRange(_,_)}};this.ui.telInput.addEventListener("input",a,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:n}=this.options;if(t||e){let o=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(e&&i&&n&&s.key==="+"){s.preventDefault(),this._m();return}if(t){let a=this._getTelInputValue(),d=!a.startsWith("+")&&this.ui.telInput.selectionStart===0&&s.key==="+",c=this._normaliseNumerals(s.key),C=/^[0-9]$/.test(c),I=e?C:d||C,w=this.ui.telInput,g=w.selectionStart,E=w.selectionEnd,b=a.slice(0,g),v=a.slice(E),y=b+s.key+v,L=this._ap(y),_=l.utils.getCoreNumber(L,this.selectedCountryData.iso2),W=this.n&&_.length>this.n,mt=this._s(L)!==null;(!I||W&&!mt&&!d)&&s.preventDefault()}}};this.ui.telInput.addEventListener("keydown",o,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let i=this.ui.telInput,n=i.selectionStart,o=i.selectionEnd,s=this._getTelInputValue(),a=s.slice(0,n),u=s.slice(o),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),C=this._normaliseNumerals(c),I=n===0&&o>0,w=!s.startsWith("+")||I,g=C.replace(D.NON_PLUS_NUMERIC_GLOBAL,""),E=g.startsWith("+"),b=g.replace(/\+/g,""),v=E&&w?`+${b}`:b,y=a+v+u;if(y.length>5){let _=l.utils.getCoreNumber(y,d);for(;_.length===0&&y.length>0;)y=y.slice(0,-1),_=l.utils.getCoreNumber(y,d);if(!_)return;if(this.n&&_.length>this.n)if(i.selectionEnd===s.length){let W=_.length-this.n;y=y.slice(0,y.length-W)}else return}this._setTelInputValue(y);let L=n+v.length;i.setSelectionRange(L,L),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 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=o=>{[f.ARROW_UP,f.ARROW_DOWN,f.ENTER,f.ESC].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),o.key===f.ARROW_UP||o.key===f.ARROW_DOWN?this._af(o.key):o.key===f.ENTER?this._ag():o.key===f.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&D.HIDDEN_SEARCH_CHAR.test(o.key)&&(o.stopPropagation(),i&&clearTimeout(i),e+=o.key.toLowerCase(),this._q(e),i=setTimeout(()=>{e=""},Z.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",n,{signal:t})}_ad(t){let e=()=>{let s=this.ui.searchInput.value.trim();this._ae(s),this.ui.searchInput.value?this.ui.k.classList.remove(h.HIDE):this.ui.k.classList.add(h.HIDE)},i=null,n=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)};this.ui.searchInput.addEventListener("input",n,{signal:t});let o=()=>{this.ui.searchInput.value="",this.ui.searchInput.focus(),e()};this.ui.k.addEventListener("click",o,{signal:t})}_q(t){let e=nt(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&&l.utils&&this.selectedCountryData){let i=this.options.nationalMode||!e.startsWith("+")&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:o}=l.utils.numberFormat,s=i?n:o;e=l.utils.formatNumber(e,this.selectedCountryData.iso2,s)}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 s=i&&t.startsWith(i)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${s}`}_s(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.iso2,o=this.selectedCountryData.dialCode;i=this._r(i);let s=this._ao(i,!0),a=T(i);if(s){let u=T(s),d=this.dialCodeToIso2Map[u];if(d.length===1)return d[0]===n?null:d[0];if(!n&&this.f&&d.includes(this.f))return this.f;if(o===x.NANP&&Y(a))return null;let{areaCodes:C,priority:I}=this.selectedCountryData;if(C){let v=C.map(y=>`${o}${y}`);for(let y of v)if(a.startsWith(y))return null}let g=C&&!(I===0)&&a.length>u.length,E=n&&d.includes(n)&&!g,b=n===d[0];if(!E&&!b)return d[0]}else if(i.startsWith("+")&&a.length){let u=this.selectedCountryData.dialCode||"";return u&&u.startsWith(a)?null:""}else if((!i||i==="+")&&!n)return this.f;return null}_aj(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.options,o=this.selectedCountryData.iso2||"";if(this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.selectedCountry){let s=t&&i?`${h.FLAG} iti__${t}`:`${h.FLAG} ${h.GLOBE}`,a,u;if(t){let{name:d,dialCode:c}=this.selectedCountryData;u=d,a=n.selectedCountryAriaLabel.replace("${countryName}",d).replace("${dialCode}",`+${c}`)}else u=n.noCountrySelected,a=n.noCountrySelected;this.ui.selectedCountryInner.className=s,this.ui.selectedCountry.setAttribute("title",u),this.ui.selectedCountry.setAttribute(p.LABEL,a)}if(e){let s=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.ui.selectedDialCode.textContent=s,this.ui.updateInputPadding()}return this._ak(),this._t(),o!==t}_t(){let{strictMode:t,placeholderNumberType:e,validationNumberTypes:i}=this.options,{iso2:n}=this.selectedCountryData;if(t&&l.utils)if(n){let o=l.utils.numberType[e],s=l.utils.getExampleNumber(n,!1,o,!0),a=s;for(;l.utils.isPossibleNumber(s,n,i);)a=s,s+="0";let u=l.utils.getCoreNumber(a,n);this.n=u.length,n==="by"&&(this.n=u.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.options,o=t===S.AGGRESSIVE||!this.ui.a&&t===S.POLITE;if(l.utils&&o){let s=l.utils.numberType[e],a=this.selectedCountryData.iso2?l.utils.getExampleNumber(this.selectedCountryData.iso2,i,s):"";a=this._aq(a),typeof n=="function"&&(a=n(a,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",a)}}_al(t){let e=t.dataset[K.COUNTRY_CODE],i=this._aj(e);this._am();let n=t.dataset[K.DIAL_CODE];if(this._an(n),this.options.formatOnDisplay){let o=this._getTelInputValue();this._ah(o)}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.ui.highlightedItem&&this.ui.highlightedItem.setAttribute(p.SELECTED,"false"),this.options.countrySearch&&this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),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}`,n;if(e.startsWith("+")){let o=this._ao(e);o?n=e.replace(o,i):n=i,this._setTelInputValue(n)}}_ao(t,e){let i="";if(t.startsWith("+")){let n="",o=!1;for(let s=0;s<t.length;s++){let a=t.charAt(s);if(/[0-9]/.test(a)){if(n+=a,!!!this.dialCodeToIso2Map[n])break;if(this.dialCodes.has(n)){if(i=t.substring(0,s+1),o=!0,!e)break}else e&&o&&(i=t.substring(0,s+1));if(n.length===this.dialCodeMaxLen)break}}}return i}_ap(t){let e=t?this._normaliseNumerals(t):this._getTelInputValue(),{dialCode:i}=this.selectedCountryData,n,o=T(e);return this.options.separateDialCode&&!e.startsWith("+")&&i&&o?n=`+${i}`:n="",n+e}_aq(t){let e=this._ao(t),i=ct(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(i)}_ar(){this._as(A.COUNTRY_CHANGE)}handleAutoCountry(){this.options.initialCountry===H.AUTO&&l.autoCountry&&(this.f=l.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleUtils(){if(l.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(),l.instances instanceof Map?l.instances.delete(this.id):delete l.instances[this.id])}getExtension(){return l.utils?l.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(l.utils){let{iso2:e}=this.selectedCountryData,i=this._ap(),n=l.utils.formatNumber(i,e,t);return this._mapAsciiToUserNumerals(n)}return""}getNumberType(){return l.utils?l.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):G.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(l.utils){let{iso2:t}=this.selectedCountryData;return l.utils.getValidationError(this._ap(),t)}return G.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===R.DIAL_CODE&&l.utils){let i=this._ap(),n=l.utils.getCoreNumber(i,e);if(n[0]===R.MOBILE_PREFIX&&n.length!==R.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return l.utils?l.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.validationNumberTypes):null}_v(t){if(!l.utils)return null;if(!this.selectedCountryData.iso2)return!1;let e=s=>t?this._w(s):this._u(s),i=this._ap(),n=i.search(D.ALPHA_UNICODE);if(n>-1&&!this.options.allowPhonewords){let s=i.substring(0,n),a=e(s),u=e(i);return a&&u}return e(i)}_w(t){return l.utils?l.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.validationNumberTypes):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 o=this._getTelInputValue();this._ah(o)}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")}},At=r=>{if(!l.utils&&!l.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 l.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 l.utils=i,M("handleUtils"),!0}).catch(e=>{throw M("rejectUtilsScriptPromise",e),e})}return null},M=(r,...t)=>{Object.values(l.instances).forEach(e=>{let i=e[r];typeof i=="function"&&i.apply(e,t)})},l=Object.assign((r,t)=>{let e=new B(r,t);return l.instances[e.id]=e,r.iti=e,e},{defaults:j,documentReady:()=>document.readyState==="complete",getCountryData:()=>N,getInstance:r=>{let t=r.dataset.intlTelInputId;return t?l.instances[t]:null},instances:{},attachUtils:At,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"25.13.1"}),St=l;return bt(Pt);})();
28
28
 
29
29
  // UMD
30
30
  return factoryOutput.default;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * International Telephone Input v25.13.0
2
+ * International Telephone Input v25.13.1
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
@@ -2747,11 +2747,11 @@ var factoryOutput = (() => {
2747
2747
  }
2748
2748
  }
2749
2749
  };
2750
- var processDialCodes = (countries, options) => {
2750
+ var processDialCodes = (countries) => {
2751
2751
  const dialCodes = /* @__PURE__ */ new Set();
2752
2752
  let dialCodeMaxLen = 0;
2753
2753
  const dialCodeToIso2Map = {};
2754
- const _addToDialCodeMap = (iso2, dialCode, priority) => {
2754
+ const _addToDialCodeMap = (iso2, dialCode) => {
2755
2755
  if (!iso2 || !dialCode) {
2756
2756
  return;
2757
2757
  }
@@ -2765,10 +2765,10 @@ var factoryOutput = (() => {
2765
2765
  if (iso2List.includes(iso2)) {
2766
2766
  return;
2767
2767
  }
2768
- const index = priority !== void 0 ? priority : iso2List.length;
2769
- iso2List[index] = iso2;
2768
+ iso2List.push(iso2);
2770
2769
  };
2771
- for (const c of countries) {
2770
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
2771
+ for (const c of countriesSortedByPriority) {
2772
2772
  if (!dialCodes.has(c.dialCode)) {
2773
2773
  dialCodes.add(c.dialCode);
2774
2774
  }
@@ -2776,14 +2776,7 @@ var factoryOutput = (() => {
2776
2776
  const partialDialCode = c.dialCode.substring(0, k);
2777
2777
  _addToDialCodeMap(c.iso2, partialDialCode);
2778
2778
  }
2779
- _addToDialCodeMap(c.iso2, c.dialCode, c.priority);
2780
- }
2781
- if (options.onlyCountries.length || options.excludeCountries.length) {
2782
- dialCodes.forEach((dialCode) => {
2783
- dialCodeToIso2Map[dialCode] = dialCodeToIso2Map[dialCode].filter(Boolean);
2784
- });
2785
- }
2786
- for (const c of countries) {
2779
+ _addToDialCodeMap(c.iso2, c.dialCode);
2787
2780
  if (c.areaCodes) {
2788
2781
  const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
2789
2782
  for (const areaCode of c.areaCodes) {
@@ -2918,8 +2911,7 @@ var factoryOutput = (() => {
2918
2911
  this.promise = this._createInitPromises();
2919
2912
  this.countries = processAllCountries(this.options);
2920
2913
  const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
2921
- this.countries,
2922
- this.options
2914
+ this.countries
2923
2915
  );
2924
2916
  this.dialCodes = dialCodes;
2925
2917
  this.dialCodeMaxLen = dialCodeMaxLen;
@@ -4100,7 +4092,7 @@ var factoryOutput = (() => {
4100
4092
  attachUtils,
4101
4093
  startedLoadingUtilsScript: false,
4102
4094
  startedLoadingAutoCountry: false,
4103
- version: "25.13.0"
4095
+ version: "25.13.1"
4104
4096
  }
4105
4097
  );
4106
4098
  var intl_tel_input_default = intlTelInput;