@rpcbase/ui 0.260.0 → 0.262.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/sha256.worker-BEf4_Y9w.js.map +1 -0
- package/dist/components/FilesUploadField/index.d.ts +19 -6
- package/dist/components/FilesUploadField/index.d.ts.map +1 -1
- package/dist/components/FilesUploadField/sha256.d.ts +5 -0
- package/dist/components/FilesUploadField/sha256.d.ts.map +1 -0
- package/dist/components/FilesUploadField/sha256.worker.d.ts +4 -0
- package/dist/components/FilesUploadField/sha256.worker.d.ts.map +1 -0
- package/dist/components/ImagesField/index.d.ts +4 -2
- package/dist/components/ImagesField/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index298.js +11 -803
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +865 -28
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +26 -510
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +481 -755
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +786 -7428
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +7429 -7
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +6 -12
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +12 -5
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +3 -3
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +5 -469
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +464 -32
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +36 -18
- package/dist/index309.js.map +1 -1
- package/dist/index310.js +17 -28
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +30 -4
- package/dist/index311.js.map +1 -1
- package/dist/index312.js +4 -59
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +59 -9
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +9 -5
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +5 -9
- package/dist/index315.js.map +1 -1
- package/dist/index316.js +9 -12
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +13 -3
- package/dist/index317.js.map +1 -1
- package/dist/index318.js +3 -17
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +14 -23
- package/dist/index319.js.map +1 -1
- package/dist/index320.js +23 -39
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +41 -5
- package/dist/index321.js.map +1 -1
- package/dist/index322.js +5 -25
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +24 -18
- package/dist/index323.js.map +1 -1
- package/dist/index324.js +17 -32
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +34 -5
- package/dist/index325.js.map +1 -1
- package/dist/index326.js +5 -9
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +8 -7
- package/dist/index327.js.map +1 -1
- package/dist/index328.js +8 -9
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +9 -10
- package/dist/index329.js.map +1 -1
- package/dist/index330.js +10 -7
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +7 -75
- package/dist/index331.js.map +1 -1
- package/dist/index332.js +66 -153
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +147 -99
- package/dist/index333.js.map +1 -1
- package/dist/index334.js +113 -13
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +12 -78
- package/dist/index335.js.map +1 -1
- package/dist/index336.js +57 -23
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +45 -12
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +13 -16
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +15 -100
- package/dist/index339.js.map +1 -1
- package/dist/index340.js +95 -50
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +5 -57
- package/dist/index341.js.map +1 -1
- package/dist/index342.js +78 -41
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +58 -100
- package/dist/index343.js.map +1 -1
- package/dist/index344.js +104 -46
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +51 -39
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +42 -142
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +123 -120
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +108 -224
- package/dist/index348.js.map +1 -1
- package/dist/index349.js +174 -158
- package/dist/index349.js.map +1 -1
- package/dist/index350.js +144 -213
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +309 -5
- package/dist/index351.js.map +1 -1
- package/dist/index352.js +5 -6
- package/dist/index352.js.map +1 -1
- package/dist/index353.js +6 -7
- package/dist/index353.js.map +1 -1
- package/dist/index354.js +5 -4
- package/dist/index354.js.map +1 -1
- package/dist/index355.js +4 -4
- package/dist/index355.js.map +1 -1
- package/dist/index356.js +6 -21
- package/dist/index356.js.map +1 -1
- package/dist/index357.js +21 -10
- package/dist/index357.js.map +1 -1
- package/dist/index358.js +10 -128
- package/dist/index358.js.map +1 -1
- package/dist/index359.js +122 -36
- package/dist/index359.js.map +1 -1
- package/dist/index360.js +38 -64
- package/dist/index360.js.map +1 -1
- package/dist/index361.js +66 -115
- package/dist/index361.js.map +1 -1
- package/dist/index362.js +112 -485
- package/dist/index362.js.map +1 -1
- package/dist/index363.js +490 -13
- package/dist/index363.js.map +1 -1
- package/dist/index364.js +13 -4
- package/dist/index364.js.map +1 -1
- package/dist/index365.js +4 -47
- package/dist/index365.js.map +1 -1
- package/dist/index366.js +44 -15
- package/dist/index366.js.map +1 -1
- package/dist/index367.js +19 -5
- package/dist/index367.js.map +1 -1
- package/dist/index368.js +5 -27
- package/dist/index368.js.map +1 -1
- package/dist/index369.js +27 -48
- package/dist/index369.js.map +1 -1
- package/dist/index370.js +46 -27
- package/dist/index370.js.map +1 -1
- package/dist/index371.js +27 -16
- package/dist/index371.js.map +1 -1
- package/dist/index372.js +16 -41
- package/dist/index372.js.map +1 -1
- package/dist/index373.js +42 -14
- package/dist/index373.js.map +1 -1
- package/dist/index374.js +14 -10
- package/dist/index374.js.map +1 -1
- package/dist/index375.js +9 -51
- package/dist/index375.js.map +1 -1
- package/dist/index376.js +53 -43
- package/dist/index376.js.map +1 -1
- package/dist/index377.js +43 -16
- package/dist/index377.js.map +1 -1
- package/dist/index378.js +15 -4
- package/dist/index378.js.map +1 -1
- package/dist/index379.js +4 -4
- package/dist/index379.js.map +1 -1
- package/dist/index380.js +4 -9
- package/dist/index380.js.map +1 -1
- package/dist/index381.js +9 -340
- package/dist/index381.js.map +1 -1
- package/dist/index382.js +339 -4
- package/dist/index382.js.map +1 -1
- package/dist/index383.js +5 -16
- package/dist/index383.js.map +1 -1
- package/dist/index384.js +16 -111
- package/dist/index384.js.map +1 -1
- package/dist/index385.js +109 -19
- package/dist/index385.js.map +1 -1
- package/dist/index386.js +18 -18
- package/dist/index386.js.map +1 -1
- package/dist/index387.js +21 -5
- package/dist/index387.js.map +1 -1
- package/dist/index388.js +5 -20
- package/dist/index388.js.map +1 -1
- package/dist/index389.js +19 -13
- package/dist/index389.js.map +1 -1
- package/dist/index390.js +13 -84
- package/dist/index390.js.map +1 -1
- package/dist/index391.js +84 -7
- package/dist/index391.js.map +1 -1
- package/dist/index392.js +9 -29
- package/dist/index392.js.map +1 -1
- package/dist/index393.js +28 -9
- package/dist/index393.js.map +1 -1
- package/dist/index394.js +9 -5
- package/dist/index394.js.map +1 -1
- package/dist/index395.js +6 -252
- package/dist/index395.js.map +1 -1
- package/dist/index396.js +250 -10
- package/dist/index396.js.map +1 -1
- package/dist/index397.js +11 -10
- package/dist/index397.js.map +1 -1
- package/dist/index398.js +10 -6
- package/dist/index398.js.map +1 -1
- package/dist/index399.js +6 -22
- package/dist/index399.js.map +1 -1
- package/dist/index400.js +21 -21
- package/dist/index400.js.map +1 -1
- package/dist/index401.js +21 -107
- package/dist/index401.js.map +1 -1
- package/dist/index402.js +109 -15
- package/dist/index402.js.map +1 -1
- package/dist/index403.js +15 -12
- package/dist/index403.js.map +1 -1
- package/dist/index404.js +10 -8
- package/dist/index404.js.map +1 -1
- package/dist/index405.js +8 -242
- package/dist/index405.js.map +1 -1
- package/dist/index406.js +238 -25
- package/dist/index406.js.map +1 -1
- package/dist/index407.js +29 -51
- package/dist/index407.js.map +1 -1
- package/dist/index408.js +51 -10
- package/dist/index408.js.map +1 -1
- package/dist/index409.js +11 -128
- package/dist/index409.js.map +1 -1
- package/dist/index410.js +124 -35
- package/dist/index410.js.map +1 -1
- package/dist/index411.js +36 -23
- package/dist/index411.js.map +1 -1
- package/dist/index412.js +26 -11
- package/dist/index412.js.map +1 -1
- package/dist/index413.js +11 -23
- package/dist/index413.js.map +1 -1
- package/dist/index414.js +19 -13
- package/dist/index414.js.map +1 -1
- package/dist/index415.js +14 -13
- package/dist/index415.js.map +1 -1
- package/dist/index416.js +14 -322
- package/dist/index416.js.map +1 -1
- package/dist/index417.js +323 -61
- package/dist/index417.js.map +1 -1
- package/dist/index418.js +63 -4
- package/dist/index418.js.map +1 -1
- package/dist/index419.js +4 -28
- package/dist/index419.js.map +1 -1
- package/dist/index420.js +25 -468
- package/dist/index420.js.map +1 -1
- package/dist/index421.js +452 -250
- package/dist/index421.js.map +1 -1
- package/dist/index422.js +272 -0
- package/dist/index422.js.map +1 -0
- package/package.json +2 -1
package/dist/index338.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index338.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index338.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js"],"sourcesContent":["// When phone numbers are written in `RFC3966` format — `\"tel:+12133734253\"` —\n// they can have their \"calling code\" part written separately in a `phone-context` parameter.\n// Example: `\"tel:12133734253;phone-context=+1\"`.\n// This function parses the full phone number from the local number and the `phone-context`\n// when the `phone-context` contains a `+` sign.\n\nimport { VALID_DIGITS\n// PLUS_CHARS\n} from '../constants.js';\nexport var PLUS_SIGN = '+';\nvar RFC3966_VISUAL_SEPARATOR_ = '[\\\\-\\\\.\\\\(\\\\)]?';\nvar RFC3966_PHONE_DIGIT_ = '(' + '[' + VALID_DIGITS + ']' + '|' + RFC3966_VISUAL_SEPARATOR_ + ')';\nvar RFC3966_GLOBAL_NUMBER_DIGITS_ = '^' + '\\\\' + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + '*' + '[' + VALID_DIGITS + ']' + RFC3966_PHONE_DIGIT_ + '*' + '$';\n\n/**\r\n * Regular expression of valid global-number-digits for the phone-context\r\n * parameter, following the syntax defined in RFC3966.\r\n */\nvar RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g');\n\n// In this port of Google's library, we don't accept alpha characters in phone numbers.\n// const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS\nvar ALPHANUM_ = VALID_DIGITS;\nvar RFC3966_DOMAINLABEL_ = '[' + ALPHANUM_ + ']+((\\\\-)*[' + ALPHANUM_ + '])*';\nvar VALID_ALPHA_ = 'a-zA-Z';\nvar RFC3966_TOPLABEL_ = '[' + VALID_ALPHA_ + ']+((\\\\-)*[' + ALPHANUM_ + '])*';\nvar RFC3966_DOMAINNAME_ = '^(' + RFC3966_DOMAINLABEL_ + '\\\\.)*' + RFC3966_TOPLABEL_ + '\\\\.?$';\n\n/**\r\n * Regular expression of valid domainname for the phone-context parameter,\r\n * following the syntax defined in RFC3966.\r\n */\nvar RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, 'g');\nexport var RFC3966_PREFIX_ = 'tel:';\nexport var RFC3966_PHONE_CONTEXT_ = ';phone-context=';\nexport var RFC3966_ISDN_SUBADDRESS_ = ';isub=';\n\n/**\r\n * Extracts the value of the phone-context parameter of `numberToExtractFrom`,\r\n * following the syntax defined in RFC3966.\r\n *\r\n * @param {string} numberToExtractFrom\r\n * @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.\r\n */\nexport default function extractPhoneContext(numberToExtractFrom) {\n var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_);\n // If no phone-context parameter is present\n if (indexOfPhoneContext < 0) {\n return null;\n }\n var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length;\n // If phone-context parameter is empty\n if (phoneContextStart >= numberToExtractFrom.length) {\n return '';\n }\n var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart);\n // If phone-context is not the last parameter\n if (phoneContextEnd >= 0) {\n return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);\n } else {\n return numberToExtractFrom.substring(phoneContextStart);\n }\n}\n\n/**\r\n * Returns whether the value of phoneContext follows the syntax defined in RFC3966.\r\n *\r\n * @param {string|null} phoneContext\r\n * @return {boolean}\r\n */\nexport function isPhoneContextValid(phoneContext) {\n if (phoneContext === null) {\n return true;\n }\n if (phoneContext.length === 0) {\n return false;\n }\n\n // Does phone-context value match pattern of global-number-digits or domainname.\n return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);\n}\n//# sourceMappingURL=extractPhoneContext.js.map"],"x_google_ignoreList":[0],"mappings":";AAWA,IAAI,IAAuB,OAAY,IAAe,sBAClD,IAAgC,SAAyB,IAAuB,OAAY,IAAe,MAAM,IAAuB,MAMxI,IAAwC,IAAI,OAAO,GAA+B,GAAG,GAIrF,IAAY,GACZ,IAAuB,MAAM,IAAY,eAAe,IAAY,OAEpE,IAAoB,sBAAoC,IAAY,OACpE,IAAsB,OAAO,IAAuB,UAAU,IAAoB,SAMlF,IAA8B,IAAI,OAAO,GAAqB,GAAG,GAC1D,IAAkB,QAClB,IAAyB,mBACzB,IAA2B;AAStC,SAAwB,EAAoB,GAAqB;CAC/D,IAAI,IAAsB,EAAoB,QAAQ,CAAsB;CAE5E,IAAI,IAAsB,GACxB,OAAO;CAET,IAAI,IAAoB,IAAsB,EAAuB;CAErE,IAAI,KAAqB,EAAoB,QAC3C,OAAO;CAET,IAAI,IAAkB,EAAoB,QAAQ,KAAK,CAAiB;CAKtE,OAHE,KAAmB,IACd,EAAoB,UAAU,GAAmB,CAAe,IAEhE,EAAoB,UAAU,CAAiB;AAE1D;AAQA,SAAgB,EAAoB,GAAc;CAShD,OARI,MAAiB,OACZ,KAEL,EAAa,WAAW,IACnB,KAIF,EAAsC,KAAK,CAAY,KAAK,EAA4B,KAAK,CAAY;AAClH"}
|
package/dist/index339.js
CHANGED
|
@@ -1,105 +1,20 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import m from "./index338.js";
|
|
14
|
-
//#region ../../node_modules/libphonenumber-js/es6/parse.js
|
|
15
|
-
var h = 250, g = RegExp("[" + r + i + "]"), _ = RegExp("[^" + i + "#]+$");
|
|
16
|
-
function v(r, i, a) {
|
|
17
|
-
i ||= {};
|
|
18
|
-
var o = new e(a);
|
|
19
|
-
if (i.defaultCountry && !o.hasCountry(i.defaultCountry)) throw i.v2 ? new d("INVALID_COUNTRY") : Error(`Unknown country: ${i.defaultCountry}`);
|
|
20
|
-
var s = b(r, i.v2, i.extract), c = s.number, l = s.ext, f = s.error;
|
|
21
|
-
if (!c) {
|
|
22
|
-
if (i.v2) throw f === "TOO_SHORT" ? new d("TOO_SHORT") : new d("NOT_A_NUMBER");
|
|
23
|
-
return {};
|
|
1
|
+
import e from "./index334.js";
|
|
2
|
+
import t, { RFC3966_ISDN_SUBADDRESS_ as n, RFC3966_PHONE_CONTEXT_ as r, RFC3966_PREFIX_ as i, isPhoneContextValid as a } from "./index338.js";
|
|
3
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js
|
|
4
|
+
function o(o, s) {
|
|
5
|
+
var c = s.extractFormattedPhoneNumber, l = t(o);
|
|
6
|
+
if (!a(l)) throw new e("NOT_A_NUMBER");
|
|
7
|
+
var u;
|
|
8
|
+
if (l === null) u = c(o) || "";
|
|
9
|
+
else {
|
|
10
|
+
u = "", l.charAt(0) === "+" && (u += l);
|
|
11
|
+
var d = o.indexOf(i), f = d >= 0 ? d + i.length : 0, p = o.indexOf(r);
|
|
12
|
+
u += o.substring(f, p);
|
|
24
13
|
}
|
|
25
|
-
var
|
|
26
|
-
if (
|
|
27
|
-
if (i.v2) throw new d("INVALID_COUNTRY");
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
if (!h || h.length < 2) {
|
|
31
|
-
/* istanbul ignore if */
|
|
32
|
-
if (i.v2) throw new d("TOO_SHORT");
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
if (h.length > 17) {
|
|
36
|
-
if (i.v2) throw new d("TOO_LONG");
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
if (i.v2) {
|
|
40
|
-
var y = new u(g, h, o.metadata);
|
|
41
|
-
return m && (y.country = m), v && (y.carrierCode = v), l && (y.ext = l), y.__countryCallingCodeSource = _, y;
|
|
42
|
-
}
|
|
43
|
-
var C = (i.extended ? o.hasSelectedNumberingPlan() : m) ? n(h, o.nationalNumberPattern()) : !1;
|
|
44
|
-
return i.extended ? {
|
|
45
|
-
country: m,
|
|
46
|
-
countryCallingCode: g,
|
|
47
|
-
carrierCode: v,
|
|
48
|
-
valid: C,
|
|
49
|
-
possible: C ? !0 : !!(i.extended === !0 && o.possibleLengths() && t(h, o)),
|
|
50
|
-
phone: h,
|
|
51
|
-
ext: l
|
|
52
|
-
} : C ? x(m, h, l) : {};
|
|
53
|
-
}
|
|
54
|
-
function y(e, t, n) {
|
|
55
|
-
if (e) {
|
|
56
|
-
if (e.length > h) {
|
|
57
|
-
if (n) throw new d("TOO_LONG");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (t === !1) return e;
|
|
61
|
-
var r = e.search(g);
|
|
62
|
-
if (!(r < 0)) return e.slice(r).replace(_, "");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function b(e, t, n) {
|
|
66
|
-
var r = m(e, { extractFormattedPhoneNumber: function(e) {
|
|
67
|
-
return y(e, n, t);
|
|
68
|
-
} });
|
|
69
|
-
if (!r) return {};
|
|
70
|
-
if (!c(r)) return l(r) ? { error: "TOO_SHORT" } : {};
|
|
71
|
-
var i = f(r);
|
|
72
|
-
return i.ext ? i : { number: r };
|
|
73
|
-
}
|
|
74
|
-
function x(e, t, n) {
|
|
75
|
-
var r = {
|
|
76
|
-
country: e,
|
|
77
|
-
phone: t
|
|
78
|
-
};
|
|
79
|
-
return n && (r.ext = n), r;
|
|
80
|
-
}
|
|
81
|
-
function S(e, t, n, r) {
|
|
82
|
-
var i = s(p(e), void 0, t, n, r.metadata), c = i.countryCallingCodeSource, l = i.countryCallingCode, u = i.number, d;
|
|
83
|
-
if (l) r.selectNumberingPlan(l);
|
|
84
|
-
else if (u && (t || n)) t ? (d = t, r.selectNumberingPlan(t), l = r.numberingPlan.callingCode()) : (r.selectNumberingPlan(n), l = n);
|
|
85
|
-
else return {};
|
|
86
|
-
if (!u) return {
|
|
87
|
-
countryCallingCodeSource: c,
|
|
88
|
-
countryCallingCode: l
|
|
89
|
-
};
|
|
90
|
-
var f = o(p(u), void 0, r), m = f.nationalNumber, h = f.carrierCode, g = a(l, {
|
|
91
|
-
nationalNumber: m,
|
|
92
|
-
metadata: r
|
|
93
|
-
});
|
|
94
|
-
return g && (d = g, g === "001" || r.selectNumberingPlan(d)), {
|
|
95
|
-
country: d,
|
|
96
|
-
countryCallingCode: l,
|
|
97
|
-
countryCallingCodeSource: c,
|
|
98
|
-
nationalNumber: m,
|
|
99
|
-
carrierCode: h
|
|
100
|
-
};
|
|
14
|
+
var m = u.indexOf(n);
|
|
15
|
+
if (m > 0 && (u = u.substring(0, m)), u !== "") return u;
|
|
101
16
|
}
|
|
102
17
|
//#endregion
|
|
103
|
-
export {
|
|
18
|
+
export { o as default };
|
|
104
19
|
|
|
105
20
|
//# sourceMappingURL=index339.js.map
|
package/dist/index339.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index339.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/parse.js"],"sourcesContent":["// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport { VALID_DIGITS, PLUS_CHARS, MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN } from './constants.js';\nimport ParseError from './ParseError.js';\nimport Metadata from './metadata.js';\nimport isViablePhoneNumber, { isViablePhoneNumberStart } from './helpers/isViablePhoneNumber.js';\nimport extractExtension from './helpers/extension/extractExtension.js';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber.js';\nimport getCountryCallingCode from './getCountryCallingCode.js';\nimport { isPossibleNumber } from './isPossible.js';\n// import { parseRFC3966 } from './helpers/RFC3966.js'\nimport PhoneNumber from './PhoneNumber.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js';\nimport extractNationalNumber from './helpers/extractNationalNumber.js';\n// import stripIddPrefix from './helpers/stripIddPrefix.js'\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js';\nimport extractFormattedPhoneNumberFromPossibleRfc3966NumberUri from './helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js';\n\n// We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\nvar MAX_INPUT_STRING_LENGTH = 250;\n\n// This consists of the plus symbol, digits, and arabic-indic digits.\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']');\n\n// Regular expression of trailing characters that we want to remove.\n// A trailing `#` is sometimes used when writing phone numbers with extensions in US.\n// Example: \"+1 (645) 123 1234-910#\" number has extension \"910\".\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\n// Examples:\n//\n// ```js\n// parse('8 (800) 555-35-35', 'RU')\n// parse('8 (800) 555-35-35', 'RU', metadata)\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n// parse('+7 800 555 35 35')\n// parse('+7 800 555 35 35', metadata)\n// ```\n//\n\n/**\r\n * Parses a phone number.\r\n *\r\n * parse('123456789', { defaultCountry: 'RU', v2: true }, metadata)\r\n * parse('123456789', { defaultCountry: 'RU' }, metadata)\r\n * parse('123456789', undefined, metadata)\r\n *\r\n * @param {string} input\r\n * @param {object} [options]\r\n * @param {object} metadataJson\r\n * @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed).\r\n */\nexport default function parse(text, options, metadataJson) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n var metadata = new Metadata(metadataJson);\n\n // Validate `defaultCountry`.\n if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n throw new Error(\"Unknown country: \".concat(options.defaultCountry));\n }\n\n // Parse the phone number.\n var _parseInput = parseInput(text, options.v2, options.extract),\n formattedPhoneNumber = _parseInput.number,\n ext = _parseInput.ext,\n error = _parseInput.error;\n\n // If the phone number is not viable then return nothing.\n if (!formattedPhoneNumber) {\n if (options.v2) {\n if (error === 'TOO_SHORT') {\n throw new ParseError('TOO_SHORT');\n }\n throw new ParseError('NOT_A_NUMBER');\n }\n return {};\n }\n var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode,\n // If `country` is returned, its numbering plan will also be selected in `metadata`.\n // Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`.\n // Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.\n metadata),\n country = _parsePhoneNumber.country,\n nationalNumber = _parsePhoneNumber.nationalNumber,\n countryCallingCode = _parsePhoneNumber.countryCallingCode,\n countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource,\n carrierCode = _parsePhoneNumber.carrierCode;\n if (!metadata.hasSelectedNumberingPlan()) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n return {};\n }\n\n // Validate national (significant) number length.\n if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {\n // Won't throw here because the regexp already demands length > 1.\n /* istanbul ignore if */\n if (options.v2) {\n throw new ParseError('TOO_SHORT');\n }\n // Google's demo just throws an error in this case.\n return {};\n }\n\n // Validate national (significant) number length.\n //\n // A sidenote:\n //\n // They say that sometimes national (significant) numbers\n // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n // Such numbers will just be discarded.\n //\n if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {\n if (options.v2) {\n throw new ParseError('TOO_LONG');\n }\n // Google's demo just throws an error in this case.\n return {};\n }\n if (options.v2) {\n var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);\n if (country) {\n phoneNumber.country = country;\n }\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n }\n if (ext) {\n phoneNumber.ext = ext;\n }\n phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;\n return phoneNumber;\n }\n\n // Check if national phone number pattern matches the number.\n // National number pattern is different for each country,\n // even for those ones which are part of the \"NANPA\" group.\n var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;\n if (!options.extended) {\n return valid ? result(country, nationalNumber, ext) : {};\n }\n\n // isInternational: countryCallingCode !== undefined\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n carrierCode: carrierCode,\n valid: valid,\n possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,\n phone: nationalNumber,\n ext: ext\n };\n}\n\n/**\r\n * Extracts a formatted phone number from text.\r\n * Doesn't guarantee that the extracted phone number\r\n * is a valid phone number (for example, doesn't validate its length).\r\n * @param {string} text\r\n * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.\r\n * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.\r\n * @return {string}\r\n * @example\r\n * // Returns \"(213) 373-4253\".\r\n * extractFormattedPhoneNumber(\"Call (213) 373-4253 for assistance.\")\r\n */\nfunction _extractFormattedPhoneNumber(text, extract, throwOnError) {\n if (!text) {\n return;\n }\n if (text.length > MAX_INPUT_STRING_LENGTH) {\n if (throwOnError) {\n throw new ParseError('TOO_LONG');\n }\n return;\n }\n if (extract === false) {\n return text;\n }\n // Attempt to extract a possible number from the string passed in\n var startsAt = text.search(PHONE_NUMBER_START_PATTERN);\n if (startsAt < 0) {\n return;\n }\n return text\n // Trim everything to the left of the phone number\n .slice(startsAt)\n // Remove trailing non-numerical characters\n .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n\n/**\r\n * @param {string} text - Input.\r\n * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.\r\n * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\nfunction parseInput(text, v2, extract) {\n // // Parse RFC 3966 phone number URI.\n // if (text && text.indexOf('tel:') === 0) {\n // \treturn parseRFC3966(text)\n // }\n // let number = extractFormattedPhoneNumber(text, extract, v2)\n var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, {\n extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text) {\n return _extractFormattedPhoneNumber(text, extract, v2);\n }\n });\n // If the phone number is not viable, then abort.\n if (!number) {\n return {};\n }\n if (!isViablePhoneNumber(number)) {\n if (isViablePhoneNumberStart(number)) {\n return {\n error: 'TOO_SHORT'\n };\n }\n return {};\n }\n // Attempt to parse extension first, since it doesn't require region-specific\n // data and we want to have the non-normalised number here.\n var withExtensionStripped = extractExtension(number);\n if (withExtensionStripped.ext) {\n return withExtensionStripped;\n }\n return {\n number: number\n };\n}\n\n/**\r\n * Creates `parse()` result object.\r\n */\nfunction result(country, nationalNumber, ext) {\n var result = {\n country: country,\n phone: nationalNumber\n };\n if (ext) {\n result.ext = ext;\n }\n return result;\n}\n\n/**\r\n * Parses a viable phone number.\r\n * @param {string} formattedPhoneNumber — Example: \"(213) 373-4253\".\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {Metadata} metadata — Metadata instance with no pre-selected numbering plan. If `country` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.\r\n * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.\r\n */\nfunction parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {\n // Attempt to extract a calling code from a phone number.\n // * If the phone number is found to be \"international\":\n // * It will attempt to identify the calling code part of it and whether that part is complete and valid.\n // * If the calling code part is complete and valid, it will return two properties:\n // that calling code part (without `+`) and the rest of the digits.\n // * Otherwise, i.e. if the calling code part is incomplete or invalid,\n // it will return an empty object.\n // * Otherwise, i.e. if the phone number is national, there's no callind code to extract\n // so it will just return the originally-passed `number` string as the only property.\n var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), undefined,\n // `defaultCountry` and `defaultCallingCode` are only used to detect\n // if it's an \"international\" phone number or not. They won't be used\n // to derive the resulting `countryCallingCode` from them, or anything like that.\n defaultCountry, defaultCallingCode, metadata.metadata),\n countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource,\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n // The exact country of the phone number\n var country;\n\n // If `formattedPhoneNumber` is passed in \"international\" format,\n // choose a country by `countryCallingCode`.\n if (countryCallingCode) {\n metadata.selectNumberingPlan(countryCallingCode);\n }\n // Else, if `formattedPhoneNumber` is passed in \"national\" format,\n // then `number` is defined and `countryCallingCode` is `undefined`.\n else if (number && (defaultCountry || defaultCallingCode)) {\n if (defaultCountry) {\n country = defaultCountry;\n metadata.selectNumberingPlan(defaultCountry);\n countryCallingCode = metadata.numberingPlan.callingCode();\n } else {\n metadata.selectNumberingPlan(defaultCallingCode);\n countryCallingCode = defaultCallingCode;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(countryCallingCode)) {\n country = '001';\n }\n }\n }\n } else return {};\n\n // At this point, `country` could be `undefined` but `countryCallingCode` is always defined.\n //\n // Also, if `country` is defined, its numbering plan is selected in `metadata`.\n // Otherwise, the numering plan for the `countryCallingCode` is selected in `metadata`.\n\n if (!number) {\n return {\n countryCallingCodeSource: countryCallingCodeSource,\n countryCallingCode: countryCallingCode\n };\n }\n var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), undefined, metadata),\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode;\n\n // Sometimes there are several countries\n // corresponding to the same country phone code\n // (e.g. NANPA countries all having `1` country phone code).\n // Therefore, to reliably determine the exact country,\n // national (significant) number should have been parsed first.\n //\n // When `metadata.json` is generated, all \"ambiguous\" country phone codes\n // get their countries populated with the full set of\n // \"phone number type\" regular expressions.\n //\n var exactCountry = getCountryByCallingCode(countryCallingCode, {\n nationalNumber: nationalNumber,\n metadata: metadata\n });\n if (exactCountry) {\n country = exactCountry;\n /* istanbul ignore if */\n if (exactCountry === '001') {\n // Can't happen with `USE_NON_GEOGRAPHIC_COUNTRY_CODE` being `false`.\n // If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` is set to `true` for some reason,\n // then remove the \"istanbul ignore if\".\n } else {\n metadata.selectNumberingPlan(country);\n }\n }\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n countryCallingCodeSource: countryCallingCodeSource,\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n//# sourceMappingURL=parse.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;AAwBA,IAAI,IAA0B,KAG1B,IAAiC,OAAO,MAAM,IAAa,IAAe,GAAG,GAK7E,IAAqC,OAAO,OAAO,IAAe,MAAW;AA2BjF,SAAwB,EAAM,GAAM,GAAS,GAAc;CAGzD,MAAqB,CAAC;CACtB,IAAI,IAAW,IAAI,EAAS,CAAY;CAGxC,IAAI,EAAQ,kBAAkB,CAAC,EAAS,WAAW,EAAQ,cAAc,GAIvE,MAHI,EAAQ,KACJ,IAAI,EAAW,iBAAiB,IAE9B,MAAM,oBAA2B,EAAQ,gBAAe;CAIpE,IAAI,IAAc,EAAW,GAAM,EAAQ,IAAI,EAAQ,OAAO,GAC5D,IAAuB,EAAY,QACnC,IAAM,EAAY,KAClB,IAAQ,EAAY;CAGtB,IAAI,CAAC,GAAsB;EACzB,IAAI,EAAQ,IAIV,MAHI,MAAU,cACN,IAAI,EAAW,WAAW,IAE5B,IAAI,EAAW,cAAc;EAErC,OAAO,CAAC;CACV;CACA,IAAI,IAAoB,EAAiB,GAAsB,EAAQ,gBAAgB,EAAQ,oBAI7F,CAAQ,GACR,IAAU,EAAkB,SAC5B,IAAiB,EAAkB,gBACnC,IAAqB,EAAkB,oBACvC,IAA2B,EAAkB,0BAC7C,IAAc,EAAkB;CAClC,IAAI,CAAC,EAAS,yBAAyB,GAAG;EACxC,IAAI,EAAQ,IACV,MAAM,IAAI,EAAW,iBAAiB;EAExC,OAAO,CAAC;CACV;CAGA,IAAI,CAAC,KAAkB,EAAe,SAAA,GAA6B;;EAGjE,IAAI,EA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I,IAAwB,EAAiB,CAAM;CAInD,OAHI,EAAsB,MACjB,IAEF,EACG,UACV;AACF;AAKA,SAAS,EAAO,GAAS,GAAgB,GAAK;CAC5C,IAAI,IAAS;EACF;EACT,OAAO;CACT;CAIA,OAHI,MACF,EAAO,MAAM,IAER;AACT;AAUA,SAAS,EAAiB,GAAsB,GAAgB,GAAoB,GAAU;CAU5F,IAAI,IAAwB,EAA0B,EAA2B,CAAoB,GAAG,KAAA,GAItG,GAAgB,GAAoB,EAAS,QAAQ,GACrD,IAA2B,EAAsB,0BACjD,IAAqB,EAAsB,oBAC3C,IAAS,EAAsB,QAG7B;CAIJ,IAAI,GACF,EAAS,oBAAoB,CAAkB;MAI5C,IAAI,MAAW,KAAkB,IACpC,AAAI,KACF,IAAU,GACV,EAAS,oBAAoB,CAAc,GAC3C,IAAqB,EAAS,cAAc,YAAY,MAExD,EAAS,oBAAoB,CAAkB,GAC/C,IAAqB;MAQlB,OAAO,CAAC;CAOf,IAAI,CAAC,GACH,OAAO;EACqB;EACN;CACtB;CAEF,IAAI,IAAwB,EAAsB,EAA2B,CAAM,GAAG,KAAA,GAAW,CAAQ,GACvG,IAAiB,EAAsB,gBACvC,IAAc,EAAsB,aAYlC,IAAe,EAAwB,GAAoB;EAC7C;EACN;CACZ,CAAC;CAYD,OAXI,MACF,IAAU,GAEN,MAAiB,SAKnB,EAAS,oBAAoB,CAAO,IAGjC;EACI;EACW;EACM;EACV;EACH;CACf;AACF"}
|
|
1
|
+
{"version":3,"file":"index339.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js"],"sourcesContent":["import extractPhoneContext, { isPhoneContextValid, PLUS_SIGN, RFC3966_PREFIX_, RFC3966_PHONE_CONTEXT_, RFC3966_ISDN_SUBADDRESS_ } from './extractPhoneContext.js';\nimport ParseError from '../ParseError.js';\n\n/**\r\n * @param {string} numberToParse\r\n * @param {string} nationalNumber\r\n * @return {}\r\n */\nexport default function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {\n var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;\n var phoneContext = extractPhoneContext(numberToParse);\n if (!isPhoneContextValid(phoneContext)) {\n throw new ParseError('NOT_A_NUMBER');\n }\n var phoneNumberString;\n if (phoneContext === null) {\n // Extract a possible number from the string passed in.\n // (this strips leading characters that could not be the start of a phone number)\n phoneNumberString = extractFormattedPhoneNumber(numberToParse) || '';\n } else {\n phoneNumberString = '';\n\n // If the phone context contains a phone number prefix, we need to capture\n // it, whereas domains will be ignored.\n if (phoneContext.charAt(0) === PLUS_SIGN) {\n phoneNumberString += phoneContext;\n }\n\n // Now append everything between the \"tel:\" prefix and the phone-context.\n // This should include the national number, an optional extension or\n // isdn-subaddress component. Note we also handle the case when \"tel:\" is\n // missing, as we have seen in some of the phone number inputs.\n // In that case, we append everything from the beginning.\n var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);\n var indexOfNationalNumber;\n // RFC 3966 \"tel:\" prefix is preset at this stage because\n // `isPhoneContextValid()` requires it to be present.\n /* istanbul ignore else */\n if (indexOfRfc3966Prefix >= 0) {\n indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;\n } else {\n indexOfNationalNumber = 0;\n }\n var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);\n phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);\n }\n\n // Delete the isdn-subaddress and everything after it if it is present.\n // Note extension won't appear at the same time with isdn-subaddress\n // according to paragraph 5.3 of the RFC3966 spec.\n var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);\n if (indexOfIsdn > 0) {\n phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);\n }\n // If both phone context and isdn-subaddress are absent but other\n // parameters are present, the parameters are left in nationalNumber.\n // This is because we are concerned about deleting content from a potential\n // number string when there is no strong evidence that the number is\n // actually written in RFC3966.\n\n if (phoneNumberString !== '') {\n return phoneNumberString;\n }\n}\n//# sourceMappingURL=extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js.map"],"x_google_ignoreList":[0],"mappings":";;;AAQA,SAAwB,EAAwD,GAAe,GAAM;CACnG,IAAI,IAA8B,EAAK,6BACnC,IAAe,EAAoB,CAAa;CACpD,IAAI,CAAC,EAAoB,CAAY,GACnC,MAAM,IAAI,EAAW,cAAc;CAErC,IAAI;CACJ,IAAI,MAAiB,MAGnB,IAAoB,EAA4B,CAAa,KAAK;MAC7D;EAKL,AAJA,IAAoB,IAIhB,EAAa,OAAO,CAAC,MAAA,QACvB,KAAqB;EAQvB,IAAI,IAAuB,EAAc,QAAQ,CAAe,GAC5D,IAIA,KAAwB,IACF,IAAuB,EAAgB,SAEvC,GAEtB,IAAsB,EAAc,QAAQ,CAAsB;EACtE,KAAqB,EAAc,UAAU,GAAuB,CAAmB;CACzF;CAKA,IAAI,IAAc,EAAkB,QAAQ,CAAwB;CAUpE,IATI,IAAc,MAChB,IAAoB,EAAkB,UAAU,GAAG,CAAW,IAQ5D,MAAsB,IACxB,OAAO;AAEX"}
|
package/dist/index340.js
CHANGED
|
@@ -1,60 +1,105 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import e from "./index308.js";
|
|
2
|
+
import { isPossibleNumber as t } from "./index311.js";
|
|
3
|
+
import n from "./index312.js";
|
|
4
|
+
import { PLUS_CHARS as r, VALID_DIGITS as i } from "./index318.js";
|
|
5
|
+
import a from "./index322.js";
|
|
6
|
+
import o from "./index323.js";
|
|
7
|
+
import s from "./index325.js";
|
|
8
|
+
import c, { isViablePhoneNumberStart as l } from "./index330.js";
|
|
9
|
+
import u from "./index333.js";
|
|
10
|
+
import d from "./index334.js";
|
|
11
|
+
import f from "./index335.js";
|
|
12
|
+
import p from "./index337.js";
|
|
13
|
+
import m from "./index339.js";
|
|
14
|
+
//#region ../../node_modules/libphonenumber-js/es6/parse.js
|
|
15
|
+
var h = 250, g = RegExp("[" + r + i + "]"), _ = RegExp("[^" + i + "#]+$");
|
|
16
|
+
function v(r, i, a) {
|
|
17
|
+
i ||= {};
|
|
18
|
+
var o = new e(a);
|
|
19
|
+
if (i.defaultCountry && !o.hasCountry(i.defaultCountry)) throw i.v2 ? new d("INVALID_COUNTRY") : Error(`Unknown country: ${i.defaultCountry}`);
|
|
20
|
+
var s = b(r, i.v2, i.extract), c = s.number, l = s.ext, f = s.error;
|
|
21
|
+
if (!c) {
|
|
22
|
+
if (i.v2) throw f === "TOO_SHORT" ? new d("TOO_SHORT") : new d("NOT_A_NUMBER");
|
|
23
|
+
return {};
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
var p = S(c, i.defaultCountry, i.defaultCallingCode, o), m = p.country, h = p.nationalNumber, g = p.countryCallingCode, _ = p.countryCallingCodeSource, v = p.carrierCode;
|
|
26
|
+
if (!o.hasSelectedNumberingPlan()) {
|
|
27
|
+
if (i.v2) throw new d("INVALID_COUNTRY");
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
if (!h || h.length < 2) {
|
|
31
|
+
/* istanbul ignore if */
|
|
32
|
+
if (i.v2) throw new d("TOO_SHORT");
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
if (h.length > 17) {
|
|
36
|
+
if (i.v2) throw new d("TOO_LONG");
|
|
37
|
+
return {};
|
|
29
38
|
}
|
|
30
|
-
|
|
39
|
+
if (i.v2) {
|
|
40
|
+
var y = new u(g, h, o.metadata);
|
|
41
|
+
return m && (y.country = m), v && (y.carrierCode = v), l && (y.ext = l), y.__countryCallingCodeSource = _, y;
|
|
42
|
+
}
|
|
43
|
+
var C = (i.extended ? o.hasSelectedNumberingPlan() : m) ? n(h, o.nationalNumberPattern()) : !1;
|
|
44
|
+
return i.extended ? {
|
|
45
|
+
country: m,
|
|
46
|
+
countryCallingCode: g,
|
|
47
|
+
carrierCode: v,
|
|
48
|
+
valid: C,
|
|
49
|
+
possible: C ? !0 : !!(i.extended === !0 && o.possibleLengths() && t(h, o)),
|
|
50
|
+
phone: h,
|
|
51
|
+
ext: l
|
|
52
|
+
} : C ? x(m, h, l) : {};
|
|
31
53
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
function y(e, t, n) {
|
|
55
|
+
if (e) {
|
|
56
|
+
if (e.length > h) {
|
|
57
|
+
if (n) throw new d("TOO_LONG");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (t === !1) return e;
|
|
61
|
+
var r = e.search(g);
|
|
62
|
+
if (!(r < 0)) return e.slice(r).replace(_, "");
|
|
63
|
+
}
|
|
39
64
|
}
|
|
40
|
-
function
|
|
41
|
-
var
|
|
42
|
-
|
|
65
|
+
function b(e, t, n) {
|
|
66
|
+
var r = m(e, { extractFormattedPhoneNumber: function(e) {
|
|
67
|
+
return y(e, n, t);
|
|
68
|
+
} });
|
|
69
|
+
if (!r) return {};
|
|
70
|
+
if (!c(r)) return l(r) ? { error: "TOO_SHORT" } : {};
|
|
71
|
+
var i = f(r);
|
|
72
|
+
return i.ext ? i : { number: r };
|
|
43
73
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
51
|
-
}
|
|
52
|
-
return (n === "string" ? String : Number)(e);
|
|
74
|
+
function x(e, t, n) {
|
|
75
|
+
var r = {
|
|
76
|
+
country: e,
|
|
77
|
+
phone: t
|
|
78
|
+
};
|
|
79
|
+
return n && (r.ext = n), r;
|
|
53
80
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
81
|
+
function S(e, t, n, r) {
|
|
82
|
+
var i = s(p(e), void 0, t, n, r.metadata), c = i.countryCallingCodeSource, l = i.countryCallingCode, u = i.number, d;
|
|
83
|
+
if (l) r.selectNumberingPlan(l);
|
|
84
|
+
else if (u && (t || n)) t ? (d = t, r.selectNumberingPlan(t), l = r.numberingPlan.callingCode()) : (r.selectNumberingPlan(n), l = n);
|
|
85
|
+
else return {};
|
|
86
|
+
if (!u) return {
|
|
87
|
+
countryCallingCodeSource: c,
|
|
88
|
+
countryCallingCode: l
|
|
89
|
+
};
|
|
90
|
+
var f = o(p(u), void 0, r), m = f.nationalNumber, h = f.carrierCode, g = a(l, {
|
|
91
|
+
nationalNumber: m,
|
|
92
|
+
metadata: r
|
|
93
|
+
});
|
|
94
|
+
return g && (d = g, g === "001" || r.selectNumberingPlan(d)), {
|
|
95
|
+
country: d,
|
|
96
|
+
countryCallingCode: l,
|
|
97
|
+
countryCallingCodeSource: c,
|
|
98
|
+
nationalNumber: m,
|
|
99
|
+
carrierCode: h
|
|
100
|
+
};
|
|
56
101
|
}
|
|
57
102
|
//#endregion
|
|
58
|
-
export {
|
|
103
|
+
export { v as default };
|
|
59
104
|
|
|
60
105
|
//# sourceMappingURL=index340.js.map
|
package/dist/index340.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index340.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js"],"sourcesContent":["function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport parse from './parse.js';\nexport default function parsePhoneNumberWithError(text, options, metadata) {\n return parse(text, _objectSpread(_objectSpread({}, options), {}, {\n v2: true\n }), metadata);\n}\n//# sourceMappingURL=parsePhoneNumberWithError_.js.map"],"x_google_ignoreList":[0],"mappings":";;AAAA,SAAS,EAAQ,GAAG;CAAE;CAA2B,OAAO,IAAwB,OAAO,UAArB,cAA2C,OAAO,OAAO,YAA1B,WAAqC,SAAU,GAAG;EAAE,OAAO,OAAO;CAAG,IAAI,SAAU,GAAG;EAAE,OAAO,KAAmB,OAAO,UAArB,cAA+B,EAAE,gBAAgB,UAAU,MAAM,OAAO,YAAY,WAAW,OAAO;CAAG,GAAG,EAAQ,CAAC;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G,IAAI,IAAI,EAAE,OAAO;CAAc,IAAe,MAAX,KAAK,GAAS;EAAE,IAAI,IAAI,EAAE,KAAK,GAAG,KAAK,SAAS;EAAG,IAAgB,EAAQ,CAAC,KAArB,UAAwB,OAAO;EAAG,MAAU,UAAU,8CAA8C;CAAG;CAAE,QAAqB,MAAb,WAAiB,SAAS,OAAA,CAAQ,CAAC;AAAG;AAE3T,SAAwB,EAA0B,GAAM,GAAS,GAAU;CACzE,OAAO,EAAM,GAAM,EAAc,EAAc,CAAC,GAAG,CAAO,GAAG,CAAC,GAAG,EAC/D,IAAI,GACN,CAAC,GAAG,CAAQ;AACd"}
|
|
1
|
+
{"version":3,"file":"index340.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/parse.js"],"sourcesContent":["// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport { VALID_DIGITS, PLUS_CHARS, MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN } from './constants.js';\nimport ParseError from './ParseError.js';\nimport Metadata from './metadata.js';\nimport isViablePhoneNumber, { isViablePhoneNumberStart } from './helpers/isViablePhoneNumber.js';\nimport extractExtension from './helpers/extension/extractExtension.js';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber.js';\nimport getCountryCallingCode from './getCountryCallingCode.js';\nimport { isPossibleNumber } from './isPossible.js';\n// import { parseRFC3966 } from './helpers/RFC3966.js'\nimport PhoneNumber from './PhoneNumber.js';\nimport matchesEntirely from './helpers/matchesEntirely.js';\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode.js';\nimport extractNationalNumber from './helpers/extractNationalNumber.js';\n// import stripIddPrefix from './helpers/stripIddPrefix.js'\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js';\nimport extractFormattedPhoneNumberFromPossibleRfc3966NumberUri from './helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js';\n\n// We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\nvar MAX_INPUT_STRING_LENGTH = 250;\n\n// This consists of the plus symbol, digits, and arabic-indic digits.\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']');\n\n// Regular expression of trailing characters that we want to remove.\n// A trailing `#` is sometimes used when writing phone numbers with extensions in US.\n// Example: \"+1 (645) 123 1234-910#\" number has extension \"910\".\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\n// Examples:\n//\n// ```js\n// parse('8 (800) 555-35-35', 'RU')\n// parse('8 (800) 555-35-35', 'RU', metadata)\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n// parse('+7 800 555 35 35')\n// parse('+7 800 555 35 35', metadata)\n// ```\n//\n\n/**\r\n * Parses a phone number.\r\n *\r\n * parse('123456789', { defaultCountry: 'RU', v2: true }, metadata)\r\n * parse('123456789', { defaultCountry: 'RU' }, metadata)\r\n * parse('123456789', undefined, metadata)\r\n *\r\n * @param {string} input\r\n * @param {object} [options]\r\n * @param {object} metadataJson\r\n * @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed).\r\n */\nexport default function parse(text, options, metadataJson) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n var metadata = new Metadata(metadataJson);\n\n // Validate `defaultCountry`.\n if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n throw new Error(\"Unknown country: \".concat(options.defaultCountry));\n }\n\n // Parse the phone number.\n var _parseInput = parseInput(text, options.v2, options.extract),\n formattedPhoneNumber = _parseInput.number,\n ext = _parseInput.ext,\n error = _parseInput.error;\n\n // If the phone number is not viable then return nothing.\n if (!formattedPhoneNumber) {\n if (options.v2) {\n if (error === 'TOO_SHORT') {\n throw new ParseError('TOO_SHORT');\n }\n throw new ParseError('NOT_A_NUMBER');\n }\n return {};\n }\n var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode,\n // If `country` is returned, its numbering plan will also be selected in `metadata`.\n // Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`.\n // Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.\n metadata),\n country = _parsePhoneNumber.country,\n nationalNumber = _parsePhoneNumber.nationalNumber,\n countryCallingCode = _parsePhoneNumber.countryCallingCode,\n countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource,\n carrierCode = _parsePhoneNumber.carrierCode;\n if (!metadata.hasSelectedNumberingPlan()) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n return {};\n }\n\n // Validate national (significant) number length.\n if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {\n // Won't throw here because the regexp already demands length > 1.\n /* istanbul ignore if */\n if (options.v2) {\n throw new ParseError('TOO_SHORT');\n }\n // Google's demo just throws an error in this case.\n return {};\n }\n\n // Validate national (significant) number length.\n //\n // A sidenote:\n //\n // They say that sometimes national (significant) numbers\n // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n // Such numbers will just be discarded.\n //\n if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {\n if (options.v2) {\n throw new ParseError('TOO_LONG');\n }\n // Google's demo just throws an error in this case.\n return {};\n }\n if (options.v2) {\n var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);\n if (country) {\n phoneNumber.country = country;\n }\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n }\n if (ext) {\n phoneNumber.ext = ext;\n }\n phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;\n return phoneNumber;\n }\n\n // Check if national phone number pattern matches the number.\n // National number pattern is different for each country,\n // even for those ones which are part of the \"NANPA\" group.\n var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;\n if (!options.extended) {\n return valid ? result(country, nationalNumber, ext) : {};\n }\n\n // isInternational: countryCallingCode !== undefined\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n carrierCode: carrierCode,\n valid: valid,\n possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,\n phone: nationalNumber,\n ext: ext\n };\n}\n\n/**\r\n * Extracts a formatted phone number from text.\r\n * Doesn't guarantee that the extracted phone number\r\n * is a valid phone number (for example, doesn't validate its length).\r\n * @param {string} text\r\n * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.\r\n * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.\r\n * @return {string}\r\n * @example\r\n * // Returns \"(213) 373-4253\".\r\n * extractFormattedPhoneNumber(\"Call (213) 373-4253 for assistance.\")\r\n */\nfunction _extractFormattedPhoneNumber(text, extract, throwOnError) {\n if (!text) {\n return;\n }\n if (text.length > MAX_INPUT_STRING_LENGTH) {\n if (throwOnError) {\n throw new ParseError('TOO_LONG');\n }\n return;\n }\n if (extract === false) {\n return text;\n }\n // Attempt to extract a possible number from the string passed in\n var startsAt = text.search(PHONE_NUMBER_START_PATTERN);\n if (startsAt < 0) {\n return;\n }\n return text\n // Trim everything to the left of the phone number\n .slice(startsAt)\n // Remove trailing non-numerical characters\n .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n\n/**\r\n * @param {string} text - Input.\r\n * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.\r\n * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\nfunction parseInput(text, v2, extract) {\n // // Parse RFC 3966 phone number URI.\n // if (text && text.indexOf('tel:') === 0) {\n // \treturn parseRFC3966(text)\n // }\n // let number = extractFormattedPhoneNumber(text, extract, v2)\n var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, {\n extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text) {\n return _extractFormattedPhoneNumber(text, extract, v2);\n }\n });\n // If the phone number is not viable, then abort.\n if (!number) {\n return {};\n }\n if (!isViablePhoneNumber(number)) {\n if (isViablePhoneNumberStart(number)) {\n return {\n error: 'TOO_SHORT'\n };\n }\n return {};\n }\n // Attempt to parse extension first, since it doesn't require region-specific\n // data and we want to have the non-normalised number here.\n var withExtensionStripped = extractExtension(number);\n if (withExtensionStripped.ext) {\n return withExtensionStripped;\n }\n return {\n number: number\n };\n}\n\n/**\r\n * Creates `parse()` result object.\r\n */\nfunction result(country, nationalNumber, ext) {\n var result = {\n country: country,\n phone: nationalNumber\n };\n if (ext) {\n result.ext = ext;\n }\n return result;\n}\n\n/**\r\n * Parses a viable phone number.\r\n * @param {string} formattedPhoneNumber — Example: \"(213) 373-4253\".\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {Metadata} metadata — Metadata instance with no pre-selected numbering plan. If `country` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if `countryCallingCode` is returned, its numbering plan will also be selected in `metadata`. Otherwise, if neither `country` nor `countryCallingCode` are returned, no numbering plan will be selected in `metadata`.\r\n * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.\r\n */\nfunction parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {\n // Attempt to extract a calling code from a phone number.\n // * If the phone number is found to be \"international\":\n // * It will attempt to identify the calling code part of it and whether that part is complete and valid.\n // * If the calling code part is complete and valid, it will return two properties:\n // that calling code part (without `+`) and the rest of the digits.\n // * Otherwise, i.e. if the calling code part is incomplete or invalid,\n // it will return an empty object.\n // * Otherwise, i.e. if the phone number is national, there's no callind code to extract\n // so it will just return the originally-passed `number` string as the only property.\n var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), undefined,\n // `defaultCountry` and `defaultCallingCode` are only used to detect\n // if it's an \"international\" phone number or not. They won't be used\n // to derive the resulting `countryCallingCode` from them, or anything like that.\n defaultCountry, defaultCallingCode, metadata.metadata),\n countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource,\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n // The exact country of the phone number\n var country;\n\n // If `formattedPhoneNumber` is passed in \"international\" format,\n // choose a country by `countryCallingCode`.\n if (countryCallingCode) {\n metadata.selectNumberingPlan(countryCallingCode);\n }\n // Else, if `formattedPhoneNumber` is passed in \"national\" format,\n // then `number` is defined and `countryCallingCode` is `undefined`.\n else if (number && (defaultCountry || defaultCallingCode)) {\n if (defaultCountry) {\n country = defaultCountry;\n metadata.selectNumberingPlan(defaultCountry);\n countryCallingCode = metadata.numberingPlan.callingCode();\n } else {\n metadata.selectNumberingPlan(defaultCallingCode);\n countryCallingCode = defaultCallingCode;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(countryCallingCode)) {\n country = '001';\n }\n }\n }\n } else return {};\n\n // At this point, `country` could be `undefined` but `countryCallingCode` is always defined.\n //\n // Also, if `country` is defined, its numbering plan is selected in `metadata`.\n // Otherwise, the numering plan for the `countryCallingCode` is selected in `metadata`.\n\n if (!number) {\n return {\n countryCallingCodeSource: countryCallingCodeSource,\n countryCallingCode: countryCallingCode\n };\n }\n var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), undefined, metadata),\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode;\n\n // Sometimes there are several countries\n // corresponding to the same country phone code\n // (e.g. NANPA countries all having `1` country phone code).\n // Therefore, to reliably determine the exact country,\n // national (significant) number should have been parsed first.\n //\n // When `metadata.json` is generated, all \"ambiguous\" country phone codes\n // get their countries populated with the full set of\n // \"phone number type\" regular expressions.\n //\n var exactCountry = getCountryByCallingCode(countryCallingCode, {\n nationalNumber: nationalNumber,\n metadata: metadata\n });\n if (exactCountry) {\n country = exactCountry;\n /* istanbul ignore if */\n if (exactCountry === '001') {\n // Can't happen with `USE_NON_GEOGRAPHIC_COUNTRY_CODE` being `false`.\n // If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` is set to `true` for some reason,\n // then remove the \"istanbul ignore if\".\n } else {\n metadata.selectNumberingPlan(country);\n }\n }\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n countryCallingCodeSource: countryCallingCodeSource,\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n//# sourceMappingURL=parse.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;AAwBA,IAAI,IAA0B,KAG1B,IAAiC,OAAO,MAAM,IAAa,IAAe,GAAG,GAK7E,IAAqC,OAAO,OAAO,IAAe,MAAW;AA2BjF,SAAwB,EAAM,GAAM,GAAS,GAAc;CAGzD,MAAqB,CAAC;CACtB,IAAI,IAAW,IAAI,EAAS,CAAY;CAGxC,IAAI,EAAQ,kBAAkB,CAAC,EAAS,WAAW,EAAQ,cAAc,GAIvE,MAHI,EAAQ,KACJ,IAAI,EAAW,iBAAiB,IAE9B,MAAM,oBAA2B,EAAQ,gBAAe;CAIpE,IAAI,IAAc,EAAW,GAAM,EAAQ,IAAI,EAAQ,OAAO,GAC5D,IAAuB,EAAY,QACnC,IAAM,EAAY,KAClB,IAAQ,EAAY;CAGtB,IAAI,CAAC,GAAsB;EACzB,IAAI,EAAQ,IAIV,MAHI,MAAU,cACN,IAAI,EAAW,WAAW,IAE5B,IAAI,EAAW,cAAc;EAErC,OAAO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;EACI;EACW;EACM;EACV;EACH;CACf;AACF"}
|
package/dist/index341.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
//#region ../../node_modules/libphonenumber-js/es6/
|
|
1
|
+
import e from "./index340.js";
|
|
2
|
+
//#region ../../node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js
|
|
3
3
|
function t(e) {
|
|
4
4
|
"@babel/helpers - typeof";
|
|
5
5
|
return t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
@@ -51,62 +51,10 @@ function o(e, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return (n === "string" ? String : Number)(e);
|
|
53
53
|
}
|
|
54
|
-
function s(
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
function c() {
|
|
58
|
-
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
59
|
-
}
|
|
60
|
-
function l(e, t) {
|
|
61
|
-
if (e) {
|
|
62
|
-
if (typeof e == "string") return u(e, t);
|
|
63
|
-
var n = {}.toString.call(e).slice(8, -1);
|
|
64
|
-
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? u(e, t) : void 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function u(e, t) {
|
|
68
|
-
(t == null || t > e.length) && (t = e.length);
|
|
69
|
-
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
70
|
-
return r;
|
|
71
|
-
}
|
|
72
|
-
function d(e, t) {
|
|
73
|
-
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
74
|
-
if (n != null) {
|
|
75
|
-
var r, i, a, o, s = [], c = !0, l = !1;
|
|
76
|
-
try {
|
|
77
|
-
if (a = (n = n.call(e)).next, t === 0) {
|
|
78
|
-
if (Object(n) !== n) return;
|
|
79
|
-
c = !1;
|
|
80
|
-
} else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
81
|
-
} catch (e) {
|
|
82
|
-
l = !0, i = e;
|
|
83
|
-
} finally {
|
|
84
|
-
try {
|
|
85
|
-
if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
86
|
-
} finally {
|
|
87
|
-
if (l) throw i;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return s;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function f(e) {
|
|
94
|
-
if (Array.isArray(e)) return e;
|
|
95
|
-
}
|
|
96
|
-
function p(t) {
|
|
97
|
-
var n = s(Array.prototype.slice.call(t), 4), i = n[0], a = n[1], o = n[2], c = n[3], l, u, d;
|
|
98
|
-
if (typeof i == "string") l = i;
|
|
99
|
-
else throw TypeError("A text for parsing must be a string.");
|
|
100
|
-
if (!a || typeof a == "string") c ? (u = o, d = c) : (u = void 0, d = o), a && (u = r({ defaultCountry: a }, u));
|
|
101
|
-
else if (e(a)) o ? (u = a, d = o) : d = a;
|
|
102
|
-
else throw Error(`Invalid second argument: ${a}`);
|
|
103
|
-
return {
|
|
104
|
-
text: l,
|
|
105
|
-
options: u,
|
|
106
|
-
metadata: d
|
|
107
|
-
};
|
|
54
|
+
function s(t, n, i) {
|
|
55
|
+
return e(t, r(r({}, n), {}, { v2: !0 }), i);
|
|
108
56
|
}
|
|
109
57
|
//#endregion
|
|
110
|
-
export {
|
|
58
|
+
export { s as default };
|
|
111
59
|
|
|
112
60
|
//# sourceMappingURL=index341.js.map
|
package/dist/index341.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index341.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/
|
|
1
|
+
{"version":3,"file":"index341.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js"],"sourcesContent":["function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport parse from './parse.js';\nexport default function parsePhoneNumberWithError(text, options, metadata) {\n return parse(text, _objectSpread(_objectSpread({}, options), {}, {\n v2: true\n }), metadata);\n}\n//# sourceMappingURL=parsePhoneNumberWithError_.js.map"],"x_google_ignoreList":[0],"mappings":";;AAAA,SAAS,EAAQ,GAAG;CAAE;CAA2B,OAAO,IAAwB,OAAO,UAArB,cAA2C,OAAO,OAAO,YAA1B,WAAqC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