Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-international-phone

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-international-phone - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

build/index.mjs

1

build/hooks/usePhoneInput.d.ts

@@ -0,1 +1,2 @@

/// <reference types="react" />
import { CountryData, CountryIso2 } from '../types';

@@ -2,0 +3,0 @@ export declare const MASK_CHAR = ".";

2

build/index.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-international-phone"]=t(require("react")):e["react-international-phone"]=t(e.react)}(this,(e=>(()=>{"use strict";var t={386:(e,t,r)=>{r.r(t)},652:(e,t,r)=>{r.r(t)},249:(e,t,r)=>{r.r(t)},782:(e,t,r)=>{r.r(t)},425:(e,t,r)=>{r.r(t)},110:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return a(t,e),t},l=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.CountrySelector=void 0,r(386);var u=i(r(156)),s=r(445),c=r(379),d=r(197),f=r(289),p=r(946);t.CountrySelector=function(e){var t,r,o=e.selectedCountry,a=e.onSelect,i=e.disabled,v=e.hideDropdown,y=e.countries,b=void 0===y?s.defaultCountries:y,h=e.renderButtonWrapper,C=l(e,["selectedCountry","onSelect","disabled","hideDropdown","countries","renderButtonWrapper"]),m=(0,u.useState)(!1),g=m[0],P=m[1],_=(0,u.useMemo)((function(){if(o)return(0,d.getCountry)({value:o,field:"iso2",countries:b})}),[b,o]),w=(0,u.useRef)(null);return u.default.createElement("div",{className:(0,c.buildClassNames)({addPrefix:["country-selector"],rawClassNames:[C.className]}),style:C.style,ref:w},(t={title:null==_?void 0:_.name,onClick:function(){return P((function(e){return!e}))},onMouseDown:function(e){return e.preventDefault()},onKeyDown:function(e){e.key&&["ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),P(!0))},disabled:v||i,role:"combobox","aria-label":"Country selector","aria-haspopup":"listbox","aria-expanded":g},r=u.default.createElement("div",{className:(0,c.buildClassNames)({addPrefix:["country-selector-button__button-content"],rawClassNames:[C.buttonContentWrapperClassName]}),style:C.buttonContentWrapperStyle},u.default.createElement(f.FlagEmoji,{iso2:o,className:(0,c.buildClassNames)({addPrefix:["country-selector-button__flag-emoji",i&&"country-selector-button__flag-emoji--disabled"],rawClassNames:[C.flagClassName]}),style:n({visibility:o?"visible":"hidden"},C.flagStyle)}),!v&&u.default.createElement("div",{className:(0,c.buildClassNames)({addPrefix:["country-selector-button__dropdown-arrow",i&&"country-selector-button__dropdown-arrow--disabled",g&&"country-selector-button__dropdown-arrow--active"],rawClassNames:[C.dropdownArrowClassName]}),style:C.dropdownArrowStyle})),h?h({children:r,rootProps:t}):u.default.createElement("button",n({},t,{type:"button",className:(0,c.buildClassNames)({addPrefix:["country-selector-button",g&&"country-selector-button--active",i&&"country-selector-button--disabled",v&&"country-selector-button--hide-dropdown"],rawClassNames:[C.buttonClassName]}),"data-country":o,style:C.buttonStyle}),r)),u.default.createElement(p.CountrySelectorDropdown,n({show:g,countries:b,onSelect:function(e){P(!1),null==a||a(e)},selectedCountry:o,onClose:function(){P(!1)}},C.dropdownStyleProps)))}},946:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return a(t,e),t},l=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.CountrySelectorDropdown=void 0,r(652);var u=i(r(156)),s=r(445),c=r(379),d=r(197),f=r(289);t.CountrySelectorDropdown=function(e){var t=e.show,r=e.dialCodePrefix,o=void 0===r?"+":r,a=e.selectedCountry,i=e.countries,p=void 0===i?s.defaultCountries:i,v=e.onSelect,y=e.onClose,b=l(e,["show","dialCodePrefix","selectedCountry","countries","onSelect","onClose"]),h=(0,u.useRef)(null),C=(0,u.useRef)(),m=(0,u.useRef)({updatedAt:void 0,value:""}),g=(0,u.useCallback)((function(e){return p.findIndex((function(t){return(0,d.parseCountry)(t).iso2===e}))}),[p]),P=(0,u.useState)(g(a)),_=P[0],w=P[1],O=function(){C.current!==a&&w(g(a))},D=(0,u.useCallback)((function(e){w(g(e.iso2)),null==v||v(e)}),[v,g]),j=function(e){var t=p.length-1;w((function(r){var n,o=(n=r,"prev"===e?n-1:"next"===e?n+1:"last"===e?t:0);return o<0?0:o>t?t:o}))},S=(0,u.useCallback)((function(){if(h.current&&void 0!==_){var e=(0,d.parseCountry)(p[_]).iso2;if(e!==C.current){var t=h.current.querySelector('[data-country="'.concat(e,'"]'));t&&((0,d.scrollToChild)(h.current,t),C.current=e)}}}),[_,p]);return(0,u.useEffect)((function(){S()}),[_,S]),(0,u.useEffect)((function(){h.current&&(t?h.current.focus():O())}),[t]),(0,u.useEffect)((function(){O()}),[a]),u.default.createElement("ul",{ref:h,role:"listbox",className:(0,c.buildClassNames)({addPrefix:["country-selector-dropdown"],rawClassNames:[b.className]}),style:n({display:t?"block":"none"},b.style),onKeyDown:function(e){if(e.stopPropagation(),"Enter"!==e.key)if("Escape"!==e.key){if("ArrowUp"===e.key)return e.preventDefault(),void j("prev");if("ArrowDown"===e.key)return e.preventDefault(),void j("next");if("PageUp"===e.key)return e.preventDefault(),void j("first");if("PageDown"===e.key)return e.preventDefault(),void j("last");" "===e.key&&e.preventDefault(),1!==e.key.length||e.altKey||e.ctrlKey||e.metaKey||function(e){var t=m.current.updatedAt&&(new Date).getTime()-m.current.updatedAt.getTime()>1e3;m.current={value:t?e:"".concat(m.current.value).concat(e),updatedAt:new Date};var r=p.findIndex((function(e){return(0,d.parseCountry)(e).name.toLowerCase().startsWith(m.current.value)}));-1!==r&&w(r)}(e.key.toLocaleLowerCase())}else null==y||y();else{var t=(0,d.parseCountry)(p[_]);D(t)}},onBlur:y,tabIndex:-1,"aria-activedescendant":"".concat((0,d.parseCountry)(p[_]).iso2,"-option")},p.map((function(e,t){var r=(0,d.parseCountry)(e),n=r.iso2===a,i=t===_;return u.default.createElement("li",{key:r.iso2,"data-country":r.iso2,role:"option","aria-selected":n,"aria-label":"".concat(r.name," ").concat(o).concat(r.dialCode),id:"".concat(r.iso2,"-option"),className:(0,c.buildClassNames)({addPrefix:["country-selector-dropdown__list-item",n&&"country-selector-dropdown__list-item--selected",i&&"country-selector-dropdown__list-item--focused"],rawClassNames:[b.listItemClassName]}),onClick:function(){return D(r)},style:b.listItemStyle},u.default.createElement(f.FlagEmoji,{iso2:r.iso2,className:(0,c.buildClassNames)({addPrefix:["country-selector-dropdown__list-item-flag-emoji"],rawClassNames:[b.listItemFlagClassName]}),style:b.listItemFlagStyle}),u.default.createElement("span",{className:(0,c.buildClassNames)({addPrefix:["country-selector-dropdown__list-item-country-name"],rawClassNames:[b.listItemCountryNameClassName]}),style:b.listItemCountryNameStyle},r.name),u.default.createElement("span",{className:(0,c.buildClassNames)({addPrefix:["country-selector-dropdown__list-item-dial-code"],rawClassNames:[b.listItemDialCodeClassName]}),style:b.listItemDialCodeStyle},o,r.dialCode))})))}},805:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DialCodePreview=void 0,r(249);var o=n(r(156)),a=r(379);t.DialCodePreview=function(e){var t=e.dialCode,r=e.prefix,n=e.disabled,i=e.style,l=e.className;return o.default.createElement("div",{className:(0,a.buildClassNames)({addPrefix:["dial-code-preview",n&&"dial-code-preview--disabled"],rawClassNames:[l]}),style:i},"".concat(r).concat(t))}},289:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FlagEmoji=void 0,r(782);var i=a(r(156)),l=r(379),u="abcdefghijklmnopqrstuvwxyz".split("").reduce((function(e,t,r){var o,a,i;return n(n({},e),((o={})[t]=(a=r,i=parseInt("1f1e6",16),Number(i+a).toString(16)),o))}),{});t.FlagEmoji=function(e){var t=e.iso2,r=e.size,a=void 0===r?"24px":r,s=e.protocol,c=void 0===s?"https":s,d=e.disableLazyLoading,f=e.className,p=o(e,["iso2","size","protocol","disableLazyLoading","className"]);if(!t)return i.default.createElement("img",n({width:a,height:a},p));var v=function(e){return[u[e[0]],u[e[1]]].join("-")}(t),y="".concat(c,"://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/").concat(v,".svg");return i.default.createElement("img",n({className:(0,l.buildClassNames)({addPrefix:["flag-emoji"],rawClassNames:[f]}),src:y,width:a,height:a,draggable:!1,"data-country":t,loading:d?void 0:"lazy"},p))}},519:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return a(t,e),t},l=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.PhoneInput=void 0,r(425);var u=i(r(156)),s=r(445),c=r(268),d=r(379),f=r(197),p=r(110),v=r(805);t.PhoneInput=function(e){var t,r=e.hideDropdown,o=e.placeholder,a=e.disabled,i=e.showDisabledDialCodeAndPrefix,y=e.inputProps,b=e.onChange,h=e.style,C=e.className,m=e.inputStyle,g=e.inputClassName,P=e.countrySelectorStyleProps,_=e.dialCodePreviewStyleProps,w=e.value,O=e.countries,D=void 0===O?s.defaultCountries:O,j=l(e,["hideDropdown","placeholder","disabled","showDisabledDialCodeAndPrefix","inputProps","onChange","style","className","inputStyle","inputClassName","countrySelectorStyleProps","dialCodePreviewStyleProps","value","countries"]),S=(0,c.usePhoneInput)(n(n({value:w,countries:D},j),{onChange:function(e){null==b||b(e.phone,e.country)}})),N=S.phone,M=S.inputRef,x=S.country,k=S.setCountry,A=S.handlePhoneValueChange,E=(0,u.useMemo)((function(){if(x)return(0,f.getCountry)({value:x,field:"iso2",countries:D})}),[D,x]),I=j.disableDialCodeAndPrefix&&i&&(null==E?void 0:E.dialCode);return u.default.createElement("div",{className:(0,d.buildClassNames)({addPrefix:["input-container"],rawClassNames:[C]}),style:h},u.default.createElement(p.CountrySelector,n({onSelect:function(e){return k(e.iso2)},selectedCountry:x,countries:D,disabled:a,hideDropdown:r},P)),I&&u.default.createElement(v.DialCodePreview,n({dialCode:E.dialCode,prefix:null!==(t=j.prefix)&&void 0!==t?t:"+",disabled:a},_)),u.default.createElement("input",n({onChange:A,value:N,type:"tel",ref:M,className:(0,d.buildClassNames)({addPrefix:["input",a&&"input--disabled"],rawClassNames:[g]}),placeholder:o,disabled:a,style:m},y)))}},445:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultCountries=void 0,t.defaultCountries=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["Andorra","ad","376"],["Angola","ao","244"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54","(..) ........",0],["Armenia","am","374",".. ......"],["Aruba","aw","297"],["Australia","au","61",". .... ....",0],["Austria","at","43"],["Azerbaijan","az","994","(..) ... .. .."],["Bahamas","bs","1242"],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1246"],["Belarus","by","375","(..) ... .. .."],["Belgium","be","32","... .. .. .."],["Belize","bz","501"],["Benin","bj","229"],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55","(..) ........."],["British Indian Ocean Territory","io","246"],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1","(...) ...-....",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599","",1],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86","... .... ...."],["Colombia","co","57","... ... ...."],["Comoros","km","269"],["Congo","cd","243"],["Congo","cg","242"],["Costa Rica","cr","506","....-...."],["Côte d'Ivoire","ci","225",".. .. .. .. .."],["Croatia","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599","",0],["Cyprus","cy","357",".. ......"],["Czech Republic","cz","420","... ... ..."],["Denmark","dk","45",".. .. .. .."],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic","do","1","",2],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503","....-...."],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372",".... ......"],["Ethiopia","et","251"],["Fiji","fj","679"],["Finland","fi","358",".. ... .. .."],["France","fr","33",". .. .. .. .."],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49",".... ........"],["Ghana","gh","233"],["Greece","gr","30"],["Grenada","gd","1473"],["Guadeloupe","gp","590","",0],["Guam","gu","1671"],["Guatemala","gt","502","....-...."],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509","....-...."],["Honduras","hn","504"],["Hong Kong","hk","852",".... ...."],["Hungary","hu","36"],["Iceland","is","354","... ...."],["India","in","91",".....-....."],["Indonesia","id","62"],["Iran","ir","98","... ... ...."],["Iraq","iq","964"],["Ireland","ie","353",".. ......."],["Israel","il","972","... ... ...."],["Italy","it","39","... .......",0],["Jamaica","jm","1876"],["Japan","jp","81",".. .... ...."],["Jordan","jo","962"],["Kazakhstan","kz","7","... ...-..-..",0],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996","... ... ..."],["Laos","la","856"],["Latvia","lv","371",".. ... ..."],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Macedonia","mk","389"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60","..-....-...."],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mexico","mx","52","... ... ....",0],["Micronesia","fm","691"],["Moldova","md","373","(..) ..-..-.."],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Morocco","ma","212"],["Mozambique","mz","258"],["Myanmar","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31",".. ........"],["New Caledonia","nc","687"],["New Zealand","nz","64","...-...-...."],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["North Korea","kp","850"],["Norway","no","47","... .. ..."],["Oman","om","968"],["Pakistan","pk","92","...-......."],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63",".... ......."],["Poland","pl","48","...-...-..."],["Portugal","pt","351"],["Puerto Rico","pr","1","",3],["Qatar","qa","974"],["Réunion","re","262"],["Romania","ro","40"],["Russia","ru","7","(...) ...-..-..",1],["Rwanda","rw","250"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65","....-...."],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82","... .... ...."],["South Sudan","ss","211"],["Spain","es","34","... ... ..."],["Sri Lanka","lk","94"],["Sudan","sd","249"],["Suriname","sr","597"],["Swaziland","sz","268"],["Sweden","se","46","(...) ...-..."],["Switzerland","ch","41",".. ... .. .."],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia","tn","216"],["Turkey","tr","90","... ... .. .."],["Turkmenistan","tm","993"],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380","(..) ... .. .."],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",".... ......"],["United States","us","1","(...) ...-....",0],["Uruguay","uy","598"],["Uzbekistan","uz","998",".. ... .. .."],["Vanuatu","vu","678"],["Vatican City","va","39",".. .... ....",1],["Venezuela","ve","58"],["Vietnam","vn","84"],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"]]},616:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.useHistoryState=void 0;var a=r(156),i=r(459),l={size:20,overrideLastItemDebounceMS:-1};t.useHistoryState=function(e,t){var r=n(n({},l),t),u=r.size,s=r.overrideLastItemDebounceMS,c=r.onChange,d=(0,a.useState)(e),f=d[0],p=d[1],v=(0,a.useState)([f]),y=v[0],b=v[1],h=(0,a.useState)(0),C=h[0],m=h[1],g=(0,i.useTimer)();return[f,function(e,t){if(("object"!=typeof e||Object.entries(e).toString()!==Object.entries(f).toString())&&e!==f){var r=s>0,n=g.check(),a=!r||void 0===n||n>s;if(void 0!==(null==t?void 0:t.overrideLastItem)?t.overrideLastItem:!a)b((function(t){return o(o([],t.slice(0,C),!0),[e],!1)}));else{var i=y.length>=u;b((function(t){return o(o([],t.slice(i?1:0,C+1),!0),[e],!1)})),i||m((function(e){return e+1}))}p(e),null==c||c(e)}},function(){if(C<=0)return{success:!1};var e=y[C-1];return p(e),m((function(e){return e-1})),null==c||c(e),{success:!0,value:e}},function(){if(C+1>=y.length)return{success:!1};var e=y[C+1];return p(e),m((function(e){return e+1})),null==c||c(e),{success:!0,value:e}}]}},268:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.usePhoneInput=t.defaultConfig=t.MASK_CHAR=void 0;var n=r(156),o=r(445),a=r(197),i=r(616);t.MASK_CHAR=".",t.defaultConfig={defaultCountry:"us",value:"",prefix:"+",defaultMask:"............",charAfterDialCode:" ",historySaveDebounceMS:200,disableCountryGuess:!1,disableDialCodePrefill:!1,forceDialCode:!1,disableDialCodeAndPrefix:!1,countries:o.defaultCountries},t.usePhoneInput=function(e){var r=e.defaultCountry,o=void 0===r?t.defaultConfig.defaultCountry:r,l=e.value,u=void 0===l?t.defaultConfig.value:l,s=e.countries,c=void 0===s?t.defaultConfig.countries:s,d=e.prefix,f=void 0===d?t.defaultConfig.prefix:d,p=e.defaultMask,v=void 0===p?t.defaultConfig.defaultMask:p,y=e.charAfterDialCode,b=void 0===y?t.defaultConfig.charAfterDialCode:y,h=e.historySaveDebounceMS,C=void 0===h?t.defaultConfig.historySaveDebounceMS:h,m=e.disableCountryGuess,g=void 0===m?t.defaultConfig.disableCountryGuess:m,P=e.disableDialCodePrefill,_=void 0===P?t.defaultConfig.disableDialCodePrefill:P,w=e.forceDialCode,O=void 0===w?t.defaultConfig.forceDialCode:w,D=e.disableDialCodeAndPrefix,j=void 0===D?t.defaultConfig.disableDialCodeAndPrefix:D,S=e.onChange,N=!j&&!g,M=(0,n.useRef)(null),x=function(e){var r,n=e.value,o=e.country,i=e.trimNonDigitsEnd,l=e.insertDialCodeOnEmpty,u=!e.forceDisableCountryGuess&&N?(0,a.guessCountryByPartialNumber)({phone:n,countries:c,currentCountryIso2:o.iso2}):void 0,s=null!==(r=null==u?void 0:u.country)&&void 0!==r?r:o;return{phone:s?(0,a.formatPhone)(n,{prefix:f,mask:s.format||v,maskChar:t.MASK_CHAR,dialCode:s.dialCode,trimNonDigitsEnd:i,charAfterDialCode:b,forceDialCode:O,insertDialCodeOnEmpty:l,disableDialCodeAndPrefix:j}):n,countryGuessResult:u,formatCountry:s}},k=function(e){Promise.resolve().then((function(){var t;null===(t=M.current)||void 0===t||t.setSelectionRange(e,e)}))},A=(0,i.useHistoryState)((function(){var e=(0,a.guessCountryByPartialNumber)({phone:u,countries:c,currentCountryIso2:o}).country||(0,a.getCountry)({value:o,field:"iso2",countries:c});e||console.error('[react-international-phone]: can not find a country with "'.concat(o,'" iso2 code'));var t=e||(0,a.parseCountry)(c.find((function(e){return"us"===(0,a.parseCountry)(e).iso2}))),r=x({value:u,country:t,insertDialCodeOnEmpty:!_}).phone;return k(r.length),{phone:r,country:t.iso2}}),{overrideLastItemDebounceMS:C,onChange:S}),E=A[0],I=E.phone,B=E.country,L=A[1],z=A[2],R=A[3],T=(0,n.useMemo)((function(){return(0,a.getCountry)({value:B,field:"iso2",countries:c})}),[c,B]),G=function(e,t){var r,n,o=void 0===t?{}:t,i=o.deletion,l=o.cursorPosition,u=o.insertDialCodeOnEmpty,s=o.inserted,c=e,d=l;O&&!j&&T&&!(0,a.removeNonDigits)(e).startsWith(T.dialCode)&&e&&(s&&e.startsWith(f)&&e.length-(null!=l?l:0)==0?c=e:(c=I,d=0));var p=x({value:c,country:T,trimNonDigitsEnd:"backward"===i,insertDialCodeOnEmpty:u,forceDisableCountryGuess:O&&!!i&&(0,a.removeNonDigits)(c).length<T.dialCode.length}),v=p.phone,y=p.countryGuessResult,h=T;N&&(null==y?void 0:y.country)&&y.country.name!==B&&y.fullDialCodeMatch&&(h=y.country);var C=(0,a.getCursorPosition)({cursorPositionAfterInput:null!=d?d:0,phoneBeforeInput:I,phoneAfterInput:e,phoneAfterFormatted:v,leftOffset:O?f.length+(null!==(n=null===(r=null==T?void 0:T.dialCode)||void 0===r?void 0:r.length)&&void 0!==n?n:0)+b.length:0,deletion:i});return L({phone:v,country:h.iso2}),k(C),v};(0,n.useEffect)((function(){var e=M.current;if(e){var t=function(e){if(e.key){var t=e.ctrlKey,r=e.shiftKey,n="z"===e.key.toLowerCase();t&&n&&(r?R():z())}};return e.addEventListener("keydown",t),function(){e.removeEventListener("keydown",t)}}}),[M,z,R]);var K=(0,n.useState)(!1),W=K[0],F=K[1];return(0,n.useEffect)((function(){if(!W)return F(!0),void(u!==I&&(null==S||S({phone:I,country:B})));u!==I&&G(u)}),[u]),{phone:I,country:B,setCountry:function(e){var t=(0,a.getCountry)({value:e,field:"iso2",countries:c});if(t){var r=j?"":"".concat(f).concat(t.dialCode).concat(b);L({phone:r,country:t.iso2}),Promise.resolve().then((function(){var e;null===(e=M.current)||void 0===e||e.focus()}))}},handlePhoneValueChange:function(e){var t;e.preventDefault();var r=e.nativeEvent.inputType,n=null==r?void 0:r.startsWith("insertFrom"),o=G(e.target.value,{deletion:function(){var e;if(null!==(e=null==r?void 0:r.toLocaleLowerCase().includes("delete"))&&void 0!==e&&e)return(null==r?void 0:r.toLocaleLowerCase().includes("forward"))?"forward":"backward"}(),inserted:n,cursorPosition:null!==(t=e.target.selectionStart)&&void 0!==t?t:0});return j&&T?(0,a.addDialCode)({phone:o,dialCode:T.dialCode,charAfterDialCode:b,prefix:f}):o},inputRef:M}}},459:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useTimer=void 0;var n=r(156);t.useTimer=function(){var e=(0,n.useRef)(),t=(0,n.useRef)(Date.now());return{check:function(){var r=Date.now(),n=e.current?r-t.current:void 0;return e.current=t.current,t.current=r,n}}}},379:function(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.buildClassNames=t.classNamesWithPrefix=t.joinClasses=t.classPrefix=void 0,t.classPrefix="react-international-phone-",t.joinClasses=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return!!e})).join(" ").trim()},t.classNamesWithPrefix=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.joinClasses.apply(void 0,e).split(" ").map((function(e){return"".concat(t.classPrefix).concat(e)})).join(" ")},t.buildClassNames=function(e){var n=e.addPrefix,o=e.rawClassNames;return t.joinClasses.apply(void 0,r([t.classNamesWithPrefix.apply(void 0,n)],o,!1))}},36:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyMask=void 0,t.applyMask=function(e){var t=e.value,r=e.mask,n=e.maskSymbol,o=e.offset,a=void 0===o?0:o,i=e.trimNonMaskCharsLeftover,l=void 0!==i&&i;if(t.length<a)return t;for(var u=t.slice(0,a),s=t.slice(a),c=u,d=0,f=0,p=r.split("");f<p.length;f++){var v=p[f];if(d>=s.length){if(!l&&v!==n){c+=v;continue}break}v===n?(c+=s[d],d+=1):c+=v}return c}},945:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(36),t),o(r(961),t),o(r(230),t)},961:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeNonDigits=void 0,t.removeNonDigits=function(e){return e.replace(/\D/g,"")}},230:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.scrollToChild=void 0,t.scrollToChild=function(e,t){var r=e.style.display;"block"!==r&&(e.style.display="block");var n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),a=o.top-n.top,i=n.bottom-o.bottom;a>=0&&i>=0||(Math.abs(a)<Math.abs(i)?e.scrollTop+=a:e.scrollTop-=i),e.style.display=r}},738:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buildCountryData=void 0,t.buildCountryData=function(e){for(var t=[e.name,e.iso2,e.dialCode,e.format,e.priority,e.areaCodes],r=0;r<t.length;r+=1)if(0!==r){var n=t[r-1],o=t[r];if(void 0===n&&void 0!==o){var a=JSON.stringify(t,(function(e,t){return void 0===t?"__undefined":t})).replace(/"__undefined"/g,"undefined");throw new Error("[react-international-phone] invalid country values passed to buildCountryData. Check ".concat(n," in: ").concat(a))}}return t.filter((function(e){return void 0!==e}))}},183:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCountry=void 0;var n=r(863);t.getCountry=function(e){var t=e.value,r=e.field,o=e.countries;if(["priority"].includes(r))throw new Error(function(e){return'Field "'.concat(e,'" is not supported')}(r));var a=o.find((function(e){var o=(0,n.parseCountry)(e);return t===o[r]}));if(a)return(0,n.parseCountry)(a)}},265:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.guessCountryByPartialNumber=void 0;var n=r(945),o=r(183),a=r(863);t.guessCountryByPartialNumber=function(e){var t,r=e.phone,i=e.countries,l=e.currentCountryIso2,u={country:void 0,fullDialCodeMatch:!1};if(!r)return u;var s=(0,n.removeNonDigits)(r);if(!s)return u;for(var c=u,d=function(e){var t,r,n,o,a=e.country,i=e.fullDialCodeMatch,l=a.dialCode===(null===(t=c.country)||void 0===t?void 0:t.dialCode),u=(null!==(r=a.priority)&&void 0!==r?r:0)<(null!==(o=null===(n=c.country)||void 0===n?void 0:n.priority)&&void 0!==o?o:0);l&&!u||(c={country:a,fullDialCodeMatch:i})},f=0,p=i;f<p.length;f++){var v=p[f],y=(0,a.parseCountry)(v),b=y.dialCode,h=y.areaCodes;if(s.startsWith(b)){var C=!c.country||Number(b)>=Number(c.country.dialCode);if(h)for(var m=s.substring(b.length),g=0,P=h;g<P.length;g++){var _=P[g];if(m.startsWith(_))return{country:y,fullDialCodeMatch:!0}}!C&&b!==s&&c.fullDialCodeMatch||d({country:y,fullDialCodeMatch:!0})}c.fullDialCodeMatch||s.length<b.length&&b.startsWith(s)&&(!c.country||Number(b)<=Number(c.country.dialCode))&&d({country:y,fullDialCodeMatch:!1})}if(l){var w=(0,o.getCountry)({value:l,field:"iso2",countries:i});if(!w)return c;var O=!!w&&function(e){if(!(null==e?void 0:e.areaCodes))return!1;var t=s.substring(e.dialCode.length);return e.areaCodes.some((function(e){return e.startsWith(t)}))}(w);c&&(null===(t=c.country)||void 0===t?void 0:t.dialCode)===w.dialCode&&c.country!==w&&c.fullDialCodeMatch&&(!w.areaCodes||O)&&(c={country:w,fullDialCodeMatch:!0})}return c}},373:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(738),t),o(r(183),t),o(r(265),t),o(r(863),t)},863:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseCountry=void 0,t.parseCountry=function(e){return{name:e[0],iso2:e[1],dialCode:e[2],format:e[3],priority:e[4],areaCodes:e[5]}}},197:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(945),t),o(r(373),t),o(r(367),t)},479:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDialCode=void 0;var n=r(617);t.addDialCode=function(e){var t=e.phone,r=e.dialCode,o=e.prefix,a=void 0===o?"+":o,i=e.charAfterDialCode,l=void 0===i?" ":i;return"".concat(a).concat(r).concat(l).concat((0,n.removeDialCode)({phone:t,dialCode:r,charAfterDialCode:l,prefix:a}))}},854:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatPhone=void 0;var n=r(945);t.formatPhone=function(e,t){var r=!t.disableDialCodeAndPrefix&&t.forceDialCode,o=!t.disableDialCodeAndPrefix&&t.insertDialCodeOnEmpty,a=e,i=function(e){return t.trimNonDigitsEnd?e.trim():e};if(!a)return o&&!a.length||r?i("".concat(t.prefix).concat(t.dialCode).concat(t.charAfterDialCode)):i(a);if((a=(0,n.removeNonDigits)(a))===t.dialCode&&!t.disableDialCodeAndPrefix)return i("".concat(t.prefix).concat(t.dialCode).concat(t.charAfterDialCode));if(t.dialCode.startsWith(a)&&!t.disableDialCodeAndPrefix)return i(r?"".concat(t.prefix).concat(t.dialCode).concat(t.charAfterDialCode):"".concat(t.prefix).concat(a));if(!a.startsWith(t.dialCode)&&!t.disableDialCodeAndPrefix){if(r)return i("".concat(t.prefix).concat(t.dialCode).concat(t.charAfterDialCode));if(a.length<t.dialCode.length)return i("".concat(t.prefix).concat(a))}var l,u=(l=t.dialCode.length,t.disableDialCodeAndPrefix&&(l=0),{phoneLeftSide:a.slice(0,l),phoneRightSide:a.slice(l)}),s=u.phoneLeftSide,c=u.phoneRightSide;return s="".concat(t.prefix).concat(s).concat(t.charAfterDialCode),c=(0,n.applyMask)({value:c,mask:t.mask,maskSymbol:t.maskChar,trimNonMaskCharsLeftover:t.trimNonDigitsEnd}),t.disableDialCodeAndPrefix&&(s=""),i("".concat(s).concat(c))}},753:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCursorPosition=void 0;var r=function(e){return/\d/.test(e)};t.getCursorPosition=function(e){var t=e.phoneBeforeInput,n=e.phoneAfterInput,o=e.phoneAfterFormatted,a=e.cursorPositionAfterInput,i=e.leftOffset,l=void 0===i?0:i,u=e.deletion;if(a<l)return l;if(!t)return o.length;var s="backward"===u;if(0===a&&n.length>0&&o.length>0){if(s)return 0;for(var c=0;c<o.length;c+=1)if(r(o[c]))return c;return o.length}if(n.length<t.length&&1===n.length)return o.length;var d=null;for(c=a-1;c>=0;c-=1)if(r(n[c])){d=c;break}if(null===d)return 0!==a?a:o.length;var f=0;for(c=0;c<d;c+=1)r(n[c])&&(f+=1);s&&(f-=1);var p=0,v=0;for(c=0;c<o.length&&(p+=1,r(o[c])&&(v+=1),v!==f+1);c+=1);for(;!r(o[p])&&p<o.length;)p+=1;return s&&(p+=1),p}},367:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(479),t),o(r(854),t),o(r(753),t),o(r(617),t)},617:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeDialCode=void 0,t.removeDialCode=function(e){var t=e.phone,r=e.dialCode,n=e.prefix,o=void 0===n?"+":n,a=e.charAfterDialCode,i=void 0===a?" ":a;if(!t||!r)return t;var l=t;return l.startsWith(o)&&(l=l.replace(o,"")),l.startsWith(r)?((l=l.replace(r,"")).startsWith(i)&&(l=l.replace(i,"")),l):t}},156:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e].call(a.exports,a,a.exports,n),a.exports}n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.parseCountry=e.buildCountryData=e.usePhoneInput=e.defaultCountries=e.PhoneInput=e.FlagEmoji=e.DialCodePreview=e.CountrySelectorDropdown=e.CountrySelector=void 0;var t=n(110);Object.defineProperty(e,"CountrySelector",{enumerable:!0,get:function(){return t.CountrySelector}});var r=n(946);Object.defineProperty(e,"CountrySelectorDropdown",{enumerable:!0,get:function(){return r.CountrySelectorDropdown}});var a=n(805);Object.defineProperty(e,"DialCodePreview",{enumerable:!0,get:function(){return a.DialCodePreview}});var i=n(289);Object.defineProperty(e,"FlagEmoji",{enumerable:!0,get:function(){return i.FlagEmoji}});var l=n(519);Object.defineProperty(e,"PhoneInput",{enumerable:!0,get:function(){return l.PhoneInput}});var u=n(445);Object.defineProperty(e,"defaultCountries",{enumerable:!0,get:function(){return u.defaultCountries}});var s=n(268);Object.defineProperty(e,"usePhoneInput",{enumerable:!0,get:function(){return s.usePhoneInput}});var c=n(197);Object.defineProperty(e,"buildCountryData",{enumerable:!0,get:function(){return c.buildCountryData}}),Object.defineProperty(e,"parseCountry",{enumerable:!0,get:function(){return c.parseCountry}})})(),o})()));
"use strict";function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(r){if(Array.isArray(r))return e(r)}function n(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var a=true;var o=false;var i,l;try{for(t=t.call(e);!(a=(i=t.next()).done);a=true){n.push(i.value);if(r&&n.length===r)break}}catch(e){o=true;l=e}finally{try{if(!a&&t["return"]!=null)t["return"]()}finally{if(o)throw l}}return n}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var a=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){a=a.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}a.forEach(function(r){n(e,r,t[r])})}return e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function d(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{c(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,r){if(e==null)return{};var t=f(e,r);var n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++){n=o[a];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function f(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var a,o;for(o=0;o<n.length;o++){a=n[o];if(r.indexOf(a)>=0)continue;t[a]=e[a]}return t}function v(e,t){return r(e)||o(e,t)||p(e,t)||i()}function y(e){return t(e)||a(e)||p(e)||l()}function p(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}var m=Object.create;var h=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var D=function(e,r){for(var t in r)h(e,t,{get:r[t],enumerable:!0})},S=function(e,r,t,n){var a=true,o=false,i=undefined;if(r&&typeof r=="object"||typeof r=="function")try{var l=function(){var a=c.value;!w.call(e,a)&&a!==t&&h(e,a,{get:function(){return r[a]},enumerable:!(n=C(r,a))||n.enumerable})};for(var u=b(r)[Symbol.iterator](),c;!(a=(c=u.next()).done);a=true)l()}catch(e){o=true;i=e}finally{try{if(!a&&u.return!=null){u.return()}}finally{if(o){throw i}}}return e};var P=function(e,r,t){return t=e!=null?m(g(e)):{},S(r||!e||!e.__esModule?h(t,"default",{value:e,enumerable:!0}):t,e)},x=function(e){return S(h({},"__esModule",{value:!0}),e)};var k={};D(k,{CountrySelector:function(){return et},CountrySelectorDropdown:function(){return er},DialCodePreview:function(){return ea},FlagEmoji:function(){return $},PhoneInput:function(){return ep},buildCountryData:function(){return _},defaultCountries:function(){return A},parseCountry:function(){return B},usePhoneInput:function(){return ey}});module.exports=x(k);var N=P(require("react"));var A=[["Afghanistan","af","93"],["Albania","al","355"],["Algeria","dz","213"],["Andorra","ad","376"],["Angola","ao","244"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54","(..) ........",0],["Armenia","am","374",".. ......"],["Aruba","aw","297"],["Australia","au","61",". .... ....",0],["Austria","at","43"],["Azerbaijan","az","994","(..) ... .. .."],["Bahamas","bs","1242"],["Bahrain","bh","973"],["Bangladesh","bd","880"],["Barbados","bb","1246"],["Belarus","by","375","(..) ... .. .."],["Belgium","be","32","... .. .. .."],["Belize","bz","501"],["Benin","bj","229"],["Bhutan","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina","ba","387"],["Botswana","bw","267"],["Brazil","br","55","(..) ........."],["British Indian Ocean Territory","io","246"],["Brunei","bn","673"],["Bulgaria","bg","359"],["Burkina Faso","bf","226"],["Burundi","bi","257"],["Cambodia","kh","855"],["Cameroon","cm","237"],["Canada","ca","1","(...) ...-....",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde","cv","238"],["Caribbean Netherlands","bq","599","",1],["Central African Republic","cf","236"],["Chad","td","235"],["Chile","cl","56"],["China","cn","86","... .... ...."],["Colombia","co","57","... ... ...."],["Comoros","km","269"],["Congo","cd","243"],["Congo","cg","242"],["Costa Rica","cr","506","....-...."],["C\xf4te d'Ivoire","ci","225",".. .. .. .. .."],["Croatia","hr","385"],["Cuba","cu","53"],["Cura\xe7ao","cw","599","",0],["Cyprus","cy","357",".. ......"],["Czech Republic","cz","420","... ... ..."],["Denmark","dk","45",".. .. .. .."],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic","do","1","",2],["Ecuador","ec","593"],["Egypt","eg","20"],["El Salvador","sv","503","....-...."],["Equatorial Guinea","gq","240"],["Eritrea","er","291"],["Estonia","ee","372",".... ......"],["Ethiopia","et","251"],["Fiji","fj","679"],["Finland","fi","358",".. ... .. .."],["France","fr","33",". .. .. .. .."],["French Guiana","gf","594"],["French Polynesia","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia","ge","995"],["Germany","de","49",".... ........"],["Ghana","gh","233"],["Greece","gr","30"],["Grenada","gd","1473"],["Guadeloupe","gp","590","",0],["Guam","gu","1671"],["Guatemala","gt","502","....-...."],["Guinea","gn","224"],["Guinea-Bissau","gw","245"],["Guyana","gy","592"],["Haiti","ht","509","....-...."],["Honduras","hn","504"],["Hong Kong","hk","852",".... ...."],["Hungary","hu","36"],["Iceland","is","354","... ...."],["India","in","91",".....-....."],["Indonesia","id","62"],["Iran","ir","98","... ... ...."],["Iraq","iq","964"],["Ireland","ie","353",".. ......."],["Israel","il","972","... ... ...."],["Italy","it","39","... .......",0],["Jamaica","jm","1876"],["Japan","jp","81",".. .... ...."],["Jordan","jo","962"],["Kazakhstan","kz","7","... ...-..-..",0],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait","kw","965"],["Kyrgyzstan","kg","996","... ... ..."],["Laos","la","856"],["Latvia","lv","371",".. ... ..."],["Lebanon","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya","ly","218"],["Liechtenstein","li","423"],["Lithuania","lt","370"],["Luxembourg","lu","352"],["Macau","mo","853"],["Macedonia","mk","389"],["Madagascar","mg","261"],["Malawi","mw","265"],["Malaysia","my","60","..-....-...."],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania","mr","222"],["Mauritius","mu","230"],["Mexico","mx","52","... ... ....",0],["Micronesia","fm","691"],["Moldova","md","373","(..) ..-..-.."],["Monaco","mc","377"],["Mongolia","mn","976"],["Montenegro","me","382"],["Morocco","ma","212"],["Mozambique","mz","258"],["Myanmar","mm","95"],["Namibia","na","264"],["Nauru","nr","674"],["Nepal","np","977"],["Netherlands","nl","31",".. ........"],["New Caledonia","nc","687"],["New Zealand","nz","64","...-...-...."],["Nicaragua","ni","505"],["Niger","ne","227"],["Nigeria","ng","234"],["North Korea","kp","850"],["Norway","no","47","... .. ..."],["Oman","om","968"],["Pakistan","pk","92","...-......."],["Palau","pw","680"],["Palestine","ps","970"],["Panama","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru","pe","51"],["Philippines","ph","63",".... ......."],["Poland","pl","48","...-...-..."],["Portugal","pt","351"],["Puerto Rico","pr","1","",3],["Qatar","qa","974"],["R\xe9union","re","262"],["Romania","ro","40"],["Russia","ru","7","(...) ...-..-..",1],["Rwanda","rw","250"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["S\xe3o Tom\xe9 and Pr\xedncipe","st","239"],["Saudi Arabia","sa","966"],["Senegal","sn","221"],["Serbia","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65","....-...."],["Slovakia","sk","421"],["Slovenia","si","386"],["Solomon Islands","sb","677"],["Somalia","so","252"],["South Africa","za","27"],["South Korea","kr","82","... .... ...."],["South Sudan","ss","211"],["Spain","es","34","... ... ..."],["Sri Lanka","lk","94"],["Sudan","sd","249"],["Suriname","sr","597"],["Swaziland","sz","268"],["Sweden","se","46","(...) ...-..."],["Switzerland","ch","41",".. ... .. .."],["Syria","sy","963"],["Taiwan","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia","tn","216"],["Turkey","tr","90","... ... .. .."],["Turkmenistan","tm","993"],["Tuvalu","tv","688"],["Uganda","ug","256"],["Ukraine","ua","380","(..) ... .. .."],["United Arab Emirates","ae","971"],["United Kingdom","gb","44",".... ......"],["United States","us","1","(...) ...-....",0],["Uruguay","uy","598"],["Uzbekistan","uz","998",".. ... .. .."],["Vanuatu","vu","678"],["Vatican City","va","39",".. .... ....",1],["Venezuela","ve","58"],["Vietnam","vn","84"],["Yemen","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"]];var j="react-international-phone-",E=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return r.filter(function(e){return!!e}).join(" ").trim()},O=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}return E.apply(void 0,y(r)).split(" ").map(function(e){return"".concat(j).concat(e)}).join(" ")},M=function(e){var r=e.addPrefix,t=e.rawClassNames;return E.apply(void 0,[O.apply(void 0,y(r))].concat(y(t)))};var I=function(e){var r=e.value,t=e.mask,n=e.maskSymbol,a=e.offset,o=a===void 0?0:a,i=e.trimNonMaskCharsLeftover,l=i===void 0?!1:i;if(r.length<o)return r;var u=r.slice(0,o),c=r.slice(o),d=u,s=0;var f=true,v=false,y=undefined;try{for(var p=t.split("")[Symbol.iterator](),m;!(f=(m=p.next()).done);f=true){var h=m.value;if(s>=c.length){if(!l&&h!==n){d+=h;continue}break}h===n?(d+=c[s],s+=1):d+=h}}catch(e){v=true;y=e}finally{try{if(!f&&p.return!=null){p.return()}}finally{if(v){throw y}}}return d};var L=function(e){return e.replace(/\D/g,"")};var z=function(e,r){var t=e.style.display;t!=="block"&&(e.style.display="block");var n=e.getBoundingClientRect(),a=r.getBoundingClientRect(),o=a.top-n.top,i=n.bottom-a.bottom;o>=0&&i>=0||(Math.abs(o)<Math.abs(i)?e.scrollTop+=o:e.scrollTop-=i),e.style.display=t};var _=function(e){var r=e.name,t=e.iso2,n=e.dialCode,a=e.format,o=e.priority,i=e.areaCodes,l=[r,t,n,a,o,i];for(var u=0;u<l.length;u+=1){if(u===0)continue;var c=l[u-1],d=l[u];if(c===void 0&&d!==void 0){var s=JSON.stringify(l,function(e,r){return r===void 0?"__undefined":r}).replace(/"__undefined"/g,"undefined");throw new Error("[react-international-phone] invalid country values passed to buildCountryData. Check ".concat(c," in: ").concat(s))}}return l.filter(function(e){return e!==void 0})};var B=function(e){var r=v(e,6),t=r[0],n=r[1],a=r[2],o=r[3],i=r[4],l=r[5];return{name:t,iso2:n,dialCode:a,format:o,priority:i,areaCodes:l}};var R=function(e){return'Field "'.concat(e,'" is not supported')},G=function(e){var r=e.value,t=e.field,n=e.countries;if(["priority"].includes(t))throw new Error(R(t));var a=n.find(function(e){var n=B(e);return r===n[t]});if(a)return B(a)};var T=function(e){var r=e.phone,t=e.countries,n=e.currentCountryIso2;var a={country:void 0,fullDialCodeMatch:!1};if(!r)return a;var o=L(r);if(!o)return a;var i=a,l=function(e){var r=e.country,t=e.fullDialCodeMatch;var n,a;var o,l;var u=r.dialCode===((n=i.country)===null||n===void 0?void 0:n.dialCode),c=((o=r.priority)!==null&&o!==void 0?o:0)<((l=(a=i.country)===null||a===void 0?void 0:a.priority)!==null&&l!==void 0?l:0);(!u||c)&&(i={country:r,fullDialCodeMatch:t})};var u=true,c=false,d=undefined;try{for(var s=t[Symbol.iterator](),f;!(u=(f=s.next()).done);u=true){var v=f.value;var y=B(v),p=y.dialCode,m=y.areaCodes;if(o.startsWith(p)){var h=i.country?Number(p)>=Number(i.country.dialCode):!0;if(m){var C=o.substring(p.length);var b=true,g=false,w=undefined;try{for(var D=m[Symbol.iterator](),S;!(b=(S=D.next()).done);b=true){var P=S.value;if(C.startsWith(P))return{country:y,fullDialCodeMatch:!0}}}catch(e){g=true;w=e}finally{try{if(!b&&D.return!=null){D.return()}}finally{if(g){throw w}}}}(h||p===o||!i.fullDialCodeMatch)&&l({country:y,fullDialCodeMatch:!0})}i.fullDialCodeMatch||o.length<p.length&&p.startsWith(o)&&(!i.country||Number(p)<=Number(i.country.dialCode))&&l({country:y,fullDialCodeMatch:!1})}}catch(e){c=true;d=e}finally{try{if(!u&&s.return!=null){s.return()}}finally{if(c){throw d}}}if(n){var x;var k=G({value:n,field:"iso2",countries:t});if(!k)return i;var N=k?function(e){var r;if(!((r=e)===null||r===void 0?void 0:r.areaCodes))return!1;var t=o.substring(e.dialCode.length);return e.areaCodes.some(function(e){return e.startsWith(t)})}(k):!1;!!i&&((x=i.country)===null||x===void 0?void 0:x.dialCode)===k.dialCode&&i.country!==k&&i.fullDialCodeMatch&&(!k.areaCodes||N)&&(i={country:k,fullDialCodeMatch:!0})}return i};var q=function(e){var r=e.phone,t=e.dialCode,n=e.prefix,a=n===void 0?"+":n,o=e.charAfterDialCode,i=o===void 0?" ":o;if(!r||!t)return r;var l=r;return l.startsWith(a)&&(l=l.replace(a,"")),l.startsWith(t)?(l=l.replace(t,""),l.startsWith(i)&&(l=l.replace(i,"")),l):r};var K=function(e){var r=e.phone,t=e.dialCode,n=e.prefix,a=n===void 0?"+":n,o=e.charAfterDialCode,i=o===void 0?" ":o;return"".concat(a).concat(t).concat(i).concat(q({phone:r,dialCode:t,charAfterDialCode:i,prefix:a}))};var W=function(e,r){var t=r.disableDialCodeAndPrefix?!1:r.forceDialCode,n=r.disableDialCodeAndPrefix?!1:r.insertDialCodeOnEmpty,a=e,o=function(e){return r.trimNonDigitsEnd?e.trim():e};if(!a)return n&&!a.length||t?o("".concat(r.prefix).concat(r.dialCode).concat(r.charAfterDialCode)):o(a);if(a=L(a),a===r.dialCode&&!r.disableDialCodeAndPrefix)return o("".concat(r.prefix).concat(r.dialCode).concat(r.charAfterDialCode));if(r.dialCode.startsWith(a)&&!r.disableDialCodeAndPrefix)return o(t?"".concat(r.prefix).concat(r.dialCode).concat(r.charAfterDialCode):"".concat(r.prefix).concat(a));if(!a.startsWith(r.dialCode)&&!r.disableDialCodeAndPrefix){if(t)return o("".concat(r.prefix).concat(r.dialCode).concat(r.charAfterDialCode));if(a.length<r.dialCode.length)return o("".concat(r.prefix).concat(a))}var i=function(){var e=r.dialCode.length;r.disableDialCodeAndPrefix&&(e=0);var t=a.slice(0,e),n=a.slice(e);return{phoneLeftSide:t,phoneRightSide:n}},l=i(),u=l.phoneLeftSide,c=l.phoneRightSide;return u="".concat(r.prefix).concat(u).concat(r.charAfterDialCode),c=I({value:c,mask:r.mask,maskSymbol:r.maskChar,trimNonMaskCharsLeftover:r.trimNonDigitsEnd}),r.disableDialCodeAndPrefix&&(u=""),o("".concat(u).concat(c))};var F=function(e){return/\d/.test(e)},U=function(e){var r=e.phoneBeforeInput,t=e.phoneAfterInput,n=e.phoneAfterFormatted,a=e.cursorPositionAfterInput,o=e.leftOffset,i=o===void 0?0:o,l=e.deletion;if(a<i)return i;if(!r)return n.length;var u=l==="backward";if(a===0&&t.length>0&&n.length>0){if(u)return 0;for(var c=0;c<n.length;c+=1)if(F(n[c]))return c;return n.length}if(t.length<r.length&&t.length===1)return n.length;var d=null;for(var s=a-1;s>=0;s-=1)if(F(t[s])){d=s;break}if(d===null)return a!==0?a:n.length;var f=0;for(var v=0;v<d;v+=1)F(t[v])&&(f+=1);u&&(f-=1);var y=0,p=0;for(var m=0;m<n.length&&(y+=1,F(n[m])&&(p+=1),p!==f+1);m+=1);for(;!F(n[y])&&y<n.length;)y+=1;return u&&(y+=1),y};var V=P(require("react"));var H=function(e,r){var t=parseInt(e,16);return Number(t+r).toString(16)},J="abcdefghijklmnopqrstuvwxyz",Z="1f1e6",Q=J.split("").reduce(function(e,r,t){return d(u({},e),n({},r,H(Z,t)))},{}),Y=function(e){return[Q[e[0]],Q[e[1]]].join("-")},$=function(e){var r=e.iso2,t=e.size,n=t===void 0?"24px":t,a=e.protocol,o=a===void 0?"https":a,i=e.disableLazyLoading,l=e.className,c=s(e,["iso2","size","protocol","disableLazyLoading","className"]);if(!r)return V.default.createElement("img",u({width:n,height:n},c));var d=Y(r),f="".concat(o,"://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/").concat(d,".svg");return V.default.createElement("img",u({className:M({addPrefix:["flag-emoji"],rawClassNames:[l]}),src:f,width:n,height:n,draggable:!1,"data-country":r,loading:i?void 0:"lazy"},c))};var X=P(require("react"));var ee=1e3,er=function(e){var r=e.show,t=e.dialCodePrefix,n=t===void 0?"+":t,a=e.selectedCountry,o=e.countries,i=o===void 0?A:o,l=e.onSelect,c=e.onClose,d=s(e,["show","dialCodePrefix","selectedCountry","countries","onSelect","onClose"]);var f=(0,X.useRef)(null),y=(0,X.useRef)(),p=(0,X.useRef)({updatedAt:void 0,value:""}),m=function(e){var r=p.current.updatedAt&&new Date().getTime()-p.current.updatedAt.getTime()>ee;p.current={value:r?e:"".concat(p.current.value).concat(e),updatedAt:new Date};var t=i.findIndex(function(e){return B(e).name.toLowerCase().startsWith(p.current.value)});t!==-1&&g(t)},h=(0,X.useCallback)(function(e){return i.findIndex(function(r){return B(r).iso2===e})},[i]),C=v((0,X.useState)(h(a)),2),b=C[0],g=C[1],w=function(){y.current!==a&&g(h(a))},D=(0,X.useCallback)(function(e){var r;g(h(e.iso2)),(r=l)===null||r===void 0?void 0:r(e)},[l,h]),S=function(e){var r=i.length-1,t=function(t){return e==="prev"?t-1:e==="next"?t+1:e==="last"?r:0};g(function(e){var n=t(e);return n<0?0:n>r?r:n})},P=function(e){if(e.stopPropagation(),e.key==="Enter"){var r=B(i[b]);D(r);return}if(e.key==="Escape"){var t;(t=c)===null||t===void 0?void 0:t();return}if(e.key==="ArrowUp"){e.preventDefault(),S("prev");return}if(e.key==="ArrowDown"){e.preventDefault(),S("next");return}if(e.key==="PageUp"){e.preventDefault(),S("first");return}if(e.key==="PageDown"){e.preventDefault(),S("last");return}e.key===" "&&e.preventDefault(),e.key.length===1&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&m(e.key.toLocaleLowerCase())},x=(0,X.useCallback)(function(){if(!f.current||b===void 0)return;var e=B(i[b]).iso2;if(e===y.current)return;var r=f.current.querySelector('[data-country="'.concat(e,'"]'));r&&(z(f.current,r),y.current=e)},[b,i]);return(0,X.useEffect)(function(){x()},[b,x]),(0,X.useEffect)(function(){f.current&&(r?f.current.focus():w())},[r]),(0,X.useEffect)(function(){w()},[a]),X.default.createElement("ul",{ref:f,role:"listbox",className:M({addPrefix:["country-selector-dropdown"],rawClassNames:[d.className]}),style:u({display:r?"block":"none"},d.style),onKeyDown:P,onBlur:c,tabIndex:-1,"aria-activedescendant":"".concat(B(i[b]).iso2,"-option")},i.map(function(e,r){var t=B(e),o=t.iso2===a,i=r===b;return X.default.createElement("li",{key:t.iso2,"data-country":t.iso2,role:"option","aria-selected":o,"aria-label":"".concat(t.name," ").concat(n).concat(t.dialCode),id:"".concat(t.iso2,"-option"),className:M({addPrefix:["country-selector-dropdown__list-item",o&&"country-selector-dropdown__list-item--selected",i&&"country-selector-dropdown__list-item--focused"],rawClassNames:[d.listItemClassName]}),onClick:function(){return D(t)},style:d.listItemStyle},X.default.createElement($,{iso2:t.iso2,className:M({addPrefix:["country-selector-dropdown__list-item-flag-emoji"],rawClassNames:[d.listItemFlagClassName]}),style:d.listItemFlagStyle}),X.default.createElement("span",{className:M({addPrefix:["country-selector-dropdown__list-item-country-name"],rawClassNames:[d.listItemCountryNameClassName]}),style:d.listItemCountryNameStyle},t.name),X.default.createElement("span",{className:M({addPrefix:["country-selector-dropdown__list-item-dial-code"],rawClassNames:[d.listItemDialCodeClassName]}),style:d.listItemDialCodeStyle},n,t.dialCode))}))};var et=function(e){var r=e.selectedCountry,t=e.onSelect,n=e.disabled,a=e.hideDropdown,o=e.countries,i=o===void 0?A:o,l=e.renderButtonWrapper,c=s(e,["selectedCountry","onSelect","disabled","hideDropdown","countries","renderButtonWrapper"]);var f=v((0,N.useState)(!1),2),y=f[0],p=f[1],m=(0,N.useMemo)(function(){if(r)return G({value:r,field:"iso2",countries:i})},[i,r]),h=(0,N.useRef)(null),C=function(e){e.key&&["ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),p(!0))},b=function(){var e;var t={title:(e=m)===null||e===void 0?void 0:e.name,onClick:function(){return p(function(e){return!e})},onMouseDown:function(e){return e.preventDefault()},onKeyDown:C,disabled:a||n,role:"combobox","aria-label":"Country selector","aria-haspopup":"listbox","aria-expanded":y},o=N.default.createElement("div",{className:M({addPrefix:["country-selector-button__button-content"],rawClassNames:[c.buttonContentWrapperClassName]}),style:c.buttonContentWrapperStyle},N.default.createElement($,{iso2:r,className:M({addPrefix:["country-selector-button__flag-emoji",n&&"country-selector-button__flag-emoji--disabled"],rawClassNames:[c.flagClassName]}),style:u({visibility:r?"visible":"hidden"},c.flagStyle)}),!a&&N.default.createElement("div",{className:M({addPrefix:["country-selector-button__dropdown-arrow",n&&"country-selector-button__dropdown-arrow--disabled",y&&"country-selector-button__dropdown-arrow--active"],rawClassNames:[c.dropdownArrowClassName]}),style:c.dropdownArrowStyle}));return l?l({children:o,rootProps:t}):N.default.createElement("button",d(u({},t),{type:"button",className:M({addPrefix:["country-selector-button",y&&"country-selector-button--active",n&&"country-selector-button--disabled",a&&"country-selector-button--hide-dropdown"],rawClassNames:[c.buttonClassName]}),"data-country":r,style:c.buttonStyle}),o)};return N.default.createElement("div",{className:M({addPrefix:["country-selector"],rawClassNames:[c.className]}),style:c.style,ref:h},b(),N.default.createElement(er,u({show:y,countries:i,onSelect:function(e){var r;p(!1),(r=t)===null||r===void 0?void 0:r(e)},selectedCountry:r,onClose:function(){p(!1)}},c.dropdownStyleProps)))};var en=P(require("react"));var ea=function(e){var r=e.dialCode,t=e.prefix,n=e.disabled,a=e.style,o=e.className;return en.default.createElement("div",{className:M({addPrefix:["dial-code-preview",n&&"dial-code-preview--disabled"],rawClassNames:[o]}),style:a},"".concat(t).concat(r))};var eo=P(require("react"));var ei=require("react");var el=require("react");var eu=require("react"),ec=function(){var e=(0,eu.useRef)(),r=(0,eu.useRef)(Date.now());return{check:function(){var t=Date.now(),n=e.current?t-r.current:void 0;return e.current=r.current,r.current=t,n}}};var ed={size:20,overrideLastItemDebounceMS:-1};function es(e,r){var t=u({},ed,r),n=t.size,a=t.overrideLastItemDebounceMS,o=t.onChange,i=v((0,el.useState)(e),2),l=i[0],c=i[1],d=v((0,el.useState)([l]),2),s=d[0],f=d[1],p=v((0,el.useState)(0),2),m=p[0],h=p[1],C=ec();return[l,function(e,r){var t,i;if(typeof e=="object"&&Object.entries(e).toString()===Object.entries(l).toString()||e===l)return;var u=a>0,d=C.check(),v=u&&d!==void 0?d>a:!0;if(((t=r)===null||t===void 0?void 0:t.overrideLastItem)!==void 0?r.overrideLastItem:!v)f(function(r){return y(r.slice(0,m)).concat([e])});else{var p=s.length>=n;f(function(r){return y(r.slice(p?1:0,m+1)).concat([e])}),p||h(function(e){return e+1})}c(e),(i=o)===null||i===void 0?void 0:i(e)},function(){var e;if(m<=0)return{success:!1};var r=s[m-1];return c(r),h(function(e){return e-1}),(e=o)===null||e===void 0?void 0:e(r),{success:!0,value:r}},function(){var e;if(m+1>=s.length)return{success:!1};var r=s[m+1];return c(r),h(function(e){return e+1}),(e=o)===null||e===void 0?void 0:e(r),{success:!0,value:r}}]}var ef=".",ev={defaultCountry:"us",value:"",prefix:"+",defaultMask:"............",charAfterDialCode:" ",historySaveDebounceMS:200,disableCountryGuess:!1,disableDialCodePrefill:!1,forceDialCode:!1,disableDialCodeAndPrefix:!1,countries:A},ey=function(e){var r=e.defaultCountry,t=r===void 0?ev.defaultCountry:r,n=e.value,a=n===void 0?ev.value:n,o=e.countries,i=o===void 0?ev.countries:o,l=e.prefix,u=l===void 0?ev.prefix:l,c=e.defaultMask,d=c===void 0?ev.defaultMask:c,s=e.charAfterDialCode,f=s===void 0?ev.charAfterDialCode:s,y=e.historySaveDebounceMS,p=y===void 0?ev.historySaveDebounceMS:y,m=e.disableCountryGuess,h=m===void 0?ev.disableCountryGuess:m,C=e.disableDialCodePrefill,b=C===void 0?ev.disableDialCodePrefill:C,g=e.forceDialCode,w=g===void 0?ev.forceDialCode:g,D=e.disableDialCodeAndPrefix,S=D===void 0?ev.disableDialCodeAndPrefix:D,P=e.onChange;var x=S?!1:!h,k=(0,ei.useRef)(null),N=function(e){var r=e.value,t=e.country,n=e.trimNonDigitsEnd,a=e.insertDialCodeOnEmpty,o=e.forceDisableCountryGuess;var l;var c;var s=!o&&x?T({phone:r,countries:i,currentCountryIso2:t.iso2}):void 0,v=(c=(l=s)===null||l===void 0?void 0:l.country)!==null&&c!==void 0?c:t;return{phone:v?W(r,{prefix:u,mask:v.format||d,maskChar:ef,dialCode:v.dialCode,trimNonDigitsEnd:n,charAfterDialCode:f,forceDialCode:w,insertDialCodeOnEmpty:a,disableDialCodeAndPrefix:S}):r,countryGuessResult:s,formatCountry:v}},A=function(e){Promise.resolve().then(function(){var r;(r=k.current)===null||r===void 0?void 0:r.setSelectionRange(e,e)})},j=v(es(function(){var e=T({phone:a,countries:i,currentCountryIso2:t}).country||G({value:t,field:"iso2",countries:i});e||console.error('[react-international-phone]: can not find a country with "'.concat(t,'" iso2 code'));var r=e||B(i.find(function(e){return B(e).iso2==="us"})),n=N({value:a,country:r,insertDialCodeOnEmpty:!b}).phone;return A(n.length),{phone:n,country:r.iso2}},{overrideLastItemDebounceMS:p,onChange:P}),4),E=j[0],O=E.phone,M=E.country,I=j[1],z=j[2],_=j[3],R=(0,ei.useMemo)(function(){return G({value:M,field:"iso2",countries:i})},[i,M]),q=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.deletion,n=r.cursorPosition,a=r.insertDialCodeOnEmpty,o=r.inserted;var i,l,c;var d=e,s=n;w&&!S&&R&&!L(e).startsWith(R.dialCode)&&e&&(o&&e.startsWith(u)&&e.length-(n!==null&&n!==void 0?n:0)===0?d=e:(d=O,s=0));var v=N({value:d,country:R,trimNonDigitsEnd:t==="backward",insertDialCodeOnEmpty:a,forceDisableCountryGuess:w&&!!t&&L(d).length<R.dialCode.length}),y=v.phone,p=v.countryGuessResult,m=R;x&&((i=p)===null||i===void 0?void 0:i.country)&&p.country.name!==M&&p.fullDialCodeMatch&&(m=p.country);var h;var C=U({cursorPositionAfterInput:s!==null&&s!==void 0?s:0,phoneBeforeInput:O,phoneAfterInput:e,phoneAfterFormatted:y,leftOffset:w?u.length+((h=(c=R)===null||c===void 0?void 0:(l=c.dialCode)===null||l===void 0?void 0:l.length)!==null&&h!==void 0?h:0)+f.length:0,deletion:t});return I({phone:y,country:m.iso2}),A(C),y};(0,ei.useEffect)(function(){var e=k.current;if(!e)return;var r=function(e){if(!e.key)return;var r=e.ctrlKey,t=e.shiftKey,n=e.key.toLowerCase()==="z";!r||!n||(t?_():z())};return e.addEventListener("keydown",r),function(){e.removeEventListener("keydown",r)}},[k,z,_]);var F=function(e){var r;e.preventDefault();var t;var n=e.nativeEvent.inputType,a=function(){var e,r;var t;if((t=(e=n)===null||e===void 0?void 0:e.toLocaleLowerCase().includes("delete"))!==null&&t!==void 0?t:!1)return((r=n)===null||r===void 0?void 0:r.toLocaleLowerCase().includes("forward"))?"forward":"backward"},o=(r=n)===null||r===void 0?void 0:r.startsWith("insertFrom"),i=q(e.target.value,{deletion:a(),inserted:o,cursorPosition:(t=e.target.selectionStart)!==null&&t!==void 0?t:0});return S&&R?K({phone:i,dialCode:R.dialCode,charAfterDialCode:f,prefix:u}):i},V=function(e){var r=G({value:e,field:"iso2",countries:i});if(!r)return;var t=S?"":"".concat(u).concat(r.dialCode).concat(f);I({phone:t,country:r.iso2}),Promise.resolve().then(function(){var e;(e=k.current)===null||e===void 0?void 0:e.focus()})},H=v((0,ei.useState)(!1),2),J=H[0],Z=H[1];return(0,ei.useEffect)(function(){if(!J){var e;Z(!0),a!==O&&((e=P)===null||e===void 0?void 0:e({phone:O,country:M}));return}a!==O&&q(a)},[a]),{phone:O,country:M,setCountry:V,handlePhoneValueChange:F,inputRef:k}};var ep=function(e){var r=e.hideDropdown,t=e.placeholder,n=e.disabled,a=e.showDisabledDialCodeAndPrefix,o=e.inputProps,i=e.onChange,l=e.style,c=e.className,f=e.inputStyle,v=e.inputClassName,y=e.countrySelectorStyleProps,p=e.dialCodePreviewStyleProps,m=e.value,h=e.countries,C=h===void 0?A:h,b=s(e,["hideDropdown","placeholder","disabled","showDisabledDialCodeAndPrefix","inputProps","onChange","style","className","inputStyle","inputClassName","countrySelectorStyleProps","dialCodePreviewStyleProps","value","countries"]);var g;var w=ey(d(u({value:m,countries:C},b),{onChange:function(e){var r;(r=i)===null||r===void 0?void 0:r(e.phone,e.country)}})),D=w.phone,S=w.inputRef,P=w.country,x=w.setCountry,k=w.handlePhoneValueChange,N=(0,eo.useMemo)(function(){if(P)return G({value:P,field:"iso2",countries:C})},[C,P]),j=b.disableDialCodeAndPrefix&&a&&((g=N)===null||g===void 0?void 0:g.dialCode);var E;return eo.default.createElement("div",{className:M({addPrefix:["input-container"],rawClassNames:[c]}),style:l},eo.default.createElement(et,u({onSelect:function(e){return x(e.iso2)},selectedCountry:P,countries:C,disabled:n,hideDropdown:r},y)),j&&eo.default.createElement(ea,u({dialCode:N.dialCode,prefix:(E=b.prefix)!==null&&E!==void 0?E:"+",disabled:n},p)),eo.default.createElement("input",u({onChange:k,value:D,type:"tel",ref:S,className:M({addPrefix:["input",n&&"input--disabled"],rawClassNames:[v]}),placeholder:t,disabled:n,style:f},o)))};0&&(module.exports={CountrySelector:CountrySelector,CountrySelectorDropdown:CountrySelectorDropdown,DialCodePreview:DialCodePreview,FlagEmoji:FlagEmoji,PhoneInput:PhoneInput,buildCountryData:buildCountryData,defaultCountries:defaultCountries,parseCountry:parseCountry,usePhoneInput:usePhoneInput});
{
"name": "react-international-phone",
"version": "3.0.0",
"version": "3.0.1",
"description": "☎️ International phone input component for React",

@@ -22,17 +22,26 @@ "keywords": [

"license": "MIT",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
"build"
],
"exports": {
".": "./build/index.js",
".": {
"import": {
"types": "./build/index.d.ts",
"default": "./build/index.mjs"
},
"require": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
}
},
"./style.css": "./build/index.css"
},
"types": "./build/index.d.ts",
"main": "./build/index.js",
"files": [
"build/**/*"
],
"scripts": {
"build": "webpack",
"build": "tsup && tsc --emitDeclarationOnly",
"test": "jest",
"test:coverage": "jest --coverage",
"storybook": "start-storybook -p 6006",
"storybook:build": "build-storybook",
"storybook": "sb dev -p 6006",
"storybook:build": "sb build",
"storybook-test:chrome": "npx playwright test ./.storybook/browser.test --headed --browser=chromium",

@@ -73,7 +82,7 @@ "storybook-test:firefox": "npx playwright test ./.storybook/browser.test --headed --browser=firefox",

"@semantic-release/release-notes-generator": "^10.0.3",
"@storybook/addon-controls": "^6.5.16",
"@storybook/builder-webpack5": "^6.5.16",
"@storybook/manager-webpack5": "^6.5.16",
"@storybook/addon-controls": "^7.3.0",
"@storybook/preset-scss": "^1.0.3",
"@storybook/react": "^6.5.16",
"@storybook/react": "^7.3.0",
"@storybook/react-vite": "^7.3.0",
"@swc/core": "^1.3.76",
"@testing-library/jest-dom": "^5.16.5",

@@ -91,3 +100,3 @@ "@testing-library/react": "^12.1.5",

"antd": "^5.0.2",
"css-loader": "^6.7.3",
"esbuild-sass-plugin": "^2.12.0",
"eslint": "^7.32.0",

@@ -107,4 +116,3 @@ "eslint-config-prettier": "^8.5.0",

"lint-staged": "^13.0.3",
"mini-css-extract-plugin": "^2.7.2",
"postcss": "^8.4.17",
"postcss": "^8.4.21",
"postcss-scss": "^4.0.5",

@@ -116,6 +124,4 @@ "prettier": "^2.7.1",

"sass": "^1.55.0",
"sass-loader": "^13.2.0",
"semantic-release": "^19.0.5",
"storybook": "^6.5.16",
"style-loader": "^3.3.1",
"storybook": "^7.3.0",
"stylelint": "^14.13.0",

@@ -132,5 +138,4 @@ "stylelint-config-idiomatic-order": "^9.0.0",

"ts-node": "^10.9.1",
"tsup": "^7.2.0",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"yup": "^0.32.11"

@@ -137,0 +142,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc