@rpcbase/ui 0.197.0 → 0.198.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 (188) hide show
  1. package/dist/index151.js +1 -1
  2. package/dist/index152.js +605 -5
  3. package/dist/index152.js.map +1 -1
  4. package/dist/index153.js +5 -68
  5. package/dist/index153.js.map +1 -1
  6. package/dist/index154.js +69 -2
  7. package/dist/index154.js.map +1 -1
  8. package/dist/index155.js +2 -364
  9. package/dist/index155.js.map +1 -1
  10. package/dist/index156.js +303 -201
  11. package/dist/index156.js.map +1 -1
  12. package/dist/index157.js +247 -46
  13. package/dist/index157.js.map +1 -1
  14. package/dist/index158.js +56 -42
  15. package/dist/index158.js.map +1 -1
  16. package/dist/index159.js +46 -169
  17. package/dist/index159.js.map +1 -1
  18. package/dist/index160.js +156 -96
  19. package/dist/index160.js.map +1 -1
  20. package/dist/index161.js +109 -24
  21. package/dist/index161.js.map +1 -1
  22. package/dist/index162.js +25 -8
  23. package/dist/index162.js.map +1 -1
  24. package/dist/index163.js +8 -5
  25. package/dist/index163.js.map +1 -1
  26. package/dist/index164.js +4 -5
  27. package/dist/index164.js.map +1 -1
  28. package/dist/index165.js +5 -4
  29. package/dist/index165.js.map +1 -1
  30. package/dist/index166.js +4 -466
  31. package/dist/index166.js.map +1 -1
  32. package/dist/index167.js +420 -139
  33. package/dist/index167.js.map +1 -1
  34. package/dist/index168.js +149 -71
  35. package/dist/index168.js.map +1 -1
  36. package/dist/index169.js +74 -229
  37. package/dist/index169.js.map +1 -1
  38. package/dist/index170.js +262 -9
  39. package/dist/index170.js.map +1 -1
  40. package/dist/index171.js +9 -42
  41. package/dist/index171.js.map +1 -1
  42. package/dist/index172.js +42 -4
  43. package/dist/index172.js.map +1 -1
  44. package/dist/index173.js +4 -46
  45. package/dist/index173.js.map +1 -1
  46. package/dist/index174.js +41 -200
  47. package/dist/index174.js.map +1 -1
  48. package/dist/index175.js +204 -20
  49. package/dist/index175.js.map +1 -1
  50. package/dist/index176.js +22 -25
  51. package/dist/index176.js.map +1 -1
  52. package/dist/index177.js +23 -398
  53. package/dist/index177.js.map +1 -1
  54. package/dist/index178.js +383 -589
  55. package/dist/index178.js.map +1 -1
  56. package/dist/index19.js +185 -183
  57. package/dist/index19.js.map +1 -1
  58. package/dist/index239.js +66 -12
  59. package/dist/index239.js.map +1 -1
  60. package/dist/index24.js +1 -1
  61. package/dist/index240.js +176 -150
  62. package/dist/index240.js.map +1 -1
  63. package/dist/index241.js +43 -27
  64. package/dist/index241.js.map +1 -1
  65. package/dist/index242.js +13 -9
  66. package/dist/index242.js.map +1 -1
  67. package/dist/index243.js +147 -41
  68. package/dist/index243.js.map +1 -1
  69. package/dist/index244.js +29 -10
  70. package/dist/index244.js.map +1 -1
  71. package/dist/index245.js +9 -44
  72. package/dist/index245.js.map +1 -1
  73. package/dist/index246.js +41 -88
  74. package/dist/index246.js.map +1 -1
  75. package/dist/index247.js +10 -85
  76. package/dist/index247.js.map +1 -1
  77. package/dist/index248.js +41 -102
  78. package/dist/index248.js.map +1 -1
  79. package/dist/index249.js +88 -45
  80. package/dist/index249.js.map +1 -1
  81. package/dist/index250.js +85 -10
  82. package/dist/index250.js.map +1 -1
  83. package/dist/index251.js +96 -28
  84. package/dist/index251.js.map +1 -1
  85. package/dist/index252.js +52 -8
  86. package/dist/index252.js.map +1 -1
  87. package/dist/index253.js +10 -115
  88. package/dist/index253.js.map +1 -1
  89. package/dist/index254.js +36 -16
  90. package/dist/index254.js.map +1 -1
  91. package/dist/index255.js +8 -15
  92. package/dist/index255.js.map +1 -1
  93. package/dist/index256.js +116 -3
  94. package/dist/index256.js.map +1 -1
  95. package/dist/index257.js +16 -35
  96. package/dist/index257.js.map +1 -1
  97. package/dist/index258.js +14 -19
  98. package/dist/index258.js.map +1 -1
  99. package/dist/index259.js +3 -9
  100. package/dist/index259.js.map +1 -1
  101. package/dist/index260.js +36 -8
  102. package/dist/index260.js.map +1 -1
  103. package/dist/index261.js +20 -24
  104. package/dist/index261.js.map +1 -1
  105. package/dist/index262.js +10 -29
  106. package/dist/index262.js.map +1 -1
  107. package/dist/index263.js +9 -5
  108. package/dist/index263.js.map +1 -1
  109. package/dist/index264.js +4 -4
  110. package/dist/index266.js +2 -2
  111. package/dist/index267.js +22 -65
  112. package/dist/index267.js.map +1 -1
  113. package/dist/index268.js +27 -179
  114. package/dist/index268.js.map +1 -1
  115. package/dist/index269.js +5 -47
  116. package/dist/index269.js.map +1 -1
  117. package/dist/index273.js +1 -1
  118. package/dist/index277.js +1 -1
  119. package/dist/index278.js +1 -1
  120. package/dist/index299.js +1 -1
  121. package/dist/index31.js +5 -5
  122. package/dist/index36.js +1 -1
  123. package/dist/index37.js +2 -2
  124. package/dist/index40.js +2 -2
  125. package/dist/index41.js +20 -20
  126. package/dist/index45.js +1 -1
  127. package/dist/index46.js +1 -1
  128. package/dist/index49.js +1 -1
  129. package/dist/index50.js +1 -1
  130. package/dist/index51.js +7 -2
  131. package/dist/index51.js.map +1 -1
  132. package/dist/index52.js +34 -2
  133. package/dist/index52.js.map +1 -1
  134. package/dist/index53.js +27 -2
  135. package/dist/index53.js.map +1 -1
  136. package/dist/index54.js +8 -2
  137. package/dist/index54.js.map +1 -1
  138. package/dist/index55.js +11 -6
  139. package/dist/index55.js.map +1 -1
  140. package/dist/index56.js +2 -34
  141. package/dist/index56.js.map +1 -1
  142. package/dist/index57.js +2 -27
  143. package/dist/index57.js.map +1 -1
  144. package/dist/index58.js +205 -8
  145. package/dist/index58.js.map +1 -1
  146. package/dist/index59.js +3 -11
  147. package/dist/index59.js.map +1 -1
  148. package/dist/index60.js +44 -201
  149. package/dist/index60.js.map +1 -1
  150. package/dist/index61.js +50 -3
  151. package/dist/index61.js.map +1 -1
  152. package/dist/index62.js +7 -47
  153. package/dist/index62.js.map +1 -1
  154. package/dist/index63.js +12 -48
  155. package/dist/index63.js.map +1 -1
  156. package/dist/index64.js +133 -7
  157. package/dist/index64.js.map +1 -1
  158. package/dist/index65.js +10 -14
  159. package/dist/index65.js.map +1 -1
  160. package/dist/index66.js +210 -127
  161. package/dist/index66.js.map +1 -1
  162. package/dist/index67.js +12 -10
  163. package/dist/index67.js.map +1 -1
  164. package/dist/index68.js +44 -214
  165. package/dist/index68.js.map +1 -1
  166. package/dist/index69.js +49 -12
  167. package/dist/index69.js.map +1 -1
  168. package/dist/index70.js +4 -47
  169. package/dist/index70.js.map +1 -1
  170. package/dist/index71.js +5 -49
  171. package/dist/index71.js.map +1 -1
  172. package/dist/index72.js +28 -4
  173. package/dist/index72.js.map +1 -1
  174. package/dist/index73.js +50 -6
  175. package/dist/index73.js.map +1 -1
  176. package/dist/index74.js +9 -28
  177. package/dist/index74.js.map +1 -1
  178. package/dist/index75.js +6 -50
  179. package/dist/index75.js.map +1 -1
  180. package/dist/index76.js +8 -9
  181. package/dist/index76.js.map +1 -1
  182. package/dist/index77.js +5 -5
  183. package/dist/index77.js.map +1 -1
  184. package/dist/index78.js +2 -8
  185. package/dist/index78.js.map +1 -1
  186. package/dist/index79.js +2 -6
  187. package/dist/index79.js.map +1 -1
  188. package/package.json +1 -1
package/dist/index167.js CHANGED
@@ -1,189 +1,470 @@
1
- import l, { validateMetadata as h } from "./index166.js";
2
- import d from "./index241.js";
3
- import v from "./index242.js";
4
- import w from "./index243.js";
5
- import P from "./index244.js";
6
- import C from "./index245.js";
7
- import s from "./index172.js";
8
- import E from "./index246.js";
9
- function o(r) {
1
+ import f from "./index253.js";
2
+ import l from "./index173.js";
3
+ function a(n) {
10
4
  "@babel/helpers - typeof";
11
- return o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
5
+ return a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
12
6
  return typeof t;
13
7
  } : function(t) {
14
8
  return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
15
- }, o(r);
9
+ }, a(n);
16
10
  }
17
- function f(r, t) {
18
- var e = Object.keys(r);
19
- if (Object.getOwnPropertySymbols) {
20
- var n = Object.getOwnPropertySymbols(r);
21
- t && (n = n.filter(function(i) {
22
- return Object.getOwnPropertyDescriptor(r, i).enumerable;
23
- })), e.push.apply(e, n);
24
- }
25
- return e;
26
- }
27
- function c(r) {
28
- for (var t = 1; t < arguments.length; t++) {
29
- var e = arguments[t] != null ? arguments[t] : {};
30
- t % 2 ? f(Object(e), !0).forEach(function(n) {
31
- j(r, n, e[n]);
32
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : f(Object(e)).forEach(function(n) {
33
- Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
34
- });
35
- }
36
- return r;
37
- }
38
- function j(r, t, e) {
39
- return (t = y(t)) in r ? Object.defineProperty(r, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = e, r;
40
- }
41
- function O(r, t) {
42
- if (!(r instanceof t)) throw new TypeError("Cannot call a class as a function");
11
+ function o(n, t) {
12
+ if (!(n instanceof t)) throw new TypeError("Cannot call a class as a function");
43
13
  }
44
- function k(r, t) {
14
+ function y(n, t) {
45
15
  for (var e = 0; e < t.length; e++) {
46
- var n = t[e];
47
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(r, y(n.key), n);
16
+ var i = t[e];
17
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, v(i.key), i);
48
18
  }
49
19
  }
50
- function N(r, t, e) {
51
- return t && k(r.prototype, t), Object.defineProperty(r, "prototype", { writable: !1 }), r;
20
+ function u(n, t, e) {
21
+ return t && y(n.prototype, t), Object.defineProperty(n, "prototype", { writable: !1 }), n;
52
22
  }
53
- function y(r) {
54
- var t = T(r, "string");
55
- return o(t) == "symbol" ? t : t + "";
23
+ function v(n) {
24
+ var t = P(n, "string");
25
+ return a(t) == "symbol" ? t : t + "";
56
26
  }
57
- function T(r, t) {
58
- if (o(r) != "object" || !r) return r;
59
- var e = r[Symbol.toPrimitive];
27
+ function P(n, t) {
28
+ if (a(n) != "object" || !n) return n;
29
+ var e = n[Symbol.toPrimitive];
60
30
  if (e !== void 0) {
61
- var n = e.call(r, t);
62
- if (o(n) != "object") return n;
31
+ var i = e.call(n, t);
32
+ if (a(i) != "object") return i;
63
33
  throw new TypeError("@@toPrimitive must return a primitive value.");
64
34
  }
65
- return String(r);
35
+ return String(n);
66
36
  }
67
- var U = /* @__PURE__ */ (function() {
68
- function r(t, e, n) {
69
- if (O(this, r), !t)
70
- throw new TypeError("First argument is required");
71
- if (typeof t != "string")
72
- throw new TypeError("First argument must be a string");
73
- if (t[0] === "+" && !e)
74
- throw new TypeError("`metadata` argument not passed");
75
- if (s(e) && s(e.countries)) {
76
- n = e;
77
- var i = t;
78
- if (!_.test(i))
79
- throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');
80
- var u = C(i, void 0, void 0, void 0, n), m = u.countryCallingCode, p = u.number;
81
- if (e = p, t = m, !e)
82
- throw new Error("Invalid `number` argument passed: too short");
83
- }
84
- if (!e)
85
- throw new TypeError("`nationalNumber` argument is required");
86
- if (typeof e != "string")
87
- throw new TypeError("`nationalNumber` argument must be a string");
88
- h(n);
89
- var a = S(t, n), b = a.country, g = a.countryCallingCode;
90
- this.country = b, this.countryCallingCode = g, this.nationalNumber = e, this.number = "+" + this.countryCallingCode + this.nationalNumber, this.getMetadata = function() {
91
- return n;
92
- };
37
+ var d = "1.2.0", p = "1.7.35", h = " ext. ", C = /^\d+$/, b = /* @__PURE__ */ (function() {
38
+ function n(t) {
39
+ o(this, n), _(t), this.metadata = t, m.call(this, t);
93
40
  }
94
- return N(r, [{
95
- key: "setExt",
41
+ return u(n, [{
42
+ key: "getCountries",
43
+ value: function() {
44
+ return Object.keys(this.metadata.countries).filter(function(e) {
45
+ return e !== "001";
46
+ });
47
+ }
48
+ }, {
49
+ key: "getCountryMetadata",
50
+ value: function(e) {
51
+ return this.metadata.countries[e];
52
+ }
53
+ }, {
54
+ key: "nonGeographic",
55
+ value: function() {
56
+ if (!(this.v1 || this.v2 || this.v3))
57
+ return this.metadata.nonGeographic || this.metadata.nonGeographical;
58
+ }
59
+ }, {
60
+ key: "hasCountry",
61
+ value: function(e) {
62
+ return this.getCountryMetadata(e) !== void 0;
63
+ }
64
+ }, {
65
+ key: "hasCallingCode",
66
+ value: function(e) {
67
+ if (this.getCountryCodesForCallingCode(e))
68
+ return !0;
69
+ if (this.nonGeographic()) {
70
+ if (this.nonGeographic()[e])
71
+ return !0;
72
+ } else {
73
+ var i = this.countryCallingCodes()[e];
74
+ if (i && i.length === 1 && i[0] === "001")
75
+ return !0;
76
+ }
77
+ }
78
+ }, {
79
+ key: "isNonGeographicCallingCode",
96
80
  value: function(e) {
97
- this.ext = e;
81
+ return this.nonGeographic() ? !!this.nonGeographic()[e] : !this.getCountryCodesForCallingCode(e);
82
+ }
83
+ // Deprecated.
84
+ }, {
85
+ key: "country",
86
+ value: function(e) {
87
+ return this.selectNumberingPlan(e);
88
+ }
89
+ }, {
90
+ key: "selectNumberingPlan",
91
+ value: function(e, i) {
92
+ if (e && C.test(e) && (i = e, e = null), e && e !== "001") {
93
+ if (!this.hasCountry(e))
94
+ throw new Error("Unknown country: ".concat(e));
95
+ this.numberingPlan = new g(this.getCountryMetadata(e), this);
96
+ } else if (i) {
97
+ if (!this.hasCallingCode(i))
98
+ throw new Error("Unknown calling code: ".concat(i));
99
+ this.numberingPlan = new g(this.getNumberingPlanMetadata(i), this);
100
+ } else
101
+ this.numberingPlan = void 0;
102
+ return this;
103
+ }
104
+ }, {
105
+ key: "getCountryCodesForCallingCode",
106
+ value: function(e) {
107
+ var i = this.countryCallingCodes()[e];
108
+ if (i)
109
+ return i.length === 1 && i[0].length === 3 ? void 0 : i;
110
+ }
111
+ }, {
112
+ key: "getCountryCodeForCallingCode",
113
+ value: function(e) {
114
+ var i = this.getCountryCodesForCallingCode(e);
115
+ if (i)
116
+ return i[0];
117
+ }
118
+ }, {
119
+ key: "getNumberingPlanMetadata",
120
+ value: function(e) {
121
+ var i = this.getCountryCodeForCallingCode(e);
122
+ if (i)
123
+ return this.getCountryMetadata(i);
124
+ if (this.nonGeographic()) {
125
+ var r = this.nonGeographic()[e];
126
+ if (r)
127
+ return r;
128
+ } else {
129
+ var s = this.countryCallingCodes()[e];
130
+ if (s && s.length === 1 && s[0] === "001")
131
+ return this.metadata.countries["001"];
132
+ }
133
+ }
134
+ // Deprecated.
135
+ }, {
136
+ key: "countryCallingCode",
137
+ value: function() {
138
+ return this.numberingPlan.callingCode();
139
+ }
140
+ // Deprecated.
141
+ }, {
142
+ key: "IDDPrefix",
143
+ value: function() {
144
+ return this.numberingPlan.IDDPrefix();
145
+ }
146
+ // Deprecated.
147
+ }, {
148
+ key: "defaultIDDPrefix",
149
+ value: function() {
150
+ return this.numberingPlan.defaultIDDPrefix();
151
+ }
152
+ // Deprecated.
153
+ }, {
154
+ key: "nationalNumberPattern",
155
+ value: function() {
156
+ return this.numberingPlan.nationalNumberPattern();
157
+ }
158
+ // Deprecated.
159
+ }, {
160
+ key: "possibleLengths",
161
+ value: function() {
162
+ return this.numberingPlan.possibleLengths();
98
163
  }
164
+ // Deprecated.
99
165
  }, {
100
- key: "getPossibleCountries",
166
+ key: "formats",
101
167
  value: function() {
102
- return this.country ? [this.country] : P(this.countryCallingCode, this.nationalNumber, this.getMetadata());
168
+ return this.numberingPlan.formats();
103
169
  }
170
+ // Deprecated.
104
171
  }, {
105
- key: "isPossible",
172
+ key: "nationalPrefixForParsing",
106
173
  value: function() {
107
- return d(this, {
108
- v2: !0
109
- }, this.getMetadata());
174
+ return this.numberingPlan.nationalPrefixForParsing();
110
175
  }
176
+ // Deprecated.
111
177
  }, {
112
- key: "isValid",
178
+ key: "nationalPrefixTransformRule",
113
179
  value: function() {
114
- return v(this, {
115
- v2: !0
116
- }, this.getMetadata());
180
+ return this.numberingPlan.nationalPrefixTransformRule();
117
181
  }
182
+ // Deprecated.
118
183
  }, {
119
- key: "isNonGeographic",
184
+ key: "leadingDigits",
120
185
  value: function() {
121
- var e = new l(this.getMetadata());
122
- return e.isNonGeographicCallingCode(this.countryCallingCode);
186
+ return this.numberingPlan.leadingDigits();
123
187
  }
188
+ // Deprecated.
124
189
  }, {
125
- key: "isEqual",
190
+ key: "hasTypes",
191
+ value: function() {
192
+ return this.numberingPlan.hasTypes();
193
+ }
194
+ // Deprecated.
195
+ }, {
196
+ key: "type",
126
197
  value: function(e) {
127
- return this.number === e.number && this.ext === e.ext;
128
- }
129
- // This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,
130
- // but later it was found out that it doesn't include the possible `TOO_SHORT` result
131
- // returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,
132
- // so eventually I simply commented out this method from the `PhoneNumber` class
133
- // and just left the `validatePhoneNumberLength()` function, even though that one would require
134
- // and additional step to also validate the actual country / calling code of the phone number.
135
- // validateLength() {
136
- // const metadata = new Metadata(this.getMetadata())
137
- // metadata.selectNumberingPlan(this.countryCallingCode)
138
- // const result = checkNumberLength(this.nationalNumber, metadata)
139
- // if (result !== 'IS_POSSIBLE') {
140
- // return result
141
- // }
142
- // }
143
- }, {
144
- key: "getType",
145
- value: function() {
146
- return w(this, {
147
- v2: !0
148
- }, this.getMetadata());
198
+ return this.numberingPlan.type(e);
149
199
  }
200
+ // Deprecated.
150
201
  }, {
151
- key: "format",
152
- value: function(e, n) {
153
- return E(this, e, n ? c(c({}, n), {}, {
154
- v2: !0
155
- }) : {
156
- v2: !0
157
- }, this.getMetadata());
202
+ key: "ext",
203
+ value: function() {
204
+ return this.numberingPlan.ext();
158
205
  }
159
206
  }, {
160
- key: "formatNational",
207
+ key: "countryCallingCodes",
208
+ value: function() {
209
+ return this.v1 ? this.metadata.country_phone_code_to_countries : this.metadata.country_calling_codes;
210
+ }
211
+ // Deprecated.
212
+ }, {
213
+ key: "chooseCountryByCountryCallingCode",
161
214
  value: function(e) {
162
- return this.format("NATIONAL", e);
215
+ return this.selectNumberingPlan(e);
163
216
  }
164
217
  }, {
165
- key: "formatInternational",
218
+ key: "hasSelectedNumberingPlan",
219
+ value: function() {
220
+ return this.numberingPlan !== void 0;
221
+ }
222
+ }]);
223
+ })(), g = /* @__PURE__ */ (function() {
224
+ function n(t, e) {
225
+ o(this, n), this.globalMetadataObject = e, this.metadata = t, m.call(this, e.metadata);
226
+ }
227
+ return u(n, [{
228
+ key: "callingCode",
229
+ value: function() {
230
+ return this.metadata[0];
231
+ }
232
+ // Formatting information for regions which share
233
+ // a country calling code is contained by only one region
234
+ // for performance reasons. For example, for NANPA region
235
+ // ("North American Numbering Plan Administration",
236
+ // which includes USA, Canada, Cayman Islands, Bahamas, etc)
237
+ // it will be contained in the metadata for `US`.
238
+ }, {
239
+ key: "getDefaultCountryMetadataForRegion",
240
+ value: function() {
241
+ return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
242
+ }
243
+ // Is always present.
244
+ }, {
245
+ key: "IDDPrefix",
246
+ value: function() {
247
+ if (!(this.v1 || this.v2))
248
+ return this.metadata[1];
249
+ }
250
+ // Is only present when a country supports multiple IDD prefixes.
251
+ }, {
252
+ key: "defaultIDDPrefix",
253
+ value: function() {
254
+ if (!(this.v1 || this.v2))
255
+ return this.metadata[12];
256
+ }
257
+ }, {
258
+ key: "nationalNumberPattern",
259
+ value: function() {
260
+ return this.v1 || this.v2 ? this.metadata[1] : this.metadata[2];
261
+ }
262
+ // "possible length" data is always present in Google's metadata.
263
+ }, {
264
+ key: "possibleLengths",
265
+ value: function() {
266
+ if (!this.v1)
267
+ return this.metadata[this.v2 ? 2 : 3];
268
+ }
269
+ }, {
270
+ key: "_getFormats",
166
271
  value: function(e) {
167
- return this.format("INTERNATIONAL", e);
272
+ return e[this.v1 ? 2 : this.v2 ? 3 : 4];
273
+ }
274
+ // For countries of the same region (e.g. NANPA)
275
+ // formats are all stored in the "main" country for that region.
276
+ // E.g. "RU" and "KZ", "US" and "CA".
277
+ }, {
278
+ key: "formats",
279
+ value: function() {
280
+ var e = this, i = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
281
+ return i.map(function(r) {
282
+ return new F(r, e);
283
+ });
284
+ }
285
+ }, {
286
+ key: "nationalPrefix",
287
+ value: function() {
288
+ return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
168
289
  }
169
290
  }, {
170
- key: "getURI",
291
+ key: "_getNationalPrefixFormattingRule",
171
292
  value: function(e) {
172
- return this.format("RFC3966", e);
293
+ return e[this.v1 ? 4 : this.v2 ? 5 : 6];
294
+ }
295
+ // For countries of the same region (e.g. NANPA)
296
+ // national prefix formatting rule is stored in the "main" country for that region.
297
+ // E.g. "RU" and "KZ", "US" and "CA".
298
+ }, {
299
+ key: "nationalPrefixFormattingRule",
300
+ value: function() {
301
+ return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
302
+ }
303
+ }, {
304
+ key: "_nationalPrefixForParsing",
305
+ value: function() {
306
+ return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
307
+ }
308
+ }, {
309
+ key: "nationalPrefixForParsing",
310
+ value: function() {
311
+ return this._nationalPrefixForParsing() || this.nationalPrefix();
312
+ }
313
+ }, {
314
+ key: "nationalPrefixTransformRule",
315
+ value: function() {
316
+ return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
317
+ }
318
+ }, {
319
+ key: "_getNationalPrefixIsOptionalWhenFormatting",
320
+ value: function() {
321
+ return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
322
+ }
323
+ // For countries of the same region (e.g. NANPA)
324
+ // "national prefix is optional when formatting" flag is
325
+ // stored in the "main" country for that region.
326
+ // E.g. "RU" and "KZ", "US" and "CA".
327
+ }, {
328
+ key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
329
+ value: function() {
330
+ return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
331
+ }
332
+ }, {
333
+ key: "leadingDigits",
334
+ value: function() {
335
+ return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
336
+ }
337
+ }, {
338
+ key: "types",
339
+ value: function() {
340
+ return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
341
+ }
342
+ }, {
343
+ key: "hasTypes",
344
+ value: function() {
345
+ return this.types() && this.types().length === 0 ? !1 : !!this.types();
346
+ }
347
+ }, {
348
+ key: "type",
349
+ value: function(e) {
350
+ if (this.hasTypes() && c(this.types(), e))
351
+ return new x(c(this.types(), e), this);
352
+ }
353
+ }, {
354
+ key: "ext",
355
+ value: function() {
356
+ return this.v1 || this.v2 ? h : this.metadata[13] || h;
357
+ }
358
+ }]);
359
+ })(), F = /* @__PURE__ */ (function() {
360
+ function n(t, e) {
361
+ o(this, n), this._format = t, this.metadata = e;
362
+ }
363
+ return u(n, [{
364
+ key: "pattern",
365
+ value: function() {
366
+ return this._format[0];
367
+ }
368
+ }, {
369
+ key: "format",
370
+ value: function() {
371
+ return this._format[1];
372
+ }
373
+ }, {
374
+ key: "leadingDigitsPatterns",
375
+ value: function() {
376
+ return this._format[2] || [];
377
+ }
378
+ }, {
379
+ key: "nationalPrefixFormattingRule",
380
+ value: function() {
381
+ return this._format[3] || this.metadata.nationalPrefixFormattingRule();
382
+ }
383
+ }, {
384
+ key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
385
+ value: function() {
386
+ return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
387
+ }
388
+ }, {
389
+ key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
390
+ value: function() {
391
+ return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
392
+ }
393
+ // Checks whether national prefix formatting rule contains national prefix.
394
+ }, {
395
+ key: "usesNationalPrefix",
396
+ value: function() {
397
+ return !!(this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
398
+ !k.test(this.nationalPrefixFormattingRule()));
399
+ }
400
+ }, {
401
+ key: "internationalFormat",
402
+ value: function() {
403
+ return this._format[5] || this.format();
173
404
  }
174
405
  }]);
175
- })(), M = function(t) {
176
- return /^[A-Z]{2}$/.test(t);
406
+ })(), k = /^\(?\$1\)?$/, x = /* @__PURE__ */ (function() {
407
+ function n(t, e) {
408
+ o(this, n), this.type = t, this.metadata = e;
409
+ }
410
+ return u(n, [{
411
+ key: "pattern",
412
+ value: function() {
413
+ return this.metadata.v1 ? this.type : this.type[0];
414
+ }
415
+ }, {
416
+ key: "possibleLengths",
417
+ value: function() {
418
+ if (!this.metadata.v1)
419
+ return this.type[1] || this.metadata.possibleLengths();
420
+ }
421
+ }]);
422
+ })();
423
+ function c(n, t) {
424
+ switch (t) {
425
+ case "FIXED_LINE":
426
+ return n[0];
427
+ case "MOBILE":
428
+ return n[1];
429
+ case "TOLL_FREE":
430
+ return n[2];
431
+ case "PREMIUM_RATE":
432
+ return n[3];
433
+ case "PERSONAL_NUMBER":
434
+ return n[4];
435
+ case "VOICEMAIL":
436
+ return n[5];
437
+ case "UAN":
438
+ return n[6];
439
+ case "PAGER":
440
+ return n[7];
441
+ case "VOIP":
442
+ return n[8];
443
+ case "SHARED_COST":
444
+ return n[9];
445
+ }
446
+ }
447
+ function _(n) {
448
+ if (!n)
449
+ throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");
450
+ if (!l(n) || !l(n.countries))
451
+ throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(l(n) ? "an object of shape: { " + Object.keys(n).join(", ") + " }" : "a " + N(n) + ": " + n, "."));
452
+ }
453
+ var N = function(t) {
454
+ return a(t);
177
455
  };
178
- function S(r, t) {
179
- var e, n, i = new l(t);
180
- return M(r) ? (e = r, i.selectNumberingPlan(e), n = i.countryCallingCode()) : n = r, {
181
- country: e,
182
- countryCallingCode: n
183
- };
456
+ function R(n, t) {
457
+ if (t = new b(t), t.hasCountry(n))
458
+ return t.selectNumberingPlan(n).countryCallingCode();
459
+ throw new Error("Unknown country: ".concat(n));
460
+ }
461
+ function m(n) {
462
+ var t = n.version;
463
+ typeof t == "number" ? (this.v1 = t === 1, this.v2 = t === 2, this.v3 = t === 3, this.v4 = t === 4) : t ? f(t, d) === -1 ? this.v2 = !0 : f(t, p) === -1 ? this.v3 = !0 : this.v4 = !0 : this.v1 = !0;
184
464
  }
185
- var _ = /^\+\d+$/;
186
465
  export {
187
- U as default
466
+ b as default,
467
+ R as getCountryCallingCode,
468
+ _ as validateMetadata
188
469
  };
189
470
  //# sourceMappingURL=index167.js.map