intl-tel-input 25.13.1 → 25.13.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.
@@ -1950,7 +1950,7 @@ const lt = {
1950
1950
  // additional countries (not supported by country-list library)
1951
1951
  ac: "Ascension Island",
1952
1952
  xk: "Kosovo"
1953
- }, j = { ...lt, ...at }, S = {
1953
+ }, j = { ...lt, ...at }, T = {
1954
1954
  OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1955
1955
  CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1956
1956
  COUNTRY_CHANGE: "countrychange",
@@ -1974,7 +1974,7 @@ const lt = {
1974
1974
  }, F = {
1975
1975
  PASTE: "insertFromPaste",
1976
1976
  DELETE_FWD: "deleteContentForward"
1977
- }, L = {
1977
+ }, E = {
1978
1978
  ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
1979
1979
  // any kind of letter from any language
1980
1980
  NON_PLUS_NUMERIC: /[^+0-9]/,
@@ -2015,7 +2015,7 @@ const lt = {
2015
2015
  }, G = {
2016
2016
  COUNTRY_CODE: "countryCode",
2017
2017
  DIAL_CODE: "dialCode"
2018
- }, p = {
2018
+ }, m = {
2019
2019
  EXPANDED: "aria-expanded",
2020
2020
  LABEL: "aria-label",
2021
2021
  SELECTED: "aria-selected",
@@ -2086,11 +2086,11 @@ const lt = {
2086
2086
  validationNumberTypes: ["MOBILE"]
2087
2087
  }, ht = (l, t) => {
2088
2088
  l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...t, ...l.i18n };
2089
- }, P = (l) => l.replace(/\D/g, ""), q = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), pt = (l, t) => {
2089
+ }, v = (l) => l.replace(/\D/g, ""), q = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), pt = (l, t) => {
2090
2090
  const e = q(t), i = [], s = [], o = [], n = [], r = [], a = [];
2091
2091
  for (const c of l)
2092
2092
  c.iso2 === e ? i.push(c) : c.normalisedName.startsWith(e) ? s.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ? r.push(c) : c.initials.includes(e) && a.push(c);
2093
- const d = (c, f) => c.priority - f.priority;
2093
+ const d = (c, p) => c.priority - p.priority;
2094
2094
  return [
2095
2095
  ...i.sort(d),
2096
2096
  ...s.sort(d),
@@ -2105,19 +2105,19 @@ const lt = {
2105
2105
  if (i.name.toLowerCase().startsWith(e))
2106
2106
  return i;
2107
2107
  return null;
2108
- }, U = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), m = (l, t, e) => {
2108
+ }, U = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), f = (l, t, e) => {
2109
2109
  const i = document.createElement(l);
2110
2110
  return t && Object.entries(t).forEach(
2111
2111
  ([s, o]) => i.setAttribute(s, o)
2112
2112
  ), e && e.appendChild(i), i;
2113
2113
  }, mt = () => `
2114
- <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
2114
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${m.HIDDEN}="true">
2115
2115
  <circle cx="11" cy="11" r="7" />
2116
2116
  <line x1="21" y1="21" x2="16.65" y2="16.65" />
2117
2117
  </svg>`, ft = (l) => {
2118
2118
  const t = `iti-${l}-clear-mask`;
2119
2119
  return `
2120
- <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
2120
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${m.HIDDEN}="true" focusable="false">
2121
2121
  <mask id="${t}" maskUnits="userSpaceOnUse">
2122
2122
  <rect width="16" height="16" fill="white" />
2123
2123
  <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" />
@@ -2127,7 +2127,7 @@ const lt = {
2127
2127
  };
2128
2128
  class yt {
2129
2129
  constructor(t, e, i) {
2130
- this.highlightedItem = null, t.dataset.intlTelInputId = i.toString(), this.telInput = t, this.options = e, this.id = i, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2130
+ this.highlightedItem = null, this.selectedItem = null, t.dataset.intlTelInputId = i.toString(), this.telInput = t, this.options = e, this.id = i, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2131
2131
  }
2132
2132
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2133
2133
  generateMarkup(t) {
@@ -2146,47 +2146,47 @@ class yt {
2146
2146
  "iti--show-flags": e,
2147
2147
  "iti--inline-dropdown": !s,
2148
2148
  [i]: !!i
2149
- }), n = m("div", { class: o });
2149
+ }), n = f("div", { class: o });
2150
2150
  return this.isRTL && n.setAttribute("dir", "ltr"), this.telInput.before(n), n;
2151
2151
  }
2152
2152
  _maybeBuildCountryContainer(t) {
2153
2153
  const { allowDropdown: e, separateDialCode: i, showFlags: s } = this.options;
2154
2154
  if (e || s || i) {
2155
- this.countryContainer = m(
2155
+ this.countryContainer = f(
2156
2156
  "div",
2157
2157
  // visibly hidden until we measure it's width to set the input padding correctly
2158
2158
  { class: `iti__country-container ${h.V_HIDE}` },
2159
2159
  t
2160
- ), e ? (this.selectedCountry = m(
2160
+ ), e ? (this.selectedCountry = f(
2161
2161
  "button",
2162
2162
  {
2163
2163
  type: "button",
2164
2164
  class: "iti__selected-country",
2165
- [p.EXPANDED]: "false",
2166
- [p.LABEL]: this.options.i18n.noCountrySelected,
2167
- [p.HASPOPUP]: "dialog",
2168
- [p.CONTROLS]: `iti-${this.id}__dropdown-content`
2165
+ [m.EXPANDED]: "false",
2166
+ [m.LABEL]: this.options.i18n.noCountrySelected,
2167
+ [m.HASPOPUP]: "dialog",
2168
+ [m.CONTROLS]: `iti-${this.id}__dropdown-content`
2169
2169
  },
2170
2170
  this.countryContainer
2171
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
2171
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = f(
2172
2172
  "div",
2173
2173
  { class: "iti__selected-country" },
2174
2174
  this.countryContainer
2175
2175
  );
2176
- const o = m(
2176
+ const o = f(
2177
2177
  "div",
2178
2178
  { class: "iti__selected-country-primary" },
2179
2179
  this.selectedCountry
2180
2180
  );
2181
- this.selectedCountryInner = m(
2181
+ this.selectedCountryInner = f(
2182
2182
  "div",
2183
2183
  { class: h.FLAG },
2184
2184
  o
2185
- ), e && (this.dropdownArrow = m(
2185
+ ), e && (this.dropdownArrow = f(
2186
2186
  "div",
2187
- { class: "iti__arrow", [p.HIDDEN]: "true" },
2187
+ { class: "iti__arrow", [m.HIDDEN]: "true" },
2188
2188
  o
2189
- )), i && (this.selectedDialCode = m(
2189
+ )), i && (this.selectedDialCode = f(
2190
2190
  "div",
2191
2191
  { class: "iti__selected-dial-code" },
2192
2192
  this.selectedCountry
@@ -2202,18 +2202,18 @@ class yt {
2202
2202
  dropdownContainer: o,
2203
2203
  containerClass: n
2204
2204
  } = this.options, r = t ? "" : "iti--flexible-dropdown-width";
2205
- if (this.dropdownContent = m("div", {
2205
+ if (this.dropdownContent = f("div", {
2206
2206
  id: `iti-${this.id}__dropdown-content`,
2207
2207
  class: `iti__dropdown-content ${h.HIDE} ${r}`,
2208
2208
  role: "dialog",
2209
- [p.MODAL]: "true"
2210
- }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = m(
2209
+ [m.MODAL]: "true"
2210
+ }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = f(
2211
2211
  "ul",
2212
2212
  {
2213
2213
  class: "iti__country-list",
2214
2214
  id: `iti-${this.id}__country-listbox`,
2215
2215
  role: "listbox",
2216
- [p.LABEL]: s.countryListAriaLabel
2216
+ [m.LABEL]: s.countryListAriaLabel
2217
2217
  },
2218
2218
  this.dropdownContent
2219
2219
  ), this._appendListItems(), i && this.updateSearchResultsA11yText(), o) {
@@ -2224,24 +2224,24 @@ class yt {
2224
2224
  "iti--inline-dropdown": !e,
2225
2225
  [n]: !!n
2226
2226
  });
2227
- this.dropdown = m("div", { class: a }), this.dropdown.appendChild(this.dropdownContent);
2227
+ this.dropdown = f("div", { class: a }), this.dropdown.appendChild(this.dropdownContent);
2228
2228
  } else
2229
2229
  this.countryContainer.appendChild(this.dropdownContent);
2230
2230
  }
2231
2231
  _buildSearchUI() {
2232
- const { i18n: t } = this.options, e = m(
2232
+ const { i18n: t } = this.options, e = f(
2233
2233
  "div",
2234
2234
  { class: "iti__search-input-wrapper" },
2235
2235
  this.dropdownContent
2236
2236
  );
2237
- this.searchIcon = m(
2237
+ this.searchIcon = f(
2238
2238
  "span",
2239
2239
  {
2240
2240
  class: "iti__search-icon",
2241
- [p.HIDDEN]: "true"
2241
+ [m.HIDDEN]: "true"
2242
2242
  },
2243
2243
  e
2244
- ), this.searchIcon.innerHTML = mt(), this.searchInput = m(
2244
+ ), this.searchIcon.innerHTML = mt(), this.searchInput = f(
2245
2245
  "input",
2246
2246
  {
2247
2247
  id: `iti-${this.id}__search-input`,
@@ -2251,31 +2251,31 @@ class yt {
2251
2251
  placeholder: t.searchPlaceholder,
2252
2252
  // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2253
2253
  role: "combobox",
2254
- [p.EXPANDED]: "true",
2255
- [p.LABEL]: t.searchPlaceholder,
2256
- [p.CONTROLS]: `iti-${this.id}__country-listbox`,
2257
- [p.AUTOCOMPLETE]: "list",
2254
+ [m.EXPANDED]: "true",
2255
+ [m.LABEL]: t.searchPlaceholder,
2256
+ [m.CONTROLS]: `iti-${this.id}__country-listbox`,
2257
+ [m.AUTOCOMPLETE]: "list",
2258
2258
  autocomplete: "off"
2259
2259
  },
2260
2260
  e
2261
- ), this.searchClearButton = m(
2261
+ ), this.searchClearButton = f(
2262
2262
  "button",
2263
2263
  {
2264
2264
  type: "button",
2265
2265
  class: `iti__search-clear ${h.HIDE}`,
2266
- [p.LABEL]: t.clearSearchAriaLabel,
2266
+ [m.LABEL]: t.clearSearchAriaLabel,
2267
2267
  tabindex: "-1"
2268
2268
  },
2269
2269
  e
2270
- ), this.searchClearButton.innerHTML = ft(this.id), this.searchResultsA11yText = m(
2270
+ ), this.searchClearButton.innerHTML = ft(this.id), this.searchResultsA11yText = f(
2271
2271
  "span",
2272
2272
  { class: "iti__a11y-text" },
2273
2273
  this.dropdownContent
2274
- ), this.searchNoResults = m(
2274
+ ), this.searchNoResults = f(
2275
2275
  "div",
2276
2276
  {
2277
2277
  class: `iti__no-results ${h.HIDE}`,
2278
- [p.HIDDEN]: "true"
2278
+ [m.HIDDEN]: "true"
2279
2279
  // all a11y messaging happens in this.searchResultsA11yText
2280
2280
  },
2281
2281
  this.dropdownContent
@@ -2293,7 +2293,7 @@ class yt {
2293
2293
  const r = (i = this.telInput.form) == null ? void 0 : i.querySelector(
2294
2294
  `input[name="${n.phone}"]`
2295
2295
  );
2296
- r ? this.hiddenInput = r : (this.hiddenInput = m("input", {
2296
+ r ? this.hiddenInput = r : (this.hiddenInput = f("input", {
2297
2297
  type: "hidden",
2298
2298
  name: n.phone
2299
2299
  }), t.appendChild(this.hiddenInput));
@@ -2302,7 +2302,7 @@ class yt {
2302
2302
  const r = (s = this.telInput.form) == null ? void 0 : s.querySelector(
2303
2303
  `input[name="${n.country}"]`
2304
2304
  );
2305
- r ? this.hiddenInputCountry = r : (this.hiddenInputCountry = m("input", {
2305
+ r ? this.hiddenInputCountry = r : (this.hiddenInputCountry = f("input", {
2306
2306
  type: "hidden",
2307
2307
  name: n.country
2308
2308
  }), t.appendChild(this.hiddenInputCountry));
@@ -2314,19 +2314,18 @@ class yt {
2314
2314
  const t = document.createDocumentFragment();
2315
2315
  for (let e = 0; e < this.countries.length; e++) {
2316
2316
  const i = this.countries[e], s = U({
2317
- [h.COUNTRY_ITEM]: !0,
2318
- [h.HIGHLIGHT]: e === 0
2319
- }), o = m("li", {
2317
+ [h.COUNTRY_ITEM]: !0
2318
+ }), o = f("li", {
2320
2319
  id: `iti-${this.id}__item-${i.iso2}`,
2321
2320
  class: s,
2322
2321
  tabindex: "-1",
2323
2322
  role: "option",
2324
- [p.SELECTED]: "false"
2323
+ [m.SELECTED]: "false"
2325
2324
  });
2326
- 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);
2327
- const n = m("span", { class: "iti__country-name" }, o);
2325
+ o.dataset.dialCode = i.dialCode, o.dataset.countryCode = i.iso2, i.nodeById[this.id] = o, this.options.showFlags && f("div", { class: `${h.FLAG} iti__${i.iso2}` }, o);
2326
+ const n = f("span", { class: "iti__country-name" }, o);
2328
2327
  n.textContent = i.name;
2329
- const r = m("span", { class: "iti__dial-code" }, o);
2328
+ const r = f("span", { class: "iti__dial-code" }, o);
2330
2329
  this.isRTL && r.setAttribute("dir", "ltr"), r.textContent = `+${i.dialCode}`, t.appendChild(o);
2331
2330
  }
2332
2331
  this.countryList.appendChild(t);
@@ -2380,19 +2379,27 @@ class yt {
2380
2379
  if (a < o)
2381
2380
  e.scrollTop = c;
2382
2381
  else if (d > n) {
2383
- const f = s - r;
2384
- e.scrollTop = c - f;
2382
+ const p = s - r;
2383
+ e.scrollTop = c - p;
2385
2384
  }
2386
2385
  }
2387
- //* Remove highlighting from other list items and highlight the given item.
2386
+ //* Remove highlighting from the previous list item and highlight the new one.
2388
2387
  highlightListItem(t, e) {
2389
2388
  const i = this.highlightedItem;
2390
- 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)) {
2389
+ if (i && i.classList.remove(h.HIGHLIGHT), this.highlightedItem = t, this.highlightedItem && (this.highlightedItem.classList.add(h.HIGHLIGHT), this.options.countrySearch)) {
2391
2390
  const s = this.highlightedItem.getAttribute("id") || "";
2392
- this.searchInput.setAttribute(p.ACTIVE_DESCENDANT, s);
2391
+ this.searchInput.setAttribute(m.ACTIVE_DESCENDANT, s);
2393
2392
  }
2394
2393
  e && this.highlightedItem.focus();
2395
2394
  }
2395
+ updateSelectedItem(t) {
2396
+ if (this.selectedItem && this.selectedItem.dataset.countryCode !== t && (this.selectedItem.setAttribute(m.SELECTED, "false"), this.selectedItem = null), t && !this.selectedItem) {
2397
+ const e = this.countryList.querySelector(
2398
+ `[data-country-code="${t}"]`
2399
+ );
2400
+ e && (e.setAttribute(m.SELECTED, "true"), this.selectedItem = e);
2401
+ }
2402
+ }
2396
2403
  //* Country search: Filter the country list to the given array of countries.
2397
2404
  filterCountries(t) {
2398
2405
  this.countryList.innerHTML = "";
@@ -2406,7 +2413,7 @@ class yt {
2406
2413
  destroy() {
2407
2414
  this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2408
2415
  const t = this.telInput.parentNode;
2409
- 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.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null;
2416
+ 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.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null, this.selectedItem = null;
2410
2417
  for (const e of this.countries)
2411
2418
  delete e.nodeById[this.id];
2412
2419
  this.countries = null;
@@ -2455,8 +2462,8 @@ const gt = (l) => {
2455
2462
  const r = i[n.dialCode][0];
2456
2463
  for (const a of n.areaCodes) {
2457
2464
  for (let d = 1; d < a.length; d++) {
2458
- const c = a.substring(0, d), f = n.dialCode + c;
2459
- s(r, f), s(n.iso2, f);
2465
+ const c = a.substring(0, d), p = n.dialCode + c;
2466
+ s(r, p), s(n.iso2, p);
2460
2467
  }
2461
2468
  s(n.iso2, n.dialCode + a);
2462
2469
  }
@@ -2489,7 +2496,7 @@ const gt = (l) => {
2489
2496
  }, Dt = (l, t, e, i, s) => {
2490
2497
  const o = e ? e.formatNumberAsYouType(l, i.iso2) : l, { dialCode: n } = i;
2491
2498
  return s && t.charAt(0) !== "+" && o.includes(`+${n}`) ? (o.split(`+${n}`)[1] || "").trim() : o;
2492
- }, Et = (l, t, e, i) => {
2499
+ }, Lt = (l, t, e, i) => {
2493
2500
  if (e === 0 && !i)
2494
2501
  return 0;
2495
2502
  let s = 0;
@@ -2500,7 +2507,7 @@ const gt = (l) => {
2500
2507
  return o;
2501
2508
  }
2502
2509
  return t.length;
2503
- }, Lt = [
2510
+ }, Et = [
2504
2511
  "800",
2505
2512
  "822",
2506
2513
  "833",
@@ -2519,17 +2526,17 @@ const gt = (l) => {
2519
2526
  "888",
2520
2527
  "889"
2521
2528
  ], z = (l) => {
2522
- const t = P(l);
2529
+ const t = v(l);
2523
2530
  if (t.startsWith(K.NANP) && t.length >= 4) {
2524
2531
  const e = t.substring(1, 4);
2525
- return Lt.includes(e);
2532
+ return Et.includes(e);
2526
2533
  }
2527
2534
  return !1;
2528
2535
  };
2529
2536
  for (const l of A)
2530
2537
  l.name = j[l.iso2];
2531
2538
  let At = 0;
2532
- const Tt = new Set(A.map((l) => l.iso2)), B = (l) => Tt.has(l);
2539
+ const St = new Set(A.map((l) => l.iso2)), B = (l) => St.has(l);
2533
2540
  class V {
2534
2541
  constructor(t, e = {}) {
2535
2542
  this.id = At++, this.options = { ...Y, ...e }, ht(this.options, j), this.ui = new yt(t, this.options, this.id), this.isAndroid = V._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = gt(this.options);
@@ -2589,10 +2596,10 @@ class V {
2589
2596
  //* 1. Extracting a dial code from the given number
2590
2597
  //* 2. Using explicit initialCountry
2591
2598
  _setInitialState(t = !1) {
2592
- const e = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(e), s = this._getTelInputValue(), n = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, r = this._getDialCode(n), a = z(n), { initialCountry: d, geoIpLookup: c } = this.options, f = d === M.AUTO && c;
2599
+ const e = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(e), s = this._getTelInputValue(), n = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, r = this._getDialCode(n), a = z(n), { initialCountry: d, geoIpLookup: c } = this.options, p = d === M.AUTO && c;
2593
2600
  if (r && !a)
2594
2601
  this._updateCountryFromNumber(n);
2595
- else if (!f || t) {
2602
+ else if (!p || t) {
2596
2603
  const b = d ? d.toLowerCase() : "";
2597
2604
  B(b) ? this._setCountry(b) : r && a ? this._setCountry(dt.ISO2) : this._setCountry("");
2598
2605
  }
@@ -2669,10 +2676,10 @@ class V {
2669
2676
  u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2670
2677
  (t = "") => {
2671
2678
  const e = t.toLowerCase();
2672
- B(e) ? (u.autoCountry = e, setTimeout(() => T("handleAutoCountry"))) : (this._setInitialState(!0), T("rejectAutoCountryPromise"));
2679
+ B(e) ? (u.autoCountry = e, setTimeout(() => S("handleAutoCountry"))) : (this._setInitialState(!0), S("rejectAutoCountryPromise"));
2673
2680
  },
2674
2681
  () => {
2675
- this._setInitialState(!0), T("rejectAutoCountryPromise");
2682
+ this._setInitialState(!0), S("rejectAutoCountryPromise");
2676
2683
  }
2677
2684
  ));
2678
2685
  }
@@ -2692,7 +2699,7 @@ class V {
2692
2699
  countrySearch: o
2693
2700
  } = this.options;
2694
2701
  let n = !1;
2695
- L.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
2702
+ E.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
2696
2703
  const r = (a) => {
2697
2704
  const d = this._getTelInputValue();
2698
2705
  if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && s && o) {
@@ -2701,29 +2708,29 @@ class V {
2701
2708
  return;
2702
2709
  }
2703
2710
  this._updateCountryFromNumber(d) && this._triggerCountryChange();
2704
- const c = (a == null ? void 0 : a.data) && L.NON_PLUS_NUMERIC.test(a.data), f = (a == null ? void 0 : a.inputType) === F.PASTE && d;
2705
- c || f && !t ? n = !0 : L.NON_PLUS_NUMERIC.test(d) || (n = !1);
2711
+ const c = (a == null ? void 0 : a.data) && E.NON_PLUS_NUMERIC.test(a.data), p = (a == null ? void 0 : a.inputType) === F.PASTE && d;
2712
+ c || p && !t ? n = !0 : E.NON_PLUS_NUMERIC.test(d) || (n = !1);
2706
2713
  const b = (a == null ? void 0 : a.detail) && a.detail.isSetNumber, C = this.userNumeralSet === "ascii";
2707
2714
  if (e && !n && !b && C) {
2708
2715
  const y = this.ui.telInput.selectionStart || 0, N = d.substring(
2709
2716
  0,
2710
2717
  y
2711
2718
  ).replace(
2712
- L.NON_PLUS_NUMERIC_GLOBAL,
2719
+ E.NON_PLUS_NUMERIC_GLOBAL,
2713
2720
  ""
2714
- ).length, D = (a == null ? void 0 : a.inputType) === F.DELETE_FWD, g = this._getFullNumber(), E = Dt(
2721
+ ).length, D = (a == null ? void 0 : a.inputType) === F.DELETE_FWD, g = this._getFullNumber(), L = Dt(
2715
2722
  g,
2716
2723
  d,
2717
2724
  u.utils,
2718
2725
  this.selectedCountryData,
2719
2726
  this.options.separateDialCode
2720
- ), w = Et(
2727
+ ), w = Lt(
2721
2728
  N,
2722
- E,
2729
+ L,
2723
2730
  y,
2724
2731
  D
2725
2732
  );
2726
- this._setTelInputValue(E), this.ui.telInput.setSelectionRange(w, w);
2733
+ this._setTelInputValue(L), this.ui.telInput.setSelectionRange(w, w);
2727
2734
  }
2728
2735
  };
2729
2736
  this.ui.telInput.addEventListener(
@@ -2744,11 +2751,11 @@ class V {
2744
2751
  return;
2745
2752
  }
2746
2753
  if (t) {
2747
- const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), f = /^[0-9]$/.test(c), b = e ? f : d || f, C = this.ui.telInput, y = C.selectionStart, I = C.selectionEnd, N = r.slice(0, y), D = r.slice(I), g = N + n.key + D, E = this._getFullNumber(g), w = u.utils.getCoreNumber(
2748
- E,
2754
+ const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), p = /^[0-9]$/.test(c), b = e ? p : d || p, C = this.ui.telInput, y = C.selectionStart, I = C.selectionEnd, N = r.slice(0, y), D = r.slice(I), g = N + n.key + D, L = this._getFullNumber(g), w = u.utils.getCoreNumber(
2755
+ L,
2749
2756
  this.selectedCountryData.iso2
2750
- ), v = this.maxCoreNumberLength && w.length > this.maxCoreNumberLength, X = this._getNewCountryFromNumber(E) !== null;
2751
- (!b || v && !X && !d) && n.preventDefault();
2757
+ ), P = this.maxCoreNumberLength && w.length > this.maxCoreNumberLength, X = this._getNewCountryFromNumber(L) !== null;
2758
+ (!b || P && !X && !d) && n.preventDefault();
2752
2759
  }
2753
2760
  }
2754
2761
  };
@@ -2761,7 +2768,7 @@ class V {
2761
2768
  if (this.options.strictMode) {
2762
2769
  const t = (e) => {
2763
2770
  e.preventDefault();
2764
- const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, s), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), f = this._normaliseNumerals(c), b = s === 0 && o > 0, C = !n.startsWith("+") || b, y = f.replace(L.NON_PLUS_NUMERIC_GLOBAL, ""), I = y.startsWith("+"), N = y.replace(/\+/g, ""), D = I && C ? `+${N}` : N;
2771
+ const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, s), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), p = this._normaliseNumerals(c), b = s === 0 && o > 0, C = !n.startsWith("+") || b, y = p.replace(E.NON_PLUS_NUMERIC_GLOBAL, ""), I = y.startsWith("+"), N = y.replace(/\+/g, ""), D = I && C ? `+${N}` : N;
2765
2772
  let g = r + D + a;
2766
2773
  if (g.length > 5) {
2767
2774
  let w = u.utils.getCoreNumber(g, d);
@@ -2771,14 +2778,14 @@ class V {
2771
2778
  return;
2772
2779
  if (this.maxCoreNumberLength && w.length > this.maxCoreNumberLength)
2773
2780
  if (i.selectionEnd === n.length) {
2774
- const v = w.length - this.maxCoreNumberLength;
2775
- g = g.slice(0, g.length - v);
2781
+ const P = w.length - this.maxCoreNumberLength;
2782
+ g = g.slice(0, g.length - P);
2776
2783
  } else
2777
2784
  return;
2778
2785
  }
2779
2786
  this._setTelInputValue(g);
2780
- const E = s + D.length;
2781
- i.setSelectionRange(E, E), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2787
+ const L = s + D.length;
2788
+ i.setSelectionRange(L, L), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2782
2789
  };
2783
2790
  this.ui.telInput.addEventListener("paste", t, {
2784
2791
  signal: this.abortController.signal
@@ -2802,11 +2809,11 @@ class V {
2802
2809
  //* Open the dropdown.
2803
2810
  _openDropdown() {
2804
2811
  const { fixDropdownWidth: t, countrySearch: e } = this.options;
2805
- if (this.dropdownAbortController = 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._setDropdownPosition(), e) {
2812
+ if (this.dropdownAbortController = new AbortController(), t && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(h.HIDE), this.ui.selectedCountry.setAttribute(m.EXPANDED, "true"), this._setDropdownPosition(), e) {
2806
2813
  const i = this.ui.countryList.firstElementChild;
2807
2814
  i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
2808
2815
  }
2809
- this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(S.OPEN_COUNTRY_DROPDOWN);
2816
+ this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(T.OPEN_COUNTRY_DROPDOWN);
2810
2817
  }
2811
2818
  //* Set the dropdown position
2812
2819
  _setDropdownPosition() {
@@ -2885,7 +2892,7 @@ class V {
2885
2892
  _.ARROW_DOWN,
2886
2893
  _.ENTER,
2887
2894
  _.ESC
2888
- ].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === _.ARROW_UP || o.key === _.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === _.ENTER ? this._handleEnterKey() : o.key === _.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && L.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), i && clearTimeout(i), e += o.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2895
+ ].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === _.ARROW_UP || o.key === _.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === _.ENTER ? this._handleEnterKey() : o.key === _.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && E.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), i && clearTimeout(i), e += o.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2889
2896
  e = "";
2890
2897
  }, ut.HIDDEN_SEARCH_RESET_MS));
2891
2898
  };
@@ -2972,25 +2979,25 @@ class V {
2972
2979
  let i = e ? t.substring(e) : t;
2973
2980
  const s = this.selectedCountryData.iso2, o = this.selectedCountryData.dialCode;
2974
2981
  i = this._ensureHasDialCode(i);
2975
- const n = this._getDialCode(i, !0), r = P(i);
2982
+ const n = this._getDialCode(i, !0), r = v(i);
2976
2983
  if (n) {
2977
- const a = P(n), d = this.dialCodeToIso2Map[a];
2984
+ const a = v(n), d = this.dialCodeToIso2Map[a];
2978
2985
  if (d.length === 1)
2979
2986
  return d[0] === s ? null : d[0];
2980
2987
  if (!s && this.defaultCountry && d.includes(this.defaultCountry))
2981
2988
  return this.defaultCountry;
2982
2989
  if (o === K.NANP && z(r))
2983
2990
  return null;
2984
- const { areaCodes: f, priority: b } = this.selectedCountryData;
2985
- if (f) {
2986
- const D = f.map(
2991
+ const { areaCodes: p, priority: b } = this.selectedCountryData;
2992
+ if (p) {
2993
+ const D = p.map(
2987
2994
  (g) => `${o}${g}`
2988
2995
  );
2989
2996
  for (const g of D)
2990
2997
  if (r.startsWith(g))
2991
2998
  return null;
2992
2999
  }
2993
- const y = f && !(b === 0) && r.length > a.length, I = s && d.includes(s) && !y, N = s === d[0];
3000
+ const y = p && !(b === 0) && r.length > a.length, I = s && d.includes(s) && !y, N = s === d[0];
2994
3001
  if (!I && !N)
2995
3002
  return d[0];
2996
3003
  } else if (i.startsWith("+") && r.length) {
@@ -3000,25 +3007,25 @@ class V {
3000
3007
  return this.defaultCountry;
3001
3008
  return null;
3002
3009
  }
3003
- //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
3010
+ //* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
3004
3011
  //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
3005
3012
  _setCountry(t) {
3006
- const { separateDialCode: e, showFlags: i, i18n: s } = this.options, o = this.selectedCountryData.iso2 || "";
3007
- if (this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
3008
- const n = t && i ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
3009
- let r, a;
3013
+ const { separateDialCode: e, showFlags: i, i18n: s, allowDropdown: o } = this.options, n = this.selectedCountryData.iso2 || "";
3014
+ if (o && this.ui.updateSelectedItem(t), this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
3015
+ const r = t && i ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
3016
+ let a, d;
3010
3017
  if (t) {
3011
- const { name: d, dialCode: c } = this.selectedCountryData;
3012
- a = d, r = s.selectedCountryAriaLabel.replace("${countryName}", d).replace("${dialCode}", `+${c}`);
3018
+ const { name: c, dialCode: p } = this.selectedCountryData;
3019
+ d = c, a = s.selectedCountryAriaLabel.replace("${countryName}", c).replace("${dialCode}", `+${p}`);
3013
3020
  } else
3014
- a = s.noCountrySelected, r = s.noCountrySelected;
3015
- this.ui.selectedCountryInner.className = n, this.ui.selectedCountry.setAttribute("title", a), this.ui.selectedCountry.setAttribute(p.LABEL, r);
3021
+ d = s.noCountrySelected, a = s.noCountrySelected;
3022
+ this.ui.selectedCountryInner.className = r, this.ui.selectedCountry.setAttribute("title", d), this.ui.selectedCountry.setAttribute(m.LABEL, a);
3016
3023
  }
3017
3024
  if (e) {
3018
- const n = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
3019
- this.ui.selectedDialCode.textContent = n, this.ui.updateInputPadding();
3025
+ const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
3026
+ this.ui.selectedDialCode.textContent = r, this.ui.updateInputPadding();
3020
3027
  }
3021
- return this._updatePlaceholder(), this._updateMaxLength(), o !== t;
3028
+ return this._updatePlaceholder(), this._updateMaxLength(), n !== t;
3022
3029
  }
3023
3030
  //* Update the maximum valid number length for the currently selected country.
3024
3031
  _updateMaxLength() {
@@ -3074,7 +3081,7 @@ class V {
3074
3081
  }
3075
3082
  //* Close the dropdown and unbind any listeners.
3076
3083
  _closeDropdown() {
3077
- 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.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(S.CLOSE_COUNTRY_DROPDOWN));
3084
+ this.ui.dropdownContent.classList.contains(h.HIDE) || (this.ui.dropdownContent.classList.add(h.HIDE), this.ui.selectedCountry.setAttribute(m.EXPANDED, "false"), this.options.countrySearch && (this.ui.searchInput.removeAttribute(m.ACTIVE_DESCENDANT), this.ui.highlightedItem && (this.ui.highlightedItem.classList.remove(h.HIGHLIGHT), this.ui.highlightedItem = null)), this.ui.dropdownArrow.classList.remove(h.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(T.CLOSE_COUNTRY_DROPDOWN));
3078
3085
  }
3079
3086
  //* Replace any existing dial code with the new one
3080
3087
  //* Note: called from _selectListItem and setCountry
@@ -3112,7 +3119,7 @@ class V {
3112
3119
  _getFullNumber(t) {
3113
3120
  const e = t ? this._normaliseNumerals(t) : this._getTelInputValue(), { dialCode: i } = this.selectedCountryData;
3114
3121
  let s;
3115
- const o = P(e);
3122
+ const o = v(e);
3116
3123
  return this.options.separateDialCode && !e.startsWith("+") && i && o ? s = `+${i}` : s = "", s + e;
3117
3124
  }
3118
3125
  //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
@@ -3127,7 +3134,7 @@ class V {
3127
3134
  }
3128
3135
  //* Trigger the 'countrychange' event.
3129
3136
  _triggerCountryChange() {
3130
- this._trigger(S.COUNTRY_CHANGE);
3137
+ this._trigger(T.COUNTRY_CHANGE);
3131
3138
  }
3132
3139
  //**************************
3133
3140
  //* SECRET PUBLIC METHODS
@@ -3216,7 +3223,7 @@ class V {
3216
3223
  return null;
3217
3224
  if (!this.selectedCountryData.iso2)
3218
3225
  return !1;
3219
- const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), i = this._getFullNumber(), s = i.search(L.ALPHA_UNICODE);
3226
+ const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), i = this._getFullNumber(), s = i.search(E.ALPHA_UNICODE);
3220
3227
  if (s > -1 && !this.options.allowPhonewords) {
3221
3228
  const n = i.substring(0, s), r = e(n), a = e(i);
3222
3229
  return r && a;
@@ -3247,7 +3254,7 @@ class V {
3247
3254
  //* Set the input value and update the country.
3248
3255
  setNumber(t) {
3249
3256
  const e = this._normaliseNumerals(t), i = this._updateCountryFromNumber(e);
3250
- this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger(S.INPUT, { isSetNumber: !0 });
3257
+ this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger(T.INPUT, { isSetNumber: !0 });
3251
3258
  }
3252
3259
  //* Set the placeholder number typ
3253
3260
  setPlaceholderNumberType(t) {
@@ -3257,7 +3264,7 @@ class V {
3257
3264
  this.ui.telInput.disabled = t, t ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
3258
3265
  }
3259
3266
  }
3260
- const St = (l) => {
3267
+ const Tt = (l) => {
3261
3268
  if (!u.utils && !u.startedLoadingUtilsScript) {
3262
3269
  let t;
3263
3270
  if (typeof l == "function")
@@ -3278,13 +3285,13 @@ const St = (l) => {
3278
3285
  throw new TypeError(
3279
3286
  "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
3280
3287
  );
3281
- return u.utils = i, T("handleUtils"), !0;
3288
+ return u.utils = i, S("handleUtils"), !0;
3282
3289
  }).catch((e) => {
3283
- throw T("rejectUtilsScriptPromise", e), e;
3290
+ throw S("rejectUtilsScriptPromise", e), e;
3284
3291
  });
3285
3292
  }
3286
3293
  return null;
3287
- }, T = (l, ...t) => {
3294
+ }, S = (l, ...t) => {
3288
3295
  Object.values(u.instances).forEach((e) => {
3289
3296
  const i = e[l];
3290
3297
  typeof i == "function" && i.apply(e, t);
@@ -3307,10 +3314,10 @@ const St = (l) => {
3307
3314
  },
3308
3315
  //* A map from instance ID to instance object.
3309
3316
  instances: {},
3310
- attachUtils: St,
3317
+ attachUtils: Tt,
3311
3318
  startedLoadingUtilsScript: !1,
3312
3319
  startedLoadingAutoCountry: !1,
3313
- version: "25.13.1"
3320
+ version: "25.13.2"
3314
3321
  }
3315
3322
  ), Ot = {
3316
3323
  __name: "IntlTelInput",
@@ -3351,12 +3358,12 @@ const St = (l) => {
3351
3358
  "changeErrorCode",
3352
3359
  C ? null : r.value.getValidationError()
3353
3360
  ));
3354
- }, f = () => {
3361
+ }, p = () => {
3355
3362
  var C;
3356
3363
  o("changeNumber", ((C = r.value) == null ? void 0 : C.getNumber()) ?? ""), c();
3357
3364
  }, b = () => {
3358
3365
  var C;
3359
- o("changeCountry", ((C = r.value) == null ? void 0 : C.getSelectedCountryData().iso2) ?? ""), f(), c();
3366
+ o("changeCountry", ((C = r.value) == null ? void 0 : C.getSelectedCountryData().iso2) ?? ""), p(), c();
3360
3367
  };
3361
3368
  return J(() => {
3362
3369
  n.value && (r.value = u(n.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = d());
@@ -3375,7 +3382,7 @@ const St = (l) => {
3375
3382
  "onUpdate:modelValue": y[0] || (y[0] = (I) => i.value = I),
3376
3383
  type: "tel",
3377
3384
  onCountrychange: b,
3378
- onInput: f
3385
+ onInput: p
3379
3386
  }, l.inputProps), null, 16)), [
3380
3387
  [
3381
3388
  ot,