intl-tel-input 19.2.15 → 19.2.17
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 +18 -18
- package/build/css/intlTelInput.css +1 -1
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput-jquery.js +3 -4
- package/build/js/intlTelInput-jquery.min.js +3 -3
- package/build/js/intlTelInput.js +3 -4
- package/build/js/intlTelInput.min.js +3 -3
- package/composer.json +1 -1
- package/grunt/replace.js +0 -3
- package/package.json +1 -1
- package/react/build/IntlTelInput.cjs.js +1 -1
- package/react/build/IntlTelInput.cjs.js.map +2 -2
- package/react/build/IntlTelInput.esm.js +1 -1
- package/react/build/IntlTelInput.esm.js.map +2 -2
- package/react/demo/SimpleApp.js +1 -1
- package/react/demo/ValidationApp.js +1 -1
- package/react/demo/simple-bundle.js +641 -652
- package/react/demo/validation-bundle.js +646 -657
- package/src/css/intlTelInput.scss +1 -1
- package/src/js/intlTelInput.js +1 -2
|
@@ -5544,7 +5544,7 @@ var require_react_dom_development = __commonJS({
|
|
|
5544
5544
|
passiveBrowserEventsSupported = false;
|
|
5545
5545
|
}
|
|
5546
5546
|
}
|
|
5547
|
-
function invokeGuardedCallbackProd(name, func, context, a, b, c,
|
|
5547
|
+
function invokeGuardedCallbackProd(name, func, context, a, b, c, d2, e, f) {
|
|
5548
5548
|
var funcArgs = Array.prototype.slice.call(arguments, 3);
|
|
5549
5549
|
try {
|
|
5550
5550
|
func.apply(context, funcArgs);
|
|
@@ -5556,7 +5556,7 @@ var require_react_dom_development = __commonJS({
|
|
|
5556
5556
|
{
|
|
5557
5557
|
if (typeof window !== "undefined" && typeof window.dispatchEvent === "function" && typeof document !== "undefined" && typeof document.createEvent === "function") {
|
|
5558
5558
|
var fakeNode = document.createElement("react");
|
|
5559
|
-
invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c,
|
|
5559
|
+
invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d2, e, f) {
|
|
5560
5560
|
if (typeof document === "undefined" || document === null) {
|
|
5561
5561
|
throw new Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");
|
|
5562
5562
|
}
|
|
@@ -5631,12 +5631,12 @@ var require_react_dom_development = __commonJS({
|
|
|
5631
5631
|
caughtError = error2;
|
|
5632
5632
|
}
|
|
5633
5633
|
};
|
|
5634
|
-
function invokeGuardedCallback(name, func, context, a, b, c,
|
|
5634
|
+
function invokeGuardedCallback(name, func, context, a, b, c, d2, e, f) {
|
|
5635
5635
|
hasError = false;
|
|
5636
5636
|
caughtError = null;
|
|
5637
5637
|
invokeGuardedCallbackImpl$1.apply(reporter, arguments);
|
|
5638
5638
|
}
|
|
5639
|
-
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c,
|
|
5639
|
+
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d2, e, f) {
|
|
5640
5640
|
invokeGuardedCallback.apply(this, arguments);
|
|
5641
5641
|
if (hasError) {
|
|
5642
5642
|
var error2 = clearCaughtError();
|
|
@@ -20820,13 +20820,13 @@ var require_react_dom_development = __commonJS({
|
|
|
20820
20820
|
}
|
|
20821
20821
|
}
|
|
20822
20822
|
}
|
|
20823
|
-
function discreteUpdates(fn, a, b, c,
|
|
20823
|
+
function discreteUpdates(fn, a, b, c, d2) {
|
|
20824
20824
|
var previousPriority = getCurrentUpdatePriority();
|
|
20825
20825
|
var prevTransition = ReactCurrentBatchConfig$3.transition;
|
|
20826
20826
|
try {
|
|
20827
20827
|
ReactCurrentBatchConfig$3.transition = null;
|
|
20828
20828
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
20829
|
-
return fn(a, b, c,
|
|
20829
|
+
return fn(a, b, c, d2);
|
|
20830
20830
|
} finally {
|
|
20831
20831
|
setCurrentUpdatePriority(previousPriority);
|
|
20832
20832
|
ReactCurrentBatchConfig$3.transition = prevTransition;
|
|
@@ -24283,665 +24283,654 @@ var require_prop_types = __commonJS({
|
|
|
24283
24283
|
}
|
|
24284
24284
|
});
|
|
24285
24285
|
|
|
24286
|
-
// react/
|
|
24287
|
-
var
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
|
|
24291
|
-
|
|
24292
|
-
|
|
24293
|
-
|
|
24294
|
-
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
|
|
24307
|
-
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
24311
|
-
|
|
24312
|
-
|
|
24313
|
-
|
|
24314
|
-
|
|
24315
|
-
|
|
24316
|
-
|
|
24317
|
-
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24336
|
-
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
24286
|
+
// react/demo/ValidationApp.js
|
|
24287
|
+
var import_react2 = __toESM(require_react());
|
|
24288
|
+
var import_client = __toESM(require_client());
|
|
24289
|
+
|
|
24290
|
+
// react/build/IntlTelInput.esm.js
|
|
24291
|
+
var import_react = __toESM(require_react());
|
|
24292
|
+
var import_prop_types = __toESM(require_prop_types());
|
|
24293
|
+
var Z = Object.create;
|
|
24294
|
+
var j = Object.defineProperty;
|
|
24295
|
+
var $ = Object.getOwnPropertyDescriptor;
|
|
24296
|
+
var Q = Object.getOwnPropertyNames;
|
|
24297
|
+
var X = Object.getPrototypeOf;
|
|
24298
|
+
var tt = Object.prototype.hasOwnProperty;
|
|
24299
|
+
var et = (p, c) => () => (c || p((c = { exports: {} }).exports, c), c.exports);
|
|
24300
|
+
var it = (p, c, g, m) => {
|
|
24301
|
+
if (c && typeof c == "object" || typeof c == "function")
|
|
24302
|
+
for (let _ of Q(c))
|
|
24303
|
+
!tt.call(p, _) && _ !== g && j(p, _, { get: () => c[_], enumerable: !(m = $(c, _)) || m.enumerable });
|
|
24304
|
+
return p;
|
|
24305
|
+
};
|
|
24306
|
+
var nt = (p, c, g) => (g = p != null ? Z(X(p)) : {}, it(c || !p || !p.__esModule ? j(g, "default", { value: p, enumerable: true }) : g, p));
|
|
24307
|
+
var G = et((at, N) => {
|
|
24308
|
+
(function(p) {
|
|
24309
|
+
typeof N == "object" && N.exports ? N.exports = p() : window.intlTelInput = p();
|
|
24310
|
+
})(function(p) {
|
|
24311
|
+
"use strict";
|
|
24312
|
+
return function() {
|
|
24313
|
+
for (var c = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["American Samoa", "as", "1", 5, ["684"]], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Anguilla", "ai", "1", 6, ["264"]], ["Antigua & Barbuda", "ag", "1", 7, ["268"]], ["Argentina", "ar", "54"], ["Armenia", "am", "374"], ["Aruba", "aw", "297"], ["Ascension Island", "ac", "247"], ["Australia", "au", "61", 0], ["Austria", "at", "43"], ["Azerbaijan", "az", "994"], ["Bahamas", "bs", "1", 8, ["242"]], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1", 9, ["246"]], ["Belarus", "by", "375"], ["Belgium", "be", "32"], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bermuda", "bm", "1", 10, ["441"]], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia & Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "br", "55"], ["British Indian Ocean Territory", "io", "246"], ["British Virgin Islands", "vg", "1", 11, ["284"]], ["Brunei", "bn", "673"], ["Bulgaria", "bg", "359"], ["Burkina Faso", "bf", "226"], ["Burundi", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "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", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", 1, ["3", "4", "7"]], ["Cayman Islands", "ky", "1", 12, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "td", "235"], ["Chile", "cl", "56"], ["China", "cn", "86"], ["Christmas Island", "cx", "61", 2, ["89164"]], ["Cocos (Keeling) Islands", "cc", "61", 1, ["89162"]], ["Colombia", "co", "57"], ["Comoros", "km", "269"], ["Congo - Brazzaville", "cg", "242"], ["Congo - Kinshasa", "cd", "243"], ["Cook Islands", "ck", "682"], ["Costa Rica", "cr", "506"], ["C\xF4te d\u2019Ivoire", "ci", "225"], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Cura\xE7ao", "cw", "599", 0], ["Cyprus", "cy", "357"], ["Czech Republic", "cz", "420"], ["Denmark", "dk", "45"], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1", 13, ["767"]], ["Dominican Republic", "do", "1", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503"], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372"], ["Eswatini", "sz", "268"], ["Ethiopia", "et", "251"], ["Falkland Islands", "fk", "500"], ["Faroe Islands", "fo", "298"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", 0], ["France", "fr", "33"], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49"], ["Ghana", "gh", "233"], ["Gibraltar", "gi", "350"], ["Greece", "gr", "30"], ["Greenland", "gl", "299"], ["Grenada", "gd", "1", 14, ["473"]], ["Guadeloupe", "gp", "590", 0], ["Guam", "gu", "1", 15, ["671"]], ["Guatemala", "gt", "502"], ["Guernsey", "gg", "44", 1, ["1481", "7781", "7839", "7911"]], ["Guinea", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509"], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852"], ["Hungary", "hu", "36"], ["Iceland", "is", "354"], ["India", "in", "91"], ["Indonesia", "id", "62"], ["Iran", "ir", "98"], ["Iraq", "iq", "964"], ["Ireland", "ie", "353"], ["Isle of Man", "im", "44", 2, ["1624", "74576", "7524", "7924", "7624"]], ["Israel", "il", "972"], ["Italy", "it", "39", 0], ["Jamaica", "jm", "1", 4, ["876", "658"]], ["Japan", "jp", "81"], ["Jersey", "je", "44", 3, ["1534", "7509", "7700", "7797", "7829", "7937"]], ["Jordan", "jo", "962"], ["Kazakhstan", "kz", "7", 1, ["33", "7"]], ["Kenya", "ke", "254"], ["Kiribati", "ki", "686"], ["Kosovo", "xk", "383"], ["Kuwait", "kw", "965"], ["Kyrgyzstan", "kg", "996"], ["Laos", "la", "856"], ["Latvia", "lv", "371"], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Madagascar", "mg", "261"], ["Malawi", "mw", "265"], ["Malaysia", "my", "60"], ["Maldives", "mv", "960"], ["Mali", "ml", "223"], ["Malta", "mt", "356"], ["Marshall Islands", "mh", "692"], ["Martinique", "mq", "596"], ["Mauritania", "mr", "222"], ["Mauritius", "mu", "230"], ["Mayotte", "yt", "262", 1, ["269", "639"]], ["Mexico", "mx", "52"], ["Micronesia", "fm", "691"], ["Moldova", "md", "373"], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Montserrat", "ms", "1", 16, ["664"]], ["Morocco", "ma", "212", 0], ["Mozambique", "mz", "258"], ["Myanmar (Burma)", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31"], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64"], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["Niue", "nu", "683"], ["Norfolk Island", "nf", "672"], ["North Korea", "kp", "850"], ["North Macedonia", "mk", "389"], ["Northern Mariana Islands", "mp", "1", 17, ["670"]], ["Norway", "no", "47", 0], ["Oman", "om", "968"], ["Pakistan", "pk", "92"], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63"], ["Poland", "pl", "48"], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["R\xE9union", "re", "262", 0], ["Romania", "ro", "40"], ["Russia", "ru", "7", 0], ["Rwanda", "rw", "250"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["S\xE3o Tom\xE9 & Pr\xEDncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65"], ["Sint Maarten", "sx", "1", 21, ["721"]], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82"], ["South Sudan", "ss", "211"], ["Spain", "es", "34"], ["Sri Lanka", "lk", "94"], ["St Barth\xE9lemy", "bl", "590", 1], ["St Helena", "sh", "290"], ["St Kitts & Nevis", "kn", "1", 18, ["869"]], ["St Lucia", "lc", "1", 19, ["758"]], ["St Martin", "mf", "590", 2], ["St Pierre & Miquelon", "pm", "508"], ["St Vincent & Grenadines", "vc", "1", 20, ["784"]], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Svalbard & Jan Mayen", "sj", "47", 1, ["79"]], ["Sweden", "se", "46"], ["Switzerland", "ch", "41"], ["Syria", "sy", "963"], ["Taiwan", "tw", "886"], ["Tajikistan", "tj", "992"], ["Tanzania", "tz", "255"], ["Thailand", "th", "66"], ["Timor-Leste", "tl", "670"], ["Togo", "tg", "228"], ["Tokelau", "tk", "690"], ["Tonga", "to", "676"], ["Trinidad & Tobago", "tt", "1", 22, ["868"]], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90"], ["Turkmenistan", "tm", "993"], ["Turks & Caicos Islands", "tc", "1", 23, ["649"]], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380"], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", "598"], ["US Virgin Islands", "vi", "1", 24, ["340"]], ["Uzbekistan", "uz", "998"], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", 1, ["06698"]], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Wallis & Futuna", "wf", "681"], ["Western Sahara", "eh", "212", 1, ["5288", "5289"]], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"], ["\xC5land Islands", "ax", "358", 1, ["18"]]], g = 0; g < c.length; g++) {
|
|
24314
|
+
var m = c[g];
|
|
24315
|
+
c[g] = { name: m[0], iso2: m[1], dialCode: m[2], priority: m[3] || 0, areaCodes: m[4] || null, nodeById: {} };
|
|
24316
|
+
}
|
|
24317
|
+
function _(s) {
|
|
24318
|
+
for (var n = 1; n < arguments.length; n++) {
|
|
24319
|
+
var t = arguments[n] != null ? Object(arguments[n]) : {}, e = Object.keys(t);
|
|
24320
|
+
typeof Object.getOwnPropertySymbols == "function" && e.push.apply(e, Object.getOwnPropertySymbols(t).filter(function(i) {
|
|
24321
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
24322
|
+
})), e.forEach(function(i) {
|
|
24323
|
+
T(s, i, t[i]);
|
|
24324
|
+
});
|
|
24325
|
+
}
|
|
24326
|
+
return s;
|
|
24327
|
+
}
|
|
24328
|
+
function T(s, n, t) {
|
|
24329
|
+
return n = k(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
|
|
24330
|
+
}
|
|
24331
|
+
function F(s, n) {
|
|
24332
|
+
return C(s) || w(s, n) || x(s, n) || P();
|
|
24333
|
+
}
|
|
24334
|
+
function P() {
|
|
24335
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
24337
24336
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
24337
|
+
}
|
|
24338
|
+
function x(s, n) {
|
|
24339
|
+
if (s) {
|
|
24340
|
+
if (typeof s == "string")
|
|
24341
|
+
return S(s, n);
|
|
24342
|
+
var t = Object.prototype.toString.call(s).slice(8, -1);
|
|
24343
|
+
if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
|
|
24344
|
+
return Array.from(s);
|
|
24345
|
+
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
|
|
24346
|
+
return S(s, n);
|
|
24347
|
+
}
|
|
24348
|
+
}
|
|
24349
|
+
function S(s, n) {
|
|
24350
|
+
(n == null || n > s.length) && (n = s.length);
|
|
24351
|
+
for (var t = 0, e = new Array(n); t < n; t++)
|
|
24352
|
+
e[t] = s[t];
|
|
24353
|
+
return e;
|
|
24354
|
+
}
|
|
24355
|
+
function w(s, n) {
|
|
24356
|
+
var t = s == null ? null : typeof Symbol < "u" && s[Symbol.iterator] || s["@@iterator"];
|
|
24357
|
+
if (t != null) {
|
|
24358
|
+
var e, i, o, r, a = [], l = true, u = false;
|
|
24359
|
+
try {
|
|
24360
|
+
if (o = (t = t.call(s)).next, n === 0) {
|
|
24361
|
+
if (Object(t) !== t)
|
|
24362
|
+
return;
|
|
24363
|
+
l = false;
|
|
24364
|
+
} else
|
|
24365
|
+
for (; !(l = (e = o.call(t)).done) && (a.push(e.value), a.length !== n); l = true)
|
|
24366
|
+
;
|
|
24367
|
+
} catch (h) {
|
|
24368
|
+
u = true, i = h;
|
|
24369
|
+
} finally {
|
|
24370
|
+
try {
|
|
24371
|
+
if (!l && t.return != null && (r = t.return(), Object(r) !== r))
|
|
24372
|
+
return;
|
|
24373
|
+
} finally {
|
|
24374
|
+
if (u)
|
|
24375
|
+
throw i;
|
|
24376
|
+
}
|
|
24338
24377
|
}
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24350
|
-
|
|
24351
|
-
|
|
24352
|
-
|
|
24353
|
-
|
|
24378
|
+
return a;
|
|
24379
|
+
}
|
|
24380
|
+
}
|
|
24381
|
+
function C(s) {
|
|
24382
|
+
if (Array.isArray(s))
|
|
24383
|
+
return s;
|
|
24384
|
+
}
|
|
24385
|
+
function I(s, n) {
|
|
24386
|
+
if (!(s instanceof n))
|
|
24387
|
+
throw new TypeError("Cannot call a class as a function");
|
|
24388
|
+
}
|
|
24389
|
+
function b(s, n) {
|
|
24390
|
+
for (var t = 0; t < n.length; t++) {
|
|
24391
|
+
var e = n[t];
|
|
24392
|
+
e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, k(e.key), e);
|
|
24393
|
+
}
|
|
24394
|
+
}
|
|
24395
|
+
function O(s, n, t) {
|
|
24396
|
+
return n && b(s.prototype, n), t && b(s, t), Object.defineProperty(s, "prototype", { writable: false }), s;
|
|
24397
|
+
}
|
|
24398
|
+
function k(s) {
|
|
24399
|
+
var n = z(s, "string");
|
|
24400
|
+
return typeof n == "symbol" ? n : String(n);
|
|
24401
|
+
}
|
|
24402
|
+
function z(s, n) {
|
|
24403
|
+
if (typeof s != "object" || s === null)
|
|
24404
|
+
return s;
|
|
24405
|
+
var t = s[Symbol.toPrimitive];
|
|
24406
|
+
if (t !== p) {
|
|
24407
|
+
var e = t.call(s, n || "default");
|
|
24408
|
+
if (typeof e != "object")
|
|
24354
24409
|
return e;
|
|
24355
|
-
|
|
24356
|
-
|
|
24357
|
-
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
24372
|
-
|
|
24373
|
-
|
|
24374
|
-
|
|
24375
|
-
|
|
24376
|
-
|
|
24377
|
-
|
|
24378
|
-
|
|
24410
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
24411
|
+
}
|
|
24412
|
+
return (n === "string" ? String : Number)(s);
|
|
24413
|
+
}
|
|
24414
|
+
var L = { getInstance: function(n) {
|
|
24415
|
+
var t = n.getAttribute("data-intl-tel-input-id");
|
|
24416
|
+
return window.intlTelInputGlobals.instances[t];
|
|
24417
|
+
}, instances: {}, documentReady: function() {
|
|
24418
|
+
return document.readyState === "complete";
|
|
24419
|
+
} };
|
|
24420
|
+
typeof window == "object" && (window.intlTelInputGlobals = L);
|
|
24421
|
+
var V = 0, M = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, H = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], D = function(n) {
|
|
24422
|
+
var t = window.intlTelInputGlobals.instances;
|
|
24423
|
+
Object.values(t).forEach(function(e) {
|
|
24424
|
+
return e[n]();
|
|
24425
|
+
});
|
|
24426
|
+
}, W = function() {
|
|
24427
|
+
function s(n) {
|
|
24428
|
+
var t = arguments.length > 1 && arguments[1] !== p ? arguments[1] : {};
|
|
24429
|
+
I(this, s), this.id = V++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, M, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
|
|
24430
|
+
}
|
|
24431
|
+
return O(s, [{ key: "_init", value: function() {
|
|
24432
|
+
var t = this;
|
|
24433
|
+
this.options.useFullscreenPopup && (this.options.fixDropdownWidth = false), this.options.countrySearch && !this.options.useFullscreenPopup && (this.options.fixDropdownWidth = true), this.options.nationalMode && (this.options.autoInsertDialCode = false), this.options.showSelectedDialCode && (this.options.autoInsertDialCode = false);
|
|
24434
|
+
var e = this.options.allowDropdown && !this.options.showSelectedDialCode;
|
|
24435
|
+
if (!this.options.showFlags && e && (this.options.showFlags = true), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isRTL = !!this.telInput.closest("[dir=rtl]"), typeof Promise < "u") {
|
|
24436
|
+
var i = new Promise(function(r, a) {
|
|
24437
|
+
t.resolveAutoCountryPromise = r, t.rejectAutoCountryPromise = a;
|
|
24438
|
+
}), o = new Promise(function(r, a) {
|
|
24439
|
+
t.resolveUtilsScriptPromise = r, t.rejectUtilsScriptPromise = a;
|
|
24440
|
+
});
|
|
24441
|
+
this.promise = Promise.all([i, o]);
|
|
24442
|
+
} else
|
|
24443
|
+
this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {
|
|
24444
|
+
}, this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {
|
|
24445
|
+
};
|
|
24446
|
+
this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
24447
|
+
} }, { key: "_processCountryData", value: function() {
|
|
24448
|
+
this._processAllCountries(), this._processCountryCodes(), this._processPreferredCountries(), this._translateCountryNames(), (this.options.onlyCountries.length || this.options.i18n) && this.countries.sort(this._countryNameSort);
|
|
24449
|
+
} }, { key: "_addCountryCode", value: function(t, e, i) {
|
|
24450
|
+
e.length > this.countryCodeMaxLen && (this.countryCodeMaxLen = e.length), this.countryCodes.hasOwnProperty(e) || (this.countryCodes[e] = []);
|
|
24451
|
+
for (var o = 0; o < this.countryCodes[e].length; o++)
|
|
24452
|
+
if (this.countryCodes[e][o] === t)
|
|
24453
|
+
return;
|
|
24454
|
+
var r = i !== p ? i : this.countryCodes[e].length;
|
|
24455
|
+
this.countryCodes[e][r] = t;
|
|
24456
|
+
} }, { key: "_processAllCountries", value: function() {
|
|
24457
|
+
if (this.options.onlyCountries.length) {
|
|
24458
|
+
var t = this.options.onlyCountries.map(function(i) {
|
|
24459
|
+
return i.toLowerCase();
|
|
24460
|
+
});
|
|
24461
|
+
this.countries = c.filter(function(i) {
|
|
24462
|
+
return t.indexOf(i.iso2) > -1;
|
|
24463
|
+
});
|
|
24464
|
+
} else if (this.options.excludeCountries.length) {
|
|
24465
|
+
var e = this.options.excludeCountries.map(function(i) {
|
|
24466
|
+
return i.toLowerCase();
|
|
24467
|
+
});
|
|
24468
|
+
this.countries = c.filter(function(i) {
|
|
24469
|
+
return e.indexOf(i.iso2) === -1;
|
|
24470
|
+
});
|
|
24471
|
+
} else
|
|
24472
|
+
this.countries = c;
|
|
24473
|
+
} }, { key: "_translateCountryNames", value: function() {
|
|
24474
|
+
for (var t = 0; t < this.countries.length; t++) {
|
|
24475
|
+
var e = this.countries[t].iso2.toLowerCase();
|
|
24476
|
+
this.options.i18n.hasOwnProperty(e) && (this.countries[t].name = this.options.i18n[e]);
|
|
24477
|
+
}
|
|
24478
|
+
} }, { key: "_countryNameSort", value: function(t, e) {
|
|
24479
|
+
return t.name < e.name ? -1 : t.name > e.name ? 1 : 0;
|
|
24480
|
+
} }, { key: "_processCountryCodes", value: function() {
|
|
24481
|
+
this.countryCodeMaxLen = 0, this.dialCodes = {}, this.countryCodes = {};
|
|
24482
|
+
for (var t = 0; t < this.countries.length; t++) {
|
|
24483
|
+
var e = this.countries[t];
|
|
24484
|
+
this.dialCodes[e.dialCode] || (this.dialCodes[e.dialCode] = true), this._addCountryCode(e.iso2, e.dialCode, e.priority);
|
|
24485
|
+
}
|
|
24486
|
+
for (var i = 0; i < this.countries.length; i++) {
|
|
24487
|
+
var o = this.countries[i];
|
|
24488
|
+
if (o.areaCodes)
|
|
24489
|
+
for (var r = this.countryCodes[o.dialCode][0], a = 0; a < o.areaCodes.length; a++) {
|
|
24490
|
+
for (var l = o.areaCodes[a], u = 1; u < l.length; u++) {
|
|
24491
|
+
var h = o.dialCode + l.substr(0, u);
|
|
24492
|
+
this._addCountryCode(r, h), this._addCountryCode(o.iso2, h);
|
|
24493
|
+
}
|
|
24494
|
+
this._addCountryCode(o.iso2, o.dialCode + l);
|
|
24495
|
+
}
|
|
24496
|
+
}
|
|
24497
|
+
} }, { key: "_processPreferredCountries", value: function() {
|
|
24498
|
+
this.preferredCountries = [];
|
|
24499
|
+
for (var t = 0; t < this.options.preferredCountries.length; t++) {
|
|
24500
|
+
var e = this.options.preferredCountries[t].toLowerCase(), i = this._getCountryData(e, false, true);
|
|
24501
|
+
i && this.preferredCountries.push(i);
|
|
24502
|
+
}
|
|
24503
|
+
} }, { key: "_createEl", value: function(t, e, i) {
|
|
24504
|
+
var o = document.createElement(t);
|
|
24505
|
+
return e && Object.entries(e).forEach(function(r) {
|
|
24506
|
+
var a = F(r, 2), l = a[0], u = a[1];
|
|
24507
|
+
return o.setAttribute(l, u);
|
|
24508
|
+
}), i && i.appendChild(o), o;
|
|
24509
|
+
} }, { key: "_generateMarkup", value: function() {
|
|
24510
|
+
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
24511
|
+
var t = this.options, e = t.allowDropdown, i = t.showSelectedDialCode, o = t.showFlags, r = t.containerClass, a = t.hiddenInput, l = t.dropdownContainer, u = t.fixDropdownWidth, h = t.useFullscreenPopup, v = t.countrySearch, f = "iti";
|
|
24512
|
+
e && (f += " iti--allow-dropdown"), i && (f += " iti--show-selected-dial-code"), o && (f += " iti--show-flags"), r && (f += " ".concat(r)), h || (f += " iti--inline-dropdown");
|
|
24513
|
+
var y = this._createEl("div", { class: f });
|
|
24514
|
+
this.telInput.parentNode.insertBefore(y, this.telInput);
|
|
24515
|
+
var E = e || o || i;
|
|
24516
|
+
if (E && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, y)), y.appendChild(this.telInput), E && (this.selectedFlag = this._createEl("div", _({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
|
|
24517
|
+
this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
|
|
24518
|
+
var q = u ? "" : "iti--flexible-dropdown-width";
|
|
24519
|
+
if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(q) }), v && (this.searchInput = this._createEl("input", { type: "text", class: "iti__search-input", placeholder: this.options.i18n.searchPlaceholder || "Search" }, this.dropdownContent)), this.countryList = this._createEl("ul", { class: "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" }, this.dropdownContent), this.preferredCountries.length && !v && (this._appendListItems(this.preferredCountries, "iti__preferred", true), this._createEl("li", { class: "iti__divider", "aria-hidden": "true" }, this.countryList)), this._appendListItems(this.countries, "iti__standard"), l) {
|
|
24520
|
+
var A = "iti iti--container";
|
|
24521
|
+
h ? A += " iti--fullscreen-popup" : A += " iti--inline-dropdown", v && (A += " iti--country-search"), this.dropdown = this._createEl("div", { class: A }), this.dropdown.appendChild(this.dropdownContent);
|
|
24522
|
+
} else
|
|
24523
|
+
this.flagsContainer.appendChild(this.dropdownContent);
|
|
24524
|
+
}
|
|
24525
|
+
if (a) {
|
|
24526
|
+
var Y = this.telInput.getAttribute("name"), J = a(Y);
|
|
24527
|
+
this.hiddenInput = this._createEl("input", { type: "hidden", name: J }), y.appendChild(this.hiddenInput);
|
|
24528
|
+
}
|
|
24529
|
+
} }, { key: "_appendListItems", value: function(t, e, i) {
|
|
24530
|
+
for (var o = 0; o < t.length; o++) {
|
|
24531
|
+
var r = t[o], a = i ? "-preferred" : "", l = this._createEl("li", { id: "iti-".concat(this.id, "__item-").concat(r.iso2).concat(a), class: "iti__country ".concat(e), tabindex: "-1", role: "option", "data-dial-code": r.dialCode, "data-country-code": r.iso2, "aria-selected": "false" }, this.countryList);
|
|
24532
|
+
r.nodeById[this.id] = l;
|
|
24533
|
+
var u = "";
|
|
24534
|
+
this.options.showFlags && (u += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2, "'></div></div>")), u += "<span class='iti__country-name'>".concat(r.name, "</span>"), u += "<span class='iti__dial-code'>+".concat(r.dialCode, "</span>"), l.insertAdjacentHTML("beforeend", u);
|
|
24535
|
+
}
|
|
24536
|
+
} }, { key: "_setInitialState", value: function() {
|
|
24537
|
+
var t = this.telInput.getAttribute("value"), e = this.telInput.value, i = t && t.charAt(0) === "+" && (!e || e.charAt(0) !== "+"), o = i ? t : e, r = this._getDialCode(o), a = this._isRegionlessNanp(o), l = this.options, u = l.initialCountry, h = l.autoInsertDialCode;
|
|
24538
|
+
if (r && !a)
|
|
24539
|
+
this._updateFlagFromNumber(o);
|
|
24540
|
+
else if (u !== "auto") {
|
|
24541
|
+
var v = u && this._getCountryData(u, false, true);
|
|
24542
|
+
v ? this._setFlag(u.toLowerCase()) : r && a ? this._setFlag("us") : (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, o || this._setFlag(this.defaultCountry)), !o && h && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
|
|
24543
|
+
}
|
|
24544
|
+
o && this._updateValFromNumber(o);
|
|
24545
|
+
} }, { key: "_initListeners", value: function() {
|
|
24546
|
+
this._initKeyListeners(), this.options.autoInsertDialCode && this._initBlurListeners(), this.options.allowDropdown && this._initDropdownListeners(), this.hiddenInput && this._initHiddenInputListener();
|
|
24547
|
+
} }, { key: "_initHiddenInputListener", value: function() {
|
|
24548
|
+
var t = this;
|
|
24549
|
+
this._handleHiddenInputSubmit = function() {
|
|
24550
|
+
t.hiddenInput.value = t.getNumber();
|
|
24551
|
+
}, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
24552
|
+
} }, { key: "_initDropdownListeners", value: function() {
|
|
24553
|
+
var t = this;
|
|
24554
|
+
this._handleLabelClick = function(i) {
|
|
24555
|
+
t.dropdownContent.classList.contains("iti__hide") ? t.telInput.focus() : i.preventDefault();
|
|
24556
|
+
};
|
|
24557
|
+
var e = this.telInput.closest("label");
|
|
24558
|
+
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedFlag = function() {
|
|
24559
|
+
t.dropdownContent.classList.contains("iti__hide") && !t.telInput.disabled && !t.telInput.readOnly && t._showDropdown();
|
|
24560
|
+
}, this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag), this._handleFlagsContainerKeydown = function(i) {
|
|
24561
|
+
var o = t.dropdownContent.classList.contains("iti__hide");
|
|
24562
|
+
o && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), t._showDropdown()), i.key === "Tab" && t._closeDropdown();
|
|
24563
|
+
}, this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
24564
|
+
} }, { key: "_initRequests", value: function() {
|
|
24565
|
+
var t = this;
|
|
24566
|
+
this.options.utilsScript && !window.intlTelInputUtils ? window.intlTelInputGlobals.documentReady() ? window.intlTelInputGlobals.loadUtils(this.options.utilsScript) : window.addEventListener("load", function() {
|
|
24567
|
+
window.intlTelInputGlobals.loadUtils(t.options.utilsScript);
|
|
24568
|
+
}) : this.resolveUtilsScriptPromise(), this.options.initialCountry === "auto" ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
24569
|
+
} }, { key: "_loadAutoCountry", value: function() {
|
|
24570
|
+
window.intlTelInputGlobals.autoCountry ? this.handleAutoCountry() : window.intlTelInputGlobals.startedLoadingAutoCountry || (window.intlTelInputGlobals.startedLoadingAutoCountry = true, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(function(t) {
|
|
24571
|
+
window.intlTelInputGlobals.autoCountry = t.toLowerCase(), setTimeout(function() {
|
|
24572
|
+
return D("handleAutoCountry");
|
|
24573
|
+
});
|
|
24574
|
+
}, function() {
|
|
24575
|
+
return D("rejectAutoCountryPromise");
|
|
24576
|
+
}));
|
|
24577
|
+
} }, { key: "_initKeyListeners", value: function() {
|
|
24578
|
+
var t = this, e = false;
|
|
24579
|
+
this._handleKeyEvent = function(i) {
|
|
24580
|
+
if (t._updateFlagFromNumber(t.telInput.value) && t._triggerCountryChange(), i && i.data && /[^+0-9]/.test(i.data) ? e = true : /[^+0-9]/.test(t.telInput.value) || (e = false), t.options.formatAsYouType && !e) {
|
|
24581
|
+
var o = t.telInput.selectionStart, r = t.telInput.value.substring(0, o), a = r.replace(/[^+0-9]/g, "").length, l = i && i.inputType === "deleteContentForward", u = t._formatNumberAsYouType(), h = t._translateCursorPosition(a, u, o, l);
|
|
24582
|
+
t.telInput.value = u, t.telInput.setSelectionRange(h, h);
|
|
24583
|
+
}
|
|
24584
|
+
}, this.telInput.addEventListener("input", this._handleKeyEvent), this._handleClipboardEvent = function() {
|
|
24585
|
+
setTimeout(t._handleKeyEvent);
|
|
24586
|
+
}, this.telInput.addEventListener("cut", this._handleClipboardEvent), this.telInput.addEventListener("paste", this._handleClipboardEvent);
|
|
24587
|
+
} }, { key: "_translateCursorPosition", value: function(t, e, i, o) {
|
|
24588
|
+
if (i === 0 && !o)
|
|
24589
|
+
return 0;
|
|
24590
|
+
for (var r = 0, a = 0; a < e.length; a++) {
|
|
24591
|
+
if (/[+0-9]/.test(e[a]) && r++, r === t && !o)
|
|
24592
|
+
return a + 1;
|
|
24593
|
+
if (o && r === t + 1)
|
|
24379
24594
|
return a;
|
|
24380
|
-
}
|
|
24381
24595
|
}
|
|
24382
|
-
|
|
24383
|
-
|
|
24384
|
-
|
|
24385
|
-
|
|
24386
|
-
|
|
24387
|
-
|
|
24388
|
-
|
|
24389
|
-
|
|
24390
|
-
|
|
24391
|
-
|
|
24392
|
-
|
|
24393
|
-
|
|
24394
|
-
|
|
24395
|
-
}
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24420
|
-
}
|
|
24421
|
-
|
|
24422
|
-
var
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24596
|
+
return e.length;
|
|
24597
|
+
} }, { key: "_cap", value: function(t) {
|
|
24598
|
+
var e = this.telInput.getAttribute("maxlength");
|
|
24599
|
+
return e && t.length > e ? t.substr(0, e) : t;
|
|
24600
|
+
} }, { key: "_initBlurListeners", value: function() {
|
|
24601
|
+
var t = this;
|
|
24602
|
+
this._handleSubmitOrBlurEvent = function() {
|
|
24603
|
+
t._removeEmptyDialCode();
|
|
24604
|
+
}, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
|
|
24605
|
+
} }, { key: "_removeEmptyDialCode", value: function() {
|
|
24606
|
+
if (this.telInput.value.charAt(0) === "+") {
|
|
24607
|
+
var t = this._getNumeric(this.telInput.value);
|
|
24608
|
+
(!t || this.selectedCountryData.dialCode === t) && (this.telInput.value = "");
|
|
24609
|
+
}
|
|
24610
|
+
} }, { key: "_getNumeric", value: function(t) {
|
|
24611
|
+
return t.replace(/\D/g, "");
|
|
24612
|
+
} }, { key: "_trigger", value: function(t) {
|
|
24613
|
+
var e = new Event(t, { bubbles: true, cancelable: true });
|
|
24614
|
+
this.telInput.dispatchEvent(e);
|
|
24615
|
+
} }, { key: "_showDropdown", value: function() {
|
|
24616
|
+
if (this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch) {
|
|
24617
|
+
var t = this.countryList.firstElementChild;
|
|
24618
|
+
t && this._highlightListItem(t, false), this.searchInput.focus();
|
|
24619
|
+
} else
|
|
24620
|
+
this.activeItem && (this._highlightListItem(this.activeItem, false), this._scrollTo(this.activeItem, true));
|
|
24621
|
+
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
24622
|
+
} }, { key: "_toggleClass", value: function(t, e, i) {
|
|
24623
|
+
i && !t.classList.contains(e) ? t.classList.add(e) : !i && t.classList.contains(e) && t.classList.remove(e);
|
|
24624
|
+
} }, { key: "_setDropdownPosition", value: function() {
|
|
24625
|
+
var t = this;
|
|
24626
|
+
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
24627
|
+
var e = this.telInput.getBoundingClientRect(), i = document.documentElement.scrollTop, o = e.top + i, r = this.dropdownContent.offsetHeight, a = o + this.telInput.offsetHeight + r < i + window.innerHeight, l = o - r > i, u = !this.options.countrySearch && !a && l;
|
|
24628
|
+
if (this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", u), this.options.dropdownContainer) {
|
|
24629
|
+
var h = u ? 0 : this.telInput.offsetHeight;
|
|
24630
|
+
this.dropdown.style.top = "".concat(o + h, "px"), this.dropdown.style.left = "".concat(e.left + document.body.scrollLeft, "px"), this._handleWindowScroll = function() {
|
|
24631
|
+
return t._closeDropdown();
|
|
24632
|
+
}, window.addEventListener("scroll", this._handleWindowScroll);
|
|
24633
|
+
}
|
|
24634
|
+
}
|
|
24635
|
+
} }, { key: "_bindDropdownListeners", value: function() {
|
|
24636
|
+
var t = this;
|
|
24637
|
+
this._handleMouseoverCountryList = function(l) {
|
|
24638
|
+
var u = l.target.closest(".iti__country");
|
|
24639
|
+
u && t._highlightListItem(u, false);
|
|
24640
|
+
}, this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList), this._handleClickCountryList = function(l) {
|
|
24641
|
+
var u = l.target.closest(".iti__country");
|
|
24642
|
+
u && t._selectListItem(u);
|
|
24643
|
+
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
24644
|
+
var e = true;
|
|
24645
|
+
this._handleClickOffToClose = function() {
|
|
24646
|
+
e || t._closeDropdown(), e = false;
|
|
24647
|
+
}, document.documentElement.addEventListener("click", this._handleClickOffToClose);
|
|
24648
|
+
var i = "", o = null;
|
|
24649
|
+
if (this._handleKeydownOnDropdown = function(l) {
|
|
24650
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(l.key) && (l.preventDefault(), l.stopPropagation(), l.key === "ArrowUp" || l.key === "ArrowDown" ? t._handleUpDownKey(l.key) : l.key === "Enter" ? t._handleEnterKey() : l.key === "Escape" && t._closeDropdown()), !t.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(l.key) && (l.stopPropagation(), o && clearTimeout(o), i += l.key.toLowerCase(), t._searchForCountry(i), o = setTimeout(function() {
|
|
24651
|
+
i = "";
|
|
24652
|
+
}, 1e3));
|
|
24653
|
+
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
24654
|
+
var r = function() {
|
|
24655
|
+
var u = t.searchInput.value.trim();
|
|
24656
|
+
u ? t._filterCountries(u) : t._filterCountries("", true);
|
|
24657
|
+
}, a = null;
|
|
24658
|
+
this._handleSearchChange = function() {
|
|
24659
|
+
a && clearTimeout(a), a = setTimeout(function() {
|
|
24660
|
+
r(), a = null;
|
|
24661
|
+
}, 100);
|
|
24662
|
+
}, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", function(l) {
|
|
24663
|
+
return l.stopPropagation();
|
|
24426
24664
|
});
|
|
24427
|
-
}
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
|
|
24456
|
-
|
|
24457
|
-
|
|
24458
|
-
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24468
|
-
|
|
24469
|
-
|
|
24470
|
-
|
|
24471
|
-
|
|
24472
|
-
} else
|
|
24473
|
-
this.countries = c;
|
|
24474
|
-
} }, { key: "_translateCountryNames", value: function() {
|
|
24475
|
-
for (var t = 0; t < this.countries.length; t++) {
|
|
24476
|
-
var e = this.countries[t].iso2.toLowerCase();
|
|
24477
|
-
this.options.i18n.hasOwnProperty(e) && (this.countries[t].name = this.options.i18n[e]);
|
|
24478
|
-
}
|
|
24479
|
-
} }, { key: "_countryNameSort", value: function(t, e) {
|
|
24480
|
-
return t.name < e.name ? -1 : t.name > e.name ? 1 : 0;
|
|
24481
|
-
} }, { key: "_processCountryCodes", value: function() {
|
|
24482
|
-
this.countryCodeMaxLen = 0, this.dialCodes = {}, this.countryCodes = {};
|
|
24483
|
-
for (var t = 0; t < this.countries.length; t++) {
|
|
24484
|
-
var e = this.countries[t];
|
|
24485
|
-
this.dialCodes[e.dialCode] || (this.dialCodes[e.dialCode] = true), this._addCountryCode(e.iso2, e.dialCode, e.priority);
|
|
24486
|
-
}
|
|
24487
|
-
for (var i = 0; i < this.countries.length; i++) {
|
|
24488
|
-
var o = this.countries[i];
|
|
24489
|
-
if (o.areaCodes)
|
|
24490
|
-
for (var r = this.countryCodes[o.dialCode][0], a = 0; a < o.areaCodes.length; a++) {
|
|
24491
|
-
for (var l = o.areaCodes[a], u = 1; u < l.length; u++) {
|
|
24492
|
-
var p = o.dialCode + l.substr(0, u);
|
|
24493
|
-
this._addCountryCode(r, p), this._addCountryCode(o.iso2, p);
|
|
24494
|
-
}
|
|
24495
|
-
this._addCountryCode(o.iso2, o.dialCode + l);
|
|
24496
|
-
}
|
|
24497
|
-
}
|
|
24498
|
-
} }, { key: "_processPreferredCountries", value: function() {
|
|
24499
|
-
this.preferredCountries = [];
|
|
24500
|
-
for (var t = 0; t < this.options.preferredCountries.length; t++) {
|
|
24501
|
-
var e = this.options.preferredCountries[t].toLowerCase(), i = this._getCountryData(e, false, true);
|
|
24502
|
-
i && this.preferredCountries.push(i);
|
|
24503
|
-
}
|
|
24504
|
-
} }, { key: "_createEl", value: function(t, e, i) {
|
|
24505
|
-
var o = document.createElement(t);
|
|
24506
|
-
return e && Object.entries(e).forEach(function(r) {
|
|
24507
|
-
var a = x(r, 2), l = a[0], u = a[1];
|
|
24508
|
-
return o.setAttribute(l, u);
|
|
24509
|
-
}), i && i.appendChild(o), o;
|
|
24510
|
-
} }, { key: "_generateMarkup", value: function() {
|
|
24511
|
-
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
24512
|
-
var t = this.options, e = t.allowDropdown, i = t.showSelectedDialCode, o = t.showFlags, r = t.containerClass, a = t.hiddenInput, l = t.dropdownContainer, u = t.fixDropdownWidth, p = t.useFullscreenPopup, g = t.countrySearch, f = "iti";
|
|
24513
|
-
e && (f += " iti--allow-dropdown"), i && (f += " iti--show-selected-dial-code"), o && (f += " iti--show-flags"), r && (f += " ".concat(r)), p || (f += " iti--inline-dropdown");
|
|
24514
|
-
var y = this._createEl("div", { class: f });
|
|
24515
|
-
this.telInput.parentNode.insertBefore(y, this.telInput);
|
|
24516
|
-
var A = e || o || i;
|
|
24517
|
-
if (A && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, y)), y.appendChild(this.telInput), A && (this.selectedFlag = this._createEl("div", _({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
|
|
24518
|
-
this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
|
|
24519
|
-
var J = u ? "" : "iti--flexible-dropdown-width";
|
|
24520
|
-
if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(J) }), g && (this.searchInput = this._createEl("input", { type: "text", class: "iti__search-input", placeholder: this.options.i18n.searchPlaceholder || "Search" }, this.dropdownContent)), this.countryList = this._createEl("ul", { class: "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" }, this.dropdownContent), this.preferredCountries.length && !g && (this._appendListItems(this.preferredCountries, "iti__preferred", true), this._createEl("li", { class: "iti__divider", "aria-hidden": "true" }, this.countryList)), this._appendListItems(this.countries, "iti__standard"), l) {
|
|
24521
|
-
var N = "iti iti--container";
|
|
24522
|
-
p ? N += " iti--fullscreen-popup" : N += " iti--inline-dropdown", g && (N += " iti--country-search"), this.dropdown = this._createEl("div", { class: N }), this.dropdown.appendChild(this.dropdownContent);
|
|
24523
|
-
} else
|
|
24524
|
-
this.flagsContainer.appendChild(this.dropdownContent);
|
|
24525
|
-
}
|
|
24526
|
-
if (a) {
|
|
24527
|
-
var Z = this.telInput.getAttribute("name"), $ = a(Z);
|
|
24528
|
-
this.hiddenInput = this._createEl("input", { type: "hidden", name: $ }), y.appendChild(this.hiddenInput);
|
|
24529
|
-
}
|
|
24530
|
-
} }, { key: "_appendListItems", value: function(t, e, i) {
|
|
24531
|
-
for (var o = 0; o < t.length; o++) {
|
|
24532
|
-
var r = t[o], a = i ? "-preferred" : "", l = this._createEl("li", { id: "iti-".concat(this.id, "__item-").concat(r.iso2).concat(a), class: "iti__country ".concat(e), tabindex: "-1", role: "option", "data-dial-code": r.dialCode, "data-country-code": r.iso2, "aria-selected": "false" }, this.countryList);
|
|
24533
|
-
r.nodeById[this.id] = l;
|
|
24534
|
-
var u = "";
|
|
24535
|
-
this.options.showFlags && (u += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2, "'></div></div>")), u += "<span class='iti__country-name'>".concat(r.name, "</span>"), u += "<span class='iti__dial-code'>+".concat(r.dialCode, "</span>"), l.insertAdjacentHTML("beforeend", u);
|
|
24536
|
-
}
|
|
24537
|
-
} }, { key: "_setInitialState", value: function() {
|
|
24538
|
-
var t = this.telInput.getAttribute("value"), e = this.telInput.value, i = t && t.charAt(0) === "+" && (!e || e.charAt(0) !== "+"), o = i ? t : e, r = this._getDialCode(o), a = this._isRegionlessNanp(o), l = this.options, u = l.initialCountry, p = l.autoInsertDialCode;
|
|
24539
|
-
if (r && !a)
|
|
24540
|
-
this._updateFlagFromNumber(o);
|
|
24541
|
-
else if (u !== "auto") {
|
|
24542
|
-
var g = u && this._getCountryData(u, false, true);
|
|
24543
|
-
g ? this._setFlag(u.toLowerCase()) : r && a ? this._setFlag("us") : (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, o || this._setFlag(this.defaultCountry)), !o && p && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
|
|
24544
|
-
}
|
|
24545
|
-
o && this._updateValFromNumber(o);
|
|
24546
|
-
} }, { key: "_initListeners", value: function() {
|
|
24547
|
-
this._initKeyListeners(), this.options.autoInsertDialCode && this._initBlurListeners(), this.options.allowDropdown && this._initDropdownListeners(), this.hiddenInput && this._initHiddenInputListener();
|
|
24548
|
-
} }, { key: "_initHiddenInputListener", value: function() {
|
|
24549
|
-
var t = this;
|
|
24550
|
-
this._handleHiddenInputSubmit = function() {
|
|
24551
|
-
t.hiddenInput.value = t.getNumber();
|
|
24552
|
-
}, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
|
|
24553
|
-
} }, { key: "_initDropdownListeners", value: function() {
|
|
24554
|
-
var t = this;
|
|
24555
|
-
this._handleLabelClick = function(i) {
|
|
24556
|
-
t.dropdownContent.classList.contains("iti__hide") ? t.telInput.focus() : i.preventDefault();
|
|
24557
|
-
};
|
|
24558
|
-
var e = this.telInput.closest("label");
|
|
24559
|
-
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedFlag = function() {
|
|
24560
|
-
t.dropdownContent.classList.contains("iti__hide") && !t.telInput.disabled && !t.telInput.readOnly && t._showDropdown();
|
|
24561
|
-
}, this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag), this._handleFlagsContainerKeydown = function(i) {
|
|
24562
|
-
var o = t.dropdownContent.classList.contains("iti__hide");
|
|
24563
|
-
o && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), t._showDropdown()), i.key === "Tab" && t._closeDropdown();
|
|
24564
|
-
}, this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
24565
|
-
} }, { key: "_initRequests", value: function() {
|
|
24566
|
-
var t = this;
|
|
24567
|
-
this.options.utilsScript && !window.intlTelInputUtils ? window.intlTelInputGlobals.documentReady() ? window.intlTelInputGlobals.loadUtils(this.options.utilsScript) : window.addEventListener("load", function() {
|
|
24568
|
-
window.intlTelInputGlobals.loadUtils(t.options.utilsScript);
|
|
24569
|
-
}) : this.resolveUtilsScriptPromise(), this.options.initialCountry === "auto" ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
24570
|
-
} }, { key: "_loadAutoCountry", value: function() {
|
|
24571
|
-
window.intlTelInputGlobals.autoCountry ? this.handleAutoCountry() : window.intlTelInputGlobals.startedLoadingAutoCountry || (window.intlTelInputGlobals.startedLoadingAutoCountry = true, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(function(t) {
|
|
24572
|
-
window.intlTelInputGlobals.autoCountry = t.toLowerCase(), setTimeout(function() {
|
|
24573
|
-
return E("handleAutoCountry");
|
|
24574
|
-
});
|
|
24575
|
-
}, function() {
|
|
24576
|
-
return E("rejectAutoCountryPromise");
|
|
24577
|
-
}));
|
|
24578
|
-
} }, { key: "_initKeyListeners", value: function() {
|
|
24579
|
-
var t = this, e = false;
|
|
24580
|
-
this._handleKeyEvent = function(i) {
|
|
24581
|
-
if (t._updateFlagFromNumber(t.telInput.value) && t._triggerCountryChange(), i && i.data && /[^+0-9]/.test(i.data) ? e = true : /[^+0-9]/.test(t.telInput.value) || (e = false), t.options.formatAsYouType && !e) {
|
|
24582
|
-
var o = t.telInput.selectionStart, r = t.telInput.value.substring(0, o), a = r.replace(/[^+0-9]/g, "").length, l = i && i.inputType === "deleteContentForward", u = t._formatNumberAsYouType(), p = t._translateCursorPosition(a, u, o, l);
|
|
24583
|
-
t.telInput.value = u, t.telInput.setSelectionRange(p, p);
|
|
24584
|
-
}
|
|
24585
|
-
}, this.telInput.addEventListener("input", this._handleKeyEvent), this._handleClipboardEvent = function() {
|
|
24586
|
-
setTimeout(t._handleKeyEvent);
|
|
24587
|
-
}, this.telInput.addEventListener("cut", this._handleClipboardEvent), this.telInput.addEventListener("paste", this._handleClipboardEvent);
|
|
24588
|
-
} }, { key: "_translateCursorPosition", value: function(t, e, i, o) {
|
|
24589
|
-
if (i === 0 && !o)
|
|
24590
|
-
return 0;
|
|
24591
|
-
for (var r = 0, a = 0; a < e.length; a++) {
|
|
24592
|
-
if (/[+0-9]/.test(e[a]) && r++, r === t && !o)
|
|
24593
|
-
return a + 1;
|
|
24594
|
-
if (o && r === t + 1)
|
|
24595
|
-
return a;
|
|
24596
|
-
}
|
|
24597
|
-
return e.length;
|
|
24598
|
-
} }, { key: "_cap", value: function(t) {
|
|
24599
|
-
var e = this.telInput.getAttribute("maxlength");
|
|
24600
|
-
return e && t.length > e ? t.substr(0, e) : t;
|
|
24601
|
-
} }, { key: "_initBlurListeners", value: function() {
|
|
24602
|
-
var t = this;
|
|
24603
|
-
this._handleSubmitOrBlurEvent = function() {
|
|
24604
|
-
t._removeEmptyDialCode();
|
|
24605
|
-
}, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
|
|
24606
|
-
} }, { key: "_removeEmptyDialCode", value: function() {
|
|
24607
|
-
if (this.telInput.value.charAt(0) === "+") {
|
|
24608
|
-
var t = this._getNumeric(this.telInput.value);
|
|
24609
|
-
(!t || this.selectedCountryData.dialCode === t) && (this.telInput.value = "");
|
|
24610
|
-
}
|
|
24611
|
-
} }, { key: "_getNumeric", value: function(t) {
|
|
24612
|
-
return t.replace(/\D/g, "");
|
|
24613
|
-
} }, { key: "_trigger", value: function(t) {
|
|
24614
|
-
var e = new Event(t, { bubbles: true, cancelable: true });
|
|
24615
|
-
this.telInput.dispatchEvent(e);
|
|
24616
|
-
} }, { key: "_showDropdown", value: function() {
|
|
24617
|
-
if (this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch) {
|
|
24618
|
-
var t = this.countryList.firstElementChild;
|
|
24619
|
-
t && this._highlightListItem(t, false), this.searchInput.focus();
|
|
24620
|
-
} else
|
|
24621
|
-
this.activeItem && (this._highlightListItem(this.activeItem, false), this._scrollTo(this.activeItem, true));
|
|
24622
|
-
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
24623
|
-
} }, { key: "_toggleClass", value: function(t, e, i) {
|
|
24624
|
-
i && !t.classList.contains(e) ? t.classList.add(e) : !i && t.classList.contains(e) && t.classList.remove(e);
|
|
24625
|
-
} }, { key: "_setDropdownPosition", value: function() {
|
|
24626
|
-
var t = this;
|
|
24627
|
-
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
24628
|
-
var e = this.telInput.getBoundingClientRect(), i = document.documentElement.scrollTop, o = e.top + i, r = this.dropdownContent.offsetHeight, a = o + this.telInput.offsetHeight + r < i + window.innerHeight, l = o - r > i, u = !this.options.countrySearch && !a && l;
|
|
24629
|
-
if (this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", u), this.options.dropdownContainer) {
|
|
24630
|
-
var p = u ? 0 : this.telInput.offsetHeight;
|
|
24631
|
-
this.dropdown.style.top = "".concat(o + p, "px"), this.dropdown.style.left = "".concat(e.left + document.body.scrollLeft, "px"), this._handleWindowScroll = function() {
|
|
24632
|
-
return t._closeDropdown();
|
|
24633
|
-
}, window.addEventListener("scroll", this._handleWindowScroll);
|
|
24634
|
-
}
|
|
24635
|
-
}
|
|
24636
|
-
} }, { key: "_bindDropdownListeners", value: function() {
|
|
24637
|
-
var t = this;
|
|
24638
|
-
this._handleMouseoverCountryList = function(l) {
|
|
24639
|
-
var u = l.target.closest(".iti__country");
|
|
24640
|
-
u && t._highlightListItem(u, false);
|
|
24641
|
-
}, this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList), this._handleClickCountryList = function(l) {
|
|
24642
|
-
var u = l.target.closest(".iti__country");
|
|
24643
|
-
u && t._selectListItem(u);
|
|
24644
|
-
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
24645
|
-
var e = true;
|
|
24646
|
-
this._handleClickOffToClose = function() {
|
|
24647
|
-
e || t._closeDropdown(), e = false;
|
|
24648
|
-
}, document.documentElement.addEventListener("click", this._handleClickOffToClose);
|
|
24649
|
-
var i = "", o = null;
|
|
24650
|
-
if (this._handleKeydownOnDropdown = function(l) {
|
|
24651
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(l.key) && (l.preventDefault(), l.stopPropagation(), l.key === "ArrowUp" || l.key === "ArrowDown" ? t._handleUpDownKey(l.key) : l.key === "Enter" ? t._handleEnterKey() : l.key === "Escape" && t._closeDropdown()), !t.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(l.key) && (l.stopPropagation(), o && clearTimeout(o), i += l.key.toLowerCase(), t._searchForCountry(i), o = setTimeout(function() {
|
|
24652
|
-
i = "";
|
|
24653
|
-
}, 1e3));
|
|
24654
|
-
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
24655
|
-
var r = function() {
|
|
24656
|
-
var u = t.searchInput.value.trim();
|
|
24657
|
-
u ? t._filterCountries(u) : t._filterCountries("", true);
|
|
24658
|
-
}, a = null;
|
|
24659
|
-
this._handleSearchChange = function() {
|
|
24660
|
-
a && clearTimeout(a), a = setTimeout(function() {
|
|
24661
|
-
r(), a = null;
|
|
24662
|
-
}, 100);
|
|
24663
|
-
}, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", function(l) {
|
|
24664
|
-
return l.stopPropagation();
|
|
24665
|
-
});
|
|
24666
|
-
}
|
|
24667
|
-
} }, { key: "_normaliseString", value: function() {
|
|
24668
|
-
var t = arguments.length > 0 && arguments[0] !== h ? arguments[0] : "";
|
|
24669
|
-
return t.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
24670
|
-
} }, { key: "_filterCountries", value: function(t) {
|
|
24671
|
-
var e = arguments.length > 1 && arguments[1] !== h ? arguments[1] : false, i = true;
|
|
24672
|
-
this.countryList.innerHTML = "";
|
|
24673
|
-
for (var o = this._normaliseString(t), r = 0; r < this.countries.length; r++) {
|
|
24674
|
-
var a = this.countries[r], l = this._normaliseString(a.name), u = "+".concat(a.dialCode);
|
|
24675
|
-
(e || l.includes(o) || u.includes(o) || a.iso2.includes(o)) && (this.countryList.appendChild(a.nodeById[this.id]), i && (this._highlightListItem(a.nodeById[this.id], false), i = false));
|
|
24676
|
-
}
|
|
24677
|
-
} }, { key: "_handleUpDownKey", value: function(t) {
|
|
24678
|
-
var e = t === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
|
|
24679
|
-
if (e ? e.classList.contains("iti__divider") && (e = t === "ArrowUp" ? e.previousElementSibling : e.nextElementSibling) : this.countryList.childElementCount > 1 && (e = t === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), e) {
|
|
24680
|
-
var i = !this.options.countrySearch;
|
|
24681
|
-
this._highlightListItem(e, i), this.options.countrySearch && this._scrollTo(e, false);
|
|
24682
|
-
}
|
|
24683
|
-
} }, { key: "_handleEnterKey", value: function() {
|
|
24684
|
-
this.highlightedItem && this._selectListItem(this.highlightedItem);
|
|
24685
|
-
} }, { key: "_searchForCountry", value: function(t) {
|
|
24686
|
-
for (var e = 0; e < this.countries.length; e++)
|
|
24687
|
-
if (this._startsWith(this.countries[e].name, t)) {
|
|
24688
|
-
var i = this.countries[e].nodeById[this.id];
|
|
24689
|
-
this._highlightListItem(i, false), this._scrollTo(i, true);
|
|
24665
|
+
}
|
|
24666
|
+
} }, { key: "_normaliseString", value: function() {
|
|
24667
|
+
var t = arguments.length > 0 && arguments[0] !== p ? arguments[0] : "";
|
|
24668
|
+
return t.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
24669
|
+
} }, { key: "_filterCountries", value: function(t) {
|
|
24670
|
+
var e = arguments.length > 1 && arguments[1] !== p ? arguments[1] : false, i = true;
|
|
24671
|
+
this.countryList.innerHTML = "";
|
|
24672
|
+
for (var o = this._normaliseString(t), r = 0; r < this.countries.length; r++) {
|
|
24673
|
+
var a = this.countries[r], l = this._normaliseString(a.name), u = "+".concat(a.dialCode);
|
|
24674
|
+
(e || l.includes(o) || u.includes(o) || a.iso2.includes(o)) && (this.countryList.appendChild(a.nodeById[this.id]), i && (this._highlightListItem(a.nodeById[this.id], false), i = false));
|
|
24675
|
+
}
|
|
24676
|
+
} }, { key: "_handleUpDownKey", value: function(t) {
|
|
24677
|
+
var e = t === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
|
|
24678
|
+
if (e ? e.classList.contains("iti__divider") && (e = t === "ArrowUp" ? e.previousElementSibling : e.nextElementSibling) : this.countryList.childElementCount > 1 && (e = t === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), e) {
|
|
24679
|
+
var i = !this.options.countrySearch;
|
|
24680
|
+
this._highlightListItem(e, i), this.options.countrySearch && this._scrollTo(e, false);
|
|
24681
|
+
}
|
|
24682
|
+
} }, { key: "_handleEnterKey", value: function() {
|
|
24683
|
+
this.highlightedItem && this._selectListItem(this.highlightedItem);
|
|
24684
|
+
} }, { key: "_searchForCountry", value: function(t) {
|
|
24685
|
+
for (var e = 0; e < this.countries.length; e++)
|
|
24686
|
+
if (this._startsWith(this.countries[e].name, t)) {
|
|
24687
|
+
var i = this.countries[e].nodeById[this.id];
|
|
24688
|
+
this._highlightListItem(i, false), this._scrollTo(i, true);
|
|
24689
|
+
break;
|
|
24690
|
+
}
|
|
24691
|
+
} }, { key: "_startsWith", value: function(t, e) {
|
|
24692
|
+
return t.substr(0, e.length).toLowerCase() === e;
|
|
24693
|
+
} }, { key: "_updateValFromNumber", value: function(t) {
|
|
24694
|
+
var e = t;
|
|
24695
|
+
if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
|
|
24696
|
+
var i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.showSelectedDialCode, o = intlTelInputUtils.numberFormat, r = o.NATIONAL, a = o.INTERNATIONAL, l = i ? r : a;
|
|
24697
|
+
e = intlTelInputUtils.formatNumber(e, this.selectedCountryData.iso2, l);
|
|
24698
|
+
}
|
|
24699
|
+
e = this._beforeSetNumber(e), this.telInput.value = e;
|
|
24700
|
+
} }, { key: "_updateFlagFromNumber", value: function(t) {
|
|
24701
|
+
var e = t.indexOf("+"), i = e ? t.substring(e) : t, o = this.selectedCountryData.dialCode, r = o === "1";
|
|
24702
|
+
i && r && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = "1".concat(i)), i = "+".concat(i)), this.options.showSelectedDialCode && o && i.charAt(0) !== "+" && (i = "+".concat(o).concat(i));
|
|
24703
|
+
var a = this._getDialCode(i, true), l = this._getNumeric(i), u = null;
|
|
24704
|
+
if (a) {
|
|
24705
|
+
var h = this.countryCodes[this._getNumeric(a)], v = h.indexOf(this.selectedCountryData.iso2) !== -1 && l.length <= a.length - 1, f = o === "1" && this._isRegionlessNanp(l);
|
|
24706
|
+
if (!f && !v) {
|
|
24707
|
+
for (var y = 0; y < h.length; y++)
|
|
24708
|
+
if (h[y]) {
|
|
24709
|
+
u = h[y];
|
|
24690
24710
|
break;
|
|
24691
24711
|
}
|
|
24692
|
-
}
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
|
|
24722
|
-
|
|
24723
|
-
|
|
24724
|
-
|
|
24725
|
-
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24740
|
-
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
|
|
24751
|
-
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24759
|
-
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24763
|
-
|
|
24764
|
-
|
|
24765
|
-
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
|
|
24778
|
-
|
|
24779
|
-
|
|
24780
|
-
|
|
24781
|
-
var A = r - u;
|
|
24782
|
-
i.scrollTop = f - A;
|
|
24783
|
-
}
|
|
24784
|
-
} }, { key: "_updateDialCode", value: function(t) {
|
|
24785
|
-
var e = this.telInput.value, i = "+".concat(t), o;
|
|
24786
|
-
if (e.charAt(0) === "+") {
|
|
24787
|
-
var r = this._getDialCode(e);
|
|
24788
|
-
r ? o = e.replace(r, i) : o = i, this.telInput.value = o;
|
|
24789
|
-
} else
|
|
24790
|
-
this.options.autoInsertDialCode && (e ? o = i + e : o = i, this.telInput.value = o);
|
|
24791
|
-
} }, { key: "_getDialCode", value: function(t, e) {
|
|
24792
|
-
var i = "";
|
|
24793
|
-
if (t.charAt(0) === "+")
|
|
24794
|
-
for (var o = "", r = 0; r < t.length; r++) {
|
|
24795
|
-
var a = t.charAt(r);
|
|
24796
|
-
if (!isNaN(parseInt(a, 10))) {
|
|
24797
|
-
if (o += a, e)
|
|
24798
|
-
this.countryCodes[o] && (i = t.substr(0, r + 1));
|
|
24799
|
-
else if (this.dialCodes[o]) {
|
|
24800
|
-
i = t.substr(0, r + 1);
|
|
24801
|
-
break;
|
|
24802
|
-
}
|
|
24803
|
-
if (o.length === this.countryCodeMaxLen)
|
|
24804
|
-
break;
|
|
24805
|
-
}
|
|
24712
|
+
}
|
|
24713
|
+
} else
|
|
24714
|
+
i.charAt(0) === "+" && l.length ? u = "" : (!i || i === "+") && (u = this.defaultCountry);
|
|
24715
|
+
return u !== null ? this._setFlag(u) : false;
|
|
24716
|
+
} }, { key: "_isRegionlessNanp", value: function(t) {
|
|
24717
|
+
var e = this._getNumeric(t);
|
|
24718
|
+
if (e.charAt(0) === "1") {
|
|
24719
|
+
var i = e.substr(1, 3);
|
|
24720
|
+
return H.indexOf(i) !== -1;
|
|
24721
|
+
}
|
|
24722
|
+
return false;
|
|
24723
|
+
} }, { key: "_highlightListItem", value: function(t, e) {
|
|
24724
|
+
var i = this.highlightedItem;
|
|
24725
|
+
i && i.classList.remove("iti__highlight"), this.highlightedItem = t, this.highlightedItem.classList.add("iti__highlight"), this.selectedFlag.setAttribute("aria-activedescendant", t.getAttribute("id")), e && this.highlightedItem.focus();
|
|
24726
|
+
} }, { key: "_getCountryData", value: function(t, e, i) {
|
|
24727
|
+
for (var o = e ? c : this.countries, r = 0; r < o.length; r++)
|
|
24728
|
+
if (o[r].iso2 === t)
|
|
24729
|
+
return o[r];
|
|
24730
|
+
if (i)
|
|
24731
|
+
return null;
|
|
24732
|
+
throw new Error("No country data for '".concat(t, "'"));
|
|
24733
|
+
} }, { key: "_setFlag", value: function(t) {
|
|
24734
|
+
var e = this.options, i = e.allowDropdown, o = e.showSelectedDialCode, r = e.showFlags, a = e.countrySearch, l = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
24735
|
+
if (this.selectedCountryData = t ? this._getCountryData(t, false, false) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), r && this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(t)), this._setSelectedCountryFlagTitleAttribute(t, o), o) {
|
|
24736
|
+
var u = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
|
|
24737
|
+
this.selectedDialCode.innerHTML = u;
|
|
24738
|
+
var h = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
|
|
24739
|
+
this.isRTL ? this.telInput.style.paddingRight = "".concat(h + 6, "px") : this.telInput.style.paddingLeft = "".concat(h + 6, "px");
|
|
24740
|
+
}
|
|
24741
|
+
if (this._updatePlaceholder(), i && !a) {
|
|
24742
|
+
var v = this.activeItem;
|
|
24743
|
+
if (v && (v.classList.remove("iti__active"), v.setAttribute("aria-selected", "false")), t) {
|
|
24744
|
+
var f = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(t, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(t));
|
|
24745
|
+
f.setAttribute("aria-selected", "true"), f.classList.add("iti__active"), this.activeItem = f;
|
|
24746
|
+
}
|
|
24747
|
+
}
|
|
24748
|
+
return l.iso2 !== t;
|
|
24749
|
+
} }, { key: "_setSelectedCountryFlagTitleAttribute", value: function(t, e) {
|
|
24750
|
+
if (this.selectedFlag) {
|
|
24751
|
+
var i;
|
|
24752
|
+
t && !e ? i = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : t ? i = this.selectedCountryData.name : i = "Unknown", this.selectedFlag.setAttribute("title", i);
|
|
24753
|
+
}
|
|
24754
|
+
} }, { key: "_getHiddenSelectedFlagWidth", value: function() {
|
|
24755
|
+
var t = this.telInput.parentNode.cloneNode();
|
|
24756
|
+
t.style.visibility = "hidden", document.body.appendChild(t);
|
|
24757
|
+
var e = this.flagsContainer.cloneNode();
|
|
24758
|
+
t.appendChild(e);
|
|
24759
|
+
var i = this.selectedFlag.cloneNode(true);
|
|
24760
|
+
e.appendChild(i);
|
|
24761
|
+
var o = i.offsetWidth;
|
|
24762
|
+
return t.parentNode.removeChild(t), o;
|
|
24763
|
+
} }, { key: "_updatePlaceholder", value: function() {
|
|
24764
|
+
var t = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
|
|
24765
|
+
if (window.intlTelInputUtils && t) {
|
|
24766
|
+
var e = intlTelInputUtils.numberType[this.options.placeholderNumberType], i = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, e) : "";
|
|
24767
|
+
i = this._beforeSetNumber(i), typeof this.options.customPlaceholder == "function" && (i = this.options.customPlaceholder(i, this.selectedCountryData)), this.telInput.setAttribute("placeholder", i);
|
|
24768
|
+
}
|
|
24769
|
+
} }, { key: "_selectListItem", value: function(t) {
|
|
24770
|
+
var e = this._setFlag(t.getAttribute("data-country-code"));
|
|
24771
|
+
this._closeDropdown(), this._updateDialCode(t.getAttribute("data-dial-code")), this.telInput.focus(), e && this._triggerCountryChange();
|
|
24772
|
+
} }, { key: "_closeDropdown", value: function() {
|
|
24773
|
+
this.dropdownContent.classList.add("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "false"), this.selectedFlag.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), document.removeEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch && this.searchInput.removeEventListener("input", this._handleSearchChange), document.documentElement.removeEventListener("click", this._handleClickOffToClose), this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList), 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");
|
|
24774
|
+
} }, { key: "_scrollTo", value: function(t, e) {
|
|
24775
|
+
var i = this.countryList, o = document.documentElement.scrollTop, r = i.offsetHeight, a = i.getBoundingClientRect().top + o, l = a + r, u = t.offsetHeight, h = t.getBoundingClientRect().top + o, v = h + u, f = h - a + i.scrollTop, y = r / 2 - u / 2;
|
|
24776
|
+
if (h < a)
|
|
24777
|
+
e && (f -= y), i.scrollTop = f;
|
|
24778
|
+
else if (v > l) {
|
|
24779
|
+
e && (f += y);
|
|
24780
|
+
var E = r - u;
|
|
24781
|
+
i.scrollTop = f - E;
|
|
24782
|
+
}
|
|
24783
|
+
} }, { key: "_updateDialCode", value: function(t) {
|
|
24784
|
+
var e = this.telInput.value, i = "+".concat(t), o;
|
|
24785
|
+
if (e.charAt(0) === "+") {
|
|
24786
|
+
var r = this._getDialCode(e);
|
|
24787
|
+
r ? o = e.replace(r, i) : o = i, this.telInput.value = o;
|
|
24788
|
+
} else
|
|
24789
|
+
this.options.autoInsertDialCode && (e ? o = i + e : o = i, this.telInput.value = o);
|
|
24790
|
+
} }, { key: "_getDialCode", value: function(t, e) {
|
|
24791
|
+
var i = "";
|
|
24792
|
+
if (t.charAt(0) === "+")
|
|
24793
|
+
for (var o = "", r = 0; r < t.length; r++) {
|
|
24794
|
+
var a = t.charAt(r);
|
|
24795
|
+
if (!isNaN(parseInt(a, 10))) {
|
|
24796
|
+
if (o += a, e)
|
|
24797
|
+
this.countryCodes[o] && (i = t.substr(0, r + 1));
|
|
24798
|
+
else if (this.dialCodes[o]) {
|
|
24799
|
+
i = t.substr(0, r + 1);
|
|
24800
|
+
break;
|
|
24806
24801
|
}
|
|
24807
|
-
|
|
24808
|
-
|
|
24809
|
-
var t = this.telInput.value.trim(), e = this.selectedCountryData.dialCode, i, o = this._getNumeric(t);
|
|
24810
|
-
return this.options.showSelectedDialCode && !this.options.nationalMode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
|
|
24811
|
-
} }, { key: "_beforeSetNumber", value: function(t) {
|
|
24812
|
-
var e = t;
|
|
24813
|
-
if (this.options.showSelectedDialCode) {
|
|
24814
|
-
var i = this._getDialCode(e);
|
|
24815
|
-
if (i) {
|
|
24816
|
-
i = "+".concat(this.selectedCountryData.dialCode);
|
|
24817
|
-
var o = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
24818
|
-
e = e.substr(o);
|
|
24819
|
-
}
|
|
24820
|
-
}
|
|
24821
|
-
return this._cap(e);
|
|
24822
|
-
} }, { key: "_triggerCountryChange", value: function() {
|
|
24823
|
-
this._trigger("countrychange");
|
|
24824
|
-
} }, { key: "_formatNumberAsYouType", value: function() {
|
|
24825
|
-
var t = this._getFullNumber(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, i = this.selectedCountryData.dialCode;
|
|
24826
|
-
if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && e.includes("+".concat(i))) {
|
|
24827
|
-
var o = e.split("+".concat(i))[1] || "";
|
|
24828
|
-
return o.trim();
|
|
24829
|
-
}
|
|
24830
|
-
return e;
|
|
24831
|
-
} }, { key: "handleAutoCountry", value: function() {
|
|
24832
|
-
this.options.initialCountry === "auto" && (this.defaultCountry = window.intlTelInputGlobals.autoCountry, this.telInput.value || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
24833
|
-
} }, { key: "handleUtils", value: function() {
|
|
24834
|
-
window.intlTelInputUtils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this._updatePlaceholder()), this.resolveUtilsScriptPromise();
|
|
24835
|
-
} }, { key: "destroy", value: function() {
|
|
24836
|
-
var t = this.telInput.form;
|
|
24837
|
-
if (this.options.allowDropdown) {
|
|
24838
|
-
this._closeDropdown(), this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag), this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
24839
|
-
var e = this.telInput.closest("label");
|
|
24840
|
-
e && e.removeEventListener("click", this._handleLabelClick);
|
|
24841
|
-
}
|
|
24842
|
-
this.hiddenInput && t && t.removeEventListener("submit", this._handleHiddenInputSubmit), this.options.autoInsertDialCode && (t && t.removeEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent)), this.telInput.removeEventListener("input", this._handleKeyEvent), this.telInput.removeEventListener("cut", this._handleClipboardEvent), this.telInput.removeEventListener("paste", this._handleClipboardEvent), this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
24843
|
-
var i = this.telInput.parentNode;
|
|
24844
|
-
i.parentNode.insertBefore(this.telInput, i), i.parentNode.removeChild(i), delete window.intlTelInputGlobals.instances[this.id];
|
|
24845
|
-
} }, { key: "getExtension", value: function() {
|
|
24846
|
-
return window.intlTelInputUtils ? intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2) : "";
|
|
24847
|
-
} }, { key: "getNumber", value: function(t) {
|
|
24848
|
-
if (window.intlTelInputUtils) {
|
|
24849
|
-
var e = this.selectedCountryData.iso2;
|
|
24850
|
-
return intlTelInputUtils.formatNumber(this._getFullNumber(), e, t);
|
|
24802
|
+
if (o.length === this.countryCodeMaxLen)
|
|
24803
|
+
break;
|
|
24851
24804
|
}
|
|
24852
|
-
return "";
|
|
24853
|
-
} }, { key: "getNumberType", value: function() {
|
|
24854
|
-
return window.intlTelInputUtils ? intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2) : -99;
|
|
24855
|
-
} }, { key: "getSelectedCountryData", value: function() {
|
|
24856
|
-
return this.selectedCountryData;
|
|
24857
|
-
} }, { key: "getValidationError", value: function() {
|
|
24858
|
-
if (window.intlTelInputUtils) {
|
|
24859
|
-
var t = this.selectedCountryData.iso2;
|
|
24860
|
-
return intlTelInputUtils.getValidationError(this._getFullNumber(), t);
|
|
24861
|
-
}
|
|
24862
|
-
return -99;
|
|
24863
|
-
} }, { key: "isValidNumber", value: function() {
|
|
24864
|
-
var t = this._getFullNumber();
|
|
24865
|
-
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(t, this.selectedCountryData.iso2) : null;
|
|
24866
|
-
} }, { key: "isValidNumberPrecise", value: function() {
|
|
24867
|
-
var t = this._getFullNumber();
|
|
24868
|
-
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(t, this.selectedCountryData.iso2) : null;
|
|
24869
|
-
} }, { key: "setCountry", value: function(t) {
|
|
24870
|
-
var e = t.toLowerCase();
|
|
24871
|
-
this.selectedCountryData.iso2 !== e && (this._setFlag(e), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
24872
|
-
} }, { key: "setNumber", value: function(t) {
|
|
24873
|
-
var e = this._updateFlagFromNumber(t);
|
|
24874
|
-
this._updateValFromNumber(t), e && this._triggerCountryChange();
|
|
24875
|
-
} }, { key: "setPlaceholderNumberType", value: function(t) {
|
|
24876
|
-
this.options.placeholderNumberType = t, this._updatePlaceholder();
|
|
24877
|
-
} }]), s;
|
|
24878
|
-
}();
|
|
24879
|
-
S.getCountryData = function() {
|
|
24880
|
-
return c;
|
|
24881
|
-
};
|
|
24882
|
-
var R = function(n, t, e) {
|
|
24883
|
-
var i = document.createElement("script");
|
|
24884
|
-
i.onload = function() {
|
|
24885
|
-
E("handleUtils"), t && t();
|
|
24886
|
-
}, i.onerror = function() {
|
|
24887
|
-
E("rejectUtilsScriptPromise"), e && e();
|
|
24888
|
-
}, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
|
|
24889
|
-
};
|
|
24890
|
-
return S.loadUtils = function(s) {
|
|
24891
|
-
if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
|
|
24892
|
-
if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
|
|
24893
|
-
return new Promise(function(n, t) {
|
|
24894
|
-
return R(s, n, t);
|
|
24895
|
-
});
|
|
24896
|
-
R(s);
|
|
24897
24805
|
}
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24901
|
-
|
|
24902
|
-
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
|
|
24906
|
-
|
|
24907
|
-
|
|
24908
|
-
|
|
24909
|
-
|
|
24910
|
-
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
|
|
24806
|
+
return i;
|
|
24807
|
+
} }, { key: "_getFullNumber", value: function() {
|
|
24808
|
+
var t = this.telInput.value.trim(), e = this.selectedCountryData.dialCode, i, o = this._getNumeric(t);
|
|
24809
|
+
return this.options.showSelectedDialCode && !this.options.nationalMode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
|
|
24810
|
+
} }, { key: "_beforeSetNumber", value: function(t) {
|
|
24811
|
+
var e = t;
|
|
24812
|
+
if (this.options.showSelectedDialCode) {
|
|
24813
|
+
var i = this._getDialCode(e);
|
|
24814
|
+
if (i) {
|
|
24815
|
+
i = "+".concat(this.selectedCountryData.dialCode);
|
|
24816
|
+
var o = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
24817
|
+
e = e.substr(o);
|
|
24818
|
+
}
|
|
24819
|
+
}
|
|
24820
|
+
return this._cap(e);
|
|
24821
|
+
} }, { key: "_triggerCountryChange", value: function() {
|
|
24822
|
+
this._trigger("countrychange");
|
|
24823
|
+
} }, { key: "_formatNumberAsYouType", value: function() {
|
|
24824
|
+
var t = this._getFullNumber(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t, i = this.selectedCountryData.dialCode;
|
|
24825
|
+
if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && e.includes("+".concat(i))) {
|
|
24826
|
+
var o = e.split("+".concat(i))[1] || "";
|
|
24827
|
+
return o.trim();
|
|
24828
|
+
}
|
|
24829
|
+
return e;
|
|
24830
|
+
} }, { key: "handleAutoCountry", value: function() {
|
|
24831
|
+
this.options.initialCountry === "auto" && (this.defaultCountry = window.intlTelInputGlobals.autoCountry, this.telInput.value || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
24832
|
+
} }, { key: "handleUtils", value: function() {
|
|
24833
|
+
window.intlTelInputUtils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this._updatePlaceholder()), this.resolveUtilsScriptPromise();
|
|
24834
|
+
} }, { key: "destroy", value: function() {
|
|
24835
|
+
var t = this.telInput.form;
|
|
24836
|
+
if (this.options.allowDropdown) {
|
|
24837
|
+
this._closeDropdown(), this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag), this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
|
|
24838
|
+
var e = this.telInput.closest("label");
|
|
24839
|
+
e && e.removeEventListener("click", this._handleLabelClick);
|
|
24840
|
+
}
|
|
24841
|
+
this.hiddenInput && t && t.removeEventListener("submit", this._handleHiddenInputSubmit), this.options.autoInsertDialCode && (t && t.removeEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent)), this.telInput.removeEventListener("input", this._handleKeyEvent), this.telInput.removeEventListener("cut", this._handleClipboardEvent), this.telInput.removeEventListener("paste", this._handleClipboardEvent), this.telInput.removeAttribute("data-intl-tel-input-id");
|
|
24842
|
+
var i = this.telInput.parentNode;
|
|
24843
|
+
i.parentNode.insertBefore(this.telInput, i), i.parentNode.removeChild(i), delete window.intlTelInputGlobals.instances[this.id];
|
|
24844
|
+
} }, { key: "getExtension", value: function() {
|
|
24845
|
+
return window.intlTelInputUtils ? intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2) : "";
|
|
24846
|
+
} }, { key: "getNumber", value: function(t) {
|
|
24847
|
+
if (window.intlTelInputUtils) {
|
|
24848
|
+
var e = this.selectedCountryData.iso2;
|
|
24849
|
+
return intlTelInputUtils.formatNumber(this._getFullNumber(), e, t);
|
|
24850
|
+
}
|
|
24851
|
+
return "";
|
|
24852
|
+
} }, { key: "getNumberType", value: function() {
|
|
24853
|
+
return window.intlTelInputUtils ? intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2) : -99;
|
|
24854
|
+
} }, { key: "getSelectedCountryData", value: function() {
|
|
24855
|
+
return this.selectedCountryData;
|
|
24856
|
+
} }, { key: "getValidationError", value: function() {
|
|
24857
|
+
if (window.intlTelInputUtils) {
|
|
24858
|
+
var t = this.selectedCountryData.iso2;
|
|
24859
|
+
return intlTelInputUtils.getValidationError(this._getFullNumber(), t);
|
|
24860
|
+
}
|
|
24861
|
+
return -99;
|
|
24862
|
+
} }, { key: "isValidNumber", value: function() {
|
|
24863
|
+
var t = this._getFullNumber();
|
|
24864
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(t, this.selectedCountryData.iso2) : null;
|
|
24865
|
+
} }, { key: "isValidNumberPrecise", value: function() {
|
|
24866
|
+
var t = this._getFullNumber();
|
|
24867
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(t, this.selectedCountryData.iso2) : null;
|
|
24868
|
+
} }, { key: "setCountry", value: function(t) {
|
|
24869
|
+
var e = t.toLowerCase();
|
|
24870
|
+
this.selectedCountryData.iso2 !== e && (this._setFlag(e), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
24871
|
+
} }, { key: "setNumber", value: function(t) {
|
|
24872
|
+
var e = this._updateFlagFromNumber(t);
|
|
24873
|
+
this._updateValFromNumber(t), e && this._triggerCountryChange();
|
|
24874
|
+
} }, { key: "setPlaceholderNumberType", value: function(t) {
|
|
24875
|
+
this.options.placeholderNumberType = t, this._updatePlaceholder();
|
|
24876
|
+
} }]), s;
|
|
24877
|
+
}();
|
|
24878
|
+
L.getCountryData = function() {
|
|
24879
|
+
return c;
|
|
24880
|
+
};
|
|
24881
|
+
var B = function(n, t, e) {
|
|
24882
|
+
var i = document.createElement("script");
|
|
24883
|
+
i.onload = function() {
|
|
24884
|
+
D("handleUtils"), t && t();
|
|
24885
|
+
}, i.onerror = function() {
|
|
24886
|
+
D("rejectUtilsScriptPromise"), e && e();
|
|
24887
|
+
}, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
|
|
24888
|
+
};
|
|
24889
|
+
return L.loadUtils = function(s) {
|
|
24890
|
+
if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
|
|
24891
|
+
if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
|
|
24892
|
+
return new Promise(function(n, t) {
|
|
24893
|
+
return B(s, n, t);
|
|
24894
|
+
});
|
|
24895
|
+
B(s);
|
|
24920
24896
|
}
|
|
24897
|
+
return null;
|
|
24898
|
+
}, L.defaults = M, L.version = "19.2.17", function(s, n) {
|
|
24899
|
+
var t = new W(s, n);
|
|
24900
|
+
return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
|
|
24921
24901
|
};
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
return C.current = (0, V.default)(I.current, P), b.addEventListener("countrychange", L), () => {
|
|
24925
|
-
b.removeEventListener("countrychange", L), C.current.destroy();
|
|
24926
|
-
};
|
|
24927
|
-
}, []), w.default.createElement("input", { type: "tel", ref: I, onInput: L, defaultValue: h, className: x, disabled: O, onFocus: U, onBlur: k });
|
|
24928
|
-
};
|
|
24929
|
-
j.propTypes = { initialValue: d.default.string, onChangeNumber: d.default.func, onChangeCountry: d.default.func, onChangeValidity: d.default.func, onChangeErrorCode: d.default.func, initOptions: d.default.shape({ allowDropdown: d.default.bool, autoInsertDialCode: d.default.bool, autoPlaceholder: d.default.string, containerClass: d.default.string, countrySearch: d.default.bool, customPlaceholder: d.default.func, dropdownContainer: d.default.node, excludeCountries: d.default.arrayOf(d.default.string), fixDropdownWidth: d.default.bool, formatAsYouType: d.default.bool, formatOnDisplay: d.default.bool, geoIpLookup: d.default.func, hiddenInput: d.default.func, i18n: d.default.objectOf(d.default.string), initialCountry: d.default.string, nationalMode: d.default.bool, onlyCountries: d.default.arrayOf(d.default.string), placeholderNumberType: d.default.string, preferredCountries: d.default.arrayOf(d.default.string), showFlags: d.default.bool, showSelectedDialCode: d.default.bool, useFullscreenPopup: d.default.bool, utilsScript: d.default.string }), className: d.default.string, disabled: d.default.bool, onFocus: d.default.func, onBlur: d.default.func };
|
|
24930
|
-
j.defaultProps = { initialValue: "", onChangeNumber: () => {
|
|
24931
|
-
}, onChangeCountry: () => {
|
|
24932
|
-
}, onChangeValidity: () => {
|
|
24933
|
-
}, onChangeErrorCode: () => {
|
|
24934
|
-
}, initOptions: {}, className: "", disabled: false, onFocus: () => {
|
|
24935
|
-
}, onBlur: () => {
|
|
24936
|
-
} };
|
|
24937
|
-
var st = j;
|
|
24938
|
-
}
|
|
24902
|
+
}();
|
|
24903
|
+
});
|
|
24939
24904
|
});
|
|
24905
|
+
var K = nt(G());
|
|
24906
|
+
var U = ({ initialValue: p, onChangeNumber: c, onChangeCountry: g, onChangeValidity: m, onChangeErrorCode: _, initOptions: T, className: F, disabled: P, onFocus: x, onBlur: S }) => {
|
|
24907
|
+
let w = (0, import_react.useRef)(null), C = (0, import_react.useRef)(null), I = () => {
|
|
24908
|
+
let b = C.current.getNumber(), O = C.current.getSelectedCountryData().iso2;
|
|
24909
|
+
if (c(b), g(O), C.current.isValidNumber())
|
|
24910
|
+
m(true), _(null);
|
|
24911
|
+
else {
|
|
24912
|
+
let k = C.current.getValidationError();
|
|
24913
|
+
m(false), _(k);
|
|
24914
|
+
}
|
|
24915
|
+
};
|
|
24916
|
+
return (0, import_react.useEffect)(() => {
|
|
24917
|
+
let b = w.current;
|
|
24918
|
+
return C.current = (0, K.default)(w.current, T), b.addEventListener("countrychange", I), () => {
|
|
24919
|
+
b.removeEventListener("countrychange", I), C.current.destroy();
|
|
24920
|
+
};
|
|
24921
|
+
}, []), import_react.default.createElement("input", { type: "tel", ref: w, onInput: I, defaultValue: p, className: F, disabled: P, onFocus: x, onBlur: S });
|
|
24922
|
+
};
|
|
24923
|
+
U.propTypes = { initialValue: import_prop_types.default.string, onChangeNumber: import_prop_types.default.func, onChangeCountry: import_prop_types.default.func, onChangeValidity: import_prop_types.default.func, onChangeErrorCode: import_prop_types.default.func, initOptions: import_prop_types.default.shape({ allowDropdown: import_prop_types.default.bool, autoInsertDialCode: import_prop_types.default.bool, autoPlaceholder: import_prop_types.default.string, containerClass: import_prop_types.default.string, countrySearch: import_prop_types.default.bool, customPlaceholder: import_prop_types.default.func, dropdownContainer: import_prop_types.default.node, excludeCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), fixDropdownWidth: import_prop_types.default.bool, formatAsYouType: import_prop_types.default.bool, formatOnDisplay: import_prop_types.default.bool, geoIpLookup: import_prop_types.default.func, hiddenInput: import_prop_types.default.func, i18n: import_prop_types.default.objectOf(import_prop_types.default.string), initialCountry: import_prop_types.default.string, nationalMode: import_prop_types.default.bool, onlyCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), placeholderNumberType: import_prop_types.default.string, preferredCountries: import_prop_types.default.arrayOf(import_prop_types.default.string), showFlags: import_prop_types.default.bool, showSelectedDialCode: import_prop_types.default.bool, useFullscreenPopup: import_prop_types.default.bool, utilsScript: import_prop_types.default.string }), className: import_prop_types.default.string, disabled: import_prop_types.default.bool, onFocus: import_prop_types.default.func, onBlur: import_prop_types.default.func };
|
|
24924
|
+
U.defaultProps = { initialValue: "", onChangeNumber: () => {
|
|
24925
|
+
}, onChangeCountry: () => {
|
|
24926
|
+
}, onChangeValidity: () => {
|
|
24927
|
+
}, onChangeErrorCode: () => {
|
|
24928
|
+
}, initOptions: {}, className: "", disabled: false, onFocus: () => {
|
|
24929
|
+
}, onBlur: () => {
|
|
24930
|
+
} };
|
|
24931
|
+
var dt = U;
|
|
24940
24932
|
|
|
24941
24933
|
// react/demo/ValidationApp.js
|
|
24942
|
-
var import_react = __toESM(require_react());
|
|
24943
|
-
var import_client = __toESM(require_client());
|
|
24944
|
-
var import_IntlTelInput = __toESM(require_IntlTelInput_cjs());
|
|
24945
24934
|
var errorMap = [
|
|
24946
24935
|
"Invalid number",
|
|
24947
24936
|
"Invalid country code",
|
|
@@ -24950,10 +24939,10 @@ var errorMap = [
|
|
|
24950
24939
|
"Invalid number"
|
|
24951
24940
|
];
|
|
24952
24941
|
var App = () => {
|
|
24953
|
-
const [isValid, setIsValid] = (0,
|
|
24954
|
-
const [number, setNumber] = (0,
|
|
24955
|
-
const [errorCode, setErrorCode] = (0,
|
|
24956
|
-
const [notice, setNotice] = (0,
|
|
24942
|
+
const [isValid, setIsValid] = (0, import_react2.useState)(null);
|
|
24943
|
+
const [number, setNumber] = (0, import_react2.useState)(null);
|
|
24944
|
+
const [errorCode, setErrorCode] = (0, import_react2.useState)(null);
|
|
24945
|
+
const [notice, setNotice] = (0, import_react2.useState)(null);
|
|
24957
24946
|
const handleSubmit = () => {
|
|
24958
24947
|
if (isValid) {
|
|
24959
24948
|
setNotice(`Valid number: ${number}`);
|
|
@@ -24962,8 +24951,8 @@ var App = () => {
|
|
|
24962
24951
|
setNotice(`Error: ${errorMessage}`);
|
|
24963
24952
|
}
|
|
24964
24953
|
};
|
|
24965
|
-
return /* @__PURE__ */
|
|
24966
|
-
|
|
24954
|
+
return /* @__PURE__ */ import_react2.default.createElement("form", null, /* @__PURE__ */ import_react2.default.createElement(
|
|
24955
|
+
dt,
|
|
24967
24956
|
{
|
|
24968
24957
|
onChangeNumber: setNumber,
|
|
24969
24958
|
onChangeValidity: setIsValid,
|
|
@@ -24973,11 +24962,11 @@ var App = () => {
|
|
|
24973
24962
|
utilsScript: "../../build/js/utils.js"
|
|
24974
24963
|
}
|
|
24975
24964
|
}
|
|
24976
|
-
), /* @__PURE__ */
|
|
24965
|
+
), /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", onClick: handleSubmit }, "Validate"), notice && /* @__PURE__ */ import_react2.default.createElement("div", { className: "notice" }, notice));
|
|
24977
24966
|
};
|
|
24978
24967
|
var container = document.getElementById("app");
|
|
24979
24968
|
var root = (0, import_client.createRoot)(container);
|
|
24980
|
-
root.render(/* @__PURE__ */
|
|
24969
|
+
root.render(/* @__PURE__ */ import_react2.default.createElement(App, null));
|
|
24981
24970
|
/*! Bundled license information:
|
|
24982
24971
|
|
|
24983
24972
|
react/cjs/react.development.js:
|