diff --git a/public/assets/build/css/demo.css b/public/assets/build/css/demo.css index e07f0a0..b2d9053 100644 --- a/public/assets/build/css/demo.css +++ b/public/assets/build/css/demo.css @@ -9,20 +9,6 @@ body { color: #555; } -pre { - margin: 0 !important; - display: inline-block; -} - -.token.operator, -.token.entity, -.token.url, -.language-css .token.string, -.style .token.string, -.token.variable { - background: none; -} - input, button { height: 35px; @@ -41,11 +27,10 @@ button[disabled] { input, select { border: 1px solid #ccc; - width: 250px; + width: 220px; } -::placeholder, -:-ms-input-placeholder { +input::placeholder { color: #bbb; } @@ -53,9 +38,14 @@ button { color: #fff; background-color: #428bca; border: 1px solid #357ebd; + margin-left: 5px; } button:hover { background-color: #3276b1; border-color: #285e8e; cursor: pointer; +} + +.notice { + margin-top: 15px; } \ No newline at end of file diff --git a/public/assets/build/css/intlTelInput.css b/public/assets/build/css/intlTelInput.css index 47e76ae..42a9594 100644 --- a/public/assets/build/css/intlTelInput.css +++ b/public/assets/build/css/intlTelInput.css @@ -11,9 +11,16 @@ .iti__v-hide { visibility: hidden; } -.iti input, -.iti input[type=text], -.iti input[type=tel] { +.iti__a11y-text { + width: 1px; + height: 1px; + clip: rect(1px, 1px, 1px, 1px); + overflow: hidden; + position: absolute; +} +.iti input.iti__tel-input, +.iti input.iti__tel-input[type=text], +.iti input.iti__tel-input[type=tel] { position: relative; z-index: 0; margin-top: 0 !important; @@ -52,26 +59,46 @@ border-top: none; border-bottom: 4px solid #555; } -.iti__country-list { +.iti__dropdown-content { + border-radius: 3px; + background-color: white; +} +.iti--inline-dropdown .iti__dropdown-content { position: absolute; z-index: 2; + margin-top: 3px; + margin-left: -1px; + border: 1px solid #ccc; + box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); +} +.iti__dropdown-content--dropup { + bottom: 100%; + margin-bottom: 3px; +} +.iti__search-input { + width: 100%; + border-width: 0; + border-radius: 3px; + padding: 9px 12px; +} +.iti__search-input + .iti__country-list { + border-top: 1px solid #ccc; +} +.iti__country-list { list-style: none; padding: 0; - margin: 0 0 0 -1px; - box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); - background-color: white; - border: 1px solid #ccc; - white-space: nowrap; - max-height: 200px; + margin: 0; overflow-y: scroll; -webkit-overflow-scrolling: touch; } -.iti__country-list--dropup { - bottom: 100%; - margin-bottom: -1px; +.iti--inline-dropdown .iti__country-list { + max-height: 185px; +} +.iti--flexible-dropdown-width .iti__country-list { + white-space: nowrap; } @media (max-width: 500px) { - .iti__country-list { + .iti--flexible-dropdown-width .iti__country-list { white-space: normal; } } @@ -87,7 +114,7 @@ .iti__country { display: flex; align-items: center; - padding: 5px 10px; + padding: 8px 8px; outline: none; } .iti__dial-code { @@ -97,35 +124,35 @@ background-color: rgba(0, 0, 0, 0.05); } .iti__flag-box, .iti__country-name { - margin-right: 6px; + margin-right: 8px; } [dir=rtl] .iti__flag-box, [dir=rtl] .iti__country-name { margin-right: 0; - margin-left: 6px; + margin-left: 8px; } -.iti--allow-dropdown input, -.iti--allow-dropdown input[type=text], -.iti--allow-dropdown input[type=tel], .iti--separate-dial-code input, -.iti--separate-dial-code input[type=text], -.iti--separate-dial-code input[type=tel] { +.iti--allow-dropdown input.iti__tel-input, +.iti--allow-dropdown input.iti__tel-input[type=text], +.iti--allow-dropdown input.iti__tel-input[type=tel], .iti--show-selected-dial-code input.iti__tel-input, +.iti--show-selected-dial-code input.iti__tel-input[type=text], +.iti--show-selected-dial-code input.iti__tel-input[type=tel] { padding-right: 6px; padding-left: 52px; margin-left: 0; } -[dir=rtl] .iti--allow-dropdown input, -[dir=rtl] .iti--allow-dropdown input[type=text], -[dir=rtl] .iti--allow-dropdown input[type=tel], [dir=rtl] .iti--separate-dial-code input, -[dir=rtl] .iti--separate-dial-code input[type=text], -[dir=rtl] .iti--separate-dial-code input[type=tel] { +[dir=rtl] .iti--allow-dropdown input.iti__tel-input, +[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=text], +[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=tel], [dir=rtl] .iti--show-selected-dial-code input.iti__tel-input, +[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=text], +[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=tel] { padding-right: 52px; padding-left: 6px; margin-right: 0; } -.iti--allow-dropdown .iti__flag-container, .iti--separate-dial-code .iti__flag-container { +.iti--allow-dropdown .iti__flag-container, .iti--show-selected-dial-code .iti__flag-container { right: auto; left: 0; } -[dir=rtl] .iti--allow-dropdown .iti__flag-container, [dir=rtl] .iti--separate-dial-code .iti__flag-container { +[dir=rtl] .iti--allow-dropdown .iti__flag-container, [dir=rtl] .iti--show-selected-dial-code .iti__flag-container { right: 0; left: auto; } @@ -135,26 +162,26 @@ .iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag { background-color: rgba(0, 0, 0, 0.05); } -.iti--allow-dropdown input[disabled] + .iti__flag-container:hover, -.iti--allow-dropdown input[readonly] + .iti__flag-container:hover { +.iti--allow-dropdown .iti__flag-container:has(+ input[disabled]):hover, +.iti--allow-dropdown .iti__flag-container:has(+ input[readonly]):hover { cursor: default; } -.iti--allow-dropdown input[disabled] + .iti__flag-container:hover .iti__selected-flag, -.iti--allow-dropdown input[readonly] + .iti__flag-container:hover .iti__selected-flag { +.iti--allow-dropdown .iti__flag-container:has(+ input[disabled]):hover .iti__selected-flag, +.iti--allow-dropdown .iti__flag-container:has(+ input[readonly]):hover .iti__selected-flag { background-color: transparent; } -.iti--separate-dial-code .iti__selected-flag { +.iti--show-selected-dial-code .iti__selected-flag { background-color: rgba(0, 0, 0, 0.05); } -.iti--separate-dial-code.iti--show-flags .iti__selected-dial-code { +.iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code { margin-left: 6px; } -[dir=rtl] .iti--separate-dial-code.iti--show-flags .iti__selected-dial-code { +[dir=rtl] .iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code { margin-left: 0; margin-right: 6px; } .iti--container { - position: absolute; + position: fixed; top: -1000px; left: -1000px; z-index: 1060; @@ -164,18 +191,28 @@ cursor: pointer; } -.iti-mobile .iti--container { - top: 30px; - bottom: 30px; - left: 30px; - right: 30px; +.iti--fullscreen-popup.iti--container { + background-color: rgba(0, 0, 0, 0.5); + top: 0; + bottom: 0; + left: 0; + right: 0; position: fixed; + padding: 30px; + display: flex; + flex-direction: column; + justify-content: center; +} +.iti--fullscreen-popup.iti--container.iti--country-search { + justify-content: flex-start; } -.iti-mobile .iti__country-list { +.iti--fullscreen-popup .iti__dropdown-content { + display: flex; + flex-direction: column; max-height: 100%; - width: 100%; + position: relative; } -.iti-mobile .iti__country { +.iti--fullscreen-popup .iti__country { padding: 10px 10px; line-height: 1.5em; } @@ -201,7 +238,7 @@ .iti__flag.iti__va { width: 15px; } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { +@media (min-resolution: 2x) { .iti__flag { background-size: 5762px 15px; } @@ -1264,15 +1301,23 @@ box-shadow: 0px 0px 1px 0px #888; background-image: url("../img/flags.png?1"); background-repeat: no-repeat; - background-color: #dbdbdb; background-position: 20px 0; } -@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { +@media (min-resolution: 2x) { .iti__flag { background-image: url("../img/flags@2x.png?1"); } } -.iti__flag.iti__np { - background-color: transparent; +.iti__globe { + background-image: url("../img/globe.png"); + background-size: contain; + background-position: right; + box-shadow: none; + height: 19px; +} +@media (min-resolution: 2x) { + .iti__globe { + background-image: url("../img/globe@2x.png"); + } } \ No newline at end of file diff --git a/public/assets/build/css/intlTelInput.min.css b/public/assets/build/css/intlTelInput.min.css index dbdfb75..73eff58 100644 --- a/public/assets/build/css/intlTelInput.min.css +++ b/public/assets/build/css/intlTelInput.min.css @@ -1 +1 @@ -.iti{position:relative;display:inline-block}.iti *{box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input,.iti input[type=tel],.iti input[type=text]{position:relative;z-index:0;margin-top:0!important;margin-bottom:0!important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}[dir=rtl] .iti__arrow{margin-right:6px;margin-left:0}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__country-list{position:absolute;z-index:2;list-style:none;padding:0;margin:0 0 0 -1px;box-shadow:1px 1px 4px rgba(0,0,0,.2);background-color:#fff;border:1px solid #ccc;white-space:nowrap;max-height:200px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti__country-list--dropup{bottom:100%;margin-bottom:-1px}@media (max-width:500px){.iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #ccc}.iti__country{display:flex;align-items:center;padding:5px 10px;outline:0}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:rgba(0,0,0,.05)}.iti__country-name,.iti__flag-box{margin-right:6px}[dir=rtl] .iti__country-name,[dir=rtl] .iti__flag-box{margin-right:0;margin-left:6px}.iti--allow-dropdown input,.iti--allow-dropdown input[type=tel],.iti--allow-dropdown input[type=text],.iti--separate-dial-code input,.iti--separate-dial-code input[type=tel],.iti--separate-dial-code input[type=text]{padding-right:6px;padding-left:52px;margin-left:0}[dir=rtl] .iti--allow-dropdown input,[dir=rtl] .iti--allow-dropdown input[type=tel],[dir=rtl] .iti--allow-dropdown input[type=text],[dir=rtl] .iti--separate-dial-code input,[dir=rtl] .iti--separate-dial-code input[type=tel],[dir=rtl] .iti--separate-dial-code input[type=text]{padding-right:52px;padding-left:6px;margin-right:0}.iti--allow-dropdown .iti__flag-container,.iti--separate-dial-code .iti__flag-container{right:auto;left:0}[dir=rtl] .iti--allow-dropdown .iti__flag-container,[dir=rtl] .iti--separate-dial-code .iti__flag-container{right:0;left:auto}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover{cursor:default}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover .iti__selected-flag,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover .iti__selected-flag{background-color:transparent}.iti--separate-dial-code .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--separate-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:6px}[dir=rtl] .iti--separate-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:0;margin-right:6px}.iti--container{position:absolute;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti-mobile .iti--container{top:30px;bottom:30px;left:30px;right:30px;position:fixed}.iti-mobile .iti__country-list{max-height:100%;width:100%}.iti-mobile .iti__country{padding:10px 10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.iti__flag{background-size:5762px 15px}}.iti__flag.iti__ac{height:10px;background-position:0 0}.iti__flag.iti__ad{height:14px;background-position:-22px 0}.iti__flag.iti__ae{height:10px;background-position:-44px 0}.iti__flag.iti__af{height:14px;background-position:-66px 0}.iti__flag.iti__ag{height:14px;background-position:-88px 0}.iti__flag.iti__ai{height:10px;background-position:-110px 0}.iti__flag.iti__al{height:15px;background-position:-132px 0}.iti__flag.iti__am{height:10px;background-position:-154px 0}.iti__flag.iti__ao{height:14px;background-position:-176px 0}.iti__flag.iti__aq{height:14px;background-position:-198px 0}.iti__flag.iti__ar{height:13px;background-position:-220px 0}.iti__flag.iti__as{height:10px;background-position:-242px 0}.iti__flag.iti__at{height:14px;background-position:-264px 0}.iti__flag.iti__au{height:10px;background-position:-286px 0}.iti__flag.iti__aw{height:14px;background-position:-308px 0}.iti__flag.iti__ax{height:13px;background-position:-330px 0}.iti__flag.iti__az{height:10px;background-position:-352px 0}.iti__flag.iti__ba{height:10px;background-position:-374px 0}.iti__flag.iti__bb{height:14px;background-position:-396px 0}.iti__flag.iti__bd{height:12px;background-position:-418px 0}.iti__flag.iti__be{height:15px;background-position:-440px 0}.iti__flag.iti__bf{height:14px;background-position:-460px 0}.iti__flag.iti__bg{height:12px;background-position:-482px 0}.iti__flag.iti__bh{height:12px;background-position:-504px 0}.iti__flag.iti__bi{height:12px;background-position:-526px 0}.iti__flag.iti__bj{height:14px;background-position:-548px 0}.iti__flag.iti__bl{height:14px;background-position:-570px 0}.iti__flag.iti__bm{height:10px;background-position:-592px 0}.iti__flag.iti__bn{height:10px;background-position:-614px 0}.iti__flag.iti__bo{height:14px;background-position:-636px 0}.iti__flag.iti__bq{height:14px;background-position:-658px 0}.iti__flag.iti__br{height:14px;background-position:-680px 0}.iti__flag.iti__bs{height:10px;background-position:-702px 0}.iti__flag.iti__bt{height:14px;background-position:-724px 0}.iti__flag.iti__bv{height:15px;background-position:-746px 0}.iti__flag.iti__bw{height:14px;background-position:-768px 0}.iti__flag.iti__by{height:10px;background-position:-790px 0}.iti__flag.iti__bz{height:12px;background-position:-812px 0}.iti__flag.iti__ca{height:10px;background-position:-834px 0}.iti__flag.iti__cc{height:10px;background-position:-856px 0}.iti__flag.iti__cd{height:15px;background-position:-878px 0}.iti__flag.iti__cf{height:14px;background-position:-900px 0}.iti__flag.iti__cg{height:14px;background-position:-922px 0}.iti__flag.iti__ch{height:15px;background-position:-944px 0}.iti__flag.iti__ci{height:14px;background-position:-961px 0}.iti__flag.iti__ck{height:10px;background-position:-983px 0}.iti__flag.iti__cl{height:14px;background-position:-1005px 0}.iti__flag.iti__cm{height:14px;background-position:-1027px 0}.iti__flag.iti__cn{height:14px;background-position:-1049px 0}.iti__flag.iti__co{height:14px;background-position:-1071px 0}.iti__flag.iti__cp{height:14px;background-position:-1093px 0}.iti__flag.iti__cq{height:12px;background-position:-1115px 0}.iti__flag.iti__cr{height:12px;background-position:-1137px 0}.iti__flag.iti__cu{height:10px;background-position:-1159px 0}.iti__flag.iti__cv{height:12px;background-position:-1181px 0}.iti__flag.iti__cw{height:14px;background-position:-1203px 0}.iti__flag.iti__cx{height:10px;background-position:-1225px 0}.iti__flag.iti__cy{height:14px;background-position:-1247px 0}.iti__flag.iti__cz{height:14px;background-position:-1269px 0}.iti__flag.iti__de{height:12px;background-position:-1291px 0}.iti__flag.iti__dg{height:10px;background-position:-1313px 0}.iti__flag.iti__dj{height:14px;background-position:-1335px 0}.iti__flag.iti__dk{height:15px;background-position:-1357px 0}.iti__flag.iti__dm{height:10px;background-position:-1379px 0}.iti__flag.iti__do{height:14px;background-position:-1401px 0}.iti__flag.iti__dz{height:14px;background-position:-1423px 0}.iti__flag.iti__ea{height:14px;background-position:-1445px 0}.iti__flag.iti__ec{height:14px;background-position:-1467px 0}.iti__flag.iti__ee{height:13px;background-position:-1489px 0}.iti__flag.iti__eg{height:14px;background-position:-1511px 0}.iti__flag.iti__eh{height:10px;background-position:-1533px 0}.iti__flag.iti__er{height:10px;background-position:-1555px 0}.iti__flag.iti__es{height:14px;background-position:-1577px 0}.iti__flag.iti__et{height:10px;background-position:-1599px 0}.iti__flag.iti__eu{height:14px;background-position:-1621px 0}.iti__flag.iti__ez{height:14px;background-position:-1643px 0}.iti__flag.iti__fi{height:12px;background-position:-1665px 0}.iti__flag.iti__fj{height:10px;background-position:-1687px 0}.iti__flag.iti__fk{height:10px;background-position:-1709px 0}.iti__flag.iti__fm{height:11px;background-position:-1731px 0}.iti__flag.iti__fo{height:15px;background-position:-1753px 0}.iti__flag.iti__fr{height:14px;background-position:-1775px 0}.iti__flag.iti__fx{height:14px;background-position:-1797px 0}.iti__flag.iti__ga{height:15px;background-position:-1819px 0}.iti__flag.iti__gb{height:10px;background-position:-1841px 0}.iti__flag.iti__gd{height:12px;background-position:-1863px 0}.iti__flag.iti__ge{height:14px;background-position:-1885px 0}.iti__flag.iti__gf{height:14px;background-position:-1907px 0}.iti__flag.iti__gg{height:14px;background-position:-1929px 0}.iti__flag.iti__gh{height:14px;background-position:-1951px 0}.iti__flag.iti__gi{height:10px;background-position:-1973px 0}.iti__flag.iti__gl{height:14px;background-position:-1995px 0}.iti__flag.iti__gm{height:14px;background-position:-2017px 0}.iti__flag.iti__gn{height:14px;background-position:-2039px 0}.iti__flag.iti__gp{height:14px;background-position:-2061px 0}.iti__flag.iti__gq{height:14px;background-position:-2083px 0}.iti__flag.iti__gr{height:14px;background-position:-2105px 0}.iti__flag.iti__gs{height:10px;background-position:-2127px 0}.iti__flag.iti__gt{height:13px;background-position:-2149px 0}.iti__flag.iti__gu{height:11px;background-position:-2171px 0}.iti__flag.iti__gw{height:10px;background-position:-2193px 0}.iti__flag.iti__gy{height:12px;background-position:-2215px 0}.iti__flag.iti__hk{height:14px;background-position:-2237px 0}.iti__flag.iti__hm{height:10px;background-position:-2259px 0}.iti__flag.iti__hn{height:10px;background-position:-2281px 0}.iti__flag.iti__hr{height:10px;background-position:-2303px 0}.iti__flag.iti__ht{height:12px;background-position:-2325px 0}.iti__flag.iti__hu{height:10px;background-position:-2347px 0}.iti__flag.iti__ic{height:14px;background-position:-2369px 0}.iti__flag.iti__id{height:14px;background-position:-2391px 0}.iti__flag.iti__ie{height:10px;background-position:-2413px 0}.iti__flag.iti__il{height:15px;background-position:-2435px 0}.iti__flag.iti__im{height:10px;background-position:-2457px 0}.iti__flag.iti__in{height:14px;background-position:-2479px 0}.iti__flag.iti__io{height:10px;background-position:-2501px 0}.iti__flag.iti__iq{height:14px;background-position:-2523px 0}.iti__flag.iti__ir{height:12px;background-position:-2545px 0}.iti__flag.iti__is{height:15px;background-position:-2567px 0}.iti__flag.iti__it{height:14px;background-position:-2589px 0}.iti__flag.iti__je{height:12px;background-position:-2611px 0}.iti__flag.iti__jm{height:10px;background-position:-2633px 0}.iti__flag.iti__jo{height:10px;background-position:-2655px 0}.iti__flag.iti__jp{height:14px;background-position:-2677px 0}.iti__flag.iti__ke{height:14px;background-position:-2699px 0}.iti__flag.iti__kg{height:12px;background-position:-2721px 0}.iti__flag.iti__kh{height:13px;background-position:-2743px 0}.iti__flag.iti__ki{height:10px;background-position:-2765px 0}.iti__flag.iti__km{height:12px;background-position:-2787px 0}.iti__flag.iti__kn{height:14px;background-position:-2809px 0}.iti__flag.iti__kp{height:10px;background-position:-2831px 0}.iti__flag.iti__kr{height:14px;background-position:-2853px 0}.iti__flag.iti__kw{height:10px;background-position:-2875px 0}.iti__flag.iti__ky{height:10px;background-position:-2897px 0}.iti__flag.iti__kz{height:10px;background-position:-2919px 0}.iti__flag.iti__la{height:14px;background-position:-2941px 0}.iti__flag.iti__lb{height:14px;background-position:-2963px 0}.iti__flag.iti__lc{height:10px;background-position:-2985px 0}.iti__flag.iti__li{height:12px;background-position:-3007px 0}.iti__flag.iti__lk{height:10px;background-position:-3029px 0}.iti__flag.iti__lr{height:11px;background-position:-3051px 0}.iti__flag.iti__ls{height:14px;background-position:-3073px 0}.iti__flag.iti__lt{height:12px;background-position:-3095px 0}.iti__flag.iti__lu{height:12px;background-position:-3117px 0}.iti__flag.iti__lv{height:10px;background-position:-3139px 0}.iti__flag.iti__ly{height:10px;background-position:-3161px 0}.iti__flag.iti__ma{height:14px;background-position:-3183px 0}.iti__flag.iti__mc{height:15px;background-position:-3205px 0}.iti__flag.iti__md{height:10px;background-position:-3226px 0}.iti__flag.iti__me{height:10px;background-position:-3248px 0}.iti__flag.iti__mf{height:14px;background-position:-3270px 0}.iti__flag.iti__mg{height:14px;background-position:-3292px 0}.iti__flag.iti__mh{height:11px;background-position:-3314px 0}.iti__flag.iti__mk{height:10px;background-position:-3336px 0}.iti__flag.iti__ml{height:14px;background-position:-3358px 0}.iti__flag.iti__mm{height:14px;background-position:-3380px 0}.iti__flag.iti__mn{height:10px;background-position:-3402px 0}.iti__flag.iti__mo{height:14px;background-position:-3424px 0}.iti__flag.iti__mp{height:10px;background-position:-3446px 0}.iti__flag.iti__mq{height:14px;background-position:-3468px 0}.iti__flag.iti__mr{height:14px;background-position:-3490px 0}.iti__flag.iti__ms{height:10px;background-position:-3512px 0}.iti__flag.iti__mt{height:14px;background-position:-3534px 0}.iti__flag.iti__mu{height:14px;background-position:-3556px 0}.iti__flag.iti__mv{height:14px;background-position:-3578px 0}.iti__flag.iti__mw{height:14px;background-position:-3600px 0}.iti__flag.iti__mx{height:12px;background-position:-3622px 0}.iti__flag.iti__my{height:10px;background-position:-3644px 0}.iti__flag.iti__mz{height:14px;background-position:-3666px 0}.iti__flag.iti__na{height:14px;background-position:-3688px 0}.iti__flag.iti__nc{height:10px;background-position:-3710px 0}.iti__flag.iti__ne{height:15px;background-position:-3732px 0}.iti__flag.iti__nf{height:10px;background-position:-3752px 0}.iti__flag.iti__ng{height:10px;background-position:-3774px 0}.iti__flag.iti__ni{height:12px;background-position:-3796px 0}.iti__flag.iti__nl{height:14px;background-position:-3818px 0}.iti__flag.iti__no{height:15px;background-position:-3840px 0}.iti__flag.iti__np{height:15px;background-position:-3862px 0}.iti__flag.iti__nr{height:10px;background-position:-3877px 0}.iti__flag.iti__nu{height:10px;background-position:-3899px 0}.iti__flag.iti__nz{height:10px;background-position:-3921px 0}.iti__flag.iti__om{height:10px;background-position:-3943px 0}.iti__flag.iti__pa{height:14px;background-position:-3965px 0}.iti__flag.iti__pe{height:14px;background-position:-3987px 0}.iti__flag.iti__pf{height:14px;background-position:-4009px 0}.iti__flag.iti__pg{height:15px;background-position:-4031px 0}.iti__flag.iti__ph{height:10px;background-position:-4053px 0}.iti__flag.iti__pk{height:14px;background-position:-4075px 0}.iti__flag.iti__pl{height:13px;background-position:-4097px 0}.iti__flag.iti__pm{height:14px;background-position:-4119px 0}.iti__flag.iti__pn{height:10px;background-position:-4141px 0}.iti__flag.iti__pr{height:14px;background-position:-4163px 0}.iti__flag.iti__ps{height:10px;background-position:-4185px 0}.iti__flag.iti__pt{height:14px;background-position:-4207px 0}.iti__flag.iti__pw{height:13px;background-position:-4229px 0}.iti__flag.iti__py{height:11px;background-position:-4251px 0}.iti__flag.iti__qa{height:8px;background-position:-4273px 0}.iti__flag.iti__re{height:14px;background-position:-4295px 0}.iti__flag.iti__ro{height:14px;background-position:-4317px 0}.iti__flag.iti__rs{height:14px;background-position:-4339px 0}.iti__flag.iti__ru{height:14px;background-position:-4361px 0}.iti__flag.iti__rw{height:14px;background-position:-4383px 0}.iti__flag.iti__sa{height:14px;background-position:-4405px 0}.iti__flag.iti__sb{height:10px;background-position:-4427px 0}.iti__flag.iti__sc{height:10px;background-position:-4449px 0}.iti__flag.iti__sd{height:10px;background-position:-4471px 0}.iti__flag.iti__se{height:13px;background-position:-4493px 0}.iti__flag.iti__sg{height:14px;background-position:-4515px 0}.iti__flag.iti__sh{height:10px;background-position:-4537px 0}.iti__flag.iti__si{height:10px;background-position:-4559px 0}.iti__flag.iti__sj{height:15px;background-position:-4581px 0}.iti__flag.iti__sk{height:14px;background-position:-4603px 0}.iti__flag.iti__sl{height:14px;background-position:-4625px 0}.iti__flag.iti__sm{height:15px;background-position:-4647px 0}.iti__flag.iti__sn{height:14px;background-position:-4669px 0}.iti__flag.iti__so{height:14px;background-position:-4691px 0}.iti__flag.iti__sr{height:14px;background-position:-4713px 0}.iti__flag.iti__ss{height:10px;background-position:-4735px 0}.iti__flag.iti__st{height:10px;background-position:-4757px 0}.iti__flag.iti__su{height:10px;background-position:-4779px 0}.iti__flag.iti__sv{height:12px;background-position:-4801px 0}.iti__flag.iti__sx{height:14px;background-position:-4823px 0}.iti__flag.iti__sy{height:14px;background-position:-4845px 0}.iti__flag.iti__sz{height:14px;background-position:-4867px 0}.iti__flag.iti__ta{height:10px;background-position:-4889px 0}.iti__flag.iti__tc{height:10px;background-position:-4911px 0}.iti__flag.iti__td{height:14px;background-position:-4933px 0}.iti__flag.iti__tf{height:14px;background-position:-4955px 0}.iti__flag.iti__tg{height:13px;background-position:-4977px 0}.iti__flag.iti__th{height:14px;background-position:-4999px 0}.iti__flag.iti__tj{height:10px;background-position:-5021px 0}.iti__flag.iti__tk{height:10px;background-position:-5043px 0}.iti__flag.iti__tl{height:10px;background-position:-5065px 0}.iti__flag.iti__tm{height:14px;background-position:-5087px 0}.iti__flag.iti__tn{height:14px;background-position:-5109px 0}.iti__flag.iti__to{height:10px;background-position:-5131px 0}.iti__flag.iti__tr{height:14px;background-position:-5153px 0}.iti__flag.iti__tt{height:12px;background-position:-5175px 0}.iti__flag.iti__tv{height:10px;background-position:-5197px 0}.iti__flag.iti__tw{height:14px;background-position:-5219px 0}.iti__flag.iti__tz{height:14px;background-position:-5241px 0}.iti__flag.iti__ua{height:14px;background-position:-5263px 0}.iti__flag.iti__ug{height:14px;background-position:-5285px 0}.iti__flag.iti__uk{height:10px;background-position:-5307px 0}.iti__flag.iti__um{height:11px;background-position:-5329px 0}.iti__flag.iti__un{height:14px;background-position:-5351px 0}.iti__flag.iti__us{height:11px;background-position:-5373px 0}.iti__flag.iti__uy{height:14px;background-position:-5395px 0}.iti__flag.iti__uz{height:10px;background-position:-5417px 0}.iti__flag.iti__va{height:15px;background-position:-5439px 0}.iti__flag.iti__vc{height:14px;background-position:-5456px 0}.iti__flag.iti__ve{height:14px;background-position:-5478px 0}.iti__flag.iti__vg{height:10px;background-position:-5500px 0}.iti__flag.iti__vi{height:14px;background-position:-5522px 0}.iti__flag.iti__vn{height:14px;background-position:-5544px 0}.iti__flag.iti__vu{height:12px;background-position:-5566px 0}.iti__flag.iti__wf{height:14px;background-position:-5588px 0}.iti__flag.iti__ws{height:10px;background-position:-5610px 0}.iti__flag.iti__xk{height:15px;background-position:-5632px 0}.iti__flag.iti__ye{height:14px;background-position:-5654px 0}.iti__flag.iti__yt{height:14px;background-position:-5676px 0}.iti__flag.iti__za{height:14px;background-position:-5698px 0}.iti__flag.iti__zm{height:14px;background-position:-5720px 0}.iti__flag.iti__zw{height:10px;background-position:-5742px 0}.iti__flag{height:15px;box-shadow:0 0 1px 0 #888;background-image:url(../img/flags.png?1);background-repeat:no-repeat;background-color:#dbdbdb;background-position:20px 0}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.iti__flag{background-image:url(../img/flags@2x.png?1)}}.iti__flag.iti__np{background-color:transparent} \ No newline at end of file +.iti{position:relative;display:inline-block}.iti *{box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti__a11y-text{width:1px;height:1px;clip:rect(1px,1px,1px,1px);overflow:hidden;position:absolute}.iti input.iti__tel-input,.iti input.iti__tel-input[type=tel],.iti input.iti__tel-input[type=text]{position:relative;z-index:0;margin-top:0!important;margin-bottom:0!important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}[dir=rtl] .iti__arrow{margin-right:6px;margin-left:0}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__dropdown-content{border-radius:3px;background-color:#fff}.iti--inline-dropdown .iti__dropdown-content{position:absolute;z-index:2;margin-top:3px;margin-left:-1px;border:1px solid #ccc;box-shadow:1px 1px 4px rgba(0,0,0,.2)}.iti__dropdown-content--dropup{bottom:100%;margin-bottom:3px}.iti__search-input{width:100%;border-width:0;border-radius:3px;padding:9px 12px}.iti__search-input+.iti__country-list{border-top:1px solid #ccc}.iti__country-list{list-style:none;padding:0;margin:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti--inline-dropdown .iti__country-list{max-height:185px}.iti--flexible-dropdown-width .iti__country-list{white-space:nowrap}@media (max-width:500px){.iti--flexible-dropdown-width .iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #ccc}.iti__country{display:flex;align-items:center;padding:8px 8px;outline:0}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:rgba(0,0,0,.05)}.iti__country-name,.iti__flag-box{margin-right:8px}[dir=rtl] .iti__country-name,[dir=rtl] .iti__flag-box{margin-right:0;margin-left:8px}.iti--allow-dropdown input.iti__tel-input,.iti--allow-dropdown input.iti__tel-input[type=tel],.iti--allow-dropdown input.iti__tel-input[type=text],.iti--show-selected-dial-code input.iti__tel-input,.iti--show-selected-dial-code input.iti__tel-input[type=tel],.iti--show-selected-dial-code input.iti__tel-input[type=text]{padding-right:6px;padding-left:52px;margin-left:0}[dir=rtl] .iti--allow-dropdown input.iti__tel-input,[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=tel],[dir=rtl] .iti--allow-dropdown input.iti__tel-input[type=text],[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input,[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=tel],[dir=rtl] .iti--show-selected-dial-code input.iti__tel-input[type=text]{padding-right:52px;padding-left:6px;margin-right:0}.iti--allow-dropdown .iti__flag-container,.iti--show-selected-dial-code .iti__flag-container{right:auto;left:0}[dir=rtl] .iti--allow-dropdown .iti__flag-container,[dir=rtl] .iti--show-selected-dial-code .iti__flag-container{right:0;left:auto}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--allow-dropdown .iti__flag-container:has(+input[disabled]):hover,.iti--allow-dropdown .iti__flag-container:has(+input[readonly]):hover{cursor:default}.iti--allow-dropdown .iti__flag-container:has(+input[disabled]):hover .iti__selected-flag,.iti--allow-dropdown .iti__flag-container:has(+input[readonly]):hover .iti__selected-flag{background-color:transparent}.iti--show-selected-dial-code .iti__selected-flag{background-color:rgba(0,0,0,.05)}.iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:6px}[dir=rtl] .iti--show-selected-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:0;margin-right:6px}.iti--container{position:fixed;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti--fullscreen-popup.iti--container{background-color:rgba(0,0,0,.5);top:0;bottom:0;left:0;right:0;position:fixed;padding:30px;display:flex;flex-direction:column;justify-content:center}.iti--fullscreen-popup.iti--container.iti--country-search{justify-content:flex-start}.iti--fullscreen-popup .iti__dropdown-content{display:flex;flex-direction:column;max-height:100%;position:relative}.iti--fullscreen-popup .iti__country{padding:10px 10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (min-resolution:2x){.iti__flag{background-size:5762px 15px}}.iti__flag.iti__ac{height:10px;background-position:0 0}.iti__flag.iti__ad{height:14px;background-position:-22px 0}.iti__flag.iti__ae{height:10px;background-position:-44px 0}.iti__flag.iti__af{height:14px;background-position:-66px 0}.iti__flag.iti__ag{height:14px;background-position:-88px 0}.iti__flag.iti__ai{height:10px;background-position:-110px 0}.iti__flag.iti__al{height:15px;background-position:-132px 0}.iti__flag.iti__am{height:10px;background-position:-154px 0}.iti__flag.iti__ao{height:14px;background-position:-176px 0}.iti__flag.iti__aq{height:14px;background-position:-198px 0}.iti__flag.iti__ar{height:13px;background-position:-220px 0}.iti__flag.iti__as{height:10px;background-position:-242px 0}.iti__flag.iti__at{height:14px;background-position:-264px 0}.iti__flag.iti__au{height:10px;background-position:-286px 0}.iti__flag.iti__aw{height:14px;background-position:-308px 0}.iti__flag.iti__ax{height:13px;background-position:-330px 0}.iti__flag.iti__az{height:10px;background-position:-352px 0}.iti__flag.iti__ba{height:10px;background-position:-374px 0}.iti__flag.iti__bb{height:14px;background-position:-396px 0}.iti__flag.iti__bd{height:12px;background-position:-418px 0}.iti__flag.iti__be{height:15px;background-position:-440px 0}.iti__flag.iti__bf{height:14px;background-position:-460px 0}.iti__flag.iti__bg{height:12px;background-position:-482px 0}.iti__flag.iti__bh{height:12px;background-position:-504px 0}.iti__flag.iti__bi{height:12px;background-position:-526px 0}.iti__flag.iti__bj{height:14px;background-position:-548px 0}.iti__flag.iti__bl{height:14px;background-position:-570px 0}.iti__flag.iti__bm{height:10px;background-position:-592px 0}.iti__flag.iti__bn{height:10px;background-position:-614px 0}.iti__flag.iti__bo{height:14px;background-position:-636px 0}.iti__flag.iti__bq{height:14px;background-position:-658px 0}.iti__flag.iti__br{height:14px;background-position:-680px 0}.iti__flag.iti__bs{height:10px;background-position:-702px 0}.iti__flag.iti__bt{height:14px;background-position:-724px 0}.iti__flag.iti__bv{height:15px;background-position:-746px 0}.iti__flag.iti__bw{height:14px;background-position:-768px 0}.iti__flag.iti__by{height:10px;background-position:-790px 0}.iti__flag.iti__bz{height:12px;background-position:-812px 0}.iti__flag.iti__ca{height:10px;background-position:-834px 0}.iti__flag.iti__cc{height:10px;background-position:-856px 0}.iti__flag.iti__cd{height:15px;background-position:-878px 0}.iti__flag.iti__cf{height:14px;background-position:-900px 0}.iti__flag.iti__cg{height:14px;background-position:-922px 0}.iti__flag.iti__ch{height:15px;background-position:-944px 0}.iti__flag.iti__ci{height:14px;background-position:-961px 0}.iti__flag.iti__ck{height:10px;background-position:-983px 0}.iti__flag.iti__cl{height:14px;background-position:-1005px 0}.iti__flag.iti__cm{height:14px;background-position:-1027px 0}.iti__flag.iti__cn{height:14px;background-position:-1049px 0}.iti__flag.iti__co{height:14px;background-position:-1071px 0}.iti__flag.iti__cp{height:14px;background-position:-1093px 0}.iti__flag.iti__cq{height:12px;background-position:-1115px 0}.iti__flag.iti__cr{height:12px;background-position:-1137px 0}.iti__flag.iti__cu{height:10px;background-position:-1159px 0}.iti__flag.iti__cv{height:12px;background-position:-1181px 0}.iti__flag.iti__cw{height:14px;background-position:-1203px 0}.iti__flag.iti__cx{height:10px;background-position:-1225px 0}.iti__flag.iti__cy{height:14px;background-position:-1247px 0}.iti__flag.iti__cz{height:14px;background-position:-1269px 0}.iti__flag.iti__de{height:12px;background-position:-1291px 0}.iti__flag.iti__dg{height:10px;background-position:-1313px 0}.iti__flag.iti__dj{height:14px;background-position:-1335px 0}.iti__flag.iti__dk{height:15px;background-position:-1357px 0}.iti__flag.iti__dm{height:10px;background-position:-1379px 0}.iti__flag.iti__do{height:14px;background-position:-1401px 0}.iti__flag.iti__dz{height:14px;background-position:-1423px 0}.iti__flag.iti__ea{height:14px;background-position:-1445px 0}.iti__flag.iti__ec{height:14px;background-position:-1467px 0}.iti__flag.iti__ee{height:13px;background-position:-1489px 0}.iti__flag.iti__eg{height:14px;background-position:-1511px 0}.iti__flag.iti__eh{height:10px;background-position:-1533px 0}.iti__flag.iti__er{height:10px;background-position:-1555px 0}.iti__flag.iti__es{height:14px;background-position:-1577px 0}.iti__flag.iti__et{height:10px;background-position:-1599px 0}.iti__flag.iti__eu{height:14px;background-position:-1621px 0}.iti__flag.iti__ez{height:14px;background-position:-1643px 0}.iti__flag.iti__fi{height:12px;background-position:-1665px 0}.iti__flag.iti__fj{height:10px;background-position:-1687px 0}.iti__flag.iti__fk{height:10px;background-position:-1709px 0}.iti__flag.iti__fm{height:11px;background-position:-1731px 0}.iti__flag.iti__fo{height:15px;background-position:-1753px 0}.iti__flag.iti__fr{height:14px;background-position:-1775px 0}.iti__flag.iti__fx{height:14px;background-position:-1797px 0}.iti__flag.iti__ga{height:15px;background-position:-1819px 0}.iti__flag.iti__gb{height:10px;background-position:-1841px 0}.iti__flag.iti__gd{height:12px;background-position:-1863px 0}.iti__flag.iti__ge{height:14px;background-position:-1885px 0}.iti__flag.iti__gf{height:14px;background-position:-1907px 0}.iti__flag.iti__gg{height:14px;background-position:-1929px 0}.iti__flag.iti__gh{height:14px;background-position:-1951px 0}.iti__flag.iti__gi{height:10px;background-position:-1973px 0}.iti__flag.iti__gl{height:14px;background-position:-1995px 0}.iti__flag.iti__gm{height:14px;background-position:-2017px 0}.iti__flag.iti__gn{height:14px;background-position:-2039px 0}.iti__flag.iti__gp{height:14px;background-position:-2061px 0}.iti__flag.iti__gq{height:14px;background-position:-2083px 0}.iti__flag.iti__gr{height:14px;background-position:-2105px 0}.iti__flag.iti__gs{height:10px;background-position:-2127px 0}.iti__flag.iti__gt{height:13px;background-position:-2149px 0}.iti__flag.iti__gu{height:11px;background-position:-2171px 0}.iti__flag.iti__gw{height:10px;background-position:-2193px 0}.iti__flag.iti__gy{height:12px;background-position:-2215px 0}.iti__flag.iti__hk{height:14px;background-position:-2237px 0}.iti__flag.iti__hm{height:10px;background-position:-2259px 0}.iti__flag.iti__hn{height:10px;background-position:-2281px 0}.iti__flag.iti__hr{height:10px;background-position:-2303px 0}.iti__flag.iti__ht{height:12px;background-position:-2325px 0}.iti__flag.iti__hu{height:10px;background-position:-2347px 0}.iti__flag.iti__ic{height:14px;background-position:-2369px 0}.iti__flag.iti__id{height:14px;background-position:-2391px 0}.iti__flag.iti__ie{height:10px;background-position:-2413px 0}.iti__flag.iti__il{height:15px;background-position:-2435px 0}.iti__flag.iti__im{height:10px;background-position:-2457px 0}.iti__flag.iti__in{height:14px;background-position:-2479px 0}.iti__flag.iti__io{height:10px;background-position:-2501px 0}.iti__flag.iti__iq{height:14px;background-position:-2523px 0}.iti__flag.iti__ir{height:12px;background-position:-2545px 0}.iti__flag.iti__is{height:15px;background-position:-2567px 0}.iti__flag.iti__it{height:14px;background-position:-2589px 0}.iti__flag.iti__je{height:12px;background-position:-2611px 0}.iti__flag.iti__jm{height:10px;background-position:-2633px 0}.iti__flag.iti__jo{height:10px;background-position:-2655px 0}.iti__flag.iti__jp{height:14px;background-position:-2677px 0}.iti__flag.iti__ke{height:14px;background-position:-2699px 0}.iti__flag.iti__kg{height:12px;background-position:-2721px 0}.iti__flag.iti__kh{height:13px;background-position:-2743px 0}.iti__flag.iti__ki{height:10px;background-position:-2765px 0}.iti__flag.iti__km{height:12px;background-position:-2787px 0}.iti__flag.iti__kn{height:14px;background-position:-2809px 0}.iti__flag.iti__kp{height:10px;background-position:-2831px 0}.iti__flag.iti__kr{height:14px;background-position:-2853px 0}.iti__flag.iti__kw{height:10px;background-position:-2875px 0}.iti__flag.iti__ky{height:10px;background-position:-2897px 0}.iti__flag.iti__kz{height:10px;background-position:-2919px 0}.iti__flag.iti__la{height:14px;background-position:-2941px 0}.iti__flag.iti__lb{height:14px;background-position:-2963px 0}.iti__flag.iti__lc{height:10px;background-position:-2985px 0}.iti__flag.iti__li{height:12px;background-position:-3007px 0}.iti__flag.iti__lk{height:10px;background-position:-3029px 0}.iti__flag.iti__lr{height:11px;background-position:-3051px 0}.iti__flag.iti__ls{height:14px;background-position:-3073px 0}.iti__flag.iti__lt{height:12px;background-position:-3095px 0}.iti__flag.iti__lu{height:12px;background-position:-3117px 0}.iti__flag.iti__lv{height:10px;background-position:-3139px 0}.iti__flag.iti__ly{height:10px;background-position:-3161px 0}.iti__flag.iti__ma{height:14px;background-position:-3183px 0}.iti__flag.iti__mc{height:15px;background-position:-3205px 0}.iti__flag.iti__md{height:10px;background-position:-3226px 0}.iti__flag.iti__me{height:10px;background-position:-3248px 0}.iti__flag.iti__mf{height:14px;background-position:-3270px 0}.iti__flag.iti__mg{height:14px;background-position:-3292px 0}.iti__flag.iti__mh{height:11px;background-position:-3314px 0}.iti__flag.iti__mk{height:10px;background-position:-3336px 0}.iti__flag.iti__ml{height:14px;background-position:-3358px 0}.iti__flag.iti__mm{height:14px;background-position:-3380px 0}.iti__flag.iti__mn{height:10px;background-position:-3402px 0}.iti__flag.iti__mo{height:14px;background-position:-3424px 0}.iti__flag.iti__mp{height:10px;background-position:-3446px 0}.iti__flag.iti__mq{height:14px;background-position:-3468px 0}.iti__flag.iti__mr{height:14px;background-position:-3490px 0}.iti__flag.iti__ms{height:10px;background-position:-3512px 0}.iti__flag.iti__mt{height:14px;background-position:-3534px 0}.iti__flag.iti__mu{height:14px;background-position:-3556px 0}.iti__flag.iti__mv{height:14px;background-position:-3578px 0}.iti__flag.iti__mw{height:14px;background-position:-3600px 0}.iti__flag.iti__mx{height:12px;background-position:-3622px 0}.iti__flag.iti__my{height:10px;background-position:-3644px 0}.iti__flag.iti__mz{height:14px;background-position:-3666px 0}.iti__flag.iti__na{height:14px;background-position:-3688px 0}.iti__flag.iti__nc{height:10px;background-position:-3710px 0}.iti__flag.iti__ne{height:15px;background-position:-3732px 0}.iti__flag.iti__nf{height:10px;background-position:-3752px 0}.iti__flag.iti__ng{height:10px;background-position:-3774px 0}.iti__flag.iti__ni{height:12px;background-position:-3796px 0}.iti__flag.iti__nl{height:14px;background-position:-3818px 0}.iti__flag.iti__no{height:15px;background-position:-3840px 0}.iti__flag.iti__np{height:15px;background-position:-3862px 0}.iti__flag.iti__nr{height:10px;background-position:-3877px 0}.iti__flag.iti__nu{height:10px;background-position:-3899px 0}.iti__flag.iti__nz{height:10px;background-position:-3921px 0}.iti__flag.iti__om{height:10px;background-position:-3943px 0}.iti__flag.iti__pa{height:14px;background-position:-3965px 0}.iti__flag.iti__pe{height:14px;background-position:-3987px 0}.iti__flag.iti__pf{height:14px;background-position:-4009px 0}.iti__flag.iti__pg{height:15px;background-position:-4031px 0}.iti__flag.iti__ph{height:10px;background-position:-4053px 0}.iti__flag.iti__pk{height:14px;background-position:-4075px 0}.iti__flag.iti__pl{height:13px;background-position:-4097px 0}.iti__flag.iti__pm{height:14px;background-position:-4119px 0}.iti__flag.iti__pn{height:10px;background-position:-4141px 0}.iti__flag.iti__pr{height:14px;background-position:-4163px 0}.iti__flag.iti__ps{height:10px;background-position:-4185px 0}.iti__flag.iti__pt{height:14px;background-position:-4207px 0}.iti__flag.iti__pw{height:13px;background-position:-4229px 0}.iti__flag.iti__py{height:11px;background-position:-4251px 0}.iti__flag.iti__qa{height:8px;background-position:-4273px 0}.iti__flag.iti__re{height:14px;background-position:-4295px 0}.iti__flag.iti__ro{height:14px;background-position:-4317px 0}.iti__flag.iti__rs{height:14px;background-position:-4339px 0}.iti__flag.iti__ru{height:14px;background-position:-4361px 0}.iti__flag.iti__rw{height:14px;background-position:-4383px 0}.iti__flag.iti__sa{height:14px;background-position:-4405px 0}.iti__flag.iti__sb{height:10px;background-position:-4427px 0}.iti__flag.iti__sc{height:10px;background-position:-4449px 0}.iti__flag.iti__sd{height:10px;background-position:-4471px 0}.iti__flag.iti__se{height:13px;background-position:-4493px 0}.iti__flag.iti__sg{height:14px;background-position:-4515px 0}.iti__flag.iti__sh{height:10px;background-position:-4537px 0}.iti__flag.iti__si{height:10px;background-position:-4559px 0}.iti__flag.iti__sj{height:15px;background-position:-4581px 0}.iti__flag.iti__sk{height:14px;background-position:-4603px 0}.iti__flag.iti__sl{height:14px;background-position:-4625px 0}.iti__flag.iti__sm{height:15px;background-position:-4647px 0}.iti__flag.iti__sn{height:14px;background-position:-4669px 0}.iti__flag.iti__so{height:14px;background-position:-4691px 0}.iti__flag.iti__sr{height:14px;background-position:-4713px 0}.iti__flag.iti__ss{height:10px;background-position:-4735px 0}.iti__flag.iti__st{height:10px;background-position:-4757px 0}.iti__flag.iti__su{height:10px;background-position:-4779px 0}.iti__flag.iti__sv{height:12px;background-position:-4801px 0}.iti__flag.iti__sx{height:14px;background-position:-4823px 0}.iti__flag.iti__sy{height:14px;background-position:-4845px 0}.iti__flag.iti__sz{height:14px;background-position:-4867px 0}.iti__flag.iti__ta{height:10px;background-position:-4889px 0}.iti__flag.iti__tc{height:10px;background-position:-4911px 0}.iti__flag.iti__td{height:14px;background-position:-4933px 0}.iti__flag.iti__tf{height:14px;background-position:-4955px 0}.iti__flag.iti__tg{height:13px;background-position:-4977px 0}.iti__flag.iti__th{height:14px;background-position:-4999px 0}.iti__flag.iti__tj{height:10px;background-position:-5021px 0}.iti__flag.iti__tk{height:10px;background-position:-5043px 0}.iti__flag.iti__tl{height:10px;background-position:-5065px 0}.iti__flag.iti__tm{height:14px;background-position:-5087px 0}.iti__flag.iti__tn{height:14px;background-position:-5109px 0}.iti__flag.iti__to{height:10px;background-position:-5131px 0}.iti__flag.iti__tr{height:14px;background-position:-5153px 0}.iti__flag.iti__tt{height:12px;background-position:-5175px 0}.iti__flag.iti__tv{height:10px;background-position:-5197px 0}.iti__flag.iti__tw{height:14px;background-position:-5219px 0}.iti__flag.iti__tz{height:14px;background-position:-5241px 0}.iti__flag.iti__ua{height:14px;background-position:-5263px 0}.iti__flag.iti__ug{height:14px;background-position:-5285px 0}.iti__flag.iti__uk{height:10px;background-position:-5307px 0}.iti__flag.iti__um{height:11px;background-position:-5329px 0}.iti__flag.iti__un{height:14px;background-position:-5351px 0}.iti__flag.iti__us{height:11px;background-position:-5373px 0}.iti__flag.iti__uy{height:14px;background-position:-5395px 0}.iti__flag.iti__uz{height:10px;background-position:-5417px 0}.iti__flag.iti__va{height:15px;background-position:-5439px 0}.iti__flag.iti__vc{height:14px;background-position:-5456px 0}.iti__flag.iti__ve{height:14px;background-position:-5478px 0}.iti__flag.iti__vg{height:10px;background-position:-5500px 0}.iti__flag.iti__vi{height:14px;background-position:-5522px 0}.iti__flag.iti__vn{height:14px;background-position:-5544px 0}.iti__flag.iti__vu{height:12px;background-position:-5566px 0}.iti__flag.iti__wf{height:14px;background-position:-5588px 0}.iti__flag.iti__ws{height:10px;background-position:-5610px 0}.iti__flag.iti__xk{height:15px;background-position:-5632px 0}.iti__flag.iti__ye{height:14px;background-position:-5654px 0}.iti__flag.iti__yt{height:14px;background-position:-5676px 0}.iti__flag.iti__za{height:14px;background-position:-5698px 0}.iti__flag.iti__zm{height:14px;background-position:-5720px 0}.iti__flag.iti__zw{height:10px;background-position:-5742px 0}.iti__flag{height:15px;box-shadow:0 0 1px 0 #888;background-image:url(../img/flags.png?1);background-repeat:no-repeat;background-position:20px 0}@media (min-resolution:2x){.iti__flag{background-image:url(../img/flags@2x.png?1)}}.iti__globe{background-image:url(../img/globe.png);background-size:contain;background-position:right;box-shadow:none;height:19px}@media (min-resolution:2x){.iti__globe{background-image:url(../img/globe@2x.png)}} \ No newline at end of file diff --git a/public/assets/build/js/data.js b/public/assets/build/js/data.js index 78dd86e..3052387 100644 --- a/public/assets/build/js/data.js +++ b/public/assets/build/js/data.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v18.2.1 + * International Telephone Input v20.0.3 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ @@ -20,7 +20,7 @@ // Order (if >1 country with same dial code), // Area codes // ] - var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "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", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "North Macedonia (Северна Македонија)", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; + var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua & Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia & Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "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", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo - Brazzaville", "cg", "242" ], [ "Congo - Kinshasa", "cd", "243" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "North Macedonia", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Réunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé & Príncipe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "St Barthélemy", "bl", "590", 1 ], [ "St Helena", "sh", "290" ], [ "St Kitts & Nevis", "kn", "1", 18, [ "869" ] ], [ "St Lucia", "lc", "1", 19, [ "758" ] ], [ "St Martin", "mf", "590", 2 ], [ "St Pierre & Miquelon", "pm", "508" ], [ "St Vincent & Grenadines", "vc", "1", 20, [ "784" ] ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard & Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad & Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks & Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "US Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis & Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; // loop over all of the countries above, restructuring the data to be objects with named keys for (var i = 0; i < allCountries.length; i++) { var c = allCountries[i]; @@ -29,7 +29,8 @@ iso2: c[1], dialCode: c[2], priority: c[3] || 0, - areaCodes: c[4] || null + areaCodes: c[4] || null, + nodeById: {} }; } if (typeof module === "object" && module.exports) module.exports = allCountries; else window.allCountries = allCountries; diff --git a/public/assets/build/js/data.min.js b/public/assets/build/js/data.min.js index ca705b2..0353885 100644 --- a/public/assets/build/js/data.min.js +++ b/public/assets/build/js/data.min.js @@ -1,7 +1,7 @@ /* - * International Telephone Input v18.2.1 + * International Telephone Input v20.0.3 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ -!function(){for(var a=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","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","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["North Macedonia (Северна Македонија)","mk","389"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1,["5288","5289"]],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],b=0;b1 country with same dial code), // Area codes // ] - var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "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", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "North Macedonia (Северна Македонија)", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; + var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua & Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia & Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "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", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo - Brazzaville", "cg", "242" ], [ "Congo - Kinshasa", "cd", "243" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "North Macedonia", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Réunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé & Príncipe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "St Barthélemy", "bl", "590", 1 ], [ "St Helena", "sh", "290" ], [ "St Kitts & Nevis", "kn", "1", 18, [ "869" ] ], [ "St Lucia", "lc", "1", 19, [ "758" ] ], [ "St Martin", "mf", "590", 2 ], [ "St Pierre & Miquelon", "pm", "508" ], [ "St Vincent & Grenadines", "vc", "1", 20, [ "784" ] ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard & Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad & Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks & Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "US Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis & Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; // loop over all of the countries above, restructuring the data to be objects with named keys for (var i = 0; i < allCountries.length; i++) { var c = allCountries[i]; @@ -38,21 +38,28 @@ iso2: c[1], dialCode: c[2], priority: c[3] || 0, - areaCodes: c[4] || null + areaCodes: c[4] || null, + nodeById: {} }; } "use strict"; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === "function") { - ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function(key) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; @@ -71,6 +78,49 @@ } return obj; } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _iterableToArrayLimit(arr, i) { + var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; + if (null != _i) { + var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; + try { + if (_x = (_i = _i.call(arr)).next, 0 === i) { + if (Object(_i) !== _i) return; + _n = !1; + } else for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) ; + } catch (err) { + _d = !0, _e = err; + } finally { + try { + if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; + } finally { + if (_d) throw _e; + } + } + return _arr; + } + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); @@ -126,131 +176,111 @@ var defaults = { // whether or not to allow the dropdown allowDropdown: true, - // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry - // also listen for blur/submit and auto remove dial code if that's all there is - autoInsertDialCode: false, // add a placeholder in the input with an example number for the selected country autoPlaceholder: "polite", + // add a country search input at the top of the dropdown + countrySearch: true, // modify the parentClass - customContainer: "", + containerClass: "", // modify the auto placeholder customPlaceholder: null, // append menu to specified element dropdownContainer: null, // don't display these countries excludeCountries: [], + // fix the dropdown width to the input width (rather than being as wide as the longest country name) + fixDropdownWidth: true, + // format the number as the user types + formatAsYouType: true, // format the input value during initialisation and on setNumber formatOnDisplay: true, // geoIp lookup function geoIpLookup: null, - // inject a hidden input with this name, and on submit, populate it with the result of getNumber - hiddenInput: "", + // inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber + hiddenInput: null, + // internationalise the plugin text e.g. search input placeholder, country names + i18n: {}, // initial country initialCountry: "", - // localized country names e.g. { 'de': 'Deutschland' } - localizedCountries: null, // national vs international formatting for numbers e.g. placeholders and displaying existing numbers nationalMode: true, // display only these countries onlyCountries: [], // number type to use for placeholders placeholderNumberType: "MOBILE", - // the countries at the top of the list. defaults to united states and united kingdom - preferredCountries: [ "us", "gb" ], - // display the country dial code next to the selected flag - separateDialCode: false, - // option to hide the flags - must be used with separateDialCode, or allowDropdown=false + // the countries at the top of the list + preferredCountries: [], + // option to hide the flags - must be used with showSelectedDialCode, or allowDropdown=false showFlags: true, + // display the international dial code next to the selected flag + showSelectedDialCode: false, + // use full screen popup instead of dropdown for country list + useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? // we cannot just test screen size as some smartphones/website meta tags will report desktop + // resolutions + // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' + /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, // specify the path to the libphonenumber script to enable validation/formatting utilsScript: "" }; // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ]; - // utility function to iterate over an object. can't use Object.entries or native forEach because - // of IE11 - var forEachProp = function forEachProp(obj, callback) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - callback(keys[i], obj[keys[i]]); - } - }; // run a method on each instance of the plugin var forEachInstance = function forEachInstance(method) { - forEachProp(window.intlTelInputGlobals.instances, function(key) { - window.intlTelInputGlobals.instances[key][method](); + var instances = window.intlTelInputGlobals.instances; + Object.values(instances).forEach(function(instance) { + return instance[method](); }); }; // this is our plugin class that we will create an instance of // eslint-disable-next-line no-unused-vars var Iti = /*#__PURE__*/ function() { - function Iti(input, options) { - var _this = this; + function Iti(input) { + var customOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Iti); this.id = id++; this.telInput = input; this.activeItem = null; this.highlightedItem = null; // process specified options / defaults - // alternative to Object.assign, which isn't supported by IE11 - var customOptions = options || {}; - this.options = {}; - forEachProp(defaults, function(key, value) { - _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value; - }); + this.options = Object.assign({}, defaults, customOptions); this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder")); } _createClass(Iti, [ { key: "_init", value: function _init() { - var _this2 = this; - // if in nationalMode, do not insert dial codes - if (this.options.nationalMode) { - this.options.autoInsertDialCode = false; + var _this = this; + // if showing fullscreen popup, do not fix the width + if (this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = false; } - // if separateDialCode enabled, do not insert dial codes - if (this.options.separateDialCode) { - this.options.autoInsertDialCode = false; + // when search enabled, we must fix the width else it would change with different results + if (this.options.countrySearch && !this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = true; } // force showFlags=true if there's a dropdown and we're not displaying the dial code, // as otherwise you just have a down arrow on it's own which doesn't make sense - var forceShowFlags = this.options.allowDropdown && !this.options.separateDialCode; + var forceShowFlags = this.options.allowDropdown && !this.options.showSelectedDialCode; if (!this.options.showFlags && forceShowFlags) { this.options.showFlags = true; } - // we cannot just test screen size as some smartphones/website meta tags will report desktop - // resolutions - // Note: for some reason jasmine breaks if you put this in the main Plugin function with the - // rest of these declarations - // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' - this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); - if (this.isMobile) { - // trigger the mobile dropdown css - document.body.classList.add("iti-mobile"); - // on mobile, we want a full screen dropdown, so we must append it to the body - if (!this.options.dropdownContainer) { - this.options.dropdownContainer = document.body; - } + // on mobile, we want a full screen dropdown, so we must append it to the body + if (this.options.useFullscreenPopup && !this.options.dropdownContainer) { + this.options.dropdownContainer = document.body; } // check if input has one parent with RTL this.isRTL = !!this.telInput.closest("[dir=rtl]"); // these promises get resolved when their individual requests complete // this way the dev can do something like iti.promise.then(...) to know when all requests are // complete - if (typeof Promise !== "undefined") { - var autoCountryPromise = new Promise(function(resolve, reject) { - _this2.resolveAutoCountryPromise = resolve; - _this2.rejectAutoCountryPromise = reject; - }); - var utilsScriptPromise = new Promise(function(resolve, reject) { - _this2.resolveUtilsScriptPromise = resolve; - _this2.rejectUtilsScriptPromise = reject; - }); - this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]); - } else { - // prevent errors when Promise doesn't exist - this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {}; - this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {}; - } + var autoCountryPromise = new Promise(function(resolve, reject) { + _this.resolveAutoCountryPromise = resolve; + _this.rejectAutoCountryPromise = reject; + }); + var utilsScriptPromise = new Promise(function(resolve, reject) { + _this.resolveUtilsScriptPromise = resolve; + _this.rejectUtilsScriptPromise = reject; + }); + this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]); // in various situations there could be no country selected initially, but we need to be able // to assume this variable exists this.selectedCountryData = {}; @@ -260,7 +290,7 @@ this._generateMarkup(); // set the initial state of the input value and the selected flag this._setInitialState(); - // start all of the event listeners: autoInsertDialCode, input keydown, selectedFlag click + // start all of the event listeners: input keydown, selectedFlag click this._initListeners(); // utils script, and auto country this._initRequests(); @@ -270,37 +300,35 @@ value: function _processCountryData() { // process onlyCountries or excludeCountries array if present this._processAllCountries(); - // process the countryCodes map - this._processCountryCodes(); + // generate this.dialCodes and this.dialCodeToIso2Map + this._processDialCodes(); // process the preferredCountries this._processPreferredCountries(); - // translate countries according to localizedCountries option - if (this.options.localizedCountries) { - this._translateCountriesByLocale(); - } + // translate country names according to i18n option + this._translateCountryNames(); // sort countries by name - if (this.options.onlyCountries.length || this.options.localizedCountries) { + if (this.options.onlyCountries.length || this.options.i18n) { this.countries.sort(this._countryNameSort); } } }, { - key: "_addCountryCode", - value: function _addCountryCode(iso2, countryCode, priority) { - if (countryCode.length > this.countryCodeMaxLen) { - this.countryCodeMaxLen = countryCode.length; + key: "_addToDialCodeMap", + value: function _addToDialCodeMap(iso2, dialCode, priority) { + if (dialCode.length > this.dialCodeMaxLen) { + this.dialCodeMaxLen = dialCode.length; } - if (!this.countryCodes.hasOwnProperty(countryCode)) { - this.countryCodes[countryCode] = []; + if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) { + this.dialCodeToIso2Map[dialCode] = []; } - // bail if we already have this country for this countryCode - for (var i = 0; i < this.countryCodes[countryCode].length; i++) { - if (this.countryCodes[countryCode][i] === iso2) { + // bail if we already have this country for this dialCode + for (var i = 0; i < this.dialCodeToIso2Map[dialCode].length; i++) { + if (this.dialCodeToIso2Map[dialCode][i] === iso2) { return; } } // check for undefined as 0 is falsy - var index = priority !== undefined ? priority : this.countryCodes[countryCode].length; - this.countryCodes[countryCode][index] = iso2; + var index = priority !== undefined ? priority : this.dialCodeToIso2Map[dialCode].length; + this.dialCodeToIso2Map[dialCode][index] = iso2; } }, { key: "_processAllCountries", @@ -324,12 +352,12 @@ } } }, { - key: "_translateCountriesByLocale", - value: function _translateCountriesByLocale() { + key: "_translateCountryNames", + value: function _translateCountryNames() { for (var i = 0; i < this.countries.length; i++) { - var iso = this.countries[i].iso2.toLowerCase(); - if (this.options.localizedCountries.hasOwnProperty(iso)) { - this.countries[i].name = this.options.localizedCountries[iso]; + var iso2 = this.countries[i].iso2.toLowerCase(); + if (this.options.i18n.hasOwnProperty(iso2)) { + this.countries[i].name = this.options.i18n[iso2]; } } } @@ -345,20 +373,30 @@ return 0; } }, { - key: "_processCountryCodes", - value: function _processCountryCodes() { - this.countryCodeMaxLen = 0; - // here we store just dial codes + key: "_processDialCodes", + value: function _processDialCodes() { + // here we store just dial codes, where the key is the dial code, and the value is true + // e.g. { 1: true, 7: true, 20: true, ... } this.dialCodes = {}; - // here we store "country codes" (both dial codes and their area codes) - this.countryCodes = {}; + this.dialCodeMaxLen = 0; + // here we map dialCodes (inc both dialCode and dialCode+areaCode) to iso2 codes + /* e.g. + * { + * 1: [ 'us', 'ca', ... ], # all NANP countries + * 12: [ 'us', 'ca', ... ], # subset of NANP countries + * 120: [ 'us', 'ca' ], # just US and Canada + * 1204: [ 'ca' ], # only Canada + * ... + * } + */ + this.dialCodeToIso2Map = {}; // first: add dial codes for (var i = 0; i < this.countries.length; i++) { var c = this.countries[i]; if (!this.dialCodes[c.dialCode]) { this.dialCodes[c.dialCode] = true; } - this._addCountryCode(c.iso2, c.dialCode, c.priority); + this._addToDialCodeMap(c.iso2, c.dialCode, c.priority); } // next: add area codes // this is a second loop over countries, to make sure we have all of the "root" countries @@ -368,7 +406,7 @@ var _c = this.countries[_i]; // area codes if (_c.areaCodes) { - var rootCountryCode = this.countryCodes[_c.dialCode][0]; + var rootIso2Code = this.dialCodeToIso2Map[_c.dialCode][0]; // for each area code for (var j = 0; j < _c.areaCodes.length; j++) { var areaCode = _c.areaCodes[j]; @@ -376,11 +414,11 @@ for (var k = 1; k < areaCode.length; k++) { var partialDialCode = _c.dialCode + areaCode.substr(0, k); // start with the root country, as that also matches this dial code - this._addCountryCode(rootCountryCode, partialDialCode); - this._addCountryCode(_c.iso2, partialDialCode); + this._addToDialCodeMap(rootIso2Code, partialDialCode); + this._addToDialCodeMap(_c.iso2, partialDialCode); } // add the full area code - this._addCountryCode(_c.iso2, _c.dialCode + areaCode); + this._addToDialCodeMap(_c.iso2, _c.dialCode + areaCode); } } } @@ -390,8 +428,8 @@ value: function _processPreferredCountries() { this.preferredCountries = []; for (var i = 0; i < this.options.preferredCountries.length; i++) { - var countryCode = this.options.preferredCountries[i].toLowerCase(); - var countryData = this._getCountryData(countryCode, false, true); + var iso2 = this.options.preferredCountries[i].toLowerCase(); + var countryData = this._getCountryData(iso2, true); if (countryData) { this.preferredCountries.push(countryData); } @@ -402,7 +440,8 @@ value: function _createEl(name, attrs, container) { var el = document.createElement(name); if (attrs) { - forEachProp(attrs, function(key, value) { + Object.entries(attrs).forEach(function(_ref) { + var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; return el.setAttribute(key, value); }); } @@ -414,6 +453,7 @@ }, { key: "_generateMarkup", value: function _generateMarkup() { + this.telInput.classList.add("iti__tel-input"); // if autocomplete does not exist on the element and its form, then // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the @@ -421,56 +461,58 @@ if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) { this.telInput.setAttribute("autocomplete", "off"); } - var _this$options = this.options, allowDropdown = _this$options.allowDropdown, separateDialCode = _this$options.separateDialCode, showFlags = _this$options.showFlags, customContainer = _this$options.customContainer, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer; + var _this$options = this.options, allowDropdown = _this$options.allowDropdown, showSelectedDialCode = _this$options.showSelectedDialCode, showFlags = _this$options.showFlags, containerClass = _this$options.containerClass, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer, fixDropdownWidth = _this$options.fixDropdownWidth, useFullscreenPopup = _this$options.useFullscreenPopup, countrySearch = _this$options.countrySearch, i18n = _this$options.i18n; // containers (mostly for positioning) var parentClass = "iti"; if (allowDropdown) { parentClass += " iti--allow-dropdown"; } - if (separateDialCode) { - parentClass += " iti--separate-dial-code"; + if (showSelectedDialCode) { + parentClass += " iti--show-selected-dial-code"; } if (showFlags) { parentClass += " iti--show-flags"; } - if (customContainer) { - parentClass += " ".concat(customContainer); + if (containerClass) { + parentClass += " ".concat(containerClass); + } + if (!useFullscreenPopup) { + parentClass += " iti--inline-dropdown"; } var wrapper = this._createEl("div", { "class": parentClass }); this.telInput.parentNode.insertBefore(wrapper, this.telInput); - // only hide the flagsContainer if allowDropdown, showFlags and separateDialCode are all false - var showFlagsContainer = allowDropdown || showFlags || separateDialCode; - if (showFlagsContainer) { + // if we're showing flags or dial codes, we need the flags container etc + if (showFlags || showSelectedDialCode) { this.flagsContainer = this._createEl("div", { "class": "iti__flag-container" }, wrapper); - } - wrapper.appendChild(this.telInput); - // selected flag (displayed to left of input) - // using Aria tags for "Select-Only Combobox Example" - // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ - if (showFlagsContainer) { + // selected flag (displayed on left of input while allowDropdown is enabled, otherwise to right) + // when countrySearch disabled: using Aria tags for "Select-Only Combobox Example" + // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ this.selectedFlag = this._createEl("div", _objectSpread({ "class": "iti__selected-flag" - }, allowDropdown && { - role: "combobox", - "aria-haspopup": "listbox", - "aria-controls": "iti-".concat(this.id, "__country-listbox"), + }, allowDropdown && _objectSpread({ "aria-expanded": "false", - "aria-label": "Telephone country code" - }), this.flagsContainer); - } - if (showFlags) { - this.selectedFlagInner = this._createEl("div", { - "class": "iti__flag" - }, this.selectedFlag); + "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country", + "aria-haspopup": countrySearch ? "true" : "listbox", + "aria-controls": countrySearch ? "iti-".concat(this.id, "__dropdown-content") : "iti-".concat(this.id, "__country-listbox") + }, countrySearch || { + role: "combobox" + })), this.flagsContainer); + // we now include the selected flag element even when showFlags is disabled, + // as need to show globe icon for showSelectedDialCode empty state + this.selectedFlagInner = this._createEl("div", null, this.selectedFlag); + this.selectedFlagA11yText = this._createEl("span", { + "class": "iti__a11y-text" + }, this.selectedFlagInner); } + wrapper.appendChild(this.telInput); if (this.selectedFlag && this.telInput.disabled) { this.selectedFlag.setAttribute("aria-disabled", "true"); } - if (separateDialCode) { + if (showSelectedDialCode) { this.selectedDialCode = this._createEl("div", { "class": "iti__selected-dial-code" }, this.selectedFlag); @@ -481,79 +523,120 @@ this.selectedFlag.setAttribute("tabindex", "0"); } this.dropdownArrow = this._createEl("div", { - "class": "iti__arrow" + "class": "iti__arrow", + "aria-hidden": "true" }, this.selectedFlag); - // country dropdown: preferred countries, then divider, then all countries + var extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width"; + this.dropdownContent = this._createEl("div", { + id: "iti-".concat(this.id, "__dropdown-content"), + "class": "iti__dropdown-content iti__hide ".concat(extraClasses) + }); + if (countrySearch) { + this.searchInput = this._createEl("input", { + type: "text", + "class": "iti__search-input", + placeholder: i18n.searchPlaceholder || "Search", + role: "combobox", + "aria-expanded": "true", + "aria-label": i18n.searchPlaceholder || "Search", + "aria-controls": "iti-".concat(this.id, "__country-listbox"), + "aria-autocomplete": "list", + autocomplete: "off" + }, this.dropdownContent); + this.searchResultsA11yText = this._createEl("span", { + "class": "iti__a11y-text" + }, this.dropdownContent); + } + // country list: preferred countries, then divider, then all countries this.countryList = this._createEl("ul", { - "class": "iti__country-list iti__hide", + "class": "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", - "aria-label": "List of countries" - }); - if (this.preferredCountries.length) { + "aria-label": i18n.countryListAriaLabel || "List of countries" + }, this.dropdownContent); + if (this.preferredCountries.length && !countrySearch) { this._appendListItems(this.preferredCountries, "iti__preferred", true); this._createEl("li", { "class": "iti__divider", - role: "separator", - "aria-disabled": "true" + "aria-hidden": "true" }, this.countryList); } this._appendListItems(this.countries, "iti__standard"); + if (countrySearch) { + this._updateSearchResultsText(); + } // create dropdownContainer markup if (dropdownContainer) { + var dropdownClasses = "iti iti--container"; + if (useFullscreenPopup) { + dropdownClasses += " iti--fullscreen-popup"; + } else { + dropdownClasses += " iti--inline-dropdown"; + } + if (countrySearch) { + dropdownClasses += " iti--country-search"; + } this.dropdown = this._createEl("div", { - "class": "iti iti--container" + "class": dropdownClasses }); - this.dropdown.appendChild(this.countryList); + this.dropdown.appendChild(this.dropdownContent); } else { - this.flagsContainer.appendChild(this.countryList); + this.flagsContainer.appendChild(this.dropdownContent); } } if (hiddenInput) { - var hiddenInputName = hiddenInput; - var name = this.telInput.getAttribute("name"); - if (name) { - var i = name.lastIndexOf("["); - // if input name contains square brackets, then give the hidden input the same name, - // replacing the contents of the last set of brackets with the given hiddenInput name - if (i !== -1) { - hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]"); - } + var telInputName = this.telInput.getAttribute("name"); + var names = hiddenInput(telInputName); + if (names.phone) { + // Create hidden input for the full international number + this.hiddenInput = this._createEl("input", { + type: "hidden", + name: names.phone + }); + wrapper.appendChild(this.hiddenInput); + } + if (names.country) { + // Create hidden input for the selected country iso2 code + this.hiddenInputCountry = this._createEl("input", { + type: "hidden", + name: names.country + }); + wrapper.appendChild(this.hiddenInputCountry); } - this.hiddenInput = this._createEl("input", { - type: "hidden", - name: hiddenInputName - }); - wrapper.appendChild(this.hiddenInput); } } }, { key: "_appendListItems", value: function _appendListItems(countries, className, preferred) { - // we create so many DOM elements, it is faster to build a temp string - // and then add everything to the DOM in one go at the end - var tmp = ""; - // for each country for (var i = 0; i < countries.length; i++) { var c = countries[i]; var idSuffix = preferred ? "-preferred" : ""; - // open the list item - tmp += "
  • "); + var listItem = this._createEl("li", { + id: "iti-".concat(this.id, "__item-").concat(c.iso2).concat(idSuffix), + "class": "iti__country ".concat(className), + tabindex: "-1", + role: "option", + "data-dial-code": c.dialCode, + "data-country-code": c.iso2, + "aria-selected": "false" + }, this.countryList); + // store this for later use e.g. country search filtering + c.nodeById[this.id] = listItem; + var content = ""; // add the flag if (this.options.showFlags) { - tmp += "
    "); + content += "
    "); } // and the country name and dial code - tmp += "".concat(c.name, ""); - tmp += "+".concat(c.dialCode, ""); - // close the list item - tmp += "
  • "; + content += "".concat(c.name, ""); + content += "+".concat(c.dialCode, ""); + listItem.insertAdjacentHTML("beforeend", content); } - this.countryList.insertAdjacentHTML("beforeend", tmp); } }, { key: "_setInitialState", value: function _setInitialState() { + var overrideAutoCountry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; // fix firefox bug: when first load page (with input with value set to number with intl dial // code) and initialising plugin removes the dial code from the input, then refresh page, // and we try to init plugin again but this time on number without dial code so get grey flag @@ -563,31 +646,26 @@ var val = useAttribute ? attributeValue : inputValue; var dialCode = this._getDialCode(val); var isRegionlessNanp = this._isRegionlessNanp(val); - var _this$options2 = this.options, initialCountry = _this$options2.initialCountry, autoInsertDialCode = _this$options2.autoInsertDialCode; + var initialCountry = this.options.initialCountry; // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the // flag, else fall back to the default country if (dialCode && !isRegionlessNanp) { this._updateFlagFromNumber(val); - } else if (initialCountry !== "auto") { + } else if (initialCountry !== "auto" || overrideAutoCountry) { + var lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : ""; + var isValidInitialCountry = lowerInitialCountry && this._getCountryData(lowerInitialCountry, true); // see if we should select a flag - if (initialCountry) { - this._setFlag(initialCountry.toLowerCase()); + if (isValidInitialCountry) { + this._setCountry(lowerInitialCountry); } else { if (dialCode && isRegionlessNanp) { // has intl dial code, is regionless nanp, and no initialCountry, so default to US - this._setFlag("us"); + this._setCountry("us"); } else { - // no dial code and no initialCountry, so default to first in list - this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; - if (!val) { - this._setFlag(this.defaultCountry); - } + // display the empty state (globe icon) + this._setCountry(); } } - // if empty and autoInsertDialCode then insert the dial code - if (!val && autoInsertDialCode) { - this.telInput.value = "+".concat(this.selectedCountryData.dialCode); - } } // NOTE: if initialCountry is set to auto, that will be handled separately // format - note this wont be run after _updateDialCode as that's only called if no val @@ -599,52 +677,43 @@ key: "_initListeners", value: function _initListeners() { this._initKeyListeners(); - if (this.options.autoInsertDialCode) { - this._initBlurListeners(); - } if (this.options.allowDropdown) { this._initDropdownListeners(); } - if (this.hiddenInput) { + if ((this.hiddenInput || this.hiddenInputCountry) && this.telInput.form) { this._initHiddenInputListener(); } } }, { key: "_initHiddenInputListener", value: function _initHiddenInputListener() { - var _this3 = this; + var _this2 = this; this._handleHiddenInputSubmit = function() { - _this3.hiddenInput.value = _this3.getNumber(); + if (_this2.hiddenInput) { + _this2.hiddenInput.value = _this2.getNumber(); + } + if (_this2.hiddenInputCountry) { + _this2.hiddenInputCountry.value = _this2.getSelectedCountryData().iso2; + } }; - if (this.telInput.form) { - this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit); - } - } - }, { - key: "_getClosestLabel", - value: function _getClosestLabel() { - var el = this.telInput; - while (el && el.tagName !== "LABEL") { - el = el.parentNode; - } - return el; + this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit); } }, { key: "_initDropdownListeners", value: function _initDropdownListeners() { - var _this4 = this; + var _this3 = this; // hack for input nested inside label (which is valid markup): clicking the selected-flag to // open the dropdown would then automatically trigger a 2nd click on the input which would // close it again this._handleLabelClick = function(e) { // if the dropdown is closed, then focus the input, else ignore the click - if (_this4.countryList.classList.contains("iti__hide")) { - _this4.telInput.focus(); + if (_this3.dropdownContent.classList.contains("iti__hide")) { + _this3.telInput.focus(); } else { e.preventDefault(); } }; - var label = this._getClosestLabel(); + var label = this.telInput.closest("label"); if (label) { label.addEventListener("click", this._handleLabelClick); } @@ -653,24 +722,24 @@ // only intercept this event if we're opening the dropdown // else let it bubble up to the top ("click-off-to-close" listener) // we cannot just stopPropagation as it may be needed to close another instance - if (_this4.countryList.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) { - _this4._showDropdown(); + if (_this3.dropdownContent.classList.contains("iti__hide") && !_this3.telInput.disabled && !_this3.telInput.readOnly) { + _this3._openDropdown(); } }; this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag); - // open dropdown list if currently focused + // open dropdown if selected flag is focused and they press up/down/space/enter this._handleFlagsContainerKeydown = function(e) { - var isDropdownHidden = _this4.countryList.classList.contains("iti__hide"); - if (isDropdownHidden && [ "ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter" ].indexOf(e.key) !== -1) { + var isDropdownHidden = _this3.dropdownContent.classList.contains("iti__hide"); + if (isDropdownHidden && [ "ArrowUp", "ArrowDown", " ", "Enter" ].includes(e.key)) { // prevent form from being submitted if "ENTER" was pressed e.preventDefault(); // prevent event from being handled again by document e.stopPropagation(); - _this4._showDropdown(); + _this3._openDropdown(); } // allow navigation from dropdown to input on TAB if (e.key === "Tab") { - _this4._closeDropdown(); + _this3._closeDropdown(); } }; this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown); @@ -678,7 +747,7 @@ }, { key: "_initRequests", value: function _initRequests() { - var _this5 = this; + var _this4 = this; // if the user has specified the path to the utils script, fetch it on window.load, else resolve if (this.options.utilsScript && !window.intlTelInputUtils) { // if the plugin is being initialised after the window.load event has already been fired @@ -687,13 +756,14 @@ } else { // wait until the load event so we don't block any other requests e.g. the flags image window.addEventListener("load", function() { - window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript); + window.intlTelInputGlobals.loadUtils(_this4.options.utilsScript); }); } } else { this.resolveUtilsScriptPromise(); } - if (this.options.initialCountry === "auto") { + // dont bother with IP lookup if we already have a selected country + if (this.options.initialCountry === "auto" && !this.selectedCountryData.iso2) { this._loadAutoCountry(); } else { this.resolveAutoCountryPromise(); @@ -702,6 +772,7 @@ }, { key: "_loadAutoCountry", value: function _loadAutoCountry() { + var _this5 = this; // 3 options: // 1) already loaded (we're done) // 2) not already started loading (start) @@ -712,17 +783,25 @@ // don't do this twice! window.intlTelInputGlobals.startedLoadingAutoCountry = true; if (typeof this.options.geoIpLookup === "function") { - this.options.geoIpLookup(function(countryCode) { - window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase(); - // tell all instances the auto country is ready - // TODO: this should just be the current instances - // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight - // away (e.g. if they have already done the geo ip lookup somewhere else). Using - // setTimeout means that the current thread of execution will finish before executing - // this, which allows the plugin to finish initialising. - setTimeout(function() { - return forEachInstance("handleAutoCountry"); - }); + this.options.geoIpLookup(function() { + var iso2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + var iso2Lower = iso2.toLowerCase(); + var isValidIso2 = iso2Lower && _this5._getCountryData(iso2Lower, true); + if (isValidIso2) { + window.intlTelInputGlobals.autoCountry = iso2Lower; + // tell all instances the auto country is ready + // TODO: this should just be the current instances + // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight + // away (e.g. if they have already done the geo ip lookup somewhere else). Using + // setTimeout means that the current thread of execution will finish before executing + // this, which allows the plugin to finish initialising. + setTimeout(function() { + return forEachInstance("handleAutoCountry"); + }); + } else { + _this5._setInitialState(true); + forEachInstance("rejectAutoCountryPromise"); + } }, function() { return forEachInstance("rejectAutoCountryPromise"); }); @@ -733,20 +812,63 @@ key: "_initKeyListeners", value: function _initKeyListeners() { var _this6 = this; - // update flag on keyup - this._handleKeyupEvent = function() { + var userOverrideFormatting = false; + // update flag on input event + this._handleKeyEvent = function(e) { if (_this6._updateFlagFromNumber(_this6.telInput.value)) { _this6._triggerCountryChange(); } + // if user types their own formatting char (not a plus or a numeric), then set the override + var isFormattingChar = e && e.data && /[^+0-9]/.test(e.data); + var isPaste = e && e.inputType === "insertFromPaste" && _this6.telInput.value; + if (isFormattingChar || isPaste) { + userOverrideFormatting = true; + } else if (!/[^+0-9]/.test(_this6.telInput.value)) { + userOverrideFormatting = false; + } + // handle FAYT, unless userOverrideFormatting or it's a paste event + if (_this6.options.formatAsYouType && !userOverrideFormatting && !isPaste) { + // maintain caret position after reformatting + var currentCaretPos = _this6.telInput.selectionStart; + var valueBeforeCaret = _this6.telInput.value.substring(0, currentCaretPos); + var relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length; + var isDeleteForwards = e && e.inputType === "deleteContentForward"; + var formattedValue = _this6._formatNumberAsYouType(); + var newCaretPos = _this6._translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards); + _this6.telInput.value = formattedValue; + _this6.telInput.setSelectionRange(newCaretPos, newCaretPos); + } }; - this.telInput.addEventListener("keyup", this._handleKeyupEvent); - // update flag on cut/paste events (now supported in all major browsers) - this._handleClipboardEvent = function() { - // hack because "paste" event is fired before input is updated - setTimeout(_this6._handleKeyupEvent); - }; - this.telInput.addEventListener("cut", this._handleClipboardEvent); - this.telInput.addEventListener("paste", this._handleClipboardEvent); + // this handles individual key presses as well as cut/paste events + // the advantage of the "input" event over "keyup" etc is that "input" only fires when the value changes, + // whereas "keyup" fires even for arrow key presses etc + this.telInput.addEventListener("input", this._handleKeyEvent); + } + }, { + key: "_translateCursorPosition", + value: function _translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) { + // if the first char is a formatting char, and they backspace delete it: + // cursor should stay at the start (pos 0), rather than stick to the first digit (pos 1) + if (prevCaretPos === 0 && !isDeleteForwards) { + return 0; + } + var count = 0; + for (var i = 0; i < formattedValue.length; i++) { + if (/[+0-9]/.test(formattedValue[i])) { + count++; + } + // normal case: stop when you hit the right number of relevant chars + // (cursor will be just after the final relevant char) + if (count === relevantChars && !isDeleteForwards) { + return i + 1; + } + // spacial case: delete forwards (fn + delete on a mac): + // wait until hit one extra relevant char, and put the cursor just before it (after any formatting chars) + if (isDeleteForwards && count === relevantChars + 1) { + return i; + } + } + return formattedValue.length; } }, { key: "_cap", @@ -754,19 +876,6 @@ var max = this.telInput.getAttribute("maxlength"); return max && number.length > max ? number.substr(0, max) : number; } - }, { - key: "_initBlurListeners", - value: function _initBlurListeners() { - var _this7 = this; - // on blur or form submit: if just a dial code then remove it - this._handleSubmitOrBlurEvent = function() { - _this7._removeEmptyDialCode(); - }; - if (this.telInput.form) { - this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent); - } - this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent); - } }, { key: "_removeEmptyDialCode", value: function _removeEmptyDialCode() { @@ -786,22 +895,38 @@ }, { key: "_trigger", value: function _trigger(name) { - // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax - var e = document.createEvent("Event"); - e.initEvent(name, true, true); - // can bubble, and is cancellable + var e = new Event(name, { + bubbles: true, + cancelable: true + }); this.telInput.dispatchEvent(e); } }, { - key: "_showDropdown", - value: function _showDropdown() { - this.countryList.classList.remove("iti__hide"); + key: "_openDropdown", + value: function _openDropdown() { + var _this$options2 = this.options, fixDropdownWidth = _this$options2.fixDropdownWidth, countrySearch = _this$options2.countrySearch; + if (fixDropdownWidth) { + this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px"); + } + this.dropdownContent.classList.remove("iti__hide"); this.selectedFlag.setAttribute("aria-expanded", "true"); this._setDropdownPosition(); - // update highlighting and scroll to active list item - if (this.activeItem) { + // if we have previously selected a country (and countrySearch is disabled), then highlight that item and scroll to it + // else highlight the first item and scroll to top (even if countrySearch is disabled e.g. on init, showing globe icon) + if (this.activeItem && !countrySearch) { + // update highlighting and scroll to active list item this._highlightListItem(this.activeItem, false); this._scrollTo(this.activeItem, true); + } else { + // start by highlighting the first item in the list + var firstElementChild = this.countryList.firstElementChild; + if (firstElementChild) { + this._highlightListItem(firstElementChild, false); + this.countryList.scrollTop = 0; + } + if (countrySearch) { + this.searchInput.focus(); + } } // bind all the dropdown-related listeners: mouseover, click, click-off, keydown this._bindDropdownListeners(); @@ -821,67 +946,58 @@ }, { key: "_setDropdownPosition", value: function _setDropdownPosition() { - var _this8 = this; + var _this7 = this; if (this.options.dropdownContainer) { this.options.dropdownContainer.appendChild(this.dropdown); } - if (!this.isMobile) { + if (!this.options.useFullscreenPopup) { var pos = this.telInput.getBoundingClientRect(); // windowTop from https://stackoverflow.com/a/14384091/217866 - var windowTop = window.pageYOffset || document.documentElement.scrollTop; + var windowTop = document.documentElement.scrollTop; var inputTop = pos.top + windowTop; - var dropdownHeight = this.countryList.offsetHeight; + var dropdownHeight = this.dropdownContent.offsetHeight; // dropdownFitsBelow = (dropdownBottom < windowBottom) var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight; var dropdownFitsAbove = inputTop - dropdownHeight > windowTop; + // dont allow positioning above when country search enabled as the search box jumps around as you filter countries + var positionDropdownAboveInput = !this.options.countrySearch && !dropdownFitsBelow && dropdownFitsAbove; // by default, the dropdown will be below the input. If we want to position it above the // input, we add the dropup class. - this._toggleClass(this.countryList, "iti__country-list--dropup", !dropdownFitsBelow && dropdownFitsAbove); + this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", positionDropdownAboveInput); // if dropdownContainer is enabled, calculate postion if (this.options.dropdownContainer) { - // by default the dropdown will be directly over the input because it's not in the flow. - // If we want to position it below, we need to add some extra top value. - var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight; + // if we want to position the dropdown below the input, we need to add the input height to the top value + var extraTop = positionDropdownAboveInput ? 0 : this.telInput.offsetHeight; // calculate placement this.dropdown.style.top = "".concat(inputTop + extraTop, "px"); this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px"); // close menu on window scroll this._handleWindowScroll = function() { - return _this8._closeDropdown(); + return _this7._closeDropdown(); }; window.addEventListener("scroll", this._handleWindowScroll); } } } - }, { - key: "_getClosestListItem", - value: function _getClosestListItem(target) { - var el = target; - while (el && el !== this.countryList && !el.classList.contains("iti__country")) { - el = el.parentNode; - } - // if we reached the countryList element, then return null - return el === this.countryList ? null : el; - } }, { key: "_bindDropdownListeners", value: function _bindDropdownListeners() { - var _this9 = this; + var _this8 = this; // when mouse over a list item, just highlight that one // we add the class "highlight", so if they hit "enter" we know which one to select this._handleMouseoverCountryList = function(e) { // handle event delegation, as we're listening for this event on the countryList - var listItem = _this9._getClosestListItem(e.target); + var listItem = e.target.closest(".iti__country"); if (listItem) { - _this9._highlightListItem(listItem, false); + _this8._highlightListItem(listItem, false); } }; this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList); // listen for country selection this._handleClickCountryList = function(e) { - var listItem = _this9._getClosestListItem(e.target); + var listItem = e.target.closest(".iti__country"); if (listItem) { - _this9._selectListItem(listItem); + _this8._selectListItem(listItem); } }; this.countryList.addEventListener("click", this._handleClickCountryList); @@ -891,12 +1007,12 @@ var isOpening = true; this._handleClickOffToClose = function() { if (!isOpening) { - _this9._closeDropdown(); + _this8._closeDropdown(); } isOpening = false; }; document.documentElement.addEventListener("click", this._handleClickOffToClose); - // listen for up/down scrolling, enter to select, or letters to jump to country name. + // listen for up/down scrolling, enter to select, or escape to close // use keydown as keypress doesn't fire for non-char keys and we want to catch if they // just hit down and hold it to scroll down (no keyup event). // listen on the document because that's where key events are triggered if no input has focus @@ -905,21 +1021,28 @@ this._handleKeydownOnDropdown = function(e) { // prevent down key from scrolling the whole page, // and enter key from submitting a form etc - e.preventDefault(); - // up and down to navigate - if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") { - _this9._handleUpDownKey(e.key); - } else if (e.key === "Enter") { - _this9._handleEnterKey(); - } else if (e.key === "Escape") { - _this9._closeDropdown(); - } else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) { + if ([ "ArrowUp", "ArrowDown", "Enter", "Escape" ].includes(e.key)) { + e.preventDefault(); + e.stopPropagation(); + // up and down to navigate + if (e.key === "ArrowUp" || e.key === "ArrowDown") { + _this8._handleUpDownKey(e.key); + } else if (e.key === "Enter") { + _this8._handleEnterKey(); + } else if (e.key === "Escape") { + _this8._closeDropdown(); + } + } + // alpha chars to perform search + // regex allows one latin alpha char or space, based on https://stackoverflow.com/a/26900132/217866) + if (!_this8.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) { + e.stopPropagation(); // jump to countries that start with the query string if (queryTimer) { clearTimeout(queryTimer); } query += e.key.toLowerCase(); - _this9._searchForCountry(query); + _this8._searchForCountry(query); // if the timer hits 1 second, reset the query queryTimer = setTimeout(function() { query = ""; @@ -927,17 +1050,99 @@ } }; document.addEventListener("keydown", this._handleKeydownOnDropdown); + if (this.options.countrySearch) { + var doFilter = function doFilter() { + var inputQuery = _this8.searchInput.value.trim(); + if (inputQuery) { + _this8._filterCountries(inputQuery); + } else { + _this8._filterCountries("", true); + } + }; + var keyupTimer = null; + this._handleSearchChange = function() { + // filtering country nodes is expensive (lots of DOM manipulation), so rate limit it + if (keyupTimer) { + clearTimeout(keyupTimer); + } + keyupTimer = setTimeout(function() { + doFilter(); + keyupTimer = null; + }, 100); + }; + this.searchInput.addEventListener("input", this._handleSearchChange); + // stop propagation on search input click, so doesn't trigger click-off-to-close listener + this.searchInput.addEventListener("click", function(e) { + return e.stopPropagation(); + }); + } + } + }, { + key: "_normaliseString", + value: function _normaliseString() { + var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + return s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(); + } + }, { + key: "_filterCountries", + value: function _filterCountries(query) { + var isReset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var isFirst = true; + this.countryList.innerHTML = ""; + var normalisedQuery = this._normaliseString(query); + for (var i = 0; i < this.countries.length; i++) { + var c = this.countries[i]; + var normalisedCountryName = this._normaliseString(c.name); + var fullDialCode = "+".concat(c.dialCode); + if (isReset || normalisedCountryName.includes(normalisedQuery) || fullDialCode.includes(normalisedQuery) || c.iso2.includes(normalisedQuery)) { + this.countryList.appendChild(c.nodeById[this.id]); + // highlight the first item + if (isFirst) { + this._highlightListItem(c.nodeById[this.id], false); + isFirst = false; + } + } + } + // scroll to top (useful if user had previously scrolled down) + this.countryList.scrollTop = 0; + this._updateSearchResultsText(); + } + }, { + key: "_updateSearchResultsText", + value: function _updateSearchResultsText() { + var i18n = this.options.i18n; + var count = this.countryList.childElementCount; + var searchText; + if (count === 0) { + searchText = i18n.zeroSearchResults || "No results found"; + } else if (count === 1) { + searchText = i18n.oneSearchResult || "1 result found"; + } else { + // eslint-disable-next-line no-template-curly-in-string + searchText = i18n.multipleSearchResults ? i18n.multipleSearchResults.replace("${count}", count) : "".concat(count, " results found"); + } + this.searchResultsA11yText.textContent = searchText; } }, { key: "_handleUpDownKey", value: function _handleUpDownKey(key) { - var next = key === "ArrowUp" || key === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling; + var next = key === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling; if (next) { // skip the divider if (next.classList.contains("iti__divider")) { - next = key === "ArrowUp" || key === "Up" ? next.previousElementSibling : next.nextElementSibling; + next = key === "ArrowUp" ? next.previousElementSibling : next.nextElementSibling; } - this._highlightListItem(next, true); + } else if (this.countryList.childElementCount > 1) { + // otherwise, we must be at the end, so loop round again + next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild; + } + if (next) { + // make sure the next item is visible + // (before calling focus(), which can cause the next item to scroll to the middle of the dropdown, which is jarring) + this._scrollTo(next, false); + // if country search enabled, dont lose focus from the search input on up/down + var doFocus = !this.options.countrySearch; + this._highlightListItem(next, doFocus); } } }, { @@ -952,7 +1157,7 @@ value: function _searchForCountry(query) { for (var i = 0; i < this.countries.length; i++) { if (this._startsWith(this.countries[i].name, query)) { - var listItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[i].iso2)); + var listItem = this.countries[i].nodeById[this.id]; // update highlighting and scroll this._highlightListItem(listItem, false); this._scrollTo(listItem, true); @@ -967,10 +1172,10 @@ } }, { key: "_updateValFromNumber", - value: function _updateValFromNumber(originalNumber) { - var number = originalNumber; + value: function _updateValFromNumber(fullNumber) { + var number = fullNumber; if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) { - var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.separateDialCode; + var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.showSelectedDialCode; var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL; var format = useNational ? NATIONAL : INTERNATIONAL; number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); @@ -980,13 +1185,17 @@ } }, { key: "_updateFlagFromNumber", - value: function _updateFlagFromNumber(originalNumber) { + value: function _updateFlagFromNumber(fullNumber) { + var plusIndex = fullNumber.indexOf("+"); + // if it contains a plus, discard any chars before it e.g. accidental space char. + // this keeps the selected country auto-updating correctly, which we want as + // libphonenumber's validation/getNumber methods will ignore these chars anyway + var number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber; // if we already have US/Canada selected, make sure the number starts // with a +1 so _getDialCode will be able to extract the area code // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag // from the number), that means we're initialising the plugin with a number that already has a // dial code, so fine to ignore this bit - var number = originalNumber; var selectedDialCode = this.selectedCountryData.dialCode; var isNanp = selectedDialCode === "1"; if (number && isNanp && number.charAt(0) !== "+") { @@ -995,32 +1204,32 @@ } number = "+".concat(number); } - // if separateDialCode enabled, then consider the selected dial code to be part of the number - if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") { + // if showSelectedDialCode enabled, then consider the selected dial code to be part of the number + if (this.options.showSelectedDialCode && selectedDialCode && number.charAt(0) !== "+") { number = "+".concat(selectedDialCode).concat(number); } // try and extract valid dial code from input var dialCode = this._getDialCode(number, true); var numeric = this._getNumeric(number); - var countryCode = null; + var iso2 = null; if (dialCode) { - var countryCodes = this.countryCodes[this._getNumeric(dialCode)]; + var iso2Codes = this.dialCodeToIso2Map[this._getNumeric(dialCode)]; // check if the right country is already selected. this should be false if the number is // longer than the matched dial code because in this case we need to make sure that if // there are multiple country matches, that the first one is selected (note: we could // just check that here, but it requires the same loop that we already have later) - var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1; + var alreadySelected = iso2Codes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1; var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric); // only update the flag if: // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp) // AND // B) the right country is not already selected if (!isRegionlessNanpNumber && !alreadySelected) { - // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first + // if using onlyCountries option, iso2Codes[0] may be empty, so we must find the first // non-empty index - for (var j = 0; j < countryCodes.length; j++) { - if (countryCodes[j]) { - countryCode = countryCodes[j]; + for (var j = 0; j < iso2Codes.length; j++) { + if (iso2Codes[j]) { + iso2 = iso2Codes[j]; break; } } @@ -1029,13 +1238,13 @@ // invalid dial code, so empty // Note: use getNumeric here because the number has not been formatted yet, so could contain // bad chars - countryCode = ""; - } else if (!number || number === "+") { - // empty, or just a plus, so default - countryCode = this.defaultCountry; + iso2 = ""; + } else if ((!number || number === "+") && !this.selectedCountryData.iso2) { + // if no selected flag, and user either clears the input, or just types a plus, then show default + iso2 = this.defaultCountry; } - if (countryCode !== null) { - return this._setFlag(countryCode); + if (iso2 !== null) { + return this._setCountry(iso2); } return false; } @@ -1055,44 +1264,62 @@ var prevItem = this.highlightedItem; if (prevItem) { prevItem.classList.remove("iti__highlight"); + prevItem.setAttribute("aria-selected", "false"); } this.highlightedItem = listItem; this.highlightedItem.classList.add("iti__highlight"); + this.highlightedItem.setAttribute("aria-selected", "true"); this.selectedFlag.setAttribute("aria-activedescendant", listItem.getAttribute("id")); + if (this.options.countrySearch) { + this.searchInput.setAttribute("aria-activedescendant", listItem.getAttribute("id")); + } if (shouldFocus) { this.highlightedItem.focus(); } } }, { key: "_getCountryData", - value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) { - var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; - for (var i = 0; i < countryList.length; i++) { - if (countryList[i].iso2 === countryCode) { - return countryList[i]; + value: function _getCountryData(iso2, allowFail) { + for (var i = 0; i < this.countries.length; i++) { + if (this.countries[i].iso2 === iso2) { + return this.countries[i]; } } if (allowFail) { return null; } - throw new Error("No country data for '".concat(countryCode, "'")); + throw new Error("No country data for '".concat(iso2, "'")); } }, { - key: "_setFlag", - value: function _setFlag(countryCode) { - var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags; + key: "_setCountry", + value: function _setCountry(iso2) { + var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, showSelectedDialCode = _this$options3.showSelectedDialCode, showFlags = _this$options3.showFlags, countrySearch = _this$options3.countrySearch, i18n = _this$options3.i18n; var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; - // do this first as it will throw an error and stop if countryCode is invalid - this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; + // do this first as it will throw an error and stop if iso2 is invalid + this.selectedCountryData = iso2 ? this._getCountryData(iso2, false) : {}; // update the defaultCountry - we only need the iso2 from now on, so just store that if (this.selectedCountryData.iso2) { this.defaultCountry = this.selectedCountryData.iso2; } - if (showFlags) { - this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode)); + // update the flag class and the a11y text + if (this.selectedFlagInner) { + var flagClass = ""; + var a11yText = ""; + if (iso2) { + if (showFlags) { + flagClass = "iti__flag iti__".concat(iso2); + a11yText = "".concat(this.selectedCountryData.name, " +").concat(this.selectedCountryData.dialCode); + } + } else { + flagClass = "iti__flag iti__globe"; + a11yText = i18n.noCountrySelected || "No country selected"; + } + this.selectedFlagInner.className = flagClass; + this.selectedFlagA11yText.textContent = a11yText; } - this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode); - if (separateDialCode) { + this._setSelectedCountryFlagTitleAttribute(iso2, showSelectedDialCode); + // update the selected dial code + if (showSelectedDialCode) { var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : ""; this.selectedDialCode.innerHTML = dialCode; // offsetWidth is zero if input is in a hidden container during initialisation @@ -1106,34 +1333,34 @@ } // and the input's placeholder this._updatePlaceholder(); - // update the active list item - if (allowDropdown) { + // update the active list item (only if country search disabled, as country search doesn't store the active item) + if (allowDropdown && !countrySearch) { var prevItem = this.activeItem; if (prevItem) { prevItem.classList.remove("iti__active"); prevItem.setAttribute("aria-selected", "false"); } - if (countryCode) { + if (iso2) { // check if there is a preferred item first, else fall back to standard - var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode)); + var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(iso2, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(iso2)); nextItem.setAttribute("aria-selected", "true"); nextItem.classList.add("iti__active"); this.activeItem = nextItem; } } // return if the flag has changed or not - return prevCountry.iso2 !== countryCode; + return prevCountry.iso2 !== iso2; } }, { key: "_setSelectedCountryFlagTitleAttribute", - value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) { + value: function _setSelectedCountryFlagTitleAttribute(iso2, showSelectedDialCode) { if (!this.selectedFlag) { return; } var title; - if (countryCode && !separateDialCode) { + if (iso2 && !showSelectedDialCode) { title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode); - } else if (countryCode) { + } else if (iso2) { // For screen reader output, we don't want to include the dial code in the reader output twice // so just use the selected country name here: title = this.selectedCountryData.name; @@ -1161,13 +1388,14 @@ }, { key: "_updatePlaceholder", value: function _updatePlaceholder() { - var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite"; + var _this$options4 = this.options, autoPlaceholder = _this$options4.autoPlaceholder, placeholderNumberType = _this$options4.placeholderNumberType, nationalMode = _this$options4.nationalMode, customPlaceholder = _this$options4.customPlaceholder; + var shouldSetPlaceholder = autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && autoPlaceholder === "polite"; if (window.intlTelInputUtils && shouldSetPlaceholder) { - var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType]; - var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; + var numberType = intlTelInputUtils.numberType[placeholderNumberType]; + var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, nationalMode, numberType) : ""; placeholder = this._beforeSetNumber(placeholder); - if (typeof this.options.customPlaceholder === "function") { - placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); + if (typeof customPlaceholder === "function") { + placeholder = customPlaceholder(placeholder, this.selectedCountryData); } this.telInput.setAttribute("placeholder", placeholder); } @@ -1176,15 +1404,11 @@ key: "_selectListItem", value: function _selectListItem(listItem) { // update selected flag and active list item - var flagChanged = this._setFlag(listItem.getAttribute("data-country-code")); + var flagChanged = this._setCountry(listItem.getAttribute("data-country-code")); this._closeDropdown(); this._updateDialCode(listItem.getAttribute("data-dial-code")); // focus the input this.telInput.focus(); - // put cursor at end - this fix is required for FF and IE11 (with auto inserting dial code), - // who try to put the cursor at the beginning the first time - var len = this.telInput.value.length; - this.telInput.setSelectionRange(len, len); if (flagChanged) { this._triggerCountryChange(); } @@ -1192,19 +1416,28 @@ }, { key: "_closeDropdown", value: function _closeDropdown() { - this.countryList.classList.add("iti__hide"); + this.dropdownContent.classList.add("iti__hide"); this.selectedFlag.setAttribute("aria-expanded", "false"); this.selectedFlag.removeAttribute("aria-activedescendant"); + if (this.highlightedItem) { + this.highlightedItem.setAttribute("aria-selected", "false"); + } + if (this.options.countrySearch) { + this.searchInput.removeAttribute("aria-activedescendant"); + } // update the arrow this.dropdownArrow.classList.remove("iti__arrow--up"); // unbind key events document.removeEventListener("keydown", this._handleKeydownOnDropdown); + if (this.options.countrySearch) { + this.searchInput.removeEventListener("input", this._handleSearchChange); + } document.documentElement.removeEventListener("click", this._handleClickOffToClose); this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList); this.countryList.removeEventListener("click", this._handleClickCountryList); // remove menu from container if (this.options.dropdownContainer) { - if (!this.isMobile) { + if (!this.options.useFullscreenPopup) { window.removeEventListener("scroll", this._handleWindowScroll); } if (this.dropdown.parentNode) { @@ -1218,7 +1451,7 @@ value: function _scrollTo(element, middle) { var container = this.countryList; // windowTop from https://stackoverflow.com/a/14384091/217866 - var windowTop = window.pageYOffset || document.documentElement.scrollTop; + var windowTop = document.documentElement.scrollTop; var containerHeight = container.offsetHeight; var containerTop = container.getBoundingClientRect().top + windowTop; var containerBottom = containerTop + containerHeight; @@ -1261,14 +1494,6 @@ newNumber = newDialCode; } this.telInput.value = newNumber; - } else if (this.options.autoInsertDialCode) { - if (inputVal) { - // there is an existing value with no dial code: prefix the new dial code - newNumber = newDialCode + inputVal; - } else { - newNumber = newDialCode; - } - this.telInput.value = newNumber; } } }, { @@ -1286,7 +1511,7 @@ numericChars += c; // if current numericChars make a valid dial code if (includeAreaCode) { - if (this.countryCodes[numericChars]) { + if (this.dialCodeToIso2Map[numericChars]) { // store the actual raw string (useful for matching later) dialCode = number.substr(0, i + 1); } @@ -1298,7 +1523,7 @@ } } // stop searching as soon as we can - in this case when we hit max len - if (numericChars.length === this.countryCodeMaxLen) { + if (numericChars.length === this.dialCodeMaxLen) { break; } } @@ -1313,8 +1538,8 @@ var dialCode = this.selectedCountryData.dialCode; var prefix; var numericVal = this._getNumeric(val); - if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) { - // when using separateDialCode, it is visible so is effectively part of the typed number + if (this.options.showSelectedDialCode && !this.options.nationalMode && val.charAt(0) !== "+" && dialCode && numericVal) { + // when using showSelectedDialCode, it is visible so is effectively part of the typed number prefix = "+".concat(dialCode); } else { prefix = ""; @@ -1323,9 +1548,9 @@ } }, { key: "_beforeSetNumber", - value: function _beforeSetNumber(originalNumber) { - var number = originalNumber; - if (this.options.separateDialCode) { + value: function _beforeSetNumber(fullNumber) { + var number = fullNumber; + if (this.options.showSelectedDialCode) { var dialCode = this._getDialCode(number); // if there is a valid dial code if (dialCode) { @@ -1346,6 +1571,19 @@ value: function _triggerCountryChange() { this._trigger("countrychange"); } + }, { + key: "_formatNumberAsYouType", + value: function _formatNumberAsYouType() { + var val = this._getFullNumber(); + var result = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val; + // if showSelectedDialCode and they haven't (re)typed the dial code in the input as well, then remove the dial code + var dialCode = this.selectedCountryData.dialCode; + if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && result.includes("+".concat(dialCode))) { + var afterDialCode = result.split("+".concat(dialCode))[1] || ""; + return afterDialCode.trim(); + } + return result; + } }, { key: "handleAutoCountry", value: function handleAutoCountry() { @@ -1369,38 +1607,33 @@ if (this.telInput.value) { this._updateValFromNumber(this.telInput.value); } - this._updatePlaceholder(); + if (this.selectedCountryData.iso2) { + this._updatePlaceholder(); + } } this.resolveUtilsScriptPromise(); } }, { key: "destroy", value: function destroy() { - var form = this.telInput.form; if (this.options.allowDropdown) { // make sure the dropdown is closed (and unbind listeners) this._closeDropdown(); this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag); this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown); // label click hack - var label = this._getClosestLabel(); + var label = this.telInput.closest("label"); if (label) { label.removeEventListener("click", this._handleLabelClick); } } // unbind hiddenInput listeners - if (this.hiddenInput && form) { + var form = this.telInput.form; + if (this._handleHiddenInputSubmit && form) { form.removeEventListener("submit", this._handleHiddenInputSubmit); } - // unbind autoInsertDialCode listeners - if (this.options.autoInsertDialCode) { - if (form) { - form.removeEventListener("submit", this._handleSubmitOrBlurEvent); - } - this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent); - } // unbind key events, and cut/paste events - this.telInput.removeEventListener("keyup", this._handleKeyupEvent); + this.telInput.removeEventListener("input", this._handleKeyEvent); this.telInput.removeEventListener("cut", this._handleClipboardEvent); this.telInput.removeEventListener("paste", this._handleClipboardEvent); // remove attribute of id instance: data-intl-tel-input-id @@ -1453,22 +1686,31 @@ }, { key: "isValidNumber", value: function isValidNumber() { - var val = this._getFullNumber().trim(); - return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null; + var mobileOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var val = this._getFullNumber(); + // return false for any alpha chars + if (/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/.test(val)) { + return false; + } + return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2, mobileOnly) : null; } }, { - key: "isPossibleNumber", - value: function isPossibleNumber() { - var val = this._getFullNumber().trim(); - return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null; + key: "isValidNumberPrecise", + value: function isValidNumberPrecise() { + var val = this._getFullNumber(); + // return false for any alpha chars + if (/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/.test(val)) { + return false; + } + return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null; } }, { key: "setCountry", - value: function setCountry(originalCountryCode) { - var countryCode = originalCountryCode.toLowerCase(); + value: function setCountry(iso2) { + var iso2Lower = iso2.toLowerCase(); // check if already selected - if (this.selectedCountryData.iso2 !== countryCode) { - this._setFlag(countryCode); + if (this.selectedCountryData.iso2 !== iso2Lower) { + this._setCountry(iso2Lower); this._updateDialCode(this.selectedCountryData.dialCode); this._triggerCountryChange(); } @@ -1530,20 +1772,16 @@ if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) { // only do this once window.intlTelInputGlobals.startedLoadingUtilsScript = true; - // if we have promises, then return a promise - if (typeof Promise !== "undefined") { - return new Promise(function(resolve, reject) { - return injectScript(path, resolve, reject); - }); - } - injectScript(path); + return new Promise(function(resolve, reject) { + return injectScript(path, resolve, reject); + }); } return null; }; // default options intlTelInputGlobals.defaults = defaults; // version - intlTelInputGlobals.version = "18.2.1"; + intlTelInputGlobals.version = "20.0.3"; var pluginName = "intlTelInput"; // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations diff --git a/public/assets/build/js/intlTelInput.js b/public/assets/build/js/intlTelInput.js index b9ed680..13bad78 100644 --- a/public/assets/build/js/intlTelInput.js +++ b/public/assets/build/js/intlTelInput.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v18.2.1 + * International Telephone Input v20.0.3 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ @@ -24,7 +24,7 @@ // Order (if >1 country with same dial code), // Area codes // ] - var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "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", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "North Macedonia (Северна Македонија)", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; + var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua & Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia & Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "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", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo - Brazzaville", "cg", "242" ], [ "Congo - Kinshasa", "cd", "243" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "North Macedonia", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Réunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé & Príncipe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "St Barthélemy", "bl", "590", 1 ], [ "St Helena", "sh", "290" ], [ "St Kitts & Nevis", "kn", "1", 18, [ "869" ] ], [ "St Lucia", "lc", "1", 19, [ "758" ] ], [ "St Martin", "mf", "590", 2 ], [ "St Pierre & Miquelon", "pm", "508" ], [ "St Vincent & Grenadines", "vc", "1", 20, [ "784" ] ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard & Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad & Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks & Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "US Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis & Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ]; // loop over all of the countries above, restructuring the data to be objects with named keys for (var i = 0; i < allCountries.length; i++) { var c = allCountries[i]; @@ -33,21 +33,28 @@ iso2: c[1], dialCode: c[2], priority: c[3] || 0, - areaCodes: c[4] || null + areaCodes: c[4] || null, + nodeById: {} }; } "use strict"; + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; + } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === "function") { - ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function(key) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; @@ -66,6 +73,49 @@ } return obj; } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _iterableToArrayLimit(arr, i) { + var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; + if (null != _i) { + var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; + try { + if (_x = (_i = _i.call(arr)).next, 0 === i) { + if (Object(_i) !== _i) return; + _n = !1; + } else for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) ; + } catch (err) { + _d = !0, _e = err; + } finally { + try { + if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; + } finally { + if (_d) throw _e; + } + } + return _arr; + } + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); @@ -121,131 +171,111 @@ var defaults = { // whether or not to allow the dropdown allowDropdown: true, - // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry - // also listen for blur/submit and auto remove dial code if that's all there is - autoInsertDialCode: false, // add a placeholder in the input with an example number for the selected country autoPlaceholder: "polite", + // add a country search input at the top of the dropdown + countrySearch: true, // modify the parentClass - customContainer: "", + containerClass: "", // modify the auto placeholder customPlaceholder: null, // append menu to specified element dropdownContainer: null, // don't display these countries excludeCountries: [], + // fix the dropdown width to the input width (rather than being as wide as the longest country name) + fixDropdownWidth: true, + // format the number as the user types + formatAsYouType: true, // format the input value during initialisation and on setNumber formatOnDisplay: true, // geoIp lookup function geoIpLookup: null, - // inject a hidden input with this name, and on submit, populate it with the result of getNumber - hiddenInput: "", + // inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber + hiddenInput: null, + // internationalise the plugin text e.g. search input placeholder, country names + i18n: {}, // initial country initialCountry: "", - // localized country names e.g. { 'de': 'Deutschland' } - localizedCountries: null, // national vs international formatting for numbers e.g. placeholders and displaying existing numbers nationalMode: true, // display only these countries onlyCountries: [], // number type to use for placeholders placeholderNumberType: "MOBILE", - // the countries at the top of the list. defaults to united states and united kingdom - preferredCountries: [ "us", "gb" ], - // display the country dial code next to the selected flag - separateDialCode: false, - // option to hide the flags - must be used with separateDialCode, or allowDropdown=false + // the countries at the top of the list + preferredCountries: [], + // option to hide the flags - must be used with showSelectedDialCode, or allowDropdown=false showFlags: true, + // display the international dial code next to the selected flag + showSelectedDialCode: false, + // use full screen popup instead of dropdown for country list + useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? // we cannot just test screen size as some smartphones/website meta tags will report desktop + // resolutions + // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' + /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, // specify the path to the libphonenumber script to enable validation/formatting utilsScript: "" }; // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ]; - // utility function to iterate over an object. can't use Object.entries or native forEach because - // of IE11 - var forEachProp = function forEachProp(obj, callback) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - callback(keys[i], obj[keys[i]]); - } - }; // run a method on each instance of the plugin var forEachInstance = function forEachInstance(method) { - forEachProp(window.intlTelInputGlobals.instances, function(key) { - window.intlTelInputGlobals.instances[key][method](); + var instances = window.intlTelInputGlobals.instances; + Object.values(instances).forEach(function(instance) { + return instance[method](); }); }; // this is our plugin class that we will create an instance of // eslint-disable-next-line no-unused-vars var Iti = /*#__PURE__*/ function() { - function Iti(input, options) { - var _this = this; + function Iti(input) { + var customOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Iti); this.id = id++; this.telInput = input; this.activeItem = null; this.highlightedItem = null; // process specified options / defaults - // alternative to Object.assign, which isn't supported by IE11 - var customOptions = options || {}; - this.options = {}; - forEachProp(defaults, function(key, value) { - _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value; - }); + this.options = Object.assign({}, defaults, customOptions); this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder")); } _createClass(Iti, [ { key: "_init", value: function _init() { - var _this2 = this; - // if in nationalMode, do not insert dial codes - if (this.options.nationalMode) { - this.options.autoInsertDialCode = false; + var _this = this; + // if showing fullscreen popup, do not fix the width + if (this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = false; } - // if separateDialCode enabled, do not insert dial codes - if (this.options.separateDialCode) { - this.options.autoInsertDialCode = false; + // when search enabled, we must fix the width else it would change with different results + if (this.options.countrySearch && !this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = true; } // force showFlags=true if there's a dropdown and we're not displaying the dial code, // as otherwise you just have a down arrow on it's own which doesn't make sense - var forceShowFlags = this.options.allowDropdown && !this.options.separateDialCode; + var forceShowFlags = this.options.allowDropdown && !this.options.showSelectedDialCode; if (!this.options.showFlags && forceShowFlags) { this.options.showFlags = true; } - // we cannot just test screen size as some smartphones/website meta tags will report desktop - // resolutions - // Note: for some reason jasmine breaks if you put this in the main Plugin function with the - // rest of these declarations - // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' - this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); - if (this.isMobile) { - // trigger the mobile dropdown css - document.body.classList.add("iti-mobile"); - // on mobile, we want a full screen dropdown, so we must append it to the body - if (!this.options.dropdownContainer) { - this.options.dropdownContainer = document.body; - } + // on mobile, we want a full screen dropdown, so we must append it to the body + if (this.options.useFullscreenPopup && !this.options.dropdownContainer) { + this.options.dropdownContainer = document.body; } // check if input has one parent with RTL this.isRTL = !!this.telInput.closest("[dir=rtl]"); // these promises get resolved when their individual requests complete // this way the dev can do something like iti.promise.then(...) to know when all requests are // complete - if (typeof Promise !== "undefined") { - var autoCountryPromise = new Promise(function(resolve, reject) { - _this2.resolveAutoCountryPromise = resolve; - _this2.rejectAutoCountryPromise = reject; - }); - var utilsScriptPromise = new Promise(function(resolve, reject) { - _this2.resolveUtilsScriptPromise = resolve; - _this2.rejectUtilsScriptPromise = reject; - }); - this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]); - } else { - // prevent errors when Promise doesn't exist - this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {}; - this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {}; - } + var autoCountryPromise = new Promise(function(resolve, reject) { + _this.resolveAutoCountryPromise = resolve; + _this.rejectAutoCountryPromise = reject; + }); + var utilsScriptPromise = new Promise(function(resolve, reject) { + _this.resolveUtilsScriptPromise = resolve; + _this.rejectUtilsScriptPromise = reject; + }); + this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]); // in various situations there could be no country selected initially, but we need to be able // to assume this variable exists this.selectedCountryData = {}; @@ -255,7 +285,7 @@ this._generateMarkup(); // set the initial state of the input value and the selected flag this._setInitialState(); - // start all of the event listeners: autoInsertDialCode, input keydown, selectedFlag click + // start all of the event listeners: input keydown, selectedFlag click this._initListeners(); // utils script, and auto country this._initRequests(); @@ -265,37 +295,35 @@ value: function _processCountryData() { // process onlyCountries or excludeCountries array if present this._processAllCountries(); - // process the countryCodes map - this._processCountryCodes(); + // generate this.dialCodes and this.dialCodeToIso2Map + this._processDialCodes(); // process the preferredCountries this._processPreferredCountries(); - // translate countries according to localizedCountries option - if (this.options.localizedCountries) { - this._translateCountriesByLocale(); - } + // translate country names according to i18n option + this._translateCountryNames(); // sort countries by name - if (this.options.onlyCountries.length || this.options.localizedCountries) { + if (this.options.onlyCountries.length || this.options.i18n) { this.countries.sort(this._countryNameSort); } } }, { - key: "_addCountryCode", - value: function _addCountryCode(iso2, countryCode, priority) { - if (countryCode.length > this.countryCodeMaxLen) { - this.countryCodeMaxLen = countryCode.length; + key: "_addToDialCodeMap", + value: function _addToDialCodeMap(iso2, dialCode, priority) { + if (dialCode.length > this.dialCodeMaxLen) { + this.dialCodeMaxLen = dialCode.length; } - if (!this.countryCodes.hasOwnProperty(countryCode)) { - this.countryCodes[countryCode] = []; + if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) { + this.dialCodeToIso2Map[dialCode] = []; } - // bail if we already have this country for this countryCode - for (var i = 0; i < this.countryCodes[countryCode].length; i++) { - if (this.countryCodes[countryCode][i] === iso2) { + // bail if we already have this country for this dialCode + for (var i = 0; i < this.dialCodeToIso2Map[dialCode].length; i++) { + if (this.dialCodeToIso2Map[dialCode][i] === iso2) { return; } } // check for undefined as 0 is falsy - var index = priority !== undefined ? priority : this.countryCodes[countryCode].length; - this.countryCodes[countryCode][index] = iso2; + var index = priority !== undefined ? priority : this.dialCodeToIso2Map[dialCode].length; + this.dialCodeToIso2Map[dialCode][index] = iso2; } }, { key: "_processAllCountries", @@ -319,12 +347,12 @@ } } }, { - key: "_translateCountriesByLocale", - value: function _translateCountriesByLocale() { + key: "_translateCountryNames", + value: function _translateCountryNames() { for (var i = 0; i < this.countries.length; i++) { - var iso = this.countries[i].iso2.toLowerCase(); - if (this.options.localizedCountries.hasOwnProperty(iso)) { - this.countries[i].name = this.options.localizedCountries[iso]; + var iso2 = this.countries[i].iso2.toLowerCase(); + if (this.options.i18n.hasOwnProperty(iso2)) { + this.countries[i].name = this.options.i18n[iso2]; } } } @@ -340,20 +368,30 @@ return 0; } }, { - key: "_processCountryCodes", - value: function _processCountryCodes() { - this.countryCodeMaxLen = 0; - // here we store just dial codes + key: "_processDialCodes", + value: function _processDialCodes() { + // here we store just dial codes, where the key is the dial code, and the value is true + // e.g. { 1: true, 7: true, 20: true, ... } this.dialCodes = {}; - // here we store "country codes" (both dial codes and their area codes) - this.countryCodes = {}; + this.dialCodeMaxLen = 0; + // here we map dialCodes (inc both dialCode and dialCode+areaCode) to iso2 codes + /* e.g. + * { + * 1: [ 'us', 'ca', ... ], # all NANP countries + * 12: [ 'us', 'ca', ... ], # subset of NANP countries + * 120: [ 'us', 'ca' ], # just US and Canada + * 1204: [ 'ca' ], # only Canada + * ... + * } + */ + this.dialCodeToIso2Map = {}; // first: add dial codes for (var i = 0; i < this.countries.length; i++) { var c = this.countries[i]; if (!this.dialCodes[c.dialCode]) { this.dialCodes[c.dialCode] = true; } - this._addCountryCode(c.iso2, c.dialCode, c.priority); + this._addToDialCodeMap(c.iso2, c.dialCode, c.priority); } // next: add area codes // this is a second loop over countries, to make sure we have all of the "root" countries @@ -363,7 +401,7 @@ var _c = this.countries[_i]; // area codes if (_c.areaCodes) { - var rootCountryCode = this.countryCodes[_c.dialCode][0]; + var rootIso2Code = this.dialCodeToIso2Map[_c.dialCode][0]; // for each area code for (var j = 0; j < _c.areaCodes.length; j++) { var areaCode = _c.areaCodes[j]; @@ -371,11 +409,11 @@ for (var k = 1; k < areaCode.length; k++) { var partialDialCode = _c.dialCode + areaCode.substr(0, k); // start with the root country, as that also matches this dial code - this._addCountryCode(rootCountryCode, partialDialCode); - this._addCountryCode(_c.iso2, partialDialCode); + this._addToDialCodeMap(rootIso2Code, partialDialCode); + this._addToDialCodeMap(_c.iso2, partialDialCode); } // add the full area code - this._addCountryCode(_c.iso2, _c.dialCode + areaCode); + this._addToDialCodeMap(_c.iso2, _c.dialCode + areaCode); } } } @@ -385,8 +423,8 @@ value: function _processPreferredCountries() { this.preferredCountries = []; for (var i = 0; i < this.options.preferredCountries.length; i++) { - var countryCode = this.options.preferredCountries[i].toLowerCase(); - var countryData = this._getCountryData(countryCode, false, true); + var iso2 = this.options.preferredCountries[i].toLowerCase(); + var countryData = this._getCountryData(iso2, true); if (countryData) { this.preferredCountries.push(countryData); } @@ -397,7 +435,8 @@ value: function _createEl(name, attrs, container) { var el = document.createElement(name); if (attrs) { - forEachProp(attrs, function(key, value) { + Object.entries(attrs).forEach(function(_ref) { + var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1]; return el.setAttribute(key, value); }); } @@ -409,6 +448,7 @@ }, { key: "_generateMarkup", value: function _generateMarkup() { + this.telInput.classList.add("iti__tel-input"); // if autocomplete does not exist on the element and its form, then // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the @@ -416,56 +456,58 @@ if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) { this.telInput.setAttribute("autocomplete", "off"); } - var _this$options = this.options, allowDropdown = _this$options.allowDropdown, separateDialCode = _this$options.separateDialCode, showFlags = _this$options.showFlags, customContainer = _this$options.customContainer, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer; + var _this$options = this.options, allowDropdown = _this$options.allowDropdown, showSelectedDialCode = _this$options.showSelectedDialCode, showFlags = _this$options.showFlags, containerClass = _this$options.containerClass, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer, fixDropdownWidth = _this$options.fixDropdownWidth, useFullscreenPopup = _this$options.useFullscreenPopup, countrySearch = _this$options.countrySearch, i18n = _this$options.i18n; // containers (mostly for positioning) var parentClass = "iti"; if (allowDropdown) { parentClass += " iti--allow-dropdown"; } - if (separateDialCode) { - parentClass += " iti--separate-dial-code"; + if (showSelectedDialCode) { + parentClass += " iti--show-selected-dial-code"; } if (showFlags) { parentClass += " iti--show-flags"; } - if (customContainer) { - parentClass += " ".concat(customContainer); + if (containerClass) { + parentClass += " ".concat(containerClass); + } + if (!useFullscreenPopup) { + parentClass += " iti--inline-dropdown"; } var wrapper = this._createEl("div", { "class": parentClass }); this.telInput.parentNode.insertBefore(wrapper, this.telInput); - // only hide the flagsContainer if allowDropdown, showFlags and separateDialCode are all false - var showFlagsContainer = allowDropdown || showFlags || separateDialCode; - if (showFlagsContainer) { + // if we're showing flags or dial codes, we need the flags container etc + if (showFlags || showSelectedDialCode) { this.flagsContainer = this._createEl("div", { "class": "iti__flag-container" }, wrapper); - } - wrapper.appendChild(this.telInput); - // selected flag (displayed to left of input) - // using Aria tags for "Select-Only Combobox Example" - // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ - if (showFlagsContainer) { + // selected flag (displayed on left of input while allowDropdown is enabled, otherwise to right) + // when countrySearch disabled: using Aria tags for "Select-Only Combobox Example" + // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ this.selectedFlag = this._createEl("div", _objectSpread({ "class": "iti__selected-flag" - }, allowDropdown && { - role: "combobox", - "aria-haspopup": "listbox", - "aria-controls": "iti-".concat(this.id, "__country-listbox"), + }, allowDropdown && _objectSpread({ "aria-expanded": "false", - "aria-label": "Telephone country code" - }), this.flagsContainer); - } - if (showFlags) { - this.selectedFlagInner = this._createEl("div", { - "class": "iti__flag" - }, this.selectedFlag); + "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country", + "aria-haspopup": countrySearch ? "true" : "listbox", + "aria-controls": countrySearch ? "iti-".concat(this.id, "__dropdown-content") : "iti-".concat(this.id, "__country-listbox") + }, countrySearch || { + role: "combobox" + })), this.flagsContainer); + // we now include the selected flag element even when showFlags is disabled, + // as need to show globe icon for showSelectedDialCode empty state + this.selectedFlagInner = this._createEl("div", null, this.selectedFlag); + this.selectedFlagA11yText = this._createEl("span", { + "class": "iti__a11y-text" + }, this.selectedFlagInner); } + wrapper.appendChild(this.telInput); if (this.selectedFlag && this.telInput.disabled) { this.selectedFlag.setAttribute("aria-disabled", "true"); } - if (separateDialCode) { + if (showSelectedDialCode) { this.selectedDialCode = this._createEl("div", { "class": "iti__selected-dial-code" }, this.selectedFlag); @@ -476,79 +518,120 @@ this.selectedFlag.setAttribute("tabindex", "0"); } this.dropdownArrow = this._createEl("div", { - "class": "iti__arrow" + "class": "iti__arrow", + "aria-hidden": "true" }, this.selectedFlag); - // country dropdown: preferred countries, then divider, then all countries + var extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width"; + this.dropdownContent = this._createEl("div", { + id: "iti-".concat(this.id, "__dropdown-content"), + "class": "iti__dropdown-content iti__hide ".concat(extraClasses) + }); + if (countrySearch) { + this.searchInput = this._createEl("input", { + type: "text", + "class": "iti__search-input", + placeholder: i18n.searchPlaceholder || "Search", + role: "combobox", + "aria-expanded": "true", + "aria-label": i18n.searchPlaceholder || "Search", + "aria-controls": "iti-".concat(this.id, "__country-listbox"), + "aria-autocomplete": "list", + autocomplete: "off" + }, this.dropdownContent); + this.searchResultsA11yText = this._createEl("span", { + "class": "iti__a11y-text" + }, this.dropdownContent); + } + // country list: preferred countries, then divider, then all countries this.countryList = this._createEl("ul", { - "class": "iti__country-list iti__hide", + "class": "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", - "aria-label": "List of countries" - }); - if (this.preferredCountries.length) { + "aria-label": i18n.countryListAriaLabel || "List of countries" + }, this.dropdownContent); + if (this.preferredCountries.length && !countrySearch) { this._appendListItems(this.preferredCountries, "iti__preferred", true); this._createEl("li", { "class": "iti__divider", - role: "separator", - "aria-disabled": "true" + "aria-hidden": "true" }, this.countryList); } this._appendListItems(this.countries, "iti__standard"); + if (countrySearch) { + this._updateSearchResultsText(); + } // create dropdownContainer markup if (dropdownContainer) { + var dropdownClasses = "iti iti--container"; + if (useFullscreenPopup) { + dropdownClasses += " iti--fullscreen-popup"; + } else { + dropdownClasses += " iti--inline-dropdown"; + } + if (countrySearch) { + dropdownClasses += " iti--country-search"; + } this.dropdown = this._createEl("div", { - "class": "iti iti--container" + "class": dropdownClasses }); - this.dropdown.appendChild(this.countryList); + this.dropdown.appendChild(this.dropdownContent); } else { - this.flagsContainer.appendChild(this.countryList); + this.flagsContainer.appendChild(this.dropdownContent); } } if (hiddenInput) { - var hiddenInputName = hiddenInput; - var name = this.telInput.getAttribute("name"); - if (name) { - var i = name.lastIndexOf("["); - // if input name contains square brackets, then give the hidden input the same name, - // replacing the contents of the last set of brackets with the given hiddenInput name - if (i !== -1) { - hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]"); - } + var telInputName = this.telInput.getAttribute("name"); + var names = hiddenInput(telInputName); + if (names.phone) { + // Create hidden input for the full international number + this.hiddenInput = this._createEl("input", { + type: "hidden", + name: names.phone + }); + wrapper.appendChild(this.hiddenInput); + } + if (names.country) { + // Create hidden input for the selected country iso2 code + this.hiddenInputCountry = this._createEl("input", { + type: "hidden", + name: names.country + }); + wrapper.appendChild(this.hiddenInputCountry); } - this.hiddenInput = this._createEl("input", { - type: "hidden", - name: hiddenInputName - }); - wrapper.appendChild(this.hiddenInput); } } }, { key: "_appendListItems", value: function _appendListItems(countries, className, preferred) { - // we create so many DOM elements, it is faster to build a temp string - // and then add everything to the DOM in one go at the end - var tmp = ""; - // for each country for (var i = 0; i < countries.length; i++) { var c = countries[i]; var idSuffix = preferred ? "-preferred" : ""; - // open the list item - tmp += "
  • "); + var listItem = this._createEl("li", { + id: "iti-".concat(this.id, "__item-").concat(c.iso2).concat(idSuffix), + "class": "iti__country ".concat(className), + tabindex: "-1", + role: "option", + "data-dial-code": c.dialCode, + "data-country-code": c.iso2, + "aria-selected": "false" + }, this.countryList); + // store this for later use e.g. country search filtering + c.nodeById[this.id] = listItem; + var content = ""; // add the flag if (this.options.showFlags) { - tmp += "
    "); + content += "
    "); } // and the country name and dial code - tmp += "".concat(c.name, ""); - tmp += "+".concat(c.dialCode, ""); - // close the list item - tmp += "
  • "; + content += "".concat(c.name, ""); + content += "+".concat(c.dialCode, ""); + listItem.insertAdjacentHTML("beforeend", content); } - this.countryList.insertAdjacentHTML("beforeend", tmp); } }, { key: "_setInitialState", value: function _setInitialState() { + var overrideAutoCountry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; // fix firefox bug: when first load page (with input with value set to number with intl dial // code) and initialising plugin removes the dial code from the input, then refresh page, // and we try to init plugin again but this time on number without dial code so get grey flag @@ -558,31 +641,26 @@ var val = useAttribute ? attributeValue : inputValue; var dialCode = this._getDialCode(val); var isRegionlessNanp = this._isRegionlessNanp(val); - var _this$options2 = this.options, initialCountry = _this$options2.initialCountry, autoInsertDialCode = _this$options2.autoInsertDialCode; + var initialCountry = this.options.initialCountry; // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the // flag, else fall back to the default country if (dialCode && !isRegionlessNanp) { this._updateFlagFromNumber(val); - } else if (initialCountry !== "auto") { + } else if (initialCountry !== "auto" || overrideAutoCountry) { + var lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : ""; + var isValidInitialCountry = lowerInitialCountry && this._getCountryData(lowerInitialCountry, true); // see if we should select a flag - if (initialCountry) { - this._setFlag(initialCountry.toLowerCase()); + if (isValidInitialCountry) { + this._setCountry(lowerInitialCountry); } else { if (dialCode && isRegionlessNanp) { // has intl dial code, is regionless nanp, and no initialCountry, so default to US - this._setFlag("us"); + this._setCountry("us"); } else { - // no dial code and no initialCountry, so default to first in list - this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2; - if (!val) { - this._setFlag(this.defaultCountry); - } + // display the empty state (globe icon) + this._setCountry(); } } - // if empty and autoInsertDialCode then insert the dial code - if (!val && autoInsertDialCode) { - this.telInput.value = "+".concat(this.selectedCountryData.dialCode); - } } // NOTE: if initialCountry is set to auto, that will be handled separately // format - note this wont be run after _updateDialCode as that's only called if no val @@ -594,52 +672,43 @@ key: "_initListeners", value: function _initListeners() { this._initKeyListeners(); - if (this.options.autoInsertDialCode) { - this._initBlurListeners(); - } if (this.options.allowDropdown) { this._initDropdownListeners(); } - if (this.hiddenInput) { + if ((this.hiddenInput || this.hiddenInputCountry) && this.telInput.form) { this._initHiddenInputListener(); } } }, { key: "_initHiddenInputListener", value: function _initHiddenInputListener() { - var _this3 = this; + var _this2 = this; this._handleHiddenInputSubmit = function() { - _this3.hiddenInput.value = _this3.getNumber(); + if (_this2.hiddenInput) { + _this2.hiddenInput.value = _this2.getNumber(); + } + if (_this2.hiddenInputCountry) { + _this2.hiddenInputCountry.value = _this2.getSelectedCountryData().iso2; + } }; - if (this.telInput.form) { - this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit); - } - } - }, { - key: "_getClosestLabel", - value: function _getClosestLabel() { - var el = this.telInput; - while (el && el.tagName !== "LABEL") { - el = el.parentNode; - } - return el; + this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit); } }, { key: "_initDropdownListeners", value: function _initDropdownListeners() { - var _this4 = this; + var _this3 = this; // hack for input nested inside label (which is valid markup): clicking the selected-flag to // open the dropdown would then automatically trigger a 2nd click on the input which would // close it again this._handleLabelClick = function(e) { // if the dropdown is closed, then focus the input, else ignore the click - if (_this4.countryList.classList.contains("iti__hide")) { - _this4.telInput.focus(); + if (_this3.dropdownContent.classList.contains("iti__hide")) { + _this3.telInput.focus(); } else { e.preventDefault(); } }; - var label = this._getClosestLabel(); + var label = this.telInput.closest("label"); if (label) { label.addEventListener("click", this._handleLabelClick); } @@ -648,24 +717,24 @@ // only intercept this event if we're opening the dropdown // else let it bubble up to the top ("click-off-to-close" listener) // we cannot just stopPropagation as it may be needed to close another instance - if (_this4.countryList.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) { - _this4._showDropdown(); + if (_this3.dropdownContent.classList.contains("iti__hide") && !_this3.telInput.disabled && !_this3.telInput.readOnly) { + _this3._openDropdown(); } }; this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag); - // open dropdown list if currently focused + // open dropdown if selected flag is focused and they press up/down/space/enter this._handleFlagsContainerKeydown = function(e) { - var isDropdownHidden = _this4.countryList.classList.contains("iti__hide"); - if (isDropdownHidden && [ "ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter" ].indexOf(e.key) !== -1) { + var isDropdownHidden = _this3.dropdownContent.classList.contains("iti__hide"); + if (isDropdownHidden && [ "ArrowUp", "ArrowDown", " ", "Enter" ].includes(e.key)) { // prevent form from being submitted if "ENTER" was pressed e.preventDefault(); // prevent event from being handled again by document e.stopPropagation(); - _this4._showDropdown(); + _this3._openDropdown(); } // allow navigation from dropdown to input on TAB if (e.key === "Tab") { - _this4._closeDropdown(); + _this3._closeDropdown(); } }; this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown); @@ -673,7 +742,7 @@ }, { key: "_initRequests", value: function _initRequests() { - var _this5 = this; + var _this4 = this; // if the user has specified the path to the utils script, fetch it on window.load, else resolve if (this.options.utilsScript && !window.intlTelInputUtils) { // if the plugin is being initialised after the window.load event has already been fired @@ -682,13 +751,14 @@ } else { // wait until the load event so we don't block any other requests e.g. the flags image window.addEventListener("load", function() { - window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript); + window.intlTelInputGlobals.loadUtils(_this4.options.utilsScript); }); } } else { this.resolveUtilsScriptPromise(); } - if (this.options.initialCountry === "auto") { + // dont bother with IP lookup if we already have a selected country + if (this.options.initialCountry === "auto" && !this.selectedCountryData.iso2) { this._loadAutoCountry(); } else { this.resolveAutoCountryPromise(); @@ -697,6 +767,7 @@ }, { key: "_loadAutoCountry", value: function _loadAutoCountry() { + var _this5 = this; // 3 options: // 1) already loaded (we're done) // 2) not already started loading (start) @@ -707,17 +778,25 @@ // don't do this twice! window.intlTelInputGlobals.startedLoadingAutoCountry = true; if (typeof this.options.geoIpLookup === "function") { - this.options.geoIpLookup(function(countryCode) { - window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase(); - // tell all instances the auto country is ready - // TODO: this should just be the current instances - // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight - // away (e.g. if they have already done the geo ip lookup somewhere else). Using - // setTimeout means that the current thread of execution will finish before executing - // this, which allows the plugin to finish initialising. - setTimeout(function() { - return forEachInstance("handleAutoCountry"); - }); + this.options.geoIpLookup(function() { + var iso2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + var iso2Lower = iso2.toLowerCase(); + var isValidIso2 = iso2Lower && _this5._getCountryData(iso2Lower, true); + if (isValidIso2) { + window.intlTelInputGlobals.autoCountry = iso2Lower; + // tell all instances the auto country is ready + // TODO: this should just be the current instances + // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight + // away (e.g. if they have already done the geo ip lookup somewhere else). Using + // setTimeout means that the current thread of execution will finish before executing + // this, which allows the plugin to finish initialising. + setTimeout(function() { + return forEachInstance("handleAutoCountry"); + }); + } else { + _this5._setInitialState(true); + forEachInstance("rejectAutoCountryPromise"); + } }, function() { return forEachInstance("rejectAutoCountryPromise"); }); @@ -728,20 +807,63 @@ key: "_initKeyListeners", value: function _initKeyListeners() { var _this6 = this; - // update flag on keyup - this._handleKeyupEvent = function() { + var userOverrideFormatting = false; + // update flag on input event + this._handleKeyEvent = function(e) { if (_this6._updateFlagFromNumber(_this6.telInput.value)) { _this6._triggerCountryChange(); } + // if user types their own formatting char (not a plus or a numeric), then set the override + var isFormattingChar = e && e.data && /[^+0-9]/.test(e.data); + var isPaste = e && e.inputType === "insertFromPaste" && _this6.telInput.value; + if (isFormattingChar || isPaste) { + userOverrideFormatting = true; + } else if (!/[^+0-9]/.test(_this6.telInput.value)) { + userOverrideFormatting = false; + } + // handle FAYT, unless userOverrideFormatting or it's a paste event + if (_this6.options.formatAsYouType && !userOverrideFormatting && !isPaste) { + // maintain caret position after reformatting + var currentCaretPos = _this6.telInput.selectionStart; + var valueBeforeCaret = _this6.telInput.value.substring(0, currentCaretPos); + var relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length; + var isDeleteForwards = e && e.inputType === "deleteContentForward"; + var formattedValue = _this6._formatNumberAsYouType(); + var newCaretPos = _this6._translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards); + _this6.telInput.value = formattedValue; + _this6.telInput.setSelectionRange(newCaretPos, newCaretPos); + } }; - this.telInput.addEventListener("keyup", this._handleKeyupEvent); - // update flag on cut/paste events (now supported in all major browsers) - this._handleClipboardEvent = function() { - // hack because "paste" event is fired before input is updated - setTimeout(_this6._handleKeyupEvent); - }; - this.telInput.addEventListener("cut", this._handleClipboardEvent); - this.telInput.addEventListener("paste", this._handleClipboardEvent); + // this handles individual key presses as well as cut/paste events + // the advantage of the "input" event over "keyup" etc is that "input" only fires when the value changes, + // whereas "keyup" fires even for arrow key presses etc + this.telInput.addEventListener("input", this._handleKeyEvent); + } + }, { + key: "_translateCursorPosition", + value: function _translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) { + // if the first char is a formatting char, and they backspace delete it: + // cursor should stay at the start (pos 0), rather than stick to the first digit (pos 1) + if (prevCaretPos === 0 && !isDeleteForwards) { + return 0; + } + var count = 0; + for (var i = 0; i < formattedValue.length; i++) { + if (/[+0-9]/.test(formattedValue[i])) { + count++; + } + // normal case: stop when you hit the right number of relevant chars + // (cursor will be just after the final relevant char) + if (count === relevantChars && !isDeleteForwards) { + return i + 1; + } + // spacial case: delete forwards (fn + delete on a mac): + // wait until hit one extra relevant char, and put the cursor just before it (after any formatting chars) + if (isDeleteForwards && count === relevantChars + 1) { + return i; + } + } + return formattedValue.length; } }, { key: "_cap", @@ -749,19 +871,6 @@ var max = this.telInput.getAttribute("maxlength"); return max && number.length > max ? number.substr(0, max) : number; } - }, { - key: "_initBlurListeners", - value: function _initBlurListeners() { - var _this7 = this; - // on blur or form submit: if just a dial code then remove it - this._handleSubmitOrBlurEvent = function() { - _this7._removeEmptyDialCode(); - }; - if (this.telInput.form) { - this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent); - } - this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent); - } }, { key: "_removeEmptyDialCode", value: function _removeEmptyDialCode() { @@ -781,22 +890,38 @@ }, { key: "_trigger", value: function _trigger(name) { - // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax - var e = document.createEvent("Event"); - e.initEvent(name, true, true); - // can bubble, and is cancellable + var e = new Event(name, { + bubbles: true, + cancelable: true + }); this.telInput.dispatchEvent(e); } }, { - key: "_showDropdown", - value: function _showDropdown() { - this.countryList.classList.remove("iti__hide"); + key: "_openDropdown", + value: function _openDropdown() { + var _this$options2 = this.options, fixDropdownWidth = _this$options2.fixDropdownWidth, countrySearch = _this$options2.countrySearch; + if (fixDropdownWidth) { + this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px"); + } + this.dropdownContent.classList.remove("iti__hide"); this.selectedFlag.setAttribute("aria-expanded", "true"); this._setDropdownPosition(); - // update highlighting and scroll to active list item - if (this.activeItem) { + // if we have previously selected a country (and countrySearch is disabled), then highlight that item and scroll to it + // else highlight the first item and scroll to top (even if countrySearch is disabled e.g. on init, showing globe icon) + if (this.activeItem && !countrySearch) { + // update highlighting and scroll to active list item this._highlightListItem(this.activeItem, false); this._scrollTo(this.activeItem, true); + } else { + // start by highlighting the first item in the list + var firstElementChild = this.countryList.firstElementChild; + if (firstElementChild) { + this._highlightListItem(firstElementChild, false); + this.countryList.scrollTop = 0; + } + if (countrySearch) { + this.searchInput.focus(); + } } // bind all the dropdown-related listeners: mouseover, click, click-off, keydown this._bindDropdownListeners(); @@ -816,67 +941,58 @@ }, { key: "_setDropdownPosition", value: function _setDropdownPosition() { - var _this8 = this; + var _this7 = this; if (this.options.dropdownContainer) { this.options.dropdownContainer.appendChild(this.dropdown); } - if (!this.isMobile) { + if (!this.options.useFullscreenPopup) { var pos = this.telInput.getBoundingClientRect(); // windowTop from https://stackoverflow.com/a/14384091/217866 - var windowTop = window.pageYOffset || document.documentElement.scrollTop; + var windowTop = document.documentElement.scrollTop; var inputTop = pos.top + windowTop; - var dropdownHeight = this.countryList.offsetHeight; + var dropdownHeight = this.dropdownContent.offsetHeight; // dropdownFitsBelow = (dropdownBottom < windowBottom) var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight; var dropdownFitsAbove = inputTop - dropdownHeight > windowTop; + // dont allow positioning above when country search enabled as the search box jumps around as you filter countries + var positionDropdownAboveInput = !this.options.countrySearch && !dropdownFitsBelow && dropdownFitsAbove; // by default, the dropdown will be below the input. If we want to position it above the // input, we add the dropup class. - this._toggleClass(this.countryList, "iti__country-list--dropup", !dropdownFitsBelow && dropdownFitsAbove); + this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", positionDropdownAboveInput); // if dropdownContainer is enabled, calculate postion if (this.options.dropdownContainer) { - // by default the dropdown will be directly over the input because it's not in the flow. - // If we want to position it below, we need to add some extra top value. - var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight; + // if we want to position the dropdown below the input, we need to add the input height to the top value + var extraTop = positionDropdownAboveInput ? 0 : this.telInput.offsetHeight; // calculate placement this.dropdown.style.top = "".concat(inputTop + extraTop, "px"); this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px"); // close menu on window scroll this._handleWindowScroll = function() { - return _this8._closeDropdown(); + return _this7._closeDropdown(); }; window.addEventListener("scroll", this._handleWindowScroll); } } } - }, { - key: "_getClosestListItem", - value: function _getClosestListItem(target) { - var el = target; - while (el && el !== this.countryList && !el.classList.contains("iti__country")) { - el = el.parentNode; - } - // if we reached the countryList element, then return null - return el === this.countryList ? null : el; - } }, { key: "_bindDropdownListeners", value: function _bindDropdownListeners() { - var _this9 = this; + var _this8 = this; // when mouse over a list item, just highlight that one // we add the class "highlight", so if they hit "enter" we know which one to select this._handleMouseoverCountryList = function(e) { // handle event delegation, as we're listening for this event on the countryList - var listItem = _this9._getClosestListItem(e.target); + var listItem = e.target.closest(".iti__country"); if (listItem) { - _this9._highlightListItem(listItem, false); + _this8._highlightListItem(listItem, false); } }; this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList); // listen for country selection this._handleClickCountryList = function(e) { - var listItem = _this9._getClosestListItem(e.target); + var listItem = e.target.closest(".iti__country"); if (listItem) { - _this9._selectListItem(listItem); + _this8._selectListItem(listItem); } }; this.countryList.addEventListener("click", this._handleClickCountryList); @@ -886,12 +1002,12 @@ var isOpening = true; this._handleClickOffToClose = function() { if (!isOpening) { - _this9._closeDropdown(); + _this8._closeDropdown(); } isOpening = false; }; document.documentElement.addEventListener("click", this._handleClickOffToClose); - // listen for up/down scrolling, enter to select, or letters to jump to country name. + // listen for up/down scrolling, enter to select, or escape to close // use keydown as keypress doesn't fire for non-char keys and we want to catch if they // just hit down and hold it to scroll down (no keyup event). // listen on the document because that's where key events are triggered if no input has focus @@ -900,21 +1016,28 @@ this._handleKeydownOnDropdown = function(e) { // prevent down key from scrolling the whole page, // and enter key from submitting a form etc - e.preventDefault(); - // up and down to navigate - if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") { - _this9._handleUpDownKey(e.key); - } else if (e.key === "Enter") { - _this9._handleEnterKey(); - } else if (e.key === "Escape") { - _this9._closeDropdown(); - } else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) { + if ([ "ArrowUp", "ArrowDown", "Enter", "Escape" ].includes(e.key)) { + e.preventDefault(); + e.stopPropagation(); + // up and down to navigate + if (e.key === "ArrowUp" || e.key === "ArrowDown") { + _this8._handleUpDownKey(e.key); + } else if (e.key === "Enter") { + _this8._handleEnterKey(); + } else if (e.key === "Escape") { + _this8._closeDropdown(); + } + } + // alpha chars to perform search + // regex allows one latin alpha char or space, based on https://stackoverflow.com/a/26900132/217866) + if (!_this8.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) { + e.stopPropagation(); // jump to countries that start with the query string if (queryTimer) { clearTimeout(queryTimer); } query += e.key.toLowerCase(); - _this9._searchForCountry(query); + _this8._searchForCountry(query); // if the timer hits 1 second, reset the query queryTimer = setTimeout(function() { query = ""; @@ -922,17 +1045,99 @@ } }; document.addEventListener("keydown", this._handleKeydownOnDropdown); + if (this.options.countrySearch) { + var doFilter = function doFilter() { + var inputQuery = _this8.searchInput.value.trim(); + if (inputQuery) { + _this8._filterCountries(inputQuery); + } else { + _this8._filterCountries("", true); + } + }; + var keyupTimer = null; + this._handleSearchChange = function() { + // filtering country nodes is expensive (lots of DOM manipulation), so rate limit it + if (keyupTimer) { + clearTimeout(keyupTimer); + } + keyupTimer = setTimeout(function() { + doFilter(); + keyupTimer = null; + }, 100); + }; + this.searchInput.addEventListener("input", this._handleSearchChange); + // stop propagation on search input click, so doesn't trigger click-off-to-close listener + this.searchInput.addEventListener("click", function(e) { + return e.stopPropagation(); + }); + } + } + }, { + key: "_normaliseString", + value: function _normaliseString() { + var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; + return s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(); + } + }, { + key: "_filterCountries", + value: function _filterCountries(query) { + var isReset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var isFirst = true; + this.countryList.innerHTML = ""; + var normalisedQuery = this._normaliseString(query); + for (var i = 0; i < this.countries.length; i++) { + var c = this.countries[i]; + var normalisedCountryName = this._normaliseString(c.name); + var fullDialCode = "+".concat(c.dialCode); + if (isReset || normalisedCountryName.includes(normalisedQuery) || fullDialCode.includes(normalisedQuery) || c.iso2.includes(normalisedQuery)) { + this.countryList.appendChild(c.nodeById[this.id]); + // highlight the first item + if (isFirst) { + this._highlightListItem(c.nodeById[this.id], false); + isFirst = false; + } + } + } + // scroll to top (useful if user had previously scrolled down) + this.countryList.scrollTop = 0; + this._updateSearchResultsText(); + } + }, { + key: "_updateSearchResultsText", + value: function _updateSearchResultsText() { + var i18n = this.options.i18n; + var count = this.countryList.childElementCount; + var searchText; + if (count === 0) { + searchText = i18n.zeroSearchResults || "No results found"; + } else if (count === 1) { + searchText = i18n.oneSearchResult || "1 result found"; + } else { + // eslint-disable-next-line no-template-curly-in-string + searchText = i18n.multipleSearchResults ? i18n.multipleSearchResults.replace("${count}", count) : "".concat(count, " results found"); + } + this.searchResultsA11yText.textContent = searchText; } }, { key: "_handleUpDownKey", value: function _handleUpDownKey(key) { - var next = key === "ArrowUp" || key === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling; + var next = key === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling; if (next) { // skip the divider if (next.classList.contains("iti__divider")) { - next = key === "ArrowUp" || key === "Up" ? next.previousElementSibling : next.nextElementSibling; + next = key === "ArrowUp" ? next.previousElementSibling : next.nextElementSibling; } - this._highlightListItem(next, true); + } else if (this.countryList.childElementCount > 1) { + // otherwise, we must be at the end, so loop round again + next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild; + } + if (next) { + // make sure the next item is visible + // (before calling focus(), which can cause the next item to scroll to the middle of the dropdown, which is jarring) + this._scrollTo(next, false); + // if country search enabled, dont lose focus from the search input on up/down + var doFocus = !this.options.countrySearch; + this._highlightListItem(next, doFocus); } } }, { @@ -947,7 +1152,7 @@ value: function _searchForCountry(query) { for (var i = 0; i < this.countries.length; i++) { if (this._startsWith(this.countries[i].name, query)) { - var listItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[i].iso2)); + var listItem = this.countries[i].nodeById[this.id]; // update highlighting and scroll this._highlightListItem(listItem, false); this._scrollTo(listItem, true); @@ -962,10 +1167,10 @@ } }, { key: "_updateValFromNumber", - value: function _updateValFromNumber(originalNumber) { - var number = originalNumber; + value: function _updateValFromNumber(fullNumber) { + var number = fullNumber; if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) { - var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.separateDialCode; + var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.showSelectedDialCode; var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL; var format = useNational ? NATIONAL : INTERNATIONAL; number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format); @@ -975,13 +1180,17 @@ } }, { key: "_updateFlagFromNumber", - value: function _updateFlagFromNumber(originalNumber) { + value: function _updateFlagFromNumber(fullNumber) { + var plusIndex = fullNumber.indexOf("+"); + // if it contains a plus, discard any chars before it e.g. accidental space char. + // this keeps the selected country auto-updating correctly, which we want as + // libphonenumber's validation/getNumber methods will ignore these chars anyway + var number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber; // if we already have US/Canada selected, make sure the number starts // with a +1 so _getDialCode will be able to extract the area code // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag // from the number), that means we're initialising the plugin with a number that already has a // dial code, so fine to ignore this bit - var number = originalNumber; var selectedDialCode = this.selectedCountryData.dialCode; var isNanp = selectedDialCode === "1"; if (number && isNanp && number.charAt(0) !== "+") { @@ -990,32 +1199,32 @@ } number = "+".concat(number); } - // if separateDialCode enabled, then consider the selected dial code to be part of the number - if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") { + // if showSelectedDialCode enabled, then consider the selected dial code to be part of the number + if (this.options.showSelectedDialCode && selectedDialCode && number.charAt(0) !== "+") { number = "+".concat(selectedDialCode).concat(number); } // try and extract valid dial code from input var dialCode = this._getDialCode(number, true); var numeric = this._getNumeric(number); - var countryCode = null; + var iso2 = null; if (dialCode) { - var countryCodes = this.countryCodes[this._getNumeric(dialCode)]; + var iso2Codes = this.dialCodeToIso2Map[this._getNumeric(dialCode)]; // check if the right country is already selected. this should be false if the number is // longer than the matched dial code because in this case we need to make sure that if // there are multiple country matches, that the first one is selected (note: we could // just check that here, but it requires the same loop that we already have later) - var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1; + var alreadySelected = iso2Codes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1; var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric); // only update the flag if: // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp) // AND // B) the right country is not already selected if (!isRegionlessNanpNumber && !alreadySelected) { - // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first + // if using onlyCountries option, iso2Codes[0] may be empty, so we must find the first // non-empty index - for (var j = 0; j < countryCodes.length; j++) { - if (countryCodes[j]) { - countryCode = countryCodes[j]; + for (var j = 0; j < iso2Codes.length; j++) { + if (iso2Codes[j]) { + iso2 = iso2Codes[j]; break; } } @@ -1024,13 +1233,13 @@ // invalid dial code, so empty // Note: use getNumeric here because the number has not been formatted yet, so could contain // bad chars - countryCode = ""; - } else if (!number || number === "+") { - // empty, or just a plus, so default - countryCode = this.defaultCountry; + iso2 = ""; + } else if ((!number || number === "+") && !this.selectedCountryData.iso2) { + // if no selected flag, and user either clears the input, or just types a plus, then show default + iso2 = this.defaultCountry; } - if (countryCode !== null) { - return this._setFlag(countryCode); + if (iso2 !== null) { + return this._setCountry(iso2); } return false; } @@ -1050,44 +1259,62 @@ var prevItem = this.highlightedItem; if (prevItem) { prevItem.classList.remove("iti__highlight"); + prevItem.setAttribute("aria-selected", "false"); } this.highlightedItem = listItem; this.highlightedItem.classList.add("iti__highlight"); + this.highlightedItem.setAttribute("aria-selected", "true"); this.selectedFlag.setAttribute("aria-activedescendant", listItem.getAttribute("id")); + if (this.options.countrySearch) { + this.searchInput.setAttribute("aria-activedescendant", listItem.getAttribute("id")); + } if (shouldFocus) { this.highlightedItem.focus(); } } }, { key: "_getCountryData", - value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) { - var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries; - for (var i = 0; i < countryList.length; i++) { - if (countryList[i].iso2 === countryCode) { - return countryList[i]; + value: function _getCountryData(iso2, allowFail) { + for (var i = 0; i < this.countries.length; i++) { + if (this.countries[i].iso2 === iso2) { + return this.countries[i]; } } if (allowFail) { return null; } - throw new Error("No country data for '".concat(countryCode, "'")); + throw new Error("No country data for '".concat(iso2, "'")); } }, { - key: "_setFlag", - value: function _setFlag(countryCode) { - var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags; + key: "_setCountry", + value: function _setCountry(iso2) { + var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, showSelectedDialCode = _this$options3.showSelectedDialCode, showFlags = _this$options3.showFlags, countrySearch = _this$options3.countrySearch, i18n = _this$options3.i18n; var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {}; - // do this first as it will throw an error and stop if countryCode is invalid - this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {}; + // do this first as it will throw an error and stop if iso2 is invalid + this.selectedCountryData = iso2 ? this._getCountryData(iso2, false) : {}; // update the defaultCountry - we only need the iso2 from now on, so just store that if (this.selectedCountryData.iso2) { this.defaultCountry = this.selectedCountryData.iso2; } - if (showFlags) { - this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode)); + // update the flag class and the a11y text + if (this.selectedFlagInner) { + var flagClass = ""; + var a11yText = ""; + if (iso2) { + if (showFlags) { + flagClass = "iti__flag iti__".concat(iso2); + a11yText = "".concat(this.selectedCountryData.name, " +").concat(this.selectedCountryData.dialCode); + } + } else { + flagClass = "iti__flag iti__globe"; + a11yText = i18n.noCountrySelected || "No country selected"; + } + this.selectedFlagInner.className = flagClass; + this.selectedFlagA11yText.textContent = a11yText; } - this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode); - if (separateDialCode) { + this._setSelectedCountryFlagTitleAttribute(iso2, showSelectedDialCode); + // update the selected dial code + if (showSelectedDialCode) { var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : ""; this.selectedDialCode.innerHTML = dialCode; // offsetWidth is zero if input is in a hidden container during initialisation @@ -1101,34 +1328,34 @@ } // and the input's placeholder this._updatePlaceholder(); - // update the active list item - if (allowDropdown) { + // update the active list item (only if country search disabled, as country search doesn't store the active item) + if (allowDropdown && !countrySearch) { var prevItem = this.activeItem; if (prevItem) { prevItem.classList.remove("iti__active"); prevItem.setAttribute("aria-selected", "false"); } - if (countryCode) { + if (iso2) { // check if there is a preferred item first, else fall back to standard - var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode)); + var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(iso2, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(iso2)); nextItem.setAttribute("aria-selected", "true"); nextItem.classList.add("iti__active"); this.activeItem = nextItem; } } // return if the flag has changed or not - return prevCountry.iso2 !== countryCode; + return prevCountry.iso2 !== iso2; } }, { key: "_setSelectedCountryFlagTitleAttribute", - value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) { + value: function _setSelectedCountryFlagTitleAttribute(iso2, showSelectedDialCode) { if (!this.selectedFlag) { return; } var title; - if (countryCode && !separateDialCode) { + if (iso2 && !showSelectedDialCode) { title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode); - } else if (countryCode) { + } else if (iso2) { // For screen reader output, we don't want to include the dial code in the reader output twice // so just use the selected country name here: title = this.selectedCountryData.name; @@ -1156,13 +1383,14 @@ }, { key: "_updatePlaceholder", value: function _updatePlaceholder() { - var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite"; + var _this$options4 = this.options, autoPlaceholder = _this$options4.autoPlaceholder, placeholderNumberType = _this$options4.placeholderNumberType, nationalMode = _this$options4.nationalMode, customPlaceholder = _this$options4.customPlaceholder; + var shouldSetPlaceholder = autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && autoPlaceholder === "polite"; if (window.intlTelInputUtils && shouldSetPlaceholder) { - var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType]; - var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : ""; + var numberType = intlTelInputUtils.numberType[placeholderNumberType]; + var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, nationalMode, numberType) : ""; placeholder = this._beforeSetNumber(placeholder); - if (typeof this.options.customPlaceholder === "function") { - placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData); + if (typeof customPlaceholder === "function") { + placeholder = customPlaceholder(placeholder, this.selectedCountryData); } this.telInput.setAttribute("placeholder", placeholder); } @@ -1171,15 +1399,11 @@ key: "_selectListItem", value: function _selectListItem(listItem) { // update selected flag and active list item - var flagChanged = this._setFlag(listItem.getAttribute("data-country-code")); + var flagChanged = this._setCountry(listItem.getAttribute("data-country-code")); this._closeDropdown(); this._updateDialCode(listItem.getAttribute("data-dial-code")); // focus the input this.telInput.focus(); - // put cursor at end - this fix is required for FF and IE11 (with auto inserting dial code), - // who try to put the cursor at the beginning the first time - var len = this.telInput.value.length; - this.telInput.setSelectionRange(len, len); if (flagChanged) { this._triggerCountryChange(); } @@ -1187,19 +1411,28 @@ }, { key: "_closeDropdown", value: function _closeDropdown() { - this.countryList.classList.add("iti__hide"); + this.dropdownContent.classList.add("iti__hide"); this.selectedFlag.setAttribute("aria-expanded", "false"); this.selectedFlag.removeAttribute("aria-activedescendant"); + if (this.highlightedItem) { + this.highlightedItem.setAttribute("aria-selected", "false"); + } + if (this.options.countrySearch) { + this.searchInput.removeAttribute("aria-activedescendant"); + } // update the arrow this.dropdownArrow.classList.remove("iti__arrow--up"); // unbind key events document.removeEventListener("keydown", this._handleKeydownOnDropdown); + if (this.options.countrySearch) { + this.searchInput.removeEventListener("input", this._handleSearchChange); + } document.documentElement.removeEventListener("click", this._handleClickOffToClose); this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList); this.countryList.removeEventListener("click", this._handleClickCountryList); // remove menu from container if (this.options.dropdownContainer) { - if (!this.isMobile) { + if (!this.options.useFullscreenPopup) { window.removeEventListener("scroll", this._handleWindowScroll); } if (this.dropdown.parentNode) { @@ -1213,7 +1446,7 @@ value: function _scrollTo(element, middle) { var container = this.countryList; // windowTop from https://stackoverflow.com/a/14384091/217866 - var windowTop = window.pageYOffset || document.documentElement.scrollTop; + var windowTop = document.documentElement.scrollTop; var containerHeight = container.offsetHeight; var containerTop = container.getBoundingClientRect().top + windowTop; var containerBottom = containerTop + containerHeight; @@ -1256,14 +1489,6 @@ newNumber = newDialCode; } this.telInput.value = newNumber; - } else if (this.options.autoInsertDialCode) { - if (inputVal) { - // there is an existing value with no dial code: prefix the new dial code - newNumber = newDialCode + inputVal; - } else { - newNumber = newDialCode; - } - this.telInput.value = newNumber; } } }, { @@ -1281,7 +1506,7 @@ numericChars += c; // if current numericChars make a valid dial code if (includeAreaCode) { - if (this.countryCodes[numericChars]) { + if (this.dialCodeToIso2Map[numericChars]) { // store the actual raw string (useful for matching later) dialCode = number.substr(0, i + 1); } @@ -1293,7 +1518,7 @@ } } // stop searching as soon as we can - in this case when we hit max len - if (numericChars.length === this.countryCodeMaxLen) { + if (numericChars.length === this.dialCodeMaxLen) { break; } } @@ -1308,8 +1533,8 @@ var dialCode = this.selectedCountryData.dialCode; var prefix; var numericVal = this._getNumeric(val); - if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) { - // when using separateDialCode, it is visible so is effectively part of the typed number + if (this.options.showSelectedDialCode && !this.options.nationalMode && val.charAt(0) !== "+" && dialCode && numericVal) { + // when using showSelectedDialCode, it is visible so is effectively part of the typed number prefix = "+".concat(dialCode); } else { prefix = ""; @@ -1318,9 +1543,9 @@ } }, { key: "_beforeSetNumber", - value: function _beforeSetNumber(originalNumber) { - var number = originalNumber; - if (this.options.separateDialCode) { + value: function _beforeSetNumber(fullNumber) { + var number = fullNumber; + if (this.options.showSelectedDialCode) { var dialCode = this._getDialCode(number); // if there is a valid dial code if (dialCode) { @@ -1341,6 +1566,19 @@ value: function _triggerCountryChange() { this._trigger("countrychange"); } + }, { + key: "_formatNumberAsYouType", + value: function _formatNumberAsYouType() { + var val = this._getFullNumber(); + var result = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val; + // if showSelectedDialCode and they haven't (re)typed the dial code in the input as well, then remove the dial code + var dialCode = this.selectedCountryData.dialCode; + if (this.options.showSelectedDialCode && !this.options.nationalMode && this.telInput.value.charAt(0) !== "+" && result.includes("+".concat(dialCode))) { + var afterDialCode = result.split("+".concat(dialCode))[1] || ""; + return afterDialCode.trim(); + } + return result; + } }, { key: "handleAutoCountry", value: function handleAutoCountry() { @@ -1364,38 +1602,33 @@ if (this.telInput.value) { this._updateValFromNumber(this.telInput.value); } - this._updatePlaceholder(); + if (this.selectedCountryData.iso2) { + this._updatePlaceholder(); + } } this.resolveUtilsScriptPromise(); } }, { key: "destroy", value: function destroy() { - var form = this.telInput.form; if (this.options.allowDropdown) { // make sure the dropdown is closed (and unbind listeners) this._closeDropdown(); this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag); this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown); // label click hack - var label = this._getClosestLabel(); + var label = this.telInput.closest("label"); if (label) { label.removeEventListener("click", this._handleLabelClick); } } // unbind hiddenInput listeners - if (this.hiddenInput && form) { + var form = this.telInput.form; + if (this._handleHiddenInputSubmit && form) { form.removeEventListener("submit", this._handleHiddenInputSubmit); } - // unbind autoInsertDialCode listeners - if (this.options.autoInsertDialCode) { - if (form) { - form.removeEventListener("submit", this._handleSubmitOrBlurEvent); - } - this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent); - } // unbind key events, and cut/paste events - this.telInput.removeEventListener("keyup", this._handleKeyupEvent); + this.telInput.removeEventListener("input", this._handleKeyEvent); this.telInput.removeEventListener("cut", this._handleClipboardEvent); this.telInput.removeEventListener("paste", this._handleClipboardEvent); // remove attribute of id instance: data-intl-tel-input-id @@ -1448,22 +1681,31 @@ }, { key: "isValidNumber", value: function isValidNumber() { - var val = this._getFullNumber().trim(); - return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null; + var mobileOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + var val = this._getFullNumber(); + // return false for any alpha chars + if (/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/.test(val)) { + return false; + } + return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2, mobileOnly) : null; } }, { - key: "isPossibleNumber", - value: function isPossibleNumber() { - var val = this._getFullNumber().trim(); - return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null; + key: "isValidNumberPrecise", + value: function isValidNumberPrecise() { + var val = this._getFullNumber(); + // return false for any alpha chars + if (/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/.test(val)) { + return false; + } + return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null; } }, { key: "setCountry", - value: function setCountry(originalCountryCode) { - var countryCode = originalCountryCode.toLowerCase(); + value: function setCountry(iso2) { + var iso2Lower = iso2.toLowerCase(); // check if already selected - if (this.selectedCountryData.iso2 !== countryCode) { - this._setFlag(countryCode); + if (this.selectedCountryData.iso2 !== iso2Lower) { + this._setCountry(iso2Lower); this._updateDialCode(this.selectedCountryData.dialCode); this._triggerCountryChange(); } @@ -1525,20 +1767,16 @@ if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) { // only do this once window.intlTelInputGlobals.startedLoadingUtilsScript = true; - // if we have promises, then return a promise - if (typeof Promise !== "undefined") { - return new Promise(function(resolve, reject) { - return injectScript(path, resolve, reject); - }); - } - injectScript(path); + return new Promise(function(resolve, reject) { + return injectScript(path, resolve, reject); + }); } return null; }; // default options intlTelInputGlobals.defaults = defaults; // version - intlTelInputGlobals.version = "18.2.1"; + intlTelInputGlobals.version = "20.0.3"; // convenience wrapper return function(input, options) { var iti = new Iti(input, options); diff --git a/public/assets/build/js/intlTelInput.min.js b/public/assets/build/js/intlTelInput.min.js index e028a6e..2283454 100644 --- a/public/assets/build/js/intlTelInput.min.js +++ b/public/assets/build/js/intlTelInput.min.js @@ -1,8 +1,8 @@ /* - * International Telephone Input v18.2.1 + * International Telephone Input v20.0.3 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ -!function(a){"object"==typeof module&&module.exports?module.exports=a():window.intlTelInput=a()}(function(a){"use strict";return function(){function b(a){for(var b=1;bthis.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=i.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=i}},{key:"_d0",value:function(){for(var a=0;ab.name?1:0}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a"),this.d.showFlags&&(d+="
    ")),d+="".concat(f.name,""),d+="+".concat(f.dialCode,""),d+=""}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.getAttribute("value"),b=this.a.value,c=a&&"+"===a.charAt(0)&&(!b||"+"!==b.charAt(0)),d=c?a:b,e=this._5(d),f=this._w(d),g=this.d,h=g.initialCountry,i=g.autoInsertDialCode;e&&!f?this._v(d):"auto"!==h&&(h?this._z(h.toLowerCase()):e&&f?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,d||this._z(this.j)),!d&&i&&(this.a.value="+".concat(this.s.dialCode))),d&&this._u(d)}},{key:"_i",value:function(){this._j(),this.d.autoInsertDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return q("handleAutoCountry")})},function(){return q("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+ec;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;bg){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a){var b,c=this.a.value,d="+".concat(a);if("+"===c.charAt(0)){var e=this._5(c);b=e?c.replace(e,d):d,this.a.value=b}else this.d.autoInsertDialCode&&(b=c?d+c:d,this.a.value=b)}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;ea.length)&&(b=a.length);for(var c=0,d=new Array(b);c1&&arguments[1]!==a?arguments[1]:{};k(this,b),this.id=t++,this.a=c,this.b=null,this.c=null,this.d=Object.assign({},u,d),this.e=Boolean(c.getAttribute("placeholder"))}return m(b,[{key:"_init",value:function(){var a=this;this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.countrySearch&&!this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!0);var b=this.d.allowDropdown&&!this.d.showSelectedDialCode;!this.d.showFlags&&b&&(this.d.showFlags=!0),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isRTL=!!this.a.closest("[dir=rtl]");var c=new Promise(function(b,c){a.h=b,a.i=c}),d=new Promise(function(b,c){a.i0=b,a.i1=c});this.promise=Promise.all([c,d]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}},{key:"_b",value:function(){this._d(),this._d2(),this._e(),this._d0(),(this.d.onlyCountries.length||this.d.i18n)&&this.p.sort(this._d1)}},{key:"_c",value:function(b,c,d){c.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=p.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=p}},{key:"_d0",value:function(){for(var a=0;ab.name?1:0}},{key:"_d2",value:function(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(var a=0;a")),h+="".concat(e.name,""),h+="+".concat(e.dialCode,""),g.insertAdjacentHTML("beforeend",h)}}},{key:"_h",value:function(){var b=arguments.length>0&&arguments[0]!==a&&arguments[0],c=this.a.getAttribute("value"),d=this.a.value,e=c&&"+"===c.charAt(0)&&(!d||"+"!==d.charAt(0)),f=e?c:d,g=this._5(f),h=this._w(f),i=this.d.initialCountry;if(g&&!h)this._v(f);else if("auto"!==i||b){var j=i?i.toLowerCase():"",k=j&&this._y(j,!0);k?this._z(j):g&&h?this._z("us"):this._z()}f&&this._u(f)}},{key:"_i",value:function(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput&&(a.hiddenInput.value=a.getNumber()),a.hiddenInputCountry&&(a.hiddenInputCountry.value=a.getSelectedCountryData().iso2)},this.a.form.addEventListener("submit",this._a14)}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.dropdownContent.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this.a.closest("label");b&&b.addEventListener("click",this._a9),this._a10=function(){!a.dropdownContent.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"!==this.d.initialCountry||this.s.iso2?this.h():this._i4()}},{key:"_i4",value:function(){var b=this;window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(){var c=arguments.length>0&&arguments[0]!==a?arguments[0]:"",d=c.toLowerCase();d&&b._y(d,!0)?(window.intlTelInputGlobals.autoCountry=d,setTimeout(function(){return w("handleAutoCountry")})):(b._h(!0),w("rejectAutoCountryPromise"))},function(){return w("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this,b=!1;this._a12=function(c){a._v(a.a.value)&&a._8();var d=c&&c.data&&/[^+0-9]/.test(c.data),e=c&&"insertFromPaste"===c.inputType&&a.a.value;if(d||e?b=!0:/[^+0-9]/.test(a.a.value)||(b=!1),a.d.formatAsYouType&&!b&&!e){var f=a.a.selectionStart,g=a.a.value.substring(0,f),h=g.replace(/[^+0-9]/g,"").length,i=c&&"deleteContentForward"===c.inputType,j=a._9(),k=a._j3(h,j,f,i);a.a.value=j,a.a.setSelectionRange(k,k)}},this.a.addEventListener("input",this._a12)}},{key:"_j3",value:function(a,b,c,d){if(0===c&&!d)return 0;for(var e=0,f=0;fb?a.substr(0,b):a}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_trigger",value:function(a){var b=new Event(a,{bubbles:!0,cancelable:!0});this.a.dispatchEvent(b)}},{key:"_n",value:function(){var a=this.d,b=a.fixDropdownWidth,c=a.countrySearch;if(b&&(this.dropdownContent.style.width="".concat(this.a.offsetWidth,"px")),this.dropdownContent.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&!c)this._x(this.b,!1),this._3(this.b,!0);else{var d=this.countryList.firstElementChild;d&&(this._x(d,!1),this.countryList.scrollTop=0),c&&this.searchInput.focus()}this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){var b=this.a.getBoundingClientRect(),c=document.documentElement.scrollTop,d=b.top+c,e=this.dropdownContent.offsetHeight,f=d+this.a.offsetHeight+ec,h=!this.d.countrySearch&&!f&&g;if(this._n2(this.dropdownContent,"iti__dropdown-content--dropup",h),this.d.dropdownContainer){var i=h?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+i,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=b.target.closest(".iti__country");c&&a._x(c,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=function(b){var c=b.target.closest(".iti__country");c&&a._1(c)},this.countryList.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;if(this._a3=function(b){["ArrowUp","ArrowDown","Enter","Escape"].includes(b.key)&&(b.preventDefault(),b.stopPropagation(),"ArrowUp"===b.key||"ArrowDown"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key&&a._2()),!a.d.countrySearch&&/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(b.stopPropagation(),d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3),this.d.countrySearch){var e=function(){var b=a.searchInput.value.trim();b?a._p3(b):a._p3("",!0)},f=null;this._a7=function(){f&&clearTimeout(f),f=setTimeout(function(){e(),f=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",function(a){return a.stopPropagation()})}}},{key:"_p2",value:function(){return(arguments.length>0&&arguments[0]!==a?arguments[0]:"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}},{key:"_p3",value:function(b){var c=arguments.length>1&&arguments[1]!==a&&arguments[1],d=!0;this.countryList.innerHTML="";for(var e=this._p2(b),f=0;f1&&(b="ArrowUp"===a?this.countryList.lastElementChild:this.countryList.firstElementChild),b){this._3(b,!1);var c=!this.d.countrySearch;this._x(b,c)}}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;bg){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a){var b,c=this.a.value,d="+".concat(a);if("+"===c.charAt(0)){var e=this._5(c);b=e?c.replace(e,d):d,this.a.value=b}}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;e0&&arguments[0]!==a)||arguments[0],c=this._6();return!/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/.test(c)&&(window.intlTelInputUtils?intlTelInputUtils.isPossibleNumber(c,this.s.iso2,b):null)}},{key:"isValidNumberPrecise",value:function(){var a=this._6();return!/(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])/.test(a)&&(window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,this.s.iso2):null)}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.s.iso2!==b&&(this._z(b),this._4(this.s.dialCode),this._8())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._8()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),b}();s.getCountryData=function(){return p};var y=function(a,b,c){var d=document.createElement("script");d.onload=function(){w("handleUtils"),b&&b()},d.onerror=function(){w("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};return s.loadUtils=function(a){return window.intlTelInputUtils||window.intlTelInputGlobals.startedLoadingUtilsScript?null:(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,new Promise(function(b,c){return y(a,b,c)}))},s.defaults=u,s.version="20.0.3",function(a,b){var c=new x(a,b);return c._init(),a.setAttribute("data-intl-tel-input-id",c.id),window.intlTelInputGlobals.instances[c.id]=c,c}}()}); \ No newline at end of file diff --git a/public/assets/build/js/utils.js b/public/assets/build/js/utils.js index cb297db..2c64209 100644 --- a/public/assets/build/js/utils.js +++ b/public/assets/build/js/utils.js @@ -1,18 +1,12 @@ -/** - * Skipped minification because the original files appears to be already minified. - * Original file: /npm/intl-tel-input@20.1.0/build/js/utils.js - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ (function(){/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ - var aa=this||self;function k(a,b){a=a.split(".");var c=aa;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b}function m(a,b){function c(){}c.prototype=b.prototype;a.ma=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.sa=function(d,e,f){for(var g=Array(arguments.length-2),h=2;ha.length?!1:N(Ja,a)}function Na(a){return N(Ea,a)?O(a,ya):O(a,K)}function Oa(a){var b=Na(a.toString());C(a);a.g(b)}function Pa(a){return null!=a&&(1!=w(a,9)||-1!=t(a,9)[0])}function O(a,b){for(var c=new B,d,e=a.length,f=0;fb?2:f[f.length-1]=e&&e<=d;++e)if(c=parseInt(a.substring(0,e),10),c in I)return b.g(a.substring(e)),c;return 0} - function Xa(a,b,c,d,e,f){if(0==b.length)return 0;b=new B(b);var g;null!=c&&(g=q(c,11));null==g&&(g="NonMatch");var h=b.toString();if(0==h.length)g=20;else if(L.test(h))h=h.replace(L,""),C(b),b.g(Na(h)),g=1;else{h=new RegExp(g);Oa(b);g=b.toString();if(0==g.search(h)){h=g.match(h)[0].length;var l=g.substring(h).match(Aa);l&&null!=l[1]&&0=b.h.length)throw Error("Phone number too short after IDD"); - a=Wa(b,d);if(0!=a)return r(f,1,a),a;throw Error("Invalid country calling code");}if(null!=c&&(g=v(c,10),h=""+g,l=b.toString(),0==l.lastIndexOf(h,0)&&(h=new B(l.substring(h.length)),l=q(c,1),l=new RegExp(v(l,2)),Ya(h,c,null),h=h.toString(),!N(l,b.toString())&&N(l,h)||3==W(a,b.toString(),c,-1))))return d.g(h),e&&r(f,6,10),r(f,1,g),g;r(f,1,0);return 0} - function Ya(a,b,c){var d=a.toString(),e=d.length,f=q(b,15);if(0!=e&&null!=f&&0!=f.length){var g=new RegExp("^(?:"+f+")");if(e=g.exec(d)){f=new RegExp(v(q(b,1),2));var h=N(f,d),l=e.length-1;b=q(b,16);if(null==b||0==b.length||null==e[l]||0==e[l].length){if(!h||N(f,d.substring(e[0].length)))null!=c&&0=b.length)f="";else{var g=b.indexOf(";",f);f=-1!==g?b.substring(f,g):b.substring(f)}var h=f;null==h?g=!0:0===h.length?g=!1:(g=Fa.exec(h),h=Ga.exec(h),g=null!==g||null!==h);if(!g)throw Error("The string supplied did not seem to be a phone number"); - null!=f?("+"===f.charAt(0)&&e.g(f),f=b.indexOf("tel:"),e.g(b.substring(0<=f?f+4:0,b.indexOf(";phone-context=")))):(f=e.g,g=b??"",h=g.search(Ba),0<=h?(g=g.substring(h),g=g.replace(Da,""),h=g.search(Ca),0<=h&&(g=g.substring(0,h))):g="",f.call(e,g));f=e.toString();g=f.indexOf(";isub=");0b.h.length)throw Error("The string supplied is too short to be a phone number");null!=g&&(c=new B,e=new B(b.toString()),Ya(e,g,c),a=W(a,e.toString(),g,-1),2!=a&&4!=a&&5!=a&&(b=e,d&&0a)throw Error("The string supplied is too short to be a phone number");if(17{try{const c=a.replace(/[^+0-9]/g,""),d=new $a(b);let e="";for(let f=0;f{try{const e=J.g(),f=Y(e,a,b);var d=X(e,f,-1);return 0==d||4==d?Ra(e,f,"undefined"===typeof c?0:c):a}catch(e){return a}}); - k("intlTelInputUtils.getExampleNumber",(a,b,c)=>{try{const h=J.g();a:{var d=h;if(P(a)){var e=U(T(d,a),c);try{if(p(e,6)){var f=q(e,6);var g=Za(d,f,a,!1);break a}}catch(l){}}g=null}return Ra(h,g,b?2:1)}catch(h){return""}});k("intlTelInputUtils.getExtension",(a,b)=>{try{return q(Y(J.g(),a,b),3)}catch(c){return""}});k("intlTelInputUtils.getNumberType",(a,b)=>{try{const h=J.g();var c=Y(h,a,b);a=h;var d=Ua(a,c),e=R(a,v(c,1),d);if(null==e)var f=-1;else{var g=Q(c);f=Ta(g,e)}return f}catch(h){return-99}}); - k("intlTelInputUtils.getValidationError",(a,b)=>{try{const c=J.g(),d=Y(c,a,b);return X(c,d,-1)}catch(c){return"Invalid country calling code"===c.message?1:3>=a.length||"Phone number too short after IDD"===c.message||"The string supplied is too short to be a phone number"===c.message?2:"The string supplied is too long to be a phone number"===c.message?3:-99}}); - k("intlTelInputUtils.isValidNumber",(a,b)=>{try{const l=J.g();var c=Y(l,a,b);a=l;var d=Ua(a,c);var e=v(c,1),f=R(a,e,d);if(null==f||"001"!=d&&e!=Va(a,d))var g=!1;else{var h=Q(c);g=-1!=Ta(h,f)}return g}catch(l){return!1}});k("intlTelInputUtils.isPossibleNumber",(a,b,c)=>{try{const d=J.g(),e=Y(d,a,b);return c?0===X(d,e,1):0===X(d,e,-1)}catch(d){return!1}});k("intlTelInputUtils.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}); - k("intlTelInputUtils.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1});k("intlTelInputUtils.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5});})(); \ No newline at end of file +function J(){this.g={}}J.h=void 0;J.g=function(){return J.h?J.h:J.h=new J}; +var K={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},xa={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6", +7:"7",8:"8",9:"9","+":"+","*":"*","#":"#"},ya={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2", +B:"2",C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},za=RegExp("[+\uff0b]+"),L=RegExp("^[+\uff0b]+"),Aa=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),Ba=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),Ca=/[\\\/] *x/,Da=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),Ea=/(?:.*?[A-Za-z]){3}.*/,Fa=RegExp("^\\+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]|[\\-\\.\\(\\)]?)*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]|[\\-\\.\\(\\)]?)*$"), +Ga=RegExp("^([A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]+((\\-)*[A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])*\\.?$");function M(a){return"([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,"+a+"})"} +function Ha(){return";ext="+M("20")+"|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|\u0434\u043e\u0431|anexo)[:\\.\uff0e]?[ \u00a0\\t,-]*"+(M("20")+"#?|[ \u00a0\\t,]*(?:[x\uff58#\uff03~\uff5e]|int|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*")+(M("9")+"#?|[- ]+")+(M("6")+"#|[ \u00a0\\t]*(?:,{2}|;)[:\\.\uff0e]?[ \u00a0\\t,-]*")+(M("15")+"#?|[ \u00a0\\t]*(?:,)+[:\\.\uff0e]?[ \u00a0\\t,-]*")+(M("9")+"#?")} +var Ia=new RegExp("(?:"+Ha()+")$","i"),Ja=new RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:"+Ha()+")?$","i"),Ka=/(\$\d)/, +La=/^\(?\$1\)?$/;function Ma(a){return 2>a.length?!1:N(Ja,a)}function Na(a){return N(Ea,a)?O(a,ya):O(a,K)}function Oa(a){var b=Na(a.toString());C(a);a.g(b)}function Pa(a){return null!=a&&(1!=w(a,9)||-1!=t(a,9)[0])}function O(a,b){for(var c=new B,d,e=a.length,f=0;fb?2:f[f.length-1]=e&&e<=d;++e)if(c=parseInt(a.substring(0,e),10),c in I)return b.g(a.substring(e)),c;return 0} +function Xa(a,b,c,d,e,f){if(0==b.length)return 0;b=new B(b);var g;null!=c&&(g=q(c,11));null==g&&(g="NonMatch");var h=b.toString();if(0==h.length)g=20;else if(L.test(h))h=h.replace(L,""),C(b),b.g(Na(h)),g=1;else{h=new RegExp(g);Oa(b);g=b.toString();if(0==g.search(h)){h=g.match(h)[0].length;var l=g.substring(h).match(Aa);l&&null!=l[1]&&0=b.h.length)throw Error("Phone number too short after IDD"); +a=Wa(b,d);if(0!=a)return r(f,1,a),a;throw Error("Invalid country calling code");}if(null!=c&&(g=v(c,10),h=""+g,l=b.toString(),0==l.lastIndexOf(h,0)&&(h=new B(l.substring(h.length)),l=q(c,1),l=new RegExp(v(l,2)),Ya(h,c,null),h=h.toString(),!N(l,b.toString())&&N(l,h)||3==W(a,b.toString(),c,-1))))return d.g(h),e&&r(f,6,10),r(f,1,g),g;r(f,1,0);return 0} +function Ya(a,b,c){var d=a.toString(),e=d.length,f=q(b,15);if(0!=e&&null!=f&&0!=f.length){var g=new RegExp("^(?:"+f+")");if(e=g.exec(d)){f=new RegExp(v(q(b,1),2));var h=N(f,d),l=e.length-1;b=q(b,16);if(null==b||0==b.length||null==e[l]||0==e[l].length){if(!h||N(f,d.substring(e[0].length)))null!=c&&0=b.length)f="";else{var g=b.indexOf(";",f);f=-1!==g?b.substring(f,g):b.substring(f)}var h=f;null==h?g=!0:0===h.length?g=!1:(g=Fa.exec(h),h=Ga.exec(h),g=null!==g||null!==h);if(!g)throw Error("The string supplied did not seem to be a phone number"); +null!=f?("+"===f.charAt(0)&&e.g(f),f=b.indexOf("tel:"),e.g(b.substring(0<=f?f+4:0,b.indexOf(";phone-context=")))):(f=e.g,g=b??"",h=g.search(Ba),0<=h?(g=g.substring(h),g=g.replace(Da,""),h=g.search(Ca),0<=h&&(g=g.substring(0,h))):g="",f.call(e,g));f=e.toString();g=f.indexOf(";isub=");0b.h.length)throw Error("The string supplied is too short to be a phone number");null!=g&&(c=new B,e=new B(b.toString()),Ya(e,g,c),a=W(a,e.toString(),g,-1),2!=a&&4!=a&&5!=a&&(b=e,d&&0a)throw Error("The string supplied is too short to be a phone number");if(17{try{const c=a.replace(/[^+0-9]/g,""),d=new $a(b);let e="";for(let f=0;f{try{const e=J.g(),f=Y(e,a,b);var d=X(e,f,-1);return 0==d||4==d?Ra(e,f,"undefined"===typeof c?0:c):a}catch(e){return a}}); +k("intlTelInputUtils.getExampleNumber",(a,b,c)=>{try{const h=J.g();a:{var d=h;if(P(a)){var e=U(T(d,a),c);try{if(p(e,6)){var f=q(e,6);var g=Za(d,f,a,!1);break a}}catch(l){}}g=null}return Ra(h,g,b?2:1)}catch(h){return""}});k("intlTelInputUtils.getExtension",(a,b)=>{try{return q(Y(J.g(),a,b),3)}catch(c){return""}});k("intlTelInputUtils.getNumberType",(a,b)=>{try{const h=J.g();var c=Y(h,a,b);a=h;var d=Ua(a,c),e=R(a,v(c,1),d);if(null==e)var f=-1;else{var g=Q(c);f=Ta(g,e)}return f}catch(h){return-99}}); +k("intlTelInputUtils.getValidationError",(a,b)=>{try{const c=J.g(),d=Y(c,a,b);return X(c,d,-1)}catch(c){return"Invalid country calling code"===c.message?1:3>=a.length||"Phone number too short after IDD"===c.message||"The string supplied is too short to be a phone number"===c.message?2:"The string supplied is too long to be a phone number"===c.message?3:-99}}); +k("intlTelInputUtils.isValidNumber",(a,b)=>{try{const l=J.g();var c=Y(l,a,b);a=l;var d=Ua(a,c);var e=v(c,1),f=R(a,e,d);if(null==f||"001"!=d&&e!=Va(a,d))var g=!1;else{var h=Q(c);g=-1!=Ta(h,f)}return g}catch(l){return!1}});k("intlTelInputUtils.isPossibleNumber",(a,b,c)=>{try{const d=J.g(),e=Y(d,a,b);return c?0===X(d,e,1):0===X(d,e,-1)}catch(d){return!1}});k("intlTelInputUtils.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}); +k("intlTelInputUtils.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1});k("intlTelInputUtils.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5});})();