@desource/phone-mask-react 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,78 +1,78 @@
1
- import { jsxs as F, Fragment as dt, jsx as C } from "react/jsx-runtime";
2
- import { useMemo as I, useEffect as v, useState as T, useCallback as h, useRef as R, forwardRef as pt, useImperativeHandle as ft } from "react";
3
- import { createPortal as ht } from "react-dom";
4
- const gt = { AC: "+247 #####", AD: ["+376 ### ###", "+376 #### ####"], AE: ["+971 # ### ####", "+971 ## ### ####", "+971 ### ######", "+971 ### # #####"], AF: "+93 ## ### ####", AG: "+1 ###-###-####", AI: "+1 ###-###-####", AL: ["+355 ## ### ###", "+355 ## ### ####", "+355 ### ####", "+355 ### ###", "+355 ### #####"], AM: ["+374 ## ######", "+374 ### ## ###"], AO: "+244 ### ### ###", AR: ["+54 ## ####-####", "+54 # ## ####-####", "+54 ###-###-####"], AS: "+1 ###-###-####", AT: ["+43 # #########", "+43 ### ######"], AU: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###", "+61 ## ### ##"], AW: "+297 ### ####", AX: ["+358 ## #######", "+358 ### ######"], AZ: ["+994 ## ### ## ##", "+994 ### ## ## ##"], BA: ["+387 ## ###-###", "+387 ## ### ###"], BB: "+1 ###-###-####", BD: ["+880 #-#######", "+880 ####-######", "+880 ###-#######"], BE: ["+32 ## ## ## ##", "+32 ### ## ## ##", "+32 ### ## ###"], BF: "+226 ## ## ## ##", BG: ["+359 # ### ###", "+359 ## ### ###", "+359 ### ## ###"], BH: "+973 #### ####", BI: "+257 ## ## ## ##", BJ: ["+229 ## ## ## ## ##", "+229 ## ## ## ##"], BL: "+590 ### ## ## ##", BM: "+1 ###-###-####", BN: "+673 ### ####", BO: ["+591 # #######", "+591 ########", "+591 ### ## ####"], BQ: "+599 ### ####", BR: ["+55 ## ####-####", "+55 ## #####-####", "+55 ### ## ####", "+55 ####-####"], BS: "+1 ###-###-####", BT: ["+975 # ### ###", "+975 ## ## ## ##"], BW: ["+267 ### ####", "+267 ## ### ###", "+267 #### ### ###", "+267 ## #####"], BY: ["+375 ### ##-##-##", "+375 ## ###-##-##", "+375 ### ### ####"], BZ: ["+501 ###-####", "+501 #-###-####-###"], CA: "+1 ###-###-####", CC: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###"], CD: ["+243 ## #####", "+243 ### ### ###"], CF: "+236 ## ## ## ##", CG: ["+242 ## ### ####", "+242 # #### ####"], CH: ["+41 ## ### ## ##", "+41 ### ### ###"], CI: ["+225 ## ## # #####", "+225 ## ## ## ####"], CK: "+682 ## ###", CL: ["+56 ### ### ###", "+56 # #### ####", "+56 ### ### ####", "+56 ## ### ####"], CM: ["+237 # ## ## ## ##", "+237 ## ## ## ##"], CN: ["+86 ## #### ####", "+86 ### #### ####", "+86 ### ### ####", "+86 ########"], CO: ["+57 ### #######", "+57 # ### #######"], CR: ["+506 #### ####", "+506 ###-###-####"], CU: ["+53 # #######", "+53 ### #######"], CV: "+238 ### ## ##", CW: ["+599 # ### ####", "+599 ### ####"], CX: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###"], CY: "+357 ## ######", CZ: "+420 ### ### ###", DE: ["+49 ## ######", "+49 #### #######", "+49 ### ##########", "+49 ### # ######", "+49 ### # ####", "+49 ### #### ####", "+49 ########"], DJ: "+253 ## ## ## ##", DK: "+45 ## ## ## ##", DM: "+1 ###-###-####", DO: "+1 ###-###-####", DZ: ["+213 ## ## ## ##", "+213 ### ## ## ##", "+213 ## ### ## ##"], EC: ["+593 #-###-####", "+593 ## ### ####", "+593 #### ### ####"], EE: ["+372 ### ####", "+372 #### ####", "+372 ## ## ####"], EG: ["+20 # ########", "+20 ## ########", "+20 ### ### ####"], EH: ["+212 # ## ## ## ##", "+212 ##-#######"], ER: "+291 # ### ###", ES: ["+34 ### ## ## ##", "+34 ### ### ###"], ET: "+251 ## ### ####", FI: ["+358 ## #######", "+358 ### ######"], FJ: ["+679 ### ####", "+679 #### ### ####"], FK: "+500 #####", FM: "+691 ### ####", FO: "+298 ######", FR: ["+33 # ## ## ## ##", "+33 ### ## ## ##"], GA: "+241 ## ## ## ##", GB: ["+44 ### ### ####", "+44 #### ######", "+44 ## #### ####"], GD: "+1 ###-###-####", GE: ["+995 ## ### ## ##", "+995 ### ## ## ##", "+995 ### ### ###"], GF: "+594 ### ## ## ##", GG: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], GH: ["+233 ## ### ####", "+233 ### #####"], GI: ["+350 ### #####", "+350 ########"], GL: "+299 ## ## ##", GM: "+220 ### ####", GN: ["+224 ## ## ## ##", "+224 ### ## ## ##"], GP: "+590 ### ## ## ##", GQ: ["+240 ### ### ###", "+240 ### ######"], GR: ["+30 ## #### ####", "+30 ### ### ####"], GT: ["+502 #### ####", "+502 #### ### ####"], GU: "+1 ###-###-####", GW: ["+245 ### ### ###", "+245 ### ####"], GY: "+592 ### ####", HK: ["+852 #### ####", "+852 ### ### ###", "+852 ### ## ### ###"], HN: ["+504 ####-####", "+504 ###########"], HR: ["+385 # #### ###", "+385 ## ### ####", "+385 ### ### ###", "+385 ## ## ###", "+385 ## ### ###"], HT: "+509 ## ## ####", HU: ["+36 # ### ####", "+36 ## ### ####", "+36 ## ### ###"], ID: ["+62 ## #######", "+62 ###-###-###", "+62 ### #######", "+62 ### # ### ###", "+62 ### ### ####"], IE: ["+353 ## #####", "+353 ## ### ####", "+353 #### ### ###", "+353 ### ### ###"], IL: ["+972 #-###-####", "+972 ##-###-####", "+972 #-###-###-###"], IM: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], IN: ["+91 ##### #####", "+91 #### ## ####", "+91 #### ### ### ###", "+91 #### ### ####"], IO: "+246 ### ####", IQ: ["+964 # ### ####", "+964 ### ### ####"], IR: ["+98 ## #### ####", "+98 ### ### ####"], IS: "+354 ### ####", IT: ["+39 ## #### ####", "+39 ### ### ####", "+39 ### ### ###"], JE: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], JM: "+1 ###-###-####", JO: ["+962 # ### ####", "+962 # #### ####", "+962 ### #####", "+962 ## #######"], JP: ["+81 #-####-####", "+81 ##-####-####", "+81 ###-###-###", "+81 ##-###-####"], KE: ["+254 ## #######", "+254 ### ######", "+254 ### ### ###"], KG: ["+996 ### ### ###", "+996 ### ### # ##"], KH: ["+855 ## ### ###", "+855 #### ### ###"], KI: ["+686 #####", "+686 ########"], KM: "+269 ### ## ##", KN: "+1 ###-###-####", KP: ["+850 # ### ####", "+850 ### ### ####"], KR: ["+82 #-###-####", "+82 ##-####-####", "+82 ##-###-####"], KW: ["+965 #### ####", "+965 ### #####", "+965 #### ###"], KY: "+1 ###-###-####", KZ: ["+7 ##### # ## ##", "+7 ### ### ####", "+7 ### ###-##-##"], LA: ["+856 ## ### ###", "+856 ## ## ### ###"], LB: ["+961 # ### ###", "+961 ## ### ###"], LC: "+1 ###-###-####", LI: ["+423 ### ## ##", "+423 ### ### ###"], LK: ["+94 ### ### ###", "+94 ## ### ####"], LR: ["+231 ## ### ###", "+231 ## ### ####"], LS: "+266 #### ####", LT: ["+370 ### #####", "+370 ### ## ###"], LU: ["+352 ## ## ## ##", "+352 ### ### ###", "+352 ### ## ###"], LV: "+371 ## ### ###", LY: "+218 ##-#######", MA: ["+212 # ## ## ## ##", "+212 ##-#######"], MC: ["+377 ## ## ## ##", "+377 # ## ## ## ##"], MD: ["+373 ## ### ###", "+373 ### ## ###", "+373 ### #####"], ME: "+382 ## ### ###", MF: "+590 ### ## ## ##", MG: "+261 ## ## ### ##", MH: "+692 ###-####", MK: ["+389 # ### ####", "+389 ## ### ###", "+389 ### # ## ##"], ML: "+223 ## ## ## ##", MM: ["+95 # ### ###", "+95 # ### ####", "+95 ### ### ####"], MN: "+976 #### ####", MO: ["+853 #### ####", "+853 #### ###"], MP: "+1 ###-###-####", MQ: "+596 ### ## ## ##", MR: "+222 ## ## ## ##", MS: "+1 ###-###-####", MT: "+356 #### ####", MU: ["+230 #### ####", "+230 ### ####"], MV: ["+960 ###-####", "+960 ### ### ####"], MW: ["+265 # ### ###", "+265 ### ## ## ##"], MX: "+52 ### ### ####", MY: ["+60 #-#### ####", "+60 ##-### ####", "+60 #-###-##-####", "+60 ###-### ####"], MZ: ["+258 ## ### ###", "+258 ## ### ####", "+258 ### ### ###"], NA: ["+264 ## ### ###", "+264 ## ### ####", "+264 ### ### ###"], NC: "+687 ##.##.##", NE: ["+227 ## ## ## ##", "+227 ## ### ###"], NF: ["+672 ## ####", "+672 # #####"], NG: ["+234 #### ## ####", "+234 ### ### ####", "+234 ### #### ####"], NI: "+505 #### ####", NL: ["+31 ## ### ####", "+31 # ########", "+31 ### ####", "+31 ## #######"], NO: ["+47 ## ## ## ##", "+47 ### ## ###"], NP: ["+977 #-#######", "+977 ###-#######", "+977 ###########"], NR: "+674 ### ####", NU: ["+683 ####", "+683 ### ####"], NZ: ["+64 # ### ####", "+64 ## ### ####", "+64 ### ### ###"], OM: ["+968 ## ######", "+968 #### ####", "+968 ### #####"], PA: ["+507 ###-####", "+507 ####-####"], PE: ["+51 # #######", "+51 ### ### ###", "+51 ### #####"], PF: ["+689 ## ## ## ##", "+689 ### ## ## ##"], PG: ["+675 ### ####", "+675 #### ####"], PH: ["+63 # #### ####", "+63 ### ### ####", "+63 #### # ### ####"], PK: ["+92 ## ########", "+92 ### #######", "+92 ### ### ##", "+92 #### #####"], PL: ["+48 ## ### ## ##", "+48 ### ### ###"], PM: ["+508 ## ## ##", "+508 ### ## ## ##"], PR: "+1 ###-###-####", PS: ["+970 # ### ####", "+970 ### ### ###", "+970 #### ### ###"], PT: ["+351 ## ### ####", "+351 ### ### ###"], PW: "+680 ### ####", PY: ["+595 ## ### ####", "+595 ### ######", "+595 #### ### ####"], QA: ["+974 #### ####", "+974 ### ####"], RE: "+262 ### ## ## ##", RO: ["+40 ## ### ####", "+40 ### ### ###"], RS: ["+381 ## ######", "+381 ## #######", "+381 ### #####"], RU: "+7 ### ###-##-##", RW: "+250 ### ### ###", SA: ["+966 ## ### ####", "+966 ### ### ####", "+966 #### #####"], SB: ["+677 #####", "+677 ## #####"], SC: ["+248 # ### ###", "+248 #######"], SD: "+249 ## ### ####", SE: ["+46 # ## ## ##", "+46 ## ### ## ##", "+46 ## ## ## ##", "+46 ### ## ## ###"], SG: ["+65 #### ####", "+65 #### ### ####"], SH: "+290 #####", SI: ["+386 # ### ## ##", "+386 ## ### ###", "+386 ## ######", "+386 ### #####"], SJ: ["+47 ## ## ## ##", "+47 ### ## ###"], SK: ["+421 #/### ### ##", "+421 ### ### ###", "+421 #######"], SL: "+232 ## ######", SM: ["+378 #### ######", "+378 ## ## ## ##"], SN: ["+221 ## ### ## ##", "+221 ### ## ## ##"], SO: ["+252 # ######", "+252 # #######"], SR: ["+597 ###-###", "+597 ###-####", "+597 ##-##-##"], SS: "+211 ### ### ###", ST: "+239 ### ####", SV: ["+503 #### ####", "+503 ### ####"], SX: "+1 ###-###-####", SY: ["+963 ## ### ####", "+963 ### ### ###"], SZ: ["+268 #### ####", "+268 ##### ####"], TA: "+290 ####", TC: "+1 ###-###-####", TD: "+235 ## ## ## ##", TG: "+228 ## ## ## ##", TH: ["+66 # ### ####", "+66 ## ### ####", "+66 #### ### ###"], TJ: ["+992 ### ## ####", "+992 ## ### ####"], TK: "+690 ####", TL: ["+670 ### ####", "+670 #### ####"], TM: ["+993 ## ##-##-##", "+993 ## ######"], TN: "+216 ## ### ###", TO: ["+676 ##-###", "+676 ### ####", "+676 #### ###"], TR: ["+90 ### ### ## ##", "+90 ### ### ####"], TT: "+1 ###-###-####", TV: ["+688 ## ###", "+688 ## ####"], TW: ["+886 # #### ####", "+886 ### ### ###", "+886 ## ### ####", "+886 ## #### ####"], TZ: ["+255 ## ### ####", "+255 ### ### ###", "+255 ### ## ####"], UA: ["+380 #### #####", "+380 ## ### ####", "+380 ### ### ###"], UG: ["+256 ## #######", "+256 ### ######"], US: "+1 ###-###-####", UY: ["+598 #### ####", "+598 ## ### ###", "+598 ### ####"], UZ: "+998 ## ### ## ##", VA: ["+39 ## #### ####", "+39 ### ### ####", "+39 ### ### ###"], VC: "+1 ###-###-####", VE: "+58 ###-#######", VG: "+1 ###-###-####", VI: "+1 ###-###-####", VN: ["+84 ### #### ###", "+84 ### ### ###", "+84 #### ######", "+84 ## ### ## ##"], VU: ["+678 #####", "+678 ### ####"], WF: ["+681 ## ## ##", "+681 ### ## ## ##"], WS: ["+685 #####", "+685 ## #####", "+685 ### ###"], XK: ["+383 ## ### ###", "+383 ### #####"], YE: ["+967 # ### ###", "+967 ### ### ###"], YT: "+262 ### ## ## ##", ZA: ["+27 ## ### ####", "+27 ### ### ###"], ZM: ["+260 ### ### ###", "+260 ## #######", "+260 #########"], ZW: ["+263 ## #####", "+263 ## ### ####", "+263 ### ####", "+263 #### ######"] }, mt = /^[a-z]{2}$/i, z = (e) => {
5
- if (!mt.test(e)) {
1
+ import { jsxs as G, Fragment as Ct, jsx as C } from "react/jsx-runtime";
2
+ import { useMemo as M, useEffect as I, useState as k, useCallback as h, useRef as R, forwardRef as yt, useId as Dt, useImperativeHandle as vt } from "react";
3
+ import { createPortal as wt } from "react-dom";
4
+ const bt = { AC: "+247 #####", AD: ["+376 ### ###", "+376 #### ####"], AE: ["+971 # ### ####", "+971 ## ### ####", "+971 ### ######", "+971 ### # #####"], AF: "+93 ## ### ####", AG: "+1 ###-###-####", AI: "+1 ###-###-####", AL: ["+355 ## ### ###", "+355 ## ### ####", "+355 ### ####", "+355 ### ###", "+355 ### #####"], AM: ["+374 ## ######", "+374 ### ## ###"], AO: "+244 ### ### ###", AR: ["+54 ## ####-####", "+54 # ## ####-####", "+54 ###-###-####"], AS: "+1 ###-###-####", AT: ["+43 # #########", "+43 ### ######"], AU: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###", "+61 ## ### ##"], AW: "+297 ### ####", AX: ["+358 ## #######", "+358 ### ######"], AZ: ["+994 ## ### ## ##", "+994 ### ## ## ##"], BA: ["+387 ## ###-###", "+387 ## ### ###"], BB: "+1 ###-###-####", BD: ["+880 #-#######", "+880 ####-######", "+880 ###-#######"], BE: ["+32 ## ## ## ##", "+32 ### ## ## ##", "+32 ### ## ###"], BF: "+226 ## ## ## ##", BG: ["+359 # ### ###", "+359 ## ### ###", "+359 ### ## ###"], BH: "+973 #### ####", BI: "+257 ## ## ## ##", BJ: ["+229 ## ## ## ## ##", "+229 ## ## ## ##"], BL: "+590 ### ## ## ##", BM: "+1 ###-###-####", BN: "+673 ### ####", BO: ["+591 # #######", "+591 ########", "+591 ### ## ####"], BQ: "+599 ### ####", BR: ["+55 ## ####-####", "+55 ## #####-####", "+55 ### ## ####", "+55 ####-####"], BS: "+1 ###-###-####", BT: ["+975 # ### ###", "+975 ## ## ## ##"], BW: ["+267 ### ####", "+267 ## ### ###", "+267 #### ### ###", "+267 ## #####"], BY: ["+375 ### ##-##-##", "+375 ## ###-##-##", "+375 ### ### ####"], BZ: ["+501 ###-####", "+501 #-###-####-###"], CA: "+1 ###-###-####", CC: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###"], CD: ["+243 ## #####", "+243 ### ### ###"], CF: "+236 ## ## ## ##", CG: ["+242 ## ### ####", "+242 # #### ####"], CH: ["+41 ## ### ## ##", "+41 ### ### ###"], CI: ["+225 ## ## # #####", "+225 ## ## ## ####"], CK: "+682 ## ###", CL: ["+56 ### ### ###", "+56 # #### ####", "+56 ### ### ####", "+56 ## ### ####"], CM: ["+237 # ## ## ## ##", "+237 ## ## ## ##"], CN: ["+86 ## #### ####", "+86 ### #### ####", "+86 ### ### ####", "+86 ########"], CO: ["+57 ### #######", "+57 # ### #######"], CR: ["+506 #### ####", "+506 ###-###-####"], CU: ["+53 # #######", "+53 ### #######"], CV: "+238 ### ## ##", CW: ["+599 # ### ####", "+599 ### ####"], CX: ["+61 # #### ####", "+61 ### ### ###", "+61 #### ### ###"], CY: "+357 ## ######", CZ: "+420 ### ### ###", DE: ["+49 ## ######", "+49 #### #######", "+49 ### ##########", "+49 ### # ######", "+49 ### # ####", "+49 ### #### ####", "+49 ########"], DJ: "+253 ## ## ## ##", DK: "+45 ## ## ## ##", DM: "+1 ###-###-####", DO: "+1 ###-###-####", DZ: ["+213 ## ## ## ##", "+213 ### ## ## ##", "+213 ## ### ## ##"], EC: ["+593 #-###-####", "+593 ## ### ####", "+593 #### ### ####"], EE: ["+372 ### ####", "+372 #### ####", "+372 ## ## ####"], EG: ["+20 # ########", "+20 ## ########", "+20 ### ### ####"], EH: ["+212 # ## ## ## ##", "+212 ##-#######"], ER: "+291 # ### ###", ES: ["+34 ### ## ## ##", "+34 ### ### ###"], ET: "+251 ## ### ####", FI: ["+358 ## #######", "+358 ### ######"], FJ: ["+679 ### ####", "+679 #### ### ####"], FK: "+500 #####", FM: "+691 ### ####", FO: "+298 ######", FR: ["+33 # ## ## ## ##", "+33 ### ## ## ##"], GA: "+241 ## ## ## ##", GB: ["+44 ### ### ####", "+44 #### ######", "+44 ## #### ####"], GD: "+1 ###-###-####", GE: ["+995 ## ### ## ##", "+995 ### ## ## ##", "+995 ### ### ###"], GF: "+594 ### ## ## ##", GG: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], GH: ["+233 ## ### ####", "+233 ### #####"], GI: ["+350 ### #####", "+350 ########"], GL: "+299 ## ## ##", GM: "+220 ### ####", GN: ["+224 ## ## ## ##", "+224 ### ## ## ##"], GP: "+590 ### ## ## ##", GQ: ["+240 ### ### ###", "+240 ### ######"], GR: ["+30 ## #### ####", "+30 ### ### ####"], GT: ["+502 #### ####", "+502 #### ### ####"], GU: "+1 ###-###-####", GW: ["+245 ### ### ###", "+245 ### ####"], GY: "+592 ### ####", HK: ["+852 #### ####", "+852 ### ### ###", "+852 ### ## ### ###"], HN: ["+504 ####-####", "+504 ###########"], HR: ["+385 # #### ###", "+385 ## ### ####", "+385 ### ### ###", "+385 ## ## ###", "+385 ## ### ###"], HT: "+509 ## ## ####", HU: ["+36 # ### ####", "+36 ## ### ####", "+36 ## ### ###"], ID: ["+62 ## #######", "+62 ###-###-###", "+62 ### #######", "+62 ### # ### ###", "+62 ### ### ####"], IE: ["+353 ## #####", "+353 ## ### ####", "+353 #### ### ###", "+353 ### ### ###"], IL: ["+972 #-###-####", "+972 ##-###-####", "+972 #-###-###-###"], IM: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], IN: ["+91 ##### #####", "+91 #### ## ####", "+91 #### ### ### ###", "+91 #### ### ####"], IO: "+246 ### ####", IQ: ["+964 # ### ####", "+964 ### ### ####"], IR: ["+98 ## #### ####", "+98 ### ### ####"], IS: "+354 ### ####", IT: ["+39 ## #### ####", "+39 ### ### ####", "+39 ### ### ###"], JE: ["+44 #### ######", "+44 ### ### ####", "+44 ## #### ####"], JM: "+1 ###-###-####", JO: ["+962 # ### ####", "+962 # #### ####", "+962 ### #####", "+962 ## #######"], JP: ["+81 #-####-####", "+81 ##-####-####", "+81 ###-###-###", "+81 ##-###-####"], KE: ["+254 ## #######", "+254 ### ######", "+254 ### ### ###"], KG: ["+996 ### ### ###", "+996 ### ### # ##"], KH: ["+855 ## ### ###", "+855 #### ### ###"], KI: ["+686 #####", "+686 ########"], KM: "+269 ### ## ##", KN: "+1 ###-###-####", KP: ["+850 # ### ####", "+850 ### ### ####"], KR: ["+82 #-###-####", "+82 ##-####-####", "+82 ##-###-####"], KW: ["+965 #### ####", "+965 ### #####", "+965 #### ###"], KY: "+1 ###-###-####", KZ: ["+7 ##### # ## ##", "+7 ### ### ####", "+7 ### ###-##-##"], LA: ["+856 ## ### ###", "+856 ## ## ### ###"], LB: ["+961 # ### ###", "+961 ## ### ###"], LC: "+1 ###-###-####", LI: ["+423 ### ## ##", "+423 ### ### ###"], LK: ["+94 ### ### ###", "+94 ## ### ####"], LR: ["+231 ## ### ###", "+231 ## ### ####"], LS: "+266 #### ####", LT: ["+370 ### #####", "+370 ### ## ###"], LU: ["+352 ## ## ## ##", "+352 ### ### ###", "+352 ### ## ###"], LV: "+371 ## ### ###", LY: "+218 ##-#######", MA: ["+212 # ## ## ## ##", "+212 ##-#######"], MC: ["+377 ## ## ## ##", "+377 # ## ## ## ##"], MD: ["+373 ## ### ###", "+373 ### ## ###", "+373 ### #####"], ME: "+382 ## ### ###", MF: "+590 ### ## ## ##", MG: "+261 ## ## ### ##", MH: "+692 ###-####", MK: ["+389 # ### ####", "+389 ## ### ###", "+389 ### # ## ##"], ML: "+223 ## ## ## ##", MM: ["+95 # ### ###", "+95 # ### ####", "+95 ### ### ####"], MN: "+976 #### ####", MO: ["+853 #### ####", "+853 #### ###"], MP: "+1 ###-###-####", MQ: "+596 ### ## ## ##", MR: "+222 ## ## ## ##", MS: "+1 ###-###-####", MT: "+356 #### ####", MU: ["+230 #### ####", "+230 ### ####"], MV: ["+960 ###-####", "+960 ### ### ####"], MW: ["+265 # ### ###", "+265 ### ## ## ##"], MX: "+52 ### ### ####", MY: ["+60 #-#### ####", "+60 ##-### ####", "+60 #-###-##-####", "+60 ###-### ####"], MZ: ["+258 ## ### ###", "+258 ## ### ####", "+258 ### ### ###"], NA: ["+264 ## ### ###", "+264 ## ### ####", "+264 ### ### ###"], NC: "+687 ##.##.##", NE: ["+227 ## ## ## ##", "+227 ## ### ###"], NF: ["+672 ## ####", "+672 # #####"], NG: ["+234 #### ## ####", "+234 ### ### ####", "+234 ### #### ####"], NI: "+505 #### ####", NL: ["+31 ## ### ####", "+31 # ########", "+31 ### ####", "+31 ## #######"], NO: ["+47 ## ## ## ##", "+47 ### ## ###"], NP: ["+977 #-#######", "+977 ###-#######", "+977 ###########"], NR: "+674 ### ####", NU: ["+683 ####", "+683 ### ####"], NZ: ["+64 # ### ####", "+64 ## ### ####", "+64 ### ### ###"], OM: ["+968 ## ######", "+968 #### ####", "+968 ### #####"], PA: ["+507 ###-####", "+507 ####-####"], PE: ["+51 # #######", "+51 ### ### ###", "+51 ### #####"], PF: ["+689 ## ## ## ##", "+689 ### ## ## ##"], PG: ["+675 ### ####", "+675 #### ####"], PH: ["+63 # #### ####", "+63 ### ### ####", "+63 #### # ### ####"], PK: ["+92 ## ########", "+92 ### #######", "+92 ### ### ##", "+92 #### #####"], PL: ["+48 ## ### ## ##", "+48 ### ### ###"], PM: ["+508 ## ## ##", "+508 ### ## ## ##"], PR: "+1 ###-###-####", PS: ["+970 # ### ####", "+970 ### ### ###", "+970 #### ### ###"], PT: ["+351 ## ### ####", "+351 ### ### ###"], PW: "+680 ### ####", PY: ["+595 ## ### ####", "+595 ### ######", "+595 #### ### ####"], QA: ["+974 #### ####", "+974 ### ####"], RE: "+262 ### ## ## ##", RO: ["+40 ## ### ####", "+40 ### ### ###"], RS: ["+381 ## ######", "+381 ## #######", "+381 ### #####"], RU: "+7 ### ###-##-##", RW: "+250 ### ### ###", SA: ["+966 ## ### ####", "+966 ### ### ####", "+966 #### #####"], SB: ["+677 #####", "+677 ## #####"], SC: ["+248 # ### ###", "+248 #######"], SD: "+249 ## ### ####", SE: ["+46 # ## ## ##", "+46 ## ### ## ##", "+46 ## ## ## ##", "+46 ### ## ## ###"], SG: ["+65 #### ####", "+65 #### ### ####"], SH: "+290 #####", SI: ["+386 # ### ## ##", "+386 ## ### ###", "+386 ## ######", "+386 ### #####"], SJ: ["+47 ## ## ## ##", "+47 ### ## ###"], SK: ["+421 #/### ### ##", "+421 ### ### ###", "+421 #######"], SL: "+232 ## ######", SM: ["+378 #### ######", "+378 ## ## ## ##"], SN: ["+221 ## ### ## ##", "+221 ### ## ## ##"], SO: ["+252 # ######", "+252 # #######"], SR: ["+597 ###-###", "+597 ###-####", "+597 ##-##-##"], SS: "+211 ### ### ###", ST: "+239 ### ####", SV: ["+503 #### ####", "+503 ### ####"], SX: "+1 ###-###-####", SY: ["+963 ## ### ####", "+963 ### ### ###"], SZ: ["+268 #### ####", "+268 ##### ####"], TA: "+290 ####", TC: "+1 ###-###-####", TD: "+235 ## ## ## ##", TG: "+228 ## ## ## ##", TH: ["+66 # ### ####", "+66 ## ### ####", "+66 #### ### ###"], TJ: ["+992 ### ## ####", "+992 ## ### ####"], TK: "+690 ####", TL: ["+670 ### ####", "+670 #### ####"], TM: ["+993 ## ##-##-##", "+993 ## ######"], TN: "+216 ## ### ###", TO: ["+676 ##-###", "+676 ### ####", "+676 #### ###"], TR: ["+90 ### ### ## ##", "+90 ### ### ####"], TT: "+1 ###-###-####", TV: ["+688 ## ###", "+688 ## ####"], TW: ["+886 # #### ####", "+886 ### ### ###", "+886 ## ### ####", "+886 ## #### ####"], TZ: ["+255 ## ### ####", "+255 ### ### ###", "+255 ### ## ####"], UA: ["+380 #### #####", "+380 ## ### ####", "+380 ### ### ###"], UG: ["+256 ## #######", "+256 ### ######"], US: "+1 ###-###-####", UY: ["+598 #### ####", "+598 ## ### ###", "+598 ### ####"], UZ: "+998 ## ### ## ##", VA: ["+39 ## #### ####", "+39 ### ### ####", "+39 ### ### ###"], VC: "+1 ###-###-####", VE: "+58 ###-#######", VG: "+1 ###-###-####", VI: "+1 ###-###-####", VN: ["+84 ### #### ###", "+84 ### ### ###", "+84 #### ######", "+84 ## ### ## ##"], VU: ["+678 #####", "+678 ### ####"], WF: ["+681 ## ## ##", "+681 ### ## ## ##"], WS: ["+685 #####", "+685 ## #####", "+685 ### ###"], XK: ["+383 ## ### ###", "+383 ### #####"], YE: ["+967 # ### ###", "+967 ### ### ###"], YT: "+262 ### ## ## ##", ZA: ["+27 ## ### ####", "+27 ### ### ###"], ZM: ["+260 ### ### ###", "+260 ## #######", "+260 #########"], ZW: ["+263 ## #####", "+263 ## ### ####", "+263 ### ####", "+263 #### ######"] }, It = /^[a-z]{2}$/i, _ = (e) => {
5
+ if (!It.test(e)) {
6
6
  const n = typeof e;
7
7
  throw new TypeError(`cc argument must be an ISO 3166-1 alpha-2 string, but got '${n === "string" ? e : n}' instead.`);
8
8
  }
9
9
  const t = [...e.toUpperCase()].map((n) => (n.codePointAt(0) ?? 0) + 127397);
10
10
  return String.fromCodePoint(...t);
11
- }, he = "en", j = /* @__PURE__ */ new Map(), xe = (e) => {
12
- const t = e.toLowerCase(), n = j.get(t);
11
+ }, Ce = "en", J = /* @__PURE__ */ new Map(), $e = (e) => {
12
+ const t = e.toLowerCase(), n = J.get(t);
13
13
  if (n) return n;
14
14
  const r = new Intl.DisplayNames([e], { type: "region" });
15
- if (j.size >= 10) {
16
- for (const s of j.keys()) if (s !== he) {
17
- j.delete(s);
15
+ if (J.size >= 10) {
16
+ for (const s of J.keys()) if (s !== Ce) {
17
+ J.delete(s);
18
18
  break;
19
19
  }
20
20
  }
21
- return j.set(t, r), r;
22
- }, K = Object.entries(gt), Ae = (e) => e.split(/ (.*)/s);
23
- function $(e) {
21
+ return J.set(t, r), r;
22
+ }, K = Object.entries(bt), Be = (e) => e.split(/ (.*)/s);
23
+ function U(e) {
24
24
  let t = "", n = "";
25
25
  if (Array.isArray(e)) {
26
26
  const r = [];
27
27
  for (const s of e) {
28
- const [o, a] = Ae(s);
29
- t || (t = o), r.push(a);
28
+ const [o, i] = Be(s);
29
+ t || (t = o), r.push(i);
30
30
  }
31
31
  n = r;
32
32
  } else {
33
- const [r, s] = Ae(e);
33
+ const [r, s] = Be(e);
34
34
  t = r, n = s;
35
35
  }
36
36
  return [t, n];
37
37
  }
38
38
  K.map(([e, t]) => ({ id: e, mask: t }));
39
39
  K.reduce((e, [t, n]) => {
40
- const [r, s] = $(n);
40
+ const [r, s] = U(n);
41
41
  return e[t] = { code: r, mask: s }, e;
42
42
  }, {});
43
43
  K.map(([e, t]) => {
44
- const [n, r] = $(t);
44
+ const [n, r] = U(t);
45
45
  return { id: e, code: n, mask: r };
46
46
  });
47
47
  K.reduce((e, [t, n]) => {
48
- const [r, s] = $(n);
49
- return e[t] = { code: r, mask: s, flag: z(t) }, e;
48
+ const [r, s] = U(n);
49
+ return e[t] = { code: r, mask: s, flag: _(t) }, e;
50
50
  }, {});
51
51
  K.map(([e, t]) => {
52
- const [n, r] = $(t);
53
- return { id: e, code: n, mask: r, flag: z(e) };
52
+ const [n, r] = U(t);
53
+ return { id: e, code: n, mask: r, flag: _(e) };
54
54
  });
55
- const Be = (e) => {
56
- const t = xe(e);
55
+ const Ge = (e) => {
56
+ const t = $e(e);
57
57
  return K.reduce((n, [r, s]) => {
58
- const [o, a] = $(s), i = t.of(r) ?? "";
59
- return n[r] = { code: o, mask: a, name: i, flag: z(r) }, n;
58
+ const [o, i] = U(s), a = t.of(r) ?? "";
59
+ return n[r] = { code: o, mask: i, name: a, flag: _(r) }, n;
60
60
  }, {});
61
- }, He = (e) => {
62
- const t = xe(e);
61
+ }, Ke = (e) => {
62
+ const t = $e(e);
63
63
  return K.map(([n, r]) => {
64
- const [s, o] = $(r);
65
- return { id: n, code: s, mask: o, name: t.of(n) ?? "", flag: z(n) };
64
+ const [s, o] = U(r);
65
+ return { id: n, code: s, mask: o, name: t.of(n) ?? "", flag: _(n) };
66
66
  });
67
- }, Ct = Be(he);
68
- He(he);
69
- const yt = z;
70
- function Re() {
71
- return typeof navigator < "u" && navigator.language || "en";
67
+ }, St = Ge(Ce);
68
+ Ke(Ce);
69
+ const Lt = _;
70
+ function Fe() {
71
+ return globalThis.navigator?.language || "en";
72
72
  }
73
- function wt() {
73
+ function Mt() {
74
74
  try {
75
- const e = Re();
75
+ const e = Fe();
76
76
  try {
77
77
  const n = new Intl.Locale(e);
78
78
  if (n.region) return n.region.toUpperCase();
@@ -84,170 +84,160 @@ function wt() {
84
84
  }
85
85
  return null;
86
86
  }
87
- function Dt(e) {
88
- const t = Ct;
87
+ function Tt(e) {
88
+ const t = St;
89
89
  return e.toUpperCase() in t;
90
90
  }
91
- function vt(e, t) {
92
- const n = Be(t), r = e.toUpperCase();
91
+ function Et(e, t) {
92
+ const n = Ge(t), r = e.toUpperCase();
93
93
  return r in n ? { id: r, ...n[r] } : { id: "US", ...n.US };
94
94
  }
95
- function se(e, t) {
96
- return e && Dt(e) ? e.toUpperCase() : t || "";
95
+ function ie(e, t) {
96
+ return e && Tt(e) ? e.toUpperCase() : t || "";
97
97
  }
98
- function Ve(e) {
98
+ function Ue(e) {
99
99
  return Array.isArray(e) ? e : [e];
100
100
  }
101
- function ge(e) {
101
+ function ye(e) {
102
102
  return (e.match(/#/g) || []).length;
103
103
  }
104
- function fe(e) {
104
+ function ge(e) {
105
105
  return e.replace(/^\+\d+\s?/, "");
106
106
  }
107
- function Ge(e, t) {
107
+ function We(e, t) {
108
+ if (!e.length) return "";
108
109
  if (e.length === 1) return e[0];
109
- const n = e.map((o) => ({ mask: o, count: ge(o) })), r = n.filter((o) => o.count >= t).sort((o, a) => o.count - a.count);
110
+ const n = e.map((o) => ({ mask: o, count: ye(o) })), r = n.filter((o) => o.count >= t).sort((o, i) => o.count - i.count);
110
111
  if (r.length > 0) return r[0].mask;
111
- const s = n.sort((o, a) => a.count - o.count)[0];
112
+ const s = n.sort((o, i) => i.count - o.count)[0];
112
113
  return s ? s.mask : e[0];
113
114
  }
114
- function re(e, t) {
115
+ function se(e, t) {
115
116
  let n = "";
116
117
  const r = [];
117
118
  let s = 0;
118
- const o = t.length, a = e.length;
119
- for (let i = 0; i < a; i++) {
120
- const c = e[i];
121
- if (c === "#") {
119
+ const o = t.length, i = e.length;
120
+ for (let a = 0; a < i; a++) {
121
+ const f = e[a];
122
+ if (f === "#") {
122
123
  if (!(s < o)) break;
123
124
  n += t[s], r.push(s), s++;
124
125
  } else {
125
- const l = e.indexOf("#", i + 1) !== -1 && s < o;
126
- (n.length > 0 || l) && (n += c, r.push(-1));
126
+ const c = e.indexOf("#", a + 1) !== -1 && s < o;
127
+ (n.length > 0 || c) && (n += f, r.push(-1));
127
128
  }
128
129
  }
129
130
  return { display: n, map: r };
130
131
  }
131
- function Lt(e, t) {
132
+ function kt(e, t) {
132
133
  const n = t.trim().toUpperCase();
133
134
  if (!n) return e;
134
135
  const r = n.replace(/\D/g, ""), s = r.length > 0;
135
136
  return e.map((o) => {
136
- const a = o.name.toUpperCase(), i = o.id.toUpperCase(), c = o.code.toUpperCase(), l = o.code.replace(/\D/g, "");
137
+ const i = o.name.toUpperCase(), a = o.id.toUpperCase(), f = o.code.toUpperCase(), c = o.code.replace(/\D/g, "");
137
138
  let u = 0;
138
- return a.startsWith(n) ? u = 1e3 : a.includes(n) && (u = 500), c.startsWith(n) ? u += 100 : c.includes(n) && (u += 50), i === n ? u += 200 : i.startsWith(n) && (u += 150), s && l.startsWith(r) ? u += 80 : s && l.includes(r) && (u += 40), { country: o, score: u };
139
- }).filter((o) => o.score > 0).sort((o, a) => a.score !== o.score ? a.score - o.score : o.country.name.localeCompare(a.country.name)).map((o) => o.country);
139
+ return i.startsWith(n) ? u = 1e3 : i.includes(n) && (u = 500), f.startsWith(n) ? u += 100 : f.includes(n) && (u += 50), a === n ? u += 200 : a.startsWith(n) && (u += 150), s && c.startsWith(r) ? u += 80 : s && c.includes(r) && (u += 40), { country: o, score: u };
140
+ }).filter((o) => o.score > 0).sort((o, i) => i.score === o.score ? o.country.name.localeCompare(i.country.name) : i.score - o.score).map((o) => o.country);
141
+ }
142
+ const At = [" ", "-", "(", ")"], Nt = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "Tab"], Pt = /[^\d\s\-()]/;
143
+ function me(e, t, n) {
144
+ return { newDigits: e.slice(0, t) + e.slice(n), caretDigitIndex: t };
140
145
  }
141
- const St = [" ", "-", "(", ")"], Mt = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "Tab"], It = /[^\d\s\-()]/;
142
- function _(e, t) {
146
+ function He(e, t, n, r) {
147
+ if (n === r) return;
148
+ const s = t.getDigitRange(e, n, r);
149
+ if (!s) return;
150
+ const [o, i] = s;
151
+ return me(e, o, i);
152
+ }
153
+ function j(e, t) {
143
154
  const n = e.replace(/\D/g, "");
144
155
  return t ? n.slice(0, t) : n;
145
156
  }
146
- function Fe(e) {
157
+ function Oe(e) {
147
158
  return e ? [e.selectionStart ?? 0, e.selectionEnd ?? 0] : [0, 0];
148
159
  }
149
- function bt(e, t) {
160
+ function xt(e, t) {
150
161
  if (e) try {
151
162
  e.setSelectionRange(t, t);
152
163
  } catch {
153
164
  }
154
165
  }
155
- function Et(e) {
166
+ function Bt(e) {
156
167
  if (!e.target) return;
157
168
  const t = e.target, n = e.data;
158
- e.inputType === "insertText" && n && (It.test(n) || n === " " && t.value.endsWith(" ")) && e.preventDefault();
169
+ e.inputType === "insertText" && n && (Pt.test(n) || n === " " && t.value.endsWith(" ")) && e.preventDefault();
159
170
  }
160
- function kt(e, t) {
171
+ function Ht(e, t) {
161
172
  if (!e.target) return;
162
- const n = e.target, { formatter: r } = t, s = r.getMaxDigits(), o = _(n.value, s);
173
+ const n = e.target, { formatter: r } = t, s = r.getMaxDigits(), o = j(n.value, s);
163
174
  return { newDigits: o, caretDigitIndex: o.length };
164
175
  }
165
- function Tt(e, t) {
176
+ function Rt(e, t) {
166
177
  if (!e.target) return;
167
178
  const n = e.target, { digits: r, formatter: s } = t;
168
- if (e.ctrlKey || e.metaKey || e.altKey || Mt.includes(e.key)) return;
169
- const [o, a] = Fe(n);
170
- if (e.key !== "Backspace") if (e.key !== "Delete") /^[0-9]$/.test(e.key) ? r.length >= s.getMaxDigits() && e.preventDefault() : e.key.length === 1 && e.preventDefault();
171
- else {
172
- if (e.preventDefault(), o !== a) {
173
- const i = s.getDigitRange(r, o, a);
174
- if (i) {
175
- const [c, l] = i;
176
- return { newDigits: r.slice(0, c) + r.slice(l), caretDigitIndex: c };
177
- }
178
- }
179
- if (o < n.value.length) {
180
- const i = s.getDigitRange(r, o, n.value.length);
181
- if (i) {
182
- const [c] = i;
183
- return { newDigits: r.slice(0, c) + r.slice(c + 1), caretDigitIndex: c };
184
- }
185
- }
186
- }
187
- else {
188
- if (e.preventDefault(), o !== a) {
189
- const i = s.getDigitRange(r, o, a);
190
- if (i) {
191
- const [c, l] = i;
192
- return { newDigits: r.slice(0, c) + r.slice(l), caretDigitIndex: c };
193
- }
194
- }
195
- if (o > 0) {
196
- const i = n.value;
197
- let c = o - 1;
198
- for (; c >= 0 && St.includes(i[c]); ) c--;
199
- if (c >= 0) {
200
- const l = s.getDigitRange(r, c, c + 1);
201
- if (l) {
202
- const [u] = l;
203
- return { newDigits: r.slice(0, u) + r.slice(u + 1), caretDigitIndex: u };
204
- }
205
- }
206
- }
207
- }
208
- }
209
- function At(e, t) {
179
+ if ((function(c) {
180
+ return c.ctrlKey || c.metaKey || c.altKey || Nt.includes(c.key);
181
+ })(e)) return;
182
+ const [o, i] = Oe(n), a = n.value;
183
+ return e.key === "Backspace" ? (e.preventDefault(), He(r, s, o, i) ?? (function(c, u, l, d) {
184
+ if (d <= 0) return;
185
+ let p = d - 1;
186
+ for (; p >= 0 && At.includes(l[p]); ) p--;
187
+ if (p < 0) return;
188
+ const D = u.getDigitRange(c, p, p + 1);
189
+ if (!D) return;
190
+ const [v] = D;
191
+ return me(c, v, v + 1);
192
+ })(r, s, a, o)) : e.key === "Delete" ? (e.preventDefault(), He(r, s, o, i) ?? (function(c, u, l, d) {
193
+ if (d >= l.length) return;
194
+ const p = u.getDigitRange(c, d, l.length);
195
+ if (!p) return;
196
+ const [D] = p;
197
+ return me(c, D, D + 1);
198
+ })(r, s, a, o)) : void (/^\d$/.test(e.key) ? r.length >= s.getMaxDigits() && e.preventDefault() : e.key.length === 1 && e.preventDefault());
199
+ }
200
+ function Vt(e, t) {
210
201
  if (!e.target) return;
211
202
  e.preventDefault();
212
- const n = e.target, { digits: r, formatter: s } = t, o = e.clipboardData?.getData("text") || "", a = s.getMaxDigits(), i = _(o, a);
213
- if (i.length === 0) return;
214
- const [c, l] = Fe(n);
215
- if (c !== l) {
216
- const p = s.getDigitRange(r, c, l);
217
- if (p) {
218
- const [f, b] = p;
219
- return { newDigits: _(r.slice(0, f) + i + r.slice(b), a), caretDigitIndex: f + i.length };
203
+ const n = e.target, { digits: r, formatter: s } = t, o = e.clipboardData?.getData("text") || "", i = s.getMaxDigits(), a = j(o, i);
204
+ if (a.length === 0) return;
205
+ const [f, c] = Oe(n);
206
+ if (f !== c) {
207
+ const d = s.getDigitRange(r, f, c);
208
+ if (d) {
209
+ const [p, D] = d;
210
+ return { newDigits: j(r.slice(0, p) + a + r.slice(D), i), caretDigitIndex: p + a.length };
220
211
  }
221
212
  }
222
- const u = s.getDigitRange(r, 0, c), d = u ? u[1] : 0;
223
- return { newDigits: _(r.slice(0, d) + i + r.slice(d), a), caretDigitIndex: d + i.length };
213
+ const u = s.getDigitRange(r, 0, f), l = u ? u[1] : 0;
214
+ return { newDigits: j(r.slice(0, l) + a + r.slice(l), i), caretDigitIndex: l + a.length };
224
215
  }
225
- function Nt(e) {
226
- const t = Ve(e.mask), n = t.map((o) => ge(fe(o))), r = Math.max(...n), s = (o) => {
227
- const a = Ge(t, o);
228
- return fe(a);
216
+ function $t(e) {
217
+ const t = Ue(e.mask), n = t.map((o) => ye(ge(o))), r = Math.max(...n), s = (o) => {
218
+ const i = We(t, o);
219
+ return ge(i);
229
220
  };
230
221
  return { formatDisplay: (o) => {
231
- const a = s(o.length);
232
- return re(a, o).display;
222
+ const i = s(o.length);
223
+ return se(i, o).display;
233
224
  }, getMaxDigits: () => r, getPlaceholder: () => s(0), getCaretPosition: (o) => {
234
- const a = s(o), { display: i, map: c } = re(a, "0".repeat(o));
235
- for (let l = 0; l < c.length; l++) if (c[l] === o) return l;
236
- if (o >= c.length) return i.length;
237
- for (let l = 0; l < c.length; l++) if (c[l] > o) return l;
238
- return i.length;
239
- }, getDigitRange: (o, a, i) => {
240
- const c = s(o.length), { map: l } = re(c, o);
241
- let u = 1 / 0, d = -1 / 0;
242
- for (let p = a; p < i && p < l.length; p++) {
243
- const f = l[p];
244
- f !== void 0 && f >= 0 && (u = Math.min(u, f), d = Math.max(d, f));
225
+ const i = Math.max(0, o);
226
+ if (i === 0) return 0;
227
+ const a = s(i), { display: f } = se(a, "0".repeat(i));
228
+ return f.length;
229
+ }, getDigitRange: (o, i, a) => {
230
+ const f = s(o.length), { map: c } = se(f, o);
231
+ let u = 1 / 0, l = -1 / 0;
232
+ for (let d = i; d < a && d < c.length; d++) {
233
+ const p = c[d];
234
+ p !== void 0 && p >= 0 && (u = Math.min(u, p), l = Math.max(l, p));
245
235
  }
246
- return u === 1 / 0 ? null : [u, d + 1];
236
+ return u === 1 / 0 ? null : [u, l + 1];
247
237
  }, isComplete: (o) => n.includes(o.length) };
248
238
  }
249
- const Pt = "https://ipapi.co/json/", xt = 1500, pe = "@desource/phone-mask:geo", Bt = 864e5;
250
- async function Ht(e = Pt, t = xt) {
239
+ const Gt = "https://ipapi.co/json/", Kt = 1500, he = "@desource/phone-mask:geo", Ft = 864e5;
240
+ async function Ut(e = Gt, t = Kt) {
251
241
  const n = new AbortController(), r = setTimeout(() => n.abort(), t);
252
242
  try {
253
243
  const s = await fetch(e, { signal: n.signal, headers: { Accept: "application/json" } });
@@ -258,77 +248,77 @@ async function Ht(e = Pt, t = xt) {
258
248
  return clearTimeout(r), null;
259
249
  }
260
250
  }
261
- async function Rt() {
251
+ async function Wt() {
262
252
  try {
263
- const n = localStorage.getItem(pe);
253
+ const n = localStorage.getItem(he);
264
254
  if (n) {
265
- const r = JSON.parse(n), s = Date.now() - r.ts > Bt, o = se(r.country_code);
255
+ const r = JSON.parse(n), s = Date.now() - r.ts > Ft, o = ie(r.country_code);
266
256
  if (o && !s) return o;
267
- localStorage.removeItem(pe);
257
+ localStorage.removeItem(he);
268
258
  }
269
259
  } catch {
270
260
  }
271
- const e = await Ht(), t = se(e);
261
+ const e = await Ut(), t = ie(e);
272
262
  if (t) {
273
263
  try {
274
264
  const n = JSON.stringify({ country_code: t, ts: Date.now() });
275
- localStorage.setItem(pe, n);
265
+ localStorage.setItem(he, n);
276
266
  } catch {
277
267
  }
278
268
  return t;
279
269
  }
280
270
  return null;
281
271
  }
282
- function Ke({
272
+ function Ze({
283
273
  country: e,
284
274
  value: t,
285
275
  onChange: n,
286
276
  onPhoneChange: r,
287
277
  onValidationChange: s
288
278
  }) {
289
- const o = I(() => Nt(e), [e]), a = o.getMaxDigits(), i = I(() => _(t, a), [t, a]), c = o.getPlaceholder(), l = o.formatDisplay(i), u = i ? `${e.code}${i}` : "", d = l ? `${e.code} ${l}` : "", p = o.isComplete(i), f = i.length === 0, b = !f && !p, L = I(() => ({ full: u, fullFormatted: d, digits: i }), [u, d, i]);
290
- return v(() => {
291
- t !== i && n(i);
292
- }, [t, i, n]), v(() => {
293
- r?.(L);
294
- }, [L, r]), v(() => {
295
- s?.(p);
296
- }, [p, s]), {
297
- digits: i,
279
+ const o = M(() => $t(e), [e]), i = o.getMaxDigits(), a = M(() => j(t, i), [t, i]), f = o.getPlaceholder(), c = o.formatDisplay(a), u = a ? `${e.code}${a}` : "", l = c ? `${e.code} ${c}` : "", d = o.isComplete(a), p = a.length === 0, D = !p && !d, v = M(() => ({ full: u, fullFormatted: l, digits: a }), [u, l, a]);
280
+ return I(() => {
281
+ t !== a && n(a);
282
+ }, [t, a, n]), I(() => {
283
+ r?.(v);
284
+ }, [v, r]), I(() => {
285
+ s?.(d);
286
+ }, [d, s]), {
287
+ digits: a,
298
288
  formatter: o,
299
- displayPlaceholder: c,
300
- displayValue: l,
289
+ displayPlaceholder: f,
290
+ displayValue: c,
301
291
  full: u,
302
- fullFormatted: d,
303
- isComplete: p,
304
- isEmpty: f,
305
- shouldShowWarn: b
292
+ fullFormatted: l,
293
+ isComplete: d,
294
+ isEmpty: p,
295
+ shouldShowWarn: D
306
296
  };
307
297
  }
308
- function Ue({
298
+ function Ye({
309
299
  country: e,
310
300
  locale: t,
311
301
  detect: n,
312
302
  onCountryChange: r
313
303
  }) {
314
- const s = I(() => t || Re(), [t]), [o, a] = T(se(e, "US")), i = I(() => vt(o, s), [o, s]), c = !!n && !e, l = h((d) => {
315
- const p = se(d);
316
- return p ? (a(p), !0) : !1;
304
+ const s = M(() => t || Fe(), [t]), [o, i] = k(ie(e, "US")), a = M(() => Et(o, s), [o, s]), f = !!n && !e, c = h((l) => {
305
+ const d = ie(l);
306
+ return d ? (i(d), !0) : !1;
317
307
  }, []), u = h(async () => {
318
- const d = await Rt();
319
- if (l(d)) return;
320
- const p = wt();
321
- l(p);
322
- }, [l]);
323
- return v(() => {
324
- e && e !== o && l(e);
325
- }, [o, e, l]), v(() => {
326
- c && u();
327
- }, [c, u]), v(() => {
328
- r?.(i);
329
- }, [i, r]), { country: i, setCountry: l, locale: s };
330
- }
331
- function me() {
308
+ const l = await Wt();
309
+ if (c(l)) return;
310
+ const d = Mt();
311
+ c(d);
312
+ }, [c]);
313
+ return I(() => {
314
+ e && e !== o && c(e);
315
+ }, [o, e, c]), I(() => {
316
+ f && u();
317
+ }, [f, u]), I(() => {
318
+ r?.(a);
319
+ }, [a, r]), { country: a, setCountry: c, locale: s };
320
+ }
321
+ function De() {
332
322
  const e = R(null), t = h(() => {
333
323
  e.current && (clearTimeout(e.current), e.current = null);
334
324
  }, []), n = h(
@@ -337,10 +327,10 @@ function me() {
337
327
  },
338
328
  [t]
339
329
  );
340
- return v(() => t, [t]), I(() => ({ set: n, clear: t }), [n, t]);
330
+ return I(() => t, [t]), M(() => ({ set: n, clear: t }), [n, t]);
341
331
  }
342
- function Vt() {
343
- const [e, t] = T(!1), n = me(), r = h(
332
+ function Ot() {
333
+ const [e, t] = k(!1), n = De(), r = h(
344
334
  (o = !0) => {
345
335
  o && t(!1), n.clear();
346
336
  },
@@ -355,91 +345,91 @@ function Vt() {
355
345
  );
356
346
  return { showValidationHint: e, clearValidationHint: r, scheduleValidationHint: s };
357
347
  }
358
- function oe(e) {
348
+ function re(e) {
359
349
  return "nativeEvent" in e ? e.nativeEvent : e;
360
350
  }
361
- const Gt = 500, Ne = 300;
362
- function $e(e) {
363
- const { formatter: t, digits: n, inactive: r, onChange: s, scheduleValidationHint: o } = e, a = h(
364
- (d, p) => {
351
+ const Zt = 500, Re = 300;
352
+ function Je(e) {
353
+ const { formatter: t, digits: n, inactive: r, onChange: s, scheduleValidationHint: o } = e, i = h(
354
+ (l, d) => {
365
355
  setTimeout(() => {
366
- if (!d) return;
367
- const f = t.getCaretPosition(p);
368
- bt(d, f);
356
+ if (!l) return;
357
+ const p = t.getCaretPosition(d);
358
+ xt(l, p);
369
359
  }, 0);
370
360
  },
371
361
  [t]
372
- ), i = h((d) => {
373
- Et(oe(d));
374
- }, []), c = h(
375
- (d) => {
362
+ ), a = h((l) => {
363
+ Bt(re(l));
364
+ }, []), f = h(
365
+ (l) => {
376
366
  if (r) return;
377
- const p = oe(d), f = kt(p, { formatter: t });
378
- f && (s?.(f.newDigits), a(p.target, f.caretDigitIndex), o?.(Gt));
367
+ const d = re(l), p = Ht(d, { formatter: t });
368
+ p && (s?.(p.newDigits), i(d.target, p.caretDigitIndex), o?.(Zt));
379
369
  },
380
- [r, t, s, a, o]
381
- ), l = h(
382
- (d) => {
370
+ [r, t, s, i, o]
371
+ ), c = h(
372
+ (l) => {
383
373
  if (r) return;
384
- const p = oe(d), f = Tt(p, { digits: n, formatter: t });
385
- f && (s?.(f.newDigits), a(p.target, f.caretDigitIndex), o?.(Ne));
374
+ const d = re(l), p = Rt(d, { digits: n, formatter: t });
375
+ p && (s?.(p.newDigits), i(d.target, p.caretDigitIndex), o?.(Re));
386
376
  },
387
- [r, n, t, s, a, o]
377
+ [r, n, t, s, i, o]
388
378
  ), u = h(
389
- (d) => {
379
+ (l) => {
390
380
  if (r) return;
391
- const p = oe(d), f = At(p, { digits: n, formatter: t });
392
- f && (s?.(f.newDigits), a(p.target, f.caretDigitIndex), o?.(Ne));
381
+ const d = re(l), p = Vt(d, { digits: n, formatter: t });
382
+ p && (s?.(p.newDigits), i(d.target, p.caretDigitIndex), o?.(Re));
393
383
  },
394
- [r, n, t, s, a, o]
384
+ [r, n, t, s, i, o]
395
385
  );
396
386
  return {
397
- handleBeforeInput: i,
398
- handleInput: c,
399
- handleKeydown: l,
387
+ handleBeforeInput: a,
388
+ handleInput: f,
389
+ handleKeydown: c,
400
390
  handlePaste: u
401
391
  };
402
392
  }
403
- function Ft({
393
+ function Yt({
404
394
  rootRef: e,
405
395
  dropdownRef: t,
406
396
  searchRef: n,
407
397
  selectorRef: r,
408
398
  locale: s,
409
399
  countryOption: o,
410
- inactive: a,
411
- onSelectCountry: i,
412
- onAfterSelect: c
400
+ inactive: i,
401
+ onSelectCountry: a,
402
+ onAfterSelect: f
413
403
  }) {
414
- const [l, u] = T(""), [d, p] = T(!1), [f, b] = T({}), [L, N] = T(!1), [P, g] = T(0), A = I(() => He(s), [s]), E = I(() => Lt(A, l), [A, l]), k = I(() => !o && A.length > 1, [o, A]), x = h(() => {
404
+ const [c, u] = k(""), [l, d] = k(!1), [p, D] = k({}), [v, N] = k(!1), [P, g] = k(0), A = M(() => Ke(s), [s]), T = M(() => kt(A, c), [A, c]), E = M(() => !o && A.length > 1, [o, A]), x = h(() => {
415
405
  setTimeout(() => n.current?.focus({ preventScroll: !0 }), 0);
416
- }, []), D = h(() => {
417
- d && N(!0);
418
- }, [d]), W = h(() => {
419
- N(!1), p(!0), g(0), x();
420
- }, [x]), X = h(() => {
421
- L && (p(!1), N(!1));
422
- }, [L]), Z = h(() => {
423
- a || !k || (d ? D() : W());
424
- }, [a, d, k, W, D]), B = h(
406
+ }, []), b = h(() => {
407
+ l && N(!0);
408
+ }, [l]), W = h(() => {
409
+ N(!1), d(!0), g(0), x();
410
+ }, [x]), z = h(() => {
411
+ v && (d(!1), N(!1));
412
+ }, [v]), X = h(() => {
413
+ i || !E || (l ? b() : W());
414
+ }, [i, l, E, W, b]), B = h(
425
415
  (m) => {
426
- i(m), D(), u(""), g(0), c?.();
416
+ a(m), b(), u(""), g(0), f?.();
427
417
  },
428
- [i, D, c]
418
+ [a, b, f]
429
419
  ), Q = h((m) => {
430
420
  u(m.target.value), g(0);
431
- }, []), U = h(
421
+ }, []), F = h(
432
422
  (m) => {
433
423
  const y = m.target, S = t.current, H = r.current;
434
- y && (S?.contains(y) || H?.contains(y) || D());
424
+ y && (S?.contains(y) || H?.contains(y) || b());
435
425
  },
436
- [D]
426
+ [b]
437
427
  ), w = h((m) => {
438
428
  if (m?.type === "scroll" && m.target && t.current?.contains(m.target) || !e?.current) return;
439
429
  const y = e.current.getBoundingClientRect();
440
- b({
441
- top: `${y.bottom + window.scrollY + 8}px`,
442
- left: `${y.left + window.scrollX}px`,
430
+ D({
431
+ top: `${y.bottom + globalThis.scrollY + 8}px`,
432
+ left: `${y.left + globalThis.scrollX}px`,
443
433
  width: `${y.width}px`
444
434
  });
445
435
  }, []), O = h((m) => {
@@ -447,267 +437,266 @@ function Ft({
447
437
  const y = t.current?.lastElementChild, S = y?.children[m];
448
438
  if (!y || !S) return;
449
439
  const H = y.getBoundingClientRect(), V = S.getBoundingClientRect();
450
- let G = 0;
440
+ let $ = 0;
451
441
  if (V.top < H.top)
452
- G = y.scrollTop - (H.top - V.top);
442
+ $ = y.scrollTop - (H.top - V.top);
453
443
  else if (V.bottom > H.bottom)
454
- G = y.scrollTop + (V.bottom - H.bottom);
444
+ $ = y.scrollTop + (V.bottom - H.bottom);
455
445
  else
456
446
  return;
457
- y.scrollTo({ top: G, behavior: "smooth" });
447
+ y.scrollTo({ top: $, behavior: "smooth" });
458
448
  }, 0);
459
- }, []), ie = h(
449
+ }, []), ae = h(
460
450
  (m) => {
461
451
  m.key === "ArrowDown" ? (m.preventDefault(), g((y) => {
462
- const S = Math.min(y + 1, E.length - 1);
452
+ const S = Math.min(y + 1, T.length - 1);
463
453
  return O(S), S;
464
454
  })) : m.key === "ArrowUp" ? (m.preventDefault(), g((y) => {
465
455
  const S = Math.max(y - 1, 0);
466
456
  return O(S), S;
467
- })) : m.key === "Enter" && E[P] ? (m.preventDefault(), B(E[P].id)) : m.key === "Escape" && D();
457
+ })) : m.key === "Enter" && T[P] ? (m.preventDefault(), B(T[P].id)) : m.key === "Escape" && b();
468
458
  },
469
- [E, P, B, D, O]
459
+ [T, P, B, b, O]
470
460
  );
471
- return v(() => {
472
- !k && d && D();
473
- }, [k, d, D]), v(() => {
474
- if (d)
475
- return w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), window.addEventListener("click", U, !0), () => {
476
- window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), window.removeEventListener("click", U, !0);
461
+ return I(() => {
462
+ !E && l && b();
463
+ }, [E, l, b]), I(() => {
464
+ if (l)
465
+ return w(), globalThis.addEventListener("resize", w), globalThis.addEventListener("scroll", w, !0), globalThis.addEventListener("click", F, !0), () => {
466
+ globalThis.removeEventListener("resize", w), globalThis.removeEventListener("scroll", w, !0), globalThis.removeEventListener("click", F, !0);
477
467
  };
478
- }, [d, w, U]), {
468
+ }, [l, w, F]), {
479
469
  // State
480
- dropdownOpen: d,
481
- isClosing: L,
482
- search: l,
470
+ dropdownOpen: l,
471
+ isClosing: v,
472
+ search: c,
483
473
  focusedIndex: P,
484
- dropdownStyle: f,
474
+ dropdownStyle: p,
485
475
  // Derived
486
- filteredCountries: E,
487
- hasDropdown: k,
476
+ filteredCountries: T,
477
+ hasDropdown: E,
488
478
  // Actions
489
479
  openDropdown: W,
490
- closeDropdown: D,
491
- toggleDropdown: Z,
480
+ closeDropdown: b,
481
+ toggleDropdown: X,
492
482
  selectCountry: B,
493
483
  setFocusedIndex: g,
494
484
  handleSearchChange: Q,
495
- handleSearchKeydown: ie,
496
- handleDropdownAnimationEnd: X
485
+ handleSearchKeydown: ae,
486
+ handleDropdownAnimationEnd: z
497
487
  };
498
488
  }
499
- function Kt(e = 1800) {
500
- const [t, n] = T(!1), [r, s] = T(!1), o = me(), a = h(
501
- async (i) => {
489
+ function Jt(e = 1800) {
490
+ const [t, n] = k(!1), [r, s] = k(!1), o = De(), i = h(
491
+ async (a) => {
502
492
  if (r) return !1;
503
- const c = i.trim();
504
- if (!c) return !1;
493
+ const f = a.trim();
494
+ if (!f) return !1;
505
495
  s(!0);
506
496
  try {
507
- return await navigator.clipboard.writeText(c), n(!0), o.set(() => {
497
+ return await navigator.clipboard.writeText(f), n(!0), o.set(() => {
508
498
  n(!1);
509
499
  }, e), !0;
510
- } catch (l) {
511
- return console.warn("Copy failed", l), !1;
500
+ } catch (c) {
501
+ return console.warn("Copy failed", c), !1;
512
502
  } finally {
513
503
  s(!1);
514
504
  }
515
505
  },
516
506
  [r, o]
517
507
  );
518
- return { copied: t, isCopying: r, copy: a };
508
+ return { copied: t, isCopying: r, copy: i };
519
509
  }
520
- const Pe = 1800;
521
- function Ut({ liveRef: e, fullFormatted: t, onCopy: n }) {
522
- const r = me(), { copied: s, copy: o } = Kt(Pe), a = I(() => s ? "Copied" : `Copy ${t}`, [s, t]), i = I(() => s ? "Copied" : "Copy phone number", [s]), c = h(
510
+ const Ve = 1800;
511
+ function jt({ liveRef: e, fullFormatted: t, onCopy: n }) {
512
+ const r = De(), { copied: s, copy: o } = Jt(Ve), i = M(() => s ? "Copied" : `Copy ${t}`, [s, t]), a = M(() => s ? "Copied" : "Copy phone number", [s]), f = h(
523
513
  (u) => {
524
514
  e?.current && (e.current.textContent = u, r.set(() => {
525
515
  e.current && (e.current.textContent = "");
526
- }, Pe));
516
+ }, Ve));
527
517
  },
528
518
  [e, r]
529
- ), l = h(async () => {
519
+ ), c = h(async () => {
530
520
  const u = t.trim();
531
- await o(u) && (n?.(u), c("Phone number copied to clipboard"));
532
- }, [t, o, n, c]);
521
+ await o(u) && (n?.(u), f("Phone number copied to clipboard"));
522
+ }, [t, o, n, f]);
533
523
  return {
534
524
  copied: s,
535
- copyAriaLabel: a,
536
- copyButtonTitle: i,
537
- onCopyClick: l
525
+ copyAriaLabel: i,
526
+ copyButtonTitle: a,
527
+ onCopyClick: c
538
528
  };
539
529
  }
540
- function $t({ theme: e }) {
541
- const [t, n] = T(!1), r = I(() => e !== "auto" ? `theme-${e}` : t ? "theme-dark" : "theme-light", [e, t]);
542
- return v(() => {
543
- if (typeof window > "u") return;
544
- const s = window.matchMedia?.("(prefers-color-scheme: dark)") ?? null;
530
+ function _t({ theme: e }) {
531
+ const [t, n] = k(!1), r = M(() => e === "auto" ? t ? "theme-dark" : "theme-light" : `theme-${e}`, [e, t]);
532
+ return I(() => {
533
+ const s = globalThis.matchMedia?.("(prefers-color-scheme: dark)") ?? null;
545
534
  if (!s) return;
546
535
  n(s.matches);
547
- const o = (a) => {
548
- n(a.matches);
536
+ const o = (i) => {
537
+ n(i.matches);
549
538
  };
550
539
  return s.addEventListener("change", o), () => s.removeEventListener("change", o);
551
540
  }, []), {
552
541
  themeClass: r
553
542
  };
554
543
  }
555
- const Wt = (e, t) => {
544
+ const zt = (e, t) => {
556
545
  const {
557
546
  value: n = "",
558
547
  country: r,
559
548
  detect: s = !0,
560
549
  locale: o,
561
- size: a = "normal",
562
- theme: i = "auto",
563
- disabled: c = !1,
564
- readonly: l = !1,
550
+ size: i = "normal",
551
+ theme: a = "auto",
552
+ disabled: f = !1,
553
+ readonly: c = !1,
565
554
  showCopy: u = !0,
566
- showClear: d = !1,
567
- withValidity: p = !0,
568
- searchPlaceholder: f = "Search country or code...",
569
- noResultsText: b = "No countries found",
570
- clearButtonLabel: L = "Clear phone number",
555
+ showClear: l = !1,
556
+ withValidity: d = !0,
557
+ searchPlaceholder: p = "Search country or code...",
558
+ noResultsText: D = "No countries found",
559
+ clearButtonLabel: v = "Clear phone number",
571
560
  dropdownClass: N = "",
572
561
  disableDefaultStyles: P = !1,
573
562
  onChange: g,
574
563
  onPhoneChange: A,
575
- onCountryChange: E,
576
- onValidationChange: k,
564
+ onCountryChange: T,
565
+ onValidationChange: E,
577
566
  onFocus: x,
578
- onBlur: D,
567
+ onBlur: b,
579
568
  onCopy: W,
580
- onClear: X,
581
- renderActionsBefore: Z,
569
+ onClear: z,
570
+ renderActionsBefore: X,
582
571
  renderFlag: B,
583
572
  renderCopySvg: Q,
584
- renderClearSvg: U
585
- } = e, { country: w, setCountry: O, locale: ie } = Ue({
573
+ renderClearSvg: F
574
+ } = e, { country: w, setCountry: O, locale: ae } = Ye({
586
575
  country: r,
587
576
  locale: o,
588
577
  detect: s,
589
- onCountryChange: E
578
+ onCountryChange: T
590
579
  }), {
591
580
  digits: m,
592
581
  formatter: y,
593
582
  displayPlaceholder: S,
594
583
  displayValue: H,
595
584
  full: V,
596
- fullFormatted: G,
585
+ fullFormatted: $,
597
586
  isComplete: q,
598
- isEmpty: Ce,
599
- shouldShowWarn: We
600
- } = Ke({
587
+ isEmpty: ve,
588
+ shouldShowWarn: je
589
+ } = Ze({
601
590
  country: w,
602
591
  value: n,
603
592
  onChange: g,
604
593
  onPhoneChange: A,
605
- onValidationChange: k
606
- }), { showValidationHint: Ze, clearValidationHint: ee, scheduleValidationHint: Oe } = Vt(), ae = R(null), ye = R(null), we = R(null), De = R(null), ve = R(null), Le = R(null), Y = c || l, Se = Ze && We, Me = u && !Ce && !c, Ie = d && !Ce && !Y, {
607
- copied: ce,
608
- copyAriaLabel: Ye,
609
- copyButtonTitle: Je,
610
- onCopyClick: je
611
- } = Ut({
612
- liveRef: we,
613
- fullFormatted: G,
594
+ onValidationChange: E
595
+ }), { showValidationHint: _e, clearValidationHint: ee, scheduleValidationHint: ze } = Ot(), we = Dt(), ce = R(null), be = R(null), Ie = R(null), Se = R(null), Le = R(null), Me = R(null), Z = f || c, Te = _e && je, Ee = u && !ve && !f, ke = l && !ve && !Z, {
596
+ copied: le,
597
+ copyAriaLabel: Xe,
598
+ copyButtonTitle: Qe,
599
+ onCopyClick: qe
600
+ } = jt({
601
+ liveRef: Ie,
602
+ fullFormatted: $,
614
603
  onCopy: W
615
- }), J = h(() => {
616
- setTimeout(() => ae.current?.focus(), 0);
617
- }, []), { handleBeforeInput: _e, handleInput: ze, handleKeydown: Xe, handlePaste: Qe } = $e({
604
+ }), Y = h(() => {
605
+ setTimeout(() => ce.current?.focus(), 0);
606
+ }, []), { handleBeforeInput: et, handleInput: tt, handleKeydown: nt, handlePaste: ot } = Je({
618
607
  formatter: y,
619
608
  digits: m,
620
- inactive: Y,
609
+ inactive: Z,
621
610
  onChange: g,
622
- scheduleValidationHint: Oe
611
+ scheduleValidationHint: ze
623
612
  }), {
624
- dropdownOpen: le,
625
- isClosing: qe,
626
- search: et,
627
- focusedIndex: be,
628
- dropdownStyle: tt,
629
- filteredCountries: Ee,
630
- hasDropdown: te,
631
- closeDropdown: ke,
632
- toggleDropdown: nt,
633
- selectCountry: ue,
634
- setFocusedIndex: ot,
635
- handleSearchChange: rt,
636
- handleSearchKeydown: st,
637
- handleDropdownAnimationEnd: it
638
- } = Ft({
639
- rootRef: ye,
640
- dropdownRef: De,
641
- searchRef: ve,
642
- selectorRef: Le,
643
- locale: ie,
644
- inactive: Y,
613
+ dropdownOpen: te,
614
+ isClosing: rt,
615
+ search: st,
616
+ focusedIndex: ue,
617
+ dropdownStyle: it,
618
+ filteredCountries: de,
619
+ hasDropdown: ne,
620
+ closeDropdown: Ae,
621
+ toggleDropdown: at,
622
+ selectCountry: pe,
623
+ setFocusedIndex: ct,
624
+ handleSearchChange: lt,
625
+ handleSearchKeydown: ut,
626
+ handleDropdownAnimationEnd: dt
627
+ } = Yt({
628
+ rootRef: be,
629
+ dropdownRef: Se,
630
+ searchRef: Le,
631
+ selectorRef: Me,
632
+ locale: ae,
633
+ inactive: Z,
645
634
  countryOption: r,
646
635
  onSelectCountry: O,
647
- onAfterSelect: J
648
- }), at = h(
649
- (M) => {
650
- ee(!1), ke(), x?.(M);
636
+ onAfterSelect: Y
637
+ }), pt = h(
638
+ (L) => {
639
+ ee(!1), Ae(), x?.(L);
651
640
  },
652
- [x, ke, ee]
653
- ), ne = h(() => {
654
- g?.(""), ee(), X?.();
655
- }, [g, X, ee]), ct = h(() => {
656
- ne(), J();
657
- }, [ne, J]);
658
- ft(
641
+ [x, Ae, ee]
642
+ ), oe = h(() => {
643
+ g?.(""), ee(), z?.();
644
+ }, [g, z, ee]), ft = h(() => {
645
+ oe(), Y();
646
+ }, [oe, Y]);
647
+ vt(
659
648
  t,
660
649
  () => ({
661
- focus: J,
662
- blur: () => ae.current?.blur(),
663
- clear: ne,
664
- selectCountry: ue,
650
+ focus: Y,
651
+ blur: () => ce.current?.blur(),
652
+ clear: oe,
653
+ selectCountry: pe,
665
654
  getFullNumber: () => V,
666
- getFullFormattedNumber: () => G,
655
+ getFullFormattedNumber: () => $,
667
656
  getDigits: () => m,
668
657
  isValid: () => q,
669
658
  isComplete: () => q
670
659
  }),
671
- [J, ue, V, G, m, q, ne]
660
+ [Y, pe, V, $, m, q, oe]
672
661
  );
673
- const { themeClass: Te } = $t({ theme: i }), lt = [
662
+ const { themeClass: Ne } = _t({ theme: a }), ht = [
674
663
  "phone-input",
675
- `size-${a}`,
676
- Te,
677
- c && "is-disabled",
678
- l && "is-readonly",
664
+ `size-${i}`,
665
+ Ne,
666
+ f && "is-disabled",
667
+ c && "is-readonly",
679
668
  P && "is-unstyled",
680
- p && Se && "is-incomplete",
681
- p && q && "is-complete"
682
- ].filter(Boolean).join(" "), ut = +Me + +Ie + (Z ? 1 : 0);
683
- return /* @__PURE__ */ F(dt, { children: [
684
- /* @__PURE__ */ F(
669
+ d && Te && "is-incomplete",
670
+ d && q && "is-complete"
671
+ ].filter(Boolean).join(" "), gt = +Ee + +ke + (X ? 1 : 0), Pe = `pi-options-${we}`, xe = `pi-option-${we}`, mt = te && de[ue] ? `${xe}-${ue}` : void 0;
672
+ return /* @__PURE__ */ G(Ct, { children: [
673
+ /* @__PURE__ */ G(
685
674
  "div",
686
675
  {
687
- ref: ye,
688
- className: lt,
689
- style: { "--pi-actions-count": ut },
676
+ ref: be,
677
+ className: ht,
678
+ style: { "--pi-actions-count": gt },
690
679
  role: "group",
691
680
  "aria-label": "Phone input with country selector",
692
681
  children: [
693
- /* @__PURE__ */ C("div", { className: "pi-selector", ref: Le, children: /* @__PURE__ */ F(
682
+ /* @__PURE__ */ C("div", { className: "pi-selector", ref: Me, children: /* @__PURE__ */ G(
694
683
  "button",
695
684
  {
696
685
  type: "button",
697
- className: `pi-selector-btn ${!te || l ? "no-dropdown" : ""}`,
698
- disabled: c,
699
- tabIndex: Y || !te ? -1 : void 0,
686
+ className: `pi-selector-btn ${!ne || c ? "no-dropdown" : ""}`,
687
+ disabled: f,
688
+ tabIndex: Z || !ne ? -1 : void 0,
700
689
  "aria-label": `Selected country: ${w.name}`,
701
- "aria-expanded": le,
702
- "aria-haspopup": te ? "listbox" : void 0,
703
- onClick: nt,
690
+ "aria-expanded": te,
691
+ "aria-haspopup": ne ? "listbox" : void 0,
692
+ onClick: at,
704
693
  children: [
705
694
  /* @__PURE__ */ C("span", { className: "pi-flag", role: "img", "aria-label": `${w.name} flag`, children: B ? B(w) : w.flag }),
706
695
  /* @__PURE__ */ C("span", { className: "pi-code", children: w.code }),
707
- !Y && te && /* @__PURE__ */ C(
696
+ !Z && ne && /* @__PURE__ */ C(
708
697
  "svg",
709
698
  {
710
- className: `pi-chevron ${le ? "is-open" : ""}`,
699
+ className: `pi-chevron ${te ? "is-open" : ""}`,
711
700
  width: "12",
712
701
  height: "12",
713
702
  viewBox: "0 0 12 12",
@@ -728,11 +717,11 @@ const Wt = (e, t) => {
728
717
  ]
729
718
  }
730
719
  ) }),
731
- /* @__PURE__ */ F("div", { className: "pi-input-wrap", children: [
720
+ /* @__PURE__ */ G("div", { className: "pi-input-wrap", children: [
732
721
  /* @__PURE__ */ C(
733
722
  "input",
734
723
  {
735
- ref: ae,
724
+ ref: ce,
736
725
  type: "tel",
737
726
  inputMode: "tel",
738
727
  autoComplete: "tel-national",
@@ -742,28 +731,28 @@ const Wt = (e, t) => {
742
731
  className: "pi-input",
743
732
  placeholder: S,
744
733
  value: H,
745
- disabled: c,
746
- readOnly: l,
747
- "aria-invalid": Se,
748
- onInput: ze,
749
- onBeforeInput: _e,
750
- onKeyDown: Xe,
751
- onPaste: Qe,
752
- onFocus: at,
753
- onBlur: D
734
+ disabled: f,
735
+ readOnly: c,
736
+ "aria-invalid": Te,
737
+ onInput: tt,
738
+ onBeforeInput: et,
739
+ onKeyDown: nt,
740
+ onPaste: ot,
741
+ onFocus: pt,
742
+ onBlur: b
754
743
  }
755
744
  ),
756
- /* @__PURE__ */ F("div", { className: "pi-actions", role: "toolbar", "aria-label": "Phone input actions", children: [
757
- Z && Z(),
758
- Me && /* @__PURE__ */ C(
745
+ /* @__PURE__ */ G("div", { className: "pi-actions", role: "toolbar", "aria-label": "Phone input actions", children: [
746
+ X?.(),
747
+ Ee && /* @__PURE__ */ C(
759
748
  "button",
760
749
  {
761
750
  type: "button",
762
- className: `pi-btn pi-btn-copy ${ce ? "is-copied" : ""}`,
763
- "aria-label": Ye,
764
- title: Je,
765
- onClick: je,
766
- children: Q ? Q(ce) : ce ? /* @__PURE__ */ C("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ C("path", { d: "M6.5 11.5L3 8L4.06 6.94L6.5 9.38L11.94 3.94L13 5L6.5 11.5Z", fill: "currentColor" }) }) : /* @__PURE__ */ C("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ C(
751
+ className: `pi-btn pi-btn-copy ${le ? "is-copied" : ""}`,
752
+ "aria-label": Xe,
753
+ title: Qe,
754
+ onClick: qe,
755
+ children: Q ? Q(le) : le ? /* @__PURE__ */ C("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ C("path", { d: "M6.5 11.5L3 8L4.06 6.94L6.5 9.38L11.94 3.94L13 5L6.5 11.5Z", fill: "currentColor" }) }) : /* @__PURE__ */ C("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ C(
767
756
  "path",
768
757
  {
769
758
  d: "M13.5 5.5V13.5H5.5V5.5H13.5ZM13.5 4H5.5C4.67 4 4 4.67 4 5.5V13.5C4 14.33 4.67 15 5.5 15H13.5C14.33 15 15 14.33 15 13.5V5.5C15 4.67 14.33 4 13.5 4ZM10.5 1H2.5V11H4V2.5H10.5V1Z",
@@ -772,15 +761,15 @@ const Wt = (e, t) => {
772
761
  ) })
773
762
  }
774
763
  ),
775
- Ie && /* @__PURE__ */ C(
764
+ ke && /* @__PURE__ */ C(
776
765
  "button",
777
766
  {
778
767
  type: "button",
779
768
  className: "pi-btn pi-btn-clear",
780
- "aria-label": L,
781
- title: L,
782
- onClick: ct,
783
- children: U ? U() : /* @__PURE__ */ C("svg", { width: "11", height: "11", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ C(
769
+ "aria-label": v,
770
+ title: v,
771
+ onClick: ft,
772
+ children: F ? F() : /* @__PURE__ */ C("svg", { width: "11", height: "11", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ C(
784
773
  "path",
785
774
  {
786
775
  d: "M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z",
@@ -794,60 +783,62 @@ const Wt = (e, t) => {
794
783
  ]
795
784
  }
796
785
  ),
797
- le && typeof document < "u" && ht(
798
- /* @__PURE__ */ F(
786
+ te && typeof document < "u" && wt(
787
+ /* @__PURE__ */ G(
799
788
  "div",
800
789
  {
801
- ref: De,
802
- className: `phone-dropdown ${N} ${Te} ${qe ? "is-closing" : ""}`,
803
- style: tt,
790
+ ref: Se,
791
+ className: `phone-dropdown ${N} ${Ne} ${rt ? "is-closing" : ""}`,
792
+ style: it,
804
793
  role: "dialog",
805
794
  "aria-modal": "false",
806
795
  "aria-label": "Select country",
807
- onAnimationEnd: it,
796
+ onAnimationEnd: dt,
808
797
  children: [
809
798
  /* @__PURE__ */ C("div", { className: "pi-search-wrap", children: /* @__PURE__ */ C(
810
799
  "input",
811
800
  {
812
- ref: ve,
801
+ ref: Le,
813
802
  type: "search",
814
803
  className: "pi-search",
815
804
  "aria-label": "Search countries",
816
- placeholder: f,
817
- value: et,
818
- onChange: rt,
819
- onKeyDown: st
805
+ "aria-controls": Pe,
806
+ "aria-activedescendant": mt,
807
+ placeholder: p,
808
+ value: st,
809
+ onChange: lt,
810
+ onKeyDown: ut
820
811
  }
821
812
  ) }),
822
- /* @__PURE__ */ C("ul", { className: "pi-options", role: "listbox", "aria-activedescendant": `option-${be}`, tabIndex: -1, children: Ee.length > 0 ? Ee.map((M, de) => /* @__PURE__ */ F(
813
+ /* @__PURE__ */ C("ul", { id: Pe, className: "pi-options", role: "listbox", tabIndex: -1, children: de.length > 0 ? de.map((L, fe) => /* @__PURE__ */ G(
823
814
  "li",
824
815
  {
825
- id: `option-${de}`,
816
+ id: `${xe}-${fe}`,
826
817
  role: "option",
827
- className: `pi-option ${de === be ? "is-focused" : ""} ${M.id === w.id ? "is-selected" : ""}`,
828
- "aria-selected": M.id === w.id,
829
- title: M.name,
830
- onClick: () => ue(M.id),
831
- onMouseEnter: () => ot(de),
818
+ className: `pi-option ${fe === ue ? "is-focused" : ""} ${L.id === w.id ? "is-selected" : ""}`,
819
+ "aria-selected": L.id === w.id,
820
+ title: L.name,
821
+ onClick: () => pe(L.id),
822
+ onMouseEnter: () => ct(fe),
832
823
  children: [
833
- /* @__PURE__ */ C("span", { className: "pi-flag", role: "img", "aria-label": `${M.name} flag`, children: B ? B(M) : M.flag }),
834
- /* @__PURE__ */ C("span", { className: "pi-opt-name", children: M.name }),
835
- /* @__PURE__ */ C("span", { className: "pi-opt-code", children: M.code })
824
+ /* @__PURE__ */ C("span", { className: "pi-flag", role: "img", "aria-label": `${L.name} flag`, children: B ? B(L) : L.flag }),
825
+ /* @__PURE__ */ C("span", { className: "pi-opt-name", children: L.name }),
826
+ /* @__PURE__ */ C("span", { className: "pi-opt-code", children: L.code })
836
827
  ]
837
828
  },
838
- M.id
839
- )) : /* @__PURE__ */ C("li", { className: "pi-empty", children: b }) })
829
+ L.id
830
+ )) : /* @__PURE__ */ C("li", { className: "pi-empty", children: D }) })
840
831
  ]
841
832
  }
842
833
  ),
843
834
  document.body
844
835
  ),
845
- /* @__PURE__ */ C("div", { ref: we, className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true" })
836
+ /* @__PURE__ */ C("div", { ref: Ie, className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true" })
846
837
  ] });
847
- }, Zt = pt(Wt);
848
- Zt.displayName = "PhoneInput";
849
- function jt(e) {
850
- const t = R(null), { country: n, setCountry: r } = Ue({
838
+ }, Xt = yt(zt);
839
+ Xt.displayName = "PhoneInput";
840
+ function tn(e) {
841
+ const t = R(null), { country: n, setCountry: r } = Ye({
851
842
  country: e.country,
852
843
  locale: e.locale,
853
844
  detect: e.detect,
@@ -855,64 +846,65 @@ function jt(e) {
855
846
  }), {
856
847
  digits: s,
857
848
  formatter: o,
858
- displayPlaceholder: a,
859
- displayValue: i,
860
- full: c,
861
- fullFormatted: l,
849
+ displayPlaceholder: i,
850
+ displayValue: a,
851
+ full: f,
852
+ fullFormatted: c,
862
853
  isComplete: u,
863
- isEmpty: d,
864
- shouldShowWarn: p
865
- } = Ke({
854
+ isEmpty: l,
855
+ shouldShowWarn: d
856
+ } = Ze({
866
857
  country: n,
867
858
  value: e.value,
868
859
  onChange: e.onChange,
869
860
  onPhoneChange: e.onPhoneChange
870
- }), { handleBeforeInput: f, handleInput: b, handleKeydown: L, handlePaste: N } = $e({
861
+ }), { handleBeforeInput: p, handleInput: D, handleKeydown: v, handlePaste: N } = Je({
871
862
  formatter: o,
872
863
  digits: s,
873
864
  onChange: e.onChange
874
865
  });
875
- v(() => {
866
+ I(() => {
876
867
  const g = t.current;
877
868
  g && (g.setAttribute("type", "tel"), g.setAttribute("inputmode", "tel"));
878
- }, []), v(() => {
869
+ }, []), I(() => {
879
870
  const g = t.current;
880
- g && (g.value = i, g.setAttribute("placeholder", a));
881
- }, [i, a]), v(() => {
871
+ g && (g.value = a, g.setAttribute("placeholder", i));
872
+ }, [a, i]), I(() => {
882
873
  const g = t.current;
883
874
  if (!g) return;
884
- const A = f, E = b, k = L, x = N;
885
- return g.addEventListener("beforeinput", A), g.addEventListener("input", E), g.addEventListener("keydown", k), g.addEventListener("paste", x), () => {
886
- g.removeEventListener("beforeinput", A), g.removeEventListener("input", E), g.removeEventListener("keydown", k), g.removeEventListener("paste", x);
875
+ const A = p, T = D, E = v, x = N;
876
+ return g.addEventListener("beforeinput", A), g.addEventListener("input", T), g.addEventListener("keydown", E), g.addEventListener("paste", x), () => {
877
+ g.removeEventListener("beforeinput", A), g.removeEventListener("input", T), g.removeEventListener("keydown", E), g.removeEventListener("paste", x);
887
878
  };
888
- }, [f, b, L, N]);
879
+ }, [p, D, v, N]);
889
880
  const P = h(() => {
890
881
  e.onChange("");
891
882
  }, [e.onChange]);
892
883
  return {
893
884
  ref: t,
894
885
  digits: s,
895
- full: c,
896
- fullFormatted: l,
886
+ formatter: o,
887
+ full: f,
888
+ fullFormatted: c,
897
889
  isComplete: u,
898
- isEmpty: d,
899
- shouldShowWarn: p,
890
+ isEmpty: l,
891
+ shouldShowWarn: d,
900
892
  country: n,
901
893
  setCountry: r,
902
894
  clear: P
903
895
  };
904
896
  }
905
- const _t = {
906
- getFlagEmoji: yt,
907
- countPlaceholders: ge,
908
- formatDigitsWithMap: re,
909
- pickMaskVariant: Ge,
910
- removeCountryCodePrefix: fe,
911
- toArray: Ve
897
+ const nn = {
898
+ getFlagEmoji: Lt,
899
+ countPlaceholders: ye,
900
+ formatDigitsWithMap: se,
901
+ pickMaskVariant: We,
902
+ removeCountryCodePrefix: ge,
903
+ toArray: Ue
912
904
  };
913
905
  export {
914
- _t as PMaskHelpers,
915
- Zt as PhoneInput,
916
- jt as usePhoneMask
906
+ nn as PMaskHelpers,
907
+ Xt as PhoneInput,
908
+ tn as usePhoneMask
917
909
  };
918
910
  //# sourceMappingURL=index.js.map