intl-tel-input 27.3.0 → 28.0.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.
Files changed (38) hide show
  1. package/dist/css/intlTelInput-no-assets.css +2 -2
  2. package/dist/css/intlTelInput.css +3 -3
  3. package/dist/js/data.d.ts +1 -4
  4. package/dist/js/data.js +3 -9
  5. package/dist/js/data.min.js +2 -2
  6. package/dist/js/data.mjs +2 -8
  7. package/dist/js/i18n.d.ts +1 -1592
  8. package/dist/js/intlTelInput.d.ts +62 -49
  9. package/dist/js/intlTelInput.js +221 -182
  10. package/dist/js/intlTelInput.min.js +6 -6
  11. package/dist/js/intlTelInput.mjs +219 -180
  12. package/dist/js/intlTelInputWithUtils.js +622 -568
  13. package/dist/js/intlTelInputWithUtils.min.js +6 -6
  14. package/dist/js/intlTelInputWithUtils.mjs +620 -566
  15. package/dist/js/utils.js +56 -55
  16. package/package.json +14 -181
  17. package/CHANGELOG.md +0 -33
  18. package/angular/README.md +0 -13
  19. package/angular/dist/IntlTelInput.d.ts +0 -110
  20. package/angular/dist/IntlTelInput.js +0 -5096
  21. package/angular/dist/IntlTelInputWithUtils.d.ts +0 -3
  22. package/angular/dist/IntlTelInputWithUtils.js +0 -11435
  23. package/react/README.md +0 -13
  24. package/react/dist/IntlTelInput.d.ts +0 -25
  25. package/react/dist/IntlTelInput.js +0 -4788
  26. package/react/dist/IntlTelInputWithUtils.d.ts +0 -4
  27. package/react/dist/IntlTelInputWithUtils.js +0 -11127
  28. package/svelte/README.md +0 -14
  29. package/svelte/src/IntlTelInput.svelte +0 -233
  30. package/svelte/src/IntlTelInput.svelte.d.ts +0 -36
  31. package/svelte/src/IntlTelInputWithUtils.svelte +0 -24
  32. package/vue/README.md +0 -14
  33. package/vue/dist/IntlTelInput-jw1tkqdD.js +0 -2657
  34. package/vue/dist/IntlTelInput.js +0 -5
  35. package/vue/dist/IntlTelInput.vue.d.ts +0 -43
  36. package/vue/dist/IntlTelInputWithUtils.js +0 -49403
  37. package/vue/dist/index.d.ts +0 -4
  38. package/vue/dist/indexWithUtils.d.ts +0 -3
@@ -1,2657 +0,0 @@
1
- import { computed as e, createElementBlock as t, defineComponent as n, getCurrentInstance as r, mergeProps as i, onMounted as a, onUnmounted as o, openBlock as s, ref as c, shallowRef as l, watch as u } from "vue";
2
- //#region dist/js/intlTelInput.mjs
3
- var d = [
4
- [
5
- "af",
6
- "93",
7
- 0,
8
- null,
9
- "0"
10
- ],
11
- [
12
- "ax",
13
- "358",
14
- 1,
15
- ["18", "4"],
16
- "0"
17
- ],
18
- [
19
- "al",
20
- "355",
21
- 0,
22
- null,
23
- "0"
24
- ],
25
- [
26
- "dz",
27
- "213",
28
- 0,
29
- null,
30
- "0"
31
- ],
32
- [
33
- "as",
34
- "1",
35
- 5,
36
- ["684"],
37
- "1"
38
- ],
39
- ["ad", "376"],
40
- ["ao", "244"],
41
- [
42
- "ai",
43
- "1",
44
- 6,
45
- ["264"],
46
- "1"
47
- ],
48
- [
49
- "ag",
50
- "1",
51
- 7,
52
- ["268"],
53
- "1"
54
- ],
55
- [
56
- "ar",
57
- "54",
58
- 0,
59
- null,
60
- "0"
61
- ],
62
- [
63
- "am",
64
- "374",
65
- 0,
66
- null,
67
- "0"
68
- ],
69
- ["aw", "297"],
70
- ["ac", "247"],
71
- [
72
- "au",
73
- "61",
74
- 0,
75
- ["4"],
76
- "0"
77
- ],
78
- [
79
- "at",
80
- "43",
81
- 0,
82
- null,
83
- "0"
84
- ],
85
- [
86
- "az",
87
- "994",
88
- 0,
89
- null,
90
- "0"
91
- ],
92
- [
93
- "bs",
94
- "1",
95
- 8,
96
- ["242"],
97
- "1"
98
- ],
99
- ["bh", "973"],
100
- [
101
- "bd",
102
- "880",
103
- 0,
104
- null,
105
- "0"
106
- ],
107
- [
108
- "bb",
109
- "1",
110
- 9,
111
- ["246"],
112
- "1"
113
- ],
114
- [
115
- "by",
116
- "375",
117
- 0,
118
- null,
119
- "8"
120
- ],
121
- [
122
- "be",
123
- "32",
124
- 0,
125
- null,
126
- "0"
127
- ],
128
- ["bz", "501"],
129
- ["bj", "229"],
130
- [
131
- "bm",
132
- "1",
133
- 10,
134
- ["441"],
135
- "1"
136
- ],
137
- ["bt", "975"],
138
- [
139
- "bo",
140
- "591",
141
- 0,
142
- null,
143
- "0"
144
- ],
145
- [
146
- "ba",
147
- "387",
148
- 0,
149
- null,
150
- "0"
151
- ],
152
- ["bw", "267"],
153
- [
154
- "br",
155
- "55",
156
- 0,
157
- null,
158
- "0"
159
- ],
160
- ["io", "246"],
161
- [
162
- "vg",
163
- "1",
164
- 11,
165
- ["284"],
166
- "1"
167
- ],
168
- ["bn", "673"],
169
- [
170
- "bg",
171
- "359",
172
- 0,
173
- null,
174
- "0"
175
- ],
176
- ["bf", "226"],
177
- ["bi", "257"],
178
- [
179
- "kh",
180
- "855",
181
- 0,
182
- null,
183
- "0"
184
- ],
185
- ["cm", "237"],
186
- [
187
- "ca",
188
- "1",
189
- 1,
190
- /* @__PURE__ */ "204.226.236.249.250.257.263.289.306.343.354.365.367.368.382.403.416.418.428.431.437.438.450.468.474.506.514.519.548.579.581.584.587.604.613.639.647.672.683.705.709.742.753.778.780.782.807.819.825.867.873.879.902.905.942".split("."),
191
- "1"
192
- ],
193
- ["cv", "238"],
194
- [
195
- "bq",
196
- "599",
197
- 1,
198
- [
199
- "3",
200
- "4",
201
- "7"
202
- ]
203
- ],
204
- [
205
- "ky",
206
- "1",
207
- 12,
208
- ["345"],
209
- "1"
210
- ],
211
- ["cf", "236"],
212
- ["td", "235"],
213
- ["cl", "56"],
214
- [
215
- "cn",
216
- "86",
217
- 0,
218
- null,
219
- "0"
220
- ],
221
- [
222
- "cx",
223
- "61",
224
- 2,
225
- ["4", "89164"],
226
- "0"
227
- ],
228
- [
229
- "cc",
230
- "61",
231
- 1,
232
- ["4", "89162"],
233
- "0"
234
- ],
235
- [
236
- "co",
237
- "57",
238
- 0,
239
- null,
240
- "0"
241
- ],
242
- ["km", "269"],
243
- ["cg", "242"],
244
- [
245
- "cd",
246
- "243",
247
- 0,
248
- null,
249
- "0"
250
- ],
251
- ["ck", "682"],
252
- ["cr", "506"],
253
- ["ci", "225"],
254
- [
255
- "hr",
256
- "385",
257
- 0,
258
- null,
259
- "0"
260
- ],
261
- [
262
- "cu",
263
- "53",
264
- 0,
265
- null,
266
- "0"
267
- ],
268
- [
269
- "cw",
270
- "599",
271
- 0
272
- ],
273
- ["cy", "357"],
274
- ["cz", "420"],
275
- ["dk", "45"],
276
- ["dj", "253"],
277
- [
278
- "dm",
279
- "1",
280
- 13,
281
- ["767"],
282
- "1"
283
- ],
284
- [
285
- "do",
286
- "1",
287
- 2,
288
- [
289
- "809",
290
- "829",
291
- "849"
292
- ],
293
- "1"
294
- ],
295
- [
296
- "ec",
297
- "593",
298
- 0,
299
- null,
300
- "0"
301
- ],
302
- [
303
- "eg",
304
- "20",
305
- 0,
306
- null,
307
- "0"
308
- ],
309
- ["sv", "503"],
310
- ["gq", "240"],
311
- [
312
- "er",
313
- "291",
314
- 0,
315
- null,
316
- "0"
317
- ],
318
- ["ee", "372"],
319
- ["sz", "268"],
320
- [
321
- "et",
322
- "251",
323
- 0,
324
- null,
325
- "0"
326
- ],
327
- ["fk", "500"],
328
- ["fo", "298"],
329
- ["fj", "679"],
330
- [
331
- "fi",
332
- "358",
333
- 0,
334
- ["4"],
335
- "0"
336
- ],
337
- [
338
- "fr",
339
- "33",
340
- 0,
341
- null,
342
- "0"
343
- ],
344
- [
345
- "gf",
346
- "594",
347
- 0,
348
- null,
349
- "0"
350
- ],
351
- ["pf", "689"],
352
- ["ga", "241"],
353
- ["gm", "220"],
354
- [
355
- "ge",
356
- "995",
357
- 0,
358
- null,
359
- "0"
360
- ],
361
- [
362
- "de",
363
- "49",
364
- 0,
365
- null,
366
- "0"
367
- ],
368
- [
369
- "gh",
370
- "233",
371
- 0,
372
- null,
373
- "0"
374
- ],
375
- ["gi", "350"],
376
- ["gr", "30"],
377
- ["gl", "299"],
378
- [
379
- "gd",
380
- "1",
381
- 14,
382
- ["473"],
383
- "1"
384
- ],
385
- [
386
- "gp",
387
- "590",
388
- 0,
389
- null,
390
- "0"
391
- ],
392
- [
393
- "gu",
394
- "1",
395
- 15,
396
- ["671"],
397
- "1"
398
- ],
399
- ["gt", "502"],
400
- [
401
- "gg",
402
- "44",
403
- 1,
404
- [
405
- "1481",
406
- "7781",
407
- "7839",
408
- "7911"
409
- ],
410
- "0"
411
- ],
412
- ["gn", "224"],
413
- ["gw", "245"],
414
- ["gy", "592"],
415
- ["ht", "509"],
416
- ["hn", "504"],
417
- ["hk", "852"],
418
- [
419
- "hu",
420
- "36",
421
- 0,
422
- null,
423
- "06"
424
- ],
425
- ["is", "354"],
426
- [
427
- "in",
428
- "91",
429
- 0,
430
- null,
431
- "0"
432
- ],
433
- [
434
- "id",
435
- "62",
436
- 0,
437
- null,
438
- "0"
439
- ],
440
- [
441
- "ir",
442
- "98",
443
- 0,
444
- null,
445
- "0"
446
- ],
447
- [
448
- "iq",
449
- "964",
450
- 0,
451
- null,
452
- "0"
453
- ],
454
- [
455
- "ie",
456
- "353",
457
- 0,
458
- null,
459
- "0"
460
- ],
461
- [
462
- "im",
463
- "44",
464
- 2,
465
- [
466
- "1624",
467
- "74576",
468
- "7524",
469
- "7624",
470
- "7924"
471
- ],
472
- "0"
473
- ],
474
- [
475
- "il",
476
- "972",
477
- 0,
478
- null,
479
- "0"
480
- ],
481
- [
482
- "it",
483
- "39",
484
- 0,
485
- ["3"]
486
- ],
487
- [
488
- "jm",
489
- "1",
490
- 4,
491
- ["658", "876"],
492
- "1"
493
- ],
494
- [
495
- "jp",
496
- "81",
497
- 0,
498
- null,
499
- "0"
500
- ],
501
- [
502
- "je",
503
- "44",
504
- 3,
505
- [
506
- "1534",
507
- "7509",
508
- "7700",
509
- "7797",
510
- "7829",
511
- "7937"
512
- ],
513
- "0"
514
- ],
515
- [
516
- "jo",
517
- "962",
518
- 0,
519
- null,
520
- "0"
521
- ],
522
- [
523
- "kz",
524
- "7",
525
- 1,
526
- ["33", "7"],
527
- "8"
528
- ],
529
- [
530
- "ke",
531
- "254",
532
- 0,
533
- null,
534
- "0"
535
- ],
536
- [
537
- "ki",
538
- "686",
539
- 0,
540
- null,
541
- "0"
542
- ],
543
- [
544
- "xk",
545
- "383",
546
- 0,
547
- null,
548
- "0"
549
- ],
550
- ["kw", "965"],
551
- [
552
- "kg",
553
- "996",
554
- 0,
555
- null,
556
- "0"
557
- ],
558
- [
559
- "la",
560
- "856",
561
- 0,
562
- null,
563
- "0"
564
- ],
565
- ["lv", "371"],
566
- [
567
- "lb",
568
- "961",
569
- 0,
570
- null,
571
- "0"
572
- ],
573
- ["ls", "266"],
574
- [
575
- "lr",
576
- "231",
577
- 0,
578
- null,
579
- "0"
580
- ],
581
- [
582
- "ly",
583
- "218",
584
- 0,
585
- null,
586
- "0"
587
- ],
588
- [
589
- "li",
590
- "423",
591
- 0,
592
- null,
593
- "0"
594
- ],
595
- [
596
- "lt",
597
- "370",
598
- 0,
599
- null,
600
- "0"
601
- ],
602
- ["lu", "352"],
603
- ["mo", "853"],
604
- [
605
- "mg",
606
- "261",
607
- 0,
608
- null,
609
- "0"
610
- ],
611
- [
612
- "mw",
613
- "265",
614
- 0,
615
- null,
616
- "0"
617
- ],
618
- [
619
- "my",
620
- "60",
621
- 0,
622
- null,
623
- "0"
624
- ],
625
- ["mv", "960"],
626
- ["ml", "223"],
627
- ["mt", "356"],
628
- [
629
- "mh",
630
- "692",
631
- 0,
632
- null,
633
- "1"
634
- ],
635
- [
636
- "mq",
637
- "596",
638
- 0,
639
- null,
640
- "0"
641
- ],
642
- ["mr", "222"],
643
- ["mu", "230"],
644
- [
645
- "yt",
646
- "262",
647
- 1,
648
- ["269", "639"],
649
- "0"
650
- ],
651
- ["mx", "52"],
652
- ["fm", "691"],
653
- [
654
- "md",
655
- "373",
656
- 0,
657
- null,
658
- "0"
659
- ],
660
- [
661
- "mc",
662
- "377",
663
- 0,
664
- null,
665
- "0"
666
- ],
667
- [
668
- "mn",
669
- "976",
670
- 0,
671
- null,
672
- "0"
673
- ],
674
- [
675
- "me",
676
- "382",
677
- 0,
678
- null,
679
- "0"
680
- ],
681
- [
682
- "ms",
683
- "1",
684
- 16,
685
- ["664"],
686
- "1"
687
- ],
688
- [
689
- "ma",
690
- "212",
691
- 0,
692
- ["6", "7"],
693
- "0"
694
- ],
695
- ["mz", "258"],
696
- [
697
- "mm",
698
- "95",
699
- 0,
700
- null,
701
- "0"
702
- ],
703
- [
704
- "na",
705
- "264",
706
- 0,
707
- null,
708
- "0"
709
- ],
710
- ["nr", "674"],
711
- [
712
- "np",
713
- "977",
714
- 0,
715
- null,
716
- "0"
717
- ],
718
- [
719
- "nl",
720
- "31",
721
- 0,
722
- null,
723
- "0"
724
- ],
725
- ["nc", "687"],
726
- [
727
- "nz",
728
- "64",
729
- 0,
730
- null,
731
- "0"
732
- ],
733
- ["ni", "505"],
734
- ["ne", "227"],
735
- [
736
- "ng",
737
- "234",
738
- 0,
739
- null,
740
- "0"
741
- ],
742
- ["nu", "683"],
743
- ["nf", "672"],
744
- [
745
- "kp",
746
- "850",
747
- 0,
748
- null,
749
- "0"
750
- ],
751
- [
752
- "mk",
753
- "389",
754
- 0,
755
- null,
756
- "0"
757
- ],
758
- [
759
- "mp",
760
- "1",
761
- 17,
762
- ["670"],
763
- "1"
764
- ],
765
- [
766
- "no",
767
- "47",
768
- 0,
769
- ["4", "9"]
770
- ],
771
- ["om", "968"],
772
- [
773
- "pk",
774
- "92",
775
- 0,
776
- null,
777
- "0"
778
- ],
779
- ["pw", "680"],
780
- [
781
- "ps",
782
- "970",
783
- 0,
784
- null,
785
- "0"
786
- ],
787
- ["pa", "507"],
788
- ["pg", "675"],
789
- [
790
- "py",
791
- "595",
792
- 0,
793
- null,
794
- "0"
795
- ],
796
- [
797
- "pe",
798
- "51",
799
- 0,
800
- null,
801
- "0"
802
- ],
803
- [
804
- "ph",
805
- "63",
806
- 0,
807
- null,
808
- "0"
809
- ],
810
- ["pl", "48"],
811
- ["pt", "351"],
812
- [
813
- "pr",
814
- "1",
815
- 3,
816
- ["787", "939"],
817
- "1"
818
- ],
819
- ["qa", "974"],
820
- [
821
- "re",
822
- "262",
823
- 0,
824
- null,
825
- "0"
826
- ],
827
- [
828
- "ro",
829
- "40",
830
- 0,
831
- null,
832
- "0"
833
- ],
834
- [
835
- "ru",
836
- "7",
837
- 0,
838
- ["33"],
839
- "8"
840
- ],
841
- [
842
- "rw",
843
- "250",
844
- 0,
845
- null,
846
- "0"
847
- ],
848
- ["ws", "685"],
849
- ["sm", "378"],
850
- ["st", "239"],
851
- [
852
- "sa",
853
- "966",
854
- 0,
855
- null,
856
- "0"
857
- ],
858
- ["sn", "221"],
859
- [
860
- "rs",
861
- "381",
862
- 0,
863
- null,
864
- "0"
865
- ],
866
- ["sc", "248"],
867
- [
868
- "sl",
869
- "232",
870
- 0,
871
- null,
872
- "0"
873
- ],
874
- ["sg", "65"],
875
- [
876
- "sx",
877
- "1",
878
- 21,
879
- ["721"],
880
- "1"
881
- ],
882
- [
883
- "sk",
884
- "421",
885
- 0,
886
- null,
887
- "0"
888
- ],
889
- [
890
- "si",
891
- "386",
892
- 0,
893
- null,
894
- "0"
895
- ],
896
- ["sb", "677"],
897
- [
898
- "so",
899
- "252",
900
- 0,
901
- null,
902
- "0"
903
- ],
904
- [
905
- "za",
906
- "27",
907
- 0,
908
- null,
909
- "0"
910
- ],
911
- [
912
- "kr",
913
- "82",
914
- 0,
915
- null,
916
- "0"
917
- ],
918
- [
919
- "ss",
920
- "211",
921
- 0,
922
- null,
923
- "0"
924
- ],
925
- ["es", "34"],
926
- [
927
- "lk",
928
- "94",
929
- 0,
930
- null,
931
- "0"
932
- ],
933
- [
934
- "bl",
935
- "590",
936
- 1,
937
- null,
938
- "0"
939
- ],
940
- ["sh", "290"],
941
- [
942
- "kn",
943
- "1",
944
- 18,
945
- ["869"],
946
- "1"
947
- ],
948
- [
949
- "lc",
950
- "1",
951
- 19,
952
- ["758"],
953
- "1"
954
- ],
955
- [
956
- "mf",
957
- "590",
958
- 2,
959
- null,
960
- "0"
961
- ],
962
- [
963
- "pm",
964
- "508",
965
- 0,
966
- null,
967
- "0"
968
- ],
969
- [
970
- "vc",
971
- "1",
972
- 20,
973
- ["784"],
974
- "1"
975
- ],
976
- [
977
- "sd",
978
- "249",
979
- 0,
980
- null,
981
- "0"
982
- ],
983
- ["sr", "597"],
984
- [
985
- "sj",
986
- "47",
987
- 1,
988
- [
989
- "4",
990
- "79",
991
- "9"
992
- ]
993
- ],
994
- [
995
- "se",
996
- "46",
997
- 0,
998
- null,
999
- "0"
1000
- ],
1001
- [
1002
- "ch",
1003
- "41",
1004
- 0,
1005
- null,
1006
- "0"
1007
- ],
1008
- [
1009
- "sy",
1010
- "963",
1011
- 0,
1012
- null,
1013
- "0"
1014
- ],
1015
- [
1016
- "tw",
1017
- "886",
1018
- 0,
1019
- null,
1020
- "0"
1021
- ],
1022
- ["tj", "992"],
1023
- [
1024
- "tz",
1025
- "255",
1026
- 0,
1027
- null,
1028
- "0"
1029
- ],
1030
- [
1031
- "th",
1032
- "66",
1033
- 0,
1034
- null,
1035
- "0"
1036
- ],
1037
- ["tl", "670"],
1038
- ["tg", "228"],
1039
- ["tk", "690"],
1040
- ["to", "676"],
1041
- [
1042
- "tt",
1043
- "1",
1044
- 22,
1045
- ["868"],
1046
- "1"
1047
- ],
1048
- ["tn", "216"],
1049
- [
1050
- "tr",
1051
- "90",
1052
- 0,
1053
- null,
1054
- "0"
1055
- ],
1056
- [
1057
- "tm",
1058
- "993",
1059
- 0,
1060
- null,
1061
- "8"
1062
- ],
1063
- [
1064
- "tc",
1065
- "1",
1066
- 23,
1067
- ["649"],
1068
- "1"
1069
- ],
1070
- ["tv", "688"],
1071
- [
1072
- "vi",
1073
- "1",
1074
- 24,
1075
- ["340"],
1076
- "1"
1077
- ],
1078
- [
1079
- "ug",
1080
- "256",
1081
- 0,
1082
- null,
1083
- "0"
1084
- ],
1085
- [
1086
- "ua",
1087
- "380",
1088
- 0,
1089
- null,
1090
- "0"
1091
- ],
1092
- [
1093
- "ae",
1094
- "971",
1095
- 0,
1096
- null,
1097
- "0"
1098
- ],
1099
- [
1100
- "gb",
1101
- "44",
1102
- 0,
1103
- null,
1104
- "0"
1105
- ],
1106
- [
1107
- "us",
1108
- "1",
1109
- 0,
1110
- null,
1111
- "1"
1112
- ],
1113
- [
1114
- "uy",
1115
- "598",
1116
- 0,
1117
- null,
1118
- "0"
1119
- ],
1120
- ["uz", "998"],
1121
- ["vu", "678"],
1122
- [
1123
- "va",
1124
- "39",
1125
- 1,
1126
- ["06698", "3"]
1127
- ],
1128
- [
1129
- "ve",
1130
- "58",
1131
- 0,
1132
- null,
1133
- "0"
1134
- ],
1135
- [
1136
- "vn",
1137
- "84",
1138
- 0,
1139
- null,
1140
- "0"
1141
- ],
1142
- ["wf", "681"],
1143
- [
1144
- "eh",
1145
- "212",
1146
- 1,
1147
- [
1148
- "5288",
1149
- "5289",
1150
- "6",
1151
- "7"
1152
- ],
1153
- "0"
1154
- ],
1155
- [
1156
- "ye",
1157
- "967",
1158
- 0,
1159
- null,
1160
- "0"
1161
- ],
1162
- [
1163
- "zm",
1164
- "260",
1165
- 0,
1166
- null,
1167
- "0"
1168
- ],
1169
- [
1170
- "zw",
1171
- "263",
1172
- 0,
1173
- null,
1174
- "0"
1175
- ]
1176
- ], f = [];
1177
- for (let e of d) f.push({
1178
- name: "",
1179
- iso2: e[0],
1180
- dialCode: e[1],
1181
- priority: e[2] || 0,
1182
- areaCodes: e[3] || null,
1183
- nationalPrefix: e[4] || null,
1184
- normalisedName: "",
1185
- initials: "",
1186
- dialCodePlus: ""
1187
- });
1188
- var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
1189
- OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1190
- CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1191
- COUNTRY_CHANGE: "countrychange",
1192
- INPUT: "input",
1193
- STRICT_REJECT: "strict:reject"
1194
- }, _ = {
1195
- HIDE: "iti__hide",
1196
- V_HIDE: "iti__v-hide",
1197
- ARROW_UP: "iti__arrow--up",
1198
- GLOBE: "iti__globe",
1199
- FLAG: "iti__flag",
1200
- LOADING: "iti__loading",
1201
- COUNTRY_ITEM: "iti__country",
1202
- HIGHLIGHT: "iti__highlight"
1203
- }, v = {
1204
- ARROW_UP: "ArrowUp",
1205
- ARROW_DOWN: "ArrowDown",
1206
- SPACE: " ",
1207
- ENTER: "Enter",
1208
- ESC: "Escape",
1209
- TAB: "Tab"
1210
- }, y = {
1211
- PASTE: "insertFromPaste",
1212
- DELETE_FORWARD: "deleteContentForward"
1213
- }, b = {
1214
- ALPHA_UNICODE: /\p{L}/u,
1215
- NON_PLUS_NUMERIC: /[^+0-9]/,
1216
- NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
1217
- HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1218
- }, x = {
1219
- SEARCH_DEBOUNCE_MS: 100,
1220
- HIDDEN_SEARCH_RESET_MS: 1e3,
1221
- NEXT_TICK: 0
1222
- }, S = {
1223
- UNKNOWN_NUMBER_TYPE: -99,
1224
- UNKNOWN_VALIDATION_ERROR: -99
1225
- }, C = {
1226
- NARROW_VIEWPORT_WIDTH: 500,
1227
- FALLBACK_SELECTED_WITH_DIAL_WIDTH: 78,
1228
- FALLBACK_SELECTED_NO_DIAL_WIDTH: 42,
1229
- INPUT_PADDING_EXTRA_LEFT: 6,
1230
- DROPDOWN_MARGIN: 3,
1231
- FALLBACK_DROPDOWN_HEIGHT: 200
1232
- }, w = {
1233
- PLUS: "+",
1234
- NANP: "1"
1235
- }, T = {
1236
- ISO2: "gb",
1237
- DIAL_CODE: "44",
1238
- MOBILE_PREFIX: "7",
1239
- MOBILE_CORE_LENGTH: 10
1240
- }, E = {
1241
- ISO2: "us",
1242
- DIAL_CODE: "1"
1243
- }, D = {
1244
- AGGRESSIVE: "aggressive",
1245
- POLITE: "polite",
1246
- OFF: "off"
1247
- }, O = { AUTO: "auto" }, k = new Set([
1248
- "FIXED_LINE",
1249
- "MOBILE",
1250
- "FIXED_LINE_OR_MOBILE",
1251
- "TOLL_FREE",
1252
- "PREMIUM_RATE",
1253
- "SHARED_COST",
1254
- "VOIP",
1255
- "PERSONAL_NUMBER",
1256
- "PAGER",
1257
- "UAN",
1258
- "VOICEMAIL",
1259
- "UNKNOWN"
1260
- ]), A = {
1261
- ISO2: "countryCode",
1262
- DIAL_CODE: "dialCode",
1263
- INSTANCE_ID: "intlTelInputId"
1264
- }, j = {
1265
- EXPANDED: "aria-expanded",
1266
- LABEL: "aria-label",
1267
- SELECTED: "aria-selected",
1268
- ACTIVE_DESCENDANT: "aria-activedescendant",
1269
- HASPOPUP: "aria-haspopup",
1270
- CONTROLS: "aria-controls",
1271
- HIDDEN: "aria-hidden",
1272
- AUTOCOMPLETE: "aria-autocomplete",
1273
- MODAL: "aria-modal"
1274
- }, M = {
1275
- selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
1276
- noCountrySelected: "Select country for phone number",
1277
- countryListAriaLabel: "List of countries",
1278
- searchPlaceholder: "Search",
1279
- clearSearchAriaLabel: "Clear search",
1280
- searchEmptyState: "No results found",
1281
- searchSummaryAria(e) {
1282
- return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
1283
- }
1284
- }, N = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, P = () => N(`(max-width: ${C.NARROW_VIEWPORT_WIDTH}px)`), F = {
1285
- allowDropdown: !0,
1286
- allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
1287
- allowNumberExtensions: !1,
1288
- allowPhonewords: !1,
1289
- autoPlaceholder: D.POLITE,
1290
- containerClass: "",
1291
- countryNameLocale: "en",
1292
- countryOrder: null,
1293
- countrySearch: !0,
1294
- customPlaceholder: null,
1295
- dropdownAlwaysOpen: !1,
1296
- dropdownContainer: null,
1297
- excludeCountries: null,
1298
- fixDropdownWidth: !0,
1299
- formatAsYouType: !0,
1300
- formatOnDisplay: !0,
1301
- geoIpLookup: null,
1302
- hiddenInput: null,
1303
- i18n: {},
1304
- initialCountry: "",
1305
- loadUtils: null,
1306
- nationalMode: !0,
1307
- onlyCountries: null,
1308
- placeholderNumberType: "MOBILE",
1309
- searchInputClass: "",
1310
- separateDialCode: !1,
1311
- strictRejectAnimation: !1,
1312
- showFlags: !0,
1313
- strictMode: !1,
1314
- useFullscreenPopup: (() => {
1315
- if (typeof navigator < "u" && typeof window < "u") {
1316
- let e = N("(max-height: 600px)"), t = N("(pointer: coarse)");
1317
- return P() || t && e;
1318
- }
1319
- return !1;
1320
- })()
1321
- }, I = (e) => JSON.stringify(e), L = (e) => !!e && typeof e == "object" && !Array.isArray(e), ee = (e) => typeof e == "function", te = (e) => {
1322
- if (!e || typeof e != "object") return !1;
1323
- let t = e;
1324
- return t.nodeType === 1 && typeof t.tagName == "string" && typeof t.appendChild == "function";
1325
- }, R = new Set(Object.values(D)), z = (e) => {
1326
- console.warn(`[intl-tel-input] ${e}`);
1327
- }, B = (e, t, n) => {
1328
- z(`Option '${e}' must be ${t}; got ${I(n)}. Ignoring.`);
1329
- }, V = (e, t) => {
1330
- let n = "an array of iso2 country code strings";
1331
- if (!Array.isArray(t)) return B(e, n, t), !1;
1332
- let r = [];
1333
- for (let i of t) {
1334
- if (typeof i != "string") return B(e, n, t), !1;
1335
- m(i.toLowerCase()) ? r.push(i) : z(`Invalid iso2 code in '${e}': '${i}'. Skipping.`);
1336
- }
1337
- return r;
1338
- }, ne = (e) => {
1339
- if (e === void 0) return {};
1340
- if (!L(e)) return z(`The second argument must be an options object; got ${I(e)}. Using defaults.`), {};
1341
- let t = {};
1342
- for (let [n, r] of Object.entries(e)) {
1343
- if (!Object.hasOwn(F, n)) {
1344
- z(`Unknown option '${n}'. Ignoring.`);
1345
- continue;
1346
- }
1347
- switch (n) {
1348
- case "allowDropdown":
1349
- case "allowNumberExtensions":
1350
- case "allowPhonewords":
1351
- case "countrySearch":
1352
- case "dropdownAlwaysOpen":
1353
- case "fixDropdownWidth":
1354
- case "formatAsYouType":
1355
- case "formatOnDisplay":
1356
- case "nationalMode":
1357
- case "showFlags":
1358
- case "separateDialCode":
1359
- case "strictMode":
1360
- case "strictRejectAnimation":
1361
- case "useFullscreenPopup":
1362
- if (typeof r != "boolean") {
1363
- B(n, "a boolean", r);
1364
- break;
1365
- }
1366
- t[n] = r;
1367
- break;
1368
- case "autoPlaceholder":
1369
- if (typeof r != "string" || !R.has(r)) {
1370
- B("autoPlaceholder", `one of ${Array.from(R).join(", ")}`, r);
1371
- break;
1372
- }
1373
- t[n] = r;
1374
- break;
1375
- case "containerClass":
1376
- case "searchInputClass":
1377
- case "countryNameLocale":
1378
- if (typeof r != "string") {
1379
- B(n, "a string", r);
1380
- break;
1381
- }
1382
- t[n] = r;
1383
- break;
1384
- case "countryOrder":
1385
- if (r === null) t[n] = r;
1386
- else {
1387
- let e = V(n, r);
1388
- e !== !1 && (t[n] = e);
1389
- }
1390
- break;
1391
- case "customPlaceholder":
1392
- case "geoIpLookup":
1393
- case "hiddenInput":
1394
- case "loadUtils":
1395
- if (r !== null && !ee(r)) {
1396
- B(n, "a function or null", r);
1397
- break;
1398
- }
1399
- t[n] = r;
1400
- break;
1401
- case "dropdownContainer":
1402
- if (r !== null && !te(r)) {
1403
- B("dropdownContainer", "an HTMLElement or null", r);
1404
- break;
1405
- }
1406
- t[n] = r;
1407
- break;
1408
- case "excludeCountries":
1409
- case "onlyCountries":
1410
- if (r === null) t[n] = r;
1411
- else {
1412
- let e = V(n, r);
1413
- e !== !1 && (t[n] = e);
1414
- }
1415
- break;
1416
- case "i18n":
1417
- if (r && !L(r)) {
1418
- B("i18n", "an object", r);
1419
- break;
1420
- }
1421
- t[n] = r;
1422
- break;
1423
- case "initialCountry": {
1424
- if (typeof r != "string") {
1425
- B("initialCountry", "a string", r);
1426
- break;
1427
- }
1428
- let e = r.toLowerCase();
1429
- if (e && e !== O.AUTO && !m(e)) {
1430
- B("initialCountry", "a valid iso2 country code or 'auto'", r);
1431
- break;
1432
- }
1433
- t[n] = r;
1434
- break;
1435
- }
1436
- case "placeholderNumberType":
1437
- if (typeof r != "string" || !k.has(r)) {
1438
- B("placeholderNumberType", `one of ${Array.from(k).join(", ")}`, r);
1439
- break;
1440
- }
1441
- t[n] = r;
1442
- break;
1443
- case "allowedNumberTypes":
1444
- if (r !== null) {
1445
- if (!Array.isArray(r)) {
1446
- B("allowedNumberTypes", "an array of number types or null", r);
1447
- break;
1448
- }
1449
- let e = !0;
1450
- for (let t of r) if (typeof t != "string" || !k.has(t)) {
1451
- B("allowedNumberTypes", `an array of valid number types (${Array.from(k).join(", ")})`, t), e = !1;
1452
- break;
1453
- }
1454
- e && (t[n] = r);
1455
- } else t[n] = null;
1456
- break;
1457
- }
1458
- }
1459
- return t;
1460
- }, re = (e) => {
1461
- e.initialCountry &&= e.initialCountry.toLowerCase(), e.onlyCountries?.length && (e.onlyCountries = e.onlyCountries.map((e) => e.toLowerCase())), e.excludeCountries?.length && (e.excludeCountries = e.excludeCountries.map((e) => e.toLowerCase())), e.countryOrder &&= e.countryOrder.map((e) => e.toLowerCase());
1462
- }, ie = (e) => {
1463
- e.dropdownAlwaysOpen && (e.useFullscreenPopup = !1, e.allowDropdown = !0), e.useFullscreenPopup ? e.fixDropdownWidth = !1 : P() && (e.fixDropdownWidth = !0), e.onlyCountries?.length === 1 && (e.initialCountry = e.onlyCountries[0]), e.separateDialCode && (e.nationalMode = !1), e.allowDropdown && !e.showFlags && !e.separateDialCode && (e.nationalMode = !1), e.useFullscreenPopup && !e.dropdownContainer && (e.dropdownContainer = document.body), e.i18n = {
1464
- ...M,
1465
- ...e.i18n
1466
- };
1467
- }, H = (e) => e.replace(/\D/g, ""), U = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), W = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), G = (e, t, n) => {
1468
- let r = document.createElement(e);
1469
- return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
1470
- }, ae = () => `
1471
- <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${j.HIDDEN}="true">
1472
- <circle cx="11" cy="11" r="7" />
1473
- <line x1="21" y1="21" x2="16.65" y2="16.65" />
1474
- </svg>`, oe = (e) => {
1475
- let t = `iti-${e}-clear-mask`;
1476
- return `
1477
- <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${j.HIDDEN}="true" focusable="false">
1478
- <mask id="${t}" maskUnits="userSpaceOnUse">
1479
- <rect width="16" height="16" fill="white" />
1480
- <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
1481
- </mask>
1482
- <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
1483
- </svg>`;
1484
- }, se = () => `
1485
- <svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${j.HIDDEN}="true">
1486
- <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
1487
- </svg>`, K = () => "\n <svg width=\"256\" height=\"256\" viewBox=\"0 0 512 512\" class=\"iti__globe-svg\">\n <path d=\"M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39\"/>\n <path d=\"m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40\"/>\n </svg>", ce = (e, t) => {
1488
- let n = U(t), r = [], i = [], a = [], o = [], s = [], c = [];
1489
- for (let t of e) t.iso2 === n ? r.push(t) : t.normalisedName.startsWith(n) ? i.push(t) : t.normalisedName.includes(n) ? a.push(t) : n === t.dialCode || n === t.dialCodePlus ? o.push(t) : t.dialCodePlus.includes(n) ? s.push(t) : t.initials.includes(n) && c.push(t);
1490
- let l = (e, t) => e.priority - t.priority;
1491
- return [
1492
- ...r,
1493
- ...i,
1494
- ...a,
1495
- ...o.sort(l),
1496
- ...s.sort(l),
1497
- ...c
1498
- ];
1499
- }, le = (e, t) => {
1500
- let n = U(t);
1501
- for (let t of e) if (t.normalisedName.startsWith(n)) return t;
1502
- return null;
1503
- }, q = class e {
1504
- #e;
1505
- #t;
1506
- #n;
1507
- #r = "";
1508
- #i;
1509
- #a = null;
1510
- #o;
1511
- #s;
1512
- #c;
1513
- #l;
1514
- #u;
1515
- #d;
1516
- #f;
1517
- #p;
1518
- #m;
1519
- #h;
1520
- #g;
1521
- #_;
1522
- #v;
1523
- #y;
1524
- #b;
1525
- #x;
1526
- #S = null;
1527
- #C = null;
1528
- #w = /* @__PURE__ */ new Map();
1529
- #T = null;
1530
- telInputEl;
1531
- hadInitialPlaceholder;
1532
- constructor(e, t, n) {
1533
- e.dataset[A.INSTANCE_ID] = n.toString(), this.telInputEl = e, this.#e = t, this.#t = n, this.hadInitialPlaceholder = !!e.getAttribute("placeholder"), this.#n = !!this.telInputEl.closest("[dir=rtl]"), this.#r = this.telInputEl.style.paddingLeft;
1534
- }
1535
- static validateInput(e) {
1536
- let t = e?.tagName;
1537
- if (!(e && typeof e == "object" && t === "INPUT" && typeof e.setAttribute == "function")) {
1538
- let t = Object.prototype.toString.call(e);
1539
- throw TypeError(`The first argument must be an HTMLInputElement, not ${t}`);
1540
- }
1541
- }
1542
- buildMarkup(e) {
1543
- this.#i = e, this.telInputEl.classList.add("iti__tel-input"), this.telInputEl.hasAttribute("type") || this.telInputEl.setAttribute("type", "tel"), this.telInputEl.hasAttribute("autocomplete") || this.telInputEl.setAttribute("autocomplete", "tel"), this.telInputEl.hasAttribute("inputmode") || this.telInputEl.setAttribute("inputmode", "tel");
1544
- let t = this.#E();
1545
- this.#D(t), t.appendChild(this.telInputEl), this.#A(), this.#j(t), this.ensureDropdownWidthSet();
1546
- }
1547
- #E() {
1548
- let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i = G("div", { class: W({
1549
- iti: !0,
1550
- "iti--allow-dropdown": e,
1551
- "iti--show-flags": t,
1552
- "iti--inline-dropdown": !r,
1553
- [n]: !!n
1554
- }) });
1555
- return this.#n && i.setAttribute("dir", "ltr"), this.telInputEl.before(i), i;
1556
- }
1557
- #D(e) {
1558
- let { allowDropdown: t, separateDialCode: n, showFlags: r } = this.#e;
1559
- if (!t && !r && !n) return;
1560
- this.#s = G("div", { class: `iti__country-container ${_.V_HIDE}` }, e), t ? (this.#c = G("button", {
1561
- type: "button",
1562
- class: "iti__selected-country",
1563
- [j.EXPANDED]: "false",
1564
- [j.LABEL]: this.#e.i18n.noCountrySelected,
1565
- [j.HASPOPUP]: "dialog",
1566
- [j.CONTROLS]: `iti-${this.#t}__dropdown-content`
1567
- }, this.#s), this.telInputEl.disabled && this.#c.setAttribute("disabled", "true")) : this.#c = G("div", { class: "iti__selected-country" }, this.#s);
1568
- let i = G("div", { class: "iti__selected-country-primary" }, this.#c);
1569
- this.#l = G("div", { class: _.FLAG }, i), t && (this.#d = G("div", {
1570
- class: "iti__arrow",
1571
- [j.HIDDEN]: "true"
1572
- }, i)), n && (this.#u = G("div", { class: "iti__selected-dial-code" }, this.#c)), t && this.#O();
1573
- }
1574
- ensureDropdownWidthSet() {
1575
- let { fixDropdownWidth: e, allowDropdown: t } = this.#e;
1576
- if (!t || !e || this.#f.style.width) return;
1577
- let n = this.telInputEl.offsetWidth;
1578
- n > 0 && (this.#f.style.width = `${n}px`);
1579
- }
1580
- #O() {
1581
- let { fixDropdownWidth: e, useFullscreenPopup: t, countrySearch: n, i18n: r, dropdownContainer: i, containerClass: a } = this.#e, o = e ? "" : "iti--flexible-dropdown-width";
1582
- this.#f = G("div", {
1583
- id: `iti-${this.#t}__dropdown-content`,
1584
- class: `iti__dropdown-content ${_.HIDE} ${o}`,
1585
- role: "dialog",
1586
- [j.MODAL]: "true"
1587
- }), this.#n && this.#f.setAttribute("dir", "rtl"), n && this.#k(), this.#g = G("ul", {
1588
- class: "iti__country-list",
1589
- id: `iti-${this.#t}__country-listbox`,
1590
- role: "listbox",
1591
- [j.LABEL]: r.countryListAriaLabel
1592
- }, this.#f), this.#M(), n && this.#L(), t || (this.#o = this.#I(), n && (this.#f.style.height = `${this.#o}px`)), i ? (this.#x = G("div", { class: W({
1593
- iti: !0,
1594
- "iti--container": !0,
1595
- "iti--fullscreen-popup": t,
1596
- "iti--inline-dropdown": !t,
1597
- [a]: !!a
1598
- }) }), this.#x.appendChild(this.#f)) : this.#s.appendChild(this.#f);
1599
- }
1600
- #k() {
1601
- let { i18n: e, searchInputClass: t } = this.#e, n = G("div", { class: "iti__search-input-wrapper" }, this.#f);
1602
- this.#p = G("span", {
1603
- class: "iti__search-icon",
1604
- [j.HIDDEN]: "true"
1605
- }, n), this.#p.innerHTML = ae(), this.#m = G("input", {
1606
- id: `iti-${this.#t}__search-input`,
1607
- type: "search",
1608
- class: `iti__search-input ${t}`,
1609
- placeholder: e.searchPlaceholder,
1610
- role: "combobox",
1611
- [j.EXPANDED]: "true",
1612
- [j.LABEL]: e.searchPlaceholder,
1613
- [j.CONTROLS]: `iti-${this.#t}__country-listbox`,
1614
- [j.AUTOCOMPLETE]: "list",
1615
- autocomplete: "off"
1616
- }, n), this.#h = G("button", {
1617
- type: "button",
1618
- class: `iti__search-clear ${_.HIDE}`,
1619
- [j.LABEL]: e.clearSearchAriaLabel,
1620
- tabindex: "-1"
1621
- }, n), this.#h.innerHTML = oe(this.#t), this.#b = G("span", { class: "iti__a11y-text" }, this.#f), this.#y = G("div", {
1622
- class: `iti__no-results ${_.HIDE}`,
1623
- [j.HIDDEN]: "true"
1624
- }, this.#f), this.#y.textContent = e.searchEmptyState ?? null;
1625
- }
1626
- #A() {
1627
- this.#s && (this.#N(), this.#s.classList.remove(_.V_HIDE));
1628
- }
1629
- #j(e) {
1630
- let { hiddenInput: t } = this.#e;
1631
- if (!t) return;
1632
- let n = t(this.telInputEl.getAttribute("name") || "");
1633
- if (n.phone) {
1634
- let t = this.telInputEl.form?.querySelector(`input[name="${n.phone}"]`);
1635
- t ? this.#_ = t : (this.#_ = G("input", {
1636
- type: "hidden",
1637
- name: n.phone
1638
- }), e.appendChild(this.#_));
1639
- }
1640
- if (n.country) {
1641
- let t = this.telInputEl.form?.querySelector(`input[name="${n.country}"]`);
1642
- t ? this.#v = t : (this.#v = G("input", {
1643
- type: "hidden",
1644
- name: n.country
1645
- }), e.appendChild(this.#v));
1646
- }
1647
- }
1648
- #M() {
1649
- let e = document.createDocumentFragment();
1650
- for (let t = 0; t < this.#i.length; t++) {
1651
- let n = this.#i[t], r = W({ [_.COUNTRY_ITEM]: !0 }), i = G("li", {
1652
- id: `iti-${this.#t}__item-${n.iso2}`,
1653
- class: r,
1654
- tabindex: "-1",
1655
- role: "option",
1656
- [j.SELECTED]: "false"
1657
- });
1658
- i.dataset[A.DIAL_CODE] = n.dialCode, i.dataset[A.ISO2] = n.iso2, this.#w.set(n.iso2, i), this.#e.showFlags && G("div", { class: `${_.FLAG} iti__${n.iso2}` }, i);
1659
- let a = G("span", { class: "iti__country-name" }, i);
1660
- a.textContent = `${n.name} `;
1661
- let o = G("span", { class: "iti__dial-code" }, a);
1662
- this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${n.dialCode})`, e.appendChild(i);
1663
- }
1664
- this.#g.appendChild(e);
1665
- }
1666
- #N() {
1667
- if (this.#c) {
1668
- let e = this.#e.separateDialCode ? C.FALLBACK_SELECTED_WITH_DIAL_WIDTH : C.FALLBACK_SELECTED_NO_DIAL_WIDTH, t = (this.#c.offsetWidth || this.#F() || e) + C.INPUT_PADDING_EXTRA_LEFT;
1669
- this.telInputEl.style.paddingLeft = `${t}px`;
1670
- }
1671
- }
1672
- static #P() {
1673
- let e;
1674
- try {
1675
- e = window.top.document.body;
1676
- } catch {
1677
- e = document.body;
1678
- }
1679
- return e;
1680
- }
1681
- #F() {
1682
- if (!this.telInputEl.parentNode) return 0;
1683
- let t = e.#P(), n = this.telInputEl.parentNode.cloneNode(!1);
1684
- n.style.visibility = "hidden", t.appendChild(n);
1685
- let r = this.#s.cloneNode();
1686
- n.appendChild(r);
1687
- let i = this.#c.cloneNode(!0);
1688
- r.appendChild(i);
1689
- let a = i.offsetWidth;
1690
- return t.removeChild(n), a;
1691
- }
1692
- #I() {
1693
- let t = e.#P();
1694
- this.#f.classList.remove(_.HIDE);
1695
- let n = G("div", { class: "iti iti--inline-dropdown" });
1696
- n.appendChild(this.#f), n.style.visibility = "hidden", t.appendChild(n);
1697
- let r = this.#f.offsetHeight;
1698
- return t.removeChild(n), n.style.visibility = "", this.#f.classList.add(_.HIDE), r > 0 ? r : C.FALLBACK_DROPDOWN_HEIGHT;
1699
- }
1700
- #L() {
1701
- let { i18n: e } = this.#e, t = this.#g.childElementCount;
1702
- this.#b.textContent = e.searchSummaryAria(t);
1703
- }
1704
- #R(e) {
1705
- let t;
1706
- t = e === "" ? this.#i : ce(this.#i, e), this.#$(t);
1707
- }
1708
- prefillSearchWithPlus() {
1709
- this.#m.value = "+", this.#m.focus(), this.#R("");
1710
- }
1711
- #z() {
1712
- let e = this.#m.value.trim();
1713
- this.#R(e), this.#m.value ? this.#h.classList.remove(_.HIDE) : this.#h.classList.add(_.HIDE);
1714
- }
1715
- #B() {
1716
- this.#a && clearTimeout(this.#a), this.#a = setTimeout(() => {
1717
- this.#z(), this.#a = null;
1718
- }, x.SEARCH_DEBOUNCE_MS);
1719
- }
1720
- #V() {
1721
- this.#m.value = "", this.#m.focus(), this.#z();
1722
- }
1723
- #H(e) {
1724
- let t = this.#g, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
1725
- r.top < n.top ? t.scrollTop = i : r.bottom > n.bottom && (t.scrollTop = i - n.height + r.height);
1726
- }
1727
- #U(e, t = !0) {
1728
- if (this.#C?.classList.remove(_.HIGHLIGHT), e) {
1729
- if (e.classList.add(_.HIGHLIGHT), this.#e.countrySearch) {
1730
- let t = e.getAttribute("id") || "";
1731
- this.#m.setAttribute(j.ACTIVE_DESCENDANT, t);
1732
- }
1733
- t && this.#H(e), this.#C = e;
1734
- } else this.#C = null;
1735
- }
1736
- bindHiddenInputSubmitListener(e, t, n) {
1737
- let r = this.telInputEl.form;
1738
- !r || !this.#_ && !this.#v || r.addEventListener("submit", () => {
1739
- this.#_ && (this.#_.value = t()), this.#v && (this.#v.value = n());
1740
- }, { signal: e });
1741
- }
1742
- bindAllInitialDropdownListeners(e, t, n) {
1743
- let r = this.telInputEl.closest("label");
1744
- r && r.addEventListener("click", (e) => {
1745
- this.isDropdownOpen() ? e.preventDefault() : this.telInputEl.focus();
1746
- }, { signal: e }), this.#c.addEventListener("click", () => {
1747
- !this.isDropdownOpen() && !this.telInputEl.disabled && !this.telInputEl.readOnly && t();
1748
- }, { signal: e }), this.#s.addEventListener("keydown", (e) => {
1749
- let r = [
1750
- v.ARROW_UP,
1751
- v.ARROW_DOWN,
1752
- v.SPACE,
1753
- v.ENTER
1754
- ];
1755
- !this.isDropdownOpen() && r.includes(e.key) && (e.preventDefault(), e.stopPropagation(), t()), e.key === v.TAB && n();
1756
- }, { signal: e });
1757
- }
1758
- openDropdown(e, t) {
1759
- let { countrySearch: n, dropdownAlwaysOpen: r, dropdownContainer: i } = this.#e;
1760
- if (this.#T = new AbortController(), this.ensureDropdownWidthSet(), i) this.#te();
1761
- else {
1762
- let e = this.#ee(), t = this.telInputEl.offsetHeight + C.DROPDOWN_MARGIN;
1763
- e ? this.#f.style.top = `${t}px` : this.#f.style.bottom = `${t}px`;
1764
- }
1765
- this.#f.classList.remove(_.HIDE), this.#c.setAttribute(j.EXPANDED, "true");
1766
- let a = this.#S ?? this.#g.firstElementChild;
1767
- a && this.#U(a), n && !r && this.#m.focus(), this.#e.useFullscreenPopup && this.#x && window.visualViewport && window.visualViewport.addEventListener("resize", () => {
1768
- this.#ne(), this.#C && this.#H(this.#C);
1769
- }, { signal: this.#T.signal }), this.#d.classList.add(_.ARROW_UP), this.#W(e, t);
1770
- }
1771
- #W(e, t) {
1772
- let n = this.#T.signal;
1773
- this.#G(n), this.#K(n, e), this.#e.dropdownAlwaysOpen || this.#q(n, t), this.#J(n, e, t), this.#e.countrySearch && this.#Y(n), !this.#e.useFullscreenPopup && this.#e.dropdownContainer && window.addEventListener("scroll", t, { signal: n });
1774
- }
1775
- #G(e) {
1776
- this.#g.addEventListener("mouseover", (e) => {
1777
- let t = e.target?.closest(`.${_.COUNTRY_ITEM}`);
1778
- t && this.#U(t, !1);
1779
- }, { signal: e });
1780
- }
1781
- #K(e, t) {
1782
- this.#g.addEventListener("click", (e) => {
1783
- let n = e.target?.closest(`.${_.COUNTRY_ITEM}`);
1784
- n && t(n);
1785
- }, { signal: e });
1786
- }
1787
- #q(e, t) {
1788
- setTimeout(() => {
1789
- document.documentElement.addEventListener("click", (e) => {
1790
- this.#f.contains(e.target) || t();
1791
- }, { signal: e });
1792
- }, 0);
1793
- }
1794
- #J(e, t, n) {
1795
- let r = "", i = null;
1796
- document.addEventListener("keydown", (e) => {
1797
- [
1798
- v.ARROW_UP,
1799
- v.ARROW_DOWN,
1800
- v.ENTER,
1801
- v.ESC
1802
- ].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#Z(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#C) : e.key === v.ESC && (n(), this.#c.focus())), !this.#e.countrySearch && e.target !== this.telInputEl && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#X(r), i = setTimeout(() => {
1803
- r = "";
1804
- }, x.HIDDEN_SEARCH_RESET_MS));
1805
- }, { signal: e });
1806
- }
1807
- #Y(e) {
1808
- this.#m.addEventListener("input", () => this.#B(), { signal: e }), this.#h.addEventListener("click", () => this.#V(), { signal: e });
1809
- }
1810
- #X(e) {
1811
- let t = le(this.#i, e);
1812
- if (t) {
1813
- let e = this.#w.get(t.iso2);
1814
- this.#U(e);
1815
- }
1816
- }
1817
- #Z(e) {
1818
- let t = e === v.ARROW_UP ? this.#C?.previousElementSibling : this.#C?.nextElementSibling;
1819
- !t && this.#g.childElementCount > 1 && (t = e === v.ARROW_UP ? this.#g.lastElementChild : this.#g.firstElementChild), t && this.#U(t);
1820
- }
1821
- #Q(e) {
1822
- if (this.#S && this.#S.dataset[A.ISO2] !== e && (this.#S.setAttribute(j.SELECTED, "false"), this.#S.querySelector(".iti__country-check")?.remove(), this.#S = null), e && !this.#S) {
1823
- let t = this.#g.querySelector(`[data-country-code="${e}"]`);
1824
- if (t) {
1825
- t.setAttribute(j.SELECTED, "true");
1826
- let e = G("span", {
1827
- class: "iti__country-check",
1828
- [j.HIDDEN]: "true"
1829
- }, t);
1830
- e.innerHTML = se(), this.#S = t, this.#e.dropdownAlwaysOpen && this.#U(t);
1831
- }
1832
- }
1833
- }
1834
- #$(e) {
1835
- this.#g.replaceChildren();
1836
- let t = !0;
1837
- for (let n of e) {
1838
- let e = this.#w.get(n.iso2);
1839
- e && (this.#g.appendChild(e), t &&= (this.#U(e, !1), !1));
1840
- }
1841
- t ? (this.#U(null), this.#y && this.#y.classList.remove(_.HIDE)) : this.#y && this.#y.classList.add(_.HIDE), this.#g.scrollTop = 0, this.#L();
1842
- }
1843
- closeDropdown() {
1844
- let { countrySearch: e, dropdownContainer: t } = this.#e;
1845
- this.#T.abort(), this.#T = null, this.#f.classList.add(_.HIDE), this.#c.setAttribute(j.EXPANDED, "false"), e && (this.#m.removeAttribute(j.ACTIVE_DESCENDANT), this.#m.value = "", this.#z(), this.#C &&= (this.#C.classList.remove(_.HIGHLIGHT), null)), this.#d.classList.remove(_.ARROW_UP), t ? (this.#x.remove(), this.#x.style.top = "", this.#x.style.bottom = "", this.#x.style.paddingLeft = "", this.#x.style.paddingRight = "") : (this.#f.style.top = "", this.#f.style.bottom = "");
1846
- }
1847
- #ee() {
1848
- if (this.#e.dropdownAlwaysOpen) return !0;
1849
- let e = this.telInputEl.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
1850
- return n >= this.#o || n >= t;
1851
- }
1852
- #te() {
1853
- let { dropdownContainer: e, useFullscreenPopup: t } = this.#e;
1854
- if (t) {
1855
- if (window.innerWidth >= C.NARROW_VIEWPORT_WIDTH) {
1856
- let e = this.telInputEl.getBoundingClientRect();
1857
- this.#x.style.paddingLeft = `${e.left}px`, this.#x.style.paddingRight = `${window.innerWidth - e.right}px`;
1858
- }
1859
- } else {
1860
- let e = this.telInputEl.getBoundingClientRect();
1861
- this.#x.style.left = `${e.left}px`, this.#ee() ? this.#x.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#x.style.top = "unset", this.#x.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
1862
- }
1863
- e.appendChild(this.#x);
1864
- }
1865
- #ne() {
1866
- let e = window.visualViewport;
1867
- if (!e || !this.#x) return;
1868
- let t = window.innerHeight - e.height;
1869
- this.#x.style.bottom = `${t}px`;
1870
- }
1871
- isDropdownOpen() {
1872
- return !this.#f.classList.contains(_.HIDE);
1873
- }
1874
- setLoading(e) {
1875
- this.#l.classList.toggle(_.LOADING, e);
1876
- }
1877
- isLoading() {
1878
- return this.#l.classList.contains(_.LOADING);
1879
- }
1880
- setDisabled(e) {
1881
- this.telInputEl.disabled = e, this.#c && (e ? this.#c.setAttribute("disabled", "true") : this.#c.removeAttribute("disabled"));
1882
- }
1883
- setReadonly(e) {
1884
- this.telInputEl.readOnly = e, this.#c && (e ? this.#c.setAttribute("disabled", "true") : this.#c.removeAttribute("disabled"));
1885
- }
1886
- setCountry(e) {
1887
- let { allowDropdown: t, showFlags: n, separateDialCode: r, i18n: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
1888
- if (t && this.#Q(s), this.#c) {
1889
- let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c;
1890
- s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" : K()) : (r = i.noCountrySelected, t = i.noCountrySelected, c = K()), this.#l.className = e, this.#c.setAttribute("title", r), this.#c.setAttribute(j.LABEL, t), this.#l.innerHTML = c;
1891
- }
1892
- if (r) {
1893
- let e = o ? `+${o}` : "";
1894
- this.#u.textContent = e, this.#N();
1895
- }
1896
- }
1897
- destroy() {
1898
- this.telInputEl.iti = void 0, delete this.telInputEl.dataset[A.INSTANCE_ID], this.telInputEl.style.paddingLeft = this.#r;
1899
- let e = this.telInputEl.parentNode;
1900
- e && (e.before(this.telInputEl), e.remove()), this.#w.clear();
1901
- }
1902
- }, ue = (e) => {
1903
- let { onlyCountries: t, excludeCountries: n } = e;
1904
- return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
1905
- }, de = (e, t) => {
1906
- let { countryNameLocale: n, i18n: r } = t, i;
1907
- try {
1908
- i = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
1909
- } catch (e) {
1910
- console.error(e), i = null;
1911
- }
1912
- for (let t of e) t.name = r[t.iso2] || i?.of(t.iso2.toUpperCase()) || "";
1913
- }, fe = (e) => {
1914
- let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
1915
- if (!e || !t) return;
1916
- t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
1917
- let i = r[t];
1918
- i.includes(e) || i.push(e);
1919
- }, a = [...e].sort((e, t) => e.priority - t.priority);
1920
- for (let e of a) {
1921
- t.has(e.dialCode) || t.add(e.dialCode);
1922
- for (let t = 1; t < e.dialCode.length; t++) {
1923
- let n = e.dialCode.substring(0, t);
1924
- i(e.iso2, n);
1925
- }
1926
- if (i(e.iso2, e.dialCode), e.areaCodes) {
1927
- let t = r[e.dialCode][0];
1928
- for (let n of e.areaCodes) {
1929
- for (let r = 1; r < n.length; r++) {
1930
- let a = n.substring(0, r), o = e.dialCode + a;
1931
- i(t, o), i(e.iso2, o);
1932
- }
1933
- i(e.iso2, e.dialCode + n);
1934
- }
1935
- }
1936
- }
1937
- return {
1938
- dialCodes: t,
1939
- dialCodeMaxLength: n,
1940
- dialCodeToIso2Map: r
1941
- };
1942
- }, pe = (e, t) => {
1943
- let { countryOrder: n } = t;
1944
- e.sort((e, t) => {
1945
- if (n) {
1946
- let r = n.indexOf(e.iso2), i = n.indexOf(t.iso2), a = r > -1, o = i > -1;
1947
- if (a || o) return a && o ? r - i : a ? -1 : 1;
1948
- }
1949
- return e.name.localeCompare(t.name);
1950
- });
1951
- }, me = (e) => {
1952
- for (let t of e) t.normalisedName = U(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
1953
- }, he = /* @__PURE__ */ new Set([
1954
- "800",
1955
- "808",
1956
- "870",
1957
- "881",
1958
- "882",
1959
- "883",
1960
- "888",
1961
- "979"
1962
- ]), J = (e) => {
1963
- let t = H(e).slice(0, 3);
1964
- return e.startsWith("+") && he.has(t);
1965
- }, Y = (e, t, n, r) => {
1966
- if (!n || !t) return e;
1967
- let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
1968
- return e.substring(a);
1969
- }, ge = (e, t, n, r, i) => {
1970
- let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
1971
- return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
1972
- }, _e = (e, t, n, r) => {
1973
- if (n === 0 && !r) return 0;
1974
- let i = 0;
1975
- for (let n = 0; n < t.length; n++) {
1976
- if (/[+0-9]/.test(t[n]) && i++, i === e && !r) return n + 1;
1977
- if (r && i === e + 1) return n;
1978
- }
1979
- return t.length;
1980
- }, ve = /* @__PURE__ */ new Set([
1981
- "800",
1982
- "822",
1983
- "833",
1984
- "844",
1985
- "855",
1986
- "866",
1987
- "877",
1988
- "880",
1989
- "881",
1990
- "882",
1991
- "883",
1992
- "884",
1993
- "885",
1994
- "886",
1995
- "887",
1996
- "888",
1997
- "889"
1998
- ]), ye = (e) => {
1999
- let t = H(e);
2000
- if (t.startsWith(w.NANP) && t.length >= 4) {
2001
- let e = t.substring(1, 4);
2002
- return ve.has(e);
2003
- }
2004
- return !1;
2005
- }, be = class {
2006
- #e;
2007
- constructor(e) {
2008
- e && this.#t(e);
2009
- }
2010
- #t(e) {
2011
- /[\u0660-\u0669]/.test(e) ? this.#e = "arabic-indic" : /[\u06F0-\u06F9]/.test(e) ? this.#e = "persian" : this.#e = "ascii";
2012
- }
2013
- denormalise(e) {
2014
- if (!this.#e || this.#e === "ascii") return e;
2015
- let t = this.#e === "arabic-indic" ? 1632 : 1776;
2016
- return e.replace(/[0-9]/g, (e) => String.fromCharCode(t + Number(e)));
2017
- }
2018
- normalise(e) {
2019
- if (!e) return "";
2020
- if (this.#t(e), this.#e === "ascii") return e;
2021
- let t = this.#e === "arabic-indic" ? 1632 : 1776, n = this.#e === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
2022
- return e.replace(n, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - t)));
2023
- }
2024
- isAscii() {
2025
- return !this.#e || this.#e === "ascii";
2026
- }
2027
- }, xe = 0, X = (e) => {
2028
- if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
2029
- }, Se = () => {
2030
- let e, t;
2031
- return {
2032
- promise: new Promise((n, r) => {
2033
- e = n, t = r;
2034
- }),
2035
- resolve: e,
2036
- reject: t
2037
- };
2038
- }, Z = class e {
2039
- id;
2040
- promise;
2041
- #e;
2042
- #t;
2043
- #n;
2044
- #r;
2045
- #i;
2046
- #a;
2047
- #o;
2048
- #s;
2049
- #c = null;
2050
- #l = null;
2051
- #u;
2052
- #d = !0;
2053
- #f;
2054
- #p;
2055
- #m = !1;
2056
- #h;
2057
- #g;
2058
- constructor(e, t = {}) {
2059
- this.id = xe++, q.validateInput(e);
2060
- let n = ne(t);
2061
- this.#t = {
2062
- ...F,
2063
- ...n
2064
- }, re(this.#t), ie(this.#t), this.#e = new q(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#p = new be(e.value), this.promise = this.#y(this.#t), this.#r = ue(this.#t);
2065
- let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = fe(this.#r);
2066
- this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#b();
2067
- }
2068
- #_() {
2069
- let e = this.#e.telInputEl.value.trim();
2070
- return this.#p.normalise(e);
2071
- }
2072
- #v(e) {
2073
- this.#e.telInputEl.value = this.#p.denormalise(e);
2074
- }
2075
- #y(e) {
2076
- let { initialCountry: t, geoIpLookup: n, loadUtils: r } = e, i = t === O.AUTO && !!n, a = !!r && !Q.utils;
2077
- return i && (this.#h = Se()), a && (this.#g = Se()), Promise.all([this.#h?.promise, this.#g?.promise]).then(() => {});
2078
- }
2079
- #b() {
2080
- this.#f = new AbortController(), this.#x(), this.#e.buildMarkup(this.#r), this.#S(), this.#C(), this.#w(), this.#t.dropdownAlwaysOpen && this.#H();
2081
- }
2082
- #x() {
2083
- de(this.#r, this.#t), pe(this.#r, this.#t), me(this.#r);
2084
- }
2085
- #S(e = !1) {
2086
- let t = this.#e.telInputEl.getAttribute("value"), n = this.#p.normalise(t ?? ""), r = this.#_(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#ee(i), o = ye(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === O.AUTO && c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
2087
- a ? o ? f ? this.#J(u) : d || this.#J(E.ISO2) : (f && this.#J(u), this.#W(i)) : f ? this.#J(u) : d || this.#J(""), i && this.#U(i);
2088
- }
2089
- #C() {
2090
- this.#O(), this.#t.allowDropdown && this.#e.bindAllInitialDropdownListeners(this.#f.signal, () => this.#H(), () => this.#Q()), this.#e.bindHiddenInputSubmitListener(this.#f.signal, () => this.getNumber(), () => this.#c?.iso2 || "");
2091
- }
2092
- #w() {
2093
- if (this.#g) {
2094
- let { loadUtils: e } = this.#t, t = () => {
2095
- Q.attachUtils(e)?.catch(() => {});
2096
- };
2097
- Q.documentReady() ? t() : window.addEventListener("load", t, { signal: this.#f.signal });
2098
- }
2099
- this.#h && (this.#c ? this.#h.resolve() : this.#T());
2100
- }
2101
- #T() {
2102
- if (Q.autoCountry) {
2103
- this.#oe();
2104
- return;
2105
- }
2106
- this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.geoIpLookup == "function" && this.#t.geoIpLookup((t = "") => {
2107
- let n = t.toLowerCase();
2108
- m(n) ? (Q.autoCountry = n, setTimeout(() => e.forEachInstance("handleAutoCountryLoaded"))) : e.forEachInstance("handleAutoCountryFailure");
2109
- }, () => {
2110
- e.forEachInstance("handleAutoCountryFailure");
2111
- }));
2112
- }
2113
- #E() {
2114
- this.#H(), this.#e.prefillSearchWithPlus();
2115
- }
2116
- #D(e) {
2117
- let t = this.#e.telInputEl.selectionStart || 0, n = e.substring(0, t - 1), r = e.substring(t);
2118
- return this.#v(n + r), t - 1;
2119
- }
2120
- #O() {
2121
- this.#N(), this.#F(), this.#L();
2122
- }
2123
- #k(e) {
2124
- this.#D(e), this.#E();
2125
- }
2126
- #A(e, t) {
2127
- let n = this.#D(e);
2128
- this.#e.telInputEl.setSelectionRange(n, n), this.#B(), this.#V(g.STRICT_REJECT, {
2129
- source: "key",
2130
- rejectedInput: t,
2131
- reason: "invalid"
2132
- });
2133
- }
2134
- #j(e, t) {
2135
- let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = ge(this.#ne(), e, Q.utils, this.#c, this.#t.separateDialCode), a = _e(r, i, n, t);
2136
- this.#v(i), this.#e.telInputEl.setSelectionRange(a, a);
2137
- }
2138
- #M(e) {
2139
- if (e.startsWith("+") && this.#c && this.#ee(e)) {
2140
- let t = Y(e, !0, !0, this.#c);
2141
- this.#v(t);
2142
- }
2143
- }
2144
- #N() {
2145
- this.#m = b.ALPHA_UNICODE.test(this.#_()), this.#e.telInputEl.addEventListener("input", this.#P, { signal: this.#f.signal });
2146
- }
2147
- #P = (e) => {
2148
- let { strictMode: t, formatAsYouType: n, separateDialCode: r, allowDropdown: i, countrySearch: a } = this.#t, o = e?.detail;
2149
- if (o?.isCountryChange) return;
2150
- let s = this.#_();
2151
- if (this.#n && e?.data === "+" && r && i && a) {
2152
- this.#k(s);
2153
- return;
2154
- }
2155
- if (this.#n && t && (e?.data === " " || e?.data === "-" || e?.data === ".")) {
2156
- this.#A(s, e.data);
2157
- return;
2158
- }
2159
- this.#W(s) && this.#ae();
2160
- let c = e?.data && b.NON_PLUS_NUMERIC.test(e.data), l = e?.inputType === y.PASTE && s;
2161
- c || l && !t ? this.#m = !0 : b.NON_PLUS_NUMERIC.test(s) || (this.#m = !1), n && !this.#m && !o?.isSetNumber && this.#p.isAscii() && this.#j(s, e?.inputType === y.DELETE_FORWARD), r && this.#M(s);
2162
- };
2163
- #F() {
2164
- let { strictMode: e, separateDialCode: t } = this.#t;
2165
- !e && !t || this.#e.telInputEl.addEventListener("keydown", this.#I, { signal: this.#f.signal });
2166
- }
2167
- #I = (e) => {
2168
- let { strictMode: t, separateDialCode: n, allowDropdown: r, countrySearch: i } = this.#t;
2169
- if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) return;
2170
- if (n && r && i && e.key === "+") {
2171
- e.preventDefault(), this.#E();
2172
- return;
2173
- }
2174
- if (!t) return;
2175
- let a = this.#_(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#p.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#te(h), v = !1;
2176
- Q.utils && this.#l && (v = Q.utils.getCoreNumber(_, this.#c?.iso2).length > this.#l);
2177
- let y = this.#K(_) !== null;
2178
- (!l || v && !y && !o) && (this.#B(), this.#V(g.STRICT_REJECT, {
2179
- source: "key",
2180
- rejectedInput: e.key,
2181
- reason: l ? "max-length" : "invalid"
2182
- }), e.preventDefault());
2183
- };
2184
- #L() {
2185
- this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", this.#R, { signal: this.#f.signal });
2186
- }
2187
- #R = (e) => {
2188
- e.preventDefault();
2189
- let t = this.#e.telInputEl, n = t.selectionStart, r = t.selectionEnd, i = this.#_(), a = i.slice(0, n ?? void 0), o = i.slice(r ?? void 0), s = this.#c?.iso2, c = e.clipboardData.getData("text"), l = this.#p.normalise(c), u = n === 0 && r > 0, d = !i.startsWith("+") || u, f = l.replace(b.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = a + h + o, v = h === l ? null : "invalid";
2190
- if (_.length > 5 && Q.utils) {
2191
- let e = Q.utils.getCoreNumber(_, s);
2192
- for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, s);
2193
- if (!e) {
2194
- this.#B(), this.#V(g.STRICT_REJECT, {
2195
- source: "paste",
2196
- rejectedInput: c,
2197
- reason: "max-length"
2198
- });
2199
- return;
2200
- }
2201
- if (this.#l && e.length > this.#l) if (t.selectionEnd === i.length) {
2202
- let t = e.length - this.#l;
2203
- _ = _.slice(0, _.length - t), v = "max-length";
2204
- } else {
2205
- this.#B(), this.#V(g.STRICT_REJECT, {
2206
- source: "paste",
2207
- rejectedInput: c,
2208
- reason: "max-length"
2209
- });
2210
- return;
2211
- }
2212
- }
2213
- this.#v(_);
2214
- let y = n + h.length;
2215
- t.setSelectionRange(y, y), t.dispatchEvent(new InputEvent("input", { bubbles: !0 })), v && (l.length > 0 && h.length === 0 && this.#B(), this.#V(g.STRICT_REJECT, {
2216
- source: "paste",
2217
- rejectedInput: c,
2218
- reason: v
2219
- }));
2220
- };
2221
- #z(e) {
2222
- let t = Number(this.#e.telInputEl.getAttribute("maxlength"));
2223
- return t && e.length > t ? e.substring(0, t) : e;
2224
- }
2225
- #B() {
2226
- if (!this.#t.strictRejectAnimation) return;
2227
- let e = this.#e.telInputEl.parentElement;
2228
- e && (e.classList.remove("iti__strict-reject-animation"), e.offsetWidth, e.classList.add("iti__strict-reject-animation"));
2229
- }
2230
- #V(e, t = {}) {
2231
- let n = new CustomEvent(e, {
2232
- bubbles: !0,
2233
- cancelable: !0,
2234
- detail: t
2235
- });
2236
- this.#e.telInputEl.dispatchEvent(n);
2237
- }
2238
- #H() {
2239
- this.#e.openDropdown((e) => this.#Z(e), () => this.#Q()), this.#V(g.OPEN_COUNTRY_DROPDOWN);
2240
- }
2241
- #U(e) {
2242
- let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
2243
- if (t && Q.utils && this.#c) {
2244
- let t = J(e), a = n && !t || !i.startsWith("+") && !r, { NATIONAL: o, INTERNATIONAL: s } = Q.utils.numberFormat, c = a ? o : s;
2245
- i = Q.utils.formatNumber(i, this.#c?.iso2, c);
2246
- }
2247
- i = this.#re(i), this.#v(i);
2248
- }
2249
- #W(e) {
2250
- let t = this.#K(e);
2251
- return t === null ? !1 : this.#J(t);
2252
- }
2253
- #G(e) {
2254
- let t = this.#c?.dialCode, n = this.#c?.nationalPrefix;
2255
- return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
2256
- }
2257
- #K(e) {
2258
- let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#c?.iso2;
2259
- n = this.#G(n);
2260
- let i = this.#ee(n, !0), a = H(n);
2261
- if (i) {
2262
- let e = H(i), t = this.#a[e];
2263
- return t.length === 1 ? t[0] === r ? null : t[0] : this.#q(t, e, a);
2264
- } else if (n.startsWith("+") && a.length) {
2265
- let e = this.#c?.dialCode || "";
2266
- return e && e.startsWith(a) ? null : "";
2267
- } else if ((!n || n === "+") && !r && this.#u) return this.#u;
2268
- return null;
2269
- }
2270
- #q(e, t, n) {
2271
- let r = this.#c?.iso2, i = this.#c?.dialCode;
2272
- if (!r && this.#u && e.includes(this.#u)) return this.#u;
2273
- if (i === w.NANP && ye(n)) return null;
2274
- let a = this.#c?.areaCodes, o = this.#c?.priority;
2275
- if (a) {
2276
- let e = a.map((e) => `${i}${e}`);
2277
- for (let t of e) if (n.startsWith(t)) return null;
2278
- }
2279
- let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
2280
- return !c && !l ? e[0] : null;
2281
- }
2282
- #J(e) {
2283
- let t = this.#c?.iso2 || "";
2284
- return this.#c = e ? this.#s.get(e) : null, this.#c && (this.#u = this.#c.iso2), this.#e.setCountry(this.#c), this.#X(), this.#Y(), t !== e;
2285
- }
2286
- #Y() {
2287
- let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
2288
- if (!e || !Q.utils) return;
2289
- let r = this.#c?.iso2;
2290
- if (!r) {
2291
- this.#l = null;
2292
- return;
2293
- }
2294
- let i = Q.utils.numberType[t], a = Q.utils.getExampleNumber(r, !1, i, !0), o = a;
2295
- for (; Q.utils.isPossibleNumber(a, r, n);) o = a, a += "0";
2296
- let s = Q.utils.getCoreNumber(o, r);
2297
- this.#l = s.length, r === "by" && (this.#l = s.length + 1);
2298
- }
2299
- #X() {
2300
- let { autoPlaceholder: e, placeholderNumberType: t, nationalMode: n, customPlaceholder: r } = this.#t, i = e === D.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === D.POLITE;
2301
- if (!Q.utils || !i) return;
2302
- let a = Q.utils.numberType[t], o = this.#c ? Q.utils.getExampleNumber(this.#c.iso2, n, a) : "";
2303
- o = this.#re(o), typeof r == "function" && (o = r(o, this.#c)), this.#e.telInputEl.setAttribute("placeholder", o);
2304
- }
2305
- #Z(e) {
2306
- if (!e) return;
2307
- let t = e.dataset[A.ISO2], n = this.#J(t);
2308
- this.#Q();
2309
- let r = e.dataset[A.DIAL_CODE];
2310
- if (this.#$(r), this.#t.formatOnDisplay) {
2311
- let e = this.#_();
2312
- this.#U(e);
2313
- }
2314
- this.#e.telInputEl.focus(), n && (this.#ae(), this.#V(g.INPUT, { isCountryChange: !0 }));
2315
- }
2316
- #Q(e) {
2317
- !this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#V(g.CLOSE_COUNTRY_DROPDOWN));
2318
- }
2319
- #$(e) {
2320
- let t = this.#_();
2321
- if (!t.startsWith("+")) return;
2322
- let n = `+${e}`, r = this.#ee(t), i;
2323
- i = r ? t.replace(r, n) : n, this.#v(i);
2324
- }
2325
- #ee(e, t) {
2326
- if (!e.startsWith("+")) return "";
2327
- let n = "", r = "", i = !1;
2328
- for (let a = 0; a < e.length; a++) {
2329
- let o = e.charAt(a);
2330
- if (/[0-9]/.test(o)) {
2331
- if (r += o, !this.#a[r]) break;
2332
- if (this.#o.has(r)) {
2333
- if (n = e.substring(0, a + 1), i = !0, !t) break;
2334
- } else t && i && (n = e.substring(0, a + 1));
2335
- if (r.length === this.#i) break;
2336
- }
2337
- }
2338
- return n;
2339
- }
2340
- #te(e) {
2341
- let t = this.#c?.dialCode, n = H(e);
2342
- return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
2343
- }
2344
- #ne() {
2345
- let e = this.#_();
2346
- return this.#te(e);
2347
- }
2348
- #re(e) {
2349
- let t = Y(e, !!this.#ee(e), this.#t.separateDialCode, this.#c);
2350
- return this.#z(t);
2351
- }
2352
- #ie() {
2353
- let e = this.#c;
2354
- if (!e) return null;
2355
- let { iso2: t, dialCode: n, name: r } = e;
2356
- return {
2357
- iso2: t,
2358
- dialCode: n,
2359
- name: r
2360
- };
2361
- }
2362
- #ae() {
2363
- let e = this.#ie();
2364
- this.#V(g.COUNTRY_CHANGE, e);
2365
- }
2366
- #oe() {
2367
- if (!(!this.#h || !Q.autoCountry)) {
2368
- if (!this.#d) {
2369
- this.#h.resolve();
2370
- return;
2371
- }
2372
- this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#u = Q.autoCountry, this.#e.setLoading(!1), this.#h.resolve();
2373
- }
2374
- }
2375
- #se() {
2376
- if (!this.#d) {
2377
- this.#h?.reject();
2378
- return;
2379
- }
2380
- this.#S(!0), this.#e.setLoading(!1), this.#h?.reject();
2381
- }
2382
- #ce() {
2383
- if (!this.#d) {
2384
- this.#g?.resolve();
2385
- return;
2386
- }
2387
- if (!Q.utils) {
2388
- this.#g?.resolve();
2389
- return;
2390
- }
2391
- let e = this.#_();
2392
- e && this.#U(e), this.#c && (this.#X(), this.#Y()), this.#g?.resolve();
2393
- }
2394
- #le(e) {
2395
- if (!this.#d) {
2396
- this.#g?.reject(e);
2397
- return;
2398
- }
2399
- this.#g?.reject(e);
2400
- }
2401
- destroy() {
2402
- this.#d && (this.#d = !1, this.#t.allowDropdown && this.#Q(!0), this.#f.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
2403
- }
2404
- isActive() {
2405
- return this.#d;
2406
- }
2407
- getExtension() {
2408
- return this.#d ? (X("getExtension"), Q.utils.getExtension(this.#ne(), this.#c?.iso2)) : "";
2409
- }
2410
- getNumber(e) {
2411
- if (!this.#d) return "";
2412
- X("getNumber");
2413
- let t = this.#c?.iso2, n = this.#ne(), r = Q.utils.formatNumber(n, t, e);
2414
- return this.#p.denormalise(r);
2415
- }
2416
- getNumberType() {
2417
- return this.#d ? (X("getNumberType"), Q.utils.getNumberType(this.#ne(), this.#c?.iso2)) : S.UNKNOWN_NUMBER_TYPE;
2418
- }
2419
- getSelectedCountryData() {
2420
- return this.#ie();
2421
- }
2422
- getValidationError() {
2423
- if (!this.#d) return S.UNKNOWN_VALIDATION_ERROR;
2424
- X("getValidationError");
2425
- let e = this.#c?.iso2;
2426
- return Q.utils.getValidationError(this.#ne(), e);
2427
- }
2428
- isValidNumber() {
2429
- if (!this.#d) return null;
2430
- X("isValidNumber");
2431
- let e = this.#c?.dialCode, t = this.#c?.iso2, n = this.#ne(), r = Q.utils.getCoreNumber(n, t);
2432
- if (r) {
2433
- if (e === T.DIAL_CODE && r[0] === T.MOBILE_PREFIX && r.length !== T.MOBILE_CORE_LENGTH) return !1;
2434
- if (!b.ALPHA_UNICODE.test(n) && e) {
2435
- let t = H(n.startsWith("+") ? n.slice(1 + e.length) : n).length;
2436
- if (r.length > t) return !1;
2437
- }
2438
- }
2439
- return this.#ue("possible");
2440
- }
2441
- isValidNumberPrecise() {
2442
- return this.#d ? (X("isValidNumberPrecise"), this.#ue("precise")) : null;
2443
- }
2444
- #ue(e) {
2445
- let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#c?.iso2, a = this.#ne();
2446
- return !this.#c && !J(a) || !(e === "precise" ? Q.utils.isValidNumber : Q.utils.isPossibleNumber)(a, i, r) ? !1 : b.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
2447
- }
2448
- setCountry(e) {
2449
- if (!this.#d) return;
2450
- let t = e?.toLowerCase();
2451
- if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
2452
- let n = this.#c?.iso2;
2453
- if (e && t !== n || !e && n) {
2454
- if (this.#J(t), this.#$(this.#c?.dialCode || ""), this.#t.formatOnDisplay) {
2455
- let e = this.#_();
2456
- this.#U(e);
2457
- }
2458
- this.#ae(), this.#V(g.INPUT, { isCountryChange: !0 });
2459
- }
2460
- }
2461
- setNumber(e) {
2462
- if (!this.#d) return;
2463
- let t = this.#p.normalise(e), n = this.#W(t);
2464
- this.#U(t), n && this.#ae(), this.#V(g.INPUT, { isSetNumber: !0 });
2465
- }
2466
- setPlaceholderNumberType(e) {
2467
- this.#d && (this.#t.placeholderNumberType = e, this.#X());
2468
- }
2469
- setDisabled(e) {
2470
- this.#d && this.#e.setDisabled(e);
2471
- }
2472
- setReadonly(e) {
2473
- this.#d && this.#e.setReadonly(e);
2474
- }
2475
- static forEachInstance(t, ...n) {
2476
- let r = [...Q.instances.values()], i = n[0];
2477
- r.forEach((n) => {
2478
- if (n instanceof e) switch (t) {
2479
- case "handleUtilsLoaded":
2480
- n.#ce();
2481
- break;
2482
- case "handleUtilsFailure":
2483
- n.#le(i);
2484
- break;
2485
- case "handleAutoCountryLoaded":
2486
- n.#oe();
2487
- break;
2488
- case "handleAutoCountryFailure":
2489
- n.#se();
2490
- break;
2491
- }
2492
- });
2493
- }
2494
- }, Q = Object.assign((e, t) => {
2495
- let n = new Z(e, t);
2496
- return Q.instances.set(String(n.id), n), e.iti = n, n;
2497
- }, {
2498
- defaults: F,
2499
- documentReady: () => document.readyState === "complete",
2500
- getCountryData: () => h,
2501
- getInstance: (e) => {
2502
- let t = e.dataset[A.INSTANCE_ID];
2503
- return t ? Q.instances.get(t) ?? null : null;
2504
- },
2505
- instances: /* @__PURE__ */ new Map(),
2506
- attachUtils: (e) => {
2507
- if (!Q.utils && !Q.startedLoadingUtils) {
2508
- let t;
2509
- if (typeof e == "function") try {
2510
- t = Promise.resolve(e());
2511
- } catch (e) {
2512
- return Promise.reject(e);
2513
- }
2514
- else return Promise.reject(/* @__PURE__ */ TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utils module, not ${typeof e}`));
2515
- return Q.startedLoadingUtils = !0, t.then((e) => {
2516
- let t = e?.default;
2517
- if (!t || typeof t != "object") throw TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
2518
- return Q.utils = t, Z.forEachInstance("handleUtilsLoaded"), !0;
2519
- }).catch((e) => {
2520
- throw Z.forEachInstance("handleUtilsFailure", e), e;
2521
- });
2522
- }
2523
- return null;
2524
- },
2525
- startedLoadingUtils: !1,
2526
- startedLoadingAutoCountry: !1,
2527
- version: "27.3.0"
2528
- }), $ = Q, Ce = /* @__PURE__ */ n({
2529
- inheritAttrs: !1,
2530
- __name: "IntlTelInput",
2531
- props: {
2532
- usePreciseValidation: {
2533
- type: Boolean,
2534
- default: !1
2535
- },
2536
- disabled: {
2537
- type: Boolean,
2538
- default: !1
2539
- },
2540
- readonly: {
2541
- type: Boolean,
2542
- default: !1
2543
- },
2544
- inputProps: { default: () => ({}) },
2545
- initialValue: {},
2546
- modelValue: {},
2547
- allowDropdown: { type: Boolean },
2548
- allowedNumberTypes: {},
2549
- allowNumberExtensions: { type: Boolean },
2550
- allowPhonewords: { type: Boolean },
2551
- autoPlaceholder: {},
2552
- containerClass: {},
2553
- countryNameLocale: {},
2554
- countryOrder: {},
2555
- countrySearch: { type: Boolean },
2556
- customPlaceholder: {},
2557
- dropdownAlwaysOpen: { type: Boolean },
2558
- dropdownContainer: {},
2559
- excludeCountries: {},
2560
- fixDropdownWidth: { type: Boolean },
2561
- formatAsYouType: { type: Boolean },
2562
- formatOnDisplay: { type: Boolean },
2563
- geoIpLookup: {},
2564
- hiddenInput: {},
2565
- i18n: {},
2566
- initialCountry: {},
2567
- loadUtils: {},
2568
- nationalMode: { type: Boolean },
2569
- onlyCountries: {},
2570
- placeholderNumberType: {},
2571
- searchInputClass: {},
2572
- separateDialCode: { type: Boolean },
2573
- strictRejectAnimation: { type: Boolean },
2574
- showFlags: { type: Boolean },
2575
- strictMode: { type: Boolean },
2576
- useFullscreenPopup: { type: Boolean }
2577
- },
2578
- emits: [
2579
- "changeNumber",
2580
- "changeCountry",
2581
- "changeValidity",
2582
- "changeErrorCode",
2583
- "openCountryDropdown",
2584
- "closeCountryDropdown",
2585
- "strictReject",
2586
- "update:modelValue"
2587
- ],
2588
- setup(n, { expose: d, emit: f }) {
2589
- let p = n, m = f, h = (e) => {
2590
- console.warn(`intl-tel-input: ignoring inputProps.${e} - see docs for more info.`);
2591
- }, g = new Set([
2592
- "type",
2593
- "value",
2594
- "disabled",
2595
- "readonly",
2596
- "onInput",
2597
- "oninput"
2598
- ]), _ = c(""), v = e(() => {
2599
- let e = p.inputProps ?? {}, t = {};
2600
- for (let [n, r] of Object.entries(e)) g.has(n) ? h(n) : n === "class" ? t[n] = `${_.value} ${r}` : t[n] = r;
2601
- return t;
2602
- }), y = e(() => p.modelValue ?? p.initialValue ?? ""), b = r(), x = Object.keys($.defaults), S = e(() => {
2603
- let e = b?.vnode.props ?? {}, t = new Set(Object.keys(e).map((e) => e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()))), n = {};
2604
- return x.forEach((e) => {
2605
- if (!t.has(e)) return;
2606
- let r = p[e];
2607
- r !== void 0 && (n[e] = r);
2608
- }), n;
2609
- }), C = c(null), w = l(null), T = c(), E = c(), D = c(), O = c(), k = !1, A = () => (p.usePreciseValidation ? w.value.isValidNumberPrecise() : w.value.isValidNumber()) ?? !1, j = () => {
2610
- if (!w.value?.isActive()) return;
2611
- if (!$.utils) {
2612
- k = !0;
2613
- return;
2614
- }
2615
- let e = A(), t = e ? null : w.value.getValidationError();
2616
- e !== D.value && (D.value = e, m("changeValidity", e)), t !== O.value && (O.value = t, m("changeErrorCode", t));
2617
- }, M = () => {
2618
- if (!w.value?.isActive()) return;
2619
- if (!$.utils) {
2620
- k = !0;
2621
- return;
2622
- }
2623
- let e = w.value.getNumber() ?? "";
2624
- e !== T.value && (T.value = e, m("changeNumber", e), m("update:modelValue", e)), j();
2625
- }, N = () => {
2626
- if (!w.value?.isActive()) return;
2627
- let e = w.value.getSelectedCountryData()?.iso2 ?? "";
2628
- e !== E.value && (E.value = e, m("changeCountry", e)), M();
2629
- }, P = () => m("openCountryDropdown"), F = () => m("closeCountryDropdown"), I = (e) => {
2630
- let { source: t, rejectedInput: n, reason: r } = e.detail;
2631
- m("strictReject", t, n, r);
2632
- };
2633
- return a(() => {
2634
- C.value && (w.value = $(C.value, S.value), _.value = C.value.className, C.value.addEventListener("open:countrydropdown", P), C.value.addEventListener("close:countrydropdown", F), C.value.addEventListener("strict:reject", I), p.disabled && w.value.setDisabled(p.disabled), p.readonly && w.value.setReadonly(p.readonly), E.value = w.value.getSelectedCountryData()?.iso2 ?? "", w.value.promise.then(() => {
2635
- w.value?.isActive() && (y.value && w.value.setNumber(y.value), k ? (k = !1, N()) : (T.value = w.value.getNumber() ?? "", D.value = A(), O.value = D.value ? null : w.value.getValidationError()));
2636
- }));
2637
- }), u(() => p.disabled, (e) => w.value?.setDisabled(e)), u(() => p.readonly, (e) => w.value?.setReadonly(e)), u(() => y.value, (e) => {
2638
- w.value && w.value.promise.then(() => {
2639
- if (!w.value?.isActive()) return;
2640
- let t = e ?? "", n = w.value.getNumber() ?? "";
2641
- document.activeElement === C.value || n === t || (w.value.setNumber(t), j());
2642
- });
2643
- }, { flush: "post" }), o(() => {
2644
- C.value && (C.value.removeEventListener("open:countrydropdown", P), C.value.removeEventListener("close:countrydropdown", F), C.value.removeEventListener("strict:reject", I)), w.value?.destroy();
2645
- }), d({
2646
- instance: w,
2647
- input: C
2648
- }), (e, n) => (s(), t("input", i(v.value, {
2649
- ref_key: "input",
2650
- ref: C,
2651
- type: "tel",
2652
- onInput: N
2653
- }), null, 16));
2654
- }
2655
- });
2656
- //#endregion
2657
- export { $ as n, Ce as t };