intl-tel-input 21.2.0 → 21.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -67,16 +67,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
67
67
|
## Getting Started (Using a CDN)
|
|
68
68
|
1. Add the CSS
|
|
69
69
|
```html
|
|
70
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.
|
|
70
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.1/build/css/intlTelInput.css">
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
2. Add the plugin script and initialise it on your input element
|
|
74
74
|
```html
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.1/build/js/intlTelInput.min.js"></script>
|
|
76
76
|
<script>
|
|
77
77
|
const input = document.querySelector("#phone");
|
|
78
78
|
window.intlTelInput(input, {
|
|
79
|
-
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.
|
|
79
|
+
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@21.2.1/build/js/utils.js",
|
|
80
80
|
});
|
|
81
81
|
</script>
|
|
82
82
|
```
|
package/build/js/data.js
CHANGED
package/build/js/data.min.js
CHANGED
package/build/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v21.2.
|
|
2
|
+
* International Telephone Input v21.2.1
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -3119,7 +3119,7 @@ var factoryOutput = (() => {
|
|
|
3119
3119
|
//* A map from instance ID to instance object.
|
|
3120
3120
|
instances: {},
|
|
3121
3121
|
loadUtils,
|
|
3122
|
-
version: "21.2.
|
|
3122
|
+
version: "21.2.1"
|
|
3123
3123
|
};
|
|
3124
3124
|
window.intlTelInputGlobals = intlTelInputGlobals;
|
|
3125
3125
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v21.2.
|
|
2
|
+
* International Telephone Input v21.2.1
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
}(() => {
|
|
15
15
|
|
|
16
|
-
var factoryOutput=(()=>{var w=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var N=(r,e)=>{for(var i in e)w(r,i,{get:e[i],enumerable:!0})},M=(r,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of D(e))!A.call(r,s)&&s!==i&&w(r,s,{get:()=>e[s],enumerable:!(n=S(e,s))||n.enumerable});return r};var x=r=>M(w({},"__esModule",{value:!0}),r);var $={};N($,{Iti:()=>v,default:()=>B});var t={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var I=[[t.af,"af","93"],[t.al,"al","355"],[t.dz,"dz","213"],[t.as,"as","1",5,["684"]],[t.ad,"ad","376"],[t.ao,"ao","244"],[t.ai,"ai","1",6,["264"]],[t.ag,"ag","1",7,["268"]],[t.ar,"ar","54"],[t.am,"am","374"],[t.aw,"aw","297"],["Ascension Island","ac","247"],[t.au,"au","61",0],[t.at,"at","43"],[t.az,"az","994"],[t.bs,"bs","1",8,["242"]],[t.bh,"bh","973"],[t.bd,"bd","880"],[t.bb,"bb","1",9,["246"]],[t.by,"by","375"],[t.be,"be","32"],[t.bz,"bz","501"],[t.bj,"bj","229"],[t.bm,"bm","1",10,["441"]],[t.bt,"bt","975"],[t.bo,"bo","591"],[t.ba,"ba","387"],[t.bw,"bw","267"],[t.br,"br","55"],[t.io,"io","246"],[t.vg,"vg","1",11,["284"]],[t.bn,"bn","673"],[t.bg,"bg","359"],[t.bf,"bf","226"],[t.bi,"bi","257"],[t.kh,"kh","855"],[t.cm,"cm","237"],[t.ca,"ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],[t.cv,"cv","238"],[t.bq,"bq","599",1,["3","4","7"]],[t.ky,"ky","1",12,["345"]],[t.cf,"cf","236"],[t.td,"td","235"],[t.cl,"cl","56"],[t.cn,"cn","86"],[t.cx,"cx","61",2,["89164"]],[t.cc,"cc","61",1,["89162"]],[t.co,"co","57"],[t.km,"km","269"],[t.cg,"cg","242"],[t.cd,"cd","243"],[t.ck,"ck","682"],[t.cr,"cr","506"],[t.ci,"ci","225"],[t.hr,"hr","385"],[t.cu,"cu","53"],[t.cw,"cw","599",0],[t.cy,"cy","357"],[t.cz,"cz","420"],[t.dk,"dk","45"],[t.dj,"dj","253"],[t.dm,"dm","1",13,["767"]],[t.do,"do","1",2,["809","829","849"]],[t.ec,"ec","593"],[t.eg,"eg","20"],[t.sv,"sv","503"],[t.gq,"gq","240"],[t.er,"er","291"],[t.ee,"ee","372"],[t.sz,"sz","268"],[t.et,"et","251"],[t.fk,"fk","500"],[t.fo,"fo","298"],[t.fj,"fj","679"],[t.fi,"fi","358",0],[t.fr,"fr","33"],[t.gf,"gf","594"],[t.pf,"pf","689"],[t.ga,"ga","241"],[t.gm,"gm","220"],[t.ge,"ge","995"],[t.de,"de","49"],[t.gh,"gh","233"],[t.gi,"gi","350"],[t.gr,"gr","30"],[t.gl,"gl","299"],[t.gd,"gd","1",14,["473"]],[t.gp,"gp","590",0],[t.gu,"gu","1",15,["671"]],[t.gt,"gt","502"],[t.gg,"gg","44",1,["1481","7781","7839","7911"]],[t.gn,"gn","224"],[t.gw,"gw","245"],[t.gy,"gy","592"],[t.ht,"ht","509"],[t.hn,"hn","504"],[t.hk,"hk","852"],[t.hu,"hu","36"],[t.is,"is","354"],[t.in,"in","91"],[t.id,"id","62"],[t.ir,"ir","98"],[t.iq,"iq","964"],[t.ie,"ie","353"],[t.im,"im","44",2,["1624","74576","7524","7924","7624"]],[t.il,"il","972"],[t.it,"it","39",0],[t.jm,"jm","1",4,["876","658"]],[t.jp,"jp","81"],[t.je,"je","44",3,["1534","7509","7700","7797","7829","7937"]],[t.jo,"jo","962"],[t.kz,"kz","7",1,["33","7"]],[t.ke,"ke","254"],[t.ki,"ki","686"],["Kosovo","xk","383"],[t.kw,"kw","965"],[t.kg,"kg","996"],[t.la,"la","856"],[t.lv,"lv","371"],[t.lb,"lb","961"],[t.ls,"ls","266"],[t.lr,"lr","231"],[t.ly,"ly","218"],[t.li,"li","423"],[t.lt,"lt","370"],[t.lu,"lu","352"],[t.mo,"mo","853"],[t.mg,"mg","261"],[t.mw,"mw","265"],[t.my,"my","60"],[t.mv,"mv","960"],[t.ml,"ml","223"],[t.mt,"mt","356"],[t.mh,"mh","692"],[t.mq,"mq","596"],[t.mr,"mr","222"],[t.mu,"mu","230"],[t.yt,"yt","262",1,["269","639"]],[t.mx,"mx","52"],[t.fm,"fm","691"],[t.md,"md","373"],[t.mc,"mc","377"],[t.mn,"mn","976"],[t.me,"me","382"],[t.ms,"ms","1",16,["664"]],[t.ma,"ma","212",0],[t.mz,"mz","258"],[t.mm,"mm","95"],[t.na,"na","264"],[t.nr,"nr","674"],[t.np,"np","977"],[t.nl,"nl","31"],[t.nc,"nc","687"],[t.nz,"nz","64"],[t.ni,"ni","505"],[t.ne,"ne","227"],[t.ng,"ng","234"],[t.nu,"nu","683"],[t.nf,"nf","672"],[t.kp,"kp","850"],[t.mk,"mk","389"],[t.mp,"mp","1",17,["670"]],[t.no,"no","47",0],[t.om,"om","968"],[t.pk,"pk","92"],[t.pw,"pw","680"],[t.ps,"ps","970"],[t.pa,"pa","507"],[t.pg,"pg","675"],[t.py,"py","595"],[t.pe,"pe","51"],[t.ph,"ph","63"],[t.pl,"pl","48"],[t.pt,"pt","351"],[t.pr,"pr","1",3,["787","939"]],[t.qa,"qa","974"],[t.re,"re","262",0],[t.ro,"ro","40"],[t.ru,"ru","7",0],[t.rw,"rw","250"],[t.ws,"ws","685"],[t.sm,"sm","378"],[t.st,"st","239"],[t.sa,"sa","966"],[t.sn,"sn","221"],[t.rs,"rs","381"],[t.sc,"sc","248"],[t.sl,"sl","232"],[t.sg,"sg","65"],[t.sx,"sx","1",21,["721"]],[t.sk,"sk","421"],[t.si,"si","386"],[t.sb,"sb","677"],[t.so,"so","252"],[t.za,"za","27"],[t.kr,"kr","82"],[t.ss,"ss","211"],[t.es,"es","34"],[t.lk,"lk","94"],[t.bl,"bl","590",1],[t.sh,"sh","290"],[t.kn,"kn","1",18,["869"]],[t.lc,"lc","1",19,["758"]],[t.mf,"mf","590",2],[t.pm,"pm","508"],[t.vc,"vc","1",20,["784"]],[t.sd,"sd","249"],[t.sr,"sr","597"],[t.sj,"sj","47",1,["79"]],[t.se,"se","46"],[t.ch,"ch","41"],[t.sy,"sy","963"],[t.tw,"tw","886"],[t.tj,"tj","992"],[t.tz,"tz","255"],[t.th,"th","66"],[t.tl,"tl","670"],[t.tg,"tg","228"],[t.tk,"tk","690"],[t.to,"to","676"],[t.tt,"tt","1",22,["868"]],[t.tn,"tn","216"],[t.tr,"tr","90"],[t.tm,"tm","993"],[t.tc,"tc","1",23,["649"]],[t.tv,"tv","688"],[t.ug,"ug","256"],[t.ua,"ua","380"],[t.ae,"ae","971"],[t.gb,"gb","44",0],[t.us,"us","1",0],[t.uy,"uy","598"],[t.vi,"vi","1",24,["340"]],[t.uz,"uz","998"],[t.vu,"vu","678"],[t.va,"va","39",1,["06698"]],[t.ve,"ve","58"],[t.vn,"vn","84"],[t.wf,"wf","681"],[t.eh,"eh","212",1,["5288","5289"]],[t.ye,"ye","967"],[t.zm,"zm","260"],[t.zw,"zw","263"],[t.ax,"ax","358",1,["18"]]],_=[];for(let r=0;r<I.length;r++){let e=I[r];_[r]={name:e[0],iso2:e[1],dialCode:e[2],priority:e[3]||0,areaCodes:e[4]||null,nodeById:{}}}var C=_;var L={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found"};var P=0,k={allowDropdown:!0,autoPlaceholder:"polite",countrySearch:!0,containerClass:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:[],showFlags:!0,showSelectedDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},H=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=r=>r.replace(/\D/g,""),T=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),z=(r,e,i)=>{i&&!r.classList.contains(e)?r.classList.add(e):!i&&r.classList.contains(e)&&r.classList.remove(e)},E=r=>{let e=b(r);if(e.charAt(0)==="1"){let i=e.substr(1,3);return H.indexOf(i)!==-1}return!1},U=(r,e)=>r.name<e.name?-1:r.name>e.name?1:0,j=(r,e,i,n)=>{if(i===0&&!n)return 0;let s=0;for(let o=0;o<e.length;o++){if(/[+0-9]/.test(e[o])&&s++,s===r&&!n)return o+1;if(n&&s===r+1)return o}return e.length},c=(r,e,i)=>{let n=document.createElement(r);return e&&Object.entries(e).forEach(([s,o])=>n.setAttribute(s,o)),i&&i.appendChild(n),n},f=r=>{let{instances:e}=window.intlTelInputGlobals;Object.values(e).forEach(i=>i[r]())},v=class{id;promise;telInput;activeItem;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;preferredCountries;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_a14;_a9;_a10;_a11;_a12;_handleKeydownEvent;_a4;_a0;_a1;_a2;_a3;_a7;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(e,i={}){this.id=P++,this.a=e,this.b=null,this.c=null,this.d=Object.assign({},k,i),this.e=!!e.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.countrySearch&&!this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!0);let e=this.d.allowDropdown&&!this.d.showSelectedDialCode;!this.d.showFlags&&e&&(this.d.showFlags=!0),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.i18n={...L,...this.d.i18n};let i=new Promise((s,o)=>{this.h=s,this.i=o}),n=new Promise((s,o)=>{this.i0=s,this.i1=o});this.promise=Promise.all([i,n]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._e(),this._d0(),(this.d.onlyCountries.length||this.d.i18n)&&this.p.sort(U)}_c(e,i,n){i.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=i.length),this.q.hasOwnProperty(i)||(this.q[i]=[]);for(let o=0;o<this.q[i].length;o++)if(this.q[i][o]===e)return;let s=n!==void 0?n:this.q[i].length;this.q[i][s]=e}_d(){let{onlyCountries:e,excludeCountries:i}=this.d;if(e.length){let n=e.map(s=>s.toLowerCase());this.p=C.filter(s=>n.indexOf(s.iso2)>-1)}else if(i.length){let n=i.map(s=>s.toLowerCase());this.p=C.filter(s=>n.indexOf(s.iso2)===-1)}else this.p=C}_d0(){for(let e=0;e<this.p.length;e++){let i=this.p[e].iso2.toLowerCase();this.d.i18n.hasOwnProperty(i)&&(this.p[e].name=this.d.i18n[i])}}_d2(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(let e=0;e<this.p.length;e++){let i=this.p[e];this.dialCodes[i.dialCode]||(this.dialCodes[i.dialCode]=!0),this._c(i.iso2,i.dialCode,i.priority)}for(let e=0;e<this.p.length;e++){let i=this.p[e];if(i.areaCodes){let n=this.q[i.dialCode][0];for(let s=0;s<i.areaCodes.length;s++){let o=i.areaCodes[s];for(let a=1;a<o.length;a++){let u=i.dialCode+o.substr(0,a);this._c(n,u),this._c(i.iso2,u)}this._c(i.iso2,i.dialCode+o)}}}}_e(){this.preferredCountries=[];for(let e=0;e<this.d.preferredCountries.length;e++){let i=this.d.preferredCountries[e].toLowerCase(),n=this._y(i,!0);n&&this.preferredCountries.push(n)}}_f(){this.a.classList.add("iti__tel-input"),!this.a.hasAttribute("autocomplete")&&!(this.a.form&&this.a.form.hasAttribute("autocomplete"))&&this.a.setAttribute("autocomplete","off");let{allowDropdown:e,showSelectedDialCode:i,showFlags:n,containerClass:s,hiddenInput:o,dropdownContainer:a,fixDropdownWidth:u,useFullscreenPopup:d,countrySearch:l,i18n:g}=this.d,p="iti";e&&(p+=" iti--allow-dropdown"),i&&(p+=" iti--show-selected-dial-code"),n&&(p+=" iti--show-flags"),s&&(p+=` ${s}`),d||(p+=" iti--inline-dropdown");let h=c("div",{class:p});if(this.a.parentNode?.insertBefore(h,this.a),(n||i)&&(this.k=c("div",{class:"iti__country-container"},h),this.selectedCountry=c("button",{type:"button",class:"iti__selected-country",...e&&{"aria-expanded":"false","aria-label":this.d.i18n.selectedCountryAriaLabel,"aria-haspopup":l?"true":"listbox","aria-controls":l?`iti-${this.id}__dropdown-content`:`iti-${this.id}__country-listbox`,...l?{role:"combobox"}:{}}},this.k),this.l=c("div",null,this.selectedCountry),this.selectedCountryA11yText=c("span",{class:"iti__a11y-text"},this.l)),h.appendChild(this.a),this.selectedCountry&&this.a.disabled&&this.selectedCountry.setAttribute("aria-disabled","true"),i&&(this.t=c("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e){this.a.disabled||this.selectedCountry.setAttribute("tabindex","0"),this.u=c("div",{class:"iti__arrow","aria-hidden":"true"},this.selectedCountry);let y=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=c("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${y}`}),l&&(this.searchInput=c("input",{type:"text",class:"iti__search-input",placeholder:g.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":g.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=c("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=c("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":g.countryListAriaLabel},this.dropdownContent),this.preferredCountries.length&&!l&&(this._g(this.preferredCountries,"iti__preferred",!0),c("li",{class:"iti__divider","aria-hidden":"true"},this.countryList)),this._g(this.p,"iti__standard"),l&&this._p4(),a){let m="iti iti--container";d?m+=" iti--fullscreen-popup":m+=" iti--inline-dropdown",l&&(m+=" iti--country-search"),this.dropdown=c("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.k.appendChild(this.dropdownContent)}if(o){let y=this.a.getAttribute("name")||"",m=o(y);m.phone&&(this.hiddenInput=c("input",{type:"hidden",name:m.phone}),h.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=c("input",{type:"hidden",name:m.country}),h.appendChild(this.hiddenInputCountry))}}_g(e,i,n){for(let s=0;s<e.length;s++){let o=e[s],a=n?"-preferred":"",u=c("li",{id:`iti-${this.id}__item-${o.iso2}${a}`,class:`iti__country ${i}`,tabindex:"-1",role:"option","data-dial-code":o.dialCode,"data-country-code":o.iso2,"aria-selected":"false"},this.countryList);o.nodeById[this.id]=u;let d="";this.d.showFlags&&(d+=`<div class='iti__flag-box'><div class='iti__flag iti__${o.iso2}'></div></div>`),d+=`<span class='iti__country-name'>${o.name}</span>`,d+=`<span class='iti__dial-code'>+${o.dialCode}</span>`,u.insertAdjacentHTML("beforeend",d)}}_h(e=!1){let i=this.a.getAttribute("value"),n=this.a.value,o=i&&i.charAt(0)==="+"&&(!n||n.charAt(0)!=="+")?i:n,a=this._5(o),u=E(o),{initialCountry:d}=this.d;if(a&&!u)this._v(o);else if(d!=="auto"||e){let l=d?d.toLowerCase():"";l&&this._y(l,!0)?this._z(l):a&&u?this._z("us"):this._z()}o&&this._u(o)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=i=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():i.preventDefault()};let e=this.a.closest("label");e&&e.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=i=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(i.key)&&(i.preventDefault(),i.stopPropagation(),this._n()),i.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",()=>{window.intlTelInputGlobals.loadUtils(this.d.utilsScript)}):this.i0(),this.d.initialCountry==="auto"&&!this.s.iso2?this._i4():this.h()}_i4(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((e="")=>{let i=e.toLowerCase();i&&this._y(i,!0)?(window.intlTelInputGlobals.autoCountry=i,setTimeout(()=>f("handleAutoCountry"))):(this._h(!0),f("rejectAutoCountryPromise"))},()=>{this._h(!0),f("rejectAutoCountryPromise")}))}_j(){let{strictMode:e,formatAsYouType:i}=this.d,n=!1;this._a12=s=>{this._v(this.a.value)&&this._8();let o=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.a.value;if(o||a&&!e?n=!0:/[^+0-9]/.test(this.a.value)||(n=!1),i&&!n){let u=this.a.selectionStart||0,l=this.a.value.substring(0,u).replace(/[^+0-9]/g,"").length,g=s&&s.inputType==="deleteContentForward",p=this._9(),h=j(l,p,u,g);this.a.value=p,this.a.setSelectionRange(h,h)}},this.a.addEventListener("input",this._a12),e&&(this._handleKeydownEvent=s=>{if(s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){let o=this.a.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=o||a,d=this._6(),l=window.intlTelInputUtils.getCoreNumber(d,this.s.iso2),g=this.maxCoreNumberLength&&l.length>=this.maxCoreNumberLength;(!u||g)&&s.preventDefault()}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(e){let i=parseInt(this.a.getAttribute("maxlength")||"",10);return i&&e.length>i?e.substr(0,i):e}_trigger(e){let i=new Event(e,{bubbles:!0,cancelable:!0});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:e,countrySearch:i}=this.d;if(e&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),this.b&&!i)this._x(this.b,!1),this._3(this.b,!0);else{let n=this.countryList.firstElementChild;n&&(this._x(n,!1),this.countryList.scrollTop=0),i&&this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let e=this.a.getBoundingClientRect(),i=document.documentElement.scrollTop,n=e.top+i,s=this.dropdownContent.offsetHeight,o=n+this.a.offsetHeight+s<i+window.innerHeight,a=n-s>i,u=!this.d.countrySearch&&!o&&a;if(z(this.dropdownContent,"iti__dropdown-content--dropup",u),this.d.dropdownContainer){let d=u?0:this.a.offsetHeight;this.dropdown.style.top=`${n+d}px`,this.dropdown.style.left=`${e.left+document.body.scrollLeft}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4)}}}_p(){this._a0=s=>{let o=s.target?.closest(".iti__country");o&&this._x(o,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=s=>{let o=s.target?.closest(".iti__country");o&&this._1(o)},this.countryList.addEventListener("click",this._a1);let e=!0;this._a2=()=>{e||this._2(),e=!1},document.documentElement.addEventListener("click",this._a2);let i="",n=null;if(this._a3=s=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key==="ArrowUp"||s.key==="ArrowDown"?this._q(s.key):s.key==="Enter"?this._r():s.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key)&&(s.stopPropagation(),n&&clearTimeout(n),i+=s.key.toLowerCase(),this._s(i),n=setTimeout(()=>{i=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let s=()=>{let a=this.searchInput.value.trim();a?this._p3(a):this._p3("",!0)},o=null;this._a7=()=>{o&&clearTimeout(o),o=setTimeout(()=>{s(),o=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",a=>a.stopPropagation())}}_p3(e,i=!1){let n=!0;this.countryList.innerHTML="";let s=T(e);for(let o=0;o<this.p.length;o++){let a=this.p[o],u=T(a.name),d=`+${a.dialCode}`;if(i||u.includes(s)||d.includes(s)||a.iso2.includes(s)){let l=a.nodeById[this.id];l&&this.countryList.appendChild(l),n&&(this._x(l,!1),n=!1)}}this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:e}=this.d,i=this.countryList.childElementCount,n;i===0?n=e.zeroSearchResults:i===1?n=e.oneSearchResult:n=e.multipleSearchResults.replace("${count}",i.toString()),this.searchResultsA11yText.textContent=n}_q(e){let i=e==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;if(i?i.classList.contains("iti__divider")&&(i=e==="ArrowUp"?i.previousElementSibling:i.nextElementSibling):this.countryList.childElementCount>1&&(i=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),i){this._3(i,!1);let n=!this.d.countrySearch;this._x(i,n)}}_r(){this.c&&this._1(this.c)}_s(e){for(let i=0;i<this.p.length;i++){let n=this.p[i];if(n.name.substr(0,e.length).toLowerCase()===e){let o=n.nodeById[this.id];this._x(o,!1),this._3(o,!0);break}}}_u(e){let i=e;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){let n=this.d.nationalMode||i.charAt(0)!=="+"&&!this.d.showSelectedDialCode,{NATIONAL:s,INTERNATIONAL:o}=window.intlTelInputUtils.numberFormat,a=n?s:o;i=window.intlTelInputUtils.formatNumber(i,this.s.iso2,a)}i=this._7(i),this.a.value=i}_v(e){let i=e.indexOf("+"),n=i?e.substring(i):e,s=this.s.dialCode;n&&s==="1"&&n.charAt(0)!=="+"&&(n.charAt(0)!=="1"&&(n=`1${n}`),n=`+${n}`),this.d.showSelectedDialCode&&s&&n.charAt(0)!=="+"&&(n=`+${s}${n}`);let a=this._5(n,!0),u=b(n),d=null;if(a){let l=this.q[b(a)],g=l.indexOf(this.s.iso2)!==-1&&u.length<=a.length-1;if(!(s==="1"&&E(u))&&!g){for(let h=0;h<l.length;h++)if(l[h]){d=l[h];break}}}else n.charAt(0)==="+"&&u.length?d="":(!n||n==="+")&&!this.s.iso2&&(d=this.j);return d!==null?this._z(d):!1}_x(e,i){let n=this.c;n&&(n.classList.remove("iti__highlight"),n.setAttribute("aria-selected","false")),this.c=e,this.c.classList.add("iti__highlight"),this.c.setAttribute("aria-selected","true"),this.selectedCountry.setAttribute("aria-activedescendant",e.getAttribute("id")||""),this.d.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",e.getAttribute("id")||""),i&&this.c.focus()}_y(e,i){for(let n=0;n<this.p.length;n++)if(this.p[n].iso2===e)return this.p[n];if(i)return null;throw new Error(`No country data for '${e}'`)}_z(e){let{allowDropdown:i,showSelectedDialCode:n,showFlags:s,countrySearch:o,i18n:a}=this.d,u=this.s.iso2?this.s:{};if(this.s=e?this._y(e,!1)||{}:{},this.s.iso2&&(this.j=this.s.iso2),this.l){let d="",l="";e?s&&(d=`iti__flag iti__${e}`,l=`${this.s.name} +${this.s.dialCode}`):(d="iti__flag iti__globe",l=a.noCountrySelected),this.l.className=d,this.selectedCountryA11yText.textContent=l}if(this._z3(e,n),n){let d=this.s.dialCode?`+${this.s.dialCode}`:"";this.t.innerHTML=d;let l=this.selectedCountry.offsetWidth||this._z2();this.isRTL?this.a.style.paddingRight=`${l+6}px`:this.a.style.paddingLeft=`${l+6}px`}if(this._0(),this._updateMaxLength(),i&&!o){let d=this.b;if(d&&(d.classList.remove("iti__active"),d.setAttribute("aria-selected","false")),e){let l=this.countryList.querySelector(`#iti-${this.id}__item-${e}-preferred`)||this.countryList.querySelector(`#iti-${this.id}__item-${e}`);l&&(l.setAttribute("aria-selected","true"),l.classList.add("iti__active"),this.b=l)}}return u.iso2!==e}_updateMaxLength(){if(this.d.strictMode&&window.intlTelInputUtils)if(this.s.iso2){let e=window.intlTelInputUtils.numberType[this.d.placeholderNumberType],i=window.intlTelInputUtils.getExampleNumber(this.s.iso2,!1,e,!0),n=i;for(;window.intlTelInputUtils.isPossibleNumber(i,this.s.iso2);)n=i,i+="0";let s=window.intlTelInputUtils.getCoreNumber(n,this.s.iso2);this.maxCoreNumberLength=s.length}else this.maxCoreNumberLength=null}_z3(e=null,i){if(!this.selectedCountry)return;let n;e&&!i?n=`${this.s.name}: +${this.s.dialCode}`:e?n=this.s.name:n="Unknown",this.selectedCountry.setAttribute("title",n)}_z2(){if(this.a.parentNode){let e=this.a.parentNode.cloneNode(!1);e.style.visibility="hidden",document.body.appendChild(e);let i=this.k.cloneNode();e.appendChild(i);let n=this.selectedCountry.cloneNode(!0);i.appendChild(n);let s=n.offsetWidth;return document.body.removeChild(e),s}return 0}_0(){let{autoPlaceholder:e,placeholderNumberType:i,nationalMode:n,customPlaceholder:s}=this.d,o=e==="aggressive"||!this.e&&e==="polite";if(window.intlTelInputUtils&&o){let a=window.intlTelInputUtils.numberType[i],u=this.s.iso2?window.intlTelInputUtils.getExampleNumber(this.s.iso2,n,a):"";u=this._7(u),typeof s=="function"&&(u=s(u,this.s)),this.a.setAttribute("placeholder",u)}}_1(e){let i=this._z(e.getAttribute("data-country-code"));this._2(),this._4(e.getAttribute("data-dial-code")),this.a.focus(),i&&this._8()}_2(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.c&&this.c.setAttribute("aria-selected","false"),this.d.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),this.d.countrySearch&&this.searchInput.removeEventListener("input",this._a7),document.documentElement.removeEventListener("click",this._a2),this.countryList.removeEventListener("mouseover",this._a0),this.countryList.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.d.useFullscreenPopup||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_3(e,i){let n=this.countryList,s=document.documentElement.scrollTop,o=n.offsetHeight,a=n.getBoundingClientRect().top+s,u=a+o,d=e.offsetHeight,l=e.getBoundingClientRect().top+s,g=l+d,p=l-a+n.scrollTop,h=o/2-d/2;if(l<a)i&&(p-=h),n.scrollTop=p;else if(g>u){i&&(p+=h);let y=o-d;n.scrollTop=p-y}}_4(e){let i=this.a.value,n=`+${e}`,s;if(i.charAt(0)==="+"){let o=this._5(i);o?s=i.replace(o,n):s=n,this.a.value=s}}_5(e,i){let n="";if(e.charAt(0)==="+"){let s="";for(let o=0;o<e.length;o++){let a=e.charAt(o);if(!isNaN(parseInt(a,10))){if(s+=a,i)this.q[s]&&(n=e.substr(0,o+1));else if(this.dialCodes[s]){n=e.substr(0,o+1);break}if(s.length===this.dialCodeMaxLen)break}}}return n}_6(){let e=this.a.value.trim(),{dialCode:i}=this.s,n,s=b(e);return this.d.showSelectedDialCode&&!this.d.nationalMode&&e.charAt(0)!=="+"&&i&&s?n=`+${i}`:n="",n+e}_7(e){let i=e;if(this.d.showSelectedDialCode){let n=this._5(i);if(n){n=`+${this.s.dialCode}`;let s=i[n.length]===" "||i[n.length]==="-"?n.length+1:n.length;i=i.substr(s)}}return this._j2(i)}_8(){this._trigger("countrychange")}_9(){let e=this._6(),i=window.intlTelInputUtils?window.intlTelInputUtils.formatNumberAsYouType(e,this.s.iso2):e,{dialCode:n}=this.s;return this.d.showSelectedDialCode&&!this.d.nationalMode&&this.a.value.charAt(0)!=="+"&&i.includes(`+${n}`)?(i.split(`+${n}`)[1]||"").trim():i}handleAutoCountry(){this.d.initialCountry==="auto"&&window.intlTelInputGlobals.autoCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}handleUtils(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this.s.iso2&&(this._0(),this._updateMaxLength())),this.i0()}destroy(){if(this.d.allowDropdown){this._2(),this.selectedCountry.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);let n=this.a.closest("label");n&&n.removeEventListener("click",this._a9)}let{form:e}=this.a;this._a14&&e&&e.removeEventListener("submit",this._a14),this.a.removeEventListener("input",this._a12),this._handleKeydownEvent&&this.a.removeEventListener("keydown",this._handleKeydownEvent),this.a.removeAttribute("data-intl-tel-input-id");let i=this.a.parentNode;i?.parentNode?.insertBefore(this.a,i),i?.parentNode?.removeChild(i),delete window.intlTelInputGlobals.instances[this.id]}getExtension(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}getNumber(e){if(window.intlTelInputUtils){let{iso2:i}=this.s;return window.intlTelInputUtils.formatNumber(this._6(),i,e)}return""}getNumberType(){return window.intlTelInputUtils?window.intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}getSelectedCountryData(){return this.s}getValidationError(){if(window.intlTelInputUtils){let{iso2:e}=this.s;return window.intlTelInputUtils.getValidationError(this._6(),e)}return-99}isValidNumber(e=!0){let i=this._6();return/\p{L}/u.test(i)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isPossibleNumber(i,this.s.iso2,e):null}isValidNumberPrecise(){let e=this._6();return/\p{L}/u.test(e)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isValidNumber(e,this.s.iso2):null}setCountry(e){let i=e.toLowerCase();this.s.iso2!==i&&(this._z(i),this._4(this.s.dialCode),this._8())}setNumber(e){let i=this._v(e);this._u(e),i&&this._8()}setPlaceholderNumberType(e){this.d.placeholderNumberType=e,this._0()}},F=(r,e,i)=>{let n=document.createElement("script");n.onload=()=>{f("handleUtils"),e&&e()},n.onerror=()=>{f("rejectUtilsScriptPromise"),i&&i()},n.className="iti-load-utils",n.async=!0,n.src=r,document.body.appendChild(n)},R=r=>!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript?(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise((e,i)=>F(r,e,i))):null;if(typeof window=="object"){let r={defaults:k,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:e=>{let i=e.getAttribute("data-intl-tel-input-id");return i?r.instances[i]:null},instances:{},loadUtils:R,version:"21.2.0"};window.intlTelInputGlobals=r}var O=(r,e)=>{let i=new v(r,e);return i._init(),r.setAttribute("data-intl-tel-input-id",i.id.toString()),window.intlTelInputGlobals.instances[i.id]=i,i},B=O;return x($);})();
|
|
16
|
+
var factoryOutput=(()=>{var w=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var N=(r,e)=>{for(var i in e)w(r,i,{get:e[i],enumerable:!0})},M=(r,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of D(e))!A.call(r,s)&&s!==i&&w(r,s,{get:()=>e[s],enumerable:!(n=S(e,s))||n.enumerable});return r};var x=r=>M(w({},"__esModule",{value:!0}),r);var $={};N($,{Iti:()=>v,default:()=>B});var t={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var I=[[t.af,"af","93"],[t.al,"al","355"],[t.dz,"dz","213"],[t.as,"as","1",5,["684"]],[t.ad,"ad","376"],[t.ao,"ao","244"],[t.ai,"ai","1",6,["264"]],[t.ag,"ag","1",7,["268"]],[t.ar,"ar","54"],[t.am,"am","374"],[t.aw,"aw","297"],["Ascension Island","ac","247"],[t.au,"au","61",0],[t.at,"at","43"],[t.az,"az","994"],[t.bs,"bs","1",8,["242"]],[t.bh,"bh","973"],[t.bd,"bd","880"],[t.bb,"bb","1",9,["246"]],[t.by,"by","375"],[t.be,"be","32"],[t.bz,"bz","501"],[t.bj,"bj","229"],[t.bm,"bm","1",10,["441"]],[t.bt,"bt","975"],[t.bo,"bo","591"],[t.ba,"ba","387"],[t.bw,"bw","267"],[t.br,"br","55"],[t.io,"io","246"],[t.vg,"vg","1",11,["284"]],[t.bn,"bn","673"],[t.bg,"bg","359"],[t.bf,"bf","226"],[t.bi,"bi","257"],[t.kh,"kh","855"],[t.cm,"cm","237"],[t.ca,"ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],[t.cv,"cv","238"],[t.bq,"bq","599",1,["3","4","7"]],[t.ky,"ky","1",12,["345"]],[t.cf,"cf","236"],[t.td,"td","235"],[t.cl,"cl","56"],[t.cn,"cn","86"],[t.cx,"cx","61",2,["89164"]],[t.cc,"cc","61",1,["89162"]],[t.co,"co","57"],[t.km,"km","269"],[t.cg,"cg","242"],[t.cd,"cd","243"],[t.ck,"ck","682"],[t.cr,"cr","506"],[t.ci,"ci","225"],[t.hr,"hr","385"],[t.cu,"cu","53"],[t.cw,"cw","599",0],[t.cy,"cy","357"],[t.cz,"cz","420"],[t.dk,"dk","45"],[t.dj,"dj","253"],[t.dm,"dm","1",13,["767"]],[t.do,"do","1",2,["809","829","849"]],[t.ec,"ec","593"],[t.eg,"eg","20"],[t.sv,"sv","503"],[t.gq,"gq","240"],[t.er,"er","291"],[t.ee,"ee","372"],[t.sz,"sz","268"],[t.et,"et","251"],[t.fk,"fk","500"],[t.fo,"fo","298"],[t.fj,"fj","679"],[t.fi,"fi","358",0],[t.fr,"fr","33"],[t.gf,"gf","594"],[t.pf,"pf","689"],[t.ga,"ga","241"],[t.gm,"gm","220"],[t.ge,"ge","995"],[t.de,"de","49"],[t.gh,"gh","233"],[t.gi,"gi","350"],[t.gr,"gr","30"],[t.gl,"gl","299"],[t.gd,"gd","1",14,["473"]],[t.gp,"gp","590",0],[t.gu,"gu","1",15,["671"]],[t.gt,"gt","502"],[t.gg,"gg","44",1,["1481","7781","7839","7911"]],[t.gn,"gn","224"],[t.gw,"gw","245"],[t.gy,"gy","592"],[t.ht,"ht","509"],[t.hn,"hn","504"],[t.hk,"hk","852"],[t.hu,"hu","36"],[t.is,"is","354"],[t.in,"in","91"],[t.id,"id","62"],[t.ir,"ir","98"],[t.iq,"iq","964"],[t.ie,"ie","353"],[t.im,"im","44",2,["1624","74576","7524","7924","7624"]],[t.il,"il","972"],[t.it,"it","39",0],[t.jm,"jm","1",4,["876","658"]],[t.jp,"jp","81"],[t.je,"je","44",3,["1534","7509","7700","7797","7829","7937"]],[t.jo,"jo","962"],[t.kz,"kz","7",1,["33","7"]],[t.ke,"ke","254"],[t.ki,"ki","686"],["Kosovo","xk","383"],[t.kw,"kw","965"],[t.kg,"kg","996"],[t.la,"la","856"],[t.lv,"lv","371"],[t.lb,"lb","961"],[t.ls,"ls","266"],[t.lr,"lr","231"],[t.ly,"ly","218"],[t.li,"li","423"],[t.lt,"lt","370"],[t.lu,"lu","352"],[t.mo,"mo","853"],[t.mg,"mg","261"],[t.mw,"mw","265"],[t.my,"my","60"],[t.mv,"mv","960"],[t.ml,"ml","223"],[t.mt,"mt","356"],[t.mh,"mh","692"],[t.mq,"mq","596"],[t.mr,"mr","222"],[t.mu,"mu","230"],[t.yt,"yt","262",1,["269","639"]],[t.mx,"mx","52"],[t.fm,"fm","691"],[t.md,"md","373"],[t.mc,"mc","377"],[t.mn,"mn","976"],[t.me,"me","382"],[t.ms,"ms","1",16,["664"]],[t.ma,"ma","212",0],[t.mz,"mz","258"],[t.mm,"mm","95"],[t.na,"na","264"],[t.nr,"nr","674"],[t.np,"np","977"],[t.nl,"nl","31"],[t.nc,"nc","687"],[t.nz,"nz","64"],[t.ni,"ni","505"],[t.ne,"ne","227"],[t.ng,"ng","234"],[t.nu,"nu","683"],[t.nf,"nf","672"],[t.kp,"kp","850"],[t.mk,"mk","389"],[t.mp,"mp","1",17,["670"]],[t.no,"no","47",0],[t.om,"om","968"],[t.pk,"pk","92"],[t.pw,"pw","680"],[t.ps,"ps","970"],[t.pa,"pa","507"],[t.pg,"pg","675"],[t.py,"py","595"],[t.pe,"pe","51"],[t.ph,"ph","63"],[t.pl,"pl","48"],[t.pt,"pt","351"],[t.pr,"pr","1",3,["787","939"]],[t.qa,"qa","974"],[t.re,"re","262",0],[t.ro,"ro","40"],[t.ru,"ru","7",0],[t.rw,"rw","250"],[t.ws,"ws","685"],[t.sm,"sm","378"],[t.st,"st","239"],[t.sa,"sa","966"],[t.sn,"sn","221"],[t.rs,"rs","381"],[t.sc,"sc","248"],[t.sl,"sl","232"],[t.sg,"sg","65"],[t.sx,"sx","1",21,["721"]],[t.sk,"sk","421"],[t.si,"si","386"],[t.sb,"sb","677"],[t.so,"so","252"],[t.za,"za","27"],[t.kr,"kr","82"],[t.ss,"ss","211"],[t.es,"es","34"],[t.lk,"lk","94"],[t.bl,"bl","590",1],[t.sh,"sh","290"],[t.kn,"kn","1",18,["869"]],[t.lc,"lc","1",19,["758"]],[t.mf,"mf","590",2],[t.pm,"pm","508"],[t.vc,"vc","1",20,["784"]],[t.sd,"sd","249"],[t.sr,"sr","597"],[t.sj,"sj","47",1,["79"]],[t.se,"se","46"],[t.ch,"ch","41"],[t.sy,"sy","963"],[t.tw,"tw","886"],[t.tj,"tj","992"],[t.tz,"tz","255"],[t.th,"th","66"],[t.tl,"tl","670"],[t.tg,"tg","228"],[t.tk,"tk","690"],[t.to,"to","676"],[t.tt,"tt","1",22,["868"]],[t.tn,"tn","216"],[t.tr,"tr","90"],[t.tm,"tm","993"],[t.tc,"tc","1",23,["649"]],[t.tv,"tv","688"],[t.ug,"ug","256"],[t.ua,"ua","380"],[t.ae,"ae","971"],[t.gb,"gb","44",0],[t.us,"us","1",0],[t.uy,"uy","598"],[t.vi,"vi","1",24,["340"]],[t.uz,"uz","998"],[t.vu,"vu","678"],[t.va,"va","39",1,["06698"]],[t.ve,"ve","58"],[t.vn,"vn","84"],[t.wf,"wf","681"],[t.eh,"eh","212",1,["5288","5289"]],[t.ye,"ye","967"],[t.zm,"zm","260"],[t.zw,"zw","263"],[t.ax,"ax","358",1,["18"]]],_=[];for(let r=0;r<I.length;r++){let e=I[r];_[r]={name:e[0],iso2:e[1],dialCode:e[2],priority:e[3]||0,areaCodes:e[4]||null,nodeById:{}}}var C=_;var L={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found"};var P=0,k={allowDropdown:!0,autoPlaceholder:"polite",countrySearch:!0,containerClass:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:[],showFlags:!0,showSelectedDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},H=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=r=>r.replace(/\D/g,""),T=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),z=(r,e,i)=>{i&&!r.classList.contains(e)?r.classList.add(e):!i&&r.classList.contains(e)&&r.classList.remove(e)},E=r=>{let e=b(r);if(e.charAt(0)==="1"){let i=e.substr(1,3);return H.indexOf(i)!==-1}return!1},U=(r,e)=>r.name<e.name?-1:r.name>e.name?1:0,j=(r,e,i,n)=>{if(i===0&&!n)return 0;let s=0;for(let o=0;o<e.length;o++){if(/[+0-9]/.test(e[o])&&s++,s===r&&!n)return o+1;if(n&&s===r+1)return o}return e.length},c=(r,e,i)=>{let n=document.createElement(r);return e&&Object.entries(e).forEach(([s,o])=>n.setAttribute(s,o)),i&&i.appendChild(n),n},f=r=>{let{instances:e}=window.intlTelInputGlobals;Object.values(e).forEach(i=>i[r]())},v=class{id;promise;telInput;activeItem;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;preferredCountries;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_a14;_a9;_a10;_a11;_a12;_handleKeydownEvent;_a4;_a0;_a1;_a2;_a3;_a7;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(e,i={}){this.id=P++,this.a=e,this.b=null,this.c=null,this.d=Object.assign({},k,i),this.e=!!e.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.countrySearch&&!this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!0);let e=this.d.allowDropdown&&!this.d.showSelectedDialCode;!this.d.showFlags&&e&&(this.d.showFlags=!0),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.i18n={...L,...this.d.i18n};let i=new Promise((s,o)=>{this.h=s,this.i=o}),n=new Promise((s,o)=>{this.i0=s,this.i1=o});this.promise=Promise.all([i,n]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._e(),this._d0(),(this.d.onlyCountries.length||this.d.i18n)&&this.p.sort(U)}_c(e,i,n){i.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=i.length),this.q.hasOwnProperty(i)||(this.q[i]=[]);for(let o=0;o<this.q[i].length;o++)if(this.q[i][o]===e)return;let s=n!==void 0?n:this.q[i].length;this.q[i][s]=e}_d(){let{onlyCountries:e,excludeCountries:i}=this.d;if(e.length){let n=e.map(s=>s.toLowerCase());this.p=C.filter(s=>n.indexOf(s.iso2)>-1)}else if(i.length){let n=i.map(s=>s.toLowerCase());this.p=C.filter(s=>n.indexOf(s.iso2)===-1)}else this.p=C}_d0(){for(let e=0;e<this.p.length;e++){let i=this.p[e].iso2.toLowerCase();this.d.i18n.hasOwnProperty(i)&&(this.p[e].name=this.d.i18n[i])}}_d2(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(let e=0;e<this.p.length;e++){let i=this.p[e];this.dialCodes[i.dialCode]||(this.dialCodes[i.dialCode]=!0),this._c(i.iso2,i.dialCode,i.priority)}for(let e=0;e<this.p.length;e++){let i=this.p[e];if(i.areaCodes){let n=this.q[i.dialCode][0];for(let s=0;s<i.areaCodes.length;s++){let o=i.areaCodes[s];for(let a=1;a<o.length;a++){let u=i.dialCode+o.substr(0,a);this._c(n,u),this._c(i.iso2,u)}this._c(i.iso2,i.dialCode+o)}}}}_e(){this.preferredCountries=[];for(let e=0;e<this.d.preferredCountries.length;e++){let i=this.d.preferredCountries[e].toLowerCase(),n=this._y(i,!0);n&&this.preferredCountries.push(n)}}_f(){this.a.classList.add("iti__tel-input"),!this.a.hasAttribute("autocomplete")&&!(this.a.form&&this.a.form.hasAttribute("autocomplete"))&&this.a.setAttribute("autocomplete","off");let{allowDropdown:e,showSelectedDialCode:i,showFlags:n,containerClass:s,hiddenInput:o,dropdownContainer:a,fixDropdownWidth:u,useFullscreenPopup:d,countrySearch:l,i18n:g}=this.d,p="iti";e&&(p+=" iti--allow-dropdown"),i&&(p+=" iti--show-selected-dial-code"),n&&(p+=" iti--show-flags"),s&&(p+=` ${s}`),d||(p+=" iti--inline-dropdown");let h=c("div",{class:p});if(this.a.parentNode?.insertBefore(h,this.a),(n||i)&&(this.k=c("div",{class:"iti__country-container"},h),this.selectedCountry=c("button",{type:"button",class:"iti__selected-country",...e&&{"aria-expanded":"false","aria-label":this.d.i18n.selectedCountryAriaLabel,"aria-haspopup":l?"true":"listbox","aria-controls":l?`iti-${this.id}__dropdown-content`:`iti-${this.id}__country-listbox`,...l?{role:"combobox"}:{}}},this.k),this.l=c("div",null,this.selectedCountry),this.selectedCountryA11yText=c("span",{class:"iti__a11y-text"},this.l)),h.appendChild(this.a),this.selectedCountry&&this.a.disabled&&this.selectedCountry.setAttribute("aria-disabled","true"),i&&(this.t=c("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e){this.a.disabled||this.selectedCountry.setAttribute("tabindex","0"),this.u=c("div",{class:"iti__arrow","aria-hidden":"true"},this.selectedCountry);let y=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=c("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${y}`}),l&&(this.searchInput=c("input",{type:"text",class:"iti__search-input",placeholder:g.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":g.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=c("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=c("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":g.countryListAriaLabel},this.dropdownContent),this.preferredCountries.length&&!l&&(this._g(this.preferredCountries,"iti__preferred",!0),c("li",{class:"iti__divider","aria-hidden":"true"},this.countryList)),this._g(this.p,"iti__standard"),l&&this._p4(),a){let m="iti iti--container";d?m+=" iti--fullscreen-popup":m+=" iti--inline-dropdown",l&&(m+=" iti--country-search"),this.dropdown=c("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.k.appendChild(this.dropdownContent)}if(o){let y=this.a.getAttribute("name")||"",m=o(y);m.phone&&(this.hiddenInput=c("input",{type:"hidden",name:m.phone}),h.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=c("input",{type:"hidden",name:m.country}),h.appendChild(this.hiddenInputCountry))}}_g(e,i,n){for(let s=0;s<e.length;s++){let o=e[s],a=n?"-preferred":"",u=c("li",{id:`iti-${this.id}__item-${o.iso2}${a}`,class:`iti__country ${i}`,tabindex:"-1",role:"option","data-dial-code":o.dialCode,"data-country-code":o.iso2,"aria-selected":"false"},this.countryList);o.nodeById[this.id]=u;let d="";this.d.showFlags&&(d+=`<div class='iti__flag-box'><div class='iti__flag iti__${o.iso2}'></div></div>`),d+=`<span class='iti__country-name'>${o.name}</span>`,d+=`<span class='iti__dial-code'>+${o.dialCode}</span>`,u.insertAdjacentHTML("beforeend",d)}}_h(e=!1){let i=this.a.getAttribute("value"),n=this.a.value,o=i&&i.charAt(0)==="+"&&(!n||n.charAt(0)!=="+")?i:n,a=this._5(o),u=E(o),{initialCountry:d}=this.d;if(a&&!u)this._v(o);else if(d!=="auto"||e){let l=d?d.toLowerCase():"";l&&this._y(l,!0)?this._z(l):a&&u?this._z("us"):this._z()}o&&this._u(o)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=i=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():i.preventDefault()};let e=this.a.closest("label");e&&e.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=i=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(i.key)&&(i.preventDefault(),i.stopPropagation(),this._n()),i.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",()=>{window.intlTelInputGlobals.loadUtils(this.d.utilsScript)}):this.i0(),this.d.initialCountry==="auto"&&!this.s.iso2?this._i4():this.h()}_i4(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((e="")=>{let i=e.toLowerCase();i&&this._y(i,!0)?(window.intlTelInputGlobals.autoCountry=i,setTimeout(()=>f("handleAutoCountry"))):(this._h(!0),f("rejectAutoCountryPromise"))},()=>{this._h(!0),f("rejectAutoCountryPromise")}))}_j(){let{strictMode:e,formatAsYouType:i}=this.d,n=!1;this._a12=s=>{this._v(this.a.value)&&this._8();let o=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.a.value;if(o||a&&!e?n=!0:/[^+0-9]/.test(this.a.value)||(n=!1),i&&!n){let u=this.a.selectionStart||0,l=this.a.value.substring(0,u).replace(/[^+0-9]/g,"").length,g=s&&s.inputType==="deleteContentForward",p=this._9(),h=j(l,p,u,g);this.a.value=p,this.a.setSelectionRange(h,h)}},this.a.addEventListener("input",this._a12),e&&(this._handleKeydownEvent=s=>{if(s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){let o=this.a.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=o||a,d=this._6(),l=window.intlTelInputUtils.getCoreNumber(d,this.s.iso2),g=this.maxCoreNumberLength&&l.length>=this.maxCoreNumberLength;(!u||g)&&s.preventDefault()}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(e){let i=parseInt(this.a.getAttribute("maxlength")||"",10);return i&&e.length>i?e.substr(0,i):e}_trigger(e){let i=new Event(e,{bubbles:!0,cancelable:!0});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:e,countrySearch:i}=this.d;if(e&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),this.b&&!i)this._x(this.b,!1),this._3(this.b,!0);else{let n=this.countryList.firstElementChild;n&&(this._x(n,!1),this.countryList.scrollTop=0),i&&this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let e=this.a.getBoundingClientRect(),i=document.documentElement.scrollTop,n=e.top+i,s=this.dropdownContent.offsetHeight,o=n+this.a.offsetHeight+s<i+window.innerHeight,a=n-s>i,u=!this.d.countrySearch&&!o&&a;if(z(this.dropdownContent,"iti__dropdown-content--dropup",u),this.d.dropdownContainer){let d=u?0:this.a.offsetHeight;this.dropdown.style.top=`${n+d}px`,this.dropdown.style.left=`${e.left+document.body.scrollLeft}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4)}}}_p(){this._a0=s=>{let o=s.target?.closest(".iti__country");o&&this._x(o,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=s=>{let o=s.target?.closest(".iti__country");o&&this._1(o)},this.countryList.addEventListener("click",this._a1);let e=!0;this._a2=()=>{e||this._2(),e=!1},document.documentElement.addEventListener("click",this._a2);let i="",n=null;if(this._a3=s=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key==="ArrowUp"||s.key==="ArrowDown"?this._q(s.key):s.key==="Enter"?this._r():s.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key)&&(s.stopPropagation(),n&&clearTimeout(n),i+=s.key.toLowerCase(),this._s(i),n=setTimeout(()=>{i=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let s=()=>{let a=this.searchInput.value.trim();a?this._p3(a):this._p3("",!0)},o=null;this._a7=()=>{o&&clearTimeout(o),o=setTimeout(()=>{s(),o=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",a=>a.stopPropagation())}}_p3(e,i=!1){let n=!0;this.countryList.innerHTML="";let s=T(e);for(let o=0;o<this.p.length;o++){let a=this.p[o],u=T(a.name),d=`+${a.dialCode}`;if(i||u.includes(s)||d.includes(s)||a.iso2.includes(s)){let l=a.nodeById[this.id];l&&this.countryList.appendChild(l),n&&(this._x(l,!1),n=!1)}}this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:e}=this.d,i=this.countryList.childElementCount,n;i===0?n=e.zeroSearchResults:i===1?n=e.oneSearchResult:n=e.multipleSearchResults.replace("${count}",i.toString()),this.searchResultsA11yText.textContent=n}_q(e){let i=e==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;if(i?i.classList.contains("iti__divider")&&(i=e==="ArrowUp"?i.previousElementSibling:i.nextElementSibling):this.countryList.childElementCount>1&&(i=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),i){this._3(i,!1);let n=!this.d.countrySearch;this._x(i,n)}}_r(){this.c&&this._1(this.c)}_s(e){for(let i=0;i<this.p.length;i++){let n=this.p[i];if(n.name.substr(0,e.length).toLowerCase()===e){let o=n.nodeById[this.id];this._x(o,!1),this._3(o,!0);break}}}_u(e){let i=e;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){let n=this.d.nationalMode||i.charAt(0)!=="+"&&!this.d.showSelectedDialCode,{NATIONAL:s,INTERNATIONAL:o}=window.intlTelInputUtils.numberFormat,a=n?s:o;i=window.intlTelInputUtils.formatNumber(i,this.s.iso2,a)}i=this._7(i),this.a.value=i}_v(e){let i=e.indexOf("+"),n=i?e.substring(i):e,s=this.s.dialCode;n&&s==="1"&&n.charAt(0)!=="+"&&(n.charAt(0)!=="1"&&(n=`1${n}`),n=`+${n}`),this.d.showSelectedDialCode&&s&&n.charAt(0)!=="+"&&(n=`+${s}${n}`);let a=this._5(n,!0),u=b(n),d=null;if(a){let l=this.q[b(a)],g=l.indexOf(this.s.iso2)!==-1&&u.length<=a.length-1;if(!(s==="1"&&E(u))&&!g){for(let h=0;h<l.length;h++)if(l[h]){d=l[h];break}}}else n.charAt(0)==="+"&&u.length?d="":(!n||n==="+")&&!this.s.iso2&&(d=this.j);return d!==null?this._z(d):!1}_x(e,i){let n=this.c;n&&(n.classList.remove("iti__highlight"),n.setAttribute("aria-selected","false")),this.c=e,this.c.classList.add("iti__highlight"),this.c.setAttribute("aria-selected","true"),this.selectedCountry.setAttribute("aria-activedescendant",e.getAttribute("id")||""),this.d.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",e.getAttribute("id")||""),i&&this.c.focus()}_y(e,i){for(let n=0;n<this.p.length;n++)if(this.p[n].iso2===e)return this.p[n];if(i)return null;throw new Error(`No country data for '${e}'`)}_z(e){let{allowDropdown:i,showSelectedDialCode:n,showFlags:s,countrySearch:o,i18n:a}=this.d,u=this.s.iso2?this.s:{};if(this.s=e?this._y(e,!1)||{}:{},this.s.iso2&&(this.j=this.s.iso2),this.l){let d="",l="";e?s&&(d=`iti__flag iti__${e}`,l=`${this.s.name} +${this.s.dialCode}`):(d="iti__flag iti__globe",l=a.noCountrySelected),this.l.className=d,this.selectedCountryA11yText.textContent=l}if(this._z3(e,n),n){let d=this.s.dialCode?`+${this.s.dialCode}`:"";this.t.innerHTML=d;let l=this.selectedCountry.offsetWidth||this._z2();this.isRTL?this.a.style.paddingRight=`${l+6}px`:this.a.style.paddingLeft=`${l+6}px`}if(this._0(),this._updateMaxLength(),i&&!o){let d=this.b;if(d&&(d.classList.remove("iti__active"),d.setAttribute("aria-selected","false")),e){let l=this.countryList.querySelector(`#iti-${this.id}__item-${e}-preferred`)||this.countryList.querySelector(`#iti-${this.id}__item-${e}`);l&&(l.setAttribute("aria-selected","true"),l.classList.add("iti__active"),this.b=l)}}return u.iso2!==e}_updateMaxLength(){if(this.d.strictMode&&window.intlTelInputUtils)if(this.s.iso2){let e=window.intlTelInputUtils.numberType[this.d.placeholderNumberType],i=window.intlTelInputUtils.getExampleNumber(this.s.iso2,!1,e,!0),n=i;for(;window.intlTelInputUtils.isPossibleNumber(i,this.s.iso2);)n=i,i+="0";let s=window.intlTelInputUtils.getCoreNumber(n,this.s.iso2);this.maxCoreNumberLength=s.length}else this.maxCoreNumberLength=null}_z3(e=null,i){if(!this.selectedCountry)return;let n;e&&!i?n=`${this.s.name}: +${this.s.dialCode}`:e?n=this.s.name:n="Unknown",this.selectedCountry.setAttribute("title",n)}_z2(){if(this.a.parentNode){let e=this.a.parentNode.cloneNode(!1);e.style.visibility="hidden",document.body.appendChild(e);let i=this.k.cloneNode();e.appendChild(i);let n=this.selectedCountry.cloneNode(!0);i.appendChild(n);let s=n.offsetWidth;return document.body.removeChild(e),s}return 0}_0(){let{autoPlaceholder:e,placeholderNumberType:i,nationalMode:n,customPlaceholder:s}=this.d,o=e==="aggressive"||!this.e&&e==="polite";if(window.intlTelInputUtils&&o){let a=window.intlTelInputUtils.numberType[i],u=this.s.iso2?window.intlTelInputUtils.getExampleNumber(this.s.iso2,n,a):"";u=this._7(u),typeof s=="function"&&(u=s(u,this.s)),this.a.setAttribute("placeholder",u)}}_1(e){let i=this._z(e.getAttribute("data-country-code"));this._2(),this._4(e.getAttribute("data-dial-code")),this.a.focus(),i&&this._8()}_2(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.c&&this.c.setAttribute("aria-selected","false"),this.d.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),this.d.countrySearch&&this.searchInput.removeEventListener("input",this._a7),document.documentElement.removeEventListener("click",this._a2),this.countryList.removeEventListener("mouseover",this._a0),this.countryList.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.d.useFullscreenPopup||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_3(e,i){let n=this.countryList,s=document.documentElement.scrollTop,o=n.offsetHeight,a=n.getBoundingClientRect().top+s,u=a+o,d=e.offsetHeight,l=e.getBoundingClientRect().top+s,g=l+d,p=l-a+n.scrollTop,h=o/2-d/2;if(l<a)i&&(p-=h),n.scrollTop=p;else if(g>u){i&&(p+=h);let y=o-d;n.scrollTop=p-y}}_4(e){let i=this.a.value,n=`+${e}`,s;if(i.charAt(0)==="+"){let o=this._5(i);o?s=i.replace(o,n):s=n,this.a.value=s}}_5(e,i){let n="";if(e.charAt(0)==="+"){let s="";for(let o=0;o<e.length;o++){let a=e.charAt(o);if(!isNaN(parseInt(a,10))){if(s+=a,i)this.q[s]&&(n=e.substr(0,o+1));else if(this.dialCodes[s]){n=e.substr(0,o+1);break}if(s.length===this.dialCodeMaxLen)break}}}return n}_6(){let e=this.a.value.trim(),{dialCode:i}=this.s,n,s=b(e);return this.d.showSelectedDialCode&&!this.d.nationalMode&&e.charAt(0)!=="+"&&i&&s?n=`+${i}`:n="",n+e}_7(e){let i=e;if(this.d.showSelectedDialCode){let n=this._5(i);if(n){n=`+${this.s.dialCode}`;let s=i[n.length]===" "||i[n.length]==="-"?n.length+1:n.length;i=i.substr(s)}}return this._j2(i)}_8(){this._trigger("countrychange")}_9(){let e=this._6(),i=window.intlTelInputUtils?window.intlTelInputUtils.formatNumberAsYouType(e,this.s.iso2):e,{dialCode:n}=this.s;return this.d.showSelectedDialCode&&!this.d.nationalMode&&this.a.value.charAt(0)!=="+"&&i.includes(`+${n}`)?(i.split(`+${n}`)[1]||"").trim():i}handleAutoCountry(){this.d.initialCountry==="auto"&&window.intlTelInputGlobals.autoCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}handleUtils(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this.s.iso2&&(this._0(),this._updateMaxLength())),this.i0()}destroy(){if(this.d.allowDropdown){this._2(),this.selectedCountry.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);let n=this.a.closest("label");n&&n.removeEventListener("click",this._a9)}let{form:e}=this.a;this._a14&&e&&e.removeEventListener("submit",this._a14),this.a.removeEventListener("input",this._a12),this._handleKeydownEvent&&this.a.removeEventListener("keydown",this._handleKeydownEvent),this.a.removeAttribute("data-intl-tel-input-id");let i=this.a.parentNode;i?.parentNode?.insertBefore(this.a,i),i?.parentNode?.removeChild(i),delete window.intlTelInputGlobals.instances[this.id]}getExtension(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}getNumber(e){if(window.intlTelInputUtils){let{iso2:i}=this.s;return window.intlTelInputUtils.formatNumber(this._6(),i,e)}return""}getNumberType(){return window.intlTelInputUtils?window.intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}getSelectedCountryData(){return this.s}getValidationError(){if(window.intlTelInputUtils){let{iso2:e}=this.s;return window.intlTelInputUtils.getValidationError(this._6(),e)}return-99}isValidNumber(e=!0){let i=this._6();return/\p{L}/u.test(i)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isPossibleNumber(i,this.s.iso2,e):null}isValidNumberPrecise(){let e=this._6();return/\p{L}/u.test(e)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isValidNumber(e,this.s.iso2):null}setCountry(e){let i=e.toLowerCase();this.s.iso2!==i&&(this._z(i),this._4(this.s.dialCode),this._8())}setNumber(e){let i=this._v(e);this._u(e),i&&this._8()}setPlaceholderNumberType(e){this.d.placeholderNumberType=e,this._0()}},F=(r,e,i)=>{let n=document.createElement("script");n.onload=()=>{f("handleUtils"),e&&e()},n.onerror=()=>{f("rejectUtilsScriptPromise"),i&&i()},n.className="iti-load-utils",n.async=!0,n.src=r,document.body.appendChild(n)},R=r=>!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript?(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise((e,i)=>F(r,e,i))):null;if(typeof window=="object"){let r={defaults:k,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:e=>{let i=e.getAttribute("data-intl-tel-input-id");return i?r.instances[i]:null},instances:{},loadUtils:R,version:"21.2.1"};window.intlTelInputGlobals=r}var O=(r,e)=>{let i=new v(r,e);return i._init(),r.setAttribute("data-intl-tel-input-id",i.id.toString()),window.intlTelInputGlobals.instances[i.id]=i,i},B=O;return x($);})();
|
|
17
17
|
|
|
18
18
|
// UMD
|
|
19
19
|
return factoryOutput.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intl-tel-input",
|
|
3
|
-
"version": "21.2.
|
|
3
|
+
"version": "21.2.1",
|
|
4
4
|
"description": "A JavaScript plugin for entering and validating international telephone numbers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"international",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"require": "./react/build/IntlTelInput.cjs",
|
|
107
107
|
"default": "./react/build/IntlTelInput.js"
|
|
108
108
|
},
|
|
109
|
-
"./i18n/*": "./build/i18n
|
|
109
|
+
"./i18n/*": "./build/js/i18n/*/index.mjs",
|
|
110
110
|
"./*": "./*"
|
|
111
111
|
},
|
|
112
112
|
"typesVersions": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var N=Object.create;var v=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var z=(r,i)=>{for(var e in i)v(r,e,{get:i[e],enumerable:!0})},_=(r,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of x(i))!H.call(r,s)&&s!==e&&v(r,s,{get:()=>i[s],enumerable:!(n=M(i,s))||n.enumerable});return r};var U=(r,i,e)=>(e=r!=null?N(P(r)):{},_(i||!r||!r.__esModule?v(e,"default",{value:r,enumerable:!0}):e,r)),j=r=>_(v({},"__esModule",{value:!0}),r);var Y={};z(Y,{default:()=>W});module.exports=j(Y);var y=U(require("react"));var t={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var L=[[t.af,"af","93"],[t.al,"al","355"],[t.dz,"dz","213"],[t.as,"as","1",5,["684"]],[t.ad,"ad","376"],[t.ao,"ao","244"],[t.ai,"ai","1",6,["264"]],[t.ag,"ag","1",7,["268"]],[t.ar,"ar","54"],[t.am,"am","374"],[t.aw,"aw","297"],["Ascension Island","ac","247"],[t.au,"au","61",0],[t.at,"at","43"],[t.az,"az","994"],[t.bs,"bs","1",8,["242"]],[t.bh,"bh","973"],[t.bd,"bd","880"],[t.bb,"bb","1",9,["246"]],[t.by,"by","375"],[t.be,"be","32"],[t.bz,"bz","501"],[t.bj,"bj","229"],[t.bm,"bm","1",10,["441"]],[t.bt,"bt","975"],[t.bo,"bo","591"],[t.ba,"ba","387"],[t.bw,"bw","267"],[t.br,"br","55"],[t.io,"io","246"],[t.vg,"vg","1",11,["284"]],[t.bn,"bn","673"],[t.bg,"bg","359"],[t.bf,"bf","226"],[t.bi,"bi","257"],[t.kh,"kh","855"],[t.cm,"cm","237"],[t.ca,"ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],[t.cv,"cv","238"],[t.bq,"bq","599",1,["3","4","7"]],[t.ky,"ky","1",12,["345"]],[t.cf,"cf","236"],[t.td,"td","235"],[t.cl,"cl","56"],[t.cn,"cn","86"],[t.cx,"cx","61",2,["89164"]],[t.cc,"cc","61",1,["89162"]],[t.co,"co","57"],[t.km,"km","269"],[t.cg,"cg","242"],[t.cd,"cd","243"],[t.ck,"ck","682"],[t.cr,"cr","506"],[t.ci,"ci","225"],[t.hr,"hr","385"],[t.cu,"cu","53"],[t.cw,"cw","599",0],[t.cy,"cy","357"],[t.cz,"cz","420"],[t.dk,"dk","45"],[t.dj,"dj","253"],[t.dm,"dm","1",13,["767"]],[t.do,"do","1",2,["809","829","849"]],[t.ec,"ec","593"],[t.eg,"eg","20"],[t.sv,"sv","503"],[t.gq,"gq","240"],[t.er,"er","291"],[t.ee,"ee","372"],[t.sz,"sz","268"],[t.et,"et","251"],[t.fk,"fk","500"],[t.fo,"fo","298"],[t.fj,"fj","679"],[t.fi,"fi","358",0],[t.fr,"fr","33"],[t.gf,"gf","594"],[t.pf,"pf","689"],[t.ga,"ga","241"],[t.gm,"gm","220"],[t.ge,"ge","995"],[t.de,"de","49"],[t.gh,"gh","233"],[t.gi,"gi","350"],[t.gr,"gr","30"],[t.gl,"gl","299"],[t.gd,"gd","1",14,["473"]],[t.gp,"gp","590",0],[t.gu,"gu","1",15,["671"]],[t.gt,"gt","502"],[t.gg,"gg","44",1,["1481","7781","7839","7911"]],[t.gn,"gn","224"],[t.gw,"gw","245"],[t.gy,"gy","592"],[t.ht,"ht","509"],[t.hn,"hn","504"],[t.hk,"hk","852"],[t.hu,"hu","36"],[t.is,"is","354"],[t.in,"in","91"],[t.id,"id","62"],[t.ir,"ir","98"],[t.iq,"iq","964"],[t.ie,"ie","353"],[t.im,"im","44",2,["1624","74576","7524","7924","7624"]],[t.il,"il","972"],[t.it,"it","39",0],[t.jm,"jm","1",4,["876","658"]],[t.jp,"jp","81"],[t.je,"je","44",3,["1534","7509","7700","7797","7829","7937"]],[t.jo,"jo","962"],[t.kz,"kz","7",1,["33","7"]],[t.ke,"ke","254"],[t.ki,"ki","686"],["Kosovo","xk","383"],[t.kw,"kw","965"],[t.kg,"kg","996"],[t.la,"la","856"],[t.lv,"lv","371"],[t.lb,"lb","961"],[t.ls,"ls","266"],[t.lr,"lr","231"],[t.ly,"ly","218"],[t.li,"li","423"],[t.lt,"lt","370"],[t.lu,"lu","352"],[t.mo,"mo","853"],[t.mg,"mg","261"],[t.mw,"mw","265"],[t.my,"my","60"],[t.mv,"mv","960"],[t.ml,"ml","223"],[t.mt,"mt","356"],[t.mh,"mh","692"],[t.mq,"mq","596"],[t.mr,"mr","222"],[t.mu,"mu","230"],[t.yt,"yt","262",1,["269","639"]],[t.mx,"mx","52"],[t.fm,"fm","691"],[t.md,"md","373"],[t.mc,"mc","377"],[t.mn,"mn","976"],[t.me,"me","382"],[t.ms,"ms","1",16,["664"]],[t.ma,"ma","212",0],[t.mz,"mz","258"],[t.mm,"mm","95"],[t.na,"na","264"],[t.nr,"nr","674"],[t.np,"np","977"],[t.nl,"nl","31"],[t.nc,"nc","687"],[t.nz,"nz","64"],[t.ni,"ni","505"],[t.ne,"ne","227"],[t.ng,"ng","234"],[t.nu,"nu","683"],[t.nf,"nf","672"],[t.kp,"kp","850"],[t.mk,"mk","389"],[t.mp,"mp","1",17,["670"]],[t.no,"no","47",0],[t.om,"om","968"],[t.pk,"pk","92"],[t.pw,"pw","680"],[t.ps,"ps","970"],[t.pa,"pa","507"],[t.pg,"pg","675"],[t.py,"py","595"],[t.pe,"pe","51"],[t.ph,"ph","63"],[t.pl,"pl","48"],[t.pt,"pt","351"],[t.pr,"pr","1",3,["787","939"]],[t.qa,"qa","974"],[t.re,"re","262",0],[t.ro,"ro","40"],[t.ru,"ru","7",0],[t.rw,"rw","250"],[t.ws,"ws","685"],[t.sm,"sm","378"],[t.st,"st","239"],[t.sa,"sa","966"],[t.sn,"sn","221"],[t.rs,"rs","381"],[t.sc,"sc","248"],[t.sl,"sl","232"],[t.sg,"sg","65"],[t.sx,"sx","1",21,["721"]],[t.sk,"sk","421"],[t.si,"si","386"],[t.sb,"sb","677"],[t.so,"so","252"],[t.za,"za","27"],[t.kr,"kr","82"],[t.ss,"ss","211"],[t.es,"es","34"],[t.lk,"lk","94"],[t.bl,"bl","590",1],[t.sh,"sh","290"],[t.kn,"kn","1",18,["869"]],[t.lc,"lc","1",19,["758"]],[t.mf,"mf","590",2],[t.pm,"pm","508"],[t.vc,"vc","1",20,["784"]],[t.sd,"sd","249"],[t.sr,"sr","597"],[t.sj,"sj","47",1,["79"]],[t.se,"se","46"],[t.ch,"ch","41"],[t.sy,"sy","963"],[t.tw,"tw","886"],[t.tj,"tj","992"],[t.tz,"tz","255"],[t.th,"th","66"],[t.tl,"tl","670"],[t.tg,"tg","228"],[t.tk,"tk","690"],[t.to,"to","676"],[t.tt,"tt","1",22,["868"]],[t.tn,"tn","216"],[t.tr,"tr","90"],[t.tm,"tm","993"],[t.tc,"tc","1",23,["649"]],[t.tv,"tv","688"],[t.ug,"ug","256"],[t.ua,"ua","380"],[t.ae,"ae","971"],[t.gb,"gb","44",0],[t.us,"us","1",0],[t.uy,"uy","598"],[t.vi,"vi","1",24,["340"]],[t.uz,"uz","998"],[t.vu,"vu","678"],[t.va,"va","39",1,["06698"]],[t.ve,"ve","58"],[t.vn,"vn","84"],[t.wf,"wf","681"],[t.eh,"eh","212",1,["5288","5289"]],[t.ye,"ye","967"],[t.zm,"zm","260"],[t.zw,"zw","263"],[t.ax,"ax","358",1,["18"]]],T=[];for(let r=0;r<L.length;r++){let i=L[r];T[r]={name:i[0],iso2:i[1],dialCode:i[2],priority:i[3]||0,areaCodes:i[4]||null,nodeById:{}}}var f=T;var E={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found"};var R=0,D={allowDropdown:!0,autoPlaceholder:"polite",countrySearch:!0,containerClass:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:[],showFlags:!0,showSelectedDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},F=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],w=r=>r.replace(/\D/g,""),S=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),O=(r,i,e)=>{e&&!r.classList.contains(i)?r.classList.add(i):!e&&r.classList.contains(i)&&r.classList.remove(i)},k=r=>{let i=w(r);if(i.charAt(0)==="1"){let e=i.substr(1,3);return F.indexOf(e)!==-1}return!1},B=(r,i)=>r.name<i.name?-1:r.name>i.name?1:0,$=(r,i,e,n)=>{if(e===0&&!n)return 0;let s=0;for(let o=0;o<i.length;o++){if(/[+0-9]/.test(i[o])&&s++,s===r&&!n)return o+1;if(n&&s===r+1)return o}return i.length},g=(r,i,e)=>{let n=document.createElement(r);return i&&Object.entries(i).forEach(([s,o])=>n.setAttribute(s,o)),e&&e.appendChild(n),n},b=r=>{let{instances:i}=window.intlTelInputGlobals;Object.values(i).forEach(e=>e[r]())},I=class{id;promise;telInput;activeItem;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;preferredCountries;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(i,e={}){this.id=R++,this.telInput=i,this.activeItem=null,this.highlightedItem=null,this.options=Object.assign({},D,e),this.hadInitialPlaceholder=!!i.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.countrySearch&&!this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!0);let i=this.options.allowDropdown&&!this.options.showSelectedDialCode;!this.options.showFlags&&i&&(this.options.showFlags=!0),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...E,...this.options.i18n};let e=new Promise((s,o)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=o}),n=new Promise((s,o)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=o});this.promise=Promise.all([e,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._processPreferredCountries(),this._translateCountryNames(),(this.options.onlyCountries.length||this.options.i18n)&&this.countries.sort(B)}_addToDialCodeMap(i,e,n){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let o=0;o<this.dialCodeToIso2Map[e].length;o++)if(this.dialCodeToIso2Map[e][o]===i)return;let s=n!==void 0?n:this.dialCodeToIso2Map[e].length;this.dialCodeToIso2Map[e][s]=i}_processAllCountries(){let{onlyCountries:i,excludeCountries:e}=this.options;if(i.length){let n=i.map(s=>s.toLowerCase());this.countries=f.filter(s=>n.indexOf(s.iso2)>-1)}else if(e.length){let n=e.map(s=>s.toLowerCase());this.countries=f.filter(s=>n.indexOf(s.iso2)===-1)}else this.countries=f}_translateCountryNames(){for(let i=0;i<this.countries.length;i++){let e=this.countries[i].iso2.toLowerCase();this.options.i18n.hasOwnProperty(e)&&(this.countries[i].name=this.options.i18n[e])}}_processDialCodes(){this.dialCodes={},this.dialCodeMaxLen=0,this.dialCodeToIso2Map={};for(let i=0;i<this.countries.length;i++){let e=this.countries[i];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._addToDialCodeMap(e.iso2,e.dialCode,e.priority)}for(let i=0;i<this.countries.length;i++){let e=this.countries[i];if(e.areaCodes){let n=this.dialCodeToIso2Map[e.dialCode][0];for(let s=0;s<e.areaCodes.length;s++){let o=e.areaCodes[s];for(let l=1;l<o.length;l++){let u=e.dialCode+o.substr(0,l);this._addToDialCodeMap(n,u),this._addToDialCodeMap(e.iso2,u)}this._addToDialCodeMap(e.iso2,e.dialCode+o)}}}}_processPreferredCountries(){this.preferredCountries=[];for(let i=0;i<this.options.preferredCountries.length;i++){let e=this.options.preferredCountries[i].toLowerCase(),n=this._getCountryData(e,!0);n&&this.preferredCountries.push(n)}}_generateMarkup(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!(this.telInput.form&&this.telInput.form.hasAttribute("autocomplete"))&&this.telInput.setAttribute("autocomplete","off");let{allowDropdown:i,showSelectedDialCode:e,showFlags:n,containerClass:s,hiddenInput:o,dropdownContainer:l,fixDropdownWidth:u,useFullscreenPopup:d,countrySearch:a,i18n:p}=this.options,h="iti";i&&(h+=" iti--allow-dropdown"),e&&(h+=" iti--show-selected-dial-code"),n&&(h+=" iti--show-flags"),s&&(h+=` ${s}`),d||(h+=" iti--inline-dropdown");let c=g("div",{class:h});if(this.telInput.parentNode?.insertBefore(c,this.telInput),(n||e)&&(this.countryContainer=g("div",{class:"iti__country-container"},c),this.selectedCountry=g("button",{type:"button",class:"iti__selected-country",...i&&{"aria-expanded":"false","aria-label":this.options.i18n.selectedCountryAriaLabel,"aria-haspopup":a?"true":"listbox","aria-controls":a?`iti-${this.id}__dropdown-content`:`iti-${this.id}__country-listbox`,...a?{role:"combobox"}:{}}},this.countryContainer),this.selectedCountryInner=g("div",null,this.selectedCountry),this.selectedCountryA11yText=g("span",{class:"iti__a11y-text"},this.selectedCountryInner)),c.appendChild(this.telInput),this.selectedCountry&&this.telInput.disabled&&this.selectedCountry.setAttribute("aria-disabled","true"),e&&(this.selectedDialCode=g("div",{class:"iti__selected-dial-code"},this.selectedCountry)),i){this.telInput.disabled||this.selectedCountry.setAttribute("tabindex","0"),this.dropdownArrow=g("div",{class:"iti__arrow","aria-hidden":"true"},this.selectedCountry);let C=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=g("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${C}`}),a&&(this.searchInput=g("input",{type:"text",class:"iti__search-input",placeholder:p.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":p.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=g("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=g("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":p.countryListAriaLabel},this.dropdownContent),this.preferredCountries.length&&!a&&(this._appendListItems(this.preferredCountries,"iti__preferred",!0),g("li",{class:"iti__divider","aria-hidden":"true"},this.countryList)),this._appendListItems(this.countries,"iti__standard"),a&&this._updateSearchResultsText(),l){let m="iti iti--container";d?m+=" iti--fullscreen-popup":m+=" iti--inline-dropdown",a&&(m+=" iti--country-search"),this.dropdown=g("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}if(o){let C=this.telInput.getAttribute("name")||"",m=o(C);m.phone&&(this.hiddenInput=g("input",{type:"hidden",name:m.phone}),c.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=g("input",{type:"hidden",name:m.country}),c.appendChild(this.hiddenInputCountry))}}_appendListItems(i,e,n){for(let s=0;s<i.length;s++){let o=i[s],l=n?"-preferred":"",u=g("li",{id:`iti-${this.id}__item-${o.iso2}${l}`,class:`iti__country ${e}`,tabindex:"-1",role:"option","data-dial-code":o.dialCode,"data-country-code":o.iso2,"aria-selected":"false"},this.countryList);o.nodeById[this.id]=u;let d="";this.options.showFlags&&(d+=`<div class='iti__flag-box'><div class='iti__flag iti__${o.iso2}'></div></div>`),d+=`<span class='iti__country-name'>${o.name}</span>`,d+=`<span class='iti__dial-code'>+${o.dialCode}</span>`,u.insertAdjacentHTML("beforeend",d)}}_setInitialState(i=!1){let e=this.telInput.getAttribute("value"),n=this.telInput.value,o=e&&e.charAt(0)==="+"&&(!n||n.charAt(0)!=="+")?e:n,l=this._getDialCode(o),u=k(o),{initialCountry:d}=this.options;if(l&&!u)this._updateCountryFromNumber(o);else if(d!=="auto"||i){let a=d?d.toLowerCase():"";a&&this._getCountryData(a,!0)?this._setCountry(a):l&&u?this._setCountry("us"):this._setCountry()}o&&this._updateValFromNumber(o)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=e=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():e.preventDefault()};let i=this.telInput.closest("label");i&&i.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._openDropdown()),e.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{window.intlTelInputGlobals.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((i="")=>{let e=i.toLowerCase();e&&this._getCountryData(e,!0)?(window.intlTelInputGlobals.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._setInitialState(!0),b("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),b("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:i,formatAsYouType:e}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let o=s&&s.data&&/[^+0-9]/.test(s.data),l=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(o||l&&!i?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),e&&!n){let u=this.telInput.selectionStart||0,a=this.telInput.value.substring(0,u).replace(/[^+0-9]/g,"").length,p=s&&s.inputType==="deleteContentForward",h=this._formatNumberAsYouType(),c=$(a,h,u,p);this.telInput.value=h,this.telInput.setSelectionRange(c,c)}},this.telInput.addEventListener("input",this._handleInputEvent),i&&(this._handleKeydownEvent=s=>{if(s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){let o=this.telInput.selectionStart===0&&s.key==="+",l=/^[0-9]$/.test(s.key),u=o||l,d=this._getFullNumber(),a=window.intlTelInputUtils.getCoreNumber(d,this.selectedCountryData.iso2),p=this.maxCoreNumberLength&&a.length>=this.maxCoreNumberLength;(!u||p)&&s.preventDefault()}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(i){let e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&i.length>e?i.substr(0,e):i}_trigger(i){let e=new Event(i,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}_openDropdown(){let{fixDropdownWidth:i,countrySearch:e}=this.options;if(i&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),this.activeItem&&!e)this._highlightListItem(this.activeItem,!1),this._scrollTo(this.activeItem,!0);else{let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),e&&this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let i=this.telInput.getBoundingClientRect(),e=document.documentElement.scrollTop,n=i.top+e,s=this.dropdownContent.offsetHeight,o=n+this.telInput.offsetHeight+s<e+window.innerHeight,l=n-s>e,u=!this.options.countrySearch&&!o&&l;if(O(this.dropdownContent,"iti__dropdown-content--dropup",u),this.options.dropdownContainer){let d=u?0:this.telInput.offsetHeight;this.dropdown.style.top=`${n+d}px`,this.dropdown.style.left=`${i.left+document.body.scrollLeft}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll)}}}_bindDropdownListeners(){this._handleMouseoverCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._highlightListItem(o,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._selectListItem(o)},this.countryList.addEventListener("click",this._handleClickCountryList);let i=!0;this._handleClickOffToClose=()=>{i||this._closeDropdown(),i=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let e="",n=null;if(this._handleKeydownOnDropdown=s=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key==="ArrowUp"||s.key==="ArrowDown"?this._handleUpDownKey(s.key):s.key==="Enter"?this._handleEnterKey():s.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key)&&(s.stopPropagation(),n&&clearTimeout(n),e+=s.key.toLowerCase(),this._searchForCountry(e),n=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let s=()=>{let l=this.searchInput.value.trim();l?this._filterCountries(l):this._filterCountries("",!0)},o=null;this._handleSearchChange=()=>{o&&clearTimeout(o),o=setTimeout(()=>{s(),o=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",l=>l.stopPropagation())}}_filterCountries(i,e=!1){let n=!0;this.countryList.innerHTML="";let s=S(i);for(let o=0;o<this.countries.length;o++){let l=this.countries[o],u=S(l.name),d=`+${l.dialCode}`;if(e||u.includes(s)||d.includes(s)||l.iso2.includes(s)){let a=l.nodeById[this.id];a&&this.countryList.appendChild(a),n&&(this._highlightListItem(a,!1),n=!1)}}this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:i}=this.options,e=this.countryList.childElementCount,n;e===0?n=i.zeroSearchResults:e===1?n=i.oneSearchResult:n=i.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=n}_handleUpDownKey(i){let e=i==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;if(e?e.classList.contains("iti__divider")&&(e=i==="ArrowUp"?e.previousElementSibling:e.nextElementSibling):this.countryList.childElementCount>1&&(e=i==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e){this._scrollTo(e,!1);let n=!this.options.countrySearch;this._highlightListItem(e,n)}}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_searchForCountry(i){for(let e=0;e<this.countries.length;e++){let n=this.countries[e];if(n.name.substr(0,i.length).toLowerCase()===i){let o=n.nodeById[this.id];this._highlightListItem(o,!1),this._scrollTo(o,!0);break}}}_updateValFromNumber(i){let e=i;if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){let n=this.options.nationalMode||e.charAt(0)!=="+"&&!this.options.showSelectedDialCode,{NATIONAL:s,INTERNATIONAL:o}=window.intlTelInputUtils.numberFormat,l=n?s:o;e=window.intlTelInputUtils.formatNumber(e,this.selectedCountryData.iso2,l)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(i){let e=i.indexOf("+"),n=e?i.substring(e):i,s=this.selectedCountryData.dialCode;n&&s==="1"&&n.charAt(0)!=="+"&&(n.charAt(0)!=="1"&&(n=`1${n}`),n=`+${n}`),this.options.showSelectedDialCode&&s&&n.charAt(0)!=="+"&&(n=`+${s}${n}`);let l=this._getDialCode(n,!0),u=w(n),d=null;if(l){let a=this.dialCodeToIso2Map[w(l)],p=a.indexOf(this.selectedCountryData.iso2)!==-1&&u.length<=l.length-1;if(!(s==="1"&&k(u))&&!p){for(let c=0;c<a.length;c++)if(a[c]){d=a[c];break}}}else n.charAt(0)==="+"&&u.length?d="":(!n||n==="+")&&!this.selectedCountryData.iso2&&(d=this.defaultCountry);return d!==null?this._setCountry(d):!1}_highlightListItem(i,e){let n=this.highlightedItem;n&&(n.classList.remove("iti__highlight"),n.setAttribute("aria-selected","false")),this.highlightedItem=i,this.highlightedItem.classList.add("iti__highlight"),this.highlightedItem.setAttribute("aria-selected","true"),this.selectedCountry.setAttribute("aria-activedescendant",i.getAttribute("id")||""),this.options.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",i.getAttribute("id")||""),e&&this.highlightedItem.focus()}_getCountryData(i,e){for(let n=0;n<this.countries.length;n++)if(this.countries[n].iso2===i)return this.countries[n];if(e)return null;throw new Error(`No country data for '${i}'`)}_setCountry(i){let{allowDropdown:e,showSelectedDialCode:n,showFlags:s,countrySearch:o,i18n:l}=this.options,u=this.selectedCountryData.iso2?this.selectedCountryData:{};if(this.selectedCountryData=i?this._getCountryData(i,!1)||{}:{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedCountryInner){let d="",a="";i?s&&(d=`iti__flag iti__${i}`,a=`${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`):(d="iti__flag iti__globe",a=l.noCountrySelected),this.selectedCountryInner.className=d,this.selectedCountryA11yText.textContent=a}if(this._setSelectedCountryTitleAttribute(i,n),n){let d=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.selectedDialCode.innerHTML=d;let a=this.selectedCountry.offsetWidth||this._getHiddenSelectedCountryWidth();this.isRTL?this.telInput.style.paddingRight=`${a+6}px`:this.telInput.style.paddingLeft=`${a+6}px`}if(this._updatePlaceholder(),this._updateMaxLength(),e&&!o){let d=this.activeItem;if(d&&(d.classList.remove("iti__active"),d.setAttribute("aria-selected","false")),i){let a=this.countryList.querySelector(`#iti-${this.id}__item-${i}-preferred`)||this.countryList.querySelector(`#iti-${this.id}__item-${i}`);a&&(a.setAttribute("aria-selected","true"),a.classList.add("iti__active"),this.activeItem=a)}}return u.iso2!==i}_updateMaxLength(){if(this.options.strictMode&&window.intlTelInputUtils)if(this.selectedCountryData.iso2){let i=window.intlTelInputUtils.numberType[this.options.placeholderNumberType],e=window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,!1,i,!0),n=e;for(;window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2);)n=e,e+="0";let s=window.intlTelInputUtils.getCoreNumber(n,this.selectedCountryData.iso2);this.maxCoreNumberLength=s.length}else this.maxCoreNumberLength=null}_setSelectedCountryTitleAttribute(i=null,e){if(!this.selectedCountry)return;let n;i&&!e?n=`${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`:i?n=this.selectedCountryData.name:n="Unknown",this.selectedCountry.setAttribute("title",n)}_getHiddenSelectedCountryWidth(){if(this.telInput.parentNode){let i=this.telInput.parentNode.cloneNode(!1);i.style.visibility="hidden",document.body.appendChild(i);let e=this.countryContainer.cloneNode();i.appendChild(e);let n=this.selectedCountry.cloneNode(!0);e.appendChild(n);let s=n.offsetWidth;return document.body.removeChild(i),s}return 0}_updatePlaceholder(){let{autoPlaceholder:i,placeholderNumberType:e,nationalMode:n,customPlaceholder:s}=this.options,o=i==="aggressive"||!this.hadInitialPlaceholder&&i==="polite";if(window.intlTelInputUtils&&o){let l=window.intlTelInputUtils.numberType[e],u=this.selectedCountryData.iso2?window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,n,l):"";u=this._beforeSetNumber(u),typeof s=="function"&&(u=s(u,this.selectedCountryData)),this.telInput.setAttribute("placeholder",u)}}_selectListItem(i){let e=this._setCountry(i.getAttribute("data-country-code"));this._closeDropdown(),this._updateDialCode(i.getAttribute("data-dial-code")),this.telInput.focus(),e&&this._triggerCountryChange()}_closeDropdown(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.highlightedItem&&this.highlightedItem.setAttribute("aria-selected","false"),this.options.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.dropdownArrow.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch&&this.searchInput.removeEventListener("input",this._handleSearchChange),document.documentElement.removeEventListener("click",this._handleClickOffToClose),this.countryList.removeEventListener("mouseover",this._handleMouseoverCountryList),this.countryList.removeEventListener("click",this._handleClickCountryList),this.options.dropdownContainer&&(this.options.useFullscreenPopup||window.removeEventListener("scroll",this._handleWindowScroll),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_scrollTo(i,e){let n=this.countryList,s=document.documentElement.scrollTop,o=n.offsetHeight,l=n.getBoundingClientRect().top+s,u=l+o,d=i.offsetHeight,a=i.getBoundingClientRect().top+s,p=a+d,h=a-l+n.scrollTop,c=o/2-d/2;if(a<l)e&&(h-=c),n.scrollTop=h;else if(p>u){e&&(h+=c);let C=o-d;n.scrollTop=h-C}}_updateDialCode(i){let e=this.telInput.value,n=`+${i}`,s;if(e.charAt(0)==="+"){let o=this._getDialCode(e);o?s=e.replace(o,n):s=n,this.telInput.value=s}}_getDialCode(i,e){let n="";if(i.charAt(0)==="+"){let s="";for(let o=0;o<i.length;o++){let l=i.charAt(o);if(!isNaN(parseInt(l,10))){if(s+=l,e)this.dialCodeToIso2Map[s]&&(n=i.substr(0,o+1));else if(this.dialCodes[s]){n=i.substr(0,o+1);break}if(s.length===this.dialCodeMaxLen)break}}}return n}_getFullNumber(){let i=this.telInput.value.trim(),{dialCode:e}=this.selectedCountryData,n,s=w(i);return this.options.showSelectedDialCode&&!this.options.nationalMode&&i.charAt(0)!=="+"&&e&&s?n=`+${e}`:n="",n+i}_beforeSetNumber(i){let e=i;if(this.options.showSelectedDialCode){let n=this._getDialCode(e);if(n){n=`+${this.selectedCountryData.dialCode}`;let s=e[n.length]===" "||e[n.length]==="-"?n.length+1:n.length;e=e.substr(s)}}return this._cap(e)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let i=this._getFullNumber(),e=window.intlTelInputUtils?window.intlTelInputUtils.formatNumberAsYouType(i,this.selectedCountryData.iso2):i,{dialCode:n}=this.selectedCountryData;return this.options.showSelectedDialCode&&!this.options.nationalMode&&this.telInput.value.charAt(0)!=="+"&&e.includes(`+${n}`)?(e.split(`+${n}`)[1]||"").trim():e}handleAutoCountry(){this.options.initialCountry==="auto"&&window.intlTelInputGlobals.autoCountry&&(this.defaultCountry=window.intlTelInputGlobals.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){window.intlTelInputUtils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let n=this.telInput.closest("label");n&&n.removeEventListener("click",this._handleLabelClick)}let{form:i}=this.telInput;this._handleHiddenInputSubmit&&i&&i.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let e=this.telInput.parentNode;e?.parentNode?.insertBefore(this.telInput,e),e?.parentNode?.removeChild(e),delete window.intlTelInputGlobals.instances[this.id]}getExtension(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber(i){if(window.intlTelInputUtils){let{iso2:e}=this.selectedCountryData;return window.intlTelInputUtils.formatNumber(this._getFullNumber(),e,i)}return""}getNumberType(){return window.intlTelInputUtils?window.intlTelInputUtils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(window.intlTelInputUtils){let{iso2:i}=this.selectedCountryData;return window.intlTelInputUtils.getValidationError(this._getFullNumber(),i)}return-99}isValidNumber(i=!0){let e=this._getFullNumber();return/\p{L}/u.test(e)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2,i):null}isValidNumberPrecise(){let i=this._getFullNumber();return/\p{L}/u.test(i)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isValidNumber(i,this.selectedCountryData.iso2):null}setCountry(i){let e=i.toLowerCase();this.selectedCountryData.iso2!==e&&(this._setCountry(e),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(i){let e=this._updateCountryFromNumber(i);this._updateValFromNumber(i),e&&this._triggerCountryChange()}setPlaceholderNumberType(i){this.options.placeholderNumberType=i,this._updatePlaceholder()}},G=(r,i,e)=>{let n=document.createElement("script");n.onload=()=>{b("handleUtils"),i&&i()},n.onerror=()=>{b("rejectUtilsScriptPromise"),e&&e()},n.className="iti-load-utils",n.async=!0,n.src=r,document.body.appendChild(n)},K=r=>!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript?(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise((i,e)=>G(r,i,e))):null;if(typeof window=="object"){let r={defaults:D,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:i=>{let e=i.getAttribute("data-intl-tel-input-id");return e?r.instances[e]:null},instances:{},loadUtils:K,version:"21.2.0"};window.intlTelInputGlobals=r}var V=(r,i)=>{let e=new I(r,i);return e._init(),r.setAttribute("data-intl-tel-input-id",e.id.toString()),window.intlTelInputGlobals.instances[e.id]=e,e},A=V;var q=({initialValue:r="",onChangeNumber:i=()=>{},onChangeCountry:e=()=>{},onChangeValidity:n=()=>{},onChangeErrorCode:s=()=>{},usePreciseValidation:o=!1,initOptions:l={},inputProps:u={}})=>{let d=(0,y.useRef)(null),a=(0,y.useRef)(null),p=()=>{let h=a.current?.getNumber()||"",c=a.current?.getSelectedCountryData().iso2||"";if(i(h),e(c),a.current)if(o?a.current.isValidNumberPrecise():a.current.isValidNumber())n(!0),s(null);else{let m=a.current.getValidationError();n(!1),s(m)}};return(0,y.useEffect)(()=>{let h=d.current;return h&&(a.current=A(h,l),h.addEventListener("countrychange",p)),()=>{h&&h.removeEventListener("countrychange",p),a.current?.destroy()}},[]),y.default.createElement("input",{type:"tel",ref:d,onInput:p,defaultValue:r,...u})},W=q;
|
|
1
|
+
var N=Object.create;var v=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var z=(r,i)=>{for(var e in i)v(r,e,{get:i[e],enumerable:!0})},_=(r,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of x(i))!H.call(r,s)&&s!==e&&v(r,s,{get:()=>i[s],enumerable:!(n=M(i,s))||n.enumerable});return r};var U=(r,i,e)=>(e=r!=null?N(P(r)):{},_(i||!r||!r.__esModule?v(e,"default",{value:r,enumerable:!0}):e,r)),j=r=>_(v({},"__esModule",{value:!0}),r);var Y={};z(Y,{default:()=>W});module.exports=j(Y);var y=U(require("react"));var t={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var L=[[t.af,"af","93"],[t.al,"al","355"],[t.dz,"dz","213"],[t.as,"as","1",5,["684"]],[t.ad,"ad","376"],[t.ao,"ao","244"],[t.ai,"ai","1",6,["264"]],[t.ag,"ag","1",7,["268"]],[t.ar,"ar","54"],[t.am,"am","374"],[t.aw,"aw","297"],["Ascension Island","ac","247"],[t.au,"au","61",0],[t.at,"at","43"],[t.az,"az","994"],[t.bs,"bs","1",8,["242"]],[t.bh,"bh","973"],[t.bd,"bd","880"],[t.bb,"bb","1",9,["246"]],[t.by,"by","375"],[t.be,"be","32"],[t.bz,"bz","501"],[t.bj,"bj","229"],[t.bm,"bm","1",10,["441"]],[t.bt,"bt","975"],[t.bo,"bo","591"],[t.ba,"ba","387"],[t.bw,"bw","267"],[t.br,"br","55"],[t.io,"io","246"],[t.vg,"vg","1",11,["284"]],[t.bn,"bn","673"],[t.bg,"bg","359"],[t.bf,"bf","226"],[t.bi,"bi","257"],[t.kh,"kh","855"],[t.cm,"cm","237"],[t.ca,"ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],[t.cv,"cv","238"],[t.bq,"bq","599",1,["3","4","7"]],[t.ky,"ky","1",12,["345"]],[t.cf,"cf","236"],[t.td,"td","235"],[t.cl,"cl","56"],[t.cn,"cn","86"],[t.cx,"cx","61",2,["89164"]],[t.cc,"cc","61",1,["89162"]],[t.co,"co","57"],[t.km,"km","269"],[t.cg,"cg","242"],[t.cd,"cd","243"],[t.ck,"ck","682"],[t.cr,"cr","506"],[t.ci,"ci","225"],[t.hr,"hr","385"],[t.cu,"cu","53"],[t.cw,"cw","599",0],[t.cy,"cy","357"],[t.cz,"cz","420"],[t.dk,"dk","45"],[t.dj,"dj","253"],[t.dm,"dm","1",13,["767"]],[t.do,"do","1",2,["809","829","849"]],[t.ec,"ec","593"],[t.eg,"eg","20"],[t.sv,"sv","503"],[t.gq,"gq","240"],[t.er,"er","291"],[t.ee,"ee","372"],[t.sz,"sz","268"],[t.et,"et","251"],[t.fk,"fk","500"],[t.fo,"fo","298"],[t.fj,"fj","679"],[t.fi,"fi","358",0],[t.fr,"fr","33"],[t.gf,"gf","594"],[t.pf,"pf","689"],[t.ga,"ga","241"],[t.gm,"gm","220"],[t.ge,"ge","995"],[t.de,"de","49"],[t.gh,"gh","233"],[t.gi,"gi","350"],[t.gr,"gr","30"],[t.gl,"gl","299"],[t.gd,"gd","1",14,["473"]],[t.gp,"gp","590",0],[t.gu,"gu","1",15,["671"]],[t.gt,"gt","502"],[t.gg,"gg","44",1,["1481","7781","7839","7911"]],[t.gn,"gn","224"],[t.gw,"gw","245"],[t.gy,"gy","592"],[t.ht,"ht","509"],[t.hn,"hn","504"],[t.hk,"hk","852"],[t.hu,"hu","36"],[t.is,"is","354"],[t.in,"in","91"],[t.id,"id","62"],[t.ir,"ir","98"],[t.iq,"iq","964"],[t.ie,"ie","353"],[t.im,"im","44",2,["1624","74576","7524","7924","7624"]],[t.il,"il","972"],[t.it,"it","39",0],[t.jm,"jm","1",4,["876","658"]],[t.jp,"jp","81"],[t.je,"je","44",3,["1534","7509","7700","7797","7829","7937"]],[t.jo,"jo","962"],[t.kz,"kz","7",1,["33","7"]],[t.ke,"ke","254"],[t.ki,"ki","686"],["Kosovo","xk","383"],[t.kw,"kw","965"],[t.kg,"kg","996"],[t.la,"la","856"],[t.lv,"lv","371"],[t.lb,"lb","961"],[t.ls,"ls","266"],[t.lr,"lr","231"],[t.ly,"ly","218"],[t.li,"li","423"],[t.lt,"lt","370"],[t.lu,"lu","352"],[t.mo,"mo","853"],[t.mg,"mg","261"],[t.mw,"mw","265"],[t.my,"my","60"],[t.mv,"mv","960"],[t.ml,"ml","223"],[t.mt,"mt","356"],[t.mh,"mh","692"],[t.mq,"mq","596"],[t.mr,"mr","222"],[t.mu,"mu","230"],[t.yt,"yt","262",1,["269","639"]],[t.mx,"mx","52"],[t.fm,"fm","691"],[t.md,"md","373"],[t.mc,"mc","377"],[t.mn,"mn","976"],[t.me,"me","382"],[t.ms,"ms","1",16,["664"]],[t.ma,"ma","212",0],[t.mz,"mz","258"],[t.mm,"mm","95"],[t.na,"na","264"],[t.nr,"nr","674"],[t.np,"np","977"],[t.nl,"nl","31"],[t.nc,"nc","687"],[t.nz,"nz","64"],[t.ni,"ni","505"],[t.ne,"ne","227"],[t.ng,"ng","234"],[t.nu,"nu","683"],[t.nf,"nf","672"],[t.kp,"kp","850"],[t.mk,"mk","389"],[t.mp,"mp","1",17,["670"]],[t.no,"no","47",0],[t.om,"om","968"],[t.pk,"pk","92"],[t.pw,"pw","680"],[t.ps,"ps","970"],[t.pa,"pa","507"],[t.pg,"pg","675"],[t.py,"py","595"],[t.pe,"pe","51"],[t.ph,"ph","63"],[t.pl,"pl","48"],[t.pt,"pt","351"],[t.pr,"pr","1",3,["787","939"]],[t.qa,"qa","974"],[t.re,"re","262",0],[t.ro,"ro","40"],[t.ru,"ru","7",0],[t.rw,"rw","250"],[t.ws,"ws","685"],[t.sm,"sm","378"],[t.st,"st","239"],[t.sa,"sa","966"],[t.sn,"sn","221"],[t.rs,"rs","381"],[t.sc,"sc","248"],[t.sl,"sl","232"],[t.sg,"sg","65"],[t.sx,"sx","1",21,["721"]],[t.sk,"sk","421"],[t.si,"si","386"],[t.sb,"sb","677"],[t.so,"so","252"],[t.za,"za","27"],[t.kr,"kr","82"],[t.ss,"ss","211"],[t.es,"es","34"],[t.lk,"lk","94"],[t.bl,"bl","590",1],[t.sh,"sh","290"],[t.kn,"kn","1",18,["869"]],[t.lc,"lc","1",19,["758"]],[t.mf,"mf","590",2],[t.pm,"pm","508"],[t.vc,"vc","1",20,["784"]],[t.sd,"sd","249"],[t.sr,"sr","597"],[t.sj,"sj","47",1,["79"]],[t.se,"se","46"],[t.ch,"ch","41"],[t.sy,"sy","963"],[t.tw,"tw","886"],[t.tj,"tj","992"],[t.tz,"tz","255"],[t.th,"th","66"],[t.tl,"tl","670"],[t.tg,"tg","228"],[t.tk,"tk","690"],[t.to,"to","676"],[t.tt,"tt","1",22,["868"]],[t.tn,"tn","216"],[t.tr,"tr","90"],[t.tm,"tm","993"],[t.tc,"tc","1",23,["649"]],[t.tv,"tv","688"],[t.ug,"ug","256"],[t.ua,"ua","380"],[t.ae,"ae","971"],[t.gb,"gb","44",0],[t.us,"us","1",0],[t.uy,"uy","598"],[t.vi,"vi","1",24,["340"]],[t.uz,"uz","998"],[t.vu,"vu","678"],[t.va,"va","39",1,["06698"]],[t.ve,"ve","58"],[t.vn,"vn","84"],[t.wf,"wf","681"],[t.eh,"eh","212",1,["5288","5289"]],[t.ye,"ye","967"],[t.zm,"zm","260"],[t.zw,"zw","263"],[t.ax,"ax","358",1,["18"]]],T=[];for(let r=0;r<L.length;r++){let i=L[r];T[r]={name:i[0],iso2:i[1],dialCode:i[2],priority:i[3]||0,areaCodes:i[4]||null,nodeById:{}}}var f=T;var E={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found"};var R=0,D={allowDropdown:!0,autoPlaceholder:"polite",countrySearch:!0,containerClass:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:[],showFlags:!0,showSelectedDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},F=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],w=r=>r.replace(/\D/g,""),S=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),O=(r,i,e)=>{e&&!r.classList.contains(i)?r.classList.add(i):!e&&r.classList.contains(i)&&r.classList.remove(i)},k=r=>{let i=w(r);if(i.charAt(0)==="1"){let e=i.substr(1,3);return F.indexOf(e)!==-1}return!1},B=(r,i)=>r.name<i.name?-1:r.name>i.name?1:0,$=(r,i,e,n)=>{if(e===0&&!n)return 0;let s=0;for(let o=0;o<i.length;o++){if(/[+0-9]/.test(i[o])&&s++,s===r&&!n)return o+1;if(n&&s===r+1)return o}return i.length},g=(r,i,e)=>{let n=document.createElement(r);return i&&Object.entries(i).forEach(([s,o])=>n.setAttribute(s,o)),e&&e.appendChild(n),n},b=r=>{let{instances:i}=window.intlTelInputGlobals;Object.values(i).forEach(e=>e[r]())},I=class{id;promise;telInput;activeItem;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;preferredCountries;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(i,e={}){this.id=R++,this.telInput=i,this.activeItem=null,this.highlightedItem=null,this.options=Object.assign({},D,e),this.hadInitialPlaceholder=!!i.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.countrySearch&&!this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!0);let i=this.options.allowDropdown&&!this.options.showSelectedDialCode;!this.options.showFlags&&i&&(this.options.showFlags=!0),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...E,...this.options.i18n};let e=new Promise((s,o)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=o}),n=new Promise((s,o)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=o});this.promise=Promise.all([e,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._processPreferredCountries(),this._translateCountryNames(),(this.options.onlyCountries.length||this.options.i18n)&&this.countries.sort(B)}_addToDialCodeMap(i,e,n){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let o=0;o<this.dialCodeToIso2Map[e].length;o++)if(this.dialCodeToIso2Map[e][o]===i)return;let s=n!==void 0?n:this.dialCodeToIso2Map[e].length;this.dialCodeToIso2Map[e][s]=i}_processAllCountries(){let{onlyCountries:i,excludeCountries:e}=this.options;if(i.length){let n=i.map(s=>s.toLowerCase());this.countries=f.filter(s=>n.indexOf(s.iso2)>-1)}else if(e.length){let n=e.map(s=>s.toLowerCase());this.countries=f.filter(s=>n.indexOf(s.iso2)===-1)}else this.countries=f}_translateCountryNames(){for(let i=0;i<this.countries.length;i++){let e=this.countries[i].iso2.toLowerCase();this.options.i18n.hasOwnProperty(e)&&(this.countries[i].name=this.options.i18n[e])}}_processDialCodes(){this.dialCodes={},this.dialCodeMaxLen=0,this.dialCodeToIso2Map={};for(let i=0;i<this.countries.length;i++){let e=this.countries[i];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._addToDialCodeMap(e.iso2,e.dialCode,e.priority)}for(let i=0;i<this.countries.length;i++){let e=this.countries[i];if(e.areaCodes){let n=this.dialCodeToIso2Map[e.dialCode][0];for(let s=0;s<e.areaCodes.length;s++){let o=e.areaCodes[s];for(let l=1;l<o.length;l++){let u=e.dialCode+o.substr(0,l);this._addToDialCodeMap(n,u),this._addToDialCodeMap(e.iso2,u)}this._addToDialCodeMap(e.iso2,e.dialCode+o)}}}}_processPreferredCountries(){this.preferredCountries=[];for(let i=0;i<this.options.preferredCountries.length;i++){let e=this.options.preferredCountries[i].toLowerCase(),n=this._getCountryData(e,!0);n&&this.preferredCountries.push(n)}}_generateMarkup(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!(this.telInput.form&&this.telInput.form.hasAttribute("autocomplete"))&&this.telInput.setAttribute("autocomplete","off");let{allowDropdown:i,showSelectedDialCode:e,showFlags:n,containerClass:s,hiddenInput:o,dropdownContainer:l,fixDropdownWidth:u,useFullscreenPopup:d,countrySearch:a,i18n:p}=this.options,h="iti";i&&(h+=" iti--allow-dropdown"),e&&(h+=" iti--show-selected-dial-code"),n&&(h+=" iti--show-flags"),s&&(h+=` ${s}`),d||(h+=" iti--inline-dropdown");let c=g("div",{class:h});if(this.telInput.parentNode?.insertBefore(c,this.telInput),(n||e)&&(this.countryContainer=g("div",{class:"iti__country-container"},c),this.selectedCountry=g("button",{type:"button",class:"iti__selected-country",...i&&{"aria-expanded":"false","aria-label":this.options.i18n.selectedCountryAriaLabel,"aria-haspopup":a?"true":"listbox","aria-controls":a?`iti-${this.id}__dropdown-content`:`iti-${this.id}__country-listbox`,...a?{role:"combobox"}:{}}},this.countryContainer),this.selectedCountryInner=g("div",null,this.selectedCountry),this.selectedCountryA11yText=g("span",{class:"iti__a11y-text"},this.selectedCountryInner)),c.appendChild(this.telInput),this.selectedCountry&&this.telInput.disabled&&this.selectedCountry.setAttribute("aria-disabled","true"),e&&(this.selectedDialCode=g("div",{class:"iti__selected-dial-code"},this.selectedCountry)),i){this.telInput.disabled||this.selectedCountry.setAttribute("tabindex","0"),this.dropdownArrow=g("div",{class:"iti__arrow","aria-hidden":"true"},this.selectedCountry);let C=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=g("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${C}`}),a&&(this.searchInput=g("input",{type:"text",class:"iti__search-input",placeholder:p.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":p.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=g("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=g("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":p.countryListAriaLabel},this.dropdownContent),this.preferredCountries.length&&!a&&(this._appendListItems(this.preferredCountries,"iti__preferred",!0),g("li",{class:"iti__divider","aria-hidden":"true"},this.countryList)),this._appendListItems(this.countries,"iti__standard"),a&&this._updateSearchResultsText(),l){let m="iti iti--container";d?m+=" iti--fullscreen-popup":m+=" iti--inline-dropdown",a&&(m+=" iti--country-search"),this.dropdown=g("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}if(o){let C=this.telInput.getAttribute("name")||"",m=o(C);m.phone&&(this.hiddenInput=g("input",{type:"hidden",name:m.phone}),c.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=g("input",{type:"hidden",name:m.country}),c.appendChild(this.hiddenInputCountry))}}_appendListItems(i,e,n){for(let s=0;s<i.length;s++){let o=i[s],l=n?"-preferred":"",u=g("li",{id:`iti-${this.id}__item-${o.iso2}${l}`,class:`iti__country ${e}`,tabindex:"-1",role:"option","data-dial-code":o.dialCode,"data-country-code":o.iso2,"aria-selected":"false"},this.countryList);o.nodeById[this.id]=u;let d="";this.options.showFlags&&(d+=`<div class='iti__flag-box'><div class='iti__flag iti__${o.iso2}'></div></div>`),d+=`<span class='iti__country-name'>${o.name}</span>`,d+=`<span class='iti__dial-code'>+${o.dialCode}</span>`,u.insertAdjacentHTML("beforeend",d)}}_setInitialState(i=!1){let e=this.telInput.getAttribute("value"),n=this.telInput.value,o=e&&e.charAt(0)==="+"&&(!n||n.charAt(0)!=="+")?e:n,l=this._getDialCode(o),u=k(o),{initialCountry:d}=this.options;if(l&&!u)this._updateCountryFromNumber(o);else if(d!=="auto"||i){let a=d?d.toLowerCase():"";a&&this._getCountryData(a,!0)?this._setCountry(a):l&&u?this._setCountry("us"):this._setCountry()}o&&this._updateValFromNumber(o)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=e=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():e.preventDefault()};let i=this.telInput.closest("label");i&&i.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._openDropdown()),e.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{window.intlTelInputGlobals.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((i="")=>{let e=i.toLowerCase();e&&this._getCountryData(e,!0)?(window.intlTelInputGlobals.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._setInitialState(!0),b("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),b("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:i,formatAsYouType:e}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let o=s&&s.data&&/[^+0-9]/.test(s.data),l=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(o||l&&!i?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),e&&!n){let u=this.telInput.selectionStart||0,a=this.telInput.value.substring(0,u).replace(/[^+0-9]/g,"").length,p=s&&s.inputType==="deleteContentForward",h=this._formatNumberAsYouType(),c=$(a,h,u,p);this.telInput.value=h,this.telInput.setSelectionRange(c,c)}},this.telInput.addEventListener("input",this._handleInputEvent),i&&(this._handleKeydownEvent=s=>{if(s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){let o=this.telInput.selectionStart===0&&s.key==="+",l=/^[0-9]$/.test(s.key),u=o||l,d=this._getFullNumber(),a=window.intlTelInputUtils.getCoreNumber(d,this.selectedCountryData.iso2),p=this.maxCoreNumberLength&&a.length>=this.maxCoreNumberLength;(!u||p)&&s.preventDefault()}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(i){let e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&i.length>e?i.substr(0,e):i}_trigger(i){let e=new Event(i,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}_openDropdown(){let{fixDropdownWidth:i,countrySearch:e}=this.options;if(i&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),this.activeItem&&!e)this._highlightListItem(this.activeItem,!1),this._scrollTo(this.activeItem,!0);else{let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),e&&this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let i=this.telInput.getBoundingClientRect(),e=document.documentElement.scrollTop,n=i.top+e,s=this.dropdownContent.offsetHeight,o=n+this.telInput.offsetHeight+s<e+window.innerHeight,l=n-s>e,u=!this.options.countrySearch&&!o&&l;if(O(this.dropdownContent,"iti__dropdown-content--dropup",u),this.options.dropdownContainer){let d=u?0:this.telInput.offsetHeight;this.dropdown.style.top=`${n+d}px`,this.dropdown.style.left=`${i.left+document.body.scrollLeft}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll)}}}_bindDropdownListeners(){this._handleMouseoverCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._highlightListItem(o,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._selectListItem(o)},this.countryList.addEventListener("click",this._handleClickCountryList);let i=!0;this._handleClickOffToClose=()=>{i||this._closeDropdown(),i=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let e="",n=null;if(this._handleKeydownOnDropdown=s=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key==="ArrowUp"||s.key==="ArrowDown"?this._handleUpDownKey(s.key):s.key==="Enter"?this._handleEnterKey():s.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key)&&(s.stopPropagation(),n&&clearTimeout(n),e+=s.key.toLowerCase(),this._searchForCountry(e),n=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let s=()=>{let l=this.searchInput.value.trim();l?this._filterCountries(l):this._filterCountries("",!0)},o=null;this._handleSearchChange=()=>{o&&clearTimeout(o),o=setTimeout(()=>{s(),o=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",l=>l.stopPropagation())}}_filterCountries(i,e=!1){let n=!0;this.countryList.innerHTML="";let s=S(i);for(let o=0;o<this.countries.length;o++){let l=this.countries[o],u=S(l.name),d=`+${l.dialCode}`;if(e||u.includes(s)||d.includes(s)||l.iso2.includes(s)){let a=l.nodeById[this.id];a&&this.countryList.appendChild(a),n&&(this._highlightListItem(a,!1),n=!1)}}this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:i}=this.options,e=this.countryList.childElementCount,n;e===0?n=i.zeroSearchResults:e===1?n=i.oneSearchResult:n=i.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=n}_handleUpDownKey(i){let e=i==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;if(e?e.classList.contains("iti__divider")&&(e=i==="ArrowUp"?e.previousElementSibling:e.nextElementSibling):this.countryList.childElementCount>1&&(e=i==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e){this._scrollTo(e,!1);let n=!this.options.countrySearch;this._highlightListItem(e,n)}}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_searchForCountry(i){for(let e=0;e<this.countries.length;e++){let n=this.countries[e];if(n.name.substr(0,i.length).toLowerCase()===i){let o=n.nodeById[this.id];this._highlightListItem(o,!1),this._scrollTo(o,!0);break}}}_updateValFromNumber(i){let e=i;if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){let n=this.options.nationalMode||e.charAt(0)!=="+"&&!this.options.showSelectedDialCode,{NATIONAL:s,INTERNATIONAL:o}=window.intlTelInputUtils.numberFormat,l=n?s:o;e=window.intlTelInputUtils.formatNumber(e,this.selectedCountryData.iso2,l)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(i){let e=i.indexOf("+"),n=e?i.substring(e):i,s=this.selectedCountryData.dialCode;n&&s==="1"&&n.charAt(0)!=="+"&&(n.charAt(0)!=="1"&&(n=`1${n}`),n=`+${n}`),this.options.showSelectedDialCode&&s&&n.charAt(0)!=="+"&&(n=`+${s}${n}`);let l=this._getDialCode(n,!0),u=w(n),d=null;if(l){let a=this.dialCodeToIso2Map[w(l)],p=a.indexOf(this.selectedCountryData.iso2)!==-1&&u.length<=l.length-1;if(!(s==="1"&&k(u))&&!p){for(let c=0;c<a.length;c++)if(a[c]){d=a[c];break}}}else n.charAt(0)==="+"&&u.length?d="":(!n||n==="+")&&!this.selectedCountryData.iso2&&(d=this.defaultCountry);return d!==null?this._setCountry(d):!1}_highlightListItem(i,e){let n=this.highlightedItem;n&&(n.classList.remove("iti__highlight"),n.setAttribute("aria-selected","false")),this.highlightedItem=i,this.highlightedItem.classList.add("iti__highlight"),this.highlightedItem.setAttribute("aria-selected","true"),this.selectedCountry.setAttribute("aria-activedescendant",i.getAttribute("id")||""),this.options.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",i.getAttribute("id")||""),e&&this.highlightedItem.focus()}_getCountryData(i,e){for(let n=0;n<this.countries.length;n++)if(this.countries[n].iso2===i)return this.countries[n];if(e)return null;throw new Error(`No country data for '${i}'`)}_setCountry(i){let{allowDropdown:e,showSelectedDialCode:n,showFlags:s,countrySearch:o,i18n:l}=this.options,u=this.selectedCountryData.iso2?this.selectedCountryData:{};if(this.selectedCountryData=i?this._getCountryData(i,!1)||{}:{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedCountryInner){let d="",a="";i?s&&(d=`iti__flag iti__${i}`,a=`${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`):(d="iti__flag iti__globe",a=l.noCountrySelected),this.selectedCountryInner.className=d,this.selectedCountryA11yText.textContent=a}if(this._setSelectedCountryTitleAttribute(i,n),n){let d=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.selectedDialCode.innerHTML=d;let a=this.selectedCountry.offsetWidth||this._getHiddenSelectedCountryWidth();this.isRTL?this.telInput.style.paddingRight=`${a+6}px`:this.telInput.style.paddingLeft=`${a+6}px`}if(this._updatePlaceholder(),this._updateMaxLength(),e&&!o){let d=this.activeItem;if(d&&(d.classList.remove("iti__active"),d.setAttribute("aria-selected","false")),i){let a=this.countryList.querySelector(`#iti-${this.id}__item-${i}-preferred`)||this.countryList.querySelector(`#iti-${this.id}__item-${i}`);a&&(a.setAttribute("aria-selected","true"),a.classList.add("iti__active"),this.activeItem=a)}}return u.iso2!==i}_updateMaxLength(){if(this.options.strictMode&&window.intlTelInputUtils)if(this.selectedCountryData.iso2){let i=window.intlTelInputUtils.numberType[this.options.placeholderNumberType],e=window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,!1,i,!0),n=e;for(;window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2);)n=e,e+="0";let s=window.intlTelInputUtils.getCoreNumber(n,this.selectedCountryData.iso2);this.maxCoreNumberLength=s.length}else this.maxCoreNumberLength=null}_setSelectedCountryTitleAttribute(i=null,e){if(!this.selectedCountry)return;let n;i&&!e?n=`${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`:i?n=this.selectedCountryData.name:n="Unknown",this.selectedCountry.setAttribute("title",n)}_getHiddenSelectedCountryWidth(){if(this.telInput.parentNode){let i=this.telInput.parentNode.cloneNode(!1);i.style.visibility="hidden",document.body.appendChild(i);let e=this.countryContainer.cloneNode();i.appendChild(e);let n=this.selectedCountry.cloneNode(!0);e.appendChild(n);let s=n.offsetWidth;return document.body.removeChild(i),s}return 0}_updatePlaceholder(){let{autoPlaceholder:i,placeholderNumberType:e,nationalMode:n,customPlaceholder:s}=this.options,o=i==="aggressive"||!this.hadInitialPlaceholder&&i==="polite";if(window.intlTelInputUtils&&o){let l=window.intlTelInputUtils.numberType[e],u=this.selectedCountryData.iso2?window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,n,l):"";u=this._beforeSetNumber(u),typeof s=="function"&&(u=s(u,this.selectedCountryData)),this.telInput.setAttribute("placeholder",u)}}_selectListItem(i){let e=this._setCountry(i.getAttribute("data-country-code"));this._closeDropdown(),this._updateDialCode(i.getAttribute("data-dial-code")),this.telInput.focus(),e&&this._triggerCountryChange()}_closeDropdown(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.highlightedItem&&this.highlightedItem.setAttribute("aria-selected","false"),this.options.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.dropdownArrow.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch&&this.searchInput.removeEventListener("input",this._handleSearchChange),document.documentElement.removeEventListener("click",this._handleClickOffToClose),this.countryList.removeEventListener("mouseover",this._handleMouseoverCountryList),this.countryList.removeEventListener("click",this._handleClickCountryList),this.options.dropdownContainer&&(this.options.useFullscreenPopup||window.removeEventListener("scroll",this._handleWindowScroll),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_scrollTo(i,e){let n=this.countryList,s=document.documentElement.scrollTop,o=n.offsetHeight,l=n.getBoundingClientRect().top+s,u=l+o,d=i.offsetHeight,a=i.getBoundingClientRect().top+s,p=a+d,h=a-l+n.scrollTop,c=o/2-d/2;if(a<l)e&&(h-=c),n.scrollTop=h;else if(p>u){e&&(h+=c);let C=o-d;n.scrollTop=h-C}}_updateDialCode(i){let e=this.telInput.value,n=`+${i}`,s;if(e.charAt(0)==="+"){let o=this._getDialCode(e);o?s=e.replace(o,n):s=n,this.telInput.value=s}}_getDialCode(i,e){let n="";if(i.charAt(0)==="+"){let s="";for(let o=0;o<i.length;o++){let l=i.charAt(o);if(!isNaN(parseInt(l,10))){if(s+=l,e)this.dialCodeToIso2Map[s]&&(n=i.substr(0,o+1));else if(this.dialCodes[s]){n=i.substr(0,o+1);break}if(s.length===this.dialCodeMaxLen)break}}}return n}_getFullNumber(){let i=this.telInput.value.trim(),{dialCode:e}=this.selectedCountryData,n,s=w(i);return this.options.showSelectedDialCode&&!this.options.nationalMode&&i.charAt(0)!=="+"&&e&&s?n=`+${e}`:n="",n+i}_beforeSetNumber(i){let e=i;if(this.options.showSelectedDialCode){let n=this._getDialCode(e);if(n){n=`+${this.selectedCountryData.dialCode}`;let s=e[n.length]===" "||e[n.length]==="-"?n.length+1:n.length;e=e.substr(s)}}return this._cap(e)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let i=this._getFullNumber(),e=window.intlTelInputUtils?window.intlTelInputUtils.formatNumberAsYouType(i,this.selectedCountryData.iso2):i,{dialCode:n}=this.selectedCountryData;return this.options.showSelectedDialCode&&!this.options.nationalMode&&this.telInput.value.charAt(0)!=="+"&&e.includes(`+${n}`)?(e.split(`+${n}`)[1]||"").trim():e}handleAutoCountry(){this.options.initialCountry==="auto"&&window.intlTelInputGlobals.autoCountry&&(this.defaultCountry=window.intlTelInputGlobals.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){window.intlTelInputUtils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let n=this.telInput.closest("label");n&&n.removeEventListener("click",this._handleLabelClick)}let{form:i}=this.telInput;this._handleHiddenInputSubmit&&i&&i.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let e=this.telInput.parentNode;e?.parentNode?.insertBefore(this.telInput,e),e?.parentNode?.removeChild(e),delete window.intlTelInputGlobals.instances[this.id]}getExtension(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber(i){if(window.intlTelInputUtils){let{iso2:e}=this.selectedCountryData;return window.intlTelInputUtils.formatNumber(this._getFullNumber(),e,i)}return""}getNumberType(){return window.intlTelInputUtils?window.intlTelInputUtils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(window.intlTelInputUtils){let{iso2:i}=this.selectedCountryData;return window.intlTelInputUtils.getValidationError(this._getFullNumber(),i)}return-99}isValidNumber(i=!0){let e=this._getFullNumber();return/\p{L}/u.test(e)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2,i):null}isValidNumberPrecise(){let i=this._getFullNumber();return/\p{L}/u.test(i)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isValidNumber(i,this.selectedCountryData.iso2):null}setCountry(i){let e=i.toLowerCase();this.selectedCountryData.iso2!==e&&(this._setCountry(e),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(i){let e=this._updateCountryFromNumber(i);this._updateValFromNumber(i),e&&this._triggerCountryChange()}setPlaceholderNumberType(i){this.options.placeholderNumberType=i,this._updatePlaceholder()}},G=(r,i,e)=>{let n=document.createElement("script");n.onload=()=>{b("handleUtils"),i&&i()},n.onerror=()=>{b("rejectUtilsScriptPromise"),e&&e()},n.className="iti-load-utils",n.async=!0,n.src=r,document.body.appendChild(n)},K=r=>!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript?(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise((i,e)=>G(r,i,e))):null;if(typeof window=="object"){let r={defaults:D,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:i=>{let e=i.getAttribute("data-intl-tel-input-id");return e?r.instances[e]:null},instances:{},loadUtils:K,version:"21.2.1"};window.intlTelInputGlobals=r}var V=(r,i)=>{let e=new I(r,i);return e._init(),r.setAttribute("data-intl-tel-input-id",e.id.toString()),window.intlTelInputGlobals.instances[e.id]=e,e},A=V;var q=({initialValue:r="",onChangeNumber:i=()=>{},onChangeCountry:e=()=>{},onChangeValidity:n=()=>{},onChangeErrorCode:s=()=>{},usePreciseValidation:o=!1,initOptions:l={},inputProps:u={}})=>{let d=(0,y.useRef)(null),a=(0,y.useRef)(null),p=()=>{let h=a.current?.getNumber()||"",c=a.current?.getSelectedCountryData().iso2||"";if(i(h),e(c),a.current)if(o?a.current.isValidNumberPrecise():a.current.isValidNumber())n(!0),s(null);else{let m=a.current.getValidationError();n(!1),s(m)}};return(0,y.useEffect)(()=>{let h=d.current;return h&&(a.current=A(h,l),h.addEventListener("countrychange",p)),()=>{h&&h.removeEventListener("countrychange",p),a.current?.destroy()}},[]),y.default.createElement("input",{type:"tel",ref:d,onInput:p,defaultValue:r,...u})},W=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import U,{useRef as k,useEffect as j}from"react";var t={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var w=[[t.af,"af","93"],[t.al,"al","355"],[t.dz,"dz","213"],[t.as,"as","1",5,["684"]],[t.ad,"ad","376"],[t.ao,"ao","244"],[t.ai,"ai","1",6,["264"]],[t.ag,"ag","1",7,["268"]],[t.ar,"ar","54"],[t.am,"am","374"],[t.aw,"aw","297"],["Ascension Island","ac","247"],[t.au,"au","61",0],[t.at,"at","43"],[t.az,"az","994"],[t.bs,"bs","1",8,["242"]],[t.bh,"bh","973"],[t.bd,"bd","880"],[t.bb,"bb","1",9,["246"]],[t.by,"by","375"],[t.be,"be","32"],[t.bz,"bz","501"],[t.bj,"bj","229"],[t.bm,"bm","1",10,["441"]],[t.bt,"bt","975"],[t.bo,"bo","591"],[t.ba,"ba","387"],[t.bw,"bw","267"],[t.br,"br","55"],[t.io,"io","246"],[t.vg,"vg","1",11,["284"]],[t.bn,"bn","673"],[t.bg,"bg","359"],[t.bf,"bf","226"],[t.bi,"bi","257"],[t.kh,"kh","855"],[t.cm,"cm","237"],[t.ca,"ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],[t.cv,"cv","238"],[t.bq,"bq","599",1,["3","4","7"]],[t.ky,"ky","1",12,["345"]],[t.cf,"cf","236"],[t.td,"td","235"],[t.cl,"cl","56"],[t.cn,"cn","86"],[t.cx,"cx","61",2,["89164"]],[t.cc,"cc","61",1,["89162"]],[t.co,"co","57"],[t.km,"km","269"],[t.cg,"cg","242"],[t.cd,"cd","243"],[t.ck,"ck","682"],[t.cr,"cr","506"],[t.ci,"ci","225"],[t.hr,"hr","385"],[t.cu,"cu","53"],[t.cw,"cw","599",0],[t.cy,"cy","357"],[t.cz,"cz","420"],[t.dk,"dk","45"],[t.dj,"dj","253"],[t.dm,"dm","1",13,["767"]],[t.do,"do","1",2,["809","829","849"]],[t.ec,"ec","593"],[t.eg,"eg","20"],[t.sv,"sv","503"],[t.gq,"gq","240"],[t.er,"er","291"],[t.ee,"ee","372"],[t.sz,"sz","268"],[t.et,"et","251"],[t.fk,"fk","500"],[t.fo,"fo","298"],[t.fj,"fj","679"],[t.fi,"fi","358",0],[t.fr,"fr","33"],[t.gf,"gf","594"],[t.pf,"pf","689"],[t.ga,"ga","241"],[t.gm,"gm","220"],[t.ge,"ge","995"],[t.de,"de","49"],[t.gh,"gh","233"],[t.gi,"gi","350"],[t.gr,"gr","30"],[t.gl,"gl","299"],[t.gd,"gd","1",14,["473"]],[t.gp,"gp","590",0],[t.gu,"gu","1",15,["671"]],[t.gt,"gt","502"],[t.gg,"gg","44",1,["1481","7781","7839","7911"]],[t.gn,"gn","224"],[t.gw,"gw","245"],[t.gy,"gy","592"],[t.ht,"ht","509"],[t.hn,"hn","504"],[t.hk,"hk","852"],[t.hu,"hu","36"],[t.is,"is","354"],[t.in,"in","91"],[t.id,"id","62"],[t.ir,"ir","98"],[t.iq,"iq","964"],[t.ie,"ie","353"],[t.im,"im","44",2,["1624","74576","7524","7924","7624"]],[t.il,"il","972"],[t.it,"it","39",0],[t.jm,"jm","1",4,["876","658"]],[t.jp,"jp","81"],[t.je,"je","44",3,["1534","7509","7700","7797","7829","7937"]],[t.jo,"jo","962"],[t.kz,"kz","7",1,["33","7"]],[t.ke,"ke","254"],[t.ki,"ki","686"],["Kosovo","xk","383"],[t.kw,"kw","965"],[t.kg,"kg","996"],[t.la,"la","856"],[t.lv,"lv","371"],[t.lb,"lb","961"],[t.ls,"ls","266"],[t.lr,"lr","231"],[t.ly,"ly","218"],[t.li,"li","423"],[t.lt,"lt","370"],[t.lu,"lu","352"],[t.mo,"mo","853"],[t.mg,"mg","261"],[t.mw,"mw","265"],[t.my,"my","60"],[t.mv,"mv","960"],[t.ml,"ml","223"],[t.mt,"mt","356"],[t.mh,"mh","692"],[t.mq,"mq","596"],[t.mr,"mr","222"],[t.mu,"mu","230"],[t.yt,"yt","262",1,["269","639"]],[t.mx,"mx","52"],[t.fm,"fm","691"],[t.md,"md","373"],[t.mc,"mc","377"],[t.mn,"mn","976"],[t.me,"me","382"],[t.ms,"ms","1",16,["664"]],[t.ma,"ma","212",0],[t.mz,"mz","258"],[t.mm,"mm","95"],[t.na,"na","264"],[t.nr,"nr","674"],[t.np,"np","977"],[t.nl,"nl","31"],[t.nc,"nc","687"],[t.nz,"nz","64"],[t.ni,"ni","505"],[t.ne,"ne","227"],[t.ng,"ng","234"],[t.nu,"nu","683"],[t.nf,"nf","672"],[t.kp,"kp","850"],[t.mk,"mk","389"],[t.mp,"mp","1",17,["670"]],[t.no,"no","47",0],[t.om,"om","968"],[t.pk,"pk","92"],[t.pw,"pw","680"],[t.ps,"ps","970"],[t.pa,"pa","507"],[t.pg,"pg","675"],[t.py,"py","595"],[t.pe,"pe","51"],[t.ph,"ph","63"],[t.pl,"pl","48"],[t.pt,"pt","351"],[t.pr,"pr","1",3,["787","939"]],[t.qa,"qa","974"],[t.re,"re","262",0],[t.ro,"ro","40"],[t.ru,"ru","7",0],[t.rw,"rw","250"],[t.ws,"ws","685"],[t.sm,"sm","378"],[t.st,"st","239"],[t.sa,"sa","966"],[t.sn,"sn","221"],[t.rs,"rs","381"],[t.sc,"sc","248"],[t.sl,"sl","232"],[t.sg,"sg","65"],[t.sx,"sx","1",21,["721"]],[t.sk,"sk","421"],[t.si,"si","386"],[t.sb,"sb","677"],[t.so,"so","252"],[t.za,"za","27"],[t.kr,"kr","82"],[t.ss,"ss","211"],[t.es,"es","34"],[t.lk,"lk","94"],[t.bl,"bl","590",1],[t.sh,"sh","290"],[t.kn,"kn","1",18,["869"]],[t.lc,"lc","1",19,["758"]],[t.mf,"mf","590",2],[t.pm,"pm","508"],[t.vc,"vc","1",20,["784"]],[t.sd,"sd","249"],[t.sr,"sr","597"],[t.sj,"sj","47",1,["79"]],[t.se,"se","46"],[t.ch,"ch","41"],[t.sy,"sy","963"],[t.tw,"tw","886"],[t.tj,"tj","992"],[t.tz,"tz","255"],[t.th,"th","66"],[t.tl,"tl","670"],[t.tg,"tg","228"],[t.tk,"tk","690"],[t.to,"to","676"],[t.tt,"tt","1",22,["868"]],[t.tn,"tn","216"],[t.tr,"tr","90"],[t.tm,"tm","993"],[t.tc,"tc","1",23,["649"]],[t.tv,"tv","688"],[t.ug,"ug","256"],[t.ua,"ua","380"],[t.ae,"ae","971"],[t.gb,"gb","44",0],[t.us,"us","1",0],[t.uy,"uy","598"],[t.vi,"vi","1",24,["340"]],[t.uz,"uz","998"],[t.vu,"vu","678"],[t.va,"va","39",1,["06698"]],[t.ve,"ve","58"],[t.vn,"vn","84"],[t.wf,"wf","681"],[t.eh,"eh","212",1,["5288","5289"]],[t.ye,"ye","967"],[t.zm,"zm","260"],[t.zw,"zw","263"],[t.ax,"ax","358",1,["18"]]],I=[];for(let d=0;d<w.length;d++){let i=w[d];I[d]={name:i[0],iso2:i[1],dialCode:i[2],priority:i[3]||0,areaCodes:i[4]||null,nodeById:{}}}var C=I;var _={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found"};var D=0,E={allowDropdown:!0,autoPlaceholder:"polite",countrySearch:!0,containerClass:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:[],showFlags:!0,showSelectedDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},A=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=d=>d.replace(/\D/g,""),L=(d="")=>d.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),N=(d,i,e)=>{e&&!d.classList.contains(i)?d.classList.add(i):!e&&d.classList.contains(i)&&d.classList.remove(i)},T=d=>{let i=b(d);if(i.charAt(0)==="1"){let e=i.substr(1,3);return A.indexOf(e)!==-1}return!1},M=(d,i)=>d.name<i.name?-1:d.name>i.name?1:0,x=(d,i,e,n)=>{if(e===0&&!n)return 0;let s=0;for(let o=0;o<i.length;o++){if(/[+0-9]/.test(i[o])&&s++,s===d&&!n)return o+1;if(n&&s===d+1)return o}return i.length},g=(d,i,e)=>{let n=document.createElement(d);return i&&Object.entries(i).forEach(([s,o])=>n.setAttribute(s,o)),e&&e.appendChild(n),n},f=d=>{let{instances:i}=window.intlTelInputGlobals;Object.values(i).forEach(e=>e[d]())},v=class{id;promise;telInput;activeItem;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;preferredCountries;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(i,e={}){this.id=D++,this.telInput=i,this.activeItem=null,this.highlightedItem=null,this.options=Object.assign({},E,e),this.hadInitialPlaceholder=!!i.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.countrySearch&&!this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!0);let i=this.options.allowDropdown&&!this.options.showSelectedDialCode;!this.options.showFlags&&i&&(this.options.showFlags=!0),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={..._,...this.options.i18n};let e=new Promise((s,o)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=o}),n=new Promise((s,o)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=o});this.promise=Promise.all([e,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._processPreferredCountries(),this._translateCountryNames(),(this.options.onlyCountries.length||this.options.i18n)&&this.countries.sort(M)}_addToDialCodeMap(i,e,n){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let o=0;o<this.dialCodeToIso2Map[e].length;o++)if(this.dialCodeToIso2Map[e][o]===i)return;let s=n!==void 0?n:this.dialCodeToIso2Map[e].length;this.dialCodeToIso2Map[e][s]=i}_processAllCountries(){let{onlyCountries:i,excludeCountries:e}=this.options;if(i.length){let n=i.map(s=>s.toLowerCase());this.countries=C.filter(s=>n.indexOf(s.iso2)>-1)}else if(e.length){let n=e.map(s=>s.toLowerCase());this.countries=C.filter(s=>n.indexOf(s.iso2)===-1)}else this.countries=C}_translateCountryNames(){for(let i=0;i<this.countries.length;i++){let e=this.countries[i].iso2.toLowerCase();this.options.i18n.hasOwnProperty(e)&&(this.countries[i].name=this.options.i18n[e])}}_processDialCodes(){this.dialCodes={},this.dialCodeMaxLen=0,this.dialCodeToIso2Map={};for(let i=0;i<this.countries.length;i++){let e=this.countries[i];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._addToDialCodeMap(e.iso2,e.dialCode,e.priority)}for(let i=0;i<this.countries.length;i++){let e=this.countries[i];if(e.areaCodes){let n=this.dialCodeToIso2Map[e.dialCode][0];for(let s=0;s<e.areaCodes.length;s++){let o=e.areaCodes[s];for(let a=1;a<o.length;a++){let u=e.dialCode+o.substr(0,a);this._addToDialCodeMap(n,u),this._addToDialCodeMap(e.iso2,u)}this._addToDialCodeMap(e.iso2,e.dialCode+o)}}}}_processPreferredCountries(){this.preferredCountries=[];for(let i=0;i<this.options.preferredCountries.length;i++){let e=this.options.preferredCountries[i].toLowerCase(),n=this._getCountryData(e,!0);n&&this.preferredCountries.push(n)}}_generateMarkup(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!(this.telInput.form&&this.telInput.form.hasAttribute("autocomplete"))&&this.telInput.setAttribute("autocomplete","off");let{allowDropdown:i,showSelectedDialCode:e,showFlags:n,containerClass:s,hiddenInput:o,dropdownContainer:a,fixDropdownWidth:u,useFullscreenPopup:l,countrySearch:r,i18n:p}=this.options,h="iti";i&&(h+=" iti--allow-dropdown"),e&&(h+=" iti--show-selected-dial-code"),n&&(h+=" iti--show-flags"),s&&(h+=` ${s}`),l||(h+=" iti--inline-dropdown");let c=g("div",{class:h});if(this.telInput.parentNode?.insertBefore(c,this.telInput),(n||e)&&(this.countryContainer=g("div",{class:"iti__country-container"},c),this.selectedCountry=g("button",{type:"button",class:"iti__selected-country",...i&&{"aria-expanded":"false","aria-label":this.options.i18n.selectedCountryAriaLabel,"aria-haspopup":r?"true":"listbox","aria-controls":r?`iti-${this.id}__dropdown-content`:`iti-${this.id}__country-listbox`,...r?{role:"combobox"}:{}}},this.countryContainer),this.selectedCountryInner=g("div",null,this.selectedCountry),this.selectedCountryA11yText=g("span",{class:"iti__a11y-text"},this.selectedCountryInner)),c.appendChild(this.telInput),this.selectedCountry&&this.telInput.disabled&&this.selectedCountry.setAttribute("aria-disabled","true"),e&&(this.selectedDialCode=g("div",{class:"iti__selected-dial-code"},this.selectedCountry)),i){this.telInput.disabled||this.selectedCountry.setAttribute("tabindex","0"),this.dropdownArrow=g("div",{class:"iti__arrow","aria-hidden":"true"},this.selectedCountry);let y=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=g("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${y}`}),r&&(this.searchInput=g("input",{type:"text",class:"iti__search-input",placeholder:p.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":p.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=g("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=g("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":p.countryListAriaLabel},this.dropdownContent),this.preferredCountries.length&&!r&&(this._appendListItems(this.preferredCountries,"iti__preferred",!0),g("li",{class:"iti__divider","aria-hidden":"true"},this.countryList)),this._appendListItems(this.countries,"iti__standard"),r&&this._updateSearchResultsText(),a){let m="iti iti--container";l?m+=" iti--fullscreen-popup":m+=" iti--inline-dropdown",r&&(m+=" iti--country-search"),this.dropdown=g("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}if(o){let y=this.telInput.getAttribute("name")||"",m=o(y);m.phone&&(this.hiddenInput=g("input",{type:"hidden",name:m.phone}),c.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=g("input",{type:"hidden",name:m.country}),c.appendChild(this.hiddenInputCountry))}}_appendListItems(i,e,n){for(let s=0;s<i.length;s++){let o=i[s],a=n?"-preferred":"",u=g("li",{id:`iti-${this.id}__item-${o.iso2}${a}`,class:`iti__country ${e}`,tabindex:"-1",role:"option","data-dial-code":o.dialCode,"data-country-code":o.iso2,"aria-selected":"false"},this.countryList);o.nodeById[this.id]=u;let l="";this.options.showFlags&&(l+=`<div class='iti__flag-box'><div class='iti__flag iti__${o.iso2}'></div></div>`),l+=`<span class='iti__country-name'>${o.name}</span>`,l+=`<span class='iti__dial-code'>+${o.dialCode}</span>`,u.insertAdjacentHTML("beforeend",l)}}_setInitialState(i=!1){let e=this.telInput.getAttribute("value"),n=this.telInput.value,o=e&&e.charAt(0)==="+"&&(!n||n.charAt(0)!=="+")?e:n,a=this._getDialCode(o),u=T(o),{initialCountry:l}=this.options;if(a&&!u)this._updateCountryFromNumber(o);else if(l!=="auto"||i){let r=l?l.toLowerCase():"";r&&this._getCountryData(r,!0)?this._setCountry(r):a&&u?this._setCountry("us"):this._setCountry()}o&&this._updateValFromNumber(o)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=e=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():e.preventDefault()};let i=this.telInput.closest("label");i&&i.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._openDropdown()),e.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{window.intlTelInputGlobals.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((i="")=>{let e=i.toLowerCase();e&&this._getCountryData(e,!0)?(window.intlTelInputGlobals.autoCountry=e,setTimeout(()=>f("handleAutoCountry"))):(this._setInitialState(!0),f("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),f("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:i,formatAsYouType:e}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let o=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(o||a&&!i?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),e&&!n){let u=this.telInput.selectionStart||0,r=this.telInput.value.substring(0,u).replace(/[^+0-9]/g,"").length,p=s&&s.inputType==="deleteContentForward",h=this._formatNumberAsYouType(),c=x(r,h,u,p);this.telInput.value=h,this.telInput.setSelectionRange(c,c)}},this.telInput.addEventListener("input",this._handleInputEvent),i&&(this._handleKeydownEvent=s=>{if(s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){let o=this.telInput.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=o||a,l=this._getFullNumber(),r=window.intlTelInputUtils.getCoreNumber(l,this.selectedCountryData.iso2),p=this.maxCoreNumberLength&&r.length>=this.maxCoreNumberLength;(!u||p)&&s.preventDefault()}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(i){let e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&i.length>e?i.substr(0,e):i}_trigger(i){let e=new Event(i,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}_openDropdown(){let{fixDropdownWidth:i,countrySearch:e}=this.options;if(i&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),this.activeItem&&!e)this._highlightListItem(this.activeItem,!1),this._scrollTo(this.activeItem,!0);else{let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),e&&this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let i=this.telInput.getBoundingClientRect(),e=document.documentElement.scrollTop,n=i.top+e,s=this.dropdownContent.offsetHeight,o=n+this.telInput.offsetHeight+s<e+window.innerHeight,a=n-s>e,u=!this.options.countrySearch&&!o&&a;if(N(this.dropdownContent,"iti__dropdown-content--dropup",u),this.options.dropdownContainer){let l=u?0:this.telInput.offsetHeight;this.dropdown.style.top=`${n+l}px`,this.dropdown.style.left=`${i.left+document.body.scrollLeft}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll)}}}_bindDropdownListeners(){this._handleMouseoverCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._highlightListItem(o,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._selectListItem(o)},this.countryList.addEventListener("click",this._handleClickCountryList);let i=!0;this._handleClickOffToClose=()=>{i||this._closeDropdown(),i=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let e="",n=null;if(this._handleKeydownOnDropdown=s=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key==="ArrowUp"||s.key==="ArrowDown"?this._handleUpDownKey(s.key):s.key==="Enter"?this._handleEnterKey():s.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key)&&(s.stopPropagation(),n&&clearTimeout(n),e+=s.key.toLowerCase(),this._searchForCountry(e),n=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let s=()=>{let a=this.searchInput.value.trim();a?this._filterCountries(a):this._filterCountries("",!0)},o=null;this._handleSearchChange=()=>{o&&clearTimeout(o),o=setTimeout(()=>{s(),o=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",a=>a.stopPropagation())}}_filterCountries(i,e=!1){let n=!0;this.countryList.innerHTML="";let s=L(i);for(let o=0;o<this.countries.length;o++){let a=this.countries[o],u=L(a.name),l=`+${a.dialCode}`;if(e||u.includes(s)||l.includes(s)||a.iso2.includes(s)){let r=a.nodeById[this.id];r&&this.countryList.appendChild(r),n&&(this._highlightListItem(r,!1),n=!1)}}this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:i}=this.options,e=this.countryList.childElementCount,n;e===0?n=i.zeroSearchResults:e===1?n=i.oneSearchResult:n=i.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=n}_handleUpDownKey(i){let e=i==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;if(e?e.classList.contains("iti__divider")&&(e=i==="ArrowUp"?e.previousElementSibling:e.nextElementSibling):this.countryList.childElementCount>1&&(e=i==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e){this._scrollTo(e,!1);let n=!this.options.countrySearch;this._highlightListItem(e,n)}}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_searchForCountry(i){for(let e=0;e<this.countries.length;e++){let n=this.countries[e];if(n.name.substr(0,i.length).toLowerCase()===i){let o=n.nodeById[this.id];this._highlightListItem(o,!1),this._scrollTo(o,!0);break}}}_updateValFromNumber(i){let e=i;if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){let n=this.options.nationalMode||e.charAt(0)!=="+"&&!this.options.showSelectedDialCode,{NATIONAL:s,INTERNATIONAL:o}=window.intlTelInputUtils.numberFormat,a=n?s:o;e=window.intlTelInputUtils.formatNumber(e,this.selectedCountryData.iso2,a)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(i){let e=i.indexOf("+"),n=e?i.substring(e):i,s=this.selectedCountryData.dialCode;n&&s==="1"&&n.charAt(0)!=="+"&&(n.charAt(0)!=="1"&&(n=`1${n}`),n=`+${n}`),this.options.showSelectedDialCode&&s&&n.charAt(0)!=="+"&&(n=`+${s}${n}`);let a=this._getDialCode(n,!0),u=b(n),l=null;if(a){let r=this.dialCodeToIso2Map[b(a)],p=r.indexOf(this.selectedCountryData.iso2)!==-1&&u.length<=a.length-1;if(!(s==="1"&&T(u))&&!p){for(let c=0;c<r.length;c++)if(r[c]){l=r[c];break}}}else n.charAt(0)==="+"&&u.length?l="":(!n||n==="+")&&!this.selectedCountryData.iso2&&(l=this.defaultCountry);return l!==null?this._setCountry(l):!1}_highlightListItem(i,e){let n=this.highlightedItem;n&&(n.classList.remove("iti__highlight"),n.setAttribute("aria-selected","false")),this.highlightedItem=i,this.highlightedItem.classList.add("iti__highlight"),this.highlightedItem.setAttribute("aria-selected","true"),this.selectedCountry.setAttribute("aria-activedescendant",i.getAttribute("id")||""),this.options.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",i.getAttribute("id")||""),e&&this.highlightedItem.focus()}_getCountryData(i,e){for(let n=0;n<this.countries.length;n++)if(this.countries[n].iso2===i)return this.countries[n];if(e)return null;throw new Error(`No country data for '${i}'`)}_setCountry(i){let{allowDropdown:e,showSelectedDialCode:n,showFlags:s,countrySearch:o,i18n:a}=this.options,u=this.selectedCountryData.iso2?this.selectedCountryData:{};if(this.selectedCountryData=i?this._getCountryData(i,!1)||{}:{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedCountryInner){let l="",r="";i?s&&(l=`iti__flag iti__${i}`,r=`${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`):(l="iti__flag iti__globe",r=a.noCountrySelected),this.selectedCountryInner.className=l,this.selectedCountryA11yText.textContent=r}if(this._setSelectedCountryTitleAttribute(i,n),n){let l=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.selectedDialCode.innerHTML=l;let r=this.selectedCountry.offsetWidth||this._getHiddenSelectedCountryWidth();this.isRTL?this.telInput.style.paddingRight=`${r+6}px`:this.telInput.style.paddingLeft=`${r+6}px`}if(this._updatePlaceholder(),this._updateMaxLength(),e&&!o){let l=this.activeItem;if(l&&(l.classList.remove("iti__active"),l.setAttribute("aria-selected","false")),i){let r=this.countryList.querySelector(`#iti-${this.id}__item-${i}-preferred`)||this.countryList.querySelector(`#iti-${this.id}__item-${i}`);r&&(r.setAttribute("aria-selected","true"),r.classList.add("iti__active"),this.activeItem=r)}}return u.iso2!==i}_updateMaxLength(){if(this.options.strictMode&&window.intlTelInputUtils)if(this.selectedCountryData.iso2){let i=window.intlTelInputUtils.numberType[this.options.placeholderNumberType],e=window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,!1,i,!0),n=e;for(;window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2);)n=e,e+="0";let s=window.intlTelInputUtils.getCoreNumber(n,this.selectedCountryData.iso2);this.maxCoreNumberLength=s.length}else this.maxCoreNumberLength=null}_setSelectedCountryTitleAttribute(i=null,e){if(!this.selectedCountry)return;let n;i&&!e?n=`${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`:i?n=this.selectedCountryData.name:n="Unknown",this.selectedCountry.setAttribute("title",n)}_getHiddenSelectedCountryWidth(){if(this.telInput.parentNode){let i=this.telInput.parentNode.cloneNode(!1);i.style.visibility="hidden",document.body.appendChild(i);let e=this.countryContainer.cloneNode();i.appendChild(e);let n=this.selectedCountry.cloneNode(!0);e.appendChild(n);let s=n.offsetWidth;return document.body.removeChild(i),s}return 0}_updatePlaceholder(){let{autoPlaceholder:i,placeholderNumberType:e,nationalMode:n,customPlaceholder:s}=this.options,o=i==="aggressive"||!this.hadInitialPlaceholder&&i==="polite";if(window.intlTelInputUtils&&o){let a=window.intlTelInputUtils.numberType[e],u=this.selectedCountryData.iso2?window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,n,a):"";u=this._beforeSetNumber(u),typeof s=="function"&&(u=s(u,this.selectedCountryData)),this.telInput.setAttribute("placeholder",u)}}_selectListItem(i){let e=this._setCountry(i.getAttribute("data-country-code"));this._closeDropdown(),this._updateDialCode(i.getAttribute("data-dial-code")),this.telInput.focus(),e&&this._triggerCountryChange()}_closeDropdown(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.highlightedItem&&this.highlightedItem.setAttribute("aria-selected","false"),this.options.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.dropdownArrow.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch&&this.searchInput.removeEventListener("input",this._handleSearchChange),document.documentElement.removeEventListener("click",this._handleClickOffToClose),this.countryList.removeEventListener("mouseover",this._handleMouseoverCountryList),this.countryList.removeEventListener("click",this._handleClickCountryList),this.options.dropdownContainer&&(this.options.useFullscreenPopup||window.removeEventListener("scroll",this._handleWindowScroll),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_scrollTo(i,e){let n=this.countryList,s=document.documentElement.scrollTop,o=n.offsetHeight,a=n.getBoundingClientRect().top+s,u=a+o,l=i.offsetHeight,r=i.getBoundingClientRect().top+s,p=r+l,h=r-a+n.scrollTop,c=o/2-l/2;if(r<a)e&&(h-=c),n.scrollTop=h;else if(p>u){e&&(h+=c);let y=o-l;n.scrollTop=h-y}}_updateDialCode(i){let e=this.telInput.value,n=`+${i}`,s;if(e.charAt(0)==="+"){let o=this._getDialCode(e);o?s=e.replace(o,n):s=n,this.telInput.value=s}}_getDialCode(i,e){let n="";if(i.charAt(0)==="+"){let s="";for(let o=0;o<i.length;o++){let a=i.charAt(o);if(!isNaN(parseInt(a,10))){if(s+=a,e)this.dialCodeToIso2Map[s]&&(n=i.substr(0,o+1));else if(this.dialCodes[s]){n=i.substr(0,o+1);break}if(s.length===this.dialCodeMaxLen)break}}}return n}_getFullNumber(){let i=this.telInput.value.trim(),{dialCode:e}=this.selectedCountryData,n,s=b(i);return this.options.showSelectedDialCode&&!this.options.nationalMode&&i.charAt(0)!=="+"&&e&&s?n=`+${e}`:n="",n+i}_beforeSetNumber(i){let e=i;if(this.options.showSelectedDialCode){let n=this._getDialCode(e);if(n){n=`+${this.selectedCountryData.dialCode}`;let s=e[n.length]===" "||e[n.length]==="-"?n.length+1:n.length;e=e.substr(s)}}return this._cap(e)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let i=this._getFullNumber(),e=window.intlTelInputUtils?window.intlTelInputUtils.formatNumberAsYouType(i,this.selectedCountryData.iso2):i,{dialCode:n}=this.selectedCountryData;return this.options.showSelectedDialCode&&!this.options.nationalMode&&this.telInput.value.charAt(0)!=="+"&&e.includes(`+${n}`)?(e.split(`+${n}`)[1]||"").trim():e}handleAutoCountry(){this.options.initialCountry==="auto"&&window.intlTelInputGlobals.autoCountry&&(this.defaultCountry=window.intlTelInputGlobals.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){window.intlTelInputUtils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let n=this.telInput.closest("label");n&&n.removeEventListener("click",this._handleLabelClick)}let{form:i}=this.telInput;this._handleHiddenInputSubmit&&i&&i.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let e=this.telInput.parentNode;e?.parentNode?.insertBefore(this.telInput,e),e?.parentNode?.removeChild(e),delete window.intlTelInputGlobals.instances[this.id]}getExtension(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber(i){if(window.intlTelInputUtils){let{iso2:e}=this.selectedCountryData;return window.intlTelInputUtils.formatNumber(this._getFullNumber(),e,i)}return""}getNumberType(){return window.intlTelInputUtils?window.intlTelInputUtils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(window.intlTelInputUtils){let{iso2:i}=this.selectedCountryData;return window.intlTelInputUtils.getValidationError(this._getFullNumber(),i)}return-99}isValidNumber(i=!0){let e=this._getFullNumber();return/\p{L}/u.test(e)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2,i):null}isValidNumberPrecise(){let i=this._getFullNumber();return/\p{L}/u.test(i)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isValidNumber(i,this.selectedCountryData.iso2):null}setCountry(i){let e=i.toLowerCase();this.selectedCountryData.iso2!==e&&(this._setCountry(e),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(i){let e=this._updateCountryFromNumber(i);this._updateValFromNumber(i),e&&this._triggerCountryChange()}setPlaceholderNumberType(i){this.options.placeholderNumberType=i,this._updatePlaceholder()}},P=(d,i,e)=>{let n=document.createElement("script");n.onload=()=>{f("handleUtils"),i&&i()},n.onerror=()=>{f("rejectUtilsScriptPromise"),e&&e()},n.className="iti-load-utils",n.async=!0,n.src=d,document.body.appendChild(n)},H=d=>!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript?(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise((i,e)=>P(d,i,e))):null;if(typeof window=="object"){let d={defaults:E,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:i=>{let e=i.getAttribute("data-intl-tel-input-id");return e?d.instances[e]:null},instances:{},loadUtils:H,version:"21.2.0"};window.intlTelInputGlobals=d}var z=(d,i)=>{let e=new v(d,i);return e._init(),d.setAttribute("data-intl-tel-input-id",e.id.toString()),window.intlTelInputGlobals.instances[e.id]=e,e},S=z;var R=({initialValue:d="",onChangeNumber:i=()=>{},onChangeCountry:e=()=>{},onChangeValidity:n=()=>{},onChangeErrorCode:s=()=>{},usePreciseValidation:o=!1,initOptions:a={},inputProps:u={}})=>{let l=k(null),r=k(null),p=()=>{let h=r.current?.getNumber()||"",c=r.current?.getSelectedCountryData().iso2||"";if(i(h),e(c),r.current)if(o?r.current.isValidNumberPrecise():r.current.isValidNumber())n(!0),s(null);else{let m=r.current.getValidationError();n(!1),s(m)}};return j(()=>{let h=l.current;return h&&(r.current=S(h,a),h.addEventListener("countrychange",p)),()=>{h&&h.removeEventListener("countrychange",p),r.current?.destroy()}},[]),U.createElement("input",{type:"tel",ref:l,onInput:p,defaultValue:d,...u})},Q=R;export{Q as default};
|
|
1
|
+
import U,{useRef as k,useEffect as j}from"react";var t={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var w=[[t.af,"af","93"],[t.al,"al","355"],[t.dz,"dz","213"],[t.as,"as","1",5,["684"]],[t.ad,"ad","376"],[t.ao,"ao","244"],[t.ai,"ai","1",6,["264"]],[t.ag,"ag","1",7,["268"]],[t.ar,"ar","54"],[t.am,"am","374"],[t.aw,"aw","297"],["Ascension Island","ac","247"],[t.au,"au","61",0],[t.at,"at","43"],[t.az,"az","994"],[t.bs,"bs","1",8,["242"]],[t.bh,"bh","973"],[t.bd,"bd","880"],[t.bb,"bb","1",9,["246"]],[t.by,"by","375"],[t.be,"be","32"],[t.bz,"bz","501"],[t.bj,"bj","229"],[t.bm,"bm","1",10,["441"]],[t.bt,"bt","975"],[t.bo,"bo","591"],[t.ba,"ba","387"],[t.bw,"bw","267"],[t.br,"br","55"],[t.io,"io","246"],[t.vg,"vg","1",11,["284"]],[t.bn,"bn","673"],[t.bg,"bg","359"],[t.bf,"bf","226"],[t.bi,"bi","257"],[t.kh,"kh","855"],[t.cm,"cm","237"],[t.ca,"ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905"]],[t.cv,"cv","238"],[t.bq,"bq","599",1,["3","4","7"]],[t.ky,"ky","1",12,["345"]],[t.cf,"cf","236"],[t.td,"td","235"],[t.cl,"cl","56"],[t.cn,"cn","86"],[t.cx,"cx","61",2,["89164"]],[t.cc,"cc","61",1,["89162"]],[t.co,"co","57"],[t.km,"km","269"],[t.cg,"cg","242"],[t.cd,"cd","243"],[t.ck,"ck","682"],[t.cr,"cr","506"],[t.ci,"ci","225"],[t.hr,"hr","385"],[t.cu,"cu","53"],[t.cw,"cw","599",0],[t.cy,"cy","357"],[t.cz,"cz","420"],[t.dk,"dk","45"],[t.dj,"dj","253"],[t.dm,"dm","1",13,["767"]],[t.do,"do","1",2,["809","829","849"]],[t.ec,"ec","593"],[t.eg,"eg","20"],[t.sv,"sv","503"],[t.gq,"gq","240"],[t.er,"er","291"],[t.ee,"ee","372"],[t.sz,"sz","268"],[t.et,"et","251"],[t.fk,"fk","500"],[t.fo,"fo","298"],[t.fj,"fj","679"],[t.fi,"fi","358",0],[t.fr,"fr","33"],[t.gf,"gf","594"],[t.pf,"pf","689"],[t.ga,"ga","241"],[t.gm,"gm","220"],[t.ge,"ge","995"],[t.de,"de","49"],[t.gh,"gh","233"],[t.gi,"gi","350"],[t.gr,"gr","30"],[t.gl,"gl","299"],[t.gd,"gd","1",14,["473"]],[t.gp,"gp","590",0],[t.gu,"gu","1",15,["671"]],[t.gt,"gt","502"],[t.gg,"gg","44",1,["1481","7781","7839","7911"]],[t.gn,"gn","224"],[t.gw,"gw","245"],[t.gy,"gy","592"],[t.ht,"ht","509"],[t.hn,"hn","504"],[t.hk,"hk","852"],[t.hu,"hu","36"],[t.is,"is","354"],[t.in,"in","91"],[t.id,"id","62"],[t.ir,"ir","98"],[t.iq,"iq","964"],[t.ie,"ie","353"],[t.im,"im","44",2,["1624","74576","7524","7924","7624"]],[t.il,"il","972"],[t.it,"it","39",0],[t.jm,"jm","1",4,["876","658"]],[t.jp,"jp","81"],[t.je,"je","44",3,["1534","7509","7700","7797","7829","7937"]],[t.jo,"jo","962"],[t.kz,"kz","7",1,["33","7"]],[t.ke,"ke","254"],[t.ki,"ki","686"],["Kosovo","xk","383"],[t.kw,"kw","965"],[t.kg,"kg","996"],[t.la,"la","856"],[t.lv,"lv","371"],[t.lb,"lb","961"],[t.ls,"ls","266"],[t.lr,"lr","231"],[t.ly,"ly","218"],[t.li,"li","423"],[t.lt,"lt","370"],[t.lu,"lu","352"],[t.mo,"mo","853"],[t.mg,"mg","261"],[t.mw,"mw","265"],[t.my,"my","60"],[t.mv,"mv","960"],[t.ml,"ml","223"],[t.mt,"mt","356"],[t.mh,"mh","692"],[t.mq,"mq","596"],[t.mr,"mr","222"],[t.mu,"mu","230"],[t.yt,"yt","262",1,["269","639"]],[t.mx,"mx","52"],[t.fm,"fm","691"],[t.md,"md","373"],[t.mc,"mc","377"],[t.mn,"mn","976"],[t.me,"me","382"],[t.ms,"ms","1",16,["664"]],[t.ma,"ma","212",0],[t.mz,"mz","258"],[t.mm,"mm","95"],[t.na,"na","264"],[t.nr,"nr","674"],[t.np,"np","977"],[t.nl,"nl","31"],[t.nc,"nc","687"],[t.nz,"nz","64"],[t.ni,"ni","505"],[t.ne,"ne","227"],[t.ng,"ng","234"],[t.nu,"nu","683"],[t.nf,"nf","672"],[t.kp,"kp","850"],[t.mk,"mk","389"],[t.mp,"mp","1",17,["670"]],[t.no,"no","47",0],[t.om,"om","968"],[t.pk,"pk","92"],[t.pw,"pw","680"],[t.ps,"ps","970"],[t.pa,"pa","507"],[t.pg,"pg","675"],[t.py,"py","595"],[t.pe,"pe","51"],[t.ph,"ph","63"],[t.pl,"pl","48"],[t.pt,"pt","351"],[t.pr,"pr","1",3,["787","939"]],[t.qa,"qa","974"],[t.re,"re","262",0],[t.ro,"ro","40"],[t.ru,"ru","7",0],[t.rw,"rw","250"],[t.ws,"ws","685"],[t.sm,"sm","378"],[t.st,"st","239"],[t.sa,"sa","966"],[t.sn,"sn","221"],[t.rs,"rs","381"],[t.sc,"sc","248"],[t.sl,"sl","232"],[t.sg,"sg","65"],[t.sx,"sx","1",21,["721"]],[t.sk,"sk","421"],[t.si,"si","386"],[t.sb,"sb","677"],[t.so,"so","252"],[t.za,"za","27"],[t.kr,"kr","82"],[t.ss,"ss","211"],[t.es,"es","34"],[t.lk,"lk","94"],[t.bl,"bl","590",1],[t.sh,"sh","290"],[t.kn,"kn","1",18,["869"]],[t.lc,"lc","1",19,["758"]],[t.mf,"mf","590",2],[t.pm,"pm","508"],[t.vc,"vc","1",20,["784"]],[t.sd,"sd","249"],[t.sr,"sr","597"],[t.sj,"sj","47",1,["79"]],[t.se,"se","46"],[t.ch,"ch","41"],[t.sy,"sy","963"],[t.tw,"tw","886"],[t.tj,"tj","992"],[t.tz,"tz","255"],[t.th,"th","66"],[t.tl,"tl","670"],[t.tg,"tg","228"],[t.tk,"tk","690"],[t.to,"to","676"],[t.tt,"tt","1",22,["868"]],[t.tn,"tn","216"],[t.tr,"tr","90"],[t.tm,"tm","993"],[t.tc,"tc","1",23,["649"]],[t.tv,"tv","688"],[t.ug,"ug","256"],[t.ua,"ua","380"],[t.ae,"ae","971"],[t.gb,"gb","44",0],[t.us,"us","1",0],[t.uy,"uy","598"],[t.vi,"vi","1",24,["340"]],[t.uz,"uz","998"],[t.vu,"vu","678"],[t.va,"va","39",1,["06698"]],[t.ve,"ve","58"],[t.vn,"vn","84"],[t.wf,"wf","681"],[t.eh,"eh","212",1,["5288","5289"]],[t.ye,"ye","967"],[t.zm,"zm","260"],[t.zw,"zw","263"],[t.ax,"ax","358",1,["18"]]],I=[];for(let d=0;d<w.length;d++){let i=w[d];I[d]={name:i[0],iso2:i[1],dialCode:i[2],priority:i[3]||0,areaCodes:i[4]||null,nodeById:{}}}var C=I;var _={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found"};var D=0,E={allowDropdown:!0,autoPlaceholder:"polite",countrySearch:!0,containerClass:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:[],showFlags:!0,showSelectedDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},A=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=d=>d.replace(/\D/g,""),L=(d="")=>d.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),N=(d,i,e)=>{e&&!d.classList.contains(i)?d.classList.add(i):!e&&d.classList.contains(i)&&d.classList.remove(i)},T=d=>{let i=b(d);if(i.charAt(0)==="1"){let e=i.substr(1,3);return A.indexOf(e)!==-1}return!1},M=(d,i)=>d.name<i.name?-1:d.name>i.name?1:0,x=(d,i,e,n)=>{if(e===0&&!n)return 0;let s=0;for(let o=0;o<i.length;o++){if(/[+0-9]/.test(i[o])&&s++,s===d&&!n)return o+1;if(n&&s===d+1)return o}return i.length},g=(d,i,e)=>{let n=document.createElement(d);return i&&Object.entries(i).forEach(([s,o])=>n.setAttribute(s,o)),e&&e.appendChild(n),n},f=d=>{let{instances:i}=window.intlTelInputGlobals;Object.values(i).forEach(e=>e[d]())},v=class{id;promise;telInput;activeItem;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;preferredCountries;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(i,e={}){this.id=D++,this.telInput=i,this.activeItem=null,this.highlightedItem=null,this.options=Object.assign({},E,e),this.hadInitialPlaceholder=!!i.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.countrySearch&&!this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!0);let i=this.options.allowDropdown&&!this.options.showSelectedDialCode;!this.options.showFlags&&i&&(this.options.showFlags=!0),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={..._,...this.options.i18n};let e=new Promise((s,o)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=o}),n=new Promise((s,o)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=o});this.promise=Promise.all([e,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._processPreferredCountries(),this._translateCountryNames(),(this.options.onlyCountries.length||this.options.i18n)&&this.countries.sort(M)}_addToDialCodeMap(i,e,n){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let o=0;o<this.dialCodeToIso2Map[e].length;o++)if(this.dialCodeToIso2Map[e][o]===i)return;let s=n!==void 0?n:this.dialCodeToIso2Map[e].length;this.dialCodeToIso2Map[e][s]=i}_processAllCountries(){let{onlyCountries:i,excludeCountries:e}=this.options;if(i.length){let n=i.map(s=>s.toLowerCase());this.countries=C.filter(s=>n.indexOf(s.iso2)>-1)}else if(e.length){let n=e.map(s=>s.toLowerCase());this.countries=C.filter(s=>n.indexOf(s.iso2)===-1)}else this.countries=C}_translateCountryNames(){for(let i=0;i<this.countries.length;i++){let e=this.countries[i].iso2.toLowerCase();this.options.i18n.hasOwnProperty(e)&&(this.countries[i].name=this.options.i18n[e])}}_processDialCodes(){this.dialCodes={},this.dialCodeMaxLen=0,this.dialCodeToIso2Map={};for(let i=0;i<this.countries.length;i++){let e=this.countries[i];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._addToDialCodeMap(e.iso2,e.dialCode,e.priority)}for(let i=0;i<this.countries.length;i++){let e=this.countries[i];if(e.areaCodes){let n=this.dialCodeToIso2Map[e.dialCode][0];for(let s=0;s<e.areaCodes.length;s++){let o=e.areaCodes[s];for(let a=1;a<o.length;a++){let u=e.dialCode+o.substr(0,a);this._addToDialCodeMap(n,u),this._addToDialCodeMap(e.iso2,u)}this._addToDialCodeMap(e.iso2,e.dialCode+o)}}}}_processPreferredCountries(){this.preferredCountries=[];for(let i=0;i<this.options.preferredCountries.length;i++){let e=this.options.preferredCountries[i].toLowerCase(),n=this._getCountryData(e,!0);n&&this.preferredCountries.push(n)}}_generateMarkup(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!(this.telInput.form&&this.telInput.form.hasAttribute("autocomplete"))&&this.telInput.setAttribute("autocomplete","off");let{allowDropdown:i,showSelectedDialCode:e,showFlags:n,containerClass:s,hiddenInput:o,dropdownContainer:a,fixDropdownWidth:u,useFullscreenPopup:l,countrySearch:r,i18n:p}=this.options,h="iti";i&&(h+=" iti--allow-dropdown"),e&&(h+=" iti--show-selected-dial-code"),n&&(h+=" iti--show-flags"),s&&(h+=` ${s}`),l||(h+=" iti--inline-dropdown");let c=g("div",{class:h});if(this.telInput.parentNode?.insertBefore(c,this.telInput),(n||e)&&(this.countryContainer=g("div",{class:"iti__country-container"},c),this.selectedCountry=g("button",{type:"button",class:"iti__selected-country",...i&&{"aria-expanded":"false","aria-label":this.options.i18n.selectedCountryAriaLabel,"aria-haspopup":r?"true":"listbox","aria-controls":r?`iti-${this.id}__dropdown-content`:`iti-${this.id}__country-listbox`,...r?{role:"combobox"}:{}}},this.countryContainer),this.selectedCountryInner=g("div",null,this.selectedCountry),this.selectedCountryA11yText=g("span",{class:"iti__a11y-text"},this.selectedCountryInner)),c.appendChild(this.telInput),this.selectedCountry&&this.telInput.disabled&&this.selectedCountry.setAttribute("aria-disabled","true"),e&&(this.selectedDialCode=g("div",{class:"iti__selected-dial-code"},this.selectedCountry)),i){this.telInput.disabled||this.selectedCountry.setAttribute("tabindex","0"),this.dropdownArrow=g("div",{class:"iti__arrow","aria-hidden":"true"},this.selectedCountry);let y=u?"":"iti--flexible-dropdown-width";if(this.dropdownContent=g("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${y}`}),r&&(this.searchInput=g("input",{type:"text",class:"iti__search-input",placeholder:p.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":p.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=g("span",{class:"iti__a11y-text"},this.dropdownContent)),this.countryList=g("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":p.countryListAriaLabel},this.dropdownContent),this.preferredCountries.length&&!r&&(this._appendListItems(this.preferredCountries,"iti__preferred",!0),g("li",{class:"iti__divider","aria-hidden":"true"},this.countryList)),this._appendListItems(this.countries,"iti__standard"),r&&this._updateSearchResultsText(),a){let m="iti iti--container";l?m+=" iti--fullscreen-popup":m+=" iti--inline-dropdown",r&&(m+=" iti--country-search"),this.dropdown=g("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}if(o){let y=this.telInput.getAttribute("name")||"",m=o(y);m.phone&&(this.hiddenInput=g("input",{type:"hidden",name:m.phone}),c.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=g("input",{type:"hidden",name:m.country}),c.appendChild(this.hiddenInputCountry))}}_appendListItems(i,e,n){for(let s=0;s<i.length;s++){let o=i[s],a=n?"-preferred":"",u=g("li",{id:`iti-${this.id}__item-${o.iso2}${a}`,class:`iti__country ${e}`,tabindex:"-1",role:"option","data-dial-code":o.dialCode,"data-country-code":o.iso2,"aria-selected":"false"},this.countryList);o.nodeById[this.id]=u;let l="";this.options.showFlags&&(l+=`<div class='iti__flag-box'><div class='iti__flag iti__${o.iso2}'></div></div>`),l+=`<span class='iti__country-name'>${o.name}</span>`,l+=`<span class='iti__dial-code'>+${o.dialCode}</span>`,u.insertAdjacentHTML("beforeend",l)}}_setInitialState(i=!1){let e=this.telInput.getAttribute("value"),n=this.telInput.value,o=e&&e.charAt(0)==="+"&&(!n||n.charAt(0)!=="+")?e:n,a=this._getDialCode(o),u=T(o),{initialCountry:l}=this.options;if(a&&!u)this._updateCountryFromNumber(o);else if(l!=="auto"||i){let r=l?l.toLowerCase():"";r&&this._getCountryData(r,!0)?this._setCountry(r):a&&u?this._setCountry("us"):this._setCountry()}o&&this._updateValFromNumber(o)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=e=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():e.preventDefault()};let i=this.telInput.closest("label");i&&i.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._openDropdown()),e.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{window.intlTelInputGlobals.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((i="")=>{let e=i.toLowerCase();e&&this._getCountryData(e,!0)?(window.intlTelInputGlobals.autoCountry=e,setTimeout(()=>f("handleAutoCountry"))):(this._setInitialState(!0),f("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),f("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:i,formatAsYouType:e}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let o=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(o||a&&!i?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),e&&!n){let u=this.telInput.selectionStart||0,r=this.telInput.value.substring(0,u).replace(/[^+0-9]/g,"").length,p=s&&s.inputType==="deleteContentForward",h=this._formatNumberAsYouType(),c=x(r,h,u,p);this.telInput.value=h,this.telInput.setSelectionRange(c,c)}},this.telInput.addEventListener("input",this._handleInputEvent),i&&(this._handleKeydownEvent=s=>{if(s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){let o=this.telInput.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=o||a,l=this._getFullNumber(),r=window.intlTelInputUtils.getCoreNumber(l,this.selectedCountryData.iso2),p=this.maxCoreNumberLength&&r.length>=this.maxCoreNumberLength;(!u||p)&&s.preventDefault()}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(i){let e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&i.length>e?i.substr(0,e):i}_trigger(i){let e=new Event(i,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}_openDropdown(){let{fixDropdownWidth:i,countrySearch:e}=this.options;if(i&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),this.activeItem&&!e)this._highlightListItem(this.activeItem,!1),this._scrollTo(this.activeItem,!0);else{let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),e&&this.searchInput.focus()}this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let i=this.telInput.getBoundingClientRect(),e=document.documentElement.scrollTop,n=i.top+e,s=this.dropdownContent.offsetHeight,o=n+this.telInput.offsetHeight+s<e+window.innerHeight,a=n-s>e,u=!this.options.countrySearch&&!o&&a;if(N(this.dropdownContent,"iti__dropdown-content--dropup",u),this.options.dropdownContainer){let l=u?0:this.telInput.offsetHeight;this.dropdown.style.top=`${n+l}px`,this.dropdown.style.left=`${i.left+document.body.scrollLeft}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll)}}}_bindDropdownListeners(){this._handleMouseoverCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._highlightListItem(o,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=s=>{let o=s.target?.closest(".iti__country");o&&this._selectListItem(o)},this.countryList.addEventListener("click",this._handleClickCountryList);let i=!0;this._handleClickOffToClose=()=>{i||this._closeDropdown(),i=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let e="",n=null;if(this._handleKeydownOnDropdown=s=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(s.key)&&(s.preventDefault(),s.stopPropagation(),s.key==="ArrowUp"||s.key==="ArrowDown"?this._handleUpDownKey(s.key):s.key==="Enter"?this._handleEnterKey():s.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(s.key)&&(s.stopPropagation(),n&&clearTimeout(n),e+=s.key.toLowerCase(),this._searchForCountry(e),n=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let s=()=>{let a=this.searchInput.value.trim();a?this._filterCountries(a):this._filterCountries("",!0)},o=null;this._handleSearchChange=()=>{o&&clearTimeout(o),o=setTimeout(()=>{s(),o=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",a=>a.stopPropagation())}}_filterCountries(i,e=!1){let n=!0;this.countryList.innerHTML="";let s=L(i);for(let o=0;o<this.countries.length;o++){let a=this.countries[o],u=L(a.name),l=`+${a.dialCode}`;if(e||u.includes(s)||l.includes(s)||a.iso2.includes(s)){let r=a.nodeById[this.id];r&&this.countryList.appendChild(r),n&&(this._highlightListItem(r,!1),n=!1)}}this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:i}=this.options,e=this.countryList.childElementCount,n;e===0?n=i.zeroSearchResults:e===1?n=i.oneSearchResult:n=i.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=n}_handleUpDownKey(i){let e=i==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;if(e?e.classList.contains("iti__divider")&&(e=i==="ArrowUp"?e.previousElementSibling:e.nextElementSibling):this.countryList.childElementCount>1&&(e=i==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e){this._scrollTo(e,!1);let n=!this.options.countrySearch;this._highlightListItem(e,n)}}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_searchForCountry(i){for(let e=0;e<this.countries.length;e++){let n=this.countries[e];if(n.name.substr(0,i.length).toLowerCase()===i){let o=n.nodeById[this.id];this._highlightListItem(o,!1),this._scrollTo(o,!0);break}}}_updateValFromNumber(i){let e=i;if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){let n=this.options.nationalMode||e.charAt(0)!=="+"&&!this.options.showSelectedDialCode,{NATIONAL:s,INTERNATIONAL:o}=window.intlTelInputUtils.numberFormat,a=n?s:o;e=window.intlTelInputUtils.formatNumber(e,this.selectedCountryData.iso2,a)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(i){let e=i.indexOf("+"),n=e?i.substring(e):i,s=this.selectedCountryData.dialCode;n&&s==="1"&&n.charAt(0)!=="+"&&(n.charAt(0)!=="1"&&(n=`1${n}`),n=`+${n}`),this.options.showSelectedDialCode&&s&&n.charAt(0)!=="+"&&(n=`+${s}${n}`);let a=this._getDialCode(n,!0),u=b(n),l=null;if(a){let r=this.dialCodeToIso2Map[b(a)],p=r.indexOf(this.selectedCountryData.iso2)!==-1&&u.length<=a.length-1;if(!(s==="1"&&T(u))&&!p){for(let c=0;c<r.length;c++)if(r[c]){l=r[c];break}}}else n.charAt(0)==="+"&&u.length?l="":(!n||n==="+")&&!this.selectedCountryData.iso2&&(l=this.defaultCountry);return l!==null?this._setCountry(l):!1}_highlightListItem(i,e){let n=this.highlightedItem;n&&(n.classList.remove("iti__highlight"),n.setAttribute("aria-selected","false")),this.highlightedItem=i,this.highlightedItem.classList.add("iti__highlight"),this.highlightedItem.setAttribute("aria-selected","true"),this.selectedCountry.setAttribute("aria-activedescendant",i.getAttribute("id")||""),this.options.countrySearch&&this.searchInput.setAttribute("aria-activedescendant",i.getAttribute("id")||""),e&&this.highlightedItem.focus()}_getCountryData(i,e){for(let n=0;n<this.countries.length;n++)if(this.countries[n].iso2===i)return this.countries[n];if(e)return null;throw new Error(`No country data for '${i}'`)}_setCountry(i){let{allowDropdown:e,showSelectedDialCode:n,showFlags:s,countrySearch:o,i18n:a}=this.options,u=this.selectedCountryData.iso2?this.selectedCountryData:{};if(this.selectedCountryData=i?this._getCountryData(i,!1)||{}:{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedCountryInner){let l="",r="";i?s&&(l=`iti__flag iti__${i}`,r=`${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`):(l="iti__flag iti__globe",r=a.noCountrySelected),this.selectedCountryInner.className=l,this.selectedCountryA11yText.textContent=r}if(this._setSelectedCountryTitleAttribute(i,n),n){let l=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.selectedDialCode.innerHTML=l;let r=this.selectedCountry.offsetWidth||this._getHiddenSelectedCountryWidth();this.isRTL?this.telInput.style.paddingRight=`${r+6}px`:this.telInput.style.paddingLeft=`${r+6}px`}if(this._updatePlaceholder(),this._updateMaxLength(),e&&!o){let l=this.activeItem;if(l&&(l.classList.remove("iti__active"),l.setAttribute("aria-selected","false")),i){let r=this.countryList.querySelector(`#iti-${this.id}__item-${i}-preferred`)||this.countryList.querySelector(`#iti-${this.id}__item-${i}`);r&&(r.setAttribute("aria-selected","true"),r.classList.add("iti__active"),this.activeItem=r)}}return u.iso2!==i}_updateMaxLength(){if(this.options.strictMode&&window.intlTelInputUtils)if(this.selectedCountryData.iso2){let i=window.intlTelInputUtils.numberType[this.options.placeholderNumberType],e=window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,!1,i,!0),n=e;for(;window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2);)n=e,e+="0";let s=window.intlTelInputUtils.getCoreNumber(n,this.selectedCountryData.iso2);this.maxCoreNumberLength=s.length}else this.maxCoreNumberLength=null}_setSelectedCountryTitleAttribute(i=null,e){if(!this.selectedCountry)return;let n;i&&!e?n=`${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}`:i?n=this.selectedCountryData.name:n="Unknown",this.selectedCountry.setAttribute("title",n)}_getHiddenSelectedCountryWidth(){if(this.telInput.parentNode){let i=this.telInput.parentNode.cloneNode(!1);i.style.visibility="hidden",document.body.appendChild(i);let e=this.countryContainer.cloneNode();i.appendChild(e);let n=this.selectedCountry.cloneNode(!0);e.appendChild(n);let s=n.offsetWidth;return document.body.removeChild(i),s}return 0}_updatePlaceholder(){let{autoPlaceholder:i,placeholderNumberType:e,nationalMode:n,customPlaceholder:s}=this.options,o=i==="aggressive"||!this.hadInitialPlaceholder&&i==="polite";if(window.intlTelInputUtils&&o){let a=window.intlTelInputUtils.numberType[e],u=this.selectedCountryData.iso2?window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,n,a):"";u=this._beforeSetNumber(u),typeof s=="function"&&(u=s(u,this.selectedCountryData)),this.telInput.setAttribute("placeholder",u)}}_selectListItem(i){let e=this._setCountry(i.getAttribute("data-country-code"));this._closeDropdown(),this._updateDialCode(i.getAttribute("data-dial-code")),this.telInput.focus(),e&&this._triggerCountryChange()}_closeDropdown(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.highlightedItem&&this.highlightedItem.setAttribute("aria-selected","false"),this.options.countrySearch&&this.searchInput.removeAttribute("aria-activedescendant"),this.dropdownArrow.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch&&this.searchInput.removeEventListener("input",this._handleSearchChange),document.documentElement.removeEventListener("click",this._handleClickOffToClose),this.countryList.removeEventListener("mouseover",this._handleMouseoverCountryList),this.countryList.removeEventListener("click",this._handleClickCountryList),this.options.dropdownContainer&&(this.options.useFullscreenPopup||window.removeEventListener("scroll",this._handleWindowScroll),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_scrollTo(i,e){let n=this.countryList,s=document.documentElement.scrollTop,o=n.offsetHeight,a=n.getBoundingClientRect().top+s,u=a+o,l=i.offsetHeight,r=i.getBoundingClientRect().top+s,p=r+l,h=r-a+n.scrollTop,c=o/2-l/2;if(r<a)e&&(h-=c),n.scrollTop=h;else if(p>u){e&&(h+=c);let y=o-l;n.scrollTop=h-y}}_updateDialCode(i){let e=this.telInput.value,n=`+${i}`,s;if(e.charAt(0)==="+"){let o=this._getDialCode(e);o?s=e.replace(o,n):s=n,this.telInput.value=s}}_getDialCode(i,e){let n="";if(i.charAt(0)==="+"){let s="";for(let o=0;o<i.length;o++){let a=i.charAt(o);if(!isNaN(parseInt(a,10))){if(s+=a,e)this.dialCodeToIso2Map[s]&&(n=i.substr(0,o+1));else if(this.dialCodes[s]){n=i.substr(0,o+1);break}if(s.length===this.dialCodeMaxLen)break}}}return n}_getFullNumber(){let i=this.telInput.value.trim(),{dialCode:e}=this.selectedCountryData,n,s=b(i);return this.options.showSelectedDialCode&&!this.options.nationalMode&&i.charAt(0)!=="+"&&e&&s?n=`+${e}`:n="",n+i}_beforeSetNumber(i){let e=i;if(this.options.showSelectedDialCode){let n=this._getDialCode(e);if(n){n=`+${this.selectedCountryData.dialCode}`;let s=e[n.length]===" "||e[n.length]==="-"?n.length+1:n.length;e=e.substr(s)}}return this._cap(e)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let i=this._getFullNumber(),e=window.intlTelInputUtils?window.intlTelInputUtils.formatNumberAsYouType(i,this.selectedCountryData.iso2):i,{dialCode:n}=this.selectedCountryData;return this.options.showSelectedDialCode&&!this.options.nationalMode&&this.telInput.value.charAt(0)!=="+"&&e.includes(`+${n}`)?(e.split(`+${n}`)[1]||"").trim():e}handleAutoCountry(){this.options.initialCountry==="auto"&&window.intlTelInputGlobals.autoCountry&&(this.defaultCountry=window.intlTelInputGlobals.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){window.intlTelInputUtils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let n=this.telInput.closest("label");n&&n.removeEventListener("click",this._handleLabelClick)}let{form:i}=this.telInput;this._handleHiddenInputSubmit&&i&&i.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let e=this.telInput.parentNode;e?.parentNode?.insertBefore(this.telInput,e),e?.parentNode?.removeChild(e),delete window.intlTelInputGlobals.instances[this.id]}getExtension(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber(i){if(window.intlTelInputUtils){let{iso2:e}=this.selectedCountryData;return window.intlTelInputUtils.formatNumber(this._getFullNumber(),e,i)}return""}getNumberType(){return window.intlTelInputUtils?window.intlTelInputUtils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(window.intlTelInputUtils){let{iso2:i}=this.selectedCountryData;return window.intlTelInputUtils.getValidationError(this._getFullNumber(),i)}return-99}isValidNumber(i=!0){let e=this._getFullNumber();return/\p{L}/u.test(e)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isPossibleNumber(e,this.selectedCountryData.iso2,i):null}isValidNumberPrecise(){let i=this._getFullNumber();return/\p{L}/u.test(i)?!1:window.intlTelInputUtils?window.intlTelInputUtils.isValidNumber(i,this.selectedCountryData.iso2):null}setCountry(i){let e=i.toLowerCase();this.selectedCountryData.iso2!==e&&(this._setCountry(e),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(i){let e=this._updateCountryFromNumber(i);this._updateValFromNumber(i),e&&this._triggerCountryChange()}setPlaceholderNumberType(i){this.options.placeholderNumberType=i,this._updatePlaceholder()}},P=(d,i,e)=>{let n=document.createElement("script");n.onload=()=>{f("handleUtils"),i&&i()},n.onerror=()=>{f("rejectUtilsScriptPromise"),e&&e()},n.className="iti-load-utils",n.async=!0,n.src=d,document.body.appendChild(n)},H=d=>!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript?(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise((i,e)=>P(d,i,e))):null;if(typeof window=="object"){let d={defaults:E,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:i=>{let e=i.getAttribute("data-intl-tel-input-id");return e?d.instances[e]:null},instances:{},loadUtils:H,version:"21.2.1"};window.intlTelInputGlobals=d}var z=(d,i)=>{let e=new v(d,i);return e._init(),d.setAttribute("data-intl-tel-input-id",e.id.toString()),window.intlTelInputGlobals.instances[e.id]=e,e},S=z;var R=({initialValue:d="",onChangeNumber:i=()=>{},onChangeCountry:e=()=>{},onChangeValidity:n=()=>{},onChangeErrorCode:s=()=>{},usePreciseValidation:o=!1,initOptions:a={},inputProps:u={}})=>{let l=k(null),r=k(null),p=()=>{let h=r.current?.getNumber()||"",c=r.current?.getSelectedCountryData().iso2||"";if(i(h),e(c),r.current)if(o?r.current.isValidNumberPrecise():r.current.isValidNumber())n(!0),s(null);else{let m=r.current.getValidationError();n(!1),s(m)}};return j(()=>{let h=l.current;return h&&(r.current=S(h,a),h.addEventListener("countrychange",p)),()=>{h&&h.removeEventListener("countrychange",p),r.current?.destroy()}},[]),U.createElement("input",{type:"tel",ref:l,onInput:p,defaultValue:d,...u})},Q=R;export{Q as default};
|