UNPKG

ngx-material-intl-tel-input

Version:
1 lines 117 kB
{"version":3,"file":"ngx-material-intl-tel-input.mjs","sources":["../../../../libs/ngx-material-intl-tel-input-lib/src/lib/enums/country-iso.enum.ts","../../../../libs/ngx-material-intl-tel-input-lib/src/lib/data/country-code.ts","../../../../libs/ngx-material-intl-tel-input-lib/src/lib/validators/tel.validators.ts","../../../../libs/ngx-material-intl-tel-input-lib/src/lib/services/geo-ip/geo-ip.service.ts","../../../../libs/ngx-material-intl-tel-input-lib/src/lib/services/country-data/country-data.service.ts","../../../../libs/ngx-material-intl-tel-input-lib/src/lib/ngx-material-intl-tel-input-lib/ngx-material-intl-tel-input-lib.component.ts","../../../../libs/ngx-material-intl-tel-input-lib/src/lib/ngx-material-intl-tel-input-lib/ngx-material-intl-tel-input-lib.component.html","../../../../libs/ngx-material-intl-tel-input-lib/src/ngx-material-intl-tel-input.ts"],"sourcesContent":["export enum CountryISO {\n\tAfghanistan = 'af',\n\tAlbania = 'al',\n\tAlgeria = 'dz',\n\tAmericanSamoa = 'as',\n\tAndorra = 'ad',\n\tAngola = 'ao',\n\tAnguilla = 'ai',\n\tAntiguaAndBarbuda = 'ag',\n\tArgentina = 'ar',\n\tArmenia = 'am',\n\tAruba = 'aw',\n\tAustralia = 'au',\n\tAustria = 'at',\n\tAzerbaijan = 'az',\n\tBahamas = 'bs',\n\tBahrain = 'bh',\n\tBangladesh = 'bd',\n\tBarbados = 'bb',\n\tBelarus = 'by',\n\tBelgium = 'be',\n\tBelize = 'bz',\n\tBenin = 'bj',\n\tBermuda = 'bm',\n\tBhutan = 'bt',\n\tBolivia = 'bo',\n\tBosniaAndHerzegovina = 'ba',\n\tBotswana = 'bw',\n\tBrazil = 'br',\n\tBritishIndianOceanTerritory = 'io',\n\tBritishVirginIslands = 'vg',\n\tBrunei = 'bn',\n\tBulgaria = 'bg',\n\tBurkinaFaso = 'bf',\n\tBurundi = 'bi',\n\tCambodia = 'kh',\n\tCameroon = 'cm',\n\tCanada = 'ca',\n\tCapeVerde = 'cv',\n\tCaribbeanNetherlands = 'bq',\n\tCaymanIslands = 'ky',\n\tCentralAfricanRepublic = 'cf',\n\tChad = 'td',\n\tChile = 'cl',\n\tChina = 'cn',\n\tChristmasIsland = 'cx',\n\tCocos = 'cc',\n\tColombia = 'co',\n\tComoros = 'km',\n\tCongoDRCJamhuriYaKidemokrasiaYaKongo = 'cd',\n\tCongoRepublicCongoBrazzaville = 'cg',\n\tCookIslands = 'ck',\n\tCostaRica = 'cr',\n\tCôteDIvoire = 'ci',\n\tCroatia = 'hr',\n\tCuba = 'cu',\n\tCuraçao = 'cw',\n\tCyprus = 'cy',\n\tCzechRepublic = 'cz',\n\tDenmark = 'dk',\n\tDjibouti = 'dj',\n\tDominica = 'dm',\n\tDominicanRepublic = 'do',\n\tEcuador = 'ec',\n\tEgypt = 'eg',\n\tElSalvador = 'sv',\n\tEquatorialGuinea = 'gq',\n\tEritrea = 'er',\n\tEstonia = 'ee',\n\tEthiopia = 'et',\n\tFalklandIslands = 'fk',\n\tFaroeIslands = 'fo',\n\tFiji = 'fj',\n\tFinland = 'fi',\n\tFrance = 'fr',\n\tFrenchGuiana = 'gf',\n\tFrenchPolynesia = 'pf',\n\tGabon = 'ga',\n\tGambia = 'gm',\n\tGeorgia = 'ge',\n\tGermany = 'de',\n\tGhana = 'gh',\n\tGibraltar = 'gi',\n\tGreece = 'gr',\n\tGreenland = 'gl',\n\tGrenada = 'gd',\n\tGuadeloupe = 'gp',\n\tGuam = 'gu',\n\tGuatemala = 'gt',\n\tGuernsey = 'gg',\n\tGuinea = 'gn',\n\tGuineaBissau = 'gw',\n\tGuyana = 'gy',\n\tHaiti = 'ht',\n\tHonduras = 'hn',\n\tHongKong = 'hk',\n\tHungary = 'hu',\n\tIceland = 'is',\n\tIndia = 'in',\n\tIndonesia = 'id',\n\tIran = 'ir',\n\tIraq = 'iq',\n\tIreland = 'ie',\n\tIsleOfMan = 'im',\n\tIsrael = 'il',\n\tItaly = 'it',\n\tJamaica = 'jm',\n\tJapan = 'jp',\n\tJersey = 'je',\n\tJordan = 'jo',\n\tKazakhstan = 'kz',\n\tKenya = 'ke',\n\tKiribati = 'ki',\n\tKosovo = 'xk',\n\tKuwait = 'kw',\n\tKyrgyzstan = 'kg',\n\tLaos = 'la',\n\tLatvia = 'lv',\n\tLebanon = 'lb',\n\tLesotho = 'ls',\n\tLiberia = 'lr',\n\tLibya = 'ly',\n\tLiechtenstein = 'li',\n\tLithuania = 'lt',\n\tLuxembourg = 'lu',\n\tMacau = 'mo',\n\tMacedonia = 'mk',\n\tMadagascar = 'mg',\n\tMalawi = 'mw',\n\tMalaysia = 'my',\n\tMaldives = 'mv',\n\tMali = 'ml',\n\tMalta = 'mt',\n\tMarshallIslands = 'mh',\n\tMartinique = 'mq',\n\tMauritania = 'mr',\n\tMauritius = 'mu',\n\tMayotte = 'yt',\n\tMexico = 'mx',\n\tMicronesia = 'fm',\n\tMoldova = 'md',\n\tMonaco = 'mc',\n\tMongolia = 'mn',\n\tMontenegro = 'me',\n\tMontserrat = 'ms',\n\tMorocco = 'ma',\n\tMozambique = 'mz',\n\tMyanmar = 'mm',\n\tNamibia = 'na',\n\tNauru = 'nr',\n\tNepal = 'np',\n\tNetherlands = 'nl',\n\tNewCaledonia = 'nc',\n\tNewZealand = 'nz',\n\tNicaragua = 'ni',\n\tNiger = 'ne',\n\tNigeria = 'ng',\n\tNiue = 'nu',\n\tNorfolkIsland = 'nf',\n\tNorthKorea = 'kp',\n\tNorthernMarianaIslands = 'mp',\n\tNorway = 'no',\n\tOman = 'om',\n\tPakistan = 'pk',\n\tPalau = 'pw',\n\tPalestine = 'ps',\n\tPanama = 'pa',\n\tPapuaNewGuinea = 'pg',\n\tParaguay = 'py',\n\tPeru = 'pe',\n\tPhilippines = 'ph',\n\tPoland = 'pl',\n\tPortugal = 'pt',\n\tPuertoRico = 'pr',\n\tQatar = 'qa',\n\tRéunion = 're',\n\tRomania = 'ro',\n\tRussia = 'ru',\n\tRwanda = 'rw',\n\tSaintBarthélemy = 'bl',\n\tSaintHelena = 'sh',\n\tSaintKittsAndNevis = 'kn',\n\tSaintLucia = 'lc',\n\tSaintMartin = 'mf',\n\tSaintPierreAndMiquelon = 'pm',\n\tSaintVincentAndTheGrenadines = 'vc',\n\tSamoa = 'ws',\n\tSanMarino = 'sm',\n\tSãoToméAndPríncipe = 'st',\n\tSaudiArabia = 'sa',\n\tSenegal = 'sn',\n\tSerbia = 'rs',\n\tSeychelles = 'sc',\n\tSierraLeone = 'sl',\n\tSingapore = 'sg',\n\tSintMaarten = 'sx',\n\tSlovakia = 'sk',\n\tSlovenia = 'si',\n\tSolomonIslands = 'sb',\n\tSomalia = 'so',\n\tSouthAfrica = 'za',\n\tSouthKorea = 'kr',\n\tSouthSudan = 'ss',\n\tSpain = 'es',\n\tSriLanka = 'lk',\n\tSudan = 'sd',\n\tSuriname = 'sr',\n\tSvalbardAndJanMayen = 'sj',\n\tSwaziland = 'sz',\n\tSweden = 'se',\n\tSwitzerland = 'ch',\n\tSyria = 'sy',\n\tTaiwan = 'tw',\n\tTajikistan = 'tj',\n\tTanzania = 'tz',\n\tThailand = 'th',\n\tTimorLeste = 'tl',\n\tTogo = 'tg',\n\tTokelau = 'tk',\n\tTonga = 'to',\n\tTrinidadAndTobago = 'tt',\n\tTunisia = 'tn',\n\tTurkey = 'tr',\n\tTurkmenistan = 'tm',\n\tTurksAndCaicosIslands = 'tc',\n\tTuvalu = 'tv',\n\tUSVirginIslands = 'vi',\n\tUganda = 'ug',\n\tUkraine = 'ua',\n\tUnitedArabEmirates = 'ae',\n\tUnitedKingdom = 'gb',\n\tUnitedStates = 'us',\n\tUruguay = 'uy',\n\tUzbekistan = 'uz',\n\tVanuatu = 'vu',\n\tVaticanCity = 'va',\n\tVenezuela = 've',\n\tVietnam = 'vn',\n\tWallisAndFutuna = 'wf',\n\tWesternSahara = 'eh',\n\tYemen = 'ye',\n\tZambia = 'zm',\n\tZimbabwe = 'zw',\n\tÅlandIslands = 'ax',\n}\n","import { Injectable } from '@angular/core';\nimport { CountryISO } from '../enums/country-iso.enum';\n\nexport type CountryData = [\n string,\n string,\n string,\n string,\n number?,\n (string | number)[]?\n];\n\n@Injectable()\nexport class CountryCode {\n public allCountries: CountryData[] = [\n ['🇦🇫', 'Afghanistan (‫افغانستان‬‎)', CountryISO.Afghanistan, '93'],\n ['🇦🇱', 'Albania (Shqipëri)', CountryISO.Albania, '355'],\n ['🇩🇿', 'Algeria (‫الجزائر‬‎)', CountryISO.Algeria, '213'],\n ['🇦🇸', 'American Samoa', 'as', '1', 1, ['684']],\n ['🇦🇩', 'Andorra', CountryISO.Andorra, '376'],\n ['🇦🇴', 'Angola', CountryISO.Angola, '244'],\n ['🇦🇮', 'Anguilla', 'ai', '1', 1, ['264']],\n ['🇦🇬', 'Antigua and Barbuda', 'ag', '1', 1, ['268']],\n ['🇦🇷', 'Argentina', CountryISO.Argentina, '54'],\n ['🇦🇲', 'Armenia (Հայաստան)', CountryISO.Armenia, '374'],\n ['🇦🇼', 'Aruba', CountryISO.Aruba, '297'],\n ['🇦🇺', 'Australia', CountryISO.Australia, '61', 0],\n ['🇦🇹', 'Austria (Österreich)', CountryISO.Austria, '43'],\n ['🇦🇿', 'Azerbaijan (Azərbaycan)', CountryISO.Azerbaijan, '994'],\n ['🇧🇸', 'Bahamas', 'bs', '1', 1, ['242']],\n ['🇧🇭', 'Bahrain (‫البحرين‬‎)', CountryISO.Bahrain, '973'],\n ['🇧🇩', 'Bangladesh (বাংলাদেশ)', CountryISO.Bangladesh, '880'],\n ['🇧🇧', 'Barbados', 'bb', '1', 1, ['246']],\n ['🇧🇾', 'Belarus (Беларусь)', CountryISO.Belarus, '375'],\n ['🇧🇪', 'Belgium (België)', CountryISO.Belgium, '32'],\n ['🇧🇿', 'Belize', CountryISO.Belize, '501'],\n ['🇧🇯', 'Benin (Bénin)', CountryISO.Benin, '229'],\n ['🇧🇲', 'Bermuda', 'bm', '1', 1, ['441']],\n ['🇧🇹', 'Bhutan (འབྲུག)', CountryISO.Bhutan, '975'],\n ['🇧🇴', 'Bolivia', CountryISO.Bolivia, '591'],\n [\n '🇧🇦',\n 'Bosnia and Herzegovina (Босна и Херцеговина)',\n CountryISO.BosniaAndHerzegovina,\n '387'\n ],\n ['🇧🇼', 'Botswana', CountryISO.Botswana, '267'],\n ['🇧🇷', 'Brazil (Brasil)', CountryISO.Brazil, '55'],\n [\n '🇮🇴',\n 'British Indian Ocean Territory',\n CountryISO.BritishIndianOceanTerritory,\n '246'\n ],\n ['🇻🇬', 'British Virgin Islands', 'vg', '1', 1, ['284']],\n ['🇧🇳', 'Brunei', CountryISO.Brunei, '673'],\n ['🇧🇬', 'Bulgaria (България)', CountryISO.Bulgaria, '359'],\n ['🇧🇫', 'Burkina Faso', CountryISO.BurkinaFaso, '226'],\n ['🇧🇮', 'Burundi (Uburundi)', CountryISO.Burundi, '257'],\n ['🇰🇭', 'Cambodia (កម្ពុជា)', CountryISO.Cambodia, '855'],\n ['🇨🇲', 'Cameroon (Cameroun)', CountryISO.Cameroon, '237'],\n [\n '🇨🇦',\n 'Canada',\n CountryISO.Canada,\n '1',\n 1,\n [\n '204',\n '226',\n '236',\n '249',\n '250',\n '289',\n '306',\n '343',\n '365',\n '387',\n '403',\n '416',\n '418',\n '431',\n '437',\n '438',\n '450',\n '506',\n '514',\n '519',\n '548',\n '579',\n '581',\n '587',\n '604',\n '613',\n '639',\n '647',\n '672',\n '705',\n '709',\n '742',\n '778',\n '780',\n '782',\n '807',\n '819',\n '825',\n '867',\n '873',\n '902',\n '905'\n ]\n ],\n ['🇨🇻', 'Cape Verde (Kabu Verdi)', CountryISO.CapeVerde, '238'],\n ['🇧🇶', 'Caribbean Netherlands', CountryISO.CaribbeanNetherlands, '599', 1],\n ['🇰🇾', 'Cayman Islands', 'ky', '1', 1, ['345']],\n [\n '🇨🇫',\n 'Central African Republic (République centrafricaine)',\n CountryISO.CentralAfricanRepublic,\n '236'\n ],\n ['🇹🇩', 'Chad (Tchad)', CountryISO.Chad, '235'],\n ['🇨🇱', 'Chile', CountryISO.Chile, '56'],\n ['🇨🇳', 'China (中国)', CountryISO.China, '86'],\n ['🇨🇽', 'Christmas Island', CountryISO.ChristmasIsland, '61', 2],\n ['🇨🇨', 'Cocos (Keeling) Islands', CountryISO.Cocos, '61', 1],\n ['🇨🇴', 'Colombia', CountryISO.Colombia, '57'],\n ['🇰🇲', 'Comoros (‫جزر القمر‬‎)', CountryISO.Comoros, '269'],\n [\n '🇨🇩',\n 'Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)',\n CountryISO.CongoDRCJamhuriYaKidemokrasiaYaKongo,\n '243'\n ],\n [\n '🇨🇬',\n 'Congo (Republic) (Congo-Brazzaville)',\n CountryISO.CongoRepublicCongoBrazzaville,\n '242'\n ],\n ['🇨🇰', 'Cook Islands', CountryISO.CookIslands, '682'],\n ['🇨🇷', 'Costa Rica', CountryISO.CostaRica, '506'],\n ['🇨🇮', 'Côte d’Ivoire', CountryISO.CôteDIvoire, '225'],\n ['🇭🇷', 'Croatia (Hrvatska)', CountryISO.Croatia, '385'],\n ['🇨🇺', 'Cuba', CountryISO.Cuba, '53'],\n ['🇨🇼', 'Curaçao', CountryISO.Curaçao, '599', 0],\n ['🇨🇾', 'Cyprus (Κύπρος)', CountryISO.Cyprus, '357'],\n ['🇨🇿', 'Czech Republic (Česká republika)', CountryISO.CzechRepublic, '420'],\n ['🇩🇰', 'Denmark (Danmark)', CountryISO.Denmark, '45'],\n ['🇩🇯', 'Djibouti', CountryISO.Djibouti, '253'],\n ['🇩🇲', 'Dominica', CountryISO.Dominica, '1767'],\n [\n '🇩🇴',\n 'Dominican Republic (República Dominicana)',\n CountryISO.DominicanRepublic,\n '1',\n 2,\n ['809', '829', '849']\n ],\n ['🇪🇨', 'Ecuador', CountryISO.Ecuador, '593'],\n ['🇪🇬', 'Egypt (‫مصر‬‎)', CountryISO.Egypt, '20'],\n ['🇸🇻', 'El Salvador', CountryISO.ElSalvador, '503'],\n [\n '🇬🇶',\n 'Equatorial Guinea (Guinea Ecuatorial)',\n CountryISO.EquatorialGuinea,\n '240'\n ],\n ['🇪🇷', 'Eritrea', CountryISO.Eritrea, '291'],\n ['🇪🇪', 'Estonia (Eesti)', CountryISO.Estonia, '372'],\n ['🇪🇹', 'Ethiopia', CountryISO.Ethiopia, '251'],\n [\n '🇫🇰',\n 'Falkland Islands (Islas Malvinas)',\n CountryISO.FalklandIslands,\n '500'\n ],\n ['🇫🇴', 'Faroe Islands (Føroyar)', CountryISO.FaroeIslands, '298'],\n ['🇫🇯', 'Fiji', CountryISO.Fiji, '679'],\n ['🇫🇮', 'Finland (Suomi)', CountryISO.Finland, '358', 0],\n ['🇫🇷', 'France', CountryISO.France, '33'],\n ['🇬🇫', 'French Guiana (Guyane française)', CountryISO.FrenchGuiana, '594'],\n [\n '🇵🇫',\n 'French Polynesia (Polynésie française)',\n CountryISO.FrenchPolynesia,\n '689'\n ],\n ['🇬🇦', 'Gabon', CountryISO.Gabon, '241'],\n ['🇬🇲', 'Gambia', CountryISO.Gambia, '220'],\n ['🇬🇪', 'Georgia (საქართველო)', CountryISO.Georgia, '995'],\n ['🇩🇪', 'Germany (Deutschland)', CountryISO.Germany, '49'],\n ['🇬🇭', 'Ghana (Gaana)', CountryISO.Ghana, '233'],\n ['🇬🇮', 'Gibraltar', CountryISO.Gibraltar, '350'],\n ['🇬🇷', 'Greece (Ελλάδα)', CountryISO.Greece, '30'],\n ['🇬🇱', 'Greenland (Kalaallit Nunaat)', CountryISO.Greenland, '299'],\n ['🇬🇩', 'Grenada', CountryISO.Grenada, '1473'],\n ['🇬🇵', 'Guadeloupe', CountryISO.Guadeloupe, '590', 0],\n ['🇬🇺', 'Guam', 'gu', '1', 1, ['671']],\n ['🇬🇹', 'Guatemala', CountryISO.Guatemala, '502'],\n ['🇬🇬', 'Guernsey', CountryISO.Guernsey, '44', 1, [1481]],\n ['🇬🇳', 'Guinea (Guinée)', CountryISO.Guinea, '224'],\n ['🇬🇼', 'Guinea-Bissau (Guiné Bissau)', CountryISO.GuineaBissau, '245'],\n ['🇬🇾', 'Guyana', CountryISO.Guyana, '592'],\n ['🇭🇹', 'Haiti', CountryISO.Haiti, '509'],\n ['🇭🇳', 'Honduras', CountryISO.Honduras, '504'],\n ['🇭🇰', 'Hong Kong (香港)', CountryISO.HongKong, '852'],\n ['🇭🇺', 'Hungary (Magyarország)', CountryISO.Hungary, '36'],\n ['🇮🇸', 'Iceland (Ísland)', CountryISO.Iceland, '354'],\n ['🇮🇳', 'India (भारत)', CountryISO.India, '91'],\n ['🇮🇩', 'Indonesia', CountryISO.Indonesia, '62'],\n ['🇮🇷', 'Iran (‫ایران‬‎)', CountryISO.Iran, '98'],\n ['🇮🇶', 'Iraq (‫العراق‬‎)', CountryISO.Iraq, '964'],\n ['🇮🇪', 'Ireland', CountryISO.Ireland, '353'],\n ['🇮🇲', 'Isle of Man', CountryISO.IsleOfMan, '44', 2, [1624]],\n ['🇮🇱', 'Israel (‫ישראל‬‎)', CountryISO.Israel, '972'],\n ['🇮🇹', 'Italy (Italia)', CountryISO.Italy, '39', 0],\n ['🇯🇲', 'Jamaica', 'jm', '1', 1, ['876']],\n ['🇯🇵', 'Japan (日本)', CountryISO.Japan, '81'],\n ['🇯🇪', 'Jersey', CountryISO.Jersey, '44', 3, [1534]],\n ['🇯🇴', 'Jordan (‫الأردن‬‎)', CountryISO.Jordan, '962'],\n ['🇰🇿', 'Kazakhstan (Казахстан)', CountryISO.Kazakhstan, '7', 1],\n ['🇰🇪', 'Kenya', CountryISO.Kenya, '254'],\n ['🇰🇮', 'Kiribati', CountryISO.Kiribati, '686'],\n ['🇽🇰', 'Kosovo', CountryISO.Kosovo, '383'],\n ['🇰🇼', 'Kuwait (‫الكويت‬‎)', CountryISO.Kuwait, '965'],\n ['🇰🇬', 'Kyrgyzstan (Кыргызстан)', CountryISO.Kyrgyzstan, '996'],\n ['🇱🇦', 'Laos (ລາວ)', CountryISO.Laos, '856'],\n ['🇱🇻', 'Latvia (Latvija)', CountryISO.Latvia, '371'],\n ['🇱🇧', 'Lebanon (‫لبنان‬‎)', CountryISO.Lebanon, '961'],\n ['🇱🇸', 'Lesotho', CountryISO.Lesotho, '266'],\n ['🇱🇷', 'Liberia', CountryISO.Liberia, '231'],\n ['🇱🇾', 'Libya (‫ليبيا‬‎)', CountryISO.Libya, '218'],\n ['🇱🇮', 'Liechtenstein', CountryISO.Liechtenstein, '423'],\n ['🇱🇹', 'Lithuania (Lietuva)', CountryISO.Lithuania, '370'],\n ['🇱🇺', 'Luxembourg', CountryISO.Luxembourg, '352'],\n ['🇲🇴', 'Macau (澳門)', CountryISO.Macau, '853'],\n ['🇲🇰', 'Macedonia (FYROM) (Македонија)', CountryISO.Macedonia, '389'],\n ['🇲🇬', 'Madagascar (Madagasikara)', CountryISO.Madagascar, '261'],\n ['🇲🇼', 'Malawi', CountryISO.Malawi, '265'],\n ['🇲🇾', 'Malaysia', CountryISO.Malaysia, '60'],\n ['🇲🇻', 'Maldives', CountryISO.Maldives, '960'],\n ['🇲🇱', 'Mali', CountryISO.Mali, '223'],\n ['🇲🇹', 'Malta', CountryISO.Malta, '356'],\n ['🇲🇭', 'Marshall Islands', CountryISO.MarshallIslands, '692'],\n ['🇲🇶', 'Martinique', CountryISO.Martinique, '596'],\n ['🇲🇷', 'Mauritania (‫موريتانيا‬‎)', CountryISO.Mauritania, '222'],\n ['🇲🇺', 'Mauritius (Moris)', CountryISO.Mauritius, '230'],\n ['🇾🇹', 'Mayotte', CountryISO.Mayotte, '262', 1],\n ['🇲🇽', 'Mexico (México)', CountryISO.Mexico, '52'],\n ['🇫🇲', 'Micronesia', CountryISO.Micronesia, '691'],\n ['🇲🇩', 'Moldova (Republica Moldova)', CountryISO.Moldova, '373'],\n ['🇲🇨', 'Monaco', CountryISO.Monaco, '377'],\n ['🇲🇳', 'Mongolia (Монгол)', CountryISO.Mongolia, '976'],\n ['🇲🇪', 'Montenegro (Crna Gora)', CountryISO.Montenegro, '382'],\n ['🇲🇸', 'Montserrat', 'ms', '1', 1, ['664']],\n ['🇲🇦', 'Morocco (‫المغرب‬‎)', CountryISO.Morocco, '212', 0],\n ['🇲🇿', 'Mozambique (Moçambique)', CountryISO.Mozambique, '258'],\n ['🇲🇲', 'Myanmar (Burma) (မြန်မာ)', CountryISO.Myanmar, '95'],\n ['🇳🇦', 'Namibia (Namibië)', CountryISO.Namibia, '264'],\n ['🇳🇷', 'Nauru', CountryISO.Nauru, '674'],\n ['🇳🇵', 'Nepal (नेपाल)', CountryISO.Nepal, '977'],\n ['🇳🇱', 'Netherlands (Nederland)', CountryISO.Netherlands, '31'],\n [\n '🇳🇨',\n 'New Caledonia (Nouvelle-Calédonie)',\n CountryISO.NewCaledonia,\n '687'\n ],\n ['🇳🇿', 'New Zealand', CountryISO.NewZealand, '64'],\n ['🇳🇮', 'Nicaragua', CountryISO.Nicaragua, '505'],\n ['🇳🇪', 'Niger (Nijar)', CountryISO.Niger, '227'],\n ['🇳🇬', 'Nigeria', CountryISO.Nigeria, '234'],\n ['🇳🇺', 'Niue', CountryISO.Niue, '683'],\n ['🇳🇫', 'Norfolk Island', CountryISO.NorfolkIsland, '672'],\n [\n '🇰🇵',\n 'North Korea (조선 민주주의 인민 공화국)',\n CountryISO.NorthKorea,\n '850'\n ],\n [\n '🇲🇵',\n 'Northern Mariana Islands',\n CountryISO.NorthernMarianaIslands,\n '1670'\n ],\n ['🇳🇴', 'Norway (Norge)', CountryISO.Norway, '47', 0],\n ['🇴🇲', 'Oman (‫عُمان‬‎)', CountryISO.Oman, '968'],\n ['🇵🇰', 'Pakistan (‫پاکستان‬‎)', CountryISO.Pakistan, '92'],\n ['🇵🇼', 'Palau', CountryISO.Palau, '680'],\n ['🇵🇸', 'Palestine (‫فلسطين‬‎)', CountryISO.Palestine, '970'],\n ['🇵🇦', 'Panama (Panamá)', CountryISO.Panama, '507'],\n ['🇵🇬', 'Papua New Guinea', CountryISO.PapuaNewGuinea, '675'],\n ['🇵🇾', 'Paraguay', CountryISO.Paraguay, '595'],\n ['🇵🇪', 'Peru (Perú)', CountryISO.Peru, '51'],\n ['🇵🇭', 'Philippines', CountryISO.Philippines, '63'],\n ['🇵🇱', 'Poland (Polska)', CountryISO.Poland, '48'],\n ['🇵🇹', 'Portugal', CountryISO.Portugal, '351'],\n ['🇵🇷', 'Puerto Rico', CountryISO.PuertoRico, '1', 3, ['787', '939']],\n ['🇶🇦', 'Qatar (‫قطر‬‎)', CountryISO.Qatar, '974'],\n ['🇷🇪', 'Réunion (La Réunion)', CountryISO.Réunion, '262', 0],\n ['🇷🇴', 'Romania (România)', CountryISO.Romania, '40'],\n ['🇷🇺', 'Russia (Россия)', CountryISO.Russia, '7', 0],\n ['🇷🇼', 'Rwanda', CountryISO.Rwanda, '250'],\n [\n '🇧🇱',\n 'Saint Barthélemy (Saint-Barthélemy)',\n CountryISO.SaintBarthélemy,\n '590',\n 1\n ],\n ['🇸🇭', 'Saint Helena', CountryISO.SaintHelena, '290'],\n ['🇰🇳', 'Saint Kitts and Nevis', CountryISO.SaintKittsAndNevis, '1869'],\n ['🇱🇨', 'Saint Lucia', 'lc', '1', 1, ['758']],\n [\n '🇲🇫',\n 'Saint Martin (Saint-Martin (partie française))',\n CountryISO.SaintMartin,\n '590',\n 2\n ],\n [\n '🇵🇲',\n 'Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)',\n CountryISO.SaintPierreAndMiquelon,\n '508'\n ],\n ['🇻🇨', 'Saint Vincent and the Grenadines', 'vc', '1', 1, ['784']],\n ['🇼🇸', 'Samoa', CountryISO.Samoa, '685'],\n ['🇸🇲', 'San Marino', CountryISO.SanMarino, '378'],\n [\n '🇸🇹',\n 'São Tomé and Príncipe (São Tomé e Príncipe)',\n CountryISO.SãoToméAndPríncipe,\n '239'\n ],\n [\n '🇸🇦',\n 'Saudi Arabia (‫المملكة العربية السعودية‬‎)',\n CountryISO.SaudiArabia,\n '966'\n ],\n ['🇸🇳', 'Senegal (Sénégal)', CountryISO.Senegal, '221'],\n ['🇷🇸', 'Serbia (Србија)', CountryISO.Serbia, '381'],\n ['🇸🇨', 'Seychelles', CountryISO.Seychelles, '248'],\n ['🇸🇱', 'Sierra Leone', CountryISO.SierraLeone, '232'],\n ['🇸🇬', 'Singapore', CountryISO.Singapore, '65'],\n ['🇸🇽', 'Sint Maarten', 'sx', '1', 1, ['721']],\n ['🇸🇰', 'Slovakia (Slovensko)', CountryISO.Slovakia, '421'],\n ['🇸🇮', 'Slovenia (Slovenija)', CountryISO.Slovenia, '386'],\n ['🇸🇧', 'Solomon Islands', CountryISO.SolomonIslands, '677'],\n ['🇸🇴', 'Somalia (Soomaaliya)', CountryISO.Somalia, '252'],\n ['🇿🇦', 'South Africa', CountryISO.SouthAfrica, '27'],\n ['🇰🇷', 'South Korea (대한민국)', CountryISO.SouthKorea, '82'],\n ['🇸🇸', 'South Sudan (‫جنوب السودان‬‎)', CountryISO.SouthSudan, '211'],\n ['🇪🇸', 'Spain (España)', CountryISO.Spain, '34'],\n ['🇱🇰', 'Sri Lanka (ශ්‍රී ලංකාව)', CountryISO.SriLanka, '94'],\n ['🇸🇩', 'Sudan (‫السودان‬‎)', CountryISO.Sudan, '249'],\n ['🇸🇷', 'Suriname', CountryISO.Suriname, '597'],\n ['🇸🇯', 'Svalbard and Jan Mayen', CountryISO.SvalbardAndJanMayen, '47', 1],\n ['🇸🇿', 'Swaziland', CountryISO.Swaziland, '268'],\n ['🇸🇪', 'Sweden (Sverige)', CountryISO.Sweden, '46'],\n ['🇨🇭', 'Switzerland (Schweiz)', CountryISO.Switzerland, '41'],\n ['🇸🇾', 'Syria (‫سوريا‬‎)', CountryISO.Syria, '963'],\n ['🇹🇼', 'Taiwan (台灣)', CountryISO.Taiwan, '886'],\n ['🇹🇯', 'Tajikistan', CountryISO.Tajikistan, '992'],\n ['🇹🇿', 'Tanzania', CountryISO.Tanzania, '255'],\n ['🇹🇭', 'Thailand (ไทย)', CountryISO.Thailand, '66'],\n ['🇹🇱', 'Timor-Leste', CountryISO.TimorLeste, '670'],\n ['🇹🇬', 'Togo', CountryISO.Togo, '228'],\n ['🇹🇰', 'Tokelau', CountryISO.Tokelau, '690'],\n ['🇹🇴', 'Tonga', CountryISO.Tonga, '676'],\n ['🇹🇹', 'Trinidad and Tobago', 'tt', '1', 1, ['868']],\n ['🇹🇳', 'Tunisia (‫تونس‬‎)', CountryISO.Tunisia, '216'],\n ['🇹🇷', 'Turkey (Türkiye)', CountryISO.Turkey, '90'],\n ['🇹🇲', 'Turkmenistan', CountryISO.Turkmenistan, '993'],\n [\n '🇹🇨',\n 'Turks and Caicos Islands',\n CountryISO.TurksAndCaicosIslands,\n '1649'\n ],\n ['🇹🇻', 'Tuvalu', CountryISO.Tuvalu, '688'],\n ['🇻🇮', 'U.S. Virgin Islands', 'vi', '1', 1, ['340']],\n ['🇺🇬', 'Uganda', CountryISO.Uganda, '256'],\n ['🇺🇦', 'Ukraine (Україна)', CountryISO.Ukraine, '380'],\n [\n '🇦🇪',\n 'United Arab Emirates (‫الإمارات العربية المتحدة‬‎)',\n CountryISO.UnitedArabEmirates,\n '971'\n ],\n ['🇬🇧', 'United Kingdom', CountryISO.UnitedKingdom, '44', 0],\n ['🇺🇸', 'United States', CountryISO.UnitedStates, '1', 0],\n ['🇺🇾', 'Uruguay', CountryISO.Uruguay, '598'],\n ['🇺🇿', 'Uzbekistan (Oʻzbekiston)', CountryISO.Uzbekistan, '998'],\n ['🇻🇺', 'Vanuatu', CountryISO.Vanuatu, '678'],\n [\n '🇻🇦',\n 'Vatican City (Città del Vaticano)',\n CountryISO.VaticanCity,\n '39',\n 1\n ],\n ['🇻🇪', 'Venezuela', CountryISO.Venezuela, '58'],\n ['🇻🇳', 'Vietnam (Việt Nam)', CountryISO.Vietnam, '84'],\n ['🇼🇫', 'Wallis and Futuna', CountryISO.WallisAndFutuna, '681'],\n [\n '🇪🇭',\n 'Western Sahara (‫الصحراء الغربية‬‎)',\n CountryISO.WesternSahara,\n '212',\n 1\n ],\n ['🇾🇪', 'Yemen (‫اليمن‬‎)', CountryISO.Yemen, '967'],\n ['🇿🇲', 'Zambia', CountryISO.Zambia, '260'],\n ['🇿🇼', 'Zimbabwe', CountryISO.Zimbabwe, '263'],\n ['🇦🇽', 'Åland Islands', CountryISO.ÅlandIslands, '358', 1]\n ];\n}\n","import { AbstractControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';\nimport { Country } from '../types/country.model';\n\nexport default class TelValidators {\n static isValidNumber(\n telForm: FormGroup,\n includeDialCode = false,\n allCountries: Country[],\n outputNumberFormat: PhoneNumberFormat = PhoneNumberFormat.INTERNATIONAL\n ): ValidatorFn {\n return (control: AbstractControl): { [key: string]: boolean } | null => {\n try {\n const phoneNumberUtil = PhoneNumberUtil.getInstance();\n\n if (!control.value) {\n return null;\n }\n\n // NOTE: the PhoneNumberUtil.parse() method does NOT appear to correctly parse phone numbers with\n // country codes which include the 'area code' eg. Dominica (+1767), Grenada (+1473), etc.\n // Instead, the returned phone number is for the US (+1) country code.\n const parsed = phoneNumberUtil.parse(control.value);\n\n const setPrefixControlValue = (\n countryCode: string | number | undefined,\n allCountries: Country[],\n telForm: FormGroup\n ) => {\n const country = allCountries.find((c) => {\n if (c.dialCode === countryCode?.toString()) {\n if (c.areaCodes) {\n // Checking the area codes only works because the countries using the same country code as the\n // US (+1) and UK (+44) are ALL defined earlier in the list of all countries (country-code.ts)\n // and are checked before defaulting to the US or UK (which are defined without area codes and\n // have the highest priority (0)).\n return c.areaCodes?.find((ac) =>\n parsed.getNationalNumber()?.toString().startsWith(ac)\n );\n } else if (c.priority === 0) {\n // If a country does NOT have any area codes but shares a country code with another country,\n // return the country with the highest priority (0), eg. country code '599' belongs to both\n // 'Carribean Netherlands' (priority 1) and 'Curaçao' (priority 0).\n return c;\n }\n }\n return undefined;\n });\n if (country && country.iso2 !== telForm?.value?.prefixCtrl?.iso2) {\n telForm.get('prefixCtrl')?.setValue(country, { emitEvent: false });\n }\n };\n if (includeDialCode) {\n const countryDialCode =\n telForm?.value?.prefixCtrl?.dialCode || parsed.getCountryCode();\n if (countryDialCode) {\n setPrefixControlValue(countryDialCode, allCountries, telForm);\n }\n }\n\n const formattedOnlyNumber = phoneNumberUtil.format(\n parsed,\n includeDialCode || telForm?.value?.prefixCtrl?.iso2 === 'mp'\n ? outputNumberFormat\n : PhoneNumberFormat.NATIONAL\n );\n telForm\n .get('numberControl')\n ?.setValue(formattedOnlyNumber, { emitEvent: false });\n\n const isValidNumber = phoneNumberUtil.isValidNumber(parsed);\n setPrefixControlValue(parsed.getCountryCode(), allCountries, telForm);\n if (!isValidNumber) {\n control.setErrors({ invalidNumber: true });\n telForm.get('numberControl')?.setErrors({ invalidNumber: true });\n return {\n invalidNumber: true\n };\n } else {\n control.setErrors(null);\n telForm.get('numberControl')?.setErrors(null);\n return null;\n }\n } catch {\n control.setErrors({ invalidNumber: true });\n telForm.get('numberControl')?.setErrors({ invalidNumber: true });\n return {\n invalidNumber: true\n };\n }\n };\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { GeoData } from '../../types/geo.type';\n\n@Injectable()\nexport class GeoIpService {\n constructor(private http: HttpClient) {}\n\n /**\n * geoIpLookup function makes an HTTP GET request to retrieve geographical data based on the client's IP address.\n *\n * @return {Observable<GeoData>} an observable of GeoData containing geographical information\n */\n geoIpLookup(): Observable<GeoData> {\n return this.http.get<GeoData>('https://ipapi.co/json');\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Country } from '../../types/country.model';\nimport {\n PhoneNumberFormat,\n PhoneNumberType,\n PhoneNumberUtil\n} from 'google-libphonenumber';\nimport { CountryCode, CountryData } from '../../data/country-code';\nimport { CountryISO } from '../../enums/country-iso.enum';\n\n@Injectable()\nexport class CountryDataService {\n phoneNumberUtil = PhoneNumberUtil.getInstance();\n\n /**\n * Retrieves a Country object based on the provided country data and placeholder flag.\n *\n * @param {CountryData} countryData - the country data used to create the Country object\n * @param {boolean} enablePlaceholder - a flag indicating whether to include a placeholder value\n * @return {Country} the generated Country object\n */\n private getCountryObject(\n countryData: CountryData,\n enablePlaceholder: boolean,\n includeDialCode: boolean,\n useMask: boolean,\n forceSelectedCountryCode: boolean,\n showMaskPlaceholder: boolean,\n outputNumberFormat: PhoneNumberFormat\n ): Country {\n const phoneNumberPlaceholder = this.getPhoneNumberPlaceholder(\n countryData[2].toString().toUpperCase(),\n includeDialCode,\n outputNumberFormat\n );\n const country: Country = {\n emojiFlag: countryData[0].toString(),\n name: countryData[1].toString(),\n iso2: countryData[2].toString(),\n dialCode: countryData[3].toString(),\n priority: (countryData?.[4] && +countryData[4]) || 0,\n areaCodes: (countryData[5] as string[]) || undefined,\n htmlId: `country-code__${countryData[2].toString()}`,\n flagClass: `country-code__${countryData[2].toString().toLocaleLowerCase()}`,\n placeHolder: enablePlaceholder ? phoneNumberPlaceholder : ''\n };\n if (useMask) {\n let mask = '';\n if (forceSelectedCountryCode) {\n mask = this.formatPhoneNumberWithPrefix(phoneNumberPlaceholder, false);\n } else {\n mask = this.formatPhoneNumberWithPrefix(phoneNumberPlaceholder, true);\n }\n country.mask = {\n mask: mask,\n lazy: !showMaskPlaceholder\n };\n }\n return country;\n }\n\n /**\n * Sorts the array of countries based on the preferred countries list.\n *\n * @param {Country[]} allCountries - the array of all countries to be sorted\n * @param {string[]} preferredCountries - the list of preferred countries\n * @return {Country[]} the sorted array of countries\n */\n private sortCountries(\n allCountries: Country[],\n preferredCountries?: string[]\n ): Country[] {\n if (preferredCountries?.length) {\n return allCountries.sort((a, b) => {\n if (\n preferredCountries.includes(a.iso2) &&\n !preferredCountries.includes(b.iso2)\n ) {\n return -1;\n } else if (\n !preferredCountries.includes(a.iso2) &&\n preferredCountries.includes(b.iso2)\n ) {\n return 1;\n }\n return 0;\n });\n }\n return allCountries;\n }\n\n /**\n * Retrieves the placeholder for a phone number based on the provided country code.\n *\n * @param {string} countryCode - The country code for the phone number.\n * @return {string} The formatted phone number placeholder.\n */\n protected getPhoneNumberPlaceholder(\n countryCode: string,\n includeDialCode: boolean,\n outputNumberFormat: PhoneNumberFormat\n ): string {\n try {\n return this.phoneNumberUtil.format(\n this.phoneNumberUtil.getExampleNumberForType(\n countryCode,\n PhoneNumberType.MOBILE\n ),\n includeDialCode || countryCode === 'MP'\n ? outputNumberFormat\n : PhoneNumberFormat.NATIONAL\n );\n } catch {\n return '';\n }\n }\n\n /**\n * Process the list of countries based on the provided data and parameters.\n *\n * @param {CountryCode} countryCodeData - the data containing country codes\n * @param {boolean} enablePlaceholder - flag to enable placeholder\n * @param {(CountryISO | string)[]} [visibleCountries] - optional array of visible country ISO codes or country names\n * @param {(CountryISO | string)[]} [preferredCountries] - optional array of preferred country ISO codes or country names\n * @param {(CountryISO | string)[]} [excludedCountries] - optional array of excluded country ISO codes or country names\n * @return {Country[]} the processed and sorted list of countries\n */\n processCountries(\n countryCodeData: CountryCode,\n enablePlaceholder: boolean,\n includeDialCode: boolean,\n visibleCountries?: (CountryISO | string)[],\n preferredCountries?: (CountryISO | string)[],\n excludedCountries?: (CountryISO | string)[],\n useMask = false,\n forceSelectedCountryCode = false,\n showMaskPlaceholder = false,\n outputNumberFormat = PhoneNumberFormat.INTERNATIONAL\n ): Country[] {\n const allCountries: Country[] = countryCodeData.allCountries.map(\n (countryData: CountryData) =>\n this.getCountryObject(\n countryData,\n enablePlaceholder,\n includeDialCode,\n useMask,\n forceSelectedCountryCode,\n showMaskPlaceholder,\n outputNumberFormat\n )\n );\n const filteredVisibleCountries = visibleCountries?.length\n ? allCountries.filter((country) =>\n visibleCountries.includes(country.iso2)\n )\n : allCountries;\n const filteredCountries = excludedCountries?.length\n ? filteredVisibleCountries.filter(\n (country) => !excludedCountries.includes(country.iso2)\n )\n : filteredVisibleCountries;\n const sortedCountries = this.sortCountries(\n filteredCountries,\n preferredCountries\n );\n return sortedCountries;\n }\n\n /**\n * Formats a phone number by masking its digits while optionally masking the prefix.\n *\n * @param {string} phoneNumber - The phone number to be formatted.\n * @param {boolean} maskPrefix - Flag indicating whether to mask the prefix digits.\n * @return {string} The formatted phone number with masked digits and optionally masked prefix.\n */\n private formatPhoneNumberWithPrefix(\n phoneNumber: string,\n maskPrefix: boolean\n ): string {\n // Match the prefix (variable number of digits)\n const prefixMatch = phoneNumber.match(/^\\+\\d+/);\n if (prefixMatch) {\n // Extract the prefix\n const prefix = prefixMatch[0];\n // Determine how to format the prefix based on the maskPrefix parameter\n const formattedPrefix = maskPrefix\n ? `+{${'0'.repeat(prefix.length - 1)}}` // Replace prefix digits with 0s\n : `+{${prefix.slice(1)}}`; // Keep the original prefix digits\n // Extract the rest of the phone number\n const restOfNumber = phoneNumber.slice(prefix.length);\n // Replace all digits in the rest of the phone number with zeros\n const maskedNumber = restOfNumber.replace(/\\d/g, '0');\n // Combine the formatted prefix with the masked number\n return `${formattedPrefix}${maskedNumber}`;\n }\n // If no prefix is found, replace all digits in the entire phone number\n return phoneNumber.replace(/\\d/g, '0');\n }\n}\n","import { AsyncPipe, NgClass, NgTemplateOutlet } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n OnInit,\n effect,\n input,\n model,\n output,\n signal,\n viewChild\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlContainer,\n FormControl,\n FormControlStatus,\n FormGroup,\n ReactiveFormsModule,\n Validators\n} from '@angular/forms';\nimport {\n MAT_SELECT_CONFIG,\n MatSelect,\n MatSelectModule\n} from '@angular/material/select';\nimport { NgxMatSelectSearchModule } from 'ngx-mat-select-search';\nimport { Observable, ReplaySubject, Subject, take, takeUntil } from 'rxjs';\nimport { CountryCode } from '../data/country-code';\nimport { Country } from '../types/country.model';\nimport {\n PhoneNumber,\n PhoneNumberFormat,\n PhoneNumberUtil\n} from 'google-libphonenumber';\nimport {\n MatFormFieldAppearance,\n MatFormFieldModule\n} from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport TelValidators from '../validators/tel.validators';\nimport { GeoIpService } from '../services/geo-ip/geo-ip.service';\nimport { GeoData } from '../types/geo.type';\nimport { TextLabels } from '../types/text-labels.type';\nimport { CountryISO } from '../enums/country-iso.enum';\nimport { CountryDataService } from '../services/country-data/country-data.service';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { IMaskModule } from 'angular-imask';\n\n@Component({\n selector: 'ngx-material-intl-tel-input',\n templateUrl: './ngx-material-intl-tel-input-lib.component.html',\n styleUrl: './ngx-material-intl-tel-input-lib.component.scss',\n imports: [\n AsyncPipe,\n MatSelectModule,\n NgxMatSelectSearchModule,\n ReactiveFormsModule,\n NgClass,\n MatFormFieldModule,\n MatInputModule,\n MatTooltipModule,\n NgTemplateOutlet,\n IMaskModule\n ],\n providers: [\n CountryCode,\n {\n provide: MAT_SELECT_CONFIG,\n useValue: { overlayPanelClass: 'tel-mat-select-pane' }\n },\n GeoIpService,\n CountryDataService\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NgxMaterialIntlTelInputComponent\n implements OnInit, AfterViewInit, OnDestroy\n{\n /** control for the selected country prefix */\n public prefixCtrl: FormControl<Country | null> =\n new FormControl<Country | null>(null);\n\n /** control for the MatSelect filter keyword */\n public prefixFilterCtrl: FormControl<string | null> = new FormControl<\n string | null\n >('');\n\n /** list of countries filtered by search keyword */\n public filteredCountries: ReplaySubject<Country[]> = new ReplaySubject<\n Country[]\n >(1);\n\n singleSelect = viewChild<MatSelect>('singleSelect');\n numberInput = viewChild<ElementRef>('numberInput');\n\n /** Subject that emits when the component has been destroyed. */\n protected _onDestroy = new Subject<void>();\n\n allCountries: Country[] = [];\n phoneNumberUtil = PhoneNumberUtil.getInstance();\n\n telForm = new FormGroup({\n prefixCtrl: this.prefixCtrl,\n numberControl: new FormControl('')\n });\n\n fieldControl = model<\n FormControl | AbstractControl<string | null, string | null> | null\n >(new FormControl(''));\n fieldControlName = input<string>('');\n required = model<boolean>(false);\n disabled = model<boolean>(false);\n appearance = input<MatFormFieldAppearance>('fill');\n enablePlaceholder = input<boolean>(true);\n autoIpLookup = input<boolean>(true);\n autoSelectCountry = input<boolean>(true);\n autoSelectedCountry = input<CountryISO | string>('');\n numberValidation = input<boolean>(true);\n iconMakeCall = input<boolean>(true);\n initialValue = model<string>('');\n enableSearch = input<boolean>(true);\n includeDialCode = input<boolean>(false);\n emojiFlags = input<boolean>(false);\n hidePhoneIcon = input<boolean>(false);\n preferredCountries = input<(CountryISO | string)[]>([]);\n visibleCountries = input<(CountryISO | string)[]>([]);\n excludedCountries = input<(CountryISO | string)[]>([]);\n textLabels = input<TextLabels>({\n mainLabel: 'Phone number',\n codePlaceholder: 'Code',\n searchPlaceholderLabel: 'Search',\n noEntriesFoundLabel: 'No countries found',\n nationalNumberLabel: 'Number',\n hintLabel: 'Select country and type your phone number',\n invalidNumberError: 'Number is not valid',\n requiredError: 'This field is required'\n });\n useMask = input<boolean>(false);\n forceSelectedCountryCode = input<boolean>(false);\n showMaskPlaceholder = input<boolean>(false);\n outputNumberFormat = input<\n | PhoneNumberFormat.E164\n | PhoneNumberFormat.INTERNATIONAL\n | PhoneNumberFormat.RFC3966\n >(PhoneNumberFormat.INTERNATIONAL);\n currentValue = output<string>();\n currentCountryCode = output<string>();\n currentCountryISO = output<string>();\n isFocused = signal<boolean>(false);\n isLoading = signal<boolean>(true);\n\n constructor(\n private countryCodeData: CountryCode,\n private geoIpService: GeoIpService,\n private countryDataService: CountryDataService,\n private controlContainer: ControlContainer\n ) {\n effect(() => {\n this.setRequiredValidators();\n this.setDisabledState();\n });\n }\n\n /**\n * Initialize the component and perform necessary setup tasks.\n *\n */\n ngOnInit(): void {\n this.setFieldControl();\n this.fetchCountryData();\n this.addValidations();\n // load the initial countries list\n this.filteredCountries.next(this.allCountries.slice());\n // listen for search field value changes\n this.prefixFilterCtrl.valueChanges\n .pipe(takeUntil(this._onDestroy))\n .subscribe(() => {\n this.filterCountries();\n });\n this.startTelFormValueChangesListener();\n this.startPrefixValueChangesListener();\n setTimeout(() => {\n this.setInitialTelValue();\n });\n this.startFieldControlValueChangesListener();\n this.startFieldControlStatusChangesListener();\n }\n\n /**\n * Fetches country data and populates the allCountries array.\n */\n protected fetchCountryData(): void {\n const processedCountries = this.countryDataService.processCountries(\n this.countryCodeData,\n this.enablePlaceholder(),\n this.includeDialCode(),\n this.visibleCountries(),\n this.preferredCountries(),\n this.excludedCountries(),\n this.useMask(),\n this.forceSelectedCountryCode(),\n this.showMaskPlaceholder(),\n this.outputNumberFormat()\n );\n this.allCountries = processedCountries;\n }\n\n /**\n * Adds validations to the form field based on the current configuration.\n * It sets required validators and disabled state, and if number validation is enabled,\n * it adds a custom validator to check the validity of the phone number.\n */\n private addValidations(): void {\n this.setRequiredValidators();\n this.setDisabledState();\n if (this.numberValidation()) {\n this.fieldControl()?.addValidators(\n TelValidators.isValidNumber(\n this.telForm,\n this.includeDialCode(),\n this.allCountries,\n this.outputNumberFormat()\n )\n );\n }\n }\n\n /**\n * Sets the required validators for the field control based on the 'required' input property.\n * If 'required' is true, adds a 'Validators.required' validator to the field control.\n * If 'required' is false, removes the 'Validators.required' validator from the field control.\n */\n setRequiredValidators(): void {\n if (this.required()) {\n this.fieldControl()?.addValidators(Validators.required);\n } else {\n this.fieldControl()?.removeValidators(Validators.required);\n }\n }\n\n /**\n * Sets the disabled state of the telForm and fieldControl based on the 'disabled' input property.\n * If 'disabled' is true, both telForm and fieldControl are disabled.\n * If 'disabled' is false, both telForm and fieldControl are enabled.\n */\n setDisabledState(): void {\n if (this.disabled()) {\n this.telForm?.disable();\n this.fieldControl()?.disable();\n } else {\n this.telForm?.enable();\n this.fieldControl()?.enable();\n }\n }\n\n /**\n * A lifecycle hook that is called after Angular has fully initialized a component's view.\n *\n * @return {void}\n */\n ngAfterViewInit(): void {\n this.setInitialPrefixValue();\n }\n\n /**\n * Method called when the component is destroyed.\n *\n */\n ngOnDestroy(): void {\n this._onDestroy.next();\n this._onDestroy.complete();\n }\n\n /**\n * Performs a geo IP lookup and sets the prefix control value based on the country retrieved.\n */\n private geoIpLookup(): void {\n this.geoIpService.geoIpLookup().subscribe({\n next: (data: GeoData) => {\n const country =\n this.allCountries?.find(\n (c) => c.iso2 === data.country_code?.toLowerCase()\n ) || null;\n if (country) {\n this.prefixCtrl.setValue(country);\n } else {\n this.setAutoSelectedCountry();\n }\n },\n error: () => {\n this.setAutoSelectedCountry();\n },\n complete: () => {\n this.isLoading.set(false);\n }\n });\n }\n\n /**\n * Sets the initial value after the filteredCountries are loaded initially\n */\n protected setInitialPrefixValue(): void {\n this.filteredCountries\n .pipe(take(1), takeUntil(this._onDestroy))\n .subscribe(() => {\n // setting the compareWith property to a comparison function\n // triggers initializing the selection according to the initial value of\n // the form control (i.e. _initializeSelection())\n // this needs to be done after the filteredCountries are loaded initially\n // and after the mat-option elements are available\n const singleSelectInstance = this.singleSelect() as MatSelect;\n singleSelectInstance.compareWith = (a: Country, b: Country) =>\n a && b && a.iso2 === b.iso2;\n });\n }\n\n /**\n * Method to filter the list of countries based on a search keyword.\n *\n */\n protected filterCountries(): void {\n if (!this.allCountries) {\n return;\n }\n // get the search keyword\n let search = this.prefixFilterCtrl.value || '';\n if (!search) {\n this.filteredCountries.next(this.allCountries.slice());\n return;\n } else {\n search = search.toLowerCase();\n }\n // filter the countries\n this.filteredCountries.next(\n this.allCountries.filter(\n (country) => country?.name?.toLowerCase()?.indexOf(search) > -1\n )\n );\n }\n\n /**\n * A method that handles the focus event for the input.\n *\n */\n onInputFocus(): void {\n this.isFocused.set(true);\n }\n\n /**\n * A method that handles the blur event for the input.\n */\n onInputBlur(): void {\n this.isFocused.set(false);\n }\n\n /**\n * Listens for changes in the telForm value and updates the fieldControl accordingly.\n */\n private startTelFormValueChangesListener(): void {\n this.telForm.valueChanges\n .pipe(takeUntil(this._onDestroy))\n .subscribe((data) => {\n const inputElement = this.numberInput()?.nativeElement;\n if (data?.numberControl) {\n const cursorPosition = inputElement?.selectionStart;\n const currentValue = data.numberControl;\n this.fieldControl()?.markAsDirty();\n let value = '';\n if (\n data?.prefixCtrl?.dialCode &&\n !this.includeDialCode() &&\n data?.prefixCtrl?.iso2 !== 'mp'\n ) {\n value = '+' + data.prefixCtrl.dialCode + data.numberControl;\n } else {\n value = data.numberControl;\n }\n try {\n const parsed = this.phoneNumberUtil.parse(\n value,\n data?.prefixCtrl?.iso2\n );\n const formatted = this.phoneNumberUtil.format(\n parsed,\n this.outputNumberFormat()\n );\n this.fieldControl()?.setValue(formatted);\n this.setCursorPosition(\n inputElement,\n cursorPosition,\n parsed,\n currentValue\n );\n } catch {\n this.fieldControl()?.setValue(value);\n }\n } else {\n this.fieldControl()?.setValue('');\n }\n });\n }\n\n /**\n * Listens for changes in the prefix control value and updates the number control accordingly.\n * If includeDialCode is true and the data contains a dialCode, sets the number control value with the dial code.\n * If isLoading is false, focuses on the number input element after a timeout.\n */\n private startPrefixValueChangesListener(): void {\n this.prefixCtrl.valueChanges\n .pipe(takeUntil(this._onDestroy))\n .subscribe((data) => {\n if (this.includeDialCode() && data?.dialCode) {\n this.telForm\n .get('numberControl')\n ?.setValue('+' + data?.dialCode, { emitEvent: false });\n }\n if (!this.isLoading()) {\n setTimeout(() => {\n this.numberInput()?.nativeElement?.focus();\n });\n }\n });\n }\n\n /**\n * Sets the initial telephone value based on the initial value.\n */\n private setInitialTelValue(): void {\n if (!this.initialValue()) {\n // set initial selection\n if (this.autoSelectCountry()) {\n if (this.autoIpLookup()) {\n this.geoIpLookup();\n } else {\n this.setAutoSelectedCountry();\n this.isLoading.set(false);\n }\n } else {\n this.isLoading.set(false);\n }\n } else {\n try {\n const parsedNumber = this.phoneNumberUtil.parse(this.initialValue());\n const countryCode = parsedNumber.getCountryCode();\n const country = this.allCountries?.find(\n (c) => c.dialCode === `${countryCode}`\n );\n if (country) {\n this.prefixCtrl.setValue(country);\n }\n const nationalNumber =\n parsedNumber?.getNationalNumber()?.toString() || '';\n if (nationalNumber) {\n this.telForm.get('numberControl')?.setValue(nationalNumber);\n }\n } catch {\n this.telForm.get('numberControl')?.setValue(this.initialValue());\n this.fieldControl()?.setValue(this.initialValue());\n this.fieldControl()?.markAsDirty();\n } finally {\n this.isLoading.set(false);\n }\n }\n }\n\n /**\n * Set the auto selected country based on the specified criteria.\n *\n */\n private setAutoSelectedCountry(