intl-tel-input 25.10.12 → 25.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { mergeModels as s0, useModel as P0, ref as I1, onMounted as x0, watch as B0, onUnmounted as R0, withDirectives as k0, createElementBlock as O0, openBlock as G0, mergeProps as U0, vModelText as F0 } from "vue";
1
+ import { mergeModels as u0, useModel as P0, ref as _1, onMounted as B0, watch as R0, onUnmounted as k0, withDirectives as G0, createElementBlock as O0, openBlock as U0, mergeProps as F0, vModelText as V0 } from "vue";
2
2
  const K0 = [
3
3
  [
4
4
  "af",
@@ -1677,19 +1677,19 @@ const K0 = [
1677
1677
  "0"
1678
1678
  ]
1679
1679
  ], Y = [];
1680
- for (const f of K0)
1680
+ for (const p of K0)
1681
1681
  Y.push({
1682
1682
  name: "",
1683
1683
  // populated in the plugin
1684
- iso2: f[0],
1685
- dialCode: f[1],
1686
- priority: f[2] || 0,
1687
- areaCodes: f[3] || null,
1684
+ iso2: p[0],
1685
+ dialCode: p[1],
1686
+ priority: p[2] || 0,
1687
+ areaCodes: p[3] || null,
1688
1688
  nodeById: {},
1689
1689
  // populated by the plugin
1690
- nationalPrefix: f[4] || null
1690
+ nationalPrefix: p[4] || null
1691
1691
  });
1692
- const V0 = {
1692
+ const a0 = {
1693
1693
  ad: "Andorra",
1694
1694
  ae: "United Arab Emirates",
1695
1695
  af: "Afghanistan",
@@ -1944,13 +1944,13 @@ const V0 = {
1944
1944
  // additional countries (not supported by country-list library)
1945
1945
  ac: "Ascension Island",
1946
1946
  xk: "Kosovo"
1947
- }, l0 = { ...V0, ...H0 }, v1 = (f) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(f).matches, j0 = () => {
1947
+ }, W0 = { ...a0, ...H0 }, b1 = (p) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(p).matches, j0 = () => {
1948
1948
  if (typeof navigator < "u" && typeof window < "u") {
1949
- const f = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e = v1("(max-width: 500px)"), $ = v1("(max-height: 600px)"), i = v1("(pointer: coarse)");
1950
- return f || e || i && $;
1949
+ const p = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e = b1("(max-width: 500px)"), $ = b1("(max-height: 600px)"), i = b1("(pointer: coarse)");
1950
+ return p || e || i && $;
1951
1951
  }
1952
1952
  return !1;
1953
- }, u0 = {
1953
+ }, h0 = {
1954
1954
  // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1955
1955
  allowPhonewords: !1,
1956
1956
  //* Whether or not to allow the dropdown.
@@ -2002,213 +2002,51 @@ const V0 = {
2002
2002
  //* The number type to enforce during validation.
2003
2003
  validationNumberTypes: ["MOBILE"]
2004
2004
  };
2005
- function W0(f) {
2006
- f.useFullscreenPopup && (f.fixDropdownWidth = !1), f.onlyCountries.length === 1 && (f.initialCountry = f.onlyCountries[0]), f.separateDialCode && (f.nationalMode = !1), f.allowDropdown && !f.showFlags && !f.separateDialCode && (f.nationalMode = !1), f.useFullscreenPopup && !f.dropdownContainer && (f.dropdownContainer = document.body), f.i18n = { ...l0, ...f.i18n };
2005
+ function z0(p) {
2006
+ p.useFullscreenPopup && (p.fixDropdownWidth = !1), p.onlyCountries.length === 1 && (p.initialCountry = p.onlyCountries[0]), p.separateDialCode && (p.nationalMode = !1), p.allowDropdown && !p.showFlags && !p.separateDialCode && (p.nationalMode = !1), p.useFullscreenPopup && !p.dropdownContainer && (p.dropdownContainer = document.body), p.i18n = { ...W0, ...p.i18n };
2007
2007
  }
2008
- const c1 = (f) => f.replace(/\D/g, ""), a0 = (f = "") => f.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), L = (f, e, $) => {
2009
- const i = document.createElement(f);
2010
- return e && Object.entries(e).forEach(([r, u]) => i.setAttribute(r, u)), $ && $.appendChild(i), i;
2008
+ const c1 = (p) => p.replace(/\D/g, ""), c0 = (p = "") => p.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), w1 = (p) => Object.keys(p).filter((e) => !!p[e]).join(" "), v = (p, e, $) => {
2009
+ const i = document.createElement(p);
2010
+ return e && Object.entries(e).forEach(([s, h]) => i.setAttribute(s, h)), $ && $.appendChild(i), i;
2011
2011
  };
2012
- function z0(f) {
2013
- const { onlyCountries: e, excludeCountries: $ } = f;
2014
- if (e.length) {
2015
- const i = e.map((r) => r.toLowerCase());
2016
- return Y.filter((r) => i.includes(r.iso2));
2017
- } else if ($.length) {
2018
- const i = $.map((r) => r.toLowerCase());
2019
- return Y.filter((r) => !i.includes(r.iso2));
2020
- }
2021
- return Y;
2022
- }
2023
- function Z0(f, e) {
2024
- for (const $ of f) {
2025
- const i = $.iso2.toLowerCase();
2026
- e.i18n[i] && ($.name = e.i18n[i]);
2027
- }
2028
- }
2029
- function Y0(f, e) {
2030
- const $ = /* @__PURE__ */ new Set();
2031
- let i = 0;
2032
- const r = {}, u = (h, c, C) => {
2033
- if (!h || !c)
2034
- return;
2035
- c.length > i && (i = c.length), r.hasOwnProperty(c) || (r[c] = []);
2036
- const g = r[c];
2037
- if (g.includes(h))
2038
- return;
2039
- const I = C !== void 0 ? C : g.length;
2040
- g[I] = h;
2041
- };
2042
- for (const h of f) {
2043
- $.has(h.dialCode) || $.add(h.dialCode);
2044
- for (let c = 1; c < h.dialCode.length; c++) {
2045
- const C = h.dialCode.substring(0, c);
2046
- u(h.iso2, C);
2047
- }
2048
- u(h.iso2, h.dialCode, h.priority);
2049
- }
2050
- (e.onlyCountries.length || e.excludeCountries.length) && $.forEach((h) => {
2051
- r[h] = r[h].filter(Boolean);
2052
- });
2053
- for (const h of f)
2054
- if (h.areaCodes) {
2055
- const c = r[h.dialCode][0];
2056
- for (const C of h.areaCodes) {
2057
- for (let g = 1; g < C.length; g++) {
2058
- const I = C.substring(0, g), w = h.dialCode + I;
2059
- u(c, w), u(h.iso2, w);
2060
- }
2061
- u(h.iso2, h.dialCode + C);
2062
- }
2063
- }
2064
- return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: r };
2065
- }
2066
- function J0(f, e) {
2067
- e.countryOrder && (e.countryOrder = e.countryOrder.map(($) => $.toLowerCase())), f.sort(($, i) => {
2068
- const { countryOrder: r } = e;
2069
- if (r) {
2070
- const u = r.indexOf($.iso2), h = r.indexOf(i.iso2), c = u > -1, C = h > -1;
2071
- if (c || C)
2072
- return c && C ? u - h : c ? -1 : 1;
2073
- }
2074
- return $.name.localeCompare(i.name);
2075
- });
2076
- }
2077
- function q0(f) {
2078
- for (const e of f)
2079
- e.normalisedName = a0(e.name), e.initials = e.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(($) => $[0]).join("").toLowerCase(), e.dialCodePlus = `+${e.dialCode}`;
2080
- }
2081
- function X0(f, e, $, i) {
2082
- let r = f;
2083
- if ($ && e) {
2084
- e = `+${i.dialCode}`;
2085
- const u = r[e.length] === " " || r[e.length] === "-" ? e.length + 1 : e.length;
2086
- r = r.substring(u);
2087
- }
2088
- return r;
2089
- }
2090
- function Q0(f, e, $, i, r) {
2091
- const u = $ ? $.formatNumberAsYouType(f, i.iso2) : f, { dialCode: h } = i;
2092
- return r && e.charAt(0) !== "+" && u.includes(`+${h}`) ? (u.split(`+${h}`)[1] || "").trim() : u;
2093
- }
2094
- function d2(f, e, $, i) {
2095
- if ($ === 0 && !i)
2096
- return 0;
2097
- let r = 0;
2098
- for (let u = 0; u < e.length; u++) {
2099
- if (/[+0-9]/.test(e[u]) && r++, r === f && !i)
2100
- return u + 1;
2101
- if (i && r === f + 1)
2102
- return u;
2103
- }
2104
- return e.length;
2105
- }
2106
- const t2 = [
2107
- "800",
2108
- "822",
2109
- "833",
2110
- "844",
2111
- "855",
2112
- "866",
2113
- "877",
2114
- "880",
2115
- "881",
2116
- "882",
2117
- "883",
2118
- "884",
2119
- "885",
2120
- "886",
2121
- "887",
2122
- "888",
2123
- "889"
2124
- ], o0 = (f) => {
2125
- const e = c1(f);
2126
- if (e.charAt(0) === "1") {
2127
- const $ = e.substring(1, 4);
2128
- return t2.includes($);
2129
- }
2130
- return !1;
2131
- };
2132
- for (const f of Y)
2133
- f.name = l0[f.iso2];
2134
- let e2 = 0;
2135
- const $2 = new Set(Y.map((f) => f.iso2)), w1 = (f) => $2.has(f), $1 = (f, ...e) => {
2136
- const { instances: $ } = y;
2137
- Object.values($).forEach((i) => i[f](...e));
2138
- };
2139
- class f1 {
2140
- /**
2141
- * Build a space-delimited class string from an object map of className -> truthy/falsey.
2142
- * Only keys with truthy values are included.
2143
- */
2144
- static _buildClassNames(e) {
2145
- return Object.keys(e).filter(($) => !!e[$]).join(" ");
2146
- }
2147
- constructor(e, $ = {}) {
2148
- this.id = e2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u0, $), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
2149
- }
2150
- _detectEnvironmentAndLayout() {
2151
- this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2152
- }
2153
- _createInitPromises() {
2154
- const e = new Promise((i, r) => {
2155
- this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = r;
2156
- }), $ = new Promise((i, r) => {
2157
- this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = r;
2158
- });
2159
- this.promise = Promise.all([e, $]);
2160
- }
2161
- //* Can't be private as it's called from intlTelInput convenience wrapper.
2162
- _init() {
2163
- W0(this.options), this._detectEnvironmentAndLayout(), this._createInitPromises(), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
2164
- }
2165
- //********************
2166
- //* PRIVATE METHODS
2167
- //********************
2168
- //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2169
- _processCountryData() {
2170
- this.countries = z0(this.options);
2171
- const e = Y0(this.countries, this.options);
2172
- this.dialCodes = e.dialCodes, this.dialCodeMaxLen = e.dialCodeMaxLen, this.dialCodeToIso2Map = e.dialCodeToIso2Map, Z0(this.countries, this.options), J0(this.countries, this.options), this.countryByIso2 = new Map(this.countries.map(($) => [$.iso2, $])), q0(this.countries);
2012
+ class Z0 {
2013
+ constructor(e, $, i) {
2014
+ this.highlightedItem = null, e.dataset.intlTelInputId = i.toString(), this.telInput = e, this.options = $, this.id = i, this.hadInitialPlaceholder = !!e.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2173
2015
  }
2174
2016
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2175
- _generateMarkup() {
2176
- this._prepareTelInput();
2177
- const e = this._createWrapperAndInsert();
2178
- this._maybeBuildCountryContainer(e), e.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(e);
2017
+ generateMarkup(e) {
2018
+ this.countries = e, this._prepareTelInput();
2019
+ const $ = this._createWrapperAndInsert();
2020
+ this._maybeBuildCountryContainer($), $.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs($);
2179
2021
  }
2180
2022
  _prepareTelInput() {
2181
- this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
2023
+ var e;
2024
+ this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((e = this.telInput.form) != null && e.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
2182
2025
  }
2183
2026
  _createWrapperAndInsert() {
2184
- var c;
2185
2027
  const {
2186
2028
  allowDropdown: e,
2187
2029
  showFlags: $,
2188
2030
  containerClass: i,
2189
- useFullscreenPopup: r
2190
- } = this.options, u = f1._buildClassNames({
2031
+ useFullscreenPopup: s
2032
+ } = this.options, h = w1({
2191
2033
  iti: !0,
2192
2034
  "iti--allow-dropdown": e,
2193
2035
  "iti--show-flags": $,
2194
- "iti--inline-dropdown": !r,
2036
+ "iti--inline-dropdown": !s,
2195
2037
  [i]: !!i
2196
- }), h = L("div", { class: u });
2197
- return this.isRTL && h.setAttribute("dir", "ltr"), (c = this.telInput.parentNode) == null || c.insertBefore(h, this.telInput), h;
2038
+ }), u = v("div", { class: h });
2039
+ return this.isRTL && u.setAttribute("dir", "ltr"), this.telInput.before(u), u;
2198
2040
  }
2199
2041
  _maybeBuildCountryContainer(e) {
2200
- const {
2201
- allowDropdown: $,
2202
- separateDialCode: i,
2203
- showFlags: r
2204
- } = this.options;
2205
- if ($ || r || i) {
2206
- this.countryContainer = L(
2042
+ const { allowDropdown: $, separateDialCode: i, showFlags: s } = this.options;
2043
+ if ($ || s || i) {
2044
+ this.countryContainer = v(
2207
2045
  "div",
2208
2046
  // visibly hidden until we measure it's width to set the input padding correctly
2209
2047
  { class: "iti__country-container iti__v-hide" },
2210
2048
  e
2211
- ), $ ? (this.selectedCountry = L(
2049
+ ), $ ? (this.selectedCountry = v(
2212
2050
  "button",
2213
2051
  {
2214
2052
  type: "button",
@@ -2219,25 +2057,25 @@ class f1 {
2219
2057
  "aria-controls": `iti-${this.id}__dropdown-content`
2220
2058
  },
2221
2059
  this.countryContainer
2222
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = L(
2060
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = v(
2223
2061
  "div",
2224
2062
  { class: "iti__selected-country" },
2225
2063
  this.countryContainer
2226
2064
  );
2227
- const u = L(
2065
+ const h = v(
2228
2066
  "div",
2229
2067
  { class: "iti__selected-country-primary" },
2230
2068
  this.selectedCountry
2231
2069
  );
2232
- this.selectedCountryInner = L(
2070
+ this.selectedCountryInner = v(
2233
2071
  "div",
2234
2072
  { class: "iti__flag" },
2235
- u
2236
- ), $ && (this.dropdownArrow = L(
2073
+ h
2074
+ ), $ && (this.dropdownArrow = v(
2237
2075
  "div",
2238
2076
  { class: "iti__arrow", "aria-hidden": "true" },
2239
- u
2240
- )), i && (this.selectedDialCode = L(
2077
+ h
2078
+ )), i && (this.selectedDialCode = v(
2241
2079
  "div",
2242
2080
  { class: "iti__selected-dial-code" },
2243
2081
  this.selectedCountry
@@ -2249,43 +2087,43 @@ class f1 {
2249
2087
  fixDropdownWidth: e,
2250
2088
  useFullscreenPopup: $,
2251
2089
  countrySearch: i,
2252
- i18n: r,
2253
- dropdownContainer: u,
2254
- containerClass: h
2255
- } = this.options, c = e ? "" : "iti--flexible-dropdown-width";
2256
- if (this.dropdownContent = L("div", {
2090
+ i18n: s,
2091
+ dropdownContainer: h,
2092
+ containerClass: u
2093
+ } = this.options, f = e ? "" : "iti--flexible-dropdown-width";
2094
+ if (this.dropdownContent = v("div", {
2257
2095
  id: `iti-${this.id}__dropdown-content`,
2258
- class: `iti__dropdown-content iti__hide ${c}`,
2096
+ class: `iti__dropdown-content iti__hide ${f}`,
2259
2097
  role: "dialog",
2260
2098
  "aria-modal": "true"
2261
- }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = L(
2099
+ }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = v(
2262
2100
  "ul",
2263
2101
  {
2264
2102
  class: "iti__country-list",
2265
2103
  id: `iti-${this.id}__country-listbox`,
2266
2104
  role: "listbox",
2267
- "aria-label": r.countryListAriaLabel
2105
+ "aria-label": s.countryListAriaLabel
2268
2106
  },
2269
2107
  this.dropdownContent
2270
- ), this._appendListItems(), i && this._updateSearchResultsA11yText(), u) {
2271
- const C = f1._buildClassNames({
2108
+ ), this._appendListItems(), this.options.countrySearch && this.updateSearchResultsA11yText(), h) {
2109
+ const c = w1({
2272
2110
  iti: !0,
2273
2111
  "iti--container": !0,
2274
2112
  "iti--fullscreen-popup": $,
2275
2113
  "iti--inline-dropdown": !$,
2276
- [h]: !!h
2114
+ [u]: !!u
2277
2115
  });
2278
- this.dropdown = L("div", { class: C }), this.dropdown.appendChild(this.dropdownContent);
2116
+ this.dropdown = v("div", { class: c }), this.dropdown.appendChild(this.dropdownContent);
2279
2117
  } else
2280
2118
  this.countryContainer.appendChild(this.dropdownContent);
2281
2119
  }
2282
2120
  _buildSearchUI() {
2283
- const { i18n: e } = this.options, $ = L(
2121
+ const { i18n: e } = this.options, $ = v(
2284
2122
  "div",
2285
2123
  { class: "iti__search-input-wrapper" },
2286
2124
  this.dropdownContent
2287
2125
  );
2288
- this.searchIcon = L(
2126
+ this.searchIcon = v(
2289
2127
  "span",
2290
2128
  {
2291
2129
  class: "iti__search-icon",
@@ -2296,7 +2134,7 @@ class f1 {
2296
2134
  <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
2297
2135
  <circle cx="11" cy="11" r="7" />
2298
2136
  <line x1="21" y1="21" x2="16.65" y2="16.65" />
2299
- </svg>`, this.searchInput = L(
2137
+ </svg>`, this.searchInput = v(
2300
2138
  "input",
2301
2139
  {
2302
2140
  id: `iti-${this.id}__search-input`,
@@ -2313,7 +2151,7 @@ class f1 {
2313
2151
  autocomplete: "off"
2314
2152
  },
2315
2153
  $
2316
- ), this.searchClearButton = L(
2154
+ ), this.searchClearButton = v(
2317
2155
  "button",
2318
2156
  {
2319
2157
  type: "button",
@@ -2331,11 +2169,11 @@ class f1 {
2331
2169
  <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" />
2332
2170
  </mask>
2333
2171
  <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${i})" />
2334
- </svg>`, this.searchResultsA11yText = L(
2172
+ </svg>`, this.searchResultsA11yText = v(
2335
2173
  "span",
2336
2174
  { class: "iti__a11y-text" },
2337
2175
  this.dropdownContent
2338
- ), this.searchNoResults = L(
2176
+ ), this.searchNoResults = v(
2339
2177
  "div",
2340
2178
  {
2341
2179
  class: "iti__no-results iti__hide",
@@ -2346,109 +2184,371 @@ class f1 {
2346
2184
  ), this.searchNoResults.textContent = e.zeroSearchResults;
2347
2185
  }
2348
2186
  _maybeUpdateInputPaddingAndReveal() {
2349
- this.countryContainer && (this._updateInputPadding(), this.countryContainer.classList.remove("iti__v-hide"));
2187
+ this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove("iti__v-hide"));
2350
2188
  }
2351
2189
  _maybeBuildHiddenInputs(e) {
2352
- var i, r;
2190
+ var i, s;
2353
2191
  const { hiddenInput: $ } = this.options;
2354
2192
  if ($) {
2355
- const u = this.telInput.getAttribute("name") || "", h = $(u);
2356
- if (h.phone) {
2357
- const c = (i = this.telInput.form) == null ? void 0 : i.querySelector(`input[name="${h.phone}"]`);
2358
- c ? this.hiddenInput = c : (this.hiddenInput = L("input", {
2193
+ const h = this.telInput.getAttribute("name") || "", u = $(h);
2194
+ if (u.phone) {
2195
+ const f = (i = this.telInput.form) == null ? void 0 : i.querySelector(
2196
+ `input[name="${u.phone}"]`
2197
+ );
2198
+ f ? this.hiddenInput = f : (this.hiddenInput = v("input", {
2359
2199
  type: "hidden",
2360
- name: h.phone
2200
+ name: u.phone
2361
2201
  }), e.appendChild(this.hiddenInput));
2362
2202
  }
2363
- if (h.country) {
2364
- const c = (r = this.telInput.form) == null ? void 0 : r.querySelector(`input[name="${h.country}"]`);
2365
- c ? this.hiddenInputCountry = c : (this.hiddenInputCountry = L("input", {
2203
+ if (u.country) {
2204
+ const f = (s = this.telInput.form) == null ? void 0 : s.querySelector(
2205
+ `input[name="${u.country}"]`
2206
+ );
2207
+ f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = v("input", {
2366
2208
  type: "hidden",
2367
- name: h.country
2209
+ name: u.country
2368
2210
  }), e.appendChild(this.hiddenInputCountry));
2369
2211
  }
2370
2212
  }
2371
2213
  }
2372
2214
  //* For each country: add a country list item <li> to the countryList <ul> container.
2373
2215
  _appendListItems() {
2374
- for (let e = 0; e < this.countries.length; e++) {
2375
- const $ = this.countries[e], i = e === 0 ? "iti__highlight" : "", r = L(
2376
- "li",
2377
- {
2378
- id: `iti-${this.id}__item-${$.iso2}`,
2379
- class: `iti__country ${i}`,
2380
- tabindex: "-1",
2381
- role: "option",
2382
- "data-dial-code": $.dialCode,
2383
- "data-country-code": $.iso2,
2384
- "aria-selected": "false"
2385
- },
2386
- this.countryList
2216
+ const e = document.createDocumentFragment();
2217
+ for (let $ = 0; $ < this.countries.length; $++) {
2218
+ const i = this.countries[$], s = w1({
2219
+ iti__country: !0,
2220
+ iti__highlight: $ === 0
2221
+ }), h = v("li", {
2222
+ id: `iti-${this.id}__item-${i.iso2}`,
2223
+ class: s,
2224
+ tabindex: "-1",
2225
+ role: "option",
2226
+ "aria-selected": "false"
2227
+ });
2228
+ h.dataset.dialCode = i.dialCode, h.dataset.countryCode = i.iso2, i.nodeById[this.id] = h, this.options.showFlags && v("div", { class: `iti__flag iti__${i.iso2}` }, h);
2229
+ const u = v("span", { class: "iti__country-name" }, h);
2230
+ u.textContent = i.name;
2231
+ const f = v("span", { class: "iti__dial-code" }, h);
2232
+ this.isRTL && f.setAttribute("dir", "ltr"), f.textContent = `+${i.dialCode}`, e.appendChild(h);
2233
+ }
2234
+ this.countryList.appendChild(e);
2235
+ }
2236
+ //* Update the input padding to make space for the selected country/dial code.
2237
+ updateInputPadding() {
2238
+ if (this.selectedCountry) {
2239
+ const e = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + 6;
2240
+ this.telInput.style.paddingLeft = `${i}px`;
2241
+ }
2242
+ }
2243
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2244
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2245
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2246
+ //* and then to inject a deep clone of the selectedCountry element.
2247
+ _getHiddenSelectedCountryWidth() {
2248
+ if (this.telInput.parentNode) {
2249
+ let e;
2250
+ try {
2251
+ e = window.top.document.body;
2252
+ } catch {
2253
+ e = document.body;
2254
+ }
2255
+ const $ = this.telInput.parentNode.cloneNode(
2256
+ !1
2257
+ );
2258
+ $.style.visibility = "hidden", e.appendChild($);
2259
+ const i = this.countryContainer.cloneNode();
2260
+ $.appendChild(i);
2261
+ const s = this.selectedCountry.cloneNode(
2262
+ !0
2387
2263
  );
2388
- $.nodeById[this.id] = r;
2389
- let u = "";
2390
- this.options.showFlags && (u += `<div class='iti__flag iti__${$.iso2}'></div>`), u += `<span class='iti__country-name'>${$.name}</span>`, u += `<span class='iti__dial-code' dir='ltr'>+${$.dialCode}</span>`, r.insertAdjacentHTML("beforeend", u);
2264
+ i.appendChild(s);
2265
+ const h = s.offsetWidth;
2266
+ return e.removeChild($), h;
2391
2267
  }
2268
+ return 0;
2269
+ }
2270
+ //* Update search results text (for a11y).
2271
+ updateSearchResultsA11yText() {
2272
+ const { i18n: e } = this.options, $ = this.countryList.childElementCount;
2273
+ let i;
2274
+ $ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace(
2275
+ "${count}",
2276
+ $.toString()
2277
+ ), this.searchResultsA11yText.textContent = i;
2278
+ }
2279
+ //* Check if an element is visible within it's container, else scroll until it is.
2280
+ scrollTo(e) {
2281
+ const $ = this.countryList, i = document.documentElement.scrollTop, s = $.offsetHeight, h = $.getBoundingClientRect().top + i, u = h + s, f = e.offsetHeight, c = e.getBoundingClientRect().top + i, g = c + f, I = c - h + $.scrollTop;
2282
+ if (c < h)
2283
+ $.scrollTop = I;
2284
+ else if (g > u) {
2285
+ const S = s - f;
2286
+ $.scrollTop = I - S;
2287
+ }
2288
+ }
2289
+ //* Remove highlighting from other list items and highlight the given item.
2290
+ highlightListItem(e, $) {
2291
+ const i = this.highlightedItem;
2292
+ if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"), this.options.countrySearch)) {
2293
+ const s = this.highlightedItem.getAttribute("id") || "";
2294
+ this.searchInput.setAttribute(
2295
+ "aria-activedescendant",
2296
+ s
2297
+ );
2298
+ }
2299
+ $ && this.highlightedItem.focus();
2300
+ }
2301
+ //* Country search: Filter the country list to the given array of countries.
2302
+ filterCountries(e) {
2303
+ this.countryList.innerHTML = "";
2304
+ let $ = !0;
2305
+ for (const i of e) {
2306
+ const s = i.nodeById[this.id];
2307
+ s && (this.countryList.appendChild(s), $ && (this.highlightListItem(s, !1), $ = !1));
2308
+ }
2309
+ $ ? (this.highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove("iti__hide")) : this.searchNoResults && this.searchNoResults.classList.add("iti__hide"), this.countryList.scrollTop = 0, this.updateSearchResultsA11yText();
2310
+ }
2311
+ destroy() {
2312
+ this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2313
+ const e = this.telInput.parentNode;
2314
+ e.before(this.telInput), e.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;
2315
+ for (const $ of this.countries)
2316
+ delete $.nodeById[this.id];
2317
+ this.countries = null;
2318
+ }
2319
+ }
2320
+ function Y0(p) {
2321
+ const { onlyCountries: e, excludeCountries: $ } = p;
2322
+ if (e.length) {
2323
+ const i = e.map((s) => s.toLowerCase());
2324
+ return Y.filter((s) => i.includes(s.iso2));
2325
+ } else if ($.length) {
2326
+ const i = $.map((s) => s.toLowerCase());
2327
+ return Y.filter((s) => !i.includes(s.iso2));
2328
+ }
2329
+ return Y;
2330
+ }
2331
+ function J0(p, e) {
2332
+ for (const $ of p) {
2333
+ const i = $.iso2.toLowerCase();
2334
+ e.i18n[i] && ($.name = e.i18n[i]);
2335
+ }
2336
+ }
2337
+ function q0(p, e) {
2338
+ const $ = /* @__PURE__ */ new Set();
2339
+ let i = 0;
2340
+ const s = {}, h = (u, f, c) => {
2341
+ if (!u || !f)
2342
+ return;
2343
+ f.length > i && (i = f.length), s.hasOwnProperty(f) || (s[f] = []);
2344
+ const g = s[f];
2345
+ if (g.includes(u))
2346
+ return;
2347
+ const I = c !== void 0 ? c : g.length;
2348
+ g[I] = u;
2349
+ };
2350
+ for (const u of p) {
2351
+ $.has(u.dialCode) || $.add(u.dialCode);
2352
+ for (let f = 1; f < u.dialCode.length; f++) {
2353
+ const c = u.dialCode.substring(0, f);
2354
+ h(u.iso2, c);
2355
+ }
2356
+ h(u.iso2, u.dialCode, u.priority);
2357
+ }
2358
+ (e.onlyCountries.length || e.excludeCountries.length) && $.forEach((u) => {
2359
+ s[u] = s[u].filter(Boolean);
2360
+ });
2361
+ for (const u of p)
2362
+ if (u.areaCodes) {
2363
+ const f = s[u.dialCode][0];
2364
+ for (const c of u.areaCodes) {
2365
+ for (let g = 1; g < c.length; g++) {
2366
+ const I = c.substring(0, g), S = u.dialCode + I;
2367
+ h(f, S), h(u.iso2, S);
2368
+ }
2369
+ h(u.iso2, u.dialCode + c);
2370
+ }
2371
+ }
2372
+ return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: s };
2373
+ }
2374
+ function X0(p, e) {
2375
+ e.countryOrder && (e.countryOrder = e.countryOrder.map(($) => $.toLowerCase())), p.sort(($, i) => {
2376
+ const { countryOrder: s } = e;
2377
+ if (s) {
2378
+ const h = s.indexOf($.iso2), u = s.indexOf(i.iso2), f = h > -1, c = u > -1;
2379
+ if (f || c)
2380
+ return f && c ? h - u : f ? -1 : 1;
2381
+ }
2382
+ return $.name.localeCompare(i.name);
2383
+ });
2384
+ }
2385
+ function Q0(p) {
2386
+ for (const e of p)
2387
+ e.normalisedName = c0(e.name), e.initials = e.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(($) => $[0]).join("").toLowerCase(), e.dialCodePlus = `+${e.dialCode}`;
2388
+ }
2389
+ function d2(p, e, $, i) {
2390
+ let s = p;
2391
+ if ($ && e) {
2392
+ e = `+${i.dialCode}`;
2393
+ const h = s[e.length] === " " || s[e.length] === "-" ? e.length + 1 : e.length;
2394
+ s = s.substring(h);
2395
+ }
2396
+ return s;
2397
+ }
2398
+ function t2(p, e, $, i, s) {
2399
+ const h = $ ? $.formatNumberAsYouType(p, i.iso2) : p, { dialCode: u } = i;
2400
+ return s && e.charAt(0) !== "+" && h.includes(`+${u}`) ? (h.split(`+${u}`)[1] || "").trim() : h;
2401
+ }
2402
+ function e2(p, e, $, i) {
2403
+ if ($ === 0 && !i)
2404
+ return 0;
2405
+ let s = 0;
2406
+ for (let h = 0; h < e.length; h++) {
2407
+ if (/[+0-9]/.test(e[h]) && s++, s === p && !i)
2408
+ return h + 1;
2409
+ if (i && s === p + 1)
2410
+ return h;
2411
+ }
2412
+ return e.length;
2413
+ }
2414
+ const $2 = [
2415
+ "800",
2416
+ "822",
2417
+ "833",
2418
+ "844",
2419
+ "855",
2420
+ "866",
2421
+ "877",
2422
+ "880",
2423
+ "881",
2424
+ "882",
2425
+ "883",
2426
+ "884",
2427
+ "885",
2428
+ "886",
2429
+ "887",
2430
+ "888",
2431
+ "889"
2432
+ ], l0 = (p) => {
2433
+ const e = c1(p);
2434
+ if (e.charAt(0) === "1") {
2435
+ const $ = e.substring(1, 4);
2436
+ return $2.includes($);
2437
+ }
2438
+ return !1;
2439
+ };
2440
+ for (const p of Y)
2441
+ p.name = a0[p.iso2];
2442
+ let n2 = 0;
2443
+ const i2 = new Set(Y.map((p) => p.iso2)), S1 = (p) => i2.has(p);
2444
+ class v1 {
2445
+ constructor(e, $ = {}) {
2446
+ this.id = n2++, this.options = { ...h0, ...$ }, z0(this.options), this.ui = new Z0(e, this.options, this.id), this.isAndroid = v1._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = Y0(this.options);
2447
+ const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: h } = q0(
2448
+ this.countries,
2449
+ this.options
2450
+ );
2451
+ this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = h, this.countryByIso2 = new Map(this.countries.map((u) => [u.iso2, u])), this._init();
2452
+ }
2453
+ static _getIsAndroid() {
2454
+ return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
2455
+ }
2456
+ _createInitPromises() {
2457
+ const e = new Promise((i, s) => {
2458
+ this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
2459
+ }), $ = new Promise((i, s) => {
2460
+ this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
2461
+ });
2462
+ return Promise.all([e, $]);
2463
+ }
2464
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
2465
+ _init() {
2466
+ this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
2467
+ }
2468
+ //********************
2469
+ //* PRIVATE METHODS
2470
+ //********************
2471
+ //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2472
+ _processCountryData() {
2473
+ J0(this.countries, this.options), X0(this.countries, this.options), Q0(this.countries);
2392
2474
  }
2393
2475
  //* Set the initial state of the input value and the selected country by:
2394
2476
  //* 1. Extracting a dial code from the given number
2395
2477
  //* 2. Using explicit initialCountry
2396
2478
  _setInitialState(e = !1) {
2397
- const $ = this.telInput.getAttribute("value"), i = this.telInput.value, u = $ && $.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? $ : i, h = this._getDialCode(u), c = o0(u), { initialCountry: C, geoIpLookup: g } = this.options, I = C === "auto" && g;
2398
- if (h && !c)
2399
- this._updateCountryFromNumber(u);
2479
+ const $ = this.ui.telInput.getAttribute("value"), i = this.ui.telInput.value, h = $ && $.startsWith("+") && (!i || !i.startsWith("+")) ? $ : i, u = this._getDialCode(h), f = l0(h), { initialCountry: c, geoIpLookup: g } = this.options, I = c === "auto" && g;
2480
+ if (u && !f)
2481
+ this._updateCountryFromNumber(h);
2400
2482
  else if (!I || e) {
2401
- const w = C ? C.toLowerCase() : "";
2402
- w1(w) ? this._setCountry(w) : h && c ? this._setCountry("us") : this._setCountry("");
2483
+ const S = c ? c.toLowerCase() : "";
2484
+ S1(S) ? this._setCountry(S) : u && f ? this._setCountry("us") : this._setCountry("");
2403
2485
  }
2404
- u && this._updateValFromNumber(u);
2486
+ h && this._updateValFromNumber(h);
2405
2487
  }
2406
2488
  //* Initialise the main event listeners: input keyup, and click selected country.
2407
2489
  _initListeners() {
2408
- this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.hiddenInput || this.hiddenInputCountry) && this.telInput.form && this._initHiddenInputListener();
2490
+ this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
2409
2491
  }
2410
2492
  //* Update hidden input on form submit.
2411
2493
  _initHiddenInputListener() {
2412
- var e;
2413
- this._handleHiddenInputSubmit = () => {
2414
- this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
2415
- }, (e = this.telInput.form) == null || e.addEventListener(
2416
- "submit",
2417
- this._handleHiddenInputSubmit
2418
- );
2494
+ var $;
2495
+ const e = () => {
2496
+ this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
2497
+ };
2498
+ ($ = this.ui.telInput.form) == null || $.addEventListener("submit", e, {
2499
+ signal: this.abortController.signal
2500
+ });
2419
2501
  }
2420
2502
  //* initialise the dropdown listeners.
2421
2503
  _initDropdownListeners() {
2422
- this._handleLabelClick = ($) => {
2423
- this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : $.preventDefault();
2504
+ const e = this.abortController.signal, $ = (u) => {
2505
+ this.ui.dropdownContent.classList.contains("iti__hide") ? this.ui.telInput.focus() : u.preventDefault();
2506
+ }, i = this.ui.telInput.closest("label");
2507
+ i && i.addEventListener("click", $, { signal: e });
2508
+ const s = () => {
2509
+ this.ui.dropdownContent.classList.contains("iti__hide") && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
2510
+ };
2511
+ this.ui.selectedCountry.addEventListener("click", s, {
2512
+ signal: e
2513
+ });
2514
+ const h = (u) => {
2515
+ this.ui.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(u.key) && (u.preventDefault(), u.stopPropagation(), this._openDropdown()), u.key === "Tab" && this._closeDropdown();
2424
2516
  };
2425
- const e = this.telInput.closest("label");
2426
- e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
2427
- this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
2428
- }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = ($) => {
2429
- this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes($.key) && ($.preventDefault(), $.stopPropagation(), this._openDropdown()), $.key === "Tab" && this._closeDropdown();
2430
- }, this.countryContainer.addEventListener(
2517
+ this.ui.countryContainer.addEventListener(
2431
2518
  "keydown",
2432
- this._handleCountryContainerKeydown
2519
+ h,
2520
+ { signal: e }
2433
2521
  );
2434
2522
  }
2435
2523
  //* Init many requests: utils script / geo ip lookup.
2436
2524
  _initRequests() {
2437
- let { loadUtils: e, initialCountry: $, geoIpLookup: i } = this.options;
2438
- e && !y.utils ? (this._doAttachUtils = () => {
2439
- var u;
2440
- (u = y.attachUtils(e)) == null || u.catch(() => {
2441
- });
2442
- }, y.documentReady() ? this._doAttachUtils() : (this._handlePageLoad = () => {
2443
- this._doAttachUtils();
2444
- }, window.addEventListener("load", this._handlePageLoad))) : this.resolveUtilsScriptPromise(), $ === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2525
+ const { loadUtils: e, initialCountry: $, geoIpLookup: i } = this.options;
2526
+ if (e && !y.utils) {
2527
+ const h = () => {
2528
+ var u;
2529
+ (u = y.attachUtils(e)) == null || u.catch(() => {
2530
+ });
2531
+ };
2532
+ if (y.documentReady())
2533
+ h();
2534
+ else {
2535
+ const u = () => {
2536
+ h();
2537
+ };
2538
+ window.addEventListener("load", u, {
2539
+ signal: this.abortController.signal
2540
+ });
2541
+ }
2542
+ } else
2543
+ this.resolveUtilsScriptPromise();
2544
+ $ === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2445
2545
  }
2446
2546
  //* Perform the geo ip lookup.
2447
2547
  _loadAutoCountry() {
2448
2548
  y.autoCountry ? this.handleAutoCountry() : y.startedLoadingAutoCountry || (y.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2449
2549
  (e = "") => {
2450
2550
  const $ = e.toLowerCase();
2451
- w1($) ? (y.autoCountry = $, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
2551
+ S1($) ? (y.autoCountry = $, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
2452
2552
  },
2453
2553
  () => {
2454
2554
  this._setInitialState(!0), $1("rejectAutoCountryPromise");
@@ -2456,206 +2556,257 @@ class f1 {
2456
2556
  ));
2457
2557
  }
2458
2558
  _openDropdownWithPlus() {
2459
- this._openDropdown(), this.searchInput.value = "+", this._filterCountries("");
2559
+ this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
2460
2560
  }
2461
2561
  //* Initialize the tel input listeners.
2462
2562
  _initTelInputListeners() {
2463
2563
  this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
2464
2564
  }
2465
2565
  _bindInputListener() {
2466
- const { strictMode: e, formatAsYouType: $, separateDialCode: i, allowDropdown: r, countrySearch: u } = this.options;
2467
- let h = !1;
2468
- new RegExp("\\p{L}", "u").test(this.telInput.value) && (h = !0), this._handleInputEvent = (c) => {
2469
- if (this.isAndroid && (c == null ? void 0 : c.data) === "+" && i && r && u) {
2470
- const w = this.telInput.selectionStart || 0, k = this.telInput.value.substring(0, w - 1), v = this.telInput.value.substring(w);
2471
- this.telInput.value = k + v, this._openDropdownWithPlus();
2566
+ const {
2567
+ strictMode: e,
2568
+ formatAsYouType: $,
2569
+ separateDialCode: i,
2570
+ allowDropdown: s,
2571
+ countrySearch: h
2572
+ } = this.options;
2573
+ let u = !1;
2574
+ new RegExp("\\p{L}", "u").test(this.ui.telInput.value) && (u = !0);
2575
+ const f = (c) => {
2576
+ if (this.isAndroid && (c == null ? void 0 : c.data) === "+" && i && s && h) {
2577
+ const L = this.ui.telInput.selectionStart || 0, b = this.ui.telInput.value.substring(
2578
+ 0,
2579
+ L - 1
2580
+ ), A = this.ui.telInput.value.substring(L);
2581
+ this.ui.telInput.value = b + A, this._openDropdownWithPlus();
2472
2582
  return;
2473
2583
  }
2474
- this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
2475
- const C = (c == null ? void 0 : c.data) && /[^+0-9]/.test(c.data), g = (c == null ? void 0 : c.inputType) === "insertFromPaste" && this.telInput.value;
2476
- C || g && !e ? h = !0 : /[^+0-9]/.test(this.telInput.value) || (h = !1);
2477
- const I = (c == null ? void 0 : c.detail) && c.detail.isSetNumber;
2478
- if ($ && !h && !I) {
2479
- const w = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, w).replace(/[^+0-9]/g, "").length, E = (c == null ? void 0 : c.inputType) === "deleteContentForward", N = this._getFullNumber(), P = Q0(
2480
- N,
2481
- this.telInput.value,
2584
+ this._updateCountryFromNumber(this.ui.telInput.value) && this._triggerCountryChange();
2585
+ const g = (c == null ? void 0 : c.data) && /[^+0-9]/.test(c.data), I = (c == null ? void 0 : c.inputType) === "insertFromPaste" && this.ui.telInput.value;
2586
+ g || I && !e ? u = !0 : /[^+0-9]/.test(this.ui.telInput.value) || (u = !1);
2587
+ const S = (c == null ? void 0 : c.detail) && c.detail.isSetNumber;
2588
+ if ($ && !u && !S) {
2589
+ const L = this.ui.telInput.selectionStart || 0, A = this.ui.telInput.value.substring(
2590
+ 0,
2591
+ L
2592
+ ).replace(
2593
+ /[^+0-9]/g,
2594
+ ""
2595
+ ).length, G = (c == null ? void 0 : c.inputType) === "deleteContentForward", E = this._getFullNumber(), P = t2(
2596
+ E,
2597
+ this.ui.telInput.value,
2482
2598
  y.utils,
2483
2599
  this.selectedCountryData,
2484
2600
  this.options.separateDialCode
2485
- ), G = d2(v, P, w, E);
2486
- this.telInput.value = P, this.telInput.setSelectionRange(G, G);
2601
+ ), U = e2(
2602
+ A,
2603
+ P,
2604
+ L,
2605
+ G
2606
+ );
2607
+ this.ui.telInput.value = P, this.ui.telInput.setSelectionRange(U, U);
2487
2608
  }
2488
- }, this.telInput.addEventListener("input", this._handleInputEvent);
2609
+ };
2610
+ this.ui.telInput.addEventListener("input", f, {
2611
+ signal: this.abortController.signal
2612
+ });
2489
2613
  }
2490
2614
  _maybeBindKeydownListener() {
2491
- const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch: r } = this.options;
2492
- (e || $) && (this._handleKeydownEvent = (u) => {
2493
- if (u.key && u.key.length === 1 && !u.altKey && !u.ctrlKey && !u.metaKey) {
2494
- if ($ && i && r && u.key === "+") {
2495
- u.preventDefault(), this._openDropdownWithPlus();
2496
- return;
2497
- }
2498
- if (e) {
2499
- const h = this.telInput.value, C = !(h.charAt(0) === "+") && this.telInput.selectionStart === 0 && u.key === "+", g = /^[0-9]$/.test(u.key), I = $ ? g : C || g, w = h.slice(0, this.telInput.selectionStart) + u.key + h.slice(this.telInput.selectionEnd), k = this._getFullNumber(w), v = y.utils.getCoreNumber(k, this.selectedCountryData.iso2), E = this.maxCoreNumberLength && v.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(k) !== null;
2500
- (!I || E && !P && !C) && u.preventDefault();
2615
+ const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch: s } = this.options;
2616
+ if (e || $) {
2617
+ const h = (u) => {
2618
+ if (u.key && u.key.length === 1 && !u.altKey && !u.ctrlKey && !u.metaKey) {
2619
+ if ($ && i && s && u.key === "+") {
2620
+ u.preventDefault(), this._openDropdownWithPlus();
2621
+ return;
2622
+ }
2623
+ if (e) {
2624
+ const f = this.ui.telInput.value, g = !f.startsWith("+") && this.ui.telInput.selectionStart === 0 && u.key === "+", I = /^[0-9]$/.test(u.key), S = $ ? I : g || I, L = f.slice(0, this.ui.telInput.selectionStart) + u.key + f.slice(this.ui.telInput.selectionEnd), b = this._getFullNumber(L), A = y.utils.getCoreNumber(
2625
+ b,
2626
+ this.selectedCountryData.iso2
2627
+ ), G = this.maxCoreNumberLength && A.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(b) !== null;
2628
+ (!S || G && !P && !g) && u.preventDefault();
2629
+ }
2501
2630
  }
2502
- }
2503
- }, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
2631
+ };
2632
+ this.ui.telInput.addEventListener("keydown", h, {
2633
+ signal: this.abortController.signal
2634
+ });
2635
+ }
2504
2636
  }
2505
2637
  _maybeBindPasteListener() {
2506
- this.options.strictMode && (this._handlePasteEvent = (e) => {
2507
- e.preventDefault();
2508
- const $ = this.telInput, i = $.selectionStart, r = $.selectionEnd, u = $.value.slice(0, i), h = $.value.slice(r), c = this.selectedCountryData.iso2, C = e.clipboardData.getData("text"), g = i === 0 && r > 0, I = !$.value.startsWith("+") || g, w = C.replace(/[^0-9+]/g, ""), k = w.startsWith("+"), v = w.replace(/\+/g, ""), E = k && I ? `+${v}` : v;
2509
- let N = u + E + h, P = y.utils.getCoreNumber(N, c);
2510
- for (; P.length === 0 && N.length > 0; )
2511
- N = N.slice(0, -1), P = y.utils.getCoreNumber(N, c);
2512
- if (!P)
2513
- return;
2514
- if (this.maxCoreNumberLength && P.length > this.maxCoreNumberLength)
2515
- if ($.selectionEnd === $.value.length) {
2516
- const j = P.length - this.maxCoreNumberLength;
2517
- N = N.slice(0, N.length - j);
2518
- } else
2638
+ if (this.options.strictMode) {
2639
+ const e = ($) => {
2640
+ $.preventDefault();
2641
+ const i = this.ui.telInput, s = i.selectionStart, h = i.selectionEnd, u = i.value.slice(0, s), f = i.value.slice(h), c = this.selectedCountryData.iso2, g = $.clipboardData.getData("text"), I = s === 0 && h > 0, S = !i.value.startsWith("+") || I, L = g.replace(/[^0-9+]/g, ""), b = L.startsWith("+"), A = L.replace(/\+/g, ""), G = b && S ? `+${A}` : A;
2642
+ let E = u + G + f, P = y.utils.getCoreNumber(E, c);
2643
+ for (; P.length === 0 && E.length > 0; )
2644
+ E = E.slice(0, -1), P = y.utils.getCoreNumber(E, c);
2645
+ if (!P)
2519
2646
  return;
2520
- $.value = N;
2521
- const G = i + E.length;
2522
- $.setSelectionRange(G, G), $.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2523
- }, this.telInput.addEventListener("paste", this._handlePasteEvent));
2647
+ if (this.maxCoreNumberLength && P.length > this.maxCoreNumberLength)
2648
+ if (i.selectionEnd === i.value.length) {
2649
+ const f1 = P.length - this.maxCoreNumberLength;
2650
+ E = E.slice(0, E.length - f1);
2651
+ } else
2652
+ return;
2653
+ i.value = E;
2654
+ const U = s + G.length;
2655
+ i.setSelectionRange(U, U), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2656
+ };
2657
+ this.ui.telInput.addEventListener("paste", e, {
2658
+ signal: this.abortController.signal
2659
+ });
2660
+ }
2524
2661
  }
2525
2662
  //* Adhere to the input's maxlength attr.
2526
2663
  _cap(e) {
2527
- const $ = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
2664
+ const $ = Number(this.ui.telInput.getAttribute("maxlength"));
2528
2665
  return $ && e.length > $ ? e.substring(0, $) : e;
2529
2666
  }
2530
- //* Trigger a custom event on the input.
2667
+ //* Trigger a custom event on the input (typed via ItiEventMap).
2531
2668
  _trigger(e, $ = {}) {
2532
2669
  const i = new CustomEvent(e, {
2533
2670
  bubbles: !0,
2534
2671
  cancelable: !0,
2535
2672
  detail: $
2536
2673
  });
2537
- this.telInput.dispatchEvent(i);
2674
+ this.ui.telInput.dispatchEvent(i);
2538
2675
  }
2539
2676
  //* Open the dropdown.
2540
2677
  _openDropdown() {
2541
2678
  const { fixDropdownWidth: e, countrySearch: $ } = this.options;
2542
- if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), $) {
2543
- const i = this.countryList.firstElementChild;
2544
- i && (this._highlightListItem(i, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
2679
+ if (this.dropdownAbortController = new AbortController(), e && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove("iti__hide"), this.ui.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), $) {
2680
+ const i = this.ui.countryList.firstElementChild;
2681
+ i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
2545
2682
  }
2546
- this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
2683
+ this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
2547
2684
  }
2548
2685
  //* Set the dropdown position
2549
2686
  _setDropdownPosition() {
2550
- if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
2551
- const e = this.telInput.getBoundingClientRect(), $ = this.telInput.offsetHeight;
2552
- this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + $}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
2687
+ if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
2688
+ const e = this.ui.telInput.getBoundingClientRect(), $ = this.ui.telInput.offsetHeight;
2689
+ if (this.options.dropdownContainer) {
2690
+ this.ui.dropdown.style.top = `${e.top + $}px`, this.ui.dropdown.style.left = `${e.left}px`;
2691
+ const i = () => this._closeDropdown();
2692
+ window.addEventListener("scroll", i, {
2693
+ signal: this.dropdownAbortController.signal
2694
+ });
2695
+ }
2553
2696
  }
2554
2697
  }
2555
2698
  //* We only bind dropdown listeners when the dropdown is open.
2556
2699
  _bindDropdownListeners() {
2557
- this._handleMouseoverCountryList = (i) => {
2558
- var u;
2559
- const r = (u = i.target) == null ? void 0 : u.closest(".iti__country");
2560
- r && this._highlightListItem(r, !1);
2561
- }, this.countryList.addEventListener(
2562
- "mouseover",
2563
- this._handleMouseoverCountryList
2564
- ), this._handleClickCountryList = (i) => {
2565
- var u;
2566
- const r = (u = i.target) == null ? void 0 : u.closest(".iti__country");
2567
- r && this._selectListItem(r);
2568
- }, this.countryList.addEventListener("click", this._handleClickCountryList), this._handleClickOffToClose = (i) => {
2569
- !!i.target.closest(`#iti-${this.id}__dropdown-content`) || this._closeDropdown();
2570
- }, setTimeout(() => {
2700
+ const e = this.dropdownAbortController.signal, $ = (c) => {
2701
+ var I;
2702
+ const g = (I = c.target) == null ? void 0 : I.closest(
2703
+ ".iti__country"
2704
+ );
2705
+ g && this.ui.highlightListItem(g, !1);
2706
+ };
2707
+ this.ui.countryList.addEventListener("mouseover", $, {
2708
+ signal: e
2709
+ });
2710
+ const i = (c) => {
2711
+ var I;
2712
+ const g = (I = c.target) == null ? void 0 : I.closest(
2713
+ ".iti__country"
2714
+ );
2715
+ g && this._selectListItem(g);
2716
+ };
2717
+ this.ui.countryList.addEventListener("click", i, {
2718
+ signal: e
2719
+ });
2720
+ const s = (c) => {
2721
+ !!c.target.closest(
2722
+ `#iti-${this.id}__dropdown-content`
2723
+ ) || this._closeDropdown();
2724
+ };
2725
+ setTimeout(() => {
2571
2726
  document.documentElement.addEventListener(
2572
2727
  "click",
2573
- this._handleClickOffToClose
2728
+ s,
2729
+ { signal: e }
2574
2730
  );
2575
2731
  }, 0);
2576
- let e = "", $ = null;
2577
- if (this._handleKeydownOnDropdown = (i) => {
2578
- ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), i.key === "ArrowUp" || i.key === "ArrowDown" ? this._handleUpDownKey(i.key) : i.key === "Enter" ? this._handleEnterKey() : i.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(i.key) && (i.stopPropagation(), $ && clearTimeout($), e += i.key.toLowerCase(), this._searchForCountry(e), $ = setTimeout(() => {
2579
- e = "";
2732
+ let h = "", u = null;
2733
+ const f = (c) => {
2734
+ ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(c.key) && (c.preventDefault(), c.stopPropagation(), c.key === "ArrowUp" || c.key === "ArrowDown" ? this._handleUpDownKey(c.key) : c.key === "Enter" ? this._handleEnterKey() : c.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(c.key) && (c.stopPropagation(), u && clearTimeout(u), h += c.key.toLowerCase(), this._searchForCountry(h), u = setTimeout(() => {
2735
+ h = "";
2580
2736
  }, 1e3));
2581
- }, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
2582
- const i = () => {
2583
- const u = this.searchInput.value.trim();
2584
- this._filterCountries(u), this.searchInput.value ? this.searchClearButton.classList.remove("iti__hide") : this.searchClearButton.classList.add("iti__hide");
2737
+ };
2738
+ if (document.addEventListener("keydown", f, { signal: e }), this.options.countrySearch) {
2739
+ const c = () => {
2740
+ const L = this.ui.searchInput.value.trim();
2741
+ this._filterCountriesByQuery(L), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove("iti__hide") : this.ui.searchClearButton.classList.add("iti__hide");
2585
2742
  };
2586
- let r = null;
2587
- this._handleSearchChange = () => {
2588
- r && clearTimeout(r), r = setTimeout(() => {
2589
- i(), r = null;
2743
+ let g = null;
2744
+ const I = () => {
2745
+ g && clearTimeout(g), g = setTimeout(() => {
2746
+ c(), g = null;
2590
2747
  }, 100);
2591
- }, this.searchInput.addEventListener("input", this._handleSearchChange), this._handleSearchClear = () => {
2592
- this.searchInput.value = "", this.searchInput.focus(), i();
2593
- }, this.searchClearButton.addEventListener("click", this._handleSearchClear);
2748
+ };
2749
+ this.ui.searchInput.addEventListener("input", I, {
2750
+ signal: e
2751
+ });
2752
+ const S = () => {
2753
+ this.ui.searchInput.value = "", this.ui.searchInput.focus(), c();
2754
+ };
2755
+ this.ui.searchClearButton.addEventListener("click", S, {
2756
+ signal: e
2757
+ });
2594
2758
  }
2595
2759
  }
2596
2760
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2597
2761
  _searchForCountry(e) {
2598
2762
  for (const $ of this.countries)
2599
2763
  if ($.name.substring(0, e.length).toLowerCase() === e) {
2600
- const r = $.nodeById[this.id];
2601
- this._highlightListItem(r, !1), this._scrollTo(r);
2764
+ const s = $.nodeById[this.id];
2765
+ this.ui.highlightListItem(s, !1), this.ui.scrollTo(s);
2602
2766
  break;
2603
2767
  }
2604
2768
  }
2605
- //* Country search enabled: Filter the countries according to the search query.
2606
- _filterCountries(e) {
2607
- this.countryList.innerHTML = "";
2769
+ //* Country search: Filter the countries according to the search query.
2770
+ _filterCountriesByQuery(e) {
2608
2771
  let $;
2609
- e === "" ? $ = this.countries : $ = this._getMatchedCountries(e);
2610
- let i = !0;
2611
- for (const r of $) {
2612
- const u = r.nodeById[this.id];
2613
- u && (this.countryList.appendChild(u), i && (this._highlightListItem(u, !1), i = !1));
2614
- }
2615
- i ? (this._highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove("iti__hide")) : this.searchNoResults && this.searchNoResults.classList.add("iti__hide"), this.countryList.scrollTop = 0, this._updateSearchResultsA11yText();
2772
+ e === "" ? $ = this.countries : $ = this._getMatchedCountries(e), this.ui.filterCountries($);
2616
2773
  }
2617
2774
  _getMatchedCountries(e) {
2618
- const $ = a0(e), i = [], r = [], u = [], h = [], c = [], C = [];
2775
+ const $ = c0(e), i = [], s = [], h = [], u = [], f = [], c = [];
2619
2776
  for (const g of this.countries)
2620
- g.iso2 === $ ? i.push(g) : g.normalisedName.startsWith($) ? r.push(g) : g.normalisedName.includes($) ? u.push(g) : $ === g.dialCode || $ === g.dialCodePlus ? h.push(g) : g.dialCodePlus.includes($) ? c.push(g) : g.initials.includes($) && C.push(g);
2777
+ g.iso2 === $ ? i.push(g) : g.normalisedName.startsWith($) ? s.push(g) : g.normalisedName.includes($) ? h.push(g) : $ === g.dialCode || $ === g.dialCodePlus ? u.push(g) : g.dialCodePlus.includes($) ? f.push(g) : g.initials.includes($) && c.push(g);
2621
2778
  return [
2622
2779
  ...i.sort((g, I) => g.priority - I.priority),
2623
- ...r.sort((g, I) => g.priority - I.priority),
2624
- ...u.sort((g, I) => g.priority - I.priority),
2780
+ ...s.sort((g, I) => g.priority - I.priority),
2625
2781
  ...h.sort((g, I) => g.priority - I.priority),
2626
- ...c.sort((g, I) => g.priority - I.priority),
2627
- ...C.sort((g, I) => g.priority - I.priority)
2782
+ ...u.sort((g, I) => g.priority - I.priority),
2783
+ ...f.sort((g, I) => g.priority - I.priority),
2784
+ ...c.sort((g, I) => g.priority - I.priority)
2628
2785
  ];
2629
2786
  }
2630
- //* Update search results text (for a11y).
2631
- _updateSearchResultsA11yText() {
2632
- const { i18n: e } = this.options, $ = this.countryList.childElementCount;
2633
- let i;
2634
- $ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace("${count}", $.toString()), this.searchResultsA11yText.textContent = i;
2635
- }
2636
2787
  //* Highlight the next/prev item in the list (and ensure it is visible).
2637
2788
  _handleUpDownKey(e) {
2638
- var i, r;
2639
- let $ = e === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (r = this.highlightedItem) == null ? void 0 : r.nextElementSibling;
2640
- !$ && this.countryList.childElementCount > 1 && ($ = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), $ && (this._scrollTo($), this._highlightListItem($, !1));
2789
+ var i, s;
2790
+ let $ = e === "ArrowUp" ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
2791
+ !$ && this.ui.countryList.childElementCount > 1 && ($ = e === "ArrowUp" ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), $ && (this.ui.scrollTo($), this.ui.highlightListItem($, !1));
2641
2792
  }
2642
2793
  //* Select the currently highlighted item.
2643
2794
  _handleEnterKey() {
2644
- this.highlightedItem && this._selectListItem(this.highlightedItem);
2795
+ this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
2645
2796
  }
2646
2797
  //* Update the input's value to the given val (format first if possible)
2647
2798
  //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2648
2799
  _updateValFromNumber(e) {
2649
2800
  let $ = e;
2650
2801
  if (this.options.formatOnDisplay && y.utils && this.selectedCountryData) {
2651
- const i = this.options.nationalMode || $.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: r, INTERNATIONAL: u } = y.utils.numberFormat, h = i ? r : u;
2802
+ const i = this.options.nationalMode || !$.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: h } = y.utils.numberFormat, u = i ? s : h;
2652
2803
  $ = y.utils.formatNumber(
2653
2804
  $,
2654
2805
  this.selectedCountryData.iso2,
2655
- h
2806
+ u
2656
2807
  );
2657
2808
  }
2658
- $ = this._beforeSetNumber($), this.telInput.value = $;
2809
+ $ = this._beforeSetNumber($), this.ui.telInput.value = $;
2659
2810
  }
2660
2811
  //* Check if need to select a new country based on the given number
2661
2812
  //* Note: called from _setInitialState, keyup handler, setNumber.
@@ -2666,10 +2817,10 @@ class f1 {
2666
2817
  // if there is a selected country, and the number doesn't start with a dial code, then add it
2667
2818
  _ensureHasDialCode(e) {
2668
2819
  const { dialCode: $, nationalPrefix: i } = this.selectedCountryData;
2669
- if (e.charAt(0) === "+" || !$)
2820
+ if (e.startsWith("+") || !$)
2670
2821
  return e;
2671
- const h = i && e.charAt(0) === i && !this.options.separateDialCode ? e.substring(1) : e;
2672
- return `+${$}${h}`;
2822
+ const u = i && e.startsWith(i) && !this.options.separateDialCode ? e.substring(1) : e;
2823
+ return `+${$}${u}`;
2673
2824
  }
2674
2825
  // Get the country ISO2 code from the given number
2675
2826
  // BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
@@ -2677,186 +2828,137 @@ class f1 {
2677
2828
  _getNewCountryFromNumber(e) {
2678
2829
  const $ = e.indexOf("+");
2679
2830
  let i = $ ? e.substring($) : e;
2680
- const r = this.selectedCountryData.iso2, u = this.selectedCountryData.dialCode;
2831
+ const s = this.selectedCountryData.iso2, h = this.selectedCountryData.dialCode;
2681
2832
  i = this._ensureHasDialCode(i);
2682
- const h = this._getDialCode(i, !0), c = c1(i);
2683
- if (h) {
2684
- const C = c1(h), g = this.dialCodeToIso2Map[C];
2833
+ const u = this._getDialCode(i, !0), f = c1(i);
2834
+ if (u) {
2835
+ const c = c1(u), g = this.dialCodeToIso2Map[c];
2685
2836
  if (g.length === 1)
2686
- return g[0] === r ? null : g[0];
2687
- if (!r && this.defaultCountry && g.includes(this.defaultCountry))
2837
+ return g[0] === s ? null : g[0];
2838
+ if (!s && this.defaultCountry && g.includes(this.defaultCountry))
2688
2839
  return this.defaultCountry;
2689
- if (u === "1" && o0(c))
2840
+ if (h === "1" && l0(f))
2690
2841
  return null;
2691
- const { areaCodes: w, priority: k } = this.selectedCountryData;
2692
- if (w) {
2693
- const G = w.map((j) => `${u}${j}`);
2694
- for (const j of G)
2695
- if (c.startsWith(j))
2842
+ const { areaCodes: S, priority: L } = this.selectedCountryData;
2843
+ if (S) {
2844
+ const P = S.map(
2845
+ (U) => `${h}${U}`
2846
+ );
2847
+ for (const U of P)
2848
+ if (f.startsWith(U))
2696
2849
  return null;
2697
2850
  }
2698
- const E = w && !(k === 0) && c.length > C.length, N = r && g.includes(r) && !E, P = r === g[0];
2699
- if (!N && !P)
2851
+ const A = S && !(L === 0) && f.length > c.length, G = s && g.includes(s) && !A, E = s === g[0];
2852
+ if (!G && !E)
2700
2853
  return g[0];
2701
2854
  } else {
2702
- if (i.charAt(0) === "+" && c.length)
2855
+ if (i.startsWith("+") && f.length)
2703
2856
  return "";
2704
- if ((!i || i === "+") && !r)
2857
+ if ((!i || i === "+") && !s)
2705
2858
  return this.defaultCountry;
2706
2859
  }
2707
2860
  return null;
2708
2861
  }
2709
- //* Remove highlighting from other list items and highlight the given item.
2710
- _highlightListItem(e, $) {
2711
- const i = this.highlightedItem;
2712
- if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"), this.options.countrySearch)) {
2713
- const r = this.highlightedItem.getAttribute("id") || "";
2714
- this.searchInput.setAttribute("aria-activedescendant", r);
2715
- }
2716
- $ && this.highlightedItem.focus();
2717
- }
2718
2862
  //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
2719
2863
  //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2720
2864
  _setCountry(e) {
2721
- const { separateDialCode: $, showFlags: i, i18n: r } = this.options, u = this.selectedCountryData.iso2 || "";
2722
- if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
2723
- const h = e && i ? `iti__flag iti__${e}` : "iti__flag iti__globe";
2724
- let c, C;
2865
+ const { separateDialCode: $, showFlags: i, i18n: s } = this.options, h = this.selectedCountryData.iso2 || "";
2866
+ if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
2867
+ const u = e && i ? `iti__flag iti__${e}` : "iti__flag iti__globe";
2868
+ let f, c;
2725
2869
  if (e) {
2726
2870
  const { name: g, dialCode: I } = this.selectedCountryData;
2727
- C = g, c = r.selectedCountryAriaLabel.replace("${countryName}", g).replace("${dialCode}", `+${I}`);
2871
+ c = g, f = s.selectedCountryAriaLabel.replace("${countryName}", g).replace("${dialCode}", `+${I}`);
2728
2872
  } else
2729
- C = r.noCountrySelected, c = r.noCountrySelected;
2730
- this.selectedCountryInner.className = h, this.selectedCountry.setAttribute("title", C), this.selectedCountry.setAttribute("aria-label", c);
2873
+ c = s.noCountrySelected, f = s.noCountrySelected;
2874
+ this.ui.selectedCountryInner.className = u, this.ui.selectedCountry.setAttribute("title", c), this.ui.selectedCountry.setAttribute("aria-label", f);
2731
2875
  }
2732
2876
  if ($) {
2733
- const h = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2734
- this.selectedDialCode.innerHTML = h, this._updateInputPadding();
2735
- }
2736
- return this._updatePlaceholder(), this._updateMaxLength(), u !== e;
2737
- }
2738
- //* Update the input padding to make space for the selected country/dial code.
2739
- _updateInputPadding() {
2740
- if (this.selectedCountry) {
2741
- const e = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + 6;
2742
- this.telInput.style.paddingLeft = `${i}px`;
2877
+ const u = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2878
+ this.ui.selectedDialCode.textContent = u, this.ui.updateInputPadding();
2743
2879
  }
2880
+ return this._updatePlaceholder(), this._updateMaxLength(), h !== e;
2744
2881
  }
2745
2882
  //* Update the maximum valid number length for the currently selected country.
2746
2883
  _updateMaxLength() {
2747
- const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2: r } = this.selectedCountryData;
2884
+ const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
2748
2885
  if (e && y.utils)
2749
- if (r) {
2750
- const u = y.utils.numberType[$];
2751
- let h = y.utils.getExampleNumber(
2752
- r,
2886
+ if (s) {
2887
+ const h = y.utils.numberType[$];
2888
+ let u = y.utils.getExampleNumber(
2889
+ s,
2753
2890
  !1,
2754
- u,
2891
+ h,
2755
2892
  !0
2756
- ), c = h;
2757
- for (; y.utils.isPossibleNumber(h, r, i); )
2758
- c = h, h += "0";
2759
- const C = y.utils.getCoreNumber(c, r);
2760
- this.maxCoreNumberLength = C.length, r === "by" && (this.maxCoreNumberLength = C.length + 1);
2893
+ ), f = u;
2894
+ for (; y.utils.isPossibleNumber(
2895
+ u,
2896
+ s,
2897
+ i
2898
+ ); )
2899
+ f = u, u += "0";
2900
+ const c = y.utils.getCoreNumber(f, s);
2901
+ this.maxCoreNumberLength = c.length, s === "by" && (this.maxCoreNumberLength = c.length + 1);
2761
2902
  } else
2762
2903
  this.maxCoreNumberLength = null;
2763
2904
  }
2764
- //* When input is in a hidden container during init, we cannot calculate the selected country width.
2765
- //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2766
- //* To get the right styling to apply, all we need is a shallow clone of the container,
2767
- //* and then to inject a deep clone of the selectedCountry element.
2768
- _getHiddenSelectedCountryWidth() {
2769
- if (this.telInput.parentNode) {
2770
- let e;
2771
- try {
2772
- e = window.top.document.body;
2773
- } catch {
2774
- e = document.body;
2775
- }
2776
- const $ = this.telInput.parentNode.cloneNode(!1);
2777
- $.style.visibility = "hidden", e.appendChild($);
2778
- const i = this.countryContainer.cloneNode();
2779
- $.appendChild(i);
2780
- const r = this.selectedCountry.cloneNode(!0);
2781
- i.appendChild(r);
2782
- const u = r.offsetWidth;
2783
- return e.removeChild($), u;
2784
- }
2785
- return 0;
2786
- }
2787
2905
  //* Update the input placeholder to an example number from the currently selected country.
2788
2906
  _updatePlaceholder() {
2789
2907
  const {
2790
2908
  autoPlaceholder: e,
2791
2909
  placeholderNumberType: $,
2792
2910
  nationalMode: i,
2793
- customPlaceholder: r
2794
- } = this.options, u = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
2795
- if (y.utils && u) {
2796
- const h = y.utils.numberType[$];
2797
- let c = this.selectedCountryData.iso2 ? y.utils.getExampleNumber(
2911
+ customPlaceholder: s
2912
+ } = this.options, h = e === "aggressive" || !this.ui.hadInitialPlaceholder && e === "polite";
2913
+ if (y.utils && h) {
2914
+ const u = y.utils.numberType[$];
2915
+ let f = this.selectedCountryData.iso2 ? y.utils.getExampleNumber(
2798
2916
  this.selectedCountryData.iso2,
2799
2917
  i,
2800
- h
2918
+ u
2801
2919
  ) : "";
2802
- c = this._beforeSetNumber(c), typeof r == "function" && (c = r(c, this.selectedCountryData)), this.telInput.setAttribute("placeholder", c);
2920
+ f = this._beforeSetNumber(f), typeof s == "function" && (f = s(f, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", f);
2803
2921
  }
2804
2922
  }
2805
2923
  //* Called when the user selects a list item from the dropdown.
2806
2924
  _selectListItem(e) {
2807
- const $ = e.getAttribute("data-country-code"), i = this._setCountry($);
2925
+ const $ = e.dataset.countryCode, i = this._setCountry($);
2808
2926
  this._closeDropdown();
2809
- const r = e.getAttribute("data-dial-code");
2810
- this._updateDialCode(r), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this.telInput.focus(), i && this._triggerCountryChange();
2927
+ const s = e.dataset.dialCode;
2928
+ this._updateDialCode(s), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this.ui.telInput.focus(), i && this._triggerCountryChange();
2811
2929
  }
2812
2930
  //* Close the dropdown and unbind any listeners.
2813
2931
  _closeDropdown() {
2814
- this.dropdownContent.classList.add("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "false"), this.highlightedItem && this.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.searchInput.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), this.options.countrySearch && (this.searchInput.removeEventListener("input", this._handleSearchChange), this.searchClearButton.removeEventListener("click", this._handleSearchClear)), document.removeEventListener("keydown", this._handleKeydownOnDropdown), document.documentElement.removeEventListener(
2815
- "click",
2816
- this._handleClickOffToClose
2817
- ), this.countryList.removeEventListener(
2818
- "mouseover",
2819
- this._handleMouseoverCountryList
2820
- ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
2821
- }
2822
- //* Check if an element is visible within it's container, else scroll until it is.
2823
- _scrollTo(e) {
2824
- const $ = this.countryList, i = document.documentElement.scrollTop, r = $.offsetHeight, u = $.getBoundingClientRect().top + i, h = u + r, c = e.offsetHeight, C = e.getBoundingClientRect().top + i, g = C + c, I = C - u + $.scrollTop;
2825
- if (C < u)
2826
- $.scrollTop = I;
2827
- else if (g > h) {
2828
- const w = r - c;
2829
- $.scrollTop = I - w;
2830
- }
2932
+ this.ui.dropdownContent.classList.contains("iti__hide") || (this.ui.dropdownContent.classList.add("iti__hide"), this.ui.selectedCountry.setAttribute("aria-expanded", "false"), this.ui.highlightedItem && this.ui.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.ui.searchInput.removeAttribute("aria-activedescendant"), this.ui.dropdownArrow.classList.remove("iti__arrow--up"), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger("close:countrydropdown"));
2831
2933
  }
2832
2934
  //* Replace any existing dial code with the new one
2833
2935
  //* Note: called from _selectListItem and setCountry
2834
2936
  _updateDialCode(e) {
2835
- const $ = this.telInput.value, i = `+${e}`;
2836
- let r;
2837
- if ($.charAt(0) === "+") {
2838
- const u = this._getDialCode($);
2839
- u ? r = $.replace(u, i) : r = i, this.telInput.value = r;
2937
+ const $ = this.ui.telInput.value, i = `+${e}`;
2938
+ let s;
2939
+ if ($.startsWith("+")) {
2940
+ const h = this._getDialCode($);
2941
+ h ? s = $.replace(h, i) : s = i, this.ui.telInput.value = s;
2840
2942
  }
2841
2943
  }
2842
2944
  //* Try and extract a valid international dial code from a full telephone number.
2843
2945
  //* Note: returns the raw string inc plus character and any whitespace/dots etc.
2844
2946
  _getDialCode(e, $) {
2845
2947
  let i = "";
2846
- if (e.charAt(0) === "+") {
2847
- let r = "";
2848
- for (let u = 0; u < e.length; u++) {
2849
- const h = e.charAt(u);
2850
- if (/[0-9]/.test(h)) {
2851
- if (r += h, !!!this.dialCodeToIso2Map[r])
2948
+ if (e.startsWith("+")) {
2949
+ let s = "";
2950
+ for (let h = 0; h < e.length; h++) {
2951
+ const u = e.charAt(h);
2952
+ if (/[0-9]/.test(u)) {
2953
+ if (s += u, !!!this.dialCodeToIso2Map[s])
2852
2954
  break;
2853
2955
  if ($)
2854
- i = e.substring(0, u + 1);
2855
- else if (this.dialCodes.has(r)) {
2856
- i = e.substring(0, u + 1);
2956
+ i = e.substring(0, h + 1);
2957
+ else if (this.dialCodes.has(s)) {
2958
+ i = e.substring(0, h + 1);
2857
2959
  break;
2858
2960
  }
2859
- if (r.length === this.dialCodeMaxLen)
2961
+ if (s.length === this.dialCodeMaxLen)
2860
2962
  break;
2861
2963
  }
2862
2964
  }
@@ -2865,14 +2967,14 @@ class f1 {
2865
2967
  }
2866
2968
  //* Get the input val, adding the dial code if separateDialCode is enabled.
2867
2969
  _getFullNumber(e) {
2868
- const $ = e || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
2869
- let r;
2870
- const u = c1($);
2871
- return this.options.separateDialCode && $.charAt(0) !== "+" && i && u ? r = `+${i}` : r = "", r + $;
2970
+ const $ = e || this.ui.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
2971
+ let s;
2972
+ const h = c1($);
2973
+ return this.options.separateDialCode && !$.startsWith("+") && i && h ? s = `+${i}` : s = "", s + $;
2872
2974
  }
2873
2975
  //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
2874
2976
  _beforeSetNumber(e) {
2875
- const $ = this._getDialCode(e), i = X0(
2977
+ const $ = this._getDialCode(e), i = d2(
2876
2978
  e,
2877
2979
  $,
2878
2980
  this.options.separateDialCode,
@@ -2889,35 +2991,18 @@ class f1 {
2889
2991
  //**************************
2890
2992
  //* This is called when the geoip call returns.
2891
2993
  handleAutoCountry() {
2892
- this.options.initialCountry === "auto" && y.autoCountry && (this.defaultCountry = y.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2994
+ this.options.initialCountry === "auto" && y.autoCountry && (this.defaultCountry = y.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2893
2995
  }
2894
2996
  //* This is called when the utils request completes.
2895
2997
  handleUtils() {
2896
- y.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
2998
+ y.utils && (this.ui.telInput.value && this._updateValFromNumber(this.ui.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
2897
2999
  }
2898
3000
  //********************
2899
3001
  //* PUBLIC METHODS
2900
3002
  //********************
2901
3003
  //* Remove plugin.
2902
3004
  destroy() {
2903
- var u, h;
2904
- this.telInput.iti = void 0;
2905
- const { allowDropdown: e, separateDialCode: $ } = this.options;
2906
- if (e) {
2907
- this._closeDropdown(), this.selectedCountry.removeEventListener(
2908
- "click",
2909
- this._handleClickSelectedCountry
2910
- ), this.countryContainer.removeEventListener(
2911
- "keydown",
2912
- this._handleCountryContainerKeydown
2913
- );
2914
- const c = this.telInput.closest("label");
2915
- c && c.removeEventListener("click", this._handleLabelClick);
2916
- }
2917
- const { form: i } = this.telInput;
2918
- this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this._handlePasteEvent && this.telInput.removeEventListener("paste", this._handlePasteEvent), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this.telInput.removeAttribute("data-intl-tel-input-id"), $ && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2919
- const r = this.telInput.parentNode;
2920
- (u = r == null ? void 0 : r.parentNode) == null || u.insertBefore(this.telInput, r), (h = r == null ? void 0 : r.parentNode) == null || h.removeChild(r), delete y.instances[this.id];
3005
+ this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), y.instances instanceof Map ? y.instances.delete(this.id) : delete y.instances[this.id]);
2921
3006
  }
2922
3007
  //* Get the extension from the current number.
2923
3008
  getExtension() {
@@ -2961,8 +3046,8 @@ class f1 {
2961
3046
  isValidNumber() {
2962
3047
  const { dialCode: e, iso2: $ } = this.selectedCountryData;
2963
3048
  if (e === "44" && y.utils) {
2964
- const i = this._getFullNumber(), r = y.utils.getCoreNumber(i, $);
2965
- if (r[0] === "7" && r.length !== 10)
3049
+ const i = this._getFullNumber(), s = y.utils.getCoreNumber(i, $);
3050
+ if (s[0] === "7" && s.length !== 10)
2966
3051
  return !1;
2967
3052
  }
2968
3053
  return this._validateNumber(!1);
@@ -2972,7 +3057,11 @@ class f1 {
2972
3057
  return this._validateNumber(!0);
2973
3058
  }
2974
3059
  _utilsIsPossibleNumber(e) {
2975
- return y.utils ? y.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
3060
+ return y.utils ? y.utils.isPossibleNumber(
3061
+ e,
3062
+ this.selectedCountryData.iso2,
3063
+ this.options.validationNumberTypes
3064
+ ) : null;
2976
3065
  }
2977
3066
  //* Shared internal validation logic to handle alpha character extension rules.
2978
3067
  _validateNumber(e) {
@@ -2980,23 +3069,27 @@ class f1 {
2980
3069
  return null;
2981
3070
  if (!this.selectedCountryData.iso2)
2982
3071
  return !1;
2983
- const $ = (h) => e ? this._utilsIsValidNumber(h) : this._utilsIsPossibleNumber(h), i = this._getFullNumber(), r = i.search(new RegExp("\\p{L}", "u"));
2984
- if (r > -1 && !this.options.allowPhonewords) {
2985
- const h = i.substring(0, r), c = $(h), C = $(i);
2986
- return c && C;
3072
+ const $ = (u) => e ? this._utilsIsValidNumber(u) : this._utilsIsPossibleNumber(u), i = this._getFullNumber(), s = i.search(new RegExp("\\p{L}", "u"));
3073
+ if (s > -1 && !this.options.allowPhonewords) {
3074
+ const u = i.substring(0, s), f = $(u), c = $(i);
3075
+ return f && c;
2987
3076
  }
2988
3077
  return $(i);
2989
3078
  }
2990
3079
  _utilsIsValidNumber(e) {
2991
- return y.utils ? y.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
3080
+ return y.utils ? y.utils.isValidNumber(
3081
+ e,
3082
+ this.selectedCountryData.iso2,
3083
+ this.options.validationNumberTypes
3084
+ ) : null;
2992
3085
  }
2993
3086
  //* Update the selected country, and update the input val accordingly.
2994
3087
  setCountry(e) {
2995
3088
  const $ = e == null ? void 0 : e.toLowerCase();
2996
- if (!w1($))
3089
+ if (!S1($))
2997
3090
  throw new Error(`Invalid country code: '${$}'`);
2998
3091
  const i = this.selectedCountryData.iso2;
2999
- (e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this._triggerCountryChange());
3092
+ (e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this._triggerCountryChange());
3000
3093
  }
3001
3094
  //* Set the input value and update the country.
3002
3095
  setNumber(e) {
@@ -3008,100 +3101,111 @@ class f1 {
3008
3101
  this.options.placeholderNumberType = e, this._updatePlaceholder();
3009
3102
  }
3010
3103
  setDisabled(e) {
3011
- this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
3104
+ this.ui.telInput.disabled = e, e ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
3012
3105
  }
3013
3106
  }
3014
- const n2 = (f) => {
3107
+ const r2 = (p) => {
3015
3108
  if (!y.utils && !y.startedLoadingUtilsScript) {
3016
3109
  let e;
3017
- if (typeof f == "function")
3110
+ if (typeof p == "function")
3018
3111
  try {
3019
- e = Promise.resolve(f());
3112
+ e = Promise.resolve(p());
3020
3113
  } catch ($) {
3021
3114
  return Promise.reject($);
3022
3115
  }
3023
3116
  else
3024
- return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof f}`));
3117
+ return Promise.reject(
3118
+ new TypeError(
3119
+ `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof p}`
3120
+ )
3121
+ );
3025
3122
  return y.startedLoadingUtilsScript = !0, e.then(($) => {
3026
3123
  const i = $ == null ? void 0 : $.default;
3027
3124
  if (!i || typeof i != "object")
3028
- throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
3125
+ throw new TypeError(
3126
+ "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
3127
+ );
3029
3128
  return y.utils = i, $1("handleUtils"), !0;
3030
3129
  }).catch(($) => {
3031
3130
  throw $1("rejectUtilsScriptPromise", $), $;
3032
3131
  });
3033
3132
  }
3034
3133
  return null;
3134
+ }, $1 = (p, ...e) => {
3135
+ Object.values(y.instances).forEach(($) => {
3136
+ const i = $[p];
3137
+ typeof i == "function" && i.apply($, e);
3138
+ });
3035
3139
  }, y = Object.assign(
3036
- (f, e) => {
3037
- const $ = new f1(f, e);
3038
- return $._init(), f.setAttribute("data-intl-tel-input-id", $.id.toString()), y.instances[$.id] = $, f.iti = $, $;
3140
+ (p, e) => {
3141
+ const $ = new v1(p, e);
3142
+ return y.instances[$.id] = $, p.iti = $, $;
3039
3143
  },
3040
3144
  {
3041
- defaults: u0,
3145
+ defaults: h0,
3042
3146
  //* Using a static var like this allows us to mock it in the tests.
3043
3147
  documentReady: () => document.readyState === "complete",
3044
3148
  //* Get the country data object.
3045
3149
  getCountryData: () => Y,
3046
3150
  //* A getter for the plugin instance.
3047
- getInstance: (f) => {
3048
- const e = f.getAttribute("data-intl-tel-input-id");
3151
+ getInstance: (p) => {
3152
+ const e = p.dataset.intlTelInputId;
3049
3153
  return e ? y.instances[e] : null;
3050
3154
  },
3051
3155
  //* A map from instance ID to instance object.
3052
3156
  instances: {},
3053
- attachUtils: n2,
3157
+ attachUtils: r2,
3054
3158
  startedLoadingUtilsScript: !1,
3055
3159
  startedLoadingAutoCountry: !1,
3056
- version: "25.10.12"
3160
+ version: "25.11.0"
3057
3161
  }
3058
3162
  );
3059
3163
  (function() {
3060
- var f = this || self;
3164
+ var p = this || self;
3061
3165
  function e(d, t) {
3062
3166
  d = d.split(".");
3063
- var n = f;
3167
+ var n = p;
3064
3168
  d[0] in n || typeof n.execScript > "u" || n.execScript("var " + d[0]);
3065
- for (var s; d.length && (s = d.shift()); ) d.length || t === void 0 ? n[s] && n[s] !== Object.prototype[s] ? n = n[s] : n = n[s] = {} : n[s] = t;
3169
+ for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? n[r] && n[r] !== Object.prototype[r] ? n = n[r] : n = n[r] = {} : n[r] = t;
3066
3170
  }
3067
3171
  function $(d, t) {
3068
3172
  function n() {
3069
3173
  }
3070
- n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(s, o, l) {
3071
- for (var a = Array(arguments.length - 2), p = 2; p < arguments.length; p++) a[p - 2] = arguments[p];
3072
- return t.prototype[o].apply(s, a);
3174
+ n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(r, o, l) {
3175
+ for (var a = Array(arguments.length - 2), C = 2; C < arguments.length; C++) a[C - 2] = arguments[C];
3176
+ return t.prototype[o].apply(r, a);
3073
3177
  };
3074
3178
  }
3075
3179
  function i(d) {
3076
3180
  const t = [];
3077
3181
  let n = 0;
3078
- for (const s in d) t[n++] = d[s];
3182
+ for (const r in d) t[n++] = d[r];
3079
3183
  return t;
3080
3184
  }
3081
- var r = class {
3185
+ var s = class {
3082
3186
  constructor(d) {
3083
- if (u !== u) throw Error("SafeUrl is not meant to be built directly");
3187
+ if (h !== h) throw Error("SafeUrl is not meant to be built directly");
3084
3188
  this.g = d;
3085
3189
  }
3086
3190
  toString() {
3087
3191
  return this.g.toString();
3088
3192
  }
3089
- }, u = {};
3090
- new r("about:invalid#zClosurez"), new r("about:blank");
3091
- const h = {};
3092
- class c {
3193
+ }, h = {};
3194
+ new s("about:invalid#zClosurez"), new s("about:blank");
3195
+ const u = {};
3196
+ class f {
3093
3197
  constructor() {
3094
- if (h !== h) throw Error("SafeStyle is not meant to be built directly");
3198
+ if (u !== u) throw Error("SafeStyle is not meant to be built directly");
3095
3199
  }
3096
3200
  toString() {
3097
3201
  return "";
3098
3202
  }
3099
3203
  }
3100
- new c();
3101
- const C = {};
3204
+ new f();
3205
+ const c = {};
3102
3206
  class g {
3103
3207
  constructor() {
3104
- if (C !== C) throw Error("SafeStyleSheet is not meant to be built directly");
3208
+ if (c !== c) throw Error("SafeStyleSheet is not meant to be built directly");
3105
3209
  }
3106
3210
  toString() {
3107
3211
  return "";
@@ -3109,9 +3213,9 @@ const n2 = (f) => {
3109
3213
  }
3110
3214
  new g();
3111
3215
  const I = {};
3112
- class w {
3216
+ class S {
3113
3217
  constructor() {
3114
- var t = f.trustedTypes && f.trustedTypes.emptyHTML || "";
3218
+ var t = p.trustedTypes && p.trustedTypes.emptyHTML || "";
3115
3219
  if (I !== I) throw Error("SafeHtml is not meant to be built directly");
3116
3220
  this.g = t;
3117
3221
  }
@@ -3119,62 +3223,62 @@ const n2 = (f) => {
3119
3223
  return this.g.toString();
3120
3224
  }
3121
3225
  }
3122
- new w();
3123
- function k(d, t) {
3226
+ new S();
3227
+ function L(d, t) {
3124
3228
  switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
3125
- case N:
3126
- case P:
3127
3229
  case G:
3128
- case j:
3129
- case c0:
3130
3230
  case E:
3131
- case v:
3231
+ case P:
3232
+ case U:
3233
+ case f1:
3234
+ case A:
3235
+ case b:
3132
3236
  this.o = !0;
3133
3237
  }
3134
3238
  this.j = t.defaultValue;
3135
3239
  }
3136
- var v = 1, E = 2, N = 3, P = 4, G = 6, j = 16, c0 = 18;
3137
- function f0(d, t) {
3240
+ var b = 1, A = 2, G = 3, E = 4, P = 6, U = 16, f1 = 18;
3241
+ function p0(d, t) {
3138
3242
  for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
3139
3243
  var n = t[d];
3140
3244
  this.g[n.g] = n;
3141
3245
  }
3142
3246
  }
3143
- function p0(d) {
3247
+ function g0(d) {
3144
3248
  return d = i(d.g), d.sort(function(t, n) {
3145
3249
  return t.g - n.g;
3146
3250
  }), d;
3147
3251
  }
3148
- function x() {
3252
+ function B() {
3149
3253
  this.h = {}, this.j = this.m().g, this.g = this.l = null;
3150
3254
  }
3151
- x.prototype.has = function(d) {
3152
- return B(this, d.g);
3153
- }, x.prototype.get = function(d, t) {
3255
+ B.prototype.has = function(d) {
3256
+ return R(this, d.g);
3257
+ }, B.prototype.get = function(d, t) {
3154
3258
  return m(this, d.g, t);
3155
- }, x.prototype.set = function(d, t) {
3156
- T(this, d.g, t);
3157
- }, x.prototype.add = function(d, t) {
3158
- b1(this, d.g, t);
3259
+ }, B.prototype.set = function(d, t) {
3260
+ M(this, d.g, t);
3261
+ }, B.prototype.add = function(d, t) {
3262
+ L1(this, d.g, t);
3159
3263
  };
3160
- function S1(d, t) {
3161
- for (var n = p0(d.m()), s = 0; s < n.length; s++) {
3162
- var o = n[s], l = o.g;
3163
- if (B(t, l)) {
3264
+ function N1(d, t) {
3265
+ for (var n = g0(d.m()), r = 0; r < n.length; r++) {
3266
+ var o = n[r], l = o.g;
3267
+ if (R(t, l)) {
3164
3268
  d.g && delete d.g[o.g];
3165
3269
  var a = o.h == 11 || o.h == 10;
3166
3270
  if (o.l) {
3167
- o = D(t, l);
3168
- for (var p = 0; p < o.length; p++) b1(d, l, a ? o[p].clone() : o[p]);
3169
- } else o = n1(t, l), a ? (a = n1(d, l)) ? S1(a, o) : T(d, l, o.clone()) : T(d, l, o);
3271
+ o = x(t, l);
3272
+ for (var C = 0; C < o.length; C++) L1(d, l, a ? o[C].clone() : o[C]);
3273
+ } else o = n1(t, l), a ? (a = n1(d, l)) ? N1(a, o) : M(d, l, o.clone()) : M(d, l, o);
3170
3274
  }
3171
3275
  }
3172
3276
  }
3173
- x.prototype.clone = function() {
3277
+ B.prototype.clone = function() {
3174
3278
  var d = new this.constructor();
3175
- return d != this && (d.h = {}, d.g && (d.g = {}), S1(d, this)), d;
3279
+ return d != this && (d.h = {}, d.g && (d.g = {}), N1(d, this)), d;
3176
3280
  };
3177
- function B(d, t) {
3281
+ function R(d, t) {
3178
3282
  return d.h[t] != null;
3179
3283
  }
3180
3284
  function n1(d, t) {
@@ -3182,11 +3286,11 @@ const n2 = (f) => {
3182
3286
  if (n == null) return null;
3183
3287
  if (d.l) {
3184
3288
  if (!(t in d.g)) {
3185
- var s = d.l, o = d.j[t];
3289
+ var r = d.l, o = d.j[t];
3186
3290
  if (n != null) if (o.l) {
3187
- for (var l = [], a = 0; a < n.length; a++) l[a] = s.h(o, n[a]);
3291
+ for (var l = [], a = 0; a < n.length; a++) l[a] = r.h(o, n[a]);
3188
3292
  n = l;
3189
- } else n = s.h(o, n);
3293
+ } else n = r.h(o, n);
3190
3294
  return d.g[t] = n;
3191
3295
  }
3192
3296
  return d.g[t];
@@ -3194,11 +3298,11 @@ const n2 = (f) => {
3194
3298
  return n;
3195
3299
  }
3196
3300
  function m(d, t, n) {
3197
- var s = n1(d, t);
3198
- return d.j[t].l ? s[n || 0] : s;
3301
+ var r = n1(d, t);
3302
+ return d.j[t].l ? r[n || 0] : r;
3199
3303
  }
3200
- function S(d, t) {
3201
- if (B(d, t)) d = m(d, t);
3304
+ function w(d, t) {
3305
+ if (R(d, t)) d = m(d, t);
3202
3306
  else d: {
3203
3307
  if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
3204
3308
  else if (t === Number) d.j = 0;
@@ -3211,37 +3315,37 @@ const n2 = (f) => {
3211
3315
  }
3212
3316
  return d;
3213
3317
  }
3214
- function D(d, t) {
3318
+ function x(d, t) {
3215
3319
  return n1(d, t) || [];
3216
3320
  }
3217
3321
  function K(d, t) {
3218
- return d.j[t].l ? B(d, t) ? d.h[t].length : 0 : B(d, t) ? 1 : 0;
3322
+ return d.j[t].l ? R(d, t) ? d.h[t].length : 0 : R(d, t) ? 1 : 0;
3219
3323
  }
3220
- function T(d, t, n) {
3324
+ function M(d, t, n) {
3221
3325
  d.h[t] = n, d.g && (d.g[t] = n);
3222
3326
  }
3223
- function b1(d, t, n) {
3327
+ function L1(d, t, n) {
3224
3328
  d.h[t] || (d.h[t] = []), d.h[t].push(n), d.g && delete d.g[t];
3225
3329
  }
3226
3330
  function i1(d, t) {
3227
- var n = [], s;
3228
- for (s in t) s != 0 && n.push(new k(s, t[s]));
3229
- return new f0(d, n);
3331
+ var n = [], r;
3332
+ for (r in t) r != 0 && n.push(new L(r, t[r]));
3333
+ return new p0(d, n);
3230
3334
  }
3231
3335
  function r1() {
3232
3336
  }
3233
3337
  r1.prototype.g = function(d) {
3234
3338
  throw new d.h(), Error("Unimplemented");
3235
3339
  }, r1.prototype.h = function(d, t) {
3236
- if (d.h == 11 || d.h == 10) return t instanceof x ? t : this.g(d.s.prototype.m(), t);
3237
- if (d.h == 14) return typeof t == "string" && L1.test(t) && (d = Number(t), 0 < d) ? d : t;
3340
+ if (d.h == 11 || d.h == 10) return t instanceof B ? t : this.g(d.s.prototype.m(), t);
3341
+ if (d.h == 14) return typeof t == "string" && A1.test(t) && (d = Number(t), 0 < d) ? d : t;
3238
3342
  if (!d.o) return t;
3239
3343
  if (d = d.s, d === String) {
3240
3344
  if (typeof t == "number") return String(t);
3241
- } else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || L1.test(t))) return Number(t);
3345
+ } else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || A1.test(t))) return Number(t);
3242
3346
  return t;
3243
3347
  };
3244
- var L1 = /^-?[0-9]+$/;
3348
+ var A1 = /^-?[0-9]+$/;
3245
3349
  function p1() {
3246
3350
  }
3247
3351
  $(p1, r1), p1.prototype.g = function(d, t) {
@@ -3254,63 +3358,63 @@ const n2 = (f) => {
3254
3358
  }, q.prototype.g = function(d, t) {
3255
3359
  return q.ma.g.call(this, d, t);
3256
3360
  };
3257
- function A(d, t) {
3361
+ function T(d, t) {
3258
3362
  d != null && this.g.apply(this, arguments);
3259
3363
  }
3260
- A.prototype.h = "", A.prototype.set = function(d) {
3364
+ T.prototype.h = "", T.prototype.set = function(d) {
3261
3365
  this.h = "" + d;
3262
- }, A.prototype.g = function(d, t, n) {
3263
- if (this.h += String(d), t != null) for (let s = 1; s < arguments.length; s++) this.h += arguments[s];
3366
+ }, T.prototype.g = function(d, t, n) {
3367
+ if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
3264
3368
  return this;
3265
3369
  };
3266
- function R(d) {
3370
+ function k(d) {
3267
3371
  d.h = "";
3268
3372
  }
3269
- A.prototype.toString = function() {
3373
+ T.prototype.toString = function() {
3270
3374
  return this.h;
3271
3375
  };
3272
- function W() {
3273
- x.call(this);
3376
+ function j() {
3377
+ B.call(this);
3274
3378
  }
3275
- $(W, x);
3276
- var N1 = null;
3277
- function b() {
3278
- x.call(this);
3379
+ $(j, B);
3380
+ var T1 = null;
3381
+ function N() {
3382
+ B.call(this);
3279
3383
  }
3280
- $(b, x);
3281
- var A1 = null;
3384
+ $(N, B);
3385
+ var E1 = null;
3282
3386
  function z() {
3283
- x.call(this);
3387
+ B.call(this);
3284
3388
  }
3285
- $(z, x);
3286
- var E1 = null;
3287
- W.prototype.m = function() {
3288
- var d = N1;
3289
- return d || (N1 = d = i1(W, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
3290
- }, W.m = W.prototype.m, b.prototype.m = function() {
3291
- var d = A1;
3292
- return d || (A1 = d = i1(b, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
3293
- }, b.m = b.prototype.m, z.prototype.m = function() {
3389
+ $(z, B);
3390
+ var M1 = null;
3391
+ j.prototype.m = function() {
3392
+ var d = T1;
3393
+ return d || (T1 = d = i1(j, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
3394
+ }, j.m = j.prototype.m, N.prototype.m = function() {
3294
3395
  var d = E1;
3295
- return d || (E1 = d = i1(z, {
3396
+ return d || (E1 = d = i1(N, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
3397
+ }, N.m = N.prototype.m, z.prototype.m = function() {
3398
+ var d = M1;
3399
+ return d || (M1 = d = i1(z, {
3296
3400
  0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
3297
- 1: { name: "general_desc", i: 11, type: b },
3298
- 2: { name: "fixed_line", i: 11, type: b },
3299
- 3: { name: "mobile", i: 11, type: b },
3300
- 4: { name: "toll_free", i: 11, type: b },
3301
- 5: { name: "premium_rate", i: 11, type: b },
3302
- 6: { name: "shared_cost", i: 11, type: b },
3303
- 7: { name: "personal_number", i: 11, type: b },
3304
- 8: { name: "voip", i: 11, type: b },
3305
- 21: { name: "pager", i: 11, type: b },
3306
- 25: { name: "uan", i: 11, type: b },
3307
- 27: { name: "emergency", i: 11, type: b },
3308
- 28: { name: "voicemail", i: 11, type: b },
3309
- 29: { name: "short_code", i: 11, type: b },
3310
- 30: { name: "standard_rate", i: 11, type: b },
3311
- 31: { name: "carrier_specific", i: 11, type: b },
3312
- 33: { name: "sms_services", i: 11, type: b },
3313
- 24: { name: "no_international_dialling", i: 11, type: b },
3401
+ 1: { name: "general_desc", i: 11, type: N },
3402
+ 2: { name: "fixed_line", i: 11, type: N },
3403
+ 3: { name: "mobile", i: 11, type: N },
3404
+ 4: { name: "toll_free", i: 11, type: N },
3405
+ 5: { name: "premium_rate", i: 11, type: N },
3406
+ 6: { name: "shared_cost", i: 11, type: N },
3407
+ 7: { name: "personal_number", i: 11, type: N },
3408
+ 8: { name: "voip", i: 11, type: N },
3409
+ 21: { name: "pager", i: 11, type: N },
3410
+ 25: { name: "uan", i: 11, type: N },
3411
+ 27: { name: "emergency", i: 11, type: N },
3412
+ 28: { name: "voicemail", i: 11, type: N },
3413
+ 29: { name: "short_code", i: 11, type: N },
3414
+ 30: { name: "standard_rate", i: 11, type: N },
3415
+ 31: { name: "carrier_specific", i: 11, type: N },
3416
+ 33: { name: "sms_services", i: 11, type: N },
3417
+ 24: { name: "no_international_dialling", i: 11, type: N },
3314
3418
  9: { name: "id", required: !0, i: 9, type: String },
3315
3419
  10: { name: "country_code", i: 5, type: Number },
3316
3420
  11: { name: "international_prefix", i: 9, type: String },
@@ -3324,25 +3428,25 @@ const n2 = (f) => {
3324
3428
  },
3325
3429
  16: { name: "national_prefix_transform_rule", i: 9, type: String },
3326
3430
  18: { name: "same_mobile_and_fixed_line_pattern", i: 8, defaultValue: !1, type: Boolean },
3327
- 19: { name: "number_format", aa: !0, i: 11, type: W },
3328
- 20: { name: "intl_number_format", aa: !0, i: 11, type: W },
3431
+ 19: { name: "number_format", aa: !0, i: 11, type: j },
3432
+ 20: { name: "intl_number_format", aa: !0, i: 11, type: j },
3329
3433
  22: { name: "main_country_for_code", i: 8, defaultValue: !1, type: Boolean },
3330
3434
  23: { name: "leading_digits", i: 9, type: String }
3331
3435
  })), d;
3332
3436
  }, z.m = z.prototype.m;
3333
- function V() {
3334
- x.call(this);
3335
- }
3336
- $(V, x);
3337
- var T1 = null, g0 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
3338
- V.prototype.m = function() {
3339
- var d = T1;
3340
- return d || (T1 = d = i1(V, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: g0 }, 7: {
3437
+ function H() {
3438
+ B.call(this);
3439
+ }
3440
+ $(H, B);
3441
+ var D1 = null, C0 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
3442
+ H.prototype.m = function() {
3443
+ var d = D1;
3444
+ return d || (D1 = d = i1(H, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: C0 }, 7: {
3341
3445
  name: "preferred_domestic_carrier_code",
3342
3446
  i: 9,
3343
3447
  type: String
3344
3448
  } })), d;
3345
- }, V.ctor = V, V.ctor.m = V.prototype.m;
3449
+ }, H.ctor = H, H.ctor.m = H.prototype.m;
3346
3450
  var X = {
3347
3451
  1: "US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),
3348
3452
  7: ["RU", "KZ"],
@@ -3559,7 +3663,7 @@ const n2 = (f) => {
3559
3663
  995: ["GE"],
3560
3664
  996: ["KG"],
3561
3665
  998: ["UZ"]
3562
- }, M1 = {
3666
+ }, x1 = {
3563
3667
  AC: [, [
3564
3668
  ,
3565
3669
  ,
@@ -6108,7 +6212,7 @@ const n2 = (f) => {
6108
6212
  ,
6109
6213
  ,
6110
6214
  [7, 8, 9]
6111
- ], [, , "(?:1(?:0[0-8]|1[0-7]|2[014]|30)|7\\d\\d)\\d{6}", , , , "712123456", , , [9]], [, , "800[02-8]\\d{5,6}", , , , "800223456", , , [9, 10]], [, , "900[02-9]\\d{5}", , , , "900223456", , , [9]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "KE", 254, "000", "0", , , "0", , , , [[, "(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], [, "(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6215
+ ], [, , "(?:1(?:0[0-8]|1\\d|2[014]|[34]0)|7\\d\\d)\\d{6}", , , , "712123456", , , [9]], [, , "800[02-8]\\d{5,6}", , , , "800223456", , , [9, 10]], [, , "900[02-9]\\d{5}", , , , "900223456", , , [9]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "KE", 254, "000", "0", , , "0", , , , [[, "(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], [, "(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6112
6216
  KG: [, [
6113
6217
  ,
6114
6218
  ,
@@ -8164,7 +8268,7 @@ const n2 = (f) => {
8164
8268
  ,
8165
8269
  ,
8166
8270
  [5, 6, 7]
8167
- ], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[0189])\\d{6}", , , , "712345678"], [, , "800[1-3]\\d{5}", , , , "800123456"], [, , "90[1-3]\\d{6}", , , , "901123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "UG", 256, "00[057]", "0", , , "0", , , , [[, "(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], [, "(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
8271
+ ], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[0-289])\\d{6}", , , , "712345678"], [, , "800[1-3]\\d{5}", , , , "800123456"], [, , "90[1-3]\\d{6}", , , , "901123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "UG", 256, "00[057]", "0", , , "0", , , , [[, "(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], [, "(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
8168
8272
  US: [, [
8169
8273
  ,
8170
8274
  ,
@@ -8180,7 +8284,7 @@ const n2 = (f) => {
8180
8284
  ], [
8181
8285
  ,
8182
8286
  ,
8183
- "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8287
+ "3052(?:0[0-8]|[1-9]\\d)\\d{4}|(?:2742|305[3-9])\\d{6}|(?:472|983)[2-47-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8184
8288
  ,
8185
8289
  ,
8186
8290
  ,
@@ -8192,7 +8296,7 @@ const n2 = (f) => {
8192
8296
  ], [
8193
8297
  ,
8194
8298
  ,
8195
- "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8299
+ "3052(?:0[0-8]|[1-9]\\d)\\d{4}|(?:2742|305[3-9])\\d{6}|(?:472|983)[2-47-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8196
8300
  ,
8197
8301
  ,
8198
8302
  ,
@@ -8693,11 +8797,11 @@ const n2 = (f) => {
8693
8797
  ], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 888, , , , , , , , 1, [[, "(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "\\d{11}", , , , "12345678901"], , , [, , , , , , , , , [-1]]],
8694
8798
  979: [, [, , "[1359]\\d{8}", , , , , , , [9], [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "[1359]\\d{8}", , , , "123456789", , , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 979, , , , , , , , 1, [[, "(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]]
8695
8799
  };
8696
- function M() {
8800
+ function D() {
8697
8801
  this.g = {};
8698
8802
  }
8699
- M.h = void 0, M.g = function() {
8700
- return M.h ? M.h : M.h = new M();
8803
+ D.h = void 0, D.g = function() {
8804
+ return D.h ? D.h : D.h = new D();
8701
8805
  };
8702
8806
  var g1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" }, m0 = {
8703
8807
  0: "0",
@@ -8713,7 +8817,7 @@ const n2 = (f) => {
8713
8817
  "+": "+",
8714
8818
  "*": "*",
8715
8819
  "#": "#"
8716
- }, C0 = {
8820
+ }, y0 = {
8717
8821
  0: "0",
8718
8822
  1: "1",
8719
8823
  2: "2",
@@ -8780,86 +8884,86 @@ const n2 = (f) => {
8780
8884
  X: "9",
8781
8885
  Y: "9",
8782
8886
  Z: "9"
8783
- }, y0 = RegExp("[++]+"), Q = RegExp("^[++]+"), D1 = RegExp("([0-90-9٠-٩۰-۹])"), _0 = RegExp("[++0-90-9٠-٩۰-۹]"), I0 = /[\\\/] *x/, v0 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), w0 = /(?:.*?[A-Za-z]){3}.*/, S0 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), b0 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
8887
+ }, I0 = RegExp("[++]+"), Q = RegExp("^[++]+"), P1 = RegExp("([0-90-9٠-٩۰-۹])"), _0 = RegExp("[++0-90-9٠-٩۰-۹]"), b0 = /[\\\/] *x/, w0 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), S0 = /(?:.*?[A-Za-z]){3}.*/, v0 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), N0 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
8784
8888
  function J(d) {
8785
8889
  return "([0-90-9٠-٩۰-۹]{1," + d + "})";
8786
8890
  }
8787
- function P1() {
8891
+ function B1() {
8788
8892
  return ";ext=" + J("20") + "|[  \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[  \\t,-]*" + (J("20") + "#?|[  \\t,]*(?:[xx##~~]|int|int)[:\\..]?[  \\t,-]*") + (J("9") + "#?|[- ]+") + (J("6") + "#|[  \\t]*(?:,{2}|;)[:\\..]?[  \\t,-]*") + (J("15") + "#?|[  \\t]*(?:,)+[:\\..]?[  \\t,-]*") + (J("9") + "#?");
8789
8893
  }
8790
- var x1 = new RegExp("(?:" + P1() + ")$", "i"), L0 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + P1() + ")?$", "i"), N0 = /(\$\d)/, A0 = /^\(?\$1\)?$/;
8791
- function B1(d) {
8792
- return 2 > d.length ? !1 : U(L0, d);
8793
- }
8794
- function R1(d) {
8795
- return U(w0, d) ? s1(d, C0) : s1(d, g1);
8796
- }
8894
+ var R1 = new RegExp("(?:" + B1() + ")$", "i"), L0 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + B1() + ")?$", "i"), A0 = /(\$\d)/, T0 = /^\(?\$1\)?$/;
8797
8895
  function k1(d) {
8798
- var t = R1(d.toString());
8799
- R(d), d.g(t);
8896
+ return 2 > d.length ? !1 : F(L0, d);
8897
+ }
8898
+ function G1(d) {
8899
+ return F(S0, d) ? s1(d, y0) : s1(d, g1);
8800
8900
  }
8801
8901
  function O1(d) {
8802
- return d != null && (K(d, 9) != 1 || D(d, 9)[0] != -1);
8902
+ var t = G1(d.toString());
8903
+ k(d), d.g(t);
8904
+ }
8905
+ function U1(d) {
8906
+ return d != null && (K(d, 9) != 1 || x(d, 9)[0] != -1);
8803
8907
  }
8804
8908
  function s1(d, t) {
8805
- for (var n = new A(), s, o = d.length, l = 0; l < o; ++l) s = d.charAt(l), s = t[s.toUpperCase()], s != null && n.g(s);
8909
+ for (var n = new T(), r, o = d.length, l = 0; l < o; ++l) r = d.charAt(l), r = t[r.toUpperCase()], r != null && n.g(r);
8806
8910
  return n.toString();
8807
8911
  }
8808
- function G1(d) {
8809
- return d.length == 0 || A0.test(d);
8912
+ function F1(d) {
8913
+ return d.length == 0 || T0.test(d);
8810
8914
  }
8811
8915
  function o1(d) {
8812
- return d != null && isNaN(d) && d.toUpperCase() in M1;
8916
+ return d != null && isNaN(d) && d.toUpperCase() in x1;
8813
8917
  }
8814
- M.prototype.format = function(d, t) {
8815
- if (m(d, 2) == 0 && B(d, 5)) {
8816
- var n = S(d, 5);
8918
+ D.prototype.format = function(d, t) {
8919
+ if (m(d, 2) == 0 && R(d, 5)) {
8920
+ var n = w(d, 5);
8817
8921
  if (0 < n.length) return n;
8818
8922
  }
8819
- n = S(d, 1);
8820
- var s = t1(d);
8821
- if (t == 0) return U1(n, 0, s, "");
8822
- if (!(n in X)) return s;
8923
+ n = w(d, 1);
8924
+ var r = t1(d);
8925
+ if (t == 0) return V1(n, 0, r, "");
8926
+ if (!(n in X)) return r;
8823
8927
  var o = d1(this, n, e1(n));
8824
- d = B(d, 3) && m(d, 3).length != 0 ? t == 3 ? ";ext=" + m(d, 3) : B(o, 13) ? m(o, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
8928
+ d = R(d, 3) && m(d, 3).length != 0 ? t == 3 ? ";ext=" + m(d, 3) : R(o, 13) ? m(o, 13) + w(d, 3) : " ext. " + w(d, 3) : "";
8825
8929
  d: {
8826
- o = D(o, 20).length == 0 || t == 2 ? D(o, 19) : D(o, 20);
8827
- for (var l, a = o.length, p = 0; p < a; ++p) {
8828
- l = o[p];
8930
+ o = x(o, 20).length == 0 || t == 2 ? x(o, 19) : x(o, 20);
8931
+ for (var l, a = o.length, C = 0; C < a; ++C) {
8932
+ l = o[C];
8829
8933
  var _ = K(l, 3);
8830
- if ((_ == 0 || s.search(m(l, 3, _ - 1)) == 0) && (_ = new RegExp(m(l, 1)), U(_, s))) {
8934
+ if ((_ == 0 || r.search(m(l, 3, _ - 1)) == 0) && (_ = new RegExp(m(l, 1)), F(_, r))) {
8831
8935
  o = l;
8832
8936
  break d;
8833
8937
  }
8834
8938
  }
8835
8939
  o = null;
8836
8940
  }
8837
- return o != null && (a = o, o = S(a, 2), l = new RegExp(m(a, 1)), S(
8941
+ return o != null && (a = o, o = w(a, 2), l = new RegExp(m(a, 1)), w(
8838
8942
  a,
8839
8943
  5
8840
- ), a = S(a, 4), s = t == 2 && a != null && 0 < a.length ? s.replace(l, o.replace(N0, a)) : s.replace(l, o), t == 3 && (s = s.replace(RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+"), ""), s = s.replace(RegExp("[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), U1(n, t, s, d);
8944
+ ), a = w(a, 4), r = t == 2 && a != null && 0 < a.length ? r.replace(l, o.replace(A0, a)) : r.replace(l, o), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), V1(n, t, r, d);
8841
8945
  };
8842
8946
  function d1(d, t, n) {
8843
- return n == "001" ? H(d, "" + t) : H(d, n);
8947
+ return n == "001" ? W(d, "" + t) : W(d, n);
8844
8948
  }
8845
8949
  function t1(d) {
8846
- if (!B(d, 2)) return "";
8950
+ if (!R(d, 2)) return "";
8847
8951
  var t = "" + m(d, 2);
8848
- return B(d, 4) && m(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
8952
+ return R(d, 4) && m(d, 4) && 0 < w(d, 8) ? Array(w(d, 8) + 1).join("0") + t : t;
8849
8953
  }
8850
- function U1(d, t, n, s) {
8954
+ function V1(d, t, n, r) {
8851
8955
  switch (t) {
8852
8956
  case 0:
8853
- return "+" + d + n + s;
8957
+ return "+" + d + n + r;
8854
8958
  case 1:
8855
- return "+" + d + " " + n + s;
8959
+ return "+" + d + " " + n + r;
8856
8960
  case 3:
8857
- return "tel:+" + d + "-" + n + s;
8961
+ return "tel:+" + d + "-" + n + r;
8858
8962
  default:
8859
- return n + s;
8963
+ return n + r;
8860
8964
  }
8861
8965
  }
8862
- function l1(d, t) {
8966
+ function u1(d, t) {
8863
8967
  switch (t) {
8864
8968
  case 4:
8865
8969
  return m(d, 5);
@@ -8886,48 +8990,48 @@ const n2 = (f) => {
8886
8990
  return m(d, 1);
8887
8991
  }
8888
8992
  }
8889
- function F1(d, t) {
8890
- var n = K1(d, t);
8891
- return d = d1(d, S(t, 1), n), d == null ? -1 : (t = t1(t), m1(t, d));
8993
+ function K1(d, t) {
8994
+ var n = H1(d, t);
8995
+ return d = d1(d, w(t, 1), n), d == null ? -1 : (t = t1(t), C1(t, d));
8892
8996
  }
8893
- function m1(d, t) {
8997
+ function C1(d, t) {
8894
8998
  return O(d, m(t, 1)) ? O(d, m(t, 5)) ? 4 : O(d, m(t, 4)) ? 3 : O(d, m(t, 6)) ? 5 : O(d, m(t, 8)) ? 6 : O(d, m(t, 7)) ? 7 : O(d, m(t, 21)) ? 8 : O(d, m(t, 25)) ? 9 : O(d, m(t, 28)) ? 10 : O(d, m(t, 2)) ? m(t, 18) || O(d, m(t, 3)) ? 2 : 0 : !m(t, 18) && O(d, m(t, 3)) ? 1 : -1 : -1;
8895
8999
  }
8896
- function H(d, t) {
9000
+ function W(d, t) {
8897
9001
  if (t == null) return null;
8898
9002
  t = t.toUpperCase();
8899
9003
  var n = d.g[t];
8900
9004
  if (n == null) {
8901
- if (n = M1[t], n == null) return null;
9005
+ if (n = x1[t], n == null) return null;
8902
9006
  n = new q().g(z.m(), n), d.g[t] = n;
8903
9007
  }
8904
9008
  return n;
8905
9009
  }
8906
9010
  function O(d, t) {
8907
9011
  var n = d.length;
8908
- return 0 < K(t, 9) && D(t, 9).indexOf(n) == -1 ? !1 : U(S(t, 2), d);
9012
+ return 0 < K(t, 9) && x(t, 9).indexOf(n) == -1 ? !1 : F(w(t, 2), d);
8909
9013
  }
8910
9014
  function E0(d, t) {
8911
- var n = K1(d, t), s = S(t, 1), o = d1(d, s, n);
8912
- return o == null || n != "001" && s != V1(d, n) ? o = !1 : (d = t1(t), o = m1(d, o) != -1), o;
9015
+ var n = H1(d, t), r = w(t, 1), o = d1(d, r, n);
9016
+ return o == null || n != "001" && r != W1(d, n) ? o = !1 : (d = t1(t), o = C1(d, o) != -1), o;
8913
9017
  }
8914
- function K1(d, t) {
9018
+ function H1(d, t) {
8915
9019
  if (t == null) return null;
8916
- var n = S(t, 1);
9020
+ var n = w(t, 1);
8917
9021
  if (n = X[n], n == null) d = null;
8918
9022
  else if (n.length == 1) d = n[0];
8919
9023
  else d: {
8920
9024
  t = t1(t);
8921
- for (var s, o = n.length, l = 0; l < o; l++) {
8922
- s = n[l];
8923
- var a = H(d, s);
8924
- if (B(a, 23)) {
9025
+ for (var r, o = n.length, l = 0; l < o; l++) {
9026
+ r = n[l];
9027
+ var a = W(d, r);
9028
+ if (R(a, 23)) {
8925
9029
  if (t.search(m(a, 23)) == 0) {
8926
- d = s;
9030
+ d = r;
8927
9031
  break d;
8928
9032
  }
8929
- } else if (m1(t, a) != -1) {
8930
- d = s;
9033
+ } else if (C1(t, a) != -1) {
9034
+ d = r;
8931
9035
  break d;
8932
9036
  }
8933
9037
  }
@@ -8938,148 +9042,148 @@ const n2 = (f) => {
8938
9042
  function e1(d) {
8939
9043
  return d = X[d], d == null ? "ZZ" : d[0];
8940
9044
  }
8941
- function V1(d, t) {
8942
- if (d = H(d, t), d == null) throw Error("Invalid region code: " + t);
8943
- return S(d, 10);
9045
+ function W1(d, t) {
9046
+ if (d = W(d, t), d == null) throw Error("Invalid region code: " + t);
9047
+ return w(d, 10);
8944
9048
  }
8945
- function u1(d, t, n, s) {
8946
- var o = l1(n, s), l = K(o, 9) == 0 ? D(m(n, 1), 9) : D(o, 9);
8947
- if (o = D(o, 10), s == 2) if (O1(l1(n, 0))) d = l1(n, 1), O1(d) && (l = l.concat(K(d, 9) == 0 ? D(m(n, 1), 9) : D(d, 9)), l.sort(), o.length == 0 ? o = D(d, 10) : (o = o.concat(D(d, 10)), o.sort()));
8948
- else return u1(d, t, n, 1);
9049
+ function l1(d, t, n, r) {
9050
+ var o = u1(n, r), l = K(o, 9) == 0 ? x(m(n, 1), 9) : x(o, 9);
9051
+ if (o = x(o, 10), r == 2) if (U1(u1(n, 0))) d = u1(n, 1), U1(d) && (l = l.concat(K(d, 9) == 0 ? x(m(n, 1), 9) : x(d, 9)), l.sort(), o.length == 0 ? o = x(d, 10) : (o = o.concat(x(d, 10)), o.sort()));
9052
+ else return l1(d, t, n, 1);
8949
9053
  return l[0] == -1 ? 5 : (t = t.length, -1 < o.indexOf(t) ? 4 : (n = l[0], n == t ? 0 : n > t ? 2 : l[l.length - 1] < t ? 3 : -1 < l.indexOf(t, 1) ? 0 : 5));
8950
9054
  }
8951
9055
  function a1(d, t, n) {
8952
- var s = t1(t);
8953
- return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), u1(d, s, t, n)) : 1;
9056
+ var r = t1(t);
9057
+ return t = w(t, 1), t in X ? (t = d1(d, t, e1(t)), l1(d, r, t, n)) : 1;
8954
9058
  }
8955
- function H1(d, t) {
9059
+ function j1(d, t) {
8956
9060
  if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
8957
- for (var n, s = d.length, o = 1; 3 >= o && o <= s; ++o) if (n = parseInt(d.substring(0, o), 10), n in X) return t.g(d.substring(o)), n;
9061
+ for (var n, r = d.length, o = 1; 3 >= o && o <= r; ++o) if (n = parseInt(d.substring(0, o), 10), n in X) return t.g(d.substring(o)), n;
8958
9062
  return 0;
8959
9063
  }
8960
- function j1(d, t, n, s, o, l) {
9064
+ function z1(d, t, n, r, o, l) {
8961
9065
  if (t.length == 0) return 0;
8962
- t = new A(t);
9066
+ t = new T(t);
8963
9067
  var a;
8964
9068
  n != null && (a = m(n, 11)), a == null && (a = "NonMatch");
8965
- var p = t.toString();
8966
- if (p.length == 0) a = 20;
8967
- else if (Q.test(p)) p = p.replace(Q, ""), R(t), t.g(R1(p)), a = 1;
9069
+ var C = t.toString();
9070
+ if (C.length == 0) a = 20;
9071
+ else if (Q.test(C)) C = C.replace(Q, ""), k(t), t.g(G1(C)), a = 1;
8968
9072
  else {
8969
- if (p = new RegExp(a), k1(t), a = t.toString(), a.search(p) == 0) {
8970
- p = a.match(p)[0].length;
8971
- var _ = a.substring(p).match(D1);
8972
- _ && _[1] != null && 0 < _[1].length && s1(_[1], g1) == "0" ? a = !1 : (R(t), t.g(a.substring(p)), a = !0);
9073
+ if (C = new RegExp(a), O1(t), a = t.toString(), a.search(C) == 0) {
9074
+ C = a.match(C)[0].length;
9075
+ var _ = a.substring(C).match(P1);
9076
+ _ && _[1] != null && 0 < _[1].length && s1(_[1], g1) == "0" ? a = !1 : (k(t), t.g(a.substring(C)), a = !0);
8973
9077
  } else a = !1;
8974
9078
  a = a ? 5 : 20;
8975
9079
  }
8976
- if (o && T(l, 6, a), a != 20) {
9080
+ if (o && M(l, 6, a), a != 20) {
8977
9081
  if (2 >= t.h.length) throw Error("Phone number too short after IDD");
8978
- if (d = H1(t, s), d != 0) return T(l, 1, d), d;
9082
+ if (d = j1(t, r), d != 0) return M(l, 1, d), d;
8979
9083
  throw Error("Invalid country calling code");
8980
9084
  }
8981
- return n != null && (a = S(n, 10), p = "" + a, _ = t.toString(), _.lastIndexOf(p, 0) == 0 && (p = new A(_.substring(p.length)), _ = m(n, 1), _ = new RegExp(S(_, 2)), W1(p, n, null), p = p.toString(), !U(_, t.toString()) && U(_, p) || u1(d, t.toString(), n, -1) == 3)) ? (s.g(p), o && T(l, 6, 10), T(l, 1, a), a) : (T(l, 1, 0), 0);
9085
+ return n != null && (a = w(n, 10), C = "" + a, _ = t.toString(), _.lastIndexOf(C, 0) == 0 && (C = new T(_.substring(C.length)), _ = m(n, 1), _ = new RegExp(w(_, 2)), Z1(C, n, null), C = C.toString(), !F(_, t.toString()) && F(_, C) || l1(d, t.toString(), n, -1) == 3)) ? (r.g(C), o && M(l, 6, 10), M(l, 1, a), a) : (M(l, 1, 0), 0);
8982
9086
  }
8983
- function W1(d, t, n) {
8984
- var s = d.toString(), o = s.length, l = m(t, 15);
9087
+ function Z1(d, t, n) {
9088
+ var r = d.toString(), o = r.length, l = m(t, 15);
8985
9089
  if (o != 0 && l != null && l.length != 0) {
8986
9090
  var a = new RegExp("^(?:" + l + ")");
8987
- if (o = a.exec(s)) {
8988
- l = new RegExp(S(m(t, 1), 2));
8989
- var p = U(l, s), _ = o.length - 1;
8990
- t = m(t, 16), t == null || t.length == 0 || o[_] == null || o[_].length == 0 ? (!p || U(l, s.substring(o[0].length))) && (n != null && 0 < _ && o[_] != null && n.g(o[1]), d.set(s.substring(o[0].length))) : (s = s.replace(a, t), (!p || U(l, s)) && (n != null && 0 < _ && n.g(o[1]), d.set(s)));
9091
+ if (o = a.exec(r)) {
9092
+ l = new RegExp(w(m(t, 1), 2));
9093
+ var C = F(l, r), _ = o.length - 1;
9094
+ t = m(t, 16), t == null || t.length == 0 || o[_] == null || o[_].length == 0 ? (!C || F(l, r.substring(o[0].length))) && (n != null && 0 < _ && o[_] != null && n.g(o[1]), d.set(r.substring(o[0].length))) : (r = r.replace(a, t), (!C || F(l, r)) && (n != null && 0 < _ && n.g(o[1]), d.set(r)));
8991
9095
  }
8992
9096
  }
8993
9097
  }
8994
9098
  function Z(d, t, n) {
8995
9099
  if (!o1(n) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
8996
- return z1(d, t, n, !0);
9100
+ return Y1(d, t, n, !0);
8997
9101
  }
8998
- function z1(d, t, n, s) {
9102
+ function Y1(d, t, n, r) {
8999
9103
  if (t == null) throw Error("The string supplied did not seem to be a phone number");
9000
9104
  if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
9001
- var o = new A(), l = t.indexOf(";phone-context=");
9105
+ var o = new T(), l = t.indexOf(";phone-context=");
9002
9106
  if (l === -1) l = null;
9003
9107
  else if (l += 15, l >= t.length) l = "";
9004
9108
  else {
9005
9109
  var a = t.indexOf(";", l);
9006
9110
  l = a !== -1 ? t.substring(l, a) : t.substring(l);
9007
9111
  }
9008
- var p = l;
9009
- if (p == null ? a = !0 : p.length === 0 ? a = !1 : (a = S0.exec(p), p = b0.exec(p), a = a !== null || p !== null), !a || (l != null ? (l.charAt(0) === "+" && o.g(l), l = t.indexOf("tel:"), o.g(t.substring(0 <= l ? l + 4 : 0, t.indexOf(";phone-context=")))) : (l = o.g, a = t ?? "", p = a.search(_0), 0 <= p ? (a = a.substring(p), a = a.replace(v0, ""), p = a.search(I0), 0 <= p && (a = a.substring(0, p))) : a = "", l.call(o, a)), l = o.toString(), a = l.indexOf(";isub="), 0 < a && (R(o), o.g(l.substring(0, a))), !B1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
9112
+ var C = l;
9113
+ if (C == null ? a = !0 : C.length === 0 ? a = !1 : (a = v0.exec(C), C = N0.exec(C), a = a !== null || C !== null), !a || (l != null ? (l.charAt(0) === "+" && o.g(l), l = t.indexOf("tel:"), o.g(t.substring(0 <= l ? l + 4 : 0, t.indexOf(";phone-context=")))) : (l = o.g, a = t ?? "", C = a.search(_0), 0 <= C ? (a = a.substring(C), a = a.replace(w0, ""), C = a.search(b0), 0 <= C && (a = a.substring(0, C))) : a = "", l.call(o, a)), l = o.toString(), a = l.indexOf(";isub="), 0 < a && (k(o), o.g(l.substring(0, a))), !k1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
9010
9114
  if (l = o.toString(), !(o1(n) || l != null && 0 < l.length && Q.test(l))) throw Error("Invalid country calling code");
9011
- l = new V(), s && T(l, 5, t);
9115
+ l = new H(), r && M(l, 5, t);
9012
9116
  d: {
9013
- if (t = o.toString(), a = t.search(x1), 0 <= a && B1(t.substring(0, a))) {
9014
- p = t.match(x1);
9015
- for (var _ = p.length, F = 1; F < _; ++F) if (p[F] != null && 0 < p[F].length) {
9016
- R(o), o.g(t.substring(0, a)), t = p[F];
9117
+ if (t = o.toString(), a = t.search(R1), 0 <= a && k1(t.substring(0, a))) {
9118
+ C = t.match(R1);
9119
+ for (var _ = C.length, V = 1; V < _; ++V) if (C[V] != null && 0 < C[V].length) {
9120
+ k(o), o.g(t.substring(0, a)), t = C[V];
9017
9121
  break d;
9018
9122
  }
9019
9123
  }
9020
9124
  t = "";
9021
9125
  }
9022
- 0 < t.length && T(l, 3, t), a = H(d, n), t = new A(), p = 0, _ = o.toString();
9126
+ 0 < t.length && M(l, 3, t), a = W(d, n), t = new T(), C = 0, _ = o.toString();
9023
9127
  try {
9024
- p = j1(d, _, a, t, s, l);
9025
- } catch (_1) {
9026
- if (_1.message == "Invalid country calling code" && Q.test(_)) {
9027
- if (_ = _.replace(Q, ""), p = j1(d, _, a, t, s, l), p == 0) throw _1;
9028
- } else throw _1;
9128
+ C = z1(d, _, a, t, r, l);
9129
+ } catch (I1) {
9130
+ if (I1.message == "Invalid country calling code" && Q.test(_)) {
9131
+ if (_ = _.replace(Q, ""), C = z1(d, _, a, t, r, l), C == 0) throw I1;
9132
+ } else throw I1;
9029
9133
  }
9030
- if (p != 0 ? (o = e1(p), o != n && (a = d1(d, p, o))) : (k1(o), t.g(o.toString()), n != null ? (p = S(a, 10), T(
9134
+ if (C != 0 ? (o = e1(C), o != n && (a = d1(d, C, o))) : (O1(o), t.g(o.toString()), n != null ? (C = w(a, 10), M(
9031
9135
  l,
9032
9136
  1,
9033
- p
9034
- )) : s && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (a != null && (n = new A(), o = new A(t.toString()), W1(o, a, n), d = u1(d, o.toString(), a, -1), d != 2 && d != 4 && d != 5 && (t = o, s && 0 < n.toString().length && T(l, 7, n.toString()))), s = t.toString(), d = s.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
9137
+ C
9138
+ )) : r && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (a != null && (n = new T(), o = new T(t.toString()), Z1(o, a, n), d = l1(d, o.toString(), a, -1), d != 2 && d != 4 && d != 5 && (t = o, r && 0 < n.toString().length && M(l, 7, n.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
9035
9139
  if (17 < d) throw Error("The string supplied is too long to be a phone number");
9036
- if (1 < s.length && s.charAt(0) == "0") {
9037
- for (T(l, 4, !0), d = 1; d < s.length - 1 && s.charAt(d) == "0"; ) d++;
9038
- d != 1 && T(l, 8, d);
9140
+ if (1 < r.length && r.charAt(0) == "0") {
9141
+ for (M(l, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
9142
+ d != 1 && M(l, 8, d);
9039
9143
  }
9040
- return T(l, 2, parseInt(s, 10)), l;
9144
+ return M(l, 2, parseInt(r, 10)), l;
9041
9145
  }
9042
- function U(d, t) {
9146
+ function F(d, t) {
9043
9147
  return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
9044
9148
  }
9045
- function T0(d) {
9046
- this.fa = RegExp(" "), this.ja = "", this.v = new A(), this.da = "", this.s = new A(), this.ba = new A(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = M.g(), this.$ = 0, this.h = new A(), this.ha = !1, this.o = "", this.g = new A(), this.j = [], this.ka = d, this.l = J1(this, this.ka);
9149
+ function M0(d) {
9150
+ this.fa = RegExp(" "), this.ja = "", this.v = new T(), this.da = "", this.s = new T(), this.ba = new T(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new T(), this.ha = !1, this.o = "", this.g = new T(), this.j = [], this.ka = d, this.l = X1(this, this.ka);
9047
9151
  }
9048
- var Z1 = new z();
9049
- T(Z1, 11, "NA");
9050
- var M0 = RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)*$"), Y1 = /[- ]/;
9051
- function J1(d, t) {
9152
+ var J1 = new z();
9153
+ M(J1, 11, "NA");
9154
+ var D0 = RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)*$"), q1 = /[- ]/;
9155
+ function X1(d, t) {
9052
9156
  var n = d.ga;
9053
- return t = o1(t) ? V1(n, t) : 0, d = H(d.ga, e1(t)), d ?? Z1;
9157
+ return t = o1(t) ? W1(n, t) : 0, d = W(d.ga, e1(t)), d ?? J1;
9054
9158
  }
9055
- function q1(d) {
9159
+ function Q1(d) {
9056
9160
  for (var t = d.j.length, n = 0; n < t; ++n) {
9057
- var s = d.j[n], o = S(s, 1);
9161
+ var r = d.j[n], o = w(r, 1);
9058
9162
  if (d.da == o) return !1;
9059
- var l = d, a = s, p = S(a, 1);
9060
- R(l.v);
9163
+ var l = d, a = r, C = w(a, 1);
9164
+ k(l.v);
9061
9165
  var _ = l;
9062
- a = S(a, 2);
9063
- var F = "999999999999999".match(p)[0];
9064
- if (F.length < _.g.h.length ? _ = "" : (_ = F.replace(new RegExp(p, "g"), a), _ = _.replace(RegExp("9", "g"), " ")), 0 < _.length ? (l.v.g(_), l = !0) : l = !1, l) return d.da = o, d.ha = Y1.test(m(s, 4)), d.$ = 0, !0;
9166
+ a = w(a, 2);
9167
+ var V = "999999999999999".match(C)[0];
9168
+ if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(C, "g"), a), _ = _.replace(RegExp("9", "g"), " ")), 0 < _.length ? (l.v.g(_), l = !0) : l = !1, l) return d.da = o, d.ha = q1.test(m(r, 4)), d.$ = 0, !0;
9065
9169
  }
9066
9170
  return d.u = !1;
9067
9171
  }
9068
- function X1(d, t) {
9069
- for (var n = [], s = t.length - 3, o = d.j.length, l = 0; l < o; ++l) {
9172
+ function d0(d, t) {
9173
+ for (var n = [], r = t.length - 3, o = d.j.length, l = 0; l < o; ++l) {
9070
9174
  var a = d.j[l];
9071
- K(a, 3) == 0 ? n.push(d.j[l]) : (a = m(a, 3, Math.min(s, K(a, 3) - 1)), t.search(a) == 0 && n.push(d.j[l]));
9175
+ K(a, 3) == 0 ? n.push(d.j[l]) : (a = m(a, 3, Math.min(r, K(a, 3) - 1)), t.search(a) == 0 && n.push(d.j[l]));
9072
9176
  }
9073
9177
  d.j = n;
9074
9178
  }
9075
- function D0(d, t) {
9179
+ function x0(d, t) {
9076
9180
  d.s.g(t);
9077
9181
  var n = t;
9078
- if (D1.test(n) || d.s.h.length == 1 && y0.test(n) ? (t == "+" ? (n = t, d.ba.g(t)) : (n = g1[t], d.ba.g(n), d.g.g(n)), t = n) : (d.u = !1, d.la = !0), !d.u) {
9182
+ if (P1.test(n) || d.s.h.length == 1 && I0.test(n) ? (t == "+" ? (n = t, d.ba.g(t)) : (n = g1[t], d.ba.g(n), d.g.g(n)), t = n) : (d.u = !1, d.la = !0), !d.u) {
9079
9183
  if (!d.la) {
9080
- if ($0(d)) {
9081
- if (n0(d)) return Q1(d);
9082
- } else if (0 < d.o.length && (t = d.g.toString(), R(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), n = t.lastIndexOf(d.o), R(d.h), d.h.g(t.substring(0, n))), d.o != e0(d)) return d.h.g(" "), Q1(d);
9184
+ if (i0(d)) {
9185
+ if (r0(d)) return t0(d);
9186
+ } else if (0 < d.o.length && (t = d.g.toString(), k(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), n = t.lastIndexOf(d.o), k(d.h), d.h.g(t.substring(0, n))), d.o != n0(d)) return d.h.g(" "), t0(d);
9083
9187
  }
9084
9188
  return d.s.toString();
9085
9189
  }
@@ -9089,19 +9193,19 @@ const n2 = (f) => {
9089
9193
  case 2:
9090
9194
  return d.s.toString();
9091
9195
  case 3:
9092
- if ($0(d)) d.ea = !0;
9093
- else return d.o = e0(d), C1(d);
9196
+ if (i0(d)) d.ea = !0;
9197
+ else return d.o = n0(d), m1(d);
9094
9198
  default:
9095
- return d.ea ? (n0(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = i0(d, t), n = d0(d), 0 < n.length ? n : (X1(d, d.g.toString()), q1(d) ? t0(d) : d.u ? h1(d, t) : d.s.toString())) : C1(d);
9199
+ return d.ea ? (r0(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = s0(d, t), n = e0(d), 0 < n.length ? n : (d0(d, d.g.toString()), Q1(d) ? $0(d) : d.u ? h1(d, t) : d.s.toString())) : m1(d);
9096
9200
  }
9097
9201
  }
9098
- function Q1(d) {
9099
- return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, R(d.v), d.da = "", C1(d);
9202
+ function t0(d) {
9203
+ return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, k(d.v), d.da = "", m1(d);
9100
9204
  }
9101
- function d0(d) {
9102
- for (var t = d.g.toString(), n = d.j.length, s = 0; s < n; ++s) {
9103
- var o = d.j[s], l = S(o, 1);
9104
- if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha = Y1.test(m(o, 4)), o = t.replace(new RegExp(l, "g"), m(o, 2)), o = h1(d, o), s1(o, m0) == d.ba)) return o;
9205
+ function e0(d) {
9206
+ for (var t = d.g.toString(), n = d.j.length, r = 0; r < n; ++r) {
9207
+ var o = d.j[r], l = w(o, 1);
9208
+ if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha = q1.test(m(o, 4)), o = t.replace(new RegExp(l, "g"), m(o, 2)), o = h1(d, o), s1(o, m0) == d.ba)) return o;
9105
9209
  }
9106
9210
  return "";
9107
9211
  }
@@ -9109,117 +9213,117 @@ const n2 = (f) => {
9109
9213
  var n = d.h.h.length;
9110
9214
  return d.ha && 0 < n && d.h.toString().charAt(n - 1) != " " ? d.h + " " + t : d.h + t;
9111
9215
  }
9112
- function C1(d) {
9216
+ function m1(d) {
9113
9217
  var t = d.g.toString();
9114
9218
  if (3 <= t.length) {
9115
- for (var n = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? D(d.l, 20) : D(d.l, 19), s = n.length, o = 0; o < s; ++o) {
9219
+ for (var n = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? x(d.l, 20) : x(d.l, 19), r = n.length, o = 0; o < r; ++o) {
9116
9220
  var l = n[o];
9117
- 0 < d.o.length && G1(S(l, 4)) && !m(l, 6) && !B(l, 5) || (d.o.length != 0 || d.ca || G1(S(l, 4)) || m(l, 6)) && M0.test(S(l, 2)) && d.j.push(l);
9221
+ 0 < d.o.length && F1(w(l, 4)) && !m(l, 6) && !R(l, 5) || (d.o.length != 0 || d.ca || F1(w(l, 4)) || m(l, 6)) && D0.test(w(l, 2)) && d.j.push(l);
9118
9222
  }
9119
- return X1(d, t), t = d0(d), 0 < t.length ? t : q1(d) ? t0(d) : d.s.toString();
9223
+ return d0(d, t), t = e0(d), 0 < t.length ? t : Q1(d) ? $0(d) : d.s.toString();
9120
9224
  }
9121
9225
  return h1(d, t);
9122
9226
  }
9123
- function t0(d) {
9227
+ function $0(d) {
9124
9228
  var t = d.g.toString(), n = t.length;
9125
9229
  if (0 < n) {
9126
- for (var s = "", o = 0; o < n; o++) s = i0(d, t.charAt(o));
9127
- return d.u ? h1(d, s) : d.s.toString();
9230
+ for (var r = "", o = 0; o < n; o++) r = s0(d, t.charAt(o));
9231
+ return d.u ? h1(d, r) : d.s.toString();
9128
9232
  }
9129
9233
  return d.h.toString();
9130
9234
  }
9131
- function e0(d) {
9235
+ function n0(d) {
9132
9236
  var t = d.g.toString(), n = 0;
9133
- if (m(d.l, 10) != 1) var s = !1;
9134
- else s = d.g.toString(), s = s.charAt(0) == "1" && s.charAt(1) != "0" && s.charAt(1) != "1";
9135
- return s ? (n = 1, d.h.g("1").g(" "), d.ca = !0) : B(d.l, 15) && (s = new RegExp("^(?:" + m(d.l, 15) + ")"), s = t.match(s), s != null && s[0] != null && 0 < s[0].length && (d.ca = !0, n = s[0].length, d.h.g(t.substring(0, n)))), R(d.g), d.g.g(t.substring(n)), t.substring(0, n);
9237
+ if (m(d.l, 10) != 1) var r = !1;
9238
+ else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
9239
+ return r ? (n = 1, d.h.g("1").g(" "), d.ca = !0) : R(d.l, 15) && (r = new RegExp("^(?:" + m(d.l, 15) + ")"), r = t.match(r), r != null && r[0] != null && 0 < r[0].length && (d.ca = !0, n = r[0].length, d.h.g(t.substring(0, n)))), k(d.g), d.g.g(t.substring(n)), t.substring(0, n);
9136
9240
  }
9137
- function $0(d) {
9241
+ function i0(d) {
9138
9242
  var t = d.ba.toString(), n = new RegExp("^(?:\\+|" + m(d.l, 11) + ")");
9139
- return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length, R(d.g), d.g.g(t.substring(n)), R(d.h), d.h.g(t.substring(0, n)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
9243
+ return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length, k(d.g), d.g.g(t.substring(n)), k(d.h), d.h.g(t.substring(0, n)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
9140
9244
  }
9141
- function n0(d) {
9245
+ function r0(d) {
9142
9246
  if (d.g.h.length == 0) return !1;
9143
- var t = new A(), n = H1(d.g, t);
9144
- return n == 0 ? !1 : (R(d.g), d.g.g(t.toString()), t = e1(n), t == "001" ? d.l = H(d.ga, "" + n) : t != d.ka && (d.l = J1(d, t)), d.h.g("" + n).g(" "), d.o = "", !0);
9247
+ var t = new T(), n = j1(d.g, t);
9248
+ return n == 0 ? !1 : (k(d.g), d.g.g(t.toString()), t = e1(n), t == "001" ? d.l = W(d.ga, "" + n) : t != d.ka && (d.l = X1(d, t)), d.h.g("" + n).g(" "), d.o = "", !0);
9145
9249
  }
9146
- function i0(d, t) {
9250
+ function s0(d, t) {
9147
9251
  var n = d.v.toString();
9148
9252
  if (0 <= n.substring(d.$).search(d.fa)) {
9149
- var s = n.search(d.fa);
9150
- return t = n.replace(d.fa, t), R(d.v), d.v.g(t), d.$ = s, t.substring(0, d.$ + 1);
9253
+ var r = n.search(d.fa);
9254
+ return t = n.replace(d.fa, t), k(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
9151
9255
  }
9152
9256
  return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
9153
9257
  }
9154
- const r0 = (d) => {
9258
+ const o0 = (d) => {
9155
9259
  const t = [];
9156
9260
  return d.includes("FIXED_LINE_OR_MOBILE") ? (d.includes("MOBILE") || t.push("MOBILE"), d.includes("FIXED_LINE") || t.push("FIXED_LINE")) : (d.includes("MOBILE") || d.includes("FIXED_LINE")) && t.push("FIXED_LINE_OR_MOBILE"), d.concat(t);
9157
9261
  }, y1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
9158
9262
  e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
9159
9263
  try {
9160
- const n = d.replace(/[^+0-9]/g, ""), s = new T0(t);
9264
+ const n = d.replace(/[^+0-9]/g, ""), r = new M0(t);
9161
9265
  t = "";
9162
- for (let o = 0; o < n.length; o++) s.ja = D0(s, n.charAt(o)), t = s.ja;
9266
+ for (let o = 0; o < n.length; o++) r.ja = x0(r, n.charAt(o)), t = r.ja;
9163
9267
  return t;
9164
9268
  } catch {
9165
9269
  return d;
9166
9270
  }
9167
9271
  }), e("intlTelInputUtilsTemp.formatNumber", (d, t, n) => {
9168
9272
  try {
9169
- const o = M.g(), l = Z(o, d, t);
9170
- var s = a1(o, l, -1);
9171
- return s == 0 || s == 4 ? o.format(l, typeof n > "u" ? 0 : n) : d;
9273
+ const o = D.g(), l = Z(o, d, t);
9274
+ var r = a1(o, l, -1);
9275
+ return r == 0 || r == 4 ? o.format(l, typeof n > "u" ? 0 : n) : d;
9172
9276
  } catch {
9173
9277
  return d;
9174
9278
  }
9175
- }), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n, s) => {
9279
+ }), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n, r) => {
9176
9280
  try {
9177
- const _ = M.g();
9281
+ const _ = D.g();
9178
9282
  d: {
9179
9283
  var o = _;
9180
9284
  if (o1(d)) {
9181
- var l = l1(H(o, d), n);
9285
+ var l = u1(W(o, d), n);
9182
9286
  try {
9183
- if (B(l, 6)) {
9184
- var a = m(l, 6), p = z1(o, a, d, !1);
9287
+ if (R(l, 6)) {
9288
+ var a = m(l, 6), C = Y1(o, a, d, !1);
9185
9289
  break d;
9186
9290
  }
9187
9291
  } catch {
9188
9292
  }
9189
9293
  }
9190
- p = null;
9294
+ C = null;
9191
9295
  }
9192
- return _.format(p, s ? 0 : t ? 2 : 1);
9296
+ return _.format(C, r ? 0 : t ? 2 : 1);
9193
9297
  } catch {
9194
9298
  return "";
9195
9299
  }
9196
9300
  }), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
9197
9301
  try {
9198
- return m(Z(M.g(), d, t), 3);
9302
+ return m(Z(D.g(), d, t), 3);
9199
9303
  } catch {
9200
9304
  return "";
9201
9305
  }
9202
9306
  }), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
9203
9307
  try {
9204
- const n = M.g(), s = Z(n, d, t);
9205
- return F1(n, s);
9308
+ const n = D.g(), r = Z(n, d, t);
9309
+ return K1(n, r);
9206
9310
  } catch {
9207
9311
  return -99;
9208
9312
  }
9209
9313
  }), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
9210
9314
  if (!t) return 1;
9211
9315
  try {
9212
- const n = M.g(), s = Z(n, d, t);
9213
- return a1(n, s, -1);
9316
+ const n = D.g(), r = Z(n, d, t);
9317
+ return a1(n, r, -1);
9214
9318
  } catch (n) {
9215
9319
  return n.message === "Invalid country calling code" ? 1 : 3 >= d.length || n.message === "Phone number too short after IDD" || n.message === "The string supplied is too short to be a phone number" ? 2 : n.message === "The string supplied is too long to be a phone number" ? 3 : -99;
9216
9320
  }
9217
9321
  }), e("intlTelInputUtilsTemp.isValidNumber", (d, t, n) => {
9218
9322
  try {
9219
- const s = M.g(), o = Z(s, d, t), l = E0(s, o);
9323
+ const r = D.g(), o = Z(r, d, t), l = E0(r, o);
9220
9324
  if (n) {
9221
- const a = r0(n).map((p) => y1[p]);
9222
- return l && a.includes(F1(s, o));
9325
+ const a = o0(n).map((C) => y1[C]);
9326
+ return l && a.includes(K1(r, o));
9223
9327
  }
9224
9328
  return l;
9225
9329
  } catch {
@@ -9227,30 +9331,30 @@ const n2 = (f) => {
9227
9331
  }
9228
9332
  }), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, n) => {
9229
9333
  try {
9230
- const s = M.g(), o = Z(s, d, t);
9334
+ const r = D.g(), o = Z(r, d, t);
9231
9335
  if (n) {
9232
- const l = r0(n);
9233
- for (let a of l) if (a1(s, o, y1[a]) === 0) return !0;
9336
+ const l = o0(n);
9337
+ for (let a of l) if (a1(r, o, y1[a]) === 0) return !0;
9234
9338
  return !1;
9235
9339
  }
9236
- return a1(s, o, -1) === 0;
9340
+ return a1(r, o, -1) === 0;
9237
9341
  } catch {
9238
9342
  return !1;
9239
9343
  }
9240
9344
  }), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
9241
9345
  try {
9242
- return m(Z(M.g(), d, t), 2).toString();
9346
+ return m(Z(D.g(), d, t), 2).toString();
9243
9347
  } catch {
9244
9348
  return "";
9245
9349
  }
9246
9350
  }), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", y1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
9247
9351
  })();
9248
- const h0 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, i2 = h0.intlTelInputUtilsTemp;
9249
- delete h0.intlTelInputUtilsTemp;
9250
- y.utils = i2;
9251
- const s2 = {
9352
+ const f0 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, s2 = f0.intlTelInputUtilsTemp;
9353
+ delete f0.intlTelInputUtilsTemp;
9354
+ y.utils = s2;
9355
+ const u2 = {
9252
9356
  __name: "IntlTelInputWithUtils",
9253
- props: /* @__PURE__ */ s0({
9357
+ props: /* @__PURE__ */ u0({
9254
9358
  disabled: {
9255
9359
  type: Boolean,
9256
9360
  default: !1
@@ -9274,47 +9378,47 @@ const s2 = {
9274
9378
  },
9275
9379
  modelModifiers: {}
9276
9380
  }),
9277
- emits: /* @__PURE__ */ s0([
9381
+ emits: /* @__PURE__ */ u0([
9278
9382
  "changeNumber",
9279
9383
  "changeCountry",
9280
9384
  "changeValidity",
9281
9385
  "changeErrorCode"
9282
9386
  ], ["update:modelValue"]),
9283
- setup(f, { expose: e, emit: $ }) {
9284
- const i = P0(f, "modelValue"), r = f, u = $, h = I1(), c = I1(), C = I1(!1), g = () => c.value ? r.options.strictMode ? c.value.isValidNumberPrecise() : c.value.isValidNumber() : null, I = () => {
9285
- let v = g();
9286
- C.value !== v && (C.value = v, u("changeValidity", !!v), u(
9387
+ setup(p, { expose: e, emit: $ }) {
9388
+ const i = P0(p, "modelValue"), s = p, h = $, u = _1(), f = _1(), c = _1(!1), g = () => f.value ? s.options.strictMode ? f.value.isValidNumberPrecise() : f.value.isValidNumber() : null, I = () => {
9389
+ let b = g();
9390
+ c.value !== b && (c.value = b, h("changeValidity", !!b), h(
9287
9391
  "changeErrorCode",
9288
- v ? null : c.value.getValidationError()
9392
+ b ? null : f.value.getValidationError()
9289
9393
  ));
9290
- }, w = () => {
9291
- var v;
9292
- u("changeNumber", ((v = c.value) == null ? void 0 : v.getNumber()) ?? ""), I();
9293
- }, k = () => {
9294
- var v;
9295
- u("changeCountry", ((v = c.value) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), w(), I();
9394
+ }, S = () => {
9395
+ var b;
9396
+ h("changeNumber", ((b = f.value) == null ? void 0 : b.getNumber()) ?? ""), I();
9397
+ }, L = () => {
9398
+ var b;
9399
+ h("changeCountry", ((b = f.value) == null ? void 0 : b.getSelectedCountryData().iso2) ?? ""), S(), I();
9296
9400
  };
9297
- return x0(() => {
9298
- h.value && (c.value = y(h.value, r.options), r.value && c.value.setNumber(r.value), r.disabled && c.value.setDisabled(r.disabled), C.value = g());
9299
- }), B0(
9300
- () => r.disabled,
9301
- (v) => {
9302
- var E;
9303
- return (E = c.value) == null ? void 0 : E.setDisabled(v);
9401
+ return B0(() => {
9402
+ u.value && (f.value = y(u.value, s.options), s.value && f.value.setNumber(s.value), s.disabled && f.value.setDisabled(s.disabled), c.value = g());
9403
+ }), R0(
9404
+ () => s.disabled,
9405
+ (b) => {
9406
+ var A;
9407
+ return (A = f.value) == null ? void 0 : A.setDisabled(b);
9304
9408
  }
9305
- ), R0(() => {
9306
- var v;
9307
- return (v = c.value) == null ? void 0 : v.destroy();
9308
- }), e({ instance: c, input: h }), (v, E) => k0((G0(), O0("input", U0({
9409
+ ), k0(() => {
9410
+ var b;
9411
+ return (b = f.value) == null ? void 0 : b.destroy();
9412
+ }), e({ instance: f, input: u }), (b, A) => G0((U0(), O0("input", F0({
9309
9413
  ref_key: "input",
9310
- ref: h,
9311
- "onUpdate:modelValue": E[0] || (E[0] = (N) => i.value = N),
9414
+ ref: u,
9415
+ "onUpdate:modelValue": A[0] || (A[0] = (G) => i.value = G),
9312
9416
  type: "tel",
9313
- onCountrychange: k,
9314
- onInput: w
9315
- }, f.inputProps), null, 16)), [
9417
+ onCountrychange: L,
9418
+ onInput: S
9419
+ }, p.inputProps), null, 16)), [
9316
9420
  [
9317
- F0,
9421
+ V0,
9318
9422
  i.value,
9319
9423
  void 0,
9320
9424
  { lazy: !0 }
@@ -9323,5 +9427,5 @@ const s2 = {
9323
9427
  }
9324
9428
  };
9325
9429
  export {
9326
- s2 as default
9430
+ u2 as default
9327
9431
  };