libphonenumber-js 1.13.2 → 1.13.4

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 (233) hide show
  1. package/.gitlab-ci.yml +24 -9
  2. package/CHANGELOG.md +15 -2
  3. package/README.md +29 -21
  4. package/build/AsYouType.js +100 -27
  5. package/build/AsYouType.js.map +1 -1
  6. package/build/AsYouType.test.js.map +1 -1
  7. package/build/AsYouTypeFormatter.complete.js +2 -2
  8. package/build/AsYouTypeFormatter.complete.js.map +1 -1
  9. package/build/AsYouTypeFormatter.js +1 -1
  10. package/build/AsYouTypeFormatter.js.map +1 -1
  11. package/build/AsYouTypeState.js +15 -1
  12. package/build/AsYouTypeState.js.map +1 -1
  13. package/build/PhoneNumber.js +26 -39
  14. package/build/PhoneNumber.js.map +1 -1
  15. package/build/format.js +3 -3
  16. package/build/format.js.map +1 -1
  17. package/build/formatPhoneNumberForMobileDialing.js +4 -3
  18. package/build/formatPhoneNumberForMobileDialing.js.map +1 -1
  19. package/build/helpers/checkNumberLength.js +21 -6
  20. package/build/helpers/checkNumberLength.js.map +1 -1
  21. package/build/helpers/checkNumberLength.test.js.map +1 -1
  22. package/build/helpers/extractCountryCallingCode.js +16 -11
  23. package/build/helpers/extractCountryCallingCode.js.map +1 -1
  24. package/build/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +21 -10
  25. package/build/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
  26. package/build/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.test.js.map +1 -0
  27. package/build/helpers/extractNationalNumber.js +12 -3
  28. package/build/helpers/extractNationalNumber.js.map +1 -1
  29. package/build/helpers/extractNationalNumber.test.js.map +1 -1
  30. package/build/helpers/getCountryAndCallingCodeFromOneOfThem.js +35 -0
  31. package/build/helpers/getCountryAndCallingCodeFromOneOfThem.js.map +1 -0
  32. package/build/helpers/getCountryByCallingCode.js +10 -7
  33. package/build/helpers/getCountryByCallingCode.js.map +1 -1
  34. package/build/helpers/getCountryByNationalNumber.js +13 -9
  35. package/build/helpers/getCountryByNationalNumber.js.map +1 -1
  36. package/build/helpers/getIddPrefix.js +1 -1
  37. package/build/helpers/getIddPrefix.js.map +1 -1
  38. package/build/helpers/getNumberType.js +3 -3
  39. package/build/helpers/getNumberType.js.map +1 -1
  40. package/build/helpers/getPossibleCountriesForNumber.js +4 -7
  41. package/build/helpers/getPossibleCountriesForNumber.js.map +1 -1
  42. package/build/helpers/isCallingCode.js +11 -0
  43. package/build/helpers/isCallingCode.js.map +1 -0
  44. package/build/helpers/isCallingCode.test.js.map +1 -0
  45. package/build/helpers/isCountryCode.js +11 -0
  46. package/build/helpers/isCountryCode.js.map +1 -0
  47. package/build/helpers/isCountryCode.test.js.map +1 -0
  48. package/build/helpers/stripIddPrefix.js +9 -4
  49. package/build/helpers/stripIddPrefix.js.map +1 -1
  50. package/build/isPossible.js +14 -8
  51. package/build/isPossible.js.map +1 -1
  52. package/build/isValid.js +3 -3
  53. package/build/isValid.js.map +1 -1
  54. package/build/metadata.js +80 -31
  55. package/build/metadata.js.map +1 -1
  56. package/build/metadata.test.js.map +1 -1
  57. package/build/parse.js +36 -12
  58. package/build/parse.js.map +1 -1
  59. package/build/validatePhoneNumberLength.js +3 -3
  60. package/build/validatePhoneNumberLength.js.map +1 -1
  61. package/bundle/libphonenumber-js.min.js +1 -1
  62. package/bundle/libphonenumber-js.min.js.map +1 -1
  63. package/bundle/libphonenumber-max.js +1 -1
  64. package/bundle/libphonenumber-max.js.map +1 -1
  65. package/bundle/libphonenumber-min.js +1 -1
  66. package/bundle/libphonenumber-min.js.map +1 -1
  67. package/bundle/libphonenumber-mobile.js +1 -1
  68. package/bundle/libphonenumber-mobile.js.map +1 -1
  69. package/core/index.d.cts +1 -0
  70. package/core/index.d.ts +1 -0
  71. package/custom.d.ts +3 -1
  72. package/es6/AsYouType.js +100 -27
  73. package/es6/AsYouType.js.map +1 -1
  74. package/es6/AsYouType.test.js.map +1 -1
  75. package/es6/AsYouTypeFormatter.complete.js +2 -2
  76. package/es6/AsYouTypeFormatter.complete.js.map +1 -1
  77. package/es6/AsYouTypeFormatter.js +1 -1
  78. package/es6/AsYouTypeFormatter.js.map +1 -1
  79. package/es6/AsYouTypeState.js +15 -1
  80. package/es6/AsYouTypeState.js.map +1 -1
  81. package/es6/PhoneNumber.js +26 -39
  82. package/es6/PhoneNumber.js.map +1 -1
  83. package/es6/format.js +3 -3
  84. package/es6/format.js.map +1 -1
  85. package/es6/formatPhoneNumberForMobileDialing.js +4 -3
  86. package/es6/formatPhoneNumberForMobileDialing.js.map +1 -1
  87. package/es6/helpers/checkNumberLength.js +22 -6
  88. package/es6/helpers/checkNumberLength.js.map +1 -1
  89. package/es6/helpers/checkNumberLength.test.js.map +1 -1
  90. package/es6/helpers/extractCountryCallingCode.js +16 -11
  91. package/es6/helpers/extractCountryCallingCode.js.map +1 -1
  92. package/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +21 -10
  93. package/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
  94. package/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.test.js.map +1 -0
  95. package/es6/helpers/extractNationalNumber.js +12 -3
  96. package/es6/helpers/extractNationalNumber.js.map +1 -1
  97. package/es6/helpers/extractNationalNumber.test.js.map +1 -1
  98. package/es6/helpers/getCountryAndCallingCodeFromOneOfThem.js +28 -0
  99. package/es6/helpers/getCountryAndCallingCodeFromOneOfThem.js.map +1 -0
  100. package/es6/helpers/getCountryByCallingCode.js +10 -7
  101. package/es6/helpers/getCountryByCallingCode.js.map +1 -1
  102. package/es6/helpers/getCountryByNationalNumber.js +13 -9
  103. package/es6/helpers/getCountryByNationalNumber.js.map +1 -1
  104. package/es6/helpers/getIddPrefix.js +1 -1
  105. package/es6/helpers/getIddPrefix.js.map +1 -1
  106. package/es6/helpers/getNumberType.js +3 -3
  107. package/es6/helpers/getNumberType.js.map +1 -1
  108. package/es6/helpers/getPossibleCountriesForNumber.js +4 -7
  109. package/es6/helpers/getPossibleCountriesForNumber.js.map +1 -1
  110. package/es6/helpers/isCallingCode.js +5 -0
  111. package/es6/helpers/isCallingCode.js.map +1 -0
  112. package/es6/helpers/isCallingCode.test.js.map +1 -0
  113. package/es6/helpers/isCountryCode.js +5 -0
  114. package/es6/helpers/isCountryCode.js.map +1 -0
  115. package/es6/helpers/isCountryCode.test.js.map +1 -0
  116. package/es6/helpers/stripIddPrefix.js +9 -4
  117. package/es6/helpers/stripIddPrefix.js.map +1 -1
  118. package/es6/isPossible.js +14 -8
  119. package/es6/isPossible.js.map +1 -1
  120. package/es6/isValid.js +3 -3
  121. package/es6/isValid.js.map +1 -1
  122. package/es6/metadata.js +80 -31
  123. package/es6/metadata.js.map +1 -1
  124. package/es6/metadata.test.js.map +1 -1
  125. package/es6/parse.js +36 -12
  126. package/es6/parse.js.map +1 -1
  127. package/es6/validatePhoneNumberLength.js +3 -3
  128. package/es6/validatePhoneNumberLength.js.map +1 -1
  129. package/es6-modern/AsYouType.js +100 -26
  130. package/es6-modern/AsYouType.js.map +1 -1
  131. package/es6-modern/AsYouType.test.js.map +1 -1
  132. package/es6-modern/AsYouTypeFormatter.complete.js +2 -2
  133. package/es6-modern/AsYouTypeFormatter.complete.js.map +1 -1
  134. package/es6-modern/AsYouTypeFormatter.js +1 -1
  135. package/es6-modern/AsYouTypeFormatter.js.map +1 -1
  136. package/es6-modern/AsYouTypeState.js +15 -1
  137. package/es6-modern/AsYouTypeState.js.map +1 -1
  138. package/es6-modern/PhoneNumber.js +25 -36
  139. package/es6-modern/PhoneNumber.js.map +1 -1
  140. package/es6-modern/format.js +3 -3
  141. package/es6-modern/format.js.map +1 -1
  142. package/es6-modern/formatPhoneNumberForMobileDialing.js +4 -3
  143. package/es6-modern/formatPhoneNumberForMobileDialing.js.map +1 -1
  144. package/es6-modern/helpers/checkNumberLength.js +22 -6
  145. package/es6-modern/helpers/checkNumberLength.js.map +1 -1
  146. package/es6-modern/helpers/checkNumberLength.test.js.map +1 -1
  147. package/es6-modern/helpers/extractCountryCallingCode.js +16 -11
  148. package/es6-modern/helpers/extractCountryCallingCode.js.map +1 -1
  149. package/es6-modern/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +21 -10
  150. package/es6-modern/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map +1 -1
  151. package/es6-modern/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.test.js.map +1 -0
  152. package/es6-modern/helpers/extractNationalNumber.js +12 -3
  153. package/es6-modern/helpers/extractNationalNumber.js.map +1 -1
  154. package/es6-modern/helpers/extractNationalNumber.test.js.map +1 -1
  155. package/es6-modern/helpers/getCountryAndCallingCodeFromOneOfThem.js +28 -0
  156. package/es6-modern/helpers/getCountryAndCallingCodeFromOneOfThem.js.map +1 -0
  157. package/es6-modern/helpers/getCountryByCallingCode.js +10 -7
  158. package/es6-modern/helpers/getCountryByCallingCode.js.map +1 -1
  159. package/es6-modern/helpers/getCountryByNationalNumber.js +13 -10
  160. package/es6-modern/helpers/getCountryByNationalNumber.js.map +1 -1
  161. package/es6-modern/helpers/getIddPrefix.js +1 -1
  162. package/es6-modern/helpers/getIddPrefix.js.map +1 -1
  163. package/es6-modern/helpers/getNumberType.js +3 -3
  164. package/es6-modern/helpers/getNumberType.js.map +1 -1
  165. package/es6-modern/helpers/getPossibleCountriesForNumber.js +4 -7
  166. package/es6-modern/helpers/getPossibleCountriesForNumber.js.map +1 -1
  167. package/es6-modern/helpers/isCallingCode.js +5 -0
  168. package/es6-modern/helpers/isCallingCode.js.map +1 -0
  169. package/es6-modern/helpers/isCallingCode.test.js.map +1 -0
  170. package/es6-modern/helpers/isCountryCode.js +5 -0
  171. package/es6-modern/helpers/isCountryCode.js.map +1 -0
  172. package/es6-modern/helpers/isCountryCode.test.js.map +1 -0
  173. package/es6-modern/helpers/stripIddPrefix.js +9 -4
  174. package/es6-modern/helpers/stripIddPrefix.js.map +1 -1
  175. package/es6-modern/isPossible.js +14 -8
  176. package/es6-modern/isPossible.js.map +1 -1
  177. package/es6-modern/isValid.js +3 -3
  178. package/es6-modern/isValid.js.map +1 -1
  179. package/es6-modern/metadata.js +78 -31
  180. package/es6-modern/metadata.js.map +1 -1
  181. package/es6-modern/metadata.test.js.map +1 -1
  182. package/es6-modern/parse.js +41 -12
  183. package/es6-modern/parse.js.map +1 -1
  184. package/es6-modern/validatePhoneNumberLength.js +3 -3
  185. package/es6-modern/validatePhoneNumberLength.js.map +1 -1
  186. package/index.d.cts +1 -0
  187. package/index.d.ts +1 -0
  188. package/max/index.d.cts +1 -0
  189. package/max/index.d.ts +1 -0
  190. package/max/metadata/metadata.max.json +1 -1
  191. package/max/metadata/metadata.max.json.js +1 -1
  192. package/metadata.full.json +1 -1
  193. package/metadata.full.json.js +1 -1
  194. package/metadata.max.json +1 -1
  195. package/metadata.max.json.js +1 -1
  196. package/metadata.min.json +1 -1
  197. package/metadata.min.json.js +1 -1
  198. package/metadata.mobile.json +1 -1
  199. package/metadata.mobile.json.js +1 -1
  200. package/min/index.d.cts +1 -0
  201. package/min/index.d.ts +1 -0
  202. package/min/metadata/metadata.min.json +1 -1
  203. package/min/metadata/metadata.min.json.js +1 -1
  204. package/mobile/index.d.cts +1 -0
  205. package/mobile/index.d.ts +1 -0
  206. package/mobile/metadata/metadata.mobile.json +1 -1
  207. package/mobile/metadata/metadata.mobile.json.js +1 -1
  208. package/package.json +1 -1
  209. package/source/AsYouType.js +108 -27
  210. package/source/AsYouTypeFormatter.complete.js +2 -2
  211. package/source/AsYouTypeFormatter.js +1 -1
  212. package/source/AsYouTypeState.js +15 -1
  213. package/source/PhoneNumber.js +24 -39
  214. package/source/format.js +3 -3
  215. package/source/formatPhoneNumberForMobileDialing.js +4 -3
  216. package/source/helpers/checkNumberLength.js +21 -6
  217. package/source/helpers/extractCountryCallingCode.js +16 -11
  218. package/source/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +20 -10
  219. package/source/helpers/extractNationalNumber.js +11 -3
  220. package/source/helpers/getCountryAndCallingCodeFromOneOfThem.js +31 -0
  221. package/source/helpers/getCountryByCallingCode.js +10 -7
  222. package/source/helpers/getCountryByNationalNumber.js +14 -11
  223. package/source/helpers/getIddPrefix.js +1 -1
  224. package/source/helpers/getNumberType.js +3 -3
  225. package/source/helpers/getPossibleCountriesForNumber.js +4 -7
  226. package/source/helpers/isCallingCode.js +5 -0
  227. package/source/helpers/isCountryCode.js +5 -0
  228. package/source/helpers/stripIddPrefix.js +10 -4
  229. package/source/isPossible.js +13 -7
  230. package/source/isValid.js +3 -3
  231. package/source/metadata.js +77 -33
  232. package/source/parse.js +41 -11
  233. package/source/validatePhoneNumberLength.js +3 -3
package/.gitlab-ci.yml CHANGED
@@ -1,16 +1,31 @@
1
- image: node:16
1
+ image: node:22
2
2
 
3
3
  pages:
4
4
  script:
5
- - npm install
6
- - npm run metadata:generate
7
- - npm run build
8
- - mv ./bundle ./public
9
- - cp --recursive ./website/* ./public/
5
+ - npm install
6
+ - npm run metadata:generate
7
+ - npm run build
8
+ - mv ./bundle ./public
9
+ - cp --recursive ./website/* ./public/
10
10
 
11
11
  artifacts:
12
12
  paths:
13
- - public
13
+ - public
14
14
 
15
- only:
16
- - master
15
+ # Does not run on schedule
16
+ rules:
17
+ - if: $CI_PIPELINE_SOURCE == "schedule" || $CI_COMMIT_BRANCH != "master"
18
+ when: never # Excludes this job from scheduled pipeline types
19
+ - when: on_success
20
+
21
+ update-metadata:
22
+ script:
23
+ - git checkout master
24
+ - npm install
25
+ - npm run metadata:update:job
26
+
27
+ # Only runs on schedule
28
+ rules:
29
+ - if: $CI_PIPELINE_SOURCE == "schedule" && $TASK_TYPE == "metadata-update"
30
+ when: always
31
+ - when: never # Excludes this job from non-scheduled pipeline types
package/CHANGELOG.md CHANGED
@@ -67,8 +67,21 @@ And edit the README:
67
67
 
68
68
  <!-- This changelog [only](https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/16#note_594165443) mentions the changes in the code. See [Google's changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt) for metadata changes. -->
69
69
 
70
- <!-- CHANGELOG START -->
71
-
70
+ <!-- CHANGELOG START -->
71
+
72
+ 1.13.3 / 22.5.2026
73
+ ===================
74
+
75
+ * Updated metadata to version 9.0.31:
76
+ - Updated alternate formatting data for country calling code(s): 84
77
+ - Updated phone metadata for region code(s):
78
+ AI, BO, DZ, ET, GE, GM, IN, TR, UG, VN
79
+ - Updated short number metadata for region code(s): IT
80
+ - Updated geocoding data for country calling code(s): 213 (en)
81
+ - Updated carrier data for country calling code(s):
82
+ 34 (en), 43 (en), 84 (en), 90 (en), 220 (en), 251 (en), 256 (en), 354 (en),
83
+ 591 (en), 1264 (en)
84
+
72
85
  1.13.0 / 08.05.2026
73
86
  ===================
74
87
 
package/README.md CHANGED
@@ -237,26 +237,17 @@ new AsYouType('US').input('2133734') === '(213) 373-4'
237
237
  Validates a complete phone number.
238
238
 
239
239
  ```js
240
- import {
241
- isPossiblePhoneNumber,
242
- isValidPhoneNumber,
243
- validatePhoneNumberLength
244
- } from 'libphonenumber-js'
240
+ import { isPossiblePhoneNumber, isValidPhoneNumber } from 'libphonenumber-js'
245
241
 
246
242
  isPossiblePhoneNumber('8 (800) 555-35-35', 'RU') === true
247
243
  isValidPhoneNumber('8 (800) 555-35-35', 'RU') === true
248
-
249
- validatePhoneNumberLength('8 (800) 555', 'RU') === 'TOO_SHORT' // Length is invalid
250
- validatePhoneNumberLength('8 (800) 555-35-35', 'RU') === undefined // Length is valid
251
244
  ```
252
245
 
253
246
  `isPossiblePhoneNumber()` validates phone number length.
254
247
 
255
248
  `isValidPhoneNumber()` validates both phone number length and phone number digits.
256
249
 
257
- It may seem counter-intuitive but when [choosing between the two](#using-phone-number-validation-feature), I'd personally prefer `isPossiblePhoneNumber()` because its strength is in its weakness. `isValidPhoneNumber()` is a double-edged sword in terms of how strict it is, and when not updated regularly, it could get stale over time and start rejecting freshly-assigned phone number ranges.
258
-
259
- As for `validatePhoneNumberLength()`, is just a more detailed version of `isPossiblePhoneNumber()` for those who need it — when the phone number length is invalid, instead of returning just `false`, it returns the actual reason why the phone number length is incorrect: `TOO_SHORT`, `TOO_LONG`, etc.
250
+ [Choosing between the two](#using-phone-number-validation-feature): I'd personally prefer `isPossiblePhoneNumber()` because its strength is in its weakness. `isValidPhoneNumber()` is a double-edged sword in terms of how strict it is, and when not kept up-to-date, it could get stale over time and start rejecting freshly-assigned phone number ranges.
260
251
 
261
252
  ### Full-text search
262
253
 
@@ -878,24 +869,37 @@ The same approach could be used to implement an `isPossiblePhoneNumberForCountry
878
869
 
879
870
  ### `validatePhoneNumberLength(input: string, defaultCountry?: string | options?: object): string?`
880
871
 
881
- Checks if `input` phone number length is valid. If it is, then nothing is returned. Otherwise, a rejection reason is returned.
872
+ Checks if `input` phone number length is valid. If it is, nothing is returned. Otherwise, a rejection reason is returned.
882
873
 
883
874
  <details>
884
875
  <summary>Possible rejection reasons</summary>
885
876
 
886
- * `NOT_A_NUMBER` — When the supplied string is not a phone number. For example, when there are no digits: `"abcde"`, `"+"`.
877
+ ######
878
+
879
+ * `NOT_A_NUMBER`
880
+
881
+ * When the supplied string is not even a phone number. For example, when there are no digits at all: `"abcde"`, `"+"`.
887
882
 
888
883
  * `INVALID_COUNTRY`
889
884
 
890
- * When `defaultCountry` doesn't exist (or isn't supported by this library yet): `parsePhoneNumber('(111) 222-3333', 'XX')`.
891
- * When parsing a non-international number without a `defaultCountry`: `parsePhoneNumber('(111) 222-3333')`.
892
- * When an international number's country calling code doesn't exist: `parsePhoneNumber('+9991112223333')`.
885
+ * When the specified `defaultCountry` doesn't exist (or isn't supported by this library yet): `validatePhoneNumberLength('(111) 222-3333', 'XX')`.
886
+ * When passing a non-international number without specifying a `defaultCountry`: `validatePhoneNumberLength('(111) 222-3333')`.
887
+ * When an international number includes a non-existing country calling code: `parsePhoneNumber('+9991112223333')`.
893
888
 
894
- * `TOO_SHORT` — When the number is too short. For example, just 1 or 2 digits: `"1"`, `"+12"`.
889
+ * `TOO_SHORT`
895
890
 
896
- * `TOO_LONG` — When the national (significant) number is too long (17 digits max) or when the string being parsed is too long (250 characters max).
891
+ * When there must be at least 2 national (significant) number digits: `"1"` or `"+12"`.
892
+ * When the national (significant) number of such length doesn't exist (too short): `+1 213 373 42`.
897
893
 
898
- * `INVALID_LENGTH` — When the national (significant) number is neither too short, nor too long, but somewhere in between and its length is still invalid.
894
+ * `TOO_LONG`
895
+
896
+ * When the national (significant) number of such length doesn't exist (too long): `+1 213 373 42 53 00`.
897
+ * When the national (significant) number digits count exceeds the maximum allowed one (17 digits max).
898
+ * When the length of the input string exceeds the maximum allowed one (250 characters max).
899
+
900
+ * `INVALID_LENGTH`
901
+
902
+ * When the national (significant) number of such length doesn't exist and it should've been either shorter or longer (both are possible).
899
903
  </details>
900
904
 
901
905
  ######
@@ -991,6 +995,8 @@ asYouType.getTemplate() === 'xx xxx xxx xxxx'
991
995
 
992
996
  * `isValid(): boolean` — Returns `true` if the phone number is "valid". Is just a shortcut for [`getNumber()?.isValid()`](#isvalid-boolean).
993
997
 
998
+ * `validateLength(): string?` — Validates phone number length. See [`validatePhoneNumberLength()`](#validatephonenumberlengthinput-string-defaultcountry-string--options-object-string).
999
+
994
1000
  <details>
995
1001
  <summary>Legacy API (before version <code>1.6.0</code>)</summary>
996
1002
 
@@ -1984,8 +1990,9 @@ This library reuses Google's metadata. Google periodically publishes a new versi
1984
1990
 
1985
1991
  After Google updates their metadata, this library pulls the updated metadata from Google's repository and publishes a new version of itself on `npm`.
1986
1992
 
1987
- The metadata pulling process is automated through an "autoupdate" script: see `autoupdate.cmd` (Windows) or `autoupdate.sh` (Linux/macOS). The script detects changes to `PhoneNumberMetadata.xml` file in Google `libphonenumber`'s repo and, if there are any changes, it pulls the latest metadata, transforms it, commits the changes to the repository, builds a new version of the package and releases it to `npm`.
1993
+ The metadata pulling process is automated by running `metadata:update:job` npm script. <!-- : see `autoupdate.cmd` (Windows) or `autoupdate.sh` (Linux/macOS). --> The script detects changes to `PhoneNumberMetadata.xml` file in Google `libphonenumber`'s repo and, if there are any changes, it pulls the latest metadata, transforms it, pushes the changes to the repository, builds a new version of the package and publishes it on `npm` using "trusted publishing". The script is run daily via GitLab CI (could be GitHub CI if they weren't [unreliable](#gitHub-repository-status)).
1988
1994
 
1995
+ <!--
1989
1996
  I did manage to set up the autoupdate script to run dialy on my Windows machine in an automatic fashion through "Task Scheduler", but then `npm` started requiring "two-factor authentication" in order to publish a package, which requires human intervention, so currently the autoupdate process is kinda semi-automatic.
1990
1997
 
1991
1998
  <details>
@@ -2026,6 +2033,7 @@ How to [fix](https://stackoverflow.com/questions/370030/why-git-cant-remember-my
2026
2033
  </details>
2027
2034
 
2028
2035
  ######
2036
+ -->
2029
2037
 
2030
2038
  <!-- So currently, I just run the "autoupdate" script manually from time to time. With this workflow, one can see how the metadata could potentially get a bit stale, in which case just ping me to re-run the autoupdate script, assuming I'm still alive and well. -->
2031
2039
 
@@ -2035,7 +2043,7 @@ Also Google sometimes (extremely rarely) updates their code:
2035
2043
  * [`AsYouTypeFormatter.java`](https://github.com/google/libphonenumber/blob/master/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java) — is mirrored as `AsYouType` class
2036
2044
  * [`PhoneNumberMatcher.java`](https://github.com/googlei18n/libphonenumber/blob/master/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java) — is mirrored as `findPhoneNumbersInText()` function
2037
2045
 
2038
- The latest sync-up with Google's code was on Sep 19th, 2025.
2046
+ The latest sync-up with Google's code was on May 25th, 2026.
2039
2047
 
2040
2048
  ## Contributing
2041
2049
 
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  var _metadata = _interopRequireDefault(require("./metadata.js"));
8
8
  var _PhoneNumber = _interopRequireDefault(require("./PhoneNumber.js"));
9
+ var _checkNumberLength = _interopRequireDefault(require("./helpers/checkNumberLength.js"));
9
10
  var _AsYouTypeState = _interopRequireDefault(require("./AsYouTypeState.js"));
10
11
  var _AsYouTypeFormatter = _interopRequireWildcard(require("./AsYouTypeFormatter.js"));
11
12
  var _AsYouTypeParser = _interopRequireWildcard(require("./AsYouTypeParser.js"));
@@ -34,6 +35,9 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
34
35
  */
35
36
  function AsYouType(optionsOrDefaultCountry, metadata) {
36
37
  _classCallCheck(this, AsYouType);
38
+ // Metadata instance is created once and stays constant.
39
+ // This is required because other utility classes such as `AsYouTypeFormatter`
40
+ // will use this metadata instance "reference" and will assume that it stays constant.
37
41
  this.metadata = new _metadata["default"](metadata);
38
42
  var _this$getCountryAndCa = this.getCountryAndCallingCode(optionsOrDefaultCountry),
39
43
  _this$getCountryAndCa2 = _slicedToArray(_this$getCountryAndCa, 2),
@@ -127,7 +131,7 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
127
131
  _this.country = country;
128
132
  },
129
133
  onCallingCodeChange: function onCallingCodeChange(callingCode, country) {
130
- _this.metadata.selectNumberingPlan(country, callingCode);
134
+ _this.metadata.selectNumberingPlan(country || callingCode);
131
135
  _this.formatter.reset(_this.metadata.numberingPlan, _this.state);
132
136
  _this.parser.reset(_this.metadata.numberingPlan);
133
137
  }
@@ -317,10 +321,32 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
317
321
  }, {
318
322
  key: "determineTheCountry",
319
323
  value: function determineTheCountry() {
320
- this.state.setCountry((0, _getCountryByCallingCode["default"])(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
324
+ // Get a more precise country code for this national number.
325
+ // It is possible that the precise country couldn't be determined
326
+ // in cases when there're multiple countries sharing the same calling code.
327
+ // In that case, `country` will be `undefined`.
328
+ var country = (0, _getCountryByCallingCode["default"])(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
321
329
  nationalNumber: this.state.nationalSignificantNumber,
322
330
  metadata: this.metadata
323
- }));
331
+ });
332
+ // If the derived country is indeed more precise,
333
+ // or if no country could be derived for the updated phone number.
334
+ if (country !== this.state.country) {
335
+ // Set (or reset) the more precise country.
336
+ this.state.setCountry(country);
337
+ // If a more precise country could be derived.
338
+ if (country) {
339
+ // Select a more precise telephone numbering plan.
340
+ // For example, consider that `AsYouType` instance was created with `defaultCountry: "US"` argument.
341
+ // In that case, the metadata instance will be using "US" metadata.
342
+ // But then the user could input a Canadian phone number, in which case
343
+ // the metadata instance should be switched to Canadian telephone numbering plan.
344
+ // It is required to do that because later `canFormatCompleteNumber()` function will be called,
345
+ // and that function relies on the precise country being pre-selected in the metadata instance.
346
+ // Or, for example, `checkNumberLength()` function also relies on same thing.
347
+ this.metadata.selectNumberingPlan(country);
348
+ }
349
+ }
324
350
  }
325
351
 
326
352
  /**
@@ -381,18 +407,19 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
381
407
  nationalSignificantNumber = _this$state3.nationalSignificantNumber,
382
408
  carrierCode = _this$state3.carrierCode,
383
409
  callingCode = _this$state3.callingCode;
410
+ if (!nationalSignificantNumber) {
411
+ return;
412
+ }
384
413
 
385
414
  // `this._getCountry()` is basically same as `this.state.country`
386
- // with the only change that it return `undefined` in case of a
415
+ // with the only change that it returns `undefined` in case of a
387
416
  // "non-geographic" numbering plan instead of `"001"` "internal use" value.
388
417
  var country = this._getCountry();
389
- if (!nationalSignificantNumber) {
390
- return;
391
- }
392
418
 
393
- // `state.country` and `state.callingCode` aren't required to be in sync.
394
- // For example, `country` could be `"AR"` and `callingCode` could be `undefined`.
395
- // So `country` and `callingCode` are totally independent.
419
+ // Sidenote:
420
+ // `state.callingCode` and `state.country` are somewhat independent from one another
421
+ // and there could be situations when one is defined but the other is not.
422
+ // See the comment in `AsYouTypeState.js` for more info on when that is possible.
396
423
 
397
424
  if (!country && !callingCode) {
398
425
  return;
@@ -408,26 +435,32 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
408
435
  //
409
436
  // Because `AsYouType.getNumber()` method is supposed to be a 1:1
410
437
  // equivalent for `parsePhoneNumber(AsYouType.getNumberValue())`,
411
- // then it should also behave accordingly in cases of `country` ambiguity.
438
+ // it means that it should also behave accordingly in such cases of `country` ambiguity.
412
439
  // That's how users of this library would expect it to behave anyway.
413
440
  //
441
+ // So here it checks if `state.country` is same as the `defaultCountry`,
442
+ // and if it is, it attempts to get rid of any potential ambiguity.
443
+ //
414
444
  if (country) {
415
445
  if (country === this.defaultCountry) {
416
- // `state.country` and `state.callingCode` aren't required to be in sync.
417
- // For example, `state.country` could be `"AR"` and `state.callingCode` could be `undefined`.
418
- // So `state.country` and `state.callingCode` are totally independent.
419
- var metadata = new _metadata["default"](this.metadata.metadata);
420
- metadata.selectNumberingPlan(country);
421
- var _callingCode = metadata.numberingPlan.callingCode();
422
- var ambiguousCountries = this.metadata.getCountryCodesForCallingCode(_callingCode);
423
- if (ambiguousCountries.length > 1) {
424
- var exactCountry = (0, _getCountryByNationalNumber["default"])(nationalSignificantNumber, {
425
- countries: ambiguousCountries,
426
- metadata: this.metadata.metadata
427
- });
428
- if (exactCountry) {
429
- country = exactCountry;
430
- }
446
+ // // Create a `Metadata` instance just to get the calling code of the `country`.
447
+ // const metadata = new Metadata(this.metadata.metadata)
448
+ // // `state.callingCode` and `state.country` are somewhat independent from one another
449
+ // // and there could be situations when one is defined but the other is not.
450
+ // // See the comment in `AsYouTypeState.js` for more info on when that is possible.
451
+ // // Here, it only passes `state.country` because there's no need to pass `state.callingCode`
452
+ // // because `state.country` is known to be defined.
453
+ // metadata.selectNumberingPlan(country)
454
+ // const countryCallingCode = metadata.numberingPlan.callingCode()
455
+
456
+ // Instead of getting `countryCallingCode` value above,
457
+ // it could simply read it from the existing metadata instance.
458
+ var countryCallingCode = this.metadata.numberingPlan.callingCode();
459
+
460
+ // Attempt to rule out any potential country code ambiguity, if present.
461
+ var exactCountry = getExactCountryForMultiCountryCallingCode(countryCallingCode, nationalSignificantNumber, this.metadata);
462
+ if (exactCountry) {
463
+ country = exactCountry;
431
464
  }
432
465
  }
433
466
  }
@@ -469,6 +502,39 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
469
502
  return phoneNumber.isValid();
470
503
  }
471
504
 
505
+ /**
506
+ * Checks if the phone number length is valid.
507
+ * If it is, nothing is returned.
508
+ * Otherwise, a rejection reason is returned.
509
+ * @return {string?}
510
+ */
511
+ }, {
512
+ key: "validateLength",
513
+ value: function validateLength() {
514
+ var _this$state4 = this.state,
515
+ digits = _this$state4.digits,
516
+ nationalSignificantNumber = _this$state4.nationalSignificantNumber;
517
+ if (!digits) {
518
+ return 'NOT_A_NUMBER';
519
+ }
520
+ if (!this.metadata.numberingPlan) {
521
+ return 'INVALID_COUNTRY';
522
+ }
523
+ if (!nationalSignificantNumber) {
524
+ return 'TOO_SHORT';
525
+ }
526
+
527
+ // `state.callingCode` and `state.country` are somewhat independent from one another
528
+ // and there could be situations when one is defined but the other is not.
529
+ // See the comment in `AsYouTypeState.js` for more info on when that is possible.
530
+ // Here, it uses both: if `country` is defined then it will use that,
531
+ // otherwise it will use `callingCode`.
532
+ var result = (0, _checkNumberLength["default"])(nationalSignificantNumber, undefined, this.metadata);
533
+ if (result !== 'IS_POSSIBLE') {
534
+ return result;
535
+ }
536
+ }
537
+
472
538
  /**
473
539
  * @deprecated
474
540
  * This method is used in `react-phone-number-input/source/input-control.js`
@@ -500,5 +566,12 @@ var AsYouType = exports["default"] = /*#__PURE__*/function () {
500
566
  return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || '';
501
567
  }
502
568
  }]);
503
- }();
569
+ }(); // In situations when multiple countries use the same calling code,
570
+ // this function tells what exact country does a given national (significant) number belong to.
571
+ function getExactCountryForMultiCountryCallingCode(callingCode, nationalSignificantNumber, metadata) {
572
+ var ambiguousCountries = metadata.getCountryCodesForCallingCode(callingCode);
573
+ if (ambiguousCountries.length > 1) {
574
+ return (0, _getCountryByNationalNumber["default"])(nationalSignificantNumber, ambiguousCountries, metadata.metadata);
575
+ }
576
+ }
504
577
  //# sourceMappingURL=AsYouType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsYouType.js","names":["_metadata","_interopRequireDefault","require","_PhoneNumber","_AsYouTypeState","_AsYouTypeFormatter","_interopRequireWildcard","_AsYouTypeParser","_getCountryByCallingCode","_getCountryByNationalNumber","_isObject","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Symbol","iterator","constructor","prototype","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","toString","slice","name","Array","from","test","length","l","u","next","done","push","value","isArray","_classCallCheck","_defineProperties","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","String","Number","USE_NON_GEOGRAPHIC_COUNTRY_CODE","AsYouType","exports","optionsOrDefaultCountry","metadata","Metadata","_this$getCountryAndCa","getCountryAndCallingCode","_this$getCountryAndCa2","defaultCountry","defaultCallingCode","reset","isObject","hasCountry","undefined","isNonGeographicCallingCode","input","text","_this$parser$input","parser","state","digits","justLeadingPlus","formattedOutput","determineTheCountryIfNeeded","nationalSignificantNumber","formatter","narrowDownMatchingFormats","formattedNationalNumber","hasSelectedNumberingPlan","format","reExtractNationalSignificantNumber","nationalDigits","getNationalDigits","getFullNumber","getNonFormattedNumber","_this","AsYouTypeState","onCountryChange","country","onCallingCodeChange","callingCode","selectNumberingPlan","numberingPlan","AsYouTypeFormatter","AsYouTypeParser","onNationalSignificantNumberChange","isInternational","international","getCallingCode","getCountryCallingCode","getCountry","_getCountry","isCountryCallingCodeAmbiguous","determineTheCountry","_this2","prefix","getInternationalPrefixBeforeCountryCallingCode","spacing","concat","getDigitsWithoutInternationalPrefix","getNonFormattedNationalNumberWithPrefix","_this$state","prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix","nationalPrefix","number","nationalSignificantNumberIsModified","getNonFormattedTemplate","replace","DIGIT_PLACEHOLDER","countryCodes","getCountryCodesForCallingCode","setCountry","getCountryByCallingCode","nationalNumber","getNumberValue","_this$state2","callingCode_","countryCallingCode","getNumber","_this$state3","carrierCode","ambiguousCountries","exactCountry","getCountryByNationalNumber","countries","phoneNumber","PhoneNumber","isPossible","isValid","getNationalNumber","getChars","getTemplate"],"sources":["../source/AsYouType.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport PhoneNumber from './PhoneNumber.js'\r\nimport AsYouTypeState from './AsYouTypeState.js'\r\nimport AsYouTypeFormatter, { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.js'\r\nimport AsYouTypeParser, { extractFormattedDigitsAndPlus } from './AsYouTypeParser.js'\r\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js'\r\nimport getCountryByNationalNumber from './helpers/getCountryByNationalNumber.js'\r\nimport isObject from './helpers/isObject.js'\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\nexport default class AsYouType {\r\n\t/**\r\n\t * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n\t * @param {Object} metadata\r\n\t */\r\n\tconstructor(optionsOrDefaultCountry, metadata) {\r\n\t\tthis.metadata = new Metadata(metadata)\r\n\t\tconst [defaultCountry, defaultCallingCode] = this.getCountryAndCallingCode(optionsOrDefaultCountry)\r\n\t\t// `this.defaultCountry` and `this.defaultCallingCode` aren't required to be in sync.\r\n\t\t// For example, `this.defaultCountry` could be `\"AR\"` and `this.defaultCallingCode` could be `undefined`.\r\n\t\t// So `this.defaultCountry` and `this.defaultCallingCode` are totally independent.\r\n\t\tthis.defaultCountry = defaultCountry\r\n\t\tthis.defaultCallingCode = defaultCallingCode\r\n\t\tthis.reset()\r\n\t}\r\n\r\n\tgetCountryAndCallingCode(optionsOrDefaultCountry) {\r\n\t\t// Set `defaultCountry` and `defaultCallingCode` options.\r\n\t\tlet defaultCountry\r\n\t\tlet defaultCallingCode\r\n\t\t// Turns out `null` also has type \"object\". Weird.\r\n\t\tif (optionsOrDefaultCountry) {\r\n\t\t\tif (isObject(optionsOrDefaultCountry)) {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry.defaultCountry\r\n\t\t\t\tdefaultCallingCode = optionsOrDefaultCountry.defaultCallingCode\r\n\t\t\t} else {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {\r\n\t\t\tdefaultCountry = undefined\r\n\t\t}\r\n\t\tif (defaultCallingCode) {\r\n\t\t\t/* istanbul ignore if */\r\n\t\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t\tif (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\r\n\t\t\t\t\tdefaultCountry = '001'\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn [defaultCountry, defaultCallingCode]\r\n\t}\r\n\r\n\t/**\r\n\t * Inputs \"next\" phone number characters.\r\n\t * @param {string} text\r\n\t * @return {string} Formatted phone number characters that have been input so far.\r\n\t */\r\n\tinput(text) {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tjustLeadingPlus\r\n\t\t} = this.parser.input(text, this.state)\r\n\t\tif (justLeadingPlus) {\r\n\t\t\tthis.formattedOutput = '+'\r\n\t\t} else if (digits) {\r\n\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t// Match the available formats by the currently available leading digits.\r\n\t\t\tif (this.state.nationalSignificantNumber) {\r\n\t\t\t\tthis.formatter.narrowDownMatchingFormats(this.state)\r\n\t\t\t}\r\n\t\t\tlet formattedNationalNumber\r\n\t\t\tif (this.metadata.hasSelectedNumberingPlan()) {\r\n\t\t\t\tformattedNationalNumber = this.formatter.format(digits, this.state)\r\n\t\t\t}\r\n\t\t\tif (formattedNationalNumber === undefined) {\r\n\t\t\t\t// See if another national (significant) number could be re-extracted.\r\n\t\t\t\tif (this.parser.reExtractNationalSignificantNumber(this.state)) {\r\n\t\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\t\t// If it could, then re-try formatting the new national (significant) number.\r\n\t\t\t\t\tconst nationalDigits = this.state.getNationalDigits()\r\n\t\t\t\t\tif (nationalDigits) {\r\n\t\t\t\t\t\tformattedNationalNumber = this.formatter.format(nationalDigits, this.state)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.formattedOutput = formattedNationalNumber\r\n\t\t\t\t? this.getFullNumber(formattedNationalNumber)\r\n\t\t\t\t: this.getNonFormattedNumber()\r\n\t\t}\r\n\t\treturn this.formattedOutput\r\n\t}\r\n\r\n\treset() {\r\n\t\tthis.state = new AsYouTypeState({\r\n\t\t\tonCountryChange: (country) => {\r\n\t\t\t\t// Before version `1.6.0`, the official `AsYouType` formatter API\r\n\t\t\t\t// included a `.country` property on an `AsYouType` instance.\r\n\t\t\t\t// Since that property (along with the others) have been moved to\r\n\t\t\t\t// `this.state`, `this.country` property is emulated for compatibility\r\n\t\t\t\t// with the old versions.\r\n\t\t\t\tthis.country = country\r\n\t\t\t},\r\n\t\t\tonCallingCodeChange: (callingCode, country) => {\r\n\t\t\t\tthis.metadata.selectNumberingPlan(country, callingCode)\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t\tthis.parser.reset(this.metadata.numberingPlan)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.formatter = new AsYouTypeFormatter({\r\n\t\t\tstate: this.state,\r\n\t\t\tmetadata: this.metadata\r\n\t\t})\r\n\t\tthis.parser = new AsYouTypeParser({\r\n\t\t\tdefaultCountry: this.defaultCountry,\r\n\t\t\tdefaultCallingCode: this.defaultCallingCode,\r\n\t\t\tmetadata: this.metadata,\r\n\t\t\tstate: this.state,\r\n\t\t\tonNationalSignificantNumberChange: () => {\r\n\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.state.reset({\r\n\t\t\tcountry: this.defaultCountry,\r\n\t\t\tcallingCode: this.defaultCallingCode\r\n\t\t})\r\n\t\tthis.formattedOutput = ''\r\n\t\treturn this\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is being input in international format.\r\n\t * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisInternational() {\r\n\t\treturn this.state.international\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the \"calling code\" part of the phone number when it's being input\r\n\t * in an international format.\r\n\t * If no valid calling code has been entered so far, returns `undefined`.\r\n\t * @return {string} [callingCode]\r\n\t */\r\n\tgetCallingCode() {\r\n\t\t // If the number is being input in national format and some \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then `this.state.callingCode`\r\n\t\t // is equal to that \"default calling code\".\r\n\t\t //\r\n\t\t // If the number is being input in national format and no \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then returns `undefined`,\r\n\t\t // even if a \"default country\" has been passed to `AsYouType` constructor.\r\n\t\t //\r\n\t\tif (this.isInternational()) {\r\n\t\t\treturn this.state.callingCode\r\n\t\t}\r\n\t}\r\n\r\n\t// A legacy alias.\r\n\tgetCountryCallingCode() {\r\n\t\treturn this.getCallingCode()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * Returns `undefined` if no phone number has been input yet.\r\n\t * @return {string} [country]\r\n\t */\r\n\tgetCountry() {\r\n\t\tconst { digits } = this.state\r\n\t\t// Return `undefined` if no digits have been input yet.\r\n\t\tif (digits) {\r\n\t\t\treturn this._getCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * @return {string} [country]\r\n\t */\r\n\t_getCountry() {\r\n\t\tconst { country } = this.state\r\n\t\t/* istanbul ignore if */\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t// `AsYouType.getCountry()` returns `undefined`\r\n\t\t\t// for \"non-geographic\" phone numbering plans.\r\n\t\t\tif (country === '001') {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn country\r\n\t}\r\n\r\n\tdetermineTheCountryIfNeeded() {\r\n\t\t// Suppose a user enters a phone number in international format,\r\n\t\t// and there're several countries corresponding to that country calling code,\r\n\t\t// and a country has been derived from the number, and then\r\n\t\t// a user enters one more digit and the number is no longer\r\n\t\t// valid for the derived country, so the country should be re-derived\r\n\t\t// on every new digit in those cases.\r\n\t\t//\r\n\t\t// If the phone number is being input in national format,\r\n\t\t// then it could be a case when `defaultCountry` wasn't specified\r\n\t\t// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,\r\n\t\t// and that \"calling code\" could correspond to a \"non-geographic entity\",\r\n\t\t// or there could be several countries corresponding to that country calling code.\r\n\t\t// In those cases, `this.country` is `undefined` and should be derived\r\n\t\t// from the number. Again, if country calling code is ambiguous, then\r\n\t\t// `this.country` should be re-derived with each new digit.\r\n\t\t//\r\n\t\tif (!this.state.country || this.isCountryCallingCodeAmbiguous()) {\r\n\t\t\tthis.determineTheCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t// Prepends `+CountryCode ` in case of an international phone number\r\n\tgetFullNumber(formattedNationalNumber) {\r\n\t\tif (this.isInternational()) {\r\n\t\t\tconst prefix = (text) => this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state, {\r\n\t\t\t\tspacing: text ? true : false\r\n\t\t\t}) + text\r\n\t\t\tconst { callingCode } = this.state\r\n\t\t\tif (!callingCode) {\r\n\t\t\t\treturn prefix(`${this.state.getDigitsWithoutInternationalPrefix()}`)\r\n\t\t\t}\r\n\t\t\tif (!formattedNationalNumber) {\r\n\t\t\t\treturn prefix(callingCode)\r\n\t\t\t}\r\n\t\t\treturn prefix(`${callingCode} ${formattedNationalNumber}`)\r\n\t\t}\r\n\t\treturn formattedNationalNumber\r\n\t}\r\n\r\n\tgetNonFormattedNationalNumberWithPrefix() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tprefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,\r\n\t\t\tnationalPrefix\r\n\t\t} = this.state\r\n\t\tlet number = nationalSignificantNumber\r\n\t\tconst prefix = prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix || nationalPrefix\r\n\t\tif (prefix) {\r\n\t\t\tnumber = prefix + number\r\n\t\t}\r\n\t\treturn number\r\n\t}\r\n\r\n\tgetNonFormattedNumber() {\r\n\t\tconst { nationalSignificantNumberIsModified } = this.state\r\n\t\treturn this.getFullNumber(\r\n\t\t\tnationalSignificantNumberIsModified\r\n\t\t\t\t? this.state.getNationalDigits()\r\n\t\t\t\t: this.getNonFormattedNationalNumberWithPrefix()\r\n\t\t)\r\n\t}\r\n\r\n\tgetNonFormattedTemplate() {\r\n\t\tconst number = this.getNonFormattedNumber()\r\n\t\tif (number) {\r\n\t\t\treturn number.replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER)\r\n\t\t}\r\n\t}\r\n\r\n\tisCountryCallingCodeAmbiguous() {\r\n\t\tconst { callingCode } = this.state\r\n\t\tconst countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\treturn countryCodes && countryCodes.length > 1\r\n\t}\r\n\r\n\t// Determines the exact country of the phone number\r\n\t// entered so far based on the country phone code\r\n\t// and the national phone number.\r\n\tdetermineTheCountry() {\r\n\t\tthis.state.setCountry(getCountryByCallingCode(\r\n\t\t\tthis.isInternational() ? this.state.callingCode : this.defaultCallingCode,\r\n\t\t\t{\r\n\t\t\t\tnationalNumber: this.state.nationalSignificantNumber,\r\n\t\t\t\tmetadata: this.metadata\r\n\t\t\t}\r\n\t\t))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a E.164 phone number value for the user's input.\r\n\t *\r\n\t * For example, for country `\"US\"` and input `\"(222) 333-4444\"`\r\n\t * it will return `\"+12223334444\"`.\r\n\t *\r\n\t * For international phone number input, it will also auto-correct\r\n\t * some minor errors such as using a national prefix when writing\r\n\t * an international phone number. For example, if the user inputs\r\n\t * `\"+44 0 7400 000000\"` then it will return an auto-corrected\r\n\t * `\"+447400000000\"` phone number value.\r\n\t *\r\n\t * Will return `undefined` if no digits have been input,\r\n\t * or when inputting a phone number in national format and no\r\n\t * default country or default \"country calling code\" have been set.\r\n\t *\r\n\t * @return {string} [value]\r\n\t */\r\n\tgetNumberValue() {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tcallingCode,\r\n\t\t\tcountry,\r\n\t\t\tnationalSignificantNumber\r\n\t\t} = this.state\r\n\r\n\t \t// Will return `undefined` if no digits have been input.\r\n\t\tif (!digits) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (this.isInternational()) {\r\n\t\t\tif (callingCode) {\r\n\t\t\t\treturn '+' + callingCode + nationalSignificantNumber\r\n\t\t\t} else {\r\n\t\t\t\treturn '+' + digits\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (country || callingCode) {\r\n\t\t\t\tconst callingCode_ = country ? this.metadata.countryCallingCode() : callingCode\r\n\t\t\t\treturn '+' + callingCode_ + nationalSignificantNumber\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an instance of `PhoneNumber` class.\r\n\t * Will return `undefined` if no national (significant) number\r\n\t * digits have been entered so far, or if no `defaultCountry` has been\r\n\t * set and the user enters a phone number not in international format.\r\n\t */\r\n\tgetNumber() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tcarrierCode,\r\n\t\t\tcallingCode\r\n\t\t} = this.state\r\n\r\n\t\t// `this._getCountry()` is basically same as `this.state.country`\r\n\t\t// with the only change that it return `undefined` in case of a\r\n\t\t// \"non-geographic\" numbering plan instead of `\"001\"` \"internal use\" value.\r\n\t\tlet country = this._getCountry()\r\n\r\n\t\tif (!nationalSignificantNumber) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// `state.country` and `state.callingCode` aren't required to be in sync.\r\n\t\t// For example, `country` could be `\"AR\"` and `callingCode` could be `undefined`.\r\n\t\t// So `country` and `callingCode` are totally independent.\r\n\r\n\t\tif (!country && !callingCode) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// By default, if `defaultCountry` parameter was passed when\r\n\t\t// creating `AsYouType` instance, `state.country` is gonna be\r\n\t\t// that `defaultCountry`, which doesn't entirely conform with\r\n\t\t// `parsePhoneNumber()`'s behavior where it attempts to determine\r\n\t\t// the country more precisely in cases when multiple countries\r\n\t\t// could correspond to the same `countryCallingCode`.\r\n\t\t// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417192969\r\n\t\t//\r\n\t\t// Because `AsYouType.getNumber()` method is supposed to be a 1:1\r\n\t\t// equivalent for `parsePhoneNumber(AsYouType.getNumberValue())`,\r\n\t\t// then it should also behave accordingly in cases of `country` ambiguity.\r\n\t\t// That's how users of this library would expect it to behave anyway.\r\n\t\t//\r\n\t\tif (country) {\r\n\t\t\tif (country === this.defaultCountry) {\r\n\t\t\t\t// `state.country` and `state.callingCode` aren't required to be in sync.\r\n\t\t\t\t// For example, `state.country` could be `\"AR\"` and `state.callingCode` could be `undefined`.\r\n\t\t\t\t// So `state.country` and `state.callingCode` are totally independent.\r\n\t\t\t\tconst metadata = new Metadata(this.metadata.metadata)\r\n\t\t\t\tmetadata.selectNumberingPlan(country)\r\n\t\t\t\tconst callingCode = metadata.numberingPlan.callingCode()\r\n\t\t\t\tconst ambiguousCountries = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\t\t\tif (ambiguousCountries.length > 1) {\r\n\t\t\t\t\tconst exactCountry = getCountryByNationalNumber(nationalSignificantNumber, {\r\n\t\t\t\t\t\tcountries: ambiguousCountries,\r\n\t\t\t\t\t\tmetadata: this.metadata.metadata\r\n\t\t\t\t\t})\r\n\t\t\t\t\tif (exactCountry) {\r\n\t\t\t\t\t\tcountry = exactCountry\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst phoneNumber = new PhoneNumber(\r\n\t\t\tcountry || callingCode,\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tthis.metadata.metadata\r\n\t\t)\r\n\t\tif (carrierCode) {\r\n\t\t\tphoneNumber.carrierCode = carrierCode\r\n\t\t}\r\n\t\t// Phone number extensions are not supported by \"As You Type\" formatter.\r\n\t\treturn phoneNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"possible\".\r\n\t * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisPossible() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isPossible()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"valid\".\r\n\t * Is just a shortcut for `PhoneNumber.isValid()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisValid() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isValid()\r\n\t}\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t * This method is used in `react-phone-number-input/source/input-control.js`\r\n\t * in versions before `3.0.16`.\r\n\t */\r\n\tgetNationalNumber() {\r\n\t\treturn this.state.nationalSignificantNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the phone number characters entered by the user.\r\n\t * @return {string}\r\n\t */\r\n\tgetChars() {\r\n\t\treturn (this.state.international ? '+' : '') + this.state.digits\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the template for the formatted phone number.\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplate() {\r\n\t\treturn this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || ''\r\n\t}\r\n}"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,wBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,2BAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AAA4C,SAAAI,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA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OK,WAAW;IACnB;;IAEA;AACD;AACA;AACA;AACA;EAJC;IAAA5F,GAAA;IAAAR,KAAA,EAKA,SAAAsG,UAAUA,CAAA,EAAG;MACZ,IAAMF,WAAW,GAAG,IAAI,CAACP,SAAS,CAAC,CAAC;MACpC,IAAI,CAACO,WAAW,EAAE;QACjB,OAAO,KAAK;MACb;MACA,OAAOA,WAAW,CAACE,UAAU,CAAC,CAAC;IAChC;;IAEA;AACD;AACA;AACA;AACA;EAJC;IAAA9F,GAAA;IAAAR,KAAA,EAKA,SAAAuG,OAAOA,CAAA,EAAG;MACT,IAAMH,WAAW,GAAG,IAAI,CAACP,SAAS,CAAC,CAAC;MACpC,IAAI,CAACO,WAAW,EAAE;QACjB,OAAO,KAAK;MACb;MACA,OAAOA,WAAW,CAACG,OAAO,CAAC,CAAC;IAC7B;;IAEA;AACD;AACA;AACA;AACA;EAJC;IAAA/F,GAAA;IAAAR,KAAA,EAKA,SAAAwG,iBAAiBA,CAAA,EAAG;MACnB,OAAO,IAAI,CAACtE,KAAK,CAACK,yBAAyB;IAC5C;;IAEA;AACD;AACA;AACA;EAHC;IAAA/B,GAAA;IAAAR,KAAA,EAIA,SAAAyG,QAAQA,CAAA,EAAG;MACV,OAAO,CAAC,IAAI,CAACvE,KAAK,CAAC4B,aAAa,GAAG,GAAG,GAAG,EAAE,IAAI,IAAI,CAAC5B,KAAK,CAACC,MAAM;IACjE;;IAEA;AACD;AACA;AACA;EAHC;IAAA3B,GAAA;IAAAR,KAAA,EAIA,SAAA0G,WAAWA,CAAA,EAAG;MACb,OAAO,IAAI,CAAClE,SAAS,CAACkE,WAAW,CAAC,IAAI,CAACxE,KAAK,CAAC,IAAI,IAAI,CAAC+C,uBAAuB,CAAC,CAAC,IAAI,EAAE;IACtF;EAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"AsYouType.js","names":["_metadata","_interopRequireDefault","require","_PhoneNumber","_checkNumberLength","_AsYouTypeState","_AsYouTypeFormatter","_interopRequireWildcard","_AsYouTypeParser","_getCountryByCallingCode","_getCountryByNationalNumber","_isObject","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Symbol","iterator","constructor","prototype","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","toString","slice","name","Array","from","test","length","l","u","next","done","push","value","isArray","_classCallCheck","_defineProperties","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","String","Number","USE_NON_GEOGRAPHIC_COUNTRY_CODE","AsYouType","exports","optionsOrDefaultCountry","metadata","Metadata","_this$getCountryAndCa","getCountryAndCallingCode","_this$getCountryAndCa2","defaultCountry","defaultCallingCode","reset","isObject","hasCountry","undefined","isNonGeographicCallingCode","input","text","_this$parser$input","parser","state","digits","justLeadingPlus","formattedOutput","determineTheCountryIfNeeded","nationalSignificantNumber","formatter","narrowDownMatchingFormats","formattedNationalNumber","hasSelectedNumberingPlan","format","reExtractNationalSignificantNumber","nationalDigits","getNationalDigits","getFullNumber","getNonFormattedNumber","_this","AsYouTypeState","onCountryChange","country","onCallingCodeChange","callingCode","selectNumberingPlan","numberingPlan","AsYouTypeFormatter","AsYouTypeParser","onNationalSignificantNumberChange","isInternational","international","getCallingCode","getCountryCallingCode","getCountry","_getCountry","isCountryCallingCodeAmbiguous","determineTheCountry","_this2","prefix","getInternationalPrefixBeforeCountryCallingCode","spacing","concat","getDigitsWithoutInternationalPrefix","getNonFormattedNationalNumberWithPrefix","_this$state","prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix","nationalPrefix","number","nationalSignificantNumberIsModified","getNonFormattedTemplate","replace","DIGIT_PLACEHOLDER","countryCodes","getCountryCodesForCallingCode","getCountryByCallingCode","nationalNumber","setCountry","getNumberValue","_this$state2","callingCode_","countryCallingCode","getNumber","_this$state3","carrierCode","exactCountry","getExactCountryForMultiCountryCallingCode","phoneNumber","PhoneNumber","isPossible","isValid","validateLength","_this$state4","result","checkNumberLength","getNationalNumber","getChars","getTemplate","ambiguousCountries","getCountryByNationalNumber"],"sources":["../source/AsYouType.js"],"sourcesContent":["import Metadata from './metadata.js'\r\nimport PhoneNumber from './PhoneNumber.js'\r\nimport checkNumberLength from './helpers/checkNumberLength.js'\r\nimport AsYouTypeState from './AsYouTypeState.js'\r\nimport AsYouTypeFormatter, { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.js'\r\nimport AsYouTypeParser, { extractFormattedDigitsAndPlus } from './AsYouTypeParser.js'\r\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode.js'\r\nimport getCountryByNationalNumber from './helpers/getCountryByNationalNumber.js'\r\nimport isObject from './helpers/isObject.js'\r\n\r\nconst USE_NON_GEOGRAPHIC_COUNTRY_CODE = false\r\n\r\nexport default class AsYouType {\r\n\t/**\r\n\t * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n\t * @param {Object} metadata\r\n\t */\r\n\tconstructor(optionsOrDefaultCountry, metadata) {\r\n\t\t// Metadata instance is created once and stays constant.\r\n\t\t// This is required because other utility classes such as `AsYouTypeFormatter`\r\n\t\t// will use this metadata instance \"reference\" and will assume that it stays constant.\r\n\t\tthis.metadata = new Metadata(metadata)\r\n\t\tconst [defaultCountry, defaultCallingCode] = this.getCountryAndCallingCode(optionsOrDefaultCountry)\r\n\t\t// `this.defaultCountry` and `this.defaultCallingCode` aren't required to be in sync.\r\n\t\t// For example, `this.defaultCountry` could be `\"AR\"` and `this.defaultCallingCode` could be `undefined`.\r\n\t\t// So `this.defaultCountry` and `this.defaultCallingCode` are totally independent.\r\n\t\tthis.defaultCountry = defaultCountry\r\n\t\tthis.defaultCallingCode = defaultCallingCode\r\n\t\tthis.reset()\r\n\t}\r\n\r\n\tgetCountryAndCallingCode(optionsOrDefaultCountry) {\r\n\t\t// Set `defaultCountry` and `defaultCallingCode` options.\r\n\t\tlet defaultCountry\r\n\t\tlet defaultCallingCode\r\n\t\t// Turns out `null` also has type \"object\". Weird.\r\n\t\tif (optionsOrDefaultCountry) {\r\n\t\t\tif (isObject(optionsOrDefaultCountry)) {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry.defaultCountry\r\n\t\t\t\tdefaultCallingCode = optionsOrDefaultCountry.defaultCallingCode\r\n\t\t\t} else {\r\n\t\t\t\tdefaultCountry = optionsOrDefaultCountry\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (defaultCountry && !this.metadata.hasCountry(defaultCountry)) {\r\n\t\t\tdefaultCountry = undefined\r\n\t\t}\r\n\t\tif (defaultCallingCode) {\r\n\t\t\t/* istanbul ignore if */\r\n\t\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t\tif (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\r\n\t\t\t\t\tdefaultCountry = '001'\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn [defaultCountry, defaultCallingCode]\r\n\t}\r\n\r\n\t/**\r\n\t * Inputs \"next\" phone number characters.\r\n\t * @param {string} text\r\n\t * @return {string} Formatted phone number characters that have been input so far.\r\n\t */\r\n\tinput(text) {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tjustLeadingPlus\r\n\t\t} = this.parser.input(text, this.state)\r\n\t\tif (justLeadingPlus) {\r\n\t\t\tthis.formattedOutput = '+'\r\n\t\t} else if (digits) {\r\n\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t// Match the available formats by the currently available leading digits.\r\n\t\t\tif (this.state.nationalSignificantNumber) {\r\n\t\t\t\tthis.formatter.narrowDownMatchingFormats(this.state)\r\n\t\t\t}\r\n\t\t\tlet formattedNationalNumber\r\n\t\t\tif (this.metadata.hasSelectedNumberingPlan()) {\r\n\t\t\t\tformattedNationalNumber = this.formatter.format(digits, this.state)\r\n\t\t\t}\r\n\t\t\tif (formattedNationalNumber === undefined) {\r\n\t\t\t\t// See if another national (significant) number could be re-extracted.\r\n\t\t\t\tif (this.parser.reExtractNationalSignificantNumber(this.state)) {\r\n\t\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\t\t// If it could, then re-try formatting the new national (significant) number.\r\n\t\t\t\t\tconst nationalDigits = this.state.getNationalDigits()\r\n\t\t\t\t\tif (nationalDigits) {\r\n\t\t\t\t\t\tformattedNationalNumber = this.formatter.format(nationalDigits, this.state)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.formattedOutput = formattedNationalNumber\r\n\t\t\t\t? this.getFullNumber(formattedNationalNumber)\r\n\t\t\t\t: this.getNonFormattedNumber()\r\n\t\t}\r\n\t\treturn this.formattedOutput\r\n\t}\r\n\r\n\treset() {\r\n\t\tthis.state = new AsYouTypeState({\r\n\t\t\tonCountryChange: (country) => {\r\n\t\t\t\t// Before version `1.6.0`, the official `AsYouType` formatter API\r\n\t\t\t\t// included a `.country` property on an `AsYouType` instance.\r\n\t\t\t\t// Since that property (along with the others) have been moved to\r\n\t\t\t\t// `this.state`, `this.country` property is emulated for compatibility\r\n\t\t\t\t// with the old versions.\r\n\t\t\t\tthis.country = country\r\n\t\t\t},\r\n\t\t\tonCallingCodeChange: (callingCode, country) => {\r\n\t\t\t\tthis.metadata.selectNumberingPlan(country || callingCode)\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t\tthis.parser.reset(this.metadata.numberingPlan)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.formatter = new AsYouTypeFormatter({\r\n\t\t\tstate: this.state,\r\n\t\t\tmetadata: this.metadata\r\n\t\t})\r\n\t\tthis.parser = new AsYouTypeParser({\r\n\t\t\tdefaultCountry: this.defaultCountry,\r\n\t\t\tdefaultCallingCode: this.defaultCallingCode,\r\n\t\t\tmetadata: this.metadata,\r\n\t\t\tstate: this.state,\r\n\t\t\tonNationalSignificantNumberChange: () => {\r\n\t\t\t\tthis.determineTheCountryIfNeeded()\r\n\t\t\t\tthis.formatter.reset(this.metadata.numberingPlan, this.state)\r\n\t\t\t}\r\n\t\t})\r\n\t\tthis.state.reset({\r\n\t\t\tcountry: this.defaultCountry,\r\n\t\t\tcallingCode: this.defaultCallingCode\r\n\t\t})\r\n\t\tthis.formattedOutput = ''\r\n\t\treturn this\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is being input in international format.\r\n\t * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisInternational() {\r\n\t\treturn this.state.international\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the \"calling code\" part of the phone number when it's being input\r\n\t * in an international format.\r\n\t * If no valid calling code has been entered so far, returns `undefined`.\r\n\t * @return {string} [callingCode]\r\n\t */\r\n\tgetCallingCode() {\r\n\t\t // If the number is being input in national format and some \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then `this.state.callingCode`\r\n\t\t // is equal to that \"default calling code\".\r\n\t\t //\r\n\t\t // If the number is being input in national format and no \"default calling code\"\r\n\t\t // has been passed to `AsYouType` constructor, then returns `undefined`,\r\n\t\t // even if a \"default country\" has been passed to `AsYouType` constructor.\r\n\t\t //\r\n\t\tif (this.isInternational()) {\r\n\t\t\treturn this.state.callingCode\r\n\t\t}\r\n\t}\r\n\r\n\t// A legacy alias.\r\n\tgetCountryCallingCode() {\r\n\t\treturn this.getCallingCode()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * Returns `undefined` if no phone number has been input yet.\r\n\t * @return {string} [country]\r\n\t */\r\n\tgetCountry() {\r\n\t\tconst { digits } = this.state\r\n\t\t// Return `undefined` if no digits have been input yet.\r\n\t\tif (digits) {\r\n\t\t\treturn this._getCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a two-letter country code of the phone number.\r\n\t * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n\t * @return {string} [country]\r\n\t */\r\n\t_getCountry() {\r\n\t\tconst { country } = this.state\r\n\t\t/* istanbul ignore if */\r\n\t\tif (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\r\n\t\t\t// `AsYouType.getCountry()` returns `undefined`\r\n\t\t\t// for \"non-geographic\" phone numbering plans.\r\n\t\t\tif (country === '001') {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn country\r\n\t}\r\n\r\n\tdetermineTheCountryIfNeeded() {\r\n\t\t// Suppose a user enters a phone number in international format,\r\n\t\t// and there're several countries corresponding to that country calling code,\r\n\t\t// and a country has been derived from the number, and then\r\n\t\t// a user enters one more digit and the number is no longer\r\n\t\t// valid for the derived country, so the country should be re-derived\r\n\t\t// on every new digit in those cases.\r\n\t\t//\r\n\t\t// If the phone number is being input in national format,\r\n\t\t// then it could be a case when `defaultCountry` wasn't specified\r\n\t\t// when creating `AsYouType` instance, and just `defaultCallingCode` was specified,\r\n\t\t// and that \"calling code\" could correspond to a \"non-geographic entity\",\r\n\t\t// or there could be several countries corresponding to that country calling code.\r\n\t\t// In those cases, `this.country` is `undefined` and should be derived\r\n\t\t// from the number. Again, if country calling code is ambiguous, then\r\n\t\t// `this.country` should be re-derived with each new digit.\r\n\t\t//\r\n\t\tif (!this.state.country || this.isCountryCallingCodeAmbiguous()) {\r\n\t\t\tthis.determineTheCountry()\r\n\t\t}\r\n\t}\r\n\r\n\t// Prepends `+CountryCode ` in case of an international phone number\r\n\tgetFullNumber(formattedNationalNumber) {\r\n\t\tif (this.isInternational()) {\r\n\t\t\tconst prefix = (text) => this.formatter.getInternationalPrefixBeforeCountryCallingCode(this.state, {\r\n\t\t\t\tspacing: text ? true : false\r\n\t\t\t}) + text\r\n\t\t\tconst { callingCode } = this.state\r\n\t\t\tif (!callingCode) {\r\n\t\t\t\treturn prefix(`${this.state.getDigitsWithoutInternationalPrefix()}`)\r\n\t\t\t}\r\n\t\t\tif (!formattedNationalNumber) {\r\n\t\t\t\treturn prefix(callingCode)\r\n\t\t\t}\r\n\t\t\treturn prefix(`${callingCode} ${formattedNationalNumber}`)\r\n\t\t}\r\n\t\treturn formattedNationalNumber\r\n\t}\r\n\r\n\tgetNonFormattedNationalNumberWithPrefix() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tprefixBeforeNationalSignificantNumberThatIsNotNationalPrefix,\r\n\t\t\tnationalPrefix\r\n\t\t} = this.state\r\n\t\tlet number = nationalSignificantNumber\r\n\t\tconst prefix = prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix || nationalPrefix\r\n\t\tif (prefix) {\r\n\t\t\tnumber = prefix + number\r\n\t\t}\r\n\t\treturn number\r\n\t}\r\n\r\n\tgetNonFormattedNumber() {\r\n\t\tconst { nationalSignificantNumberIsModified } = this.state\r\n\t\treturn this.getFullNumber(\r\n\t\t\tnationalSignificantNumberIsModified\r\n\t\t\t\t? this.state.getNationalDigits()\r\n\t\t\t\t: this.getNonFormattedNationalNumberWithPrefix()\r\n\t\t)\r\n\t}\r\n\r\n\tgetNonFormattedTemplate() {\r\n\t\tconst number = this.getNonFormattedNumber()\r\n\t\tif (number) {\r\n\t\t\treturn number.replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER)\r\n\t\t}\r\n\t}\r\n\r\n\tisCountryCallingCodeAmbiguous() {\r\n\t\tconst { callingCode } = this.state\r\n\t\tconst countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode)\r\n\t\treturn countryCodes && countryCodes.length > 1\r\n\t}\r\n\r\n\t// Determines the exact country of the phone number\r\n\t// entered so far based on the country phone code\r\n\t// and the national phone number.\r\n\tdetermineTheCountry() {\r\n\t\t// Get a more precise country code for this national number.\r\n\t\t// It is possible that the precise country couldn't be determined\r\n\t\t// in cases when there're multiple countries sharing the same calling code.\r\n\t\t// In that case, `country` will be `undefined`.\r\n\t\tconst country = getCountryByCallingCode(\r\n\t\t\tthis.isInternational() ? this.state.callingCode : this.defaultCallingCode,\r\n\t\t\t{\r\n\t\t\t\tnationalNumber: this.state.nationalSignificantNumber,\r\n\t\t\t\tmetadata: this.metadata\r\n\t\t\t}\r\n\t\t)\r\n\t\t// If the derived country is indeed more precise,\r\n\t\t// or if no country could be derived for the updated phone number.\r\n\t\tif (country !== this.state.country) {\r\n\t\t\t// Set (or reset) the more precise country.\r\n\t\t\tthis.state.setCountry(country)\r\n\t\t\t// If a more precise country could be derived.\r\n\t\t\tif (country) {\r\n\t\t\t\t// Select a more precise telephone numbering plan.\r\n\t\t\t\t// For example, consider that `AsYouType` instance was created with `defaultCountry: \"US\"` argument.\r\n\t\t\t\t// In that case, the metadata instance will be using \"US\" metadata.\r\n\t\t\t\t// But then the user could input a Canadian phone number, in which case\r\n\t\t\t\t// the metadata instance should be switched to Canadian telephone numbering plan.\r\n\t\t\t\t// It is required to do that because later `canFormatCompleteNumber()` function will be called,\r\n\t\t\t\t// and that function relies on the precise country being pre-selected in the metadata instance.\r\n\t\t\t\t// Or, for example, `checkNumberLength()` function also relies on same thing.\r\n\t\t\t\tthis.metadata.selectNumberingPlan(country)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a E.164 phone number value for the user's input.\r\n\t *\r\n\t * For example, for country `\"US\"` and input `\"(222) 333-4444\"`\r\n\t * it will return `\"+12223334444\"`.\r\n\t *\r\n\t * For international phone number input, it will also auto-correct\r\n\t * some minor errors such as using a national prefix when writing\r\n\t * an international phone number. For example, if the user inputs\r\n\t * `\"+44 0 7400 000000\"` then it will return an auto-corrected\r\n\t * `\"+447400000000\"` phone number value.\r\n\t *\r\n\t * Will return `undefined` if no digits have been input,\r\n\t * or when inputting a phone number in national format and no\r\n\t * default country or default \"country calling code\" have been set.\r\n\t *\r\n\t * @return {string} [value]\r\n\t */\r\n\tgetNumberValue() {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tcallingCode,\r\n\t\t\tcountry,\r\n\t\t\tnationalSignificantNumber\r\n\t\t} = this.state\r\n\r\n\t \t// Will return `undefined` if no digits have been input.\r\n\t\tif (!digits) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (this.isInternational()) {\r\n\t\t\tif (callingCode) {\r\n\t\t\t\treturn '+' + callingCode + nationalSignificantNumber\r\n\t\t\t} else {\r\n\t\t\t\treturn '+' + digits\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (country || callingCode) {\r\n\t\t\t\tconst callingCode_ = country ? this.metadata.countryCallingCode() : callingCode\r\n\t\t\t\treturn '+' + callingCode_ + nationalSignificantNumber\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an instance of `PhoneNumber` class.\r\n\t * Will return `undefined` if no national (significant) number\r\n\t * digits have been entered so far, or if no `defaultCountry` has been\r\n\t * set and the user enters a phone number not in international format.\r\n\t */\r\n\tgetNumber() {\r\n\t\tconst {\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tcarrierCode,\r\n\t\t\tcallingCode\r\n\t\t} = this.state\r\n\r\n\t\tif (!nationalSignificantNumber) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// `this._getCountry()` is basically same as `this.state.country`\r\n\t\t// with the only change that it returns `undefined` in case of a\r\n\t\t// \"non-geographic\" numbering plan instead of `\"001\"` \"internal use\" value.\r\n\t\tlet country = this._getCountry()\r\n\r\n\t\t// Sidenote:\r\n\t\t// `state.callingCode` and `state.country` are somewhat independent from one another\r\n\t\t// and there could be situations when one is defined but the other is not.\r\n\t\t// See the comment in `AsYouTypeState.js` for more info on when that is possible.\r\n\r\n\t\tif (!country && !callingCode) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\t// By default, if `defaultCountry` parameter was passed when\r\n\t\t// creating `AsYouType` instance, `state.country` is gonna be\r\n\t\t// that `defaultCountry`, which doesn't entirely conform with\r\n\t\t// `parsePhoneNumber()`'s behavior where it attempts to determine\r\n\t\t// the country more precisely in cases when multiple countries\r\n\t\t// could correspond to the same `countryCallingCode`.\r\n\t\t// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417192969\r\n\t\t//\r\n\t\t// Because `AsYouType.getNumber()` method is supposed to be a 1:1\r\n\t\t// equivalent for `parsePhoneNumber(AsYouType.getNumberValue())`,\r\n\t\t// it means that it should also behave accordingly in such cases of `country` ambiguity.\r\n\t\t// That's how users of this library would expect it to behave anyway.\r\n\t\t//\r\n\t\t// So here it checks if `state.country` is same as the `defaultCountry`,\r\n\t\t// and if it is, it attempts to get rid of any potential ambiguity.\r\n\t\t//\r\n\t\tif (country) {\r\n\t\t\tif (country === this.defaultCountry) {\r\n\t\t\t\t// // Create a `Metadata` instance just to get the calling code of the `country`.\r\n\t\t\t\t// const metadata = new Metadata(this.metadata.metadata)\r\n\t\t\t\t// // `state.callingCode` and `state.country` are somewhat independent from one another\r\n\t\t\t\t// // and there could be situations when one is defined but the other is not.\r\n\t\t\t\t// // See the comment in `AsYouTypeState.js` for more info on when that is possible.\r\n\t\t\t\t// // Here, it only passes `state.country` because there's no need to pass `state.callingCode`\r\n\t\t\t\t// // because `state.country` is known to be defined.\r\n\t\t\t\t// metadata.selectNumberingPlan(country)\r\n\t\t\t\t// const countryCallingCode = metadata.numberingPlan.callingCode()\r\n\r\n\t\t\t\t// Instead of getting `countryCallingCode` value above,\r\n\t\t\t\t// it could simply read it from the existing metadata instance.\r\n\t\t\t\tconst countryCallingCode = this.metadata.numberingPlan.callingCode()\r\n\r\n\t\t\t\t// Attempt to rule out any potential country code ambiguity, if present.\r\n\t\t\t\tconst exactCountry = getExactCountryForMultiCountryCallingCode(\r\n\t\t\t\t\tcountryCallingCode,\r\n\t\t\t\t\tnationalSignificantNumber,\r\n\t\t\t\t\tthis.metadata\r\n\t\t\t\t)\r\n\t\t\t\tif (exactCountry) {\r\n\t\t\t\t\tcountry = exactCountry\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst phoneNumber = new PhoneNumber(\r\n\t\t\tcountry || callingCode,\r\n\t\t\tnationalSignificantNumber,\r\n\t\t\tthis.metadata.metadata\r\n\t\t)\r\n\t\tif (carrierCode) {\r\n\t\t\tphoneNumber.carrierCode = carrierCode\r\n\t\t}\r\n\t\t// Phone number extensions are not supported by \"As You Type\" formatter.\r\n\t\treturn phoneNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"possible\".\r\n\t * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisPossible() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isPossible()\r\n\t}\r\n\r\n\t/**\r\n\t * Returns `true` if the phone number is \"valid\".\r\n\t * Is just a shortcut for `PhoneNumber.isValid()`.\r\n\t * @return {boolean}\r\n\t */\r\n\tisValid() {\r\n\t\tconst phoneNumber = this.getNumber()\r\n\t\tif (!phoneNumber) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\treturn phoneNumber.isValid()\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if the phone number length is valid.\r\n\t * If it is, nothing is returned.\r\n\t * Otherwise, a rejection reason is returned.\r\n\t * @return {string?}\r\n\t */\r\n\tvalidateLength() {\r\n\t\tconst {\r\n\t\t\tdigits,\r\n\t\t\tnationalSignificantNumber\r\n\t\t} = this.state\r\n\r\n\t\tif (!digits) {\r\n\t\t\treturn 'NOT_A_NUMBER'\r\n\t\t}\r\n\r\n\t\tif (!this.metadata.numberingPlan) {\r\n\t\t\treturn 'INVALID_COUNTRY'\r\n\t\t}\r\n\r\n\t\tif (!nationalSignificantNumber) {\r\n\t\t\t return 'TOO_SHORT'\r\n\t\t}\r\n\r\n\t\t// `state.callingCode` and `state.country` are somewhat independent from one another\r\n\t\t// and there could be situations when one is defined but the other is not.\r\n\t\t// See the comment in `AsYouTypeState.js` for more info on when that is possible.\r\n\t\t// Here, it uses both: if `country` is defined then it will use that,\r\n\t\t// otherwise it will use `callingCode`.\r\n\t\tconst result = checkNumberLength(nationalSignificantNumber, undefined, this.metadata)\r\n\t\tif (result !== 'IS_POSSIBLE') {\r\n\t\t\treturn result\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t * This method is used in `react-phone-number-input/source/input-control.js`\r\n\t * in versions before `3.0.16`.\r\n\t */\r\n\tgetNationalNumber() {\r\n\t\treturn this.state.nationalSignificantNumber\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the phone number characters entered by the user.\r\n\t * @return {string}\r\n\t */\r\n\tgetChars() {\r\n\t\treturn (this.state.international ? '+' : '') + this.state.digits\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the template for the formatted phone number.\r\n\t * @return {string}\r\n\t */\r\n\tgetTemplate() {\r\n\t\treturn this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || ''\r\n\t}\r\n}\r\n\r\n// In situations when multiple countries use the same calling code,\r\n// this function tells what exact country does a given national (significant) number belong to.\r\nfunction getExactCountryForMultiCountryCallingCode(callingCode, nationalSignificantNumber, metadata) {\r\n\tconst ambiguousCountries = metadata.getCountryCodesForCallingCode(callingCode)\r\n\tif (ambiguousCountries.length > 1) {\r\n\t\treturn getCountryByNationalNumber(nationalSignificantNumber, ambiguousCountries, metadata.metadata)\r\n\t}\r\n}"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,mBAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAD,uBAAA,CAAAL,OAAA;AACA,IAAAO,wBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,I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