UNPKG

ngx-material-intl-tel-input

Version:
1 lines 147 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/utils/phone-number.utils.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-display-name/country-display-name.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/components/phone-icon/phone-icon.component.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 { PhoneNumberType, PhoneNumberUtil } from 'google-libphonenumber';\n\n/**\n * Gets the maximum allowed length for a country's phone number.\n *\n * @param {string} countryCode - ISO2 country code (e.g., 'CH' for Switzerland)\n * @returns {number} The maximum allowed length for the country's national number\n */\nexport const getMaxPhoneNumberLength = (countryCode?: string): number => {\n try {\n const phoneNumberUtil = PhoneNumberUtil.getInstance();\n\n // Default reasonable maximum length based on international standards\n // Most countries have maximum phone numbers between 10-15 digits\n const DEFAULT_MAX_LENGTH = 15;\n\n if (!countryCode) {\n return DEFAULT_MAX_LENGTH;\n }\n\n // Get example numbers for different types to analyze the pattern\n const exampleNumberTypes = [\n PhoneNumberType.MOBILE,\n PhoneNumberType.FIXED_LINE,\n PhoneNumberType.FIXED_LINE_OR_MOBILE\n ];\n\n let maxObservedLength = 0;\n\n // Check the length of example numbers for different types\n for (const numberType of exampleNumberTypes) {\n try {\n const exampleNumber = phoneNumberUtil.getExampleNumberForType(\n countryCode.toUpperCase(),\n numberType\n );\n\n if (exampleNumber) {\n const nationalNumber =\n exampleNumber.getNationalNumber()?.toString() || '';\n maxObservedLength = Math.max(\n maxObservedLength,\n nationalNumber.length\n );\n }\n } catch (_) {\n // Continue to the next type if this one fails\n }\n }\n\n if (maxObservedLength > 0) {\n // Add a small buffer to accommodate variations (e.g., extensions)\n return maxObservedLength + 3;\n }\n\n return DEFAULT_MAX_LENGTH;\n } catch {\n return 15; // Fallback to reasonable default\n }\n};\n\n/**\n * Validates if a phone number exceeds the maximum allowed length for its country.\n *\n * @param {string} phoneNumber - Full phone number with country code\n * @param {string} countryCode - ISO2 country code (e.g., 'CH' for Switzerland)\n * @returns {boolean} True if the phone number is valid length, false if it exceeds maximum length\n */\nexport const isValidPhoneNumberLength = (\n phoneNumber: string,\n countryCode: string\n): boolean => {\n try {\n const phoneNumberUtil = PhoneNumberUtil.getInstance();\n\n // Parse the phone number to get its national number portion\n const parsedNumber = phoneNumberUtil.parse(phoneNumber, countryCode);\n const nationalNumber = parsedNumber.getNationalNumber()?.toString() || '';\n\n // Get the maximum allowed length for this country\n const maxLength = getMaxPhoneNumberLength(countryCode);\n\n // Check if the national number length exceeds the maximum allowed\n // This only checks the actual digits, ignoring formatting characters\n return nationalNumber.length <= maxLength;\n } catch (_) {\n // If parsing fails, consider it invalid\n return false;\n }\n};\n","import { AbstractControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';\nimport { Country } from '../types/country.model';\nimport { isValidPhoneNumberLength } from '../utils/phone-number.utils';\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\n // Check if the phone number length is valid for the country\n const countryIso = telForm?.value?.prefixCtrl?.iso2;\n const isValidLength = countryIso\n ? isValidPhoneNumberLength(control.value, countryIso)\n : true;\n\n if (!isValidNumber) {\n control.setErrors({ invalidNumber: true });\n telForm.get('numberControl')?.setErrors({ invalidNumber: true });\n return {\n invalidNumber: true\n };\n } else if (!isValidLength) {\n // If the number is valid according to libphonenumber but exceeds the maximum length\n control.setErrors({ numberTooLong: true });\n telForm.get('numberControl')?.setErrors({ numberTooLong: true });\n return {\n numberTooLong: 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 { inject, Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { GeoData } from '../../types/geo.type';\n\n@Injectable()\nexport class GeoIpService {\n private readonly http = inject(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 { inject, Injectable, InjectionToken, LOCALE_ID } from '@angular/core';\n\n/**\n * Optional map of ISO country codes to user-defined display names.\n */\nexport type CountryNameOverrides = Partial<Record<string, string>>;\n\n/**\n * Injection token that allows library consumers to override country display names.\n */\nexport const COUNTRY_NAME_OVERRIDES = new InjectionToken<CountryNameOverrides>(\n 'COUNTRY_NAME_OVERRIDES'\n);\n\n/**\n * Provides localized country names using the browser `Intl.DisplayNames` API,\n * while honoring optional overrides supplied by host applications.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class CountryDisplayNameService {\n private readonly overrides = inject(COUNTRY_NAME_OVERRIDES, {\n optional: true\n });\n private currentLocale: string;\n private displayNames?: Intl.DisplayNames;\n\n constructor() {\n const locale = inject(LOCALE_ID);\n this.currentLocale = locale;\n this.displayNames = this.createDisplayNames(locale);\n }\n\n /**\n * Allows host applications to switch locales at runtime.\n *\n * @param locale - Locale identifier (e.g. `es-ES`). Falsy values are ignored.\n */\n setLocale(locale: string): void {\n if (!locale || locale === this.currentLocale) {\n return;\n }\n this.currentLocale = locale;\n this.displayNames = this.createDisplayNames(locale);\n }\n\n /**\n * Resolves a localized country name for the provided ISO code.\n *\n * @param isoCode - ISO 3166-1 alpha-2 country code.\n * @param fallback - Fallback country name.\n * @returns Localized country name if available, otherwise the fallback.\n */\n getCountryName(isoCode: string, fallback: string): string {\n const override = this.getOverride(isoCode);\n if (override) {\n return override;\n }\n\n const normalizedIso = isoCode?.toUpperCase?.();\n if (normalizedIso && this.displayNames) {\n const localizedName = this.displayNames.of(normalizedIso);\n if (localizedName && localizedName !== normalizedIso) {\n return localizedName;\n }\n }\n\n return fallback;\n }\n\n /**\n * Creates an `Intl.DisplayNames` instance for the provided locale.\n * Returns `undefined` if the API is unavailable or throws.\n */\n private createDisplayNames(locale: string): Intl.DisplayNames | undefined {\n if (\n typeof Intl !== 'undefined' &&\n typeof Intl.DisplayNames !== 'undefined'\n ) {\n try {\n return new Intl.DisplayNames([locale], { type: 'region' });\n } catch {\n return undefined;\n }\n }\n return undefined;\n }\n\n /**\n * Attempts to resolve an override using multiple ISO code permutations.\n */\n private getOverride(isoCode: string): string | undefined {\n if (!this.overrides) {\n return undefined;\n }\n\n const potentialKeys = [\n isoCode,\n isoCode?.toUpperCase?.(),\n isoCode?.toLowerCase?.()\n ].filter(Boolean) as string[];\n\n for (const key of potentialKeys) {\n const value = this.overrides[key];\n if (value) {\n return value;\n }\n }\n\n return undefined;\n }\n}\n","import { inject, 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';\nimport { CountryDisplayNameService } from '../country-display-name/country-display-name.service';\n\n@Injectable()\nexport class CountryDataService {\n private readonly countryDisplayNameService: CountryDisplayNameService =\n inject(CountryDisplayNameService);\n\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 localizeCountryNames: boolean\n ): Country {\n const phoneNumberPlaceholder = this.getPhoneNumberPlaceholder(\n countryData[2].toString().toUpperCase(),\n includeDialCode,\n outputNumberFormat\n );\n const isoCode = countryData[2].toString();\n const fallbackName = countryData[1].toString();\n const countryName = localizeCountryNames\n ? this.countryDisplayNameService.getCountryName(isoCode, fallbackName)\n : fallbackName;\n const country: Country = {\n emojiFlag: countryData[0].toString(),\n name: countryName,\n iso2: isoCode,\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 const mask = this.formatPhoneNumberWithPrefix(\n phoneNumberPlaceholder,\n !forceSelectedCountryCode\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 const aIsPreferred = preferredCountries.includes(a.iso2);\n const bIsPreferred = preferredCountries.includes(b.iso2);\n if (aIsPreferred && bIsPreferred) {\n return (\n preferredCountries.indexOf(a.iso2) -\n preferredCountries.indexOf(b.iso2)\n );\n } else if (aIsPreferred) {\n return -1;\n } else if (bIsPreferred) {\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 localizeCountryNames = false\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 localizeCountryNames\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 { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'ngx-material-intl-tel-input-phone-icon',\n standalone: true,\n template: `\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"icon icon-tabler icon-tabler-phone\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n fill=\"none\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5l1.5 -2.5l5 2v4a2 2 0 0 1 -2 2a16 16 0 0 1 -15 -15a2 2 0 0 1 2 -2\"\n />\n </svg>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class PhoneIconComponent {}\n","import { AsyncPipe, NgClass } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n OnInit,\n computed,\n effect,\n inject,\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 PhoneNumberType\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';\nimport { getMaxPhoneNumberLength } from '../utils/phone-number.utils';\nimport { PhoneIconComponent } from '../components/phone-icon/phone-icon.component';\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 PhoneIconComponent,\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 private readonly countryCodeData = inject(CountryCode);\n private readonly geoIpService = inject(GeoIpService);\n private readonly countryDataService = inject(CountryDataService);\n private readonly controlContainer = inject(ControlContainer);\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 localizeCountryNames = 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: '',\n hintLabel: 'Select country and type your phone number',\n invalidNumberError: 'Number is not valid',\n requiredError: 'This field is required',\n numberTooLongError: 'Phone number is too long'\n });\n mainLabel = input<string>('');\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 enableInputMaxLength = input<boolean>(true);\n currentValue = output<string>();\n currentCountryCode = output<string>();\n currentCountryISO = output<string>();\n isFocused = signal<boolean>(false);\n isLoading = signal<boolean>(true);\n resolvedMainLabel = computed(\n () => this.mainLabel() || this.textLabels().mainLabel\n );\n isOutlineWithLabel = computed(\n () => this.appearance() === 'outline' && !!this.resolvedMainLabel()\n );\n\n constructor() {\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 valu