intl-tel-input 23.0.5 → 23.0.7
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 +3 -3
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +2 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +110 -199
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +3 -3
- package/react/build/IntlTelInput.cjs +17 -5
- package/react/build/IntlTelInput.d.ts +10 -4
- package/react/build/IntlTelInput.js +18 -6
- package/react/build/IntlTelInputWithUtils.cjs +125 -202
- package/react/build/IntlTelInputWithUtils.js +126 -203
|
@@ -2738,7 +2738,7 @@ var intlTelInput = Object.assign(
|
|
|
2738
2738
|
//* A map from instance ID to instance object.
|
|
2739
2739
|
instances: {},
|
|
2740
2740
|
loadUtils,
|
|
2741
|
-
version: "23.0.
|
|
2741
|
+
version: "23.0.7"
|
|
2742
2742
|
}
|
|
2743
2743
|
);
|
|
2744
2744
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -2750,8 +2750,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2750
2750
|
a = a.split(".");
|
|
2751
2751
|
var c = k;
|
|
2752
2752
|
a[0] in c || "undefined" == typeof c.execScript || c.execScript("var " + a[0]);
|
|
2753
|
-
for (var d; a.length && (d = a.shift()); )
|
|
2754
|
-
a.length || void 0 === b ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b;
|
|
2753
|
+
for (var d; a.length && (d = a.shift()); ) a.length || void 0 === b ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b;
|
|
2755
2754
|
}
|
|
2756
2755
|
function n(a, b) {
|
|
2757
2756
|
function c() {
|
|
@@ -2761,8 +2760,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2761
2760
|
a.prototype = new c();
|
|
2762
2761
|
a.prototype.constructor = a;
|
|
2763
2762
|
a.sa = function(d, e, f) {
|
|
2764
|
-
for (var g = Array(arguments.length - 2), h = 2; h < arguments.length; h++)
|
|
2765
|
-
g[h - 2] = arguments[h];
|
|
2763
|
+
for (var g = Array(arguments.length - 2), h = 2; h < arguments.length; h++) g[h - 2] = arguments[h];
|
|
2766
2764
|
return b.prototype[e].apply(d, g);
|
|
2767
2765
|
};
|
|
2768
2766
|
}
|
|
@@ -2770,15 +2768,13 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2770
2768
|
function aa(a) {
|
|
2771
2769
|
const b = [];
|
|
2772
2770
|
let c = 0;
|
|
2773
|
-
for (const d in a)
|
|
2774
|
-
b[c++] = a[d];
|
|
2771
|
+
for (const d in a) b[c++] = a[d];
|
|
2775
2772
|
return b;
|
|
2776
2773
|
}
|
|
2777
2774
|
;
|
|
2778
2775
|
var da = class {
|
|
2779
2776
|
constructor(a) {
|
|
2780
|
-
if (ba !== ba)
|
|
2781
|
-
throw Error("SafeUrl is not meant to be built directly");
|
|
2777
|
+
if (ba !== ba) throw Error("SafeUrl is not meant to be built directly");
|
|
2782
2778
|
this.g = a;
|
|
2783
2779
|
}
|
|
2784
2780
|
toString() {
|
|
@@ -2790,8 +2786,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2790
2786
|
const ea = {};
|
|
2791
2787
|
class fa {
|
|
2792
2788
|
constructor() {
|
|
2793
|
-
if (ea !== ea)
|
|
2794
|
-
throw Error("SafeStyle is not meant to be built directly");
|
|
2789
|
+
if (ea !== ea) throw Error("SafeStyle is not meant to be built directly");
|
|
2795
2790
|
}
|
|
2796
2791
|
toString() {
|
|
2797
2792
|
return "".toString();
|
|
@@ -2801,8 +2796,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2801
2796
|
const ha = {};
|
|
2802
2797
|
class ia {
|
|
2803
2798
|
constructor() {
|
|
2804
|
-
if (ha !== ha)
|
|
2805
|
-
throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2799
|
+
if (ha !== ha) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2806
2800
|
}
|
|
2807
2801
|
toString() {
|
|
2808
2802
|
return "".toString();
|
|
@@ -2813,8 +2807,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2813
2807
|
class ka {
|
|
2814
2808
|
constructor() {
|
|
2815
2809
|
var a = k.trustedTypes && k.trustedTypes.emptyHTML || "";
|
|
2816
|
-
if (ja !== ja)
|
|
2817
|
-
throw Error("SafeHtml is not meant to be built directly");
|
|
2810
|
+
if (ja !== ja) throw Error("SafeHtml is not meant to be built directly");
|
|
2818
2811
|
this.g = a;
|
|
2819
2812
|
}
|
|
2820
2813
|
toString() {
|
|
@@ -2882,10 +2875,8 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2882
2875
|
var g = 11 == e.h || 10 == e.h;
|
|
2883
2876
|
if (e.l) {
|
|
2884
2877
|
e = u(b, f);
|
|
2885
|
-
for (var h = 0; h < e.length; h++)
|
|
2886
|
-
|
|
2887
|
-
} else
|
|
2888
|
-
e = v(b, f), g ? (g = v(a, f)) ? wa(g, e) : t(a, f, e.clone()) : t(a, f, e);
|
|
2878
|
+
for (var h = 0; h < e.length; h++) va(a, f, g ? e[h].clone() : e[h]);
|
|
2879
|
+
} else e = v(b, f), g ? (g = v(a, f)) ? wa(g, e) : t(a, f, e.clone()) : t(a, f, e);
|
|
2889
2880
|
}
|
|
2890
2881
|
}
|
|
2891
2882
|
}
|
|
@@ -2899,18 +2890,14 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2899
2890
|
}
|
|
2900
2891
|
function v(a, b) {
|
|
2901
2892
|
var c = a.h[b];
|
|
2902
|
-
if (null == c)
|
|
2903
|
-
return null;
|
|
2893
|
+
if (null == c) return null;
|
|
2904
2894
|
if (a.l) {
|
|
2905
2895
|
if (!(b in a.g)) {
|
|
2906
2896
|
var d = a.l, e = a.j[b];
|
|
2907
|
-
if (null != c)
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
c = f;
|
|
2912
|
-
} else
|
|
2913
|
-
c = d.h(e, c);
|
|
2897
|
+
if (null != c) if (e.l) {
|
|
2898
|
+
for (var f = [], g = 0; g < c.length; g++) f[g] = d.h(e, c[g]);
|
|
2899
|
+
c = f;
|
|
2900
|
+
} else c = d.h(e, c);
|
|
2914
2901
|
return a.g[b] = c;
|
|
2915
2902
|
}
|
|
2916
2903
|
return a.g[b];
|
|
@@ -2922,24 +2909,18 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2922
2909
|
return a.j[b].l ? d[c || 0] : d;
|
|
2923
2910
|
}
|
|
2924
2911
|
function w(a, b) {
|
|
2925
|
-
if (q(a, b))
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
a
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
a.j = 0;
|
|
2935
|
-
else if (b === String)
|
|
2936
|
-
a.j = a.o ? "0" : "";
|
|
2937
|
-
else {
|
|
2938
|
-
a = new b();
|
|
2939
|
-
break a;
|
|
2940
|
-
}
|
|
2941
|
-
a = a.j;
|
|
2912
|
+
if (q(a, b)) a = r(a, b);
|
|
2913
|
+
else a: {
|
|
2914
|
+
a = a.j[b];
|
|
2915
|
+
if (void 0 === a.j) if (b = a.s, b === Boolean) a.j = false;
|
|
2916
|
+
else if (b === Number) a.j = 0;
|
|
2917
|
+
else if (b === String) a.j = a.o ? "0" : "";
|
|
2918
|
+
else {
|
|
2919
|
+
a = new b();
|
|
2920
|
+
break a;
|
|
2942
2921
|
}
|
|
2922
|
+
a = a.j;
|
|
2923
|
+
}
|
|
2943
2924
|
return a;
|
|
2944
2925
|
}
|
|
2945
2926
|
function u(a, b) {
|
|
@@ -2959,8 +2940,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2959
2940
|
}
|
|
2960
2941
|
function y(a, b) {
|
|
2961
2942
|
var c = [], d;
|
|
2962
|
-
for (d in b)
|
|
2963
|
-
0 != d && c.push(new la(d, b[d]));
|
|
2943
|
+
for (d in b) 0 != d && c.push(new la(d, b[d]));
|
|
2964
2944
|
return new ta(a, c);
|
|
2965
2945
|
}
|
|
2966
2946
|
;
|
|
@@ -2971,18 +2951,13 @@ var intl_tel_input_default = intlTelInput;
|
|
|
2971
2951
|
throw Error("Unimplemented");
|
|
2972
2952
|
};
|
|
2973
2953
|
z.prototype.h = function(a, b) {
|
|
2974
|
-
if (11 == a.h || 10 == a.h)
|
|
2975
|
-
|
|
2976
|
-
if (
|
|
2977
|
-
return "string" === typeof b && xa.test(b) && (a = Number(b), 0 < a) ? a : b;
|
|
2978
|
-
if (!a.o)
|
|
2979
|
-
return b;
|
|
2954
|
+
if (11 == a.h || 10 == a.h) return b instanceof p ? b : this.g(a.s.prototype.m(), b);
|
|
2955
|
+
if (14 == a.h) return "string" === typeof b && xa.test(b) && (a = Number(b), 0 < a) ? a : b;
|
|
2956
|
+
if (!a.o) return b;
|
|
2980
2957
|
a = a.s;
|
|
2981
2958
|
if (a === String) {
|
|
2982
|
-
if ("number" === typeof b)
|
|
2983
|
-
|
|
2984
|
-
} else if (a === Number && "string" === typeof b && ("Infinity" === b || "-Infinity" === b || "NaN" === b || xa.test(b)))
|
|
2985
|
-
return Number(b);
|
|
2959
|
+
if ("number" === typeof b) return String(b);
|
|
2960
|
+
} else if (a === Number && "string" === typeof b && ("Infinity" === b || "-Infinity" === b || "NaN" === b || xa.test(b))) return Number(b);
|
|
2986
2961
|
return b;
|
|
2987
2962
|
};
|
|
2988
2963
|
var xa = /^-?[0-9]+$/;
|
|
@@ -3014,9 +2989,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
3014
2989
|
};
|
|
3015
2990
|
D.prototype.g = function(a, b, c) {
|
|
3016
2991
|
this.h += String(a);
|
|
3017
|
-
if (null != b)
|
|
3018
|
-
for (let d = 1; d < arguments.length; d++)
|
|
3019
|
-
this.h += arguments[d];
|
|
2992
|
+
if (null != b) for (let d = 1; d < arguments.length; d++) this.h += arguments[d];
|
|
3020
2993
|
return this;
|
|
3021
2994
|
};
|
|
3022
2995
|
function E(a) {
|
|
@@ -8402,8 +8375,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8402
8375
|
return null != a && (1 != x(a, 9) || -1 != u(a, 9)[0]);
|
|
8403
8376
|
}
|
|
8404
8377
|
function O(a, b) {
|
|
8405
|
-
for (var c = new D(), d, e = a.length, f = 0; f < e; ++f)
|
|
8406
|
-
d = a.charAt(f), d = b[d.toUpperCase()], null != d && c.g(d);
|
|
8378
|
+
for (var c = new D(), d, e = a.length, f = 0; f < e; ++f) d = a.charAt(f), d = b[d.toUpperCase()], null != d && c.g(d);
|
|
8407
8379
|
return c.toString();
|
|
8408
8380
|
}
|
|
8409
8381
|
function Ya(a) {
|
|
@@ -8415,15 +8387,12 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8415
8387
|
K.prototype.format = function(a, b) {
|
|
8416
8388
|
if (0 == r(a, 2) && q(a, 5)) {
|
|
8417
8389
|
var c = w(a, 5);
|
|
8418
|
-
if (0 < c.length)
|
|
8419
|
-
return c;
|
|
8390
|
+
if (0 < c.length) return c;
|
|
8420
8391
|
}
|
|
8421
8392
|
c = w(a, 1);
|
|
8422
8393
|
var d = Q(a);
|
|
8423
|
-
if (0 == b)
|
|
8424
|
-
|
|
8425
|
-
if (!(c in J))
|
|
8426
|
-
return d;
|
|
8394
|
+
if (0 == b) return Za(c, 0, d, "");
|
|
8395
|
+
if (!(c in J)) return d;
|
|
8427
8396
|
var e = R(this, c, S(c));
|
|
8428
8397
|
a = q(a, 3) && 0 != r(a, 3).length ? 3 == b ? ";ext=" + r(a, 3) : q(e, 13) ? r(e, 13) + w(a, 3) : " ext. " + w(a, 3) : "";
|
|
8429
8398
|
a: {
|
|
@@ -8450,8 +8419,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8450
8419
|
return "001" == c ? T(a, "" + b) : T(a, c);
|
|
8451
8420
|
}
|
|
8452
8421
|
function Q(a) {
|
|
8453
|
-
if (!q(a, 2))
|
|
8454
|
-
return "";
|
|
8422
|
+
if (!q(a, 2)) return "";
|
|
8455
8423
|
var b = "" + r(a, 2);
|
|
8456
8424
|
return q(a, 4) && r(a, 4) && 0 < w(a, 8) ? Array(w(a, 8) + 1).join("0") + b : b;
|
|
8457
8425
|
}
|
|
@@ -8498,14 +8466,12 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8498
8466
|
return V(a, r(b, 1)) ? V(a, r(b, 5)) ? 4 : V(a, r(b, 4)) ? 3 : V(a, r(b, 6)) ? 5 : V(a, r(b, 8)) ? 6 : V(a, r(b, 7)) ? 7 : V(a, r(b, 21)) ? 8 : V(a, r(b, 25)) ? 9 : V(a, r(b, 28)) ? 10 : V(a, r(b, 2)) ? r(b, 18) || V(a, r(b, 3)) ? 2 : 0 : !r(b, 18) && V(a, r(b, 3)) ? 1 : -1 : -1;
|
|
8499
8467
|
}
|
|
8500
8468
|
function T(a, b) {
|
|
8501
|
-
if (null == b)
|
|
8502
|
-
return null;
|
|
8469
|
+
if (null == b) return null;
|
|
8503
8470
|
b = b.toUpperCase();
|
|
8504
8471
|
var c = a.g[b];
|
|
8505
8472
|
if (null == c) {
|
|
8506
8473
|
c = Da[b];
|
|
8507
|
-
if (null == c)
|
|
8508
|
-
return null;
|
|
8474
|
+
if (null == c) return null;
|
|
8509
8475
|
c = new C().g(H.m(), c);
|
|
8510
8476
|
a.g[b] = c;
|
|
8511
8477
|
}
|
|
@@ -8516,32 +8482,28 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8516
8482
|
return 0 < x(b, 9) && -1 == u(b, 9).indexOf(c) ? false : N(w(b, 2), a);
|
|
8517
8483
|
}
|
|
8518
8484
|
function ab(a, b) {
|
|
8519
|
-
if (null == b)
|
|
8520
|
-
return null;
|
|
8485
|
+
if (null == b) return null;
|
|
8521
8486
|
var c = w(b, 1);
|
|
8522
8487
|
c = J[c];
|
|
8523
|
-
if (null == c)
|
|
8524
|
-
|
|
8525
|
-
else
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
var g = T(a, d);
|
|
8533
|
-
if (q(g, 23)) {
|
|
8534
|
-
if (0 == b.search(r(g, 23))) {
|
|
8535
|
-
a = d;
|
|
8536
|
-
break a;
|
|
8537
|
-
}
|
|
8538
|
-
} else if (-1 != $a(b, g)) {
|
|
8488
|
+
if (null == c) a = null;
|
|
8489
|
+
else if (1 == c.length) a = c[0];
|
|
8490
|
+
else a: {
|
|
8491
|
+
b = Q(b);
|
|
8492
|
+
for (var d, e = c.length, f = 0; f < e; f++) {
|
|
8493
|
+
d = c[f];
|
|
8494
|
+
var g = T(a, d);
|
|
8495
|
+
if (q(g, 23)) {
|
|
8496
|
+
if (0 == b.search(r(g, 23))) {
|
|
8539
8497
|
a = d;
|
|
8540
8498
|
break a;
|
|
8541
8499
|
}
|
|
8500
|
+
} else if (-1 != $a(b, g)) {
|
|
8501
|
+
a = d;
|
|
8502
|
+
break a;
|
|
8542
8503
|
}
|
|
8543
|
-
a = null;
|
|
8544
8504
|
}
|
|
8505
|
+
a = null;
|
|
8506
|
+
}
|
|
8545
8507
|
return a;
|
|
8546
8508
|
}
|
|
8547
8509
|
function S(a) {
|
|
@@ -8550,55 +8512,42 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8550
8512
|
}
|
|
8551
8513
|
function bb(a, b) {
|
|
8552
8514
|
a = T(a, b);
|
|
8553
|
-
if (null == a)
|
|
8554
|
-
throw Error("Invalid region code: " + b);
|
|
8515
|
+
if (null == a) throw Error("Invalid region code: " + b);
|
|
8555
8516
|
return w(a, 10);
|
|
8556
8517
|
}
|
|
8557
8518
|
function W(a, b, c, d) {
|
|
8558
8519
|
var e = U(c, d), f = 0 == x(e, 9) ? u(r(c, 1), 9) : u(e, 9);
|
|
8559
8520
|
e = u(e, 10);
|
|
8560
|
-
if (2 == d)
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
else
|
|
8564
|
-
return W(a, b, c, 1);
|
|
8565
|
-
if (-1 == f[0])
|
|
8566
|
-
return 5;
|
|
8521
|
+
if (2 == d) if (Xa(U(c, 0))) a = U(c, 1), Xa(a) && (f = f.concat(0 == x(a, 9) ? u(r(c, 1), 9) : u(a, 9)), f.sort(), 0 == e.length ? e = u(a, 10) : (e = e.concat(u(a, 10)), e.sort()));
|
|
8522
|
+
else return W(a, b, c, 1);
|
|
8523
|
+
if (-1 == f[0]) return 5;
|
|
8567
8524
|
b = b.length;
|
|
8568
|
-
if (-1 < e.indexOf(b))
|
|
8569
|
-
return 4;
|
|
8525
|
+
if (-1 < e.indexOf(b)) return 4;
|
|
8570
8526
|
c = f[0];
|
|
8571
8527
|
return c == b ? 0 : c > b ? 2 : f[f.length - 1] < b ? 3 : -1 < f.indexOf(b, 1) ? 0 : 5;
|
|
8572
8528
|
}
|
|
8573
8529
|
function X(a, b, c) {
|
|
8574
8530
|
var d = Q(b);
|
|
8575
8531
|
b = w(b, 1);
|
|
8576
|
-
if (!(b in J))
|
|
8577
|
-
return 1;
|
|
8532
|
+
if (!(b in J)) return 1;
|
|
8578
8533
|
b = R(a, b, S(b));
|
|
8579
8534
|
return W(a, d, b, c);
|
|
8580
8535
|
}
|
|
8581
8536
|
function cb(a, b) {
|
|
8582
8537
|
a = a.toString();
|
|
8583
|
-
if (0 == a.length || "0" == a.charAt(0))
|
|
8584
|
-
|
|
8585
|
-
for (var c, d = a.length, e = 1; 3 >= e && e <= d; ++e)
|
|
8586
|
-
if (c = parseInt(a.substring(0, e), 10), c in J)
|
|
8587
|
-
return b.g(a.substring(e)), c;
|
|
8538
|
+
if (0 == a.length || "0" == a.charAt(0)) return 0;
|
|
8539
|
+
for (var c, d = a.length, e = 1; 3 >= e && e <= d; ++e) if (c = parseInt(a.substring(0, e), 10), c in J) return b.g(a.substring(e)), c;
|
|
8588
8540
|
return 0;
|
|
8589
8541
|
}
|
|
8590
8542
|
function db(a, b, c, d, e, f) {
|
|
8591
|
-
if (0 == b.length)
|
|
8592
|
-
return 0;
|
|
8543
|
+
if (0 == b.length) return 0;
|
|
8593
8544
|
b = new D(b);
|
|
8594
8545
|
var g;
|
|
8595
8546
|
null != c && (g = r(c, 11));
|
|
8596
8547
|
null == g && (g = "NonMatch");
|
|
8597
8548
|
var h = b.toString();
|
|
8598
|
-
if (0 == h.length)
|
|
8599
|
-
|
|
8600
|
-
else if (L.test(h))
|
|
8601
|
-
h = h.replace(L, ""), E(b), b.g(Va(h)), g = 1;
|
|
8549
|
+
if (0 == h.length) g = 20;
|
|
8550
|
+
else if (L.test(h)) h = h.replace(L, ""), E(b), b.g(Va(h)), g = 1;
|
|
8602
8551
|
else {
|
|
8603
8552
|
h = new RegExp(g);
|
|
8604
8553
|
Wa(b);
|
|
@@ -8607,21 +8556,17 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8607
8556
|
h = g.match(h)[0].length;
|
|
8608
8557
|
var l = g.substring(h).match(Ia);
|
|
8609
8558
|
l && null != l[1] && 0 < l[1].length && "0" == O(l[1], Ea) ? g = false : (E(b), b.g(g.substring(h)), g = true);
|
|
8610
|
-
} else
|
|
8611
|
-
g = false;
|
|
8559
|
+
} else g = false;
|
|
8612
8560
|
g = g ? 5 : 20;
|
|
8613
8561
|
}
|
|
8614
8562
|
e && t(f, 6, g);
|
|
8615
8563
|
if (20 != g) {
|
|
8616
|
-
if (2 >= b.h.length)
|
|
8617
|
-
throw Error("Phone number too short after IDD");
|
|
8564
|
+
if (2 >= b.h.length) throw Error("Phone number too short after IDD");
|
|
8618
8565
|
a = cb(b, d);
|
|
8619
|
-
if (0 != a)
|
|
8620
|
-
return t(f, 1, a), a;
|
|
8566
|
+
if (0 != a) return t(f, 1, a), a;
|
|
8621
8567
|
throw Error("Invalid country calling code");
|
|
8622
8568
|
}
|
|
8623
|
-
if (null != c && (g = w(c, 10), h = "" + g, l = b.toString(), 0 == l.lastIndexOf(h, 0) && (h = new D(l.substring(h.length)), l = r(c, 1), l = new RegExp(w(l, 2)), eb(h, c, null), h = h.toString(), !N(l, b.toString()) && N(l, h) || 3 == W(a, b.toString(), c, -1))))
|
|
8624
|
-
return d.g(h), e && t(f, 6, 10), t(f, 1, g), g;
|
|
8569
|
+
if (null != c && (g = w(c, 10), h = "" + g, l = b.toString(), 0 == l.lastIndexOf(h, 0) && (h = new D(l.substring(h.length)), l = r(c, 1), l = new RegExp(w(l, 2)), eb(h, c, null), h = h.toString(), !N(l, b.toString()) && N(l, h) || 3 == W(a, b.toString(), c, -1)))) return d.g(h), e && t(f, 6, 10), t(f, 1, g), g;
|
|
8625
8570
|
t(f, 1, 0);
|
|
8626
8571
|
return 0;
|
|
8627
8572
|
}
|
|
@@ -8634,46 +8579,36 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8634
8579
|
var h = N(f, d), l = e.length - 1;
|
|
8635
8580
|
b = r(b, 16);
|
|
8636
8581
|
if (null == b || 0 == b.length || null == e[l] || 0 == e[l].length) {
|
|
8637
|
-
if (!h || N(f, d.substring(e[0].length)))
|
|
8638
|
-
|
|
8639
|
-
} else if (d = d.replace(g, b), !h || N(f, d))
|
|
8640
|
-
null != c && 0 < l && c.g(e[1]), a.set(d);
|
|
8582
|
+
if (!h || N(f, d.substring(e[0].length))) null != c && 0 < l && null != e[l] && c.g(e[1]), a.set(d.substring(e[0].length));
|
|
8583
|
+
} else if (d = d.replace(g, b), !h || N(f, d)) null != c && 0 < l && c.g(e[1]), a.set(d);
|
|
8641
8584
|
}
|
|
8642
8585
|
}
|
|
8643
8586
|
}
|
|
8644
8587
|
function Y(a, b, c) {
|
|
8645
|
-
if (!P(c) && 0 < b.length && "+" != b.charAt(0))
|
|
8646
|
-
throw Error("Invalid country calling code");
|
|
8588
|
+
if (!P(c) && 0 < b.length && "+" != b.charAt(0)) throw Error("Invalid country calling code");
|
|
8647
8589
|
return fb(a, b, c, true);
|
|
8648
8590
|
}
|
|
8649
8591
|
function fb(a, b, c, d) {
|
|
8650
|
-
if (null == b)
|
|
8651
|
-
|
|
8652
|
-
if (250 < b.length)
|
|
8653
|
-
throw Error("The string supplied is too long to be a phone number");
|
|
8592
|
+
if (null == b) throw Error("The string supplied did not seem to be a phone number");
|
|
8593
|
+
if (250 < b.length) throw Error("The string supplied is too long to be a phone number");
|
|
8654
8594
|
var e = new D();
|
|
8655
8595
|
var f = b.indexOf(";phone-context=");
|
|
8656
|
-
if (-1 === f)
|
|
8657
|
-
|
|
8658
|
-
else if (f += 15, f >= b.length)
|
|
8659
|
-
f = "";
|
|
8596
|
+
if (-1 === f) f = null;
|
|
8597
|
+
else if (f += 15, f >= b.length) f = "";
|
|
8660
8598
|
else {
|
|
8661
8599
|
var g = b.indexOf(";", f);
|
|
8662
8600
|
f = -1 !== g ? b.substring(f, g) : b.substring(f);
|
|
8663
8601
|
}
|
|
8664
8602
|
var h = f;
|
|
8665
8603
|
null == h ? g = true : 0 === h.length ? g = false : (g = Na.exec(h), h = Oa.exec(h), g = null !== g || null !== h);
|
|
8666
|
-
if (!g)
|
|
8667
|
-
throw Error("The string supplied did not seem to be a phone number");
|
|
8604
|
+
if (!g) throw Error("The string supplied did not seem to be a phone number");
|
|
8668
8605
|
null != f ? ("+" === f.charAt(0) && e.g(f), f = b.indexOf("tel:"), e.g(b.substring(0 <= f ? f + 4 : 0, b.indexOf(";phone-context=")))) : (f = e.g, g = b ?? "", h = g.search(Ja), 0 <= h ? (g = g.substring(h), g = g.replace(La, ""), h = g.search(Ka), 0 <= h && (g = g.substring(0, h))) : g = "", f.call(e, g));
|
|
8669
8606
|
f = e.toString();
|
|
8670
8607
|
g = f.indexOf(";isub=");
|
|
8671
8608
|
0 < g && (E(e), e.g(f.substring(0, g)));
|
|
8672
|
-
if (!Ua(e.toString()))
|
|
8673
|
-
throw Error("The string supplied did not seem to be a phone number");
|
|
8609
|
+
if (!Ua(e.toString())) throw Error("The string supplied did not seem to be a phone number");
|
|
8674
8610
|
f = e.toString();
|
|
8675
|
-
if (!(P(c) || null != f && 0 < f.length && L.test(f)))
|
|
8676
|
-
throw Error("Invalid country calling code");
|
|
8611
|
+
if (!(P(c) || null != f && 0 < f.length && L.test(f))) throw Error("Invalid country calling code");
|
|
8677
8612
|
f = new I();
|
|
8678
8613
|
d && t(f, 5, b);
|
|
8679
8614
|
a: {
|
|
@@ -8681,13 +8616,12 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8681
8616
|
g = b.search(Qa);
|
|
8682
8617
|
if (0 <= g && Ua(b.substring(0, g))) {
|
|
8683
8618
|
h = b.match(Qa);
|
|
8684
|
-
for (var l = h.length, A = 1; A < l; ++A)
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
}
|
|
8619
|
+
for (var l = h.length, A = 1; A < l; ++A) if (null != h[A] && 0 < h[A].length) {
|
|
8620
|
+
E(e);
|
|
8621
|
+
e.g(b.substring(0, g));
|
|
8622
|
+
b = h[A];
|
|
8623
|
+
break a;
|
|
8624
|
+
}
|
|
8691
8625
|
}
|
|
8692
8626
|
b = "";
|
|
8693
8627
|
}
|
|
@@ -8700,29 +8634,23 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8700
8634
|
h = db(a, l, g, b, d, f);
|
|
8701
8635
|
} catch (ca) {
|
|
8702
8636
|
if ("Invalid country calling code" == ca.message && L.test(l)) {
|
|
8703
|
-
if (l = l.replace(L, ""), h = db(a, l, g, b, d, f), 0 == h)
|
|
8704
|
-
|
|
8705
|
-
} else
|
|
8706
|
-
throw ca;
|
|
8637
|
+
if (l = l.replace(L, ""), h = db(a, l, g, b, d, f), 0 == h) throw ca;
|
|
8638
|
+
} else throw ca;
|
|
8707
8639
|
}
|
|
8708
8640
|
0 != h ? (e = S(h), e != c && (g = R(a, h, e))) : (Wa(e), b.g(e.toString()), null != c ? (h = w(g, 10), t(
|
|
8709
8641
|
f,
|
|
8710
8642
|
1,
|
|
8711
8643
|
h
|
|
8712
8644
|
)) : d && (delete f.h[6], f.g && delete f.g[6]));
|
|
8713
|
-
if (2 > b.h.length)
|
|
8714
|
-
throw Error("The string supplied is too short to be a phone number");
|
|
8645
|
+
if (2 > b.h.length) throw Error("The string supplied is too short to be a phone number");
|
|
8715
8646
|
null != g && (c = new D(), e = new D(b.toString()), eb(e, g, c), a = W(a, e.toString(), g, -1), 2 != a && 4 != a && 5 != a && (b = e, d && 0 < c.toString().length && t(f, 7, c.toString())));
|
|
8716
8647
|
d = b.toString();
|
|
8717
8648
|
a = d.length;
|
|
8718
|
-
if (2 > a)
|
|
8719
|
-
|
|
8720
|
-
if (17 < a)
|
|
8721
|
-
throw Error("The string supplied is too long to be a phone number");
|
|
8649
|
+
if (2 > a) throw Error("The string supplied is too short to be a phone number");
|
|
8650
|
+
if (17 < a) throw Error("The string supplied is too long to be a phone number");
|
|
8722
8651
|
if (1 < d.length && "0" == d.charAt(0)) {
|
|
8723
8652
|
t(f, 4, true);
|
|
8724
|
-
for (a = 1; a < d.length - 1 && "0" == d.charAt(a); )
|
|
8725
|
-
a++;
|
|
8653
|
+
for (a = 1; a < d.length - 1 && "0" == d.charAt(a); ) a++;
|
|
8726
8654
|
1 != a && t(f, 8, a);
|
|
8727
8655
|
}
|
|
8728
8656
|
t(f, 2, parseInt(d, 10));
|
|
@@ -8763,8 +8691,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8763
8691
|
function lb(a) {
|
|
8764
8692
|
for (var b = a.j.length, c = 0; c < b; ++c) {
|
|
8765
8693
|
var d = a.j[c], e = w(d, 1);
|
|
8766
|
-
if (a.da == e)
|
|
8767
|
-
return false;
|
|
8694
|
+
if (a.da == e) return false;
|
|
8768
8695
|
var f = a;
|
|
8769
8696
|
var g = d, h = w(g, 1);
|
|
8770
8697
|
E(f.v);
|
|
@@ -8773,8 +8700,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8773
8700
|
var A = "999999999999999".match(h)[0];
|
|
8774
8701
|
A.length < l.g.h.length ? l = "" : (l = A.replace(new RegExp(h, "g"), g), l = l.replace(RegExp("9", "g"), "\u2008"));
|
|
8775
8702
|
0 < l.length ? (f.v.g(l), f = true) : f = false;
|
|
8776
|
-
if (f)
|
|
8777
|
-
return a.da = e, a.ha = kb.test(r(d, 4)), a.$ = 0, true;
|
|
8703
|
+
if (f) return a.da = e, a.ha = kb.test(r(d, 4)), a.$ = 0, true;
|
|
8778
8704
|
}
|
|
8779
8705
|
return a.u = false;
|
|
8780
8706
|
}
|
|
@@ -8792,10 +8718,8 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8792
8718
|
if (!a.u) {
|
|
8793
8719
|
if (!a.la) {
|
|
8794
8720
|
if (ob(a)) {
|
|
8795
|
-
if (pb(a))
|
|
8796
|
-
|
|
8797
|
-
} else if (0 < a.o.length && (b = a.g.toString(), E(a.g), a.g.g(a.o), a.g.g(b), b = a.h.toString(), c = b.lastIndexOf(a.o), E(a.h), a.h.g(b.substring(0, c))), a.o != rb(a))
|
|
8798
|
-
return a.h.g(" "), qb(a);
|
|
8721
|
+
if (pb(a)) return qb(a);
|
|
8722
|
+
} else if (0 < a.o.length && (b = a.g.toString(), E(a.g), a.g.g(a.o), a.g.g(b), b = a.h.toString(), c = b.lastIndexOf(a.o), E(a.h), a.h.g(b.substring(0, c))), a.o != rb(a)) return a.h.g(" "), qb(a);
|
|
8799
8723
|
}
|
|
8800
8724
|
return a.s.toString();
|
|
8801
8725
|
}
|
|
@@ -8805,18 +8729,14 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8805
8729
|
case 2:
|
|
8806
8730
|
return a.s.toString();
|
|
8807
8731
|
case 3:
|
|
8808
|
-
if (ob(a))
|
|
8809
|
-
|
|
8810
|
-
else
|
|
8811
|
-
return a.o = rb(a), sb(a);
|
|
8732
|
+
if (ob(a)) a.ea = true;
|
|
8733
|
+
else return a.o = rb(a), sb(a);
|
|
8812
8734
|
default:
|
|
8813
|
-
if (a.ea)
|
|
8814
|
-
return pb(a) && (a.ea = false), a.h.toString() + a.g.toString();
|
|
8735
|
+
if (a.ea) return pb(a) && (a.ea = false), a.h.toString() + a.g.toString();
|
|
8815
8736
|
if (0 < a.j.length) {
|
|
8816
8737
|
b = tb(a, b);
|
|
8817
8738
|
c = ub(a);
|
|
8818
|
-
if (0 < c.length)
|
|
8819
|
-
return c;
|
|
8739
|
+
if (0 < c.length) return c;
|
|
8820
8740
|
mb(a, a.g.toString());
|
|
8821
8741
|
return lb(a) ? vb(a) : a.u ? Z(a, b) : a.s.toString();
|
|
8822
8742
|
}
|
|
@@ -8835,8 +8755,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8835
8755
|
function ub(a) {
|
|
8836
8756
|
for (var b = a.g.toString(), c = a.j.length, d = 0; d < c; ++d) {
|
|
8837
8757
|
var e = a.j[d], f = w(e, 1);
|
|
8838
|
-
if (new RegExp("^(?:" + f + ")$").test(b) && (a.ha = kb.test(r(e, 4)), e = b.replace(new RegExp(f, "g"), r(e, 2)), e = Z(a, e), O(e, Fa) == a.ba))
|
|
8839
|
-
return e;
|
|
8758
|
+
if (new RegExp("^(?:" + f + ")$").test(b) && (a.ha = kb.test(r(e, 4)), e = b.replace(new RegExp(f, "g"), r(e, 2)), e = Z(a, e), O(e, Fa) == a.ba)) return e;
|
|
8840
8759
|
}
|
|
8841
8760
|
return "";
|
|
8842
8761
|
}
|
|
@@ -8860,18 +8779,15 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8860
8779
|
function vb(a) {
|
|
8861
8780
|
var b = a.g.toString(), c = b.length;
|
|
8862
8781
|
if (0 < c) {
|
|
8863
|
-
for (var d = "", e = 0; e < c; e++)
|
|
8864
|
-
d = tb(a, b.charAt(e));
|
|
8782
|
+
for (var d = "", e = 0; e < c; e++) d = tb(a, b.charAt(e));
|
|
8865
8783
|
return a.u ? Z(a, d) : a.s.toString();
|
|
8866
8784
|
}
|
|
8867
8785
|
return a.h.toString();
|
|
8868
8786
|
}
|
|
8869
8787
|
function rb(a) {
|
|
8870
8788
|
var b = a.g.toString(), c = 0;
|
|
8871
|
-
if (1 != r(a.l, 10))
|
|
8872
|
-
|
|
8873
|
-
else
|
|
8874
|
-
d = a.g.toString(), d = "1" == d.charAt(0) && "0" != d.charAt(1) && "1" != d.charAt(1);
|
|
8789
|
+
if (1 != r(a.l, 10)) var d = false;
|
|
8790
|
+
else d = a.g.toString(), d = "1" == d.charAt(0) && "0" != d.charAt(1) && "1" != d.charAt(1);
|
|
8875
8791
|
d ? (c = 1, a.h.g("1").g(" "), a.ca = true) : q(a.l, 15) && (d = new RegExp("^(?:" + r(a.l, 15) + ")"), d = b.match(d), null != d && null != d[0] && 0 < d[0].length && (a.ca = true, c = d[0].length, a.h.g(b.substring(0, c))));
|
|
8876
8792
|
E(a.g);
|
|
8877
8793
|
a.g.g(b.substring(c));
|
|
@@ -8883,11 +8799,9 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8883
8799
|
return null != c && null != c[0] && 0 < c[0].length ? (a.ca = true, c = c[0].length, E(a.g), a.g.g(b.substring(c)), E(a.h), a.h.g(b.substring(0, c)), "+" != b.charAt(0) && a.h.g(" "), true) : false;
|
|
8884
8800
|
}
|
|
8885
8801
|
function pb(a) {
|
|
8886
|
-
if (0 == a.g.h.length)
|
|
8887
|
-
return false;
|
|
8802
|
+
if (0 == a.g.h.length) return false;
|
|
8888
8803
|
var b = new D(), c = cb(a.g, b);
|
|
8889
|
-
if (0 == c)
|
|
8890
|
-
return false;
|
|
8804
|
+
if (0 == c) return false;
|
|
8891
8805
|
E(a.g);
|
|
8892
8806
|
a.g.g(b.toString());
|
|
8893
8807
|
b = S(c);
|
|
@@ -8917,8 +8831,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8917
8831
|
try {
|
|
8918
8832
|
const c = a.replace(/[^+0-9]/g, ""), d = new gb(b);
|
|
8919
8833
|
b = "";
|
|
8920
|
-
for (let e = 0; e < c.length; e++)
|
|
8921
|
-
d.ja = nb(d, c.charAt(e)), b = d.ja;
|
|
8834
|
+
for (let e = 0; e < c.length; e++) d.ja = nb(d, c.charAt(e)), b = d.ja;
|
|
8922
8835
|
return b;
|
|
8923
8836
|
} catch (c) {
|
|
8924
8837
|
return a;
|
|
@@ -8967,8 +8880,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8967
8880
|
try {
|
|
8968
8881
|
const g = K.g(), h = Y(g, a, b);
|
|
8969
8882
|
var c = ab(g, h), d = R(g, w(h, 1), c);
|
|
8970
|
-
if (null == d)
|
|
8971
|
-
var e = -1;
|
|
8883
|
+
if (null == d) var e = -1;
|
|
8972
8884
|
else {
|
|
8973
8885
|
var f = Q(h);
|
|
8974
8886
|
e = $a(f, d);
|
|
@@ -8992,8 +8904,7 @@ var intl_tel_input_default = intlTelInput;
|
|
|
8992
8904
|
var c = Y(l, a, b), d = ab(l, c);
|
|
8993
8905
|
a = l;
|
|
8994
8906
|
var e = w(c, 1), f = R(a, e, d);
|
|
8995
|
-
if (null == f || "001" != d && e != bb(a, d))
|
|
8996
|
-
var g = false;
|
|
8907
|
+
if (null == f || "001" != d && e != bb(a, d)) var g = false;
|
|
8997
8908
|
else {
|
|
8998
8909
|
var h = Q(c);
|
|
8999
8910
|
g = -1 != $a(h, f);
|
|
@@ -9031,8 +8942,8 @@ intl_tel_input_default.utils = utils_default;
|
|
|
9031
8942
|
var intlTelInputWithUtils_default = intl_tel_input_default;
|
|
9032
8943
|
|
|
9033
8944
|
// react/src/intl-tel-input/reactWithUtils.tsx
|
|
9034
|
-
import React, { useRef, useEffect } from "react";
|
|
9035
|
-
var IntlTelInput = ({
|
|
8945
|
+
import React, { useRef, useEffect, forwardRef, useImperativeHandle } from "react";
|
|
8946
|
+
var IntlTelInput = forwardRef(function IntlTelInput2({
|
|
9036
8947
|
initialValue = "",
|
|
9037
8948
|
onChangeNumber = () => {
|
|
9038
8949
|
},
|
|
@@ -9045,9 +8956,20 @@ var IntlTelInput = ({
|
|
|
9045
8956
|
usePreciseValidation = false,
|
|
9046
8957
|
initOptions = {},
|
|
9047
8958
|
inputProps = {}
|
|
9048
|
-
})
|
|
8959
|
+
}, ref) {
|
|
9049
8960
|
const inputRef = useRef(null);
|
|
9050
8961
|
const itiRef = useRef(null);
|
|
8962
|
+
useImperativeHandle(ref, () => ({
|
|
8963
|
+
getInstance: () => ({
|
|
8964
|
+
setCountry: (country) => itiRef.current?.setCountry(country),
|
|
8965
|
+
// override setNumber to also call update, to trigger onChangeNumber etc
|
|
8966
|
+
setNumber: (num) => {
|
|
8967
|
+
itiRef.current?.setNumber(num);
|
|
8968
|
+
update();
|
|
8969
|
+
}
|
|
8970
|
+
}),
|
|
8971
|
+
getInput: () => inputRef.current
|
|
8972
|
+
}));
|
|
9051
8973
|
const update = () => {
|
|
9052
8974
|
const num = itiRef.current?.getNumber() || "";
|
|
9053
8975
|
const countryIso = itiRef.current?.getSelectedCountryData().iso2 || "";
|
|
@@ -9089,8 +9011,9 @@ var IntlTelInput = ({
|
|
|
9089
9011
|
...inputProps
|
|
9090
9012
|
}
|
|
9091
9013
|
);
|
|
9092
|
-
};
|
|
9014
|
+
});
|
|
9093
9015
|
var reactWithUtils_default = IntlTelInput;
|
|
9094
9016
|
export {
|
|
9095
|
-
reactWithUtils_default as default
|
|
9017
|
+
reactWithUtils_default as default,
|
|
9018
|
+
intlTelInputWithUtils_default as intlTelInput
|
|
9096
9019
|
};
|