Browse Source

Added new API for getSupportedCallingCodes (#1855)

pull/1858/head
lararennie 9 years ago
committed by Keghani Kouzoujian
parent
commit
a83ec7bfd2
11 changed files with 202 additions and 101 deletions
  1. +35
    -24
      cpp/src/phonenumbers/phonenumberutil.cc
  2. +15
    -14
      cpp/src/phonenumbers/phonenumberutil.h
  3. +27
    -4
      cpp/test/phonenumbers/phonenumberutil_test.cc
  4. +13
    -0
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  5. +13
    -0
      java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
  6. +58
    -57
      javascript/i18n/phonenumbers/demo-compiled.js
  7. +18
    -2
      javascript/i18n/phonenumbers/phonenumberutil.js
  8. +17
    -0
      javascript/i18n/phonenumbers/phonenumberutil_test.js
  9. +6
    -0
      pending_code_changes.txt
  10. BIN
      tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar
  11. BIN
      tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar

+ 35
- 24
cpp/src/phonenumbers/phonenumberutil.cc View File

@ -610,12 +610,12 @@ class PhoneNumberRegExpsAndMappings {
// example, in China mobile numbers start with a carrier indicator, and beyond
// that are geographically assigned: this carrier indicator is not considered
// to be an area code.
set<int> geo_mobile_countries_without_mobile_area_codes_;
std::set<int> geo_mobile_countries_without_mobile_area_codes_;
// Set of country calling codes that have geographically assigned mobile
// numbers. This may not be complete; we add calling codes case by case, as we
// find geographical mobile numbers or hear from user reports.
set<int> geo_mobile_countries_;
std::set<int> geo_mobile_countries_;
// Pattern that makes it easy to distinguish whether a region has a single
// international dialing prefix or not. If a region has a single international
@ -750,11 +750,12 @@ PhoneNumberUtil::PhoneNumberUtil()
: logger_(Logger::set_logger_impl(new NullLogger())),
matcher_api_(new RegexBasedMatcher()),
reg_exps_(new PhoneNumberRegExpsAndMappings),
country_calling_code_to_region_code_map_(new vector<IntRegionsPair>()),
nanpa_regions_(new set<string>()),
region_to_metadata_map_(new map<string, PhoneMetadata>()),
country_calling_code_to_region_code_map_(
new std::vector<IntRegionsPair>()),
nanpa_regions_(new std::set<string>()),
region_to_metadata_map_(new std::map<string, PhoneMetadata>()),
country_code_to_non_geographical_metadata_map_(
new map<int, PhoneMetadata>) {
new std::map<int, PhoneMetadata>) {
Logger::set_logger_impl(logger_.get());
// TODO: Update the java version to put the contents of the init
// method inside the constructor as well to keep both in sync.
@ -765,7 +766,7 @@ PhoneNumberUtil::PhoneNumberUtil()
}
// Storing data in a temporary map to make it easier to find other regions
// that share a country calling code when inserting data.
std::map<int, list<string>* > country_calling_code_to_region_map;
std::map<int, std::list<string>* > country_calling_code_to_region_map;
for (RepeatedPtrField<PhoneMetadata>::const_iterator it =
metadata_collection.metadata().begin();
it != metadata_collection.metadata().end();
@ -782,7 +783,7 @@ PhoneNumberUtil::PhoneNumberUtil()
} else {
region_to_metadata_map_->insert(std::make_pair(region_code, *it));
}
std::map<int, list<string>* >::iterator calling_code_in_map =
std::map<int, std::list<string>* >::iterator calling_code_in_map =
country_calling_code_to_region_map.find(country_calling_code);
if (calling_code_in_map != country_calling_code_to_region_map.end()) {
if (it->main_country_for_code()) {
@ -817,9 +818,9 @@ PhoneNumberUtil::~PhoneNumberUtil() {
country_calling_code_to_region_code_map_->end());
}
void PhoneNumberUtil::GetSupportedRegions(set<string>* regions) const {
void PhoneNumberUtil::GetSupportedRegions(std::set<string>* regions) const {
DCHECK(regions);
for (map<string, PhoneMetadata>::const_iterator it =
for (std::map<string, PhoneMetadata>::const_iterator it =
region_to_metadata_map_->begin(); it != region_to_metadata_map_->end();
++it) {
regions->insert(it->first);
@ -827,15 +828,25 @@ void PhoneNumberUtil::GetSupportedRegions(set<string>* regions) const {
}
void PhoneNumberUtil::GetSupportedGlobalNetworkCallingCodes(
set<int>* calling_codes) const {
std::set<int>* calling_codes) const {
DCHECK(calling_codes);
for (map<int, PhoneMetadata>::const_iterator it =
for (std::map<int, PhoneMetadata>::const_iterator it =
country_code_to_non_geographical_metadata_map_->begin();
it != country_code_to_non_geographical_metadata_map_->end(); ++it) {
calling_codes->insert(it->first);
}
}
void PhoneNumberUtil::GetSupportedCallingCodes(
std::set<int>* calling_codes) const {
DCHECK(calling_codes);
for (std::vector<IntRegionsPair>::const_iterator it =
country_calling_code_to_region_code_map_->begin();
it != country_calling_code_to_region_code_map_->end(); ++it) {
calling_codes->insert(it->first);
}
}
void PhoneNumberUtil::GetSupportedTypesForRegion(
const string& region_code,
std::set<PhoneNumberType>* types) const {
@ -968,7 +979,7 @@ bool PhoneNumberUtil::HasValidCountryCallingCode(
// if the region code is invalid or unknown.
const PhoneMetadata* PhoneNumberUtil::GetMetadataForRegion(
const string& region_code) const {
map<string, PhoneMetadata>::const_iterator it =
std::map<string, PhoneMetadata>::const_iterator it =
region_to_metadata_map_->find(region_code);
if (it != region_to_metadata_map_->end()) {
return &it->second;
@ -978,7 +989,7 @@ const PhoneMetadata* PhoneNumberUtil::GetMetadataForRegion(
const PhoneMetadata* PhoneNumberUtil::GetMetadataForNonGeographicalRegion(
int country_calling_code) const {
map<int, PhoneMetadata>::const_iterator it =
std::map<int, PhoneMetadata>::const_iterator it =
country_code_to_non_geographical_metadata_map_->find(
country_calling_code);
if (it != country_code_to_non_geographical_metadata_map_->end()) {
@ -1736,7 +1747,7 @@ bool PhoneNumberUtil::IsNANPACountry(const string& region_code) const {
// the case of no region code being found, region_codes will be left empty.
void PhoneNumberUtil::GetRegionCodesForCountryCallingCode(
int country_calling_code,
list<string>* region_codes) const {
std::list<string>* region_codes) const {
DCHECK(region_codes);
// Create a IntRegionsPair with the country_code passed in, and use it to
// locate the pair with the same country_code in the sorted vector.
@ -1761,7 +1772,7 @@ void PhoneNumberUtil::GetRegionCodeForCountryCode(
int country_calling_code,
string* region_code) const {
DCHECK(region_code);
list<string> region_codes;
std::list<string> region_codes;
GetRegionCodesForCountryCallingCode(country_calling_code, &region_codes);
*region_code = (region_codes.size() > 0) ?
@ -1772,7 +1783,7 @@ void PhoneNumberUtil::GetRegionCodeForNumber(const PhoneNumber& number,
string* region_code) const {
DCHECK(region_code);
int country_calling_code = number.country_code();
list<string> region_codes;
std::list<string> region_codes;
GetRegionCodesForCountryCallingCode(country_calling_code, &region_codes);
if (region_codes.size() == 0) {
string number_string;
@ -1791,12 +1802,12 @@ void PhoneNumberUtil::GetRegionCodeForNumber(const PhoneNumber& number,
}
void PhoneNumberUtil::GetRegionCodeForNumberFromRegionList(
const PhoneNumber& number, const list<string>& region_codes,
const PhoneNumber& number, const std::list<string>& region_codes,
string* region_code) const {
DCHECK(region_code);
string national_number;
GetNationalSignificantNumber(number, &national_number);
for (list<string>::const_iterator it = region_codes.begin();
for (std::list<string>::const_iterator it = region_codes.begin();
it != region_codes.end(); ++it) {
// Metadata cannot be NULL because the region codes come from the country
// calling code map.
@ -1925,9 +1936,9 @@ bool PhoneNumberUtil::GetExampleNumberForType(
PhoneNumberUtil::PhoneNumberType type,
PhoneNumber* number) const {
DCHECK(number);
set<string> regions;
std::set<string> regions;
GetSupportedRegions(&regions);
for (set<string>::const_iterator it = regions.begin();
for (std::set<string>::const_iterator it = regions.begin();
it != regions.end(); ++it) {
if (GetExampleNumberForType(*it, type, number)) {
return true;
@ -1935,9 +1946,9 @@ bool PhoneNumberUtil::GetExampleNumberForType(
}
// If there wasn't an example number for a region, try the non-geographical
// entities.
set<int> global_network_calling_codes;
std::set<int> global_network_calling_codes;
GetSupportedGlobalNetworkCallingCodes(&global_network_calling_codes);
for (set<int>::const_iterator it = global_network_calling_codes.begin();
for (std::set<int>::const_iterator it = global_network_calling_codes.begin();
it != global_network_calling_codes.end(); ++it) {
int country_calling_code = *it;
const PhoneMetadata* metadata =
@ -2568,7 +2579,7 @@ int PhoneNumberUtil::GetLengthOfNationalDestinationCode(
void PhoneNumberUtil::GetCountryMobileToken(int country_calling_code,
string* mobile_token) const {
DCHECK(mobile_token);
map<int, char>::iterator it = reg_exps_->mobile_token_mappings_.find(
std::map<int, char>::iterator it = reg_exps_->mobile_token_mappings_.find(
country_calling_code);
if (it != reg_exps_->mobile_token_mappings_.end()) {
*mobile_token = it->second;


+ 15
- 14
cpp/src/phonenumbers/phonenumberutil.h View File

@ -35,14 +35,8 @@ class TelephoneNumber;
namespace i18n {
namespace phonenumbers {
using std::list;
using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;
using google::protobuf::RepeatedPtrField;
using std::string;
class AsYouTypeFormatter;
class Logger;
@ -177,6 +171,12 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
void GetSupportedGlobalNetworkCallingCodes(
std::set<int>* calling_codes) const;
// Returns all country calling codes the library has metadata for, covering
// both non-geographical entities (global network calling codes) and those
// used for geographical entities. This could be used to populate a drop-down
// box of country calling codes for a phone-number widget, for instance.
void GetSupportedCallingCodes(std::set<int>* calling_codes) const;
// Returns the types for a given region which the library has metadata for.
// Will not include FIXED_LINE_OR_MOBILE (if numbers for this non-geographical
// entity could be classified as FIXED_LINE_OR_MOBILE, both FIXED_LINE and
@ -478,7 +478,7 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// is left unchanged.
void GetRegionCodesForCountryCallingCode(
int country_calling_code,
list<string>* region_codes) const;
std::list<string>* region_codes) const;
// Checks if this is a region under the North American Numbering Plan
// Administration (NANPA).
@ -746,7 +746,7 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
private:
scoped_ptr<Logger> logger_;
typedef pair<int, list<string>*> IntRegionsPair;
typedef std::pair<int, std::list<string>*> IntRegionsPair;
// The minimum and maximum length of the national significant number.
static const size_t kMinLengthForNsn = 2;
@ -787,20 +787,21 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// country calling code 7. Under this map, 1 is mapped to region code "US" and
// 7 is mapped to region code "RU". This is implemented as a sorted vector to
// achieve better performance.
scoped_ptr<vector<IntRegionsPair> > country_calling_code_to_region_code_map_;
scoped_ptr<std::vector<IntRegionsPair> >
country_calling_code_to_region_code_map_;
// The set of regions that share country calling code 1.
scoped_ptr<set<string> > nanpa_regions_;
scoped_ptr<std::set<string> > nanpa_regions_;
static const int kNanpaCountryCode = 1;
// A mapping from a region code to a PhoneMetadata for that region.
scoped_ptr<map<string, PhoneMetadata> > region_to_metadata_map_;
scoped_ptr<std::map<string, PhoneMetadata> > region_to_metadata_map_;
// A mapping from a country calling code for a non-geographical entity to the
// PhoneMetadata for that country calling code. Examples of the country
// calling codes include 800 (International Toll Free Service) and 808
// (International Shared Cost Service).
scoped_ptr<map<int, PhoneMetadata> >
scoped_ptr<std::map<int, PhoneMetadata> >
country_code_to_non_geographical_metadata_map_;
PhoneNumberUtil();
@ -898,7 +899,7 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
void GetRegionCodeForNumberFromRegionList(
const PhoneNumber& number,
const list<string>& region_codes,
const std::list<string>& region_codes,
string* region_code) const;
// Strips the IDD from the start of the number if present. Helper function


+ 27
- 4
cpp/test/phonenumbers/phonenumberutil_test.cc View File

@ -125,18 +125,18 @@ TEST_F(PhoneNumberUtilTest, ContainsOnlyValidDigits) {
}
TEST_F(PhoneNumberUtilTest, GetSupportedRegions) {
set<string> regions;
std::set<string> regions;
phone_util_.GetSupportedRegions(&regions);
EXPECT_GT(regions.size(), 0U);
}
TEST_F(PhoneNumberUtilTest, GetSupportedGlobalNetworkCallingCodes) {
set<int> calling_codes;
std::set<int> calling_codes;
phone_util_.GetSupportedGlobalNetworkCallingCodes(&calling_codes);
EXPECT_GT(calling_codes.size(), 0U);
for (set<int>::const_iterator it = calling_codes.begin();
for (std::set<int>::const_iterator it = calling_codes.begin();
it != calling_codes.end(); ++it) {
EXPECT_GT(*it, 0);
string region_code;
@ -145,6 +145,29 @@ TEST_F(PhoneNumberUtilTest, GetSupportedGlobalNetworkCallingCodes) {
}
}
TEST_F(PhoneNumberUtilTest, GetSupportedCallingCodes) {
std::set<int> calling_codes;
phone_util_.GetSupportedCallingCodes(&calling_codes);
EXPECT_GT(calling_codes.size(), 0U);
for (std::set<int>::const_iterator it = calling_codes.begin();
it != calling_codes.end(); ++it) {
EXPECT_GT(*it, 0);
string region_code;
phone_util_.GetRegionCodeForCountryCode(*it, &region_code);
EXPECT_NE(RegionCode::ZZ(), region_code);
}
std::set<int> supported_global_network_calling_codes;
phone_util_.GetSupportedGlobalNetworkCallingCodes(
&supported_global_network_calling_codes);
// There should be more than just the global network calling codes in this
// set.
EXPECT_GT(calling_codes.size(),
supported_global_network_calling_codes.size());
// But they should be included. Testing one of them.
EXPECT_NE(calling_codes.find(979), calling_codes.end());
}
TEST_F(PhoneNumberUtilTest, GetSupportedTypesForRegion) {
std::set<PhoneNumberUtil::PhoneNumberType> types;
phone_util_.GetSupportedTypesForRegion(RegionCode::BR(), &types);
@ -182,7 +205,7 @@ TEST_F(PhoneNumberUtilTest, GetSupportedTypesForNonGeoEntity) {
}
TEST_F(PhoneNumberUtilTest, GetRegionCodesForCountryCallingCode) {
list<string> regions;
std::list<string> regions;
phone_util_.GetRegionCodesForCountryCallingCode(1, &regions);
EXPECT_TRUE(find(regions.begin(), regions.end(), RegionCode::US())


+ 13
- 0
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -970,6 +970,19 @@ public class PhoneNumberUtil {
return Collections.unmodifiableSet(countryCodesForNonGeographicalRegion);
}
/**
* Returns all country calling codes the library has metadata for, covering both non-geographical
* entities (global network calling codes) and those used for geographical entities. This could be
* used to populate a drop-down box of country calling codes for a phone-number widget, for
* instance.
*
* @return an unordered set of the country calling codes for every geographical and
* non-geographical entity the library supports
*/
public Set<Integer> getSupportedCallingCodes() {
return Collections.unmodifiableSet(countryCallingCodeToRegionCodeMap.keySet());
}
/**
* Returns true if there is any possible number data set for a particular PhoneNumberDesc.
*/


+ 13
- 0
java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java View File

@ -129,6 +129,19 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
}
}
public void testGetSupportedCallingCodes() {
Set<Integer> callingCodes = phoneUtil.getSupportedCallingCodes();
assertTrue(callingCodes.size() > 0);
for (int callingCode : callingCodes) {
assertTrue(callingCode > 0);
assertTrue(phoneUtil.getRegionCodeForCountryCode(callingCode) != RegionCode.ZZ);
}
// There should be more than just the global network calling codes in this set.
assertTrue(callingCodes.size() > phoneUtil.getSupportedGlobalNetworkCallingCodes().size());
// But they should be included. Testing one of them.
assertTrue(callingCodes.contains(979));
}
public void testGetInstanceLoadBadMetadata() {
assertNull(phoneUtil.getMetadataForRegion("No Such Region"));
assertNull(phoneUtil.getMetadataForNonGeographicalRegion(-1));


+ 58
- 57
javascript/i18n/phonenumbers/demo-compiled.js View File

@ -1,15 +1,16 @@
(function(){for(var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},k="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,m=["String","prototype","repeat"],ba=0;ba<m.length-1;ba++){var ca=m[ba];ca in k||(k[ca]={});k=k[ca]}
var da=m[m.length-1],ea=k[da],fa=ea?ea:function(a){var b;if(null==this)throw new TypeError("The 'this' value for String.prototype.repeat must not be null or undefined");b=this+"";if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var c="";a;)if(a&1&&(c+=b),a>>>=1)b+=b;return c};fa!=ea&&null!=fa&&aa(k,da,{configurable:!0,writable:!0,value:fa});
function ga(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function n(a){return"string"==typeof a}function p(a,b){function c(){}c.prototype=b.prototype;a.ca=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.na=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};function q(a){if(Error.captureStackTrace)Error.captureStackTrace(this,q);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}p(q,Error);q.prototype.name="CustomError";function ha(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")};function ia(a,b){b.unshift(a);q.call(this,ha.apply(null,b));b.shift()}p(ia,q);ia.prototype.name="AssertionError";function ja(a,b){throw new ia("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var ka=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(n(a))return n(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};function la(a,b){a.sort(b||ma)}function ma(a,b){return a>b?1:a<b?-1:0};function na(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function oa(a,b){var c;a:{for(c in a)if(b.call(void 0,a[c],c,a))break a;c=void 0}return c&&a[c]};function pa(a){var b=document;return n(a)?b.getElementById(a):a};function qa(a){var b=[];ra(new sa,a,b);return b.join("")}function sa(){}
function ra(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if("array"==ga(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),e=d[f],ra(a,e,c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");f="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(e=b[d],"function"!=typeof e&&(c.push(f),ta(d,c),c.push(":"),ra(a,e,c),f=","));c.push("}");return}}switch(typeof b){case "string":ta(b,c);break;case "number":c.push(isFinite(b)&&
!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var ua={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},va=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function ta(a,b){b.push('"',a.replace(va,function(a){var b=ua[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),ua[a]=b);return b}),'"')};function wa(a,b){this.a=a;this.l=b.name;this.f=!!b.u;this.b=b.c;this.j=b.type;this.i=!1;switch(this.b){case xa:case ya:case za:case Aa:case Ba:case Ca:case Da:this.i=!0}this.g=b.defaultValue}var Da=1,Ca=2,xa=3,ya=4,za=6,Aa=16,Ba=18;function Ea(a,b){this.b=a;this.a={};for(var c=0;c<b.length;c++){var d=b[c];this.a[d.a]=d}}function Fa(a){a=na(a.a);la(a,function(a,c){return a.a-c.a});return a}function Ga(a,b){return oa(a.a,function(a){return a.l==b})||null};function r(){this.b={};this.f=this.h().a;this.a=this.g=null}function Ha(a,b){for(var c in a.b){var d=Number(c);a.f[d]||b.call(a,d,a.b[c])}}r.prototype.has=function(a){return t(this,a.a)};r.prototype.get=function(a,b){return u(this,a.a,b)};r.prototype.set=function(a,b){v(this,a.a,b)};
function Ia(a,b){for(var c=Fa(a.h()),d=0;d<c.length;d++){var e=c[d],f=e.a;if(t(b,f)){a.a&&delete a.a[e.a];var g=11==e.b||10==e.b;if(e.f)for(var e=w(b,f),h=0;h<e.length;h++)Ja(a,f,g?e[h].clone():e[h]);else e=Ka(b,f),g?(g=Ka(a,f))?Ia(g,e):v(a,f,e.clone()):v(a,f,e)}}}r.prototype.clone=function(){var a=new this.constructor;a!=this&&(a.b={},a.a&&(a.a={}),Ia(a,this));return a};function t(a,b){return null!=a.b[b]}
function Ka(a,b){var c=a.b[b];if(null==c)return null;if(a.g){if(!(b in a.a)){var d=a.g,e=a.f[b];if(null!=c)if(e.f){for(var f=[],g=0;g<c.length;g++)f[g]=d.a(e,c[g]);c=f}else c=d.a(e,c);return a.a[b]=c}return a.a[b]}return c}function u(a,b,c){var d=Ka(a,b);return a.f[b].f?d[c||0]:d}function y(a,b){var c;if(t(a,b))c=u(a,b,void 0);else a:{c=a.f[b];if(void 0===c.g){var d=c.j;if(d===Boolean)c.g=!1;else if(d===Number)c.g=0;else if(d===String)c.g=c.i?"0":"";else{c=new d;break a}}c=c.g}return c}
function w(a,b){return Ka(a,b)||[]}function z(a,b){return a.f[b].f?t(a,b)?a.b[b].length:0:t(a,b)?1:0}function v(a,b,c){a.b[b]=c;a.a&&(a.a[b]=c)}function Ja(a,b,c){a.b[b]||(a.b[b]=[]);a.b[b].push(c);a.a&&delete a.a[b]}function La(a,b){delete a.b[b];a.a&&delete a.a[b]}function Ma(a,b){var c=[],d;for(d in b)0!=d&&c.push(new wa(d,b[d]));return new Ea(a,c)};function A(){}A.prototype.b=function(a,b){return 11==a.b||10==a.b?this.g(b):"number"!=typeof b||isFinite(b)?b:b.toString()};A.prototype.f=function(a,b){var c=new a.b;this.i(c,b);return c};
A.prototype.a=function(a,b){if(11==a.b||10==a.b)return b instanceof r?b:this.f(a.j.prototype.h(),b);if(14==a.b){if(n(b)&&Na.test(b)){var c=Number(b);if(0<c)return c}return b}if(!a.i)return b;c=a.j;if(c===String){if("number"==typeof b)return String(b)}else if(c===Number&&n(b)&&("Infinity"===b||"-Infinity"===b||"NaN"===b||Na.test(b)))return Number(b);return b};var Na=/^-?[0-9]+$/;function B(a,b){this.j=a;this.l=b}p(B,A);B.prototype.g=function(a){for(var b=Fa(a.h()),c={},d=0;d<b.length;d++){var e=b[d],f=1==this.j?e.l:e.a;if(a.has(e))if(e.f){var g=[];c[f]=g;for(f=0;f<z(a,e.a);f++)g.push(this.b(e,a.get(e,f)))}else c[f]=this.b(e,a.get(e))}Ha(a,function(a,b){c[a]=b});return c};B.prototype.b=function(a,b){return this.l&&8==a.b&&"boolean"==typeof b?b?1:0:B.ca.b.call(this,a,b)};B.prototype.a=function(a,b){return 8==a.b&&"number"==typeof b?!!b:B.ca.a.call(this,a,b)};
B.prototype.i=function(a,b){var c=a.h(),d;for(d in b){var e,f=b[d],g=!/[^0-9]/.test(d);if(e=g?c.a[parseInt(d,10)]||null:Ga(c,d))if(e.f)for(g=0;g<f.length;g++){var h=this.a(e,f[g]);Ja(a,e.a,h)}else a.set(e,this.a(e,f));else g?(e=a,g=Number(d),e.b[g]=f,e.a&&delete e.a[g]):ja("Failed to find field: "+d)}};function C(a,b){null!=a&&this.a.apply(this,arguments)}C.prototype.b="";C.prototype.set=function(a){this.b=""+a};C.prototype.a=function(a,b,c){this.b+=String(a);if(null!=b)for(var d=1;d<arguments.length;d++)this.b+=arguments[d];return this};function D(a){a.b=""}C.prototype.toString=function(){return this.b};/*
(function(){var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this;
function ca(a,b){if(b){for(var c=ba,d=a.split("."),e=0;e<d.length-1;e++){var f=d[e];f in c||(c[f]={});c=c[f]}d=d[d.length-1];e=c[d];f=b(e);f!=e&&null!=f&&aa(c,d,{configurable:!0,writable:!0,value:f})}}
ca("String.prototype.repeat",function(a){return a?a:function(a){var b;if(null==this)throw new TypeError("The 'this' value for String.prototype.repeat must not be null or undefined");b=this+"";if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var d="";a;)if(a&1&&(d+=b),a>>>=1)b+=b;return d}});ca("Math.sign",function(a){return a?a:function(a){a=Number(a);return!a||isNaN(a)?a:0<a?1:-1}});
function da(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function k(a){return"string"==typeof a}function m(a,b){function c(){}c.prototype=b.prototype;a.ha=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.na=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};function n(a){if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}m(n,Error);n.prototype.name="CustomError";function ea(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")};function fa(a,b){b.unshift(a);n.call(this,ea.apply(null,b));b.shift()}m(fa,n);fa.prototype.name="AssertionError";function ga(a,b){throw new fa("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var p=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(k(a))return k(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};function ha(a,b){a.sort(b||ia)}function ia(a,b){return a>b?1:a<b?-1:0};function ja(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function ka(a,b){var c;a:{for(c in a)if(b.call(void 0,a[c],c,a))break a;c=void 0}return c&&a[c]};function q(a){var b=document;return k(a)?b.getElementById(a):a};function la(a){var b=[];ma(new na,a,b);return b.join("")}function na(){}
function ma(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if("array"==da(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),ma(a,d[f],c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");e="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(f=b[d],"function"!=typeof f&&(c.push(e),oa(d,c),c.push(":"),ma(a,f,c),e=","));c.push("}");return}}switch(typeof b){case "string":oa(b,c);break;case "number":c.push(isFinite(b)&&
!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var pa={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},qa=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function oa(a,b){b.push('"',a.replace(qa,function(a){var b=pa[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),pa[a]=b);return b}),'"')};function ra(a,b){this.a=a;this.l=b.name;this.f=!!b.u;this.b=b.c;this.j=b.type;this.i=!1;switch(this.b){case sa:case ta:case ua:case va:case wa:case xa:case ya:this.i=!0}this.g=b.defaultValue}var ya=1,xa=2,sa=3,ta=4,ua=6,va=16,wa=18;function za(a,b){this.b=a;this.a={};for(var c=0;c<b.length;c++){var d=b[c];this.a[d.a]=d}}function Aa(a){a=ja(a.a);ha(a,function(a,c){return a.a-c.a});return a}function Ba(a,b){return ka(a.a,function(a){return a.l==b})||null};function r(){this.b={};this.f=this.h().a;this.a=this.g=null}function Ca(a,b){for(var c in a.b){var d=Number(c);a.f[d]||b.call(a,d,a.b[c])}}r.prototype.has=function(a){return t(this,a.a)};r.prototype.get=function(a,b){return u(this,a.a,b)};r.prototype.set=function(a,b){v(this,a.a,b)};
function Da(a,b){for(var c=Aa(a.h()),d=0;d<c.length;d++){var e=c[d],f=e.a;if(t(b,f)){a.a&&delete a.a[e.a];var g=11==e.b||10==e.b;if(e.f)for(var e=w(b,f),h=0;h<e.length;h++)Ea(a,f,g?e[h].clone():e[h]);else e=Fa(b,f),g?(g=Fa(a,f))?Da(g,e):v(a,f,e.clone()):v(a,f,e)}}}r.prototype.clone=function(){var a=new this.constructor;a!=this&&(a.b={},a.a&&(a.a={}),Da(a,this));return a};function t(a,b){return null!=a.b[b]}
function Fa(a,b){var c=a.b[b];if(null==c)return null;if(a.g){if(!(b in a.a)){var d=a.g,e=a.f[b];if(null!=c)if(e.f){for(var f=[],g=0;g<c.length;g++)f[g]=d.a(e,c[g]);c=f}else c=d.a(e,c);return a.a[b]=c}return a.a[b]}return c}function u(a,b,c){var d=Fa(a,b);return a.f[b].f?d[c||0]:d}function y(a,b){var c;if(t(a,b))c=u(a,b,void 0);else a:{c=a.f[b];if(void 0===c.g){var d=c.j;if(d===Boolean)c.g=!1;else if(d===Number)c.g=0;else if(d===String)c.g=c.i?"0":"";else{c=new d;break a}}c=c.g}return c}
function w(a,b){return Fa(a,b)||[]}function z(a,b){return a.f[b].f?t(a,b)?a.b[b].length:0:t(a,b)?1:0}function v(a,b,c){a.b[b]=c;a.a&&(a.a[b]=c)}function Ea(a,b,c){a.b[b]||(a.b[b]=[]);a.b[b].push(c);a.a&&delete a.a[b]}function Ga(a,b){delete a.b[b];a.a&&delete a.a[b]}function Ha(a,b){var c=[],d;for(d in b)0!=d&&c.push(new ra(d,b[d]));return new za(a,c)};function A(){}A.prototype.b=function(a,b){return 11==a.b||10==a.b?this.g(b):"number"!=typeof b||isFinite(b)?b:b.toString()};A.prototype.f=function(a,b){var c=new a.b;this.i(c,b);return c};
A.prototype.a=function(a,b){if(11==a.b||10==a.b)return b instanceof r?b:this.f(a.j.prototype.h(),b);if(14==a.b){if(k(b)&&Ia.test(b)){var c=Number(b);if(0<c)return c}return b}if(!a.i)return b;c=a.j;if(c===String){if("number"==typeof b)return String(b)}else if(c===Number&&k(b)&&("Infinity"===b||"-Infinity"===b||"NaN"===b||Ia.test(b)))return Number(b);return b};var Ia=/^-?[0-9]+$/;function B(a,b){this.j=a;this.l=b}m(B,A);B.prototype.g=function(a){for(var b=Aa(a.h()),c={},d=0;d<b.length;d++){var e=b[d],f=1==this.j?e.l:e.a;if(a.has(e))if(e.f){var g=[];c[f]=g;for(f=0;f<z(a,e.a);f++)g.push(this.b(e,a.get(e,f)))}else c[f]=this.b(e,a.get(e))}Ca(a,function(a,b){c[a]=b});return c};B.prototype.b=function(a,b){return this.l&&8==a.b&&"boolean"==typeof b?b?1:0:B.ha.b.call(this,a,b)};B.prototype.a=function(a,b){return 8==a.b&&"number"==typeof b?!!b:B.ha.a.call(this,a,b)};
B.prototype.i=function(a,b){var c=a.h(),d;for(d in b){var e,f=b[d],g=!/[^0-9]/.test(d);if(e=g?c.a[parseInt(d,10)]||null:Ba(c,d))if(e.f)for(g=0;g<f.length;g++){var h=this.a(e,f[g]);Ea(a,e.a,h)}else a.set(e,this.a(e,f));else g?(e=a,g=Number(d),e.b[g]=f,e.a&&delete e.a[g]):ga("Failed to find field: "+e)}};function C(a,b){null!=a&&this.a.apply(this,arguments)}C.prototype.b="";C.prototype.set=function(a){this.b=""+a};C.prototype.a=function(a,b,c){this.b+=String(a);if(null!=b)for(var d=1;d<arguments.length;d++)this.b+=arguments[d];return this};function D(a){a.b=""}C.prototype.toString=function(){return this.b};/*
Protocol Buffer 2 Copyright 2008 Google Inc.
All other code copyright its respective owners.
@ -27,13 +28,13 @@ B.prototype.i=function(a,b){var c=a.h(),d;for(d in b){var e,f=b[d],g=!/[^0-9]/.t
See the License for the specific language governing permissions and
limitations under the License.
*/
function E(){r.call(this)}p(E,r);var Oa=null;function F(){r.call(this)}p(F,r);var Pa=null;function G(){r.call(this)}p(G,r);var Qa=null;
E.prototype.h=function(){var a=Oa;a||(Oa=a=Ma(E,{0:{name:"NumberFormat",ba:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",u:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,defaultValue:!1,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}}));return a};E.h=E.prototype.h;
F.prototype.h=function(){var a=Pa;a||(Pa=a=Ma(F,{0:{name:"PhoneNumberDesc",ba:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},9:{name:"possible_length",u:!0,c:5,type:Number},10:{name:"possible_length_local_only",u:!0,c:5,type:Number},6:{name:"example_number",c:9,type:String}}));return a};F.h=F.prototype.h;
G.prototype.h=function(){var a=Qa;a||(Qa=a=Ma(G,{0:{name:"PhoneMetadata",ba:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:F},2:{name:"fixed_line",c:11,type:F},3:{name:"mobile",c:11,type:F},4:{name:"toll_free",c:11,type:F},5:{name:"premium_rate",c:11,type:F},6:{name:"shared_cost",c:11,type:F},7:{name:"personal_number",c:11,type:F},8:{name:"voip",c:11,type:F},21:{name:"pager",c:11,type:F},25:{name:"uan",c:11,type:F},27:{name:"emergency",c:11,type:F},28:{name:"voicemail",c:11,type:F},
function E(){r.call(this)}m(E,r);var Ja=null;function F(){r.call(this)}m(F,r);var Ka=null;function G(){r.call(this)}m(G,r);var La=null;
E.prototype.h=function(){var a=Ja;a||(Ja=a=Ha(E,{0:{name:"NumberFormat",ba:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",u:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,defaultValue:!1,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}}));return a};E.h=E.prototype.h;
F.prototype.h=function(){var a=Ka;a||(Ka=a=Ha(F,{0:{name:"PhoneNumberDesc",ba:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},9:{name:"possible_length",u:!0,c:5,type:Number},10:{name:"possible_length_local_only",u:!0,c:5,type:Number},6:{name:"example_number",c:9,type:String}}));return a};F.h=F.prototype.h;
G.prototype.h=function(){var a=La;a||(La=a=Ha(G,{0:{name:"PhoneMetadata",ba:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:F},2:{name:"fixed_line",c:11,type:F},3:{name:"mobile",c:11,type:F},4:{name:"toll_free",c:11,type:F},5:{name:"premium_rate",c:11,type:F},6:{name:"shared_cost",c:11,type:F},7:{name:"personal_number",c:11,type:F},8:{name:"voip",c:11,type:F},21:{name:"pager",c:11,type:F},25:{name:"uan",c:11,type:F},27:{name:"emergency",c:11,type:F},28:{name:"voicemail",c:11,type:F},
24:{name:"no_international_dialling",c:11,type:F},9:{name:"id",required:!0,c:9,type:String},10:{name:"country_code",c:5,type:Number},11:{name:"international_prefix",c:9,type:String},17:{name:"preferred_international_prefix",c:9,type:String},12:{name:"national_prefix",c:9,type:String},13:{name:"preferred_extn_prefix",c:9,type:String},15:{name:"national_prefix_for_parsing",c:9,type:String},16:{name:"national_prefix_transform_rule",c:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",c:8,defaultValue:!1,
type:Boolean},19:{name:"number_format",u:!0,c:11,type:E},20:{name:"intl_number_format",u:!0,c:11,type:E},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}}));return a};G.h=G.prototype.h;function Ra(){}p(Ra,A);Ra.prototype.f=function(a,b){var c=new a.b;c.g=this;c.b=b;c.a={};return c};Ra.prototype.i=function(){throw Error("Unimplemented");};function H(){}p(H,Ra);H.prototype.g=function(a){for(var b=Fa(a.h()),c=[],d=0;d<b.length;d++){var e=b[d];if(a.has(e)){var f=e.a;if(e.f){c[f]=[];for(var g=0;g<z(a,e.a);g++)c[f][g]=this.b(e,a.get(e,g))}else c[f]=this.b(e,a.get(e))}}Ha(a,function(a,b){c[a]=b});return c};H.prototype.b=function(a,b){return 8==a.b?b?1:0:A.prototype.b.apply(this,arguments)};H.prototype.a=function(a,b){return 8==a.b?!!b:A.prototype.a.apply(this,arguments)};H.prototype.f=function(a,b){return H.ca.f.call(this,a,b)};function I(){r.call(this)}p(I,r);var Sa=null,Ta={ma:0,la:1,ka:5,ja:10,ia:20};
I.prototype.h=function(){var a=Sa;a||(Sa=a=Ma(I,{0:{name:"PhoneNumber",ba:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:!0,c:5,type:Number},2:{name:"national_number",required:!0,c:4,type:Number},3:{name:"extension",c:9,type:String},4:{name:"italian_leading_zero",c:8,type:Boolean},8:{name:"number_of_leading_zeros",c:5,defaultValue:1,type:Number},5:{name:"raw_input",c:9,type:String},6:{name:"country_code_source",c:14,defaultValue:0,type:Ta},7:{name:"preferred_domestic_carrier_code",
type:Boolean},19:{name:"number_format",u:!0,c:11,type:E},20:{name:"intl_number_format",u:!0,c:11,type:E},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}}));return a};G.h=G.prototype.h;function Ma(){}m(Ma,A);Ma.prototype.f=function(a,b){var c=new a.b;c.g=this;c.b=b;c.a={};return c};Ma.prototype.i=function(){throw Error("Unimplemented");};function H(){}m(H,Ma);H.prototype.g=function(a){for(var b=Aa(a.h()),c=[],d=0;d<b.length;d++){var e=b[d];if(a.has(e)){var f=e.a;if(e.f){c[f]=[];for(var g=0;g<z(a,e.a);g++)c[f][g]=this.b(e,a.get(e,g))}else c[f]=this.b(e,a.get(e))}}Ca(a,function(a,b){c[a]=b});return c};H.prototype.b=function(a,b){return 8==a.b?b?1:0:A.prototype.b.apply(this,arguments)};H.prototype.a=function(a,b){return 8==a.b?!!b:A.prototype.a.apply(this,arguments)};function I(){r.call(this)}m(I,r);var Na=null,Oa={ma:0,la:1,ka:5,ja:10,ia:20};
I.prototype.h=function(){var a=Na;a||(Na=a=Ha(I,{0:{name:"PhoneNumber",ba:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:!0,c:5,type:Number},2:{name:"national_number",required:!0,c:4,type:Number},3:{name:"extension",c:9,type:String},4:{name:"italian_leading_zero",c:8,type:Boolean},8:{name:"number_of_leading_zeros",c:5,defaultValue:1,type:Number},5:{name:"raw_input",c:9,type:String},6:{name:"country_code_source",c:14,defaultValue:0,type:Oa},7:{name:"preferred_domestic_carrier_code",
c:9,type:String}}));return a};I.ctor=I;I.ctor.h=I.prototype.h;/*
Copyright (C) 2010 The Libphonenumber Authors
@ -54,7 +55,7 @@ var J={1:"US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC V
86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],
253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],385:["HR"],386:["SI"],
387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],
692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},Ua={AC:[,[,,"[46]\\d{4}|[01589]\\d{5}",,,,,,,[5,6]],
692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},Pa={AC:[,[,,"[46]\\d{4}|[01589]\\d{5}",,,,,,,[5,6]],
[,,"6[2-467]\\d{3}",,,,"62889",,,[5]],[,,"4\\d{4}",,,,"40123",,,[5]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],"AC",247,"00",,,,,,,,,,[,,,,,,,,,[-1]],,,[,,,,,,,,,[-1]],[,,"[01589]\\d{5}",,,,"542011",,,[6]],,,[,,,,,,,,,[-1]]],AD:[,[,,"[16]\\d{5,8}|[37-9]\\d{5}",,,,,,,[6,8,9]],[,,"[78]\\d{5}",,,,"712345",,,[6]],[,,"(?:3\\d|6(?:[0-8]|90\\d{2}))\\d{4}",,,,"312345",,,[6,9]],[,,"180[02]\\d{4}",,,,"18001234",,,[8]],[,,"[19]\\d{5}",,,,"912345",,,[6]],[,,,,,,,,,[-1]],
[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],"AD",376,"00",,,,,,,,[[,"(\\d{3})(\\d{3})","$1 $2",["[137-9]|6[0-8]"]],[,"(\\d{4})(\\d{4})","$1 $2",["180","180[02]"]],[,"(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["690"]]],,[,,,,,,,,,[-1]],,,[,,"1800\\d{4}",,,,"18000000",,,[8]],[,,,,,,,,,[-1]],,,[,,,,,,,,,[-1]]],AE:[,[,,"[2-79]\\d{7,8}|800\\d{2,9}",,,,,,,[5,6,7,8,9,10,11,12]],[,,"[2-4679][2-8]\\d{6}",,,,"22345678",,,[8],[7]],[,,"5[024-68]\\d{7}",,,,"501234567",,,[9]],[,,"400\\d{6}|800\\d{2,9}",,,,"800123456"],[,,"900[02]\\d{5}",
,,,"900234567",,,[9]],[,,"700[05]\\d{5}",,,,"700012345",,,[9]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],"AE",971,"00","0",,,"0",,,,[[,"([2-4679])(\\d{3})(\\d{4})","$1 $2 $3",["[2-4679][2-8]"],"0$1"],[,"(5\\d)(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],[,"([479]00)(\\d)(\\d{5})","$1 $2 $3",["[479]0"],"$1"],[,"([68]00)(\\d{2,9})","$1 $2",["60|8"],"$1"]],,[,,,,,,,,,[-1]],,,[,,,,,,,,,[-1]],[,,"600[25]\\d{5}",,,,"600212345",,,[9]],,,[,,,,,,,,,[-1]]],AF:[,[,,"[2-7]\\d{8}",,,,,,,[9],[7]],[,,"(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}",
@ -423,41 +424,41 @@ NC:[,[,,"[2-57-9]\\d{5}",,,,,,,[6]],[,,"(?:2[03-9]|3[0-5]|4[1-7]|88)\\d{4}",,,,"
limitations under the License.
*/
function K(){this.a={}}K.a=function(){return K.b?K.b:K.b=new K};
var L={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},Va={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",
7:"7",8:"8",9:"9","+":"+","*":"*","#":"#"},Wa={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2",
B:"2",C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},Xa=/[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?/,Ya=RegExp("[+\uff0b]+"),M=RegExp("^[+\uff0b]+"),Za=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),$a=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),ab=/[\\\/] *x/,bb=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),cb=/(?:.*?[A-Za-z]){3}.*/,db=RegExp("(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[;,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)$",
"i"),eb=RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[;,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)?$",
"i"),fb=/(\$\d)/,gb=/\$NP/,hb=/\$FG/,ib=/\$CC/,jb=/^\(?\$1\)?$/;function kb(a){var b=a.search($a);0<=b?(a=a.substring(b),a=a.replace(bb,""),b=a.search(ab),0<=b&&(a=a.substring(0,b))):a="";return a}function lb(a){return 2>a.length?!1:N(eb,a)}function mb(a){return N(cb,a)?O(a,Wa):O(a,L)}function nb(a){var b=mb(a.toString());D(a);a.a(b)}function ob(a){return!!a&&(1!=z(a,9)||-1!=w(a,9)[0])}
function O(a,b){for(var c=new C,d,e=a.length,f=0;f<e;++f)d=a.charAt(f),d=b[d.toUpperCase()],null!=d&&c.a(d);return c.toString()}function rb(a){return null!=a&&isNaN(a)&&a.toUpperCase()in Ua}function P(a,b,c){if(0==u(b,2)&&t(b,5)){var d=y(b,5);if(0<d.length)return d}var d=y(b,1),e=Q(b);if(0==c)return R(d,0,e,"");if(!(d in J))return e;a=S(a,d,T(d));b=sb(b,a,c);e=tb(e,a,c);return R(d,c,e,b)}
function ub(a,b,c){var d=y(b,1),e=Q(b);if(!(d in J))return e;a=S(a,d,T(d));b=sb(b,a,2);c=tb(e,a,2,c);return R(d,2,c,b)}function S(a,b,c){return"001"==c?U(a,""+b):U(a,c)}
function vb(a,b,c){if(!rb(c))return P(a,b,1);var d=y(b,1),e=Q(b);if(!(d in J))return e;if(1==d){if(null!=c&&0<=ka(J[1],c.toUpperCase()))return d+" "+P(a,b,2)}else if(d==wb(a,c))return P(a,b,2);var f=U(a,c),g=y(f,11);c="";N(Xa,g)?c=g:t(f,17)&&(c=y(f,17));a=S(a,d,T(d));e=tb(e,a,1);b=sb(b,a,1);return 0<c.length?c+" "+d+" "+e+b:R(d,1,e,b)}
function xb(a,b,c){var d;if(d=t(b,5)){d=y(b,1);if(d=S(a,d,T(d))){var e=Q(b);d=!!yb(w(d,19),e)}else d=!1;d=!d}if(d)return y(b,5);if(!t(b,6))return P(a,b,2);switch(u(b,6)){case 1:a=P(a,b,1);break;case 5:a=vb(a,b,c);break;case 10:a=P(a,b,1).substring(1);break;default:d=T(y(b,1));var f;(c=U(a,d))?(c=y(c,12),f=c.length?c=c.replace("~",""):null):f=null;c=P(a,b,2);if(null!=f&&f.length){var g;a:{e=y(b,5);e=O(e,L);if(!e.lastIndexOf(f,0))try{g=zb(a,Ab(a,e.substring(f.length),d,!1));break a}catch(h){}g=!1}if(g)a=
c;else if(g=U(a,d),d=Q(b),g=yb(w(g,19),d))if(d=y(g,4),e=d.indexOf("$1"),0>=e)a=c;else if(d=d.substring(0,e),d=O(d,L),d.length)if(g=g.clone(),La(g,4),d=[g],g=y(b,1),c=Q(b),g in J){a=S(a,g,T(g));if(e=yb(d,c))d=e.clone(),e=y(e,4),0<e.length&&(f=y(a,12),0<f.length?(e=e.replace(gb,f).replace(hb,"$1"),v(d,4,e)):La(d,4)),c=Bb(c,d,2);a=sb(b,a,2);a=R(g,2,c,a)}else a=c;else a=c;else a=c}else a=c}b=y(b,5);null!=a&&0<b.length&&(g=O(a,Va),c=O(b,Va),g!=c&&(a=b));return a}
function Q(a){if(!t(a,2))return"";var b=""+u(a,2);return t(a,4)&&u(a,4)&&0<y(a,8)?Array(y(a,8)+1).join("0")+b:b}function R(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}function tb(a,b,c,d){b=w(b,20).length&&2!=c?w(b,20):w(b,19);return(b=yb(b,a))?Bb(a,b,c,d):a}function yb(a,b){for(var c,d=a.length,e=0;e<d;++e){c=a[e];var f=z(c,3);if(!f||!b.search(u(c,3,f-1)))if(f=new RegExp(u(c,1)),N(f,b))return c}return null}
function Bb(a,b,c,d){var e=y(b,2),f=new RegExp(u(b,1)),g=y(b,5);2==c&&null!=d&&0<d.length&&0<g.length?(b=g.replace(ib,d),e=e.replace(fb,b),a=a.replace(f,e)):(b=y(b,4),a=2==c&&null!=b&&0<b.length?a.replace(f,e.replace(fb,b)):a.replace(f,e));3==c&&(a=a.replace(RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+"),""),a=a.replace(RegExp("[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+",
"g"),"-"));return a}function sb(a,b,c){return t(a,3)&&u(a,3).length?3==c?";ext="+u(a,3):t(b,13)?u(b,13)+y(a,3):" ext. "+y(a,3):""}function Cb(a,b){switch(b){case 4:return u(a,5);case 3:return u(a,4);case 1:return u(a,3);case 0:case 2:return u(a,2);case 5:return u(a,6);case 6:return u(a,8);case 7:return u(a,7);case 8:return u(a,21);case 9:return u(a,25);case 10:return u(a,28);default:return u(a,1)}}
function Db(a,b){return V(a,u(b,1))?V(a,u(b,5))?4:V(a,u(b,4))?3:V(a,u(b,6))?5:V(a,u(b,8))?6:V(a,u(b,7))?7:V(a,u(b,21))?8:V(a,u(b,25))?9:V(a,u(b,28))?10:V(a,u(b,2))?u(b,18)||V(a,u(b,3))?2:0:!u(b,18)&&V(a,u(b,3))?1:-1:-1}function U(a,b){if(null==b)return null;b=b.toUpperCase();var c=a.a[b];if(!c){c=Ua[b];if(!c)return null;c=(new H).f(G.h(),c);a.a[b]=c}return c}function V(a,b){var c=a.length;return 0<z(b,9)&&-1==ka(w(b,9),c)?!1:N(y(b,2),a)}function zb(a,b){var c=Eb(a,b);return Fb(a,b,c)}
function Fb(a,b,c){var d=y(b,1),e=S(a,d,c);if(!e||"001"!=c&&d!=wb(a,c))return!1;a=Q(b);return-1!=Db(a,e)}function Eb(a,b){if(!b)return null;var c=y(b,1);if(c=J[c])if(1==c.length)c=c[0];else a:{for(var d=Q(b),e,f=c.length,g=0;g<f;g++){e=c[g];var h=U(a,e);if(t(h,23)){if(!d.search(u(h,23))){c=e;break a}}else if(-1!=Db(d,h)){c=e;break a}}c=null}else c=null;return c}function T(a){return(a=J[a])?a[0]:"ZZ"}function wb(a,b){var c=U(a,b);if(!c)throw Error("Invalid region code: "+b);return y(c,10)}
function Gb(a,b,c,d){var e=Cb(c,d),f=z(e,9)?w(e,9):w(u(c,1),9),e=w(e,10);if(2==d)if(ob(Cb(c,0)))a=Cb(c,1),ob(a)&&(f=f.concat(z(a,9)?w(a,9):w(u(c,1),9)),la(f),e.length?(e=e.concat(w(a,10)),la(e)):e=w(a,10));else return Gb(a,b,c,1);if(-1==f[0])return 5;b=b.length;if(-1<ka(e,b))return 4;c=f[0];return c==b?0:c>b?2:f[f.length-1]<b?3:-1<ka(f,b,1)?0:5}function Hb(a,b){var c=Q(b),d=y(b,1);if(!(d in J))return 1;d=S(a,d,T(d));return Gb(a,c,d,-1)}
function Ib(a,b){var c=a.toString();if(!c.length||"0"==c.charAt(0))return 0;for(var d,e=c.length,f=1;3>=f&&f<=e;++f)if(d=parseInt(c.substring(0,f),10),d in J)return b.a(c.substring(f)),d;return 0}
function Jb(a,b,c,d,e,f){if(!b.length)return 0;b=new C(b);var g;c&&(g=u(c,11));null==g&&(g="NonMatch");var h=b.toString();if(h.length)if(M.test(h))h=h.replace(M,""),D(b),b.a(mb(h)),g=1;else{h=new RegExp(g);nb(b);g=b.toString();if(g.search(h))g=!1;else{var h=g.match(h)[0].length,l=g.substring(h).match(Za);l&&null!=l[1]&&0<l[1].length&&"0"==O(l[1],L)?g=!1:(D(b),b.a(g.substring(h)),g=!0)}g=g?5:20}else g=20;e&&v(f,6,g);if(20!=g){if(2>=b.b.length)throw Error("Phone number too short after IDD");if(a=Ib(b,
d))return v(f,1,a),a;throw Error("Invalid country calling code");}if(c&&(g=y(c,10),h=""+g,l=b.toString(),!l.lastIndexOf(h,0)&&(h=new C(l.substring(h.length)),l=u(c,1),l=new RegExp(y(l,2)),Kb(h,c,null),h=h.toString(),!N(l,b.toString())&&N(l,h)||3==Gb(a,b.toString(),c,-1))))return d.a(h),e&&v(f,6,10),v(f,1,g),g;v(f,1,0);return 0}
function Kb(a,b,c){var d=a.toString(),e=d.length,f=u(b,15);if(e&&null!=f&&f.length){var g=new RegExp("^(?:"+f+")");if(e=g.exec(d)){var f=new RegExp(y(u(b,1),2)),h=N(f,d),l=e.length-1;b=u(b,16);if(null!=b&&b.length&&null!=e[l]&&e[l].length){if(d=d.replace(g,b),!h||N(f,d))c&&0<l&&c.a(e[1]),a.set(d)}else if(!h||N(f,d.substring(e[0].length)))c&&0<l&&null!=e[l]&&c.a(e[1]),a.set(d.substring(e[0].length))}}}
function Ab(a,b,c,d){if(null==b)throw Error("The string supplied did not seem to be a phone number");if(250<b.length)throw Error("The string supplied is too long to be a phone number");var e=new C,f=b.indexOf(";phone-context=");if(0<=f){var g=f+15;if("+"==b.charAt(g)){var h=b.indexOf(";",g);0<h?e.a(b.substring(g,h)):e.a(b.substring(g))}g=b.indexOf("tel:");e.a(b.substring(0<=g?g+4:0,f))}else e.a(kb(b));f=e.toString();g=f.indexOf(";isub=");0<g&&(D(e),e.a(f.substring(0,g)));if(!lb(e.toString()))throw Error("The string supplied did not seem to be a phone number");
f=e.toString();if(!(rb(c)||null!=f&&0<f.length&&M.test(f)))throw Error("Invalid country calling code");f=new I;d&&v(f,5,b);a:{b=e.toString();g=b.search(db);if(0<=g&&lb(b.substring(0,g)))for(var h=b.match(db),l=h.length,x=1;x<l;++x)if(null!=h[x]&&0<h[x].length){D(e);e.a(b.substring(0,g));b=h[x];break a}b=""}0<b.length&&v(f,3,b);b=U(a,c);g=new C;h=0;l=e.toString();try{h=Jb(a,l,b,g,d,f)}catch(W){if("Invalid country calling code"==W.message&&M.test(l)){if(l=l.replace(M,""),h=Jb(a,l,b,g,d,f),!h)throw W;
}else throw W;}h?(e=T(h),e!=c&&(b=S(a,h,e))):(nb(e),g.a(e.toString()),null!=c?(h=y(b,10),v(f,1,h)):d&&La(f,6));if(2>g.b.length)throw Error("The string supplied is too short to be a phone number");b&&(c=new C,e=new C(g.toString()),Kb(e,b,c),2!=Gb(a,e.toString(),b,-1)&&(g=e,d&&0<c.toString().length&&v(f,7,c.toString())));a=g.toString();d=a.length;if(2>d)throw Error("The string supplied is too short to be a phone number");if(17<d)throw Error("The string supplied is too long to be a phone number");if(1<
a.length&&"0"==a.charAt(0)){v(f,4,!0);for(d=1;d<a.length-1&&"0"==a.charAt(d);)d++;1!=d&&v(f,8,d)}v(f,2,parseInt(a,10));return f}function N(a,b){var c="string"==typeof a?b.match("^(?:"+a+")$"):b.match(a);return c&&c[0].length==b.length?!0:!1};function Lb(a){this.da=RegExp("\u2008");this.fa="";this.m=new C;this.w="";this.i=new C;this.v=new C;this.j=!0;this.$=this.o=this.ha=!1;this.ea=K.a();this.s=0;this.b=new C;this.aa=!1;this.l="";this.a=new C;this.f=[];this.ga=a;this.g=Mb(this,this.ga)}var Nb=new G;v(Nb,11,"NA");
var Ob=/\[([^\[\]])*\]/g,Pb=/\d(?=[^,}][^,}])/g,Qb=RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*(\\$\\d[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*)+$"),Rb=/[- ]/;function Mb(a,b){var c=rb(b)?wb(a.ea,b):0;return(c=U(a.ea,T(c)))?c:Nb}
function Sb(a){for(var b=a.f.length,c=0;c<b;++c){var d=a.f[c],e=y(d,1);if(a.w==e)return!1;var f;f=a;var g=d,h=y(g,1);if(-1!=h.indexOf("|"))f=!1;else{h=h.replace(Ob,"\\d");h=h.replace(Pb,"\\d");D(f.m);var l;l=f;var g=y(g,2),x="999999999999999".match(h)[0];x.length<l.a.b.length?l="":(l=x.replace(new RegExp(h,"g"),g),l=l.replace(RegExp("9","g"),"\u2008"));0<l.length?(f.m.a(l),f=!0):f=!1}if(f)return a.w=e,a.aa=Rb.test(u(d,4)),a.s=0,!0}return a.j=!1}
function Tb(a,b){for(var c=[],d=b.length-3,e=a.f.length,f=0;f<e;++f){var g=a.f[f];z(g,3)?(g=u(g,3,Math.min(d,z(g,3)-1)),b.search(g)||c.push(a.f[f])):c.push(a.f[f])}a.f=c}function Ub(a,b){a.fa=Vb(a,b);return a.fa}
function Vb(a,b){a.i.a(b);var c=b;if(Za.test(c)||1==a.i.b.length&&Ya.test(c)){var c=b,d;"+"==c?(d=c,a.v.a(c)):(d=L[c],a.v.a(d),a.a.a(d));b=d}else a.j=!1,a.ha=!0;if(!a.j){if(!a.ha)if(Wb(a)){if(Xb(a))return Yb(a)}else if(0<a.l.length&&(c=a.a.toString(),D(a.a),a.a.a(a.l),a.a.a(c),c=a.b.toString(),d=c.lastIndexOf(a.l),D(a.b),a.b.a(c.substring(0,d))),a.l!=Zb(a))return a.b.a(" "),Yb(a);return a.i.toString()}switch(a.v.b.length){case 0:case 1:case 2:return a.i.toString();case 3:if(Wb(a))a.$=!0;else return a.l=
Zb(a),$b(a);default:if(a.$)return Xb(a)&&(a.$=!1),a.b.toString()+a.a.toString();if(0<a.f.length){c=ac(a,b);d=bc(a);if(0<d.length)return d;Tb(a,a.a.toString());return Sb(a)?cc(a):a.j?dc(a,c):a.i.toString()}return $b(a)}}function Yb(a){a.j=!0;a.$=!1;a.f=[];a.s=0;D(a.m);a.w="";return $b(a)}function bc(a){for(var b=a.a.toString(),c=a.f.length,d=0;d<c;++d){var e=a.f[d],f=y(e,1);if((new RegExp("^(?:"+f+")$")).test(b))return a.aa=Rb.test(u(e,4)),b=b.replace(new RegExp(f,"g"),u(e,2)),dc(a,b)}return""}
function dc(a,b){var c=a.b.b.length;return a.aa&&0<c&&" "!=a.b.toString().charAt(c-1)?a.b+" "+b:a.b+b}function $b(a){var b=a.a.toString();if(3<=b.length){for(var c=a.o&&0<z(a.g,20)?w(a.g,20):w(a.g,19),d=c.length,e=0;e<d;++e){var f=c[e],g;(g=!t(a.g,12)||a.o||u(f,6))||(g=y(f,4),g=!g.length||jb.test(g));g&&Qb.test(y(f,2))&&a.f.push(f)}Tb(a,b);b=bc(a);return 0<b.length?b:Sb(a)?cc(a):a.i.toString()}return dc(a,b)}
function cc(a){var b=a.a.toString(),c=b.length;if(0<c){for(var d="",e=0;e<c;e++)d=ac(a,b.charAt(e));return a.j?dc(a,d):a.i.toString()}return a.b.toString()}
function Zb(a){var b=a.a.toString(),c=0,d;1!=u(a.g,10)?d=!1:(d=a.a.toString(),d="1"==d.charAt(0)&&"0"!=d.charAt(1)&&"1"!=d.charAt(1));d?(c=1,a.b.a("1").a(" "),a.o=!0):t(a.g,15)&&(d=new RegExp("^(?:"+u(a.g,15)+")"),(d=b.match(d))&&null!=d[0]&&0<d[0].length&&(a.o=!0,c=d[0].length,a.b.a(b.substring(0,c))));D(a.a);a.a.a(b.substring(c));return b.substring(0,c)}
function Wb(a){var b=a.v.toString(),c=new RegExp("^(?:\\+|"+u(a.g,11)+")");return(c=b.match(c))&&null!=c[0]&&0<c[0].length?(a.o=!0,c=c[0].length,D(a.a),a.a.a(b.substring(c)),D(a.b),a.b.a(b.substring(0,c)),"+"!=b.charAt(0)&&a.b.a(" "),!0):!1}function Xb(a){if(!a.a.b.length)return!1;var b=new C,c=Ib(a.a,b);if(!c)return!1;D(a.a);a.a.a(b.toString());b=T(c);"001"==b?a.g=U(a.ea,""+c):b!=a.ga&&(a.g=Mb(a,b));a.b.a(""+c).a(" ");a.l="";return!0}
function ac(a,b){var c=a.m.toString();if(0<=c.substring(a.s).search(a.da)){var d=c.search(a.da),c=c.replace(a.da,b);D(a.m);a.m.a(c);a.s=d;return c.substring(0,a.s+1)}1==a.f.length&&(a.j=!1);a.w="";return a.i.toString()};function ec(){var a=pa("phoneNumber").value,b=pa("defaultCountry").value,c=pa("carrierCode").value,d=new C;try{var e=K.a(),f;if(!rb(b)&&0<a.length&&"+"!=a.charAt(0))throw Error("Invalid country calling code");f=Ab(e,a,b,!0);d.a("****Parsing Result:****\n");d.a(qa((new B(1)).g(f)));d.a("\n\n****Validation Results:****");var g,h=Hb(e,f);g=0==h||4==h;d.a("\nResult from isPossibleNumber(): ");d.a(g);if(g){var l=zb(e,f);d.a("\nResult from isValidNumber(): ");d.a(l);l&&b&&"ZZ"!=b&&(d.a("\nResult from isValidNumberForRegion(): "),
d.a(Fb(e,f,b)));d.a("\nPhone Number region: ");d.a(Eb(e,f));d.a("\nResult from getNumberType(): ");var x;var W=Eb(e,f),pb=S(e,y(f,1),W);if(pb){var gc=Q(f);x=Db(gc,pb)}else x=-1;switch(x){case 0:d.a("FIXED_LINE");break;case 1:d.a("MOBILE");break;case 2:d.a("FIXED_LINE_OR_MOBILE");break;case 3:d.a("TOLL_FREE");break;case 4:d.a("PREMIUM_RATE");break;case 5:d.a("SHARED_COST");break;case 6:d.a("VOIP");break;case 7:d.a("PERSONAL_NUMBER");break;case 8:d.a("PAGER");break;case 9:d.a("UAN");break;case -1:d.a("UNKNOWN")}}else{d.a("\nResult from isPossibleNumberWithReason(): ");
switch(Hb(e,f)){case 1:d.a("INVALID_COUNTRY_CODE");break;case 2:d.a("TOO_SHORT");break;case 3:d.a("TOO_LONG")}d.a("\nNote: numbers that are not possible have type UNKNOWN, an unknown region, and are considered invalid.")}d.a("\n\n****Formatting Results:**** ");d.a("\nE164 format: ");d.a(l?P(e,f,0):"invalid");d.a("\nOriginal format: ");d.a(xb(e,f,b));d.a("\nNational format: ");d.a(P(e,f,2));d.a("\nInternational format: ");d.a(l?P(e,f,1):"invalid");d.a("\nOut-of-country format from US: ");d.a(l?vb(e,
f,"US"):"invalid");d.a("\nOut-of-country format from Switzerland: ");d.a(l?vb(e,f,"CH"):"invalid");0<c.length&&(d.a("\nNational format with carrier code: "),d.a(ub(e,f,c)));d.a("\n\n****AsYouTypeFormatter Results****");for(var hc=new Lb(b),ic=a.length,b=0;b<ic;++b){var qb=a.charAt(b);d.a("\nChar entered: ");d.a(qb);d.a(" Output: ");d.a(Ub(hc,qb))}}catch(jc){d.a("\n"+jc.toString())}pa("output").value=d.toString();return!1}var X=["phoneNumberParser"],Y=this;
X[0]in Y||!Y.execScript||Y.execScript("var "+X[0]);for(var Z;X.length&&(Z=X.shift());){var fc;if(fc=!X.length)fc=void 0!==ec;fc?Y[Z]=ec:Y[Z]?Y=Y[Z]:Y=Y[Z]={}};})();
var L={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},Qa={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",
7:"7",8:"8",9:"9","+":"+","*":"*","#":"#"},Ra={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2",
B:"2",C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},Sa=/[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?/,Ta=RegExp("[+\uff0b]+"),M=RegExp("^[+\uff0b]+"),Ua=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),Va=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),Wa=/[\\\/] *x/,Xa=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),Ya=/(?:.*?[A-Za-z]){3}.*/,Za=RegExp("(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[;,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)$",
"i"),$a=RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[;,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)?$",
"i"),ab=/(\$\d)/,bb=/\$NP/,cb=/\$FG/,db=/\$CC/,eb=/^\(?\$1\)?$/;function fb(a){var b=a.search(Va);0<=b?(a=a.substring(b),a=a.replace(Xa,""),b=a.search(Wa),0<=b&&(a=a.substring(0,b))):a="";return a}function gb(a){return 2>a.length?!1:N($a,a)}function hb(a){return N(Ya,a)?O(a,Ra):O(a,L)}function ib(a){var b=hb(a.toString());D(a);a.a(b)}function lb(a){return!!a&&(1!=z(a,9)||-1!=w(a,9)[0])}
function O(a,b){for(var c=new C,d,e=a.length,f=0;f<e;++f)d=a.charAt(f),d=b[d.toUpperCase()],null!=d&&c.a(d);return c.toString()}function mb(a){return null!=a&&isNaN(a)&&a.toUpperCase()in Pa}function P(a,b,c){if(0==u(b,2)&&t(b,5)){var d=y(b,5);if(0<d.length)return d}var d=y(b,1),e=Q(b);if(0==c)return R(d,0,e,"");if(!(d in J))return e;a=S(a,d,T(d));b=nb(b,a,c);e=ob(e,a,c);return R(d,c,e,b)}
function pb(a,b,c){var d=y(b,1),e=Q(b);if(!(d in J))return e;a=S(a,d,T(d));b=nb(b,a,2);c=ob(e,a,2,c);return R(d,2,c,b)}function S(a,b,c){return"001"==c?U(a,""+b):U(a,c)}
function qb(a,b,c){if(!mb(c))return P(a,b,1);var d=y(b,1),e=Q(b);if(!(d in J))return e;if(1==d){if(null!=c&&0<=p(J[1],c.toUpperCase()))return d+" "+P(a,b,2)}else if(d==rb(a,c))return P(a,b,2);var f=U(a,c),g=y(f,11);c="";N(Sa,g)?c=g:t(f,17)&&(c=y(f,17));a=S(a,d,T(d));e=ob(e,a,1);b=nb(b,a,1);return 0<c.length?c+" "+d+" "+e+b:R(d,1,e,b)}
function sb(a,b,c){var d;if(d=t(b,5)){d=y(b,1);if(d=S(a,d,T(d))){var e=Q(b);d=!!tb(w(d,19),e)}else d=!1;d=!d}if(d)return y(b,5);if(!t(b,6))return P(a,b,2);switch(u(b,6)){case 1:a=P(a,b,1);break;case 5:a=qb(a,b,c);break;case 10:a=P(a,b,1).substring(1);break;default:d=T(y(b,1));var f;(c=U(a,d))?(c=y(c,12),f=c.length?c=c.replace("~",""):null):f=null;c=P(a,b,2);if(null!=f&&f.length){var g;a:{e=y(b,5);e=O(e,L);if(!e.lastIndexOf(f,0))try{g=ub(a,vb(a,e.substring(f.length),d,!1));break a}catch(h){}g=!1}if(g)a=
c;else if(g=U(a,d),d=Q(b),g=tb(w(g,19),d))if(d=y(g,4),e=d.indexOf("$1"),0>=e)a=c;else if(d=d.substring(0,e),d=O(d,L),d.length)if(g=g.clone(),Ga(g,4),d=[g],g=y(b,1),c=Q(b),g in J){a=S(a,g,T(g));if(e=tb(d,c))d=e.clone(),e=y(e,4),0<e.length&&(f=y(a,12),0<f.length?(e=e.replace(bb,f).replace(cb,"$1"),v(d,4,e)):Ga(d,4)),c=wb(c,d,2);a=nb(b,a,2);a=R(g,2,c,a)}else a=c;else a=c;else a=c}else a=c}b=y(b,5);null!=a&&0<b.length&&(g=O(a,Qa),c=O(b,Qa),g!=c&&(a=b));return a}
function Q(a){if(!t(a,2))return"";var b=""+u(a,2);return t(a,4)&&u(a,4)&&0<y(a,8)?Array(y(a,8)+1).join("0")+b:b}function R(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}function ob(a,b,c,d){b=w(b,20).length&&2!=c?w(b,20):w(b,19);return(b=tb(b,a))?wb(a,b,c,d):a}function tb(a,b){for(var c,d=a.length,e=0;e<d;++e){c=a[e];var f=z(c,3);if(!f||!b.search(u(c,3,f-1)))if(f=new RegExp(u(c,1)),N(f,b))return c}return null}
function wb(a,b,c,d){var e=y(b,2),f=new RegExp(u(b,1)),g=y(b,5);2==c&&null!=d&&0<d.length&&0<g.length?(b=g.replace(db,d),e=e.replace(ab,b),a=a.replace(f,e)):(b=y(b,4),a=2==c&&null!=b&&0<b.length?a.replace(f,e.replace(ab,b)):a.replace(f,e));3==c&&(a=a.replace(RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+"),""),a=a.replace(RegExp("[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+",
"g"),"-"));return a}function nb(a,b,c){return t(a,3)&&u(a,3).length?3==c?";ext="+u(a,3):t(b,13)?u(b,13)+y(a,3):" ext. "+y(a,3):""}function xb(a,b){switch(b){case 4:return u(a,5);case 3:return u(a,4);case 1:return u(a,3);case 0:case 2:return u(a,2);case 5:return u(a,6);case 6:return u(a,8);case 7:return u(a,7);case 8:return u(a,21);case 9:return u(a,25);case 10:return u(a,28);default:return u(a,1)}}
function yb(a,b){return W(a,u(b,1))?W(a,u(b,5))?4:W(a,u(b,4))?3:W(a,u(b,6))?5:W(a,u(b,8))?6:W(a,u(b,7))?7:W(a,u(b,21))?8:W(a,u(b,25))?9:W(a,u(b,28))?10:W(a,u(b,2))?u(b,18)||W(a,u(b,3))?2:0:!u(b,18)&&W(a,u(b,3))?1:-1:-1}function U(a,b){if(null==b)return null;b=b.toUpperCase();var c=a.a[b];if(!c){c=Pa[b];if(!c)return null;c=(new H).f(G.h(),c);a.a[b]=c}return c}function W(a,b){var c=a.length;return 0<z(b,9)&&-1==p(w(b,9),c)?!1:N(y(b,2),a)}function ub(a,b){var c=zb(a,b);return Ab(a,b,c)}
function Ab(a,b,c){var d=y(b,1),e=S(a,d,c);if(!e||"001"!=c&&d!=rb(a,c))return!1;a=Q(b);return-1!=yb(a,e)}function zb(a,b){if(!b)return null;var c=y(b,1);if(c=J[c])if(1==c.length)c=c[0];else a:{for(var d=Q(b),e,f=c.length,g=0;g<f;g++){e=c[g];var h=U(a,e);if(t(h,23)){if(!d.search(u(h,23))){c=e;break a}}else if(-1!=yb(d,h)){c=e;break a}}c=null}else c=null;return c}function T(a){return(a=J[a])?a[0]:"ZZ"}function rb(a,b){var c=U(a,b);if(!c)throw Error("Invalid region code: "+b);return y(c,10)}
function Bb(a,b,c,d){var e=xb(c,d),f=z(e,9)?w(e,9):w(u(c,1),9),e=w(e,10);if(2==d)if(lb(xb(c,0)))a=xb(c,1),lb(a)&&(f=f.concat(z(a,9)?w(a,9):w(u(c,1),9)),ha(f),e.length?(e=e.concat(w(a,10)),ha(e)):e=w(a,10));else return Bb(a,b,c,1);if(-1==f[0])return 5;b=b.length;if(-1<p(e,b))return 4;c=f[0];return c==b?0:c>b?2:f[f.length-1]<b?3:-1<p(f,b,1)?0:5}function Cb(a,b){var c=Q(b),d=y(b,1);if(!(d in J))return 1;d=S(a,d,T(d));return Bb(a,c,d,-1)}
function Db(a,b){var c=a.toString();if(!c.length||"0"==c.charAt(0))return 0;for(var d,e=c.length,f=1;3>=f&&f<=e;++f)if(d=parseInt(c.substring(0,f),10),d in J)return b.a(c.substring(f)),d;return 0}
function Eb(a,b,c,d,e,f){if(!b.length)return 0;b=new C(b);var g;c&&(g=u(c,11));null==g&&(g="NonMatch");var h=b.toString();if(h.length)if(M.test(h))h=h.replace(M,""),D(b),b.a(hb(h)),g=1;else{h=new RegExp(g);ib(b);g=b.toString();if(g.search(h))g=!1;else{var h=g.match(h)[0].length,l=g.substring(h).match(Ua);l&&null!=l[1]&&0<l[1].length&&"0"==O(l[1],L)?g=!1:(D(b),b.a(g.substring(h)),g=!0)}g=g?5:20}else g=20;e&&v(f,6,g);if(20!=g){if(2>=b.b.length)throw Error("Phone number too short after IDD");if(a=Db(b,
d))return v(f,1,a),a;throw Error("Invalid country calling code");}if(c&&(g=y(c,10),h=""+g,l=b.toString(),!l.lastIndexOf(h,0)&&(h=new C(l.substring(h.length)),l=u(c,1),l=new RegExp(y(l,2)),Fb(h,c,null),h=h.toString(),!N(l,b.toString())&&N(l,h)||3==Bb(a,b.toString(),c,-1))))return d.a(h),e&&v(f,6,10),v(f,1,g),g;v(f,1,0);return 0}
function Fb(a,b,c){var d=a.toString(),e=d.length,f=u(b,15);if(e&&null!=f&&f.length){var g=new RegExp("^(?:"+f+")");if(e=g.exec(d)){var f=new RegExp(y(u(b,1),2)),h=N(f,d),l=e.length-1;b=u(b,16);if(null!=b&&b.length&&null!=e[l]&&e[l].length){if(d=d.replace(g,b),!h||N(f,d))c&&0<l&&c.a(e[1]),a.set(d)}else if(!h||N(f,d.substring(e[0].length)))c&&0<l&&null!=e[l]&&c.a(e[1]),a.set(d.substring(e[0].length))}}}
function vb(a,b,c,d){if(null==b)throw Error("The string supplied did not seem to be a phone number");if(250<b.length)throw Error("The string supplied is too long to be a phone number");var e=new C,f=b.indexOf(";phone-context=");if(0<=f){var g=f+15;if("+"==b.charAt(g)){var h=b.indexOf(";",g);0<h?e.a(b.substring(g,h)):e.a(b.substring(g))}g=b.indexOf("tel:");e.a(b.substring(0<=g?g+4:0,f))}else e.a(fb(b));f=e.toString();g=f.indexOf(";isub=");0<g&&(D(e),e.a(f.substring(0,g)));if(!gb(e.toString()))throw Error("The string supplied did not seem to be a phone number");
f=e.toString();if(!(mb(c)||null!=f&&0<f.length&&M.test(f)))throw Error("Invalid country calling code");f=new I;d&&v(f,5,b);a:{b=e.toString();g=b.search(Za);if(0<=g&&gb(b.substring(0,g)))for(var h=b.match(Za),l=h.length,x=1;x<l;++x)if(null!=h[x]&&0<h[x].length){D(e);e.a(b.substring(0,g));b=h[x];break a}b=""}0<b.length&&v(f,3,b);b=U(a,c);g=new C;h=0;l=e.toString();try{h=Eb(a,l,b,g,d,f)}catch(V){if("Invalid country calling code"==V.message&&M.test(l)){if(l=l.replace(M,""),h=Eb(a,l,b,g,d,f),!h)throw V;
}else throw V;}h?(e=T(h),e!=c&&(b=S(a,h,e))):(ib(e),g.a(e.toString()),null!=c?(h=y(b,10),v(f,1,h)):d&&Ga(f,6));if(2>g.b.length)throw Error("The string supplied is too short to be a phone number");b&&(c=new C,e=new C(g.toString()),Fb(e,b,c),2!=Bb(a,e.toString(),b,-1)&&(g=e,d&&0<c.toString().length&&v(f,7,c.toString())));a=g.toString();d=a.length;if(2>d)throw Error("The string supplied is too short to be a phone number");if(17<d)throw Error("The string supplied is too long to be a phone number");if(1<
a.length&&"0"==a.charAt(0)){v(f,4,!0);for(d=1;d<a.length-1&&"0"==a.charAt(d);)d++;1!=d&&v(f,8,d)}v(f,2,parseInt(a,10));return f}function N(a,b){var c="string"==typeof a?b.match("^(?:"+a+")$"):b.match(a);return c&&c[0].length==b.length?!0:!1};function Gb(a){this.ca=RegExp("\u2008");this.ea="";this.m=new C;this.w="";this.i=new C;this.v=new C;this.j=!0;this.$=this.o=this.ga=!1;this.da=K.a();this.s=0;this.b=new C;this.aa=!1;this.l="";this.a=new C;this.f=[];this.fa=a;this.g=Hb(this,this.fa)}var Ib=new G;v(Ib,11,"NA");
var Jb=/\[([^\[\]])*\]/g,Kb=/\d(?=[^,}][^,}])/g,Lb=RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*(\\$\\d[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*)+$"),Mb=/[- ]/;function Hb(a,b){var c=mb(b)?rb(a.da,b):0;return(c=U(a.da,T(c)))?c:Ib}
function Nb(a){for(var b=a.f.length,c=0;c<b;++c){var d=a.f[c],e=y(d,1);if(a.w==e)return!1;var f;f=a;var g=d,h=y(g,1);if(-1!=h.indexOf("|"))f=!1;else{h=h.replace(Jb,"\\d");h=h.replace(Kb,"\\d");D(f.m);var l;l=f;var g=y(g,2),x="999999999999999".match(h)[0];x.length<l.a.b.length?l="":(l=x.replace(new RegExp(h,"g"),g),l=l.replace(RegExp("9","g"),"\u2008"));0<l.length?(f.m.a(l),f=!0):f=!1}if(f)return a.w=e,a.aa=Mb.test(u(d,4)),a.s=0,!0}return a.j=!1}
function Ob(a,b){for(var c=[],d=b.length-3,e=a.f.length,f=0;f<e;++f){var g=a.f[f];z(g,3)?(g=u(g,3,Math.min(d,z(g,3)-1)),b.search(g)||c.push(a.f[f])):c.push(a.f[f])}a.f=c}function Pb(a,b){a.ea=Qb(a,b);return a.ea}
function Qb(a,b){a.i.a(b);var c=b;if(Ua.test(c)||1==a.i.b.length&&Ta.test(c)){var c=b,d;"+"==c?(d=c,a.v.a(c)):(d=L[c],a.v.a(d),a.a.a(d));b=d}else a.j=!1,a.ga=!0;if(!a.j){if(!a.ga)if(Rb(a)){if(Sb(a))return Tb(a)}else if(0<a.l.length&&(c=a.a.toString(),D(a.a),a.a.a(a.l),a.a.a(c),c=a.b.toString(),d=c.lastIndexOf(a.l),D(a.b),a.b.a(c.substring(0,d))),a.l!=Ub(a))return a.b.a(" "),Tb(a);return a.i.toString()}switch(a.v.b.length){case 0:case 1:case 2:return a.i.toString();case 3:if(Rb(a))a.$=!0;else return a.l=
Ub(a),Vb(a);default:if(a.$)return Sb(a)&&(a.$=!1),a.b.toString()+a.a.toString();if(0<a.f.length){c=Wb(a,b);d=Xb(a);if(0<d.length)return d;Ob(a,a.a.toString());return Nb(a)?Yb(a):a.j?Zb(a,c):a.i.toString()}return Vb(a)}}function Tb(a){a.j=!0;a.$=!1;a.f=[];a.s=0;D(a.m);a.w="";return Vb(a)}function Xb(a){for(var b=a.a.toString(),c=a.f.length,d=0;d<c;++d){var e=a.f[d],f=y(e,1);if((new RegExp("^(?:"+f+")$")).test(b))return a.aa=Mb.test(u(e,4)),b=b.replace(new RegExp(f,"g"),u(e,2)),Zb(a,b)}return""}
function Zb(a,b){var c=a.b.b.length;return a.aa&&0<c&&" "!=a.b.toString().charAt(c-1)?a.b+" "+b:a.b+b}function Vb(a){var b=a.a.toString();if(3<=b.length){for(var c=a.o&&0<z(a.g,20)?w(a.g,20):w(a.g,19),d=c.length,e=0;e<d;++e){var f=c[e],g;(g=!t(a.g,12)||a.o||u(f,6))||(g=y(f,4),g=!g.length||eb.test(g));g&&Lb.test(y(f,2))&&a.f.push(f)}Ob(a,b);b=Xb(a);return 0<b.length?b:Nb(a)?Yb(a):a.i.toString()}return Zb(a,b)}
function Yb(a){var b=a.a.toString(),c=b.length;if(0<c){for(var d="",e=0;e<c;e++)d=Wb(a,b.charAt(e));return a.j?Zb(a,d):a.i.toString()}return a.b.toString()}
function Ub(a){var b=a.a.toString(),c=0,d;1!=u(a.g,10)?d=!1:(d=a.a.toString(),d="1"==d.charAt(0)&&"0"!=d.charAt(1)&&"1"!=d.charAt(1));d?(c=1,a.b.a("1").a(" "),a.o=!0):t(a.g,15)&&(d=new RegExp("^(?:"+u(a.g,15)+")"),(d=b.match(d))&&null!=d[0]&&0<d[0].length&&(a.o=!0,c=d[0].length,a.b.a(b.substring(0,c))));D(a.a);a.a.a(b.substring(c));return b.substring(0,c)}
function Rb(a){var b=a.v.toString(),c=new RegExp("^(?:\\+|"+u(a.g,11)+")");return(c=b.match(c))&&null!=c[0]&&0<c[0].length?(a.o=!0,c=c[0].length,D(a.a),a.a.a(b.substring(c)),D(a.b),a.b.a(b.substring(0,c)),"+"!=b.charAt(0)&&a.b.a(" "),!0):!1}function Sb(a){if(!a.a.b.length)return!1;var b=new C,c=Db(a.a,b);if(!c)return!1;D(a.a);a.a.a(b.toString());b=T(c);"001"==b?a.g=U(a.da,""+c):b!=a.fa&&(a.g=Hb(a,b));a.b.a(""+c).a(" ");a.l="";return!0}
function Wb(a,b){var c=a.m.toString();if(0<=c.substring(a.s).search(a.ca)){var d=c.search(a.ca),c=c.replace(a.ca,b);D(a.m);a.m.a(c);a.s=d;return c.substring(0,a.s+1)}1==a.f.length&&(a.j=!1);a.w="";return a.i.toString()};function $b(){var a=q("phoneNumber").value,b=q("defaultCountry").value,c=q("carrierCode").value,d=new C;try{var e=K.a(),f;if(!mb(b)&&0<a.length&&"+"!=a.charAt(0))throw Error("Invalid country calling code");f=vb(e,a,b,!0);d.a("****Parsing Result:****\n");d.a(la((new B(1)).g(f)));d.a("\n\n****Validation Results:****");var g,h=Cb(e,f);g=0==h||4==h;d.a("\nResult from isPossibleNumber(): ");d.a(g);if(g){var l=ub(e,f);d.a("\nResult from isValidNumber(): ");d.a(l);l&&b&&"ZZ"!=b&&(d.a("\nResult from isValidNumberForRegion(): "),
d.a(Ab(e,f,b)));d.a("\nPhone Number region: ");d.a(zb(e,f));d.a("\nResult from getNumberType(): ");var x;var V=zb(e,f),jb=S(e,y(f,1),V);if(jb){var bc=Q(f);x=yb(bc,jb)}else x=-1;switch(x){case 0:d.a("FIXED_LINE");break;case 1:d.a("MOBILE");break;case 2:d.a("FIXED_LINE_OR_MOBILE");break;case 3:d.a("TOLL_FREE");break;case 4:d.a("PREMIUM_RATE");break;case 5:d.a("SHARED_COST");break;case 6:d.a("VOIP");break;case 7:d.a("PERSONAL_NUMBER");break;case 8:d.a("PAGER");break;case 9:d.a("UAN");break;case -1:d.a("UNKNOWN")}}else{d.a("\nResult from isPossibleNumberWithReason(): ");
switch(Cb(e,f)){case 1:d.a("INVALID_COUNTRY_CODE");break;case 2:d.a("TOO_SHORT");break;case 3:d.a("TOO_LONG")}d.a("\nNote: numbers that are not possible have type UNKNOWN, an unknown region, and are considered invalid.")}d.a("\n\n****Formatting Results:**** ");d.a("\nE164 format: ");d.a(l?P(e,f,0):"invalid");d.a("\nOriginal format: ");d.a(sb(e,f,b));d.a("\nNational format: ");d.a(P(e,f,2));d.a("\nInternational format: ");d.a(l?P(e,f,1):"invalid");d.a("\nOut-of-country format from US: ");d.a(l?qb(e,
f,"US"):"invalid");d.a("\nOut-of-country format from Switzerland: ");d.a(l?qb(e,f,"CH"):"invalid");0<c.length&&(d.a("\nNational format with carrier code: "),d.a(pb(e,f,c)));d.a("\n\n****AsYouTypeFormatter Results****");for(var cc=new Gb(b),dc=a.length,b=0;b<dc;++b){var kb=a.charAt(b);d.a("\nChar entered: ");d.a(kb);d.a(" Output: ");d.a(Pb(cc,kb))}}catch(ec){d.a("\n"+ec.toString())}q("output").value=d.toString();return!1}var X=["phoneNumberParser"],Y=this;
X[0]in Y||!Y.execScript||Y.execScript("var "+X[0]);for(var Z;X.length&&(Z=X.shift());){var ac;if(ac=!X.length)ac=void 0!==$b;ac?Y[Z]=$b:Y[Z]?Y=Y[Z]:Y=Y[Z]={}};})();

+ 18
- 2
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -522,7 +522,6 @@ i18n.phonenumbers.PhoneNumberUtil.ALL_PLUS_NUMBER_GROUPING_SYMBOLS_ = {
};
/**
* Pattern that makes it easy to distinguish whether a region has a single
* international dialing prefix or not. If a region has a single international
@ -1340,7 +1339,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedRegions = function() {
* Returns all global network calling codes the library has metadata for.
*
* @return {!Array.<number>} the country calling codes for every
* non-geographical entity the library supports.
* non-geographical entity the library supports.
*/
i18n.phonenumbers.PhoneNumberUtil.prototype.
getSupportedGlobalNetworkCallingCodes = function() {
@ -1356,6 +1355,23 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.
};
/**
* Returns all country calling codes the library has metadata for, covering
* both non-geographical entities (global network calling codes) and those used
* for geographical entities. This could be used to populate a drop-down box of
* country calling codes for a phone-number widget, for instance.
*
* @return {!Array.<number>} the country calling codes for every geographical
* and non-geographical entity the library supports.
*/
i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedCallingCodes =
function() {
return goog.array.join(
this.getSupportedGlobalNetworkCallingCodes(),
Object.keys(i18n.phonenumbers.metadata.countryCodeToRegionCodeMap));
};
/**
* Returns true if there is any possibleLength data set for a particular
* PhoneNumberDesc.


+ 17
- 0
javascript/i18n/phonenumbers/phonenumberutil_test.js View File

@ -443,6 +443,23 @@ function testGetSupportedGlobalNetworkCallingCodes() {
});
}
function testGetSupportedCallingCodes() {
assertTrue(phoneUtil.getSupportedCallingCodes().length > 0);
goog.array.forEach(
phoneUtil.getSupportedCallingCodes(),
function(callingCode) {
assertTrue(callingCode > 0);
assertFalse(phoneUtil.getRegionCodeForCountryCode(callingCode)
== RegionCode.ZZ);
});
// There should be more than just the global network calling codes in this set.
assertTrue(phoneUtil.getSupportedCallingCodes().length >
phoneUtil.getSupportedGlobalNetworkCallingCodes().length);
// But they should be included. Testing one of them.
assertTrue(goog.array.contains(
phoneUtil.getSupportedGlobalNetworkCallingCodes(), 979));
}
function testGetSupportedTypesForRegion() {
var PNT = i18n.phonenumbers.PhoneNumberType;
var types = phoneUtil.getSupportedTypesForRegion(RegionCode.BR);


+ 6
- 0
pending_code_changes.txt View File

@ -1,4 +1,7 @@
Code changes:
- New method getSupportedCallingCodes() API to return all the calling codes
that the library considers valid, both for geographical and non-geographical
entities.
- Added isSmsServiceForRegion(PhoneNumber, RegionCode) API in C++ and Java
short number info libraries. An SMS service is where the primary or only
intended usage is to receive and/or send text messages (SMSs). This includes
@ -18,3 +21,6 @@ Code changes:
- isPossibleNumber
- isAlphaNumber
- normalizeDigitsOnly & normalizeDiallableCharsOnly
- [C++ only] Removing most of the "using std::*" statements in
phonenumberutil.h file, leaving only using std::string. Changing the .cc and
test files to prefix "std::" where this was missing.

BIN
tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar View File


BIN
tools/java/java-build/target/java-build-1.0-SNAPSHOT-jar-with-dependencies.jar View File


Loading…
Cancel
Save