diff --git a/build/js/intlTelInput.js b/build/js/intlTelInput.js index 145e87618..0e3c06abc 100644 --- a/build/js/intlTelInput.js +++ b/build/js/intlTelInput.js @@ -1763,6 +1763,9 @@ var factoryOutput = (() => { if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; diff --git a/build/js/intlTelInput.min.js b/build/js/intlTelInput.min.js index 7e47828b1..d213beda9 100644 --- a/build/js/intlTelInput.min.js +++ b/build/js/intlTelInput.min.js @@ -13,7 +13,7 @@ } }(() => { -var factoryOutput=(()=>{var I=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var O=(l,t)=>{for(var e in t)I(l,e,{get:t[e],enumerable:!0})},H=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of P(t))!x.call(l,n)&&n!==e&&I(l,n,{get:()=>t[n],enumerable:!(i=M(t,n))||i.enumerable});return l};var R=l=>H(I({},"__esModule",{value:!0}),l);var G={};O(G,{Iti:()=>_,default:()=>$});var T=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],E=[];for(let l=0;ll.replace(/\D/g,""),A=(l="")=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),S=l=>{let t=v(l);if(t.charAt(0)==="1"){let e=t.substr(1,3);return K.indexOf(e)!==-1}return!1},U=(l,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(l);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=l=>{let{instances:t}=a;Object.values(t).forEach(e=>e[l]())},_=class{constructor(t,e={}){this.id=j++,this.a=t,this.c=null,this.d=Object.assign({},k,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.separateDialCode&&(this.d.allowDropdown=!0,this.d.nationalMode=!1,this.d.countrySearch=!0),this.d.allowDropdown&&!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.a.style.paddingRight:this.originalPaddingLeft=this.a.style.paddingLeft),this.d.i18n={...w,...this.d.i18n};let t=new Promise((i,n)=>{this.h=i,this.i=n}),e=new Promise((i,n)=>{this.i0=i,this.i1=n});this.promise=Promise.all([t,e]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this._sortCountries()}_sortCountries(){this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),r=n>-1,o=s>-1;if(r||o)return r&&o?n-s:r?-1:1}return t.name.localeCompare(e.name)})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;sn.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=f}_d0(){for(let t=0;t`),s+=`${e.name}`,s+=`+${e.dialCode}`,n.insertAdjacentHTML("beforeend",s)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,r=this._5(s),o=S(s),{initialCountry:u,geoIpLookup:c}=this.d,d=u==="auto"&&c;if(r&&!o)this._v(s);else if(!d||t){let h=u?u.toLowerCase():"";h&&this._y(h,!0)?this._z(h):r&&o?this._z("us"):this._z()}s&&this._u(s)}_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=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.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=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{utilsScript:t,initialCountry:e,geoIpLookup:i}=this.d;t&&!a.utils?a.documentReady()?a.loadUtils(t):window.addEventListener("load",()=>{a.loadUtils(t)}):this.i0(),e==="auto"&&i&&!this.s.iso2?this._i4():this.h()}_i4(){a.autoCountry?this.handleAutoCountry():a.startedLoadingAutoCountry||(a.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(a.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._h(!0),b("rejectAutoCountryPromise"))},()=>{this._h(!0),b("rejectAutoCountryPromise")}))}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n}=this.d,s=!1;/\p{L}/u.test(this.a.value)&&(s=!0);let r=()=>{this._n(),this.searchInput.value="+",this._p3("",!0)};this._a12=o=>{if(this.isAndroid&&o?.data==="+"&&i){let h=this.a.selectionStart||0,m=this.a.value.substring(0,h-1),C=this.a.value.substring(h);this.a.value=m+C,r();return}this._v(this.a.value)&&this._8();let u=o?.data&&/[^+0-9]/.test(o.data),c=o?.inputType==="insertFromPaste"&&this.a.value;u||c&&!t?s=!0:/[^+0-9]/.test(this.a.value)||(s=!1);let d=o?.detail&&o.detail.isSetNumber&&!n;if(e&&!s&&!d){let h=this.a.selectionStart||0,C=this.a.value.substring(0,h).replace(/[^+0-9]/g,"").length,g=o?.inputType==="deleteContentForward",y=this._9(),L=U(C,y,h,g);this.a.value=y,this.a.setSelectionRange(L,L)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=o=>{if(o.key&&o.key.length===1&&!o.altKey&&!o.ctrlKey&&!o.metaKey){if(i&&o.key==="+"){o.preventDefault(),r();return}if(t){let u=this.a.selectionStart===0&&o.key==="+",c=/^[0-9]$/.test(o.key),d=u||c,h=this._6(),m=a.utils.getCoreNumber(h,this.s.iso2),C=this.maxCoreNumberLength&&m.length>=this.maxCoreNumberLength,g=this.a.value.substring(this.a.selectionStart,this.a.selectionEnd),y=/\d/.test(g);(!d||C&&!y)&&o.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t,countrySearch:e}=this.d;if(t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),e){let i=this.countryList.firstElementChild;i&&(this._x(i,!1),this.countryList.scrollTop=0),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 t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2);let e="",i=null;if(this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let n=()=>{let r=this.searchInput.value.trim();r?this._p3(r):this._p3("",!0)},s=null;this._a7=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",r=>r.stopPropagation())}}_searchForCountry(t){for(let e=0;ed[0]).join("").toLowerCase(),c=`+${r.dialCode}`;if(e||o.includes(n)||c.includes(n)||r.iso2.includes(n)||u.includes(n)){let d=r.nodeById[this.id];d&&this.countryList.appendChild(d),i&&(this._x(d,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&a.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=a.utils.numberFormat,r=i?n:s;e=a.utils.formatNumber(e,this.s.iso2,r)}e=this._7(e),this.a.value=e}_v(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._5(i,!0),o=v(i),u=null;if(r){let c=this.q[v(r)],d=c.indexOf(this.s.iso2)!==-1&&o.length<=r.length-1;if(!(n==="1"&&S(o))&&!d){for(let m=0;mr){let h=n-o;e.scrollTop=d-h}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s-1){let i=t.substring(0,e),n=this._utilsIsPossibleNumber(i),s=this._utilsIsPossibleNumber(t);return n&&s}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return a.utils?a.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsValidNumber(i),s=this._utilsIsValidNumber(t);return n&&s}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return a.utils?a.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}setDisabled(t){this.a.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},V=l=>!a.utils&&!a.startedLoadingUtilsScript?(a.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(/* webpackIgnore: true */ l).then(({default:i})=>{a.utils=i,b("handleUtils"),t(!0)}).catch(()=>{b("rejectUtilsScriptPromise"),e()})})):null,a=Object.assign((l,t)=>{let e=new _(l,t);return e._init(),l.setAttribute("data-intl-tel-input-id",e.id.toString()),a.instances[e.id]=e,e},{defaults:k,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:l=>{let t=l.getAttribute("data-intl-tel-input-id");return t?a.instances[t]:null},instances:{},loadUtils:V,version:"24.2.1"}),$=a;return R(G);})(); +var factoryOutput=(()=>{var I=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var O=(l,t)=>{for(var e in t)I(l,e,{get:t[e],enumerable:!0})},H=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of P(t))!x.call(l,n)&&n!==e&&I(l,n,{get:()=>t[n],enumerable:!(i=M(t,n))||i.enumerable});return l};var R=l=>H(I({},"__esModule",{value:!0}),l);var G={};O(G,{Iti:()=>_,default:()=>$});var T=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],E=[];for(let l=0;ll.replace(/\D/g,""),A=(l="")=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),S=l=>{let t=v(l);if(t.charAt(0)==="1"){let e=t.substr(1,3);return K.indexOf(e)!==-1}return!1},U=(l,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(l);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=l=>{let{instances:t}=a;Object.values(t).forEach(e=>e[l]())},_=class{constructor(t,e={}){this.id=j++,this.a=t,this.c=null,this.d=Object.assign({},k,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.onlyCountries.length===1&&(this.d.initialCountry=this.d.onlyCountries[0]),this.d.separateDialCode&&(this.d.allowDropdown=!0,this.d.nationalMode=!1,this.d.countrySearch=!0),this.d.allowDropdown&&!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.a.style.paddingRight:this.originalPaddingLeft=this.a.style.paddingLeft),this.d.i18n={...w,...this.d.i18n};let t=new Promise((i,n)=>{this.h=i,this.i=n}),e=new Promise((i,n)=>{this.i0=i,this.i1=n});this.promise=Promise.all([t,e]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this._sortCountries()}_sortCountries(){this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),r=n>-1,o=s>-1;if(r||o)return r&&o?n-s:r?-1:1}return t.name.localeCompare(e.name)})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;sn.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=f}_d0(){for(let t=0;t`),s+=`${e.name}`,s+=`+${e.dialCode}`,n.insertAdjacentHTML("beforeend",s)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,r=this._5(s),o=S(s),{initialCountry:u,geoIpLookup:c}=this.d,d=u==="auto"&&c;if(r&&!o)this._v(s);else if(!d||t){let h=u?u.toLowerCase():"";h&&this._y(h,!0)?this._z(h):r&&o?this._z("us"):this._z()}s&&this._u(s)}_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=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.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=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{utilsScript:t,initialCountry:e,geoIpLookup:i}=this.d;t&&!a.utils?a.documentReady()?a.loadUtils(t):window.addEventListener("load",()=>{a.loadUtils(t)}):this.i0(),e==="auto"&&i&&!this.s.iso2?this._i4():this.h()}_i4(){a.autoCountry?this.handleAutoCountry():a.startedLoadingAutoCountry||(a.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(a.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._h(!0),b("rejectAutoCountryPromise"))},()=>{this._h(!0),b("rejectAutoCountryPromise")}))}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n}=this.d,s=!1;/\p{L}/u.test(this.a.value)&&(s=!0);let r=()=>{this._n(),this.searchInput.value="+",this._p3("",!0)};this._a12=o=>{if(this.isAndroid&&o?.data==="+"&&i){let h=this.a.selectionStart||0,m=this.a.value.substring(0,h-1),C=this.a.value.substring(h);this.a.value=m+C,r();return}this._v(this.a.value)&&this._8();let u=o?.data&&/[^+0-9]/.test(o.data),c=o?.inputType==="insertFromPaste"&&this.a.value;u||c&&!t?s=!0:/[^+0-9]/.test(this.a.value)||(s=!1);let d=o?.detail&&o.detail.isSetNumber&&!n;if(e&&!s&&!d){let h=this.a.selectionStart||0,C=this.a.value.substring(0,h).replace(/[^+0-9]/g,"").length,g=o?.inputType==="deleteContentForward",y=this._9(),L=U(C,y,h,g);this.a.value=y,this.a.setSelectionRange(L,L)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=o=>{if(o.key&&o.key.length===1&&!o.altKey&&!o.ctrlKey&&!o.metaKey){if(i&&o.key==="+"){o.preventDefault(),r();return}if(t){let u=this.a.selectionStart===0&&o.key==="+",c=/^[0-9]$/.test(o.key),d=u||c,h=this._6(),m=a.utils.getCoreNumber(h,this.s.iso2),C=this.maxCoreNumberLength&&m.length>=this.maxCoreNumberLength,g=this.a.value.substring(this.a.selectionStart,this.a.selectionEnd),y=/\d/.test(g);(!d||C&&!y)&&o.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t,countrySearch:e}=this.d;if(t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o(),e){let i=this.countryList.firstElementChild;i&&(this._x(i,!1),this.countryList.scrollTop=0),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 t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2);let e="",i=null;if(this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2()),!this.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key)&&(n.stopPropagation(),i&&clearTimeout(i),e+=n.key.toLowerCase(),this._searchForCountry(e),i=setTimeout(()=>{e=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){let n=()=>{let r=this.searchInput.value.trim();r?this._p3(r):this._p3("",!0)},s=null;this._a7=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",r=>r.stopPropagation())}}_searchForCountry(t){for(let e=0;ed[0]).join("").toLowerCase(),c=`+${r.dialCode}`;if(e||o.includes(n)||c.includes(n)||r.iso2.includes(n)||u.includes(n)){let d=r.nodeById[this.id];d&&this.countryList.appendChild(d),i&&(this._x(d,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&a.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=a.utils.numberFormat,r=i?n:s;e=a.utils.formatNumber(e,this.s.iso2,r)}e=this._7(e),this.a.value=e}_v(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._5(i,!0),o=v(i),u=null;if(r){let c=this.q[v(r)],d=c.indexOf(this.s.iso2)!==-1&&o.length<=r.length-1;if(!(n==="1"&&S(o))&&!d){for(let m=0;mr){let h=n-o;e.scrollTop=d-h}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s-1){let i=t.substring(0,e),n=this._utilsIsPossibleNumber(i),s=this._utilsIsPossibleNumber(t);return n&&s}return this._utilsIsPossibleNumber(t)}_utilsIsPossibleNumber(t){return a.utils?a.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){let t=this._6(),e=t.search(/\p{L}/u);if(e>-1){let i=t.substring(0,e),n=this._utilsIsValidNumber(i),s=this._utilsIsValidNumber(t);return n&&s}return this._utilsIsValidNumber(t)}_utilsIsValidNumber(t){return a.utils?a.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}setDisabled(t){this.a.disabled=t,t?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},V=l=>!a.utils&&!a.startedLoadingUtilsScript?(a.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(/* webpackIgnore: true */ l).then(({default:i})=>{a.utils=i,b("handleUtils"),t(!0)}).catch(()=>{b("rejectUtilsScriptPromise"),e()})})):null,a=Object.assign((l,t)=>{let e=new _(l,t);return e._init(),l.setAttribute("data-intl-tel-input-id",e.id.toString()),a.instances[e.id]=e,e},{defaults:k,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:l=>{let t=l.getAttribute("data-intl-tel-input-id");return t?a.instances[t]:null},instances:{},loadUtils:V,version:"24.2.1"}),$=a;return R(G);})(); // UMD return factoryOutput.default; diff --git a/build/js/intlTelInputWithUtils.js b/build/js/intlTelInputWithUtils.js index 10b60aee5..430ce270d 100644 --- a/build/js/intlTelInputWithUtils.js +++ b/build/js/intlTelInputWithUtils.js @@ -1762,6 +1762,9 @@ var factoryOutput = (() => { if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -3054,7 +3057,7 @@ var factoryOutput = (() => { if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) { intlTelInput.startedLoadingUtilsScript = true; return new Promise((resolve, reject) => { - import( + import_INTENTIONALLY_BROKEN( /* webpackIgnore: true */ /* @vite-ignore */ path diff --git a/build/js/intlTelInputWithUtils.min.js b/build/js/intlTelInputWithUtils.min.js index 6c9f96501..8246f0b33 100644 --- a/build/js/intlTelInputWithUtils.min.js +++ b/build/js/intlTelInputWithUtils.min.js @@ -13,7 +13,7 @@ } }(() => { -var factoryOutput=(()=>{var C1=Object.defineProperty;var D2=Object.getOwnPropertyDescriptor;var x2=Object.getOwnPropertyNames;var P2=Object.prototype.hasOwnProperty;var R2=(C,e)=>{for(var n in e)C1(C,n,{get:e[n],enumerable:!0})},O2=(C,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of x2(e))!P2.call(C,u)&&u!==n&&C1(C,u,{get:()=>e[u],enumerable:!(r=D2(e,u))||r.enumerable});return C};var k2=C=>O2(C1({},"__esModule",{value:!0}),C);var z2={};R2(z2,{default:()=>W2});var $2=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],n2=[];for(let C=0;C<$2.length;C++){let e=$2[C];n2[C]={name:"",iso2:e[0],dialCode:e[1],priority:e[2]||0,areaCodes:e[3]||null,nodeById:{}}}var K=n2;var B2={ad:"Andorra",ae:"United Arab Emirates",af:"Afghanistan",ag:"Antigua & Barbuda",ai:"Anguilla",al:"Albania",am:"Armenia",ao:"Angola",ar:"Argentina",as:"American Samoa",at:"Austria",au:"Australia",aw:"Aruba",ax:"\xC5land Islands",az:"Azerbaijan",ba:"Bosnia & Herzegovina",bb:"Barbados",bd:"Bangladesh",be:"Belgium",bf:"Burkina Faso",bg:"Bulgaria",bh:"Bahrain",bi:"Burundi",bj:"Benin",bl:"St. Barth\xE9lemy",bm:"Bermuda",bn:"Brunei",bo:"Bolivia",bq:"Caribbean Netherlands",br:"Brazil",bs:"Bahamas",bt:"Bhutan",bw:"Botswana",by:"Belarus",bz:"Belize",ca:"Canada",cc:"Cocos (Keeling) Islands",cd:"Congo - Kinshasa",cf:"Central African Republic",cg:"Congo - Brazzaville",ch:"Switzerland",ci:"C\xF4te d\u2019Ivoire",ck:"Cook Islands",cl:"Chile",cm:"Cameroon",cn:"China",co:"Colombia",cr:"Costa Rica",cu:"Cuba",cv:"Cape Verde",cw:"Cura\xE7ao",cx:"Christmas Island",cy:"Cyprus",cz:"Czechia",de:"Germany",dj:"Djibouti",dk:"Denmark",dm:"Dominica",do:"Dominican Republic",dz:"Algeria",ec:"Ecuador",ee:"Estonia",eg:"Egypt",eh:"Western Sahara",er:"Eritrea",es:"Spain",et:"Ethiopia",fi:"Finland",fj:"Fiji",fk:"Falkland Islands",fm:"Micronesia",fo:"Faroe Islands",fr:"France",ga:"Gabon",gb:"United Kingdom",gd:"Grenada",ge:"Georgia",gf:"French Guiana",gg:"Guernsey",gh:"Ghana",gi:"Gibraltar",gl:"Greenland",gm:"Gambia",gn:"Guinea",gp:"Guadeloupe",gq:"Equatorial Guinea",gr:"Greece",gt:"Guatemala",gu:"Guam",gw:"Guinea-Bissau",gy:"Guyana",hk:"Hong Kong SAR China",hn:"Honduras",hr:"Croatia",ht:"Haiti",hu:"Hungary",id:"Indonesia",ie:"Ireland",il:"Israel",im:"Isle of Man",in:"India",io:"British Indian Ocean Territory",iq:"Iraq",ir:"Iran",is:"Iceland",it:"Italy",je:"Jersey",jm:"Jamaica",jo:"Jordan",jp:"Japan",ke:"Kenya",kg:"Kyrgyzstan",kh:"Cambodia",ki:"Kiribati",km:"Comoros",kn:"St. Kitts & Nevis",kp:"North Korea",kr:"South Korea",kw:"Kuwait",ky:"Cayman Islands",kz:"Kazakhstan",la:"Laos",lb:"Lebanon",lc:"St. Lucia",li:"Liechtenstein",lk:"Sri Lanka",lr:"Liberia",ls:"Lesotho",lt:"Lithuania",lu:"Luxembourg",lv:"Latvia",ly:"Libya",ma:"Morocco",mc:"Monaco",md:"Moldova",me:"Montenegro",mf:"St. Martin",mg:"Madagascar",mh:"Marshall Islands",mk:"North Macedonia",ml:"Mali",mm:"Myanmar (Burma)",mn:"Mongolia",mo:"Macao SAR China",mp:"Northern Mariana Islands",mq:"Martinique",mr:"Mauritania",ms:"Montserrat",mt:"Malta",mu:"Mauritius",mv:"Maldives",mw:"Malawi",mx:"Mexico",my:"Malaysia",mz:"Mozambique",na:"Namibia",nc:"New Caledonia",ne:"Niger",nf:"Norfolk Island",ng:"Nigeria",ni:"Nicaragua",nl:"Netherlands",no:"Norway",np:"Nepal",nr:"Nauru",nu:"Niue",nz:"New Zealand",om:"Oman",pa:"Panama",pe:"Peru",pf:"French Polynesia",pg:"Papua New Guinea",ph:"Philippines",pk:"Pakistan",pl:"Poland",pm:"St. Pierre & Miquelon",pr:"Puerto Rico",ps:"Palestinian Territories",pt:"Portugal",pw:"Palau",py:"Paraguay",qa:"Qatar",re:"R\xE9union",ro:"Romania",rs:"Serbia",ru:"Russia",rw:"Rwanda",sa:"Saudi Arabia",sb:"Solomon Islands",sc:"Seychelles",sd:"Sudan",se:"Sweden",sg:"Singapore",sh:"St. Helena",si:"Slovenia",sj:"Svalbard & Jan Mayen",sk:"Slovakia",sl:"Sierra Leone",sm:"San Marino",sn:"Senegal",so:"Somalia",sr:"Suriname",ss:"South Sudan",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sv:"El Salvador",sx:"Sint Maarten",sy:"Syria",sz:"Eswatini",tc:"Turks & Caicos Islands",td:"Chad",tg:"Togo",th:"Thailand",tj:"Tajikistan",tk:"Tokelau",tl:"Timor-Leste",tm:"Turkmenistan",tn:"Tunisia",to:"Tonga",tr:"Turkey",tt:"Trinidad & Tobago",tv:"Tuvalu",tw:"Taiwan",tz:"Tanzania",ua:"Ukraine",ug:"Uganda",us:"United States",uy:"Uruguay",uz:"Uzbekistan",va:"Vatican City",vc:"St. Vincent & Grenadines",ve:"Venezuela",vg:"British Virgin Islands",vi:"U.S. Virgin Islands",vn:"Vietnam",vu:"Vanuatu",wf:"Wallis & Futuna",ws:"Samoa",ye:"Yemen",yt:"Mayotte",za:"South Africa",zm:"Zambia",zw:"Zimbabwe"},i2=B2;var G2={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",ac:"Ascension Island",xk:"Kosovo"},r2=G2;var H2={...i2,...r2},y1=H2;for(let C=0;CC.replace(/\D/g,""),o2=(C="")=>C.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),s2=C=>{let e=h1(C);if(e.charAt(0)==="1"){let n=e.substr(1,3);return F2.indexOf(n)!==-1}return!1},K2=(C,e,n,r)=>{if(n===0&&!r)return 0;let u=0;for(let l=0;l{let r=document.createElement(C);return e&&Object.entries(e).forEach(([u,l])=>r.setAttribute(u,l)),n&&n.appendChild(r),r},t1=C=>{let{instances:e}=m;Object.values(e).forEach(n=>n[C]())},v1=class{constructor(e,n={}){this.id=U2++,this.telInput=e,this.highlightedItem=null,this.options=Object.assign({},u2,n),this.hadInitialPlaceholder=!!e.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1,this.options.countrySearch=!0),this.options.allowDropdown&&!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.telInput.style.paddingRight:this.originalPaddingLeft=this.telInput.style.paddingLeft),this.options.i18n={...y1,...this.options.i18n};let e=new Promise((r,u)=>{this.resolveAutoCountryPromise=r,this.rejectAutoCountryPromise=u}),n=new Promise((r,u)=>{this.resolveUtilsScriptPromise=r,this.rejectUtilsScriptPromise=u});this.promise=Promise.all([e,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this._sortCountries()}_sortCountries(){this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(e=>e.toLowerCase())),this.countries.sort((e,n)=>{let{countryOrder:r}=this.options;if(r){let u=r.indexOf(e.iso2),l=r.indexOf(n.iso2),f=u>-1,p=l>-1;if(f||p)return f&&p?u-l:f?-1:1}return e.name.localeCompare(n.name)})}_addToDialCodeMap(e,n,r){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let l=0;lu.toLowerCase());this.countries=K.filter(u=>r.indexOf(u.iso2)>-1)}else if(n.length){let r=n.map(u=>u.toLowerCase());this.countries=K.filter(u=>r.indexOf(u.iso2)===-1)}else this.countries=K}_translateCountryNames(){for(let e=0;e`),l+=`${n.name}`,l+=`+${n.dialCode}`,u.insertAdjacentHTML("beforeend",l)}}_setInitialState(e=!1){let n=this.telInput.getAttribute("value"),r=this.telInput.value,l=n&&n.charAt(0)==="+"&&(!r||r.charAt(0)!=="+")?n:r,f=this._getDialCode(l),p=s2(l),{initialCountry:v,geoIpLookup:S}=this.options,I=v==="auto"&&S;if(f&&!p)this._updateCountryFromNumber(l);else if(!I||e){let _=v?v.toLowerCase():"";_&&this._getCountryData(_,!0)?this._setCountry(_):f&&p?this._setCountry("us"):this._setCountry()}l&&this._updateValFromNumber(l)}_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=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let e=this.telInput.closest("label");e&&e.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=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){let{utilsScript:e,initialCountry:n,geoIpLookup:r}=this.options;e&&!m.utils?m.documentReady()?m.loadUtils(e):window.addEventListener("load",()=>{m.loadUtils(e)}):this.resolveUtilsScriptPromise(),n==="auto"&&r&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){m.autoCountry?this.handleAutoCountry():m.startedLoadingAutoCountry||(m.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let n=e.toLowerCase();n&&this._getCountryData(n,!0)?(m.autoCountry=n,setTimeout(()=>t1("handleAutoCountry"))):(this._setInitialState(!0),t1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),t1("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:e,formatAsYouType:n,separateDialCode:r,formatOnDisplay:u}=this.options,l=!1;/\p{L}/u.test(this.telInput.value)&&(l=!0);let f=()=>{this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0)};this._handleInputEvent=p=>{if(this.isAndroid&&p?.data==="+"&&r){let _=this.telInput.selectionStart||0,T=this.telInput.value.substring(0,_-1),P=this.telInput.value.substring(_);this.telInput.value=T+P,f();return}this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let v=p?.data&&/[^+0-9]/.test(p.data),S=p?.inputType==="insertFromPaste"&&this.telInput.value;v||S&&!e?l=!0:/[^+0-9]/.test(this.telInput.value)||(l=!1);let I=p?.detail&&p.detail.isSetNumber&&!u;if(n&&!l&&!I){let _=this.telInput.selectionStart||0,P=this.telInput.value.substring(0,_).replace(/[^+0-9]/g,"").length,R=p?.inputType==="deleteContentForward",k=this._formatNumberAsYouType(),e1=K2(P,k,_,R);this.telInput.value=k,this.telInput.setSelectionRange(e1,e1)}},this.telInput.addEventListener("input",this._handleInputEvent),(e||r)&&(this._handleKeydownEvent=p=>{if(p.key&&p.key.length===1&&!p.altKey&&!p.ctrlKey&&!p.metaKey){if(r&&p.key==="+"){p.preventDefault(),f();return}if(e){let v=this.telInput.selectionStart===0&&p.key==="+",S=/^[0-9]$/.test(p.key),I=v||S,_=this._getFullNumber(),T=m.utils.getCoreNumber(_,this.selectedCountryData.iso2),P=this.maxCoreNumberLength&&T.length>=this.maxCoreNumberLength,R=this.telInput.value.substring(this.telInput.selectionStart,this.telInput.selectionEnd),k=/\d/.test(R);(!I||P&&!k)&&p.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(e){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&e.length>n?e.substr(0,n):e}_trigger(e,n={}){let r=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});this.telInput.dispatchEvent(r)}_openDropdown(){let{fixDropdownWidth:e,countrySearch:n}=this.options;if(e&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),n){let r=this.countryList.firstElementChild;r&&(this._highlightListItem(r,!1),this.countryList.scrollTop=0),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 e=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${e.top+n}px`,this.dropdown.style.left=`${e.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._highlightListItem(l,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._selectListItem(l)},this.countryList.addEventListener("click",this._handleClickCountryList);let e=!0;this._handleClickOffToClose=()=>{e||this._closeDropdown(),e=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let n="",r=null;if(this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(u.key)&&(u.stopPropagation(),r&&clearTimeout(r),n+=u.key.toLowerCase(),this._searchForCountry(n),r=setTimeout(()=>{n=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let u=()=>{let f=this.searchInput.value.trim();f?this._filterCountries(f):this._filterCountries("",!0)},l=null;this._handleSearchChange=()=>{l&&clearTimeout(l),l=setTimeout(()=>{u(),l=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",f=>f.stopPropagation())}}_searchForCountry(e){for(let n=0;nI[0]).join("").toLowerCase(),S=`+${f.dialCode}`;if(n||p.includes(u)||S.includes(u)||f.iso2.includes(u)||v.includes(u)){let I=f.nodeById[this.id];I&&this.countryList.appendChild(I),r&&(this._highlightListItem(I,!1),r=!1)}}r&&this._highlightListItem(null,!1),this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:e}=this.options,n=this.countryList.childElementCount,r;n===0?r=e.zeroSearchResults:n===1?r=e.oneSearchResult:r=e.multipleSearchResults.replace("${count}",n.toString()),this.searchResultsA11yText.textContent=r}_handleUpDownKey(e){let n=e==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!n&&this.countryList.childElementCount>1&&(n=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(e){let n=e;if(this.options.formatOnDisplay&&m.utils&&this.selectedCountryData){let r=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:l}=m.utils.numberFormat,f=r?u:l;n=m.utils.formatNumber(n,this.selectedCountryData.iso2,f)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber(e){let n=e.indexOf("+"),r=n?e.substring(n):e,u=this.selectedCountryData.dialCode;r&&u==="1"&&r.charAt(0)!=="+"&&(r.charAt(0)!=="1"&&(r=`1${r}`),r=`+${r}`),this.options.separateDialCode&&u&&r.charAt(0)!=="+"&&(r=`+${u}${r}`);let f=this._getDialCode(r,!0),p=h1(r),v=null;if(f){let S=this.dialCodeToIso2Map[h1(f)],I=S.indexOf(this.selectedCountryData.iso2)!==-1&&p.length<=f.length-1;if(!(u==="1"&&s2(p))&&!I){for(let T=0;Tf){let _=u-p;n.scrollTop=I-_}}_updateDialCode(e){let n=this.telInput.value,r=`+${e}`,u;if(n.charAt(0)==="+"){let l=this._getDialCode(n);l?u=n.replace(l,r):u=r,this.telInput.value=u}}_getDialCode(e,n){let r="";if(e.charAt(0)==="+"){let u="";for(let l=0;l-1){let r=e.substring(0,n),u=this._utilsIsPossibleNumber(r),l=this._utilsIsPossibleNumber(e);return u&&l}return this._utilsIsPossibleNumber(e)}_utilsIsPossibleNumber(e){return m.utils?m.utils.isPossibleNumber(e,this.selectedCountryData.iso2,this.options.validationNumberType):null}isValidNumberPrecise(){let e=this._getFullNumber(),n=e.search(/\p{L}/u);if(n>-1){let r=e.substring(0,n),u=this._utilsIsValidNumber(r),l=this._utilsIsValidNumber(e);return u&&l}return this._utilsIsValidNumber(e)}_utilsIsValidNumber(e){return m.utils?m.utils.isValidNumber(e,this.selectedCountryData.iso2):null}setCountry(e){let n=e?.toLowerCase(),r=this.selectedCountryData.iso2;(e&&n!==r||!e&&r)&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(e){let n=this._updateCountryFromNumber(e);this._updateValFromNumber(e),n&&this._triggerCountryChange(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(e){this.options.placeholderNumberType=e,this._updatePlaceholder()}setDisabled(e){this.telInput.disabled=e,e?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},V2=C=>!m.utils&&!m.startedLoadingUtilsScript?(m.startedLoadingUtilsScript=!0,new Promise((e,n)=>{import(C).then(({default:r})=>{m.utils=r,t1("handleUtils"),e(!0)}).catch(()=>{t1("rejectUtilsScriptPromise"),n()})})):null,m=Object.assign((C,e)=>{let n=new v1(C,e);return n._init(),C.setAttribute("data-intl-tel-input-id",n.id.toString()),m.instances[n.id]=n,n},{defaults:u2,documentReady:()=>document.readyState==="complete",getCountryData:()=>K,getInstance:C=>{let e=C.getAttribute("data-intl-tel-input-id");return e?m.instances[e]:null},instances:{},loadUtils:V2,version:"24.2.1"}),I1=m;(function(){var C=this||self;function e(d,t){d=d.split(".");var $=C;d[0]in $||typeof $.execScript>"u"||$.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?$[i]&&$[i]!==Object.prototype[i]?$=$[i]:$=$[i]={}:$[i]=t}function n(d,t){function $(){}$.prototype=t.prototype,d.ma=t.prototype,d.prototype=new $,d.prototype.constructor=d,d.sa=function(i,o,s){for(var a=Array(arguments.length-2),h=2;hd.length?!1:B(L2,d)}function P1(d){return B(b2,d)?r1(d,C2):r1(d,p1)}function R1(d){var t=P1(d.toString());x(d),d.g(t)}function O1(d){return d!=null&&(H(d,9)!=1||N(d,9)[0]!=-1)}function r1(d,t){for(var $=new L,i,o=d.length,s=0;st?2:s[s.length-1]=o&&o<=i;++o)if($=parseInt(d.substring(0,o),10),$ in J)return t.g(d.substring(o)),$;return 0}function F1(d,t,$,i,o,s){if(t.length==0)return 0;t=new L(t);var a;$!=null&&(a=c($,11)),a==null&&(a="NonMatch");var h=t.toString();if(h.length==0)a=20;else if(q.test(h))h=h.replace(q,""),x(t),t.g(P1(h)),a=1;else{if(h=new RegExp(a),R1(t),a=t.toString(),a.search(h)==0){h=a.match(h)[0].length;var g=a.substring(h).match(N1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=U1(t,i),d!=0)return E(s,1,d),d;throw Error("Invalid country calling code")}return $!=null&&(a=y($,10),h=""+a,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new L(g.substring(h.length)),g=c($,1),g=new RegExp(y(g,2)),K1(h,$,null),h=h.toString(),!B(g,t.toString())&&B(g,h)||u1(d,t.toString(),$,-1)==3))?(i.g(h),o&&E(s,6,10),E(s,1,a),a):(E(s,1,0),0)}function K1(d,t,$){var i=d.toString(),o=i.length,s=c(t,15);if(o!=0&&s!=null&&s.length!=0){var a=new RegExp("^(?:"+s+")");if(o=a.exec(i)){s=new RegExp(y(c(t,1),2));var h=B(s,i),g=o.length-1;t=c(t,16),t==null||t.length==0||o[g]==null||o[g].length==0?(!h||B(s,i.substring(o[0].length)))&&($!=null&&0=t.length)s="";else{var a=t.indexOf(";",s);s=a!==-1?t.substring(s,a):t.substring(s)}var h=s;if(h==null?a=!0:h.length===0?a=!1:(a=S2.exec(h),h=T2.exec(h),a=a!==null||h!==null),!a||(s!=null?(s.charAt(0)==="+"&&o.g(s),s=t.indexOf("tel:"),o.g(t.substring(0<=s?s+4:0,t.indexOf(";phone-context=")))):(s=o.g,a=t??"",h=a.search(v2),0<=h?(a=a.substring(h),a=a.replace(_2,""),h=a.search(I2),0<=h&&(a=a.substring(0,h))):a="",s.call(o,a)),s=o.toString(),a=s.indexOf(";isub="),0t.h.length||(a!=null&&($=new L,o=new L(t.toString()),K1(o,a,$),d=u1(d,o.toString(),a,-1),d!=2&&d!=4&&d!=5&&(t=o,i&&0<$.toString().length&&E(s,7,$.toString()))),i=t.toString(),d=i.length,2>d))throw Error("The string supplied is too short to be a phone number");if(17{try{let $=d.replace(/[^+0-9]/g,""),i=new A2(t);t="";for(let o=0;o<$.length;o++)i.ja=M2(i,$.charAt(o)),t=i.ja;return t}catch{return d}}),e("intlTelInputUtilsTemp.formatNumber",(d,t,$)=>{try{let o=A.g(),s=W(o,d,t);var i=Z(o,s,-1);return i==0||i==4?o.format(s,typeof $>"u"?0:$):d}catch{return d}}),e("intlTelInputUtilsTemp.getExampleNumber",(d,t,$,i)=>{try{let g=A.g();d:{var o=g;if(o1(d)){var s=s1(F(o,d),$);try{if(D(s,6)){var a=c(s,6),h=V1(o,a,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),e("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(W(A.g(),d,t),3)}catch{return""}}),e("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let a=A.g(),h=W(a,d,t);var $=G1(a,h),i=X(a,y(h,1),$);if(i==null)var o=-1;else{var s=Q(h);o=f1(s,i)}return o}catch{return-99}}),e("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let $=A.g(),i=W($,d,t);return Z($,i,-1)}catch($){return $.message==="Invalid country calling code"?1:3>=d.length||$.message==="Phone number too short after IDD"||$.message==="The string supplied is too short to be a phone number"?2:$.message==="The string supplied is too long to be a phone number"?3:-99}}),e("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=A.g();var $=W(g,d,t),i=G1(g,$);d=g;var o=y($,1),s=X(d,o,i);if(s==null||i!="001"&&o!=H1(d,i))var a=!1;else{var h=Q($);a=f1(h,s)!=-1}return a}catch{return!1}}),e("intlTelInputUtilsTemp.isPossibleNumber",(d,t,$)=>{try{let i=A.g(),o=W(i,d,t);if($){let s=Z(i,o,l1[$])===0;if($==="FIXED_LINE_OR_MOBILE"){let a=Z(i,o,l1.MOBILE)===0,h=Z(i,o,l1.FIXED_LINE)===0;return a||h||s}return s}return Z(i,o,-1)===0}catch{return!1}}),e("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(W(A.g(),d,t),2).toString()}catch{return""}}),e("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),e("intlTelInputUtilsTemp.numberType",l1),e("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var j2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var a2=j2;I1.utils=a2;var W2=I1;return k2(z2);})(); +var factoryOutput=(()=>{var C1=Object.defineProperty;var D2=Object.getOwnPropertyDescriptor;var x2=Object.getOwnPropertyNames;var P2=Object.prototype.hasOwnProperty;var R2=(C,e)=>{for(var n in e)C1(C,n,{get:e[n],enumerable:!0})},O2=(C,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of x2(e))!P2.call(C,u)&&u!==n&&C1(C,u,{get:()=>e[u],enumerable:!(r=D2(e,u))||r.enumerable});return C};var k2=C=>O2(C1({},"__esModule",{value:!0}),C);var z2={};R2(z2,{default:()=>W2});var $2=[["af","93"],["ax","358",1,["18"]],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"]],n2=[];for(let C=0;C<$2.length;C++){let e=$2[C];n2[C]={name:"",iso2:e[0],dialCode:e[1],priority:e[2]||0,areaCodes:e[3]||null,nodeById:{}}}var K=n2;var B2={ad:"Andorra",ae:"United Arab Emirates",af:"Afghanistan",ag:"Antigua & Barbuda",ai:"Anguilla",al:"Albania",am:"Armenia",ao:"Angola",ar:"Argentina",as:"American Samoa",at:"Austria",au:"Australia",aw:"Aruba",ax:"\xC5land Islands",az:"Azerbaijan",ba:"Bosnia & Herzegovina",bb:"Barbados",bd:"Bangladesh",be:"Belgium",bf:"Burkina Faso",bg:"Bulgaria",bh:"Bahrain",bi:"Burundi",bj:"Benin",bl:"St. Barth\xE9lemy",bm:"Bermuda",bn:"Brunei",bo:"Bolivia",bq:"Caribbean Netherlands",br:"Brazil",bs:"Bahamas",bt:"Bhutan",bw:"Botswana",by:"Belarus",bz:"Belize",ca:"Canada",cc:"Cocos (Keeling) Islands",cd:"Congo - Kinshasa",cf:"Central African Republic",cg:"Congo - Brazzaville",ch:"Switzerland",ci:"C\xF4te d\u2019Ivoire",ck:"Cook Islands",cl:"Chile",cm:"Cameroon",cn:"China",co:"Colombia",cr:"Costa Rica",cu:"Cuba",cv:"Cape Verde",cw:"Cura\xE7ao",cx:"Christmas Island",cy:"Cyprus",cz:"Czechia",de:"Germany",dj:"Djibouti",dk:"Denmark",dm:"Dominica",do:"Dominican Republic",dz:"Algeria",ec:"Ecuador",ee:"Estonia",eg:"Egypt",eh:"Western Sahara",er:"Eritrea",es:"Spain",et:"Ethiopia",fi:"Finland",fj:"Fiji",fk:"Falkland Islands",fm:"Micronesia",fo:"Faroe Islands",fr:"France",ga:"Gabon",gb:"United Kingdom",gd:"Grenada",ge:"Georgia",gf:"French Guiana",gg:"Guernsey",gh:"Ghana",gi:"Gibraltar",gl:"Greenland",gm:"Gambia",gn:"Guinea",gp:"Guadeloupe",gq:"Equatorial Guinea",gr:"Greece",gt:"Guatemala",gu:"Guam",gw:"Guinea-Bissau",gy:"Guyana",hk:"Hong Kong SAR China",hn:"Honduras",hr:"Croatia",ht:"Haiti",hu:"Hungary",id:"Indonesia",ie:"Ireland",il:"Israel",im:"Isle of Man",in:"India",io:"British Indian Ocean Territory",iq:"Iraq",ir:"Iran",is:"Iceland",it:"Italy",je:"Jersey",jm:"Jamaica",jo:"Jordan",jp:"Japan",ke:"Kenya",kg:"Kyrgyzstan",kh:"Cambodia",ki:"Kiribati",km:"Comoros",kn:"St. Kitts & Nevis",kp:"North Korea",kr:"South Korea",kw:"Kuwait",ky:"Cayman Islands",kz:"Kazakhstan",la:"Laos",lb:"Lebanon",lc:"St. Lucia",li:"Liechtenstein",lk:"Sri Lanka",lr:"Liberia",ls:"Lesotho",lt:"Lithuania",lu:"Luxembourg",lv:"Latvia",ly:"Libya",ma:"Morocco",mc:"Monaco",md:"Moldova",me:"Montenegro",mf:"St. Martin",mg:"Madagascar",mh:"Marshall Islands",mk:"North Macedonia",ml:"Mali",mm:"Myanmar (Burma)",mn:"Mongolia",mo:"Macao SAR China",mp:"Northern Mariana Islands",mq:"Martinique",mr:"Mauritania",ms:"Montserrat",mt:"Malta",mu:"Mauritius",mv:"Maldives",mw:"Malawi",mx:"Mexico",my:"Malaysia",mz:"Mozambique",na:"Namibia",nc:"New Caledonia",ne:"Niger",nf:"Norfolk Island",ng:"Nigeria",ni:"Nicaragua",nl:"Netherlands",no:"Norway",np:"Nepal",nr:"Nauru",nu:"Niue",nz:"New Zealand",om:"Oman",pa:"Panama",pe:"Peru",pf:"French Polynesia",pg:"Papua New Guinea",ph:"Philippines",pk:"Pakistan",pl:"Poland",pm:"St. Pierre & Miquelon",pr:"Puerto Rico",ps:"Palestinian Territories",pt:"Portugal",pw:"Palau",py:"Paraguay",qa:"Qatar",re:"R\xE9union",ro:"Romania",rs:"Serbia",ru:"Russia",rw:"Rwanda",sa:"Saudi Arabia",sb:"Solomon Islands",sc:"Seychelles",sd:"Sudan",se:"Sweden",sg:"Singapore",sh:"St. Helena",si:"Slovenia",sj:"Svalbard & Jan Mayen",sk:"Slovakia",sl:"Sierra Leone",sm:"San Marino",sn:"Senegal",so:"Somalia",sr:"Suriname",ss:"South Sudan",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sv:"El Salvador",sx:"Sint Maarten",sy:"Syria",sz:"Eswatini",tc:"Turks & Caicos Islands",td:"Chad",tg:"Togo",th:"Thailand",tj:"Tajikistan",tk:"Tokelau",tl:"Timor-Leste",tm:"Turkmenistan",tn:"Tunisia",to:"Tonga",tr:"Turkey",tt:"Trinidad & Tobago",tv:"Tuvalu",tw:"Taiwan",tz:"Tanzania",ua:"Ukraine",ug:"Uganda",us:"United States",uy:"Uruguay",uz:"Uzbekistan",va:"Vatican City",vc:"St. Vincent & Grenadines",ve:"Venezuela",vg:"British Virgin Islands",vi:"U.S. Virgin Islands",vn:"Vietnam",vu:"Vanuatu",wf:"Wallis & Futuna",ws:"Samoa",ye:"Yemen",yt:"Mayotte",za:"South Africa",zm:"Zambia",zw:"Zimbabwe"},i2=B2;var G2={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",ac:"Ascension Island",xk:"Kosovo"},r2=G2;var H2={...i2,...r2},y1=H2;for(let C=0;CC.replace(/\D/g,""),o2=(C="")=>C.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),s2=C=>{let e=h1(C);if(e.charAt(0)==="1"){let n=e.substr(1,3);return F2.indexOf(n)!==-1}return!1},K2=(C,e,n,r)=>{if(n===0&&!r)return 0;let u=0;for(let l=0;l{let r=document.createElement(C);return e&&Object.entries(e).forEach(([u,l])=>r.setAttribute(u,l)),n&&n.appendChild(r),r},t1=C=>{let{instances:e}=m;Object.values(e).forEach(n=>n[C]())},v1=class{constructor(e,n={}){this.id=U2++,this.telInput=e,this.highlightedItem=null,this.options=Object.assign({},u2,n),this.hadInitialPlaceholder=!!e.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.onlyCountries.length===1&&(this.options.initialCountry=this.options.onlyCountries[0]),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1,this.options.countrySearch=!0),this.options.allowDropdown&&!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.isRTL?this.originalPaddingRight=this.telInput.style.paddingRight:this.originalPaddingLeft=this.telInput.style.paddingLeft),this.options.i18n={...y1,...this.options.i18n};let e=new Promise((r,u)=>{this.resolveAutoCountryPromise=r,this.rejectAutoCountryPromise=u}),n=new Promise((r,u)=>{this.resolveUtilsScriptPromise=r,this.rejectUtilsScriptPromise=u});this.promise=Promise.all([e,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this._sortCountries()}_sortCountries(){this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(e=>e.toLowerCase())),this.countries.sort((e,n)=>{let{countryOrder:r}=this.options;if(r){let u=r.indexOf(e.iso2),l=r.indexOf(n.iso2),f=u>-1,p=l>-1;if(f||p)return f&&p?u-l:f?-1:1}return e.name.localeCompare(n.name)})}_addToDialCodeMap(e,n,r){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let l=0;lu.toLowerCase());this.countries=K.filter(u=>r.indexOf(u.iso2)>-1)}else if(n.length){let r=n.map(u=>u.toLowerCase());this.countries=K.filter(u=>r.indexOf(u.iso2)===-1)}else this.countries=K}_translateCountryNames(){for(let e=0;e`),l+=`${n.name}`,l+=`+${n.dialCode}`,u.insertAdjacentHTML("beforeend",l)}}_setInitialState(e=!1){let n=this.telInput.getAttribute("value"),r=this.telInput.value,l=n&&n.charAt(0)==="+"&&(!r||r.charAt(0)!=="+")?n:r,f=this._getDialCode(l),p=s2(l),{initialCountry:v,geoIpLookup:S}=this.options,I=v==="auto"&&S;if(f&&!p)this._updateCountryFromNumber(l);else if(!I||e){let _=v?v.toLowerCase():"";_&&this._getCountryData(_,!0)?this._setCountry(_):f&&p?this._setCountry("us"):this._setCountry()}l&&this._updateValFromNumber(l)}_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=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let e=this.telInput.closest("label");e&&e.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=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){let{utilsScript:e,initialCountry:n,geoIpLookup:r}=this.options;e&&!m.utils?m.documentReady()?m.loadUtils(e):window.addEventListener("load",()=>{m.loadUtils(e)}):this.resolveUtilsScriptPromise(),n==="auto"&&r&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){m.autoCountry?this.handleAutoCountry():m.startedLoadingAutoCountry||(m.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let n=e.toLowerCase();n&&this._getCountryData(n,!0)?(m.autoCountry=n,setTimeout(()=>t1("handleAutoCountry"))):(this._setInitialState(!0),t1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),t1("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:e,formatAsYouType:n,separateDialCode:r,formatOnDisplay:u}=this.options,l=!1;/\p{L}/u.test(this.telInput.value)&&(l=!0);let f=()=>{this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0)};this._handleInputEvent=p=>{if(this.isAndroid&&p?.data==="+"&&r){let _=this.telInput.selectionStart||0,T=this.telInput.value.substring(0,_-1),P=this.telInput.value.substring(_);this.telInput.value=T+P,f();return}this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let v=p?.data&&/[^+0-9]/.test(p.data),S=p?.inputType==="insertFromPaste"&&this.telInput.value;v||S&&!e?l=!0:/[^+0-9]/.test(this.telInput.value)||(l=!1);let I=p?.detail&&p.detail.isSetNumber&&!u;if(n&&!l&&!I){let _=this.telInput.selectionStart||0,P=this.telInput.value.substring(0,_).replace(/[^+0-9]/g,"").length,R=p?.inputType==="deleteContentForward",k=this._formatNumberAsYouType(),e1=K2(P,k,_,R);this.telInput.value=k,this.telInput.setSelectionRange(e1,e1)}},this.telInput.addEventListener("input",this._handleInputEvent),(e||r)&&(this._handleKeydownEvent=p=>{if(p.key&&p.key.length===1&&!p.altKey&&!p.ctrlKey&&!p.metaKey){if(r&&p.key==="+"){p.preventDefault(),f();return}if(e){let v=this.telInput.selectionStart===0&&p.key==="+",S=/^[0-9]$/.test(p.key),I=v||S,_=this._getFullNumber(),T=m.utils.getCoreNumber(_,this.selectedCountryData.iso2),P=this.maxCoreNumberLength&&T.length>=this.maxCoreNumberLength,R=this.telInput.value.substring(this.telInput.selectionStart,this.telInput.selectionEnd),k=/\d/.test(R);(!I||P&&!k)&&p.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(e){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&e.length>n?e.substr(0,n):e}_trigger(e,n={}){let r=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});this.telInput.dispatchEvent(r)}_openDropdown(){let{fixDropdownWidth:e,countrySearch:n}=this.options;if(e&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition(),n){let r=this.countryList.firstElementChild;r&&(this._highlightListItem(r,!1),this.countryList.scrollTop=0),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 e=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${e.top+n}px`,this.dropdown.style.left=`${e.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._highlightListItem(l,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._selectListItem(l)},this.countryList.addEventListener("click",this._handleClickCountryList);let e=!0;this._handleClickOffToClose=()=>{e||this._closeDropdown(),e=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose);let n="",r=null;if(this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown()),!this.options.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(u.key)&&(u.stopPropagation(),r&&clearTimeout(r),n+=u.key.toLowerCase(),this._searchForCountry(n),r=setTimeout(()=>{n=""},1e3))},document.addEventListener("keydown",this._handleKeydownOnDropdown),this.options.countrySearch){let u=()=>{let f=this.searchInput.value.trim();f?this._filterCountries(f):this._filterCountries("",!0)},l=null;this._handleSearchChange=()=>{l&&clearTimeout(l),l=setTimeout(()=>{u(),l=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",f=>f.stopPropagation())}}_searchForCountry(e){for(let n=0;nI[0]).join("").toLowerCase(),S=`+${f.dialCode}`;if(n||p.includes(u)||S.includes(u)||f.iso2.includes(u)||v.includes(u)){let I=f.nodeById[this.id];I&&this.countryList.appendChild(I),r&&(this._highlightListItem(I,!1),r=!1)}}r&&this._highlightListItem(null,!1),this.countryList.scrollTop=0,this._updateSearchResultsText()}_updateSearchResultsText(){let{i18n:e}=this.options,n=this.countryList.childElementCount,r;n===0?r=e.zeroSearchResults:n===1?r=e.oneSearchResult:r=e.multipleSearchResults.replace("${count}",n.toString()),this.searchResultsA11yText.textContent=r}_handleUpDownKey(e){let n=e==="ArrowUp"?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!n&&this.countryList.childElementCount>1&&(n=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(e){let n=e;if(this.options.formatOnDisplay&&m.utils&&this.selectedCountryData){let r=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:l}=m.utils.numberFormat,f=r?u:l;n=m.utils.formatNumber(n,this.selectedCountryData.iso2,f)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber(e){let n=e.indexOf("+"),r=n?e.substring(n):e,u=this.selectedCountryData.dialCode;r&&u==="1"&&r.charAt(0)!=="+"&&(r.charAt(0)!=="1"&&(r=`1${r}`),r=`+${r}`),this.options.separateDialCode&&u&&r.charAt(0)!=="+"&&(r=`+${u}${r}`);let f=this._getDialCode(r,!0),p=h1(r),v=null;if(f){let S=this.dialCodeToIso2Map[h1(f)],I=S.indexOf(this.selectedCountryData.iso2)!==-1&&p.length<=f.length-1;if(!(u==="1"&&s2(p))&&!I){for(let T=0;Tf){let _=u-p;n.scrollTop=I-_}}_updateDialCode(e){let n=this.telInput.value,r=`+${e}`,u;if(n.charAt(0)==="+"){let l=this._getDialCode(n);l?u=n.replace(l,r):u=r,this.telInput.value=u}}_getDialCode(e,n){let r="";if(e.charAt(0)==="+"){let u="";for(let l=0;l-1){let r=e.substring(0,n),u=this._utilsIsPossibleNumber(r),l=this._utilsIsPossibleNumber(e);return u&&l}return this._utilsIsPossibleNumber(e)}_utilsIsPossibleNumber(e){return m.utils?m.utils.isPossibleNumber(e,this.selectedCountryData.iso2,this.options.validationNumberType):null}isValidNumberPrecise(){let e=this._getFullNumber(),n=e.search(/\p{L}/u);if(n>-1){let r=e.substring(0,n),u=this._utilsIsValidNumber(r),l=this._utilsIsValidNumber(e);return u&&l}return this._utilsIsValidNumber(e)}_utilsIsValidNumber(e){return m.utils?m.utils.isValidNumber(e,this.selectedCountryData.iso2):null}setCountry(e){let n=e?.toLowerCase(),r=this.selectedCountryData.iso2;(e&&n!==r||!e&&r)&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber(e){let n=this._updateCountryFromNumber(e);this._updateValFromNumber(e),n&&this._triggerCountryChange(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(e){this.options.placeholderNumberType=e,this._updatePlaceholder()}setDisabled(e){this.telInput.disabled=e,e?this.selectedCountry.setAttribute("disabled","true"):this.selectedCountry.removeAttribute("disabled")}},V2=C=>!m.utils&&!m.startedLoadingUtilsScript?(m.startedLoadingUtilsScript=!0,new Promise((e,n)=>{import_INTENTIONALLY_BROKEN(/* webpackIgnore: true */ C).then(({default:r})=>{m.utils=r,t1("handleUtils"),e(!0)}).catch(()=>{t1("rejectUtilsScriptPromise"),n()})})):null,m=Object.assign((C,e)=>{let n=new v1(C,e);return n._init(),C.setAttribute("data-intl-tel-input-id",n.id.toString()),m.instances[n.id]=n,n},{defaults:u2,documentReady:()=>document.readyState==="complete",getCountryData:()=>K,getInstance:C=>{let e=C.getAttribute("data-intl-tel-input-id");return e?m.instances[e]:null},instances:{},loadUtils:V2,version:"24.2.1"}),I1=m;(function(){var C=this||self;function e(d,t){d=d.split(".");var $=C;d[0]in $||typeof $.execScript>"u"||$.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?$[i]&&$[i]!==Object.prototype[i]?$=$[i]:$=$[i]={}:$[i]=t}function n(d,t){function $(){}$.prototype=t.prototype,d.ma=t.prototype,d.prototype=new $,d.prototype.constructor=d,d.sa=function(i,o,s){for(var a=Array(arguments.length-2),h=2;hd.length?!1:B(L2,d)}function P1(d){return B(b2,d)?r1(d,C2):r1(d,p1)}function R1(d){var t=P1(d.toString());x(d),d.g(t)}function O1(d){return d!=null&&(H(d,9)!=1||N(d,9)[0]!=-1)}function r1(d,t){for(var $=new L,i,o=d.length,s=0;st?2:s[s.length-1]=o&&o<=i;++o)if($=parseInt(d.substring(0,o),10),$ in J)return t.g(d.substring(o)),$;return 0}function F1(d,t,$,i,o,s){if(t.length==0)return 0;t=new L(t);var a;$!=null&&(a=c($,11)),a==null&&(a="NonMatch");var h=t.toString();if(h.length==0)a=20;else if(q.test(h))h=h.replace(q,""),x(t),t.g(P1(h)),a=1;else{if(h=new RegExp(a),R1(t),a=t.toString(),a.search(h)==0){h=a.match(h)[0].length;var g=a.substring(h).match(N1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=U1(t,i),d!=0)return E(s,1,d),d;throw Error("Invalid country calling code")}return $!=null&&(a=y($,10),h=""+a,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new L(g.substring(h.length)),g=c($,1),g=new RegExp(y(g,2)),K1(h,$,null),h=h.toString(),!B(g,t.toString())&&B(g,h)||u1(d,t.toString(),$,-1)==3))?(i.g(h),o&&E(s,6,10),E(s,1,a),a):(E(s,1,0),0)}function K1(d,t,$){var i=d.toString(),o=i.length,s=c(t,15);if(o!=0&&s!=null&&s.length!=0){var a=new RegExp("^(?:"+s+")");if(o=a.exec(i)){s=new RegExp(y(c(t,1),2));var h=B(s,i),g=o.length-1;t=c(t,16),t==null||t.length==0||o[g]==null||o[g].length==0?(!h||B(s,i.substring(o[0].length)))&&($!=null&&0=t.length)s="";else{var a=t.indexOf(";",s);s=a!==-1?t.substring(s,a):t.substring(s)}var h=s;if(h==null?a=!0:h.length===0?a=!1:(a=S2.exec(h),h=T2.exec(h),a=a!==null||h!==null),!a||(s!=null?(s.charAt(0)==="+"&&o.g(s),s=t.indexOf("tel:"),o.g(t.substring(0<=s?s+4:0,t.indexOf(";phone-context=")))):(s=o.g,a=t??"",h=a.search(v2),0<=h?(a=a.substring(h),a=a.replace(_2,""),h=a.search(I2),0<=h&&(a=a.substring(0,h))):a="",s.call(o,a)),s=o.toString(),a=s.indexOf(";isub="),0t.h.length||(a!=null&&($=new L,o=new L(t.toString()),K1(o,a,$),d=u1(d,o.toString(),a,-1),d!=2&&d!=4&&d!=5&&(t=o,i&&0<$.toString().length&&E(s,7,$.toString()))),i=t.toString(),d=i.length,2>d))throw Error("The string supplied is too short to be a phone number");if(17{try{let $=d.replace(/[^+0-9]/g,""),i=new A2(t);t="";for(let o=0;o<$.length;o++)i.ja=M2(i,$.charAt(o)),t=i.ja;return t}catch{return d}}),e("intlTelInputUtilsTemp.formatNumber",(d,t,$)=>{try{let o=A.g(),s=W(o,d,t);var i=Z(o,s,-1);return i==0||i==4?o.format(s,typeof $>"u"?0:$):d}catch{return d}}),e("intlTelInputUtilsTemp.getExampleNumber",(d,t,$,i)=>{try{let g=A.g();d:{var o=g;if(o1(d)){var s=s1(F(o,d),$);try{if(D(s,6)){var a=c(s,6),h=V1(o,a,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),e("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(W(A.g(),d,t),3)}catch{return""}}),e("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let a=A.g(),h=W(a,d,t);var $=G1(a,h),i=X(a,y(h,1),$);if(i==null)var o=-1;else{var s=Q(h);o=f1(s,i)}return o}catch{return-99}}),e("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let $=A.g(),i=W($,d,t);return Z($,i,-1)}catch($){return $.message==="Invalid country calling code"?1:3>=d.length||$.message==="Phone number too short after IDD"||$.message==="The string supplied is too short to be a phone number"?2:$.message==="The string supplied is too long to be a phone number"?3:-99}}),e("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=A.g();var $=W(g,d,t),i=G1(g,$);d=g;var o=y($,1),s=X(d,o,i);if(s==null||i!="001"&&o!=H1(d,i))var a=!1;else{var h=Q($);a=f1(h,s)!=-1}return a}catch{return!1}}),e("intlTelInputUtilsTemp.isPossibleNumber",(d,t,$)=>{try{let i=A.g(),o=W(i,d,t);if($){let s=Z(i,o,l1[$])===0;if($==="FIXED_LINE_OR_MOBILE"){let a=Z(i,o,l1.MOBILE)===0,h=Z(i,o,l1.FIXED_LINE)===0;return a||h||s}return s}return Z(i,o,-1)===0}catch{return!1}}),e("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(W(A.g(),d,t),2).toString()}catch{return""}}),e("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),e("intlTelInputUtilsTemp.numberType",l1),e("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var j2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var a2=j2;I1.utils=a2;var W2=I1;return k2(z2);})(); // UMD return factoryOutput.default; diff --git a/react/build/IntlTelInput.cjs b/react/build/IntlTelInput.cjs index 1362f501a..8f1d4e06d 100644 --- a/react/build/IntlTelInput.cjs +++ b/react/build/IntlTelInput.cjs @@ -1758,6 +1758,9 @@ var Iti = class { if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -2632,7 +2635,7 @@ var Iti = class { //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/build/IntlTelInput.js b/react/build/IntlTelInput.js index 71e61b42e..2c49c5604 100644 --- a/react/build/IntlTelInput.js +++ b/react/build/IntlTelInput.js @@ -1722,6 +1722,9 @@ var Iti = class { if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -2596,7 +2599,7 @@ var Iti = class { //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/build/IntlTelInputWithUtils.cjs b/react/build/IntlTelInputWithUtils.cjs index e9faf33d0..87e8777fd 100644 --- a/react/build/IntlTelInputWithUtils.cjs +++ b/react/build/IntlTelInputWithUtils.cjs @@ -1758,6 +1758,9 @@ var Iti = class { if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -2632,7 +2635,7 @@ var Iti = class { //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/build/IntlTelInputWithUtils.js b/react/build/IntlTelInputWithUtils.js index 7c02d5efb..d59a932ac 100644 --- a/react/build/IntlTelInputWithUtils.js +++ b/react/build/IntlTelInputWithUtils.js @@ -1722,6 +1722,9 @@ var Iti = class { if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -2596,7 +2599,7 @@ var Iti = class { //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/demo/set-number/set-number-bundle.js b/react/demo/set-number/set-number-bundle.js index 08fe68325..8f322dbd9 100644 --- a/react/demo/set-number/set-number-bundle.js +++ b/react/demo/set-number/set-number-bundle.js @@ -25309,6 +25309,9 @@ if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -26183,7 +26186,7 @@ //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/demo/simple/simple-bundle.js b/react/demo/simple/simple-bundle.js index afe8eb432..a8d85570c 100644 --- a/react/demo/simple/simple-bundle.js +++ b/react/demo/simple/simple-bundle.js @@ -25309,6 +25309,9 @@ if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -26183,7 +26186,7 @@ //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/demo/toggle-disabled/toggle-disabled-bundle.js b/react/demo/toggle-disabled/toggle-disabled-bundle.js index 992ecb767..7d569491f 100644 --- a/react/demo/toggle-disabled/toggle-disabled-bundle.js +++ b/react/demo/toggle-disabled/toggle-disabled-bundle.js @@ -25309,6 +25309,9 @@ if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -26183,7 +26186,7 @@ //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/react/demo/validation/validation-bundle.js b/react/demo/validation/validation-bundle.js index e0f1c6863..58c8c68ff 100644 --- a/react/demo/validation/validation-bundle.js +++ b/react/demo/validation/validation-bundle.js @@ -25309,6 +25309,9 @@ if (this.options.useFullscreenPopup) { this.options.fixDropdownWidth = false; } + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } if (this.options.separateDialCode) { this.options.allowDropdown = true; this.options.nationalMode = false; @@ -26183,7 +26186,7 @@ //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { const selectedCountryWidth = this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth(); - const inputPadding = selectedCountryWidth + 8; + const inputPadding = selectedCountryWidth + 6; if (this.showSelectedCountryOnLeft) { this.telInput.style.paddingLeft = `${inputPadding}px`; } else { diff --git a/src/js/intl-tel-input.ts b/src/js/intl-tel-input.ts index df4bb39e6..001bbd804 100644 --- a/src/js/intl-tel-input.ts +++ b/src/js/intl-tel-input.ts @@ -300,6 +300,11 @@ export class Iti { this.options.fixDropdownWidth = false; } + //* If theres only one country, then use it! + if (this.options.onlyCountries.length === 1) { + this.options.initialCountry = this.options.onlyCountries[0]; + } + //* When separateDialCode enabled, we force nationalMode to false (because the displayed dial code is supposed to be thought of as part of the typed number), AND we force allowDropdown to true as we need the dropdown to select the dial code, AND we force countrySearch to true because that is used when the user types a plus in the tel input. if (this.options.separateDialCode) { this.options.allowDropdown = true; diff --git a/vue/build/IntlTelInput.mjs b/vue/build/IntlTelInput.mjs index 14e7ec13f..54b830396 100644 --- a/vue/build/IntlTelInput.mjs +++ b/vue/build/IntlTelInput.mjs @@ -1680,7 +1680,7 @@ class j { } //* Can't be private as it's called from intlTelInput convenience wrapper. _init() { - this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.separateDialCode && (this.options.allowDropdown = !0, this.options.nationalMode = !1, this.options.countrySearch = !0), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...A, ...this.options.i18n }; + this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.allowDropdown = !0, this.options.nationalMode = !1, this.options.countrySearch = !0), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...A, ...this.options.i18n }; const t = new Promise((i, s) => { this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s; }), e = new Promise((i, s) => { @@ -2170,7 +2170,7 @@ class j { } //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { - const e = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 8; + const e = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6; this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${e}px` : this.telInput.style.paddingRight = `${e}px`; } //* Update the maximum valid number length for the currently selected country. diff --git a/vue/build/IntlTelInputWithUtils.mjs b/vue/build/IntlTelInputWithUtils.mjs index 02a55902b..85415f2c0 100644 --- a/vue/build/IntlTelInputWithUtils.mjs +++ b/vue/build/IntlTelInputWithUtils.mjs @@ -1656,20 +1656,20 @@ const n2 = { return O2.indexOf(i) !== -1; } return !1; -}, G2 = (m, e, i, r) => { - if (i === 0 && !r) +}, G2 = (m, e, i, s) => { + if (i === 0 && !s) return 0; let u = 0; for (let a = 0; a < e.length; a++) { - if (/[+0-9]/.test(e[a]) && u++, u === m && !r) + if (/[+0-9]/.test(e[a]) && u++, u === m && !s) return a + 1; - if (r && u === m + 1) + if (s && u === m + 1) return a; } return e.length; }, L = (m, e, i) => { - const r = document.createElement(m); - return e && Object.entries(e).forEach(([u, a]) => r.setAttribute(u, a)), i && i.appendChild(r), r; + const s = document.createElement(m); + return e && Object.entries(e).forEach(([u, a]) => s.setAttribute(u, a)), i && i.appendChild(s), s; }, e1 = (m) => { const { instances: e } = C; Object.values(e).forEach((i) => i[m]()); @@ -1680,11 +1680,11 @@ class U2 { } //* Can't be private as it's called from intlTelInput convenience wrapper. _init() { - this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.separateDialCode && (this.options.allowDropdown = !0, this.options.nationalMode = !1, this.options.countrySearch = !0), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...i2, ...this.options.i18n }; - const e = new Promise((r, u) => { - this.resolveAutoCountryPromise = r, this.rejectAutoCountryPromise = u; - }), i = new Promise((r, u) => { - this.resolveUtilsScriptPromise = r, this.rejectUtilsScriptPromise = u; + this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.allowDropdown = !0, this.options.nationalMode = !1, this.options.countrySearch = !0), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...i2, ...this.options.i18n }; + const e = new Promise((s, u) => { + this.resolveAutoCountryPromise = s, this.rejectAutoCountryPromise = u; + }), i = new Promise((s, u) => { + this.resolveUtilsScriptPromise = s, this.rejectUtilsScriptPromise = u; }); this.promise = Promise.all([e, i]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests(); } @@ -1698,9 +1698,9 @@ class U2 { //* Sort countries by countryOrder option (if present), then name. _sortCountries() { this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, i) => { - const { countryOrder: r } = this.options; - if (r) { - const u = r.indexOf(e.iso2), a = r.indexOf(i.iso2), f = u > -1, h = a > -1; + const { countryOrder: s } = this.options; + if (s) { + const u = s.indexOf(e.iso2), a = s.indexOf(i.iso2), f = u > -1, h = a > -1; if (f || h) return f && h ? u - a : f ? -1 : 1; } @@ -1708,30 +1708,30 @@ class U2 { }); } //* Add a dial code to this.dialCodeToIso2Map. - _addToDialCodeMap(e, i, r) { + _addToDialCodeMap(e, i, s) { i.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = i.length), this.dialCodeToIso2Map.hasOwnProperty(i) || (this.dialCodeToIso2Map[i] = []); for (let a = 0; a < this.dialCodeToIso2Map[i].length; a++) if (this.dialCodeToIso2Map[i][a] === e) return; - const u = r !== void 0 ? r : this.dialCodeToIso2Map[i].length; + const u = s !== void 0 ? s : this.dialCodeToIso2Map[i].length; this.dialCodeToIso2Map[i][u] = e; } //* Process onlyCountries or excludeCountries array if present. _processAllCountries() { const { onlyCountries: e, excludeCountries: i } = this.options; if (e.length) { - const r = e.map( + const s = e.map( (u) => u.toLowerCase() ); this.countries = H.filter( - (u) => r.indexOf(u.iso2) > -1 + (u) => s.indexOf(u.iso2) > -1 ); } else if (i.length) { - const r = i.map( + const s = i.map( (u) => u.toLowerCase() ); this.countries = H.filter( - (u) => r.indexOf(u.iso2) === -1 + (u) => s.indexOf(u.iso2) === -1 ); } else this.countries = H; @@ -1753,12 +1753,12 @@ class U2 { for (let e = 0; e < this.countries.length; e++) { const i = this.countries[e]; if (i.areaCodes) { - const r = this.dialCodeToIso2Map[i.dialCode][0]; + const s = this.dialCodeToIso2Map[i.dialCode][0]; for (let u = 0; u < i.areaCodes.length; u++) { const a = i.areaCodes[u]; for (let f = 1; f < a.length; f++) { const h = i.dialCode + a.substr(0, f); - this._addToDialCodeMap(r, h), this._addToDialCodeMap(i.iso2, h); + this._addToDialCodeMap(s, h), this._addToDialCodeMap(i.iso2, h); } this._addToDialCodeMap(i.iso2, i.dialCode + a); } @@ -1772,7 +1772,7 @@ class U2 { const { allowDropdown: e, separateDialCode: i, - showFlags: r, + showFlags: s, containerClass: u, hiddenInput: a, dropdownContainer: f, @@ -1782,9 +1782,9 @@ class U2 { i18n: I } = this.options; let S = "iti"; - e && (S += " iti--allow-dropdown"), r && (S += " iti--show-flags"), u && (S += ` ${u}`), y || (S += " iti--inline-dropdown"), this.showSelectedCountryOnLeft = e && !this.isRTL || !e && this.isRTL; + e && (S += " iti--allow-dropdown"), s && (S += " iti--show-flags"), u && (S += ` ${u}`), y || (S += " iti--inline-dropdown"), this.showSelectedCountryOnLeft = e && !this.isRTL || !e && this.isRTL; const T = L("div", { class: S }); - if ((_ = this.telInput.parentNode) == null || _.insertBefore(T, this.telInput), e || r) { + if ((_ = this.telInput.parentNode) == null || _.insertBefore(T, this.telInput), e || s) { this.countryContainer = L( "div", { @@ -1875,11 +1875,11 @@ class U2 { //* For each country: add a country list item
  • to the countryList
      container. _appendListItems() { for (let e = 0; e < this.countries.length; e++) { - const i = this.countries[e], r = e === 0 ? "iti__highlight" : "", u = L( + const i = this.countries[e], s = e === 0 ? "iti__highlight" : "", u = L( "li", { id: `iti-${this.id}__item-${i.iso2}`, - class: `iti__country ${r}`, + class: `iti__country ${s}`, tabindex: "-1", role: "option", "data-dial-code": i.dialCode, @@ -1897,7 +1897,7 @@ class U2 { //* 1. Extracting a dial code from the given number //* 2. Using explicit initialCountry _setInitialState(e = !1) { - const i = this.telInput.getAttribute("value"), r = this.telInput.value, a = i && i.charAt(0) === "+" && (!r || r.charAt(0) !== "+") ? i : r, f = this._getDialCode(a), h = $2(a), { initialCountry: y, geoIpLookup: b } = this.options, I = y === "auto" && b; + const i = this.telInput.getAttribute("value"), s = this.telInput.value, a = i && i.charAt(0) === "+" && (!s || s.charAt(0) !== "+") ? i : s, f = this._getDialCode(a), h = $2(a), { initialCountry: y, geoIpLookup: b } = this.options, I = y === "auto" && b; if (f && !h) this._updateCountryFromNumber(a); else if (!I || e) { @@ -1937,10 +1937,10 @@ class U2 { } //* Init many requests: utils script / geo ip lookup. _initRequests() { - const { utilsScript: e, initialCountry: i, geoIpLookup: r } = this.options; + const { utilsScript: e, initialCountry: i, geoIpLookup: s } = this.options; e && !C.utils ? C.documentReady() ? C.loadUtils(e) : window.addEventListener("load", () => { C.loadUtils(e); - }) : this.resolveUtilsScriptPromise(), i === "auto" && r && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise(); + }) : this.resolveUtilsScriptPromise(), i === "auto" && s && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise(); } //* Perform the geo ip lookup. _loadAutoCountry() { @@ -1956,14 +1956,14 @@ class U2 { } //* Initialize the tel input listeners. _initTelInputListeners() { - const { strictMode: e, formatAsYouType: i, separateDialCode: r, formatOnDisplay: u } = this.options; + const { strictMode: e, formatAsYouType: i, separateDialCode: s, formatOnDisplay: u } = this.options; let a = !1; new RegExp("\\p{L}", "u").test(this.telInput.value) && (a = !0); const f = () => { this._openDropdown(), this.searchInput.value = "+", this._filterCountries("", !0); }; this._handleInputEvent = (h) => { - if (this.isAndroid && (h == null ? void 0 : h.data) === "+" && r) { + if (this.isAndroid && (h == null ? void 0 : h.data) === "+" && s) { const S = this.telInput.selectionStart || 0, T = this.telInput.value.substring(0, S - 1), _ = this.telInput.value.substring(S); this.telInput.value = T + _, f(); return; @@ -1976,9 +1976,9 @@ class U2 { const S = this.telInput.selectionStart || 0, _ = this.telInput.value.substring(0, S).replace(/[^+0-9]/g, "").length, N = (h == null ? void 0 : h.inputType) === "deleteContentForward", D = this._formatNumberAsYouType(), U = G2(_, D, S, N); this.telInput.value = D, this.telInput.setSelectionRange(U, U); } - }, this.telInput.addEventListener("input", this._handleInputEvent), (e || r) && (this._handleKeydownEvent = (h) => { + }, this.telInput.addEventListener("input", this._handleInputEvent), (e || s) && (this._handleKeydownEvent = (h) => { if (h.key && h.key.length === 1 && !h.altKey && !h.ctrlKey && !h.metaKey) { - if (r && h.key === "+") { + if (s && h.key === "+") { h.preventDefault(), f(); return; } @@ -1996,19 +1996,19 @@ class U2 { } //* Trigger a custom event on the input. _trigger(e, i = {}) { - const r = new CustomEvent(e, { + const s = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: i }); - this.telInput.dispatchEvent(r); + this.telInput.dispatchEvent(s); } //* Open the dropdown. _openDropdown() { const { fixDropdownWidth: e, countrySearch: i } = this.options; if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), i) { - const r = this.countryList.firstElementChild; - r && (this._highlightListItem(r, !1), this.countryList.scrollTop = 0), this.searchInput.focus(); + const s = this.countryList.firstElementChild; + s && (this._highlightListItem(s, !1), this.countryList.scrollTop = 0), this.searchInput.focus(); } this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown"); } @@ -2040,9 +2040,9 @@ class U2 { "click", this._handleClickOffToClose ); - let i = "", r = null; + let i = "", s = null; if (this._handleKeydownOnDropdown = (u) => { - ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(u.key) && (u.preventDefault(), u.stopPropagation(), u.key === "ArrowUp" || u.key === "ArrowDown" ? this._handleUpDownKey(u.key) : u.key === "Enter" ? this._handleEnterKey() : u.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(u.key) && (u.stopPropagation(), r && clearTimeout(r), i += u.key.toLowerCase(), this._searchForCountry(i), r = setTimeout(() => { + ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(u.key) && (u.preventDefault(), u.stopPropagation(), u.key === "ArrowUp" || u.key === "ArrowDown" ? this._handleUpDownKey(u.key) : u.key === "Enter" ? this._handleEnterKey() : u.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(u.key) && (u.stopPropagation(), s && clearTimeout(s), i += u.key.toLowerCase(), this._searchForCountry(i), s = setTimeout(() => { i = ""; }, 1e3)); }, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) { @@ -2061,9 +2061,9 @@ class U2 { //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string. _searchForCountry(e) { for (let i = 0; i < this.countries.length; i++) { - const r = this.countries[i]; - if (r.name.substr(0, e.length).toLowerCase() === e) { - const a = r.nodeById[this.id]; + const s = this.countries[i]; + if (s.name.substr(0, e.length).toLowerCase() === e) { + const a = s.nodeById[this.id]; this._highlightListItem(a, !1), this._scrollTo(a); break; } @@ -2071,28 +2071,28 @@ class U2 { } //* Country search enabled: Filter the countries according to the search query. _filterCountries(e, i = !1) { - let r = !0; + let s = !0; this.countryList.innerHTML = ""; const u = e2(e); for (let a = 0; a < this.countries.length; a++) { const f = this.countries[a], h = e2(f.name), y = f.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((I) => I[0]).join("").toLowerCase(), b = `+${f.dialCode}`; if (i || h.includes(u) || b.includes(u) || f.iso2.includes(u) || y.includes(u)) { const I = f.nodeById[this.id]; - I && this.countryList.appendChild(I), r && (this._highlightListItem(I, !1), r = !1); + I && this.countryList.appendChild(I), s && (this._highlightListItem(I, !1), s = !1); } } - r && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText(); + s && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText(); } //* Update search results text (for a11y). _updateSearchResultsText() { const { i18n: e } = this.options, i = this.countryList.childElementCount; - let r; - i === 0 ? r = e.zeroSearchResults : i === 1 ? r = e.oneSearchResult : r = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = r; + let s; + i === 0 ? s = e.zeroSearchResults : i === 1 ? s = e.oneSearchResult : s = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = s; } //* Highlight the next/prev item in the list (and ensure it is visible). _handleUpDownKey(e) { - var r, u; - let i = e === "ArrowUp" ? (r = this.highlightedItem) == null ? void 0 : r.previousElementSibling : (u = this.highlightedItem) == null ? void 0 : u.nextElementSibling; + var s, u; + let i = e === "ArrowUp" ? (s = this.highlightedItem) == null ? void 0 : s.previousElementSibling : (u = this.highlightedItem) == null ? void 0 : u.nextElementSibling; !i && this.countryList.childElementCount > 1 && (i = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), i && (this._scrollTo(i), this._highlightListItem(i, !1)); } //* Select the currently highlighted item. @@ -2104,7 +2104,7 @@ class U2 { _updateValFromNumber(e) { let i = e; if (this.options.formatOnDisplay && C.utils && this.selectedCountryData) { - const r = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: u, INTERNATIONAL: a } = C.utils.numberFormat, f = r ? u : a; + const s = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: u, INTERNATIONAL: a } = C.utils.numberFormat, f = s ? u : a; i = C.utils.formatNumber( i, this.selectedCountryData.iso2, @@ -2117,10 +2117,10 @@ class U2 { //* Note: called from _setInitialState, keyup handler, setNumber. _updateCountryFromNumber(e) { const i = e.indexOf("+"); - let r = i ? e.substring(i) : e; + let s = i ? e.substring(i) : e; const u = this.selectedCountryData.dialCode; - r && u === "1" && r.charAt(0) !== "+" && (r.charAt(0) !== "1" && (r = `1${r}`), r = `+${r}`), this.options.separateDialCode && u && r.charAt(0) !== "+" && (r = `+${u}${r}`); - const f = this._getDialCode(r, !0), h = h1(r); + s && u === "1" && s.charAt(0) !== "+" && (s.charAt(0) !== "1" && (s = `1${s}`), s = `+${s}`), this.options.separateDialCode && u && s.charAt(0) !== "+" && (s = `+${u}${s}`); + const f = this._getDialCode(s, !0), h = h1(s); let y = null; if (f) { const b = this.dialCodeToIso2Map[h1(f)], I = b.indexOf(this.selectedCountryData.iso2) !== -1 && h.length <= f.length - 1; @@ -2131,13 +2131,13 @@ class U2 { break; } } - } else r.charAt(0) === "+" && h.length ? y = "" : (!r || r === "+") && !this.selectedCountryData.iso2 && (y = this.defaultCountry); + } else s.charAt(0) === "+" && h.length ? y = "" : (!s || s === "+") && !this.selectedCountryData.iso2 && (y = this.defaultCountry); return y !== null ? this._setCountry(y) : !1; } //* Remove highlighting from other list items and highlight the given item. _highlightListItem(e, i) { - const r = this.highlightedItem; - if (r && (r.classList.remove("iti__highlight"), r.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) { + const s = this.highlightedItem; + if (s && (s.classList.remove("iti__highlight"), s.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) { this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"); const u = this.highlightedItem.getAttribute("id") || ""; this.selectedCountry.setAttribute("aria-activedescendant", u), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", u); @@ -2147,9 +2147,9 @@ class U2 { //* Find the country data for the given iso2 code //* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array _getCountryData(e, i) { - for (let r = 0; r < this.countries.length; r++) - if (this.countries[r].iso2 === e) - return this.countries[r]; + for (let s = 0; s < this.countries.length; s++) + if (this.countries[s].iso2 === e) + return this.countries[s]; if (i) return null; throw new Error(`No country data for '${e}'`); @@ -2157,10 +2157,10 @@ class U2 { //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item. //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry. _setCountry(e) { - const { separateDialCode: i, showFlags: r, i18n: u } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; + const { separateDialCode: i, showFlags: s, i18n: u } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) { let f = "", h = ""; - e && r ? (f = `iti__flag iti__${e}`, h = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (f = "iti__flag iti__globe", h = u.noCountrySelected), this.selectedCountryInner.className = f, this.selectedCountryA11yText.textContent = h; + e && s ? (f = `iti__flag iti__${e}`, h = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (f = "iti__flag iti__globe", h = u.noCountrySelected), this.selectedCountryInner.className = f, this.selectedCountryA11yText.textContent = h; } if (this._setSelectedCountryTitleAttribute(e, i), i) { const f = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : ""; @@ -2170,12 +2170,12 @@ class U2 { } //* Update the input padding to make space for the selected country/dial code. _updateInputPadding() { - const i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 8; + const i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6; this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`; } //* Update the maximum valid number length for the currently selected country. _updateMaxLength() { - const { strictMode: e, placeholderNumberType: i, validationNumberType: r } = this.options; + const { strictMode: e, placeholderNumberType: i, validationNumberType: s } = this.options; if (e && C.utils) if (this.selectedCountryData.iso2) { const u = C.utils.numberType[i]; @@ -2185,7 +2185,7 @@ class U2 { u, !0 ), f = a; - for (; C.utils.isPossibleNumber(a, this.selectedCountryData.iso2, r); ) + for (; C.utils.isPossibleNumber(a, this.selectedCountryData.iso2, s); ) f = a, a += "0"; const h = C.utils.getCoreNumber(f, this.selectedCountryData.iso2); this.maxCoreNumberLength = h.length; @@ -2195,8 +2195,8 @@ class U2 { _setSelectedCountryTitleAttribute(e = null, i) { if (!this.selectedCountry) return; - let r; - e && !i ? r = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? r = this.selectedCountryData.name : r = "Unknown", this.selectedCountry.setAttribute("title", r); + let s; + e && !i ? s = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? s = this.selectedCountryData.name : s = "Unknown", this.selectedCountry.setAttribute("title", s); } //* When the input is in a hidden container during initialisation, we must inject some markup //* into the end of the DOM to calculate the correct offsetWidth. @@ -2208,9 +2208,9 @@ class U2 { e.style.visibility = "hidden", document.body.appendChild(e); const i = this.countryContainer.cloneNode(); e.appendChild(i); - const r = this.selectedCountry.cloneNode(!0); - i.appendChild(r); - const u = r.offsetWidth; + const s = this.selectedCountry.cloneNode(!0); + i.appendChild(s); + const u = s.offsetWidth; return document.body.removeChild(e), u; } return 0; @@ -2220,14 +2220,14 @@ class U2 { const { autoPlaceholder: e, placeholderNumberType: i, - nationalMode: r, + nationalMode: s, customPlaceholder: u } = this.options, a = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite"; if (C.utils && a) { const f = C.utils.numberType[i]; let h = this.selectedCountryData.iso2 ? C.utils.getExampleNumber( this.selectedCountryData.iso2, - r, + s, f ) : ""; h = this._beforeSetNumber(h), typeof u == "function" && (h = u(h, this.selectedCountryData)), this.telInput.setAttribute("placeholder", h); @@ -2252,7 +2252,7 @@ class U2 { } //* Check if an element is visible within it's container, else scroll until it is. _scrollTo(e) { - const i = this.countryList, r = document.documentElement.scrollTop, u = i.offsetHeight, a = i.getBoundingClientRect().top + r, f = a + u, h = e.offsetHeight, y = e.getBoundingClientRect().top + r, b = y + h, I = y - a + i.scrollTop; + const i = this.countryList, s = document.documentElement.scrollTop, u = i.offsetHeight, a = i.getBoundingClientRect().top + s, f = a + u, h = e.offsetHeight, y = e.getBoundingClientRect().top + s, b = y + h, I = y - a + i.scrollTop; if (y < a) i.scrollTop = I; else if (b > f) { @@ -2263,26 +2263,26 @@ class U2 { //* Replace any existing dial code with the new one //* Note: called from _selectListItem and setCountry _updateDialCode(e) { - const i = this.telInput.value, r = `+${e}`; + const i = this.telInput.value, s = `+${e}`; let u; if (i.charAt(0) === "+") { const a = this._getDialCode(i); - a ? u = i.replace(a, r) : u = r, this.telInput.value = u; + a ? u = i.replace(a, s) : u = s, this.telInput.value = u; } } //* Try and extract a valid international dial code from a full telephone number. //* Note: returns the raw string inc plus character and any whitespace/dots etc. _getDialCode(e, i) { - let r = ""; + let s = ""; if (e.charAt(0) === "+") { let u = ""; for (let a = 0; a < e.length; a++) { const f = e.charAt(a); if (!isNaN(parseInt(f, 10))) { if (u += f, i) - this.dialCodeToIso2Map[u] && (r = e.substr(0, a + 1)); + this.dialCodeToIso2Map[u] && (s = e.substr(0, a + 1)); else if (this.dialCodes[u]) { - r = e.substr(0, a + 1); + s = e.substr(0, a + 1); break; } if (u.length === this.dialCodeMaxLen) @@ -2290,23 +2290,23 @@ class U2 { } } } - return r; + return s; } //* Get the input val, adding the dial code if separateDialCode is enabled. _getFullNumber() { const e = this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData; - let r; + let s; const u = h1(e); - return this.options.separateDialCode && e.charAt(0) !== "+" && i && u ? r = `+${i}` : r = "", r + e; + return this.options.separateDialCode && e.charAt(0) !== "+" && i && u ? s = `+${i}` : s = "", s + e; } //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute _beforeSetNumber(e) { let i = e; if (this.options.separateDialCode) { - let r = this._getDialCode(i); - if (r) { - r = `+${this.selectedCountryData.dialCode}`; - const u = i[r.length] === " " || i[r.length] === "-" ? r.length + 1 : r.length; + let s = this._getDialCode(i); + if (s) { + s = `+${this.selectedCountryData.dialCode}`; + const u = i[s.length] === " " || i[s.length] === "-" ? s.length + 1 : s.length; i = i.substr(u); } } @@ -2318,8 +2318,8 @@ class U2 { } //* Format the number as the user types. _formatNumberAsYouType() { - const e = this._getFullNumber(), i = C.utils ? C.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: r } = this.selectedCountryData; - return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${r}`) ? (i.split(`+${r}`)[1] || "").trim() : i; + const e = this._getFullNumber(), i = C.utils ? C.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: s } = this.selectedCountryData; + return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${s}`) ? (i.split(`+${s}`)[1] || "").trim() : i; } //************************** //* SECRET PUBLIC METHODS @@ -2350,8 +2350,8 @@ class U2 { const h = this.telInput.closest("label"); h && h.removeEventListener("click", this._handleLabelClick); } - const { form: r } = this.telInput; - this._handleHiddenInputSubmit && r && r.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"), i && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft); + const { form: s } = this.telInput; + this._handleHiddenInputSubmit && s && s.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"), i && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft); const u = this.telInput.parentNode; (a = u == null ? void 0 : u.parentNode) == null || a.insertBefore(this.telInput, u), (f = u == null ? void 0 : u.parentNode) == null || f.removeChild(u), delete C.instances[this.id]; } @@ -2397,7 +2397,7 @@ class U2 { isValidNumber() { const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u")); if (i > -1) { - const r = e.substring(0, i), u = this._utilsIsPossibleNumber(r), a = this._utilsIsPossibleNumber(e); + const s = e.substring(0, i), u = this._utilsIsPossibleNumber(s), a = this._utilsIsPossibleNumber(e); return u && a; } return this._utilsIsPossibleNumber(e); @@ -2409,7 +2409,7 @@ class U2 { isValidNumberPrecise() { const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u")); if (i > -1) { - const r = e.substring(0, i), u = this._utilsIsValidNumber(r), a = this._utilsIsValidNumber(e); + const s = e.substring(0, i), u = this._utilsIsValidNumber(s), a = this._utilsIsValidNumber(e); return u && a; } return this._utilsIsValidNumber(e); @@ -2419,8 +2419,8 @@ class U2 { } //* Update the selected country, and update the input val accordingly. setCountry(e) { - const i = e == null ? void 0 : e.toLowerCase(), r = this.selectedCountryData.iso2; - (e && i !== r || !e && r) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange()); + const i = e == null ? void 0 : e.toLowerCase(), s = this.selectedCountryData.iso2; + (e && i !== s || !e && s) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange()); } //* Set the input value and update the country. setNumber(e) { @@ -2440,8 +2440,8 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt /* webpackIgnore: true */ /* @vite-ignore */ m - ).then(({ default: r }) => { - C.utils = r, e1("handleUtils"), e(!0); + ).then(({ default: s }) => { + C.utils = s, e1("handleUtils"), e(!0); }).catch(() => { e1("rejectUtilsScriptPromise"), i(); }); @@ -2478,12 +2478,12 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt function i(d, t) { function $() { } - $.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(n, s, o) { + $.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(n, r, o) { for (var l = Array(arguments.length - 2), c = 2; c < arguments.length; c++) l[c - 2] = arguments[c]; - return t.prototype[s].apply(n, l); + return t.prototype[r].apply(n, l); }; } - function r(d) { + function s(d) { const t = []; let $ = 0; for (const n in d) t[$++] = d[n]; @@ -2535,8 +2535,8 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) { case D: case U: - case r2: case s2: + case r2: case o2: case N: case _: @@ -2544,7 +2544,7 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt } this.j = t.defaultValue; } - var _ = 1, N = 2, D = 3, U = 4, r2 = 6, s2 = 16, o2 = 18; + var _ = 1, N = 2, D = 3, U = 4, s2 = 6, r2 = 16, o2 = 18; function u2(d, t) { for (this.h = d, this.g = {}, d = 0; d < t.length; d++) { var $ = t[d]; @@ -2552,7 +2552,7 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt } } function l2(d) { - return d = r(d.g), d.sort(function(t, $) { + return d = s(d.g), d.sort(function(t, $) { return t.g - $.g; }), d; } @@ -2570,14 +2570,14 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt }; function y1(d, t) { for (var $ = l2(d.m()), n = 0; n < $.length; n++) { - var s = $[n], o = s.g; + var r = $[n], o = r.g; if (R(t, o)) { - d.g && delete d.g[s.g]; - var l = s.h == 11 || s.h == 10; - if (s.l) { - s = x(t, o); - for (var c = 0; c < s.length; c++) _1(d, o, l ? s[c].clone() : s[c]); - } else s = $1(t, o), l ? (l = $1(d, o)) ? y1(l, s) : E(d, o, s.clone()) : E(d, o, s); + d.g && delete d.g[r.g]; + var l = r.h == 11 || r.h == 10; + if (r.l) { + r = x(t, o); + for (var c = 0; c < r.length; c++) _1(d, o, l ? r[c].clone() : r[c]); + } else r = $1(t, o), l ? (l = $1(d, o)) ? y1(l, r) : E(d, o, r.clone()) : E(d, o, r); } } } @@ -2593,11 +2593,11 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt if ($ == null) return null; if (d.l) { if (!(t in d.g)) { - var n = d.l, s = d.j[t]; - if ($ != null) if (s.l) { - for (var o = [], l = 0; l < $.length; l++) o[l] = n.h(s, $[l]); + var n = d.l, r = d.j[t]; + if ($ != null) if (r.l) { + for (var o = [], l = 0; l < $.length; l++) o[l] = n.h(r, $[l]); $ = o; - } else $ = n.h(s, $); + } else $ = n.h(r, $); return d.g[t] = $; } return d.g[t]; @@ -8082,7 +8082,7 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt return 2 > d.length ? !1 : O(I2, d); } function M1(d) { - return O(m2, d) ? r1(d, c2) : r1(d, f1); + return O(m2, d) ? s1(d, c2) : s1(d, f1); } function D1(d) { var t = M1(d.toString()); @@ -8091,14 +8091,14 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt function x1(d) { return d != null && (F(d, 9) != 1 || x(d, 9)[0] != -1); } - function r1(d, t) { - for (var $ = new A(), n, s = d.length, o = 0; o < s; ++o) n = d.charAt(o), n = t[n.toUpperCase()], n != null && $.g(n); + function s1(d, t) { + for (var $ = new A(), n, r = d.length, o = 0; o < r; ++o) n = d.charAt(o), n = t[n.toUpperCase()], n != null && $.g(n); return $.toString(); } function P1(d) { return d.length == 0 || S2.test(d); } - function s1(d) { + function r1(d) { return d != null && isNaN(d) && d.toUpperCase() in T1; } M.prototype.format = function(d, t) { @@ -8110,24 +8110,24 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt var n = d1(d); if (t == 0) return R1($, 0, n, ""); if (!($ in q)) return n; - var s = Q(this, $, t1($)); - d = R(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : R(s, 13) ? p(s, 13) + v(d, 3) : " ext. " + v(d, 3) : ""; + var r = Q(this, $, t1($)); + d = R(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : R(r, 13) ? p(r, 13) + v(d, 3) : " ext. " + v(d, 3) : ""; d: { - s = x(s, 20).length == 0 || t == 2 ? x(s, 19) : x(s, 20); - for (var o, l = s.length, c = 0; c < l; ++c) { - o = s[c]; + r = x(r, 20).length == 0 || t == 2 ? x(r, 19) : x(r, 20); + for (var o, l = r.length, c = 0; c < l; ++c) { + o = r[c]; var g = F(o, 3); if ((g == 0 || n.search(p(o, 3, g - 1)) == 0) && (g = new RegExp(p(o, 1)), O(g, n))) { - s = o; + r = o; break d; } } - s = null; + r = null; } - return s != null && (l = s, s = v(l, 2), o = new RegExp(p(l, 1)), v( + return r != null && (l = r, r = v(l, 2), o = new RegExp(p(l, 1)), v( l, 5 - ), l = v(l, 4), n = t == 2 && l != null && 0 < l.length ? n.replace(o, s.replace(v2, l)) : n.replace(o, s), t == 3 && (n = n.replace(RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+"), ""), n = n.replace(RegExp("[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), R1($, t, n, d); + ), l = v(l, 4), n = t == 2 && l != null && 0 < l.length ? n.replace(o, r.replace(v2, l)) : n.replace(o, r), t == 3 && (n = n.replace(RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+"), ""), n = n.replace(RegExp("[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), R1($, t, n, d); }; function Q(d, t, $) { return $ == "001" ? K(d, "" + t) : K(d, $); @@ -8200,7 +8200,7 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt else if ($.length == 1) d = $[0]; else d: { t = d1(t); - for (var n, s = $.length, o = 0; o < s; o++) { + for (var n, r = $.length, o = 0; o < r; o++) { n = $[o]; var l = K(d, n); if (R(l, 23)) { @@ -8225,10 +8225,10 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt return v(d, 10); } function u1(d, t, $, n) { - var s = o1($, n), o = F(s, 9) == 0 ? x(p($, 1), 9) : x(s, 9); - if (s = x(s, 10), n == 2) if (x1(o1($, 0))) d = o1($, 1), x1(d) && (o = o.concat(F(d, 9) == 0 ? x(p($, 1), 9) : x(d, 9)), o.sort(), s.length == 0 ? s = x(d, 10) : (s = s.concat(x(d, 10)), s.sort())); + var r = o1($, n), o = F(r, 9) == 0 ? x(p($, 1), 9) : x(r, 9); + if (r = x(r, 10), n == 2) if (x1(o1($, 0))) d = o1($, 1), x1(d) && (o = o.concat(F(d, 9) == 0 ? x(p($, 1), 9) : x(d, 9)), o.sort(), r.length == 0 ? r = x(d, 10) : (r = r.concat(x(d, 10)), r.sort())); else return u1(d, t, $, 1); - return o[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : ($ = o[0], $ == t ? 0 : $ > t ? 2 : o[o.length - 1] < t ? 3 : -1 < o.indexOf(t, 1) ? 0 : 5)); + return o[0] == -1 ? 5 : (t = t.length, -1 < r.indexOf(t) ? 4 : ($ = o[0], $ == t ? 0 : $ > t ? 2 : o[o.length - 1] < t ? 3 : -1 < o.indexOf(t, 1) ? 0 : 5)); } function Y(d, t, $) { var n = d1(t); @@ -8236,10 +8236,10 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt } function O1(d, t) { if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0; - for (var $, n = d.length, s = 1; 3 >= s && s <= n; ++s) if ($ = parseInt(d.substring(0, s), 10), $ in q) return t.g(d.substring(s)), $; + for (var $, n = d.length, r = 1; 3 >= r && r <= n; ++r) if ($ = parseInt(d.substring(0, r), 10), $ in q) return t.g(d.substring(r)), $; return 0; } - function G1(d, t, $, n, s, o) { + function G1(d, t, $, n, r, o) { if (t.length == 0) return 0; t = new A(t); var l; @@ -8251,36 +8251,36 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt if (c = new RegExp(l), D1(t), l = t.toString(), l.search(c) == 0) { c = l.match(c)[0].length; var g = l.substring(c).match(A1); - g && g[1] != null && 0 < g[1].length && r1(g[1], f1) == "0" ? l = !1 : (B(t), t.g(l.substring(c)), l = !0); + g && g[1] != null && 0 < g[1].length && s1(g[1], f1) == "0" ? l = !1 : (B(t), t.g(l.substring(c)), l = !0); } else l = !1; l = l ? 5 : 20; } - if (s && E(o, 6, l), l != 20) { + if (r && E(o, 6, l), l != 20) { if (2 >= t.h.length) throw Error("Phone number too short after IDD"); if (d = O1(t, n), d != 0) return E(o, 1, d), d; throw Error("Invalid country calling code"); } - return $ != null && (l = v($, 10), c = "" + l, g = t.toString(), g.lastIndexOf(c, 0) == 0 && (c = new A(g.substring(c.length)), g = p($, 1), g = new RegExp(v(g, 2)), U1(c, $, null), c = c.toString(), !O(g, t.toString()) && O(g, c) || u1(d, t.toString(), $, -1) == 3)) ? (n.g(c), s && E(o, 6, 10), E(o, 1, l), l) : (E(o, 1, 0), 0); + return $ != null && (l = v($, 10), c = "" + l, g = t.toString(), g.lastIndexOf(c, 0) == 0 && (c = new A(g.substring(c.length)), g = p($, 1), g = new RegExp(v(g, 2)), U1(c, $, null), c = c.toString(), !O(g, t.toString()) && O(g, c) || u1(d, t.toString(), $, -1) == 3)) ? (n.g(c), r && E(o, 6, 10), E(o, 1, l), l) : (E(o, 1, 0), 0); } function U1(d, t, $) { - var n = d.toString(), s = n.length, o = p(t, 15); - if (s != 0 && o != null && o.length != 0) { + var n = d.toString(), r = n.length, o = p(t, 15); + if (r != 0 && o != null && o.length != 0) { var l = new RegExp("^(?:" + o + ")"); - if (s = l.exec(n)) { + if (r = l.exec(n)) { o = new RegExp(v(p(t, 1), 2)); - var c = O(o, n), g = s.length - 1; - t = p(t, 16), t == null || t.length == 0 || s[g] == null || s[g].length == 0 ? (!c || O(o, n.substring(s[0].length))) && ($ != null && 0 < g && s[g] != null && $.g(s[1]), d.set(n.substring(s[0].length))) : (n = n.replace(l, t), (!c || O(o, n)) && ($ != null && 0 < g && $.g(s[1]), d.set(n))); + var c = O(o, n), g = r.length - 1; + t = p(t, 16), t == null || t.length == 0 || r[g] == null || r[g].length == 0 ? (!c || O(o, n.substring(r[0].length))) && ($ != null && 0 < g && r[g] != null && $.g(r[1]), d.set(n.substring(r[0].length))) : (n = n.replace(l, t), (!c || O(o, n)) && ($ != null && 0 < g && $.g(r[1]), d.set(n))); } } } function z(d, t, $) { - if (!s1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code"); + if (!r1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code"); return F1(d, t, $, !0); } function F1(d, t, $, n) { if (t == null) throw Error("The string supplied did not seem to be a phone number"); if (250 < t.length) throw Error("The string supplied is too long to be a phone number"); - var s = new A(), o = t.indexOf(";phone-context="); + var r = new A(), o = t.indexOf(";phone-context="); if (o === -1) o = null; else if (o += 15, o >= t.length) o = ""; else { @@ -8288,20 +8288,20 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt o = l !== -1 ? t.substring(o, l) : t.substring(o); } var c = o; - if (c == null ? l = !0 : c.length === 0 ? l = !1 : (l = y2.exec(c), c = _2.exec(c), l = l !== null || c !== null), !l || (o != null ? (o.charAt(0) === "+" && s.g(o), o = t.indexOf("tel:"), s.g(t.substring(0 <= o ? o + 4 : 0, t.indexOf(";phone-context=")))) : (o = s.g, l = t ?? "", c = l.search(p2), 0 <= c ? (l = l.substring(c), l = l.replace(C2, ""), c = l.search(g2), 0 <= c && (l = l.substring(0, c))) : l = "", o.call(s, l)), o = s.toString(), l = o.indexOf(";isub="), 0 < l && (B(s), s.g(o.substring(0, l))), !E1(s.toString()))) throw Error("The string supplied did not seem to be a phone number"); - if (o = s.toString(), !(s1($) || o != null && 0 < o.length && X.test(o))) throw Error("Invalid country calling code"); + if (c == null ? l = !0 : c.length === 0 ? l = !1 : (l = y2.exec(c), c = _2.exec(c), l = l !== null || c !== null), !l || (o != null ? (o.charAt(0) === "+" && r.g(o), o = t.indexOf("tel:"), r.g(t.substring(0 <= o ? o + 4 : 0, t.indexOf(";phone-context=")))) : (o = r.g, l = t ?? "", c = l.search(p2), 0 <= c ? (l = l.substring(c), l = l.replace(C2, ""), c = l.search(g2), 0 <= c && (l = l.substring(0, c))) : l = "", o.call(r, l)), o = r.toString(), l = o.indexOf(";isub="), 0 < l && (B(r), r.g(o.substring(0, l))), !E1(r.toString()))) throw Error("The string supplied did not seem to be a phone number"); + if (o = r.toString(), !(r1($) || o != null && 0 < o.length && X.test(o))) throw Error("Invalid country calling code"); o = new V(), n && E(o, 5, t); d: { - if (t = s.toString(), l = t.search(N1), 0 <= l && E1(t.substring(0, l))) { + if (t = r.toString(), l = t.search(N1), 0 <= l && E1(t.substring(0, l))) { c = t.match(N1); for (var g = c.length, G = 1; G < g; ++G) if (c[G] != null && 0 < c[G].length) { - B(s), s.g(t.substring(0, l)), t = c[G]; + B(r), r.g(t.substring(0, l)), t = c[G]; break d; } } t = ""; } - 0 < t.length && E(o, 3, t), l = K(d, $), t = new A(), c = 0, g = s.toString(); + 0 < t.length && E(o, 3, t), l = K(d, $), t = new A(), c = 0, g = r.toString(); try { c = G1(d, g, l, t, n, o); } catch (C1) { @@ -8309,11 +8309,11 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt if (g = g.replace(X, ""), c = G1(d, g, l, t, n, o), c == 0) throw C1; } else throw C1; } - if (c != 0 ? (s = t1(c), s != $ && (l = Q(d, c, s))) : (D1(s), t.g(s.toString()), $ != null ? (c = v(l, 10), E( + if (c != 0 ? (r = t1(c), r != $ && (l = Q(d, c, r))) : (D1(r), t.g(r.toString()), $ != null ? (c = v(l, 10), E( o, 1, c - )) : n && (delete o.h[6], o.g && delete o.g[6])), 2 > t.h.length || (l != null && ($ = new A(), s = new A(t.toString()), U1(s, l, $), d = u1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, n && 0 < $.toString().length && E(o, 7, $.toString()))), n = t.toString(), d = n.length, 2 > d)) throw Error("The string supplied is too short to be a phone number"); + )) : n && (delete o.h[6], o.g && delete o.g[6])), 2 > t.h.length || (l != null && ($ = new A(), r = new A(t.toString()), U1(r, l, $), d = u1(d, r.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = r, n && 0 < $.toString().length && E(o, 7, $.toString()))), n = t.toString(), d = n.length, 2 > d)) throw Error("The string supplied is too short to be a phone number"); if (17 < d) throw Error("The string supplied is too long to be a phone number"); if (1 < n.length && n.charAt(0) == "0") { for (E(o, 4, !0), d = 1; d < n.length - 1 && n.charAt(d) == "0"; ) d++; @@ -8332,23 +8332,23 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt var b2 = RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)*$"), K1 = /[- ]/; function H1(d, t) { var $ = d.ga; - return t = s1(t) ? k1($, t) : 0, d = K(d.ga, t1(t)), d ?? V1; + return t = r1(t) ? k1($, t) : 0, d = K(d.ga, t1(t)), d ?? V1; } function j1(d) { for (var t = d.j.length, $ = 0; $ < t; ++$) { - var n = d.j[$], s = v(n, 1); - if (d.da == s) return !1; + var n = d.j[$], r = v(n, 1); + if (d.da == r) return !1; var o = d, l = n, c = v(l, 1); B(o.v); var g = o; l = v(l, 2); var G = "999999999999999".match(c)[0]; - if (G.length < g.g.h.length ? g = "" : (g = G.replace(new RegExp(c, "g"), l), g = g.replace(RegExp("9", "g"), " ")), 0 < g.length ? (o.v.g(g), o = !0) : o = !1, o) return d.da = s, d.ha = K1.test(p(n, 4)), d.$ = 0, !0; + if (G.length < g.g.h.length ? g = "" : (g = G.replace(new RegExp(c, "g"), l), g = g.replace(RegExp("9", "g"), " ")), 0 < g.length ? (o.v.g(g), o = !0) : o = !1, o) return d.da = r, d.ha = K1.test(p(n, 4)), d.$ = 0, !0; } return d.u = !1; } function W1(d, t) { - for (var $ = [], n = t.length - 3, s = d.j.length, o = 0; o < s; ++o) { + for (var $ = [], n = t.length - 3, r = d.j.length, o = 0; o < r; ++o) { var l = d.j[o]; F(l, 3) == 0 ? $.push(d.j[o]) : (l = p(l, 3, Math.min(n, F(l, 3) - 1)), t.search(l) == 0 && $.push(d.j[o])); } @@ -8382,8 +8382,8 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt } function Z1(d) { for (var t = d.g.toString(), $ = d.j.length, n = 0; n < $; ++n) { - var s = d.j[n], o = v(s, 1); - if (new RegExp("^(?:" + o + ")$").test(t) && (d.ha = K1.test(p(s, 4)), s = t.replace(new RegExp(o, "g"), p(s, 2)), s = l1(d, s), r1(s, h2) == d.ba)) return s; + var r = d.j[n], o = v(r, 1); + if (new RegExp("^(?:" + o + ")$").test(t) && (d.ha = K1.test(p(r, 4)), r = t.replace(new RegExp(o, "g"), p(r, 2)), r = l1(d, r), s1(r, h2) == d.ba)) return r; } return ""; } @@ -8394,8 +8394,8 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt function g1(d) { var t = d.g.toString(); if (3 <= t.length) { - for (var $ = d.ca && d.o.length == 0 && 0 < F(d.l, 20) ? x(d.l, 20) : x(d.l, 19), n = $.length, s = 0; s < n; ++s) { - var o = $[s]; + for (var $ = d.ca && d.o.length == 0 && 0 < F(d.l, 20) ? x(d.l, 20) : x(d.l, 19), n = $.length, r = 0; r < n; ++r) { + var o = $[r]; 0 < d.o.length && P1(v(o, 4)) && !p(o, 6) && !R(o, 5) || (d.o.length != 0 || d.ca || P1(v(o, 4)) || p(o, 6)) && b2.test(v(o, 2)) && d.j.push(o); } return W1(d, t), t = Z1(d), 0 < t.length ? t : j1(d) ? Y1(d) : d.s.toString(); @@ -8405,7 +8405,7 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt function Y1(d) { var t = d.g.toString(), $ = t.length; if (0 < $) { - for (var n = "", s = 0; s < $; s++) n = Q1(d, t.charAt(s)); + for (var n = "", r = 0; r < $; r++) n = Q1(d, t.charAt(r)); return d.u ? l1(d, n) : d.s.toString(); } return d.h.toString(); @@ -8438,16 +8438,16 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt try { const $ = d.replace(/[^+0-9]/g, ""), n = new w2(t); t = ""; - for (let s = 0; s < $.length; s++) n.ja = T2(n, $.charAt(s)), t = n.ja; + for (let r = 0; r < $.length; r++) n.ja = T2(n, $.charAt(r)), t = n.ja; return t; } catch { return d; } }), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => { try { - const s = M.g(), o = z(s, d, t); - var n = Y(s, o, -1); - return n == 0 || n == 4 ? s.format(o, typeof $ > "u" ? 0 : $) : d; + const r = M.g(), o = z(r, d, t); + var n = Y(r, o, -1); + return n == 0 || n == 4 ? r.format(o, typeof $ > "u" ? 0 : $) : d; } catch { return d; } @@ -8455,12 +8455,12 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt try { const g = M.g(); d: { - var s = g; - if (s1(d)) { - var o = o1(K(s, d), $); + var r = g; + if (r1(d)) { + var o = o1(K(r, d), $); try { if (R(o, 6)) { - var l = p(o, 6), c = F1(s, l, d, !1); + var l = p(o, 6), c = F1(r, l, d, !1); break d; } } catch { @@ -8482,12 +8482,12 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt try { const l = M.g(), c = z(l, d, t); var $ = B1(l, c), n = Q(l, v(c, 1), $); - if (n == null) var s = -1; + if (n == null) var r = -1; else { var o = d1(c); - s = p1(o, n); + r = p1(o, n); } - return s; + return r; } catch { return -99; } @@ -8503,8 +8503,8 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt const g = M.g(); var $ = z(g, d, t), n = B1(g, $); d = g; - var s = v($, 1), o = Q(d, s, n); - if (o == null || n != "001" && s != k1(d, n)) var l = !1; + var r = v($, 1), o = Q(d, r, n); + if (o == null || n != "001" && r != k1(d, n)) var l = !1; else { var c = d1($); l = p1(c, o) != -1; @@ -8515,16 +8515,16 @@ const F2 = (m) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt } }), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => { try { - const n = M.g(), s = z(n, d, t); + const n = M.g(), r = z(n, d, t); if ($) { - const o = Y(n, s, a1[$]) === 0; + const o = Y(n, r, a1[$]) === 0; if ($ === "FIXED_LINE_OR_MOBILE") { - const l = Y(n, s, a1.MOBILE) === 0, c = Y(n, s, a1.FIXED_LINE) === 0; + const l = Y(n, r, a1.MOBILE) === 0, c = Y(n, r, a1.FIXED_LINE) === 0; return l || c || o; } return o; } - return Y(n, s, -1) === 0; + return Y(n, r, -1) === 0; } catch { return !1; } @@ -8562,7 +8562,7 @@ const H2 = { }), emits: /* @__PURE__ */ d2(["changeNumber", "changeCountry", "changeValidity", "changeErrorCode"], ["update:modelValue"]), setup(m, { expose: e, emit: i }) { - const r = A2(m, "modelValue"), u = m, a = i, f = m1(), h = m1(), y = m1(!1), b = () => h.value ? u.options.strictMode ? h.value.isValidNumberPrecise() : h.value.isValidNumber() : null, I = () => { + const s = A2(m, "modelValue"), u = m, a = i, f = m1(), h = m1(), y = m1(!1), b = () => h.value ? u.options.strictMode ? h.value.isValidNumberPrecise() : h.value.isValidNumber() : null, I = () => { let _ = b(); y.value !== _ && (y.value = _, a("changeValidity", !!_), a("changeErrorCode", _ ? null : h.value.getValidationError())); }, S = () => { @@ -8586,12 +8586,12 @@ const H2 = { }), e({ instance: h, input: f }), (_, N) => M2((D2(), x2("input", { ref_key: "input", ref: f, - "onUpdate:modelValue": N[0] || (N[0] = (D) => r.value = D), + "onUpdate:modelValue": N[0] || (N[0] = (D) => s.value = D), type: "tel", onCountrychange: T, onInput: S }, null, 544)), [ - [P2, r.value] + [P2, s.value] ]); } };