UNPKG

react-phone-number-input

Version:
12 lines 163 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define("react-phone-number-input",["React"],e):"object"==typeof exports?exports["react-phone-number-input"]=e(require("React")):t["react-phone-number-input"]=e(t.React)}(window,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var d=e[r]={i:r,l:!1,exports:{}};return t[r].call(d.exports,d,d.exports,n),d.l=!0,d.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=24)}([function(t,e,n){"use strict";n.r(e);var r=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=this.constructor.name,this.message=e,this.stack=new Error(e).stack},d=r;(r.prototype=Object.create(Error.prototype)).constructor=r;var a=2,o=17,i=3,u="0-90-9٠-٩۰-۹",$="-‐-―−ー-//..  ­​⁠ ()()[]\\[\\]~⁓∼~";function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments[1];return new RegExp("^(?:"+e+")$").test(t)}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var h="1.2.0",p=" ext. ",y=function(){function t(e){f(this,t),function(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!C(t)||!C(t.countries)||!C(t.country_calling_codes)&&!C(t.country_phone_code_to_countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` and `.country_calling_codes` child object properties. Got "+(C(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+_(t)+": "+t)+".")}(e),this.metadata=e,this.v1=!e.version,this.v2=void 0!==e.version&&-1===function(t,e){for(var n=t.split("."),r=e.split("."),d=0;d<3;d++){var a=Number(n[d]),o=Number(r[d]);if(a>o)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!isNaN(o))return-1}return 0}(e.version,h),this.v3=void 0!==e.version}return c(t,[{key:"hasCountry",value:function(t){return void 0!==this.metadata.countries[t]}},{key:"country",value:function(t){if(!t)return this._country=void 0,this.country_metadata=void 0,this;if(!this.hasCountry(t))throw new Error("Unknown country: "+t);return this._country=t,this.country_metadata=this.metadata.countries[t],this}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.metadata.countries[this.countryCallingCodes()[this.countryCallingCode()][0]]}},{key:"countryCallingCode",value:function(){return this.country_metadata[0]}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.country_metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.country_metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.country_metadata[1]:this.country_metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.country_metadata[this.v2?2:3]}},{key:"_getFormats",value:function(t){return t[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var t=this,e=this._getFormats(this.country_metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return e.map(function(e){return new v(e,t)})}},{key:"nationalPrefix",value:function(){return this.country_metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(t){return t[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.country_metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"nationalPrefixForParsing",value:function(){return this.country_metadata[this.v1?5:this.v2?6:7]||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.country_metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.country_metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormatting",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.country_metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.country_metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.country_metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(t){if(this.hasTypes()&&b(this.types(),t))return new g(b(this.types(),t),this)}},{key:"ext",value:function(){return this.v1||this.v2?p:this.country_metadata[13]||p}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(t){var e=this.countryCallingCodes()[t][0];this.hasCountry(e)&&this.country(e)}},{key:"selectedCountry",value:function(){return this._country}}]),t}(),m=y,v=function(){function t(e,n){f(this,t),this._format=e,this.metadata=n}return c(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormatting",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormatting()}},{key:"nationalPrefixIsMandatoryWhenFormatting",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormatting()}},{key:"usesNationalPrefix",value:function(){return this.nationalPrefixFormattingRule()&&"$1"!==this.nationalPrefixFormattingRule()&&/\d/.test(this.nationalPrefixFormattingRule().replace("$1",""))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),g=function(){function t(e,n){f(this,t),this.type=e,this.metadata=n}return c(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),t}();function b(t,e){switch(e){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}var C=function(t){return"object"===(void 0===t?"undefined":s(t))},_=function(t){return void 0===t?"undefined":s(t)};function N(t,e){return(e=new y(e)).hasCountry(t)?e.country(t).ext():p}function S(t,e){if((e=new y(e)).hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: "+t)}function P(t,e){return void 0!==e.countries[t]}var I=";ext=",x="(["+u+"]{1,7})";function O(t){var e="xx##~~";switch(t){case"parsing":e=",;"+e}return I+x+"|[  \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|["+e+"]|int|anexo|int)[:\\..]?[  \\t,-]*"+x+"#?|[- ]+(["+u+"]{1,5})#"}var E=O("parsing"),w=O("matching"),A=new RegExp("(?:"+E+")$","i");var R=new RegExp("^"+("["+u+"]{"+a+"}")+"$|^"+("[++]{0,1}(?:["+$+"]*["+u+"]){3,}["+$+u+"]*")+"(?:"+E+")?$","i");function T(t){return t.length>=a&&R.test(t)}var M={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function F(t){return M[t]}function k(t){var e="",n=t.split(""),r=Array.isArray(n),d=0;for(n=r?n:n[Symbol.iterator]();;){var a;if(r){if(d>=n.length)break;a=n[d++]}else{if((d=n.next()).done)break;a=d.value}var o=F(a);o&&(e+=o)}return e}function L(t){var e="",n=t.split(""),r=Array.isArray(n),d=0;for(n=r?n:n[Symbol.iterator]();;){var a;if(r){if(d>=n.length)break;a=n[d++]}else{if((d=n.next()).done)break;a=d.value}e+=B(a,e)||""}return e}function B(t,e){if("+"===t){if(e)return;return"+"}return F(t)}var D=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function G(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];if(t.country){if(!(n=new m(n)).hasCountry(t.country))throw new Error("Unknown country: "+t.country);var r=e.v2?t.nationalNumber:t.phone;if(n.country(t.country),l(r,n.nationalNumberPattern())){if(U(r,"FIXED_LINE",n))return n.type("MOBILE")&&""===n.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":n.type("MOBILE")?U(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";var d=D,a=Array.isArray(d),o=0;for(d=a?d:d[Symbol.iterator]();;){var i;if(a){if(o>=d.length)break;i=d[o++]}else{if((o=d.next()).done)break;i=o.value}var u=i;if(U(r,u,n))return u}}}}function U(t,e,n){return!(!(e=n.type(e))||!e.pattern())&&(!(e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0)&&l(t,e.pattern()))}function j(t,e,n){var r=n.type(e),d=r&&r.possibleLengths()||n.possibleLengths();if("FIXED_LINE_OR_MOBILE"===e){if(!n.type("FIXED_LINE"))return j(t,"MOBILE",n);var a=n.type("MOBILE");a&&(d=function(t,e){var n=t.slice(),r=e,d=Array.isArray(r),a=0;for(r=d?r:r[Symbol.iterator]();;){var o;if(d){if(a>=r.length)break;o=r[a++]}else{if((a=r.next()).done)break;o=a.value}var i=o;t.indexOf(i)<0&&n.push(i)}return n.sort(function(t,e){return t-e})}(d,a.possibleLengths()))}else if(e&&!r)return"INVALID_LENGTH";var o=t.length,i=d[0];return i===o?"IS_POSSIBLE":i>o?"TOO_SHORT":d[d.length-1]<o?"TOO_LONG":d.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function K(t,e,n){switch(j(t,void 0,n)){case"IS_POSSIBLE":return!0;default:return!1}}var W=new RegExp("(["+u+"])"),V=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;var H=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,d=!1,a=void 0;try{for(var o,i=t[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){d=!0,a=t}finally{try{!r&&i.return&&i.return()}finally{if(d)throw a}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function Z(t){var e=void 0,n=void 0,r=(t=t.replace(/^tel:/,"tel=")).split(";"),d=Array.isArray(r),a=0;for(r=d?r:r[Symbol.iterator]();;){var o;if(d){if(a>=r.length)break;o=r[a++]}else{if((a=r.next()).done)break;o=a.value}var i=o.split("="),u=H(i,2),$=u[0],l=u[1];switch($){case"tel":e=l;break;case"ext":n=l;break;case"phone-context":"+"===l[0]&&(e=l+e)}}if(!T(e))return{};var s={number:e};return n&&(s.ext=n),s}function Y(t){var e=t.number,n=t.ext;if(!e)return"";if("+"!==e[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:"+e+(n?";ext="+n:"")}function q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];if(n=new m(n),!t.country)return!1;if(!n.hasCountry(t.country))throw new Error("Unknown country: "+t.country);return n.country(t.country),n.hasTypes()?void 0!==G(t,e,n.metadata):l(e.v2?t.nationalNumber:t.phone,n.nationalNumberPattern())}var z=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},J={formatExtension:function(t,e,n){return""+t+n.ext()+e}};function X(t,e,n,r){if(n=n?z({},J,n):J,r=new m(r),t.country){if(!r.hasCountry(t.country))throw new Error("Unknown country: "+t.country);r.country(t.country)}else{if(!t.countryCallingCode)return t.phone||"";r.chooseCountryByCountryCallingCode(t.countryCallingCode)}var d=r.countryCallingCode(),a=n.v2?t.nationalNumber:t.phone;switch(e){case"NATIONAL":return a?rt(et(a,"NATIONAL",r),t.ext,r,n.formatExtension):"";case"INTERNATIONAL":return a?rt("+"+d+" "+et(a,"INTERNATIONAL",r),t.ext,r,n.formatExtension):"+"+d;case"E.164":return"+"+d+a;case"RFC3966":return Y({number:"+"+d+a,ext:t.ext});case"IDD":if(!n.fromCountry)return;var o=function(t,e){var n=new m(e);return n.country(t),V.test(n.IDDPrefix())?n.IDDPrefix():n.defaultIDDPrefix()}(n.fromCountry,r.metadata);if(!o)return;if(n.humanReadable){var i=d&&function(t,e,n,r){var d=new m(r.metadata);if(d.country(n),e===d.countryCallingCode())return"1"===e?e+" "+et(t,"NATIONAL",r):et(t,"NATIONAL",r)}(a,r.countryCallingCode(),n.fromCountry,r);return rt(i||o+" "+d+" "+et(a,"INTERNATIONAL",r),t.ext,r,n.formatExtension)}return""+o+d+a;default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'+e+'"')}}var Q=/(\$\d)/;function tt(t,e,n,r,d){var a=t.replace(new RegExp(e.pattern()),n?e.internationalFormat():!e.nationalPrefixFormattingRule()||e.nationalPrefixIsOptionalWhenFormatting()&&!r?e.format():e.format().replace(Q,e.nationalPrefixFormattingRule()));return n?nt(a):a}function et(t,e,n){var r=function(t,e){for(var n=t,r=Array.isArray(n),d=0,n=r?n:n[Symbol.iterator]();;){var a;if(r){if(d>=n.length)break;a=n[d++]}else{if((d=n.next()).done)break;a=d.value}var o=a;if(o.leadingDigitsPatterns().length>0){var i=o.leadingDigitsPatterns()[o.leadingDigitsPatterns().length-1];if(0!==e.search(i))continue}if(l(e,o.pattern()))return o}}(n.formats(),t);return r?tt(t,r,"INTERNATIONAL"===e,!0):t}function nt(t){return t.replace(new RegExp("["+$+"]+","g")," ").trim()}function rt(t,e,n,r){return e?r(t,e,n):t}var dt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},at=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var ot=function(){function t(e,n,r){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new TypeError("`countryCallingCode` not passed");if(!n)throw new TypeError("`nationalNumber` not passed");if(it(e)){this.country=e;var d=new m(r);d.country(e),e=d.countryCallingCode()}this.countryCallingCode=e,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.metadata=r}return at(t,[{key:"isPossible",value:function(){return function(t,e,n){if(void 0===e&&(e={}),n=new m(n),e.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.chooseCountryByCountryCallingCode(t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!n.hasCountry(t.country))throw new Error("Unknown country: "+t.country);n.country(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.chooseCountryByCountryCallingCode(t.countryCallingCode)}}if(!n.possibleLengths())throw new Error("Metadata too old");return K(t.phone||t.nationalNumber,0,n)}(this,{v2:!0},this.metadata)}},{key:"isValid",value:function(){return q(this,{v2:!0},this.metadata)}},{key:"getType",value:function(){return G(this,{v2:!0},this.metadata)}},{key:"format",value:function(t,e){return X(this,t,e?dt({},e,{v2:!0}):{v2:!0},this.metadata)}},{key:"formatNational",value:function(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function(t){return this.format("RFC3966",t)}}]),t}(),it=function(t){return/^[A-Z]{2}$/.test(t)},ut=250,$t=new RegExp("[++"+u+"]"),lt=new RegExp("[^"+u+"]+$");function st(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];if(n=new m(n),e.defaultCountry&&!n.hasCountry(e.defaultCountry)){if(e.v2)throw new d("INVALID_COUNTRY");throw new Error("Unknown country: "+e.defaultCountry)}var r=function(t,e){if(t&&0===t.indexOf("tel:"))return Z(t);var n=ct(t,e);if(!n||!T(n))return{};var r=function(t){var e=t.search(A);if(e<0)return{};for(var n=t.slice(0,e),r=t.match(A),d=1;d<r.length;){if(null!=r[d]&&r[d].length>0)return{number:n,ext:r[d]};d++}}(n);if(r.ext)return r;return{number:n}}(t,e.v2),i=r.number,u=r.ext;if(!i){if(e.v2)throw new d("NOT_A_NUMBER");return{}}var $=function(t,e,n){var r=pt(t,e,n.metadata),d=r.countryCallingCode,a=r.number;if(!a)return{countryCallingCode:d};var o=void 0;if(d)n.chooseCountryByCountryCallingCode(d);else{if(!e)return{};n.country(e),o=e,d=S(e,n.metadata)}var i=function(t,e){var n=L(t),r=void 0,d=ft(n,e),a=d.number,o=d.carrierCode;if(e.possibleLengths())switch(j(a,void 0,e)){case"TOO_SHORT":case"INVALID_LENGTH":break;default:n=a,r=o}else l(n,e.nationalNumberPattern())&&!l(a,e.nationalNumberPattern())||(n=a,r=o);return{national_number:n,carrier_code:r}}(a,n),u=i.national_number,$=i.carrier_code,s=ht(d,u,n);s&&(o=s,n.country(o));return{country:o,countryCallingCode:d,national_number:u,carrierCode:$}}(i,e.defaultCountry,n),s=$.country,c=$.national_number,f=$.countryCallingCode,h=$.carrierCode;if(!n.selectedCountry()){if(e.v2)throw new d("INVALID_COUNTRY");return{}}if(c.length<a){if(e.v2)throw new d("TOO_SHORT");return{}}if(c.length>o){if(e.v2)throw new d("TOO_LONG");return{}}if(e.v2){var p=new ot(f,c,n.metadata);return s&&(p.country=s),h&&(p.carrierCode=h),u&&(p.ext=u),p}var y=!(!s||!l(c,n.nationalNumberPattern()));return e.extended?{country:s,countryCallingCode:f,carrierCode:h,valid:y,possible:!!y||!0===e.extended&&n.possibleLengths()&&K(c,0,n),phone:c,ext:u}:y?function(t,e,n){var r={country:t,phone:e};n&&(r.ext=n);return r}(s,c,u):{}}function ct(t,e){if(t)if(t.length>ut){if(e)throw new d("TOO_LONG")}else{var n=t.search($t);if(!(n<0))return t.slice(n).replace(lt,"")}}function ft(t,e){if(!t||!e.nationalPrefixForParsing())return{number:t};var n=new RegExp("^(?:"+e.nationalPrefixForParsing()+")"),r=n.exec(t);if(!r)return{number:t};var d=void 0,a=r.length-1;if(e.nationalPrefixTransformRule()&&r[a])d=t.replace(n,e.nationalPrefixTransformRule());else{var o=r[0];d=t.slice(o.length)}var i=void 0;return a>0&&(i=r[1]),{number:d,carrierCode:i}}function ht(t,e,n){var r=n.countryCallingCodes()[t];return 1===r.length?r[0]:function(t,e,n){n=new m(n);for(var r=t,d=Array.isArray(r),a=0,r=d?r:r[Symbol.iterator]();;){var o;if(d){if(a>=r.length)break;o=r[a++]}else{if((a=r.next()).done)break;o=a.value}var i=o;if(n.country(i),n.leadingDigits()){if(e&&0===e.search(n.leadingDigits()))return i}else if(G({phone:e,country:i},void 0,n.metadata))return i}}(r,e,n.metadata)}function pt(t,e,n){if(!(t=L(t)))return{};if("+"!==t[0]){var r=function(t,e,n){if(e){var r=new m(n);r.country(e);var d=new RegExp(r.IDDPrefix());if(0===t.search(d)){var a=(t=t.slice(t.match(d)[0].length)).match(W);if(!(a&&null!=a[1]&&a[1].length>0&&"0"===a[1]))return t}}}(t,e,n);if(!r||r===t)return{number:t};t="+"+r}if("0"===t[1])return{};n=new m(n);for(var d=2;d-1<=i&&d<=t.length;){var a=t.slice(1,d);if(n.countryCallingCodes()[a])return{countryCallingCode:a,number:t.slice(d)};d++}return{}}var yt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function mt(t,e,n){return st(t,yt({},e,{v2:!0}),n)}var vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},bt=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,d=!1,a=void 0;try{for(var o,i=t[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){d=!0,a=t}finally{try{!r&&i.return&&i.return()}finally{if(d)throw a}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function Ct(){var t=_t(arguments);return mt(t.text,t.options,t.metadata)}function _t(t){var e=Array.prototype.slice.call(t),n=bt(e,4),r=n[0],d=n[1],a=n[2],o=n[3],i=void 0,u=void 0,$=void 0;if("string"!=typeof r)throw new TypeError("A text for parsing must be a string.");if(i=r,d&&"string"!=typeof d){if(!Nt(d))throw new Error("Invalid second argument: "+d);a?(u=d,$=a):$=d}else o?(u=a,$=o):(u=void 0,$=a),d&&(u=gt({defaultCountry:d},u));return{text:i,options:u,metadata:$}}var Nt=function(t){return"object"===(void 0===t?"undefined":vt(t))},St=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Pt(){var t=_t(arguments);return function(t,e,n){e&&e.defaultCountry&&!P(e.defaultCountry,n)&&(e=St({},e,{defaultCountry:void 0}));try{return mt(t,e,n)}catch(t){if(!(t instanceof d))throw t}}(t.text,t.options,t.metadata)}var It=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function xt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ot=function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;xt(this,t),this.key=e,this.value=n,this.next=r,this.prev=d},Et=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;xt(this,t),this.size=0,this.limit=e,this.head=null,this.tail=null,this.cache={}}return It(t,[{key:"put",value:function(t,e){if(this.ensureLimit(),this.head){var n=new Ot(t,e,this.head);this.head.prev=n,this.head=n}else this.head=this.tail=new Ot(t,e);this.cache[t]=this.head,this.size++}},{key:"get",value:function(t){if(this.cache[t]){var e=this.cache[t].value;return this.remove(t),this.put(t,e),e}console.log("Item not available in cache for key "+t)}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(t){var e=this.cache[t];null!==e.prev?e.prev.next=e.next:this.head=e.next,null!==e.next?e.next.prev=e.prev:this.tail=e.prev,delete this.cache[t],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),t}(),wt=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var At=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cache=new Et(e)}return wt(t,[{key:"getPatternForRegExp",value:function(t){var e=this.cache.get(t);return e||(e=new RegExp("^"+t),this.cache.put(t,e)),e}}]),t}();function Rt(t,e){if(t<0||e<=0||e<t)throw new TypeError;return"{"+t+","+e+"}"}function Tt(t,e){var n=e.search(t);return n>=0?e.slice(0,n):e}var Mt="   ᠎ - \u2028\u2029   ",Ft="["+Mt+"]",kt="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Lt=new RegExp("[A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),Bt=new RegExp("[$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩]"),Dt=new RegExp("[̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦]"),Gt=new RegExp("[\0-€-ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function Ut(t){return!(!Lt.test(t)&&!Dt.test(t))&&Gt.test(t)}function jt(t){return"%"===t||Bt.test(t)}var Kt={POSSIBLE:function(t,e,n){return!0},VALID:function(t,e,n){return!(!q(t,void 0,n)||!Wt(t,e.toString(),n))},STRICT_GROUPING:function(t,e,n,r){var d=e.toString();return!(!q(t,void 0,n)||!Wt(t,d,n)||Ht(t,d)||!Vt(t,n))&&Zt(t,e,n,zt,r)},EXACT_GROUPING:function(t,e,n,r){var d=e.toString();return!(!q(t,void 0,n)||!Wt(t,d,n)||Ht(t,d)||!Vt(t,n))&&Zt(t,e,n,qt,r)}};function Wt(t,e,n){for(var r=0;r<e.length-1;r++){var d=e.charAt(r);if("x"===d||"X"===d){var a=e.charAt(r+1);if("x"===a||"X"===a){if(r++,util.isNumberMatch(t,e.substring(r))!=MatchType.NSN_MATCH)return!1}else if(k(e.substring(r))!==t.ext)return!1}}return!0}function Vt(t,e){if("FROM_DEFAULT_COUNTRY"!=t.getCountryCodeSource())return!0;var n=util.getRegionCodeForCountryCode(t.getCountryCode()),r=util.getMetadataForRegion(n);if(null==r)return!0;var d=util.getNationalSignificantNumber(t),a=util.chooseFormattingPatternForNumber(r.numberFormats(),d);if(a&&a.getNationalPrefixFormattingRule().length>0){if(a.getNationalPrefixOptionalWhenFormatting())return!0;if(PhoneNumberUtil.formattingRuleHasFirstGroupOnly(a.getNationalPrefixFormattingRule()))return!0;var o=PhoneNumberUtil.normalizeDigitsOnly(t.getRawInput());return util.maybeStripNationalPrefixAndCarrierCode(o,r,null)}return!0}function Ht(t,e){var n=e.indexOf("/");if(n<0)return!1;var r=e.indexOf("/",n+1);return!(r<0)&&(!(t.getCountryCodeSource()===CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN||t.getCountryCodeSource()===CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN)||PhoneNumberUtil.normalizeDigitsOnly(e.substring(0,n))!==String(t.getCountryCode())||e.slice(r+1).indexOf("/")>=0)}function Zt(t,e,n,r,d){var a=normalizeDigits(e,!0),o=Yt(n,t,null);if(r(n,t,a,o))return!0;var i=MetadataManager.getAlternateFormatsForCountry(t.getCountryCode()),u=util.getNationalSignificantNumber(t);if(i){var $=i.numberFormats(),l=Array.isArray($),s=0;for($=l?$:$[Symbol.iterator]();;){var c;if(l){if(s>=$.length)break;c=$[s++]}else{if((s=$.next()).done)break;c=s.value}var f=c;if(f.leadingDigitsPatterns().length>0)if(!d.getPatternForRegExp("^"+f.leadingDigitsPatterns()[0]).test(u))continue;if(r(n,t,a,o=Yt(n,t,f)))return!0}}return!1}function Yt(t,e,n){if(n){var r=util.getNationalSignificantNumber(e);return util.formatNsnUsingPattern(r,n,"RFC3966",t).split("-")}var d=formatNumber(e,"RFC3966",t),a=d.indexOf(";");a<0&&(a=d.length);var o=d.indexOf("-")+1;return d.slice(o,a).split("-")}function qt(t,e,n,r){var d=n.split(NON_DIGITS_PATTERN),a=e.hasExtension()?d.length-2:d.length-1;if(1==d.length||d[a].contains(util.getNationalSignificantNumber(e)))return!0;for(var o,i,u=r.length-1;u>0&&a>=0;){if(d[a]!==r[u])return!1;u--,a--}return a>=0&&(o=d[a],i=r[0],o.indexOf(i,o.length-i.length)===o.length-i.length)}function zt(t,e,n,r){var d,a,o=0;if(e.getCountryCodeSource()!==CountryCodeSource.FROM_DEFAULT_COUNTRY){var i=String(e.getCountryCode());o=n.indexOf(i)+i.length()}for(var u=0;u<r.length;u++){if((o=n.indexOf(r[u],o))<0)return!1;if(o+=r[u].length(),0==u&&o<n.length()){var $=util.getRegionCodeForCountryCode(e.getCountryCode());if(null!=util.getNddPrefixForRegion($,!0)&&Character.isDigit(n.charAt(o))){var l=util.getNationalSignificantNumber(e);return d=n.slice(o-r[u].length),a=l,0===d.indexOf(a)}}}return n.slice(o).contains(e.getExtension())}var Jt=/[\\/] *x/;function Xt(t){return Tt(Jt,t)}var Qt=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,te=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,ee=/^:[0-5]\d/;function ne(t,e,n){if(Qt.test(t))return!1;if(te.test(t)){var r=n.slice(e+t.length);if(ee.test(r))return!1}return!0}var re=new RegExp("^[(\\[([++]"),de=Rt(0,3),ae=new RegExp("^(?:[(\\[([])?(?:[^(\\[([)\\])]]+[)\\])]])?[^(\\[([)\\])]]+(?:[(\\[([][^(\\[([)\\])]]+[)\\])]])"+de+"[^(\\[([)\\])]]*$"),oe=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;var ie=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ue=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var $e=["\\/+(.*)/","(\\([^(]*)","(?:"+Ft+"-|-"+Ft+")"+Ft+"*(.+)","[‒-―-]"+Ft+"*(.+)","\\.+"+Ft+"*([^.]+)",Ft+"+([^   ᠎ - \u2028\u2029   ]+)"],le=Rt(0,2),se=Rt(0,4),ce=o+i,fe=Rt(0,ce),he="["+$+"]"+se,pe="[0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9]"+Rt(1,ce),ye="(?:[(\\[([++]"+he+")"+le+pe+"(?:"+he+pe+")"+fe+"(?:"+w+")?",me=new RegExp("[^0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9"+kt+"#]+$"),ve=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,ge=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new At(32),!(n=ie({},n,{defaultCountry:n.defaultCountry&&P(n.defaultCountry,r)?n.defaultCountry:void 0,leniency:n.leniency||n.extended?"POSSIBLE":"VALID",maxTries:n.maxTries||ve})).leniency)throw new TypeError("`Leniency` not supplied");if(n.maxTries<0)throw new TypeError("`maxTries` not supplied");if(this.text=e,this.options=n,this.metadata=r,this.leniency=Kt[n.leniency],!this.leniency)throw new TypeError("Unknown leniency: "+n.leniency+".");this.maxTries=n.maxTries,this.PATTERN=new RegExp(ye,"ig")}return ue(t,[{key:"find",value:function(){for(var t=void 0;this.maxTries>0&&null!==(t=this.PATTERN.exec(this.text));){var e=t[0],n=t.index;if(ne(e=Xt(e),n,this.text)){var r=this.parseAndVerify(e,n,this.text)||this.extractInnerMatch(e,n,this.text);if(r){if(this.options.v2){var d=new ot(r.country,r.phone,this.metadata);return r.ext&&(d.ext=r.ext),{startsAt:r.startsAt,endsAt:r.endsAt,number:d}}return r}}this.maxTries--}}},{key:"extractInnerMatch",value:function(t,e,n){var r=$e,d=Array.isArray(r),a=0;for(r=d?r:r[Symbol.iterator]();;){var o;if(d){if(a>=r.length)break;o=r[a++]}else{if((a=r.next()).done)break;o=a.value}for(var i=!0,u=void 0,$=new RegExp(o,"g");null!==(u=$.exec(t))&&this.maxTries>0;){if(i){var l=Tt(me,t.slice(0,u.index)),s=this.parseAndVerify(l,e,n);if(s)return s;this.maxTries--,i=!1}var c=Tt(me,u[1]),f=this.parseAndVerify(c,e+u.index,n);if(f)return f;this.maxTries--}}}},{key:"parseAndVerify",value:function(t,e,n){if(function(t,e,n,r){if(ae.test(t)&&!oe.test(t)){if("POSSIBLE"!==r){if(e>0&&!re.test(t)){var d=n[e-1];if(jt(d)||Ut(d))return!1}var a=e+t.length;if(a<n.length){var o=n[a];if(jt(o)||Ut(o))return!1}}return!0}}(t,e,n,this.options.leniency)){var r=st(t,{extended:!0,defaultCountry:this.options.defaultCountry},this.metadata);if(r.possible&&this.leniency(r,t,this.metadata,this.regExpCache)){var d={startsAt:e,endsAt:e+t.length,country:r.country,phone:r.phone};return r.ext&&(d.ext=r.ext),d}}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var t=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",t}}]),t}();function be(){var t=_t(arguments);return function(t,e,n){for(var r=new ge(t,e,n),d=[];r.hasNext();)d.push(r.next());return d}(t.text,t.options,t.metadata)}function Ce(){var t,e,n,r=_t(arguments),d=r.text,a=r.options,o=r.metadata,i=new ge(d,a,o);return t={},e=Symbol.iterator,n=function(){return{next:function(){return i.hasNext()?{done:!1,value:i.next()}:{done:!0}}}},e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _e=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var Ne=Ae("9",15),Se=new RegExp("x"),Pe=function(){return/\[([^\[\]])*\]/g},Ie=function(){return/\d(?=[^,}][^,}])/g},xe=new RegExp("^["+$+"]*(\\$\\d["+$+"]*)+$"),Oe=new RegExp("^"+("[++]{0,1}["+$+u+"]*")+"$","i"),Ee=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options={},this.metadata=new m(n),e&&this.metadata.hasCountry(e)&&(this.defaultCountry=e),this.reset()}return _e(t,[{key:"input",value:function(t){var e=ct(t)||"";return e||t&&t.indexOf("+")>=0&&(e="+"),Oe.test(e)?this.processInput(L(e)):this.currentOutput}},{key:"processInput",value:function(t){if("+"===t[0]&&(this.parsedInput||(this.parsedInput+="+",this.resetCountriness()),t=t.slice(1)),this.parsedInput+=t,this.nationalNumber+=t,this.isInternational())if(this.countryCallingCode)this.country||this.determineTheCountry();else{if(!this.nationalNumber)return this.parsedInput;if(!this.extractCountryCallingCode())return this.parsedInput;this.initialize_phone_number_formats_for_this_country_calling_code(),this.resetFormat(),this.determineTheCountry()}else{var e=this.nationalPrefix;this.nationalNumber=this.nationalPrefix+this.nationalNumber,this.extractNationalPrefix(),this.nationalPrefix!==e&&(this.matching_formats=void 0,this.resetFormat())}if(!this.nationalNumber)return this.format_as_non_formatted_number();this.match_formats_by_leading_digits();var n=this.formatNationalNumber(t);return n?this.formatFullNumber(n):this.format_as_non_formatted_number()}},{key:"format_as_non_formatted_number",value:function(){return this.isInternational()&&this.countryCallingCode?"+"+this.countryCallingCode+this.nationalNumber:this.parsedInput}},{key:"formatNationalNumber",value:function(t){var e=void 0;this.chosenFormat&&(e=this.formatNextNationalNumberDigits(t));var n=this.attempt_to_format_complete_phone_number();return n||(this.chooseAnotherFormat()?this.reformatNationalNumber():e)}},{key:"reset",value:function(){return this.parsedInput="",this.currentOutput="",this.nationalPrefix="",this.nationalNumber="",this.carrierCode="",this.resetCountriness(),this.resetFormat(),this}},{key:"resetCountry",value:function(){this.isInternational()?this.country=void 0:this.country=this.defaultCountry}},{key:"resetCountriness",value:function(){this.resetCountry(),this.defaultCountry&&!this.isInternational()?(this.metadata.country(this.defaultCountry),this.countryCallingCode=this.metadata.countryCallingCode(),this.initialize_phone_number_formats_for_this_country_calling_code()):(this.metadata.country(void 0),this.countryCallingCode=void 0,this.available_formats=[],this.matching_formats=void 0)}},{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.partially_populated_template=void 0,this.last_match_position=-1}},{key:"reformatNationalNumber",value:function(){return this.formatNextNationalNumberDigits(this.nationalNumber)}},{key:"initialize_phone_number_formats_for_this_country_calling_code",value:function(){this.available_formats=this.metadata.formats().filter(function(t){return xe.test(t.internationalFormat())}),this.matching_formats=void 0}},{key:"match_formats_by_leading_digits",value:function(){var t=this.nationalNumber,e=t.length-3;e<0&&(e=0);var n=this.had_enough_leading_digits&&this.matching_formats||this.available_formats;this.had_enough_leading_digits=this.shouldFormat(),this.matching_formats=n.filter(function(n){var r=n.leadingDigitsPatterns().length;if(0===r)return!0;var d=Math.min(e,r-1),a=n.leadingDigitsPatterns()[d];return new RegExp("^("+a+")").test(t)}),this.chosenFormat&&-1===this.matching_formats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"shouldFormat",value:function(){return this.nationalNumber.length>=3}},{key:"attempt_to_format_complete_phone_number",value:function(){var t=this.matching_formats,e=Array.isArray(t),n=0;for(t=e?t:t[Symbol.iterator]();;){var r;if(e){if(n>=t.length)break;r=t[n++]}else{if((n=t.next()).done)break;r=n.value}var d=r;if(new RegExp("^(?:"+d.pattern()+")$").test(this.nationalNumber)&&this.isFormatApplicable(d)){this.resetFormat(),this.chosenFormat=d;var a=tt(this.nationalNumber,d,this.isInternational(),""!==this.nationalPrefix,this.metadata);if(this.nationalPrefix&&"1"===this.countryCallingCode&&(a="1 "+a),this.createFormattingTemplate(d))this.reformatNationalNumber();else{var o=this.formatFullNumber(a);this.template=o.replace(/[\d\+]/g,"x"),this.partially_populated_template=o}return a}}}},{key:"formatFullNumber",value:function(t){return this.isInternational()?"+"+this.countryCallingCode+" "+t:t}},{key:"extractCountryCallingCode",value:function(){var t=pt(this.parsedInput,this.defaultCountry,this.metadata.metadata),e=t.countryCallingCode,n=t.number;if(e)return this.countryCallingCode=e,this.nationalNumber=n,this.metadata.chooseCountryByCountryCallingCode(e),void 0!==this.metadata.selectedCountry()}},{key:"extractNationalPrefix",value:function(){if(this.nationalPrefix="",this.metadata.selectedCountry()){var t=ft(this.nationalNumber,this.metadata),e=t.number,n=t.carrierCode;if(n&&(this.carrierCode=n),this.metadata.possibleLengths()&&(!this.isPossibleNumber(this.nationalNumber)||this.isPossibleNumber(e))||!l(this.nationalNumber,this.metadata.nationalNumberPattern())||l(e,this.metadata.nationalNumberPattern()))return this.nationalPrefix=this.nationalNumber.slice(0,this.nationalNumber.length-e.length),this.nationalNumber=e,this.nationalPrefix}}},{key:"isPossibleNumber",value:function(t){switch(j(t,void 0,this.metadata)){case"IS_POSSIBLE":return!0;default:return!1}}},{key:"chooseAnotherFormat",value:function(){var t=this.matching_formats,e=Array.isArray(t),n=0;for(t=e?t:t[Symbol.iterator]();;){var r;if(e){if(n>=t.length)break;r=t[n++]}else{if((n=t.next()).done)break;r=n.value}var d=r;if(this.chosenFormat===d)return;if(this.isFormatApplicable(d)&&this.createFormattingTemplate(d))return this.chosenFormat=d,this.last_match_position=-1,!0}this.resetCountry(),this.resetFormat()}},{key:"isFormatApplicable",value:function(t){return!(!this.isInternational()&&!this.nationalPrefix&&t.nationalPrefixIsMandatoryWhenFormatting())&&!(this.nationalPrefix&&!t.usesNationalPrefix()&&!t.nationalPrefixIsOptionalWhenFormatting())}},{key:"createFormattingTemplate",value:function(t){if(!(t.pattern().indexOf("|")>=0)){var e=this.getTemplateForNumberFormatPattern(t);if(e)return this.partially_populated_template=e,this.isInternational()?this.template="x"+Ae("x",this.countryCallingCode.length)+" "+e:this.template=e.replace(/\d/g,"x"),this.template}}},{key:"getTemplateForNumberFormatPattern",value:function(t){var e=t.pattern();e=e.replace(Pe(),"\\d").replace(Ie(),"\\d");var n=Ne.match(e)[0];if(!(this.nationalNumber.length>n.length)){var r=this.getFormatFormat(t),d=new RegExp("^"+e+"$"),a=this.nationalNumber.replace(/\d/g,"9");return d.test(a)&&(n=a),n.replace(new RegExp(e),r).replace(new RegExp("9","g"),"x")}}},{key:"formatNextNationalNumberDigits",value:function(t){var e=t.split(""),n=Array.isArray(e),r=0;for(e=n?e:e[Symbol.iterator]();;){var d;if(n){if(r>=e.length)break;d=e[r++]}else{if((r=e.next()).done)break;d=r.value}var a=d;if(-1===this.partially_populated_template.slice(this.last_match_position+1).search(Se))return this.chosenFormat=void 0,this.template=void 0,void(this.partially_populated_template=void 0);this.last_match_position=this.partially_populated_template.search(Se),this.partially_populated_template=this.partially_populated_template.replace(Se,a)}return we(this.partially_populated_template,this.last_match_position+1)}},{key:"isInternational",value:function(){return this.parsedInput&&"+"===this.parsedInput[0]}},{key:"getFormatFormat",value:function(t){if(this.isInternational())return nt(t.internationalFormat());if(t.nationalPrefixFormattingRule()){if(this.nationalPrefix||!t.usesNationalPrefix())return t.format().replace(Q,t.nationalPrefixFormattingRule())}else if("1"===this.countryCallingCode&&"1"===this.nationalPrefix)return"1 "+t.format();return t.format()}},{key:"determineTheCountry",value:function(){this.country=ht(this.countryCallingCode,this.nationalNumber,this.metadata)}},{key:"getNumber",value:function(){if(this.countryCallingCode&&this.nationalNumber){var t=new ot(this.country||this.countryCallingCode,this.nationalNumber,this.metadata.metadata);return this.carrierCode&&(t.carrierCode=this.carrierCode),t}}},{key:"getNationalNumber",value:function(){return this.nationalNumber}},{key:"getTemplate",value:function(){if(this.template){for(var t=-1,e=0;e<this.parsedInput.length;)t=this.template.indexOf("x",t+1),e++;return we(this.template,t+1)}}}]),t}();function we(t,e){return")"===t[e]&&e++,function(t){for(var e=[],n=0;n<t.length;)"("===t[n]?e.push(n):")"===t[n]&&e.pop(),n++;var r=0,d="";e.push(t.length);var a=e,o=Array.isArray(a),i=0;for(a=o?a:a[Symbol.iterator]();;){var u;if(o){if(i>=a.length)break;u=a[i++]}else{if((i=a.next()).done)break;u=i.value}var $=u;d+=t.slice(r,$),r=$+1}return d}(t.slice(0,e))}function Ae(t,e){if(e<1)return"";for(var n="";e>1;)1&e&&(n+=t),e>>=1,t+=t;return n+t}function Re(t,e,n){if(e[t])return new ot(t,e[t],n)}function Te(t,e,n){return n||(n=e,e=void 0),new Ee(e,n).input(t)}n.d(e,"ParseError",function(){return d}),n.d(e,"parsePhoneNumber",function(){return Ct}),n.d(e,"parsePhoneNumberFromString",function(){return Pt}),n.d(e,"findNumbers",function(){return be}),n.d(e,"searchNumbers",function(){return Ce}),n.d(e,"PhoneNumberMatcher",function(){return ge}),n.d(e,"AsYouType",function(){return Ee}),n.d(e,"Metadata",function(){return m}),n.d(e,"isSupportedCountry",function(){return P}),n.d(e,"getCountryCallingCode",function(){return S}),n.d(e,"getExtPrefix",function(){return N}),n.d(e,"getExampleNumber",function(){return Re}),n.d(e,"formatIncompletePhoneNumber",function(){return Te}),n.d(e,"parseIncompletePhoneNumber",function(){return L}),n.d(e,"parsePhoneNumberCharacter",function(){return B}),n.d(e,"parseDigits",function(){return k}),n.d(e,"parseRFC3966",function(){return Z}),n.d(e,"formatRFC3966",function(){return Y})},function(t,e,n){t.exports=n(21)()},function(e,n){e.exports=t},function(t,e,n){var r; /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";var n={}.hasOwnProperty;function d(){for(var t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var a=typeof r;if("string"===a||"number"===a)t.push(r);else if(Array.isArray(r))t.push(d.apply(null,r));else if("object"===a)for(var o in r)n.call(r,o)&&r[o]&&t.push(o)}}return t.join(" ")}void 0!==t&&t.exports?t.exports=d:void 0===(r=function(){return d}.apply(e,[]))||(t.exports=r)}()},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var d,a,o,i,u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=b(n(2)),s=b(n(1)),c=b(n(3)),f=n(9),h=n(0),p=b(n(19)),y=b(n(18)),m=n(7),v=n(17),g=n(8);function b(t){return t&&t.__esModule?t:{default:t}}var C=l.default.PureComponent||l.default.Component,_=(0,f.polyfill)((o=a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":r(e))&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));i.call(n);var d=n.props,a=d.value,o=d.labels,u=d.international,$=d.metadata,l=n.props,s=l.country,c=l.countries,f=l.countryOptions;s&&(n.isCountrySupportedWithError(s)||(s=void 0)),c=x(c,$),f=O(f,$);var h=(0,v.parsePhoneNumber)(a,$),p=(0,v.getPreSelectedCountry)(h,s,c||(0,g.getCountryCodes)(o).filter(function(t){return"ZZ"===t||$.countries[t]}),u,$);return n.state={props:n.props,country:p,countries:c,country_select_options:N(c,f,n.props),parsed_input:S(a,h,n.props),value:a},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":r(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,C),$(e,[{key:"componentDidMount",value:function(){var t=this.props.onCountryChange,e=this.props.country,n=this.state.country;t&&(e&&this.isCountrySupportedWithError(e)||(e=void 0),n!==e&&t(n))}},{key:"componentDidUpdate",value:function(t,e){var n=this.props.onCountryChange;n&&this.state.country!==e.country&&n(this.state.country)}},{key:"render",value:function(){var t=this.props,e=t.name,n=t.disabled,r=t.disablePhoneInput,d=t.autoComplete,a=t.countrySelectTabIndex,o=t.showCountrySelect,i=t.style,$=t.className,s=t.inputClassName,f=t.getInputClassName,p=t.countrySelectProperties,y=t.error,m=t.indicateInvalid,v=t.countrySelectComponent,g=t.inputComponent,b=t.ext,C=(t.country,t.countries,t.countryOptions,t.labels),_=(t.flags,t.flagComponent,t.flagsPath,t.international,t.internationalIcon,t.displayInitialValueAsLocalNumber,t.onCountryChange,t.limitMaxLength,t.metadata),N=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(t,["name","disabled","disablePhoneInput","autoComplete","countrySelectTabIndex","showCountrySelect","style","className","inputClassName","getInputClassName","countrySelectProperties","error","indicateInvalid","countrySelectComponent","inputComponent","ext","country","countries","countryOptions","labels","flags","flagComponent","flagsPath","international","internationalIcon","displayInitialValueAsLocalNumber","onCountryChange","limitMaxLength","metadata"]),S=this.state,P=S.country,I=S.hidePhoneInputField,x=S.country_select_options,O=S.parsed_input,E=S.isFocused,w={};if(p)for(var A in p)this.props.hasOwnProperty(A)&&(w[p[A]]=this.props[A],delete N[A]);return l.default.createElement("div",{style:i,className:(0,c.default)("react-phone-number-input",{"react-phone-number-input--focus":E,"react-phone-number-input--invalid":y&&m},$)},l.default.createElement("div",{className:"react-phone-number-input__row"},o&&l.default.createElement(v,u({},w,{ref:this.storeCountrySelectInstance,name:e?e+"__country":void 0,value:P,options:x,onChange:this.onCountryChange,onFocus:this._onFocus,onBlur:this._onBlur,disabled:n,tabIndex:a,hidePhoneInputField:this.hidePhoneInputField,focusPhoneInputField:this.focus,"aria-label":C.country,className:"react-phone-number-input__country"})),!I&&l.default.createElement(g,u({type:"tel",name:e},N,{ref:this.storePhoneNumberInputInstance,metadata:_,country:P,value:O||"",onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onPhoneNumberKeyDown,disabled:n||r,autoComplete:d,className:(0,c.default)("react-phone-number-input__input","react-phone-number-input__phone",{"react-phone-number-in