your-ai-workflow-firebase-os 1.2.7 → 1.2.9
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/ContactPopup-BcjnOBWb.js +7544 -0
- package/dist/ContactPopup-gaUJCR67.cjs +9 -0
- package/dist/FirebaseOS.d.ts +5 -0
- package/dist/PhoneInputField-Bwos3cqE.js +2042 -0
- package/dist/PhoneInputField-CSoNnJ2Y.cjs +1 -0
- package/dist/chunk-DYteiM-1.cjs +1 -0
- package/dist/contactForm.config-CXyq-EbM.cjs +1 -0
- package/dist/contactForm.config-DfZU9Fr1.js +2 -0
- package/dist/lib/ConfigContext.d.ts +5 -0
- package/dist/lib/ThemeContext.d.ts +2 -2
- package/dist/renderer.cjs.js +1 -0
- package/dist/renderer.d.ts +1 -0
- package/dist/renderer.es.js +2 -0
- package/dist/supportForm.config-M9zQs6qp.js +2 -0
- package/dist/supportForm.config-haLod4rv.cjs +1 -0
- package/dist/theme.config-0Lvwt5Bo.cjs +1 -0
- package/dist/theme.config-B2y1axZf.js +2 -0
- package/dist/your-ai-workflow-firebase-os.cjs.js +76 -84
- package/dist/your-ai-workflow-firebase-os.css +2 -1
- package/dist/your-ai-workflow-firebase-os.es.js +23988 -33460
- package/package.json +6 -1
- package/scripts/postinstall.js +10 -0
- package/src/FirebaseOS.tsx +7 -1
- package/src/components/ContactPopup.tsx +63 -49
- package/src/components/DashboardNav.tsx +14 -4
- package/src/components/PhoneInputField.tsx +30 -0
- package/src/configs/forms/index.ts +0 -2
- package/src/lib/ConfigContext.tsx +5 -0
- package/src/lib/ThemeContext.tsx +14 -6
- package/src/main.tsx +13 -1
- package/src/pages/DynamicPage.tsx +106 -54
- package/src/pages/FormsAdmin.tsx +37 -6
- package/src/pages/Home.tsx +14 -5
- package/src/pages/PagesAdmin.tsx +37 -6
- package/src/pages/ThemeAdmin.tsx +16 -3
- package/src/renderer.ts +1 -0
- package/dist/contactForm.config-DLeI_ZEj.js +0 -2
- package/dist/contactForm.config-Y2AYSH9s.cjs +0 -1
- package/dist/contactForm.config-ki9OzidM.cjs +0 -1
- package/dist/supportForm.config-74T-eSSH.js +0 -2
- package/dist/supportForm.config-BwZqJ5CZ.cjs +0 -1
- package/dist/supportForm.config-NfLDtLTB.cjs +0 -1
- package/dist/theme.config-BbEzcEDR.js +0 -2
- package/dist/theme.config-DJqqr_kx.cjs +0 -1
- package/dist/theme.config-DKqbHSSM.cjs +0 -1
- package/src/configs/forms/pubForm.config.ts +0 -11
- package/src/configs/forms/userForm.config.ts +0 -11
- /package/dist/{contactForm.config-BHvMbfxM.js → contactForm.config-D9No8cBy.js} +0 -0
- /package/dist/{supportForm.config-D5ZRFZtU.js → supportForm.config-Dgl58gss.js} +0 -0
- /package/dist/{theme.config-q93xMCw6.js → theme.config-D05RQKVy.js} +0 -0
|
@@ -0,0 +1,2042 @@
|
|
|
1
|
+
import e, { forwardRef as t, useCallback as n, useEffect as r, useImperativeHandle as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
//#region node_modules/react-international-phone/dist/index.mjs
|
|
4
|
+
var u = [
|
|
5
|
+
[
|
|
6
|
+
"Afghanistan",
|
|
7
|
+
"af",
|
|
8
|
+
"93"
|
|
9
|
+
],
|
|
10
|
+
[
|
|
11
|
+
"Albania",
|
|
12
|
+
"al",
|
|
13
|
+
"355"
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
"Algeria",
|
|
17
|
+
"dz",
|
|
18
|
+
"213"
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"Andorra",
|
|
22
|
+
"ad",
|
|
23
|
+
"376"
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
"Angola",
|
|
27
|
+
"ao",
|
|
28
|
+
"244"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"Antigua and Barbuda",
|
|
32
|
+
"ag",
|
|
33
|
+
"1268"
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"Argentina",
|
|
37
|
+
"ar",
|
|
38
|
+
"54",
|
|
39
|
+
{
|
|
40
|
+
default: "(..) .... ....",
|
|
41
|
+
"/^11/": "(..) .... ....",
|
|
42
|
+
"/^15/": "(..) ... ....",
|
|
43
|
+
"/^(2|3|4|5)/": "(.) .... ....",
|
|
44
|
+
"/^9/": "(.) .... ....."
|
|
45
|
+
},
|
|
46
|
+
0
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
"Armenia",
|
|
50
|
+
"am",
|
|
51
|
+
"374",
|
|
52
|
+
".. ......"
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
"Aruba",
|
|
56
|
+
"aw",
|
|
57
|
+
"297"
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"Australia",
|
|
61
|
+
"au",
|
|
62
|
+
"61",
|
|
63
|
+
{
|
|
64
|
+
default: ". .... ....",
|
|
65
|
+
"/^4/": "... ... ...",
|
|
66
|
+
"/^5(?!50)/": "... ... ...",
|
|
67
|
+
"/^1(3|8)00/": ".... ... ...",
|
|
68
|
+
"/^13/": ".. .. ..",
|
|
69
|
+
"/^180/": "... ...."
|
|
70
|
+
},
|
|
71
|
+
0,
|
|
72
|
+
[]
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
"Austria",
|
|
76
|
+
"at",
|
|
77
|
+
"43"
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
"Azerbaijan",
|
|
81
|
+
"az",
|
|
82
|
+
"994",
|
|
83
|
+
"(..) ... .. .."
|
|
84
|
+
],
|
|
85
|
+
[
|
|
86
|
+
"Bahamas",
|
|
87
|
+
"bs",
|
|
88
|
+
"1242"
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
"Bahrain",
|
|
92
|
+
"bh",
|
|
93
|
+
"973",
|
|
94
|
+
".... ...."
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"Bangladesh",
|
|
98
|
+
"bd",
|
|
99
|
+
"880"
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"Barbados",
|
|
103
|
+
"bb",
|
|
104
|
+
"1246"
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"Belarus",
|
|
108
|
+
"by",
|
|
109
|
+
"375",
|
|
110
|
+
"(..) ... .. .."
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
"Belgium",
|
|
114
|
+
"be",
|
|
115
|
+
"32",
|
|
116
|
+
"... .. .. .."
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
"Belize",
|
|
120
|
+
"bz",
|
|
121
|
+
"501"
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
"Benin",
|
|
125
|
+
"bj",
|
|
126
|
+
"229"
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
"Bhutan",
|
|
130
|
+
"bt",
|
|
131
|
+
"975"
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"Bolivia",
|
|
135
|
+
"bo",
|
|
136
|
+
"591"
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
"Bosnia and Herzegovina",
|
|
140
|
+
"ba",
|
|
141
|
+
"387"
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"Botswana",
|
|
145
|
+
"bw",
|
|
146
|
+
"267"
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
"Brazil",
|
|
150
|
+
"br",
|
|
151
|
+
"55",
|
|
152
|
+
"(..) .....-...."
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
"British Indian Ocean Territory",
|
|
156
|
+
"io",
|
|
157
|
+
"246"
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"Brunei",
|
|
161
|
+
"bn",
|
|
162
|
+
"673"
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
"Bulgaria",
|
|
166
|
+
"bg",
|
|
167
|
+
"359"
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
"Burkina Faso",
|
|
171
|
+
"bf",
|
|
172
|
+
"226"
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
"Burundi",
|
|
176
|
+
"bi",
|
|
177
|
+
"257"
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"Cambodia",
|
|
181
|
+
"kh",
|
|
182
|
+
"855"
|
|
183
|
+
],
|
|
184
|
+
[
|
|
185
|
+
"Cameroon",
|
|
186
|
+
"cm",
|
|
187
|
+
"237"
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
"Canada",
|
|
191
|
+
"ca",
|
|
192
|
+
"1",
|
|
193
|
+
"(...) ...-....",
|
|
194
|
+
1,
|
|
195
|
+
/* @__PURE__ */ "204.226.236.249.250.289.306.343.365.387.403.416.418.431.437.438.450.506.514.519.548.579.581.587.604.613.639.647.672.705.709.742.778.780.782.807.819.825.867.873.902.905".split(".")
|
|
196
|
+
],
|
|
197
|
+
[
|
|
198
|
+
"Cape Verde",
|
|
199
|
+
"cv",
|
|
200
|
+
"238"
|
|
201
|
+
],
|
|
202
|
+
[
|
|
203
|
+
"Caribbean Netherlands",
|
|
204
|
+
"bq",
|
|
205
|
+
"599",
|
|
206
|
+
"",
|
|
207
|
+
1
|
|
208
|
+
],
|
|
209
|
+
[
|
|
210
|
+
"Cayman Islands",
|
|
211
|
+
"ky",
|
|
212
|
+
"1",
|
|
213
|
+
"... ... ....",
|
|
214
|
+
4,
|
|
215
|
+
["345"]
|
|
216
|
+
],
|
|
217
|
+
[
|
|
218
|
+
"Central African Republic",
|
|
219
|
+
"cf",
|
|
220
|
+
"236"
|
|
221
|
+
],
|
|
222
|
+
[
|
|
223
|
+
"Chad",
|
|
224
|
+
"td",
|
|
225
|
+
"235"
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
"Chile",
|
|
229
|
+
"cl",
|
|
230
|
+
"56"
|
|
231
|
+
],
|
|
232
|
+
[
|
|
233
|
+
"China",
|
|
234
|
+
"cn",
|
|
235
|
+
"86",
|
|
236
|
+
"... .... ...."
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
"Colombia",
|
|
240
|
+
"co",
|
|
241
|
+
"57",
|
|
242
|
+
"... ... ...."
|
|
243
|
+
],
|
|
244
|
+
[
|
|
245
|
+
"Comoros",
|
|
246
|
+
"km",
|
|
247
|
+
"269"
|
|
248
|
+
],
|
|
249
|
+
[
|
|
250
|
+
"Congo",
|
|
251
|
+
"cd",
|
|
252
|
+
"243"
|
|
253
|
+
],
|
|
254
|
+
[
|
|
255
|
+
"Congo",
|
|
256
|
+
"cg",
|
|
257
|
+
"242"
|
|
258
|
+
],
|
|
259
|
+
[
|
|
260
|
+
"Costa Rica",
|
|
261
|
+
"cr",
|
|
262
|
+
"506",
|
|
263
|
+
"....-...."
|
|
264
|
+
],
|
|
265
|
+
[
|
|
266
|
+
"Côte d'Ivoire",
|
|
267
|
+
"ci",
|
|
268
|
+
"225",
|
|
269
|
+
".. .. .. .. .."
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
"Croatia",
|
|
273
|
+
"hr",
|
|
274
|
+
"385"
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
"Cuba",
|
|
278
|
+
"cu",
|
|
279
|
+
"53"
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
"Curaçao",
|
|
283
|
+
"cw",
|
|
284
|
+
"599",
|
|
285
|
+
"",
|
|
286
|
+
0
|
|
287
|
+
],
|
|
288
|
+
[
|
|
289
|
+
"Cyprus",
|
|
290
|
+
"cy",
|
|
291
|
+
"357",
|
|
292
|
+
".. ......"
|
|
293
|
+
],
|
|
294
|
+
[
|
|
295
|
+
"Czech Republic",
|
|
296
|
+
"cz",
|
|
297
|
+
"420",
|
|
298
|
+
"... ... ..."
|
|
299
|
+
],
|
|
300
|
+
[
|
|
301
|
+
"Denmark",
|
|
302
|
+
"dk",
|
|
303
|
+
"45",
|
|
304
|
+
".. .. .. .."
|
|
305
|
+
],
|
|
306
|
+
[
|
|
307
|
+
"Djibouti",
|
|
308
|
+
"dj",
|
|
309
|
+
"253",
|
|
310
|
+
".. .. ...."
|
|
311
|
+
],
|
|
312
|
+
[
|
|
313
|
+
"Dominica",
|
|
314
|
+
"dm",
|
|
315
|
+
"1767"
|
|
316
|
+
],
|
|
317
|
+
[
|
|
318
|
+
"Dominican Republic",
|
|
319
|
+
"do",
|
|
320
|
+
"1",
|
|
321
|
+
"(...) ...-....",
|
|
322
|
+
2,
|
|
323
|
+
[
|
|
324
|
+
"809",
|
|
325
|
+
"829",
|
|
326
|
+
"849"
|
|
327
|
+
]
|
|
328
|
+
],
|
|
329
|
+
[
|
|
330
|
+
"Ecuador",
|
|
331
|
+
"ec",
|
|
332
|
+
"593"
|
|
333
|
+
],
|
|
334
|
+
[
|
|
335
|
+
"Egypt",
|
|
336
|
+
"eg",
|
|
337
|
+
"20"
|
|
338
|
+
],
|
|
339
|
+
[
|
|
340
|
+
"El Salvador",
|
|
341
|
+
"sv",
|
|
342
|
+
"503",
|
|
343
|
+
"....-...."
|
|
344
|
+
],
|
|
345
|
+
[
|
|
346
|
+
"Equatorial Guinea",
|
|
347
|
+
"gq",
|
|
348
|
+
"240"
|
|
349
|
+
],
|
|
350
|
+
[
|
|
351
|
+
"Eritrea",
|
|
352
|
+
"er",
|
|
353
|
+
"291"
|
|
354
|
+
],
|
|
355
|
+
[
|
|
356
|
+
"Estonia",
|
|
357
|
+
"ee",
|
|
358
|
+
"372",
|
|
359
|
+
".... ......"
|
|
360
|
+
],
|
|
361
|
+
[
|
|
362
|
+
"Ethiopia",
|
|
363
|
+
"et",
|
|
364
|
+
"251",
|
|
365
|
+
".. ... ...."
|
|
366
|
+
],
|
|
367
|
+
[
|
|
368
|
+
"Faroe Islands",
|
|
369
|
+
"fo",
|
|
370
|
+
"298",
|
|
371
|
+
".. .. .."
|
|
372
|
+
],
|
|
373
|
+
[
|
|
374
|
+
"Fiji",
|
|
375
|
+
"fj",
|
|
376
|
+
"679"
|
|
377
|
+
],
|
|
378
|
+
[
|
|
379
|
+
"Finland",
|
|
380
|
+
"fi",
|
|
381
|
+
"358",
|
|
382
|
+
".. ... .. .."
|
|
383
|
+
],
|
|
384
|
+
[
|
|
385
|
+
"France",
|
|
386
|
+
"fr",
|
|
387
|
+
"33",
|
|
388
|
+
". .. .. .. .."
|
|
389
|
+
],
|
|
390
|
+
[
|
|
391
|
+
"French Guiana",
|
|
392
|
+
"gf",
|
|
393
|
+
"594",
|
|
394
|
+
"... .. .. .."
|
|
395
|
+
],
|
|
396
|
+
[
|
|
397
|
+
"French Polynesia",
|
|
398
|
+
"pf",
|
|
399
|
+
"689",
|
|
400
|
+
{
|
|
401
|
+
"/^44/": ".. .. ..",
|
|
402
|
+
"/^80[0-5]/": "... .. .. ..",
|
|
403
|
+
default: ".. .. .. .."
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
[
|
|
407
|
+
"Gabon",
|
|
408
|
+
"ga",
|
|
409
|
+
"241"
|
|
410
|
+
],
|
|
411
|
+
[
|
|
412
|
+
"Gambia",
|
|
413
|
+
"gm",
|
|
414
|
+
"220"
|
|
415
|
+
],
|
|
416
|
+
[
|
|
417
|
+
"Georgia",
|
|
418
|
+
"ge",
|
|
419
|
+
"995"
|
|
420
|
+
],
|
|
421
|
+
[
|
|
422
|
+
"Germany",
|
|
423
|
+
"de",
|
|
424
|
+
"49",
|
|
425
|
+
"... ........."
|
|
426
|
+
],
|
|
427
|
+
[
|
|
428
|
+
"Ghana",
|
|
429
|
+
"gh",
|
|
430
|
+
"233"
|
|
431
|
+
],
|
|
432
|
+
[
|
|
433
|
+
"Gibraltar",
|
|
434
|
+
"gi",
|
|
435
|
+
"350"
|
|
436
|
+
],
|
|
437
|
+
[
|
|
438
|
+
"Greece",
|
|
439
|
+
"gr",
|
|
440
|
+
"30"
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
"Greenland",
|
|
444
|
+
"gl",
|
|
445
|
+
"299",
|
|
446
|
+
".. .. .."
|
|
447
|
+
],
|
|
448
|
+
[
|
|
449
|
+
"Grenada",
|
|
450
|
+
"gd",
|
|
451
|
+
"1473"
|
|
452
|
+
],
|
|
453
|
+
[
|
|
454
|
+
"Guadeloupe",
|
|
455
|
+
"gp",
|
|
456
|
+
"590",
|
|
457
|
+
"... .. .. ..",
|
|
458
|
+
0
|
|
459
|
+
],
|
|
460
|
+
[
|
|
461
|
+
"Guam",
|
|
462
|
+
"gu",
|
|
463
|
+
"1671"
|
|
464
|
+
],
|
|
465
|
+
[
|
|
466
|
+
"Guatemala",
|
|
467
|
+
"gt",
|
|
468
|
+
"502",
|
|
469
|
+
"....-...."
|
|
470
|
+
],
|
|
471
|
+
[
|
|
472
|
+
"Guinea",
|
|
473
|
+
"gn",
|
|
474
|
+
"224"
|
|
475
|
+
],
|
|
476
|
+
[
|
|
477
|
+
"Guinea-Bissau",
|
|
478
|
+
"gw",
|
|
479
|
+
"245"
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
"Guyana",
|
|
483
|
+
"gy",
|
|
484
|
+
"592"
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
"Haiti",
|
|
488
|
+
"ht",
|
|
489
|
+
"509",
|
|
490
|
+
"....-...."
|
|
491
|
+
],
|
|
492
|
+
[
|
|
493
|
+
"Honduras",
|
|
494
|
+
"hn",
|
|
495
|
+
"504"
|
|
496
|
+
],
|
|
497
|
+
[
|
|
498
|
+
"Hong Kong",
|
|
499
|
+
"hk",
|
|
500
|
+
"852",
|
|
501
|
+
".... ...."
|
|
502
|
+
],
|
|
503
|
+
[
|
|
504
|
+
"Hungary",
|
|
505
|
+
"hu",
|
|
506
|
+
"36"
|
|
507
|
+
],
|
|
508
|
+
[
|
|
509
|
+
"Iceland",
|
|
510
|
+
"is",
|
|
511
|
+
"354",
|
|
512
|
+
"... ...."
|
|
513
|
+
],
|
|
514
|
+
[
|
|
515
|
+
"India",
|
|
516
|
+
"in",
|
|
517
|
+
"91",
|
|
518
|
+
".....-....."
|
|
519
|
+
],
|
|
520
|
+
[
|
|
521
|
+
"Indonesia",
|
|
522
|
+
"id",
|
|
523
|
+
"62"
|
|
524
|
+
],
|
|
525
|
+
[
|
|
526
|
+
"Iran",
|
|
527
|
+
"ir",
|
|
528
|
+
"98",
|
|
529
|
+
"... ... ...."
|
|
530
|
+
],
|
|
531
|
+
[
|
|
532
|
+
"Iraq",
|
|
533
|
+
"iq",
|
|
534
|
+
"964"
|
|
535
|
+
],
|
|
536
|
+
[
|
|
537
|
+
"Ireland",
|
|
538
|
+
"ie",
|
|
539
|
+
"353",
|
|
540
|
+
".. ......."
|
|
541
|
+
],
|
|
542
|
+
[
|
|
543
|
+
"Israel",
|
|
544
|
+
"il",
|
|
545
|
+
"972",
|
|
546
|
+
"... ... ...."
|
|
547
|
+
],
|
|
548
|
+
[
|
|
549
|
+
"Italy",
|
|
550
|
+
"it",
|
|
551
|
+
"39",
|
|
552
|
+
"... .......",
|
|
553
|
+
0
|
|
554
|
+
],
|
|
555
|
+
[
|
|
556
|
+
"Jamaica",
|
|
557
|
+
"jm",
|
|
558
|
+
"1876"
|
|
559
|
+
],
|
|
560
|
+
[
|
|
561
|
+
"Japan",
|
|
562
|
+
"jp",
|
|
563
|
+
"81",
|
|
564
|
+
".. .... ...."
|
|
565
|
+
],
|
|
566
|
+
[
|
|
567
|
+
"Jordan",
|
|
568
|
+
"jo",
|
|
569
|
+
"962"
|
|
570
|
+
],
|
|
571
|
+
[
|
|
572
|
+
"Kazakhstan",
|
|
573
|
+
"kz",
|
|
574
|
+
"7",
|
|
575
|
+
"... ...-..-..",
|
|
576
|
+
0
|
|
577
|
+
],
|
|
578
|
+
[
|
|
579
|
+
"Kenya",
|
|
580
|
+
"ke",
|
|
581
|
+
"254"
|
|
582
|
+
],
|
|
583
|
+
[
|
|
584
|
+
"Kiribati",
|
|
585
|
+
"ki",
|
|
586
|
+
"686"
|
|
587
|
+
],
|
|
588
|
+
[
|
|
589
|
+
"Kosovo",
|
|
590
|
+
"xk",
|
|
591
|
+
"383"
|
|
592
|
+
],
|
|
593
|
+
[
|
|
594
|
+
"Kuwait",
|
|
595
|
+
"kw",
|
|
596
|
+
"965",
|
|
597
|
+
".... ...."
|
|
598
|
+
],
|
|
599
|
+
[
|
|
600
|
+
"Kyrgyzstan",
|
|
601
|
+
"kg",
|
|
602
|
+
"996",
|
|
603
|
+
"... ... ..."
|
|
604
|
+
],
|
|
605
|
+
[
|
|
606
|
+
"Laos",
|
|
607
|
+
"la",
|
|
608
|
+
"856"
|
|
609
|
+
],
|
|
610
|
+
[
|
|
611
|
+
"Latvia",
|
|
612
|
+
"lv",
|
|
613
|
+
"371",
|
|
614
|
+
".. ... ..."
|
|
615
|
+
],
|
|
616
|
+
[
|
|
617
|
+
"Lebanon",
|
|
618
|
+
"lb",
|
|
619
|
+
"961"
|
|
620
|
+
],
|
|
621
|
+
[
|
|
622
|
+
"Lesotho",
|
|
623
|
+
"ls",
|
|
624
|
+
"266"
|
|
625
|
+
],
|
|
626
|
+
[
|
|
627
|
+
"Liberia",
|
|
628
|
+
"lr",
|
|
629
|
+
"231"
|
|
630
|
+
],
|
|
631
|
+
[
|
|
632
|
+
"Libya",
|
|
633
|
+
"ly",
|
|
634
|
+
"218"
|
|
635
|
+
],
|
|
636
|
+
[
|
|
637
|
+
"Liechtenstein",
|
|
638
|
+
"li",
|
|
639
|
+
"423"
|
|
640
|
+
],
|
|
641
|
+
[
|
|
642
|
+
"Lithuania",
|
|
643
|
+
"lt",
|
|
644
|
+
"370"
|
|
645
|
+
],
|
|
646
|
+
[
|
|
647
|
+
"Luxembourg",
|
|
648
|
+
"lu",
|
|
649
|
+
"352"
|
|
650
|
+
],
|
|
651
|
+
[
|
|
652
|
+
"Macau",
|
|
653
|
+
"mo",
|
|
654
|
+
"853"
|
|
655
|
+
],
|
|
656
|
+
[
|
|
657
|
+
"Macedonia",
|
|
658
|
+
"mk",
|
|
659
|
+
"389"
|
|
660
|
+
],
|
|
661
|
+
[
|
|
662
|
+
"Madagascar",
|
|
663
|
+
"mg",
|
|
664
|
+
"261"
|
|
665
|
+
],
|
|
666
|
+
[
|
|
667
|
+
"Malawi",
|
|
668
|
+
"mw",
|
|
669
|
+
"265"
|
|
670
|
+
],
|
|
671
|
+
[
|
|
672
|
+
"Malaysia",
|
|
673
|
+
"my",
|
|
674
|
+
"60",
|
|
675
|
+
"..-....-...."
|
|
676
|
+
],
|
|
677
|
+
[
|
|
678
|
+
"Maldives",
|
|
679
|
+
"mv",
|
|
680
|
+
"960"
|
|
681
|
+
],
|
|
682
|
+
[
|
|
683
|
+
"Mali",
|
|
684
|
+
"ml",
|
|
685
|
+
"223"
|
|
686
|
+
],
|
|
687
|
+
[
|
|
688
|
+
"Malta",
|
|
689
|
+
"mt",
|
|
690
|
+
"356"
|
|
691
|
+
],
|
|
692
|
+
[
|
|
693
|
+
"Marshall Islands",
|
|
694
|
+
"mh",
|
|
695
|
+
"692"
|
|
696
|
+
],
|
|
697
|
+
[
|
|
698
|
+
"Martinique",
|
|
699
|
+
"mq",
|
|
700
|
+
"596",
|
|
701
|
+
"... .. .. .."
|
|
702
|
+
],
|
|
703
|
+
[
|
|
704
|
+
"Mauritania",
|
|
705
|
+
"mr",
|
|
706
|
+
"222"
|
|
707
|
+
],
|
|
708
|
+
[
|
|
709
|
+
"Mauritius",
|
|
710
|
+
"mu",
|
|
711
|
+
"230"
|
|
712
|
+
],
|
|
713
|
+
[
|
|
714
|
+
"Mayotte",
|
|
715
|
+
"yt",
|
|
716
|
+
"262",
|
|
717
|
+
"... .. .. ..",
|
|
718
|
+
1,
|
|
719
|
+
["269", "639"]
|
|
720
|
+
],
|
|
721
|
+
[
|
|
722
|
+
"Mexico",
|
|
723
|
+
"mx",
|
|
724
|
+
"52",
|
|
725
|
+
"... ... ....",
|
|
726
|
+
0
|
|
727
|
+
],
|
|
728
|
+
[
|
|
729
|
+
"Micronesia",
|
|
730
|
+
"fm",
|
|
731
|
+
"691"
|
|
732
|
+
],
|
|
733
|
+
[
|
|
734
|
+
"Moldova",
|
|
735
|
+
"md",
|
|
736
|
+
"373",
|
|
737
|
+
"(..) ..-..-.."
|
|
738
|
+
],
|
|
739
|
+
[
|
|
740
|
+
"Monaco",
|
|
741
|
+
"mc",
|
|
742
|
+
"377"
|
|
743
|
+
],
|
|
744
|
+
[
|
|
745
|
+
"Mongolia",
|
|
746
|
+
"mn",
|
|
747
|
+
"976"
|
|
748
|
+
],
|
|
749
|
+
[
|
|
750
|
+
"Montenegro",
|
|
751
|
+
"me",
|
|
752
|
+
"382"
|
|
753
|
+
],
|
|
754
|
+
[
|
|
755
|
+
"Morocco",
|
|
756
|
+
"ma",
|
|
757
|
+
"212"
|
|
758
|
+
],
|
|
759
|
+
[
|
|
760
|
+
"Mozambique",
|
|
761
|
+
"mz",
|
|
762
|
+
"258"
|
|
763
|
+
],
|
|
764
|
+
[
|
|
765
|
+
"Myanmar",
|
|
766
|
+
"mm",
|
|
767
|
+
"95"
|
|
768
|
+
],
|
|
769
|
+
[
|
|
770
|
+
"Namibia",
|
|
771
|
+
"na",
|
|
772
|
+
"264"
|
|
773
|
+
],
|
|
774
|
+
[
|
|
775
|
+
"Nauru",
|
|
776
|
+
"nr",
|
|
777
|
+
"674"
|
|
778
|
+
],
|
|
779
|
+
[
|
|
780
|
+
"Nepal",
|
|
781
|
+
"np",
|
|
782
|
+
"977"
|
|
783
|
+
],
|
|
784
|
+
[
|
|
785
|
+
"Netherlands",
|
|
786
|
+
"nl",
|
|
787
|
+
"31",
|
|
788
|
+
{
|
|
789
|
+
"/^06/": "(.). .........",
|
|
790
|
+
"/^6/": ". .........",
|
|
791
|
+
"/^0(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/": "(.).. ........",
|
|
792
|
+
"/^(10|13|14|15|20|23|24|26|30|33|35|36|38|40|43|44|45|46|50|53|55|58|70|71|72|73|74|75|76|77|78|79|82|84|85|87|88|91)/": ".. ........",
|
|
793
|
+
"/^0/": "(.)... .......",
|
|
794
|
+
default: "... ......."
|
|
795
|
+
}
|
|
796
|
+
],
|
|
797
|
+
[
|
|
798
|
+
"New Caledonia",
|
|
799
|
+
"nc",
|
|
800
|
+
"687"
|
|
801
|
+
],
|
|
802
|
+
[
|
|
803
|
+
"New Zealand",
|
|
804
|
+
"nz",
|
|
805
|
+
"64",
|
|
806
|
+
"...-...-...."
|
|
807
|
+
],
|
|
808
|
+
[
|
|
809
|
+
"Nicaragua",
|
|
810
|
+
"ni",
|
|
811
|
+
"505"
|
|
812
|
+
],
|
|
813
|
+
[
|
|
814
|
+
"Niger",
|
|
815
|
+
"ne",
|
|
816
|
+
"227"
|
|
817
|
+
],
|
|
818
|
+
[
|
|
819
|
+
"Nigeria",
|
|
820
|
+
"ng",
|
|
821
|
+
"234"
|
|
822
|
+
],
|
|
823
|
+
[
|
|
824
|
+
"North Korea",
|
|
825
|
+
"kp",
|
|
826
|
+
"850"
|
|
827
|
+
],
|
|
828
|
+
[
|
|
829
|
+
"Norway",
|
|
830
|
+
"no",
|
|
831
|
+
"47",
|
|
832
|
+
"... .. ..."
|
|
833
|
+
],
|
|
834
|
+
[
|
|
835
|
+
"Oman",
|
|
836
|
+
"om",
|
|
837
|
+
"968",
|
|
838
|
+
".... ...."
|
|
839
|
+
],
|
|
840
|
+
[
|
|
841
|
+
"Pakistan",
|
|
842
|
+
"pk",
|
|
843
|
+
"92",
|
|
844
|
+
"...-......."
|
|
845
|
+
],
|
|
846
|
+
[
|
|
847
|
+
"Palau",
|
|
848
|
+
"pw",
|
|
849
|
+
"680"
|
|
850
|
+
],
|
|
851
|
+
[
|
|
852
|
+
"Palestine",
|
|
853
|
+
"ps",
|
|
854
|
+
"970"
|
|
855
|
+
],
|
|
856
|
+
[
|
|
857
|
+
"Panama",
|
|
858
|
+
"pa",
|
|
859
|
+
"507"
|
|
860
|
+
],
|
|
861
|
+
[
|
|
862
|
+
"Papua New Guinea",
|
|
863
|
+
"pg",
|
|
864
|
+
"675"
|
|
865
|
+
],
|
|
866
|
+
[
|
|
867
|
+
"Paraguay",
|
|
868
|
+
"py",
|
|
869
|
+
"595"
|
|
870
|
+
],
|
|
871
|
+
[
|
|
872
|
+
"Peru",
|
|
873
|
+
"pe",
|
|
874
|
+
"51"
|
|
875
|
+
],
|
|
876
|
+
[
|
|
877
|
+
"Philippines",
|
|
878
|
+
"ph",
|
|
879
|
+
"63",
|
|
880
|
+
"... ... ...."
|
|
881
|
+
],
|
|
882
|
+
[
|
|
883
|
+
"Poland",
|
|
884
|
+
"pl",
|
|
885
|
+
"48",
|
|
886
|
+
"...-...-..."
|
|
887
|
+
],
|
|
888
|
+
[
|
|
889
|
+
"Portugal",
|
|
890
|
+
"pt",
|
|
891
|
+
"351"
|
|
892
|
+
],
|
|
893
|
+
[
|
|
894
|
+
"Puerto Rico",
|
|
895
|
+
"pr",
|
|
896
|
+
"1",
|
|
897
|
+
"(...) ...-....",
|
|
898
|
+
3,
|
|
899
|
+
["787", "939"]
|
|
900
|
+
],
|
|
901
|
+
[
|
|
902
|
+
"Qatar",
|
|
903
|
+
"qa",
|
|
904
|
+
"974",
|
|
905
|
+
".... ...."
|
|
906
|
+
],
|
|
907
|
+
[
|
|
908
|
+
"Réunion",
|
|
909
|
+
"re",
|
|
910
|
+
"262",
|
|
911
|
+
"... .. .. ..",
|
|
912
|
+
0
|
|
913
|
+
],
|
|
914
|
+
[
|
|
915
|
+
"Romania",
|
|
916
|
+
"ro",
|
|
917
|
+
"40"
|
|
918
|
+
],
|
|
919
|
+
[
|
|
920
|
+
"Russia",
|
|
921
|
+
"ru",
|
|
922
|
+
"7",
|
|
923
|
+
"(...) ...-..-..",
|
|
924
|
+
1
|
|
925
|
+
],
|
|
926
|
+
[
|
|
927
|
+
"Rwanda",
|
|
928
|
+
"rw",
|
|
929
|
+
"250"
|
|
930
|
+
],
|
|
931
|
+
[
|
|
932
|
+
"Saint Kitts and Nevis",
|
|
933
|
+
"kn",
|
|
934
|
+
"1869"
|
|
935
|
+
],
|
|
936
|
+
[
|
|
937
|
+
"Saint Lucia",
|
|
938
|
+
"lc",
|
|
939
|
+
"1758"
|
|
940
|
+
],
|
|
941
|
+
[
|
|
942
|
+
"Saint Pierre & Miquelon",
|
|
943
|
+
"pm",
|
|
944
|
+
"508",
|
|
945
|
+
{
|
|
946
|
+
"/^708/": "... ... ...",
|
|
947
|
+
"/^8/": "... .. .. ..",
|
|
948
|
+
default: ".. .. .."
|
|
949
|
+
}
|
|
950
|
+
],
|
|
951
|
+
[
|
|
952
|
+
"Saint Vincent and the Grenadines",
|
|
953
|
+
"vc",
|
|
954
|
+
"1784"
|
|
955
|
+
],
|
|
956
|
+
[
|
|
957
|
+
"Samoa",
|
|
958
|
+
"ws",
|
|
959
|
+
"685"
|
|
960
|
+
],
|
|
961
|
+
[
|
|
962
|
+
"San Marino",
|
|
963
|
+
"sm",
|
|
964
|
+
"378"
|
|
965
|
+
],
|
|
966
|
+
[
|
|
967
|
+
"São Tomé and Príncipe",
|
|
968
|
+
"st",
|
|
969
|
+
"239"
|
|
970
|
+
],
|
|
971
|
+
[
|
|
972
|
+
"Saudi Arabia",
|
|
973
|
+
"sa",
|
|
974
|
+
"966",
|
|
975
|
+
".. ... ...."
|
|
976
|
+
],
|
|
977
|
+
[
|
|
978
|
+
"Senegal",
|
|
979
|
+
"sn",
|
|
980
|
+
"221"
|
|
981
|
+
],
|
|
982
|
+
[
|
|
983
|
+
"Serbia",
|
|
984
|
+
"rs",
|
|
985
|
+
"381"
|
|
986
|
+
],
|
|
987
|
+
[
|
|
988
|
+
"Seychelles",
|
|
989
|
+
"sc",
|
|
990
|
+
"248"
|
|
991
|
+
],
|
|
992
|
+
[
|
|
993
|
+
"Sierra Leone",
|
|
994
|
+
"sl",
|
|
995
|
+
"232"
|
|
996
|
+
],
|
|
997
|
+
[
|
|
998
|
+
"Singapore",
|
|
999
|
+
"sg",
|
|
1000
|
+
"65",
|
|
1001
|
+
"....-...."
|
|
1002
|
+
],
|
|
1003
|
+
[
|
|
1004
|
+
"Slovakia",
|
|
1005
|
+
"sk",
|
|
1006
|
+
"421"
|
|
1007
|
+
],
|
|
1008
|
+
[
|
|
1009
|
+
"Slovenia",
|
|
1010
|
+
"si",
|
|
1011
|
+
"386"
|
|
1012
|
+
],
|
|
1013
|
+
[
|
|
1014
|
+
"Solomon Islands",
|
|
1015
|
+
"sb",
|
|
1016
|
+
"677"
|
|
1017
|
+
],
|
|
1018
|
+
[
|
|
1019
|
+
"Somalia",
|
|
1020
|
+
"so",
|
|
1021
|
+
"252"
|
|
1022
|
+
],
|
|
1023
|
+
[
|
|
1024
|
+
"South Africa",
|
|
1025
|
+
"za",
|
|
1026
|
+
"27"
|
|
1027
|
+
],
|
|
1028
|
+
[
|
|
1029
|
+
"South Korea",
|
|
1030
|
+
"kr",
|
|
1031
|
+
"82",
|
|
1032
|
+
"... .... ...."
|
|
1033
|
+
],
|
|
1034
|
+
[
|
|
1035
|
+
"South Sudan",
|
|
1036
|
+
"ss",
|
|
1037
|
+
"211"
|
|
1038
|
+
],
|
|
1039
|
+
[
|
|
1040
|
+
"Spain",
|
|
1041
|
+
"es",
|
|
1042
|
+
"34",
|
|
1043
|
+
"... ... ..."
|
|
1044
|
+
],
|
|
1045
|
+
[
|
|
1046
|
+
"Sri Lanka",
|
|
1047
|
+
"lk",
|
|
1048
|
+
"94"
|
|
1049
|
+
],
|
|
1050
|
+
[
|
|
1051
|
+
"Sudan",
|
|
1052
|
+
"sd",
|
|
1053
|
+
"249"
|
|
1054
|
+
],
|
|
1055
|
+
[
|
|
1056
|
+
"Suriname",
|
|
1057
|
+
"sr",
|
|
1058
|
+
"597"
|
|
1059
|
+
],
|
|
1060
|
+
[
|
|
1061
|
+
"Swaziland",
|
|
1062
|
+
"sz",
|
|
1063
|
+
"268"
|
|
1064
|
+
],
|
|
1065
|
+
[
|
|
1066
|
+
"Sweden",
|
|
1067
|
+
"se",
|
|
1068
|
+
"46",
|
|
1069
|
+
"... ... ..."
|
|
1070
|
+
],
|
|
1071
|
+
[
|
|
1072
|
+
"Switzerland",
|
|
1073
|
+
"ch",
|
|
1074
|
+
"41",
|
|
1075
|
+
".. ... .. .."
|
|
1076
|
+
],
|
|
1077
|
+
[
|
|
1078
|
+
"Syria",
|
|
1079
|
+
"sy",
|
|
1080
|
+
"963"
|
|
1081
|
+
],
|
|
1082
|
+
[
|
|
1083
|
+
"Taiwan",
|
|
1084
|
+
"tw",
|
|
1085
|
+
"886"
|
|
1086
|
+
],
|
|
1087
|
+
[
|
|
1088
|
+
"Tajikistan",
|
|
1089
|
+
"tj",
|
|
1090
|
+
"992"
|
|
1091
|
+
],
|
|
1092
|
+
[
|
|
1093
|
+
"Tanzania",
|
|
1094
|
+
"tz",
|
|
1095
|
+
"255"
|
|
1096
|
+
],
|
|
1097
|
+
[
|
|
1098
|
+
"Thailand",
|
|
1099
|
+
"th",
|
|
1100
|
+
"66"
|
|
1101
|
+
],
|
|
1102
|
+
[
|
|
1103
|
+
"Timor-Leste",
|
|
1104
|
+
"tl",
|
|
1105
|
+
"670"
|
|
1106
|
+
],
|
|
1107
|
+
[
|
|
1108
|
+
"Togo",
|
|
1109
|
+
"tg",
|
|
1110
|
+
"228"
|
|
1111
|
+
],
|
|
1112
|
+
[
|
|
1113
|
+
"Tonga",
|
|
1114
|
+
"to",
|
|
1115
|
+
"676"
|
|
1116
|
+
],
|
|
1117
|
+
[
|
|
1118
|
+
"Trinidad and Tobago",
|
|
1119
|
+
"tt",
|
|
1120
|
+
"1868"
|
|
1121
|
+
],
|
|
1122
|
+
[
|
|
1123
|
+
"Tunisia",
|
|
1124
|
+
"tn",
|
|
1125
|
+
"216"
|
|
1126
|
+
],
|
|
1127
|
+
[
|
|
1128
|
+
"Turkey",
|
|
1129
|
+
"tr",
|
|
1130
|
+
"90",
|
|
1131
|
+
"... ... .. .."
|
|
1132
|
+
],
|
|
1133
|
+
[
|
|
1134
|
+
"Turkmenistan",
|
|
1135
|
+
"tm",
|
|
1136
|
+
"993"
|
|
1137
|
+
],
|
|
1138
|
+
[
|
|
1139
|
+
"Tuvalu",
|
|
1140
|
+
"tv",
|
|
1141
|
+
"688"
|
|
1142
|
+
],
|
|
1143
|
+
[
|
|
1144
|
+
"Uganda",
|
|
1145
|
+
"ug",
|
|
1146
|
+
"256"
|
|
1147
|
+
],
|
|
1148
|
+
[
|
|
1149
|
+
"Ukraine",
|
|
1150
|
+
"ua",
|
|
1151
|
+
"380",
|
|
1152
|
+
"(..) ... .. .."
|
|
1153
|
+
],
|
|
1154
|
+
[
|
|
1155
|
+
"United Arab Emirates",
|
|
1156
|
+
"ae",
|
|
1157
|
+
"971",
|
|
1158
|
+
{
|
|
1159
|
+
default: ".. ... ....",
|
|
1160
|
+
"/^5[024568]/": ".. ... ....",
|
|
1161
|
+
"/^[234679]/": ". ... ...."
|
|
1162
|
+
}
|
|
1163
|
+
],
|
|
1164
|
+
[
|
|
1165
|
+
"United Kingdom",
|
|
1166
|
+
"gb",
|
|
1167
|
+
"44",
|
|
1168
|
+
".... ......"
|
|
1169
|
+
],
|
|
1170
|
+
[
|
|
1171
|
+
"United States",
|
|
1172
|
+
"us",
|
|
1173
|
+
"1",
|
|
1174
|
+
"(...) ...-....",
|
|
1175
|
+
0
|
|
1176
|
+
],
|
|
1177
|
+
[
|
|
1178
|
+
"Uruguay",
|
|
1179
|
+
"uy",
|
|
1180
|
+
"598"
|
|
1181
|
+
],
|
|
1182
|
+
[
|
|
1183
|
+
"Uzbekistan",
|
|
1184
|
+
"uz",
|
|
1185
|
+
"998",
|
|
1186
|
+
".. ... .. .."
|
|
1187
|
+
],
|
|
1188
|
+
[
|
|
1189
|
+
"Vanuatu",
|
|
1190
|
+
"vu",
|
|
1191
|
+
"678"
|
|
1192
|
+
],
|
|
1193
|
+
[
|
|
1194
|
+
"Vatican City",
|
|
1195
|
+
"va",
|
|
1196
|
+
"39",
|
|
1197
|
+
".. .... ....",
|
|
1198
|
+
1
|
|
1199
|
+
],
|
|
1200
|
+
[
|
|
1201
|
+
"Venezuela",
|
|
1202
|
+
"ve",
|
|
1203
|
+
"58"
|
|
1204
|
+
],
|
|
1205
|
+
[
|
|
1206
|
+
"Vietnam",
|
|
1207
|
+
"vn",
|
|
1208
|
+
"84"
|
|
1209
|
+
],
|
|
1210
|
+
[
|
|
1211
|
+
"Wallis & Futuna",
|
|
1212
|
+
"wf",
|
|
1213
|
+
"681",
|
|
1214
|
+
".. .. .."
|
|
1215
|
+
],
|
|
1216
|
+
[
|
|
1217
|
+
"Yemen",
|
|
1218
|
+
"ye",
|
|
1219
|
+
"967"
|
|
1220
|
+
],
|
|
1221
|
+
[
|
|
1222
|
+
"Zambia",
|
|
1223
|
+
"zm",
|
|
1224
|
+
"260"
|
|
1225
|
+
],
|
|
1226
|
+
[
|
|
1227
|
+
"Zimbabwe",
|
|
1228
|
+
"zw",
|
|
1229
|
+
"263"
|
|
1230
|
+
]
|
|
1231
|
+
], d = "react-international-phone-", f = (...e) => e.filter((e) => !!e).join(" ").trim(), p = (...e) => f(...e).split(" ").map((e) => `${d}${e}`).join(" "), m = ({ addPrefix: e, rawClassNames: t }) => f(p(...e), ...t), h = ({ value: e, mask: t, maskSymbol: n, offset: r = 0, trimNonMaskCharsLeftover: i = !1, allowMaskOverflow: a = !1 }) => {
|
|
1232
|
+
if (e.length < r) return e;
|
|
1233
|
+
let o = e.slice(0, r), s = e.slice(r), c = t.split("").filter((e) => e === n).length, l = s.slice(0, c), u = a ? s.slice(c) : "", d = o, f = 0;
|
|
1234
|
+
for (let e of t.split("")) {
|
|
1235
|
+
if (f >= l.length) {
|
|
1236
|
+
if (!i && e !== n) {
|
|
1237
|
+
d += e;
|
|
1238
|
+
continue;
|
|
1239
|
+
}
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
e === n ? (d += l[f], f += 1) : d += e;
|
|
1243
|
+
}
|
|
1244
|
+
return d + u;
|
|
1245
|
+
}, g = (e) => e ? /^\d+$/.test(e) : !1, _ = (e) => e.replace(/\D/g, ""), v = (e, t) => {
|
|
1246
|
+
let n = e.style.display;
|
|
1247
|
+
n !== "block" && (e.style.display = "block");
|
|
1248
|
+
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = i.top - r.top, o = r.bottom - i.bottom;
|
|
1249
|
+
a >= 0 && o >= 0 || (Math.abs(a) < Math.abs(o) ? e.scrollTop += a : e.scrollTop -= o), e.style.display = n;
|
|
1250
|
+
}, y = () => typeof window > "u" ? !1 : window.navigator.userAgent.toLowerCase().includes("macintosh"), b = (e, t) => {
|
|
1251
|
+
let n = t.disableDialCodeAndPrefix ? !1 : t.forceDialCode, r = t.disableDialCodeAndPrefix ? !1 : t.insertDialCodeOnEmpty, i = e, a = (e) => t.trimNonDigitsEnd ? e.trim() : e;
|
|
1252
|
+
if (!i) return r && !i.length || n ? a(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`) : a(i);
|
|
1253
|
+
if (i = _(i), i === t.dialCode && !t.disableDialCodeAndPrefix) return a(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);
|
|
1254
|
+
if (t.dialCode.startsWith(i) && !t.disableDialCodeAndPrefix) return a(n ? `${t.prefix}${t.dialCode}${t.charAfterDialCode}` : `${t.prefix}${i}`);
|
|
1255
|
+
if (!i.startsWith(t.dialCode) && !t.disableDialCodeAndPrefix) {
|
|
1256
|
+
if (n) return a(`${t.prefix}${t.dialCode}${t.charAfterDialCode}`);
|
|
1257
|
+
if (i.length < t.dialCode.length) return a(`${t.prefix}${i}`);
|
|
1258
|
+
}
|
|
1259
|
+
let { phoneLeftSide: o, phoneRightSide: s } = (() => {
|
|
1260
|
+
let e = t.dialCode.length;
|
|
1261
|
+
return {
|
|
1262
|
+
phoneLeftSide: i.slice(0, e),
|
|
1263
|
+
phoneRightSide: i.slice(e)
|
|
1264
|
+
};
|
|
1265
|
+
})();
|
|
1266
|
+
return o = `${t.prefix}${o}${t.charAfterDialCode}`, s = h({
|
|
1267
|
+
value: s,
|
|
1268
|
+
mask: t.mask,
|
|
1269
|
+
maskSymbol: t.maskChar,
|
|
1270
|
+
trimNonMaskCharsLeftover: t.trimNonDigitsEnd || t.disableDialCodeAndPrefix && s.length === 0,
|
|
1271
|
+
allowMaskOverflow: t.allowMaskOverflow
|
|
1272
|
+
}), t.disableDialCodeAndPrefix && (o = ""), a(`${o}${s}`);
|
|
1273
|
+
}, x = ({ phoneBeforeInput: e, phoneAfterInput: t, phoneAfterFormatted: n, cursorPositionAfterInput: r, leftOffset: i = 0, deletion: a }) => {
|
|
1274
|
+
if (r < i) return i;
|
|
1275
|
+
if (!e) return n.length;
|
|
1276
|
+
let o = null;
|
|
1277
|
+
for (let e = r - 1; e >= 0; --e) if (g(t[e])) {
|
|
1278
|
+
o = e;
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
if (o === null) {
|
|
1282
|
+
for (let e = 0; e < t.length; e += 1) if (g(n[e])) return e;
|
|
1283
|
+
return t.length;
|
|
1284
|
+
}
|
|
1285
|
+
let s = 0;
|
|
1286
|
+
for (let e = 0; e < o; e += 1) g(t[e]) && (s += 1);
|
|
1287
|
+
let c = 0, l = 0;
|
|
1288
|
+
for (let e = 0; e < n.length && (c += 1, g(n[e]) && (l += 1), !(l >= s + 1)); e += 1);
|
|
1289
|
+
if (a !== "backward") for (; !g(n[c]) && c < n.length;) c += 1;
|
|
1290
|
+
return c;
|
|
1291
|
+
}, S = ({ phone: e, prefix: t }) => e ? `${t}${_(e)}` : "";
|
|
1292
|
+
function C({ value: e, country: t, insertDialCodeOnEmpty: n, trimNonDigitsEnd: r, countries: i, prefix: a, charAfterDialCode: o, forceDialCode: s, disableDialCodeAndPrefix: c, defaultMask: l, countryGuessingEnabled: u, disableFormatting: d, allowMaskOverflow: f }) {
|
|
1293
|
+
let p = e;
|
|
1294
|
+
c && (p = p.startsWith(`${a}`) ? p : `${a}${t.dialCode}${p}`);
|
|
1295
|
+
let m = u ? L({
|
|
1296
|
+
phone: p,
|
|
1297
|
+
countries: i,
|
|
1298
|
+
currentCountryIso2: t?.iso2
|
|
1299
|
+
}) : void 0, h = m?.country ?? t, g = b(p, {
|
|
1300
|
+
prefix: a,
|
|
1301
|
+
mask: N({
|
|
1302
|
+
phone: p,
|
|
1303
|
+
country: h,
|
|
1304
|
+
defaultMask: l,
|
|
1305
|
+
disableFormatting: d
|
|
1306
|
+
}),
|
|
1307
|
+
maskChar: A,
|
|
1308
|
+
dialCode: h.dialCode,
|
|
1309
|
+
trimNonDigitsEnd: r,
|
|
1310
|
+
charAfterDialCode: o,
|
|
1311
|
+
forceDialCode: s,
|
|
1312
|
+
insertDialCodeOnEmpty: n,
|
|
1313
|
+
disableDialCodeAndPrefix: c,
|
|
1314
|
+
allowMaskOverflow: f
|
|
1315
|
+
}), _ = u && !m?.fullDialCodeMatch ? t : h;
|
|
1316
|
+
return {
|
|
1317
|
+
phone: S({
|
|
1318
|
+
phone: c ? `${_.dialCode}${g}` : g,
|
|
1319
|
+
prefix: a
|
|
1320
|
+
}),
|
|
1321
|
+
inputValue: g,
|
|
1322
|
+
country: _
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
var w = (e) => {
|
|
1326
|
+
if (e?.toLocaleLowerCase().includes("delete") ?? !1) return e?.toLocaleLowerCase().includes("forward") ? "forward" : "backward";
|
|
1327
|
+
}, T = (e, { country: t, insertDialCodeOnEmpty: n, phoneBeforeInput: r, prefix: i, charAfterDialCode: a, forceDialCode: o, disableDialCodeAndPrefix: s, countryGuessingEnabled: c, defaultMask: l, disableFormatting: u, countries: d, allowMaskOverflow: f }) => {
|
|
1328
|
+
let p = e.nativeEvent, m = p.inputType, h = w(m), _ = !!m?.startsWith("insertFrom"), v = m === "insertText", y = p?.data || void 0, b = e.target.value, T = e.target.selectionStart ?? 0;
|
|
1329
|
+
if (m?.includes("history")) return {
|
|
1330
|
+
inputValue: r,
|
|
1331
|
+
phone: S({
|
|
1332
|
+
phone: r,
|
|
1333
|
+
prefix: i
|
|
1334
|
+
}),
|
|
1335
|
+
cursorPosition: r.length,
|
|
1336
|
+
country: t
|
|
1337
|
+
};
|
|
1338
|
+
if (v && !g(y) && b !== i) return {
|
|
1339
|
+
inputValue: r,
|
|
1340
|
+
phone: S({
|
|
1341
|
+
phone: s ? `${t.dialCode}${r}` : r,
|
|
1342
|
+
prefix: i
|
|
1343
|
+
}),
|
|
1344
|
+
cursorPosition: T - (y?.length ?? 0),
|
|
1345
|
+
country: t
|
|
1346
|
+
};
|
|
1347
|
+
if (o && !b.startsWith(`${i}${t.dialCode}`) && !_) {
|
|
1348
|
+
let e = b ? r : `${i}${t.dialCode}${a}`;
|
|
1349
|
+
return {
|
|
1350
|
+
inputValue: e,
|
|
1351
|
+
phone: S({
|
|
1352
|
+
phone: e,
|
|
1353
|
+
prefix: i
|
|
1354
|
+
}),
|
|
1355
|
+
cursorPosition: i.length + t.dialCode.length + a.length,
|
|
1356
|
+
country: t
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
let { phone: E, inputValue: D, country: O } = C({
|
|
1360
|
+
value: b,
|
|
1361
|
+
country: t,
|
|
1362
|
+
trimNonDigitsEnd: h === "backward",
|
|
1363
|
+
insertDialCodeOnEmpty: n,
|
|
1364
|
+
countryGuessingEnabled: c,
|
|
1365
|
+
countries: d,
|
|
1366
|
+
prefix: i,
|
|
1367
|
+
charAfterDialCode: a,
|
|
1368
|
+
forceDialCode: o,
|
|
1369
|
+
disableDialCodeAndPrefix: s,
|
|
1370
|
+
disableFormatting: u,
|
|
1371
|
+
defaultMask: l,
|
|
1372
|
+
allowMaskOverflow: f
|
|
1373
|
+
});
|
|
1374
|
+
return {
|
|
1375
|
+
phone: E,
|
|
1376
|
+
inputValue: D,
|
|
1377
|
+
cursorPosition: x({
|
|
1378
|
+
cursorPositionAfterInput: T,
|
|
1379
|
+
phoneBeforeInput: r,
|
|
1380
|
+
phoneAfterInput: b,
|
|
1381
|
+
phoneAfterFormatted: D,
|
|
1382
|
+
leftOffset: o ? i.length + t.dialCode.length + a.length : 0,
|
|
1383
|
+
deletion: h
|
|
1384
|
+
}),
|
|
1385
|
+
country: O
|
|
1386
|
+
};
|
|
1387
|
+
}, E = (e, t) => {
|
|
1388
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
1389
|
+
if (n.length !== r.length) return !1;
|
|
1390
|
+
for (let r of n) if (e[r] !== t[r]) return !1;
|
|
1391
|
+
return !0;
|
|
1392
|
+
}, D = () => {
|
|
1393
|
+
let e = o(), t = o(Date.now()), r = n(() => {
|
|
1394
|
+
let n = Date.now(), r = e.current ? n - t.current : void 0;
|
|
1395
|
+
return e.current = t.current, t.current = n, r;
|
|
1396
|
+
}, []);
|
|
1397
|
+
return a(() => ({ check: r }), [r]);
|
|
1398
|
+
}, O = {
|
|
1399
|
+
size: 20,
|
|
1400
|
+
overrideLastItemDebounceMS: -1
|
|
1401
|
+
};
|
|
1402
|
+
function k(e, t) {
|
|
1403
|
+
let { size: r, overrideLastItemDebounceMS: i, onChange: a } = {
|
|
1404
|
+
...O,
|
|
1405
|
+
...t
|
|
1406
|
+
}, [c, l] = s(e), u = o([c]), d = o(0), f = D();
|
|
1407
|
+
return [
|
|
1408
|
+
c,
|
|
1409
|
+
n((e, t) => {
|
|
1410
|
+
let n = u.current[d.current];
|
|
1411
|
+
if (e === n || typeof e == "object" && typeof n == "object" && E(e, n)) return;
|
|
1412
|
+
let o = i > 0, s = f.check(), c = o && s !== void 0 ? s > i : !0;
|
|
1413
|
+
if (t?.overrideLastItem === void 0 ? !c : t.overrideLastItem) u.current = [...u.current.slice(0, d.current), e];
|
|
1414
|
+
else {
|
|
1415
|
+
let t = u.current.length >= r;
|
|
1416
|
+
u.current = [...u.current.slice(+!!t, d.current + 1), e], t || (d.current += 1);
|
|
1417
|
+
}
|
|
1418
|
+
l(e), a?.(e);
|
|
1419
|
+
}, [
|
|
1420
|
+
a,
|
|
1421
|
+
i,
|
|
1422
|
+
r,
|
|
1423
|
+
f
|
|
1424
|
+
]),
|
|
1425
|
+
n(() => {
|
|
1426
|
+
if (d.current <= 0) return { success: !1 };
|
|
1427
|
+
let e = u.current[d.current - 1];
|
|
1428
|
+
return l(e), --d.current, a?.(e), {
|
|
1429
|
+
success: !0,
|
|
1430
|
+
value: e
|
|
1431
|
+
};
|
|
1432
|
+
}, [a]),
|
|
1433
|
+
n(() => {
|
|
1434
|
+
if (d.current + 1 >= u.current.length) return { success: !1 };
|
|
1435
|
+
let e = u.current[d.current + 1];
|
|
1436
|
+
return l(e), d.current += 1, a?.(e), {
|
|
1437
|
+
success: !0,
|
|
1438
|
+
value: e
|
|
1439
|
+
};
|
|
1440
|
+
}, [a])
|
|
1441
|
+
];
|
|
1442
|
+
}
|
|
1443
|
+
var A = ".", j = {
|
|
1444
|
+
defaultCountry: "us",
|
|
1445
|
+
value: "",
|
|
1446
|
+
prefix: "+",
|
|
1447
|
+
defaultMask: "............",
|
|
1448
|
+
charAfterDialCode: " ",
|
|
1449
|
+
historySaveDebounceMS: 200,
|
|
1450
|
+
disableCountryGuess: !1,
|
|
1451
|
+
disableDialCodePrefill: !1,
|
|
1452
|
+
forceDialCode: !1,
|
|
1453
|
+
disableDialCodeAndPrefix: !1,
|
|
1454
|
+
disableFormatting: !1,
|
|
1455
|
+
allowMaskOverflow: !1,
|
|
1456
|
+
countries: u,
|
|
1457
|
+
preferredCountries: []
|
|
1458
|
+
}, M = ({ defaultCountry: e = j.defaultCountry, value: t = j.value, countries: i = j.countries, prefix: c = j.prefix, defaultMask: l = j.defaultMask, charAfterDialCode: u = j.charAfterDialCode, historySaveDebounceMS: d = j.historySaveDebounceMS, disableCountryGuess: f = j.disableCountryGuess, disableDialCodePrefill: p = j.disableDialCodePrefill, forceDialCode: m = j.forceDialCode, disableDialCodeAndPrefix: h = j.disableDialCodeAndPrefix, disableFormatting: g = j.disableFormatting, allowMaskOverflow: _ = j.allowMaskOverflow, onChange: v, inputRef: b }) => {
|
|
1459
|
+
let x = {
|
|
1460
|
+
countries: i,
|
|
1461
|
+
prefix: c,
|
|
1462
|
+
charAfterDialCode: u,
|
|
1463
|
+
forceDialCode: h ? !1 : m,
|
|
1464
|
+
disableDialCodeAndPrefix: h,
|
|
1465
|
+
defaultMask: l,
|
|
1466
|
+
countryGuessingEnabled: !f,
|
|
1467
|
+
disableFormatting: g,
|
|
1468
|
+
allowMaskOverflow: _
|
|
1469
|
+
}, S = o(null), w = b || S, E = (e) => {
|
|
1470
|
+
Promise.resolve().then(() => {
|
|
1471
|
+
typeof window > "u" || w.current !== document?.activeElement || w.current?.setSelectionRange(e, e);
|
|
1472
|
+
});
|
|
1473
|
+
}, D = n((e) => I({
|
|
1474
|
+
value: e,
|
|
1475
|
+
field: "iso2",
|
|
1476
|
+
countries: i
|
|
1477
|
+
}), [i]), [{ phone: O, inputValue: A, country: M }, N, P, F] = k(() => {
|
|
1478
|
+
let n = I({
|
|
1479
|
+
value: e,
|
|
1480
|
+
field: "iso2",
|
|
1481
|
+
countries: i
|
|
1482
|
+
});
|
|
1483
|
+
n || console.error(`[react-international-phone]: can not find a country with "${e}" iso2 code`);
|
|
1484
|
+
let { phone: r, inputValue: a, country: o } = C({
|
|
1485
|
+
value: t,
|
|
1486
|
+
country: n || I({
|
|
1487
|
+
value: "us",
|
|
1488
|
+
field: "iso2",
|
|
1489
|
+
countries: i
|
|
1490
|
+
}),
|
|
1491
|
+
insertDialCodeOnEmpty: !p,
|
|
1492
|
+
...x
|
|
1493
|
+
});
|
|
1494
|
+
return E(a.length), {
|
|
1495
|
+
phone: r,
|
|
1496
|
+
inputValue: a,
|
|
1497
|
+
country: o.iso2
|
|
1498
|
+
};
|
|
1499
|
+
}, {
|
|
1500
|
+
overrideLastItemDebounceMS: d,
|
|
1501
|
+
onChange: n(({ inputValue: e, phone: t, country: n }) => {
|
|
1502
|
+
v && v({
|
|
1503
|
+
phone: t,
|
|
1504
|
+
inputValue: e,
|
|
1505
|
+
country: D(n)
|
|
1506
|
+
});
|
|
1507
|
+
}, [D, v])
|
|
1508
|
+
}), L = a(() => D(M), [M, D]);
|
|
1509
|
+
r(() => {
|
|
1510
|
+
let e = w.current;
|
|
1511
|
+
if (!e) return;
|
|
1512
|
+
let t = (e) => {
|
|
1513
|
+
if (!e.key) return;
|
|
1514
|
+
let t = e.ctrlKey, n = e.metaKey, r = e.shiftKey;
|
|
1515
|
+
if (e.key.toLowerCase() === "z") {
|
|
1516
|
+
if (y()) {
|
|
1517
|
+
if (!n) return;
|
|
1518
|
+
} else if (!t) return;
|
|
1519
|
+
r ? F() : P();
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
return e.addEventListener("keydown", t), () => {
|
|
1523
|
+
e.removeEventListener("keydown", t);
|
|
1524
|
+
};
|
|
1525
|
+
}, [
|
|
1526
|
+
w,
|
|
1527
|
+
P,
|
|
1528
|
+
F
|
|
1529
|
+
]);
|
|
1530
|
+
let R = (e) => {
|
|
1531
|
+
e.preventDefault();
|
|
1532
|
+
let { phone: n, inputValue: r, country: i, cursorPosition: a } = T(e, {
|
|
1533
|
+
country: L,
|
|
1534
|
+
phoneBeforeInput: A,
|
|
1535
|
+
insertDialCodeOnEmpty: !1,
|
|
1536
|
+
...x
|
|
1537
|
+
});
|
|
1538
|
+
return N({
|
|
1539
|
+
inputValue: r,
|
|
1540
|
+
phone: n,
|
|
1541
|
+
country: i.iso2
|
|
1542
|
+
}), E(a), t;
|
|
1543
|
+
}, z = n((e, t = { focusOnInput: !1 }) => {
|
|
1544
|
+
let n = I({
|
|
1545
|
+
value: e,
|
|
1546
|
+
field: "iso2",
|
|
1547
|
+
countries: i
|
|
1548
|
+
});
|
|
1549
|
+
if (!n) {
|
|
1550
|
+
console.error(`[react-international-phone]: can not find a country with "${e}" iso2 code`);
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
N({
|
|
1554
|
+
inputValue: h ? "" : `${c}${n.dialCode}${u}`,
|
|
1555
|
+
phone: `${c}${n.dialCode}`,
|
|
1556
|
+
country: n.iso2
|
|
1557
|
+
}), t.focusOnInput && Promise.resolve().then(() => {
|
|
1558
|
+
w.current?.focus();
|
|
1559
|
+
});
|
|
1560
|
+
}, [
|
|
1561
|
+
i,
|
|
1562
|
+
h,
|
|
1563
|
+
c,
|
|
1564
|
+
u,
|
|
1565
|
+
N,
|
|
1566
|
+
w
|
|
1567
|
+
]), [B, V] = s(!1);
|
|
1568
|
+
return r(() => {
|
|
1569
|
+
if (!B) {
|
|
1570
|
+
V(!0), t !== O && v?.({
|
|
1571
|
+
inputValue: A,
|
|
1572
|
+
phone: O,
|
|
1573
|
+
country: L
|
|
1574
|
+
});
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
if (t === O) return;
|
|
1578
|
+
let { phone: e, inputValue: n, country: r } = C({
|
|
1579
|
+
value: t,
|
|
1580
|
+
country: L,
|
|
1581
|
+
insertDialCodeOnEmpty: !p,
|
|
1582
|
+
...x
|
|
1583
|
+
});
|
|
1584
|
+
N({
|
|
1585
|
+
phone: e,
|
|
1586
|
+
inputValue: n,
|
|
1587
|
+
country: r.iso2
|
|
1588
|
+
});
|
|
1589
|
+
}, [t]), {
|
|
1590
|
+
phone: O,
|
|
1591
|
+
inputValue: A,
|
|
1592
|
+
country: L,
|
|
1593
|
+
setCountry: z,
|
|
1594
|
+
handlePhoneValueChange: R,
|
|
1595
|
+
inputRef: w
|
|
1596
|
+
};
|
|
1597
|
+
}, N = ({ phone: e, country: t, defaultMask: n = "............", disableFormatting: r = !1 }) => {
|
|
1598
|
+
let i = t.format, a = (e) => r ? e.replace(RegExp(`[^${A}]`, "g"), "") : e;
|
|
1599
|
+
if (!i) return a(n);
|
|
1600
|
+
if (typeof i == "string") return a(i);
|
|
1601
|
+
if (!i.default) return console.error(`[react-international-phone]: default mask for ${t.iso2} is not provided`), a(n);
|
|
1602
|
+
let o = Object.keys(i).find((n) => {
|
|
1603
|
+
if (n === "default") return !1;
|
|
1604
|
+
if (!(n.charAt(0) === "/" && n.charAt(n.length - 1) === "/")) return console.error(`[react-international-phone]: format regex "${n}" for ${t.iso2} is not valid`), !1;
|
|
1605
|
+
let r = new RegExp(n.substring(1, n.length - 1)), i = e.replace(t.dialCode, "");
|
|
1606
|
+
return r.test(_(i));
|
|
1607
|
+
});
|
|
1608
|
+
return a(o ? i[o] : i.default);
|
|
1609
|
+
}, P = (e) => {
|
|
1610
|
+
let [t, n, r, i, a, o] = e;
|
|
1611
|
+
return {
|
|
1612
|
+
name: t,
|
|
1613
|
+
iso2: n,
|
|
1614
|
+
dialCode: r,
|
|
1615
|
+
format: i,
|
|
1616
|
+
priority: a,
|
|
1617
|
+
areaCodes: o
|
|
1618
|
+
};
|
|
1619
|
+
}, F = (e) => `Field "${e}" is not supported`, I = ({ field: e, value: t, countries: n = u }) => {
|
|
1620
|
+
if (["priority"].includes(e)) throw Error(F(e));
|
|
1621
|
+
let r = n.find((n) => t === P(n)[e]);
|
|
1622
|
+
if (r) return P(r);
|
|
1623
|
+
}, L = ({ phone: e, countries: t = u, currentCountryIso2: n }) => {
|
|
1624
|
+
let r = {
|
|
1625
|
+
country: void 0,
|
|
1626
|
+
fullDialCodeMatch: !1
|
|
1627
|
+
};
|
|
1628
|
+
if (!e) return r;
|
|
1629
|
+
let i = _(e);
|
|
1630
|
+
if (!i) return r;
|
|
1631
|
+
let a = r, o = ({ country: e, fullDialCodeMatch: t }) => {
|
|
1632
|
+
let n = e.dialCode === a.country?.dialCode, r = (e.priority ?? 0) < (a.country?.priority ?? 0);
|
|
1633
|
+
(!n || r) && (a = {
|
|
1634
|
+
country: e,
|
|
1635
|
+
fullDialCodeMatch: t
|
|
1636
|
+
});
|
|
1637
|
+
};
|
|
1638
|
+
for (let e of t) {
|
|
1639
|
+
let t = P(e), { dialCode: n, areaCodes: r } = t;
|
|
1640
|
+
if (i.startsWith(n)) {
|
|
1641
|
+
let e = a.country ? Number(n) >= Number(a.country.dialCode) : !0;
|
|
1642
|
+
if (r) {
|
|
1643
|
+
let e = i.substring(n.length);
|
|
1644
|
+
for (let n of r) if (e.startsWith(n)) return {
|
|
1645
|
+
country: t,
|
|
1646
|
+
fullDialCodeMatch: !0
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
(e || n === i || !a.fullDialCodeMatch) && o({
|
|
1650
|
+
country: t,
|
|
1651
|
+
fullDialCodeMatch: !0
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
a.fullDialCodeMatch || i.length < n.length && n.startsWith(i) && (!a.country || Number(n) <= Number(a.country.dialCode)) && o({
|
|
1655
|
+
country: t,
|
|
1656
|
+
fullDialCodeMatch: !1
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
if (n) {
|
|
1660
|
+
let e = I({
|
|
1661
|
+
value: n,
|
|
1662
|
+
field: "iso2",
|
|
1663
|
+
countries: t
|
|
1664
|
+
});
|
|
1665
|
+
if (!e) return a;
|
|
1666
|
+
let r = e ? ((e) => {
|
|
1667
|
+
if (!e?.areaCodes) return !1;
|
|
1668
|
+
let t = i.substring(e.dialCode.length);
|
|
1669
|
+
return e.areaCodes.some((e) => e.startsWith(t));
|
|
1670
|
+
})(e) : !1;
|
|
1671
|
+
a && a.country?.dialCode === e.dialCode && a.country !== e && a.fullDialCodeMatch && (!e.areaCodes || r) && (a = {
|
|
1672
|
+
country: e,
|
|
1673
|
+
fullDialCodeMatch: !0
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
return a;
|
|
1677
|
+
}, R = (e, t) => Number(parseInt(e, 16) + t).toString(16), z = "abcdefghijklmnopqrstuvwxyz", B = "1f1e6", V = z.split("").reduce((e, t, n) => ({
|
|
1678
|
+
...e,
|
|
1679
|
+
[t]: R(B, n)
|
|
1680
|
+
}), {}), H = (e) => [V[e[0]], V[e[1]]].join("-"), U = ({ iso2: t, size: n, src: r, protocol: i = "https", disableLazyLoading: a, className: o, style: s, ...c }) => t ? e.createElement("img", {
|
|
1681
|
+
className: m({
|
|
1682
|
+
addPrefix: ["flag-emoji"],
|
|
1683
|
+
rawClassNames: [o]
|
|
1684
|
+
}),
|
|
1685
|
+
src: r || `${i}://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${H(t)}.svg`,
|
|
1686
|
+
width: n,
|
|
1687
|
+
height: n,
|
|
1688
|
+
draggable: !1,
|
|
1689
|
+
"data-country": t,
|
|
1690
|
+
loading: a ? void 0 : "lazy",
|
|
1691
|
+
style: {
|
|
1692
|
+
width: n,
|
|
1693
|
+
height: n,
|
|
1694
|
+
...s
|
|
1695
|
+
},
|
|
1696
|
+
alt: "",
|
|
1697
|
+
...c
|
|
1698
|
+
}) : e.createElement("img", {
|
|
1699
|
+
className: m({
|
|
1700
|
+
addPrefix: ["flag-emoji"],
|
|
1701
|
+
rawClassNames: [o]
|
|
1702
|
+
}),
|
|
1703
|
+
width: n,
|
|
1704
|
+
height: n,
|
|
1705
|
+
...c
|
|
1706
|
+
}), W = 1e3, G = ({ show: t, dialCodePrefix: i = "+", selectedCountry: c, countries: l = u, preferredCountries: d = [], flags: f, onSelect: p, onClose: h, ...g }) => {
|
|
1707
|
+
let _ = o(null), y = o(), b = a(() => {
|
|
1708
|
+
if (!d || !d.length) return l;
|
|
1709
|
+
let e = [], t = [...l];
|
|
1710
|
+
for (let n of d) {
|
|
1711
|
+
let r = t.findIndex((e) => P(e).iso2 === n);
|
|
1712
|
+
if (r !== -1) {
|
|
1713
|
+
let n = t.splice(r, 1)[0];
|
|
1714
|
+
e.push(n);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
return e.concat(t);
|
|
1718
|
+
}, [l, d]), x = o({
|
|
1719
|
+
updatedAt: void 0,
|
|
1720
|
+
value: ""
|
|
1721
|
+
}), S = (e) => {
|
|
1722
|
+
x.current = {
|
|
1723
|
+
value: x.current.updatedAt && (/* @__PURE__ */ new Date()).getTime() - x.current.updatedAt.getTime() > W ? e : `${x.current.value}${e}`,
|
|
1724
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
1725
|
+
};
|
|
1726
|
+
let t = b.findIndex((e) => P(e).name.toLowerCase().startsWith(x.current.value));
|
|
1727
|
+
t !== -1 && T(t);
|
|
1728
|
+
}, C = n((e) => b.findIndex((t) => P(t).iso2 === e), [b]), [w, T] = s(C(c)), E = () => {
|
|
1729
|
+
y.current !== c && T(C(c));
|
|
1730
|
+
}, D = n((e) => {
|
|
1731
|
+
T(C(e.iso2)), p?.(e);
|
|
1732
|
+
}, [p, C]), O = (e) => {
|
|
1733
|
+
let t = b.length - 1, n = (n) => e === "prev" ? n - 1 : e === "next" ? n + 1 : e === "last" ? t : 0;
|
|
1734
|
+
T((e) => {
|
|
1735
|
+
let r = n(e);
|
|
1736
|
+
return r < 0 ? 0 : r > t ? t : r;
|
|
1737
|
+
});
|
|
1738
|
+
}, k = (e) => {
|
|
1739
|
+
if (e.stopPropagation(), e.key === "Enter") {
|
|
1740
|
+
e.preventDefault(), D(P(b[w]));
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
if (e.key === "Escape") {
|
|
1744
|
+
h?.();
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
if (e.key === "ArrowUp") {
|
|
1748
|
+
e.preventDefault(), O("prev");
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
if (e.key === "ArrowDown") {
|
|
1752
|
+
e.preventDefault(), O("next");
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
if (e.key === "PageUp") {
|
|
1756
|
+
e.preventDefault(), O("first");
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
if (e.key === "PageDown") {
|
|
1760
|
+
e.preventDefault(), O("last");
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
e.key === " " && e.preventDefault(), e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey && S(e.key.toLocaleLowerCase());
|
|
1764
|
+
}, A = n(() => {
|
|
1765
|
+
if (!_.current || w === void 0) return;
|
|
1766
|
+
let e = P(b[w]).iso2;
|
|
1767
|
+
if (e === y.current) return;
|
|
1768
|
+
let t = _.current.querySelector(`[data-country="${e}"]`);
|
|
1769
|
+
t && (v(_.current, t), y.current = e);
|
|
1770
|
+
}, [w, b]);
|
|
1771
|
+
return r(() => {
|
|
1772
|
+
A();
|
|
1773
|
+
}, [w, A]), r(() => {
|
|
1774
|
+
_.current && (t ? _.current.focus() : E());
|
|
1775
|
+
}, [t]), r(() => {
|
|
1776
|
+
E();
|
|
1777
|
+
}, [c]), e.createElement("ul", {
|
|
1778
|
+
ref: _,
|
|
1779
|
+
role: "listbox",
|
|
1780
|
+
className: m({
|
|
1781
|
+
addPrefix: ["country-selector-dropdown"],
|
|
1782
|
+
rawClassNames: [g.className]
|
|
1783
|
+
}),
|
|
1784
|
+
style: {
|
|
1785
|
+
display: t ? "block" : "none",
|
|
1786
|
+
...g.style
|
|
1787
|
+
},
|
|
1788
|
+
onKeyDown: k,
|
|
1789
|
+
onBlur: h,
|
|
1790
|
+
tabIndex: -1,
|
|
1791
|
+
"aria-activedescendant": `react-international-phone__${P(b[w]).iso2}-option`
|
|
1792
|
+
}, b.map((t, n) => {
|
|
1793
|
+
let r = P(t), a = r.iso2 === c, o = n === w, s = d.includes(r.iso2), l = n === d.length - 1, u = f?.find((e) => e.iso2 === r.iso2);
|
|
1794
|
+
return e.createElement(e.Fragment, { key: r.iso2 }, e.createElement("li", {
|
|
1795
|
+
"data-country": r.iso2,
|
|
1796
|
+
role: "option",
|
|
1797
|
+
"aria-selected": a,
|
|
1798
|
+
"aria-label": `${r.name} ${i}${r.dialCode}`,
|
|
1799
|
+
id: `react-international-phone__${r.iso2}-option`,
|
|
1800
|
+
className: m({
|
|
1801
|
+
addPrefix: [
|
|
1802
|
+
"country-selector-dropdown__list-item",
|
|
1803
|
+
s && "country-selector-dropdown__list-item--preferred",
|
|
1804
|
+
a && "country-selector-dropdown__list-item--selected",
|
|
1805
|
+
o && "country-selector-dropdown__list-item--focused"
|
|
1806
|
+
],
|
|
1807
|
+
rawClassNames: [
|
|
1808
|
+
g.listItemClassName,
|
|
1809
|
+
s && g.listItemPreferredClassName,
|
|
1810
|
+
a && g.listItemSelectedClassName,
|
|
1811
|
+
o && g.listItemFocusedClassName
|
|
1812
|
+
]
|
|
1813
|
+
}),
|
|
1814
|
+
onClick: () => D(r),
|
|
1815
|
+
style: g.listItemStyle,
|
|
1816
|
+
title: r.name
|
|
1817
|
+
}, e.createElement(U, {
|
|
1818
|
+
iso2: r.iso2,
|
|
1819
|
+
src: u?.src,
|
|
1820
|
+
className: m({
|
|
1821
|
+
addPrefix: ["country-selector-dropdown__list-item-flag-emoji"],
|
|
1822
|
+
rawClassNames: [g.listItemFlagClassName]
|
|
1823
|
+
}),
|
|
1824
|
+
style: g.listItemFlagStyle
|
|
1825
|
+
}), e.createElement("span", {
|
|
1826
|
+
className: m({
|
|
1827
|
+
addPrefix: ["country-selector-dropdown__list-item-country-name"],
|
|
1828
|
+
rawClassNames: [g.listItemCountryNameClassName]
|
|
1829
|
+
}),
|
|
1830
|
+
style: g.listItemCountryNameStyle
|
|
1831
|
+
}, r.name), e.createElement("span", {
|
|
1832
|
+
className: m({
|
|
1833
|
+
addPrefix: ["country-selector-dropdown__list-item-dial-code"],
|
|
1834
|
+
rawClassNames: [g.listItemDialCodeClassName]
|
|
1835
|
+
}),
|
|
1836
|
+
style: g.listItemDialCodeStyle
|
|
1837
|
+
}, i, r.dialCode)), l ? e.createElement("hr", {
|
|
1838
|
+
className: m({
|
|
1839
|
+
addPrefix: ["country-selector-dropdown__preferred-list-divider"],
|
|
1840
|
+
rawClassNames: [g.preferredListDividerClassName]
|
|
1841
|
+
}),
|
|
1842
|
+
style: g.preferredListDividerStyle
|
|
1843
|
+
}) : null);
|
|
1844
|
+
}));
|
|
1845
|
+
}, K = e.memo(({ selectedCountry: t, onSelect: n, disabled: r, hideDropdown: i, countries: c = u, preferredCountries: l = [], flags: d, renderButtonWrapper: f, ...p }) => {
|
|
1846
|
+
let [h, g] = s(!1), _ = a(() => {
|
|
1847
|
+
if (t) return I({
|
|
1848
|
+
value: t,
|
|
1849
|
+
field: "iso2",
|
|
1850
|
+
countries: c
|
|
1851
|
+
});
|
|
1852
|
+
}, [c, t]), v = o(null), y = (e) => {
|
|
1853
|
+
e.key && ["ArrowUp", "ArrowDown"].includes(e.key) && (e.preventDefault(), g(!0));
|
|
1854
|
+
};
|
|
1855
|
+
return e.createElement("div", {
|
|
1856
|
+
className: m({
|
|
1857
|
+
addPrefix: ["country-selector"],
|
|
1858
|
+
rawClassNames: [p.className]
|
|
1859
|
+
}),
|
|
1860
|
+
style: p.style,
|
|
1861
|
+
ref: v
|
|
1862
|
+
}, (() => {
|
|
1863
|
+
let n = {
|
|
1864
|
+
title: _?.name,
|
|
1865
|
+
onClick: () => g((e) => !e),
|
|
1866
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1867
|
+
onKeyDown: y,
|
|
1868
|
+
disabled: i || r,
|
|
1869
|
+
role: "combobox",
|
|
1870
|
+
"aria-label": "Country selector",
|
|
1871
|
+
"aria-haspopup": "listbox",
|
|
1872
|
+
"aria-expanded": h
|
|
1873
|
+
}, a = e.createElement("div", {
|
|
1874
|
+
className: m({
|
|
1875
|
+
addPrefix: ["country-selector-button__button-content"],
|
|
1876
|
+
rawClassNames: [p.buttonContentWrapperClassName]
|
|
1877
|
+
}),
|
|
1878
|
+
style: p.buttonContentWrapperStyle
|
|
1879
|
+
}, e.createElement(U, {
|
|
1880
|
+
iso2: t,
|
|
1881
|
+
src: d?.find((e) => e.iso2 === t)?.src,
|
|
1882
|
+
className: m({
|
|
1883
|
+
addPrefix: ["country-selector-button__flag-emoji", r && "country-selector-button__flag-emoji--disabled"],
|
|
1884
|
+
rawClassNames: [p.flagClassName]
|
|
1885
|
+
}),
|
|
1886
|
+
style: {
|
|
1887
|
+
visibility: t ? "visible" : "hidden",
|
|
1888
|
+
...p.flagStyle
|
|
1889
|
+
}
|
|
1890
|
+
}), !i && e.createElement("div", {
|
|
1891
|
+
className: m({
|
|
1892
|
+
addPrefix: [
|
|
1893
|
+
"country-selector-button__dropdown-arrow",
|
|
1894
|
+
r && "country-selector-button__dropdown-arrow--disabled",
|
|
1895
|
+
h && "country-selector-button__dropdown-arrow--active"
|
|
1896
|
+
],
|
|
1897
|
+
rawClassNames: [p.dropdownArrowClassName]
|
|
1898
|
+
}),
|
|
1899
|
+
style: p.dropdownArrowStyle
|
|
1900
|
+
}));
|
|
1901
|
+
return f ? f({
|
|
1902
|
+
children: a,
|
|
1903
|
+
rootProps: n
|
|
1904
|
+
}) : e.createElement("button", {
|
|
1905
|
+
...n,
|
|
1906
|
+
type: "button",
|
|
1907
|
+
className: m({
|
|
1908
|
+
addPrefix: [
|
|
1909
|
+
"country-selector-button",
|
|
1910
|
+
h && "country-selector-button--active",
|
|
1911
|
+
r && "country-selector-button--disabled",
|
|
1912
|
+
i && "country-selector-button--hide-dropdown"
|
|
1913
|
+
],
|
|
1914
|
+
rawClassNames: [p.buttonClassName]
|
|
1915
|
+
}),
|
|
1916
|
+
"data-country": t,
|
|
1917
|
+
style: p.buttonStyle
|
|
1918
|
+
}, a);
|
|
1919
|
+
})(), e.createElement(G, {
|
|
1920
|
+
show: h,
|
|
1921
|
+
countries: c,
|
|
1922
|
+
preferredCountries: l,
|
|
1923
|
+
flags: d,
|
|
1924
|
+
onSelect: (e) => {
|
|
1925
|
+
g(!1), n?.(e);
|
|
1926
|
+
},
|
|
1927
|
+
selectedCountry: t,
|
|
1928
|
+
onClose: () => {
|
|
1929
|
+
g(!1);
|
|
1930
|
+
},
|
|
1931
|
+
...p.dropdownStyleProps
|
|
1932
|
+
}));
|
|
1933
|
+
}), q = ({ dialCode: t, prefix: n, disabled: r, style: i, className: a }) => e.createElement("div", {
|
|
1934
|
+
className: m({
|
|
1935
|
+
addPrefix: ["dial-code-preview", r && "dial-code-preview--disabled"],
|
|
1936
|
+
rawClassNames: [a]
|
|
1937
|
+
}),
|
|
1938
|
+
style: i
|
|
1939
|
+
}, `${n}${t}`), J = t(({ value: t, onChange: r, countries: a = u, preferredCountries: o, hideDropdown: s, showDisabledDialCodeAndPrefix: c, disableFocusAfterCountrySelect: l, flags: d, style: f, className: p, inputStyle: h, inputClassName: g, countrySelectorStyleProps: _, dialCodePreviewStyleProps: v, inputProps: y, placeholder: b, disabled: x, name: S, onFocus: C, onBlur: w, required: T, autoFocus: E, ...D }, O) => {
|
|
1940
|
+
let k = n((e) => {
|
|
1941
|
+
r?.(e.phone, {
|
|
1942
|
+
country: e.country,
|
|
1943
|
+
inputValue: e.inputValue
|
|
1944
|
+
});
|
|
1945
|
+
}, [r]), { phone: A, inputValue: j, inputRef: N, country: P, setCountry: F, handlePhoneValueChange: I } = M({
|
|
1946
|
+
value: t,
|
|
1947
|
+
countries: a,
|
|
1948
|
+
...D,
|
|
1949
|
+
onChange: k
|
|
1950
|
+
}), L = D.disableDialCodeAndPrefix && c && P?.dialCode, R = n((e) => {
|
|
1951
|
+
F(e.iso2, { focusOnInput: !l });
|
|
1952
|
+
}, [F, l]);
|
|
1953
|
+
return i(O, () => N.current ? Object.assign(N.current, {
|
|
1954
|
+
setCountry: F,
|
|
1955
|
+
state: {
|
|
1956
|
+
phone: A,
|
|
1957
|
+
inputValue: j,
|
|
1958
|
+
country: P
|
|
1959
|
+
}
|
|
1960
|
+
}) : null, [
|
|
1961
|
+
N,
|
|
1962
|
+
F,
|
|
1963
|
+
A,
|
|
1964
|
+
j,
|
|
1965
|
+
P
|
|
1966
|
+
]), e.createElement("div", {
|
|
1967
|
+
ref: O,
|
|
1968
|
+
className: m({
|
|
1969
|
+
addPrefix: ["input-container"],
|
|
1970
|
+
rawClassNames: [p]
|
|
1971
|
+
}),
|
|
1972
|
+
style: f
|
|
1973
|
+
}, e.createElement(K, {
|
|
1974
|
+
onSelect: R,
|
|
1975
|
+
flags: d,
|
|
1976
|
+
selectedCountry: P?.iso2,
|
|
1977
|
+
countries: a,
|
|
1978
|
+
preferredCountries: o,
|
|
1979
|
+
disabled: x,
|
|
1980
|
+
hideDropdown: s,
|
|
1981
|
+
..._
|
|
1982
|
+
}), L && e.createElement(q, {
|
|
1983
|
+
dialCode: P.dialCode,
|
|
1984
|
+
prefix: D.prefix ?? "+",
|
|
1985
|
+
disabled: x,
|
|
1986
|
+
...v
|
|
1987
|
+
}), e.createElement("input", {
|
|
1988
|
+
onChange: I,
|
|
1989
|
+
value: j,
|
|
1990
|
+
type: "tel",
|
|
1991
|
+
ref: N,
|
|
1992
|
+
className: m({
|
|
1993
|
+
addPrefix: ["input", x && "input--disabled"],
|
|
1994
|
+
rawClassNames: [g]
|
|
1995
|
+
}),
|
|
1996
|
+
placeholder: b,
|
|
1997
|
+
disabled: x,
|
|
1998
|
+
style: h,
|
|
1999
|
+
name: S,
|
|
2000
|
+
onFocus: C,
|
|
2001
|
+
onBlur: w,
|
|
2002
|
+
autoFocus: E,
|
|
2003
|
+
required: T,
|
|
2004
|
+
...y
|
|
2005
|
+
}));
|
|
2006
|
+
}), Y = [
|
|
2007
|
+
"us",
|
|
2008
|
+
"gb",
|
|
2009
|
+
"ca",
|
|
2010
|
+
"au",
|
|
2011
|
+
"nz",
|
|
2012
|
+
"ie",
|
|
2013
|
+
"ae",
|
|
2014
|
+
"sg"
|
|
2015
|
+
], X = [...u.filter((e) => Y.includes(e[1])), ...u.filter((e) => !Y.includes(e[1]))];
|
|
2016
|
+
function Z({ field: e, value: t, onChange: n }) {
|
|
2017
|
+
return /* @__PURE__ */ l("div", {
|
|
2018
|
+
className: "flex flex-col w-full relative z-[99999]",
|
|
2019
|
+
children: [/* @__PURE__ */ l("label", {
|
|
2020
|
+
className: "text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1",
|
|
2021
|
+
children: [
|
|
2022
|
+
e.label,
|
|
2023
|
+
" ",
|
|
2024
|
+
e.required && /* @__PURE__ */ c("span", {
|
|
2025
|
+
className: "text-red-500",
|
|
2026
|
+
children: "*"
|
|
2027
|
+
})
|
|
2028
|
+
]
|
|
2029
|
+
}), /* @__PURE__ */ c(J, {
|
|
2030
|
+
defaultCountry: "us",
|
|
2031
|
+
countries: X,
|
|
2032
|
+
value: t,
|
|
2033
|
+
onChange: (e) => n(e),
|
|
2034
|
+
forceDialCode: !0,
|
|
2035
|
+
className: "w-full flex items-center rounded-xl text-[15px] text-foreground transition-all duration-300 focus-within:border-accent glow-focus glass-panel overflow-visible relative h-12",
|
|
2036
|
+
inputClassName: "flex-1 w-full !bg-transparent !border-none !outline-none !shadow-none px-3 text-[15px] text-foreground m-0 p-0 h-full tracking-[0.5px] no-glow",
|
|
2037
|
+
countrySelectorStyleProps: { buttonClassName: "!bg-transparent !border-0 border-r !border-[var(--panel-border)]/50 !outline-none !shadow-none !px-3 hover:!bg-foreground/5 transition-colors h-full !rounded-xl !rounded-r-none flex items-center justify-center shrink-0" }
|
|
2038
|
+
})]
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
//#endregion
|
|
2042
|
+
export { Z as default };
|