intl-tel-input 24.8.1 → 25.0.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.
- package/README.md +57 -48
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +6 -8
- package/build/js/intlTelInput.js +17 -33
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +448 -404
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +90 -91
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +16 -32
- package/react/build/IntlTelInput.d.ts +6 -8
- package/react/build/IntlTelInput.js +16 -32
- package/react/build/IntlTelInputWithUtils.cjs +447 -403
- package/react/build/IntlTelInputWithUtils.js +447 -403
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +19 -27
- package/vue/build/IntlTelInputWithUtils.mjs +770 -724
package/README.md
CHANGED
|
@@ -75,16 +75,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
75
75
|
## Getting Started (Using a CDN)
|
|
76
76
|
1. Add the CSS
|
|
77
77
|
```html
|
|
78
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@
|
|
78
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.0.0/build/css/intlTelInput.css">
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
2. Add the plugin script and initialise it on your input element
|
|
82
82
|
```html
|
|
83
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@
|
|
83
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.0.0/build/js/intlTelInput.min.js"></script>
|
|
84
84
|
<script>
|
|
85
85
|
const input = document.querySelector("#phone");
|
|
86
86
|
window.intlTelInput(input, {
|
|
87
|
-
|
|
87
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.0.0/build/js/utils.js"),
|
|
88
88
|
});
|
|
89
89
|
</script>
|
|
90
90
|
```
|
|
@@ -110,20 +110,11 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
110
110
|
|
|
111
111
|
const input = document.querySelector("#phone");
|
|
112
112
|
intlTelInput(input, {
|
|
113
|
-
|
|
113
|
+
loadUtils: () => import("intl-tel-input/utils"),
|
|
114
114
|
});
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
Most bundlers (such as Webpack, Vite, or Parcel) will see this and place the [utilities script](#utilities-script) in a separate bundle and load it asynchronously, only when needed. If this doesn’t work with your bundler or you want to load the utils module from some other location (such as a CDN
|
|
118
|
-
|
|
119
|
-
```js
|
|
120
|
-
import intlTelInput from 'intl-tel-input';
|
|
121
|
-
|
|
122
|
-
const input = document.querySelector("#phone");
|
|
123
|
-
intlTelInput(input, {
|
|
124
|
-
loadUtilsOnInit: `https://cdn.jsdelivr.net/npm/intl-tel-input@${intlTelInput.version}/build/js/utils.js`;
|
|
125
|
-
});
|
|
126
|
-
```
|
|
117
|
+
Most bundlers (such as Webpack, Vite, or Parcel) will see this and place the [utilities script](#utilities-script) in a separate bundle and load it asynchronously, only when needed. If this doesn’t work with your bundler or you want to load the utils module from some other location (such as a CDN or your own hosted version), you can do that as well - see other examples.
|
|
127
118
|
|
|
128
119
|
## Getting Started (Not using a bundler)
|
|
129
120
|
1. Download the [latest release](https://github.com/jackocnr/intl-tel-input/releases/latest), or better yet install it with [npm](https://www.npmjs.com/package/intl-tel-input)
|
|
@@ -149,7 +140,7 @@ intlTelInput(input, {
|
|
|
149
140
|
<script>
|
|
150
141
|
const input = document.querySelector("#phone");
|
|
151
142
|
window.intlTelInput(input, {
|
|
152
|
-
|
|
143
|
+
loadUtils: () => import("https://my-domain/path/to/utils.js"),
|
|
153
144
|
});
|
|
154
145
|
</script>
|
|
155
146
|
```
|
|
@@ -316,14 +307,33 @@ intlTelInput(input, {
|
|
|
316
307
|
Type: `String` Default: `""`
|
|
317
308
|
Set the initial country selection by specifying its country code e.g. `"us"` for the United States. (Be careful not to do this unless you are sure of the user's country, as it can lead to tricky issues if set incorrectly and the user auto-fills their national number and submits the form without checking - in certain cases, this can pass validation and you can end up storing a number with the wrong dial code). You can also set `initialCountry` to `"auto"`, which will look up the user's country based on their IP address (requires the `geoIpLookup` option - [see example](https://intl-tel-input.com/examples/lookup-country.html)). Note that however you use `initialCountry`, it will not update the country selection if the input already contains a number with an international dial code.
|
|
318
309
|
|
|
319
|
-
**
|
|
320
|
-
Type: `
|
|
310
|
+
**loadUtils**
|
|
311
|
+
Type: `() => Promise<module>` Default: `null` Example: `() => import("/path/to/utils.js")`
|
|
312
|
+
|
|
313
|
+
This is one way to lazy load the included utils.js (to enable formatting/validation etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options.
|
|
314
|
+
|
|
315
|
+
The `loadUtils` option takes a function which returns a Promise which resolves to the utils module. You can `import` the utils module in different ways: (A) from a CDN, (B) from your own hosted version of [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package.
|
|
316
|
+
|
|
317
|
+
```js
|
|
318
|
+
// (A) import utils module from a CDN
|
|
319
|
+
intlTelInput(htmlInputElement, {
|
|
320
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.0.0/build/js/utils.js"),
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// (B) import utils module from your own hosted version of utils.js
|
|
324
|
+
intlTelInput(htmlInputElement, {
|
|
325
|
+
loadUtils: () => import("https://my-domain.com/path/to/utils.js"),
|
|
326
|
+
});
|
|
321
327
|
|
|
322
|
-
|
|
328
|
+
// (C) if your bundler supports it, you can import utils module directly from the package
|
|
329
|
+
intlTelInput(htmlInputElement, {
|
|
330
|
+
loadUtils: () => import("intl-tel-input/utils"),
|
|
331
|
+
});
|
|
332
|
+
```
|
|
323
333
|
|
|
324
|
-
|
|
334
|
+
The module is only loaded when you initialise the plugin, and additionally, only when the page has finished loading (on the window load event) to prevent blocking (the script is ~260KB). When instantiating the plugin, a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned under the `promise` instance property, so you can do something like `iti.promise.then(callback)` to know when initialisation requests like this have finished. See [Utilities Script](#utilities-script) for more information.
|
|
325
335
|
|
|
326
|
-
|
|
336
|
+
If you want more control over when this file is lazy loaded, you can manually invoke the `attachUtils` static method whenever you like, instead of using the `loadUtils` initialisation option.
|
|
327
337
|
|
|
328
338
|
**nationalMode**
|
|
329
339
|
Type: `Boolean` Default: `true`
|
|
@@ -349,20 +359,15 @@ Display the selected country's international dial code next to the input, so it
|
|
|
349
359
|
|
|
350
360
|
**strictMode**
|
|
351
361
|
Type: `Boolean` Default: `false`
|
|
352
|
-
As the user types in the input, ignore any irrelevant characters. The user can only enter numeric characters and an optional plus at the beginning. Cap the length at the maximum valid number length (this respects `
|
|
362
|
+
As the user types in the input, ignore any irrelevant characters. The user can only enter numeric characters and an optional plus at the beginning. Cap the length at the maximum valid number length (this respects `validationNumberTypes`). Requires the [utils script to be loaded](#loading-the-utilities-script). [See example](https://intl-tel-input.com/examples/strict-mode.html).
|
|
353
363
|
|
|
354
364
|
**useFullscreenPopup**
|
|
355
365
|
Type: `Boolean` Default: `true on mobile devices, false otherwise`
|
|
356
366
|
Control when the country list appears as a fullscreen popup vs an inline dropdown. By default, it will appear as a fullscreen popup on mobile devices (based on user-agent and screen width), to make better use of the limited space (similar to how a native `<select>` works), and as an inline dropdown on larger devices/screens. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--usefullscreenpopup) (using the React component).
|
|
357
367
|
|
|
358
|
-
**
|
|
359
|
-
Type: `String`
|
|
360
|
-
|
|
361
|
-
This option is deprecated and has been renamed to `loadUtilsOnInit`. Please see the deatails for that option and use it instead.
|
|
362
|
-
|
|
363
|
-
**validationNumberType**
|
|
364
|
-
Type: `String` Default: `"MOBILE"`
|
|
365
|
-
Specify [one of the keys](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L162) from the enum `intlTelInput.utils.numberType` (e.g. `"FIXED_LINE"`) to set the number type to enforce during validation with `isValidNumber`, as well as the number length to enforce with `strictMode`. Set it to `null` to not enforce any particular type.
|
|
368
|
+
**validationNumberTypes**
|
|
369
|
+
Type: `String` Default: `["MOBILE"]`
|
|
370
|
+
Specify an array of [the keys](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L162) from the enum `intlTelInput.utils.numberType` to set the number type(s) to enforce during validation with `isValidNumber`, as well as the number length to enforce with `strictMode`. Set it to `null` to not enforce any particular type. By default, it's set to `["MOBILE"]` so `isValidNumber` will only return `true` for mobile numbers. Alternatively, you could set it to `["TOLL_FREE", "PREMIUM_RATE"]` to get `isValidNumber` to return `true` for only those kinds of numbers.
|
|
366
371
|
|
|
367
372
|
## Instance Methods
|
|
368
373
|
In these examples, `iti` refers to the plugin instance which gets returned when you initialise the plugin e.g.
|
|
@@ -432,14 +437,14 @@ if (error === intlTelInput.utils.validationError.TOO_SHORT) {
|
|
|
432
437
|
```
|
|
433
438
|
|
|
434
439
|
**isValidNumber**
|
|
435
|
-
Check if the current number is valid based on its length - [see example](https://intl-tel-input.com/examples/validation-practical.html), which should be sufficient for most use cases. See `isValidNumberPrecise` for more precise validation, but the advantage of `isValidNumber` is that it is much more future-proof as while countries around the world regularly update their number rules, they
|
|
440
|
+
Check if the current number is valid based on its length - [see example](https://intl-tel-input.com/examples/validation-practical.html), which should be sufficient for most use cases. See `isValidNumberPrecise` (DANGEROUS) for more precise validation, but the advantage of `isValidNumber` is that it is much more future-proof as while countries around the world regularly update their number rules, they rarely change their number lengths. If this method returns `false`, you can use `getValidationError` to get more information. Respects the `validationNumberTypes` option (which is set to `["MOBILE"]` by default). Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
436
441
|
```js
|
|
437
442
|
const isValid = iti.isValidNumber();
|
|
438
443
|
```
|
|
439
444
|
Returns: `true`/`false`
|
|
440
445
|
|
|
441
|
-
**isValidNumberPrecise** ⚠️
|
|
442
|
-
Check if the current number is valid using precise matching rules for each country/area code etc - [see example](https://intl-tel-input.com/examples/validation.html). Note that these rules change each month for various countries around the world, so you need to be careful to keep the plugin up-to-date else you will start rejecting valid numbers
|
|
446
|
+
**isValidNumberPrecise** ⚠️ DANGEROUS
|
|
447
|
+
Check if the current number is valid using precise matching rules for each country/area code etc - [see example](https://intl-tel-input.com/examples/validation.html). Note that these rules change each month for various countries around the world, so you need to be careful to constantly keep the plugin up-to-date (e.g. via an automated script) else <ins>you will start rejecting valid numbers</ins>. For a simpler and more future-proof form of validation, see `isValidNumber` above. If validation fails, you can use `getValidationError` to get more information. Respects the `validationNumberTypes` option (which is set to `["MOBILE"]` by default). Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
443
448
|
```js
|
|
444
449
|
const isValid = iti.isValidNumberPrecise();
|
|
445
450
|
```
|
|
@@ -493,18 +498,11 @@ const iti = intlTelInput.getInstance(input);
|
|
|
493
498
|
iti.isValidNumber(); // etc
|
|
494
499
|
```
|
|
495
500
|
|
|
496
|
-
**
|
|
497
|
-
An alternative to the `
|
|
501
|
+
**attachUtils**
|
|
502
|
+
An alternative to the `loadUtils` option, this method lets you manually load the utils.js script on demand, to enable formatting/validation etc. See [Loading The Utilities Script](#loading-the-utilities-script) for more information. This method should only be called once per page. A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned so you can use `attachUtils().then(...)` to know when it's finished.
|
|
498
503
|
```js
|
|
499
|
-
|
|
500
|
-
intlTelInput.loadUtils
|
|
501
|
-
|
|
502
|
-
// Or manage load via some other method with a function:
|
|
503
|
-
intlTelInput.loadUtils(async () => {
|
|
504
|
-
// Your own loading logic here. Return a JavaScript "module" object with
|
|
505
|
-
// the utils as the default export.
|
|
506
|
-
return { default: { /* a copy of the utils module */ } }
|
|
507
|
-
});
|
|
504
|
+
const loadUtils = () => import("/build/js/utils.js");
|
|
505
|
+
intlTelInput.attachUtils(loadUtils);
|
|
508
506
|
```
|
|
509
507
|
|
|
510
508
|
## Events
|
|
@@ -592,18 +590,29 @@ The utils script provides lots of great functionality (see above section), but c
|
|
|
592
590
|
**Option 1: intlTelInputWithUtils**
|
|
593
591
|
If you're not concerned about filesize (e.g. you're lazy loading this script), the easiest thing to do is to just use the full bundle (`/build/js/intlTelInputWithUtils.js`), which comes with the utils script included. This script can be used exactly like the main intlTelInput.js - so it can either be loaded directly onto the page (which defines `window.intlTelInput` like usual), or it can be imported like so: `import intlTelInput from "intl-tel-input/intlTelInputWithUtils"`.
|
|
594
592
|
|
|
595
|
-
**Option 2:
|
|
596
|
-
If you *are* concerned about filesize, you can lazy load the utils
|
|
593
|
+
**Option 2: loadUtils**
|
|
594
|
+
If you *are* concerned about filesize, you can lazy load the utils module when the plugin initialises, using the `loadUtils` initialisation option.
|
|
597
595
|
|
|
598
|
-
|
|
596
|
+
The `loadUtils` option takes a function which returns a Promise which resolves to the utils module. You can `import` the utils module in different ways: (A) from a CDN, (B) from your own hosted version of [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js), or (C) if you use a bundler like Webpack, Vite or Parcel, you can import it directly from the package.
|
|
599
597
|
|
|
600
598
|
```js
|
|
599
|
+
// (A) import utils module from a CDN
|
|
600
|
+
intlTelInput(htmlInputElement, {
|
|
601
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.0.0/build/js/utils.js"),
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
// (B) import utils module from your own hosted version of utils.js
|
|
605
|
+
intlTelInput(htmlInputElement, {
|
|
606
|
+
loadUtils: () => import("https://my-domain.com/path/to/utils.js"),
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// (C) if your bundler supports it, you can import utils module directly from the package
|
|
601
610
|
intlTelInput(htmlInputElement, {
|
|
602
|
-
|
|
611
|
+
loadUtils: () => import("intl-tel-input/utils"),
|
|
603
612
|
});
|
|
604
613
|
```
|
|
605
614
|
|
|
606
|
-
If you want more control over when this file is lazy loaded, you can manually invoke the `
|
|
615
|
+
If you want more control over when this file is lazy loaded, you can manually invoke the `attachUtils` static method whenever you like, instead of using the `loadUtils` initialisation option.
|
|
607
616
|
|
|
608
617
|
## Troubleshooting
|
|
609
618
|
|
package/build/js/data.js
CHANGED
package/build/js/data.min.js
CHANGED
|
@@ -299,7 +299,7 @@ declare module "intl-tel-input" {
|
|
|
299
299
|
instances: {
|
|
300
300
|
[key: string]: Iti;
|
|
301
301
|
};
|
|
302
|
-
|
|
302
|
+
attachUtils: (source: UtilsLoader) => Promise<unknown> | null;
|
|
303
303
|
startedLoadingAutoCountry: boolean;
|
|
304
304
|
startedLoadingUtilsScript: boolean;
|
|
305
305
|
version: string | undefined;
|
|
@@ -311,10 +311,10 @@ declare module "intl-tel-input" {
|
|
|
311
311
|
getCoreNumber(number: string, iso2: string | undefined): string;
|
|
312
312
|
getExampleNumber(iso2: string | undefined, nationalMode: boolean, numberType: number, useE164?: boolean): string;
|
|
313
313
|
getExtension(number: string, iso2: string | undefined): string;
|
|
314
|
-
getNumberType
|
|
314
|
+
getNumberType(number: string, iso2: string | undefined): number;
|
|
315
315
|
getValidationError(number: string, iso2: string | undefined): number;
|
|
316
|
-
isPossibleNumber(number: string, iso2: string | undefined, numberType?:
|
|
317
|
-
isValidNumber
|
|
316
|
+
isPossibleNumber(number: string, iso2: string | undefined, numberType?: NumberType[] | null): boolean;
|
|
317
|
+
isValidNumber(number: string, iso2: string | undefined, numberType?: NumberType[] | null): boolean;
|
|
318
318
|
numberFormat: {
|
|
319
319
|
NATIONAL: number;
|
|
320
320
|
INTERNATIONAL: number;
|
|
@@ -348,7 +348,7 @@ declare module "intl-tel-input" {
|
|
|
348
348
|
}) | null;
|
|
349
349
|
i18n: I18n;
|
|
350
350
|
initialCountry: string;
|
|
351
|
-
|
|
351
|
+
loadUtils: UtilsLoader;
|
|
352
352
|
nationalMode: boolean;
|
|
353
353
|
onlyCountries: string[];
|
|
354
354
|
placeholderNumberType: NumberType;
|
|
@@ -356,9 +356,7 @@ declare module "intl-tel-input" {
|
|
|
356
356
|
separateDialCode: boolean;
|
|
357
357
|
strictMode: boolean;
|
|
358
358
|
useFullscreenPopup: boolean;
|
|
359
|
-
|
|
360
|
-
utilsScript: string | UtilsLoader;
|
|
361
|
-
validationNumberType: NumberType | null;
|
|
359
|
+
validationNumberTypes: NumberType[] | null;
|
|
362
360
|
}
|
|
363
361
|
export type SomeOptions = Partial<AllOptions>;
|
|
364
362
|
export class Iti {
|
package/build/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input
|
|
2
|
+
* International Telephone Input v25.0.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1664,8 +1664,8 @@ var factoryOutput = (() => {
|
|
|
1664
1664
|
i18n: {},
|
|
1665
1665
|
//* Initial country.
|
|
1666
1666
|
initialCountry: "",
|
|
1667
|
-
//*
|
|
1668
|
-
|
|
1667
|
+
//* A function to load the utils script.
|
|
1668
|
+
loadUtils: null,
|
|
1669
1669
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1670
1670
|
nationalMode: true,
|
|
1671
1671
|
//* Display only these countries.
|
|
@@ -1686,10 +1686,8 @@ var factoryOutput = (() => {
|
|
|
1686
1686
|
navigator.userAgent
|
|
1687
1687
|
) || window.innerWidth <= 500
|
|
1688
1688
|
) : false,
|
|
1689
|
-
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1690
|
-
utilsScript: "",
|
|
1691
1689
|
//* The number type to enforce during validation.
|
|
1692
|
-
|
|
1690
|
+
validationNumberTypes: ["MOBILE"]
|
|
1693
1691
|
};
|
|
1694
1692
|
var regionlessNanpNumbers = [
|
|
1695
1693
|
"800",
|
|
@@ -2198,15 +2196,11 @@ var factoryOutput = (() => {
|
|
|
2198
2196
|
}
|
|
2199
2197
|
//* Init many requests: utils script / geo ip lookup.
|
|
2200
2198
|
_initRequests() {
|
|
2201
|
-
let {
|
|
2202
|
-
if (
|
|
2203
|
-
console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead.");
|
|
2204
|
-
loadUtilsOnInit = utilsScript;
|
|
2205
|
-
}
|
|
2206
|
-
if (loadUtilsOnInit && !intlTelInput.utils) {
|
|
2199
|
+
let { loadUtils, initialCountry, geoIpLookup } = this.options;
|
|
2200
|
+
if (loadUtils && !intlTelInput.utils) {
|
|
2207
2201
|
this._handlePageLoad = () => {
|
|
2208
2202
|
window.removeEventListener("load", this._handlePageLoad);
|
|
2209
|
-
intlTelInput.loadUtils
|
|
2203
|
+
intlTelInput.attachUtils(loadUtils)?.catch(() => {
|
|
2210
2204
|
});
|
|
2211
2205
|
};
|
|
2212
2206
|
if (intlTelInput.documentReady()) {
|
|
@@ -2670,7 +2664,7 @@ var factoryOutput = (() => {
|
|
|
2670
2664
|
}
|
|
2671
2665
|
//* Update the maximum valid number length for the currently selected country.
|
|
2672
2666
|
_updateMaxLength() {
|
|
2673
|
-
const { strictMode, placeholderNumberType,
|
|
2667
|
+
const { strictMode, placeholderNumberType, validationNumberTypes } = this.options;
|
|
2674
2668
|
const { iso2 } = this.selectedCountryData;
|
|
2675
2669
|
if (strictMode && intlTelInput.utils) {
|
|
2676
2670
|
if (iso2) {
|
|
@@ -2682,7 +2676,7 @@ var factoryOutput = (() => {
|
|
|
2682
2676
|
true
|
|
2683
2677
|
);
|
|
2684
2678
|
let validNumber = exampleNumber;
|
|
2685
|
-
while (intlTelInput.utils.isPossibleNumber(exampleNumber, iso2,
|
|
2679
|
+
while (intlTelInput.utils.isPossibleNumber(exampleNumber, iso2, validationNumberTypes)) {
|
|
2686
2680
|
validNumber = exampleNumber;
|
|
2687
2681
|
exampleNumber += "0";
|
|
2688
2682
|
}
|
|
@@ -3034,7 +3028,7 @@ var factoryOutput = (() => {
|
|
|
3034
3028
|
return this._utilsIsPossibleNumber(val);
|
|
3035
3029
|
}
|
|
3036
3030
|
_utilsIsPossibleNumber(val) {
|
|
3037
|
-
return intlTelInput.utils ? intlTelInput.utils.isPossibleNumber(val, this.selectedCountryData.iso2, this.options.
|
|
3031
|
+
return intlTelInput.utils ? intlTelInput.utils.isPossibleNumber(val, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
3038
3032
|
}
|
|
3039
3033
|
//* Validate the input val (precise)
|
|
3040
3034
|
isValidNumberPrecise() {
|
|
@@ -3052,7 +3046,7 @@ var factoryOutput = (() => {
|
|
|
3052
3046
|
return this._utilsIsValidNumber(val);
|
|
3053
3047
|
}
|
|
3054
3048
|
_utilsIsValidNumber(val) {
|
|
3055
|
-
return intlTelInput.utils ? intlTelInput.utils.isValidNumber(val, this.selectedCountryData.iso2) : null;
|
|
3049
|
+
return intlTelInput.utils ? intlTelInput.utils.isValidNumber(val, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
3056
3050
|
}
|
|
3057
3051
|
//* Update the selected country, and update the input val accordingly.
|
|
3058
3052
|
setCountry(iso2) {
|
|
@@ -3088,33 +3082,23 @@ var factoryOutput = (() => {
|
|
|
3088
3082
|
}
|
|
3089
3083
|
}
|
|
3090
3084
|
};
|
|
3091
|
-
var
|
|
3085
|
+
var attachUtils = (source) => {
|
|
3092
3086
|
if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
|
|
3093
3087
|
let loadCall;
|
|
3094
|
-
if (typeof source === "
|
|
3095
|
-
loadCall = import(
|
|
3096
|
-
/* webpackIgnore: true */
|
|
3097
|
-
/* @vite-ignore */
|
|
3098
|
-
source
|
|
3099
|
-
);
|
|
3100
|
-
} else if (typeof source === "function") {
|
|
3088
|
+
if (typeof source === "function") {
|
|
3101
3089
|
try {
|
|
3102
3090
|
loadCall = Promise.resolve(source());
|
|
3103
3091
|
} catch (error) {
|
|
3104
3092
|
return Promise.reject(error);
|
|
3105
3093
|
}
|
|
3106
3094
|
} else {
|
|
3107
|
-
return Promise.reject(new TypeError(`The argument passed to
|
|
3095
|
+
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof source}`));
|
|
3108
3096
|
}
|
|
3109
3097
|
intlTelInput.startedLoadingUtilsScript = true;
|
|
3110
3098
|
return loadCall.then((module) => {
|
|
3111
3099
|
const utils = module?.default;
|
|
3112
3100
|
if (!utils || typeof utils !== "object") {
|
|
3113
|
-
|
|
3114
|
-
throw new TypeError(`The module loaded from ${source} did not set utils as its default export.`);
|
|
3115
|
-
} else {
|
|
3116
|
-
throw new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
|
|
3117
|
-
}
|
|
3101
|
+
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
3118
3102
|
}
|
|
3119
3103
|
intlTelInput.utils = utils;
|
|
3120
3104
|
forEachInstance("handleUtils");
|
|
@@ -3147,10 +3131,10 @@ var factoryOutput = (() => {
|
|
|
3147
3131
|
},
|
|
3148
3132
|
//* A map from instance ID to instance object.
|
|
3149
3133
|
instances: {},
|
|
3150
|
-
|
|
3134
|
+
attachUtils,
|
|
3151
3135
|
startedLoadingUtilsScript: false,
|
|
3152
3136
|
startedLoadingAutoCountry: false,
|
|
3153
|
-
version: "
|
|
3137
|
+
version: "25.0.0"
|
|
3154
3138
|
}
|
|
3155
3139
|
);
|
|
3156
3140
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input
|
|
2
|
+
* International Telephone Input v25.0.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
}(() => {
|
|
15
15
|
|
|
16
|
-
var factoryOutput=(()=>{var L=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var F=(a,t)=>{for(var e in t)L(a,e,{get:t[e],enumerable:!0})},U=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!R.call(a,n)&&n!==e&&L(a,n,{get:()=>t[n],enumerable:!(i=O(t,n))||i.enumerable});return a};var B=a=>U(L({},"__esModule",{value:!0}),a);var Y={};F(Y,{Iti:()=>w,default:()=>q});var D=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],N=[];for(let a=0;a<D.length;a++){let t=D[a];N[a]={name:"",iso2:t[0],dialCode:t[1],priority:t[2]||0,areaCodes:t[3]||null,nodeById:{}}}var f=N;var j={ad:"Andorra",ae:"United Arab Emirates",af:"Afghanistan",ag:"Antigua & Barbuda",ai:"Anguilla",al:"Albania",am:"Armenia",ao:"Angola",ar:"Argentina",as:"American Samoa",at:"Austria",au:"Australia",aw:"Aruba",ax:"\xC5land Islands",az:"Azerbaijan",ba:"Bosnia & Herzegovina",bb:"Barbados",bd:"Bangladesh",be:"Belgium",bf:"Burkina Faso",bg:"Bulgaria",bh:"Bahrain",bi:"Burundi",bj:"Benin",bl:"St. Barth\xE9lemy",bm:"Bermuda",bn:"Brunei",bo:"Bolivia",bq:"Caribbean Netherlands",br:"Brazil",bs:"Bahamas",bt:"Bhutan",bw:"Botswana",by:"Belarus",bz:"Belize",ca:"Canada",cc:"Cocos (Keeling) Islands",cd:"Congo - Kinshasa",cf:"Central African Republic",cg:"Congo - Brazzaville",ch:"Switzerland",ci:"C\xF4te d\u2019Ivoire",ck:"Cook Islands",cl:"Chile",cm:"Cameroon",cn:"China",co:"Colombia",cr:"Costa Rica",cu:"Cuba",cv:"Cape Verde",cw:"Cura\xE7ao",cx:"Christmas Island",cy:"Cyprus",cz:"Czechia",de:"Germany",dj:"Djibouti",dk:"Denmark",dm:"Dominica",do:"Dominican Republic",dz:"Algeria",ec:"Ecuador",ee:"Estonia",eg:"Egypt",eh:"Western Sahara",er:"Eritrea",es:"Spain",et:"Ethiopia",fi:"Finland",fj:"Fiji",fk:"Falkland Islands",fm:"Micronesia",fo:"Faroe Islands",fr:"France",ga:"Gabon",gb:"United Kingdom",gd:"Grenada",ge:"Georgia",gf:"French Guiana",gg:"Guernsey",gh:"Ghana",gi:"Gibraltar",gl:"Greenland",gm:"Gambia",gn:"Guinea",gp:"Guadeloupe",gq:"Equatorial Guinea",gr:"Greece",gt:"Guatemala",gu:"Guam",gw:"Guinea-Bissau",gy:"Guyana",hk:"Hong Kong SAR China",hn:"Honduras",hr:"Croatia",ht:"Haiti",hu:"Hungary",id:"Indonesia",ie:"Ireland",il:"Israel",im:"Isle of Man",in:"India",io:"British Indian Ocean Territory",iq:"Iraq",ir:"Iran",is:"Iceland",it:"Italy",je:"Jersey",jm:"Jamaica",jo:"Jordan",jp:"Japan",ke:"Kenya",kg:"Kyrgyzstan",kh:"Cambodia",ki:"Kiribati",km:"Comoros",kn:"St. Kitts & Nevis",kp:"North Korea",kr:"South Korea",kw:"Kuwait",ky:"Cayman Islands",kz:"Kazakhstan",la:"Laos",lb:"Lebanon",lc:"St. Lucia",li:"Liechtenstein",lk:"Sri Lanka",lr:"Liberia",ls:"Lesotho",lt:"Lithuania",lu:"Luxembourg",lv:"Latvia",ly:"Libya",ma:"Morocco",mc:"Monaco",md:"Moldova",me:"Montenegro",mf:"St. Martin",mg:"Madagascar",mh:"Marshall Islands",mk:"North Macedonia",ml:"Mali",mm:"Myanmar (Burma)",mn:"Mongolia",mo:"Macao SAR China",mp:"Northern Mariana Islands",mq:"Martinique",mr:"Mauritania",ms:"Montserrat",mt:"Malta",mu:"Mauritius",mv:"Maldives",mw:"Malawi",mx:"Mexico",my:"Malaysia",mz:"Mozambique",na:"Namibia",nc:"New Caledonia",ne:"Niger",nf:"Norfolk Island",ng:"Nigeria",ni:"Nicaragua",nl:"Netherlands",no:"Norway",np:"Nepal",nr:"Nauru",nu:"Niue",nz:"New Zealand",om:"Oman",pa:"Panama",pe:"Peru",pf:"French Polynesia",pg:"Papua New Guinea",ph:"Philippines",pk:"Pakistan",pl:"Poland",pm:"St. Pierre & Miquelon",pr:"Puerto Rico",ps:"Palestinian Territories",pt:"Portugal",pw:"Palau",py:"Paraguay",qa:"Qatar",re:"R\xE9union",ro:"Romania",rs:"Serbia",ru:"Russia",rw:"Rwanda",sa:"Saudi Arabia",sb:"Solomon Islands",sc:"Seychelles",sd:"Sudan",se:"Sweden",sg:"Singapore",sh:"St. Helena",si:"Slovenia",sj:"Svalbard & Jan Mayen",sk:"Slovakia",sl:"Sierra Leone",sm:"San Marino",sn:"Senegal",so:"Somalia",sr:"Suriname",ss:"South Sudan",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sv:"El Salvador",sx:"Sint Maarten",sy:"Syria",sz:"Eswatini",tc:"Turks & Caicos Islands",td:"Chad",tg:"Togo",th:"Thailand",tj:"Tajikistan",tk:"Tokelau",tl:"Timor-Leste",tm:"Turkmenistan",tn:"Tunisia",to:"Tonga",tr:"Turkey",tt:"Trinidad & Tobago",tv:"Tuvalu",tw:"Taiwan",tz:"Tanzania",ua:"Ukraine",ug:"Uganda",us:"United States",uy:"Uruguay",uz:"Uzbekistan",va:"Vatican City",vc:"St. Vincent & Grenadines",ve:"Venezuela",vg:"British Virgin Islands",vi:"U.S. Virgin Islands",vn:"Vietnam",vu:"Vanuatu",wf:"Wallis & Futuna",ws:"Samoa",ye:"Yemen",yt:"Mayotte",za:"South Africa",zm:"Zambia",zw:"Zimbabwe"},A=j;var z={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"},S=z;var K={...A,...S},T=K;for(let a=0;a<f.length;a++)f[a].name=T[f[a].iso2];var $=0,P={allowDropdown:!0,autoPlaceholder:"polite",containerClass:"",countryOrder:null,countrySearch:!0,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",loadUtilsOnInit:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:"",validationNumberType:"MOBILE"},V=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],I=a=>a.replace(/\D/g,""),k=(a="")=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),M=a=>{let t=I(a);if(t.charAt(0)==="1"){let e=t.substr(1,3);return V.indexOf(e)!==-1}return!1},W=(a,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===a&&!i)return s+1;if(i&&n===a+1)return s}return t.length},c=(a,t,e)=>{let i=document.createElement(a);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=(a,...t)=>{let{instances:e}=r;Object.values(e).forEach(i=>i[a](...t))},w=class{constructor(t,e={}){this.id=$++,this.a=t,this.c=null,this.d=Object.assign({},P,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.onlyCountries.length===1&&(this.d.initialCountry=this.d.onlyCountries[0]),this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.allowDropdown&&!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]");let t=this.d.allowDropdown||this.d.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!t:t,this.d.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.a.style.paddingRight:this.originalPaddingLeft=this.a.style.paddingLeft),this.d.i18n={...T,...this.d.i18n};let e=new Promise((n,s)=>{this.h=n,this.i=s}),i=new Promise((n,s)=>{this.i0=n,this.i1=s});this.promise=Promise.all([e,i]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this._sortCountries()}_sortCountries(){this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,u=s>-1;if(o||u)return o&&u?n-s:o?-1:1}return t.name.localeCompare(e.name)})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;s<this.q[e].length;s++)if(this.q[e][s]===t)return;let n=i!==void 0?i:this.q[e].length;this.q[e][n]=t}_d(){let{onlyCountries:t,excludeCountries:e}=this.d;if(t.length){let i=t.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=f}_d0(){for(let t=0;t<this.p.length;t++){let e=this.p[t].iso2.toLowerCase();this.d.i18n.hasOwnProperty(e)&&(this.p[t].name=this.d.i18n[e])}}_d2(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(let t=0;t<this.p.length;t++){let e=this.p[t];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._c(e.iso2,e.dialCode,e.priority)}for(let t=0;t<this.p.length;t++){let e=this.p[t];if(e.areaCodes){let i=this.q[e.dialCode][0];for(let n=0;n<e.areaCodes.length;n++){let s=e.areaCodes[n];for(let o=1;o<s.length;o++){let u=e.dialCode+s.substr(0,o);this._c(i,u),this._c(e.iso2,u)}this._c(e.iso2,e.dialCode+s)}}}}_f(){this.a.classList.add("iti__tel-input"),!this.a.hasAttribute("autocomplete")&&!(this.a.form&&this.a.form.hasAttribute("autocomplete"))&&this.a.setAttribute("autocomplete","off");let{allowDropdown:t,separateDialCode:e,showFlags:i,containerClass:n,hiddenInput:s,dropdownContainer:o,fixDropdownWidth:u,useFullscreenPopup:l,countrySearch:p,i18n:h}=this.d,d="iti";t&&(d+=" iti--allow-dropdown"),i&&(d+=" iti--show-flags"),n&&(d+=` ${n}`),l||(d+=" iti--inline-dropdown");let m=c("div",{class:d});if(this.a.parentNode?.insertBefore(m,this.a),t||i||e){this.k=c("div",{class:"iti__country-container"},m),this.showSelectedCountryOnLeft?this.k.style.left="0px":this.k.style.right="0px",t?(this.selectedCountry=c("button",{type:"button",class:"iti__selected-country","aria-expanded":"false","aria-label":this.d.i18n.selectedCountryAriaLabel,"aria-haspopup":"true","aria-controls":`iti-${this.id}__dropdown-content`,role:"combobox"},this.k),this.a.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=c("div",{class:"iti__selected-country"},this.k);let C=c("div",{class:"iti__selected-country-primary"},this.selectedCountry);if(this.l=c("div",{class:"iti__flag"},C),this.selectedCountryA11yText=c("span",{class:"iti__a11y-text"},this.l),t&&(this.u=c("div",{class:"iti__arrow","aria-hidden":"true"},C)),e&&(this.t=c("div",{class:"iti__selected-dial-code"},this.selectedCountry)),t){let g=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=c("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${g}`}),p&&(this.searchInput=c("input",{type:"text",class:"iti__search-input",placeholder:h.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":h.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=c("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=c("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":h.countryListAriaLabel},this.dropdownContent),this._g(),p&&this._p4(),o){let y="iti iti--container";l?y+=" iti--fullscreen-popup":y+=" iti--inline-dropdown",this.dropdown=c("div",{class:y}),this.dropdown.appendChild(this.dropdownContent)}else this.k.appendChild(this.dropdownContent)}}if(m.appendChild(this.a),this._updateInputPadding(),s){let C=this.a.getAttribute("name")||"",g=s(C);g.phone&&(this.hiddenInput=c("input",{type:"hidden",name:g.phone}),m.appendChild(this.hiddenInput)),g.country&&(this.hiddenInputCountry=c("input",{type:"hidden",name:g.country}),m.appendChild(this.hiddenInputCountry))}}_g(){for(let t=0;t<this.p.length;t++){let e=this.p[t],i=t===0?"iti__highlight":"",n=c("li",{id:`iti-${this.id}__item-${e.iso2}`,class:`iti__country ${i}`,tabindex:"-1",role:"option","data-dial-code":e.dialCode,"data-country-code":e.iso2,"aria-selected":"false"},this.countryList);e.nodeById[this.id]=n;let s="";this.d.showFlags&&(s+=`<div class='iti__flag iti__${e.iso2}'></div>`),s+=`<span class='iti__country-name'>${e.name}</span>`,s+=`<span class='iti__dial-code'>+${e.dialCode}</span>`,n.insertAdjacentHTML("beforeend",s)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),u=M(s),{initialCountry:l,geoIpLookup:p}=this.d,h=l==="auto"&&p;if(o&&!u)this._v(s);else if(!h||t){let d=l?l.toLowerCase():"";d&&this._y(d,!0)?this._z(d):o&&u?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{loadUtilsOnInit:t,utilsScript:e,initialCountry:i,geoIpLookup:n}=this.d;!t&&e&&(console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."),t=e),t&&!r.utils?(this._handlePageLoad=()=>{window.removeEventListener("load",this._handlePageLoad),r.loadUtils(t)?.catch(()=>{})},r.documentReady()?this._handlePageLoad():window.addEventListener("load",this._handlePageLoad)):this.i0(),i==="auto"&&n&&!this.s.iso2?this._i4():this.h()}_i4(){r.autoCountry?this.handleAutoCountry():r.startedLoadingAutoCountry||(r.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(r.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._h(!0),b("rejectAutoCountryPromise"))},()=>{this._h(!0),b("rejectAutoCountryPromise")}))}_nWithPlus(){this._n(),this.searchInput.value="+",this._p3("",!0)}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n,allowDropdown:s,countrySearch:o}=this.d,u=!1;/\p{L}/u.test(this.a.value)&&(u=!0),this._a12=l=>{if(this.isAndroid&&l?.data==="+"&&i&&s&&o){let m=this.a.selectionStart||0,C=this.a.value.substring(0,m-1),g=this.a.value.substring(m);this.a.value=C+g,this._nWithPlus();return}this._v(this.a.value)&&this._8();let p=l?.data&&/[^+0-9]/.test(l.data),h=l?.inputType==="insertFromPaste"&&this.a.value;p||h&&!t?u=!0:/[^+0-9]/.test(this.a.value)||(u=!1);let d=l?.detail&&l.detail.isSetNumber&&!n;if(e&&!u&&!d){let m=this.a.selectionStart||0,g=this.a.value.substring(0,m).replace(/[^+0-9]/g,"").length,y=l?.inputType==="deleteContentForward",v=this._9(),_=W(g,v,m,y);this.a.value=v,this.a.setSelectionRange(_,_)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=l=>{if(l.key&&l.key.length===1&&!l.altKey&&!l.ctrlKey&&!l.metaKey){if(i&&s&&o&&l.key==="+"){l.preventDefault(),this._nWithPlus();return}if(t){let p=this.a.value,h=p.charAt(0)==="+",d=!h&&this.a.selectionStart===0&&l.key==="+",m=/^[0-9]$/.test(l.key),C=i?m:d||m,g=p.slice(0,this.a.selectionStart)+l.key+p.slice(this.a.selectionEnd),y=this._6(g),v=r.utils.getCoreNumber(y,this.s.iso2),_=this.maxCoreNumberLength&&v.length>this.maxCoreNumberLength,E=!1;if(h){let x=this.s.iso2;E=this._getCountryFromNumber(y)!==x}(!C||_&&!E&&!d)&&l.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t,countrySearch:e}=this.d;if(t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),e){let i=this.countryList.firstElementChild;i&&(this._x(i,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2);let e="",i=null;if(this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let n=()=>{let o=this.searchInput.value.trim();o?this._p3(o):this._p3("",!0)},s=null;this._a7=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",o=>o.stopPropagation())}}_searchForCountry(t){for(let e=0;e<this.p.length;e++){let i=this.p[e];if(i.name.substr(0,t.length).toLowerCase()===t){let s=i.nodeById[this.id];this._x(s,!1),this._3(s);break}}}_p3(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=k(t);for(let s=0;s<this.p.length;s++){let o=this.p[s],u=k(o.name),l=o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(h=>h[0]).join("").toLowerCase(),p=`+${o.dialCode}`;if(e||u.includes(n)||p.includes(n)||o.iso2.includes(n)||l.includes(n)){let h=o.nodeById[this.id];h&&this.countryList.appendChild(h),i&&(this._x(h,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&r.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=r.utils.numberFormat,o=i?n:s;e=r.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=this._getCountryFromNumber(t);return e!==null?this._z(e):!1}_getCountryFromNumber(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),u=I(i);if(o){let l=this.q[I(o)],p=l.indexOf(this.s.iso2)!==-1&&u.length<=o.length-1;if(!(n==="1"&&M(u))&&!p){for(let d=0;d<l.length;d++)if(l[d])return l[d]}}else{if(i.charAt(0)==="+"&&u.length)return"";if((!i||i==="+")&&!this.s.iso2)return this.j}return null}_x(t,e){let i=this.c;if(i&&(i.classList.remove("iti__highlight"),i.setAttribute("aria-selected","false")),this.c=t,this.c){this.c.classList.add("iti__highlight"),this.c.setAttribute("aria-selected","true");let n=this.c.getAttribute("id")||"";this.selectedCountry.setAttribute("aria-activedescendant",n),this.d.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",n)}e&&this.c.focus()}_y(t,e){for(let i=0;i<this.p.length;i++)if(this.p[i].iso2===t)return this.p[i];if(e)return null;throw new Error(`No country data for '${t}'`)}_z(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.d,s=this.s.iso2?this.s:{};if(this.s=t?this._y(t,!1)||{}:{},this.s.iso2&&(this.j=this.s.iso2),this.l){let o="",u="";t&&i?(o=`iti__flag iti__${t}`,u=`${this.s.name} +${this.s.dialCode}`):(o="iti__flag iti__globe",u=n.noCountrySelected),this.l.className=o,this.selectedCountryA11yText.textContent=u}if(this._z3(t,e),e){let o=this.s.dialCode?`+${this.s.dialCode}`:"";this.t.innerHTML=o,this._updateInputPadding()}return this._0(),this._updateMaxLength(),s.iso2!==t}_updateInputPadding(){if(this.selectedCountry){let e=(this.selectedCountry.offsetWidth||this._z2())+6;this.showSelectedCountryOnLeft?this.a.style.paddingLeft=`${e}px`:this.a.style.paddingRight=`${e}px`}}_updateMaxLength(){let{strictMode:t,placeholderNumberType:e,validationNumberType:i}=this.d,{iso2:n}=this.s;if(t&&r.utils)if(n){let s=r.utils.numberType[e],o=r.utils.getExampleNumber(n,!1,s,!0),u=o;for(;r.utils.isPossibleNumber(o,n,i);)u=o,o+="0";let l=r.utils.getCoreNumber(u,n);this.maxCoreNumberLength=l.length,n==="by"&&(this.maxCoreNumberLength=l.length+1)}else this.maxCoreNumberLength=null}_z3(t=null,e){if(!this.selectedCountry)return;let i;t&&!e?i=`${this.s.name}: +${this.s.dialCode}`:t?i=this.s.name:i="Unknown",this.selectedCountry.setAttribute("title",i)}_z2(){if(this.a.parentNode){let t=this.a.parentNode.cloneNode(!1);t.style.visibility="hidden",document.body.appendChild(t);let e=this.k.cloneNode();t.appendChild(e);let i=this.selectedCountry.cloneNode(!0);e.appendChild(i);let n=i.offsetWidth;return document.body.removeChild(t),n}return 0}_0(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.d,s=t==="aggressive"||!this.e&&t==="polite";if(r.utils&&s){let o=r.utils.numberType[e],u=this.s.iso2?r.utils.getExampleNumber(this.s.iso2,i,o):"";u=this._7(u),typeof n=="function"&&(u=n(u,this.s)),this.a.setAttribute("placeholder",u)}}_1(t){let e=this._z(t.getAttribute("data-country-code"));this._2(),this._4(t.getAttribute("data-dial-code")),this.a.focus(),e&&this._8()}_2(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.c&&this.c.setAttribute("aria-selected","false"),this.d.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),this.d.countrySearch&&this.searchInput.removeEventListener("input",this._a7),document.documentElement.removeEventListener("click",this._a2),this.countryList.removeEventListener("mouseover",this._a0),this.countryList.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.d.useFullscreenPopup||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._handlePageLoad&&window.removeEventListener("load",this._handlePageLoad),this._trigger("close:countrydropdown")}_3(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,o=s+n,u=t.offsetHeight,l=t.getBoundingClientRect().top+i,p=l+u,h=l-s+e.scrollTop;if(l<s)e.scrollTop=h;else if(p>o){let d=n-u;e.scrollTop=h-d}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s<t.length;s++){let o=t.charAt(s);if(!isNaN(parseInt(o,10))){if(n+=o,e)this.q[n]&&(i=t.substr(0,s+1));else if(this.dialCodes[n]){i=t.substr(0,s+1);break}if(n.length===this.dialCodeMaxLen)break}}}return i}_6(t){let e=t||this.a.value.trim(),{dialCode:i}=this.s,n,s=I(e);return this.d.separateDialCode&&e.charAt(0)!=="+"&&i&&s?n=`+${i}`:n="",n+e}_7(t){let e=t;if(this.d.separateDialCode){let i=this._5(e);if(i){i=`+${this.s.dialCode}`;let n=e[i.length]===" "||e[i.length]==="-"?i.length+1:i.length;e=e.substr(n)}}return this._j2(e)}_8(){this._trigger("countrychange")}_9(){let t=this._6(),e=r.utils?r.utils.formatNumberAsYouType(t,this.s.iso2):t,{dialCode:i}=this.s;return this.d.separateDialCode&&this.a.value.charAt(0)!=="+"&&e.includes(`+${i}`)?(e.split(`+${i}`)[1]||"").trim():e}handleAutoCountry(){this.d.initialCountry==="auto"&&r.autoCountry&&(this.j=r.autoCountry,this.s.iso2||this.l.classList.contains("iti__globe")||this.setCountry(this.j),this.h())}handleUtils(){r.utils&&(this.a.value&&this._u(this.a.value),this.s.iso2&&(this._0(),this._updateMaxLength())),this.i0()}destroy(){let{allowDropdown:t,separateDialCode:e}=this.d;if(t){this._2(),this.selectedCountry.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);let s=this.a.closest("label");s&&s.removeEventListener("click",this._a9)}let{form:i}=this.a;this._a14&&i&&i.removeEventListener("submit",this._a14),this.a.removeEventListener("input",this._a12),this._handleKeydownEvent&&this.a.removeEventListener("keydown",this._handleKeydownEvent),this.a.removeAttribute("data-intl-tel-input-id"),e&&(this.isRTL?this.a.style.paddingRight=this.originalPaddingRight:this.a.style.paddingLeft=this.originalPaddingLeft);let n=this.a.parentNode;n?.parentNode?.insertBefore(this.a,n),n?.parentNode?.removeChild(n),delete r.instances[this.id]}getExtension(){return r.utils?r.utils.getExtension(this._6(),this.s.iso2):""}getNumber(t){if(r.utils){let{iso2:e}=this.s;return r.utils.formatNumber(this._6(),e,t)}return""}getNumberType(){return r.utils?r.utils.getNumberType(this._6(),this.s.iso2):-99}getSelectedCountryData(){return this.s}getValidationError(){if(r.utils){let{iso2:t}=this.s;return r.utils.getValidationError(this._6(),t)}return-99}isValidNumber(){if(!this.s.iso2)return!1;let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsPossibleNumber(i),s=this._utilsIsPossibleNumber(t);return n&&s}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return r.utils?r.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){if(!this.s.iso2)return!1;let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsValidNumber(i),s=this._utilsIsValidNumber(t);return n&&s}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return r.utils?r.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}setDisabled(t){this.a.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},G=a=>{if(!r.utils&&!r.startedLoadingUtilsScript){let t;if(typeof a=="string")t=import(/* webpackIgnore: true */ a);else if(typeof a=="function")try{t=Promise.resolve(a())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof a}`));return r.startedLoadingUtilsScript=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="object")throw typeof a=="string"?new TypeError(`The module loaded from ${a} did not set utils as its default export.`):new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");return r.utils=i,b("handleUtils"),!0}).catch(e=>{throw b("rejectUtilsScriptPromise",e),e})}return null},r=Object.assign((a,t)=>{let e=new w(a,t);return e._init(),a.setAttribute("data-intl-tel-input-id",e.id.toString()),r.instances[e.id]=e,e},{defaults:P,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:a=>{let t=a.getAttribute("data-intl-tel-input-id");return t?r.instances[t]:null},instances:{},loadUtils:G,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"24.8.1"}),q=r;return B(Y);})();
|
|
16
|
+
var factoryOutput=(()=>{var L=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var F=(a,t)=>{for(var e in t)L(a,e,{get:t[e],enumerable:!0})},B=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!R.call(a,n)&&n!==e&&L(a,n,{get:()=>t[n],enumerable:!(i=O(t,n))||i.enumerable});return a};var j=a=>B(L({},"__esModule",{value:!0}),a);var Y={};F(Y,{Iti:()=>w,default:()=>q});var D=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],N=[];for(let a=0;a<D.length;a++){let t=D[a];N[a]={name:"",iso2:t[0],dialCode:t[1],priority:t[2]||0,areaCodes:t[3]||null,nodeById:{}}}var f=N;var U={ad:"Andorra",ae:"United Arab Emirates",af:"Afghanistan",ag:"Antigua & Barbuda",ai:"Anguilla",al:"Albania",am:"Armenia",ao:"Angola",ar:"Argentina",as:"American Samoa",at:"Austria",au:"Australia",aw:"Aruba",ax:"\xC5land Islands",az:"Azerbaijan",ba:"Bosnia & Herzegovina",bb:"Barbados",bd:"Bangladesh",be:"Belgium",bf:"Burkina Faso",bg:"Bulgaria",bh:"Bahrain",bi:"Burundi",bj:"Benin",bl:"St. Barth\xE9lemy",bm:"Bermuda",bn:"Brunei",bo:"Bolivia",bq:"Caribbean Netherlands",br:"Brazil",bs:"Bahamas",bt:"Bhutan",bw:"Botswana",by:"Belarus",bz:"Belize",ca:"Canada",cc:"Cocos (Keeling) Islands",cd:"Congo - Kinshasa",cf:"Central African Republic",cg:"Congo - Brazzaville",ch:"Switzerland",ci:"C\xF4te d\u2019Ivoire",ck:"Cook Islands",cl:"Chile",cm:"Cameroon",cn:"China",co:"Colombia",cr:"Costa Rica",cu:"Cuba",cv:"Cape Verde",cw:"Cura\xE7ao",cx:"Christmas Island",cy:"Cyprus",cz:"Czechia",de:"Germany",dj:"Djibouti",dk:"Denmark",dm:"Dominica",do:"Dominican Republic",dz:"Algeria",ec:"Ecuador",ee:"Estonia",eg:"Egypt",eh:"Western Sahara",er:"Eritrea",es:"Spain",et:"Ethiopia",fi:"Finland",fj:"Fiji",fk:"Falkland Islands",fm:"Micronesia",fo:"Faroe Islands",fr:"France",ga:"Gabon",gb:"United Kingdom",gd:"Grenada",ge:"Georgia",gf:"French Guiana",gg:"Guernsey",gh:"Ghana",gi:"Gibraltar",gl:"Greenland",gm:"Gambia",gn:"Guinea",gp:"Guadeloupe",gq:"Equatorial Guinea",gr:"Greece",gt:"Guatemala",gu:"Guam",gw:"Guinea-Bissau",gy:"Guyana",hk:"Hong Kong SAR China",hn:"Honduras",hr:"Croatia",ht:"Haiti",hu:"Hungary",id:"Indonesia",ie:"Ireland",il:"Israel",im:"Isle of Man",in:"India",io:"British Indian Ocean Territory",iq:"Iraq",ir:"Iran",is:"Iceland",it:"Italy",je:"Jersey",jm:"Jamaica",jo:"Jordan",jp:"Japan",ke:"Kenya",kg:"Kyrgyzstan",kh:"Cambodia",ki:"Kiribati",km:"Comoros",kn:"St. Kitts & Nevis",kp:"North Korea",kr:"South Korea",kw:"Kuwait",ky:"Cayman Islands",kz:"Kazakhstan",la:"Laos",lb:"Lebanon",lc:"St. Lucia",li:"Liechtenstein",lk:"Sri Lanka",lr:"Liberia",ls:"Lesotho",lt:"Lithuania",lu:"Luxembourg",lv:"Latvia",ly:"Libya",ma:"Morocco",mc:"Monaco",md:"Moldova",me:"Montenegro",mf:"St. Martin",mg:"Madagascar",mh:"Marshall Islands",mk:"North Macedonia",ml:"Mali",mm:"Myanmar (Burma)",mn:"Mongolia",mo:"Macao SAR China",mp:"Northern Mariana Islands",mq:"Martinique",mr:"Mauritania",ms:"Montserrat",mt:"Malta",mu:"Mauritius",mv:"Maldives",mw:"Malawi",mx:"Mexico",my:"Malaysia",mz:"Mozambique",na:"Namibia",nc:"New Caledonia",ne:"Niger",nf:"Norfolk Island",ng:"Nigeria",ni:"Nicaragua",nl:"Netherlands",no:"Norway",np:"Nepal",nr:"Nauru",nu:"Niue",nz:"New Zealand",om:"Oman",pa:"Panama",pe:"Peru",pf:"French Polynesia",pg:"Papua New Guinea",ph:"Philippines",pk:"Pakistan",pl:"Poland",pm:"St. Pierre & Miquelon",pr:"Puerto Rico",ps:"Palestinian Territories",pt:"Portugal",pw:"Palau",py:"Paraguay",qa:"Qatar",re:"R\xE9union",ro:"Romania",rs:"Serbia",ru:"Russia",rw:"Rwanda",sa:"Saudi Arabia",sb:"Solomon Islands",sc:"Seychelles",sd:"Sudan",se:"Sweden",sg:"Singapore",sh:"St. Helena",si:"Slovenia",sj:"Svalbard & Jan Mayen",sk:"Slovakia",sl:"Sierra Leone",sm:"San Marino",sn:"Senegal",so:"Somalia",sr:"Suriname",ss:"South Sudan",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sv:"El Salvador",sx:"Sint Maarten",sy:"Syria",sz:"Eswatini",tc:"Turks & Caicos Islands",td:"Chad",tg:"Togo",th:"Thailand",tj:"Tajikistan",tk:"Tokelau",tl:"Timor-Leste",tm:"Turkmenistan",tn:"Tunisia",to:"Tonga",tr:"Turkey",tt:"Trinidad & Tobago",tv:"Tuvalu",tw:"Taiwan",tz:"Tanzania",ua:"Ukraine",ug:"Uganda",us:"United States",uy:"Uruguay",uz:"Uzbekistan",va:"Vatican City",vc:"St. Vincent & Grenadines",ve:"Venezuela",vg:"British Virgin Islands",vi:"U.S. Virgin Islands",vn:"Vietnam",vu:"Vanuatu",wf:"Wallis & Futuna",ws:"Samoa",ye:"Yemen",yt:"Mayotte",za:"South Africa",zm:"Zambia",zw:"Zimbabwe"},A=U;var z={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"},S=z;var K={...A,...S},T=K;for(let a=0;a<f.length;a++)f[a].name=T[f[a].iso2];var V=0,P={allowDropdown:!0,autoPlaceholder:"polite",containerClass:"",countryOrder:null,countrySearch:!0,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",loadUtils:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,validationNumberTypes:["MOBILE"]},$=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],I=a=>a.replace(/\D/g,""),k=(a="")=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),M=a=>{let t=I(a);if(t.charAt(0)==="1"){let e=t.substr(1,3);return $.indexOf(e)!==-1}return!1},W=(a,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===a&&!i)return s+1;if(i&&n===a+1)return s}return t.length},c=(a,t,e)=>{let i=document.createElement(a);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=(a,...t)=>{let{instances:e}=r;Object.values(e).forEach(i=>i[a](...t))},w=class{constructor(t,e={}){this.id=V++,this.a=t,this.c=null,this.d=Object.assign({},P,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.onlyCountries.length===1&&(this.d.initialCountry=this.d.onlyCountries[0]),this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.allowDropdown&&!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]");let t=this.d.allowDropdown||this.d.separateDialCode;this.showSelectedCountryOnLeft=this.isRTL?!t:t,this.d.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.a.style.paddingRight:this.originalPaddingLeft=this.a.style.paddingLeft),this.d.i18n={...T,...this.d.i18n};let e=new Promise((n,s)=>{this.h=n,this.i=s}),i=new Promise((n,s)=>{this.i0=n,this.i1=s});this.promise=Promise.all([e,i]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this._sortCountries()}_sortCountries(){this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,u=s>-1;if(o||u)return o&&u?n-s:o?-1:1}return t.name.localeCompare(e.name)})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;s<this.q[e].length;s++)if(this.q[e][s]===t)return;let n=i!==void 0?i:this.q[e].length;this.q[e][n]=t}_d(){let{onlyCountries:t,excludeCountries:e}=this.d;if(t.length){let i=t.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=f}_d0(){for(let t=0;t<this.p.length;t++){let e=this.p[t].iso2.toLowerCase();this.d.i18n.hasOwnProperty(e)&&(this.p[t].name=this.d.i18n[e])}}_d2(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(let t=0;t<this.p.length;t++){let e=this.p[t];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._c(e.iso2,e.dialCode,e.priority)}for(let t=0;t<this.p.length;t++){let e=this.p[t];if(e.areaCodes){let i=this.q[e.dialCode][0];for(let n=0;n<e.areaCodes.length;n++){let s=e.areaCodes[n];for(let o=1;o<s.length;o++){let u=e.dialCode+s.substr(0,o);this._c(i,u),this._c(e.iso2,u)}this._c(e.iso2,e.dialCode+s)}}}}_f(){this.a.classList.add("iti__tel-input"),!this.a.hasAttribute("autocomplete")&&!(this.a.form&&this.a.form.hasAttribute("autocomplete"))&&this.a.setAttribute("autocomplete","off");let{allowDropdown:t,separateDialCode:e,showFlags:i,containerClass:n,hiddenInput:s,dropdownContainer:o,fixDropdownWidth:u,useFullscreenPopup:l,countrySearch:p,i18n:h}=this.d,d="iti";t&&(d+=" iti--allow-dropdown"),i&&(d+=" iti--show-flags"),n&&(d+=` ${n}`),l||(d+=" iti--inline-dropdown");let m=c("div",{class:d});if(this.a.parentNode?.insertBefore(m,this.a),t||i||e){this.k=c("div",{class:"iti__country-container"},m),this.showSelectedCountryOnLeft?this.k.style.left="0px":this.k.style.right="0px",t?(this.selectedCountry=c("button",{type:"button",class:"iti__selected-country","aria-expanded":"false","aria-label":this.d.i18n.selectedCountryAriaLabel,"aria-haspopup":"true","aria-controls":`iti-${this.id}__dropdown-content`,role:"combobox"},this.k),this.a.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=c("div",{class:"iti__selected-country"},this.k);let y=c("div",{class:"iti__selected-country-primary"},this.selectedCountry);if(this.l=c("div",{class:"iti__flag"},y),this.selectedCountryA11yText=c("span",{class:"iti__a11y-text"},this.l),t&&(this.u=c("div",{class:"iti__arrow","aria-hidden":"true"},y)),e&&(this.t=c("div",{class:"iti__selected-dial-code"},this.selectedCountry)),t){let C=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=c("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${C}`}),p&&(this.searchInput=c("input",{type:"text",class:"iti__search-input",placeholder:h.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":h.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=c("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=c("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":h.countryListAriaLabel},this.dropdownContent),this._g(),p&&this._p4(),o){let g="iti iti--container";l?g+=" iti--fullscreen-popup":g+=" iti--inline-dropdown",this.dropdown=c("div",{class:g}),this.dropdown.appendChild(this.dropdownContent)}else this.k.appendChild(this.dropdownContent)}}if(m.appendChild(this.a),this._updateInputPadding(),s){let y=this.a.getAttribute("name")||"",C=s(y);C.phone&&(this.hiddenInput=c("input",{type:"hidden",name:C.phone}),m.appendChild(this.hiddenInput)),C.country&&(this.hiddenInputCountry=c("input",{type:"hidden",name:C.country}),m.appendChild(this.hiddenInputCountry))}}_g(){for(let t=0;t<this.p.length;t++){let e=this.p[t],i=t===0?"iti__highlight":"",n=c("li",{id:`iti-${this.id}__item-${e.iso2}`,class:`iti__country ${i}`,tabindex:"-1",role:"option","data-dial-code":e.dialCode,"data-country-code":e.iso2,"aria-selected":"false"},this.countryList);e.nodeById[this.id]=n;let s="";this.d.showFlags&&(s+=`<div class='iti__flag iti__${e.iso2}'></div>`),s+=`<span class='iti__country-name'>${e.name}</span>`,s+=`<span class='iti__dial-code'>+${e.dialCode}</span>`,n.insertAdjacentHTML("beforeend",s)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),u=M(s),{initialCountry:l,geoIpLookup:p}=this.d,h=l==="auto"&&p;if(o&&!u)this._v(s);else if(!h||t){let d=l?l.toLowerCase():"";d&&this._y(d,!0)?this._z(d):o&&u?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{loadUtils:t,initialCountry:e,geoIpLookup:i}=this.d;t&&!r.utils?(this._handlePageLoad=()=>{window.removeEventListener("load",this._handlePageLoad),r.attachUtils(t)?.catch(()=>{})},r.documentReady()?this._handlePageLoad():window.addEventListener("load",this._handlePageLoad)):this.i0(),e==="auto"&&i&&!this.s.iso2?this._i4():this.h()}_i4(){r.autoCountry?this.handleAutoCountry():r.startedLoadingAutoCountry||(r.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(r.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._h(!0),b("rejectAutoCountryPromise"))},()=>{this._h(!0),b("rejectAutoCountryPromise")}))}_nWithPlus(){this._n(),this.searchInput.value="+",this._p3("",!0)}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n,allowDropdown:s,countrySearch:o}=this.d,u=!1;/\p{L}/u.test(this.a.value)&&(u=!0),this._a12=l=>{if(this.isAndroid&&l?.data==="+"&&i&&s&&o){let m=this.a.selectionStart||0,y=this.a.value.substring(0,m-1),C=this.a.value.substring(m);this.a.value=y+C,this._nWithPlus();return}this._v(this.a.value)&&this._8();let p=l?.data&&/[^+0-9]/.test(l.data),h=l?.inputType==="insertFromPaste"&&this.a.value;p||h&&!t?u=!0:/[^+0-9]/.test(this.a.value)||(u=!1);let d=l?.detail&&l.detail.isSetNumber&&!n;if(e&&!u&&!d){let m=this.a.selectionStart||0,C=this.a.value.substring(0,m).replace(/[^+0-9]/g,"").length,g=l?.inputType==="deleteContentForward",v=this._9(),_=W(C,v,m,g);this.a.value=v,this.a.setSelectionRange(_,_)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=l=>{if(l.key&&l.key.length===1&&!l.altKey&&!l.ctrlKey&&!l.metaKey){if(i&&s&&o&&l.key==="+"){l.preventDefault(),this._nWithPlus();return}if(t){let p=this.a.value,h=p.charAt(0)==="+",d=!h&&this.a.selectionStart===0&&l.key==="+",m=/^[0-9]$/.test(l.key),y=i?m:d||m,C=p.slice(0,this.a.selectionStart)+l.key+p.slice(this.a.selectionEnd),g=this._6(C),v=r.utils.getCoreNumber(g,this.s.iso2),_=this.maxCoreNumberLength&&v.length>this.maxCoreNumberLength,E=!1;if(h){let x=this.s.iso2;E=this._getCountryFromNumber(g)!==x}(!y||_&&!E&&!d)&&l.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t,countrySearch:e}=this.d;if(t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),e){let i=this.countryList.firstElementChild;i&&(this._x(i,!1),this.countryList.scrollTop=0),this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2);let e="",i=null;if(this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let n=()=>{let o=this.searchInput.value.trim();o?this._p3(o):this._p3("",!0)},s=null;this._a7=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",o=>o.stopPropagation())}}_searchForCountry(t){for(let e=0;e<this.p.length;e++){let i=this.p[e];if(i.name.substr(0,t.length).toLowerCase()===t){let s=i.nodeById[this.id];this._x(s,!1),this._3(s);break}}}_p3(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=k(t);for(let s=0;s<this.p.length;s++){let o=this.p[s],u=k(o.name),l=o.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(h=>h[0]).join("").toLowerCase(),p=`+${o.dialCode}`;if(e||u.includes(n)||p.includes(n)||o.iso2.includes(n)||l.includes(n)){let h=o.nodeById[this.id];h&&this.countryList.appendChild(h),i&&(this._x(h,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&r.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=r.utils.numberFormat,o=i?n:s;e=r.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=this._getCountryFromNumber(t);return e!==null?this._z(e):!1}_getCountryFromNumber(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),u=I(i);if(o){let l=this.q[I(o)],p=l.indexOf(this.s.iso2)!==-1&&u.length<=o.length-1;if(!(n==="1"&&M(u))&&!p){for(let d=0;d<l.length;d++)if(l[d])return l[d]}}else{if(i.charAt(0)==="+"&&u.length)return"";if((!i||i==="+")&&!this.s.iso2)return this.j}return null}_x(t,e){let i=this.c;if(i&&(i.classList.remove("iti__highlight"),i.setAttribute("aria-selected","false")),this.c=t,this.c){this.c.classList.add("iti__highlight"),this.c.setAttribute("aria-selected","true");let n=this.c.getAttribute("id")||"";this.selectedCountry.setAttribute("aria-activedescendant",n),this.d.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",n)}e&&this.c.focus()}_y(t,e){for(let i=0;i<this.p.length;i++)if(this.p[i].iso2===t)return this.p[i];if(e)return null;throw new Error(`No country data for '${t}'`)}_z(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.d,s=this.s.iso2?this.s:{};if(this.s=t?this._y(t,!1)||{}:{},this.s.iso2&&(this.j=this.s.iso2),this.l){let o="",u="";t&&i?(o=`iti__flag iti__${t}`,u=`${this.s.name} +${this.s.dialCode}`):(o="iti__flag iti__globe",u=n.noCountrySelected),this.l.className=o,this.selectedCountryA11yText.textContent=u}if(this._z3(t,e),e){let o=this.s.dialCode?`+${this.s.dialCode}`:"";this.t.innerHTML=o,this._updateInputPadding()}return this._0(),this._updateMaxLength(),s.iso2!==t}_updateInputPadding(){if(this.selectedCountry){let e=(this.selectedCountry.offsetWidth||this._z2())+6;this.showSelectedCountryOnLeft?this.a.style.paddingLeft=`${e}px`:this.a.style.paddingRight=`${e}px`}}_updateMaxLength(){let{strictMode:t,placeholderNumberType:e,validationNumberTypes:i}=this.d,{iso2:n}=this.s;if(t&&r.utils)if(n){let s=r.utils.numberType[e],o=r.utils.getExampleNumber(n,!1,s,!0),u=o;for(;r.utils.isPossibleNumber(o,n,i);)u=o,o+="0";let l=r.utils.getCoreNumber(u,n);this.maxCoreNumberLength=l.length,n==="by"&&(this.maxCoreNumberLength=l.length+1)}else this.maxCoreNumberLength=null}_z3(t=null,e){if(!this.selectedCountry)return;let i;t&&!e?i=`${this.s.name}: +${this.s.dialCode}`:t?i=this.s.name:i="Unknown",this.selectedCountry.setAttribute("title",i)}_z2(){if(this.a.parentNode){let t=this.a.parentNode.cloneNode(!1);t.style.visibility="hidden",document.body.appendChild(t);let e=this.k.cloneNode();t.appendChild(e);let i=this.selectedCountry.cloneNode(!0);e.appendChild(i);let n=i.offsetWidth;return document.body.removeChild(t),n}return 0}_0(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.d,s=t==="aggressive"||!this.e&&t==="polite";if(r.utils&&s){let o=r.utils.numberType[e],u=this.s.iso2?r.utils.getExampleNumber(this.s.iso2,i,o):"";u=this._7(u),typeof n=="function"&&(u=n(u,this.s)),this.a.setAttribute("placeholder",u)}}_1(t){let e=this._z(t.getAttribute("data-country-code"));this._2(),this._4(t.getAttribute("data-dial-code")),this.a.focus(),e&&this._8()}_2(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.c&&this.c.setAttribute("aria-selected","false"),this.d.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),this.d.countrySearch&&this.searchInput.removeEventListener("input",this._a7),document.documentElement.removeEventListener("click",this._a2),this.countryList.removeEventListener("mouseover",this._a0),this.countryList.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.d.useFullscreenPopup||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._handlePageLoad&&window.removeEventListener("load",this._handlePageLoad),this._trigger("close:countrydropdown")}_3(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,o=s+n,u=t.offsetHeight,l=t.getBoundingClientRect().top+i,p=l+u,h=l-s+e.scrollTop;if(l<s)e.scrollTop=h;else if(p>o){let d=n-u;e.scrollTop=h-d}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s<t.length;s++){let o=t.charAt(s);if(!isNaN(parseInt(o,10))){if(n+=o,e)this.q[n]&&(i=t.substr(0,s+1));else if(this.dialCodes[n]){i=t.substr(0,s+1);break}if(n.length===this.dialCodeMaxLen)break}}}return i}_6(t){let e=t||this.a.value.trim(),{dialCode:i}=this.s,n,s=I(e);return this.d.separateDialCode&&e.charAt(0)!=="+"&&i&&s?n=`+${i}`:n="",n+e}_7(t){let e=t;if(this.d.separateDialCode){let i=this._5(e);if(i){i=`+${this.s.dialCode}`;let n=e[i.length]===" "||e[i.length]==="-"?i.length+1:i.length;e=e.substr(n)}}return this._j2(e)}_8(){this._trigger("countrychange")}_9(){let t=this._6(),e=r.utils?r.utils.formatNumberAsYouType(t,this.s.iso2):t,{dialCode:i}=this.s;return this.d.separateDialCode&&this.a.value.charAt(0)!=="+"&&e.includes(`+${i}`)?(e.split(`+${i}`)[1]||"").trim():e}handleAutoCountry(){this.d.initialCountry==="auto"&&r.autoCountry&&(this.j=r.autoCountry,this.s.iso2||this.l.classList.contains("iti__globe")||this.setCountry(this.j),this.h())}handleUtils(){r.utils&&(this.a.value&&this._u(this.a.value),this.s.iso2&&(this._0(),this._updateMaxLength())),this.i0()}destroy(){let{allowDropdown:t,separateDialCode:e}=this.d;if(t){this._2(),this.selectedCountry.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);let s=this.a.closest("label");s&&s.removeEventListener("click",this._a9)}let{form:i}=this.a;this._a14&&i&&i.removeEventListener("submit",this._a14),this.a.removeEventListener("input",this._a12),this._handleKeydownEvent&&this.a.removeEventListener("keydown",this._handleKeydownEvent),this.a.removeAttribute("data-intl-tel-input-id"),e&&(this.isRTL?this.a.style.paddingRight=this.originalPaddingRight:this.a.style.paddingLeft=this.originalPaddingLeft);let n=this.a.parentNode;n?.parentNode?.insertBefore(this.a,n),n?.parentNode?.removeChild(n),delete r.instances[this.id]}getExtension(){return r.utils?r.utils.getExtension(this._6(),this.s.iso2):""}getNumber(t){if(r.utils){let{iso2:e}=this.s;return r.utils.formatNumber(this._6(),e,t)}return""}getNumberType(){return r.utils?r.utils.getNumberType(this._6(),this.s.iso2):-99}getSelectedCountryData(){return this.s}getValidationError(){if(r.utils){let{iso2:t}=this.s;return r.utils.getValidationError(this._6(),t)}return-99}isValidNumber(){if(!this.s.iso2)return!1;let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsPossibleNumber(i),s=this._utilsIsPossibleNumber(t);return n&&s}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return r.utils?r.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberTypes):null}isValidNumberPrecise(){if(!this.s.iso2)return!1;let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsValidNumber(i),s=this._utilsIsValidNumber(t);return n&&s}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return r.utils?r.utils.isValidNumber(t,this.s.iso2,this.d.validationNumberTypes):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}setDisabled(t){this.a.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},G=a=>{if(!r.utils&&!r.startedLoadingUtilsScript){let t;if(typeof a=="function")try{t=Promise.resolve(a())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof a}`));return r.startedLoadingUtilsScript=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return r.utils=i,b("handleUtils"),!0}).catch(e=>{throw b("rejectUtilsScriptPromise",e),e})}return null},r=Object.assign((a,t)=>{let e=new w(a,t);return e._init(),a.setAttribute("data-intl-tel-input-id",e.id.toString()),r.instances[e.id]=e,e},{defaults:P,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:a=>{let t=a.getAttribute("data-intl-tel-input-id");return t?r.instances[t]:null},instances:{},attachUtils:G,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"25.0.0"}),q=r;return j(Y);})();
|
|
17
17
|
|
|
18
18
|
// UMD
|
|
19
19
|
return factoryOutput.default;
|