@caspeco/casper-ui-library 10.0.4 → 10.1.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.
Files changed (108) hide show
  1. package/dist/components/input/input-recipe.d.ts.map +1 -1
  2. package/dist/components/input/input-recipe.js +8 -3
  3. package/dist/components/input/input.composition.d.ts.map +1 -1
  4. package/dist/components/input/input.d.ts +1 -0
  5. package/dist/components/input/input.d.ts.map +1 -1
  6. package/dist/components/input/input.js +76 -52
  7. package/dist/components/input/types.d.ts +2 -2
  8. package/dist/components/input/types.d.ts.map +1 -1
  9. package/dist/components/menu/menu-box-button.d.ts +4 -1
  10. package/dist/components/menu/menu-box-button.d.ts.map +1 -1
  11. package/dist/components/menu/menu-box-button.js +15 -14
  12. package/dist/components/phone-input/country-data.d.ts +22 -0
  13. package/dist/components/phone-input/country-data.d.ts.map +1 -0
  14. package/dist/components/phone-input/country-data.js +38 -0
  15. package/dist/components/phone-input/country-data.spec.d.ts +2 -0
  16. package/dist/components/phone-input/country-data.spec.d.ts.map +1 -0
  17. package/dist/components/phone-input/country-list.d.ts +19 -0
  18. package/dist/components/phone-input/country-list.d.ts.map +1 -0
  19. package/dist/components/phone-input/country-list.js +27 -0
  20. package/dist/components/phone-input/country-selector.d.ts +59 -0
  21. package/dist/components/phone-input/country-selector.d.ts.map +1 -0
  22. package/dist/components/phone-input/country-selector.js +120 -0
  23. package/dist/components/phone-input/index.d.ts +5 -0
  24. package/dist/components/phone-input/index.d.ts.map +1 -0
  25. package/dist/components/phone-input/phone-input-helpers.d.ts +47 -0
  26. package/dist/components/phone-input/phone-input-helpers.d.ts.map +1 -0
  27. package/dist/components/phone-input/phone-input-helpers.js +134 -0
  28. package/dist/components/phone-input/phone-input-helpers.spec.d.ts +2 -0
  29. package/dist/components/phone-input/phone-input-helpers.spec.d.ts.map +1 -0
  30. package/dist/components/phone-input/phone-input.composition.d.ts +26 -0
  31. package/dist/components/phone-input/phone-input.composition.d.ts.map +1 -0
  32. package/dist/components/phone-input/phone-input.d.ts +22 -0
  33. package/dist/components/phone-input/phone-input.d.ts.map +1 -0
  34. package/dist/components/phone-input/phone-input.js +43 -0
  35. package/dist/components/phone-input/phone-input.spec.d.ts +2 -0
  36. package/dist/components/phone-input/phone-input.spec.d.ts.map +1 -0
  37. package/dist/components/phone-input/phone-input.visual.test.d.ts +2 -0
  38. package/dist/components/phone-input/phone-input.visual.test.d.ts.map +1 -0
  39. package/dist/components/phone-input/translations.d.ts +60 -0
  40. package/dist/components/phone-input/translations.d.ts.map +1 -0
  41. package/dist/components/phone-input/translations.js +54 -0
  42. package/dist/components/phone-input/types.d.ts +45 -0
  43. package/dist/components/phone-input/types.d.ts.map +1 -0
  44. package/dist/components/phone-input/use-phone-input.d.ts +49 -0
  45. package/dist/components/phone-input/use-phone-input.d.ts.map +1 -0
  46. package/dist/components/phone-input/use-phone-input.js +138 -0
  47. package/dist/components/phone-input/use-phone-input.spec.d.ts +2 -0
  48. package/dist/components/phone-input/use-phone-input.spec.d.ts.map +1 -0
  49. package/dist/hooks/use-measured-width.d.ts +23 -0
  50. package/dist/hooks/use-measured-width.d.ts.map +1 -0
  51. package/dist/hooks/use-measured-width.js +22 -0
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +289 -285
  55. package/dist/node_modules/country-flag-icons/modules/countries.json.js +4 -0
  56. package/dist/node_modules/country-flag-icons/modules/hasFlag.js +7 -0
  57. package/dist/node_modules/country-flag-icons/modules/react/3x2/index.js +6303 -0
  58. package/dist/node_modules/country-flag-icons/react/3x2/index.js +269 -0
  59. package/dist/node_modules/libphonenumber-js/es6/ParseError.js +89 -0
  60. package/dist/node_modules/libphonenumber-js/es6/PhoneNumber.js +192 -0
  61. package/dist/node_modules/libphonenumber-js/es6/constants.js +10 -0
  62. package/dist/node_modules/libphonenumber-js/es6/format.js +98 -0
  63. package/dist/node_modules/libphonenumber-js/es6/getCountries.js +7 -0
  64. package/dist/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +11 -0
  65. package/dist/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +7 -0
  66. package/dist/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +16 -0
  67. package/dist/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +11 -0
  68. package/dist/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js +18 -0
  69. package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +46 -0
  70. package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +27 -0
  71. package/dist/node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +23 -0
  72. package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +39 -0
  73. package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +31 -0
  74. package/dist/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js +23 -0
  75. package/dist/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +25 -0
  76. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryAndCallingCodeFromOneOfThem.js +12 -0
  77. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +9 -0
  78. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +43 -0
  79. package/dist/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +12 -0
  80. package/dist/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +52 -0
  81. package/dist/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +14 -0
  82. package/dist/node_modules/libphonenumber-js/es6/helpers/isCallingCode.js +7 -0
  83. package/dist/node_modules/libphonenumber-js/es6/helpers/isCountryCode.js +7 -0
  84. package/dist/node_modules/libphonenumber-js/es6/helpers/isObject.js +7 -0
  85. package/dist/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +20 -0
  86. package/dist/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +6 -0
  87. package/dist/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +79 -0
  88. package/dist/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +19 -0
  89. package/dist/node_modules/libphonenumber-js/es6/isPossible.js +35 -0
  90. package/dist/node_modules/libphonenumber-js/es6/isValid.js +14 -0
  91. package/dist/node_modules/libphonenumber-js/es6/isValidPhoneNumber.js +59 -0
  92. package/dist/node_modules/libphonenumber-js/es6/metadata.js +494 -0
  93. package/dist/node_modules/libphonenumber-js/es6/normalizeArguments.js +108 -0
  94. package/dist/node_modules/libphonenumber-js/es6/parse.js +138 -0
  95. package/dist/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js +40 -0
  96. package/dist/node_modules/libphonenumber-js/es6/parsePhoneNumber.js +9 -0
  97. package/dist/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js +55 -0
  98. package/dist/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js +62 -0
  99. package/dist/node_modules/libphonenumber-js/es6/tools/semver-compare.js +14 -0
  100. package/dist/node_modules/libphonenumber-js/metadata.min.json.js +4 -0
  101. package/dist/node_modules/libphonenumber-js/min/exports/getCountries.js +8 -0
  102. package/dist/node_modules/libphonenumber-js/min/exports/getCountryCallingCode.js +8 -0
  103. package/dist/node_modules/libphonenumber-js/min/exports/isSupportedCountry.js +8 -0
  104. package/dist/node_modules/libphonenumber-js/min/exports/isValidPhoneNumber.js +8 -0
  105. package/dist/node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js +8 -0
  106. package/dist/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +8 -0
  107. package/dist/test-utils/create-visual-tests.d.ts.map +1 -1
  108. package/package.json +3 -1
@@ -0,0 +1,11 @@
1
+ import { VALID_DIGITS as A } from "../../constants.js";
2
+ var g = ";ext=", t = function(a) {
3
+ return "([".concat(A, "]{1,").concat(a, "})");
4
+ };
5
+ function D(x) {
6
+ var a = "20", o = "15", i = "9", F = "6", n = "[  \\t,]*", e = "[:\\..]?[  \\t,-]*", r = "#?", s = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)", E = "(?:[xx##~~]|int|int)", l = "[- ]+", u = "[  \\t]*", v = "(?:,{2}|;)", b = g + t(a), m = n + s + e + t(a) + r, p = n + E + e + t(i) + r, L = l + t(F) + "#", f = u + v + e + t(o) + r, c = u + "(?:,)+" + e + t(i) + r;
7
+ return b + "|" + m + "|" + p + "|" + L + "|" + f + "|" + c;
8
+ }
9
+ export {
10
+ D as default
11
+ };
@@ -0,0 +1,18 @@
1
+ import o from "./createExtensionPattern.js";
2
+ var n = new RegExp("(?:" + o() + ")$", "i");
3
+ function c(e) {
4
+ var a = e.search(n);
5
+ if (a < 0)
6
+ return {};
7
+ for (var i = e.slice(0, a), r = e.match(n), t = 1; t < r.length; ) {
8
+ if (r[t])
9
+ return {
10
+ number: i,
11
+ ext: r[t]
12
+ };
13
+ t++;
14
+ }
15
+ }
16
+ export {
17
+ c as default
18
+ };
@@ -0,0 +1,46 @@
1
+ import s from "./stripIddPrefix.js";
2
+ import I from "./extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";
3
+ import R from "../metadata.js";
4
+ import { MAX_LENGTH_COUNTRY_CODE as S } from "../constants.js";
5
+ function C(r, n, e, t, o) {
6
+ if (!r)
7
+ return {};
8
+ var _;
9
+ if (r[0] !== "+") {
10
+ var a = s(r, e, t, o);
11
+ if (a && a !== r)
12
+ _ = !0, r = "+" + a;
13
+ else {
14
+ if (e || t) {
15
+ var l = I(r, n, e, t, o), N = l.countryCallingCode, M = l.number;
16
+ if (N)
17
+ return {
18
+ countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
19
+ countryCallingCode: N,
20
+ number: M
21
+ };
22
+ }
23
+ return {
24
+ // No need to set it to `UNSPECIFIED`. It can be just `undefined`.
25
+ // countryCallingCodeSource: 'UNSPECIFIED',
26
+ number: r
27
+ };
28
+ }
29
+ }
30
+ if (r[1] === "0")
31
+ return {};
32
+ for (var c = new R(o), i = 2; i - 1 <= S && i <= r.length; ) {
33
+ var f = r.slice(1, i);
34
+ if (c.hasCallingCode(f))
35
+ return c.selectNumberingPlan(f), {
36
+ countryCallingCodeSource: _ ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
37
+ countryCallingCode: f,
38
+ number: r.slice(i)
39
+ };
40
+ i++;
41
+ }
42
+ return {};
43
+ }
44
+ export {
45
+ C as default
46
+ };
@@ -0,0 +1,27 @@
1
+ import a, { getCountryCallingCode as v } from "../metadata.js";
2
+ import l from "./matchesEntirely.js";
3
+ import m from "./extractNationalNumber.js";
4
+ import b from "./checkNumberLength.js";
5
+ function y(r, h, i, e, t) {
6
+ if (!(i || e))
7
+ return {
8
+ number: r
9
+ };
10
+ var o = i ? v(i, t) : e;
11
+ if (r.indexOf(o) === 0) {
12
+ var n = new a(t);
13
+ n.selectNumberingPlan(i || e);
14
+ var u = r.slice(o.length), f = m(u, void 0, n), N = f.nationalNumber, g = m(r, void 0, n), c = g.nationalNumber;
15
+ if (!l(c, n.nationalNumberPattern()) && l(N, n.nationalNumberPattern()) || b(c, void 0, n) === "TOO_LONG")
16
+ return {
17
+ countryCallingCode: o,
18
+ number: u
19
+ };
20
+ }
21
+ return {
22
+ number: r
23
+ };
24
+ }
25
+ export {
26
+ y as default
27
+ };
@@ -0,0 +1,23 @@
1
+ import s, { isPhoneContextValid as x, PLUS_SIGN as F, RFC3966_PREFIX_ as a, RFC3966_PHONE_CONTEXT_ as d, RFC3966_ISDN_SUBADDRESS_ as m } from "./extractPhoneContext.js";
2
+ import v from "../ParseError.js";
3
+ function S(r, _) {
4
+ var f = _.extractFormattedPhoneNumber, e = s(r);
5
+ if (!x(e))
6
+ throw new v("NOT_A_NUMBER");
7
+ var t;
8
+ if (e === null)
9
+ t = f(r) || "";
10
+ else {
11
+ t = "", e.charAt(0) === F && (t += e);
12
+ var n = r.indexOf(a), o;
13
+ n >= 0 ? o = n + a.length : o = 0;
14
+ var h = r.indexOf(d);
15
+ t += r.substring(o, h);
16
+ }
17
+ var i = t.indexOf(m);
18
+ if (i > 0 && (t = t.substring(0, i)), t !== "")
19
+ return t;
20
+ }
21
+ export {
22
+ S as default
23
+ };
@@ -0,0 +1,39 @@
1
+ import l from "./extractNationalNumberFromPossiblyIncompleteNumber.js";
2
+ import o from "./matchesEntirely.js";
3
+ import u from "./checkNumberLength.js";
4
+ import N from "./getCountryByCallingCode.js";
5
+ function g(e, n, r) {
6
+ var i = l(e, r), a = i.carrierCode, t = i.nationalNumber;
7
+ if (t !== e) {
8
+ if (!m(e, t, r))
9
+ return {
10
+ nationalNumber: e
11
+ };
12
+ if (r.numberingPlan.possibleLengths() && (n || (n = N(r.numberingPlan.callingCode(), {
13
+ nationalNumber: t,
14
+ metadata: r
15
+ })), !f(t, n, r)))
16
+ return {
17
+ nationalNumber: e
18
+ };
19
+ }
20
+ return {
21
+ nationalNumber: t,
22
+ carrierCode: a
23
+ };
24
+ }
25
+ function m(e, n, r) {
26
+ return !(o(e, r.nationalNumberPattern()) && !o(n, r.nationalNumberPattern()));
27
+ }
28
+ function f(e, n, r) {
29
+ switch (u(e, n, r)) {
30
+ case "TOO_SHORT":
31
+ case "INVALID_LENGTH":
32
+ return !1;
33
+ default:
34
+ return !0;
35
+ }
36
+ }
37
+ export {
38
+ g as default
39
+ };
@@ -0,0 +1,31 @@
1
+ function F(l, i) {
2
+ if (l && i.numberingPlan.nationalPrefixForParsing()) {
3
+ var g = new RegExp("^(?:" + i.numberingPlan.nationalPrefixForParsing() + ")"), n = g.exec(l);
4
+ if (n) {
5
+ var r, P, v = n.length - 1, e = v > 0 && n[v];
6
+ if (i.nationalPrefixTransformRule() && e)
7
+ r = l.replace(g, i.nationalPrefixTransformRule()), v > 1 && (P = n[1]);
8
+ else {
9
+ var o = n[0];
10
+ r = l.slice(o.length), e && (P = n[1]);
11
+ }
12
+ var f;
13
+ if (e) {
14
+ var s = l.indexOf(n[1]), a = l.slice(0, s);
15
+ a === i.numberingPlan.nationalPrefix() && (f = i.numberingPlan.nationalPrefix());
16
+ } else
17
+ f = n[0];
18
+ return {
19
+ nationalNumber: r,
20
+ nationalPrefix: f,
21
+ carrierCode: P
22
+ };
23
+ }
24
+ }
25
+ return {
26
+ nationalNumber: l
27
+ };
28
+ }
29
+ export {
30
+ F as default
31
+ };
@@ -0,0 +1,23 @@
1
+ import { VALID_DIGITS as n } from "../constants.js";
2
+ var v = "+", I = "[\\-\\.\\(\\)]?", R = "([" + n + "]|" + I + ")", i = "^\\" + v + R + "*[" + n + "]" + R + "*$", N = new RegExp(i, "g"), r = n, C = "[" + r + "]+((\\-)*[" + r + "])*", L = "a-zA-Z", f = "[" + L + "]+((\\-)*[" + r + "])*", E = "^(" + C + "\\.)*" + f + "\\.?$", O = new RegExp(E, "g"), l = "tel:", a = ";phone-context=", u = ";isub=";
3
+ function D(_) {
4
+ var t = _.indexOf(a);
5
+ if (t < 0)
6
+ return null;
7
+ var e = t + a.length;
8
+ if (e >= _.length)
9
+ return "";
10
+ var A = _.indexOf(";", e);
11
+ return A >= 0 ? _.substring(e, A) : _.substring(e);
12
+ }
13
+ function S(_) {
14
+ return _ === null ? !0 : _.length === 0 ? !1 : N.test(_) || O.test(_);
15
+ }
16
+ export {
17
+ v as PLUS_SIGN,
18
+ u as RFC3966_ISDN_SUBADDRESS_,
19
+ a as RFC3966_PHONE_CONTEXT_,
20
+ l as RFC3966_PREFIX_,
21
+ D as default,
22
+ S as isPhoneContextValid
23
+ };
@@ -0,0 +1,25 @@
1
+ import o from "./applyInternationalSeparatorStyle.js";
2
+ var l = /(\$\d)/;
3
+ function m(e, a, t) {
4
+ var r = t.useInternationalFormat, i = t.withNationalPrefix, n = e.replace(new RegExp(a.pattern()), r ? a.internationalFormat() : (
5
+ // This library doesn't use `domestic_carrier_code_formatting_rule`,
6
+ // because that one is only used when formatting phone numbers
7
+ // for dialing from a mobile phone, and this is not a dialing library.
8
+ // carrierCode && format.domesticCarrierCodeFormattingRule()
9
+ // // First, replace the $CC in the formatting rule with the desired carrier code.
10
+ // // Then, replace the $FG in the formatting rule with the first group
11
+ // // and the carrier code combined in the appropriate way.
12
+ // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
13
+ // : (
14
+ // withNationalPrefix && format.nationalPrefixFormattingRule()
15
+ // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
16
+ // : format.format()
17
+ // )
18
+ i && a.nationalPrefixFormattingRule() ? a.format().replace(l, a.nationalPrefixFormattingRule()) : a.format()
19
+ ));
20
+ return r ? o(n) : n;
21
+ }
22
+ export {
23
+ l as FIRST_GROUP_PATTERN,
24
+ m as default
25
+ };
@@ -0,0 +1,12 @@
1
+ import r from "../metadata.js";
2
+ import i from "./isCountryCode.js";
3
+ function d(e, o) {
4
+ var t, a, n = new r(o);
5
+ return i(e) ? (t = e, n.selectNumberingPlan(t), a = n.countryCallingCode()) : a = e, {
6
+ country: t,
7
+ callingCode: a
8
+ };
9
+ }
10
+ export {
11
+ d as default
12
+ };
@@ -0,0 +1,9 @@
1
+ import o from "./getCountryByNationalNumber.js";
2
+ function i(r, a) {
3
+ var n = a.nationalNumber, e = a.metadata, t = e.getCountryCodesForCallingCode(r);
4
+ if (t)
5
+ return t.length === 1 ? t[0] : o(n, t, e.metadata);
6
+ }
7
+ export {
8
+ i as default
9
+ };
@@ -0,0 +1,43 @@
1
+ import u from "../metadata.js";
2
+ import f from "./getNumberType.js";
3
+ function d(e, r) {
4
+ var t = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
5
+ if (t) return (t = t.call(e)).next.bind(t);
6
+ if (Array.isArray(e) || (t = s(e)) || r) {
7
+ t && (e = t);
8
+ var n = 0;
9
+ return function() {
10
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
11
+ };
12
+ }
13
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
14
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
15
+ }
16
+ function s(e, r) {
17
+ if (e) {
18
+ if (typeof e == "string") return i(e, r);
19
+ var t = {}.toString.call(e).slice(8, -1);
20
+ return t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set" ? Array.from(e) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? i(e, r) : void 0;
21
+ }
22
+ }
23
+ function i(e, r) {
24
+ (r == null || r > e.length) && (r = e.length);
25
+ for (var t = 0, n = Array(r); t < r; t++) n[t] = e[t];
26
+ return n;
27
+ }
28
+ function y(e, r, t) {
29
+ for (var n = new u(t), l = d(r), o; !(o = l()).done; ) {
30
+ var a = o.value;
31
+ if (n.selectNumberingPlan(a), n.leadingDigits()) {
32
+ if (e && e.search(n.leadingDigits()) === 0)
33
+ return a;
34
+ } else if (f({
35
+ phone: e,
36
+ country: a
37
+ }, void 0, n.metadata))
38
+ return a;
39
+ }
40
+ }
41
+ export {
42
+ y as default
43
+ };
@@ -0,0 +1,12 @@
1
+ import f from "../metadata.js";
2
+ var u = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
3
+ function D(t, r, a) {
4
+ var e = new f(a);
5
+ if (e.selectNumberingPlan(t || r), e.defaultIDDPrefix())
6
+ return e.defaultIDDPrefix();
7
+ if (u.test(e.IDDPrefix()))
8
+ return e.IDDPrefix();
9
+ }
10
+ export {
11
+ D as default
12
+ };
@@ -0,0 +1,52 @@
1
+ import I from "../metadata.js";
2
+ import f from "./matchesEntirely.js";
3
+ function y(e, n) {
4
+ var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
5
+ if (r) return (r = r.call(e)).next.bind(r);
6
+ if (Array.isArray(e) || (r = c(e)) || n) {
7
+ r && (e = r);
8
+ var t = 0;
9
+ return function() {
10
+ return t >= e.length ? { done: !0 } : { done: !1, value: e[t++] };
11
+ };
12
+ }
13
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
14
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
15
+ }
16
+ function c(e, n) {
17
+ if (e) {
18
+ if (typeof e == "string") return l(e, n);
19
+ var r = {}.toString.call(e).slice(8, -1);
20
+ return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? l(e, n) : void 0;
21
+ }
22
+ }
23
+ function l(e, n) {
24
+ (n == null || n > e.length) && (n = e.length);
25
+ for (var r = 0, t = Array(n); r < n; r++) t[r] = e[r];
26
+ return t;
27
+ }
28
+ var s = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
29
+ function O(e, n, r) {
30
+ if (n = n || {}, !(!e.country && !e.countryCallingCode)) {
31
+ var t = new I(r);
32
+ t.selectNumberingPlan(e.country || e.countryCallingCode);
33
+ var a = n.v2 ? e.nationalNumber : e.phone;
34
+ if (f(a, t.nationalNumberPattern())) {
35
+ if (o(a, "FIXED_LINE", t))
36
+ return t.type("MOBILE") && t.type("MOBILE").pattern() === "" || !t.type("MOBILE") || o(a, "MOBILE", t) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
37
+ for (var E = y(s), i; !(i = E()).done; ) {
38
+ var u = i.value;
39
+ if (o(a, u, t))
40
+ return u;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ function o(e, n, r) {
46
+ var t = r.type(n);
47
+ return !t || !t.pattern() || t.possibleLengths() && t.possibleLengths().indexOf(e.length) < 0 ? !1 : f(e, t.pattern());
48
+ }
49
+ export {
50
+ O as default,
51
+ o as isNumberTypeEqualTo
52
+ };
@@ -0,0 +1,14 @@
1
+ import u from "../metadata.js";
2
+ function s(r, t, e) {
3
+ var n = new u(e), o = n.getCountryCodesForCallingCode(r);
4
+ return o ? o.filter(function(a) {
5
+ return i(t, a, e);
6
+ }) : [];
7
+ }
8
+ function i(r, t, e) {
9
+ var n = new u(e);
10
+ return n.selectNumberingPlan(t), n.numberingPlan.possibleLengths().indexOf(r.length) >= 0;
11
+ }
12
+ export {
13
+ s as default
14
+ };
@@ -0,0 +1,7 @@
1
+ var e = /^\d+$/;
2
+ function a(t) {
3
+ return e.test(t);
4
+ }
5
+ export {
6
+ a as default
7
+ };
@@ -0,0 +1,7 @@
1
+ var e = /^[A-Z]{2}$/;
2
+ function r(t) {
3
+ return e.test(t);
4
+ }
5
+ export {
6
+ r as default
7
+ };
@@ -0,0 +1,7 @@
1
+ var t = {}.constructor;
2
+ function n(r) {
3
+ return r != null && r.constructor === t;
4
+ }
5
+ export {
6
+ n as default
7
+ };
@@ -0,0 +1,20 @@
1
+ import { MIN_LENGTH_FOR_NSN as e, VALID_DIGITS as _, PLUS_CHARS as t, VALID_PUNCTUATION as E } from "../constants.js";
2
+ import r from "./extension/createExtensionPattern.js";
3
+ var n = "[" + _ + "]{" + e + "}", I = "[" + t + "]{0,1}(?:[" + E + "]*[" + _ + "]){3,}[" + E + _ + "]*", P = new RegExp("^[" + t + "]{0,1}(?:[" + E + "]*[" + _ + "]){1,2}$", "i"), R = I + // Phone number extensions
4
+ "(?:" + r() + ")?", T = new RegExp(
5
+ // Either a short two-digit-only phone number
6
+ "^" + n + "$|^" + R + "$",
7
+ "i"
8
+ );
9
+ function A(N) {
10
+ return N.length >= e && T.test(N);
11
+ }
12
+ function o(N) {
13
+ return P.test(N);
14
+ }
15
+ export {
16
+ I as VALID_PHONE_NUMBER,
17
+ R as VALID_PHONE_NUMBER_WITH_EXTENSION,
18
+ A as default,
19
+ o as isViablePhoneNumberStart
20
+ };
@@ -0,0 +1,6 @@
1
+ function r(e, n) {
2
+ return e = e || "", new RegExp("^(?:" + n + ")$").test(e);
3
+ }
4
+ export {
5
+ r as default
6
+ };
@@ -0,0 +1,79 @@
1
+ var F = {
2
+ 0: "0",
3
+ 1: "1",
4
+ 2: "2",
5
+ 3: "3",
6
+ 4: "4",
7
+ 5: "5",
8
+ 6: "6",
9
+ 7: "7",
10
+ 8: "8",
11
+ 9: "9",
12
+ "0": "0",
13
+ // Fullwidth digit 0
14
+ "1": "1",
15
+ // Fullwidth digit 1
16
+ "2": "2",
17
+ // Fullwidth digit 2
18
+ "3": "3",
19
+ // Fullwidth digit 3
20
+ "4": "4",
21
+ // Fullwidth digit 4
22
+ "5": "5",
23
+ // Fullwidth digit 5
24
+ "6": "6",
25
+ // Fullwidth digit 6
26
+ "7": "7",
27
+ // Fullwidth digit 7
28
+ "8": "8",
29
+ // Fullwidth digit 8
30
+ "9": "9",
31
+ // Fullwidth digit 9
32
+ "٠": "0",
33
+ // Arabic-indic digit 0
34
+ "١": "1",
35
+ // Arabic-indic digit 1
36
+ "٢": "2",
37
+ // Arabic-indic digit 2
38
+ "٣": "3",
39
+ // Arabic-indic digit 3
40
+ "٤": "4",
41
+ // Arabic-indic digit 4
42
+ "٥": "5",
43
+ // Arabic-indic digit 5
44
+ "٦": "6",
45
+ // Arabic-indic digit 6
46
+ "٧": "7",
47
+ // Arabic-indic digit 7
48
+ "٨": "8",
49
+ // Arabic-indic digit 8
50
+ "٩": "9",
51
+ // Arabic-indic digit 9
52
+ "۰": "0",
53
+ // Eastern-Arabic digit 0
54
+ "۱": "1",
55
+ // Eastern-Arabic digit 1
56
+ "۲": "2",
57
+ // Eastern-Arabic digit 2
58
+ "۳": "3",
59
+ // Eastern-Arabic digit 3
60
+ "۴": "4",
61
+ // Eastern-Arabic digit 4
62
+ "۵": "5",
63
+ // Eastern-Arabic digit 5
64
+ "۶": "6",
65
+ // Eastern-Arabic digit 6
66
+ "۷": "7",
67
+ // Eastern-Arabic digit 7
68
+ "۸": "8",
69
+ // Eastern-Arabic digit 8
70
+ "۹": "9"
71
+ // Eastern-Arabic digit 9
72
+ };
73
+ function r(u) {
74
+ return F[u];
75
+ }
76
+ export {
77
+ F as DIGITS,
78
+ r as parseDigit
79
+ };
@@ -0,0 +1,19 @@
1
+ import I from "../metadata.js";
2
+ import { VALID_DIGITS as l } from "../constants.js";
3
+ var p = new RegExp("([" + l + "])");
4
+ function c(t, r, f, n) {
5
+ if (r) {
6
+ var a = new I(n);
7
+ a.selectNumberingPlan(r || f);
8
+ var i = new RegExp(a.IDDPrefix());
9
+ if (t.search(i) === 0) {
10
+ t = t.slice(t.match(i)[0].length);
11
+ var e = t.match(p);
12
+ if (!(e && e[1] != null && e[1].length > 0 && e[1] === "0"))
13
+ return t;
14
+ }
15
+ }
16
+ }
17
+ export {
18
+ c as default
19
+ };
@@ -0,0 +1,35 @@
1
+ import a from "./metadata.js";
2
+ import t from "./helpers/checkNumberLength.js";
3
+ function i(e, n, o) {
4
+ n === void 0 && (n = {});
5
+ var r = new a(o);
6
+ if (n.v2) {
7
+ if (!e.countryCallingCode)
8
+ throw new Error("Invalid phone number object passed");
9
+ r.selectNumberingPlan(e.country || e.countryCallingCode);
10
+ } else {
11
+ if (!e.phone)
12
+ return !1;
13
+ if (e.country) {
14
+ if (!r.hasCountry(e.country))
15
+ throw new Error("Unknown country: ".concat(e.country));
16
+ r.selectNumberingPlan(e.country);
17
+ } else {
18
+ if (!e.countryCallingCode)
19
+ throw new Error("Invalid phone number object passed");
20
+ r.selectNumberingPlan(e.countryCallingCode);
21
+ }
22
+ }
23
+ if (r.possibleLengths())
24
+ return l(e.phone || e.nationalNumber, r);
25
+ if (e.countryCallingCode && r.isNonGeographicCallingCode(e.countryCallingCode))
26
+ return !0;
27
+ throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
28
+ }
29
+ function l(e, n) {
30
+ return t(e, void 0, n) === "IS_POSSIBLE";
31
+ }
32
+ export {
33
+ i as default,
34
+ l as isPossibleNumber
35
+ };
@@ -0,0 +1,14 @@
1
+ import n from "./metadata.js";
2
+ import l from "./helpers/matchesEntirely.js";
3
+ import o from "./helpers/getNumberType.js";
4
+ function i(e, a, t) {
5
+ a = a || {};
6
+ var r = new n(t);
7
+ if (r.selectNumberingPlan(e.country || e.countryCallingCode), r.hasTypes())
8
+ return o(e, a, r.metadata) !== void 0;
9
+ var m = a.v2 ? e.nationalNumber : e.phone;
10
+ return l(m, r.nationalNumberPattern());
11
+ }
12
+ export {
13
+ i as default
14
+ };
@@ -0,0 +1,59 @@
1
+ import c from "./normalizeArguments.js";
2
+ import f from "./parsePhoneNumber_.js";
3
+ function o(e) {
4
+ "@babel/helpers - typeof";
5
+ return o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
6
+ return typeof t;
7
+ } : function(t) {
8
+ return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
9
+ }, o(e);
10
+ }
11
+ function u(e, t) {
12
+ var r = Object.keys(e);
13
+ if (Object.getOwnPropertySymbols) {
14
+ var n = Object.getOwnPropertySymbols(e);
15
+ t && (n = n.filter(function(i) {
16
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
17
+ })), r.push.apply(r, n);
18
+ }
19
+ return r;
20
+ }
21
+ function a(e) {
22
+ for (var t = 1; t < arguments.length; t++) {
23
+ var r = arguments[t] != null ? arguments[t] : {};
24
+ t % 2 ? u(Object(r), !0).forEach(function(n) {
25
+ p(e, n, r[n]);
26
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : u(Object(r)).forEach(function(n) {
27
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
28
+ });
29
+ }
30
+ return e;
31
+ }
32
+ function p(e, t, r) {
33
+ return (t = b(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
34
+ }
35
+ function b(e) {
36
+ var t = m(e, "string");
37
+ return o(t) == "symbol" ? t : t + "";
38
+ }
39
+ function m(e, t) {
40
+ if (o(e) != "object" || !e) return e;
41
+ var r = e[Symbol.toPrimitive];
42
+ if (r !== void 0) {
43
+ var n = r.call(e, t);
44
+ if (o(n) != "object") return n;
45
+ throw new TypeError("@@toPrimitive must return a primitive value.");
46
+ }
47
+ return (t === "string" ? String : Number)(e);
48
+ }
49
+ function l() {
50
+ var e = c(arguments), t = e.text, r = e.options, n = e.metadata;
51
+ r = a(a({}, r), {}, {
52
+ extract: !1
53
+ });
54
+ var i = f(t, r, n);
55
+ return i && i.isValid() || !1;
56
+ }
57
+ export {
58
+ l as default
59
+ };