@incodetech/web 0.0.0-dev-20260407-4580f1c → 0.0.0-dev-20260407-2c382da
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/dist/AsYouType-D1H_js4X.js +2607 -0
- package/dist/Trans-aTzdT_SA.js +55 -0
- package/dist/addressAutocomplete-C8-wL1j_.js +153 -0
- package/dist/aligndevicelottie-DlQCRPfM.js +29 -0
- package/dist/antifraud/antifraud.es.js +18 -17
- package/dist/antifraud/styles.css +1 -1
- package/dist/authentication/authentication.es.js +50 -28
- package/dist/back-horizontal-hint-CSlf9KI1.js +5 -0
- package/dist/back-tutorial-An9AcMSe.js +29 -0
- package/dist/back-vertical-hint-CNieqiCr.js +5 -0
- package/dist/backdevicelottie-B4NgyWmX.js +29 -0
- package/dist/base.css +67 -327
- package/dist/blurdevicelottie-_BZRug1c.js +29 -0
- package/dist/browser-ponyfill-B6W6hHVY.js +344 -0
- package/dist/button-CE9kRlem.js +184 -0
- package/dist/cameraView-C2X7klNb.js +55 -0
- package/dist/captureOverlay-tCb4R4WE.js +592 -0
- package/dist/checkbox-B5X-mfqq.js +137 -0
- package/dist/chevronDown-DSHaPKbi.js +23 -0
- package/dist/closeIcon-9Hc97omv.js +28 -0
- package/dist/consent/consent.es.js +89 -82
- package/dist/consent/styles.css +1 -1
- package/dist/countries-DfLkrF0x.js +616 -0
- package/dist/curp-validation/curp-validation.es.js +313 -271
- package/dist/curp-validation/styles.css +1 -1
- package/dist/dateInputComposed-C7PCzh-U.js +173 -0
- package/dist/document-capture/styles.css +1 -1
- package/dist/documentCapture-C0mO-RGE.js +692 -0
- package/dist/dropdownComposed-BpinYlrx.js +367 -0
- package/dist/ekyb/styles.css +1 -1
- package/dist/ekybModule-Dr6LJUg-.js +357 -0
- package/dist/ekyc/styles.css +1 -1
- package/dist/ekycModule-C3mswduI.js +291 -0
- package/dist/email/email.es.js +154 -110
- package/dist/email/styles.css +1 -1
- package/dist/errorContent-Cb8nmQAE.js +44 -0
- package/dist/errorIcon-DEARBrGx.js +26 -0
- package/dist/extensibility.es.js +150 -22
- package/dist/face-match/styles.css +73 -147
- package/dist/faceMatch-DbDp7D3d.js +237 -0
- package/dist/fileIcon-CCSvS10T.js +52 -0
- package/dist/flip-animation-COR596wy.js +29 -0
- package/dist/flipAnimation-BqV462TA.js +2059 -0
- package/dist/flow/flow.es.js +2613 -2273
- package/dist/flow/styles.css +73 -432
- package/dist/formField-CP6wDdfA.js +106 -0
- package/dist/front-horizontal-hint-lRLKd7vY.js +7 -0
- package/dist/front-vertical-hint-qQoJXRE3.js +7 -0
- package/dist/frontdevicelottie-KhKxT5n9.js +29 -0
- package/dist/geolocation/geolocation.es.js +832 -852
- package/dist/geolocation/styles.css +1 -1
- package/dist/glaredevicelottie-DLuIStvb.js +29 -0
- package/dist/governmentValidation/governmentValidation.es.js +106 -100
- package/dist/governmentValidation/styles.css +1 -1
- package/dist/id/id.es.js +59 -53
- package/dist/id/styles.css +1 -1
- package/dist/id-laser-h-BBV3r3rz.js +29 -0
- package/dist/id-laser-v-BTHJaSfx.js +29 -0
- package/dist/id-tutorial-B-F5Q28m.js +29 -0
- package/dist/incodeModule-C4XIllao.js +96 -0
- package/dist/index.es.js +25 -4
- package/dist/inputComposed-fUbAGrDy.js +103 -0
- package/dist/instance-BWYzq8dk.js +2163 -0
- package/dist/loadingIcon-DmuPXh70.js +195 -0
- package/dist/mandatoryConsent-5xPI0cor.js +94 -0
- package/dist/manualCaptureButton-BvFmTyJe.js +372 -0
- package/dist/numberedStep-DwUB__mh.js +5 -0
- package/dist/otpInput-BFXhqFRT.js +156 -0
- package/dist/page-SrUl0qtN.js +69 -0
- package/dist/passport-horizontal-hint-BCtpMp1Y.js +5 -0
- package/dist/passport-tutorial-CaYBFTqt.js +29 -0
- package/dist/passport-vertical-hint-GaLnzqHP.js +5 -0
- package/dist/permissions-DT4Fz9MR.js +709 -0
- package/dist/phone/phone.es.js +121 -87
- package/dist/phone/styles.css +1 -1
- package/dist/phoneInput-CGr8TxOO.js +158 -0
- package/dist/phoneInputComposed-Cm9O2Jba.js +206 -0
- package/dist/processing-szVOCQwZ.js +19 -0
- package/dist/redirect-to-mobile/styles.css +1 -1
- package/dist/richText-cspvNz2a.js +1807 -0
- package/dist/selfie/selfie.es.js +50 -29
- package/dist/selfie/styles.css +66 -170
- package/dist/selfieTutorial-Dm_p0ke9.js +29 -0
- package/dist/signature/signature.es.js +707 -557
- package/dist/signature/styles.css +1 -1
- package/dist/spinner-DygONskw.js +60 -0
- package/dist/successIcon-Bjsdc4lF.js +26 -0
- package/dist/tutorial-Cdz1025D.js +473 -0
- package/dist/types/ekyb/styles.d.ts +1 -0
- package/dist/types/ekyc/styles.d.ts +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/typography-BDACYR5i.js +14 -0
- package/dist/uiConfig-Dnt-2YWB.js +23 -0
- package/dist/useMediaQuery-lJdQBmC2.js +18 -0
- package/dist/vendor-preact-BoMmvSgn.js +694 -0
- package/dist/warningIcon-DQq_MrOB.js +26 -0
- package/package.json +11 -8
- package/dist/AsYouType-DPWqJvFu.js +0 -2482
- package/dist/addressAutocomplete-B3f6PGTT.js +0 -108
- package/dist/aligndevicelottie-C9xl1spu.js +0 -12757
- package/dist/back-horizontal-hint-Be3dUGk6.js +0 -137
- package/dist/back-tutorial-BNTyW-1N.js +0 -14584
- package/dist/back-vertical-hint-Bz_rnhd-.js +0 -128
- package/dist/backdevicelottie-DBB1YCtW.js +0 -16678
- package/dist/blurdevicelottie-9WvZCZ6C.js +0 -15939
- package/dist/browser-ponyfill-B4Qc6yfW.js +0 -299
- package/dist/button-DhL5eRT3.js +0 -123
- package/dist/checkbox-l8NxPf4o.js +0 -85
- package/dist/countries-y2ydYDhN.js +0 -8323
- package/dist/dateInputComposed-B9WqdYx9.js +0 -2
- package/dist/dateInputComposed-ndsGHX1M.js +0 -94
- package/dist/defineProperty-brqHEHA_.js +0 -39
- package/dist/documentCapture-wDgRLdon.js +0 -784
- package/dist/dropdownComposed-_Ey7wJNG.js +0 -258
- package/dist/ekyb/ekyb.es.js +0 -2
- package/dist/ekybModule-BBOm1y49.js +0 -2
- package/dist/ekybModule-fz6i9ZRt.js +0 -286
- package/dist/ekyc/ekyc.es.js +0 -2
- package/dist/ekycModule-SeTFG3AJ.js +0 -233
- package/dist/ekycModule-hxIcNX8n.js +0 -2
- package/dist/extensibility-DJihqIzM.js +0 -2248
- package/dist/faceMatch-DH8sLx34.js +0 -191
- package/dist/flip-animation-DOJzdXB-.js +0 -6983
- package/dist/formField-BRTbY8w9.js +0 -100
- package/dist/front-horizontal-hint-aGAhadA2.js +0 -380
- package/dist/front-vertical-hint-DZz1VeNp.js +0 -420
- package/dist/frontdevicelottie-DadDp6be.js +0 -17302
- package/dist/glaredevicelottie-BfI84cPw.js +0 -14466
- package/dist/i18n-DZOHbK9q.js +0 -1916
- package/dist/icons-BHbofCgJ.js +0 -245
- package/dist/id-laser-h-BWyU3VgL.js +0 -467
- package/dist/id-laser-v-JiWXUlv0.js +0 -467
- package/dist/id-tutorial-Cc9xg5_J.js +0 -13152
- package/dist/incodeModule-Bf6yJ8RB.js +0 -18
- package/dist/inputComposed-BhbfD8Ru.js +0 -77
- package/dist/loadingIcon-CeQt7Zgb.js +0 -146
- package/dist/mandatoryConsent-LBS8E0rj.js +0 -101
- package/dist/numberedStep-CQVRixRP.js +0 -11
- package/dist/otpInput-CDIG9el7.js +0 -143
- package/dist/page-SvlJWUfz.js +0 -61
- package/dist/passport-horizontal-hint-CFsGs7Dp.js +0 -293
- package/dist/passport-tutorial-z0LN7Hsp.js +0 -11688
- package/dist/passport-vertical-hint-BnCpKWeN.js +0 -267
- package/dist/phoneInput-C9T_8FJt.js +0 -138
- package/dist/phoneInputComposed-B-0zieIW.js +0 -407
- package/dist/processing-B5zhNH6I.js +0 -15
- package/dist/richText-Db0PfpkE.js +0 -1973
- package/dist/rolldown-runtime-CjdbFOpI.js +0 -13
- package/dist/selfieTutorial-B0MIyPrk.js +0 -2676
- package/dist/setup-Dq2bzNKH.js +0 -15
- package/dist/spacer-DCljE53A.js +0 -59
- package/dist/spinner-Bk0YuoLu.js +0 -1
- package/dist/spinner-snIGzmm8.js +0 -41
- package/dist/successIcon-AHrfmJvv.js +0 -17
- package/dist/tutorial-DNOd11tg.js +0 -2780
- package/dist/types/ekyb.d.ts +0 -29
- package/dist/types/ekyc.d.ts +0 -29
- package/dist/typography-BNbFNFek.js +0 -1
- package/dist/typography-DvHeVWfY.js +0 -29
- package/dist/uiConfig-CwpQ-IM6.js +0 -20
- package/dist/vendor-preact-D6SntenC.js +0 -958
- package/dist/warningIcon-Cvj-ayg1.js +0 -17
|
@@ -0,0 +1,2607 @@
|
|
|
1
|
+
import { M as g, d as et, i as j, v as zt, e as Jt, w as Zt, m as Qt } from "./countries-DfLkrF0x.js";
|
|
2
|
+
function U(t, r, e) {
|
|
3
|
+
return te(t, r, void 0, e);
|
|
4
|
+
}
|
|
5
|
+
function te(t, r, e, n) {
|
|
6
|
+
r && (n = new g(n.metadata), n.selectNumberingPlan(r));
|
|
7
|
+
var i = n.type(e), a = i && i.possibleLengths() || n.possibleLengths();
|
|
8
|
+
if (!a)
|
|
9
|
+
return "IS_POSSIBLE";
|
|
10
|
+
var o = t.length, u = a[0];
|
|
11
|
+
return u === o ? "IS_POSSIBLE" : u > o ? "TOO_SHORT" : a[a.length - 1] < o ? "TOO_LONG" : a.indexOf(o, 1) >= 0 ? "IS_POSSIBLE" : "INVALID_LENGTH";
|
|
12
|
+
}
|
|
13
|
+
function ee(t, r, e) {
|
|
14
|
+
if (r === void 0 && (r = {}), e = new g(e), r.v2) {
|
|
15
|
+
if (!t.countryCallingCode)
|
|
16
|
+
throw new Error("Invalid phone number object passed");
|
|
17
|
+
e.selectNumberingPlan(t.countryCallingCode);
|
|
18
|
+
} else {
|
|
19
|
+
if (!t.phone)
|
|
20
|
+
return !1;
|
|
21
|
+
if (t.country) {
|
|
22
|
+
if (!e.hasCountry(t.country))
|
|
23
|
+
throw new Error("Unknown country: ".concat(t.country));
|
|
24
|
+
e.selectNumberingPlan(t.country);
|
|
25
|
+
} else {
|
|
26
|
+
if (!t.countryCallingCode)
|
|
27
|
+
throw new Error("Invalid phone number object passed");
|
|
28
|
+
e.selectNumberingPlan(t.countryCallingCode);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (e.possibleLengths())
|
|
32
|
+
return Dt(t.phone || t.nationalNumber, t.country, e);
|
|
33
|
+
if (t.countryCallingCode && e.isNonGeographicCallingCode(t.countryCallingCode))
|
|
34
|
+
return !0;
|
|
35
|
+
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
|
|
36
|
+
}
|
|
37
|
+
function Dt(t, r, e) {
|
|
38
|
+
switch (U(t, r, e)) {
|
|
39
|
+
case "IS_POSSIBLE":
|
|
40
|
+
return !0;
|
|
41
|
+
// This library ignores "local-only" phone numbers (for simplicity).
|
|
42
|
+
// See the readme for more info on what are "local-only" phone numbers.
|
|
43
|
+
// case 'IS_POSSIBLE_LOCAL_ONLY':
|
|
44
|
+
// return !isInternational
|
|
45
|
+
default:
|
|
46
|
+
return !1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function C(t, r) {
|
|
50
|
+
return t = t || "", new RegExp("^(?:" + r + ")$").test(t);
|
|
51
|
+
}
|
|
52
|
+
function re(t, r) {
|
|
53
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
54
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
55
|
+
if (Array.isArray(t) || (e = ne(t)) || r) {
|
|
56
|
+
e && (t = e);
|
|
57
|
+
var n = 0;
|
|
58
|
+
return function() {
|
|
59
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
63
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
64
|
+
}
|
|
65
|
+
function ne(t, r) {
|
|
66
|
+
if (t) {
|
|
67
|
+
if (typeof t == "string") return ut(t, r);
|
|
68
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
69
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? ut(t, r) : void 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function ut(t, r) {
|
|
73
|
+
(r == null || r > t.length) && (r = t.length);
|
|
74
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
75
|
+
return n;
|
|
76
|
+
}
|
|
77
|
+
var ie = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
|
|
78
|
+
function rt(t, r, e) {
|
|
79
|
+
if (r = r || {}, !(!t.country && !t.countryCallingCode)) {
|
|
80
|
+
e = new g(e), e.selectNumberingPlan(t.country, t.countryCallingCode);
|
|
81
|
+
var n = r.v2 ? t.nationalNumber : t.phone;
|
|
82
|
+
if (C(n, e.nationalNumberPattern())) {
|
|
83
|
+
if (H(n, "FIXED_LINE", e))
|
|
84
|
+
return e.type("MOBILE") && e.type("MOBILE").pattern() === "" || !e.type("MOBILE") || H(n, "MOBILE", e) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
|
|
85
|
+
for (var i = re(ie), a; !(a = i()).done; ) {
|
|
86
|
+
var o = a.value;
|
|
87
|
+
if (H(n, o, e))
|
|
88
|
+
return o;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function H(t, r, e) {
|
|
94
|
+
return r = e.type(r), !r || !r.pattern() || r.possibleLengths() && r.possibleLengths().indexOf(t.length) < 0 ? !1 : C(t, r.pattern());
|
|
95
|
+
}
|
|
96
|
+
function ae(t, r, e) {
|
|
97
|
+
if (r = r || {}, e = new g(e), e.selectNumberingPlan(t.country, t.countryCallingCode), e.hasTypes())
|
|
98
|
+
return rt(t, r, e.metadata) !== void 0;
|
|
99
|
+
var n = r.v2 ? t.nationalNumber : t.phone;
|
|
100
|
+
return C(n, e.nationalNumberPattern());
|
|
101
|
+
}
|
|
102
|
+
function oe(t, r, e) {
|
|
103
|
+
var n = new g(e), i = n.getCountryCodesForCallingCode(t);
|
|
104
|
+
return i ? i.filter(function(a) {
|
|
105
|
+
return ue(r, a, e);
|
|
106
|
+
}) : [];
|
|
107
|
+
}
|
|
108
|
+
function ue(t, r, e) {
|
|
109
|
+
var n = new g(e);
|
|
110
|
+
return n.selectNumberingPlan(r), n.numberingPlan.possibleLengths().indexOf(t.length) >= 0;
|
|
111
|
+
}
|
|
112
|
+
var nt = 2, le = 17, fe = 3, y = "0-90-9٠-٩۰-۹", se = "-‐-―−ー-", ce = "//", he = "..", ge = " ", ye = "()()[]\\[\\]", me = "~⁓∼~", b = "".concat(se).concat(ce).concat(he).concat(ge).concat(ye).concat(me), B = "++", de = new RegExp("([" + y + "])");
|
|
113
|
+
function Lt(t, r, e, n) {
|
|
114
|
+
if (r) {
|
|
115
|
+
var i = new g(n);
|
|
116
|
+
i.selectNumberingPlan(r, e);
|
|
117
|
+
var a = new RegExp(i.IDDPrefix());
|
|
118
|
+
if (t.search(a) === 0) {
|
|
119
|
+
t = t.slice(t.match(a)[0].length);
|
|
120
|
+
var o = t.match(de);
|
|
121
|
+
if (!(o && o[1] != null && o[1].length > 0 && o[1] === "0"))
|
|
122
|
+
return t;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function X(t, r) {
|
|
127
|
+
if (t && r.numberingPlan.nationalPrefixForParsing()) {
|
|
128
|
+
var e = new RegExp("^(?:" + r.numberingPlan.nationalPrefixForParsing() + ")"), n = e.exec(t);
|
|
129
|
+
if (n) {
|
|
130
|
+
var i, a, o = n.length - 1, u = o > 0 && n[o];
|
|
131
|
+
if (r.nationalPrefixTransformRule() && u)
|
|
132
|
+
i = t.replace(e, r.nationalPrefixTransformRule()), o > 1 && (a = n[1]);
|
|
133
|
+
else {
|
|
134
|
+
var l = n[0];
|
|
135
|
+
i = t.slice(l.length), u && (a = n[1]);
|
|
136
|
+
}
|
|
137
|
+
var f;
|
|
138
|
+
if (u) {
|
|
139
|
+
var s = t.indexOf(n[1]), h = t.slice(0, s);
|
|
140
|
+
h === r.numberingPlan.nationalPrefix() && (f = r.numberingPlan.nationalPrefix());
|
|
141
|
+
} else
|
|
142
|
+
f = n[0];
|
|
143
|
+
return {
|
|
144
|
+
nationalNumber: i,
|
|
145
|
+
nationalPrefix: f,
|
|
146
|
+
carrierCode: a
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
nationalNumber: t
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function be(t, r) {
|
|
155
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
156
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
157
|
+
if (Array.isArray(t) || (e = ve(t)) || r) {
|
|
158
|
+
e && (t = e);
|
|
159
|
+
var n = 0;
|
|
160
|
+
return function() {
|
|
161
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
165
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
166
|
+
}
|
|
167
|
+
function ve(t, r) {
|
|
168
|
+
if (t) {
|
|
169
|
+
if (typeof t == "string") return lt(t, r);
|
|
170
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
171
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? lt(t, r) : void 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function lt(t, r) {
|
|
175
|
+
(r == null || r > t.length) && (r = t.length);
|
|
176
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
177
|
+
return n;
|
|
178
|
+
}
|
|
179
|
+
function $t(t, r) {
|
|
180
|
+
var e = r.countries, n = r.metadata;
|
|
181
|
+
n = new g(n);
|
|
182
|
+
for (var i = be(e), a; !(a = i()).done; ) {
|
|
183
|
+
var o = a.value;
|
|
184
|
+
if (n.selectNumberingPlan(o), n.leadingDigits()) {
|
|
185
|
+
if (t && t.search(n.leadingDigits()) === 0)
|
|
186
|
+
return o;
|
|
187
|
+
} else if (rt({
|
|
188
|
+
phone: t,
|
|
189
|
+
country: o
|
|
190
|
+
}, void 0, n.metadata))
|
|
191
|
+
return o;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function it(t, r) {
|
|
195
|
+
var e = r.nationalNumber, n = r.metadata, i = n.getCountryCodesForCallingCode(t);
|
|
196
|
+
if (i)
|
|
197
|
+
return i.length === 1 ? i[0] : $t(e, {
|
|
198
|
+
countries: i,
|
|
199
|
+
metadata: n.metadata
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function K(t, r, e) {
|
|
203
|
+
var n = X(t, e), i = n.carrierCode, a = n.nationalNumber;
|
|
204
|
+
if (a !== t) {
|
|
205
|
+
if (!pe(t, a, e))
|
|
206
|
+
return {
|
|
207
|
+
nationalNumber: t
|
|
208
|
+
};
|
|
209
|
+
if (e.numberingPlan.possibleLengths() && (r || (r = it(e.numberingPlan.callingCode(), {
|
|
210
|
+
nationalNumber: a,
|
|
211
|
+
metadata: e
|
|
212
|
+
})), !Ne(a, r, e)))
|
|
213
|
+
return {
|
|
214
|
+
nationalNumber: t
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
nationalNumber: a,
|
|
219
|
+
carrierCode: i
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function pe(t, r, e) {
|
|
223
|
+
return !(C(t, e.nationalNumberPattern()) && !C(r, e.nationalNumberPattern()));
|
|
224
|
+
}
|
|
225
|
+
function Ne(t, r, e) {
|
|
226
|
+
switch (U(t, r, e)) {
|
|
227
|
+
case "TOO_SHORT":
|
|
228
|
+
case "INVALID_LENGTH":
|
|
229
|
+
return !1;
|
|
230
|
+
default:
|
|
231
|
+
return !0;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function jt(t, r, e, n, i) {
|
|
235
|
+
var a = r || e ? et(r || e, i) : n;
|
|
236
|
+
if (t.indexOf(a) === 0) {
|
|
237
|
+
i = new g(i), i.selectNumberingPlan(r || e, a);
|
|
238
|
+
var o = t.slice(a.length), u = K(o, r, i), l = u.nationalNumber, f = K(t, r, i), s = f.nationalNumber;
|
|
239
|
+
if (!C(s, i.nationalNumberPattern()) && C(l, i.nationalNumberPattern()) || U(s, r, i) === "TOO_LONG")
|
|
240
|
+
return {
|
|
241
|
+
countryCallingCode: a,
|
|
242
|
+
number: o
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
number: t
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function at(t, r, e, n, i) {
|
|
250
|
+
if (!t)
|
|
251
|
+
return {};
|
|
252
|
+
var a;
|
|
253
|
+
if (t[0] !== "+") {
|
|
254
|
+
var o = Lt(t, r || e, n, i);
|
|
255
|
+
if (o && o !== t)
|
|
256
|
+
a = !0, t = "+" + o;
|
|
257
|
+
else {
|
|
258
|
+
if (r || e || n) {
|
|
259
|
+
var u = jt(t, r, e, n, i), l = u.countryCallingCode, f = u.number;
|
|
260
|
+
if (l)
|
|
261
|
+
return {
|
|
262
|
+
countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
|
|
263
|
+
countryCallingCode: l,
|
|
264
|
+
number: f
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
// No need to set it to `UNSPECIFIED`. It can be just `undefined`.
|
|
269
|
+
// countryCallingCodeSource: 'UNSPECIFIED',
|
|
270
|
+
number: t
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (t[1] === "0")
|
|
275
|
+
return {};
|
|
276
|
+
i = new g(i);
|
|
277
|
+
for (var s = 2; s - 1 <= fe && s <= t.length; ) {
|
|
278
|
+
var h = t.slice(1, s);
|
|
279
|
+
if (i.hasCallingCode(h))
|
|
280
|
+
return i.selectNumberingPlan(h), {
|
|
281
|
+
countryCallingCodeSource: a ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
|
|
282
|
+
countryCallingCode: h,
|
|
283
|
+
number: t.slice(s)
|
|
284
|
+
};
|
|
285
|
+
s++;
|
|
286
|
+
}
|
|
287
|
+
return {};
|
|
288
|
+
}
|
|
289
|
+
function kt(t) {
|
|
290
|
+
return t.replace(new RegExp("[".concat(b, "]+"), "g"), " ").trim();
|
|
291
|
+
}
|
|
292
|
+
var Mt = /(\$\d)/;
|
|
293
|
+
function Ut(t, r, e) {
|
|
294
|
+
var n = e.useInternationalFormat, i = e.withNationalPrefix;
|
|
295
|
+
e.carrierCode, e.metadata;
|
|
296
|
+
var a = t.replace(new RegExp(r.pattern()), n ? r.internationalFormat() : (
|
|
297
|
+
// This library doesn't use `domestic_carrier_code_formatting_rule`,
|
|
298
|
+
// because that one is only used when formatting phone numbers
|
|
299
|
+
// for dialing from a mobile phone, and this is not a dialing library.
|
|
300
|
+
// carrierCode && format.domesticCarrierCodeFormattingRule()
|
|
301
|
+
// // First, replace the $CC in the formatting rule with the desired carrier code.
|
|
302
|
+
// // Then, replace the $FG in the formatting rule with the first group
|
|
303
|
+
// // and the carrier code combined in the appropriate way.
|
|
304
|
+
// ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
|
|
305
|
+
// : (
|
|
306
|
+
// withNationalPrefix && format.nationalPrefixFormattingRule()
|
|
307
|
+
// ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
|
|
308
|
+
// : format.format()
|
|
309
|
+
// )
|
|
310
|
+
i && r.nationalPrefixFormattingRule() ? r.format().replace(Mt, r.nationalPrefixFormattingRule()) : r.format()
|
|
311
|
+
));
|
|
312
|
+
return n ? kt(a) : a;
|
|
313
|
+
}
|
|
314
|
+
var Ce = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
|
|
315
|
+
function Pe(t, r, e) {
|
|
316
|
+
var n = new g(e);
|
|
317
|
+
if (n.selectNumberingPlan(t, r), n.defaultIDDPrefix())
|
|
318
|
+
return n.defaultIDDPrefix();
|
|
319
|
+
if (Ce.test(n.IDDPrefix()))
|
|
320
|
+
return n.IDDPrefix();
|
|
321
|
+
}
|
|
322
|
+
var Se = ";ext=", S = function(r) {
|
|
323
|
+
return "([".concat(y, "]{1,").concat(r, "})");
|
|
324
|
+
};
|
|
325
|
+
function Bt(t) {
|
|
326
|
+
var r = "20", e = "15", n = "9", i = "6", a = "[ \\t,]*", o = "[:\\..]?[ \\t,-]*", u = "#?", l = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", f = "(?:[xx##~~]|int|int)", s = "[- ]+", h = "[ \\t]*", c = "(?:,{2}|;)", m = Se + S(r), v = a + l + o + S(r) + u, P = a + f + o + S(n) + u, p = s + S(i) + "#", Yt = h + c + o + S(e) + u, qt = h + "(?:,)+" + o + S(n) + u;
|
|
327
|
+
return m + "|" + v + "|" + P + "|" + p + "|" + Yt + "|" + qt;
|
|
328
|
+
}
|
|
329
|
+
var xe = "[" + y + "]{" + nt + "}", Ee = "[" + B + "]{0,1}(?:[" + b + "]*[" + y + "]){3,}[" + b + y + "]*", _e = new RegExp("^[" + B + "]{0,1}(?:[" + b + "]*[" + y + "]){1,2}$", "i"), we = Ee + // Phone number extensions
|
|
330
|
+
"(?:" + Bt() + ")?", Ae = new RegExp(
|
|
331
|
+
// Either a short two-digit-only phone number
|
|
332
|
+
"^" + xe + "$|^" + we + "$",
|
|
333
|
+
"i"
|
|
334
|
+
);
|
|
335
|
+
function Te(t) {
|
|
336
|
+
return t.length >= nt && Ae.test(t);
|
|
337
|
+
}
|
|
338
|
+
function Ie(t) {
|
|
339
|
+
return _e.test(t);
|
|
340
|
+
}
|
|
341
|
+
function Fe(t) {
|
|
342
|
+
var r = t.number, e = t.ext;
|
|
343
|
+
if (!r)
|
|
344
|
+
return "";
|
|
345
|
+
if (r[0] !== "+")
|
|
346
|
+
throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');
|
|
347
|
+
return "tel:".concat(r).concat(e ? ";ext=" + e : "");
|
|
348
|
+
}
|
|
349
|
+
var ft = {
|
|
350
|
+
formatExtension: function(r, e, n) {
|
|
351
|
+
return "".concat(r).concat(n.ext()).concat(e);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
function Oe(t, r, e, n) {
|
|
355
|
+
if (e ? e = Le({}, ft, e) : e = ft, n = new g(n), t.country && t.country !== "001") {
|
|
356
|
+
if (!n.hasCountry(t.country))
|
|
357
|
+
throw new Error("Unknown country: ".concat(t.country));
|
|
358
|
+
n.selectNumberingPlan(t.country);
|
|
359
|
+
} else if (t.countryCallingCode)
|
|
360
|
+
n.selectNumberingPlan(t.countryCallingCode);
|
|
361
|
+
else return t.phone || "";
|
|
362
|
+
var i = n.countryCallingCode(), a = e.v2 ? t.nationalNumber : t.phone, o;
|
|
363
|
+
switch (r) {
|
|
364
|
+
case "NATIONAL":
|
|
365
|
+
return a ? (o = k(a, t.carrierCode, "NATIONAL", n, e), G(o, t.ext, n, e.formatExtension)) : "";
|
|
366
|
+
case "INTERNATIONAL":
|
|
367
|
+
return a ? (o = k(a, null, "INTERNATIONAL", n, e), o = "+".concat(i, " ").concat(o), G(o, t.ext, n, e.formatExtension)) : "+".concat(i);
|
|
368
|
+
case "E.164":
|
|
369
|
+
return "+".concat(i).concat(a);
|
|
370
|
+
case "RFC3966":
|
|
371
|
+
return Fe({
|
|
372
|
+
number: "+".concat(i).concat(a),
|
|
373
|
+
ext: t.ext
|
|
374
|
+
});
|
|
375
|
+
// For reference, here's Google's IDD formatter:
|
|
376
|
+
// https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
|
|
377
|
+
// Not saying that this IDD formatter replicates it 1:1, but it seems to work.
|
|
378
|
+
// Who would even need to format phone numbers in IDD format anyway?
|
|
379
|
+
case "IDD":
|
|
380
|
+
if (!e.fromCountry)
|
|
381
|
+
return;
|
|
382
|
+
var u = De(a, t.carrierCode, i, e.fromCountry, n);
|
|
383
|
+
return G(u, t.ext, n, e.formatExtension);
|
|
384
|
+
default:
|
|
385
|
+
throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(r, '"'));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function k(t, r, e, n, i) {
|
|
389
|
+
var a = Re(n.formats(), t);
|
|
390
|
+
return a ? Ut(t, a, {
|
|
391
|
+
useInternationalFormat: e === "INTERNATIONAL",
|
|
392
|
+
withNationalPrefix: !(a.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && i && i.nationalPrefix === !1),
|
|
393
|
+
carrierCode: r,
|
|
394
|
+
metadata: n
|
|
395
|
+
}) : t;
|
|
396
|
+
}
|
|
397
|
+
function Re(t, r) {
|
|
398
|
+
return $e(t, function(e) {
|
|
399
|
+
if (e.leadingDigitsPatterns().length > 0) {
|
|
400
|
+
var n = e.leadingDigitsPatterns()[e.leadingDigitsPatterns().length - 1];
|
|
401
|
+
if (r.search(n) !== 0)
|
|
402
|
+
return !1;
|
|
403
|
+
}
|
|
404
|
+
return C(r, e.pattern());
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
function G(t, r, e, n) {
|
|
408
|
+
return r ? n(t, r, e) : t;
|
|
409
|
+
}
|
|
410
|
+
function De(t, r, e, n, i) {
|
|
411
|
+
var a = et(n, i.metadata);
|
|
412
|
+
if (a === e) {
|
|
413
|
+
var o = k(t, r, "NATIONAL", i);
|
|
414
|
+
return e === "1" ? e + " " + o : o;
|
|
415
|
+
}
|
|
416
|
+
var u = Pe(n, void 0, i.metadata);
|
|
417
|
+
if (u)
|
|
418
|
+
return "".concat(u, " ").concat(e, " ").concat(k(t, null, "INTERNATIONAL", i));
|
|
419
|
+
}
|
|
420
|
+
function Le() {
|
|
421
|
+
for (var t = 1, r = arguments.length, e = new Array(r), n = 0; n < r; n++)
|
|
422
|
+
e[n] = arguments[n];
|
|
423
|
+
for (; t < e.length; ) {
|
|
424
|
+
if (e[t])
|
|
425
|
+
for (var i in e[t])
|
|
426
|
+
e[0][i] = e[t][i];
|
|
427
|
+
t++;
|
|
428
|
+
}
|
|
429
|
+
return e[0];
|
|
430
|
+
}
|
|
431
|
+
function $e(t, r) {
|
|
432
|
+
for (var e = 0; e < t.length; ) {
|
|
433
|
+
if (r(t[e]))
|
|
434
|
+
return t[e];
|
|
435
|
+
e++;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function x(t) {
|
|
439
|
+
"@babel/helpers - typeof";
|
|
440
|
+
return x = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
441
|
+
return typeof r;
|
|
442
|
+
} : function(r) {
|
|
443
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
444
|
+
}, x(t);
|
|
445
|
+
}
|
|
446
|
+
function st(t, r) {
|
|
447
|
+
var e = Object.keys(t);
|
|
448
|
+
if (Object.getOwnPropertySymbols) {
|
|
449
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
450
|
+
r && (n = n.filter(function(i) {
|
|
451
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
452
|
+
})), e.push.apply(e, n);
|
|
453
|
+
}
|
|
454
|
+
return e;
|
|
455
|
+
}
|
|
456
|
+
function ct(t) {
|
|
457
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
458
|
+
var e = arguments[r] != null ? arguments[r] : {};
|
|
459
|
+
r % 2 ? st(Object(e), !0).forEach(function(n) {
|
|
460
|
+
je(t, n, e[n]);
|
|
461
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : st(Object(e)).forEach(function(n) {
|
|
462
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
return t;
|
|
466
|
+
}
|
|
467
|
+
function je(t, r, e) {
|
|
468
|
+
return (r = Ht(r)) in t ? Object.defineProperty(t, r, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[r] = e, t;
|
|
469
|
+
}
|
|
470
|
+
function ke(t, r) {
|
|
471
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
472
|
+
}
|
|
473
|
+
function Me(t, r) {
|
|
474
|
+
for (var e = 0; e < r.length; e++) {
|
|
475
|
+
var n = r[e];
|
|
476
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, Ht(n.key), n);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function Ue(t, r, e) {
|
|
480
|
+
return r && Me(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
481
|
+
}
|
|
482
|
+
function Ht(t) {
|
|
483
|
+
var r = Be(t, "string");
|
|
484
|
+
return x(r) == "symbol" ? r : r + "";
|
|
485
|
+
}
|
|
486
|
+
function Be(t, r) {
|
|
487
|
+
if (x(t) != "object" || !t) return t;
|
|
488
|
+
var e = t[Symbol.toPrimitive];
|
|
489
|
+
if (e !== void 0) {
|
|
490
|
+
var n = e.call(t, r);
|
|
491
|
+
if (x(n) != "object") return n;
|
|
492
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
493
|
+
}
|
|
494
|
+
return String(t);
|
|
495
|
+
}
|
|
496
|
+
var Gt = /* @__PURE__ */ (function() {
|
|
497
|
+
function t(r, e, n) {
|
|
498
|
+
if (ke(this, t), !r)
|
|
499
|
+
throw new TypeError("First argument is required");
|
|
500
|
+
if (typeof r != "string")
|
|
501
|
+
throw new TypeError("First argument must be a string");
|
|
502
|
+
if (r[0] === "+" && !e)
|
|
503
|
+
throw new TypeError("`metadata` argument not passed");
|
|
504
|
+
if (j(e) && j(e.countries)) {
|
|
505
|
+
n = e;
|
|
506
|
+
var i = r;
|
|
507
|
+
if (!We.test(i))
|
|
508
|
+
throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');
|
|
509
|
+
var a = at(i, void 0, void 0, void 0, n), o = a.countryCallingCode, u = a.number;
|
|
510
|
+
if (e = u, r = o, !e)
|
|
511
|
+
throw new Error("Invalid `number` argument passed: too short");
|
|
512
|
+
}
|
|
513
|
+
if (!e)
|
|
514
|
+
throw new TypeError("`nationalNumber` argument is required");
|
|
515
|
+
if (typeof e != "string")
|
|
516
|
+
throw new TypeError("`nationalNumber` argument must be a string");
|
|
517
|
+
zt(n);
|
|
518
|
+
var l = Ge(r, n), f = l.country, s = l.countryCallingCode;
|
|
519
|
+
this.country = f, this.countryCallingCode = s, this.nationalNumber = e, this.number = "+" + this.countryCallingCode + this.nationalNumber, this.getMetadata = function() {
|
|
520
|
+
return n;
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
return Ue(t, [{
|
|
524
|
+
key: "setExt",
|
|
525
|
+
value: function(e) {
|
|
526
|
+
this.ext = e;
|
|
527
|
+
}
|
|
528
|
+
}, {
|
|
529
|
+
key: "getPossibleCountries",
|
|
530
|
+
value: function() {
|
|
531
|
+
return this.country ? [this.country] : oe(this.countryCallingCode, this.nationalNumber, this.getMetadata());
|
|
532
|
+
}
|
|
533
|
+
}, {
|
|
534
|
+
key: "isPossible",
|
|
535
|
+
value: function() {
|
|
536
|
+
return ee(this, {
|
|
537
|
+
v2: !0
|
|
538
|
+
}, this.getMetadata());
|
|
539
|
+
}
|
|
540
|
+
}, {
|
|
541
|
+
key: "isValid",
|
|
542
|
+
value: function() {
|
|
543
|
+
return ae(this, {
|
|
544
|
+
v2: !0
|
|
545
|
+
}, this.getMetadata());
|
|
546
|
+
}
|
|
547
|
+
}, {
|
|
548
|
+
key: "isNonGeographic",
|
|
549
|
+
value: function() {
|
|
550
|
+
var e = new g(this.getMetadata());
|
|
551
|
+
return e.isNonGeographicCallingCode(this.countryCallingCode);
|
|
552
|
+
}
|
|
553
|
+
}, {
|
|
554
|
+
key: "isEqual",
|
|
555
|
+
value: function(e) {
|
|
556
|
+
return this.number === e.number && this.ext === e.ext;
|
|
557
|
+
}
|
|
558
|
+
// This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,
|
|
559
|
+
// but later it was found out that it doesn't include the possible `TOO_SHORT` result
|
|
560
|
+
// returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,
|
|
561
|
+
// so eventually I simply commented out this method from the `PhoneNumber` class
|
|
562
|
+
// and just left the `validatePhoneNumberLength()` function, even though that one would require
|
|
563
|
+
// and additional step to also validate the actual country / calling code of the phone number.
|
|
564
|
+
// validateLength() {
|
|
565
|
+
// const metadata = new Metadata(this.getMetadata())
|
|
566
|
+
// metadata.selectNumberingPlan(this.countryCallingCode)
|
|
567
|
+
// const result = checkNumberLength(this.nationalNumber, metadata)
|
|
568
|
+
// if (result !== 'IS_POSSIBLE') {
|
|
569
|
+
// return result
|
|
570
|
+
// }
|
|
571
|
+
// }
|
|
572
|
+
}, {
|
|
573
|
+
key: "getType",
|
|
574
|
+
value: function() {
|
|
575
|
+
return rt(this, {
|
|
576
|
+
v2: !0
|
|
577
|
+
}, this.getMetadata());
|
|
578
|
+
}
|
|
579
|
+
}, {
|
|
580
|
+
key: "format",
|
|
581
|
+
value: function(e, n) {
|
|
582
|
+
return Oe(this, e, n ? ct(ct({}, n), {}, {
|
|
583
|
+
v2: !0
|
|
584
|
+
}) : {
|
|
585
|
+
v2: !0
|
|
586
|
+
}, this.getMetadata());
|
|
587
|
+
}
|
|
588
|
+
}, {
|
|
589
|
+
key: "formatNational",
|
|
590
|
+
value: function(e) {
|
|
591
|
+
return this.format("NATIONAL", e);
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
key: "formatInternational",
|
|
595
|
+
value: function(e) {
|
|
596
|
+
return this.format("INTERNATIONAL", e);
|
|
597
|
+
}
|
|
598
|
+
}, {
|
|
599
|
+
key: "getURI",
|
|
600
|
+
value: function(e) {
|
|
601
|
+
return this.format("RFC3966", e);
|
|
602
|
+
}
|
|
603
|
+
}]);
|
|
604
|
+
})(), He = function(r) {
|
|
605
|
+
return /^[A-Z]{2}$/.test(r);
|
|
606
|
+
};
|
|
607
|
+
function Ge(t, r) {
|
|
608
|
+
var e, n, i = new g(r);
|
|
609
|
+
return He(t) ? (e = t, i.selectNumberingPlan(e), n = i.countryCallingCode()) : n = t, {
|
|
610
|
+
country: e,
|
|
611
|
+
countryCallingCode: n
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
var We = /^\+\d+$/;
|
|
615
|
+
function Y(t) {
|
|
616
|
+
"@babel/helpers - typeof";
|
|
617
|
+
return Y = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
618
|
+
return typeof r;
|
|
619
|
+
} : function(r) {
|
|
620
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
621
|
+
}, Y(t);
|
|
622
|
+
}
|
|
623
|
+
function Ve(t, r, e) {
|
|
624
|
+
return Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
625
|
+
}
|
|
626
|
+
function Xe(t, r) {
|
|
627
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
628
|
+
}
|
|
629
|
+
function Ke(t, r, e) {
|
|
630
|
+
return r = _(r), Ye(t, ot() ? Reflect.construct(r, e || [], _(t).constructor) : r.apply(t, e));
|
|
631
|
+
}
|
|
632
|
+
function Ye(t, r) {
|
|
633
|
+
if (r && (Y(r) == "object" || typeof r == "function")) return r;
|
|
634
|
+
if (r !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
635
|
+
return qe(t);
|
|
636
|
+
}
|
|
637
|
+
function qe(t) {
|
|
638
|
+
if (t === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
639
|
+
return t;
|
|
640
|
+
}
|
|
641
|
+
function ze(t, r) {
|
|
642
|
+
if (typeof r != "function" && r !== null) throw new TypeError("Super expression must either be null or a function");
|
|
643
|
+
t.prototype = Object.create(r && r.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), r && E(t, r);
|
|
644
|
+
}
|
|
645
|
+
function q(t) {
|
|
646
|
+
var r = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
647
|
+
return q = function(n) {
|
|
648
|
+
if (n === null || !Ze(n)) return n;
|
|
649
|
+
if (typeof n != "function") throw new TypeError("Super expression must either be null or a function");
|
|
650
|
+
if (r !== void 0) {
|
|
651
|
+
if (r.has(n)) return r.get(n);
|
|
652
|
+
r.set(n, i);
|
|
653
|
+
}
|
|
654
|
+
function i() {
|
|
655
|
+
return Je(n, arguments, _(this).constructor);
|
|
656
|
+
}
|
|
657
|
+
return i.prototype = Object.create(n.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), E(i, n);
|
|
658
|
+
}, q(t);
|
|
659
|
+
}
|
|
660
|
+
function Je(t, r, e) {
|
|
661
|
+
if (ot()) return Reflect.construct.apply(null, arguments);
|
|
662
|
+
var n = [null];
|
|
663
|
+
n.push.apply(n, r);
|
|
664
|
+
var i = new (t.bind.apply(t, n))();
|
|
665
|
+
return e && E(i, e.prototype), i;
|
|
666
|
+
}
|
|
667
|
+
function ot() {
|
|
668
|
+
try {
|
|
669
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
670
|
+
}));
|
|
671
|
+
} catch {
|
|
672
|
+
}
|
|
673
|
+
return (ot = function() {
|
|
674
|
+
return !!t;
|
|
675
|
+
})();
|
|
676
|
+
}
|
|
677
|
+
function Ze(t) {
|
|
678
|
+
try {
|
|
679
|
+
return Function.toString.call(t).indexOf("[native code]") !== -1;
|
|
680
|
+
} catch {
|
|
681
|
+
return typeof t == "function";
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function E(t, r) {
|
|
685
|
+
return E = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, n) {
|
|
686
|
+
return e.__proto__ = n, e;
|
|
687
|
+
}, E(t, r);
|
|
688
|
+
}
|
|
689
|
+
function _(t) {
|
|
690
|
+
return _ = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
|
|
691
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
692
|
+
}, _(t);
|
|
693
|
+
}
|
|
694
|
+
var N = /* @__PURE__ */ (function(t) {
|
|
695
|
+
function r(e) {
|
|
696
|
+
var n;
|
|
697
|
+
return Xe(this, r), n = Ke(this, r, [e]), Object.setPrototypeOf(n, r.prototype), n.name = n.constructor.name, n;
|
|
698
|
+
}
|
|
699
|
+
return ze(r, t), Ve(r);
|
|
700
|
+
})(/* @__PURE__ */ q(Error)), ht = new RegExp("(?:" + Bt() + ")$", "i");
|
|
701
|
+
function Qe(t) {
|
|
702
|
+
var r = t.search(ht);
|
|
703
|
+
if (r < 0)
|
|
704
|
+
return {};
|
|
705
|
+
for (var e = t.slice(0, r), n = t.match(ht), i = 1; i < n.length; ) {
|
|
706
|
+
if (n[i])
|
|
707
|
+
return {
|
|
708
|
+
number: e,
|
|
709
|
+
ext: n[i]
|
|
710
|
+
};
|
|
711
|
+
i++;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function tr(t, r) {
|
|
715
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
716
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
717
|
+
if (Array.isArray(t) || (e = er(t)) || r) {
|
|
718
|
+
e && (t = e);
|
|
719
|
+
var n = 0;
|
|
720
|
+
return function() {
|
|
721
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
725
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
726
|
+
}
|
|
727
|
+
function er(t, r) {
|
|
728
|
+
if (t) {
|
|
729
|
+
if (typeof t == "string") return gt(t, r);
|
|
730
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
731
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? gt(t, r) : void 0;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function gt(t, r) {
|
|
735
|
+
(r == null || r > t.length) && (r = t.length);
|
|
736
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
737
|
+
return n;
|
|
738
|
+
}
|
|
739
|
+
var rr = {
|
|
740
|
+
0: "0",
|
|
741
|
+
1: "1",
|
|
742
|
+
2: "2",
|
|
743
|
+
3: "3",
|
|
744
|
+
4: "4",
|
|
745
|
+
5: "5",
|
|
746
|
+
6: "6",
|
|
747
|
+
7: "7",
|
|
748
|
+
8: "8",
|
|
749
|
+
9: "9",
|
|
750
|
+
"0": "0",
|
|
751
|
+
// Fullwidth digit 0
|
|
752
|
+
"1": "1",
|
|
753
|
+
// Fullwidth digit 1
|
|
754
|
+
"2": "2",
|
|
755
|
+
// Fullwidth digit 2
|
|
756
|
+
"3": "3",
|
|
757
|
+
// Fullwidth digit 3
|
|
758
|
+
"4": "4",
|
|
759
|
+
// Fullwidth digit 4
|
|
760
|
+
"5": "5",
|
|
761
|
+
// Fullwidth digit 5
|
|
762
|
+
"6": "6",
|
|
763
|
+
// Fullwidth digit 6
|
|
764
|
+
"7": "7",
|
|
765
|
+
// Fullwidth digit 7
|
|
766
|
+
"8": "8",
|
|
767
|
+
// Fullwidth digit 8
|
|
768
|
+
"9": "9",
|
|
769
|
+
// Fullwidth digit 9
|
|
770
|
+
"٠": "0",
|
|
771
|
+
// Arabic-indic digit 0
|
|
772
|
+
"١": "1",
|
|
773
|
+
// Arabic-indic digit 1
|
|
774
|
+
"٢": "2",
|
|
775
|
+
// Arabic-indic digit 2
|
|
776
|
+
"٣": "3",
|
|
777
|
+
// Arabic-indic digit 3
|
|
778
|
+
"٤": "4",
|
|
779
|
+
// Arabic-indic digit 4
|
|
780
|
+
"٥": "5",
|
|
781
|
+
// Arabic-indic digit 5
|
|
782
|
+
"٦": "6",
|
|
783
|
+
// Arabic-indic digit 6
|
|
784
|
+
"٧": "7",
|
|
785
|
+
// Arabic-indic digit 7
|
|
786
|
+
"٨": "8",
|
|
787
|
+
// Arabic-indic digit 8
|
|
788
|
+
"٩": "9",
|
|
789
|
+
// Arabic-indic digit 9
|
|
790
|
+
"۰": "0",
|
|
791
|
+
// Eastern-Arabic digit 0
|
|
792
|
+
"۱": "1",
|
|
793
|
+
// Eastern-Arabic digit 1
|
|
794
|
+
"۲": "2",
|
|
795
|
+
// Eastern-Arabic digit 2
|
|
796
|
+
"۳": "3",
|
|
797
|
+
// Eastern-Arabic digit 3
|
|
798
|
+
"۴": "4",
|
|
799
|
+
// Eastern-Arabic digit 4
|
|
800
|
+
"۵": "5",
|
|
801
|
+
// Eastern-Arabic digit 5
|
|
802
|
+
"۶": "6",
|
|
803
|
+
// Eastern-Arabic digit 6
|
|
804
|
+
"۷": "7",
|
|
805
|
+
// Eastern-Arabic digit 7
|
|
806
|
+
"۸": "8",
|
|
807
|
+
// Eastern-Arabic digit 8
|
|
808
|
+
"۹": "9"
|
|
809
|
+
// Eastern-Arabic digit 9
|
|
810
|
+
};
|
|
811
|
+
function Wt(t) {
|
|
812
|
+
return rr[t];
|
|
813
|
+
}
|
|
814
|
+
function M(t) {
|
|
815
|
+
for (var r = "", e = tr(t.split("")), n; !(n = e()).done; ) {
|
|
816
|
+
var i = n.value, a = Wt(i);
|
|
817
|
+
a && (r += a);
|
|
818
|
+
}
|
|
819
|
+
return r;
|
|
820
|
+
}
|
|
821
|
+
function nr(t, r) {
|
|
822
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
823
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
824
|
+
if (Array.isArray(t) || (e = ir(t)) || r) {
|
|
825
|
+
e && (t = e);
|
|
826
|
+
var n = 0;
|
|
827
|
+
return function() {
|
|
828
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
832
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
833
|
+
}
|
|
834
|
+
function ir(t, r) {
|
|
835
|
+
if (t) {
|
|
836
|
+
if (typeof t == "string") return yt(t, r);
|
|
837
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
838
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? yt(t, r) : void 0;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
function yt(t, r) {
|
|
842
|
+
(r == null || r > t.length) && (r = t.length);
|
|
843
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
844
|
+
return n;
|
|
845
|
+
}
|
|
846
|
+
function mt(t) {
|
|
847
|
+
for (var r = "", e = nr(t.split("")), n; !(n = e()).done; ) {
|
|
848
|
+
var i = n.value;
|
|
849
|
+
r += ar(i, r) || "";
|
|
850
|
+
}
|
|
851
|
+
return r;
|
|
852
|
+
}
|
|
853
|
+
function ar(t, r, e) {
|
|
854
|
+
return t === "+" ? r ? void 0 : "+" : Wt(t);
|
|
855
|
+
}
|
|
856
|
+
var Vt = "+", or = "[\\-\\.\\(\\)]?", dt = "([" + y + "]|" + or + ")", ur = "^\\" + Vt + dt + "*[" + y + "]" + dt + "*$", lr = new RegExp(ur, "g"), z = y, fr = "[" + z + "]+((\\-)*[" + z + "])*", sr = "a-zA-Z", cr = "[" + sr + "]+((\\-)*[" + z + "])*", hr = "^(" + fr + "\\.)*" + cr + "\\.?$", gr = new RegExp(hr, "g"), bt = "tel:", J = ";phone-context=", yr = ";isub=";
|
|
857
|
+
function mr(t) {
|
|
858
|
+
var r = t.indexOf(J);
|
|
859
|
+
if (r < 0)
|
|
860
|
+
return null;
|
|
861
|
+
var e = r + J.length;
|
|
862
|
+
if (e >= t.length)
|
|
863
|
+
return "";
|
|
864
|
+
var n = t.indexOf(";", e);
|
|
865
|
+
return n >= 0 ? t.substring(e, n) : t.substring(e);
|
|
866
|
+
}
|
|
867
|
+
function dr(t) {
|
|
868
|
+
return t === null ? !0 : t.length === 0 ? !1 : lr.test(t) || gr.test(t);
|
|
869
|
+
}
|
|
870
|
+
function br(t, r) {
|
|
871
|
+
var e = r.extractFormattedPhoneNumber, n = mr(t);
|
|
872
|
+
if (!dr(n))
|
|
873
|
+
throw new N("NOT_A_NUMBER");
|
|
874
|
+
var i;
|
|
875
|
+
if (n === null)
|
|
876
|
+
i = e(t) || "";
|
|
877
|
+
else {
|
|
878
|
+
i = "", n.charAt(0) === Vt && (i += n);
|
|
879
|
+
var a = t.indexOf(bt), o;
|
|
880
|
+
a >= 0 ? o = a + bt.length : o = 0;
|
|
881
|
+
var u = t.indexOf(J);
|
|
882
|
+
i += t.substring(o, u);
|
|
883
|
+
}
|
|
884
|
+
var l = i.indexOf(yr);
|
|
885
|
+
if (l > 0 && (i = i.substring(0, l)), i !== "")
|
|
886
|
+
return i;
|
|
887
|
+
}
|
|
888
|
+
var vr = 250, pr = new RegExp("[" + B + y + "]"), Nr = new RegExp("[^" + y + "#]+$");
|
|
889
|
+
function Cr(t, r, e) {
|
|
890
|
+
if (r = r || {}, e = new g(e), r.defaultCountry && !e.hasCountry(r.defaultCountry))
|
|
891
|
+
throw r.v2 ? new N("INVALID_COUNTRY") : new Error("Unknown country: ".concat(r.defaultCountry));
|
|
892
|
+
var n = Sr(t, r.v2, r.extract), i = n.number, a = n.ext, o = n.error;
|
|
893
|
+
if (!i) {
|
|
894
|
+
if (r.v2)
|
|
895
|
+
throw o === "TOO_SHORT" ? new N("TOO_SHORT") : new N("NOT_A_NUMBER");
|
|
896
|
+
return {};
|
|
897
|
+
}
|
|
898
|
+
var u = Er(i, r.defaultCountry, r.defaultCallingCode, e), l = u.country, f = u.nationalNumber, s = u.countryCallingCode, h = u.countryCallingCodeSource, c = u.carrierCode;
|
|
899
|
+
if (!e.hasSelectedNumberingPlan()) {
|
|
900
|
+
if (r.v2)
|
|
901
|
+
throw new N("INVALID_COUNTRY");
|
|
902
|
+
return {};
|
|
903
|
+
}
|
|
904
|
+
if (!f || f.length < nt) {
|
|
905
|
+
if (r.v2)
|
|
906
|
+
throw new N("TOO_SHORT");
|
|
907
|
+
return {};
|
|
908
|
+
}
|
|
909
|
+
if (f.length > le) {
|
|
910
|
+
if (r.v2)
|
|
911
|
+
throw new N("TOO_LONG");
|
|
912
|
+
return {};
|
|
913
|
+
}
|
|
914
|
+
if (r.v2) {
|
|
915
|
+
var m = new Gt(s, f, e.metadata);
|
|
916
|
+
return l && (m.country = l), c && (m.carrierCode = c), a && (m.ext = a), m.__countryCallingCodeSource = h, m;
|
|
917
|
+
}
|
|
918
|
+
var v = (r.extended ? e.hasSelectedNumberingPlan() : l) ? C(f, e.nationalNumberPattern()) : !1;
|
|
919
|
+
return r.extended ? {
|
|
920
|
+
country: l,
|
|
921
|
+
countryCallingCode: s,
|
|
922
|
+
carrierCode: c,
|
|
923
|
+
valid: v,
|
|
924
|
+
possible: v ? !0 : !!(r.extended === !0 && e.possibleLengths() && Dt(f, l, e)),
|
|
925
|
+
phone: f,
|
|
926
|
+
ext: a
|
|
927
|
+
} : v ? xr(l, f, a) : {};
|
|
928
|
+
}
|
|
929
|
+
function Pr(t, r, e) {
|
|
930
|
+
if (t) {
|
|
931
|
+
if (t.length > vr) {
|
|
932
|
+
if (e)
|
|
933
|
+
throw new N("TOO_LONG");
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
if (r === !1)
|
|
937
|
+
return t;
|
|
938
|
+
var n = t.search(pr);
|
|
939
|
+
if (!(n < 0))
|
|
940
|
+
return t.slice(n).replace(Nr, "");
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
function Sr(t, r, e) {
|
|
944
|
+
var n = br(t, {
|
|
945
|
+
extractFormattedPhoneNumber: function(o) {
|
|
946
|
+
return Pr(o, e, r);
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
if (!n)
|
|
950
|
+
return {};
|
|
951
|
+
if (!Te(n))
|
|
952
|
+
return Ie(n) ? {
|
|
953
|
+
error: "TOO_SHORT"
|
|
954
|
+
} : {};
|
|
955
|
+
var i = Qe(n);
|
|
956
|
+
return i.ext ? i : {
|
|
957
|
+
number: n
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function xr(t, r, e) {
|
|
961
|
+
var n = {
|
|
962
|
+
country: t,
|
|
963
|
+
phone: r
|
|
964
|
+
};
|
|
965
|
+
return e && (n.ext = e), n;
|
|
966
|
+
}
|
|
967
|
+
function Er(t, r, e, n) {
|
|
968
|
+
var i = at(mt(t), void 0, r, e, n.metadata), a = i.countryCallingCodeSource, o = i.countryCallingCode, u = i.number, l;
|
|
969
|
+
if (o)
|
|
970
|
+
n.selectNumberingPlan(o);
|
|
971
|
+
else if (u && (r || e))
|
|
972
|
+
n.selectNumberingPlan(r, e), r && (l = r), o = e || et(r, n.metadata);
|
|
973
|
+
else return {};
|
|
974
|
+
if (!u)
|
|
975
|
+
return {
|
|
976
|
+
countryCallingCodeSource: a,
|
|
977
|
+
countryCallingCode: o
|
|
978
|
+
};
|
|
979
|
+
var f = K(mt(u), l, n), s = f.nationalNumber, h = f.carrierCode, c = it(o, {
|
|
980
|
+
nationalNumber: s,
|
|
981
|
+
metadata: n
|
|
982
|
+
});
|
|
983
|
+
return c && (l = c, c === "001" || n.selectNumberingPlan(l)), {
|
|
984
|
+
country: l,
|
|
985
|
+
countryCallingCode: o,
|
|
986
|
+
countryCallingCodeSource: a,
|
|
987
|
+
nationalNumber: s,
|
|
988
|
+
carrierCode: h
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
function w(t) {
|
|
992
|
+
"@babel/helpers - typeof";
|
|
993
|
+
return w = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
994
|
+
return typeof r;
|
|
995
|
+
} : function(r) {
|
|
996
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
997
|
+
}, w(t);
|
|
998
|
+
}
|
|
999
|
+
function vt(t, r) {
|
|
1000
|
+
var e = Object.keys(t);
|
|
1001
|
+
if (Object.getOwnPropertySymbols) {
|
|
1002
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
1003
|
+
r && (n = n.filter(function(i) {
|
|
1004
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
1005
|
+
})), e.push.apply(e, n);
|
|
1006
|
+
}
|
|
1007
|
+
return e;
|
|
1008
|
+
}
|
|
1009
|
+
function pt(t) {
|
|
1010
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1011
|
+
var e = arguments[r] != null ? arguments[r] : {};
|
|
1012
|
+
r % 2 ? vt(Object(e), !0).forEach(function(n) {
|
|
1013
|
+
_r(t, n, e[n]);
|
|
1014
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : vt(Object(e)).forEach(function(n) {
|
|
1015
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
return t;
|
|
1019
|
+
}
|
|
1020
|
+
function _r(t, r, e) {
|
|
1021
|
+
return (r = wr(r)) in t ? Object.defineProperty(t, r, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[r] = e, t;
|
|
1022
|
+
}
|
|
1023
|
+
function wr(t) {
|
|
1024
|
+
var r = Ar(t, "string");
|
|
1025
|
+
return w(r) == "symbol" ? r : r + "";
|
|
1026
|
+
}
|
|
1027
|
+
function Ar(t, r) {
|
|
1028
|
+
if (w(t) != "object" || !t) return t;
|
|
1029
|
+
var e = t[Symbol.toPrimitive];
|
|
1030
|
+
if (e !== void 0) {
|
|
1031
|
+
var n = e.call(t, r);
|
|
1032
|
+
if (w(n) != "object") return n;
|
|
1033
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1034
|
+
}
|
|
1035
|
+
return (r === "string" ? String : Number)(t);
|
|
1036
|
+
}
|
|
1037
|
+
function Tr(t, r, e) {
|
|
1038
|
+
return Cr(t, pt(pt({}, r), {}, {
|
|
1039
|
+
v2: !0
|
|
1040
|
+
}), e);
|
|
1041
|
+
}
|
|
1042
|
+
function A(t) {
|
|
1043
|
+
"@babel/helpers - typeof";
|
|
1044
|
+
return A = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1045
|
+
return typeof r;
|
|
1046
|
+
} : function(r) {
|
|
1047
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1048
|
+
}, A(t);
|
|
1049
|
+
}
|
|
1050
|
+
function Nt(t, r) {
|
|
1051
|
+
var e = Object.keys(t);
|
|
1052
|
+
if (Object.getOwnPropertySymbols) {
|
|
1053
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
1054
|
+
r && (n = n.filter(function(i) {
|
|
1055
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
1056
|
+
})), e.push.apply(e, n);
|
|
1057
|
+
}
|
|
1058
|
+
return e;
|
|
1059
|
+
}
|
|
1060
|
+
function Ir(t) {
|
|
1061
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1062
|
+
var e = arguments[r] != null ? arguments[r] : {};
|
|
1063
|
+
r % 2 ? Nt(Object(e), !0).forEach(function(n) {
|
|
1064
|
+
Fr(t, n, e[n]);
|
|
1065
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : Nt(Object(e)).forEach(function(n) {
|
|
1066
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
return t;
|
|
1070
|
+
}
|
|
1071
|
+
function Fr(t, r, e) {
|
|
1072
|
+
return (r = Or(r)) in t ? Object.defineProperty(t, r, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[r] = e, t;
|
|
1073
|
+
}
|
|
1074
|
+
function Or(t) {
|
|
1075
|
+
var r = Rr(t, "string");
|
|
1076
|
+
return A(r) == "symbol" ? r : r + "";
|
|
1077
|
+
}
|
|
1078
|
+
function Rr(t, r) {
|
|
1079
|
+
if (A(t) != "object" || !t) return t;
|
|
1080
|
+
var e = t[Symbol.toPrimitive];
|
|
1081
|
+
if (e !== void 0) {
|
|
1082
|
+
var n = e.call(t, r);
|
|
1083
|
+
if (A(n) != "object") return n;
|
|
1084
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1085
|
+
}
|
|
1086
|
+
return (r === "string" ? String : Number)(t);
|
|
1087
|
+
}
|
|
1088
|
+
function Dr(t, r) {
|
|
1089
|
+
return kr(t) || jr(t, r) || $r(t, r) || Lr();
|
|
1090
|
+
}
|
|
1091
|
+
function Lr() {
|
|
1092
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1093
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1094
|
+
}
|
|
1095
|
+
function $r(t, r) {
|
|
1096
|
+
if (t) {
|
|
1097
|
+
if (typeof t == "string") return Ct(t, r);
|
|
1098
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
1099
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? Ct(t, r) : void 0;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
function Ct(t, r) {
|
|
1103
|
+
(r == null || r > t.length) && (r = t.length);
|
|
1104
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
1105
|
+
return n;
|
|
1106
|
+
}
|
|
1107
|
+
function jr(t, r) {
|
|
1108
|
+
var e = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
1109
|
+
if (e != null) {
|
|
1110
|
+
var n, i, a, o, u = [], l = !0, f = !1;
|
|
1111
|
+
try {
|
|
1112
|
+
if (a = (e = e.call(t)).next, r !== 0) for (; !(l = (n = a.call(e)).done) && (u.push(n.value), u.length !== r); l = !0) ;
|
|
1113
|
+
} catch (s) {
|
|
1114
|
+
f = !0, i = s;
|
|
1115
|
+
} finally {
|
|
1116
|
+
try {
|
|
1117
|
+
if (!l && e.return != null && (o = e.return(), Object(o) !== o)) return;
|
|
1118
|
+
} finally {
|
|
1119
|
+
if (f) throw i;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
return u;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
function kr(t) {
|
|
1126
|
+
if (Array.isArray(t)) return t;
|
|
1127
|
+
}
|
|
1128
|
+
function Mr(t) {
|
|
1129
|
+
var r = Array.prototype.slice.call(t), e = Dr(r, 4), n = e[0], i = e[1], a = e[2], o = e[3], u, l, f;
|
|
1130
|
+
if (typeof n == "string")
|
|
1131
|
+
u = n;
|
|
1132
|
+
else throw new TypeError("A text for parsing must be a string.");
|
|
1133
|
+
if (!i || typeof i == "string")
|
|
1134
|
+
o ? (l = a, f = o) : (l = void 0, f = a), i && (l = Ir({
|
|
1135
|
+
defaultCountry: i
|
|
1136
|
+
}, l));
|
|
1137
|
+
else if (j(i))
|
|
1138
|
+
a ? (l = i, f = a) : f = i;
|
|
1139
|
+
else throw new Error("Invalid second argument: ".concat(i));
|
|
1140
|
+
return {
|
|
1141
|
+
text: u,
|
|
1142
|
+
options: l,
|
|
1143
|
+
metadata: f
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
function T(t) {
|
|
1147
|
+
"@babel/helpers - typeof";
|
|
1148
|
+
return T = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1149
|
+
return typeof r;
|
|
1150
|
+
} : function(r) {
|
|
1151
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1152
|
+
}, T(t);
|
|
1153
|
+
}
|
|
1154
|
+
function Pt(t, r) {
|
|
1155
|
+
var e = Object.keys(t);
|
|
1156
|
+
if (Object.getOwnPropertySymbols) {
|
|
1157
|
+
var n = Object.getOwnPropertySymbols(t);
|
|
1158
|
+
r && (n = n.filter(function(i) {
|
|
1159
|
+
return Object.getOwnPropertyDescriptor(t, i).enumerable;
|
|
1160
|
+
})), e.push.apply(e, n);
|
|
1161
|
+
}
|
|
1162
|
+
return e;
|
|
1163
|
+
}
|
|
1164
|
+
function St(t) {
|
|
1165
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1166
|
+
var e = arguments[r] != null ? arguments[r] : {};
|
|
1167
|
+
r % 2 ? Pt(Object(e), !0).forEach(function(n) {
|
|
1168
|
+
Ur(t, n, e[n]);
|
|
1169
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : Pt(Object(e)).forEach(function(n) {
|
|
1170
|
+
Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
return t;
|
|
1174
|
+
}
|
|
1175
|
+
function Ur(t, r, e) {
|
|
1176
|
+
return (r = Br(r)) in t ? Object.defineProperty(t, r, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[r] = e, t;
|
|
1177
|
+
}
|
|
1178
|
+
function Br(t) {
|
|
1179
|
+
var r = Hr(t, "string");
|
|
1180
|
+
return T(r) == "symbol" ? r : r + "";
|
|
1181
|
+
}
|
|
1182
|
+
function Hr(t, r) {
|
|
1183
|
+
if (T(t) != "object" || !t) return t;
|
|
1184
|
+
var e = t[Symbol.toPrimitive];
|
|
1185
|
+
if (e !== void 0) {
|
|
1186
|
+
var n = e.call(t, r);
|
|
1187
|
+
if (T(n) != "object") return n;
|
|
1188
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1189
|
+
}
|
|
1190
|
+
return (r === "string" ? String : Number)(t);
|
|
1191
|
+
}
|
|
1192
|
+
function Gr(t, r, e) {
|
|
1193
|
+
r && r.defaultCountry && !Jt(r.defaultCountry, e) && (r = St(St({}, r), {}, {
|
|
1194
|
+
defaultCountry: void 0
|
|
1195
|
+
}));
|
|
1196
|
+
try {
|
|
1197
|
+
return Tr(t, r, e);
|
|
1198
|
+
} catch (n) {
|
|
1199
|
+
if (!(n instanceof N)) throw n;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
function Wr() {
|
|
1203
|
+
var t = Mr(arguments), r = t.text, e = t.options, n = t.metadata;
|
|
1204
|
+
return Gr(r, e, n);
|
|
1205
|
+
}
|
|
1206
|
+
function I(t) {
|
|
1207
|
+
"@babel/helpers - typeof";
|
|
1208
|
+
return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1209
|
+
return typeof r;
|
|
1210
|
+
} : function(r) {
|
|
1211
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1212
|
+
}, I(t);
|
|
1213
|
+
}
|
|
1214
|
+
function Vr(t, r) {
|
|
1215
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
1216
|
+
}
|
|
1217
|
+
function Xr(t, r) {
|
|
1218
|
+
for (var e = 0; e < r.length; e++) {
|
|
1219
|
+
var n = r[e];
|
|
1220
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, Yr(n.key), n);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
function Kr(t, r, e) {
|
|
1224
|
+
return r && Xr(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
1225
|
+
}
|
|
1226
|
+
function Yr(t) {
|
|
1227
|
+
var r = qr(t, "string");
|
|
1228
|
+
return I(r) == "symbol" ? r : r + "";
|
|
1229
|
+
}
|
|
1230
|
+
function qr(t, r) {
|
|
1231
|
+
if (I(t) != "object" || !t) return t;
|
|
1232
|
+
var e = t[Symbol.toPrimitive];
|
|
1233
|
+
if (e !== void 0) {
|
|
1234
|
+
var n = e.call(t, r);
|
|
1235
|
+
if (I(n) != "object") return n;
|
|
1236
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1237
|
+
}
|
|
1238
|
+
return String(t);
|
|
1239
|
+
}
|
|
1240
|
+
var zr = /* @__PURE__ */ (function() {
|
|
1241
|
+
function t(r) {
|
|
1242
|
+
var e = r.onCountryChange, n = r.onCallingCodeChange;
|
|
1243
|
+
Vr(this, t), this.onCountryChange = e, this.onCallingCodeChange = n;
|
|
1244
|
+
}
|
|
1245
|
+
return Kr(t, [{
|
|
1246
|
+
key: "reset",
|
|
1247
|
+
value: function(e) {
|
|
1248
|
+
var n = e.country, i = e.callingCode;
|
|
1249
|
+
this.international = !1, this.missingPlus = !1, this.IDDPrefix = void 0, this.callingCode = void 0, this.digits = "", this.resetNationalSignificantNumber(), this.initCountryAndCallingCode(n, i);
|
|
1250
|
+
}
|
|
1251
|
+
}, {
|
|
1252
|
+
key: "resetNationalSignificantNumber",
|
|
1253
|
+
value: function() {
|
|
1254
|
+
this.nationalSignificantNumber = this.getNationalDigits(), this.nationalSignificantNumberIsModified = !1, this.nationalPrefix = void 0, this.carrierCode = void 0, this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = void 0;
|
|
1255
|
+
}
|
|
1256
|
+
}, {
|
|
1257
|
+
key: "update",
|
|
1258
|
+
value: function(e) {
|
|
1259
|
+
for (var n = 0, i = Object.keys(e); n < i.length; n++) {
|
|
1260
|
+
var a = i[n];
|
|
1261
|
+
this[a] = e[a];
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}, {
|
|
1265
|
+
key: "initCountryAndCallingCode",
|
|
1266
|
+
value: function(e, n) {
|
|
1267
|
+
this.setCountry(e), this.setCallingCode(n);
|
|
1268
|
+
}
|
|
1269
|
+
}, {
|
|
1270
|
+
key: "setCountry",
|
|
1271
|
+
value: function(e) {
|
|
1272
|
+
this.country = e, this.onCountryChange(e);
|
|
1273
|
+
}
|
|
1274
|
+
}, {
|
|
1275
|
+
key: "setCallingCode",
|
|
1276
|
+
value: function(e) {
|
|
1277
|
+
this.callingCode = e, this.onCallingCodeChange(e, this.country);
|
|
1278
|
+
}
|
|
1279
|
+
}, {
|
|
1280
|
+
key: "startInternationalNumber",
|
|
1281
|
+
value: function(e, n) {
|
|
1282
|
+
this.international = !0, this.initCountryAndCallingCode(e, n);
|
|
1283
|
+
}
|
|
1284
|
+
}, {
|
|
1285
|
+
key: "appendDigits",
|
|
1286
|
+
value: function(e) {
|
|
1287
|
+
this.digits += e;
|
|
1288
|
+
}
|
|
1289
|
+
}, {
|
|
1290
|
+
key: "appendNationalSignificantNumberDigits",
|
|
1291
|
+
value: function(e) {
|
|
1292
|
+
this.nationalSignificantNumber += e;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Returns the part of `this.digits` that corresponds to the national number.
|
|
1296
|
+
* Basically, all digits that have been input by the user, except for the
|
|
1297
|
+
* international prefix and the country calling code part
|
|
1298
|
+
* (if the number is an international one).
|
|
1299
|
+
* @return {string}
|
|
1300
|
+
*/
|
|
1301
|
+
}, {
|
|
1302
|
+
key: "getNationalDigits",
|
|
1303
|
+
value: function() {
|
|
1304
|
+
return this.international ? this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0)) : this.digits;
|
|
1305
|
+
}
|
|
1306
|
+
}, {
|
|
1307
|
+
key: "getDigitsWithoutInternationalPrefix",
|
|
1308
|
+
value: function() {
|
|
1309
|
+
return this.international && this.IDDPrefix ? this.digits.slice(this.IDDPrefix.length) : this.digits;
|
|
1310
|
+
}
|
|
1311
|
+
}]);
|
|
1312
|
+
})();
|
|
1313
|
+
function Jr(t, r) {
|
|
1314
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
1315
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
1316
|
+
if (Array.isArray(t) || (e = Zr(t)) || r) {
|
|
1317
|
+
e && (t = e);
|
|
1318
|
+
var n = 0;
|
|
1319
|
+
return function() {
|
|
1320
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1324
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1325
|
+
}
|
|
1326
|
+
function Zr(t, r) {
|
|
1327
|
+
if (t) {
|
|
1328
|
+
if (typeof t == "string") return xt(t, r);
|
|
1329
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
1330
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? xt(t, r) : void 0;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
function xt(t, r) {
|
|
1334
|
+
(r == null || r > t.length) && (r = t.length);
|
|
1335
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
1336
|
+
return n;
|
|
1337
|
+
}
|
|
1338
|
+
var d = "x", W = new RegExp(d);
|
|
1339
|
+
function $(t, r) {
|
|
1340
|
+
if (r < 1)
|
|
1341
|
+
return "";
|
|
1342
|
+
for (var e = ""; r > 1; )
|
|
1343
|
+
r & 1 && (e += t), r >>= 1, t += t;
|
|
1344
|
+
return e + t;
|
|
1345
|
+
}
|
|
1346
|
+
function Et(t, r) {
|
|
1347
|
+
return t[r] === ")" && r++, Qr(t.slice(0, r));
|
|
1348
|
+
}
|
|
1349
|
+
function Qr(t) {
|
|
1350
|
+
for (var r = [], e = 0; e < t.length; )
|
|
1351
|
+
t[e] === "(" ? r.push(e) : t[e] === ")" && r.pop(), e++;
|
|
1352
|
+
var n = 0, i = "";
|
|
1353
|
+
r.push(t.length);
|
|
1354
|
+
for (var a = 0, o = r; a < o.length; a++) {
|
|
1355
|
+
var u = o[a];
|
|
1356
|
+
i += t.slice(n, u), n = u + 1;
|
|
1357
|
+
}
|
|
1358
|
+
return i;
|
|
1359
|
+
}
|
|
1360
|
+
function tn(t, r, e) {
|
|
1361
|
+
for (var n = Jr(e.split("")), i; !(i = n()).done; ) {
|
|
1362
|
+
var a = i.value;
|
|
1363
|
+
if (t.slice(r + 1).search(W) < 0)
|
|
1364
|
+
return;
|
|
1365
|
+
r = t.search(W), t = t.replace(W, a);
|
|
1366
|
+
}
|
|
1367
|
+
return [t, r];
|
|
1368
|
+
}
|
|
1369
|
+
function en(t, r, e) {
|
|
1370
|
+
var n = e.metadata, i = e.shouldTryNationalPrefixFormattingRule, a = e.getSeparatorAfterNationalPrefix, o = new RegExp("^(?:".concat(r.pattern(), ")$"));
|
|
1371
|
+
if (o.test(t.nationalSignificantNumber))
|
|
1372
|
+
return nn(t, r, {
|
|
1373
|
+
metadata: n,
|
|
1374
|
+
shouldTryNationalPrefixFormattingRule: i,
|
|
1375
|
+
getSeparatorAfterNationalPrefix: a
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
function rn(t, r, e) {
|
|
1379
|
+
return U(t, r, e) === "IS_POSSIBLE";
|
|
1380
|
+
}
|
|
1381
|
+
function nn(t, r, e) {
|
|
1382
|
+
var n = e.metadata, i = e.shouldTryNationalPrefixFormattingRule, a = e.getSeparatorAfterNationalPrefix;
|
|
1383
|
+
if (t.nationalSignificantNumber, t.international, t.nationalPrefix, t.carrierCode, i(r)) {
|
|
1384
|
+
var o = _t(t, r, {
|
|
1385
|
+
useNationalPrefixFormattingRule: !0,
|
|
1386
|
+
getSeparatorAfterNationalPrefix: a,
|
|
1387
|
+
metadata: n
|
|
1388
|
+
});
|
|
1389
|
+
if (o)
|
|
1390
|
+
return o;
|
|
1391
|
+
}
|
|
1392
|
+
return _t(t, r, {
|
|
1393
|
+
useNationalPrefixFormattingRule: !1,
|
|
1394
|
+
getSeparatorAfterNationalPrefix: a,
|
|
1395
|
+
metadata: n
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
function _t(t, r, e) {
|
|
1399
|
+
var n = e.metadata, i = e.useNationalPrefixFormattingRule, a = e.getSeparatorAfterNationalPrefix, o = Ut(t.nationalSignificantNumber, r, {
|
|
1400
|
+
carrierCode: t.carrierCode,
|
|
1401
|
+
useInternationalFormat: t.international,
|
|
1402
|
+
withNationalPrefix: i,
|
|
1403
|
+
metadata: n
|
|
1404
|
+
});
|
|
1405
|
+
if (i || (t.nationalPrefix ? o = t.nationalPrefix + a(r) + o : t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix && (o = t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix + " " + o)), an(o, t))
|
|
1406
|
+
return o;
|
|
1407
|
+
}
|
|
1408
|
+
function an(t, r) {
|
|
1409
|
+
return M(t) === r.getNationalDigits();
|
|
1410
|
+
}
|
|
1411
|
+
function F(t) {
|
|
1412
|
+
"@babel/helpers - typeof";
|
|
1413
|
+
return F = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1414
|
+
return typeof r;
|
|
1415
|
+
} : function(r) {
|
|
1416
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1417
|
+
}, F(t);
|
|
1418
|
+
}
|
|
1419
|
+
function on(t, r) {
|
|
1420
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
1421
|
+
}
|
|
1422
|
+
function un(t, r) {
|
|
1423
|
+
for (var e = 0; e < r.length; e++) {
|
|
1424
|
+
var n = r[e];
|
|
1425
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, fn(n.key), n);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
function ln(t, r, e) {
|
|
1429
|
+
return r && un(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
1430
|
+
}
|
|
1431
|
+
function fn(t) {
|
|
1432
|
+
var r = sn(t, "string");
|
|
1433
|
+
return F(r) == "symbol" ? r : r + "";
|
|
1434
|
+
}
|
|
1435
|
+
function sn(t, r) {
|
|
1436
|
+
if (F(t) != "object" || !t) return t;
|
|
1437
|
+
var e = t[Symbol.toPrimitive];
|
|
1438
|
+
if (e !== void 0) {
|
|
1439
|
+
var n = e.call(t, r);
|
|
1440
|
+
if (F(n) != "object") return n;
|
|
1441
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1442
|
+
}
|
|
1443
|
+
return String(t);
|
|
1444
|
+
}
|
|
1445
|
+
var cn = /* @__PURE__ */ (function() {
|
|
1446
|
+
function t() {
|
|
1447
|
+
on(this, t);
|
|
1448
|
+
}
|
|
1449
|
+
return ln(t, [{
|
|
1450
|
+
key: "parse",
|
|
1451
|
+
value: function(e) {
|
|
1452
|
+
if (this.context = [{
|
|
1453
|
+
or: !0,
|
|
1454
|
+
instructions: []
|
|
1455
|
+
}], this.parsePattern(e), this.context.length !== 1)
|
|
1456
|
+
throw new Error("Non-finalized contexts left when pattern parse ended");
|
|
1457
|
+
var n = this.context[0], i = n.branches, a = n.instructions;
|
|
1458
|
+
if (i)
|
|
1459
|
+
return {
|
|
1460
|
+
op: "|",
|
|
1461
|
+
args: i.concat([V(a)])
|
|
1462
|
+
};
|
|
1463
|
+
if (a.length === 0)
|
|
1464
|
+
throw new Error("Pattern is required");
|
|
1465
|
+
return a.length === 1 ? a[0] : a;
|
|
1466
|
+
}
|
|
1467
|
+
}, {
|
|
1468
|
+
key: "startContext",
|
|
1469
|
+
value: function(e) {
|
|
1470
|
+
this.context.push(e);
|
|
1471
|
+
}
|
|
1472
|
+
}, {
|
|
1473
|
+
key: "endContext",
|
|
1474
|
+
value: function() {
|
|
1475
|
+
this.context.pop();
|
|
1476
|
+
}
|
|
1477
|
+
}, {
|
|
1478
|
+
key: "getContext",
|
|
1479
|
+
value: function() {
|
|
1480
|
+
return this.context[this.context.length - 1];
|
|
1481
|
+
}
|
|
1482
|
+
}, {
|
|
1483
|
+
key: "parsePattern",
|
|
1484
|
+
value: function(e) {
|
|
1485
|
+
if (!e)
|
|
1486
|
+
throw new Error("Pattern is required");
|
|
1487
|
+
var n = e.match(yn);
|
|
1488
|
+
if (!n) {
|
|
1489
|
+
if (gn.test(e))
|
|
1490
|
+
throw new Error("Illegal characters found in a pattern: ".concat(e));
|
|
1491
|
+
this.getContext().instructions = this.getContext().instructions.concat(e.split(""));
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
var i = n[1], a = e.slice(0, n.index), o = e.slice(n.index + i.length);
|
|
1495
|
+
switch (i) {
|
|
1496
|
+
case "(?:":
|
|
1497
|
+
a && this.parsePattern(a), this.startContext({
|
|
1498
|
+
or: !0,
|
|
1499
|
+
instructions: [],
|
|
1500
|
+
branches: []
|
|
1501
|
+
});
|
|
1502
|
+
break;
|
|
1503
|
+
case ")":
|
|
1504
|
+
if (!this.getContext().or)
|
|
1505
|
+
throw new Error('")" operator must be preceded by "(?:" operator');
|
|
1506
|
+
if (a && this.parsePattern(a), this.getContext().instructions.length === 0)
|
|
1507
|
+
throw new Error('No instructions found after "|" operator in an "or" group');
|
|
1508
|
+
var u = this.getContext(), l = u.branches;
|
|
1509
|
+
l.push(V(this.getContext().instructions)), this.endContext(), this.getContext().instructions.push({
|
|
1510
|
+
op: "|",
|
|
1511
|
+
args: l
|
|
1512
|
+
});
|
|
1513
|
+
break;
|
|
1514
|
+
case "|":
|
|
1515
|
+
if (!this.getContext().or)
|
|
1516
|
+
throw new Error('"|" operator can only be used inside "or" groups');
|
|
1517
|
+
if (a && this.parsePattern(a), !this.getContext().branches)
|
|
1518
|
+
if (this.context.length === 1)
|
|
1519
|
+
this.getContext().branches = [];
|
|
1520
|
+
else
|
|
1521
|
+
throw new Error('"branches" not found in an "or" group context');
|
|
1522
|
+
this.getContext().branches.push(V(this.getContext().instructions)), this.getContext().instructions = [];
|
|
1523
|
+
break;
|
|
1524
|
+
case "[":
|
|
1525
|
+
a && this.parsePattern(a), this.startContext({
|
|
1526
|
+
oneOfSet: !0
|
|
1527
|
+
});
|
|
1528
|
+
break;
|
|
1529
|
+
case "]":
|
|
1530
|
+
if (!this.getContext().oneOfSet)
|
|
1531
|
+
throw new Error('"]" operator must be preceded by "[" operator');
|
|
1532
|
+
this.endContext(), this.getContext().instructions.push({
|
|
1533
|
+
op: "[]",
|
|
1534
|
+
args: hn(a)
|
|
1535
|
+
});
|
|
1536
|
+
break;
|
|
1537
|
+
/* istanbul ignore next */
|
|
1538
|
+
default:
|
|
1539
|
+
throw new Error("Unknown operator: ".concat(i));
|
|
1540
|
+
}
|
|
1541
|
+
o && this.parsePattern(o);
|
|
1542
|
+
}
|
|
1543
|
+
}]);
|
|
1544
|
+
})();
|
|
1545
|
+
function hn(t) {
|
|
1546
|
+
for (var r = [], e = 0; e < t.length; ) {
|
|
1547
|
+
if (t[e] === "-") {
|
|
1548
|
+
if (e === 0 || e === t.length - 1)
|
|
1549
|
+
throw new Error("Couldn't parse a one-of set pattern: ".concat(t));
|
|
1550
|
+
for (var n = t[e - 1].charCodeAt(0) + 1, i = t[e + 1].charCodeAt(0) - 1, a = n; a <= i; )
|
|
1551
|
+
r.push(String.fromCharCode(a)), a++;
|
|
1552
|
+
} else
|
|
1553
|
+
r.push(t[e]);
|
|
1554
|
+
e++;
|
|
1555
|
+
}
|
|
1556
|
+
return r;
|
|
1557
|
+
}
|
|
1558
|
+
var gn = /[\(\)\[\]\?\:\|]/, yn = new RegExp(
|
|
1559
|
+
// any of:
|
|
1560
|
+
"(\\||\\(\\?\\:|\\)|\\[|\\])"
|
|
1561
|
+
);
|
|
1562
|
+
function V(t) {
|
|
1563
|
+
return t.length === 1 ? t[0] : t;
|
|
1564
|
+
}
|
|
1565
|
+
function wt(t, r) {
|
|
1566
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
1567
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
1568
|
+
if (Array.isArray(t) || (e = mn(t)) || r) {
|
|
1569
|
+
e && (t = e);
|
|
1570
|
+
var n = 0;
|
|
1571
|
+
return function() {
|
|
1572
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1576
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1577
|
+
}
|
|
1578
|
+
function mn(t, r) {
|
|
1579
|
+
if (t) {
|
|
1580
|
+
if (typeof t == "string") return At(t, r);
|
|
1581
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
1582
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? At(t, r) : void 0;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
function At(t, r) {
|
|
1586
|
+
(r == null || r > t.length) && (r = t.length);
|
|
1587
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
1588
|
+
return n;
|
|
1589
|
+
}
|
|
1590
|
+
function O(t) {
|
|
1591
|
+
"@babel/helpers - typeof";
|
|
1592
|
+
return O = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1593
|
+
return typeof r;
|
|
1594
|
+
} : function(r) {
|
|
1595
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1596
|
+
}, O(t);
|
|
1597
|
+
}
|
|
1598
|
+
function dn(t, r) {
|
|
1599
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
1600
|
+
}
|
|
1601
|
+
function bn(t, r) {
|
|
1602
|
+
for (var e = 0; e < r.length; e++) {
|
|
1603
|
+
var n = r[e];
|
|
1604
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, pn(n.key), n);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
function vn(t, r, e) {
|
|
1608
|
+
return r && bn(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
1609
|
+
}
|
|
1610
|
+
function pn(t) {
|
|
1611
|
+
var r = Nn(t, "string");
|
|
1612
|
+
return O(r) == "symbol" ? r : r + "";
|
|
1613
|
+
}
|
|
1614
|
+
function Nn(t, r) {
|
|
1615
|
+
if (O(t) != "object" || !t) return t;
|
|
1616
|
+
var e = t[Symbol.toPrimitive];
|
|
1617
|
+
if (e !== void 0) {
|
|
1618
|
+
var n = e.call(t, r);
|
|
1619
|
+
if (O(n) != "object") return n;
|
|
1620
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1621
|
+
}
|
|
1622
|
+
return String(t);
|
|
1623
|
+
}
|
|
1624
|
+
var Cn = /* @__PURE__ */ (function() {
|
|
1625
|
+
function t(r) {
|
|
1626
|
+
dn(this, t), this.matchTree = new cn().parse(r);
|
|
1627
|
+
}
|
|
1628
|
+
return vn(t, [{
|
|
1629
|
+
key: "match",
|
|
1630
|
+
value: function(e) {
|
|
1631
|
+
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = n.allowOverflow;
|
|
1632
|
+
if (!e)
|
|
1633
|
+
throw new Error("String is required");
|
|
1634
|
+
var a = Z(e.split(""), this.matchTree, !0);
|
|
1635
|
+
if (a && a.match && delete a.matchedChars, !(a && a.overflow && !i))
|
|
1636
|
+
return a;
|
|
1637
|
+
}
|
|
1638
|
+
}]);
|
|
1639
|
+
})();
|
|
1640
|
+
function Z(t, r, e) {
|
|
1641
|
+
if (typeof r == "string") {
|
|
1642
|
+
var n = t.join("");
|
|
1643
|
+
return r.indexOf(n) === 0 ? t.length === r.length ? {
|
|
1644
|
+
match: !0,
|
|
1645
|
+
matchedChars: t
|
|
1646
|
+
} : {
|
|
1647
|
+
partialMatch: !0
|
|
1648
|
+
// matchedChars: characters
|
|
1649
|
+
} : n.indexOf(r) === 0 ? e && t.length > r.length ? {
|
|
1650
|
+
overflow: !0
|
|
1651
|
+
} : {
|
|
1652
|
+
match: !0,
|
|
1653
|
+
matchedChars: t.slice(0, r.length)
|
|
1654
|
+
} : void 0;
|
|
1655
|
+
}
|
|
1656
|
+
if (Array.isArray(r)) {
|
|
1657
|
+
for (var i = t.slice(), a = 0; a < r.length; ) {
|
|
1658
|
+
var o = r[a], u = Z(i, o, e && a === r.length - 1);
|
|
1659
|
+
if (u) {
|
|
1660
|
+
if (u.overflow)
|
|
1661
|
+
return u;
|
|
1662
|
+
if (u.match) {
|
|
1663
|
+
if (i = i.slice(u.matchedChars.length), i.length === 0)
|
|
1664
|
+
return a === r.length - 1 ? {
|
|
1665
|
+
match: !0,
|
|
1666
|
+
matchedChars: t
|
|
1667
|
+
} : {
|
|
1668
|
+
partialMatch: !0
|
|
1669
|
+
// matchedChars: characters
|
|
1670
|
+
};
|
|
1671
|
+
} else {
|
|
1672
|
+
if (u.partialMatch)
|
|
1673
|
+
return {
|
|
1674
|
+
partialMatch: !0
|
|
1675
|
+
// matchedChars: characters
|
|
1676
|
+
};
|
|
1677
|
+
throw new Error(`Unsupported match result:
|
|
1678
|
+
`.concat(JSON.stringify(u, null, 2)));
|
|
1679
|
+
}
|
|
1680
|
+
} else return;
|
|
1681
|
+
a++;
|
|
1682
|
+
}
|
|
1683
|
+
return e ? {
|
|
1684
|
+
overflow: !0
|
|
1685
|
+
} : {
|
|
1686
|
+
match: !0,
|
|
1687
|
+
matchedChars: t.slice(0, t.length - i.length)
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
switch (r.op) {
|
|
1691
|
+
case "|":
|
|
1692
|
+
for (var l, f = wt(r.args), s; !(s = f()).done; ) {
|
|
1693
|
+
var h = s.value, c = Z(t, h, e);
|
|
1694
|
+
if (c) {
|
|
1695
|
+
if (c.overflow)
|
|
1696
|
+
return c;
|
|
1697
|
+
if (c.match)
|
|
1698
|
+
return {
|
|
1699
|
+
match: !0,
|
|
1700
|
+
matchedChars: c.matchedChars
|
|
1701
|
+
};
|
|
1702
|
+
if (c.partialMatch)
|
|
1703
|
+
l = !0;
|
|
1704
|
+
else
|
|
1705
|
+
throw new Error(`Unsupported match result:
|
|
1706
|
+
`.concat(JSON.stringify(c, null, 2)));
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
return l ? {
|
|
1710
|
+
partialMatch: !0
|
|
1711
|
+
// matchedChars: ...
|
|
1712
|
+
} : void 0;
|
|
1713
|
+
case "[]":
|
|
1714
|
+
for (var m = wt(r.args), v; !(v = m()).done; ) {
|
|
1715
|
+
var P = v.value;
|
|
1716
|
+
if (t[0] === P)
|
|
1717
|
+
return t.length === 1 ? {
|
|
1718
|
+
match: !0,
|
|
1719
|
+
matchedChars: t
|
|
1720
|
+
} : e ? {
|
|
1721
|
+
overflow: !0
|
|
1722
|
+
} : {
|
|
1723
|
+
match: !0,
|
|
1724
|
+
matchedChars: [P]
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
return;
|
|
1728
|
+
/* istanbul ignore next */
|
|
1729
|
+
default:
|
|
1730
|
+
throw new Error("Unsupported instruction tree: ".concat(r));
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
function R(t) {
|
|
1734
|
+
"@babel/helpers - typeof";
|
|
1735
|
+
return R = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1736
|
+
return typeof r;
|
|
1737
|
+
} : function(r) {
|
|
1738
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1739
|
+
}, R(t);
|
|
1740
|
+
}
|
|
1741
|
+
function Tt(t, r) {
|
|
1742
|
+
var e = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
1743
|
+
if (e) return (e = e.call(t)).next.bind(e);
|
|
1744
|
+
if (Array.isArray(t) || (e = Pn(t)) || r) {
|
|
1745
|
+
e && (t = e);
|
|
1746
|
+
var n = 0;
|
|
1747
|
+
return function() {
|
|
1748
|
+
return n >= t.length ? { done: !0 } : { done: !1, value: t[n++] };
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1752
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1753
|
+
}
|
|
1754
|
+
function Pn(t, r) {
|
|
1755
|
+
if (t) {
|
|
1756
|
+
if (typeof t == "string") return It(t, r);
|
|
1757
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
1758
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? It(t, r) : void 0;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
function It(t, r) {
|
|
1762
|
+
(r == null || r > t.length) && (r = t.length);
|
|
1763
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
1764
|
+
return n;
|
|
1765
|
+
}
|
|
1766
|
+
function Sn(t, r) {
|
|
1767
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
1768
|
+
}
|
|
1769
|
+
function xn(t, r) {
|
|
1770
|
+
for (var e = 0; e < r.length; e++) {
|
|
1771
|
+
var n = r[e];
|
|
1772
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, _n(n.key), n);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
function En(t, r, e) {
|
|
1776
|
+
return r && xn(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
1777
|
+
}
|
|
1778
|
+
function _n(t) {
|
|
1779
|
+
var r = wn(t, "string");
|
|
1780
|
+
return R(r) == "symbol" ? r : r + "";
|
|
1781
|
+
}
|
|
1782
|
+
function wn(t, r) {
|
|
1783
|
+
if (R(t) != "object" || !t) return t;
|
|
1784
|
+
var e = t[Symbol.toPrimitive];
|
|
1785
|
+
if (e !== void 0) {
|
|
1786
|
+
var n = e.call(t, r);
|
|
1787
|
+
if (R(n) != "object") return n;
|
|
1788
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1789
|
+
}
|
|
1790
|
+
return String(t);
|
|
1791
|
+
}
|
|
1792
|
+
var Q = "9", An = 15, Tn = $(Q, An), In = /[- ]/, Fn = function() {
|
|
1793
|
+
return /\[([^\[\]])*\]/g;
|
|
1794
|
+
}, On = function() {
|
|
1795
|
+
return /\d(?=[^,}][^,}])/g;
|
|
1796
|
+
}, Rn = new RegExp("[" + b + "]*\\$1[" + b + "]*(\\$\\d[" + b + "]*)*$"), Ft = 3, Dn = /* @__PURE__ */ (function() {
|
|
1797
|
+
function t(r) {
|
|
1798
|
+
r.state;
|
|
1799
|
+
var e = r.metadata;
|
|
1800
|
+
Sn(this, t), this.metadata = e, this.resetFormat();
|
|
1801
|
+
}
|
|
1802
|
+
return En(t, [{
|
|
1803
|
+
key: "resetFormat",
|
|
1804
|
+
value: function() {
|
|
1805
|
+
this.chosenFormat = void 0, this.template = void 0, this.nationalNumberTemplate = void 0, this.populatedNationalNumberTemplate = void 0, this.populatedNationalNumberTemplatePosition = -1;
|
|
1806
|
+
}
|
|
1807
|
+
}, {
|
|
1808
|
+
key: "reset",
|
|
1809
|
+
value: function(e, n) {
|
|
1810
|
+
this.resetFormat(), e ? (this.isNANP = e.callingCode() === "1", this.matchingFormats = e.formats(), n.nationalSignificantNumber && this.narrowDownMatchingFormats(n)) : (this.isNANP = void 0, this.matchingFormats = []);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Formats an updated phone number.
|
|
1814
|
+
* @param {string} nextDigits — Additional phone number digits.
|
|
1815
|
+
* @param {object} state — `AsYouType` state.
|
|
1816
|
+
* @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.
|
|
1817
|
+
*/
|
|
1818
|
+
}, {
|
|
1819
|
+
key: "format",
|
|
1820
|
+
value: function(e, n) {
|
|
1821
|
+
var i = this;
|
|
1822
|
+
if (rn(n.nationalSignificantNumber, n.country, this.metadata))
|
|
1823
|
+
for (var a = Tt(this.matchingFormats), o; !(o = a()).done; ) {
|
|
1824
|
+
var u = o.value, l = en(n, u, {
|
|
1825
|
+
metadata: this.metadata,
|
|
1826
|
+
shouldTryNationalPrefixFormattingRule: function(s) {
|
|
1827
|
+
return i.shouldTryNationalPrefixFormattingRule(s, {
|
|
1828
|
+
international: n.international,
|
|
1829
|
+
nationalPrefix: n.nationalPrefix
|
|
1830
|
+
});
|
|
1831
|
+
},
|
|
1832
|
+
getSeparatorAfterNationalPrefix: function(s) {
|
|
1833
|
+
return i.getSeparatorAfterNationalPrefix(s);
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
if (l)
|
|
1837
|
+
return this.resetFormat(), this.chosenFormat = u, this.setNationalNumberTemplate(l.replace(/\d/g, d), n), this.populatedNationalNumberTemplate = l, this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(d), l;
|
|
1838
|
+
}
|
|
1839
|
+
return this.formatNationalNumberWithNextDigits(e, n);
|
|
1840
|
+
}
|
|
1841
|
+
// Formats the next phone number digits.
|
|
1842
|
+
}, {
|
|
1843
|
+
key: "formatNationalNumberWithNextDigits",
|
|
1844
|
+
value: function(e, n) {
|
|
1845
|
+
var i = this.chosenFormat, a = this.chooseFormat(n);
|
|
1846
|
+
if (a)
|
|
1847
|
+
return a === i ? this.formatNextNationalNumberDigits(e) : this.formatNextNationalNumberDigits(n.getNationalDigits());
|
|
1848
|
+
}
|
|
1849
|
+
}, {
|
|
1850
|
+
key: "narrowDownMatchingFormats",
|
|
1851
|
+
value: function(e) {
|
|
1852
|
+
var n = this, i = e.nationalSignificantNumber, a = e.nationalPrefix, o = e.international, u = i, l = u.length - Ft;
|
|
1853
|
+
l < 0 && (l = 0), this.matchingFormats = this.matchingFormats.filter(function(f) {
|
|
1854
|
+
return n.formatSuits(f, o, a) && n.formatMatches(f, u, l);
|
|
1855
|
+
}), this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1 && this.resetFormat();
|
|
1856
|
+
}
|
|
1857
|
+
}, {
|
|
1858
|
+
key: "formatSuits",
|
|
1859
|
+
value: function(e, n, i) {
|
|
1860
|
+
return !(i && !e.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&
|
|
1861
|
+
!e.nationalPrefixIsOptionalWhenFormattingInNationalFormat() || !n && !i && e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat());
|
|
1862
|
+
}
|
|
1863
|
+
}, {
|
|
1864
|
+
key: "formatMatches",
|
|
1865
|
+
value: function(e, n, i) {
|
|
1866
|
+
var a = e.leadingDigitsPatterns().length;
|
|
1867
|
+
if (a === 0)
|
|
1868
|
+
return !0;
|
|
1869
|
+
i = Math.min(i, a - 1);
|
|
1870
|
+
var o = e.leadingDigitsPatterns()[i];
|
|
1871
|
+
if (n.length < Ft)
|
|
1872
|
+
try {
|
|
1873
|
+
return new Cn(o).match(n, {
|
|
1874
|
+
allowOverflow: !0
|
|
1875
|
+
}) !== void 0;
|
|
1876
|
+
} catch (u) {
|
|
1877
|
+
return console.error(u), !0;
|
|
1878
|
+
}
|
|
1879
|
+
return new RegExp("^(".concat(o, ")")).test(n);
|
|
1880
|
+
}
|
|
1881
|
+
}, {
|
|
1882
|
+
key: "getFormatFormat",
|
|
1883
|
+
value: function(e, n) {
|
|
1884
|
+
return n ? e.internationalFormat() : e.format();
|
|
1885
|
+
}
|
|
1886
|
+
}, {
|
|
1887
|
+
key: "chooseFormat",
|
|
1888
|
+
value: function(e) {
|
|
1889
|
+
for (var n = this, i = function() {
|
|
1890
|
+
var f = u.value;
|
|
1891
|
+
return n.chosenFormat === f ? 0 : Rn.test(n.getFormatFormat(f, e.international)) ? n.createTemplateForFormat(f, e) ? (n.chosenFormat = f, 0) : (n.matchingFormats = n.matchingFormats.filter(function(s) {
|
|
1892
|
+
return s !== f;
|
|
1893
|
+
}), 1) : 1;
|
|
1894
|
+
}, a, o = Tt(this.matchingFormats.slice()), u; !(u = o()).done && (a = i(), a !== 0); )
|
|
1895
|
+
;
|
|
1896
|
+
return this.chosenFormat || this.resetFormat(), this.chosenFormat;
|
|
1897
|
+
}
|
|
1898
|
+
}, {
|
|
1899
|
+
key: "createTemplateForFormat",
|
|
1900
|
+
value: function(e, n) {
|
|
1901
|
+
if (!(e.pattern().indexOf("|") >= 0)) {
|
|
1902
|
+
var i = this.getTemplateForFormat(e, n);
|
|
1903
|
+
if (i)
|
|
1904
|
+
return this.setNationalNumberTemplate(i, n), !0;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}, {
|
|
1908
|
+
key: "getSeparatorAfterNationalPrefix",
|
|
1909
|
+
value: function(e) {
|
|
1910
|
+
return this.isNANP || e && e.nationalPrefixFormattingRule() && In.test(e.nationalPrefixFormattingRule()) ? " " : "";
|
|
1911
|
+
}
|
|
1912
|
+
}, {
|
|
1913
|
+
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
1914
|
+
value: function(e, n) {
|
|
1915
|
+
var i = e.IDDPrefix, a = e.missingPlus;
|
|
1916
|
+
return i ? n && n.spacing === !1 ? i : i + " " : a ? "" : "+";
|
|
1917
|
+
}
|
|
1918
|
+
}, {
|
|
1919
|
+
key: "getTemplate",
|
|
1920
|
+
value: function(e) {
|
|
1921
|
+
if (this.template) {
|
|
1922
|
+
for (var n = -1, i = 0, a = e.international ? this.getInternationalPrefixBeforeCountryCallingCode(e, {
|
|
1923
|
+
spacing: !1
|
|
1924
|
+
}) : ""; i < a.length + e.getDigitsWithoutInternationalPrefix().length; )
|
|
1925
|
+
n = this.template.indexOf(d, n + 1), i++;
|
|
1926
|
+
return Et(this.template, n + 1);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}, {
|
|
1930
|
+
key: "setNationalNumberTemplate",
|
|
1931
|
+
value: function(e, n) {
|
|
1932
|
+
this.nationalNumberTemplate = e, this.populatedNationalNumberTemplate = e, this.populatedNationalNumberTemplatePosition = -1, n.international ? this.template = this.getInternationalPrefixBeforeCountryCallingCode(n).replace(/[\d\+]/g, d) + $(d, n.callingCode.length) + " " + e : this.template = e;
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* Generates formatting template for a national phone number,
|
|
1936
|
+
* optionally containing a national prefix, for a format.
|
|
1937
|
+
* @param {Format} format
|
|
1938
|
+
* @param {string} nationalPrefix
|
|
1939
|
+
* @return {string}
|
|
1940
|
+
*/
|
|
1941
|
+
}, {
|
|
1942
|
+
key: "getTemplateForFormat",
|
|
1943
|
+
value: function(e, n) {
|
|
1944
|
+
var i = n.nationalSignificantNumber, a = n.international, o = n.nationalPrefix, u = n.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, l = e.pattern();
|
|
1945
|
+
l = l.replace(Fn(), "\\d").replace(On(), "\\d");
|
|
1946
|
+
var f = Tn.match(l)[0];
|
|
1947
|
+
if (!(i.length > f.length)) {
|
|
1948
|
+
var s = new RegExp("^" + l + "$"), h = i.replace(/\d/g, Q);
|
|
1949
|
+
s.test(h) && (f = h);
|
|
1950
|
+
var c = this.getFormatFormat(e, a), m;
|
|
1951
|
+
if (this.shouldTryNationalPrefixFormattingRule(e, {
|
|
1952
|
+
international: a,
|
|
1953
|
+
nationalPrefix: o
|
|
1954
|
+
})) {
|
|
1955
|
+
var v = c.replace(Mt, e.nationalPrefixFormattingRule());
|
|
1956
|
+
if (M(e.nationalPrefixFormattingRule()) === (o || "") + M("$1") && (c = v, m = !0, o))
|
|
1957
|
+
for (var P = o.length; P > 0; )
|
|
1958
|
+
c = c.replace(/\d/, d), P--;
|
|
1959
|
+
}
|
|
1960
|
+
var p = f.replace(new RegExp(l), c).replace(new RegExp(Q, "g"), d);
|
|
1961
|
+
return m || (u ? p = $(d, u.length) + " " + p : o && (p = $(d, o.length) + this.getSeparatorAfterNationalPrefix(e) + p)), a && (p = kt(p)), p;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}, {
|
|
1965
|
+
key: "formatNextNationalNumberDigits",
|
|
1966
|
+
value: function(e) {
|
|
1967
|
+
var n = tn(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, e);
|
|
1968
|
+
if (!n) {
|
|
1969
|
+
this.resetFormat();
|
|
1970
|
+
return;
|
|
1971
|
+
}
|
|
1972
|
+
return this.populatedNationalNumberTemplate = n[0], this.populatedNationalNumberTemplatePosition = n[1], Et(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
1973
|
+
}
|
|
1974
|
+
}, {
|
|
1975
|
+
key: "shouldTryNationalPrefixFormattingRule",
|
|
1976
|
+
value: function(e, n) {
|
|
1977
|
+
var i = n.international, a = n.nationalPrefix;
|
|
1978
|
+
if (e.nationalPrefixFormattingRule()) {
|
|
1979
|
+
var o = e.usesNationalPrefix();
|
|
1980
|
+
if (o && a || !o && !i)
|
|
1981
|
+
return !0;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}]);
|
|
1985
|
+
})();
|
|
1986
|
+
function D(t) {
|
|
1987
|
+
"@babel/helpers - typeof";
|
|
1988
|
+
return D = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
1989
|
+
return typeof r;
|
|
1990
|
+
} : function(r) {
|
|
1991
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
1992
|
+
}, D(t);
|
|
1993
|
+
}
|
|
1994
|
+
function Xt(t, r) {
|
|
1995
|
+
return kn(t) || jn(t, r) || $n(t, r) || Ln();
|
|
1996
|
+
}
|
|
1997
|
+
function Ln() {
|
|
1998
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1999
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
2000
|
+
}
|
|
2001
|
+
function $n(t, r) {
|
|
2002
|
+
if (t) {
|
|
2003
|
+
if (typeof t == "string") return Ot(t, r);
|
|
2004
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
2005
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? Ot(t, r) : void 0;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
function Ot(t, r) {
|
|
2009
|
+
(r == null || r > t.length) && (r = t.length);
|
|
2010
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
2011
|
+
return n;
|
|
2012
|
+
}
|
|
2013
|
+
function jn(t, r) {
|
|
2014
|
+
var e = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
2015
|
+
if (e != null) {
|
|
2016
|
+
var n, i, a, o, u = [], l = !0, f = !1;
|
|
2017
|
+
try {
|
|
2018
|
+
if (a = (e = e.call(t)).next, r !== 0) for (; !(l = (n = a.call(e)).done) && (u.push(n.value), u.length !== r); l = !0) ;
|
|
2019
|
+
} catch (s) {
|
|
2020
|
+
f = !0, i = s;
|
|
2021
|
+
} finally {
|
|
2022
|
+
try {
|
|
2023
|
+
if (!l && e.return != null && (o = e.return(), Object(o) !== o)) return;
|
|
2024
|
+
} finally {
|
|
2025
|
+
if (f) throw i;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
return u;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
function kn(t) {
|
|
2032
|
+
if (Array.isArray(t)) return t;
|
|
2033
|
+
}
|
|
2034
|
+
function Mn(t, r) {
|
|
2035
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
2036
|
+
}
|
|
2037
|
+
function Un(t, r) {
|
|
2038
|
+
for (var e = 0; e < r.length; e++) {
|
|
2039
|
+
var n = r[e];
|
|
2040
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, Hn(n.key), n);
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
function Bn(t, r, e) {
|
|
2044
|
+
return r && Un(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
2045
|
+
}
|
|
2046
|
+
function Hn(t) {
|
|
2047
|
+
var r = Gn(t, "string");
|
|
2048
|
+
return D(r) == "symbol" ? r : r + "";
|
|
2049
|
+
}
|
|
2050
|
+
function Gn(t, r) {
|
|
2051
|
+
if (D(t) != "object" || !t) return t;
|
|
2052
|
+
var e = t[Symbol.toPrimitive];
|
|
2053
|
+
if (e !== void 0) {
|
|
2054
|
+
var n = e.call(t, r);
|
|
2055
|
+
if (D(n) != "object") return n;
|
|
2056
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2057
|
+
}
|
|
2058
|
+
return String(t);
|
|
2059
|
+
}
|
|
2060
|
+
var Wn = "[" + b + y + "]+", Vn = new RegExp("^" + Wn + "$", "i"), Xn = "(?:[" + B + "][" + b + y + "]*|[" + b + y + "]+)", Kn = new RegExp("[^" + b + y + "]+.*$"), Yn = /[^\d\[\]]/, qn = /* @__PURE__ */ (function() {
|
|
2061
|
+
function t(r) {
|
|
2062
|
+
var e = r.defaultCountry, n = r.defaultCallingCode, i = r.metadata, a = r.onNationalSignificantNumberChange;
|
|
2063
|
+
Mn(this, t), this.defaultCountry = e, this.defaultCallingCode = n, this.metadata = i, this.onNationalSignificantNumberChange = a;
|
|
2064
|
+
}
|
|
2065
|
+
return Bn(t, [{
|
|
2066
|
+
key: "input",
|
|
2067
|
+
value: function(e, n) {
|
|
2068
|
+
var i = Zn(e), a = Xt(i, 2), o = a[0], u = a[1], l = M(o), f;
|
|
2069
|
+
return u && (n.digits || (n.startInternationalNumber(void 0, void 0), l || (f = !0))), l && this.inputDigits(l, n), {
|
|
2070
|
+
digits: l,
|
|
2071
|
+
justLeadingPlus: f
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* Inputs "next" phone number digits.
|
|
2076
|
+
* @param {string} digits
|
|
2077
|
+
* @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means "don't format the national phone number at this stage".
|
|
2078
|
+
*/
|
|
2079
|
+
}, {
|
|
2080
|
+
key: "inputDigits",
|
|
2081
|
+
value: function(e, n) {
|
|
2082
|
+
var i = n.digits, a = i.length < 3 && i.length + e.length >= 3;
|
|
2083
|
+
if (n.appendDigits(e), a && this.extractIddPrefix(n), this.isWaitingForCountryCallingCode(n)) {
|
|
2084
|
+
if (!this.extractCountryCallingCode(n))
|
|
2085
|
+
return;
|
|
2086
|
+
} else
|
|
2087
|
+
n.appendNationalSignificantNumberDigits(e);
|
|
2088
|
+
n.international || this.hasExtractedNationalSignificantNumber || this.extractNationalSignificantNumber(n.getNationalDigits(), function(o) {
|
|
2089
|
+
return n.update(o);
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
}, {
|
|
2093
|
+
key: "isWaitingForCountryCallingCode",
|
|
2094
|
+
value: function(e) {
|
|
2095
|
+
var n = e.international, i = e.callingCode;
|
|
2096
|
+
return n && !i;
|
|
2097
|
+
}
|
|
2098
|
+
// Extracts a country calling code from a number
|
|
2099
|
+
// being entered in internatonal format.
|
|
2100
|
+
}, {
|
|
2101
|
+
key: "extractCountryCallingCode",
|
|
2102
|
+
value: function(e) {
|
|
2103
|
+
var n = at("+" + e.getDigitsWithoutInternationalPrefix(), e.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), i = n.countryCallingCode, a = n.number;
|
|
2104
|
+
if (i)
|
|
2105
|
+
return e.setCallingCode(i), e.update({
|
|
2106
|
+
nationalSignificantNumber: a
|
|
2107
|
+
}), !0;
|
|
2108
|
+
}
|
|
2109
|
+
}, {
|
|
2110
|
+
key: "reset",
|
|
2111
|
+
value: function(e) {
|
|
2112
|
+
if (e) {
|
|
2113
|
+
this.hasSelectedNumberingPlan = !0;
|
|
2114
|
+
var n = e._nationalPrefixForParsing();
|
|
2115
|
+
this.couldPossiblyExtractAnotherNationalSignificantNumber = n && Yn.test(n);
|
|
2116
|
+
} else
|
|
2117
|
+
this.hasSelectedNumberingPlan = void 0, this.couldPossiblyExtractAnotherNationalSignificantNumber = void 0;
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Extracts a national (significant) number from user input.
|
|
2121
|
+
* Google's library is different in that it only applies `national_prefix_for_parsing`
|
|
2122
|
+
* and doesn't apply `national_prefix_transform_rule` after that.
|
|
2123
|
+
* https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539
|
|
2124
|
+
* @return {boolean} [extracted]
|
|
2125
|
+
*/
|
|
2126
|
+
}, {
|
|
2127
|
+
key: "extractNationalSignificantNumber",
|
|
2128
|
+
value: function(e, n) {
|
|
2129
|
+
if (this.hasSelectedNumberingPlan) {
|
|
2130
|
+
var i = X(e, this.metadata), a = i.nationalPrefix, o = i.nationalNumber, u = i.carrierCode;
|
|
2131
|
+
if (o !== e)
|
|
2132
|
+
return this.onExtractedNationalNumber(a, u, o, e, n), !0;
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* In Google's code this function is called "attempt to extract longer NDD".
|
|
2137
|
+
* "Some national prefixes are a substring of others", they say.
|
|
2138
|
+
* @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.
|
|
2139
|
+
*/
|
|
2140
|
+
}, {
|
|
2141
|
+
key: "extractAnotherNationalSignificantNumber",
|
|
2142
|
+
value: function(e, n, i) {
|
|
2143
|
+
if (!this.hasExtractedNationalSignificantNumber)
|
|
2144
|
+
return this.extractNationalSignificantNumber(e, i);
|
|
2145
|
+
if (this.couldPossiblyExtractAnotherNationalSignificantNumber) {
|
|
2146
|
+
var a = X(e, this.metadata), o = a.nationalPrefix, u = a.nationalNumber, l = a.carrierCode;
|
|
2147
|
+
if (u !== n)
|
|
2148
|
+
return this.onExtractedNationalNumber(o, l, u, e, i), !0;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}, {
|
|
2152
|
+
key: "onExtractedNationalNumber",
|
|
2153
|
+
value: function(e, n, i, a, o) {
|
|
2154
|
+
var u = !1, l, f = a.lastIndexOf(i);
|
|
2155
|
+
if (f < 0 || f !== a.length - i.length)
|
|
2156
|
+
u = !0;
|
|
2157
|
+
else {
|
|
2158
|
+
var s = a.slice(0, f);
|
|
2159
|
+
s && s !== e && (l = s);
|
|
2160
|
+
}
|
|
2161
|
+
o({
|
|
2162
|
+
nationalPrefix: e,
|
|
2163
|
+
carrierCode: n,
|
|
2164
|
+
nationalSignificantNumber: i,
|
|
2165
|
+
nationalSignificantNumberIsModified: u,
|
|
2166
|
+
prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix: l
|
|
2167
|
+
}), this.hasExtractedNationalSignificantNumber = !0, this.onNationalSignificantNumberChange();
|
|
2168
|
+
}
|
|
2169
|
+
}, {
|
|
2170
|
+
key: "reExtractNationalSignificantNumber",
|
|
2171
|
+
value: function(e) {
|
|
2172
|
+
if (this.extractAnotherNationalSignificantNumber(e.getNationalDigits(), e.nationalSignificantNumber, function(n) {
|
|
2173
|
+
return e.update(n);
|
|
2174
|
+
}))
|
|
2175
|
+
return !0;
|
|
2176
|
+
if (this.extractIddPrefix(e))
|
|
2177
|
+
return this.extractCallingCodeAndNationalSignificantNumber(e), !0;
|
|
2178
|
+
if (this.fixMissingPlus(e))
|
|
2179
|
+
return this.extractCallingCodeAndNationalSignificantNumber(e), !0;
|
|
2180
|
+
}
|
|
2181
|
+
}, {
|
|
2182
|
+
key: "extractIddPrefix",
|
|
2183
|
+
value: function(e) {
|
|
2184
|
+
var n = e.international, i = e.IDDPrefix, a = e.digits;
|
|
2185
|
+
if (e.nationalSignificantNumber, !(n || i)) {
|
|
2186
|
+
var o = Lt(a, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
|
|
2187
|
+
if (o !== void 0 && o !== a)
|
|
2188
|
+
return e.update({
|
|
2189
|
+
IDDPrefix: a.slice(0, a.length - o.length)
|
|
2190
|
+
}), this.startInternationalNumber(e, {
|
|
2191
|
+
country: void 0,
|
|
2192
|
+
callingCode: void 0
|
|
2193
|
+
}), !0;
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
}, {
|
|
2197
|
+
key: "fixMissingPlus",
|
|
2198
|
+
value: function(e) {
|
|
2199
|
+
if (!e.international) {
|
|
2200
|
+
var n = jt(e.digits, e.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), i = n.countryCallingCode;
|
|
2201
|
+
if (i)
|
|
2202
|
+
return e.update({
|
|
2203
|
+
missingPlus: !0
|
|
2204
|
+
}), this.startInternationalNumber(e, {
|
|
2205
|
+
country: e.country,
|
|
2206
|
+
callingCode: i
|
|
2207
|
+
}), !0;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
}, {
|
|
2211
|
+
key: "startInternationalNumber",
|
|
2212
|
+
value: function(e, n) {
|
|
2213
|
+
var i = n.country, a = n.callingCode;
|
|
2214
|
+
e.startInternationalNumber(i, a), e.nationalSignificantNumber && (e.resetNationalSignificantNumber(), this.onNationalSignificantNumberChange(), this.hasExtractedNationalSignificantNumber = void 0);
|
|
2215
|
+
}
|
|
2216
|
+
}, {
|
|
2217
|
+
key: "extractCallingCodeAndNationalSignificantNumber",
|
|
2218
|
+
value: function(e) {
|
|
2219
|
+
this.extractCountryCallingCode(e) && this.extractNationalSignificantNumber(e.getNationalDigits(), function(n) {
|
|
2220
|
+
return e.update(n);
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
}]);
|
|
2224
|
+
})();
|
|
2225
|
+
function zn(t) {
|
|
2226
|
+
var r = t.search(Xn);
|
|
2227
|
+
if (!(r < 0)) {
|
|
2228
|
+
t = t.slice(r);
|
|
2229
|
+
var e;
|
|
2230
|
+
return t[0] === "+" && (e = !0, t = t.slice(1)), t = t.replace(Kn, ""), e && (t = "+" + t), t;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
function Jn(t) {
|
|
2234
|
+
var r = zn(t) || "";
|
|
2235
|
+
return r[0] === "+" ? [r.slice(1), !0] : [r];
|
|
2236
|
+
}
|
|
2237
|
+
function Zn(t) {
|
|
2238
|
+
var r = Jn(t), e = Xt(r, 2), n = e[0], i = e[1];
|
|
2239
|
+
return Vn.test(n) || (n = ""), [n, i];
|
|
2240
|
+
}
|
|
2241
|
+
function L(t) {
|
|
2242
|
+
"@babel/helpers - typeof";
|
|
2243
|
+
return L = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
|
|
2244
|
+
return typeof r;
|
|
2245
|
+
} : function(r) {
|
|
2246
|
+
return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
2247
|
+
}, L(t);
|
|
2248
|
+
}
|
|
2249
|
+
function Qn(t, r) {
|
|
2250
|
+
return ni(t) || ri(t, r) || ei(t, r) || ti();
|
|
2251
|
+
}
|
|
2252
|
+
function ti() {
|
|
2253
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2254
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
2255
|
+
}
|
|
2256
|
+
function ei(t, r) {
|
|
2257
|
+
if (t) {
|
|
2258
|
+
if (typeof t == "string") return Rt(t, r);
|
|
2259
|
+
var e = {}.toString.call(t).slice(8, -1);
|
|
2260
|
+
return e === "Object" && t.constructor && (e = t.constructor.name), e === "Map" || e === "Set" ? Array.from(t) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? Rt(t, r) : void 0;
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
function Rt(t, r) {
|
|
2264
|
+
(r == null || r > t.length) && (r = t.length);
|
|
2265
|
+
for (var e = 0, n = Array(r); e < r; e++) n[e] = t[e];
|
|
2266
|
+
return n;
|
|
2267
|
+
}
|
|
2268
|
+
function ri(t, r) {
|
|
2269
|
+
var e = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
2270
|
+
if (e != null) {
|
|
2271
|
+
var n, i, a, o, u = [], l = !0, f = !1;
|
|
2272
|
+
try {
|
|
2273
|
+
if (a = (e = e.call(t)).next, r !== 0) for (; !(l = (n = a.call(e)).done) && (u.push(n.value), u.length !== r); l = !0) ;
|
|
2274
|
+
} catch (s) {
|
|
2275
|
+
f = !0, i = s;
|
|
2276
|
+
} finally {
|
|
2277
|
+
try {
|
|
2278
|
+
if (!l && e.return != null && (o = e.return(), Object(o) !== o)) return;
|
|
2279
|
+
} finally {
|
|
2280
|
+
if (f) throw i;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
return u;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
function ni(t) {
|
|
2287
|
+
if (Array.isArray(t)) return t;
|
|
2288
|
+
}
|
|
2289
|
+
function ii(t, r) {
|
|
2290
|
+
if (!(t instanceof r)) throw new TypeError("Cannot call a class as a function");
|
|
2291
|
+
}
|
|
2292
|
+
function ai(t, r) {
|
|
2293
|
+
for (var e = 0; e < r.length; e++) {
|
|
2294
|
+
var n = r[e];
|
|
2295
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, ui(n.key), n);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
function oi(t, r, e) {
|
|
2299
|
+
return r && ai(t.prototype, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
2300
|
+
}
|
|
2301
|
+
function ui(t) {
|
|
2302
|
+
var r = li(t, "string");
|
|
2303
|
+
return L(r) == "symbol" ? r : r + "";
|
|
2304
|
+
}
|
|
2305
|
+
function li(t, r) {
|
|
2306
|
+
if (L(t) != "object" || !t) return t;
|
|
2307
|
+
var e = t[Symbol.toPrimitive];
|
|
2308
|
+
if (e !== void 0) {
|
|
2309
|
+
var n = e.call(t, r);
|
|
2310
|
+
if (L(n) != "object") return n;
|
|
2311
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2312
|
+
}
|
|
2313
|
+
return String(t);
|
|
2314
|
+
}
|
|
2315
|
+
var Kt = /* @__PURE__ */ (function() {
|
|
2316
|
+
function t(r, e) {
|
|
2317
|
+
ii(this, t), this.metadata = new g(e);
|
|
2318
|
+
var n = this.getCountryAndCallingCode(r), i = Qn(n, 2), a = i[0], o = i[1];
|
|
2319
|
+
this.defaultCountry = a, this.defaultCallingCode = o, this.reset();
|
|
2320
|
+
}
|
|
2321
|
+
return oi(t, [{
|
|
2322
|
+
key: "getCountryAndCallingCode",
|
|
2323
|
+
value: function(e) {
|
|
2324
|
+
var n, i;
|
|
2325
|
+
return e && (j(e) ? (n = e.defaultCountry, i = e.defaultCallingCode) : n = e), n && !this.metadata.hasCountry(n) && (n = void 0), [n, i];
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Inputs "next" phone number characters.
|
|
2329
|
+
* @param {string} text
|
|
2330
|
+
* @return {string} Formatted phone number characters that have been input so far.
|
|
2331
|
+
*/
|
|
2332
|
+
}, {
|
|
2333
|
+
key: "input",
|
|
2334
|
+
value: function(e) {
|
|
2335
|
+
var n = this.parser.input(e, this.state), i = n.digits, a = n.justLeadingPlus;
|
|
2336
|
+
if (a)
|
|
2337
|
+
this.formattedOutput = "+";
|
|
2338
|
+
else if (i) {
|
|
2339
|
+
this.determineTheCountryIfNeeded(), this.state.nationalSignificantNumber && this.formatter.narrowDownMatchingFormats(this.state);
|
|
2340
|
+
var o;
|
|
2341
|
+
if (this.metadata.hasSelectedNumberingPlan() && (o = this.formatter.format(i, this.state)), o === void 0 && this.parser.reExtractNationalSignificantNumber(this.state)) {
|
|
2342
|
+
this.determineTheCountryIfNeeded();
|
|
2343
|
+
var u = this.state.getNationalDigits();
|
|
2344
|
+
u && (o = this.formatter.format(u, this.state));
|
|
2345
|
+
}
|
|
2346
|
+
this.formattedOutput = o ? this.getFullNumber(o) : this.getNonFormattedNumber();
|
|
2347
|
+
}
|
|
2348
|
+
return this.formattedOutput;
|
|
2349
|
+
}
|
|
2350
|
+
}, {
|
|
2351
|
+
key: "reset",
|
|
2352
|
+
value: function() {
|
|
2353
|
+
var e = this;
|
|
2354
|
+
return this.state = new zr({
|
|
2355
|
+
onCountryChange: function(i) {
|
|
2356
|
+
e.country = i;
|
|
2357
|
+
},
|
|
2358
|
+
onCallingCodeChange: function(i, a) {
|
|
2359
|
+
e.metadata.selectNumberingPlan(a, i), e.formatter.reset(e.metadata.numberingPlan, e.state), e.parser.reset(e.metadata.numberingPlan);
|
|
2360
|
+
}
|
|
2361
|
+
}), this.formatter = new Dn({
|
|
2362
|
+
state: this.state,
|
|
2363
|
+
metadata: this.metadata
|
|
2364
|
+
}), this.parser = new qn({
|
|
2365
|
+
defaultCountry: this.defaultCountry,
|
|
2366
|
+
defaultCallingCode: this.defaultCallingCode,
|
|
2367
|
+
metadata: this.metadata,
|
|
2368
|
+
state: this.state,
|
|
2369
|
+
onNationalSignificantNumberChange: function() {
|
|
2370
|
+
e.determineTheCountryIfNeeded(), e.formatter.reset(e.metadata.numberingPlan, e.state);
|
|
2371
|
+
}
|
|
2372
|
+
}), this.state.reset({
|
|
2373
|
+
country: this.defaultCountry,
|
|
2374
|
+
callingCode: this.defaultCallingCode
|
|
2375
|
+
}), this.formattedOutput = "", this;
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Returns `true` if the phone number is being input in international format.
|
|
2379
|
+
* In other words, returns `true` if and only if the parsed phone number starts with a `"+"`.
|
|
2380
|
+
* @return {boolean}
|
|
2381
|
+
*/
|
|
2382
|
+
}, {
|
|
2383
|
+
key: "isInternational",
|
|
2384
|
+
value: function() {
|
|
2385
|
+
return this.state.international;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Returns the "calling code" part of the phone number when it's being input
|
|
2389
|
+
* in an international format.
|
|
2390
|
+
* If no valid calling code has been entered so far, returns `undefined`.
|
|
2391
|
+
* @return {string} [callingCode]
|
|
2392
|
+
*/
|
|
2393
|
+
}, {
|
|
2394
|
+
key: "getCallingCode",
|
|
2395
|
+
value: function() {
|
|
2396
|
+
if (this.isInternational())
|
|
2397
|
+
return this.state.callingCode;
|
|
2398
|
+
}
|
|
2399
|
+
// A legacy alias.
|
|
2400
|
+
}, {
|
|
2401
|
+
key: "getCountryCallingCode",
|
|
2402
|
+
value: function() {
|
|
2403
|
+
return this.getCallingCode();
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Returns a two-letter country code of the phone number.
|
|
2407
|
+
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
2408
|
+
* Returns `undefined` if no phone number has been input yet.
|
|
2409
|
+
* @return {string} [country]
|
|
2410
|
+
*/
|
|
2411
|
+
}, {
|
|
2412
|
+
key: "getCountry",
|
|
2413
|
+
value: function() {
|
|
2414
|
+
var e = this.state.digits;
|
|
2415
|
+
if (e)
|
|
2416
|
+
return this._getCountry();
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Returns a two-letter country code of the phone number.
|
|
2420
|
+
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
2421
|
+
* @return {string} [country]
|
|
2422
|
+
*/
|
|
2423
|
+
}, {
|
|
2424
|
+
key: "_getCountry",
|
|
2425
|
+
value: function() {
|
|
2426
|
+
var e = this.state.country;
|
|
2427
|
+
return e;
|
|
2428
|
+
}
|
|
2429
|
+
}, {
|
|
2430
|
+
key: "determineTheCountryIfNeeded",
|
|
2431
|
+
value: function() {
|
|
2432
|
+
(!this.state.country || this.isCountryCallingCodeAmbiguous()) && this.determineTheCountry();
|
|
2433
|
+
}
|
|
2434
|
+
// Prepends `+CountryCode ` in case of an international phone number
|
|
2435
|
+
}, {
|
|
2436
|
+
key: "getFullNumber",
|
|
2437
|
+
value: function(e) {
|
|
2438
|
+
var n = this;
|
|
2439
|
+
if (this.isInternational()) {
|
|
2440
|
+
var i = function(u) {
|
|
2441
|
+
return n.formatter.getInternationalPrefixBeforeCountryCallingCode(n.state, {
|
|
2442
|
+
spacing: !!u
|
|
2443
|
+
}) + u;
|
|
2444
|
+
}, a = this.state.callingCode;
|
|
2445
|
+
return i(a ? e ? "".concat(a, " ").concat(e) : a : "".concat(this.state.getDigitsWithoutInternationalPrefix()));
|
|
2446
|
+
}
|
|
2447
|
+
return e;
|
|
2448
|
+
}
|
|
2449
|
+
}, {
|
|
2450
|
+
key: "getNonFormattedNationalNumberWithPrefix",
|
|
2451
|
+
value: function() {
|
|
2452
|
+
var e = this.state, n = e.nationalSignificantNumber, i = e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, a = e.nationalPrefix, o = n, u = i || a;
|
|
2453
|
+
return u && (o = u + o), o;
|
|
2454
|
+
}
|
|
2455
|
+
}, {
|
|
2456
|
+
key: "getNonFormattedNumber",
|
|
2457
|
+
value: function() {
|
|
2458
|
+
var e = this.state.nationalSignificantNumberIsModified;
|
|
2459
|
+
return this.getFullNumber(e ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
|
|
2460
|
+
}
|
|
2461
|
+
}, {
|
|
2462
|
+
key: "getNonFormattedTemplate",
|
|
2463
|
+
value: function() {
|
|
2464
|
+
var e = this.getNonFormattedNumber();
|
|
2465
|
+
if (e)
|
|
2466
|
+
return e.replace(/[\+\d]/g, d);
|
|
2467
|
+
}
|
|
2468
|
+
}, {
|
|
2469
|
+
key: "isCountryCallingCodeAmbiguous",
|
|
2470
|
+
value: function() {
|
|
2471
|
+
var e = this.state.callingCode, n = this.metadata.getCountryCodesForCallingCode(e);
|
|
2472
|
+
return n && n.length > 1;
|
|
2473
|
+
}
|
|
2474
|
+
// Determines the exact country of the phone number
|
|
2475
|
+
// entered so far based on the country phone code
|
|
2476
|
+
// and the national phone number.
|
|
2477
|
+
}, {
|
|
2478
|
+
key: "determineTheCountry",
|
|
2479
|
+
value: function() {
|
|
2480
|
+
this.state.setCountry(it(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
|
|
2481
|
+
nationalNumber: this.state.nationalSignificantNumber,
|
|
2482
|
+
metadata: this.metadata
|
|
2483
|
+
}));
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Returns a E.164 phone number value for the user's input.
|
|
2487
|
+
*
|
|
2488
|
+
* For example, for country `"US"` and input `"(222) 333-4444"`
|
|
2489
|
+
* it will return `"+12223334444"`.
|
|
2490
|
+
*
|
|
2491
|
+
* For international phone number input, it will also auto-correct
|
|
2492
|
+
* some minor errors such as using a national prefix when writing
|
|
2493
|
+
* an international phone number. For example, if the user inputs
|
|
2494
|
+
* `"+44 0 7400 000000"` then it will return an auto-corrected
|
|
2495
|
+
* `"+447400000000"` phone number value.
|
|
2496
|
+
*
|
|
2497
|
+
* Will return `undefined` if no digits have been input,
|
|
2498
|
+
* or when inputting a phone number in national format and no
|
|
2499
|
+
* default country or default "country calling code" have been set.
|
|
2500
|
+
*
|
|
2501
|
+
* @return {string} [value]
|
|
2502
|
+
*/
|
|
2503
|
+
}, {
|
|
2504
|
+
key: "getNumberValue",
|
|
2505
|
+
value: function() {
|
|
2506
|
+
var e = this.state, n = e.digits, i = e.callingCode, a = e.country, o = e.nationalSignificantNumber;
|
|
2507
|
+
if (n) {
|
|
2508
|
+
if (this.isInternational())
|
|
2509
|
+
return i ? "+" + i + o : "+" + n;
|
|
2510
|
+
if (a || i) {
|
|
2511
|
+
var u = a ? this.metadata.countryCallingCode() : i;
|
|
2512
|
+
return "+" + u + o;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Returns an instance of `PhoneNumber` class.
|
|
2518
|
+
* Will return `undefined` if no national (significant) number
|
|
2519
|
+
* digits have been entered so far, or if no `defaultCountry` has been
|
|
2520
|
+
* set and the user enters a phone number not in international format.
|
|
2521
|
+
*/
|
|
2522
|
+
}, {
|
|
2523
|
+
key: "getNumber",
|
|
2524
|
+
value: function() {
|
|
2525
|
+
var e = this.state, n = e.nationalSignificantNumber, i = e.carrierCode, a = e.callingCode, o = this._getCountry();
|
|
2526
|
+
if (n && !(!o && !a)) {
|
|
2527
|
+
if (o && o === this.defaultCountry) {
|
|
2528
|
+
var u = new g(this.metadata.metadata);
|
|
2529
|
+
u.selectNumberingPlan(o);
|
|
2530
|
+
var l = u.numberingPlan.callingCode(), f = this.metadata.getCountryCodesForCallingCode(l);
|
|
2531
|
+
if (f.length > 1) {
|
|
2532
|
+
var s = $t(n, {
|
|
2533
|
+
countries: f,
|
|
2534
|
+
metadata: this.metadata.metadata
|
|
2535
|
+
});
|
|
2536
|
+
s && (o = s);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
var h = new Gt(o || a, n, this.metadata.metadata);
|
|
2540
|
+
return i && (h.carrierCode = i), h;
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Returns `true` if the phone number is "possible".
|
|
2545
|
+
* Is just a shortcut for `PhoneNumber.isPossible()`.
|
|
2546
|
+
* @return {boolean}
|
|
2547
|
+
*/
|
|
2548
|
+
}, {
|
|
2549
|
+
key: "isPossible",
|
|
2550
|
+
value: function() {
|
|
2551
|
+
var e = this.getNumber();
|
|
2552
|
+
return e ? e.isPossible() : !1;
|
|
2553
|
+
}
|
|
2554
|
+
/**
|
|
2555
|
+
* Returns `true` if the phone number is "valid".
|
|
2556
|
+
* Is just a shortcut for `PhoneNumber.isValid()`.
|
|
2557
|
+
* @return {boolean}
|
|
2558
|
+
*/
|
|
2559
|
+
}, {
|
|
2560
|
+
key: "isValid",
|
|
2561
|
+
value: function() {
|
|
2562
|
+
var e = this.getNumber();
|
|
2563
|
+
return e ? e.isValid() : !1;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* @deprecated
|
|
2567
|
+
* This method is used in `react-phone-number-input/source/input-control.js`
|
|
2568
|
+
* in versions before `3.0.16`.
|
|
2569
|
+
*/
|
|
2570
|
+
}, {
|
|
2571
|
+
key: "getNationalNumber",
|
|
2572
|
+
value: function() {
|
|
2573
|
+
return this.state.nationalSignificantNumber;
|
|
2574
|
+
}
|
|
2575
|
+
/**
|
|
2576
|
+
* Returns the phone number characters entered by the user.
|
|
2577
|
+
* @return {string}
|
|
2578
|
+
*/
|
|
2579
|
+
}, {
|
|
2580
|
+
key: "getChars",
|
|
2581
|
+
value: function() {
|
|
2582
|
+
return (this.state.international ? "+" : "") + this.state.digits;
|
|
2583
|
+
}
|
|
2584
|
+
/**
|
|
2585
|
+
* Returns the template for the formatted phone number.
|
|
2586
|
+
* @return {string}
|
|
2587
|
+
*/
|
|
2588
|
+
}, {
|
|
2589
|
+
key: "getTemplate",
|
|
2590
|
+
value: function() {
|
|
2591
|
+
return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || "";
|
|
2592
|
+
}
|
|
2593
|
+
}]);
|
|
2594
|
+
})();
|
|
2595
|
+
function si() {
|
|
2596
|
+
return Zt(Wr, arguments);
|
|
2597
|
+
}
|
|
2598
|
+
function tt(t) {
|
|
2599
|
+
return Kt.call(this, t, Qt);
|
|
2600
|
+
}
|
|
2601
|
+
tt.prototype = Object.create(Kt.prototype, {});
|
|
2602
|
+
tt.prototype.constructor = tt;
|
|
2603
|
+
export {
|
|
2604
|
+
tt as A,
|
|
2605
|
+
Gt as P,
|
|
2606
|
+
si as p
|
|
2607
|
+
};
|