vue3-q-tel-input-sorted
Version:
Vue 3 telephone input implemented over Quasar framework
9,009 lines • 419 kB
JavaScript
import { computed, markRaw, defineComponent, h, withDirectives, getCurrentInstance, ref, reactive, onMounted, watch, onBeforeUpdate, inject, onBeforeUnmount, nextTick, onDeactivated, onActivated, Transition, unref, onUnmounted, Teleport, onBeforeMount, onUpdated, mergeModels, useSlots, useModel, openBlock, createBlock, mergeProps, createSlots, withCtx, createElementVNode, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, renderList, renderSlot, normalizeProps, guardReactiveProps } from "vue";
const countryInformation = [
{ name: "South Georgia", iso2: "GS", dialCode: "+500", dialCodeSuffixes: [], flag: "🇬🇸", invalid: false },
{ name: "Grenada", iso2: "GD", dialCode: "+1473", dialCodeSuffixes: [], flag: "🇬🇩", invalid: false },
{ name: "Switzerland", iso2: "CH", dialCode: "+41", dialCodeSuffixes: [], flag: "🇨🇭", invalid: false },
{ name: "Sierra Leone", iso2: "SL", dialCode: "+232", dialCodeSuffixes: [], flag: "🇸🇱", invalid: false },
{ name: "Hungary", iso2: "HU", dialCode: "+36", dialCodeSuffixes: [], flag: "🇭🇺", invalid: false },
{ name: "Taiwan", iso2: "TW", dialCode: "+886", dialCodeSuffixes: [], flag: "🇹🇼", invalid: false },
{ name: "Wallis and Futuna", iso2: "WF", dialCode: "+681", dialCodeSuffixes: [], flag: "🇼🇫", invalid: false },
{ name: "Barbados", iso2: "BB", dialCode: "+1246", dialCodeSuffixes: [], flag: "🇧🇧", invalid: false },
{ name: "Pitcairn Islands", iso2: "PN", dialCode: "+64", dialCodeSuffixes: [], flag: "🇵🇳", invalid: false },
{ name: "Ivory Coast", iso2: "CI", dialCode: "+225", dialCodeSuffixes: [], flag: "🇨🇮", invalid: false },
{ name: "Tunisia", iso2: "TN", dialCode: "+216", dialCodeSuffixes: [], flag: "🇹🇳", invalid: false },
{ name: "Italy", iso2: "IT", dialCode: "+39", dialCodeSuffixes: [], flag: "🇮🇹", invalid: false },
{ name: "Benin", iso2: "BJ", dialCode: "+229", dialCodeSuffixes: [], flag: "🇧🇯", invalid: false },
{ name: "Indonesia", iso2: "ID", dialCode: "+62", dialCodeSuffixes: [], flag: "🇮🇩", invalid: false },
{ name: "Cape Verde", iso2: "CV", dialCode: "+238", dialCodeSuffixes: [], flag: "🇨🇻", invalid: false },
{ name: "Saint Kitts and Nevis", iso2: "KN", dialCode: "+1869", dialCodeSuffixes: [], flag: "🇰🇳", invalid: false },
{ name: "Laos", iso2: "LA", dialCode: "+856", dialCodeSuffixes: [], flag: "🇱🇦", invalid: false },
{ name: "Caribbean Netherlands", iso2: "BQ", dialCode: "+599", dialCodeSuffixes: [], flag: "🇧🇶", invalid: false },
{ name: "Uganda", iso2: "UG", dialCode: "+256", dialCodeSuffixes: [], flag: "🇺🇬", invalid: false },
{ name: "Andorra", iso2: "AD", dialCode: "+376", dialCodeSuffixes: [], flag: "🇦🇩", invalid: false },
{ name: "Burundi", iso2: "BI", dialCode: "+257", dialCodeSuffixes: [], flag: "🇧🇮", invalid: false },
{ name: "South Africa", iso2: "ZA", dialCode: "+27", dialCodeSuffixes: [], flag: "🇿🇦", invalid: false },
{ name: "France", iso2: "FR", dialCode: "+33", dialCodeSuffixes: [], flag: "🇫🇷", invalid: false },
{ name: "Libya", iso2: "LY", dialCode: "+218", dialCodeSuffixes: [], flag: "🇱🇾", invalid: false },
{ name: "Mexico", iso2: "MX", dialCode: "+52", dialCodeSuffixes: [], flag: "🇲🇽", invalid: false },
{ name: "Gabon", iso2: "GA", dialCode: "+241", dialCodeSuffixes: [], flag: "🇬🇦", invalid: false },
{ name: "Northern Mariana Islands", iso2: "MP", dialCode: "+1670", dialCodeSuffixes: [], flag: "🇲🇵", invalid: false },
{ name: "North Macedonia", iso2: "MK", dialCode: "+389", dialCodeSuffixes: [], flag: "🇲🇰", invalid: false },
{ name: "China", iso2: "CN", dialCode: "+86", dialCodeSuffixes: [], flag: "🇨🇳", invalid: false },
{ name: "Yemen", iso2: "YE", dialCode: "+967", dialCodeSuffixes: [], flag: "🇾🇪", invalid: false },
{ name: "Saint Barthélemy", iso2: "BL", dialCode: "+590", dialCodeSuffixes: [], flag: "🇧🇱", invalid: false },
{ name: "Guernsey", iso2: "GG", dialCode: "+44", dialCodeSuffixes: [], flag: "🇬🇬", invalid: false },
{ name: "Solomon Islands", iso2: "SB", dialCode: "+677", dialCodeSuffixes: [], flag: "🇸🇧", invalid: false },
{ name: "Svalbard and Jan Mayen", iso2: "SJ", dialCode: "+4779", dialCodeSuffixes: [], flag: "🇸🇯", invalid: false },
{ name: "Faroe Islands", iso2: "FO", dialCode: "+298", dialCodeSuffixes: [], flag: "🇫🇴", invalid: false },
{ name: "Uzbekistan", iso2: "UZ", dialCode: "+998", dialCodeSuffixes: [], flag: "🇺🇿", invalid: false },
{ name: "Egypt", iso2: "EG", dialCode: "+20", dialCodeSuffixes: [], flag: "🇪🇬", invalid: false },
{ name: "Senegal", iso2: "SN", dialCode: "+221", dialCodeSuffixes: [], flag: "🇸🇳", invalid: false },
{ name: "Sri Lanka", iso2: "LK", dialCode: "+94", dialCodeSuffixes: [], flag: "🇱🇰", invalid: false },
{ name: "Palestine", iso2: "PS", dialCode: "+970", dialCodeSuffixes: [], flag: "🇵🇸", invalid: false },
{ name: "Bangladesh", iso2: "BD", dialCode: "+880", dialCodeSuffixes: [], flag: "🇧🇩", invalid: false },
{ name: "Peru", iso2: "PE", dialCode: "+51", dialCodeSuffixes: [], flag: "🇵🇪", invalid: false },
{ name: "Singapore", iso2: "SG", dialCode: "+65", dialCodeSuffixes: [], flag: "🇸🇬", invalid: false },
{ name: "Turkey", iso2: "TR", dialCode: "+90", dialCodeSuffixes: [], flag: "🇹🇷", invalid: false },
{ name: "Afghanistan", iso2: "AF", dialCode: "+93", dialCodeSuffixes: [], flag: "🇦🇫", invalid: false },
{ name: "Aruba", iso2: "AW", dialCode: "+297", dialCodeSuffixes: [], flag: "🇦🇼", invalid: false },
{ name: "Cook Islands", iso2: "CK", dialCode: "+682", dialCodeSuffixes: [], flag: "🇨🇰", invalid: false },
{ name: "United Kingdom", iso2: "GB", dialCode: "+44", dialCodeSuffixes: [], flag: "🇬🇧", invalid: false },
{ name: "Zambia", iso2: "ZM", dialCode: "+260", dialCodeSuffixes: [], flag: "🇿🇲", invalid: false },
{ name: "Finland", iso2: "FI", dialCode: "+358", dialCodeSuffixes: [], flag: "🇫🇮", invalid: false },
{ name: "Niger", iso2: "NE", dialCode: "+227", dialCodeSuffixes: [], flag: "🇳🇪", invalid: false },
{ name: "Christmas Island", iso2: "CX", dialCode: "+61", dialCodeSuffixes: [], flag: "🇨🇽", invalid: false },
{ name: "Tokelau", iso2: "TK", dialCode: "+690", dialCodeSuffixes: [], flag: "🇹🇰", invalid: false },
{ name: "Guinea-Bissau", iso2: "GW", dialCode: "+245", dialCodeSuffixes: [], flag: "🇬🇼", invalid: false },
{ name: "Azerbaijan", iso2: "AZ", dialCode: "+994", dialCodeSuffixes: [], flag: "🇦🇿", invalid: false },
{ name: "Réunion", iso2: "RE", dialCode: "+262", dialCodeSuffixes: [], flag: "🇷🇪", invalid: false },
{ name: "Djibouti", iso2: "DJ", dialCode: "+253", dialCodeSuffixes: [], flag: "🇩🇯", invalid: false },
{ name: "North Korea", iso2: "KP", dialCode: "+850", dialCodeSuffixes: [], flag: "🇰🇵", invalid: false },
{ name: "Mauritius", iso2: "MU", dialCode: "+230", dialCodeSuffixes: [], flag: "🇲🇺", invalid: false },
{ name: "Montserrat", iso2: "MS", dialCode: "+1664", dialCodeSuffixes: [], flag: "🇲🇸", invalid: false },
{ name: "United States Virgin Islands", iso2: "VI", dialCode: "+1340", dialCodeSuffixes: [], flag: "🇻🇮", invalid: false },
{ name: "Colombia", iso2: "CO", dialCode: "+57", dialCodeSuffixes: [], flag: "🇨🇴", invalid: false },
{ name: "Greece", iso2: "GR", dialCode: "+30", dialCodeSuffixes: [], flag: "🇬🇷", invalid: false },
{ name: "Croatia", iso2: "HR", dialCode: "+385", dialCodeSuffixes: [], flag: "🇭🇷", invalid: false },
{ name: "Morocco", iso2: "MA", dialCode: "+212", dialCodeSuffixes: [], flag: "🇲🇦", invalid: false },
{ name: "Algeria", iso2: "DZ", dialCode: "+213", dialCodeSuffixes: [], flag: "🇩🇿", invalid: false },
{ name: "Netherlands", iso2: "NL", dialCode: "+31", dialCodeSuffixes: [], flag: "🇳🇱", invalid: false },
{ name: "Sudan", iso2: "SD", dialCode: "+249", dialCodeSuffixes: [], flag: "🇸🇩", invalid: false },
{ name: "Fiji", iso2: "FJ", dialCode: "+679", dialCodeSuffixes: [], flag: "🇫🇯", invalid: false },
{ name: "Liechtenstein", iso2: "LI", dialCode: "+423", dialCodeSuffixes: [], flag: "🇱🇮", invalid: false },
{ name: "Nepal", iso2: "NP", dialCode: "+977", dialCodeSuffixes: [], flag: "🇳🇵", invalid: false },
{ name: "Puerto Rico", iso2: "PR", dialCode: "+1", dialCodeSuffixes: ["787", "939"], flag: "🇵🇷", invalid: false },
{ name: "Georgia", iso2: "GE", dialCode: "+995", dialCodeSuffixes: [], flag: "🇬🇪", invalid: false },
{ name: "Pakistan", iso2: "PK", dialCode: "+92", dialCodeSuffixes: [], flag: "🇵🇰", invalid: false },
{ name: "Monaco", iso2: "MC", dialCode: "+377", dialCodeSuffixes: [], flag: "🇲🇨", invalid: false },
{ name: "Botswana", iso2: "BW", dialCode: "+267", dialCodeSuffixes: [], flag: "🇧🇼", invalid: false },
{ name: "Lebanon", iso2: "LB", dialCode: "+961", dialCodeSuffixes: [], flag: "🇱🇧", invalid: false },
{ name: "Papua New Guinea", iso2: "PG", dialCode: "+675", dialCodeSuffixes: [], flag: "🇵🇬", invalid: false },
{ name: "Mayotte", iso2: "YT", dialCode: "+262", dialCodeSuffixes: [], flag: "🇾🇹", invalid: false },
{ name: "Dominican Republic", iso2: "DO", dialCode: "+1", dialCodeSuffixes: [], flag: "🇩🇴", invalid: false },
{ name: "Norfolk Island", iso2: "NF", dialCode: "+672", dialCodeSuffixes: [], flag: "🇳🇫", invalid: false },
{ name: "Bouvet Island", iso2: "BV", dialCode: "+47", dialCodeSuffixes: [], flag: "🇧🇻", invalid: false },
{ name: "Qatar", iso2: "QA", dialCode: "+974", dialCodeSuffixes: [], flag: "🇶🇦", invalid: false },
{ name: "Madagascar", iso2: "MG", dialCode: "+261", dialCodeSuffixes: [], flag: "🇲🇬", invalid: false },
{ name: "India", iso2: "IN", dialCode: "+91", dialCodeSuffixes: [], flag: "🇮🇳", invalid: false },
{ name: "Syria", iso2: "SY", dialCode: "+963", dialCodeSuffixes: [], flag: "🇸🇾", invalid: false },
{ name: "Montenegro", iso2: "ME", dialCode: "+382", dialCodeSuffixes: [], flag: "🇲🇪", invalid: false },
{ name: "Eswatini", iso2: "SZ", dialCode: "+268", dialCodeSuffixes: [], flag: "🇸🇿", invalid: false },
{ name: "Paraguay", iso2: "PY", dialCode: "+595", dialCodeSuffixes: [], flag: "🇵🇾", invalid: false },
{ name: "El Salvador", iso2: "SV", dialCode: "+503", dialCodeSuffixes: [], flag: "🇸🇻", invalid: false },
{ name: "Ukraine", iso2: "UA", dialCode: "+380", dialCodeSuffixes: [], flag: "🇺🇦", invalid: false },
{ name: "Isle of Man", iso2: "IM", dialCode: "+44", dialCodeSuffixes: [], flag: "🇮🇲", invalid: false },
{ name: "Namibia", iso2: "NA", dialCode: "+264", dialCodeSuffixes: [], flag: "🇳🇦", invalid: false },
{ name: "United Arab Emirates", iso2: "AE", dialCode: "+971", dialCodeSuffixes: [], flag: "🇦🇪", invalid: false },
{ name: "Bulgaria", iso2: "BG", dialCode: "+359", dialCodeSuffixes: [], flag: "🇧🇬", invalid: false },
{ name: "Greenland", iso2: "GL", dialCode: "+299", dialCodeSuffixes: [], flag: "🇬🇱", invalid: false },
{ name: "Germany", iso2: "DE", dialCode: "+49", dialCodeSuffixes: [], flag: "🇩🇪", invalid: false },
{ name: "Cambodia", iso2: "KH", dialCode: "+855", dialCodeSuffixes: [], flag: "🇰🇭", invalid: false },
{ name: "Iraq", iso2: "IQ", dialCode: "+964", dialCodeSuffixes: [], flag: "🇮🇶", invalid: false },
{ name: "French Southern and Antarctic Lands", iso2: "TF", dialCode: "+262", dialCodeSuffixes: [], flag: "🇹🇫", invalid: false },
{ name: "Sweden", iso2: "SE", dialCode: "+46", dialCodeSuffixes: [], flag: "🇸🇪", invalid: false },
{ name: "Cuba", iso2: "CU", dialCode: "+53", dialCodeSuffixes: [], flag: "🇨🇺", invalid: false },
{ name: "Kyrgyzstan", iso2: "KG", dialCode: "+996", dialCodeSuffixes: [], flag: "🇰🇬", invalid: false },
{ name: "Russia", iso2: "RU", dialCode: "+7", dialCodeSuffixes: [], flag: "🇷🇺", invalid: false },
{ name: "Malaysia", iso2: "MY", dialCode: "+60", dialCodeSuffixes: [], flag: "🇲🇾", invalid: false },
{ name: "São Tomé and Príncipe", iso2: "ST", dialCode: "+239", dialCodeSuffixes: [], flag: "🇸🇹", invalid: false },
{ name: "Cyprus", iso2: "CY", dialCode: "+357", dialCodeSuffixes: [], flag: "🇨🇾", invalid: false },
{ name: "Canada", iso2: "CA", dialCode: "+1", dialCodeSuffixes: [], flag: "🇨🇦", invalid: false },
{ name: "Malawi", iso2: "MW", dialCode: "+265", dialCodeSuffixes: [], flag: "🇲🇼", invalid: false },
{ name: "Saudi Arabia", iso2: "SA", dialCode: "+966", dialCodeSuffixes: [], flag: "🇸🇦", invalid: false },
{ name: "Bosnia and Herzegovina", iso2: "BA", dialCode: "+387", dialCodeSuffixes: [], flag: "🇧🇦", invalid: false },
{ name: "Ethiopia", iso2: "ET", dialCode: "+251", dialCodeSuffixes: [], flag: "🇪🇹", invalid: false },
{ name: "Spain", iso2: "ES", dialCode: "+34", dialCodeSuffixes: [], flag: "🇪🇸", invalid: false },
{ name: "Slovenia", iso2: "SI", dialCode: "+386", dialCodeSuffixes: [], flag: "🇸🇮", invalid: false },
{ name: "Oman", iso2: "OM", dialCode: "+968", dialCodeSuffixes: [], flag: "🇴🇲", invalid: false },
{ name: "Saint Pierre and Miquelon", iso2: "PM", dialCode: "+508", dialCodeSuffixes: [], flag: "🇵🇲", invalid: false },
{ name: "Macau", iso2: "MO", dialCode: "+853", dialCodeSuffixes: [], flag: "🇲🇴", invalid: false },
{ name: "San Marino", iso2: "SM", dialCode: "+378", dialCodeSuffixes: [], flag: "🇸🇲", invalid: false },
{ name: "Lesotho", iso2: "LS", dialCode: "+266", dialCodeSuffixes: [], flag: "🇱🇸", invalid: false },
{ name: "Marshall Islands", iso2: "MH", dialCode: "+692", dialCodeSuffixes: [], flag: "🇲🇭", invalid: false },
{ name: "Sint Maarten", iso2: "SX", dialCode: "+1721", dialCodeSuffixes: [], flag: "🇸🇽", invalid: false },
{ name: "Iceland", iso2: "IS", dialCode: "+354", dialCodeSuffixes: [], flag: "🇮🇸", invalid: false },
{ name: "Luxembourg", iso2: "LU", dialCode: "+352", dialCodeSuffixes: [], flag: "🇱🇺", invalid: false },
{ name: "Argentina", iso2: "AR", dialCode: "+54", dialCodeSuffixes: [], flag: "🇦🇷", invalid: false },
{ name: "Turks and Caicos Islands", iso2: "TC", dialCode: "+1649", dialCodeSuffixes: [], flag: "🇹🇨", invalid: false },
{ name: "Nauru", iso2: "NR", dialCode: "+674", dialCodeSuffixes: [], flag: "🇳🇷", invalid: false },
{ name: "Cocos (Keeling) Islands", iso2: "CC", dialCode: "+61", dialCodeSuffixes: [], flag: "🇨🇨", invalid: false },
{ name: "Western Sahara", iso2: "EH", dialCode: "+2", dialCodeSuffixes: [], flag: "🇪🇭", invalid: false },
{ name: "Dominica", iso2: "DM", dialCode: "+1767", dialCodeSuffixes: [], flag: "🇩🇲", invalid: false },
{ name: "Costa Rica", iso2: "CR", dialCode: "+506", dialCodeSuffixes: [], flag: "🇨🇷", invalid: false },
{ name: "Australia", iso2: "AU", dialCode: "+61", dialCodeSuffixes: [], flag: "🇦🇺", invalid: false },
{ name: "Thailand", iso2: "TH", dialCode: "+66", dialCodeSuffixes: [], flag: "🇹🇭", invalid: false },
{ name: "Haiti", iso2: "HT", dialCode: "+509", dialCodeSuffixes: [], flag: "🇭🇹", invalid: false },
{ name: "Tuvalu", iso2: "TV", dialCode: "+688", dialCodeSuffixes: [], flag: "🇹🇻", invalid: false },
{ name: "Honduras", iso2: "HN", dialCode: "+504", dialCodeSuffixes: [], flag: "🇭🇳", invalid: false },
{ name: "Equatorial Guinea", iso2: "GQ", dialCode: "+240", dialCodeSuffixes: [], flag: "🇬🇶", invalid: false },
{ name: "Saint Lucia", iso2: "LC", dialCode: "+1758", dialCodeSuffixes: [], flag: "🇱🇨", invalid: false },
{ name: "French Polynesia", iso2: "PF", dialCode: "+689", dialCodeSuffixes: [], flag: "🇵🇫", invalid: false },
{ name: "Belarus", iso2: "BY", dialCode: "+375", dialCodeSuffixes: [], flag: "🇧🇾", invalid: false },
{ name: "Latvia", iso2: "LV", dialCode: "+371", dialCodeSuffixes: [], flag: "🇱🇻", invalid: false },
{ name: "Palau", iso2: "PW", dialCode: "+680", dialCodeSuffixes: [], flag: "🇵🇼", invalid: false },
{ name: "Guadeloupe", iso2: "GP", dialCode: "+590", dialCodeSuffixes: [], flag: "🇬🇵", invalid: false },
{ name: "Philippines", iso2: "PH", dialCode: "+63", dialCodeSuffixes: [], flag: "🇵🇭", invalid: false },
{ name: "Gibraltar", iso2: "GI", dialCode: "+350", dialCodeSuffixes: [], flag: "🇬🇮", invalid: false },
{ name: "Denmark", iso2: "DK", dialCode: "+45", dialCodeSuffixes: [], flag: "🇩🇰", invalid: false },
{ name: "Cameroon", iso2: "CM", dialCode: "+237", dialCodeSuffixes: [], flag: "🇨🇲", invalid: false },
{ name: "Guinea", iso2: "GN", dialCode: "+224", dialCodeSuffixes: [], flag: "🇬🇳", invalid: false },
{ name: "Bahrain", iso2: "BH", dialCode: "+973", dialCodeSuffixes: [], flag: "🇧🇭", invalid: false },
{ name: "Suriname", iso2: "SR", dialCode: "+597", dialCodeSuffixes: [], flag: "🇸🇷", invalid: false },
{ name: "DR Congo", iso2: "CD", dialCode: "+243", dialCodeSuffixes: [], flag: "🇨🇩", invalid: false },
{ name: "Somalia", iso2: "SO", dialCode: "+252", dialCodeSuffixes: [], flag: "🇸🇴", invalid: false },
{ name: "Czechia", iso2: "CZ", dialCode: "+420", dialCodeSuffixes: [], flag: "🇨🇿", invalid: false },
{ name: "New Caledonia", iso2: "NC", dialCode: "+687", dialCodeSuffixes: [], flag: "🇳🇨", invalid: false },
{ name: "Vanuatu", iso2: "VU", dialCode: "+678", dialCodeSuffixes: [], flag: "🇻🇺", invalid: false },
{ name: "Saint Helena, Ascension and Tristan da Cunha", iso2: "SH", dialCode: "+2", dialCodeSuffixes: [], flag: "🇸🇭", invalid: false },
{ name: "Togo", iso2: "TG", dialCode: "+228", dialCodeSuffixes: [], flag: "🇹🇬", invalid: false },
{ name: "British Virgin Islands", iso2: "VG", dialCode: "+1284", dialCodeSuffixes: [], flag: "🇻🇬", invalid: false },
{ name: "Kenya", iso2: "KE", dialCode: "+254", dialCodeSuffixes: [], flag: "🇰🇪", invalid: false },
{ name: "Niue", iso2: "NU", dialCode: "+683", dialCodeSuffixes: [], flag: "🇳🇺", invalid: false },
{ name: "Rwanda", iso2: "RW", dialCode: "+250", dialCodeSuffixes: [], flag: "🇷🇼", invalid: false },
{ name: "Estonia", iso2: "EE", dialCode: "+372", dialCodeSuffixes: [], flag: "🇪🇪", invalid: false },
{ name: "Romania", iso2: "RO", dialCode: "+40", dialCodeSuffixes: [], flag: "🇷🇴", invalid: false },
{ name: "Trinidad and Tobago", iso2: "TT", dialCode: "+1868", dialCodeSuffixes: [], flag: "🇹🇹", invalid: false },
{ name: "Guyana", iso2: "GY", dialCode: "+592", dialCodeSuffixes: [], flag: "🇬🇾", invalid: false },
{ name: "Timor-Leste", iso2: "TL", dialCode: "+670", dialCodeSuffixes: [], flag: "🇹🇱", invalid: false },
{ name: "Vietnam", iso2: "VN", dialCode: "+84", dialCodeSuffixes: [], flag: "🇻🇳", invalid: false },
{ name: "Uruguay", iso2: "UY", dialCode: "+598", dialCodeSuffixes: [], flag: "🇺🇾", invalid: false },
{ name: "Vatican City", iso2: "VA", dialCode: "+3", dialCodeSuffixes: ["906698", "79"], flag: "🇻🇦", invalid: false },
{ name: "Hong Kong", iso2: "HK", dialCode: "+852", dialCodeSuffixes: [], flag: "🇭🇰", invalid: false },
{ name: "Austria", iso2: "AT", dialCode: "+43", dialCodeSuffixes: [], flag: "🇦🇹", invalid: false },
{ name: "Antigua and Barbuda", iso2: "AG", dialCode: "+1268", dialCodeSuffixes: [], flag: "🇦🇬", invalid: false },
{ name: "Turkmenistan", iso2: "TM", dialCode: "+993", dialCodeSuffixes: [], flag: "🇹🇲", invalid: false },
{ name: "Mozambique", iso2: "MZ", dialCode: "+258", dialCodeSuffixes: [], flag: "🇲🇿", invalid: false },
{ name: "Panama", iso2: "PA", dialCode: "+507", dialCodeSuffixes: [], flag: "🇵🇦", invalid: false },
{ name: "Micronesia", iso2: "FM", dialCode: "+691", dialCodeSuffixes: [], flag: "🇫🇲", invalid: false },
{ name: "Ireland", iso2: "IE", dialCode: "+353", dialCodeSuffixes: [], flag: "🇮🇪", invalid: false },
{ name: "Curaçao", iso2: "CW", dialCode: "+599", dialCodeSuffixes: [], flag: "🇨🇼", invalid: false },
{ name: "French Guiana", iso2: "GF", dialCode: "+594", dialCodeSuffixes: [], flag: "🇬🇫", invalid: false },
{ name: "Norway", iso2: "NO", dialCode: "+47", dialCodeSuffixes: [], flag: "🇳🇴", invalid: false },
{ name: "Åland Islands", iso2: "AX", dialCode: "+35818", dialCodeSuffixes: [], flag: "🇦🇽", invalid: false },
{ name: "Central African Republic", iso2: "CF", dialCode: "+236", dialCodeSuffixes: [], flag: "🇨🇫", invalid: false },
{ name: "Burkina Faso", iso2: "BF", dialCode: "+226", dialCodeSuffixes: [], flag: "🇧🇫", invalid: false },
{ name: "Eritrea", iso2: "ER", dialCode: "+291", dialCodeSuffixes: [], flag: "🇪🇷", invalid: false },
{ name: "Tanzania", iso2: "TZ", dialCode: "+255", dialCodeSuffixes: [], flag: "🇹🇿", invalid: false },
{ name: "South Korea", iso2: "KR", dialCode: "+82", dialCodeSuffixes: [], flag: "🇰🇷", invalid: false },
{ name: "Jordan", iso2: "JO", dialCode: "+962", dialCodeSuffixes: [], flag: "🇯🇴", invalid: false },
{ name: "Mauritania", iso2: "MR", dialCode: "+222", dialCodeSuffixes: [], flag: "🇲🇷", invalid: false },
{ name: "Lithuania", iso2: "LT", dialCode: "+370", dialCodeSuffixes: [], flag: "🇱🇹", invalid: false },
{ name: "United States Minor Outlying Islands", iso2: "UM", dialCode: "+268", dialCodeSuffixes: [], flag: "🇺🇲", invalid: false },
{ name: "Slovakia", iso2: "SK", dialCode: "+421", dialCodeSuffixes: [], flag: "🇸🇰", invalid: false },
{ name: "Angola", iso2: "AO", dialCode: "+244", dialCodeSuffixes: [], flag: "🇦🇴", invalid: false },
{ name: "Kazakhstan", iso2: "KZ", dialCode: "+7", dialCodeSuffixes: ["6", "7"], flag: "🇰🇿", invalid: false },
{ name: "Moldova", iso2: "MD", dialCode: "+373", dialCodeSuffixes: [], flag: "🇲🇩", invalid: false },
{ name: "Mali", iso2: "ML", dialCode: "+223", dialCodeSuffixes: [], flag: "🇲🇱", invalid: false },
{ name: "Falkland Islands", iso2: "FK", dialCode: "+500", dialCodeSuffixes: [], flag: "🇫🇰", invalid: false },
{ name: "Armenia", iso2: "AM", dialCode: "+374", dialCodeSuffixes: [], flag: "🇦🇲", invalid: false },
{ name: "Samoa", iso2: "WS", dialCode: "+685", dialCodeSuffixes: [], flag: "🇼🇸", invalid: false },
{ name: "Jersey", iso2: "JE", dialCode: "+44", dialCodeSuffixes: [], flag: "🇯🇪", invalid: false },
{ name: "Japan", iso2: "JP", dialCode: "+81", dialCodeSuffixes: [], flag: "🇯🇵", invalid: false },
{ name: "Bolivia", iso2: "BO", dialCode: "+591", dialCodeSuffixes: [], flag: "🇧🇴", invalid: false },
{ name: "Chile", iso2: "CL", dialCode: "+56", dialCodeSuffixes: [], flag: "🇨🇱", invalid: false },
{ name: "United States", iso2: "US", dialCode: "+1", dialCodeSuffixes: [], flag: "🇺🇸", invalid: false },
{ name: "Saint Vincent and the Grenadines", iso2: "VC", dialCode: "+1784", dialCodeSuffixes: [], flag: "🇻🇨", invalid: false },
{ name: "Bermuda", iso2: "BM", dialCode: "+1441", dialCodeSuffixes: [], flag: "🇧🇲", invalid: false },
{ name: "Seychelles", iso2: "SC", dialCode: "+248", dialCodeSuffixes: [], flag: "🇸🇨", invalid: false },
{ name: "British Indian Ocean Territory", iso2: "IO", dialCode: "+246", dialCodeSuffixes: [], flag: "🇮🇴", invalid: false },
{ name: "Guatemala", iso2: "GT", dialCode: "+502", dialCodeSuffixes: [], flag: "🇬🇹", invalid: false },
{ name: "Ecuador", iso2: "EC", dialCode: "+593", dialCodeSuffixes: [], flag: "🇪🇨", invalid: false },
{ name: "Martinique", iso2: "MQ", dialCode: "+596", dialCodeSuffixes: [], flag: "🇲🇶", invalid: false },
{ name: "Tajikistan", iso2: "TJ", dialCode: "+992", dialCodeSuffixes: [], flag: "🇹🇯", invalid: false },
{ name: "Malta", iso2: "MT", dialCode: "+356", dialCodeSuffixes: [], flag: "🇲🇹", invalid: false },
{ name: "Gambia", iso2: "GM", dialCode: "+220", dialCodeSuffixes: [], flag: "🇬🇲", invalid: false },
{ name: "Nigeria", iso2: "NG", dialCode: "+234", dialCodeSuffixes: [], flag: "🇳🇬", invalid: false },
{ name: "Bahamas", iso2: "BS", dialCode: "+1242", dialCodeSuffixes: [], flag: "🇧🇸", invalid: false },
{ name: "Kosovo", iso2: "XK", dialCode: "+383", dialCodeSuffixes: [], flag: "🇽🇰", invalid: false },
{ name: "Kuwait", iso2: "KW", dialCode: "+965", dialCodeSuffixes: [], flag: "🇰🇼", invalid: false },
{ name: "Maldives", iso2: "MV", dialCode: "+960", dialCodeSuffixes: [], flag: "🇲🇻", invalid: false },
{ name: "South Sudan", iso2: "SS", dialCode: "+211", dialCodeSuffixes: [], flag: "🇸🇸", invalid: false },
{ name: "Iran", iso2: "IR", dialCode: "+98", dialCodeSuffixes: [], flag: "🇮🇷", invalid: false },
{ name: "Albania", iso2: "AL", dialCode: "+355", dialCodeSuffixes: [], flag: "🇦🇱", invalid: false },
{ name: "Brazil", iso2: "BR", dialCode: "+55", dialCodeSuffixes: [], flag: "🇧🇷", invalid: false },
{ name: "Serbia", iso2: "RS", dialCode: "+381", dialCodeSuffixes: [], flag: "🇷🇸", invalid: false },
{ name: "Belize", iso2: "BZ", dialCode: "+501", dialCodeSuffixes: [], flag: "🇧🇿", invalid: false },
{ name: "Myanmar", iso2: "MM", dialCode: "+95", dialCodeSuffixes: [], flag: "🇲🇲", invalid: false },
{ name: "Bhutan", iso2: "BT", dialCode: "+975", dialCodeSuffixes: [], flag: "🇧🇹", invalid: false },
{ name: "Venezuela", iso2: "VE", dialCode: "+58", dialCodeSuffixes: [], flag: "🇻🇪", invalid: false },
{ name: "Liberia", iso2: "LR", dialCode: "+231", dialCodeSuffixes: [], flag: "🇱🇷", invalid: false },
{ name: "Jamaica", iso2: "JM", dialCode: "+1876", dialCodeSuffixes: [], flag: "🇯🇲", invalid: false },
{ name: "Poland", iso2: "PL", dialCode: "+48", dialCodeSuffixes: [], flag: "🇵🇱", invalid: false },
{ name: "Cayman Islands", iso2: "KY", dialCode: "+1345", dialCodeSuffixes: [], flag: "🇰🇾", invalid: false },
{ name: "Brunei", iso2: "BN", dialCode: "+673", dialCodeSuffixes: [], flag: "🇧🇳", invalid: false },
{ name: "Comoros", iso2: "KM", dialCode: "+269", dialCodeSuffixes: [], flag: "🇰🇲", invalid: false },
{ name: "Guam", iso2: "GU", dialCode: "+1671", dialCodeSuffixes: [], flag: "🇬🇺", invalid: false },
{ name: "Tonga", iso2: "TO", dialCode: "+676", dialCodeSuffixes: [], flag: "🇹🇴", invalid: false },
{ name: "Kiribati", iso2: "KI", dialCode: "+686", dialCodeSuffixes: [], flag: "🇰🇮", invalid: false },
{ name: "Ghana", iso2: "GH", dialCode: "+233", dialCodeSuffixes: [], flag: "🇬🇭", invalid: false },
{ name: "Chad", iso2: "TD", dialCode: "+235", dialCodeSuffixes: [], flag: "🇹🇩", invalid: false },
{ name: "Zimbabwe", iso2: "ZW", dialCode: "+263", dialCodeSuffixes: [], flag: "🇿🇼", invalid: false },
{ name: "Saint Martin", iso2: "MF", dialCode: "+590", dialCodeSuffixes: [], flag: "🇲🇫", invalid: false },
{ name: "Mongolia", iso2: "MN", dialCode: "+976", dialCodeSuffixes: [], flag: "🇲🇳", invalid: false },
{ name: "Portugal", iso2: "PT", dialCode: "+351", dialCodeSuffixes: [], flag: "🇵🇹", invalid: false },
{ name: "American Samoa", iso2: "AS", dialCode: "+1684", dialCodeSuffixes: [], flag: "🇦🇸", invalid: false },
{ name: "Republic of the Congo", iso2: "CG", dialCode: "+242", dialCodeSuffixes: [], flag: "🇨🇬", invalid: false },
{ name: "Belgium", iso2: "BE", dialCode: "+32", dialCodeSuffixes: [], flag: "🇧🇪", invalid: false },
{ name: "Israel", iso2: "IL", dialCode: "+972", dialCodeSuffixes: [], flag: "🇮🇱", invalid: false },
{ name: "New Zealand", iso2: "NZ", dialCode: "+64", dialCodeSuffixes: [], flag: "🇳🇿", invalid: false },
{ name: "Nicaragua", iso2: "NI", dialCode: "+505", dialCodeSuffixes: [], flag: "🇳🇮", invalid: false },
{ name: "Anguilla", iso2: "AI", dialCode: "+1264", dialCodeSuffixes: [], flag: "🇦🇮", invalid: false }
];
const countries = countryInformation.sort(
(a, b) => a.name.localeCompare(b.name, void 0, { sensitivity: "base" })
);
const getDefault = (iso2 = "us") => countryInformation.find((a) => a.iso2 === iso2.trim().toUpperCase());
const isNumberInCountry = (dial, country) => {
if (country.dialCode === dial) {
return 1;
}
if (!dial.startsWith(country.dialCode) && !country.dialCode.startsWith(dial)) {
return 0;
}
const newTerm = dial.replace(country.dialCode, "");
const hasSub = country.dialCodeSuffixes.find((suffix) => newTerm.startsWith(suffix) || suffix.startsWith(newTerm));
if (hasSub) {
return 1;
}
return country.dialCodeSuffixes.length ? 0 : 2;
};
const mostSpecific = (a, b) => {
var _a, _b;
const lenA = a.dialCode.length + (((_a = a.dialCodeSuffixes.find((s) => isNumberInCountry(`+${b.dialCode.replace("+", "")}${s}`, a) === 1)) == null ? void 0 : _a.length) ?? 0);
const lenB = b.dialCode.length + (((_b = b.dialCodeSuffixes.find((s) => isNumberInCountry(`+${a.dialCode.replace("+", "")}${s}`, b) === 1)) == null ? void 0 : _b.length) ?? 0);
return lenB - lenA;
};
const getCountryByDialCode = (val = "") => {
const exact = countryInformation.filter((c) => isNumberInCountry(val, c) === 1).sort(mostSpecific);
if (exact.length) return exact[0];
const partial = countryInformation.filter((c) => isNumberInCountry(val, c) === 2).sort(mostSpecific);
return partial[0];
};
const filterCountries = (term) => {
term = term.trim().toLowerCase();
if (term === "") return countryInformation.slice();
const looksNumeric = /^\+?\d+$/.test(term);
const numericNeedle = term.replace(/^\+/, "");
if (looksNumeric) {
const needleWithPlus = `+${numericNeedle}`;
const exact = countryInformation.filter((c) => isNumberInCountry(needleWithPlus, c) === 1);
const broad = countryInformation.filter((c) => isNumberInCountry(needleWithPlus, c) === 2);
const byPrefix = countryInformation.filter(
(c) => c.dialCode.replace("+", "").startsWith(numericNeedle)
);
return Array.from(/* @__PURE__ */ new Set([...exact, ...broad, ...byPrefix]));
}
return countryInformation.filter(
(c) => c.iso2.toLowerCase().includes(term) || c.name.toLowerCase().includes(term)
);
};
const getProperNumber = (phone) => {
var _a;
return ((_a = phone.match(/[+\d]+/g)) == null ? void 0 : _a.join("")) || phone;
};
const useSizeDefaults = {
xs: 18,
sm: 24,
md: 32,
lg: 38,
xl: 46
};
const useSizeProps = {
size: String
};
function useSize(props, sizes = useSizeDefaults) {
return computed(() => props.size !== void 0 ? { fontSize: props.size in sizes ? `${sizes[props.size]}px` : props.size } : null);
}
function injectProp(target2, propName, get, set) {
Object.defineProperty(target2, propName, {
get,
set,
enumerable: true
});
return target2;
}
function createComponent(raw) {
return markRaw(defineComponent(raw));
}
function createDirective(raw) {
return markRaw(raw);
}
function hSlot(slot, otherwise) {
return slot !== void 0 ? slot() || otherwise : otherwise;
}
function hUniqueSlot(slot, otherwise) {
if (slot !== void 0) {
const vnode = slot();
if (vnode !== void 0 && vnode !== null) {
return vnode.slice();
}
}
return otherwise;
}
function hMergeSlot(slot, source) {
return slot !== void 0 ? source.concat(slot()) : source;
}
function hMergeSlotSafely(slot, source) {
if (slot === void 0) {
return source;
}
return source !== void 0 ? source.concat(slot()) : slot();
}
function hDir(tag, data, children, key, condition, getDirsFn) {
data.key = key + condition;
const vnode = h(tag, data, children);
return condition === true ? withDirectives(vnode, getDirsFn()) : vnode;
}
const defaultViewBox = "0 0 24 24";
const sameFn = (i) => i;
const ionFn = (i) => `ionicons ${i}`;
const libMap = {
"mdi-": (i) => `mdi ${i}`,
"icon-": sameFn,
// fontawesome equiv
"bt-": (i) => `bt ${i}`,
"eva-": (i) => `eva ${i}`,
"ion-md": ionFn,
"ion-ios": ionFn,
"ion-logo": ionFn,
"iconfont ": sameFn,
"ti-": (i) => `themify-icon ${i}`,
"bi-": (i) => `bootstrap-icons ${i}`
};
const matMap = {
o_: "-outlined",
r_: "-round",
s_: "-sharp"
};
const symMap = {
sym_o_: "-outlined",
sym_r_: "-rounded",
sym_s_: "-sharp"
};
const libRE = new RegExp("^(" + Object.keys(libMap).join("|") + ")");
const matRE = new RegExp("^(" + Object.keys(matMap).join("|") + ")");
const symRE = new RegExp("^(" + Object.keys(symMap).join("|") + ")");
const mRE = /^[Mm]\s?[-+]?\.?\d/;
const imgRE = /^img:/;
const svgUseRE = /^svguse:/;
const ionRE = /^ion-/;
const faRE = /^(fa-(classic|sharp|solid|regular|light|brands|duotone|thin)|[lf]a[srlbdk]?) /;
const QIcon = createComponent({
name: "QIcon",
props: {
...useSizeProps,
tag: {
type: String,
default: "i"
},
name: String,
color: String,
left: Boolean,
right: Boolean
},
setup(props, { slots }) {
const { proxy: { $q } } = getCurrentInstance();
const sizeStyle = useSize(props);
const classes = computed(
() => "q-icon" + (props.left === true ? " on-left" : "") + (props.right === true ? " on-right" : "") + (props.color !== void 0 ? ` text-${props.color}` : "")
);
const type = computed(() => {
let cls;
let icon = props.name;
if (icon === "none" || !icon) {
return { none: true };
}
if ($q.iconMapFn !== null) {
const res = $q.iconMapFn(icon);
if (res !== void 0) {
if (res.icon !== void 0) {
icon = res.icon;
if (icon === "none" || !icon) {
return { none: true };
}
} else {
return {
cls: res.cls,
content: res.content !== void 0 ? res.content : " "
};
}
}
}
if (mRE.test(icon) === true) {
const [def, viewBox = defaultViewBox] = icon.split("|");
return {
svg: true,
viewBox,
nodes: def.split("&&").map((path) => {
const [d, style, transform] = path.split("@@");
return h("path", { style, d, transform });
})
};
}
if (imgRE.test(icon) === true) {
return {
img: true,
src: icon.substring(4)
};
}
if (svgUseRE.test(icon) === true) {
const [def, viewBox = defaultViewBox] = icon.split("|");
return {
svguse: true,
src: def.substring(7),
viewBox
};
}
let content = " ";
const matches = icon.match(libRE);
if (matches !== null) {
cls = libMap[matches[1]](icon);
} else if (faRE.test(icon) === true) {
cls = icon;
} else if (ionRE.test(icon) === true) {
cls = `ionicons ion-${$q.platform.is.ios === true ? "ios" : "md"}${icon.substring(3)}`;
} else if (symRE.test(icon) === true) {
cls = "notranslate material-symbols";
const matches2 = icon.match(symRE);
if (matches2 !== null) {
icon = icon.substring(6);
cls += symMap[matches2[1]];
}
content = icon;
} else {
cls = "notranslate material-icons";
const matches2 = icon.match(matRE);
if (matches2 !== null) {
icon = icon.substring(2);
cls += matMap[matches2[1]];
}
content = icon;
}
return {
cls,
content
};
});
return () => {
const data = {
class: classes.value,
style: sizeStyle.value,
"aria-hidden": "true",
role: "presentation"
};
if (type.value.none === true) {
return h(props.tag, data, hSlot(slots.default));
}
if (type.value.img === true) {
return h(props.tag, data, hMergeSlot(slots.default, [
h("img", { src: type.value.src })
]));
}
if (type.value.svg === true) {
return h(props.tag, data, hMergeSlot(slots.default, [
h("svg", {
viewBox: type.value.viewBox || "0 0 24 24"
}, type.value.nodes)
]));
}
if (type.value.svguse === true) {
return h(props.tag, data, hMergeSlot(slots.default, [
h("svg", {
viewBox: type.value.viewBox
}, [
h("use", { "xlink:href": type.value.src })
])
]));
}
if (type.value.cls !== void 0) {
data.class += " " + type.value.cls;
}
return h(props.tag, data, hMergeSlot(slots.default, [
type.value.content
]));
};
}
});
const useSpinnerProps = {
size: {
type: [String, Number],
default: "1em"
},
color: String
};
function useSpinner(props) {
return {
cSize: computed(() => props.size in useSizeDefaults ? `${useSizeDefaults[props.size]}px` : props.size),
classes: computed(
() => "q-spinner" + (props.color ? ` text-${props.color}` : "")
)
};
}
const QSpinner = createComponent({
name: "QSpinner",
props: {
...useSpinnerProps,
thickness: {
type: Number,
default: 5
}
},
setup(props) {
const { cSize, classes } = useSpinner(props);
return () => h("svg", {
class: classes.value + " q-spinner-mat",
width: cSize.value,
height: cSize.value,
viewBox: "25 25 50 50"
}, [
h("circle", {
class: "path",
cx: "50",
cy: "50",
r: "20",
fill: "none",
stroke: "currentColor",
"stroke-width": props.thickness,
"stroke-miterlimit": "10"
})
]);
}
});
let buf, bufIdx = 0;
const hexBytes = new Array(256);
for (let i = 0; i < 256; i++) {
hexBytes[i] = (i + 256).toString(16).substring(1);
}
const randomBytes = (() => {
const lib = typeof crypto !== "undefined" ? crypto : typeof window !== "undefined" ? window.crypto || window.msCrypto : void 0;
if (lib !== void 0) {
if (lib.randomBytes !== void 0) {
return lib.randomBytes;
}
if (lib.getRandomValues !== void 0) {
return (n) => {
const bytes = new Uint8Array(n);
lib.getRandomValues(bytes);
return bytes;
};
}
}
return (n) => {
const r = [];
for (let i = n; i > 0; i--) {
r.push(Math.floor(Math.random() * 256));
}
return r;
};
})();
const BUFFER_SIZE = 4096;
function uid() {
if (buf === void 0 || bufIdx + 16 > BUFFER_SIZE) {
bufIdx = 0;
buf = randomBytes(BUFFER_SIZE);
}
const b = Array.prototype.slice.call(buf, bufIdx, bufIdx += 16);
b[6] = b[6] & 15 | 64;
b[8] = b[8] & 63 | 128;
return hexBytes[b[0]] + hexBytes[b[1]] + hexBytes[b[2]] + hexBytes[b[3]] + "-" + hexBytes[b[4]] + hexBytes[b[5]] + "-" + hexBytes[b[6]] + hexBytes[b[7]] + "-" + hexBytes[b[8]] + hexBytes[b[9]] + "-" + hexBytes[b[10]] + hexBytes[b[11]] + hexBytes[b[12]] + hexBytes[b[13]] + hexBytes[b[14]] + hexBytes[b[15]];
}
const isRuntimeSsrPreHydration = ref(
false
);
let preHydrationBrowser;
function getMatch(userAgent2, platformMatch) {
const match = /(edg|edge|edga|edgios)\/([\w.]+)/.exec(userAgent2) || /(opr)[\/]([\w.]+)/.exec(userAgent2) || /(vivaldi)[\/]([\w.]+)/.exec(userAgent2) || /(chrome|crios)[\/]([\w.]+)/.exec(userAgent2) || /(version)(applewebkit)[\/]([\w.]+).*(safari)[\/]([\w.]+)/.exec(userAgent2) || /(webkit)[\/]([\w.]+).*(version)[\/]([\w.]+).*(safari)[\/]([\w.]+)/.exec(userAgent2) || /(firefox|fxios)[\/]([\w.]+)/.exec(userAgent2) || /(webkit)[\/]([\w.]+)/.exec(userAgent2) || /(opera)(?:.*version|)[\/]([\w.]+)/.exec(userAgent2) || [];
return {
browser: match[5] || match[3] || match[1] || "",
version: match[4] || match[2] || "0",
platform: platformMatch[0] || ""
};
}
function getPlatformMatch(userAgent2) {
return /(ipad)/.exec(userAgent2) || /(ipod)/.exec(userAgent2) || /(windows phone)/.exec(userAgent2) || /(iphone)/.exec(userAgent2) || /(kindle)/.exec(userAgent2) || /(silk)/.exec(userAgent2) || /(android)/.exec(userAgent2) || /(win)/.exec(userAgent2) || /(mac)/.exec(userAgent2) || /(linux)/.exec(userAgent2) || /(cros)/.exec(userAgent2) || /(playbook)/.exec(userAgent2) || /(bb)/.exec(userAgent2) || /(blackberry)/.exec(userAgent2) || [];
}
const hasTouch = "ontouchstart" in window || window.navigator.maxTouchPoints > 0;
function getPlatform(UA) {
const userAgent2 = UA.toLowerCase();
const platformMatch = getPlatformMatch(userAgent2);
const matched = getMatch(userAgent2, platformMatch);
const browser = {
mobile: false,
desktop: false,
cordova: false,
capacitor: false,
nativeMobile: false,
// nativeMobileWrapper: void 0,
electron: false,
bex: false,
linux: false,
mac: false,
win: false,
cros: false,
chrome: false,
firefox: false,
opera: false,
safari: false,
vivaldi: false,
edge: false,
edgeChromium: false,
ie: false,
webkit: false,
android: false,
ios: false,
ipad: false,
iphone: false,
ipod: false,
kindle: false,
winphone: false,
blackberry: false,
playbook: false,
silk: false
};
if (matched.browser) {
browser[matched.browser] = true;
browser.version = matched.version;
browser.versionNumber = parseInt(matched.version, 10);
}
if (matched.platform) {
browser[matched.platform] = true;
}
const knownMobiles = browser.android || browser.ios || browser.bb || browser.blackberry || browser.ipad || browser.iphone || browser.ipod || browser.kindle || browser.playbook || browser.silk || browser["windows phone"];
if (knownMobiles === true || userAgent2.indexOf("mobile") !== -1) {
browser.mobile = true;
} else {
browser.desktop = true;
}
if (browser["windows phone"]) {
browser.winphone = true;
delete browser["windows phone"];
}
if (browser.edga || browser.edgios || browser.edg) {
browser.edge = true;
matched.browser = "edge";
} else if (browser.crios) {
browser.chrome = true;
matched.browser = "chrome";
} else if (browser.fxios) {
browser.firefox = true;
matched.browser = "firefox";
}
if (browser.ipod || browser.ipad || browser.iphone) {
browser.ios = true;
}
if (browser.vivaldi) {
matched.browser = "vivaldi";
browser.vivaldi = true;
}
if (
// Chrome, Opera 15+, Vivaldi and Safari are webkit based browsers
browser.chrome || browser.opr || browser.safari || browser.vivaldi || browser.mobile === true && browser.ios !== true && knownMobiles !== true
) {
browser.webkit = true;
}
if (browser.opr) {
matched.browser = "opera";
browser.opera = true;
}
if (browser.safari) {
if (browser.blackberry || browser.bb) {
matched.browser = "blackberry";
browser.blackberry = true;
} else if (browser.playbook) {
matched.browser = "playbook";
browser.playbook = true;
} else if (browser.android) {
matched.browser = "android";
browser.android = true;
} else if (browser.kindle) {
matched.browser = "kindle";
browser.kindle = true;
} else if (browser.silk) {
matched.browser = "silk";
browser.silk = true;
}
}
browser.name = matched.browser;
browser.platform = matched.platform;
{
if (userAgent2.indexOf("electron") !== -1) {
browser.electron = true;
} else if (document.location.href.indexOf("-extension://") !== -1) {
browser.bex = true;
} else {
if (window.Capacitor !== void 0) {
browser.capacitor = true;
browser.nativeMobile = true;
browser.nativeMobileWrapper = "capacitor";
} else if (window._cordovaNative !== void 0 || window.cordova !== void 0) {
browser.cordova = true;
browser.nativeMobile = true;
browser.nativeMobileWrapper = "cordova";
}
if (isRuntimeSsrPreHydration.value === true) {
preHydrationBrowser = { is: { ...browser } };
}
if (hasTouch === true && browser.mac === true && (browser.desktop === true && browser.safari === true || browser.nativeMobile === true && browser.android !== true && browser.ios !== true && browser.ipad !== true)) {
delete browser.mac;
delete browser.desktop;
const platform = Math.min(window.innerHeight, window.innerWidth) > 414 ? "ipad" : "iphone";
Object.assign(browser, {
mobile: true,
ios: true,
platform,
[platform]: true
});
}
if (browser.mobile !== true && window.navigator.userAgentData && window.navigator.userAgentData.mobile) {
delete browser.desktop;
browser.mobile = true;
}
}
}
return browser;
}
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
const ssrClient = {
has: {
touch: false,
webStorage: false
},
within: { iframe: false }
};
const client = {
userAgent,
is: getPlatform(userAgent),
has: {
touch: hasTouch
},
within: {
iframe: window.self !== window.top
}
};
const Platform = {
install(opts) {
const { $q } = opts;
if (isRuntimeSsrPreHydration.value === true) {
opts.onSSRHydrated.push(() => {
Object.assign($q.platform, client);
isRuntimeSsrPreHydration.value = false;
});
$q.platform = reactive(this);
} else {
$q.platform = this;
}
}
};
{
let hasWebStorage;
injectProp(client.has, "webStorage", () => {
if (hasWebStorage !== void 0) {
return hasWebStorage;
}
try {
if (window.localStorage) {
hasWebStorage = true;
return true;
}
} catch (_) {
}
hasWebStorage = false;
return false;
});
Object.assign(Platform, client);
if (isRuntimeSsrPreHydration.value === true) {
Object.assign(Platform, preHydrationBrowser, ssrClient);
preHydrationBrowser = null;
}
}
function parseValue(val) {
return val === void 0 || val === null ? null : val;
}
function getId(val, required) {
return val === void 0 || val === null ? required === true ? `f_${uid()}` : null : val;
}
function useId({ getValue, required = true } = {}) {
if (isRuntimeSsrPreHydration.value === true) {
const id = getValue !== void 0 ? ref(parseValue(getValue())) : ref(null);
if (required === true && id.value === null) {
onMounted(() => {
id.value = `f_${uid()}`;
});
}
if (getValue !== void 0) {
watch(getValue, (newId) => {
id.value = getId(newId, required);
});
}
return id;
}
return getValue !== void 0 ? computed(() => getId(getValue(), required)) : ref(`f_${uid()}`);
}
const listenerRE = /^on[A-Z]/;
function useSplitAttrs() {
const { attrs, vnode } = getCurrentInstance();
const acc = {
listeners: ref({}),
attributes: ref({})
};
function update2() {
const attributes = {};
const listeners = {};
for (const key in attrs) {
if (key !== "class" && key !== "style" && listenerRE.test(key) === false) {
attributes[key] = attrs[key];
}
}
for (const key in vnode.props) {
if (listenerRE.test(key) === true) {
listeners[key] = vnode.props[key];
}
}
acc.attributes.value = attributes;
acc.listeners.value = listeners;
}
onBeforeUpdate(update2);
update2();
return acc;
}
const useDarkProps = {
dark: {
type: Boolean,
default: null
}
};
function useDark(props, $q) {
return computed(() => props.dark === null ? $q.dark.isActive : props.dark);
}
const formKey = "_q_fo_";
function useFormChild({ validate, resetValidation, requiresQForm }) {
const $form = inject(formKey, false);
if ($form !== false) {
const { props, proxy } = getCurrentInstance();
Object.assign(proxy, { validate, resetValidation });
watch(() => props.disable, (val) => {
if (val === true) {
typeof resetValidation === "function" && resetValidation();
$form.unbindComponent(proxy);
} else {
$form.bindComponent(proxy);
}
});
onMounted(() => {
props.disable !== true && $form.bindComponent(proxy);
});
onBeforeUnmount(() => {
props.disable !== true && $form.unbindComponent(proxy);
});
} else if (requiresQForm === true) {
console.error("Parent QForm not found on useFormChild()!");
}
}
const hex = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/, hexa = /^#[0-9a-fA-F]{4}([0-9a-fA-F]{4})?$/, hexOrHexa = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, rgb = /^rgb\(((0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5]),){2}(0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5])\)$/, rgba = /^rgba\(((0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5]),){2}(0|[1-9][\d]?|1[\d]{0,2}|2[\d]?|2[0-4][\d]|25[0-5]),(0|0\.[0-9]+[1-9]|0\.[1-9]+|1)\)$/;
const testPattern = {
date: (v) => /^-?[\d]+\/[0-1]\d\/[0-3]\d$/.test(v),
time: (v) => /^([0-1]?\d|2[0-3]):[0-5]\d$/.test(v),
fulltime: (v) => /^([0-1]?\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(v),
timeOrFulltime: (v) => /^([0-1]?\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/.test(v),
// -- RFC 5322 --
// -- Added in v2.6.6 --
// This is a basic helper validation.
// For something more complex (like RFC 822) you should write and use your own rule.
// We won't be accepting PRs to enhance the one below because of the reason above.
// eslint-disable-next-line
email: (v) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v),
hexColor: (v) => hex.test(v),
hexaColor: (v) => hexa.test(v),
hexOrHexaColor: (v) => hexOrHexa.test(v),
rgbColor: (v) => rgb.test(v),
rgbaColor: (v) => rgba.test(v),
rgbOrRgbaColor: (v) => rgb.test(v) || rgba.test(v),
hexOrRgbColor: (v) => hex.test(v) || rgb.test(v),
hexaOrRgbaColor: (v) => hexa.test(v) || rgba.test(v),
anyColor: (v) => hexOrHexa.test(v) || rgb.test(v) || rgba.test(v)
};
function debounce(fn, wait = 250, immediate) {
let timer = null;
function debounced() {
const args = arguments;
const later = () => {
timer = null;
{
fn.apply(this, args);
}
};
if (timer !== null) {
clearTimeout(timer);
}
timer = setTimeout(later, wait);
}
debounced.cancel = () => {
timer !== null && clearTimeout(timer);
};
return debounced;
}
const lazyRulesValues = [true, false, "ondemand"];
const useValidateProps = {
modelValue: {},
error: {
type: Boolean,
default: null
},
errorMessage: String,
noErrorIcon: Boolean,
rules: Array,
reactiveRules: Boolean,
lazyRules: {
type: [Boolean, String],
default: false,
// statement unneeded but avoids future vue implementation changes
validator: (v) => lazyRulesValues.includes(v)
}
};
function useValidate(focused, innerLoading) {
const { props, proxy } = getCurrentInstance();
const innerError = ref(false);
const innerErrorMessage = ref(null);
const isDirtyModel = ref(false);
useFormChild({ validate, resetValidation });
let validateIndex = 0, unwatchRules;
const hasRules = computed(
() => props.rules !== void 0 && props.rules !== null && props.rules.length !== 0
);
const canDebounceValidate = computed(() => props.disable !== true && hasRules.value === true && innerLoading.value === false);
const hasError = computed(
() => props.error === true || innerError.value === true
);
const errorMessage = computed(() => typeof props.errorMessage === "string" && props.errorMessage.length !== 0 ? props.errorMessage : innerErrorMessage.value);
watch(() => props.modelValue, () => {
isDirtyModel.value = true;
if (canDebounceValidate.value === true && props.lazyRules === false) {
debouncedValidate();
}
});
function onRulesChange() {
if (props.lazyRules !== "ondemand" && canDebounceValidate.value === true && isDirtyModel.value === true) {
debouncedValidate();
}
}
watch(() => props.reactiveRules, (val) => {
if (val === true) {
if (unwatchRules === void 0) {
unwatchRules = watch(() => props.rules, onRulesChange, { immediate: true, deep: true });
}
} else if (unwatchRules !== void 0) {
unwatchRules();
unwatchRules = void 0;
}
}, { immediate: true });
watch(() => props.lazyRules, onRulesChange);
watch(focused, (val) => {
if (val === true) {
isDirtyModel.value = true;
} else if (canDebounceValidate.value === true && props.lazyRules !== "ondemand") {
debouncedValidate();
}
});
function resetValidation() {
validateIndex++;
innerLoading.value = false;
isDirtyModel.value = false;
innerError.value = false;
innerErrorMessage.value = null;
debouncedValidate.cancel();
}
function validate(val = props.modelValue) {
if (props.disable === true || hasRules.value === false) {
return true;
}
const index = ++validateIndex;
const setDirty = innerLoading.value !== true ? () => {
isDirtyModel.value = true;
} : () => {
};
const update2 = (err, msg) => {
err === true && setDirty();
innerError.value = err;
innerErrorMessage.value = msg || null;
innerLoading.value = false;
};
const promises = [];
for (let i = 0; i < props.rules.length; i++) {
const rule = props.rules[i];
let res;
if (typeof rule === "function") {
res = rule(val, testPattern);
} else if (typeof rule === "string" && testPattern[rule] !== void 0) {
res = testPattern[rule](val);
}
if (res === false || typeof res === "string") {
update2(true, res);
return false;
} else if (res !== true && res !== void 0) {
promises.push(res);
}
}
if (promises.length === 0) {
update2(false);
return true;
}
innerLoading.value = true;
return Promise.all(promises).then(
(res) => {
if (res === void 0 || Array.isArray(res) === false || res.length === 0) {
index === validateIndex && update2(false);
return true;
}
const msg = res.find((r) => r === false || typeof r === "string");
index === validateIndex && update2(msg !== void 0, msg);
return msg === void 0;
},
(e) => {
if (index === validateIndex) {
console.error(e);
update2(true);
}
return false;
}
);
}
const debouncedValidate = debounce(validate, 0);
onBeforeUnmount(() => {
unwatchRules !== void 0 && unwatchRules();
debouncedValidate.cancel();
});
Object.assign(proxy, { resetValidation, validate });
injectProp(proxy, "hasError", () => hasError.value);
return {
isDirtyModel,
hasRules,
hasError,
errorMessage,
validate,
resetValidation
};
}
const listenOpts = {
hasPassive: false,
passiveCapture: true,
notPassiveCapture: true
};
try {
const opts = Object.defineProperty({}, "passive", {
get() {
Object.assign(listenOpts, {
hasPassive: true,
passive: { passive: true },
notPassive: { passive: false },
passiveCapture: { passive: true, capture: true },
notPassiveCapture: { passive: false, capture: true }
});
}
});
window.addEventListener("qtest", null, opts);
window.removeEventListener("qtest", null, opts);
} catch (_) {
}
function noop() {
}
function position(e) {
if (e.touches && e.touches[0]) {
e = e.touches[0];
} else if (e.changedTouches && e.changedTouches[0]) {
e = e.changedTouches[0];
} else if (e.targetTouches && e.targetTouches[0]) {
e = e.targetTouches[0];
}
return {
top: e.clientY,
left: e.clientX
};
}
function getEventPath(e) {
if (e.path) {
return e.path;
}
if (e.composedPath) {
return e.composedPath();
}
const path = [];
let el = e.target;
while (el) {
path.push(el);
if (el.tagName === "HTML") {
path.push(document);
path.push(window);
return path;
}
el = el.parentElement;
}
}
function stop(e) {
e.stopPropagation();
}
function prevent(e) {
e.cancelable !== false && e.preventDefault();
}
function stopAndPrevent(e) {
e.cancelable !== false && e.preventDefault();
e.stopPropagation();
}
function addEvt(ctx, targetName, events) {
const name = `__q_${targetName}_evt`;
ctx[name] = ctx[name] !== void 0 ? ctx[name].concat(events) : events;
events.forEach((evt) => {
evt[0].addEventListener(evt[1], ctx[evt[2]], listenOpts[evt[3]]);
});
}
function cleanEvt(ctx, targetName) {
const name = `__q_${targetName}_evt`;
if (ctx[name] !== void 0) {
ctx[name].forEach((evt) => {
evt[0].removeEventListener(evt[1], ctx[evt[2]], listenOpts[evt[3]]);
});
ctx[name] = void 0;
}
}
let queue = [];
let waitFlags = [];
function clearFlag(flag) {
waitFlags = waitFlags.filter((entry) => entry !== flag);
}
function addFocusWaitFlag(flag) {
clearFlag(flag);
waitFlags.push(flag);
}
function removeFocusWaitFlag(flag) {
clearFlag(flag);
if (waitFlags.length === 0 && queue.length !== 0) {
queue[queue.length - 1]();
queue = [];
}
}
function addFocusFn(fn) {
if (waitFlags.length === 0) {
fn();
} else {
queue.push(fn);
}
}
function removeFocusFn(fn) {
queue = queue.filter((entry) => entry !== fn);
}
function fieldValueIsFilled(val) {
return val !== void 0 && val !== null && ("" + val).length !== 0;
}
const useNonInputFieldProps = {
...useDarkProps,
...useValidateProps,
label: String,
stackLabel: Boolean,
hint: String,
hideHint: Boolean,
prefix: String,
suffix: String,
labelColor: String,
color: String,
bgColor: String,
filled: Boolean,
outlined: Boolean,
borderless: Boolean,
standout: [Boolean, String],
square: Boolean,
loading: Boolean,
labelSlot: Boolean,
bottomSlots: Boolean,
hideBottomSpace: Boolean,
rounded: Boolean,
dense: Boolean,
itemAligned: Boolean,
counter: Boolean,
clearable: Boolean,
clearIcon: String,
disable: Boolean,
readonly: Boolean,
autofocus: Boolean,
for: String
};
const useFieldProps = {
...useNonInputFieldProps,
maxlength: [Number, String]
};
const useFieldEmits = ["update:modelValue", "clear", "focus", "blur"];
function useFieldState({ requiredForAttr = true, tagProp, changeEvent = false } = {}) {
const { props, proxy } = getCurrentInstance();
const isDark = useDark(props, proxy.$q);
const targetUid = useId({
required: requiredForAttr,
getValue: () => props.for
});
return {
requiredForAttr,
changeEvent,
tag: tagProp === true ? computed(() => props.tag) : { value: "label" },
isDark,
editable: computed(
() => props.disable !== true && props.readonly !== true
),
innerLoading: ref(false),
focused: ref(false),
hasPopupOpen: false,
splitAttrs: useSplitAttrs(),
targetUid,
rootRef: ref(null),
targetRef: ref(null),
controlRef: ref(null)
/**
* user supplied additionals:
* innerValue - computed
* floatingLabel - computed
* inputRef - computed
* fieldClass - computed
* hasShadow - computed
* controlEvents - Object with fn(e)
* getControl - fn
* getInnerAppend - fn
* getControlChild - fn
* getShadowControl - fn
* showPopup - fn
*/
};
}
function useField(state) {
const { props, emit, slots, attrs, proxy } = getCurrentInstance();
const { $q } = proxy;
let focusoutTimer = null;
if (state.hasValue === void 0) {
state.hasValue = computed(() => fieldValueIsFilled(props.modelValue));
}
if (state.emitValue === void 0) {
state.emitValue = (value) => {
emit("update:modelValue", value);
};
}
if (state.controlEvents === void 0) {
state.controlEvents = {
onFocusin: onControlFocusin,
onFocusout: onControlFocusout
};
}
Object.assign(state, {
clearValue,
onControlFocusin,
onControlFocusout,
focus
});
if (state.computedCounter === void 0) {
state.computedCounter = computed(() => {
if (props.counter !== false) {
const len = typeof props.modelValue === "string" || typeof props.modelValue === "number" ? ("" + props.modelValue).length : Array.isArray(props.modelValue) === true ? props.modelValue.length : 0;
const max = props.maxlength !== void 0 ? props.maxlength : props.maxValues;
return len + (max !== void 0 ? " / " + max : "");
}
});
}
const {
isDirtyModel,
hasRules,
hasError,
errorMessage,
resetValidation
} = useValidate(state.focused, state.innerLoading);
const floatingLabel = state.floatingLabel !== void 0 ? computed(() => props.stackLabel === true || state.focused.value === true || state.floatingLabel.value === true) : computed(() => props.stackLabel === true || state.focused.value === true || state.hasValue.value === true);
const shouldRenderBottom = computed(
() => props.bottomSlots === true || props.hint !== void 0 || hasRules.value === true || props.counter === true || props.error !== null
);
const styleType = computed(() => {
if (props.filled === true) {
return "filled";
}
if (props.outlined === true) {
return "outlined";
}
if (props.borderless === true) {
return "borderless";
}
if (props.standout) {
return "standout";
}
return "standard";
});
const classes = computed(
() => `q-field row no-wrap items-start q-field--${styleType.value}` + (state.fieldClass !== void 0 ? ` ${state.fieldClass.value}` : "") + (props.rounded === true ? " q-field--rounded" : "") + (props.square === true ? " q-field--square" : "") + (floatingLabel.value === true ? " q-field--float" : "") + (hasLabel.value === true ? " q-field--labeled" : "") + (props.dense === true ? " q-field--dense" : "") + (props.itemAligned === true ? " q-field--item-aligned q-item-type" : "") + (state.isDark.value === true ? " q-field--dark" : "") + (state.getControl === void 0 ? " q-field--auto-height" : "") + (state.focused.value === true ? " q-field--focused" : "") + (hasError.value === true ? " q-field--error" : "") + (hasError.value === true || state.focused.value === true ? " q-field--highlighted" : "") + (props.hideBottomSpace !== true && shouldRenderBottom.value === true ? " q-field--with-bottom" : "") + (props.disable === true ? " q-field--disabled" : props.readonly === true ? " q-field--readonly" : "")
);
const contentClass = computed(
() => "q-field__control relative-position row no-wrap" + (props.bgColor !== void 0 ? ` bg-${props.bgColor}` : "") + (hasError.value === true ? " text-negative" : typeof props.standout === "string" && props.standout.length !== 0 && state.focused.value === true ? ` ${props.standout}` : props.color !== void 0 ? ` text-${props.color}` : "")
);
const hasLabel = computed(
() => props.labelSlot === true || props.label !== void 0
);
const labelClass = computed(
() => "q-field__label no-pointer-events absolute ellipsis" + (props.labelColor !== void 0 && hasError.value !== true ? ` text-${props.labelColor}` : "")
);
const controlSlotScope = computed(() => ({
id: state.targetUid.value,
editable: state.editable.value,
focused: state.focused.value,
floatingLabel: floatingLabel.value,
modelValue: props.modelValue,
emitValue: state.emitValue
}));
const attributes = computed(() => {
const acc = {};
if (state.targetUid.value) {
acc.for = state.targetUid.value;
}
if (props.disable === true) {
acc["aria-disabled"] = "true";
}
return acc;
});
function focusHandler() {
const el = document.activeElement;
let target2 = state.targetRef !== void 0 && state.targetRef.value;
if (target2 && (el === null || el.id !== state.targetUid.value)) {
target2.hasAttribute("tabindex") === true || (target2 = target2.querySelector("[tabindex]"));
if (target2 && target2 !== el) {
target2.focus({ preventScroll: true });
}
}
}
function focus() {
addFocusFn(focusHandler);
}
function blur() {
removeFocusFn(focusHandler);
const el = document.activeElement;
if (el !== null && state.rootRef.value.contains(el)) {
el.blur();
}
}
function onControlFocusin(e) {
if (focusoutTimer !== null) {
clearTimeout(focusoutTimer);
focusoutTimer = null;
}
if (state.editable.value === true && state.focused.value === false) {
state.focused.value = true;
emit("focus", e);
}
}
function onControlFocusout(e, then) {
focusoutTimer !== null && clearTimeout(focusoutTimer);
focusoutTimer = setTimeout(() => {
focusoutTimer = null;
if (document.hasFocus() === true && (state.hasPopupOpen === true || state.controlRef === void 0 || state.controlRef.value === null || state.controlRef.value.contains(document.activeElement) !== false)) {
return;
}
if (state.focused.value === true) {
state.focused.value = false;
emit("blur", e);
}
then !== void 0 && then();
});
}
function clearValue(e) {
stopAndPrevent(e);
if ($q.platform.is.mobile !== true) {
const el = state.targetRef !== void 0 && state.targetRef.value || state.rootRef.value;
el.focus();
} else if (state.rootRef.value.contains(document.activeElement) === true) {
document.activeElement.blur();
}
if (props.type === "file") {
state.inputRef.value.value = null;
}
emit("update:modelValue", null);
state.changeEvent === true && emit("change", null);
emit("clear", props.modelValue);
nextTick(() => {
const isDirty = isDirtyModel.value;
resetValidation();
isDirtyModel.value = isDirty;
});
}
function onClearableKeyup(evt) {
[13, 32].includes(evt.keyCode) && clearValue(evt);
}
function getContent() {
const node = [];
slots.prepend !== void 0 && node.push(
h("div", {
class: "q-field__prepend q-field__marginal row no-wrap items-center",
key: "prepend",
onClick: prevent
}, slots.prepend())
);
node.push(
h("div", {
class: "q-field__control-container col relative-position row no-wrap q-anchor--skip"
}, getControlContainer())
);
hasError.value === true && props.noErrorIcon === false && node.push(
getInnerAppendNode("error", [
h(QIcon, { name: $q.iconSet.field.error, color: "negative" })
])
);
if (props.loading === true || state.innerLoading.value === true) {
node.push(
getInnerAppendNode(
"inner-loading-append",
slots.loading !== void 0 ? slots.loading() : [h(QSpinner, { color: props.color })]
)
);
} else if (props.clearable === true && state.hasValue.value === true && state.editable.value === true) {
node.push(
getInnerAppendNode("inner-clearable-append", [
h(QIcon, {
class: "q-field__focusable-action",
name: props.clearIcon || $q.iconSet.field.clear,
tabindex: 0,
role: "button",
"aria-hidden": "false",
"aria-label": $q.lang.label.clear,
onKeyup: onClearableKeyup,
onClick: clearValue
})
])
);
}
slots.append !== void 0 && node.push(
h("div", {
class: "q-field__append q-field__marginal row no-wrap items-center",
key: "append",
onClick: prevent
}, slots.append())
);
state.getInnerAppend !== void 0 && node.push(
getInnerAppendNode("inner-append", state.getInnerAppend())
);
state.getControlChild !== void 0 && node.push(
state.getControlChild()
);
return node;
}
function getControlContainer() {
const node = [];
props.prefix !== void 0 && props.prefix !== null && node.push(
h("div", {
class: "q-field__prefix no-pointer-events row items-center"
}, props.prefix)
);
if (state.getShadowControl !== void 0 && state.hasShadow.value === true) {
node.push(
state.getShadowControl()
);
}
if (state.getControl !== void 0) {
node.push(state.getControl());
} else if (slots.rawControl !== void 0) {
node.push(slots.rawControl());
} else if (slots.control !== void 0) {
node.push(
h("div", {
ref: state.targetRef,
class: "q-field__native row",
tabindex: -1,
...state.splitAttrs.attributes.value,
"data-autofocus": props.autofocus === true || void 0
}, slots.control(controlSlotScope.value))
);
}
hasLabel.value === true && node.push(
h("div", {
class: labelClass.value
}, hSlot(slots.label, props.label))
);
props.suffix !== void 0 && props.suffix !== null && node.push(
h("div", {
class: "q-field__suffix no-pointer-events row items-center"
}, props.suffix)
);
return node.concat(hSlot(slots.default));
}
function getBottom() {
let msg, key;
if (hasError.value === true) {
if (errorMessage.value !== null) {
msg = [h("div", { role: "alert" }, errorMessage.value)];
key = `q--slot-error-${errorMessage.value}`;
} else {
msg = hSlot(slots.error);
key = "q--slot-error";
}
} else if (props.hideHint !== true || state.focused.value === true) {
if (props.hint !== void 0) {
msg = [h("div", props.hint)];
key = `q--slot-hint-${props.hint}`;
} else {
msg = hSlot(slots.hint);
key = "q--slot-hint";
}
}
const hasCounter = props.counter === true || slots.counter !== void 0;
if (props.hideBottomSpace === true && hasCounter === false && msg === void 0) {
return;
}
const main = h("div", {
key,
class: "q-field__messages col"
}, msg);
return h("div", {
class: "q-field__bottom row items-start q-field__bottom--" + (props.hideBottomSpace !== true ? "animated" : "stale"),
onClick: prevent
}, [
props.hideBottomSpace === true ? main : h(Transition, { name: "q-transition--field-message" }, () => main),
hasCounter === true ? h("div", {
class: "q-field__counter"
}, slots.counter !== void 0 ? slots.counter() : state.computedCounter.value) : null
]);
}
function getInnerAppendNode(key, content) {
return content === null ? null : h("div", {
key,
class: "q-field__append q-field__marginal row no-wrap items-center q-anchor--skip"
}, content);
}
let shouldActivate = false;
onDeactivated(() => {
shouldActivate = true;
});
onActivated(() => {
shouldActivate === true && props.autofocus === true && proxy.focus();
});
props.autofocus === true && onMounted(() => {
proxy.focus();
});
onBeforeUnmount(() => {
focusoutTimer !== null && clearTimeout(focusoutTimer);
});
Object.assign(proxy, { focus, blur });
return function renderField() {
const labelAttrs = state.getControl === void 0 && slots.control === void 0 ? {
...state.splitAttrs.attributes.value,
"data-autofocus": props.autofocus === true || void 0,
...attributes.value
} : attributes.value;
return h(state.tag.value, {
ref: state.rootRef,
class: [
classes.value,
attrs.class
],
style: attrs.style,
...labelAttrs
}, [
slots.before !== void 0 ? h("div", {
class: "q-field__before q-field__marginal row no-wrap items-center",
onClick: prevent
}, slots.before()) : null,
h("div", {
class: "q-field__inner relative-position col self-stretch"
}, [
h("div", {
ref: state.controlRef,
class: contentClass.value,
tabindex: -1,
...state.controlEvents
}, getContent()),
shouldRenderBottom.value === true ? getBottom() : null
]),
slots.after !== void 0 ? h("div", {
class: "q-field__after q-field__marginal row no-wrap items-center",
onClick: prevent
}, slots.after()) : null
]);
};
}
const QField = createComponent({
name: "QField",
inheritAttrs: false,
props: {
...useFieldProps,
tag: {
type: String,
default: "label"
}
},
emits: useFieldEmits,
setup() {
return useField(
useFieldState({ tagProp: true })
);
}
});
function css(element, css2) {
const style = element.style;
for (const prop in css2) {
style[prop] = css2[prop];
}
}
function getElement(el) {
if (el === void 0 || el === null) {
return void 0;
}
if (typeof el === "string") {
try {
return document.querySelector(el) || void 0;
} catch (err) {
return void 0;
}
}
const target2 = unref(el);
if (target2) {
return target2.$el || target2;
}
}
function childHasFocus(el, focusedEl) {
if (el === void 0 || el === null || el.contains(focusedEl) === true) {
return true;
}
for (let next = el.nextElementSibling; next !== null; next = next.nextElementSibling) {
if (next.contains(focusedEl)) {
return true;
}
}
return false;
}
function shouldIgnoreKey(evt) {
return evt !== Object(evt) || evt.isComposing === true || evt.qKeyEvent === true;
}
function isKeyCode(evt, keyCodes) {
return shouldIgnoreKey(evt) === true ? false : [].concat(keyCodes).includes(evt.keyCode);
}
function throttle(fn, limit = 250) {
let wait = false, result2;
return function() {
if (wait === false) {
wait = true;
setTimeout(() => {
wait = false;
}, limit);
result2 = fn.apply(this, arguments);
}
return result2;
};
}
function showRipple(evt, el, ctx, forceCenter) {
ctx.modifiers.stop === true && stop(evt);
const color = ctx.modifiers.color;
let center = ctx.modifiers.center;
center = center === true || forceCenter === true;
const node = document.createElement("span"), innerNode = document.createElement("span"), pos = position(evt), { left, top, width, height } = el.getBoundingClientRect(), diameter = Math.sqrt(width * width + height * height), radius = diameter / 2, centerX = `${(width - diameter) / 2}px`, x = center ? centerX : `${pos.left - left - radius}px`, centerY = `${(height - diameter) / 2}px`, y = center ? centerY : `${pos.top - top - radius}px`;
innerNode.className = "q-ripple__inner";
css(innerNode, {
height: `${diameter}px`,
width: `${diameter}px`,
transform: `translate3d(${x},${y},0) scale3d(.2,.2,1)`,
opacity: 0
});
node.className = `q-ripple${color ? " text-" + color : ""}`;
node.setAttribute("dir", "ltr");
node.appendChild(innerNode);
el.appendChild(node);
const abort = () => {
node.remove();
clearTimeout(timer);
};
ctx.abort.push(abort);
let timer = setTimeout(() => {
innerNode.classList.add("q-ripple__inner--enter");
innerNode.style.transform = `translate3d(${centerX},${centerY},0) scale3d(1,1,1)`;
innerNode.style.opacity = 0.2;
timer = setTimeout(() => {
innerNode.classList.remove("q-ripple__inner--enter");
innerNode.classList.add("q-ripple__inner--leave");
innerNode.style.opacity = 0;
timer = setTimeout(() => {
node.remove();
ctx.abort.splice(ctx.abort.indexOf(abort), 1);
}, 275);
}, 250);
}, 50);
}
function updateModifiers(ctx, { modifiers, value, arg }) {
const cfg = Object.assign({}, ctx.cfg.ripple, modifiers, value);
ctx.modifiers = {
early: cfg.early === true,
stop: cfg.stop === true,
center: cfg.center === true,
color: cfg.color || arg,
keyCodes: [].concat(cfg.keyCodes || 13)
};
}
const Ripple = createDirective(
{
name: "ripple",
beforeMount(el, binding) {
const cfg = binding.instance.$.appContext.config.globalProperties.$q.config || {};
if (cfg.ripple === false) {
return;
}
const ctx = {
cfg,
enabled: binding.value !== false,
modifiers: {},
abort: [],
start(evt) {
if (ctx.enabled === true && evt.qSkipRipple !== true && evt.type === (ctx.modifiers.early === true ? "pointerdown" : "click")) {
showRipple(evt, el, ctx, evt.qKeyEvent === true);
}
},
keystart: throttle((evt) => {
if (ctx.enabled === true && evt.qSkipRipple !== true && isKeyCode(evt, ctx.modifiers.keyCodes) === true && evt.type === `key${ctx.modifiers.early === true ? "down" : "up"}`) {
showRipple(evt, el, ctx, true);
}
}, 300)
};
updateModifiers(ctx, binding);
el.__qripple = ctx;
addEvt(ctx, "main", [
[el, "pointerdown", "start", "passive"],
[el, "click", "start", "passive"],
[el, "keydown", "keystart", "passive"],
[el, "keyup", "keystart", "passive"]
]);
},
updated(el, binding) {
if (binding.oldValue !== binding.value) {
const ctx = el.__qripple;
if (ctx !== void 0) {
ctx.enabled = binding.value !== false;
if (ctx.enabled === true && Object(binding.value) === binding.value) {
updateModifiers(ctx, binding);
}
}
}
},
beforeUnmount(el) {
const ctx = el.__qripple;
if (ctx !== void 0) {
ctx.abort.forEach((fn) => {
fn();
});
cleanEvt(ctx, "main");
delete el._qripple;
}
}
}
);
const defaultSizes = {
xs: 8,
sm: 10,
md: 14,
lg: 20,
xl: 24
};
const QChip = createComponent({
name: "QChip",
props: {
...useDarkProps,
...useSizeProps,
dense: Boolean,
icon: String,
iconRight: String,
iconRemove: String,
iconSelected: String,
label: [String, Number],
color: String,
textColor: String,
modelValue: {
type: Boolean,
default: true
},
selected: {
type: Boolean,
default: null
},
square: Boolean,
outline: Boolean,
clickable: Boolean,
removable: Boolean,
removeAriaLabel: String,
tabindex: [String, Number],
disable: Boolean,
ripple: {
type: [Boolean, Object],
default: true
}
},
emits: ["update:modelValue", "update:selected", "remove", "click"],
setup(props, { slots, emit }) {
const { proxy: { $q } } = getCurrentInstance();
const isDark = useDark(props, $q);
const sizeStyle = useSize(props, defaultSizes);
const hasLeftIcon = computed(() => props.selected === true || props.icon !== void 0);
const leftIcon = computed(() => props.selected === true ? props.iconSelected || $q.iconSet.chip.selected : props.icon);
const removeIcon = computed(() => props.iconRemove || $q.iconSet.chip.remove);
const isClickable = computed(
() => props.disable === false && (props.clickable === true || props.selected !== null)
);
const classes = computed(() => {
const text = props.outline === true ? props.color || props.textColor : props.textColor;
return "q-chip row inline no-wrap items-center" + (props.outline === false && props.color !== void 0 ? ` bg-${props.color}` : "") + (text ? ` text-${text} q-chip--colored` : "") + (props.disable === true ? " disabled" : "") + (props.dense === true ? " q-chip--dense" : "") + (props.outline === true ? " q-chip--outline" : "") + (props.selected === true ? " q-chip--selected" : "") + (isClickable.value === true ? " q-chip--clickable cursor-pointer non-selectable q-hoverable" : "") + (props.square === true ? " q-chip--square" : "") + (isDark.value === true ? " q-chip--dark q-dark" : "");
});
const attributes = computed(() => {
const chip = props.disable === true ? { tabindex: -1, "aria-disabled": "true" } : { tabindex: props.tabindex || 0 };
const remove = {
...chip,
role: "button",
"aria-hidden": "false",
"aria-label": props.removeAriaLabel || $q.lang.label.remove
};
return { chip, remove };
});
function onKeyup2(e) {
e.keyCode === 13 && onClick(e);
}
function onClick(e) {
if (!props.disable) {
emit("update:selected", !props.selected);
emit("click", e);
}
}
function onRemove(e) {
if (e.keyCode === void 0 || e.keyCode === 13) {
stopAndPrevent(e);
if (props.disable === false) {
emit("update:modelValue", false);
emit("remove");
}
}
}
function getContent() {
const child = [];
isClickable.value === true && child.push(
h("div", { class: "q-focus-helper" })
);
hasLeftIcon.value === true && child.push(
h(QIcon, {
class: "q-chip__icon q-chip__icon--left",
name: leftIcon.value
})
);
const label = props.label !== void 0 ? [h("div", { class: "ellipsis" }, [props.label])] : void 0;
child.push(
h("div", {
class: "q-chip__content col row no-wrap items-center q-anchor--skip"
}, hMergeSlotSafely(slots.default, label))
);
props.iconRight && child.push(
h(QIcon, {
class: "q-chip__icon q-chip__icon--right",
name: props.iconRight
})
);
props.removable === true && child.push(
h(QIcon, {
class: "q-chip__icon q-chip__icon--remove cursor-pointer",
name: removeIcon.value,
...attributes.value.remove,
onClick: onRemove,
onKeyup: onRemove
})
);
return child;
}
return () => {
if (props.modelValue === false) return;
const data = {
class: classes.value,
style: sizeStyle.value
};
isClickable.value === true && Object.assign(
data,
attributes.value.chip,
{ onClick, onKeyup: onKeyup2 }
);
return hDir(
"div",
data,
getContent(),
"ripple",
props.ripple !== false && props.disable !== true,
() => [[Ripple, props.ripple]]
);
};
}
});
function getParentProxy(proxy) {
if (Object(proxy.$parent) === proxy.$parent) {
return proxy.$parent;
}
let { parent } = proxy.$;
while (Object(parent) === parent) {
if (Object(parent.proxy) === parent.proxy) {
return parent.proxy;
}
parent = parent.parent;
}
}
function vmHasRouter(vm) {
return vm.appContext.config.globalProperties.$router !== void 0;
}
function vmIsDestroyed(vm) {
return vm.isUnmounted === true || vm.isDeactivated === true;
}
function getOriginalPath(record) {
return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
}
function isSameRouteRecord(a, b) {
return (a.aliasOf || a) === (b.aliasOf || b);
}
function includesParams(outer, inner) {
for (const key in inner) {
const innerValue = inner[key], outerValue = outer[key];
if (typeof innerValue === "string") {
if (innerValue !== outerValue) {
return false;
}
} else if (Array.isArray(outerValue) === false || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i])) {
return false;
}
}
return true;
}
function isEquivalentArray(a, b) {
return Array.isArray(b) === true ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
}
function isSameRouteLocationParamsValue(a, b) {
return Array.isArray(a) === true ? isEquivalentArray(a, b) : Array.isArray(b) === true ? isEquivalentArray(b, a) : a === b;
}
function isSameRouteLocationParams(a, b) {
if (Object.keys(a).length !== Object.keys(b).length) {
return false;
}
for (const key in a) {
if (isSameRouteLocationParamsValue(a[key], b[key]) === false) {
return false;
}
}
return true;
}
const useRouterLinkNonMatchingProps = {
// router-link
to: [String, Object],
replace: Boolean,
// regular <a> link
href: String,
target: String,
// state
disable: Boolean
};
const useRouterLinkProps = {
...useRouterLinkNonMatchingProps,
// router-link
exact: Boolean,
activeClass: {
type: String,
default: "q-router-link--active"
},
exactActiveClass: {
type: String,
default: "q-router-link--exact-active"
}
};
function useRouterLink({ fallbackTag, useDisableForRouterLinkProps = true } = {}) {
const vm = getCurrentInstance();
const { props, proxy, emit } = vm;
const hasRouter = vmHasRouter(vm);
const hasHrefLink = computed(() => props.disable !== true && props.href !== void 0);
const hasRouterLinkProps = useDisableForRouterLinkProps === true ? computed(
() => hasRouter === true && props.disable !== true && hasHrefLink.value !== true && props.to !== void 0 && props.to !== null && props.to !== ""
) : computed(
() => hasRouter === true && hasHrefLink.value !== true && props.to !== void 0 && props.to !== null && props.to !== ""
);
const resolvedLink = computed(() => hasRouterLinkProps.value === true ? getLink(props.to) : null);
const hasRouterLink = computed(() => resolvedLink.value !== null);
const hasLink = computed(() => hasHrefLink.value === true || hasRouterLink.value === true);
const linkTag = computed(() => props.type === "a" || hasLink.value === true ? "a" : props.tag || fallbackTag || "div");
const linkAttrs = computed(() => hasHrefLink.value === true ? {
href: props.href,
target: props.target
} : hasRouterLink.value === true ? {
href: resolvedLink.value.href,
target: props.target
} : {});
const linkActiveIndex = computed(() => {
if (hasRouterLink.value === false) {
return -1;
}
const { matched } = resolvedLink.value, { length } = matched, routeMatched = matched[length - 1];
if (routeMatched === void 0) {
return -1;
}
const currentMatched = proxy.$route.matched;
if (currentMatched.length === 0) {
return -1;
}
const index = currentMatched.findIndex(
isSameRouteRecord.bind(null, routeMatched)
);
if (index !== -1) {
return index;
}
const parentRecordPath = getOriginalPath(matched[length - 2]);
return (
// we are dealing with nested routes
length > 1 && getOriginalPath(routeMatched) === parentRecordPath && currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(
isSameRouteRecord.bind(null, matched[length - 2])
) : index
);
});
const linkIsActive = computed(
() => hasRouterLink.value === true && linkActiveIndex.value !== -1 && includesParams(proxy.$route.params, resolvedLink.value.params)
);
const linkIsExactActive = computed(
() => linkIsActive.value === true && linkActiveIndex.value === proxy.$route.matched.length - 1 && isSameRouteLocationParams(proxy.$route.params, resolvedLink.value.params)
);
const linkClass = computed(() => hasRouterLink.value === true ? linkIsExactActive.value === true ? ` ${props.exactActiveClass} ${props.activeClass}` : props.exact === true ? "" : linkIsActive.value === true ? ` ${props.activeClass}` : "" : "");
function getLink(to) {
try {
return proxy.$router.resolve(to);
} catch (_) {
}
return null;
}
function navigateToRouterLink(e, { returnRouterError, to = props.to, replace = props.replace } = {}) {
if (props.disable === true) {
e.preventDefault();
return Promise.resolve(false);
}
if (
// don't redirect with control keys;
// should match RouterLink from Vue Router
e.metaKey || e.altKey || e.ctrlKey || e.shiftKey || e.button !== void 0 && e.button !== 0 || props.target === "_blank"
) {
return Promise.resolve(false);
}
e.preventDefault();
const promise = proxy.$router[replace === true ? "replace" : "push"](to);
return returnRouterError === true ? promise : promise.then(() => {
}).catch(() => {
});
}
function navigateOnClick(e) {
if (hasRouterLink.value === true) {
const go = (opts) => navigateToRouterLink(e, opts);
emit("click", e, go);
e.defaultPrevented !== true && go();
} else {
emit("click", e);
}
}
return {
hasRouterLink,
hasHrefLink,
hasLink,
linkTag,
resolvedLink,
linkIsActive,
linkIsExactActive,
linkClass,
linkAttrs,
getLink,
navigateToRouterLink,
navigateOnClick
};
}
const QItem = createComponent({
name: "QItem",
props: {
...useDarkProps,
...useRouterLinkProps,
tag: {
type: String,
default: "div"
},
active: {
type: Boolean,
default: null
},
clickable: Boolean,
dense: Boolean,
insetLevel: Number,
tabindex: [String, Number],
focused: Boolean,
manualFocus: Boolean
},
emits: ["click", "keyup"],
setup(props, { slots, emit }) {
const { proxy: { $q } } = getCurrentInstance();
const isDark = useDark(props, $q);
const { hasLink, linkAttrs, linkClass, linkTag, navigateOnClick } = useRouterLink();
const rootRef = ref(null);
const blurTargetRef = ref(null);
const isActionable = computed(
() => props.clickable === true || hasLink.value === true || props.tag === "label"
);
const isClickable = computed(
() => props.disable !== true && isActionable.value === true
);
const classes = computed(
() => "q-item q-item-type row no-wrap" + (props.dense === true ? " q-item--dense" : "") + (isDark.value === true ? " q-item--dark" : "") + (hasLink.value === true && props.active === null ? linkClass.value : props.active === true ? ` q-item--active${props.activeClass !== void 0 ? ` ${props.activeClass}` : ""}` : "") + (props.disable === true ? " disabled" : "") + (isClickable.value === true ? " q-item--clickable q-link cursor-pointer " + (props.manualFocus === true ? "q-manual-focusable" : "q-focusable q-hoverable") + (props.focused === true ? " q-manual-focusable--focused" : "") : "")
);
const style = computed(() => {
if (props.insetLevel === void 0) {
return null;
}
const dir = $q.lang.rtl === true ? "Right" : "Left";
return {
["padding" + dir]: 16 + props.insetLevel * 56 + "px"
};
});
function onClick(e) {
if (isClickable.value === true) {
if (blurTargetRef.value !== null) {
if (e.qKeyEvent !== true && document.activeElement === rootRef.value) {
blurTargetRef.value.focus();
} else if (document.activeElement === blurTargetRef.value) {
rootRef.value.focus();
}
}
navigateOnClick(e);
}
}
function onKeyup2(e) {
if (isClickable.value === true && isKeyCode(e, [13, 32]) === true) {
stopAndPrevent(e);
e.qKeyEvent = true;
const evt = new MouseEvent("click", e);
evt.qKeyEvent = true;
rootRef.value.dispatchEvent(evt);
}
emit("keyup", e);
}
function getContent() {
const child = hUniqueSlot(slots.default, []);
isClickable.value === true && child.unshift(
h("div", { class: "q-focus-helper", tabindex: -1, ref: blurTargetRef })
);
return child;
}
return () => {
const data = {
ref: rootRef,
class: classes.value,
style: style.value,
role: "listitem",
onClick,
onKeyup: onKeyup2
};
if (isClickable.value === true) {
data.tabindex = props.tabindex || "0";
Object.assign(data, linkAttrs.value);
} else if (isActionable.value === true) {
data["aria-disabled"] = "true";
}
return h(
linkTag.value,
data,
getContent()
);
};
}
});
const QItemSection = createComponent({
name: "QItemSection",
props: {
avatar: Boolean,
thumbnail: Boolean,
side: Boolean,
top: Boolean,
noWrap: Boolean
},
setup(props, { slots }) {
const classes = computed(
() => `q-item__section column q-item__section--${props.avatar === true || props.side === true || props.thumbnail === true ? "side" : "main"}` + (props.top === true ? " q-item__section--top justify-start" : " justify-center") + (props.avatar === true ? " q-item__section--avatar" : "") + (props.thumbnail === true ? " q-item__section--thumbnail" : "") + (props.noWrap === true ? " q-item__section--nowrap" : "")
);
return () => h("div", { class: classes.value }, hSlot(slots.default));
}
});
const QItemLabel = createComponent({
name: "QItemLabel",
props: {
overline: Boolean,
caption: Boolean,
header: Boolean,
lines: [Number, String]
},
setup(props, { slots }) {
const parsedLines = computed(() => parseInt(props.lines, 10));
const classes = computed(
() => "q-item__label" + (props.overline === true ? " q-item__label--overline text-overline" : "") + (props.caption === true ? " q-item__label--caption text-caption" : "") + (props.header === true ? " q-item__label--header" : "") + (parsedLines.value === 1 ? " ellipsis" : "")
);
const style = computed(() => {
return props.lines !== void 0 && parsedLines.value > 1 ? {
overflow: "hidden",
display: "-webkit-box",
"-webkit-box-orient": "vertical",
"-webkit-line-clamp": parsedLines.value
} : null;
});
return () => h("div", {
style: style.value,
class: classes.value
}, hSlot(slots.default));
}
});
function clearSelection() {
if (window.getSelection !== void 0) {
const selection = window.getSelection();
if (selection.empty !== void 0) {
selection.empty();
} else if (selection.removeAllRanges !== void 0) {
selection.removeAllRanges();
Platform.is.mobile !== true && selection.addRange(document.createRange());
}
} else if (document.selection !== void 0) {
document.selection.empty();
}
}
const useAnchorStaticProps = {
/* SSR does not know about Element */
target: {
type: [Boolean, String, Element],
default: true
},
noParentEvent: Boolean
};
const useAnchorProps = {
...useAnchorStaticProps,
contextMenu: Boolean
};
function useAnchor({
showing,
avoidEmit,
// required for QPopupProxy (true)
configureAnchorEl
// optional
}) {
const { props, proxy, emit } = getCurrentInstance();
const anchorEl = ref(null);
let touchTimer = null;
function canShow(evt) {
return anchorEl.value === null ? false : evt === void 0 || evt.touches === void 0 || evt.touches.length <= 1;
}
const anchorEvents = {};
if (configureAnchorEl === void 0) {
Object.assign(anchorEvents, {
hide(evt) {
proxy.hide(evt);
},
toggle(evt) {
proxy.toggle(evt);
evt.qAnchorHandled = true;
},
toggleKey(evt) {
isKeyCode(evt, 13) === true && anchorEvents.toggle(evt);
},
contextClick(evt) {
proxy.hide(evt);
prevent(evt);
nextTick(() => {
proxy.show(evt);
evt.qAnchorHandled = true;
});
},
prevent,
mobileTouch(evt) {
anchorEvents.mobileCleanup(evt);
if (canShow(evt) !== true) {
return;
}
proxy.hide(evt);
anchorEl.value.classList.add("non-selectable");
const target2 = evt.target;
addEvt(anchorEvents, "anchor", [
[target2, "touchmove", "mobileCleanup", "passive"],
[target2, "touchend", "mobileCleanup", "passive"],
[target2, "touchcancel", "mobileCleanup", "passive"],
[anchorEl.value, "contextmenu", "prevent", "notPassive"]
]);
touchTimer = setTimeout(() => {
touchTimer = null;
proxy.show(evt);
evt.qAnchorHandled = true;
}, 300);
},
mobileCleanup(evt) {
anchorEl.value.classList.remove("non-selectable");
if (touchTimer !== null) {
clearTimeout(touchTimer);
touchTimer = null;
}
if (showing.value === true && evt !== void 0) {
clearSelection();
}
}
});
configureAnchorEl = function(context = props.contextMenu) {
if (props.noParentEvent === true || anchorEl.value === null) return;
let evts;
if (context === true) {
if (proxy.$q.platform.is.mobile === true) {
evts = [
[anchorEl.value, "touchstart", "mobileTouch", "passive"]
];
} else {
evts = [
[anchorEl.value, "mousedown", "hide", "passive"],
[anchorEl.value, "contextmenu", "contextClick", "notPassive"]
];
}
} else {
evts = [
[anchorEl.value, "click", "toggle", "passive"],
[anchorEl.value, "keyup", "toggleKey", "passive"]
];
}
addEvt(anchorEvents, "anchor", evts);
};
}
function unconfigureAnchorEl() {
cleanEvt(anchorEvents, "anchor");
}
function setAnchorEl(el) {
anchorEl.value = el;
while (anchorEl.value.classList.contains("q-anchor--skip")) {
anchorEl.value = anchorEl.value.parentNode;
}
configureAnchorEl();
}
function pickAnchorEl() {
if (props.target === false || props.target === "" || proxy.$el.parentNode === null) {
anchorEl.value = null;
} else if (props.target === true) {
setAnchorEl(proxy.$el.parentNode);
} else {
let el = props.target;
if (typeof props.target === "string") {
try {
el = document.querySelector(props.target);
} catch (err) {
el = void 0;
}
}
if (el !== void 0 && el !== null) {
anchorEl.value = el.$el || el;
configureAnchorEl();
} else {
anchorEl.value = null;
console.error(`Anchor: target "${props.target}" not found`);
}
}
}
watch(() => props.contextMenu, (val) => {
if (anchorEl.value !== null) {
unconfigureAnchorEl();
configureAnchorEl(val);
}
});
watch(() => props.target, () => {
if (anchorEl.value !== null) {
unconfigureAnchorEl();
}
pickAnchorEl();
});
watch(() => props.noParentEvent, (val) => {
if (anchorEl.value !== null) {
if (val === true) {
unconfigureAnchorEl();
} else {
configureAnchorEl();
}
}
});
onMounted(() => {
pickAnchorEl();
if (avoidEmit !== true && props.modelValue === true && anchorEl.value === null) {
emit("update:modelValue", false);
}
});
onBeforeUnmount(() => {
touchTimer !== null && clearTimeout(touchTimer);
unconfigureAnchorEl();
});
return {
anchorEl,
canShow,
anchorEvents
};
}
function useScrollTarget(props, configureScrollTarget) {
const localScrollTarget = ref(null);
let scrollFn;
function changeScrollEvent(scrollTarget, fn) {
const fnProp = `${fn !== void 0 ? "add" : "remove"}EventListener`;
const fnHandler = fn !== void 0 ? fn : scrollFn;
if (scrollTarget !== window) {
scrollTarget[fnProp]("scroll", fnHandler, listenOpts.passive);
}
window[fnProp]("scroll", fnHandler, listenOpts.passive);
scrollFn = fn;
}
function unconfigureScrollTarget() {
if (localScrollTarget.value !== null) {
changeScrollEvent(localScrollTarget.value);
localScrollTarget.value = null;
}
}
const noParentEventWatcher = watch(() => props.noParentEvent, () => {
if (localScrollTarget.value !== null) {
unconfigureScrollTarget();
configureScrollTarget();
}
});
onBeforeUnmount(noParentEventWatcher);
return {
localScrollTarget,
unconfigureScrollTarget,
changeScrollEvent
};
}
const useModelToggleProps = {
modelValue: {
type: Boolean,
default: null
},
"onUpdate:modelValue": [Function, Array]
};
const useModelToggleEmits = [
"beforeShow",
"show",
"beforeHide",
"hide"
];
function useModelToggle({
showing,
canShow,
// optional
hideOnRouteChange,
// optional
handleShow,
// optional
handleHide,
// optional
processOnMount
// optional
}) {
const vm = getCurrentInstance();
const { props, emit, proxy } = vm;
let payload;
function toggle(evt) {
if (showing.value === true) {
hide(evt);
} else {
show(evt);
}
}
function show(evt) {
if (props.disable === true || evt !== void 0 && evt.qAnchorHandled === true || canShow !== void 0 && canShow(evt) !== true) {
return;
}
const listener = props["onUpdate:modelValue"] !== void 0;
if (listener === true && true) {
emit("update:modelValue", true);
payload = evt;
nextTick(() => {
if (payload === evt) {
payload = void 0;
}
});
}
if (props.modelValue === null || listener === false || false) {
processShow(evt);
}
}
function processShow(evt) {
if (showing.value === true) {
return;
}
showing.value = true;
emit("beforeShow", evt);
if (handleShow !== void 0) {
handleShow(evt);
} else {
emit("show", evt);
}
}
function hide(evt) {
if (props.disable === true) {
return;
}
const listener = props["onUpdate:modelValue"] !== void 0;
if (listener === true && true) {
emit("update:modelValue", false);
payload = evt;
nextTick(() => {
if (payload === evt) {
payload = void 0;
}
});
}
if (props.modelValue === null || listener === false || false) {
processHide(evt);
}
}
function processHide(evt) {
if (showing.value === false) {
return;
}
showing.value = false;
emit("beforeHide", evt);
if (handleHide !== void 0) {
handleHide(evt);
} else {
emit("hide", evt);
}
}
function processModelChange(val) {
if (props.disable === true && val === true) {
if (props["onUpdate:modelValue"] !== void 0) {
emit("update:modelValue", false);
}
} else if (val === true !== showing.value) {
const fn = val === true ? processShow : processHide;
fn(payload);
}
}
watch(() => props.modelValue, processModelChange);
if (hideOnRouteChange !== void 0 && vmHasRouter(vm) === true) {
watch(() => proxy.$route.fullPath, () => {
if (hideOnRouteChange.value === true && showing.value === true) {
hide();
}
});
}
processOnMount === true && onMounted(() => {
processModelChange(props.modelValue);
});
const publicMethods = { show, hide, toggle };
Object.assign(proxy, publicMethods);
return publicMethods;
}
const globalConfig = {};
let portalIndex = 1;
let target = document.body;
function createGlobalNode(id, portalType) {
const el = document.createElement("div");
el.id = portalType !== void 0 ? `q-portal--${portalType}--${portalIndex++}` : id;
if (globalConfig.globalNodes !== void 0) {
const cls = globalConfig.globalNodes.class;
if (cls !== void 0) {
el.className = cls;
}
}
target.appendChild(el);
return el;
}
function removeGlobalNode(el) {
el.remove();
}
const portalProxyList = [];
function closePortalMenus(proxy, evt) {
do {
if (proxy.$options.name === "QMenu") {
proxy.hide(evt);
if (proxy.$props.separateClosePopup === true) {
return getParentProxy(proxy);
}
} else if (proxy.__qPortal === true) {
const parent = getParentProxy(proxy);
if (parent !== void 0 && parent.$options.name === "QPopupProxy") {
proxy.hide(evt);
return parent;
} else {
return proxy;
}
}
proxy = getParentProxy(proxy);
} while (proxy !== void 0 && proxy !== null);
}
const QPortal = createComponent({
name: "QPortal",
setup(_, { slots }) {
return () => slots.default();
}
});
function isOnGlobalDialog(vm) {
vm = vm.parent;
while (vm !== void 0 && vm !== null) {
if (vm.type.name === "QGlobalDialog") {
return true;
}
if (vm.type.name === "QDialog" || vm.type.name === "QMenu") {
return false;
}
vm = vm.parent;
}
return false;
}
function usePortal(vm, innerRef, renderPortalContent, type) {
const portalIsActive = ref(false);
const portalIsAccessible = ref(false);
let portalEl = null;
const focusObj = {};
const onGlobalDialog = type === "dialog" && isOnGlobalDialog(vm);
function showPortal(isReady) {
if (isReady === true) {
removeFocusWaitFlag(focusObj);
portalIsAccessible.value = true;
return;
}
portalIsAccessible.value = false;
if (portalIsActive.value === false) {
if (onGlobalDialog === false && portalEl === null) {
portalEl = createGlobalNode(false, type);
}
portalIsActive.value = true;
portalProxyList.push(vm.proxy);
addFocusWaitFlag(focusObj);
}
}
function hidePortal(isReady) {
portalIsAccessible.value = false;
if (isReady !== true) return;
removeFocusWaitFlag(focusObj);
portalIsActive.value = false;
const index = portalProxyList.indexOf(vm.proxy);
if (index !== -1) {
portalProxyList.splice(index, 1);
}
if (portalEl !== null) {
removeGlobalNode(portalEl);
portalEl = null;
}
}
onUnmounted(() => {
hidePortal(true);
});
vm.proxy.__qPortal = true;
injectProp(vm.proxy, "contentEl", () => innerRef.value);
return {
showPortal,
hidePortal,
portalIsActive,
portalIsAccessible,
renderPortal: () => onGlobalDialog === true ? renderPortalContent() : portalIsActive.value === true ? [h(Teleport, { to: portalEl }, h(QPortal, renderPortalContent))] : void 0
};
}
const useTransitionProps = {
transitionShow: {
type: String,
default: "fade"
},
transitionHide: {
type: String,
default: "fade"
},
transitionDuration: {
type: [String, Number],
default: 300
}
};
function useTransition(props, defaultShowFn = () => {
}, defaultHideFn = () => {
}) {
return {
transitionProps: computed(() => {
const show = `q-transition--${props.transitionShow || defaultShowFn()}`;
const hide = `q-transition--${props.transitionHide || defaultHideFn()}`;
return {
appear: true,
enterFromClass: `${show}-enter-from`,
enterActiveClass: `${show}-enter-active`,
enterToClass: `${show}-enter-to`,
leaveFromClass: `${hide}-leave-from`,
leaveActiveClass: `${hide}-leave-active`,
leaveToClass: `${hide}-leave-to`
};
}),
transitionStyle: computed(() => `--q-transition-duration: ${props.transitionDuration}ms`)
};
}
function useTick() {
let tickFn;
const vm = getCurrentInstance();
function removeTick() {
tickFn = void 0;
}
onDeactivated(removeTick);
onBeforeUnmount(removeTick);
return {
removeTick,
registerTick(fn) {
tickFn = fn;
nextTick(() => {
if (tickFn === fn) {
vmIsDestroyed(vm) === false && tickFn();
tickFn = void 0;
}
});
}
};
}
function useTimeout() {
let timer = null;
const vm = getCurrentInstance();
function removeTimeout() {
if (timer !== null) {
clearTimeout(timer);
timer = null;
}
}
onDeactivated(removeTimeout);
onBeforeUnmount(removeTimeout);
return {
removeTimeout,
registerTimeout(fn, delay) {
removeTimeout();
if (vmIsDestroyed(vm) === false) {
timer = setTimeout(() => {
timer = null;
fn();
}, delay);
}
}
};
}
const scrollTargetProp = [Element, String];
const scrollTargets = [null, document, document.body, document.scrollingElement, document.documentElement];
function getScrollTarget(el, targetEl) {
let target2 = getElement(targetEl);
if (target2 === void 0) {
if (el === void 0 || el === null) {
return window;
}
target2 = el.closest(".scroll,.scroll-y,.overflow-auto");
}
return scrollTargets.includes(target2) ? window : target2;
}
function getVerticalScrollPosition(scrollTarget) {
return scrollTarget === window ? window.pageYOffset || window.scrollY || document.body.scrollTop || 0 : scrollTarget.scrollTop;
}
function getHorizontalScrollPosition(scrollTarget) {
return scrollTarget === window ? window.pageXOffset || window.scrollX || document.body.scrollLeft || 0 : scrollTarget.scrollLeft;
}
let size;
function getScrollbarWidth() {
if (size !== void 0) {
return size;
}
const inner = document.createElement("p"), outer = document.createElement("div");
css(inner, {
width: "100%",
height: "200px"
});
css(outer, {
position: "absolute",
top: "0px",
left: "0px",
visibility: "hidden",
width: "200px",
height: "150px",
overflow: "hidden"
});
outer.appendChild(inner);
document.body.appendChild(outer);
const w1 = inner.offsetWidth;
outer.style.overflow = "scroll";
let w2 = inner.offsetWidth;
if (w1 === w2) {
w2 = outer.clientWidth;
}
outer.remove();
size = w1 - w2;
return size;
}
function hasScrollbar(el, onY = true) {
if (!el || el.nodeType !== Node.ELEMENT_NODE) {
return false;
}
return onY ? el.scrollHeight > el.clientHeight && (el.classList.contains("scroll") || el.classList.contains("overflow-auto") || ["auto", "scroll"].includes(window.getComputedStyle(el)["overflow-y"])) : el.scrollWidth > el.clientWidth && (el.classList.contains("scroll") || el.classList.contains("overflow-auto") || ["auto", "scroll"].includes(window.getComputedStyle(el)["overflow-x"]));
}
const handlers$1 = [];
let escDown;
function onKeydown(evt) {
escDown = evt.keyCode === 27;
}
function onBlur() {
if (escDown === true) {
escDown = false;
}
}
function onKeyup(evt) {
if (escDown === true) {
escDown = false;
if (isKeyCode(evt, 27) === true) {
handlers$1[handlers$1.length - 1](evt);
}
}
}
function update(action) {
window[action]("keydown", onKeydown);
window[action]("blur", onBlur);
window[action]("keyup", onKeyup);
escDown = false;
}
function addEscapeKey(fn) {
if (client.is.desktop === true) {
handlers$1.push(fn);
if (handlers$1.length === 1) {
update("addEventListener");
}
}
}
function removeEscapeKey(fn) {
const index = handlers$1.indexOf(fn);
if (index !== -1) {
handlers$1.splice(index, 1);
if (handlers$1.length === 0) {
update("removeEventListener");
}
}
}
const handlers = [];
function trigger(e) {
handlers[handlers.length - 1](e);
}
function addFocusout(fn) {
if (client.is.desktop === true) {
handlers.push(fn);
if (handlers.length === 1) {
document.body.addEventListener("focusin", trigger);
}
}
}
function removeFocusout(fn) {
const index = handlers.indexOf(fn);
if (index !== -1) {
handlers.splice(index, 1);
if (handlers.length === 0) {
document.body.removeEventListener("focusin", trigger);
}
}
}
const { notPassiveCapture } = listenOpts, registeredList = [];
function globalHandler(evt) {
const target2 = evt.target;
if (target2 === void 0 || target2.nodeType === 8 || target2.classList.contains("no-pointer-events") === true) {
return;
}
let portalIndex2 = portalProxyList.length - 1;
while (portalIndex2 >= 0) {
const proxy = portalProxyList[portalIndex2].$;
if (proxy.type.name === "QTooltip") {
portalIndex2--;
continue;
}
if (proxy.type.name !== "QDialog") {
break;
}
if (proxy.props.seamless !== true) {
return;
}
portalIndex2--;
}
for (let i = registeredList.length - 1; i >= 0; i--) {
const state = registeredList[i];
if ((state.anchorEl.value === null || state.anchorEl.value.contains(target2) === false) && (target2 === document.body || state.innerRef.value !== null && state.innerRef.value.contains(target2) === false)) {
evt.qClickOutside = true;
state.onClickOutside(evt);
} else {
return;
}
}
}
function addClickOutside(clickOutsideProps) {
registeredList.push(clickOutsideProps);
if (registeredList.length === 1) {
document.addEventListener("mousedown", globalHandler, notPassiveCapture);
document.addEventListener("touchstart", globalHandler, notPassiveCapture);
}
}
function removeClickOutside(clickOutsideProps) {
const index = registeredList.findIndex((h2) => h2 === clickOutsideProps);
if (index !== -1) {
registeredList.splice(index, 1);
if (registeredList.length === 0) {
document.removeEventListener("mousedown", globalHandler, notPassiveCapture);
document.removeEventListener("touchstart", globalHandler, notPassiveCapture);
}
}
}
let vpLeft, vpTop;
function validatePosition(pos) {
const parts = pos.split(" ");
if (parts.length !== 2) {
return false;
}
if (["top", "center", "bottom"].includes(parts[0]) !== true) {
console.error("Anchor/Self position must start with one of top/center/bottom");
return false;
}
if (["left", "middle", "right", "start", "end"].includes(parts[1]) !== true) {
console.error("Anchor/Self position must end with one of left/middle/right/start/end");
return false;
}
return true;
}
function validateOffset(val) {
if (!val) {
return true;
}
if (val.length !== 2) {
return false;
}
if (typeof val[0] !== "number" || typeof val[1] !== "number") {
return false;
}
return true;
}
const horizontalPos = {
"start#ltr": "left",
"start#rtl": "right",
"end#ltr": "right",
"end#rtl": "left"
};
["left", "middle", "right"].forEach((pos) => {
horizontalPos[`${pos}#ltr`] = pos;
horizontalPos[`${pos}#rtl`] = pos;
});
function parsePosition(pos, rtl) {
const parts = pos.split(" ");
return {
vertical: parts[0],
horizontal: horizontalPos[`${parts[1]}#${rtl === true ? "rtl" : "ltr"}`]
};
}
function getAnchorProps(el, offset) {
let { top, left, right, bottom, width, height } = el.getBoundingClientRect();
if (offset !== void 0) {
top -= offset[1];
left -= offset[0];
bottom += offset[1];
right += offset[0];
width += offset[0];
height += offset[1];
}
return {
top,
bottom,
height,
left,
right,
width,
middle: left + (right - left) / 2,
center: top + (bottom - top) / 2
};
}
function getAbsoluteAnchorProps(el, absoluteOffset, offset) {
let { top, left } = el.getBoundingClientRect();
top += absoluteOffset.top;
left += absoluteOffset.left;
if (offset !== void 0) {
top += offset[1];
left += offset[0];
}
return {
top,
bottom: top + 1,
height: 1,
left,
right: left + 1,
width: 1,
middle: left,
center: top
};
}
function getTargetProps(width, height) {
return {
top: 0,
center: height / 2,
bottom: height,
left: 0,
middle: width / 2,
right: width
};
}
function getTopLeftProps(anchorProps, targetProps, anchorOrigin, selfOrigin) {
return {
top: anchorProps[anchorOrigin.vertical] - targetProps[selfOrigin.vertical],
left: anchorProps[anchorOrigin.horizontal] - targetProps[selfOrigin.horizontal]
};
}
function setPosition(cfg, retryNumber = 0) {
if (cfg.targetEl === null || cfg.anchorEl === null || retryNumber > 5) {
return;
}
if (cfg.targetEl.offsetHeight === 0 || cfg.targetEl.offsetWidth === 0) {
setTimeout(() => {
setPosition(cfg, retryNumber + 1);
}, 10);
return;
}
const {
targetEl,
offset,
anchorEl,
anchorOrigin,
selfOrigin,
absoluteOffset,
fit,
cover,
maxHeight,
maxWidth
} = cfg;
if (client.is.ios === true && window.visualViewport !== void 0) {
const el = document.body.style;
const { offsetLeft: left, offsetTop: top } = window.visualViewport;
if (left !== vpLeft) {
el.setProperty("--q-pe-left", left + "px");
vpLeft = left;
}
if (top !== vpTop) {
el.setProperty("--q-pe-top", top + "px");
vpTop = top;
}
}
const { scrollLeft, scrollTop } = targetEl;
const anchorProps = absoluteOffset === void 0 ? getAnchorProps(anchorEl, cover === true ? [0, 0] : offset) : getAbsoluteAnchorProps(anchorEl, absoluteOffset, offset);
Object.assign(targetEl.style, {
top: 0,
left: 0,
minWidth: null,
minHeight: null,
maxWidth,
maxHeight,
visibility: "visible"
});
const { offsetWidth: origElWidth, offsetHeight: origElHeight } = targetEl;
const { elWidth, elHeight } = fit === true || cover === true ? { elWidth: Math.max(anchorProps.width, origElWidth), elHeight: cover === true ? Math.max(anchorProps.height, origElHeight) : origElHeight } : { elWidth: origElWidth, elHeight: origElHeight };
let elStyle = { maxWidth, maxHeight };
if (fit === true || cover === true) {
elStyle.minWidth = anchorProps.width + "px";
if (cover === true) {
elStyle.minHeight = anchorProps.height + "px";
}
}
Object.assign(targetEl.style, elStyle);
const targetProps = getTargetProps(elWidth, elHeight);
let props = getTopLeftProps(anchorProps, targetProps, anchorOrigin, selfOrigin);
if (absoluteOffset === void 0 || offset === void 0) {
applyBoundaries(props, anchorProps, targetProps, anchorOrigin, selfOrigin);
} else {
const { top, left } = props;
applyBoundaries(props, anchorProps, targetProps, anchorOrigin, selfOrigin);
let hasChanged = false;
if (props.top !== top) {
hasChanged = true;
const offsetY = 2 * offset[1];
anchorProps.center = anchorProps.top -= offsetY;
anchorProps.bottom -= offsetY + 2;
}
if (props.left !== left) {
hasChanged = true;
const offsetX = 2 * offset[0];
anchorProps.middle = anchorProps.left -= offsetX;
anchorProps.right -= offsetX + 2;
}
if (hasChanged === true) {
props = getTopLeftProps(anchorProps, targetProps, anchorOrigin, selfOrigin);
applyBoundaries(props, anchorProps, targetProps, anchorOrigin, selfOrigin);
}
}
elStyle = {
top: props.top + "px",
left: props.left + "px"
};
if (props.maxHeight !== void 0) {
elStyle.maxHeight = props.maxHeight + "px";
if (anchorProps.height > props.maxHeight) {
elStyle.minHeight = elStyle.maxHeight;
}
}
if (props.maxWidth !== void 0) {
elStyle.maxWidth = props.maxWidth + "px";
if (anchorProps.width > props.maxWidth) {
elStyle.minWidth = elStyle.maxWidth;
}
}
Object.assign(targetEl.style, elStyle);
if (targetEl.scrollTop !== scrollTop) {
targetEl.scrollTop = scrollTop;
}
if (targetEl.scrollLeft !== scrollLeft) {
targetEl.scrollLeft = scrollLeft;
}
}
function applyBoundaries(props, anchorProps, targetProps, anchorOrigin, selfOrigin) {
const currentHeight = targetProps.bottom, currentWidth = targetProps.right, margin = getScrollbarWidth(), innerHeight = window.innerHeight - margin, innerWidth = document.body.clientWidth;
if (props.top < 0 || props.top + currentHeight > innerHeight) {
if (selfOrigin.vertical === "center") {
props.top = anchorProps[anchorOrigin.vertical] > innerHeight / 2 ? Math.max(0, innerHeight - currentHeight) : 0;
props.maxHeight = Math.min(currentHeight, innerHeight);
} else if (anchorProps[anchorOrigin.vertical] > innerHeight / 2) {
const anchorY = Math.min(
innerHeight,
anchorOrigin.vertical === "center" ? anchorProps.center : anchorOrigin.vertical === selfOrigin.vertical ? anchorProps.bottom : anchorProps.top
);
props.maxHeight = Math.min(currentHeight, anchorY);
props.top = Math.max(0, anchorY - currentHeight);
} else {
props.top = Math.max(
0,
anchorOrigin.vertical === "center" ? anchorProps.center : anchorOrigin.vertical === selfOrigin.vertical ? anchorProps.top : anchorProps.bottom
);
props.maxHeight = Math.min(currentHeight, innerHeight - props.top);
}
}
if (props.left < 0 || props.left + currentWidth > innerWidth) {
props.maxWidth = Math.min(currentWidth, innerWidth);
if (selfOrigin.horizontal === "middle") {
props.left = anchorProps[anchorOrigin.horizontal] > innerWidth / 2 ? Math.max(0, innerWidth - currentWidth) : 0;
} else if (anchorProps[anchorOrigin.horizontal] > innerWidth / 2) {
const anchorX = Math.min(
innerWidth,
anchorOrigin.horizontal === "middle" ? anchorProps.middle : anchorOrigin.horizontal === selfOrigin.horizontal ? anchorProps.right : anchorProps.left
);
props.maxWidth = Math.min(currentWidth, anchorX);
props.left = Math.max(0, anchorX - props.maxWidth);
} else {
props.left = Math.max(
0,
anchorOrigin.horizontal === "middle" ? anchorProps.middle : anchorOrigin.horizontal === selfOrigin.horizontal ? anchorProps.left : anchorProps.right
);
props.maxWidth = Math.min(currentWidth, innerWidth - props.left);
}
}
}
const QMenu = createComponent({
name: "QMenu",
inheritAttrs: false,
props: {
...useAnchorProps,
...useModelToggleProps,
...useDarkProps,
...useTransitionProps,
persistent: Boolean,
autoClose: Boolean,
separateClosePopup: Boolean,
noRouteDismiss: Boolean,
noRefocus: Boolean,
noFocus: Boolean,
fit: Boolean,
cover: Boolean,
square: Boolean,
anchor: {
type: String,
validator: validatePosition
},
self: {
type: String,
validator: validatePosition
},
offset: {
type: Array,
validator: validateOffset
},
scrollTarget: scrollTargetProp,
touchPosition: Boolean,
maxHeight: {
type: String,
default: null
},
maxWidth: {
type: String,
default: null
}
},
emits: [
...useModelToggleEmits,
"click",
"escapeKey"
],
setup(props, { slots, emit, attrs }) {
let refocusTarget = null, absoluteOffset, unwatchPosition, avoidAutoClose;
const vm = getCurrentInstance();
const { proxy } = vm;
const { $q } = proxy;
const innerRef = ref(null);
const showing = ref(false);
const hideOnRouteChange = computed(
() => props.persistent !== true && props.noRouteDismiss !== true
);
const isDark = useDark(props, $q);
const { registerTick, removeTick } = useTick();
const { registerTimeout } = useTimeout();
const { transitionProps, transitionStyle } = useTransition(props);
const { localScrollTarget, changeScrollEvent, unconfigureScrollTarget } = useScrollTarget(props, configureScrollTarget);
const { anchorEl, canShow } = useAnchor({ showing });
const { hide } = useModelToggle({
showing,
canShow,
handleShow,
handleHide,
hideOnRouteChange,
processOnMount: true
});
const { showPortal, hidePortal, renderPortal } = usePortal(vm, innerRef, renderPortalContent, "menu");
const clickOutsideProps = {
anchorEl,
innerRef,
onClickOutside(e) {
if (props.persistent !== true && showing.value === true) {
hide(e);
if (
// always prevent touch event
e.type === "touchstart" || e.target.classList.contains("q-dialog__backdrop")
) {
stopAndPrevent(e);
}
return true;
}
}
};
const anchorOrigin = computed(
() => parsePosition(
props.anchor || (props.cover === true ? "center middle" : "bottom start"),
$q.lang.rtl
)
);
const selfOrigin = computed(() => props.cover === true ? anchorOrigin.value : parsePosition(props.self || "top start", $q.lang.rtl));
const menuClass = computed(
() => (props.square === true ? " q-menu--square" : "") + (isDark.value === true ? " q-menu--dark q-dark" : "")
);
const onEvents = computed(() => props.autoClose === true ? { onClick: onAutoClose } : {});
const handlesFocus = computed(
() => showing.value === true && props.persistent !== true
);
watch(handlesFocus, (val) => {
if (val === true) {
addEscapeKey(onEscapeKey);
addClickOutside(clickOutsideProps);
} else {
removeEscapeKey(onEscapeKey);
removeClickOutside(clickOutsideProps);
}
});
function focus() {
addFocusFn(() => {
let node = innerRef.value;
if (node && node.contains(document.activeElement) !== true) {
node = node.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]") || node.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]") || node.querySelector("[autofocus], [data-autofocus]") || node;
node.focus({ preventScroll: true });
}
});
}
function handleShow(evt) {
refocusTarget = props.noRefocus === false ? document.activeElement : null;
addFocusout(onFocusout);
showPortal();
configureScrollTarget();
absoluteOffset = void 0;
if (evt !== void 0 && (props.touchPosition || props.contextMenu)) {
const pos = position(evt);
if (pos.left !== void 0) {
const { top, left } = anchorEl.value.getBoundingClientRect();
absoluteOffset = { left: pos.left - left, top: pos.top - top };
}
}
if (unwatchPosition === void 0) {
unwatchPosition = watch(
() => $q.screen.width + "|" + $q.screen.height + "|" + props.self + "|" + props.anchor + "|" + $q.lang.rtl,
updatePosition
);
}
if (props.noFocus !== true) {
document.activeElement.blur();
}
registerTick(() => {
updatePosition();
props.noFocus !== true && focus();
});
registerTimeout(() => {
if ($q.platform.is.ios === true) {
avoidAutoClose = props.autoClose;
innerRef.value.click();
}
updatePosition();
showPortal(true);
emit("show", evt);
}, props.transitionDuration);
}
function handleHide(evt) {
removeTick();
hidePortal();
anchorCleanup(true);
if (refocusTarget !== null && // menu was hidden from code or ESC plugin
(evt === void 0 || evt.qClickOutside !== true)) {
((evt && evt.type.indexOf("key") === 0 ? refocusTarget.closest('[tabindex]:not([tabindex^="-"])') : void 0) || refocusTarget).focus();
refocusTarget = null;
}
registerTimeout(() => {
hidePortal(true);
emit("hide", evt);
}, props.transitionDuration);
}
function anchorCleanup(hiding) {
absoluteOffset = void 0;
if (unwatchPosition !== void 0) {
unwatchPosition();
unwatchPosition = void 0;
}
if (hiding === true || showing.value === true) {
removeFocusout(onFocusout);
unconfigureScrollTarget();
removeClickOutside(clickOutsideProps);
removeEscapeKey(onEscapeKey);
}
if (hiding !== true) {
refocusTarget = null;
}
}
function configureScrollTarget() {
if (anchorEl.value !== null || props.scrollTarget !== void 0) {
localScrollTarget.value = getScrollTarget(anchorEl.value, props.scrollTarget);
changeScrollEvent(localScrollTarget.value, updatePosition);
}
}
function onAutoClose(e) {
if (avoidAutoClose !== true) {
closePortalMenus(proxy, e);
emit("click", e);
} else {
avoidAutoClose = false;
}
}
function onFocusout(evt) {
if (handlesFocus.value === true && props.noFocus !== true && childHasFocus(innerRef.value, evt.target) !== true) {
focus();
}
}
function onEscapeKey(evt) {
emit("escapeKey");
hide(evt);
}
function updatePosition() {
setPosition({
targetEl: innerRef.value,
offset: props.offset,
anchorEl: anchorEl.value,
anchorOrigin: anchorOrigin.value,
selfOrigin: selfOrigin.value,
absoluteOffset,
fit: props.fit,
cover: props.cover,
maxHeight: props.maxHeight,
maxWidth: props.maxWidth
});
}
function renderPortalContent() {
return h(
Transition,
transitionProps.value,
() => showing.value === true ? h("div", {
role: "menu",
...attrs,
ref: innerRef,
tabindex: -1,
class: [
"q-menu q-position-engine scroll" + menuClass.value,
attrs.class
],
style: [
attrs.style,
transitionStyle.value
],
...onEvents.value
}, hSlot(slots.default)) : null
);
}
onBeforeUnmount(anchorCleanup);
Object.assign(proxy, { focus, updatePosition });
return renderPortal;
}
});
function useHistory(showing, hide, hideOnRouteChange) {
function removeFromHistory() {
}
onBeforeUnmount(() => {
showing.value === true && removeFromHistory();
});
return {
removeFromHistory,
addToHistory() {
}
};
}
let registered = 0, scrollPositionX, scrollPositionY, maxScrollTop, vpPendingUpdate = false, bodyLeft, bodyTop, href, closeTimer = null;
function onWheel(e) {
if (shouldPreventScroll(e)) {
stopAndPrevent(e);
}
}
function shouldPreventScroll(e) {
if (e.target === document.body || e.target.classList.contains("q-layout__backdrop")) {
return true;
}
const path = getEventPath(e), shift = e.shiftKey && !e.deltaX, scrollY = !shift && Math.abs(e.deltaX) <= Math.abs(e.deltaY), delta = shift || scrollY ? e.deltaY : e.deltaX;
for (let index = 0; index < path.length; index++) {
const el = path[index];
if (hasScrollbar(el, scrollY)) {
return scrollY ? delta < 0 && el.scrollTop === 0 ? true : delta > 0 && el.scrollTop + el.clientHeight === el.scrollHeight : delta < 0 && el.scrollLeft === 0 ? true : delta > 0 && el.scrollLeft + el.clientWidth === el.scrollWidth;
}
}
return true;
}
function onAppleScroll(e) {
if (e.target === document) {
document.scrollingElement.scrollTop = document.scrollingElement.scrollTop;
}
}
function onAppleResize(evt) {
if (vpPendingUpdate === true) {
return;
}
vpPendingUpdate = true;
requestAnimationFrame(() => {
vpPendingUpdate = false;
const { height } = evt.target, { clientHeight, scrollTop } = document.scrollingElement;
if (maxScrollTop === void 0 || height !== window.innerHeight) {
maxScrollTop = clientHeight - height;
document.scrollingElement.scrollTop = scrollTop;
}
if (scrollTop > maxScrollTop) {
document.scrollingElement.scrollTop -= Math.ceil((scrollTop - maxScrollTop) / 8);
}
});
}
function apply(action) {
const body = document.body, hasViewport = window.visualViewport !== void 0;
if (action === "add") {
const { overflowY, overflowX } = window.getComputedStyle(body);
scrollPositionX = getHorizontalScrollPosition(window);
scrollPositionY = getVerticalScrollPosition(window);
bodyLeft = body.style.left;
bodyTop = body.style.top;
href = window.location.href;
body.style.left = `-${scrollPositionX}px`;
body.style.top = `-${scrollPositionY}px`;
if (overflowX !== "hidden" && (overflowX === "scroll" || body.scrollWidth > window.innerWidth)) {
body.classList.add("q-body--force-scrollbar-x");
}
if (overflowY !== "hidden" && (overflowY === "scroll" || body.scrollHeight > window.innerHeight)) {
body.classList.add("q-body--force-scrollbar-y");
}
body.classList.add("q-body--prevent-scroll");
document.qScrollPrevented = true;
if (client.is.ios === true) {
if (hasViewport === true) {
window.scrollTo(0, 0);
window.visualViewport.addEventListener("resize", onAppleResize, listenOpts.passiveCapture);
window.visualViewport.addEventListener("scroll", onAppleResize, listenOpts.passiveCapture);
window.scrollTo(0, 0);
} else {
window.addEventListener("scroll", onAppleScroll, listenOpts.passiveCapture);
}
}
}
if (client.is.desktop === true && client.is.mac === true) {
window[`${action}EventListener`]("wheel", onWheel, listenOpts.notPassive);
}
if (action === "remove") {
if (client.is.ios === true) {
if (hasViewport === true) {
window.visualViewport.removeEventListener("resize", onAppleResize, listenOpts.passiveCapture);
window.visualViewport.removeEventListener("scroll", onAppleResize, listenOpts.passiveCapture);
} else {
window.removeEventListener("scroll", onAppleScroll, listenOpts.passiveCapture);
}
}
body.classList.remove("q-body--prevent-scroll");
body.classList.remove("q-body--force-scrollbar-x");
body.classList.remove("q-body--force-scrollbar-y");
document.qScrollPrevented = false;
body.style.left = bodyLeft;
body.style.top = bodyTop;
if (window.location.href === href) {
window.scrollTo(scrollPositionX, scrollPositionY);
}
maxScrollTop = void 0;
}
}
function preventScroll(state) {
let action = "add";
if (state === true) {
registered++;
if (closeTimer !== null) {
clearTimeout(closeTimer);
closeTimer = null;
return;
}
if (registered > 1) {
return;
}
} else {
if (registered === 0) {
return;
}
registered--;
if (registered > 0) {
return;
}
action = "remove";
if (client.is.ios === true && client.is.nativeMobile === true) {
closeTimer !== null && clearTimeout(closeTimer);
closeTimer = setTimeout(() => {
apply(action);
closeTimer = null;
}, 100);
return;
}
}
apply(action);
}
function usePreventScroll() {
let currentState;
return {
preventBodyScroll(state) {
if (state !== currentState && (currentState !== void 0 || state === true)) {
currentState = state;
preventScroll(state);
}
}
};
}
let maximizedModals = 0;
const positionClass = {
standard: "fixed-full flex-center",
top: "fixed-top justify-center",
bottom: "fixed-bottom justify-center",
right: "fixed-right items-center",
left: "fixed-left items-center"
};
const defaultTransitions = {
standard: ["scale", "scale"],
top: ["slide-down", "slide-up"],
bottom: ["slide-up", "slide-down"],
right: ["slide-left", "slide-right"],
left: ["slide-right", "slide-left"]
};
const QDialog = createComponent({
name: "QDialog",
inheritAttrs: false,
props: {
...useModelToggleProps,
...useTransitionProps,
transitionShow: String,
// override useTransitionProps
transitionHide: String,
// override useTransitionProps
persistent: Boolean,
autoClose: Boolean,
allowFocusOutside: Boolean,
noEscDismiss: Boolean,
noBackdropDismiss: Boolean,
noRouteDismiss: Boolean,
noRefocus: Boolean,
noFocus: Boolean,
noShake: Boolean,
seamless: Boolean,
maximized: Boolean,
fullWidth: Boolean,
fullHeight: Boolean,
square: Boolean,
backdropFilter: String,
position: {
type: String,
default: "standard",
validator: (val) => ["standard", "top", "bottom", "left", "right"].includes(val)
}
},
emits: [
...useModelToggleEmits,
"shake",
"click",
"escapeKey"
],
setup(props, { slots, emit, attrs }) {
const vm = getCurrentInstance();
const innerRef = ref(null);
const showing = ref(false);
const animating = ref(false);
let shakeTimeout = null, refocusTarget = null, isMaximized, avoidAutoClose;
const hideOnRouteChange = computed(
() => props.persistent !== true && props.noRouteDismiss !== true && props.seamless !== true
);
const { preventBodyScroll } = usePreventScroll();
const { registerTimeout } = useTimeout();
const { registerTick, removeTick } = useTick();
const { transitionProps, transitionStyle } = useTransition(
props,
() => defaultTransitions[props.position][0],
() => defaultTransitions[props.position][1]
);
const backdropStyle = computed(() => transitionStyle.value + (props.backdropFilter !== void 0 ? `;backdrop-filter:${props.backdropFilter};-webkit-backdrop-filter:${props.backdropFilter}` : ""));
const { showPortal, hidePortal, portalIsAccessible, renderPortal } = usePortal(
vm,
innerRef,
renderPortalContent,
"dialog"
);
const { hide } = useModelToggle({
showing,
hideOnRouteChange,
handleShow,
handleHide,
processOnMount: true
});
const { addToHistory, removeFromHistory } = useHistory(showing);
const classes = computed(
() => `q-dialog__inner flex no-pointer-events q-dialog__inner--${props.maximized === true ? "maximized" : "minimized"} q-dialog__inner--${props.position} ${positionClass[props.position]}` + (animating.value === true ? " q-dialog__inner--animating" : "") + (props.fullWidth === true ? " q-dialog__inner--fullwidth" : "") + (props.fullHeight === true ? " q-dialog__inner--fullheight" : "") + (props.square === true ? " q-dialog__inner--square" : "")
);
const useBackdrop = computed(() => showing.value === true && props.seamless !== true);
const onEvents = computed(() => props.autoClose === true ? { onClick: onAutoClose } : {});
const rootClasses = computed(() => [
`q-dialog fullscreen no-pointer-events q-dialog--${useBackdrop.value === true ? "modal" : "seamless"}`,
attrs.class
]);
watch(() => props.maximized, (state) => {
showing.value === true && updateMaximized(state);
});
watch(useBackdrop, (val) => {
preventBodyScroll(val);
if (val === true) {
addFocusout(onFocusChange);
addEscapeKey(onEscapeKey);
} else {
removeFocusout(onFocusChange);
removeEscapeKey(onEscapeKey);
}
});
function handleShow(evt) {
addToHistory();
refocusTarget = props.noRefocus === false && document.activeElement !== null ? document.activeElement : null;
updateMaximized(props.maximized);
showPortal();
animating.value = true;
if (props.noFocus !== true) {
document.activeElement !== null && document.activeElement.blur();
registerTick(focus);
} else {
removeTick();
}
registerTimeout(() => {
if (vm.proxy.$q.platform.is.ios === true) {
if (props.seamless !== true && document.activeElement) {
const { top, bottom } = document.activeElement.getBoundingClientRect(), { innerHeight } = window, height = window.visualViewport !== void 0 ? window.visualViewport.height : innerHeight;
if (top > 0 && bottom > height / 2) {
document.scrollingElement.scrollTop = Math.min(
document.scrollingElement.scrollHeight - height,
bottom >= innerHeight ? Infinity : Math.ceil(document.scrollingElement.scrollTop + bottom - height / 2)
);
}
document.activeElement.scrollIntoView();
}
avoidAutoClose = true;
innerRef.value.click();
avoidAutoClose = false;
}
showPortal(true);
animating.value = false;
emit("show", evt);
}, props.transitionDuration);
}
function handleHide(evt) {
removeTick();
removeFromHistory();
cleanup(true);
animating.value = true;
hidePortal();
if (refocusTarget !== null) {
((evt && evt.type.indexOf("key") === 0 ? refocusTarget.closest('[tabindex]:not([tabindex^="-"])') : void 0) || refocusTarget).focus();
refocusTarget = null;
}
registerTimeout(() => {
hidePortal(true);
animating.value = false;
emit("hide", evt);
}, props.transitionDuration);
}
function focus(selector) {
addFocusFn(() => {
let node = innerRef.value;
if (node === null) return;
if (selector !== void 0) {
const target2 = node.querySelector(selector);
if (target2 !== null) {
target2.focus({ preventScroll: true });
return;
}
}
if (node.contains(document.activeElement) !== true) {
node = node.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]") || node.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]") || node.querySelector("[autofocus], [data-autofocus]") || node;
node.focus({ preventScroll: true });
}
});
}
function shake(focusTarget) {
if (focusTarget && typeof focusTarget.focus === "function") {
focusTarget.focus({ preventScroll: true });
} else {
focus();
}
emit("shake");
const node = innerRef.value;
if (node !== null) {
node.classList.remove("q-animate--scale");
node.classList.add("q-animate--scale");
shakeTimeout !== null && clearTimeout(shakeTimeout);
shakeTimeout = setTimeout(() => {
shakeTimeout = null;
if (innerRef.value !== null) {
node.classList.remove("q-animate--scale");
focus();
}
}, 170);
}
}
function onEscapeKey() {
if (props.seamless !== true) {
if (props.persistent === true || props.noEscDismiss === true) {
props.maximized !== true && props.noShake !== true && shake();
} else {
emit("escapeKey");
hide();
}
}
}
function cleanup(hiding) {
if (shakeTimeout !== null) {
clearTimeout(shakeTimeout);
shakeTimeout = null;
}
if (hiding === true || showing.value === true) {
updateMaximized(false);
if (props.seamless !== true) {
preventBodyScroll(false);
removeFocusout(onFocusChange);
removeEscapeKey(onEscapeKey);
}
}
if (hiding !== true) {
refocusTarget = null;
}
}
function updateMaximized(active) {
if (active === true) {
if (isMaximized !== true) {
maximizedModals < 1 && document.body.classList.add("q-body--dialog");
maximizedModals++;
isMaximized = true;
}
} else if (isMaximized === true) {
if (maximizedModals < 2) {
document.body.classList.remove("q-body--dialog");
}
maximizedModals--;
isMaximized = false;
}
}
function onAutoClose(e) {
if (avoidAutoClose !== true) {
hide(e);
emit("click", e);
}
}
function onBackdropClick(e) {
if (props.persistent !== true && props.noBackdropDismiss !== true) {
hide(e);
} else if (props.noShake !== true) {
shake();
}
}
function onFocusChange(evt) {
if (props.allowFocusOutside !== true && portalIsAccessible.value === true && childHasFocus(innerRef.value, evt.target) !== true) {
focus('[tabindex]:not([tabindex="-1"])');
}
}
Object.assign(vm.proxy, {
// expose public methods
focus,
shake,
// private but needed by QSelect
__updateRefocusTarget(target2) {
refocusTarget = target2 || null;
}
});
onBeforeUnmount(cleanup);
function renderPortalContent() {
return h("div", {
role: "dialog",
"aria-modal": useBackdrop.value === true ? "true" : "false",
...attrs,
class: rootClasses.value
}, [
h(Transition, {
name: "q-transition--fade",
appear: true
}, () => useBackdrop.value === true ? h("div", {
class: "q-dialog__backdrop fixed-full",
style: backdropStyle.value,
"aria-hidden": "true",
tabindex: -1,
onClick: onBackdropClick
}) : null),
h(
Transition,
transitionProps.value,
() => showing.value === true ? h("div", {
ref: innerRef,
class: classes.value,
style: transitionStyle.value,
tabindex: -1,
...onEvents.value
}, hSlot(slots.default)) : null
)
]);
}
return renderPortal;
}
});
let rtlHasScrollBug = false;
{
const scroller = document.createElement("div");
scroller.setAttribute("dir", "rtl");
Object.assign(scroller.style, {
width: "1px",
height: "1px",
overflow: "auto"
});
const spacer = document.createElement("div");
Object.assign(spacer.style, {
width: "1000px",
height: "1px"
});
document.body.appendChild(scroller);
scroller.appendChild(spacer);
scroller.scrollLeft = -1e3;
rtlHasScrollBug = scroller.scrollLeft >= 0;
scroller.remove();
}
const aggBucketSize = 1e3;
const scrollToEdges = [
"start",
"center",
"end",
"start-force",
"center-force",
"end-force"
];
const filterProto = Array.prototype.filter;
const setOverflowAnchor = window.getComputedStyle(document.body).overflowAnchor === void 0 ? noop : function(contentEl, index) {
if (contentEl === null) {
return;
}
if (contentEl._qOverflowAnimationFrame !== void 0) {
cancelAnimationFrame(contentEl._qOverflowAnimationFrame);
}
contentEl._qOverflowAnimationFrame = requestAnimationFrame(() => {
if (contentEl === null) {
return;
}
contentEl._qOverflowAnimationFrame = void 0;
const children = contentEl.children || [];
filterProto.call(children, (el2) => el2.dataset && el2.dataset.qVsAnchor !== void 0).forEach((el2) => {
delete el2.dataset.qVsAnchor;
});
const el = children[index];
if (el && el.dataset) {
el.dataset.qVsAnchor = "";
}
});
};
function sumFn(acc, h2) {
return acc + h2;
}
function getScrollDetails(parent, child, beforeRef, afterRef, horizontal, rtl, stickyStart, stickyEnd) {
const parentCalc = parent === window ? document.scrollingElement || document.documentElement : parent, propElSize = horizontal === true ? "offsetWidth" : "offsetHeight", details = {
scrollStart: 0,
scrollViewSize: -stickyStart - stickyEnd,
scrollMaxSize: 0,
offsetStart: -stickyStart,
offsetEnd: -stickyEnd
};
if (horizontal === true) {
if (parent === window) {
details.scrollStart = window.pageXOffset || window.scrollX || document.body.scrollLeft || 0;
details.scrollViewSize += document.documentElement.clientWidth;
} else {
details.scrollStart = parentCalc.scrollLeft;
details.scrollViewSize += parentCalc.clientWidth;
}
details.scrollMaxSize = parentCalc.scrollWidth;
if (rtl === true) {
details.scrollStart = (rtlHasScrollBug === true ? details.scrollMaxSize - details.scrollViewSize : 0) - details.scrollStart;
}
} else {
if (parent === window) {
details.scrollStart = window.pageYOffset || window.scrollY || document.body.scrollTop || 0;
details.scrollViewSize += document.documentElement.clientHeight;
} else {
details.scrollStart = parentCalc.scrollTop;
details.scrollViewSize += parentCalc.clientHeight;
}
details.scrollMaxSize = parentCalc.scrollHeight;
}
if (beforeRef !== null) {
for (let el = beforeRef.previousElementSibling; el !== null; el = el.previousElementSibling) {
if (el.classList.contains("q-virtual-scroll--skip") === false) {
details.offsetStart += el[propElSize];
}
}
}
if (afterRef !== null) {
for (let el = afterRef.nextElementSibling; el !== null; el = el.nextElementSibling) {
if (el.classList.contains("q-virtual-scroll--skip") === false) {
details.offsetEnd += el[propElSize];
}
}
}
if (child !== parent) {
const parentRect = parentCalc.getBoundingClientRect(), childRect = child.getBoundingClientRect();
if (horizontal === true) {
details.offsetStart += childRect.left - parentRect.left;
details.offsetEnd -= childRect.width;
} else {
details.offsetStart += childRect.top - parentRect.top;
details.offsetEnd -= childRect.height;
}
if (parent !== window) {
details.offsetStart += details.scrollStart;
}
details.offsetEnd += details.scrollMaxSize - details.offsetStart;
}
return details;
}
function setScroll(parent, scroll, horizontal, rtl) {
if (scroll === "end") {
scroll = (parent === window ? document.body : parent)[horizontal === true ? "scrollWidth" : "scrollHeight"];
}
if (parent === window) {
if (horizontal === true) {
if (rtl === true) {
scroll = (rtlHasScrollBug === true ? document.body.scrollWidth - document.documentElement.clientWidth : 0) - scroll;
}
window.scrollTo(scroll, window.pageYOffset || window.scrollY || document.body.scrollTop || 0);
} else {
window.scrollTo(window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, scroll);
}
} else if (horizontal === true) {
if (rtl === true) {
scroll = (rtlHasScrollBug === true ? parent.scrollWidth - parent.offsetWidth : 0) - scroll;
}
parent.scrollLeft = scroll;
} else {
parent.scrollTop = scroll;
}
}
function sumSize(sizeAgg, size2, from, to) {
if (from >= to) {
return 0;
}
const lastTo = size2.length, fromAgg = Math.floor(from / aggBucketSize), toAgg = Math.floor((to - 1) / aggBucketSize) + 1;
let total = sizeAgg.slice(fromAgg, toAgg).reduce(sumFn, 0);
if (from % aggBucketSize !== 0) {
total -= size2.slice(fromAgg * aggBucketSize, from).reduce(sumFn, 0);
}
if (to % aggBucketSize !== 0 && to !== lastTo) {
total -= size2.slice(to, toAgg * aggBucketSize).reduce(sumFn, 0);
}
return total;
}
const commonVirtScrollProps = {
virtualScrollSliceSize: {
type: [Number, String],
default: 10
},
virtualScrollSliceRatioBefore: {
type: [Number, String],
default: 1
},
virtualScrollSliceRatioAfter: {
type: [Number, String],
default: 1
},
virtualScrollItemSize: {
type: [Number, String],
default: 24
},
virtualScrollStickySizeStart: {
type: [Number, String],
default: 0
},
virtualScrollStickySizeEnd: {
type: [Number, String],
default: 0
},
tableColspan: [Number, String]
};
const useVirtualScrollProps = {
virtualScrollHorizontal: Boolean,
onVirtualScroll: Function,
...commonVirtScrollProps
};
function useVirtualScroll({
virtualScrollLength,
getVirtualScrollTarget,
getVirtualScrollEl,
virtualScrollItemSizeComputed
// optional
}) {
const vm = getCurrentInstance();
const { props, emit, proxy } = vm;
const { $q } = proxy;
let prevScrollStart, prevToIndex, localScrollViewSize, virtualScrollSizesAgg = [], virtualScrollSizes;
const virtualScrollPaddingBefore = ref(0);
const virtualScrollPaddingAfter = ref(0);
const virtualScrollSliceSizeComputed = ref({});
const beforeRef = ref(null);
const afterRef = ref(null);
const contentRef = ref(null);
const virtualScrollSliceRange = ref({ from: 0, to: 0 });
const colspanAttr = computed(() => props.tableColspan !== void 0 ? props.tableColspan : 100);
if (virtualScrollItemSizeComputed === void 0) {
virtualScrollItemSizeComputed = computed(() => props.virtualScrollItemSize);
}
const needsReset = computed(() => virtualScrollItemSizeComputed.value + ";" + props.virtualScrollHorizontal);
const needsSliceRecalc = computed(
() => needsReset.value + ";" + props.virtualScrollSliceRatioBefore + ";" + props.virtualScrollSliceRatioAfter
);
watch(needsSliceRecalc, () => {
setVirtualScrollSize();
});
watch(needsReset, reset);
function reset() {
localResetVirtualScroll(prevToIndex, true);
}
function refresh(toIndex) {
localResetVirtualScroll(toIndex === void 0 ? prevToIndex : toIndex);
}
function scrollTo(toIndex, edge) {
const scrollEl = getVirtualScrollTarget();
if (scrollEl === void 0 || scrollEl === null || scrollEl.nodeType === 8) {
return;
}
const scrollDetails = getScrollDetails(
scrollEl,
getVirtualScrollEl(),
beforeRef.value,
afterRef.value,
props.virtualScrollHorizontal,
$q.lang.rtl,
props.virtualScrollStickySizeStart,
props.virtualScrollStickySizeEnd
);
localScrollViewSize !== scrollDetails.scrollViewSize && setVirtualScrollSize(scrollDetails.scrollViewSize);
setVirtualScrollSliceRange(
scrollEl,
scrollDetails,
Math.min(virtualScrollLength.value - 1, Math.max(0, parseInt(toIndex, 10) || 0)),
0,
scrollToEdges.indexOf(edge) !== -1 ? edge : prevToIndex !== -1 && toIndex > prevToIndex ? "end" : "start"
);
}
function localOnVirtualScrollEvt() {
const scrollEl = getVirtualScrollTarget();
if (scrollEl === void 0 || scrollEl === null || scrollEl.nodeType === 8) {
return;
}
const scrollDetails = getScrollDetails(
scrollEl,
getVirtualScrollEl(),
beforeRef.value,
afterRef.value,
props.virtualScrollHorizontal,
$q.lang.rtl,
props.virtualScrollStickySizeStart,
props.virtualScrollStickySizeEnd
), listLastIndex = virtualScrollLength.value - 1, listEndOffset = scrollDetails.scrollMaxSize - scrollDetails.offsetStart - scrollDetails.offsetEnd - virtualScrollPaddingAfter.value;
if (prevScrollStart === scrollDetails.scrollStart) {
return;
}
if (scrollDetails.scrollMaxSize <= 0) {
setVirtualScrollSliceRange(scrollEl, scrollDetails, 0, 0);
return;
}
localScrollViewSize !== scrollDetails.scrollViewSize && setVirtualScrollSize(scrollDetails.scrollViewSize);
updateVirtualScrollSizes(virtualScrollSliceRange.value.from);
const scrollMaxStart = Math.floor(scrollDetails.scrollMaxSize - Math.max(scrollDetails.scrollViewSize, scrollDetails.offsetEnd) - Math.min(virtualScrollSizes[listLastIndex], scrollDetails.scrollViewSize / 2));
if (scrollMaxStart > 0 && Math.ceil(scrollDetails.scrollStart) >= scrollMaxStart) {
setVirtualScrollSliceRange(
scrollEl,
scrollDetails,
listLastIndex,
scrollDetails.scrollMaxSize - scrollDetails.offsetEnd - virtualScrollSizesAgg.reduce(sumFn, 0)
);
return;
}
let toIndex = 0, listOffset = scrollDetails.scrollStart - scrollDetails.offsetStart, offset = listOffset;
if (listOffset <= listEndOffset && listOffset + scrollDetails.scrollViewSize >= virtualScrollPaddingBefore.value) {
listOffset -= virtualScrollPaddingBefore.value;
toIndex = virtualScrollSliceRange.value.from;
offset = listOffset;
} else {
for (let j = 0; listOffset >= virtualScrollSizesAgg[j] && toIndex < listLastIndex; j++) {
listOffset -= virtualScrollSizesAgg[j];
toIndex += aggBucketSize;
}
}
while (listOffset > 0 && toIndex < listLastIndex) {
listOffset -= virtualScrollSizes[toIndex];
if (listOffset > -scrollDetails.scrollViewSize) {
toIndex++;
offset = listOffset;
} else {
offset = virtualScrollSizes[toIndex] + listOffset;
}
}
setVirtualScrollSliceRange(
scrollEl,
scrollDetails,
toIndex,
offset
);
}
function setVirtualScrollSliceRange(scrollEl, scrollDetails, toIndex, offset, align) {
const alignForce = typeof align === "string" && align.indexOf("-force") !== -1;
const alignEnd = alignForce === true ? align.replace("-force", "") : align;
const alignRange = alignEnd !== void 0 ? alignEnd : "start";
let from = Math.max(0, toIndex - virtualScrollSliceSizeComputed.value[alignRange]), to = from + virtualScrollSliceSizeComputed.value.total;
if (to > virtualScrollLength.value) {
to = virtualScrollLength.value;
from = Math.max(0, to - virtualScrollSliceSizeComputed.value.total);
}
prevScrollStart = scrollDetails.scrollStart;
const rangeChanged = from !== virtualScrollSliceRange.value.from || to !== virtualScrollSliceRange.value.to;
if (rangeChanged === false && alignEnd === void 0) {
emitScroll(toIndex);
return;
}
const { activeElement } = document;
const contentEl = contentRef.value;
if (rangeChanged === true && contentEl !== null && contentEl !== activeElement && contentEl.contains(activeElement) === true) {
contentEl.addEventListener("focusout", onBlurRefocusFn);
setTimeout(() => {
contentEl !== null && contentEl.removeEventListener("focusout", onBlurRefocusFn);
});
}
setOverflowAnchor(contentEl, toIndex - from);
const sizeBefore = alignEnd !== void 0 ? virtualScrollSizes.slice(from, toIndex).reduce(sumFn, 0) : 0;
if (rangeChanged === true) {
const tempTo = to >= virtualScrollSliceRange.value.from && from <= virtualScrollSliceRange.value.to ? virtualScrollSliceRange.value.to : to;
virtualScrollSliceRange.value = { from, to: tempTo };
virtualScrollPaddingBefore.value = sumSize(virtualScrollSizesAgg, virtualScrollSizes, 0, from);
virtualScrollPaddingAfter.value = sumSize(virtualScrollSizesAgg, virtualScrollSizes, to, virtualScrollLength.value);
requestAnimationFrame(() => {
if (virtualScrollSliceRange.value.to !== to && prevScrollStart === scrollDetails.scrollStart) {
virtualScrollSliceRange.value = { from: virtualScrollSliceRange.value.from, to };
virtualScrollPaddingAfter.value = sumSize(virtualScrollSizesAgg, virtualScrollSizes, to, virtualScrollLength.value);
}
});
}
requestAnimationFrame(() => {
if (prevScrollStart !== scrollDetails.scrollStart) {
return;
}
if (rangeChanged === true) {
updateVirtualScrollSizes(from);
}
const sizeAfter = virtualScrollSizes.slice(from, toIndex).reduce(sumFn, 0), posStart = sizeAfter + scrollDetails.offsetStart + virtualScrollPaddingBefore.value, posEnd = posStart + virtualScrollSizes[toIndex];
let scrollPosition = posStart + offset;
if (alignEnd !== void 0) {
const sizeDiff = sizeAfter - sizeBefore;
const scrollStart = scrollDetails.scrollStart + sizeDiff;
scrollPosition = alignForce !== true && scrollStart < posStart && posEnd < scrollStart + scrollDetails.scrollViewSize ? scrollStart : alignEnd === "end" ? posEnd - scrollDetails.scrollViewSize : posStart - (alignEnd === "start" ? 0 : Math.round((scrollDetails.scrollViewSize - virtualScrollSizes[toIndex]) / 2));
}
prevScrollStart = scrollPosition;
setScroll(
scrollEl,
scrollPosition,
props.virtualScrollHorizontal,
$q.lang.rtl
);
emitScroll(toIndex);
});
}
function updateVirtualScrollSizes(from) {
const contentEl = contentRef.value;
if (contentEl) {
const children = filterProto.call(
contentEl.children,
(el) => el.classList && el.classList.contains("q-virtual-scroll--skip") === false
), childrenLength = children.length, sizeFn = props.virtualScrollHorizontal === true ? (el) => el.getBoundingClientRect().width : (el) => el.offsetHeight;
let index = from, size2, diff;
for (let i = 0; i < childrenLength; ) {
size2 = sizeFn(children[i]);
i++;
while (i < childrenLength && children[i].classList.contains("q-virtual-scroll--with-prev") === true) {
size2 += sizeFn(children[i]);
i++;
}
diff = size2 - virtualScrollSizes[index];
if (diff !== 0) {
virtualScrollSizes[index] += diff;
virtualScrollSizesAgg[Math.floor(index / aggBucketSize)] += diff;
}
index++;
}
}
}
function onBlurRefocusFn() {
contentRef.value !== null && contentRef.value !== void 0 && contentRef.value.focus();
}
function localResetVirtualScroll(toIndex, fullReset) {
const defaultSize = 1 * virtualScrollItemSizeComputed.value;
if (fullReset === true || Array.isArray(virtualScrollSizes) === false) {
virtualScrollSizes = [];
}
const oldVirtualScrollSizesLength = virtualScrollSizes.length;
virtualScrollSizes.length = virtualScrollLength.value;
for (let i = virtualScrollLength.value - 1; i >= oldVirtualScrollSizesLength; i--) {
virtualScrollSizes[i] = defaultSize;
}
const jMax = Math.floor((virtualScrollLength.value - 1) / aggBucketSize);
virtualScrollSizesAgg = [];
for (let j = 0; j <= jMax; j++) {
let size2 = 0;
const iMax = Math.min((j + 1) * aggBucketSize, virtualScrollLength.value);
for (let i = j * aggBucketSize; i < iMax; i++) {
size2 += virtualScrollSizes[i];
}
virtualScrollSizesAgg.push(size2);
}
prevToIndex = -1;
prevScrollStart = void 0;
virtualScrollPaddingBefore.value = sumSize(virtualScrollSizesAgg, virtualScrollSizes, 0, virtualScrollSliceRange.value.from);
virtualScrollPaddingAfter.value = sumSize(virtualScrollSizesAgg, virtualScrollSizes, virtualScrollSliceRange.value.to, virtualScrollLength.value);
if (toIndex >= 0) {
updateVirtualScrollSizes(virtualScrollSliceRange.value.from);
nextTick(() => {
scrollTo(toIndex);
});
} else {
onVirtualScrollEvt();
}
}
function setVirtualScrollSize(scrollViewSize) {
if (scrollViewSize === void 0 && typeof window !== "undefined") {
const scrollEl = getVirtualScrollTarget();
if (scrollEl !== void 0 && scrollEl !== null && scrollEl.nodeType !== 8) {
scrollViewSize = getScrollDetails(
scrollEl,
getVirtualScrollEl(),
beforeRef.value,
afterRef.value,
props.virtualScrollHorizontal,
$q.lang.rtl,
props.virtualScrollStickySizeStart,
props.virtualScrollStickySizeEnd
).scrollViewSize;
}
}
localScrollViewSize = scrollViewSize;
const virtualScrollSliceRatioBefore = parseFloat(props.virtualScrollSliceRatioBefore) || 0;
const virtualScrollSliceRatioAfter = parseFloat(props.virtualScrollSliceRatioAfter) || 0;
const multiplier = 1 + virtualScrollSliceRatioBefore + virtualScrollSliceRatioAfter;
const view = scrollViewSize === void 0 || scrollViewSize <= 0 ? 1 : Math.ceil(scrollViewSize / virtualScrollItemSizeComputed.value);
const baseSize = Math.max(
1,
view,
Math.ceil((props.virtualScrollSliceSize > 0 ? props.virtualScrollSliceSize : 10) / multiplier)
);
virtualScrollSliceSizeComputed.value = {
total: Math.ceil(baseSize * multiplier),
start: Math.ceil(baseSize * virtualScrollSliceRatioBefore),
center: Math.ceil(baseSize * (0.5 + virtualScrollSliceRatioBefore)),
end: Math.ceil(baseSize * (1 + virtualScrollSliceRatioBefore)),
view
};
}
function padVirtualScroll(tag, content) {
const paddingSize = props.virtualScrollHorizontal === true ? "width" : "height";
const style = {
["--q-virtual-scroll-item-" + paddingSize]: virtualScrollItemSizeComputed.value + "px"
};
return [
tag === "tbody" ? h(tag, {
class: "q-virtual-scroll__padding",
key: "before",
ref: beforeRef
}, [
h("tr", [
h("td", {
style: { [paddingSize]: `${virtualScrollPaddingBefore.value}px`, ...style },
colspan: colspanAttr.value
})
])
]) : h(tag, {
class: "q-virtual-scroll__padding",
key: "before",
ref: beforeRef,
style: { [paddingSize]: `${virtualScrollPaddingBefore.value}px`, ...style }
}),
h(tag, {
class: "q-virtual-scroll__content",
key: "content",
ref: contentRef,
tabindex: -1
}, content.flat()),
tag === "tbody" ? h(tag, {
class: "q-virtual-scroll__padding",
key: "after",
ref: afterRef
}, [
h("tr", [
h("td", {
style: { [paddingSize]: `${virtualScrollPaddingAfter.value}px`, ...style },
colspan: colspanAttr.value
})
])
]) : h(tag, {
class: "q-virtual-scroll__padding",
key: "after",
ref: afterRef,
style: { [paddingSize]: `${virtualScrollPaddingAfter.value}px`, ...style }
})
];
}
function emitScroll(index) {
if (prevToIndex !== index) {
props.onVirtualScroll !== void 0 && emit("virtualScroll", {
index,
from: virtualScrollSliceRange.value.from,
to: virtualScrollSliceRange.value.to - 1,
direction: index < prevToIndex ? "decrease" : "increase",
ref: proxy
});
prevToIndex = index;
}
}
setVirtualScrollSize();
const onVirtualScrollEvt = debounce(
localOnVirtualScrollEvt,
$q.platform.is.ios === true ? 120 : 35
);
onBeforeMount(() => {
setVirtualScrollSize();
});
let shouldActivate = false;
onDeactivated(() => {
shouldActivate = true;
});
onActivated(() => {
if (shouldActivate !== true) return;
const scrollEl = getVirtualScrollTarget();
if (prevScrollStart !== void 0 && scrollEl !== void 0 && scrollEl !== null && scrollEl.nodeType !== 8) {
setScroll(
scrollEl,
prevScrollStart,
props.virtualScrollHorizontal,
$q.lang.rtl
);
} else {
scrollTo(prevToIndex);
}
});
onBeforeUnmount(() => {
onVirtualScrollEvt.cancel();
});
Object.assign(proxy, { scrollTo, reset, refresh });
return {
virtualScrollSliceRange,
virtualScrollSliceSizeComputed,
setVirtualScrollSize,
onVirtualScrollEvt,
localResetVirtualScroll,
padVirtualScroll,
scrollTo,
reset,
refresh
};
}
const useFormProps = {
name: String
};
function useFormInputNameAttr(props) {
return computed(() => props.name || props.for);
}
function useKeyComposition(onInput) {
return function onComposition(e) {
if (e.type === "compositionend" || e.type === "change") {
if (e.target.qComposing !== true) return;
e.target.qComposing = false;
onInput(e);
} else if (e.type === "compositionstart") {
e.target.qComposing = true;
}
};
}
function isDeepEqual(a, b) {
if (a === b) {
return true;
}
if (a !== null && b !== null && typeof a === "object" && typeof b === "object") {
if (a.constructor !== b.constructor) {
return false;
}
let length, i;
if (a.constructor === Array) {
length = a.length;
if (length !== b.length) {
return false;
}
for (i = length; i-- !== 0; ) {
if (isDeepEqual(a[i], b[i]) !== true) {
return false;
}
}
return true;
}
if (a.constructor === Map) {
if (a.size !== b.size) {
return false;
}
let iter = a.entries();
i = iter.next();
while (i.done !== true) {
if (b.has(i.value[0]) !== true) {
return false;
}
i = iter.next();
}
iter = a.entries();
i = iter.next();
while (i.done !== true) {
if (isDeepEqual(i.value[1], b.get(i.value[0])) !== true) {
return false;
}
i = iter.next();
}
return true;
}
if (a.constructor === Set) {
if (a.size !== b.size) {
return false;
}
const iter = a.entries();
i = iter.next();
while (i.done !== true) {
if (b.has(i.value[0]) !== true) {
return false;
}
i = iter.next();
}
return true;
}
if (a.buffer != null && a.buffer.constructor === ArrayBuffer) {
length = a.length;
if (length !== b.length) {
return false;
}
for (i = length; i-- !== 0; ) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
if (a.constructor === RegExp) {
return a.source === b.source && a.flags === b.flags;
}
if (a.valueOf !== Object.prototype.valueOf) {
return a.valueOf() === b.valueOf();
}
if (a.toString !== Object.prototype.toString) {
return a.toString() === b.toString();
}
const keys = Object.keys(a).filter((key) => a[key] !== void 0);
length = keys.length;
if (length !== Object.keys(b).filter((key) => b[key] !== void 0).length) {
return false;
}
for (i = length; i-- !== 0; ) {
const key = keys[i];
if (isDeepEqual(a[key], b[key]) !== true) {
return false;
}
}
return true;
}
return a !== a && b !== b;
}
function normalizeToInterval(v, min, max) {
if (max <= min) {
return min;
}
const size2 = max - min + 1;
let index = min + (v - min) % size2;
if (index < min) {
index = size2 + index;
}
return index === 0 ? 0 : index;
}
const validateNewValueMode = (v) => ["add", "add-unique", "toggle"].includes(v);
const reEscapeList = ".*+?^${}()|[]\\";
const fieldPropsList = Object.keys(useFieldProps);
function getPropValueFn(userPropName, defaultPropName) {
if (typeof userPropName === "function") return userPropName;
const propName = userPropName !== void 0 ? userPropName : defaultPropName;
return (opt) => opt !== null && typeof opt === "object" && propName in opt ? opt[propName] : opt;
}
const QSelect = createComponent({
name: "QSelect",
inheritAttrs: false,
props: {
...useVirtualScrollProps,
...useFormProps,
...useFieldProps,
// override of useFieldProps > modelValue
modelValue: {
required: true
},
multiple: Boolean,
displayValue: [String, Number],
displayValueHtml: Boolean,
dropdownIcon: String,
options: {
type: Array,
default: () => []
},
optionValue: [Function, String],
optionLabel: [Function, String],
optionDisable: [Function, String],
hideSelected: Boolean,
hideDropdownIcon: Boolean,
fillInput: Boolean,
maxValues: [Number, String],
optionsDense: Boolean,
optionsDark: {
type: Boolean,
default: null
},
optionsSelectedClass: String,
optionsHtml: Boolean,
optionsCover: Boolean,
menuShrink: Boolean,
menuAnchor: String,
menuSelf: String,
menuOffset: Array,
popupContentClass: String,
popupContentStyle: [String, Array, Object],
popupNoRouteDismiss: Boolean,
useInput: Boolean,
useChips: Boolean,
newValueMode: {
type: String,
validator: validateNewValueMode
},
mapOptions: Boolean,
emitValue: Boolean,
disableTabSelection: Boolean,
inputDebounce: {
type: [Number, String],
default: 500
},
inputClass: [Array, String, Object],
inputStyle: [Array, String, Object],
tabindex: {
type: [String, Number],
default: 0
},
autocomplete: String,
transitionShow: {},
transitionHide: {},
transitionDuration: {},
behavior: {
type: String,
validator: (v) => ["default", "menu", "dialog"].includes(v),
default: "default"
},
// override of useVirtualScrollProps > virtualScrollItemSize (no default)
virtualScrollItemSize: useVirtualScrollProps.virtualScrollItemSize.type,
onNewValue: Function,
onFilter: Function
},
emits: [
...useFieldEmits,
"add",
"remove",
"inputValue",
"keyup",
"keypress",
"keydown",
"popupShow",
"popupHide",
"filterAbort"
],
setup(props, { slots, emit }) {
const { proxy } = getCurrentInstance();
const { $q } = proxy;
const menu = ref(false);
const dialog = ref(false);
const optionIndex = ref(-1);
const inputValue = ref("");
const dialogFieldFocused = ref(false);
const innerLoadingIndicator = ref(false);
let filterTimer = null, inputValueTimer = null, innerValueCache, hasDialog, userInputValue, filterId = null, defaultInputValue, transitionShowComputed, searchBuffer, searchBufferExp;
const inputRef = ref(null);
const targetRef = ref(null);
const menuRef = ref(null);
const dialogRef = ref(null);
const menuContentRef = ref(null);
const nameProp = useFormInputNameAttr(props);
const onComposition = useKeyComposition(onInput);
const virtualScrollLength = computed(() => props.options.length);
const virtualScrollItemSizeComputed = computed(() => props.virtualScrollItemSize === void 0 ? props.optionsDense === true ? 24 : 48 : props.virtualScrollItemSize);
const {
virtualScrollSliceRange,
virtualScrollSliceSizeComputed,
localResetVirtualScroll,
padVirtualScroll,
onVirtualScrollEvt,
scrollTo,
setVirtualScrollSize
} = useVirtualScroll({
virtualScrollLength,
getVirtualScrollTarget,
getVirtualScrollEl,
virtualScrollItemSizeComputed
});
const state = useFieldState();
const innerValue = computed(() => {
const mapNull = props.mapOptions === true && props.multiple !== true, val = props.modelValue !== void 0 && (props.modelValue !== null || mapNull === true) ? props.multiple === true && Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue] : [];
if (props.mapOptions === true) {
const cache = props.mapOptions === true && innerValueCache !== void 0 ? innerValueCache : [];
const values = val.map((v) => getOption(v, cache));
return props.modelValue === null && mapNull === true ? values.filter((v) => v !== null) : values;
}
return val;
});
const innerFieldProps = computed(() => {
const acc = {};
fieldPropsList.forEach((key) => {
const val = props[key];
if (val !== void 0) {
acc[key] = val;
}
});
return acc;
});
const isOptionsDark = computed(() => props.optionsDark === null ? state.isDark.value : props.optionsDark);
const hasValue = computed(() => fieldValueIsFilled(innerValue.value));
const computedInputClass = computed(() => {
let cls = "q-field__input q-placeholder col";
if (props.hideSelected === true || innerValue.value.length === 0) {
return [cls, props.inputClass];
}
cls += " q-field__input--padding";
return props.inputClass === void 0 ? cls : [cls, props.inputClass];
});
const menuContentClass = computed(
() => (props.virtualScrollHorizontal === true ? "q-virtual-scroll--horizontal" : "") + (props.popupContentClass ? " " + props.popupContentClass : "")
);
const noOptions = computed(() => virtualScrollLength.value === 0);
const selectedString = computed(
() => innerValue.value.map((opt) => getOptionLabel.value(opt)).join(", ")
);
const ariaCurrentValue = computed(() => props.displayValue !== void 0 ? props.displayValue : selectedString.value);
const needsHtmlFn = computed(() => props.optionsHtml === true ? () => true : (opt) => opt !== void 0 && opt !== null && opt.html === true);
const valueAsHtml = computed(() => props.displayValueHtml === true || props.displayValue === void 0 && (props.optionsHtml === true || innerValue.value.some(needsHtmlFn.value)));
const tabindex = computed(() => state.focused.value === true ? props.tabindex : -1);
const comboboxAttrs = computed(() => {
const attrs = {
tabindex: props.tabindex,
role: "combobox",
"aria-label": props.label,
"aria-readonly": props.readonly === true ? "true" : "false",
"aria-autocomplete": props.useInput === true ? "list" : "none",
"aria-expanded": menu.value === true ? "true" : "false",
"aria-controls": `${state.targetUid.value}_lb`
};
if (optionIndex.value >= 0) {
attrs["aria-activedescendant"] = `${state.targetUid.value}_${optionIndex.value}`;
}
return attrs;
});
const listboxAttrs = computed(() => ({
id: `${state.targetUid.value}_lb`,
role: "listbox",
"aria-multiselectable": props.multiple === true ? "true" : "false"
}));
const selectedScope = computed(() => {
return innerValue.value.map((opt, i) => ({
index: i,
opt,
html: needsHtmlFn.value(opt),
selected: true,
removeAtIndex: removeAtIndexAndFocus,
toggleOption,
tabindex: tabindex.value
}));
});
const optionScope = computed(() => {
if (virtualScrollLength.value === 0) {
return [];
}
const { from, to } = virtualScrollSliceRange.value;
return props.options.slice(from, to).map((opt, i) => {
const disable = isOptionDisabled.value(opt) === true;
const active = isOptionSelected(opt) === true;
const index = from + i;
const itemProps = {
clickable: true,
active,
activeClass: computedOptionsSelectedClass.value,
manualFocus: true,
focused: false,
disable,
tabindex: -1,
dense: props.optionsDense,
dark: isOptionsDark.value,
role: "option",
"aria-selected": active === true ? "true" : "false",
id: `${state.targetUid.value}_${index}`,
onClick: () => {
toggleOption(opt);
}
};
if (disable !== true) {
optionIndex.value === index && (itemProps.focused = true);
if ($q.platform.is.desktop === true) {
itemProps.onMousemove = () => {
menu.value === true && setOptionIndex(index);
};
}
}
return {
index,
opt,
html: needsHtmlFn.value(opt),
label: getOptionLabel.value(opt),
selected: itemProps.active,
focused: itemProps.focused,
toggleOption,
setOptionIndex,
itemProps
};
});
});
const dropdownArrowIcon = computed(() => props.dropdownIcon !== void 0 ? props.dropdownIcon : $q.iconSet.arrow.dropdown);
const squaredMenu = computed(
() => props.optionsCover === false && props.outlined !== true && props.standout !== true && props.borderless !== true && props.rounded !== true
);
const computedOptionsSelectedClass = computed(() => props.optionsSelectedClass !== void 0 ? props.optionsSelectedClass : props.color !== void 0 ? `text-${props.color}` : "");
const getOptionValue = computed(() => getPropValueFn(props.optionValue, "value"));
const getOptionLabel = computed(() => getPropValueFn(props.optionLabel, "label"));
const isOptionDisabled = computed(() => getPropValueFn(props.optionDisable, "disable"));
const innerOptionsValue = computed(() => innerValue.value.map(getOptionValue.value));
const inputControlEvents = computed(() => {
const evt = {
onInput,
// Safari < 10.2 & UIWebView doesn't fire compositionend when
// switching focus before confirming composition choice
// this also fixes the issue where some browsers e.g. iOS Chrome
// fires "change" instead of "input" on autocomplete.
onChange: onComposition,
onKeydown: onTargetKeydown,
onKeyup: onTargetAutocomplete,
onKeypress: onTargetKeypress,
onFocus: selectInputText,
onClick(e) {
hasDialog === true && stop(e);
}
};
evt.onCompositionstart = evt.onCompositionupdate = evt.onCompositionend = onComposition;
return evt;
});
watch(innerValue, (val) => {
innerValueCache = val;
if (props.useInput === true && props.fillInput === true && props.multiple !== true && state.innerLoading.value !== true && (dialog.value !== true && menu.value !== true || hasValue.value !== true)) {
userInputValue !== true && resetInputValue();
if (dialog.value === true || menu.value === true) {
filter("");
}
}
}, { immediate: true });
watch(() => props.fillInput, resetInputValue);
watch(menu, updateMenu);
watch(virtualScrollLength, rerenderMenu);
function getEmittingOptionValue(opt) {
return props.emitValue === true ? getOptionValue.value(opt) : opt;
}
function removeAtIndex(index) {
if (index !== -1 && index < innerValue.value.length) {
if (props.multiple === true) {
const model = props.modelValue.slice();
emit("remove", { index, value: model.splice(index, 1)[0] });
emit("update:modelValue", model);
} else {
emit("update:modelValue", null);
}
}
}
function removeAtIndexAndFocus(index) {
removeAtIndex(index);
state.focus();
}
function add(opt, unique) {
const val = getEmittingOptionValue(opt);
if (props.multiple !== true) {
props.fillInput === true && updateInputValue(
getOptionLabel.value(opt),
true,
true
);
emit("update:modelValue", val);
return;
}
if (innerValue.value.length === 0) {
emit("add", { index: 0, value: val });
emit("update:modelValue", props.multiple === true ? [val] : val);
return;
}
if (unique === true && isOptionSelected(opt) === true) {
return;
}
if (props.maxValues !== void 0 && props.modelValue.length >= props.maxValues) {
return;
}
const model = props.modelValue.slice();
emit("add", { index: model.length, value: val });
model.push(val);
emit("update:modelValue", model);
}
function toggleOption(opt, keepOpen) {
if (state.editable.value !== true || opt === void 0 || isOptionDisabled.value(opt) === true) {
return;
}
const optValue = getOptionValue.value(opt);
if (props.multiple !== true) {
if (keepOpen !== true) {
updateInputValue(
props.fillInput === true ? getOptionLabel.value(opt) : "",
true,
true
);
hidePopup();
}
targetRef.value !== null && targetRef.value.focus();
if (innerValue.value.length === 0 || isDeepEqual(getOptionValue.value(innerValue.value[0]), optValue) !== true) {
emit("update:modelValue", props.emitValue === true ? optValue : opt);
}
return;
}
(hasDialog !== true || dialogFieldFocused.value === true) && state.focus();
selectInputText();
if (innerValue.value.length === 0) {
const val = props.emitValue === true ? optValue : opt;
emit("add", { index: 0, value: val });
emit("update:modelValue", props.multiple === true ? [val] : val);
return;
}
const model = props.modelValue.slice(), index = innerOptionsValue.value.findIndex((v) => isDeepEqual(v, optValue));
if (index !== -1) {
emit("remove", { index, value: model.splice(index, 1)[0] });
} else {
if (props.maxValues !== void 0 && model.length >= props.maxValues) {
return;
}
const val = props.emitValue === true ? optValue : opt;
emit("add", { index: model.length, value: val });
model.push(val);
}
emit("update:modelValue", model);
}
function setOptionIndex(index) {
if ($q.platform.is.desktop !== true) return;
const val = index !== -1 && index < virtualScrollLength.value ? index : -1;
if (optionIndex.value !== val) {
optionIndex.value = val;
}
}
function moveOptionSelection(offset = 1, skipInputValue) {
if (menu.value === true) {
let index = optionIndex.value;
do {
index = normalizeToInterval(
index + offset,
-1,
virtualScrollLength.value - 1
);
} while (index !== -1 && index !== optionIndex.value && isOptionDisabled.value(props.options[index]) === true);
if (optionIndex.value !== index) {
setOptionIndex(index);
scrollTo(index);
if (skipInputValue !== true && props.useInput === true && props.fillInput === true) {
setInputValue(
index >= 0 ? getOptionLabel.value(props.options[index]) : defaultInputValue,
true
);
}
}
}
}
function getOption(value, valueCache) {
const fn = (opt) => isDeepEqual(getOptionValue.value(opt), value);
return props.options.find(fn) || valueCache.find(fn) || value;
}
function isOptionSelected(opt) {
const val = getOptionValue.value(opt);
return innerOptionsValue.value.find((v) => isDeepEqual(v, val)) !== void 0;
}
function selectInputText(e) {
if (props.useInput === true && targetRef.value !== null && (e === void 0 || targetRef.value === e.target && e.target.value === selectedString.value)) {
targetRef.value.select();
}
}
function onTargetKeyup(e) {
if (isKeyCode(e, 27) === true && menu.value === true) {
stop(e);
hidePopup();
resetInputValue();
}
emit("keyup", e);
}
function onTargetAutocomplete(e) {
const { value } = e.target;
if (e.keyCode !== void 0) {
onTargetKeyup(e);
return;
}
e.target.value = "";
if (filterTimer !== null) {
clearTimeout(filterTimer);
filterTimer = null;
}
if (inputValueTimer !== null) {
clearTimeout(inputValueTimer);
inputValueTimer = null;
}
resetInputValue();
if (typeof value === "string" && value.length !== 0) {
const needle = value.toLocaleLowerCase();
const findFn = (extractFn) => {
const option = props.options.find((opt) => extractFn.value(opt).toLocaleLowerCase() === needle);
if (option === void 0) {
return false;
}
if (innerValue.value.indexOf(option) === -1) {
toggleOption(option);
} else {
hidePopup();
}
return true;
};
const fillFn = (afterFilter) => {
if (findFn(getOptionValue) === true) {
return;
}
if (findFn(getOptionLabel) === true || afterFilter === true) {
return;
}
filter(value, true, () => fillFn(true));
};
fillFn();
} else {
state.clearValue(e);
}
}
function onTargetKeypress(e) {
emit("keypress", e);
}
function onTargetKeydown(e) {
emit("keydown", e);
if (shouldIgnoreKey(e) === true) {
return;
}
const newValueModeValid = inputValue.value.length !== 0 && (props.newValueMode !== void 0 || props.onNewValue !== void 0);
const tabShouldSelect = e.shiftKey !== true && props.disableTabSelection !== true && props.multiple !== true && (optionIndex.value !== -1 || newValueModeValid === true);
if (e.keyCode === 27) {
prevent(e);
return;
}
if (e.keyCode === 9 && tabShouldSelect === false) {
closeMenu();
return;
}
if (e.target === void 0 || e.target.id !== state.targetUid.value || state.editable.value !== true) return;
if (e.keyCode === 40 && state.innerLoading.value !== true && menu.value === false) {
stopAndPrevent(e);
showPopup();
return;
}
if (e.keyCode === 8 && (props.useChips === true || props.clearable === true) && props.hideSelected !== true && inputValue.value.length === 0) {
if (props.multiple === true && Array.isArray(props.modelValue) === true) {
removeAtIndex(props.modelValue.length - 1);
} else if (props.multiple !== true && props.modelValue !== null) {
emit("update:modelValue", null);
}
return;
}
if ((e.keyCode === 35 || e.keyCode === 36) && (typeof inputValue.value !== "string" || inputValue.value.length === 0)) {
stopAndPrevent(e);
optionIndex.value = -1;
moveOptionSelection(e.keyCode === 36 ? 1 : -1, props.multiple);
}
if ((e.keyCode === 33 || e.keyCode === 34) && virtualScrollSliceSizeComputed.value !== void 0) {
stopAndPrevent(e);
optionIndex.value = Math.max(
-1,
Math.min(
virtualScrollLength.value,
optionIndex.value + (e.keyCode === 33 ? -1 : 1) * virtualScrollSliceSizeComputed.value.view
)
);
moveOptionSelection(e.keyCode === 33 ? 1 : -1, props.multiple);
}
if (e.keyCode === 38 || e.keyCode === 40) {
stopAndPrevent(e);
moveOptionSelection(e.keyCode === 38 ? -1 : 1, props.multiple);
}
const optionsLength = virtualScrollLength.value;
if (searchBuffer === void 0 || searchBufferExp < Date.now()) {
searchBuffer = "";
}
if (optionsLength > 0 && props.useInput !== true && e.key !== void 0 && e.key.length === 1 && e.altKey === false && e.ctrlKey === false && e.metaKey === false && (e.keyCode !== 32 || searchBuffer.length !== 0)) {
menu.value !== true && showPopup(e);
const char = e.key.toLocaleLowerCase(), keyRepeat = searchBuffer.length === 1 && searchBuffer[0] === char;
searchBufferExp = Date.now() + 1500;
if (keyRepeat === false) {
stopAndPrevent(e);
searchBuffer += char;
}
const searchRe = new RegExp("^" + searchBuffer.split("").map((l) => reEscapeList.indexOf(l) !== -1 ? "\\" + l : l).join(".*"), "i");
let index = optionIndex.value;
if (keyRepeat === true || index < 0 || searchRe.test(getOptionLabel.value(props.options[index])) !== true) {
do {
index = normalizeToInterval(index + 1, -1, optionsLength - 1);
} while (index !== optionIndex.value && (isOptionDisabled.value(props.options[index]) === true || searchRe.test(getOptionLabel.value(props.options[index])) !== true));
}
if (optionIndex.value !== index) {
nextTick(() => {
setOptionIndex(index);
scrollTo(index);
if (index >= 0 && props.useInput === true && props.fillInput === true) {
setInputValue(getOptionLabel.value(props.options[index]), true);
}
});
}
return;
}
if (e.keyCode !== 13 && (e.keyCode !== 32 || props.useInput === true || searchBuffer !== "") && (e.keyCode !== 9 || tabShouldSelect === false)) return;
e.keyCode !== 9 && stopAndPrevent(e);
if (optionIndex.value !== -1 && optionIndex.value < optionsLength) {
toggleOption(props.options[optionIndex.value]);
return;
}
if (newValueModeValid === true) {
const done = (val, mode) => {
if (mode) {
if (validateNewValueMode(mode) !== true) {
return;
}
} else {
mode = props.newValueMode;
}
updateInputValue("", props.multiple !== true, true);
if (val === void 0 || val === null) {
return;
}
const fn = mode === "toggle" ? toggleOption : add;
fn(val, mode === "add-unique");
if (props.multiple !== true) {
targetRef.value !== null && targetRef.value.focus();
hidePopup();
}
};
if (props.onNewValue !== void 0) {
emit("newValue", inputValue.value, done);
} else {
done(inputValue.value);
}
if (props.multiple !== true) {
return;
}
}
if (menu.value === true) {
closeMenu();
} else if (state.innerLoading.value !== true) {
showPopup();
}
}
function getVirtualScrollEl() {
return hasDialog === true ? menuContentRef.value : menuRef.value !== null && menuRef.value.contentEl !== null ? menuRef.value.contentEl : void 0;
}
function getVirtualScrollTarget() {
return getVirtualScrollEl();
}
function getSelection() {
if (props.hideSelected === true) {
return [];
}
if (slots["selected-item"] !== void 0) {
return selectedScope.value.map((scope) => slots["selected-item"](scope)).slice();
}
if (slots.selected !== void 0) {
return [].concat(slots.selected());
}
if (props.useChips === true) {
return selectedScope.value.map((scope, i) => h(QChip, {
key: "option-" + i,
removable: state.editable.value === true && isOptionDisabled.value(scope.opt) !== true,
dense: true,
textColor: props.color,
tabindex: tabindex.value,
onRemove() {
scope.removeAtIndex(i);
}
}, () => h("span", {
class: "ellipsis",
[scope.html === true ? "innerHTML" : "textContent"]: getOptionLabel.value(scope.opt)
})));
}
return [
h("span", {
[valueAsHtml.value === true ? "innerHTML" : "textContent"]: ariaCurrentValue.value
})
];
}
function getAllOptions() {
if (noOptions.value === true) {
return slots["no-option"] !== void 0 ? slots["no-option"]({ inputValue: inputValue.value }) : void 0;
}
const fn = slots.option !== void 0 ? slots.option : (scope) => {
return h(QItem, {
key: scope.index,
...scope.itemProps
}, () => {
return h(
QItemSection,
() => h(
QItemLabel,
() => h("span", {
[scope.html === true ? "innerHTML" : "textContent"]: scope.label
})
)
);
});
};
let options = padVirtualScroll("div", optionScope.value.map(fn));
if (slots["before-options"] !== void 0) {
options = slots["before-options"]().concat(options);
}
return hMergeSlot(slots["after-options"], options);
}
function getInput(fromDialog, isTarget) {
const attrs = isTarget === true ? { ...comboboxAttrs.value, ...state.splitAttrs.attributes.value } : void 0;
const data = {
ref: isTarget === true ? targetRef : void 0,
key: "i_t",
class: computedInputClass.value,
style: props.inputStyle,
value: inputValue.value !== void 0 ? inputValue.value : "",
// required for Android in order to show ENTER key when in form
type: "search",
...attrs,
id: isTarget === true ? state.targetUid.value : void 0,
maxlength: props.maxlength,
autocomplete: props.autocomplete,
"data-autofocus": fromDialog === true || props.autofocus === true || void 0,
disabled: props.disable === true,
readonly: props.readonly === true,
...inputControlEvents.value
};
if (fromDialog !== true && hasDialog === true) {
if (Array.isArray(data.class) === true) {
data.class = [...data.class, "no-pointer-events"];
} else {
data.class += " no-pointer-events";
}
}
return h("input", data);
}
function onInput(e) {
if (filterTimer !== null) {
clearTimeout(filterTimer);
filterTimer = null;
}
if (inputValueTimer !== null) {
clearTimeout(inputValueTimer);
inputValueTimer = null;
}
if (e && e.target && e.target.qComposing === true) {
return;
}
setInputValue(e.target.value || "");
userInputValue = true;
defaultInputValue = inputValue.value;
if (state.focused.value !== true && (hasDialog !== true || dialogFieldFocused.value === true)) {
state.focus();
}
if (props.onFilter !== void 0) {
filterTimer = setTimeout(() => {
filterTimer = null;
filter(inputValue.value);
}, props.inputDebounce);
}
}
function setInputValue(val, emitImmediately) {
if (inputValue.value !== val) {
inputValue.value = val;
if (emitImmediately === true || props.inputDebounce === 0 || props.inputDebounce === "0") {
emit("inputValue", val);
} else {
inputValueTimer = setTimeout(() => {
inputValueTimer = null;
emit("inputValue", val);
}, props.inputDebounce);
}
}
}
function updateInputValue(val, noFiltering, internal) {
userInputValue = internal !== true;
if (props.useInput === true) {
setInputValue(val, true);
if (noFiltering === true || internal !== true) {
defaultInputValue = val;
}
noFiltering !== true && filter(val);
}
}
function filter(val, keepClosed, afterUpdateFn) {
if (props.onFilter === void 0 || keepClosed !== true && state.focused.value !== true) {
return;
}
if (state.innerLoading.value === true) {
emit("filterAbort");
} else {
state.innerLoading.value = true;
innerLoadingIndicator.value = true;
}
if (val !== "" && props.multiple !== true && innerValue.value.length !== 0 && userInputValue !== true && val === getOptionLabel.value(innerValue.value[0])) {
val = "";
}
const localFilterId = setTimeout(() => {
menu.value === true && (menu.value = false);
}, 10);
filterId !== null && clearTimeout(filterId);
filterId = localFilterId;
emit(
"filter",
val,
(fn, afterFn) => {
if ((keepClosed === true || state.focused.value === true) && filterId === localFilterId) {
clearTimeout(filterId);
typeof fn === "function" && fn();
innerLoadingIndicator.value = false;
nextTick(() => {
state.innerLoading.value = false;
if (state.editable.value === true) {
if (keepClosed === true) {
menu.value === true && hidePopup();
} else if (menu.value === true) {
updateMenu(true);
} else {
menu.value = true;
}
}
typeof afterFn === "function" && nextTick(() => {
afterFn(proxy);
});
typeof afterUpdateFn === "function" && nextTick(() => {
afterUpdateFn(proxy);
});
});
}
},
() => {
if (state.focused.value === true && filterId === localFilterId) {
clearTimeout(filterId);
state.innerLoading.value = false;
innerLoadingIndicator.value = false;
}
menu.value === true && (menu.value = false);
}
);
}
function getMenu() {
return h(QMenu, {
ref: menuRef,
class: menuContentClass.value,
style: props.popupContentStyle,
modelValue: menu.value,
fit: props.menuShrink !== true,
cover: props.optionsCover === true && noOptions.value !== true && props.useInput !== true,
anchor: props.menuAnchor,
self: props.menuSelf,
offset: props.menuOffset,
dark: isOptionsDark.value,
noParentEvent: true,
noRefocus: true,
noFocus: true,
noRouteDismiss: props.popupNoRouteDismiss,
square: squaredMenu.value,
transitionShow: props.transitionShow,
transitionHide: props.transitionHide,
transitionDuration: props.transitionDuration,
separateClosePopup: true,
...listboxAttrs.value,
onScrollPassive: onVirtualScrollEvt,
onBeforeShow: onControlPopupShow,
onBeforeHide: onMenuBeforeHide,
onShow: onMenuShow
}, getAllOptions);
}
function onMenuBeforeHide(e) {
onControlPopupHide(e);
closeMenu();
}
function onMenuShow() {
setVirtualScrollSize();
}
function onDialogFieldFocus(e) {
stop(e);
targetRef.value !== null && targetRef.value.focus();
dialogFieldFocused.value = true;
window.scrollTo(window.pageXOffset || window.scrollX || document.body.scrollLeft || 0, 0);
}
function onDialogFieldBlur(e) {
stop(e);
nextTick(() => {
dialogFieldFocused.value = false;
});
}
function getDialog() {
const content = [
h(QField, {
class: `col-auto ${state.fieldClass.value}`,
...innerFieldProps.value,
for: state.targetUid.value,
dark: isOptionsDark.value,
square: true,
loading: innerLoadingIndicator.value,
itemAligned: false,
filled: true,
stackLabel: inputValue.value.length !== 0,
...state.splitAttrs.listeners.value,
onFocus: onDialogFieldFocus,
onBlur: onDialogFieldBlur
}, {
...slots,
rawControl: () => state.getControl(true),
before: void 0,
after: void 0
})
];
menu.value === true && content.push(
h("div", {
ref: menuContentRef,
class: menuContentClass.value + " scroll",
style: props.popupContentStyle,
...listboxAttrs.value,
onClick: prevent,
onScrollPassive: onVirtualScrollEvt
}, getAllOptions())
);
return h(QDialog, {
ref: dialogRef,
modelValue: dialog.value,
position: props.useInput === true ? "top" : void 0,
transitionShow: transitionShowComputed,
transitionHide: props.transitionHide,
transitionDuration: props.transitionDuration,
noRouteDismiss: props.popupNoRouteDismiss,
onBeforeShow: onControlPopupShow,
onBeforeHide: onDialogBeforeHide,
onHide: onDialogHide,
onShow: onDialogShow
}, () => h("div", {
class: "q-select__dialog" + (isOptionsDark.value === true ? " q-select__dialog--dark q-dark" : "") + (dialogFieldFocused.value === true ? " q-select__dialog--focused" : "")
}, content));
}
function onDialogBeforeHide(e) {
onControlPopupHide(e);
if (dialogRef.value !== null) {
dialogRef.value.__updateRefocusTarget(
state.rootRef.value.querySelector(".q-field__native > [tabindex]:last-child")
);
}
state.focused.value = false;
}
function onDialogHide(e) {
hidePopup();
state.focused.value === false && emit("blur", e);
resetInputValue();
}
function onDialogShow() {
const el = document.activeElement;
if ((el === null || el.id !== state.targetUid.value) && targetRef.value !== null && targetRef.value !== el) {
targetRef.value.focus();
}
setVirtualScrollSize();
}
function closeMenu() {
if (dialog.value === true) {
return;
}
optionIndex.value = -1;
if (menu.value === true) {
menu.value = false;
}
if (state.focused.value === false) {
if (filterId !== null) {
clearTimeout(filterId);
filterId = null;
}
if (state.innerLoading.value === true) {
emit("filterAbort");
state.innerLoading.value = false;
innerLoadingIndicator.value = false;
}
}
}
function showPopup(e) {
if (state.editable.value !== true) {
return;
}
if (hasDialog === true) {
state.onControlFocusin(e);
dialog.value = true;
nextTick(() => {
state.focus();
});
} else {
state.focus();
}
if (props.onFilter !== void 0) {
filter(inputValue.value);
} else if (noOptions.value !== true || slots["no-option"] !== void 0) {
menu.value = true;
}
}
function hidePopup() {
dialog.value = false;
closeMenu();
}
function resetInputValue() {
props.useInput === true && updateInputValue(
props.multiple !== true && props.fillInput === true && innerValue.value.length !== 0 ? getOptionLabel.value(innerValue.value[0]) || "" : "",
true,
true
);
}
function updateMenu(show) {
let optionIndex2 = -1;
if (show === true) {
if (innerValue.value.length !== 0) {
const val = getOptionValue.value(innerValue.value[0]);
optionIndex2 = props.options.findIndex((v) => isDeepEqual(getOptionValue.value(v), val));
}
localResetVirtualScroll(optionIndex2);
}
setOptionIndex(optionIndex2);
}
function rerenderMenu(newLength, oldLength) {
if (menu.value === true && state.innerLoading.value === false) {
localResetVirtualScroll(-1, true);
nextTick(() => {
if (menu.value === true && state.innerLoading.value === false) {
if (newLength > oldLength) {
localResetVirtualScroll();
} else {
updateMenu(true);
}
}
});
}
}
function updateMenuPosition() {
if (dialog.value === false && menuRef.value !== null) {
menuRef.value.updatePosition();
}
}
function onControlPopupShow(e) {
e !== void 0 && stop(e);
emit("popupShow", e);
state.hasPopupOpen = true;
state.onControlFocusin(e);
}
function onControlPopupHide(e) {
e !== void 0 && stop(e);
emit("popupHide", e);
state.hasPopupOpen = false;
state.onControlFocusout(e);
}
function updatePreState() {
hasDialog = $q.platform.is.mobile !== true && props.behavior !== "dialog" ? false : props.behavior !== "menu" && (props.useInput === true ? slots["no-option"] !== void 0 || props.onFilter !== void 0 || noOptions.value === false : true);
transitionShowComputed = $q.platform.is.ios === true && hasDialog === true && props.useInput === true ? "fade" : props.transitionShow;
}
onBeforeUpdate(updatePreState);
onUpdated(updateMenuPosition);
updatePreState();
onBeforeUnmount(() => {
filterTimer !== null && clearTimeout(filterTimer);
inputValueTimer !== null && clearTimeout(inputValueTimer);
});
Object.assign(proxy, {
showPopup,
hidePopup,
removeAtIndex,
add,
toggleOption,
getOptionIndex: () => optionIndex.value,
setOptionIndex,
moveOptionSelection,
filter,
updateMenuPosition,
updateInputValue,
isOptionSelected,
getEmittingOptionValue,
isOptionDisabled: (...args) => isOptionDisabled.value.apply(null, args) === true,
getOptionValue: (...args) => getOptionValue.value.apply(null, args),
getOptionLabel: (...args) => getOptionLabel.value.apply(null, args)
});
Object.assign(state, {
innerValue,
fieldClass: computed(
() => `q-select q-field--auto-height q-select--with${props.useInput !== true ? "out" : ""}-input q-select--with${props.useChips !== true ? "out" : ""}-chips q-select--${props.multiple === true ? "multiple" : "single"}`
),
inputRef,
targetRef,
hasValue,
showPopup,
floatingLabel: computed(
() => props.hideSelected !== true && hasValue.value === true || typeof inputValue.value === "number" || inputValue.value.length !== 0 || fieldValueIsFilled(props.displayValue)
),
getControlChild: () => {
if (state.editable.value !== false && (dialog.value === true || noOptions.value !== true || slots["no-option"] !== void 0)) {
return hasDialog === true ? getDialog() : getMenu();
} else if (state.hasPopupOpen === true) {
state.hasPopupOpen = false;
}
},
controlEvents: {
onFocusin(e) {
state.onControlFocusin(e);
},
onFocusout(e) {
state.onControlFocusout(e, () => {
resetInputValue();
closeMenu();
});
},
onClick(e) {
prevent(e);
if (hasDialog !== true && menu.value === true) {
closeMenu();
targetRef.value !== null && targetRef.value.focus();
return;
}
showPopup(e);
}
},
getControl: (fromDialog) => {
const child = getSelection();
const isTarget = fromDialog === true || dialog.value !== true || hasDialog !== true;
if (props.useInput === true) {
child.push(getInput(fromDialog, isTarget));
} else if (state.editable.value === true) {
const attrs2 = isTarget === true ? comboboxAttrs.value : void 0;
child.push(
h("input", {
ref: isTarget === true ? targetRef : void 0,
key: "d_t",
class: "q-select__focus-target",
id: isTarget === true ? state.targetUid.value : void 0,
value: ariaCurrentValue.value,
readonly: true,
"data-autofocus": fromDialog === true || props.autofocus === true || void 0,
...attrs2,
onKeydown: onTargetKeydown,
onKeyup: onTargetKeyup,
onKeypress: onTargetKeypress
})
);
if (isTarget === true && typeof props.autocomplete === "string" && props.autocomplete.length !== 0) {
child.push(
h("input", {
class: "q-select__autocomplete-input",
autocomplete: props.autocomplete,
tabindex: -1,
onKeyup: onTargetAutocomplete
})
);
}
}
if (nameProp.value !== void 0 && props.disable !== true && innerOptionsValue.value.length !== 0) {
const opts = innerOptionsValue.value.map((value) => h("option", { value, selected: true }));
child.push(
h("select", {
class: "hidden",
name: nameProp.value,
multiple: props.multiple
}, opts)
);
}
const attrs = props.useInput === true || isTarget !== true ? void 0 : state.splitAttrs.attributes.value;
return h("div", {
class: "q-field__native row items-center",
...attrs,
...state.splitAttrs.listeners.value
}, child);
},
getInnerAppend: () => props.loading !== true && innerLoadingIndicator.value !== true && props.hideDropdownIcon !== true ? [
h(QIcon, {
class: "q-select__dropdown-icon" + (menu.value === true ? " rotate-180" : ""),
name: dropdownArrowIcon.value
})
] : null
});
return useField(state);
}
});
const insetMap = {
true: "inset",
item: "item-inset",
"item-thumbnail": "item-thumbnail-inset"
};
const margins = {
xs: 2,
sm: 4,
md: 8,
lg: 16,
xl: 24
};
const QSeparator = createComponent({
name: "QSeparator",
props: {
...useDarkProps,
spaced: [Boolean, String],
inset: [Boolean, String],
vertical: Boolean,
color: String,
size: String
},
setup(props) {
const vm = getCurrentInstance();
const isDark = useDark(props, vm.proxy.$q);
const orientation = computed(() => props.vertical === true ? "vertical" : "horizontal");
const orientClass = computed(() => ` q-separator--${orientation.value}`);
const insetClass = computed(() => props.inset !== false ? `${orientClass.value}-${insetMap[props.inset]}` : "");
const classes = computed(
() => `q-separator${orientClass.value}${insetClass.value}` + (props.color !== void 0 ? ` bg-${props.color}` : "") + (isDark.value === true ? " q-separator--dark" : "")
);
const style = computed(() => {
const acc = {};
if (props.size !== void 0) {
acc[props.vertical === true ? "width" : "height"] = props.size;
}
if (props.spaced !== false) {
const size2 = props.spaced === true ? `${margins.md}px` : props.spaced in margins ? `${margins[props.spaced]}px` : props.spaced;
const dir = props.vertical === true ? ["Left", "Right"] : ["Top", "Bottom"];
acc[`margin${dir[0]}`] = acc[`margin${dir[1]}`] = size2;
}
return acc;
});
return () => h("hr", {
class: classes.value,
style: style.value,
"aria-orientation": orientation.value
});
}
});
const NAMED_MASKS = {
date: "####/##/##",
datetime: "####/##/## ##:##",
time: "##:##",
fulltime: "##:##:##",
phone: "(###) ### - ####",
card: "#### #### #### ####"
};
const TOKENS = {
"#": { pattern: "[\\d]", negate: "[^\\d]" },
S: { pattern: "[a-zA-Z]", negate: "[^a-zA-Z]" },
N: { pattern: "[0-9a-zA-Z]", negate: "[^0-9a-zA-Z]" },
A: { pattern: "[a-zA-Z]", negate: "[^a-zA-Z]", transform: (v) => v.toLocaleUpperCase() },
a: { pattern: "[a-zA-Z]", negate: "[^a-zA-Z]", transform: (v) => v.toLocaleLowerCase() },
X: { pattern: "[0-9a-zA-Z]", negate: "[^0-9a-zA-Z]", transform: (v) => v.toLocaleUpperCase() },
x: { pattern: "[0-9a-zA-Z]", negate: "[^0-9a-zA-Z]", transform: (v) => v.toLocaleLowerCase() }
};
const KEYS = Object.keys(TOKENS);
KEYS.forEach((key) => {
TOKENS[key].regex = new RegExp(TOKENS[key].pattern);
});
const tokenRegexMask = new RegExp("\\\\([^.*+?^${}()|([\\]])|([.*+?^${}()|[\\]])|([" + KEYS.join("") + "])|(.)", "g"), escRegex = /[.*+?^${}()|[\]\\]/g;
const MARKER = String.fromCharCode(1);
const useMaskProps = {
mask: String,
reverseFillMask: Boolean,
fillMask: [Boolean, String],
unmaskedValue: Boolean
};
function useMask(props, emit, emitValue, inputRef) {
let maskMarked, maskReplaced, computedMask, computedUnmask, pastedTextStart, selectionAnchor;
const hasMask = ref(null);
const innerValue = ref(getInitialMaskedValue());
function getIsTypeText() {
return props.autogrow === true || ["textarea", "text", "search", "url", "tel", "password"].includes(props.type);
}
watch(() => props.type + props.autogrow, updateMaskInternals);
watch(() => props.mask, (v) => {
if (v !== void 0) {
updateMaskValue(innerValue.value, true);
} else {
const val = unmaskValue(innerValue.value);
updateMaskInternals();
props.modelValue !== val && emit("update:modelValue", val);
}
});
watch(() => props.fillMask + props.reverseFillMask, () => {
hasMask.value === true && updateMaskValue(innerValue.value, true);
});
watch(() => props.unmaskedValue, () => {
hasMask.value === true && updateMaskValue(innerValue.value);
});
function getInitialMaskedValue() {
updateMaskInternals();
if (hasMask.value === true) {
const masked = maskValue(unmaskValue(props.modelValue));
return props.fillMask !== false ? fillWithMask(masked) : masked;
}
return props.modelValue;
}
function getPaddedMaskMarked(size2) {
if (size2 < maskMarked.length) {
return maskMarked.slice(-size2);
}
let pad = "", localMaskMarked = maskMarked;
const padPos = localMaskMarked.indexOf(MARKER);
if (padPos !== -1) {
for (let i = size2 - localMaskMarked.length; i > 0; i--) {
pad += MARKER;
}
localMaskMarked = localMaskMarked.slice(0, padPos) + pad + localMaskMarked.slice(padPos);
}
return localMaskMarked;
}
function updateMaskInternals() {
hasMask.value = props.mask !== void 0 && props.mask.length !== 0 && getIsTypeText();
if (hasMask.value === false) {
computedUnmask = void 0;
maskMarked = "";
maskReplaced = "";
return;
}
const localComputedMask = NAMED_MASKS[props.mask] === void 0 ? props.mask : NAMED_MASKS[props.mask], fillChar = typeof props.fillMask === "string" && props.fillMask.length !== 0 ? props.fillMask.slice(0, 1) : "_", fillCharEscaped = fillChar.replace(escRegex, "\\$&"), unmask = [], extract = [], mask = [];
let firstMatch = props.reverseFillMask === true, unmaskChar = "", negateChar = "";
localComputedMask.replace(tokenRegexMask, (_, char1, esc, token, char2) => {
if (token !== void 0) {
const c = TOKENS[token];
mask.push(c);
negateChar = c.negate;
if (firstMatch === true) {
extract.push("(?:" + negateChar + "+)?(" + c.pattern + "+)?(?:" + negateChar + "+)?(" + c.pattern + "+)?");
firstMatch = false;
}
extract.push("(?:" + negateChar + "+)?(" + c.pattern + ")?");
} else if (esc !== void 0) {
unmaskChar = "\\" + (esc === "\\" ? "" : esc);
mask.push(esc);
unmask.push("([^" + unmaskChar + "]+)?" + unmaskChar + "?");
} else {
const c = char1 !== void 0 ? char1 : char2;
unmaskChar = c === "\\" ? "\\\\\\\\" : c.replace(escRegex, "\\\\$&");
mask.push(c);
unmask.push("([^" + unmaskChar + "]+)?" + unmaskChar + "?");
}
});
const unmaskMatcher = new RegExp(
"^" + unmask.join("") + "(" + (unmaskChar === "" ? "." : "[^" + unmaskChar + "]") + "+)?" + (unmaskChar === "" ? "" : "[" + unmaskChar + "]*") + "$"
), extractLast = extract.length - 1, extractMatcher = extract.map((re, index) => {
if (index === 0 && props.reverseFillMask === true) {
return new RegExp("^" + fillCharEscaped + "*" + re);
} else if (index === extractLast) {
return new RegExp(
"^" + re + "(" + (negateChar === "" ? "." : negateChar) + "+)?" + (props.reverseFillMask === true ? "$" : fillCharEscaped + "*")
);
}
return new RegExp("^" + re);
});
computedMask = mask;
computedUnmask = (val) => {
const unmaskMatch = unmaskMatcher.exec(props.reverseFillMask === true ? val : val.slice(0, mask.length + 1));
if (unmaskMatch !== null) {
val = unmaskMatch.slice(1).join("");
}
const extractMatch = [], extractMatcherLength = extractMatcher.length;
for (let i = 0, str = val; i < extractMatcherLength; i++) {
const m = extractMatcher[i].exec(str);
if (m === null) {
break;
}
str = str.slice(m.shift().length);
extractMatch.push(...m);
}
if (extractMatch.length !== 0) {
return extractMatch.join("");
}
return val;
};
maskMarked = mask.map((v) => typeof v === "string" ? v : MARKER).join("");
maskReplaced = maskMarked.split(MARKER).join(fillChar);
}
function updateMaskValue(rawVal, updateMaskInternalsFlag, inputType) {
const inp = inputRef.value, end = inp.selectionEnd, endReverse = inp.value.length - end, unmasked = unmaskValue(rawVal);
updateMaskInternalsFlag === true && updateMaskInternals();
const preMasked = maskValue(unmasked), masked = props.fillMask !== false ? fillWithMask(preMasked) : preMasked, changed = innerValue.value !== masked;
inp.value !== masked && (inp.value = masked);
changed === true && (innerValue.value = masked);
document.activeElement === inp && nextTick(() => {
if (masked === maskReplaced) {
const cursor = props.reverseFillMask === true ? maskReplaced.length : 0;
inp.setSelectionRange(cursor, cursor, "forward");
return;
}
if (inputType === "insertFromPaste" && props.reverseFillMask !== true) {
const maxEnd = inp.selectionEnd;
let cursor = end - 1;
for (let i = pastedTextStart; i <= cursor && i < maxEnd; i++) {
if (maskMarked[i] !== MARKER) {
cursor++;
}
}
moveCursor.right(inp, cursor);
return;
}
if (["deleteContentBackward", "deleteContentForward"].indexOf(inputType) !== -1) {
const cursor = props.reverseFillMask === true ? end === 0 ? masked.length > preMasked.length ? 1 : 0 : Math.max(0, masked.length - (masked === maskReplaced ? 0 : Math.min(preMasked.length, endReverse) + 1)) + 1 : end;
inp.setSelectionRange(cursor, cursor, "forward");
return;
}
if (props.reverseFillMask === true) {
if (changed === true) {
const cursor = Math.max(0, masked.length - (masked === maskReplaced ? 0 : Math.min(preMasked.length, endReverse + 1)));
if (cursor === 1 && end === 1) {
inp.setSelectionRange(cursor, cursor, "forward");
} else {
moveCursor.rightReverse(inp, cursor);
}
} else {
const cursor = masked.length - endReverse;
inp.setSelectionRange(cursor, cursor, "backward");
}
} else {
if (changed === true) {
const cursor = Math.max(0, maskMarked.indexOf(MARKER), Math.min(preMasked.length, end) - 1);
moveCursor.right(inp, cursor);
} else {
const cursor = end - 1;
moveCursor.right(inp, cursor);
}
}
});
const val = props.unmaskedValue === true ? unmaskValue(masked) : masked;
if (String(props.modelValue) !== val && (props.modelValue !== null || val !== "")) {
emitValue(val, true);
}
}
function moveCursorForPaste(inp, start, end) {
const preMasked = maskValue(unmaskValue(inp.value));
start = Math.max(0, maskMarked.indexOf(MARKER), Math.min(preMasked.length, start));
pastedTextStart = start;
inp.setSelectionRange(start, end, "forward");
}
const moveCursor = {
left(inp, cursor) {
const noMarkBefore = maskMarked.slice(cursor - 1).indexOf(MARKER) === -1;
let i = Math.max(0, cursor - 1);
for (; i >= 0; i--) {
if (maskMarked[i] === MARKER) {
cursor = i;
noMarkBefore === true && cursor++;
break;
}
}
if (i < 0 && maskMarked[cursor] !== void 0 && maskMarked[cursor] !== MARKER) {
return moveCursor.right(inp, 0);
}
cursor >= 0 && inp.setSelectionRange(cursor, cursor, "backward");
},
right(inp, cursor) {
const limit = inp.value.length;
let i = Math.min(limit, cursor + 1);
for (; i <= limit; i++) {
if (maskMarked[i] === MARKER) {
cursor = i;
break;
} else if (maskMarked[i - 1] === MARKER) {
cursor = i;
}
}
if (i > limit && maskMarked[cursor - 1] !== void 0 && maskMarked[cursor - 1] !== MARKER) {
return moveCursor.left(inp, limit);
}
inp.setSelectionRange(cursor, cursor, "forward");
},
leftReverse(inp, cursor) {
const localMaskMarked = getPaddedMaskMarked(inp.value.length);
let i = Math.max(0, cursor - 1);
for (; i >= 0; i--) {
if (localMaskMarked[i - 1] === MARKER) {
cursor = i;
break;
} else if (localMaskMarked[i] === MARKER) {
cursor = i;
if (i === 0) {
break;
}
}
}
if (i < 0 && localMaskMarked[cursor] !== void 0 && localMaskMarked[cursor] !== MARKER) {
return moveCursor.rightReverse(inp, 0);
}
cursor >= 0 && inp.setSelectionRange(cursor, cursor, "backward");
},
rightReverse(inp, cursor) {
const limit = inp.value.length, localMaskMarked = getPaddedMaskMarked(limit), noMarkBefore = localMaskMarked.slice(0, cursor + 1).indexOf(MARKER) === -1;
let i = Math.min(limit, cursor + 1);
for (; i <= limit; i++) {
if (localMaskMarked[i - 1] === MARKER) {
cursor = i;
cursor > 0 && noMarkBefore === true && cursor--;
break;
}
}
if (i > limit && localMaskMarked[cursor - 1] !== void 0 && localMaskMarked[cursor - 1] !== MARKER) {
return moveCursor.leftReverse(inp, limit);
}
inp.setSelectionRange(cursor, cursor, "forward");
}
};
function onMaskedClick(e) {
emit("click", e);
selectionAnchor = void 0;
}
function onMaskedKeydown(e) {
emit("keydown", e);
if (shouldIgnoreKey(e) === true || e.altKey === true) {
return;
}
const inp = inputRef.value, start = inp.selectionStart, end = inp.selectionEnd;
if (!e.shiftKey) {
selectionAnchor = void 0;
}
if (e.keyCode === 37 || e.keyCode === 39) {
if (e.shiftKey && selectionAnchor === void 0) {
selectionAnchor = inp.selectionDirection === "forward" ? start : end;
}
const fn = moveCursor[(e.keyCode === 39 ? "right" : "left") + (props.reverseFillMask === true ? "Reverse" : "")];
e.preventDefault();
fn(inp, selectionAnchor === start ? end : start);
if (e.shiftKey) {
const cursor = inp.selectionStart;
inp.setSelectionRange(Math.min(selectionAnchor, cursor), Math.max(selectionAnchor, cursor), "forward");
}
} else if (e.keyCode === 8 && props.reverseFillMask !== true && start === end) {
moveCursor.left(inp, start);
inp.setSelectionRange(inp.selectionStart, end, "backward");
} else if (e.keyCode === 46 && props.reverseFillMask === true && start === end) {
moveCursor.rightReverse(inp, end);
inp.setSelectionRange(start, inp.selectionEnd, "forward");
}
}
function maskValue(val) {
if (val === void 0 || val === null || val === "") {
return "";
}
if (props.reverseFillMask === true) {
return maskValueReverse(val);
}
const mask = computedMask;
let valIndex = 0, output = "";
for (let maskIndex = 0; maskIndex < mask.length; maskIndex++) {
const valChar = val[valIndex], maskDef = mask[maskIndex];
if (typeof maskDef === "string") {
output += maskDef;
valChar === maskDef && valIndex++;
} else if (valChar !== void 0 && maskDef.regex.test(valChar)) {
output += maskDef.transform !== void 0 ? maskDef.transform(valChar) : valChar;
valIndex++;
} else {
return output;
}
}
return output;
}
function maskValueReverse(val) {
const mask = computedMask, firstTokenIndex = maskMarked.indexOf(MARKER);
let valIndex = val.length - 1, output = "";
for (let maskIndex = mask.length - 1; maskIndex >= 0 && valIndex !== -1; maskIndex--) {
const maskDef = mask[maskIndex];
let valChar = val[valIndex];
if (typeof maskDef === "string") {
output = maskDef + output;
valChar === maskDef && valIndex--;
} else if (valChar !== void 0 && maskDef.regex.test(valChar)) {
do {
output = (maskDef.transform !== void 0 ? maskDef.transform(valChar) : valChar) + output;
valIndex--;
valChar = val[valIndex];
} while (firstTokenIndex === maskIndex && valChar !== void 0 && maskDef.regex.test(valChar));
} else {
return output;
}
}
return output;
}
function unmaskValue(val) {
return typeof val !== "string" || computedUnmask === void 0 ? typeof val === "number" ? computedUnmask("" + val) : val : computedUnmask(val);
}
function fillWithMask(val) {
if (maskReplaced.length - val.length <= 0) {
return val;
}
return props.reverseFillMask === true && val.length !== 0 ? maskReplaced.slice(0, -val.length) + val : val + maskReplaced.slice(val.length);
}
return {
innerValue,
hasMask,
moveCursorForPaste,
updateMaskValue,
onMaskedKeydown,
onMaskedClick
};
}
function useFileFormDomProps(props, typeGuard) {
function getFormDomProps() {
const model = props.modelValue;
try {
const dt = "DataTransfer" in window ? new DataTransfer() : "ClipboardEvent" in window ? new ClipboardEvent("").clipboardData : void 0;
if (Object(model) === model) {
("length" in model ? Array.from(model) : [model]).forEach((file) => {
dt.items.add(file);
});
}
return {
files: dt.files
};
} catch (e) {
return {
files: void 0
};
}
}
return computed(() => {
if (props.type !== "file") {
return;
}
return getFormDomProps();
});
}
const QInput = createComponent({
name: "QInput",
inheritAttrs: false,
props: {
...useFieldProps,
...useMaskProps,
...useFormProps,
// override of useFieldProps > modelValue
modelValue: [String, Number, FileList],
shadowText: String,
type: {
type: String,
default: "text"
},
debounce: [String, Number],
autogrow: Boolean,
// makes a textarea
inputClass: [Array, String, Object],
inputStyle: [Array, String, Object]
},
emits: [
...useFieldEmits,
"paste",
"change",
"keydown",
"click",
"animationend"
],
setup(props, { emit, attrs }) {
const { proxy } = getCurrentInstance();
const { $q } = proxy;
const temp = {};
let emitCachedValue = NaN, typedNumber, stopValueWatcher, emitTimer = null, emitValueFn;
const inputRef = ref(null);
const nameProp = useFormInputNameAttr(props);
const {
innerValue,
hasMask,
moveCursorForPaste,
updateMaskValue,
onMaskedKeydown,
onMaskedClick
} = useMask(props, emit, emitValue, inputRef);
const formDomProps = useFileFormDomProps(
props
);
const hasValue = computed(() => fieldValueIsFilled(innerValue.value));
const onComposition = useKeyComposition(onInput);
const state = useFieldState({ changeEvent: true });
const isTextarea = computed(
() => props.type === "textarea" || props.autogrow === true
);
const isTypeText = computed(
() => isTextarea.value === true || ["text", "search", "url", "tel", "password"].includes(props.type)
);
const onEvents = computed(() => {
const evt = {
...state.splitAttrs.listeners.value,
onInput,
onPaste,
// Safari < 10.2 & UIWebView doesn't fire compositionend when
// switching focus before confirming composition choice
// this also fixes the issue where some browsers e.g. iOS Chrome
// fires "change" instead of "input" on autocomplete.
onChange,
onBlur: onFinishEditing,
onFocus: stop
};
evt.onCompositionstart = evt.onCompositionupdate = evt.onCompositionend = onComposition;
if (hasMask.value === true) {
evt.onKeydown = onMaskedKeydown;
evt.onClick = onMaskedClick;
}
if (props.autogrow === true) {
evt.onAnimationend = onAnimationend;
}
return evt;
});
const inputAttrs = computed(() => {
const attrs2 = {
tabindex: 0,
"data-autofocus": props.autofocus === true || void 0,
rows: props.type === "textarea" ? 6 : void 0,
"aria-label": props.label,
name: nameProp.value,
...state.splitAttrs.attributes.value,
id: state.targetUid.value,
maxlength: props.maxlength,
disabled: props.disable === true,
readonly: props.readonly === true
};
if (isTextarea.value === false) {
attrs2.type = props.type;
}
if (props.autogrow === true) {
attrs2.rows = 1;
}
return attrs2;
});
watch(() => props.type, () => {
if (inputRef.value) {
inputRef.value.value = props.modelValue;
}
});
watch(() => props.modelValue, (v) => {
if (hasMask.value === true) {
if (stopValueWatcher === true) {
stopValueWatcher = false;
if (String(v) === emitCachedValue) {
return;
}
}
updateMaskValue(v);
} else if (innerValue.value !== v) {
innerValue.value = v;
if (props.type === "number" && temp.hasOwnProperty("value") === true) {
if (typedNumber === true) {
typedNumber = false;
} else {
delete temp.value;
}
}
}
props.autogrow === true && nextTick(adjustHeight);
});
watch(() => props.autogrow, (val) => {
if (val === true) {
nextTick(adjustHeight);
} else if (inputRef.value !== null && attrs.rows > 0) {
inputRef.value.style.height = "auto";
}
});
watch(() => props.dense, () => {
props.autogrow === true && nextTick(adjustHeight);
});
function focus() {
addFocusFn(() => {
const el = document.activeElement;
if (inputRef.value !== null && inputRef.value !== el && (el === null || el.id !== state.targetUid.value)) {
inputRef.value.focus({ preventScroll: true });
}
});
}
function select() {
inputRef.value !== null && inputRef.value.select();
}
function onPaste(e) {
if (hasMask.value === true && props.reverseFillMask !== true) {
const inp = e.target;
moveCursorForPaste(inp, inp.selectionStart, inp.selectionEnd);
}
emit("paste", e);
}
function onInput(e) {
if (!e || !e.target) {
return;
}
if (props.type === "file") {
emit("update:modelValue", e.target.files);
return;
}
const val = e.target.value;
if (e.target.qComposing === true) {
temp.value = val;
return;
}
if (hasMask.value === true) {
updateMaskValue(val, false, e.inputType);
} else {
emitValue(val);
if (isTypeText.value === true && e.target === document.activeElement) {
const { selectionStart, selectionEnd } = e.target;
if (selectionStart !== void 0 && selectionEnd !== void 0) {
nextTick(() => {
if (e.target === document.activeElement && val.indexOf(e.target.value) === 0) {
e.target.setSelectionRange(selectionStart, selectionEnd);
}
});
}
}
}
props.autogrow === true && adjustHeight();
}
function onAnimationend(e) {
emit("animationend", e);
adjustHeight();
}
function emitValue(val, stopWatcher) {
emitValueFn = () => {
emitTimer = null;
if (props.type !== "number" && temp.hasOwnProperty("value") === true) {
delete temp.value;
}
if (props.modelValue !== val && emitCachedValue !== val) {
emitCachedValue = val;
stopWatcher === true && (stopValueWatcher = true);
emit("update:modelValue", val);
nextTick(() => {
emitCachedValue === val && (emitCachedValue = NaN);
});
}
emitValueFn = void 0;
};
if (props.type === "number") {
typedNumber = true;
temp.value = val;
}
if (props.debounce !== void 0) {
emitTimer !== null && clearTimeout(emitTimer);
temp.value = val;
emitTimer = setTimeout(emitValueFn, props.debounce);
} else {
emitValueFn();
}
}
function adjustHeight() {
requestAnimationFrame(() => {
const inp = inputRef.value;
if (inp !== null) {
const parentStyle = inp.parentNode.style;
const { scrollTop } = inp;
const { overflowY, maxHeight } = $q.platform.is.firefox === true ? {} : window.getComputedStyle(inp);
const changeOverflow = overflowY !== void 0 && overflowY !== "scroll";
changeOverflow === true && (inp.style.overflowY = "hidden");
parentStyle.marginBottom = inp.scrollHeight - 1 + "px";
inp.style.height = "1px";
inp.style.height = inp.scrollHeight + "px";
changeOverflow === true && (inp.style.overflowY = parseInt(maxHeight, 10) < inp.scrollHeight ? "auto" : "hidden");
parentStyle.marginBottom = "";
inp.scrollTop = scrollTop;
}
});
}
function onChange(e) {
onComposition(e);
if (emitTimer !== null) {
clearTimeout(emitTimer);
emitTimer = null;
}
emitValueFn !== void 0 && emitValueFn();
emit("change", e.target.value);
}
function onFinishEditing(e) {
e !== void 0 && stop(e);
if (emitTimer !== null) {
clearTimeout(emitTimer);
emitTimer = null;
}
emitValueFn !== void 0 && emitValueFn();
typedNumber = false;
stopValueWatcher = false;
delete temp.value;
props.type !== "file" && setTimeout(() => {
if (inputRef.value !== null) {
inputRef.value.value = innerValue.value !== void 0 ? innerValue.value : "";
}
});
}
function getCurValue() {
return temp.hasOwnProperty("value") === true ? temp.value : innerValue.value !== void 0 ? innerValue.value : "";
}
onBeforeUnmount(() => {
onFinishEditing();
});
onMounted(() => {
props.autogrow === true && adjustHeight();
});
Object.assign(state, {
innerValue,
fieldClass: computed(
() => `q-${isTextarea.value === true ? "textarea" : "input"}` + (props.autogrow === true ? " q-textarea--autogrow" : "")
),
hasShadow: computed(
() => props.type !== "file" && typeof props.shadowText === "string" && props.shadowText.length !== 0
),
inputRef,
emitValue,
hasValue,
floatingLabel: computed(
() => hasValue.value === true && (props.type !== "number" || isNaN(innerValue.value) === false) || fieldValueIsFilled(props.displayValue)
),
getControl: () => {
return h(isTextarea.value === true ? "textarea" : "input", {
ref: inputRef,
class: [
"q-field__native q-placeholder",
props.inputClass
],
style: props.inputStyle,
...inputAttrs.value,
...onEvents.value,
...props.type !== "file" ? { value: getCurValue() } : formDomProps.value
});
},
getShadowControl: () => {
return h("div", {
class: "q-field__native q-field__shadow absolute-bottom no-pointer-events" + (isTextarea.value === true ? "" : " text-no-wrap")
}, [
h("span", { class: "invisible" }, getCurValue()),
h("span", props.shadowText)
]);
}
});
const renderFn = useField(state);
Object.assign(proxy, {
focus,
select,
getNativeElement: () => inputRef.value
// deprecated
});
injectProp(proxy, "nativeEl", () => inputRef.value);
return renderFn;
}
});
const _hoisted_1 = {
key: 1,
class: "q-ml-sm text-no-wrap"
};
const _hoisted_2 = {
key: 0,
class: "q-pa-none ellipsis",
style: { "min-height": "unset" }
};
const _hoisted_3 = { class: "flex items-center no-wrap" };
const _hoisted_4 = { class: "ellipsis text-no-wrap" };
const _hoisted_5 = { class: "v3-q-tel--country-selector last-search-item q-pa-sm" };
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "CountrySelection",
props: /* @__PURE__ */ mergeModels({
searchLabel: { default: "Search" },
searchIcon: { default: "search" },
noResultsText: { default: "No results found" },
useIcon: { type: Boolean, default: false },
autofocusInput: { type: Boolean },
class: { default: () => [] },
name: {},
virtualScrollHorizontal: { type: Boolean },
virtualScrollSliceSize: {},
virtualScrollSliceRatioBefore: {},
virtualScrollSliceRatioAfter: {},
virtualScrollItemSize: {},
virtualScrollStickySizeStart: {},
virtualScrollStickySizeEnd: {},
tableColspan: {},
error: { type: [Boolean, null] },
errorMessage: {},
noErrorIcon: { type: Boolean },
rules: {},
reactiveRules: { type: Boolean },
lazyRules: { type: [Boolean, String] },
label: {},
stackLabel: { type: Boolean },
hint: {},
hideHint: { type: Boolean },
prefix: {},
suffix: {},
labelColor: {},
color: {},
bgColor: {},
dark: { type: [Boolean, null] },
loading: { type: Boolean },
clearable: { type: Boolean },
clearIcon: {},
filled: { type: Boolean },
outlined: { type: Boolean },
standout: { type: [Boolean, String] },
labelSlot: { type: Boolean },
bottomSlots: { type: Boolean },
hideBottomSpace: { type: Boolean },
counter: { type: Boolean },
rounded: { type: Boolean },
square: { type: Boolean },
dense: { type: Boolean },
itemAligned: { type: Boolean },
disable: { type: Boolean },
readonly: { type: Boolean },
autofocus: { type: Boolean },
for: {},
multiple: { type: Boolean },
displayValue: {},
displayValueHtml: { type: Boolean },
optionValue: {},
optionLabel: {},
optionDisable: {},
hideSelected: { type: Boolean },
hideDropdownIcon: { type: Boolean },
dropdownIcon: {},
maxValues: {},
optionsDense: { type: Boolean },
optionsDark: { type: [Boolean, null] },
optionsSelectedClass: {},
optionsHtml: { type: Boolean },
optionsCover: { type: Boolean },
menuShrink: { type: Boolean },
menuAnchor: {},
menuSelf: {},
menuOffset: {},
popupContentClass: {},
popupContentStyle: {},
popupNoRouteDismiss: { type: Boolean },
useChips: { type: Boolean },
useInput: { type: Boolean },
maxlength: {},
fillInput: { type: Boolean },
newValueMode: {},
mapOptions: { type: Boolean },
disableTabSelection: { type: Boolean },
emitValue: { type: Boolean },
inputDebounce: {},
inputClass: {},
inputStyle: {},
tabindex: {},
autocomplete: {},
transitionShow: {},
transitionHide: {},
transitionDuration: {},
behavior: {},
onVirtualScroll: {},
"onUpdate:modelValue": {},
onFocus: {},
onBlur: {},
onClear: {},
onInputValue: {},
onRemove: {},
onAdd: {},
onNewValue: {},
onFilter: {},
onFilterAbort: {},
onPopupShow: {},
onPopupHide: {}
}, {
"country": {
required: true
},
"countryModifiers": {}
}),
emits: ["update:country"],
setup(__props) {
const $props = __props;
const $slots = useSlots();
const country = useModel(__props, "country");
const searchText = ref("");
const countryOptions = ref([...countries]);
const searchInput = ref();
const focusInput = () => {
nextTick(() => {
if ($props.autofocusInput && searchInput.value) {
searchInput.value.focus();
}
});
};
const performSearch = () => {
const needle = searchText.value.toLowerCase().trim();
const newCountries = needle === "" ? countries.concat() : filterCountries(needle);
if (newCountries.length === 0) {
newCountries.push({
name: $props.noResultsText,
dialCode: "",
iso2: "",
dialCodeSuffixes: [],
disabled: true
});
}
countryOptions.value.splice(0, countryOptions.value.length, ...newCountries);
};
const isDisabled = (option) => {
if (typeof option === "string") {
return false;
}
return !!option.disabled;
};
watch(
() => country.value,
() => {
searchText.value = "";
performSearch();
},
{
immediate: true
}
);
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(QSelect), mergeProps($props, {
"model-value": country.value,
options: countryOptions.value,
"option-disable": isDisabled,
"hide-bottom-space": "",
"hide-dropdown-icon": "",
borderless: "",
"virtual-scroll-slice-size": 9999,
"virtual-scroll-item-size": 29,
"virtual-scroll-sticky-size-start": 56,
class: ["no-inherit-feedback no-feedback v3-q-tel-input--country", $props.class],
"menu-offset": [12, 0],
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:country", $event)),
onPopupHide: _cache[2] || (_cache[2] = ($event) => searchText.value = ""),
onPopupShow: focusInput
}), createSlots({
option: withCtx((scope) => [
createElementVNode("div", mergeProps({ class: "flex items-center q-pa-xs mdi-border-bottom no-wrap" }, scope.itemProps), [
!!scope.opt.iso2 ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass(!_ctx.useIcon ? ["v3q_tel__flag", scope.opt.iso2.toLowerCase()] : "q-mr-sm")
}, toDisplayString(_ctx.useIcon ? scope.opt.flag : ""), 3)) : createCommentVNode("", true),
!!scope.opt.dialCode ? (openBlock(), createElementBlock("span", _hoisted_1, "(" + toDisplayString(scope.opt.dialCode) + ")", 1)) : createCommentVNode("", true),
createElementVNode("span", {
class: normalizeClass(["q-ml-sm text-no-wrap ellipsis", { "disabled full-width text-center": scope.opt.disabled }])
}, toDisplayString(scope.opt.name), 3)
], 16),
createVNode(unref(QSeparator))
]),
"selected-item": withCtx((scope) => [
scope.opt ? (openBlock(), createElementBlock("div", _hoisted_2, [
createElementVNode("div", _hoisted_3, [
createElementVNode("span", {
class: normalizeClass(!_ctx.useIcon ? ["v3q_tel__flag q-mr-sm", scope.opt.iso2.toLowerCase()] : "q-mr-sm")
}, toDisplayString(_ctx.useIcon ? scope.opt.flag : ""), 3),
createElementVNode("span", _hoisted_4, toDisplayString(scope.opt.dialCode), 1)
])
])) : createCommentVNode("", true)
]),
"before-options": withCtx(() => [
createElementVNode("div", _hoisted_5, [
createVNode(unref(QInput), {
ref_key: "searchInput",
ref: searchInput,
modelValue: searchText.value,
"onUpdate:modelValue": [
_cache[0] || (_cache[0] = ($event) => searchText.value = $event),
performSearch
],
dense: "",
outlined: "",
label: _ctx.searchLabel,
class: "bg-white"
}, {
prepend: withCtx(() => [
createVNode(unref(QIcon), {
name: _ctx.searchIcon ?? "search"
}, null, 8, ["name"])
]),
_: 1
}, 8, ["modelValue", "label"])
])
]),
_: 2
}, [
renderList($slots, (_, name) => {
return {
name,
fn: withCtx((scope) => [
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(scope ?? {})), void 0, true)
])
};
})
]), 1040, ["model-value", "options", "class"]);
};
}
});
const _export_sfc = (sfc, props) => {
const target2 = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target2[key] = val;
}
return target2;
};
const CountrySelection = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7e26c70b"]]);
const metadata = { "version": 4, "country_calling_codes": { "1": ["US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", "TC", "TT", "VC", "VG", "VI"], "7": ["RU", "KZ"], "20": ["EG"], "27": ["ZA"], "30": ["GR"], "31": ["NL"], "32": ["BE"], "33": ["FR"], "34": ["ES"], "36": ["HU"], "39": ["IT", "VA"], "40": ["RO"], "41": ["CH"], "43": ["AT"], "44": ["GB", "GG", "IM", "JE"], "45": ["DK"], "46": ["SE"], "47": ["NO", "SJ"], "48": ["PL"], "49": ["DE"], "51": ["PE"], "52": ["MX"], "53": ["CU"], "54": ["AR"], "55": ["BR"], "56": ["CL"], "57": ["CO"], "58": ["VE"], "60": ["MY"], "61": ["AU", "CC", "CX"], "62": ["ID"], "63": ["PH"], "64": ["NZ"], "65": ["SG"], "66": ["TH"], "81": ["JP"], "82": ["KR"], "84": ["VN"], "86": ["CN"], "90": ["TR"], "91": ["IN"], "92": ["PK"], "93": ["AF"], "94": ["LK"], "95": ["MM"], "98": ["IR"], "211": ["SS"], "212": ["MA", "EH"], "213": ["DZ"], "216": ["TN"], "218": ["LY"], "220": ["GM"], "221": ["SN"], "222": ["MR"], "223": ["ML"], "224": ["GN"], "225": ["CI"], "226": ["BF"], "227": ["NE"], "228": ["TG"], "229": ["BJ"], "230": ["MU"], "231": ["LR"], "232": ["SL"], "233": ["GH"], "234": ["NG"], "235": ["TD"], "236": ["CF"], "237": ["CM"], "238": ["CV"], "239": ["ST"], "240": ["GQ"], "241": ["GA"], "242": ["CG"], "243": ["CD"], "244": ["AO"], "245": ["GW"], "246": ["IO"], "247": ["AC"], "248": ["SC"], "249": ["SD"], "250": ["RW"], "251": ["ET"], "252": ["SO"], "253": ["DJ"], "254": ["KE"], "255": ["TZ"], "256": ["UG"], "257": ["BI"], "258": ["MZ"], "260": ["ZM"], "261": ["MG"], "262": ["RE", "YT"], "263": ["ZW"], "264": ["NA"], "265": ["MW"], "266": ["LS"], "267": ["BW"], "268": ["SZ"], "269": ["KM"], "290": ["SH", "TA"], "291": ["ER"], "297": ["AW"], "298": ["FO"], "299": ["GL"], "350": ["GI"], "351": ["PT"], "352": ["LU"], "353": ["IE"], "354": ["IS"], "355": ["AL"], "356": ["MT"], "357": ["CY"], "358": ["FI", "AX"], "359": ["BG"], "370": ["LT"], "371": ["LV"], "372": ["EE"], "373": ["MD"], "374": ["AM"], "375": ["BY"], "376": ["AD"], "377": ["MC"], "378": ["SM"], "380": ["UA"], "381": ["RS"], "382": ["ME"], "383": ["XK"], "385": ["HR"], "386": ["SI"], "387": ["BA"], "389": ["MK"], "420": ["CZ"], "421": ["SK"], "423": ["LI"], "500": ["FK"], "501": ["BZ"], "502": ["GT"], "503": ["SV"], "504": ["HN"], "505": ["NI"], "506": ["CR"], "507": ["PA"], "508": ["PM"], "509": ["HT"], "590": ["GP", "BL", "MF"], "591": ["BO"], "592": ["GY"], "593": ["EC"], "594": ["GF"], "595": ["PY"], "596": ["MQ"], "597": ["SR"], "598": ["UY"], "599": ["CW", "BQ"], "670": ["TL"], "672": ["NF"], "673": ["BN"], "674": ["NR"], "675": ["PG"], "676": ["TO"], "677": ["SB"], "678": ["VU"], "679": ["FJ"], "680": ["PW"], "681": ["WF"], "682": ["CK"], "683": ["NU"], "685": ["WS"], "686": ["KI"], "687": ["NC"], "688": ["TV"], "689": ["PF"], "690": ["TK"], "691": ["FM"], "692": ["MH"], "850": ["KP"], "852": ["HK"], "853": ["MO"], "855": ["KH"], "856": ["LA"], "880": ["BD"], "886": ["TW"], "960": ["MV"], "961": ["LB"], "962": ["JO"], "963": ["SY"], "964": ["IQ"], "965": ["KW"], "966": ["SA"], "967": ["YE"], "968": ["OM"], "970": ["PS"], "971": ["AE"], "972": ["IL"], "973": ["BH"], "974": ["QA"], "975": ["BT"], "976": ["MN"], "977": ["NP"], "992": ["TJ"], "993": ["TM"], "994": ["AZ"], "995": ["GE"], "996": ["KG"], "998": ["UZ"] }, "countries": { "AC": ["247", "00", "(?:[01589]\\d|[46])\\d{4}", [5, 6]], "AD": ["376", "00", "(?:1|6\\d)\\d{7}|[135-9]\\d{5}", [6, 8, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["[135-9]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["1"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]]], "AE": ["971", "00", "(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{2,9})", "$1 $2", ["60|8"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[236]|[479][2-8]"], "0$1"], ["(\\d{3})(\\d)(\\d{5})", "$1 $2 $3", ["[479]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"]], "0"], "AF": ["93", "00", "[2-7]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"]], "0"], "AG": ["1", "011", "(?:268|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([457]\\d{6})$|1", "268$1", 0, "268"], "AI": ["1", "011", "(?:264|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2457]\\d{6})$|1", "264$1", 0, "264"], "AL": ["355", "00", "(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}", [6, 7, 8, 9], [["(\\d{3})(\\d{3,4})", "$1 $2", ["80|9"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["4[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2358][2-5]|4"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["[23578]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["6"], "0$1"]], "0"], "AM": ["374", "00", "(?:[1-489]\\d|55|60|77)\\d{6}", [8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[89]0"], "0 $1"], ["(\\d{3})(\\d{5})", "$1 $2", ["2|3[12]"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["1|47"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[3-9]"], "0$1"]], "0"], "AO": ["244", "00", "[29]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[29]"]]]], "AR": ["54", "00", "(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}", [10, 11], [["(\\d{4})(\\d{2})(\\d{4})", "$1 $2-$3", ["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])", "2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["1"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2-$3", ["[23]"], "0$1", 1], ["(\\d)(\\d{4})(\\d{2})(\\d{4})", "$2 15-$3-$4", ["9(?:2[2-469]|3[3-578])", "9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))", "9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 15-$3-$4", ["91"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d{3})(\\d{3})(\\d{5})", "$1-$2-$3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 15-$3-$4", ["9"], "0$1", 0, "$1 $2 $3-$4"]], "0", 0, "0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?", "9$1"], "AS": ["1", "011", "(?:[58]\\d\\d|684|900)\\d{7}", [10], 0, "1", 0, "([267]\\d{6})$|1", "684$1", 0, "684"], "AT": ["43", "00", "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3,12})", "$1 $2", ["1(?:11|[2-9])"], "0$1"], ["(\\d{3})(\\d{2})", "$1 $2", ["517"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["5[079]"], "0$1"], ["(\\d{3})(\\d{3,10})", "$1 $2", ["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"], "0$1"], ["(\\d{4})(\\d{3,9})", "$1 $2", ["[2-467]|5[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,7})", "$1 $2 $3", ["5"], "0$1"]], "0"], "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "(183[12])|0", 0, 0, 0, [["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "AW": ["297", "00", "(?:[25-79]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[25-9]"]]]], "AX": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}", [5, 6, 7, 8, 9, 10, 11, 12], 0, "0", 0, 0, 0, 0, "18", 0, "00"], "AZ": ["994", "00", "365\\d{6}|(?:[124579]\\d|60|88)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[28]|2|365|46", "1[28]|2|365[45]|46", "1[28]|2|365(?:4|5[02])|46"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[13-9]"], "0$1"]], "0"], "BA": ["387", "00", "6\\d{8}|(?:[35689]\\d|49|70)\\d{6}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[1-3]|[7-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2-$3", ["[3-5]|6[56]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["6"], "0$1"]], "0"], "BB": ["1", "011", "(?:246|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "246$1", 0, "246"], "BD": ["880", "00", "[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{4,6})", "$1-$2", ["31[5-8]|[459]1"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1-$2", ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"], "0$1"], ["(\\d{4})(\\d{3,6})", "$1-$2", ["[13-9]|2[23]"], "0$1"], ["(\\d)(\\d{7,8})", "$1-$2", ["2"], "0$1"]], "0"], "BE": ["32", "00", "4\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:80|9)0"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[239]|4[23]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[15-8]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4"], "0$1"]], "0"], "BF": ["226", "00", "[025-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[025-7]"]]]], "BG": ["359", "00", "00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}", [6, 7, 8, 9, 12], [["(\\d)(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["43[1-6]|70[1-9]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:70|8)0"], "0$1"], ["(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3", ["43[1-7]|7"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[48]|9[08]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"]], "0"], "BH": ["973", "00", "[136-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[13679]|8[02-4679]"]]]], "BI": ["257", "00", "(?:[267]\\d|31)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2367]"]]]], "BJ": ["229", "00", "[24-689]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-689]"]]]], "BL": ["590", "00", "590\\d{6}|(?:69|80|9\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]], "BM": ["1", "011", "(?:441|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "441$1", 0, "441"], "BN": ["673", "00", "[2-578]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-578]"]]]], "BO": ["591", "00(?:1\\d)?", "8001\\d{5}|(?:[2-467]\\d|50)\\d{6}", [8, 9], [["(\\d)(\\d{7})", "$1 $2", ["[235]|4[46]"]], ["(\\d{8})", "$1", ["[67]"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["8"]]], "0", 0, "0(1\\d)?"], "BQ": ["599", "00", "(?:[34]1|7\\d)\\d{5}", [7], 0, 0, 0, 0, 0, 0, "[347]"], "BR": ["55", "00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)", "(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}", [8, 9, 10, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["300|4(?:0[02]|37)", "4(?:02|37)0|[34]00"]], ["(\\d{3})(\\d{2,3})(\\d{4})", "$1 $2 $3", ["(?:[358]|90)0"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"], "($1)"], ["(\\d{2})(\\d{5})(\\d{4})", "$1 $2-$3", ["[16][1-9]|[2-57-9]"], "($1)"]], "0", 0, "(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?", "$2"], "BS": ["1", "011", "(?:242|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([3-8]\\d{6})$|1", "242$1", 0, "242"], "BT": ["975", "00", "[17]\\d{7}|[2-8]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-68]|7[246]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[67]|7"]]]], "BW": ["267", "00", "(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["90"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[24-6]|3[15-9]"]], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37]"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["8"]]]], "BY": ["375", "810", "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3})", "$1 $2", ["800"], "8 $1"], ["(\\d{3})(\\d{2})(\\d{2,4})", "$1 $2 $3", ["800"], "8 $1"], ["(\\d{4})(\\d{2})(\\d{3})", "$1 $2-$3", ["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])", "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"], "8 0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["1(?:[56]|7[467])|2[1-3]"], "8 0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-4]"], "8 0$1"], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[89]"], "8 $1"]], "8", 0, "0|80?", 0, 0, 0, 0, "8~10"], "BZ": ["501", "00", "(?:0800\\d|[2-8])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-8]"]], ["(\\d)(\\d{3})(\\d{4})(\\d{3})", "$1-$2-$3-$4", ["0"]]]], "CA": ["1", "011", "(?:[2-8]\\d|90)\\d{8}|3\\d{6}", [7, 10], 0, "1", 0, 0, 0, 0, 0, [["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|90[25])[2-9]\\d{6}", [10]], ["", [10]], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]], ["900[2-9]\\d{6}", [10]], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}", [10]], 0, ["310\\d{4}", [7]], 0, ["600[2-9]\\d{6}", [10]]]], "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CD": ["243", "00", "(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[1-6]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["5"], "0$1"]], "0"], "CF": ["236", "00", "(?:[27]\\d{3}|8776)\\d{4}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[278]"]]]], "CG": ["242", "00", "222\\d{6}|(?:0\\d|80)\\d{7}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[02]"]]]], "CH": ["41", "00", "8\\d{11}|[2-9]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8[047]|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]|81"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["8"], "0$1"]], "0"], "CI": ["225", "00", "[02]\\d{9}", [10], [["(\\d{2})(\\d{2})(\\d)(\\d{5})", "$1 $2 $3 $4", ["2"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3 $4", ["0"]]]], "CK": ["682", "00", "[2-578]\\d{4}", [5], [["(\\d{2})(\\d{3})", "$1 $2", ["[2-578]"]]]], "CL": ["56", "(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0", "12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}", [9, 10, 11], [["(\\d{5})(\\d{4})", "$1 $2", ["219", "2196"], "($1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["44"]], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2[1-36]"], "($1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["9[2-9]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["60|8"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{3})(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["60"]]]], "CM": ["237", "00", "[26]\\d{8}|88\\d{6,7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["88"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[26]|88"]]]], "CN": ["86", "00|1(?:[12]\\d|79)\\d\\d00", "(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5,6})", "$1 $2", ["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]", "(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123", "10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"], "0$1"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]", "(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]", "85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])", "85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["(?:4|80)0"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|2(?:[02-57-9]|1[1-9])", "10|2(?:[02-57-9]|1[1-9])", "10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"], "0$1", 1], ["(\\d{3})(\\d{7,8})", "$1 $2", ["9"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["80"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[3-578]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["1[3-9]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["[12]"], "0$1", 1]], "0", 0, "(1(?:[12]\\d|79)\\d\\d)|0", 0, 0, 0, 0, "00"], "CO": ["57", "00(?:4(?:[14]4|56)|[579])", "60\\d{8}|(?:1\\d|[39])\\d{9}", [10, 11], [["(\\d{3})(\\d{7})", "$1 $2", ["6|90"], "($1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3[0-357]|91"]], ["(\\d)(\\d{3})(\\d{7})", "$1-$2-$3", ["1"], "0$1", 0, "$1 $2 $3"]], "0", 0, "0([3579]|4(?:[14]4|56))?"], "CR": ["506", "00", "(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}", [8, 10], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[3-9]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[89]"]]], 0, 0, "(19(?:0[0-2468]|1[09]|20|66|77|99))"], "CU": ["53", "119", "(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}", [6, 7, 8, 10], [["(\\d{2})(\\d{4,6})", "$1 $2", ["2[1-4]|[34]"], "(0$1)"], ["(\\d)(\\d{6,7})", "$1 $2", ["7"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["[56]"], "0$1"], ["(\\d{3})(\\d{7})", "$1 $2", ["8"], "0$1"]], "0"], "CV": ["238", "0", "(?:[2-59]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-589]"]]]], "CW": ["599", "00", "(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[3467]"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["9[4-8]"]]], 0, 0, 0, 0, 0, "[69]"], "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CY": ["357", "00", "(?:[279]\\d|[58]0)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[257-9]"]]]], "CZ": ["420", "00", "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}", [9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]]], "DE": ["49", "00", "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [["(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"], ["(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"], ["(\\d{4})(\\d{2,11})", "$1 $2", ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"], ["(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"], ["(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"], ["(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"], ["(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"], ["(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["15[03568]", "15(?:[0568]|31)"], "0$1"], ["(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"], ["(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"], ["(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]], "0"], "DJ": ["253", "00", "(?:2\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[27]"]]]], "DK": ["45", "00", "[2-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-9]"]]]], "DM": ["1", "011", "(?:[58]\\d\\d|767|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "767$1", 0, "767"], "DO": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "8001|8[024]9"], "DZ": ["213", "00", "(?:[1-4]|[5-79]\\d|80)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["9"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-8]"], "0$1"]], "0"], "EC": ["593", "00", "1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}", [8, 9, 10, 11], [["(\\d)(\\d{3})(\\d{4})", "$1 $2-$3", ["[2-7]"], "(0$1)", 0, "$1-$2-$3"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1"]]], "0"], "EE": ["372", "00", "8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88", "[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]], ["(\\d{4})(\\d{3,4})", "$1 $2", ["[45]|8(?:00|[1-49])", "[45]|8(?:00[1-9]|[1-49])"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], "EG": ["20", "00", "[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}", [8, 9, 10], [["(\\d)(\\d{7,8})", "$1 $2", ["[23]"], "0$1"], ["(\\d{2})(\\d{6,7})", "$1 $2", ["1[35]|[4-6]|8[2468]|9[235-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{8})", "$1 $2", ["1"], "0$1"]], "0"], "EH": ["212", "00", "[5-8]\\d{8}", [9], 0, "0", 0, 0, 0, 0, "528[89]"], "ER": ["291", "00", "[178]\\d{6}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[178]"], "0$1"]], "0"], "ES": ["34", "00", "[5-9]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]00"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-9]"]]]], "ET": ["251", "00", "(?:11|[2-579]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-579]"], "0$1"]], "0"], "FI": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{5})", "$1", ["20[2-59]"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1 $2", ["(?:[1-3]0|[68])0|70[07-9]"], "0$1"], ["(\\d{2})(\\d{4,8})", "$1 $2", ["[14]|2[09]|50|7[135]"], "0$1"], ["(\\d{2})(\\d{6,10})", "$1 $2", ["7"], "0$1"], ["(\\d)(\\d{4,9})", "$1 $2", ["(?:1[49]|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"], "0$1"]], "0", 0, 0, 0, 0, "1[03-79]|[2-9]", 0, "00"], "FJ": ["679", "0(?:0|52)", "45\\d{5}|(?:0800\\d|[235-9])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|45"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "FK": ["500", "00", "[2-7]\\d{4}", [5]], "FM": ["691", "00", "(?:[39]\\d\\d|820)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[389]"]]]], "FO": ["298", "00", "[2-9]\\d{5}", [6], [["(\\d{6})", "$1", ["[2-9]"]]], 0, 0, "(10(?:01|[12]0|88))"], "FR": ["33", "00", "[1-9]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0 $1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[1-79]"], "0$1"]], "0"], "GA": ["241", "00", "(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}", [7, 8], [["(\\d)(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-7]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["11|[67]"], "0$1"]], 0, 0, "0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})", "$1"], "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-35])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"], "GD": ["1", "011", "(?:473|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "473$1", 0, "473"], "GE": ["995", "00", "(?:[3-57]\\d\\d|800)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["32"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[57]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[348]"], "0$1"]], "0"], "GF": ["594", "00", "[56]94\\d{6}|(?:80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[56]|9[47]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[89]"], "0$1"]], "0"], "GG": ["44", "00", "(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?", [7, 9, 10], 0, "0", 0, "([25-9]\\d{5})$|0", "1481$1", 0, 0, [["1481[25-9]\\d{5}", [10]], ["7(?:(?:781|839)\\d|911[17])\\d{5}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]]], "GH": ["233", "00", "(?:[235]\\d{3}|800)\\d{5}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[235]"], "0$1"]], "0"], "GI": ["350", "00", "(?:[25]\\d|60)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["2"]]]], "GL": ["299", "00", "(?:19|[2-689]\\d|70)\\d{4}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["19|[2-9]"]]]], "GM": ["220", "00", "[2-9]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "GN": ["224", "00", "722\\d{6}|(?:3|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["3"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[67]"]]]], "GP": ["590", "00", "590\\d{6}|(?:69|80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]], "GQ": ["240", "00", "222\\d{6}|(?:3\\d|55|[89]0)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235]"]], ["(\\d{3})(\\d{6})", "$1 $2", ["[89]"]]]], "GR": ["30", "00", "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}", [10, 11, 12], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["21|7"]], ["(\\d{4})(\\d{6})", "$1 $2", ["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2689]"]], ["(\\d{3})(\\d{3,4})(\\d{5})", "$1 $2 $3", ["8"]]]], "GT": ["502", "00", "80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-8]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], "GU": ["1", "011", "(?:[58]\\d\\d|671|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "671$1", 0, "671"], "GW": ["245", "00", "[49]\\d{8}|4\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["40"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"]]]], "GY": ["592", "001", "(?:[2-8]\\d{3}|9008)\\d{3}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "HK": ["852", "00(?:30|5[09]|[126-9]?)", "8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}", [5, 6, 7, 8, 9, 11], [["(\\d{3})(\\d{2,5})", "$1 $2", ["900", "9003"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{3})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "HN": ["504", "00", "8\\d{10}|[237-9]\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["[237-9]"]]]], "HR": ["385", "00", "(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}", [6, 7, 8, 9], [["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["6[01]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{4})(\\d{3})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6|7[245]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-57]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"]], "0"], "HT": ["509", "00", "(?:[2-489]\\d|55)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[2-589]"]]]], "HU": ["36", "00", "[235-7]\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "06 $1"]], "06"], "ID": ["62", "00[89]", "00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}", [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["15"]], ["(\\d{2})(\\d{5,9})", "$1 $2", ["2[124]|[36]1"], "(0$1)"], ["(\\d{3})(\\d{5,7})", "$1 $2", ["800"], "0$1"], ["(\\d{3})(\\d{5,8})", "$1 $2", ["[2-79]"], "(0$1)"], ["(\\d{3})(\\d{3,4})(\\d{3})", "$1-$2-$3", ["8[1-35-9]"], "0$1"], ["(\\d{3})(\\d{6,8})", "$1 $2", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["804"], "0$1"], ["(\\d{3})(\\d)(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["80"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1-$2-$3", ["8"], "0$1"]], "0"], "IE": ["353", "00", "(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["2[24-9]|47|58|6[237-9]|9[35-9]"], "(0$1)"], ["(\\d{3})(\\d{5})", "$1 $2", ["[45]0"], "(0$1)"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2569]|4[1-69]|7[14]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["81"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["4"], "(0$1)"], ["(\\d{2})(\\d)(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "IL": ["972", "0(?:0|1[2-9])", "1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}", [7, 8, 9, 10, 11, 12], [["(\\d{4})(\\d{3})", "$1-$2", ["125"]], ["(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3", ["121"]], ["(\\d)(\\d{3})(\\d{4})", "$1-$2-$3", ["[2-489]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1-$2-$3", ["12"]], ["(\\d{4})(\\d{6})", "$1-$2", ["159"]], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3-$4", ["1[7-9]"]], ["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})", "$1-$2 $3-$4", ["15"]]], "0"], "IM": ["44", "00", "1624\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([25-8]\\d{5})$|0", "1624$1", 0, "74576|(?:16|7[56])24"], "IN": ["91", "00", "(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}", [8, 9, 10, 11, 12, 13], [["(\\d{8})", "$1", ["5(?:0|2[23]|3[03]|[67]1|88)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"], 0, 1], ["(\\d{4})(\\d{4,5})", "$1 $2", ["180", "1800"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["140"], 0, 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["11|2[02]|33|4[04]|79[1-7]|80[2-46]", "11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])", "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"], "0$1", 1], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807", "1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]", "1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"], "0$1", 1], ["(\\d{5})(\\d{5})", "$1 $2", ["[6-9]"], "0$1", 1], ["(\\d{4})(\\d{2,4})(\\d{4})", "$1 $2 $3", ["1(?:6|8[06])", "1(?:6|8[06]0)"], 0, 1], ["(\\d{4})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["18"], 0, 1]], "0"], "IO": ["246", "00", "3\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["3"]]]], "IQ": ["964", "00", "(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-6]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0"], "IR": ["98", "00", "[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}", [4, 5, 6, 7, 10], [["(\\d{4,5})", "$1", ["96"], "0$1"], ["(\\d{2})(\\d{4,5})", "$1 $2", ["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[1-8]"], "0$1"]], "0"], "IS": ["354", "00|1(?:0(?:01|[12]0)|100)", "(?:38\\d|[4-9])\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "IT": ["39", "00", "0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", [6, 7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], ["(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], ["(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], ["(\\d{4})(\\d{4})", "$1 $2", ["894"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1(?:44|[679])|[378]|43"]], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], ["(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, [["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}", [6, 7, 8, 9, 10, 11]], ["3[2-9]\\d{7,8}|(?:31|43)\\d{8}", [9, 10]], ["80(?:0\\d{3}|3)\\d{3}", [6, 9]], ["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", [6, 8, 9, 10]], ["1(?:78\\d|99)\\d{6}", [9, 10]], ["3[2-8]\\d{9,10}", [11, 12]], 0, 0, ["55\\d{8}", [10]], ["84(?:[08]\\d{3}|[17])\\d{3}", [6, 9]]]], "JE": ["44", "00", "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([0-24-8]\\d{5})$|0", "1534$1", 0, 0, [["1534[0-24-8]\\d{5}"], ["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"], ["80(?:07(?:35|81)|8901)\\d{4}"], ["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"], ["701511\\d{4}"], 0, ["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"], ["56\\d{8}"]]], "JM": ["1", "011", "(?:[58]\\d\\d|658|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "658|876"], "JO": ["962", "00", "(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2356]|87"], "(0$1)"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["70"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0"], "JP": ["81", "010", "00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}", [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3", ["(?:12|57|99)0"], "0$1"], ["(\\d{4})(\\d)(\\d{4})", "$1-$2-$3", ["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2-$3", ["[36]|4(?:2[09]|7[01])", "[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3", ["[14]|[289][2-9]|5[3-9]|7[2-4679]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["800"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[257-9]"], "0$1"]], "0", 0, "(000[259]\\d{6})$|(?:(?:003768)0?)|0", "$1"], "KE": ["254", "000", "(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}", [7, 8, 9, 10], [["(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0"], "KG": ["996", "00", "8\\d{9}|[235-9]\\d{8}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["3(?:1[346]|[24-79])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-79]|88"], "0$1"], ["(\\d{3})(\\d{3})(\\d)(\\d{2,3})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "KH": ["855", "00[14-9]", "1\\d{9}|[1-9]\\d{7,8}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "KI": ["686", "00", "(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}", [5, 8], 0, "0"], "KM": ["269", "00", "[3478]\\d{6}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[3478]"]]]], "KN": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "869$1", 0, "869"], "KP": ["850", "00|99", "85\\d{6}|(?:19\\d|[2-7])\\d{7}", [8, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"]], "0"], "KR": ["82", "00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))", "00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}", [5, 6, 8, 9, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{3,4})", "$1-$2", ["(?:3[1-3]|[46][1-4]|5[1-5])1"], "0$1"], ["(\\d{4})(\\d{4})", "$1-$2", ["1"]], ["(\\d)(\\d{3,4})(\\d{4})", "$1-$2-$3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[36]0|8"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1-$2-$3", ["[1346]|5[1-5]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{2})(\\d{5})(\\d{4})", "$1-$2-$3", ["5"], "0$1"]], "0", 0, "0(8(?:[1-46-8]|5\\d\\d))?"], "KW": ["965", "00", "18\\d{5}|(?:[2569]\\d|41)\\d{6}", [7, 8], [["(\\d{4})(\\d{3,4})", "$1 $2", ["[169]|2(?:[235]|4[1-35-9])|52"]], ["(\\d{3})(\\d{5})", "$1 $2", ["[245]"]]]], "KY": ["1", "011", "(?:345|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "345$1", 0, "345"], "KZ": ["7", "810", "(?:33622|8\\d{8})\\d{5}|[78]\\d{9}", [10, 14], 0, "8", 0, 0, 0, 0, "33|7", 0, "8~10"], "LA": ["856", "00", "[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2[13]|3[14]|[4-8]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["30[0135-9]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0"], "LB": ["961", "00", "[27-9]\\d{7}|[13-9]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27-9]"]]], "0"], "LC": ["1", "011", "(?:[58]\\d\\d|758|900)\\d{7}", [10], 0, "1", 0, "([2-8]\\d{6})$|1", "758$1", 0, "758"], "LI": ["423", "00", "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", [7, 9], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2379]|8(?:0[09]|7)", "[2379]|8(?:0(?:02|9)|7)"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["69"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]], "0", 0, "(1001)|0"], "LK": ["94", "00", "[1-9]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[1-689]"], "0$1"]], "0"], "LR": ["231", "00", "(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["4[67]|[56]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-578]"], "0$1"]], "0"], "LS": ["266", "00", "(?:[256]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2568]"]]]], "LT": ["370", "00", "(?:[3469]\\d|52|[78]0)\\d{6}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["52[0-7]"], "(0-$1)", 1], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0 $1", 1], ["(\\d{2})(\\d{6})", "$1 $2", ["37|4(?:[15]|6[1-8])"], "(0-$1)", 1], ["(\\d{3})(\\d{5})", "$1 $2", ["[3-6]"], "(0-$1)", 1]], "0", 0, "[08]"], "LU": ["352", "00", "35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}", [4, 5, 6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{3})", "$1 $2", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["20[2-689]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4", ["2(?:[0367]|4[3-8])"]], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["80[01]|90[015]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["2(?:[0367]|4[3-8])"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]], 0, 0, "(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"], "LV": ["371", "00", "(?:[268]\\d|90)\\d{6}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[269]|8[01]"]]]], "LY": ["218", "00", "[2-9]\\d{8}", [9], [["(\\d{2})(\\d{7})", "$1-$2", ["[2-9]"], "0$1"]], "0"], "MA": ["212", "00", "[5-8]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5[45]"], "0$1"], ["(\\d{4})(\\d{5})", "$1-$2", ["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"], "0$1"], ["(\\d{2})(\\d{7})", "$1-$2", ["8"], "0$1"], ["(\\d{3})(\\d{6})", "$1-$2", ["[5-7]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"], ["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}"], ["80[0-7]\\d{6}"], ["89\\d{7}"], 0, 0, 0, 0, ["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]], "MC": ["377", "00", "(?:[3489]|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["4"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[389]"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["6"], "0$1"]], "0"], "MD": ["373", "00", "(?:[235-7]\\d|[89]0)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["22|3"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[25-7]"], "0$1"]], "0"], "ME": ["382", "00", "(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], "0"], "MF": ["590", "00", "590\\d{6}|(?:69|80|9\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}"]]], "MG": ["261", "00", "[23]\\d{8}", [9], [["(\\d{2})(\\d{2})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0", 0, "([24-9]\\d{6})$|0", "20$1"], "MH": ["692", "011", "329\\d{4}|(?:[256]\\d|45)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-6]"]]], "1"], "MK": ["389", "00", "[2-578]\\d{7}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2|34[47]|4(?:[37]7|5[47]|64)"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[347]"], "0$1"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[58]"], "0$1"]], "0"], "ML": ["223", "00", "[24-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-9]"]]]], "MM": ["95", "00", "1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}", [6, 7, 8, 9, 10], [["(\\d)(\\d{2})(\\d{3})", "$1 $2 $3", ["16|2"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]|452|678|86", "[12]|452|6788|86"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[4-7]|8[1-35]"], "0$1"], ["(\\d)(\\d{3})(\\d{4,6})", "$1 $2 $3", ["9(?:2[0-4]|[35-9]|4[137-9])"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["92"], "0$1"], ["(\\d)(\\d{5})(\\d{4})", "$1 $2 $3", ["9"], "0$1"]], "0"], "MN": ["976", "001", "[12]\\d{7,9}|[5-9]\\d{7}", [8, 9, 10], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[12]1"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[5-9]"]], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[12]2[1-3]"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["[12](?:27|3[2-8]|4[2-68]|5[1-4689])", "[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["[12]"], "0$1"]], "0"], "MO": ["853", "00", "0800\\d{3}|(?:28|[68]\\d)\\d{6}", [7, 8], [["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[268]"]]]], "MP": ["1", "011", "[58]\\d{9}|(?:67|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "670$1", 0, "670"], "MQ": ["596", "00", "596\\d{6}|(?:69|80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "MR": ["222", "00", "(?:[2-4]\\d\\d|800)\\d{5}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-48]"]]]], "MS": ["1", "011", "(?:[58]\\d\\d|664|900)\\d{7}", [10], 0, "1", 0, "([34]\\d{6})$|1", "664$1", 0, "664"], "MT": ["356", "00", "3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2357-9]"]]]], "MU": ["230", "0(?:0|[24-7]0|3[03])", "(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46]|8[013]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[57]"]], ["(\\d{5})(\\d{5})", "$1 $2", ["8"]]], 0, 0, 0, 0, 0, 0, 0, "020"], "MV": ["960", "0(?:0|19)", "(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}", [7, 10], [["(\\d{3})(\\d{4})", "$1-$2", ["[34679]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "MW": ["265", "00", "(?:[1289]\\d|31|77)\\d{7}|1\\d{6}", [7, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["1[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[137-9]"], "0$1"]], "0"], "MX": ["52", "0[09]", "[2-9]\\d{9}", [10], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["33|5[56]|81"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-9]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "MY": ["60", "00", "1\\d{8,9}|(?:3\\d|[4-9])\\d{7}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1-$2 $3", ["[4-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1-$2 $3", ["1(?:[02469]|[378][1-9]|53)|8", "1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2 $3", ["3"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3-$4", ["1(?:[367]|80)"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2 $3", ["15"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2 $3", ["1"], "0$1"]], "0"], "MZ": ["258", "00", "(?:2|8\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2|8[2-79]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], "NA": ["264", "00", "[68]\\d{7,8}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["87"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], "NC": ["687", "00", "(?:050|[2-57-9]\\d\\d)\\d{3}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1.$2.$3", ["[02-57-9]"]]]], "NE": ["227", "00", "[027-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["08"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[089]|2[013]|7[0467]"]]]], "NF": ["672", "00", "[13]\\d{5}", [6], [["(\\d{2})(\\d{4})", "$1 $2", ["1[0-3]"]], ["(\\d)(\\d{5})", "$1 $2", ["[13]"]]], 0, 0, "([0-258]\\d{4})$", "3$1"], "NG": ["234", "009", "38\\d{6}|[78]\\d{9,13}|(?:20|9\\d)\\d{8}", [8, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["3"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["20[129]"], "0$1"], ["(\\d{4})(\\d{2})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{3})(\\d{5})(\\d{5,6})", "$1 $2 $3", ["[78]"], "0$1"]], "0"], "NI": ["505", "00", "(?:1800|[25-8]\\d{3})\\d{4}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[125-8]"]]]], "NL": ["31", "00", "(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}", [5, 6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{4,7})", "$1 $2", ["[89]0"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["66"], "0$1"], ["(\\d)(\\d{8})", "$1 $2", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-578]|91"], "0$1"], ["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3", ["9"], "0$1"]], "0"], "NO": ["47", "00", "(?:0|[2-9]\\d{3})\\d{4}", [5, 8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]"]]], 0, 0, 0, 0, 0, "[02-689]|7[0-8]"], "NP": ["977", "00", "(?:1\\d|9)\\d{9}|[1-9]\\d{7}", [8, 10, 11], [["(\\d)(\\d{7})", "$1-$2", ["1[2-6]"], "0$1"], ["(\\d{2})(\\d{6})", "$1-$2", ["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"], "0$1"], ["(\\d{3})(\\d{7})", "$1-$2", ["9"]]], "0"], "NR": ["674", "00", "(?:444|(?:55|8\\d)\\d|666)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-68]"]]]], "NU": ["683", "00", "(?:[4-7]|888\\d)\\d{3}", [4, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["8"]]]], "NZ": ["64", "0(?:0|161)", "[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,8})", "$1 $2", ["8[1-79]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["50[036-8]|8|90", "50(?:[0367]|88)|8|90"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["24|[346]|7[2-57-9]|9[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:10|74)|[589]"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1|2[028]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,5})", "$1 $2 $3", ["2(?:[169]|7[0-35-9])|7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "00"], "OM": ["968", "00", "(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}", [7, 8, 9], [["(\\d{3})(\\d{4,6})", "$1 $2", ["[58]"]], ["(\\d{2})(\\d{6})", "$1 $2", ["2"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[179]"]]]], "PA": ["507", "00", "(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}", [7, 8, 10, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[1-57-9]"]], ["(\\d{4})(\\d{4})", "$1-$2", ["[68]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]]], "PE": ["51", "00|19(?:1[124]|77|90)00", "(?:[14-8]|9\\d)\\d{7}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["80"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["1"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[4-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"]]], "0", 0, 0, 0, 0, 0, 0, "00", " Anexo "], "PF": ["689", "00", "4\\d{5}(?:\\d{2})?|8\\d{7,8}", [6, 8, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["44"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4|8[7-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], "PG": ["675", "00|140[1-3]", "(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["18|[2-69]|85"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[78]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "PH": ["63", "00", "(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}", [6, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{5})", "$1 $2", ["2"], "(0$1)"], ["(\\d{4})(\\d{4,6})", "$1 $2", ["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2", "3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"], "(0$1)"], ["(\\d{5})(\\d{4})", "$1 $2", ["346|4(?:27|9[35])|883", "3469|4(?:279|9(?:30|56))|8834"], "(0$1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|8[2-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["1"]]], "0"], "PK": ["92", "00", "122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,7})", "$1 $2 $3", ["[89]0"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["1"]], ["(\\d{3})(\\d{6,7})", "$1 $2", ["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])", "9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"], "(0$1)"], ["(\\d{2})(\\d{7,8})", "$1 $2", ["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"], "(0$1)"], ["(\\d{5})(\\d{5})", "$1 $2", ["58"], "(0$1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[24-9]"], "(0$1)"]], "0"], "PL": ["48", "00", "(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{5})", "$1", ["19"]], ["(\\d{3})(\\d{3})", "$1 $2", ["11|20|64"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1", "(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["64"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[2-8]|[2-7]|8[1-79]|9[145]"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["8"]]]], "PM": ["508", "00", "[45]\\d{5}|(?:708|80\\d)\\d{6}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[45]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], "PR": ["1", "011", "(?:[589]\\d\\d|787)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "787|939"], "PS": ["970", "00", "[2489]2\\d{6}|(?:1\\d|5)\\d{8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2489]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "PT": ["351", "00", "1693\\d{5}|(?:[26-9]\\d|30)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["2[12]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["16|[236-9]"]]]], "PW": ["680", "01[12]", "(?:[24-8]\\d\\d|345|900)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], "PY": ["595", "00", "59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3,6})", "$1 $2", ["[2-9]0"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"], "(0$1)"], ["(\\d{3})(\\d{4,5})", "$1 $2", ["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["87"]], ["(\\d{3})(\\d{6})", "$1 $2", ["9(?:[5-79]|8[1-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"]]], "0"], "QA": ["974", "00", "800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}", [7, 8, 9, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["2[16]|8"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[3-7]"]]]], "RE": ["262", "00", "(?:26|[689]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2689]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"], ["69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))\\d{4}"], ["80\\d{7}"], ["89[1-37-9]\\d{6}"], 0, 0, 0, 0, ["9(?:399[0-3]|479[0-5]|76(?:2[278]|3[0-37]))\\d{4}"], ["8(?:1[019]|2[0156]|84|90)\\d{6}"]]], "RO": ["40", "00", "(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}", [6, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["2[3-6]", "2[3-6]\\d9"], "0$1"], ["(\\d{2})(\\d{4})", "$1 $2", ["219|31"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[23]1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[236-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, " int "], "RS": ["381", "00", "38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}", [6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{3,9})", "$1 $2", ["(?:2[389]|39)0|[7-9]"], "0$1"], ["(\\d{2})(\\d{5,10})", "$1 $2", ["[1-36]"], "0$1"]], "0"], "RU": ["7", "810", "8\\d{13}|[347-9]\\d{9}", [10, 14], [["(\\d{4})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-8]|2[1-9])", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"], "8 ($1)", 1], ["(\\d{5})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-68]|2[1-9])", "7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))", "7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[349]|8(?:[02-7]|1[1-8])"], "8 ($1)", 1], ["(\\d{4})(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["8"], "8 ($1)"]], "8", 0, 0, 0, 0, "3[04-689]|[489]", 0, "8~10"], "RW": ["250", "00", "(?:06|[27]\\d\\d|[89]00)\\d{6}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0$1"]], "0"], "SA": ["966", "00", "92\\d{7}|(?:[15]|8\\d)\\d{8}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["9"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["81"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]], "0"], "SB": ["677", "0[01]", "[6-9]\\d{6}|[1-6]\\d{4}", [5, 7], [["(\\d{2})(\\d{5})", "$1 $2", ["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]], "SC": ["248", "010|0[0-2]", "(?:[2489]\\d|64)\\d{5}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[246]|9[57]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "SD": ["249", "00", "[19]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], "SE": ["46", "00", "(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}", [6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["20"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{4})", "$1-$2", ["9(?:00|39|44|9)"], "0$1", 0, "$1 $2"], ["(\\d{2})(\\d{3})(\\d{2})", "$1-$2 $3", ["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3"], ["(\\d)(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{2,3})(\\d{3})", "$1-$2 $3", ["9(?:00|39|44)"], "0$1", 0, "$1 $2 $3"], ["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["10|7"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{3})", "$1-$2 $3 $4", ["9"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4 $5", ["[26]"], "0$1", 0, "$1 $2 $3 $4 $5"]], "0"], "SG": ["65", "0[0-3]\\d", "(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-9]|[1-9])"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{4})(\\d{4})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], "SH": ["290", "00", "(?:[256]\\d|8)\\d{3}", [4, 5], 0, 0, 0, 0, 0, 0, "[256]"], "SI": ["386", "00|10(?:22|66|88|99)", "[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}", [5, 6, 7, 8], [["(\\d{2})(\\d{3,6})", "$1 $2", ["8[09]|9"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["59|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37][01]|4[0139]|51|6"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-57]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, 0, "00"], "SJ": ["47", "00", "0\\d{4}|(?:[489]\\d|79)\\d{6}", [5, 8], 0, 0, 0, 0, 0, 0, "79"], "SK": ["421", "00", "[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}", [6, 7, 9], [["(\\d)(\\d{2})(\\d{3,4})", "$1 $2 $3", ["21"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["[3-5][1-8]1", "[3-5][1-8]1[67]"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1/$2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[689]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1/$2 $3 $4", ["[3-5]"], "0$1"]], "0"], "SL": ["232", "00", "(?:[237-9]\\d|66)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[236-9]"], "(0$1)"]], "0"], "SM": ["378", "00", "(?:0549|[5-7]\\d)\\d{6}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]"]], ["(\\d{4})(\\d{6})", "$1 $2", ["0"]]], 0, 0, "([89]\\d{5})$", "0549$1"], "SN": ["221", "00", "(?:[378]\\d|93)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[379]"]]]], "SO": ["252", "00", "[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}", [6, 7, 8, 9], [["(\\d{2})(\\d{4})", "$1 $2", ["8[125]"]], ["(\\d{6})", "$1", ["[134]"]], ["(\\d)(\\d{6})", "$1 $2", ["[15]|2[0-79]|3[0-46-8]|4[0-7]"]], ["(\\d)(\\d{7})", "$1 $2", ["(?:2|90)4|[67]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[348]|64|79|90"]], ["(\\d{2})(\\d{5,7})", "$1 $2", ["1|28|6[0-35-9]|77|9[2-9]"]]], "0"], "SR": ["597", "00", "(?:[2-5]|68|[78]\\d)\\d{5}", [6, 7], [["(\\d{2})(\\d{2})(\\d{2})", "$1-$2-$3", ["56"]], ["(\\d{3})(\\d{3})", "$1-$2", ["[2-5]"]], ["(\\d{3})(\\d{4})", "$1-$2", ["[6-8]"]]]], "SS": ["211", "00", "[19]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], "ST": ["239", "00", "(?:22|9\\d)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[29]"]]]], "SV": ["503", "00", "[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?", [7, 8, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[89]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[267]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[89]"]]]], "SX": ["1", "011", "7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "(5\\d{6})$|1", "721$1", 0, "721"], "SY": ["963", "00", "[1-39]\\d{8}|[1-5]\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-5]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1", 1]], "0"], "SZ": ["268", "00", "0800\\d{4}|(?:[237]\\d|900)\\d{6}", [8, 9], [["(\\d{4})(\\d{4})", "$1 $2", ["[0237]"]], ["(\\d{5})(\\d{4})", "$1 $2", ["9"]]]], "TA": ["290", "00", "8\\d{3}", [4], 0, 0, 0, 0, 0, 0, "8"], "TC": ["1", "011", "(?:[58]\\d\\d|649|900)\\d{7}", [10], 0, "1", 0, "([2-479]\\d{6})$|1", "649$1", 0, "649"], "TD": ["235", "00|16", "(?:22|[689]\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[26-9]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], "TG": ["228", "00", "[279]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[279]"]]]], "TH": ["66", "00[1-9]", "(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}", [8, 9, 10, 13], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[13-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], "TJ": ["992", "810", "[0-57-9]\\d{8}", [9], [["(\\d{6})(\\d)(\\d{2})", "$1 $2 $3", ["331", "3317"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["44[02-479]|[34]7"]], ["(\\d{4})(\\d)(\\d{4})", "$1 $2 $3", ["3(?:[1245]|3[12])"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[0-57-9]"]]], 0, 0, 0, 0, 0, 0, 0, "8~10"], "TK": ["690", "00", "[2-47]\\d{3,6}", [4, 5, 6, 7]], "TL": ["670", "00", "7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-489]|70"]], ["(\\d{4})(\\d{4})", "$1 $2", ["7"]]]], "TM": ["993", "810", "(?:[1-6]\\d|71)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["12"], "(8 $1)"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-5]"], "(8 $1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[67]"], "8 $1"]], "8", 0, 0, 0, 0, 0, 0, "8~10"], "TN": ["216", "00", "[2-57-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-57-9]"]]]], "TO": ["676", "00", "(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}", [5, 7], [["(\\d{2})(\\d{3})", "$1-$2", ["[2-4]|50|6[09]|7[0-24-69]|8[05]"]], ["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[5-9]"]]]], "TR": ["90", "00", "4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}", [7, 10, 12, 13], [["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["512|8[01589]|90"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5(?:[0-59]|61)", "5(?:[0-59]|61[06])", "5(?:[0-59]|61[06]1)"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24][1-8]|3[1-9]"], "(0$1)", 1], ["(\\d{3})(\\d{3})(\\d{6,7})", "$1 $2 $3", ["80"], "0$1", 1]], "0"], "TT": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-46-8]\\d{6})$|1", "868$1", 0, "868"], "TV": ["688", "00", "(?:2|7\\d\\d|90)\\d{4}", [5, 6, 7], [["(\\d{2})(\\d{3})", "$1 $2", ["2"]], ["(\\d{2})(\\d{4})", "$1 $2", ["90"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], "TW": ["886", "0(?:0[25-79]|19)", "[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}", [7, 8, 9, 10, 11], [["(\\d{2})(\\d)(\\d{4})", "$1 $2 $3", ["202"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[258]0"], "0$1"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]", "[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, "#"], "TZ": ["255", "00[056]", "(?:[25-8]\\d|41|90)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[24]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["5"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[67]"], "0$1"]], "0"], "UA": ["380", "00", "[89]\\d{9}|[3-9]\\d{8}", [9, 10], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]", "6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])", "3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|89|9[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "0~0"], "UG": ["256", "00[057]", "800\\d{6}|(?:[29]0|[347]\\d)\\d{7}", [9], [["(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], "0"], "US": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [10], [["(\\d{3})(\\d{4})", "$1-$2", ["310"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3", ["[2-9]"], 0, 1, "$1-$2-$3"]], "1", 0, 0, 0, 0, 0, [["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[468])|7302[0-4]\\d)\\d{4}|(?:305[3-9]|472[24]|505[2-57-9]|7306|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"], 0, 0, 0, ["305209\\d{4}"]]], "UY": ["598", "0(?:0|1[3-9]\\d)", "0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}", [6, 7, 8, 9, 10, 11, 12, 13], [["(\\d{3})(\\d{3,4})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[49]0|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[124]"]], ["(\\d{3})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})", "$1 $2 $3 $4", ["0"]]], "0", 0, 0, 0, 0, 0, 0, "00", " int. "], "UZ": ["998", "00", "(?:20|33|[5-79]\\d|88)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[235-9]"]]]], "VA": ["39", "00", "0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}", [6, 7, 8, 9, 10, 11, 12], 0, 0, 0, 0, 0, 0, "06698"], "VC": ["1", "011", "(?:[58]\\d\\d|784|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "784$1", 0, "784"], "VE": ["58", "00", "[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}", [10], [["(\\d{3})(\\d{7})", "$1-$2", ["[24-689]"], "0$1"]], "0"], "VG": ["1", "011", "(?:284|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-578]\\d{6})$|1", "284$1", 0, "284"], "VI": ["1", "011", "[58]\\d{9}|(?:34|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "340$1", 0, "340"], "VN": ["84", "00", "[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["80"], "0$1", 1], ["(\\d{4})(\\d{4,6})", "$1 $2", ["1"], 0, 1], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["6"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[357-9]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["2[48]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["2"], "0$1", 1]], "0"], "VU": ["678", "00", "[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}", [5, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["[57-9]"]]]], "WF": ["681", "00", "(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[478]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], "WS": ["685", "0", "(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}", [5, 6, 7, 10], [["(\\d{5})", "$1", ["[2-5]|6[1-9]"]], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[68]"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], "XK": ["383", "00", "2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2|39"], "0$1"], ["(\\d{2})(\\d{7,10})", "$1 $2", ["3"], "0$1"]], "0"], "YE": ["967", "00", "(?:1|7\\d)\\d{7}|[1-7]\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-6]|7(?:[24-6]|8[0-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"], "0$1"]], "0"], "YT": ["262", "00", "(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}", [9], 0, "0", 0, 0, 0, 0, 0, [["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"], ["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"], ["80\\d{7}"], 0, 0, 0, 0, 0, ["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]], "ZA": ["27", "00", "[1-79]\\d{8}|8\\d{4,9}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,4})", "$1 $2", ["8[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["8[1-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["860"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], "ZM": ["260", "00", "800\\d{6}|(?:21|63|[79]\\d)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[28]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[79]"], "0$1"]], "0"], "ZW": ["263", "00", "2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}", [5, 6, 7, 8, 9, 10], [["(\\d{3})(\\d{3,5})", "$1 $2", ["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"], "0$1"], ["(\\d)(\\d{3})(\\d{2,4})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["80"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2", "2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)", "2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["29[013-9]|39|54"], "0$1"], ["(\\d{4})(\\d{3,5})", "$1 $2", ["(?:25|54)8", "258|5483"], "0$1"]], "0"] }, "nonGeographic": { "800": ["800", 0, "(?:00|[1-9]\\d)\\d{6}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["\\d"]]], 0, 0, 0, 0, 0, 0, [0, 0, ["(?:00|[1-9]\\d)\\d{6}"]]], "808": ["808", 0, "[1-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[1-9]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, ["[1-9]\\d{7}"]]], "870": ["870", 0, "7\\d{11}|[35-7]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[35-7]"]]], 0, 0, 0, 0, 0, 0, [0, ["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]], "878": ["878", 0, "10\\d{10}", [12], [["(\\d{2})(\\d{5})(\\d{5})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["10\\d{10}"]]], "881": ["881", 0, "6\\d{9}|[0-36-9]\\d{8}", [9, 10], [["(\\d)(\\d{3})(\\d{5})", "$1 $2 $3", ["[0-37-9]"]], ["(\\d)(\\d{3})(\\d{5,6})", "$1 $2 $3", ["6"]]], 0, 0, 0, 0, 0, 0, [0, ["6\\d{9}|[0-36-9]\\d{8}"]]], "882": ["882", 0, "[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5})", "$1 $2", ["16|342"]], ["(\\d{2})(\\d{6})", "$1 $2", ["49"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["1[36]|9"]], ["(\\d{2})(\\d{4})(\\d{3})", "$1 $2 $3", ["3[23]"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["16"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|23|3(?:[15]|4[57])|4|51"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["34"]], ["(\\d{2})(\\d{4,5})(\\d{5})", "$1 $2 $3", ["[1-35]"]]], 0, 0, 0, 0, 0, 0, [0, ["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}", [7, 8, 9, 10, 12]], 0, 0, 0, ["348[57]\\d{7}", [11]], 0, 0, ["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]], "883": ["883", 0, "(?:[1-4]\\d|51)\\d{6,10}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,8})", "$1 $2 $3", ["[14]|2[24-689]|3[02-689]|51[24-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["510"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["21"]], ["(\\d{4})(\\d{4})(\\d{4})", "$1 $2 $3", ["51[13]"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[235]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]], "888": ["888", 0, "\\d{11}", [11], [["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, ["\\d{11}"]]], "979": ["979", 0, "[1359]\\d{8}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, ["[1359]\\d{8}"]]] } };
function withMetadataArgument(func, _arguments) {
var args = Array.prototype.slice.call(_arguments);
args.push(metadata);
return func.apply(this, args);
}
function _typeof$1(obj) {
"@babel/helpers - typeof";
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof$1(obj);
}
function _createClass$2(Constructor, protoProps, staticProps) {
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _classCallCheck$2(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result2;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result2 = Reflect.construct(Super, arguments, NewTarget);
} else {
result2 = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result2);
};
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
if (Class2 === null || !_isNativeFunction(Class2)) return Class2;
if (typeof Class2 !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class2)) return _cache.get(Class2);
_cache.set(Class2, Wrapper);
}
function Wrapper() {
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } });
return _setPrototypeOf(Wrapper, Class2);
};
return _wrapNativeSuper(Class);
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct2(Parent2, args2, Class2) {
var a = [null];
a.push.apply(a, args2);
var Constructor = Function.bind.apply(Parent2, a);
var instance = new Constructor();
if (Class2) _setPrototypeOf(instance, Class2.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
return true;
} catch (e) {
return false;
}
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf(o, p);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf(o);
}
var ParseError = /* @__PURE__ */ function(_Error) {
_inherits(ParseError2, _Error);
var _super = _createSuper(ParseError2);
function ParseError2(code) {
var _this;
_classCallCheck$2(this, ParseError2);
_this = _super.call(this, code);
Object.setPrototypeOf(_assertThisInitialized(_this), ParseError2.prototype);
_this.name = _this.constructor.name;
return _this;
}
return _createClass$2(ParseError2);
}(/* @__PURE__ */ _wrapNativeSuper(Error));
var MIN_LENGTH_FOR_NSN = 2;
var MAX_LENGTH_FOR_NSN = 17;
var MAX_LENGTH_COUNTRY_CODE = 3;
var VALID_DIGITS = "0-90-9٠-٩۰-۹";
var DASHES = "-‐-―−ー-";
var SLASHES = "//";
var DOTS = "..";
var WHITESPACE = " ";
var BRACKETS = "()()[]\\[\\]";
var TILDES = "~⁓∼~";
var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
var PLUS_CHARS = "++";
function compare(a, b) {
a = a.split("-");
b = b.split("-");
var pa = a[0].split(".");
var pb = b[0].split(".");
for (var i = 0; i < 3; i++) {
var na = Number(pa[i]);
var nb = Number(pb[i]);
if (na > nb) return 1;
if (nb > na) return -1;
if (!isNaN(na) && isNaN(nb)) return 1;
if (isNaN(na) && !isNaN(nb)) return -1;
}
if (a[1] && b[1]) {
return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
}
return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
}
var objectConstructor = {}.constructor;
function isObject(object) {
return object !== void 0 && object !== null && object.constructor === objectConstructor;
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof(obj);
}
function _classCallCheck$1(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties$1(target2, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target2, descriptor.key, descriptor);
}
}
function _createClass$1(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
var V3 = "1.2.0";
var V4 = "1.7.35";
var DEFAULT_EXT_PREFIX = " ext. ";
var CALLING_CODE_REG_EXP = /^\d+$/;
var Metadata = /* @__PURE__ */ function() {
function Metadata2(metadata2) {
_classCallCheck$1(this, Metadata2);
validateMetadata(metadata2);
this.metadata = metadata2;
setVersion.call(this, metadata2);
}
_createClass$1(Metadata2, [{
key: "getCountries",
value: function getCountries() {
return Object.keys(this.metadata.countries).filter(function(_) {
return _ !== "001";
});
}
}, {
key: "getCountryMetadata",
value: function getCountryMetadata(countryCode) {
return this.metadata.countries[countryCode];
}
}, {
key: "nonGeographic",
value: function nonGeographic() {
if (this.v1 || this.v2 || this.v3) return;
return this.metadata.nonGeographic || this.metadata.nonGeographical;
}
}, {
key: "hasCountry",
value: function hasCountry(country) {
return this.getCountryMetadata(country) !== void 0;
}
}, {
key: "hasCallingCode",
value: function hasCallingCode(callingCode) {
if (this.getCountryCodesForCallingCode(callingCode)) {
return true;
}
if (this.nonGeographic()) {
if (this.nonGeographic()[callingCode]) {
return true;
}
} else {
var countryCodes = this.countryCallingCodes()[callingCode];
if (countryCodes && countryCodes.length === 1 && countryCodes[0] === "001") {
return true;
}
}
}
}, {
key: "isNonGeographicCallingCode",
value: function isNonGeographicCallingCode(callingCode) {
if (this.nonGeographic()) {
return this.nonGeographic()[callingCode] ? true : false;
} else {
return this.getCountryCodesForCallingCode(callingCode) ? false : true;
}
}
// Deprecated.
}, {
key: "country",
value: function country(countryCode) {
return this.selectNumberingPlan(countryCode);
}
}, {
key: "selectNumberingPlan",
value: function selectNumberingPlan(countryCode, callingCode) {
if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
callingCode = countryCode;
countryCode = null;
}
if (countryCode && countryCode !== "001") {
if (!this.hasCountry(countryCode)) {
throw new Error("Unknown country: ".concat(countryCode));
}
this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
} else if (callingCode) {
if (!this.hasCallingCode(callingCode)) {
throw new Error("Unknown calling code: ".concat(callingCode));
}
this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
} else {
this.numberingPlan = void 0;
}
return this;
}
}, {
key: "getCountryCodesForCallingCode",
value: function getCountryCodesForCallingCode(callingCode) {
var countryCodes = this.countryCallingCodes()[callingCode];
if (countryCodes) {
if (countryCodes.length === 1 && countryCodes[0].length === 3) {
return;
}
return countryCodes;
}
}
}, {
key: "getCountryCodeForCallingCode",
value: function getCountryCodeForCallingCode(callingCode) {
var countryCodes = this.getCountryCodesForCallingCode(callingCode);
if (countryCodes) {
return countryCodes[0];
}
}
}, {
key: "getNumberingPlanMetadata",
value: function getNumberingPlanMetadata(callingCode) {
var countryCode = this.getCountryCodeForCallingCode(callingCode);
if (countryCode) {
return this.getCountryMetadata(countryCode);
}
if (this.nonGeographic()) {
var metadata2 = this.nonGeographic()[callingCode];
if (metadata2) {
return metadata2;
}
} else {
var countryCodes = this.countryCallingCodes()[callingCode];
if (countryCodes && countryCodes.length === 1 && countryCodes[0] === "001") {
return this.metadata.countries["001"];
}
}
}
// Deprecated.
}, {
key: "countryCallingCode",
value: function countryCallingCode() {
return this.numberingPlan.callingCode();
}
// Deprecated.
}, {
key: "IDDPrefix",
value: function IDDPrefix() {
return this.numberingPlan.IDDPrefix();
}
// Deprecated.
}, {
key: "defaultIDDPrefix",
value: function defaultIDDPrefix() {
return this.numberingPlan.defaultIDDPrefix();
}
// Deprecated.
}, {
key: "nationalNumberPattern",
value: function nationalNumberPattern() {
return this.numberingPlan.nationalNumberPattern();
}
// Deprecated.
}, {
key: "possibleLengths",
value: function possibleLengths() {
return this.numberingPlan.possibleLengths();
}
// Deprecated.
}, {
key: "formats",
value: function formats() {
return this.numberingPlan.formats();
}
// Deprecated.
}, {
key: "nationalPrefixForParsing",
value: function nationalPrefixForParsing() {
return this.numberingPlan.nationalPrefixForParsing();
}
// Deprecated.
}, {
key: "nationalPrefixTransformRule",
value: function nationalPrefixTransformRule() {
return this.numberingPlan.nationalPrefixTransformRule();
}
// Deprecated.
}, {
key: "leadingDigits",
value: function leadingDigits() {
return this.numberingPlan.leadingDigits();
}
// Deprecated.
}, {
key: "hasTypes",
value: function hasTypes() {
return this.numberingPlan.hasTypes();
}
// Deprecated.
}, {
key: "type",
value: function type(_type) {
return this.numberingPlan.type(_type);
}
// Deprecated.
}, {
key: "ext",
value: function ext() {
return this.numberingPlan.ext();
}
}, {
key: "countryCallingCodes",
value: function countryCallingCodes() {
if (this.v1) return this.metadata.country_phone_code_to_countries;
return this.metadata.country_calling_codes;
}
// Deprecated.
}, {
key: "chooseCountryByCountryCallingCode",
value: function chooseCountryByCountryCallingCode(callingCode) {
return this.selectNumberingPlan(callingCode);
}
}, {
key: "hasSelectedNumberingPlan",
value: function hasSelectedNumberingPlan() {
return this.numberingPlan !== void 0;
}
}]);
return Metadata2;
}();
var NumberingPlan = /* @__PURE__ */ function() {
function NumberingPlan2(metadata2, globalMetadataObject) {
_classCallCheck$1(this, NumberingPlan2);
this.globalMetadataObject = globalMetadataObject;
this.metadata = metadata2;
setVersion.call(this, globalMetadataObject.metadata);
}
_createClass$1(NumberingPlan2, [{
key: "callingCode",
value: function callingCode() {
return this.metadata[0];
}
// Formatting information for regions which share
// a country calling code is contained by only one region
// for performance reasons. For example, for NANPA region
// ("North American Numbering Plan Administration",
// which includes USA, Canada, Cayman Islands, Bahamas, etc)
// it will be contained in the metadata for `US`.
}, {
key: "getDefaultCountryMetadataForRegion",
value: function getDefaultCountryMetadataForRegion() {
return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
}
// Is always present.
}, {
key: "IDDPrefix",
value: function IDDPrefix() {
if (this.v1 || this.v2) return;
return this.metadata[1];
}
// Is only present when a country supports multiple IDD prefixes.
}, {
key: "defaultIDDPrefix",
value: function defaultIDDPrefix() {
if (this.v1 || this.v2) return;
return this.metadata[12];
}
}, {
key: "nationalNumberPattern",
value: function nationalNumberPattern() {
if (this.v1 || this.v2) return this.metadata[1];
return this.metadata[2];
}
// "possible length" data is always present in Google's metadata.
}, {
key: "possibleLengths",
value: function possibleLengths() {
if (this.v1) return;
return this.metadata[this.v2 ? 2 : 3];
}
}, {
key: "_getFormats",
value: function _getFormats(metadata2) {
return metadata2[this.v1 ? 2 : this.v2 ? 3 : 4];
}
// For countries of the same region (e.g. NANPA)
// formats are all stored in the "main" country for that region.
// E.g. "RU" and "KZ", "US" and "CA".
}, {
key: "formats",
value: function formats() {
var _this = this;
var formats2 = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
return formats2.map(function(_) {
return new Format(_, _this);
});
}
}, {
key: "nationalPrefix",
value: function nationalPrefix() {
return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
}
}, {
key: "_getNationalPrefixFormattingRule",
value: function _getNationalPrefixFormattingRule(metadata2) {
return metadata2[this.v1 ? 4 : this.v2 ? 5 : 6];
}
// For countries of the same region (e.g. NANPA)
// national prefix formatting rule is stored in the "main" country for that region.
// E.g. "RU" and "KZ", "US" and "CA".
}, {
key: "nationalPrefixFormattingRule",
value: function nationalPrefixFormattingRule() {
return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
}
}, {
key: "_nationalPrefixForParsing",
value: function _nationalPrefixForParsing() {
return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
}
}, {
key: "nationalPrefixForParsing",
value: function nationalPrefixForParsing() {
return this._nationalPrefixForParsing() || this.nationalPrefix();
}
}, {
key: "nationalPrefixTransformRule",
value: function nationalPrefixTransformRule() {
return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
}
}, {
key: "_getNationalPrefixIsOptionalWhenFormatting",
value: function _getNationalPrefixIsOptionalWhenFormatting() {
return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
}
// For countries of the same region (e.g. NANPA)
// "national prefix is optional when formatting" flag is
// stored in the "main" country for that region.
// E.g. "RU" and "KZ", "US" and "CA".
}, {
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
}
}, {
key: "leadingDigits",
value: function leadingDigits() {
return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
}
}, {
key: "types",
value: function types() {
return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
}
}, {
key: "hasTypes",
value: function hasTypes() {
if (this.types() && this.types().length === 0) {
return false;
}
return !!this.types();
}
}, {
key: "type",
value: function type(_type2) {
if (this.hasTypes() && getType(this.types(), _type2)) {
return new Type(getType(this.types(), _type2), this);
}
}
}, {
key: "ext",
value: function ext() {
if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;
return this.metadata[13] || DEFAULT_EXT_PREFIX;
}
}]);
return NumberingPlan2;
}();
var Format = /* @__PURE__ */ function() {
function Format2(format, metadata2) {
_classCallCheck$1(this, Format2);
this._format = format;
this.metadata = metadata2;
}
_createClass$1(Format2, [{
key: "pattern",
value: function pattern() {
return this._format[0];
}
}, {
key: "format",
value: function format() {
return this._format[1];
}
}, {
key: "leadingDigitsPatterns",
value: function leadingDigitsPatterns() {
return this._format[2] || [];
}
}, {
key: "nationalPrefixFormattingRule",
value: function nationalPrefixFormattingRule() {
return this._format[3] || this.metadata.nationalPrefixFormattingRule();
}
}, {
key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
}
}, {
key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
}
// Checks whether national prefix formatting rule contains national prefix.
}, {
key: "usesNationalPrefix",
value: function usesNationalPrefix() {
return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
!FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) ? true : false;
}
}, {
key: "internationalFormat",
value: function internationalFormat() {
return this._format[5] || this.format();
}
}]);
return Format2;
}();
var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
var Type = /* @__PURE__ */ function() {
function Type2(type, metadata2) {
_classCallCheck$1(this, Type2);
this.type = type;
this.metadata = metadata2;
}
_createClass$1(Type2, [{
key: "pattern",
value: function pattern() {
if (this.metadata.v1) return this.type;
return this.type[0];
}
}, {
key: "possibleLengths",
value: function possibleLengths() {
if (this.metadata.v1) return;
return this.type[1] || this.metadata.possibleLengths();
}
}]);
return Type2;
}();
function getType(types, type) {
switch (type) {
case "FIXED_LINE":
return types[0];
case "MOBILE":
return types[1];
case "TOLL_FREE":
return types[2];
case "PREMIUM_RATE":
return types[3];
case "PERSONAL_NUMBER":
return types[4];
case "VOICEMAIL":
return types[5];
case "UAN":
return types[6];
case "PAGER":
return types[7];
case "VOIP":
return types[8];
case "SHARED_COST":
return types[9];
}
}
function validateMetadata(metadata2) {
if (!metadata2) {
throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");
}
if (!isObject(metadata2) || !isObject(metadata2.countries)) {
throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject(metadata2) ? "an object of shape: { " + Object.keys(metadata2).join(", ") + " }" : "a " + typeOf(metadata2) + ": " + metadata2, "."));
}
}
var typeOf = function typeOf2(_) {
return _typeof(_);
};
function getCountryCallingCode(country, metadata2) {
metadata2 = new Metadata(metadata2);
if (metadata2.hasCountry(country)) {
return metadata2.country(country).countryCallingCode();
}
throw new Error("Unknown country: ".concat(country));
}
function setVersion(metadata2) {
var version = metadata2.version;
if (typeof version === "number") {
this.v1 = version === 1;
this.v2 = version === 2;
this.v3 = version === 3;
this.v4 = version === 4;
} else {
if (!version) {
this.v1 = true;
} else if (compare(version, V3) === -1) {
this.v2 = true;
} else if (compare(version, V4) === -1) {
this.v3 = true;
} else {
this.v4 = true;
}
}
}
var RFC3966_EXTN_PREFIX = ";ext=";
var getExtensionDigitsPattern = function getExtensionDigitsPattern2(maxLength) {
return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
};
function createExtensionPattern(purpose) {
var extLimitAfterExplicitLabel = "20";
var extLimitAfterLikelyLabel = "15";
var extLimitAfterAmbiguousChar = "9";
var extLimitWhenNotSure = "6";
var possibleSeparatorsBetweenNumberAndExtLabel = "[ \\t,]*";
var possibleCharsAfterExtLabel = "[:\\..]?[ \\t,-]*";
var optionalExtnSuffix = "#?";
var explicitExtLabels = "(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)";
var ambiguousExtLabels = "(?:[xx##~~]|int|int)";
var ambiguousSeparator = "[- ]+";
var possibleSeparatorsNumberExtLabelNoComma = "[ \\t]*";
var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
}
var MIN_LENGTH_PHONE_NUMBER_PATTERN = "[" + VALID_DIGITS + "]{" + MIN_LENGTH_FOR_NSN + "}";
var VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){3,}[" + VALID_PUNCTUATION + VALID_DIGITS + "]*";
var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp("^[" + PLUS_CHARS + "]{0,1}(?:[" + VALID_PUNCTUATION + "]*[" + VALID_DIGITS + "]){1,2}$", "i");
var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions
"(?:" + createExtensionPattern() + ")?";
var VALID_PHONE_NUMBER_PATTERN = new RegExp(
// Either a short two-digit-only phone number
"^" + MIN_LENGTH_PHONE_NUMBER_PATTERN + "$|^" + VALID_PHONE_NUMBER_WITH_EXTENSION + "$",
"i"
);
function isViablePhoneNumber(number) {
return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);
}
function isViablePhoneNumberStart(number) {
return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
}
var EXTN_PATTERN = new RegExp("(?:" + createExtensionPattern() + ")$", "i");
function extractExtension(number) {
var start = number.search(EXTN_PATTERN);
if (start < 0) {
return {};
}
var numberWithoutExtension = number.slice(0, start);
var matches = number.match(EXTN_PATTERN);
var i = 1;
while (i < matches.length) {
if (matches[i]) {
return {
number: numberWithoutExtension,
ext: matches[i]
};
}
i++;
}
}
var DIGITS = {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"8": "8",
"9": "9",
"0": "0",
// Fullwidth digit 0
"1": "1",
// Fullwidth digit 1
"2": "2",
// Fullwidth digit 2
"3": "3",
// Fullwidth digit 3
"4": "4",
// Fullwidth digit 4
"5": "5",
// Fullwidth digit 5
"6": "6",
// Fullwidth digit 6
"7": "7",
// Fullwidth digit 7
"8": "8",
// Fullwidth digit 8
"9": "9",
// Fullwidth digit 9
"٠": "0",
// Arabic-indic digit 0
"١": "1",
// Arabic-indic digit 1
"٢": "2",
// Arabic-indic digit 2
"٣": "3",
// Arabic-indic digit 3
"٤": "4",
// Arabic-indic digit 4
"٥": "5",
// Arabic-indic digit 5
"٦": "6",
// Arabic-indic digit 6
"٧": "7",
// Arabic-indic digit 7
"٨": "8",
// Arabic-indic digit 8
"٩": "9",
// Arabic-indic digit 9
"۰": "0",
// Eastern-Arabic digit 0
"۱": "1",
// Eastern-Arabic digit 1
"۲": "2",
// Eastern-Arabic digit 2
"۳": "3",
// Eastern-Arabic digit 3
"۴": "4",
// Eastern-Arabic digit 4
"۵": "5",
// Eastern-Arabic digit 5
"۶": "6",
// Eastern-Arabic digit 6
"۷": "7",
// Eastern-Arabic digit 7
"۸": "8",
// Eastern-Arabic digit 8
"۹": "9"
// Eastern-Arabic digit 9
};
function parseDigit(character) {
return DIGITS[character];
}
function _createForOfIteratorHelperLoose$3(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike) {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return { done: true };
return { done: false, value: o[i++] };
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$4(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
}
function _arrayLikeToArray$4(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function parseIncompletePhoneNumber(string) {
var result2 = "";
for (var _iterator = _createForOfIteratorHelperLoose$3(string.split("")), _step; !(_step = _iterator()).done; ) {
var character = _step.value;
result2 += parsePhoneNumberCharacter(character, result2) || "";
}
return result2;
}
function parsePhoneNumberCharacter(character, prevParsedCharacters, emitEvent) {
if (character === "+") {
if (prevParsedCharacters) {
return;
}
return "+";
}
return parseDigit(character);
}
function checkNumberLength(nationalNumber, metadata2) {
return checkNumberLengthForType(nationalNumber, void 0, metadata2);
}
function checkNumberLengthForType(nationalNumber, type, metadata2) {
var type_info = metadata2.type(type);
var possible_lengths = type_info && type_info.possibleLengths() || metadata2.possibleLengths();
if (!possible_lengths) {
return "IS_POSSIBLE";
}
var actual_length = nationalNumber.length;
var minimum_length = possible_lengths[0];
if (minimum_length === actual_length) {
return "IS_POSSIBLE";
}
if (minimum_length > actual_length) {
return "TOO_SHORT";
}
if (possible_lengths[possible_lengths.length - 1] < actual_length) {
return "TOO_LONG";
}
return possible_lengths.indexOf(actual_length, 1) >= 0 ? "IS_POSSIBLE" : "INVALID_LENGTH";
}
function isPossiblePhoneNumber(input, options, metadata2) {
if (options === void 0) {
options = {};
}
metadata2 = new Metadata(metadata2);
if (options.v2) {
if (!input.countryCallingCode) {
throw new Error("Invalid phone number object passed");
}
metadata2.selectNumberingPlan(input.countryCallingCode);
} else {
if (!input.phone) {
return false;
}
if (input.country) {
if (!metadata2.hasCountry(input.country)) {
throw new Error("Unknown country: ".concat(input.country));
}
metadata2.country(input.country);
} else {
if (!input.countryCallingCode) {
throw new Error("Invalid phone number object passed");
}
metadata2.selectNumberingPlan(input.countryCallingCode);
}
}
if (metadata2.possibleLengths()) {
return isPossibleNumber(input.phone || input.nationalNumber, metadata2);
} else {
if (input.countryCallingCode && metadata2.isNonGeographicCallingCode(input.countryCallingCode)) {
return true;
} else {
throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
}
}
}
function isPossibleNumber(nationalNumber, metadata2) {
switch (checkNumberLength(nationalNumber, metadata2)) {
case "IS_POSSIBLE":
return true;
default:
return false;
}
}
function matchesEntirely(text, regular_expression) {
text = text || "";
return new RegExp("^(?:" + regular_expression + ")$").test(text);
}
function _createForOfIteratorHelperLoose$2(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike) {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return { done: true };
return { done: false, value: o[i++] };
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$3(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
}
function _arrayLikeToArray$3(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
var NON_FIXED_LINE_PHONE_TYPES = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
function getNumberType(input, options, metadata2) {
options = options || {};
if (!input.country && !input.countryCallingCode) {
return;
}
metadata2 = new Metadata(metadata2);
metadata2.selectNumberingPlan(input.country, input.countryCallingCode);
var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
if (!matchesEntirely(nationalNumber, metadata2.nationalNumberPattern())) {
return;
}
if (isNumberTypeEqualTo(nationalNumber, "FIXED_LINE", metadata2)) {
if (metadata2.type("MOBILE") && metadata2.type("MOBILE").pattern() === "") {
return "FIXED_LINE_OR_MOBILE";
}
if (!metadata2.type("MOBILE")) {
return "FIXED_LINE_OR_MOBILE";
}
if (isNumberTypeEqualTo(nationalNumber, "MOBILE", metadata2)) {
return "FIXED_LINE_OR_MOBILE";
}
return "FIXED_LINE";
}
for (var _iterator = _createForOfIteratorHelperLoose$2(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done; ) {
var type = _step.value;
if (isNumberTypeEqualTo(nationalNumber, type, metadata2)) {
return type;
}
}
}
function isNumberTypeEqualTo(nationalNumber, type, metadata2) {
type = metadata2.type(type);
if (!type || !type.pattern()) {
return false;
}
if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {
return false;
}
return matchesEntirely(nationalNumber, type.pattern());
}
function isValidNumber(input, options, metadata2) {
options = options || {};
metadata2 = new Metadata(metadata2);
metadata2.selectNumberingPlan(input.country, input.countryCallingCode);
if (metadata2.hasTypes()) {
return getNumberType(input, options, metadata2.metadata) !== void 0;
}
var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
return matchesEntirely(nationalNumber, metadata2.nationalNumberPattern());
}
function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata2) {
var _metadata = new Metadata(metadata2);
var possibleCountries = _metadata.getCountryCodesForCallingCode(callingCode);
if (!possibleCountries) {
return [];
}
return possibleCountries.filter(function(country) {
return couldNationalNumberBelongToCountry(nationalNumber, country, metadata2);
});
}
function couldNationalNumberBelongToCountry(nationalNumber, country, metadata2) {
var _metadata = new Metadata(metadata2);
_metadata.selectNumberingPlan(country);
if (_metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0) {
return true;
}
return false;
}
function applyInternationalSeparatorStyle(formattedNumber) {
return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), "g"), " ").trim();
}
var FIRST_GROUP_PATTERN = /(\$\d)/;
function formatNationalNumberUsingFormat(number, format, _ref) {
var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : (
// This library doesn't use `domestic_carrier_code_formatting_rule`,
// because that one is only used when formatting phone numbers
// for dialing from a mobile phone, and this is not a dialing library.
// carrierCode && format.domesticCarrierCodeFormattingRule()
// // First, replace the $CC in the formatting rule with the desired carrier code.
// // Then, replace the $FG in the formatting rule with the first group
// // and the carrier code combined in the appropriate way.
// ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
// : (
// withNationalPrefix && format.nationalPrefixFormattingRule()
// ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
// : format.format()
// )
withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format()
));
if (useInternationalFormat) {
return applyInternationalSeparatorStyle(formattedNumber);
}
return formattedNumber;
}
var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
function getIddPrefix(country, callingCode, metadata2) {
var countryMetadata = new Metadata(metadata2);
countryMetadata.selectNumberingPlan(country, callingCode);
if (countryMetadata.defaultIDDPrefix()) {
return countryMetadata.defaultIDDPrefix();
}
if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
return countryMetadata.IDDPrefix();
}
}
function formatRFC3966(_ref) {
var number = _ref.number, ext = _ref.ext;
if (!number) {
return "";
}
if (number[0] !== "+") {
throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');
}
return "tel:".concat(number).concat(ext ? ";ext=" + ext : "");
}
function _createForOfIteratorHelperLoose$1(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike) {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return { done: true };
return { done: false, value: o[i++] };
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$2(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
}
function _arrayLikeToArray$2(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function ownKeys$3(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$3(target2) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$3(Object(source), true).forEach(function(key) {
_defineProperty$3(target2, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target2, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function(key) {
Object.defineProperty(target2, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target2;
}
function _defineProperty$3(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
var DEFAULT_OPTIONS = {
formatExtension: function formatExtension(formattedNumber, extension, metadata2) {
return "".concat(formattedNumber).concat(metadata2.ext()).concat(extension);
}
};
function formatNumber(input, format, options, metadata2) {
if (options) {
options = _objectSpread$3(_objectSpread$3({}, DEFAULT_OPTIONS), options);
} else {
options = DEFAULT_OPTIONS;
}
metadata2 = new Metadata(metadata2);
if (input.country && input.country !== "001") {
if (!metadata2.hasCountry(input.country)) {
throw new Error("Unknown country: ".concat(input.country));
}
metadata2.country(input.country);
} else if (input.countryCallingCode) {
metadata2.selectNumberingPlan(input.countryCallingCode);
} else return input.phone || "";
var countryCallingCode = metadata2.countryCallingCode();
var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
var number;
switch (format) {
case "NATIONAL":
if (!nationalNumber) {
return "";
}
number = formatNationalNumber(nationalNumber, input.carrierCode, "NATIONAL", metadata2, options);
return addExtension(number, input.ext, metadata2, options.formatExtension);
case "INTERNATIONAL":
if (!nationalNumber) {
return "+".concat(countryCallingCode);
}
number = formatNationalNumber(nationalNumber, null, "INTERNATIONAL", metadata2, options);
number = "+".concat(countryCallingCode, " ").concat(number);
return addExtension(number, input.ext, metadata2, options.formatExtension);
case "E.164":
return "+".concat(countryCallingCode).concat(nationalNumber);
case "RFC3966":
return formatRFC3966({
number: "+".concat(countryCallingCode).concat(nationalNumber),
ext: input.ext
});
case "IDD":
if (!options.fromCountry) {
return;
}
var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata2);
return addExtension(formattedNumber, input.ext, metadata2, options.formatExtension);
default:
throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(format, '"'));
}
}
function formatNationalNumber(number, carrierCode, formatAs, metadata2, options) {
var format = chooseFormatForNumber(metadata2.formats(), number);
if (!format) {
return number;
}
return formatNationalNumberUsingFormat(number, format, {
useInternationalFormat: formatAs === "INTERNATIONAL",
withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
carrierCode,
metadata: metadata2
});
}
function chooseFormatForNumber(availableFormats, nationalNnumber) {
for (var _iterator = _createForOfIteratorHelperLoose$1(availableFormats), _step; !(_step = _iterator()).done; ) {
var format = _step.value;
if (format.leadingDigitsPatterns().length > 0) {
var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1];
if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {
continue;
}
}
if (matchesEntirely(nationalNnumber, format.pattern())) {
return format;
}
}
}
function addExtension(formattedNumber, ext, metadata2, formatExtension2) {
return ext ? formatExtension2(formattedNumber, ext, metadata2) : formattedNumber;
}
function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata2) {
var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata2.metadata);
if (fromCountryCallingCode === countryCallingCode) {
var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, "NATIONAL", metadata2);
if (countryCallingCode === "1") {
return countryCallingCode + " " + formattedNumber;
}
return formattedNumber;
}
var iddPrefix = getIddPrefix(fromCountry, void 0, metadata2.metadata);
if (iddPrefix) {
return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, "INTERNATIONAL", metadata2));
}
}
function ownKeys$2(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$2(target2) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$2(Object(source), true).forEach(function(key) {
_defineProperty$2(target2, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target2, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function(key) {
Object.defineProperty(target2, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target2;
}
function _defineProperty$2(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target2, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target2, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
var PhoneNumber = /* @__PURE__ */ function() {
function PhoneNumber2(countryOrCountryCallingCode, nationalNumber, metadata2) {
_classCallCheck(this, PhoneNumber2);
if (!countryOrCountryCallingCode) {
throw new TypeError("`country` or `countryCallingCode` not passed");
}
if (!nationalNumber) {
throw new TypeError("`nationalNumber` not passed");
}
if (!metadata2) {
throw new TypeError("`metadata` not passed");
}
var _getCountryAndCountry = getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadata2), country = _getCountryAndCountry.country, countryCallingCode = _getCountryAndCountry.countryCallingCode;
this.country = country;
this.countryCallingCode = countryCallingCode;
this.nationalNumber = nationalNumber;
this.number = "+" + this.countryCallingCode + this.nationalNumber;
this.getMetadata = function() {
return metadata2;
};
}
_createClass(PhoneNumber2, [{
key: "setExt",
value: function setExt(ext) {
this.ext = ext;
}
}, {
key: "getPossibleCountries",
value: function getPossibleCountries() {
if (this.country) {
return [this.country];
}
return getPossibleCountriesForNumber(this.countryCallingCode, this.nationalNumber, this.getMetadata());
}
}, {
key: "isPossible",
value: function isPossible() {
return isPossiblePhoneNumber(this, {
v2: true
}, this.getMetadata());
}
}, {
key: "isValid",
value: function isValid() {
return isValidNumber(this, {
v2: true
}, this.getMetadata());
}
}, {
key: "isNonGeographic",
value: function isNonGeographic() {
var metadata2 = new Metadata(this.getMetadata());
return metadata2.isNonGeographicCallingCode(this.countryCallingCode);
}
}, {
key: "isEqual",
value: function isEqual(phoneNumber) {
return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
}
// This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,
// but later it was found out that it doesn't include the possible `TOO_SHORT` result
// returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,
// so eventually I simply commented out this method from the `PhoneNumber` class
// and just left the `validatePhoneNumberLength()` function, even though that one would require
// and additional step to also validate the actual country / calling code of the phone number.
// validateLength() {
// const metadata = new Metadata(this.getMetadata())
// metadata.selectNumberingPlan(this.countryCallingCode)
// const result = checkNumberLength(this.nationalNumber, metadata)
// if (result !== 'IS_POSSIBLE') {
// return result
// }
// }
}, {
key: "getType",
value: function getType2() {
return getNumberType(this, {
v2: true
}, this.getMetadata());
}
}, {
key: "format",
value: function format(_format, options) {
return formatNumber(this, _format, options ? _objectSpread$2(_objectSpread$2({}, options), {}, {
v2: true
}) : {
v2: true
}, this.getMetadata());
}
}, {
key: "formatNational",
value: function formatNational(options) {
return this.format("NATIONAL", options);
}
}, {
key: "formatInternational",
value: function formatInternational(options) {
return this.format("INTERNATIONAL", options);
}
}, {
key: "getURI",
value: function getURI(options) {
return this.format("RFC3966", options);
}
}]);
return PhoneNumber2;
}();
var isCountryCode = function isCountryCode2(value) {
return /^[A-Z]{2}$/.test(value);
};
function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) {
var country;
var countryCallingCode;
var metadata2 = new Metadata(metadataJson);
if (isCountryCode(countryOrCountryCallingCode)) {
country = countryOrCountryCallingCode;
metadata2.selectNumberingPlan(country);
countryCallingCode = metadata2.countryCallingCode();
} else {
countryCallingCode = countryOrCountryCallingCode;
}
return {
country,
countryCallingCode
};
}
var CAPTURING_DIGIT_PATTERN = new RegExp("([" + VALID_DIGITS + "])");
function stripIddPrefix(number, country, callingCode, metadata2) {
if (!country) {
return;
}
var countryMetadata = new Metadata(metadata2);
countryMetadata.selectNumberingPlan(country, callingCode);
var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
if (number.search(IDDPrefixPattern) !== 0) {
return;
}
number = number.slice(number.match(IDDPrefixPattern)[0].length);
var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
if (matchedGroups[1] === "0") {
return;
}
}
return number;
}
function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata2) {
if (number && metadata2.numberingPlan.nationalPrefixForParsing()) {
var prefixPattern = new RegExp("^(?:" + metadata2.numberingPlan.nationalPrefixForParsing() + ")");
var prefixMatch = prefixPattern.exec(number);
if (prefixMatch) {
var nationalNumber;
var carrierCode;
var capturedGroupsCount = prefixMatch.length - 1;
var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
if (metadata2.nationalPrefixTransformRule() && hasCapturedGroups) {
nationalNumber = number.replace(prefixPattern, metadata2.nationalPrefixTransformRule());
if (capturedGroupsCount > 1) {
carrierCode = prefixMatch[1];
}
} else {
var prefixBeforeNationalNumber = prefixMatch[0];
nationalNumber = number.slice(prefixBeforeNationalNumber.length);
if (hasCapturedGroups) {
carrierCode = prefixMatch[1];
}
}
var nationalPrefix;
if (hasCapturedGroups) {
var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup);
if (possibleNationalPrefix === metadata2.numberingPlan.nationalPrefix()) {
nationalPrefix = metadata2.numberingPlan.nationalPrefix();
}
} else {
nationalPrefix = prefixMatch[0];
}
return {
nationalNumber,
nationalPrefix,
carrierCode
};
}
}
return {
nationalNumber: number
};
}
function extractNationalNumber(number, metadata2) {
var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata2), carrierCode = _extractNationalNumbe.carrierCode, nationalNumber = _extractNationalNumbe.nationalNumber;
if (nationalNumber !== number) {
if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata2)) {
return {
nationalNumber: number
};
}
if (metadata2.possibleLengths()) {
if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata2)) {
return {
nationalNumber: number
};
}
}
}
return {
nationalNumber,
carrierCode
};
}
function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata2) {
if (matchesEntirely(nationalNumberBefore, metadata2.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata2.nationalNumberPattern())) {
return false;
}
return true;
}
function isPossibleIncompleteNationalNumber(nationalNumber, metadata2) {
switch (checkNumberLength(nationalNumber, metadata2)) {
case "TOO_SHORT":
case "INVALID_LENGTH":
return false;
default:
return true;
}
}
function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata2) {
var countryCallingCode = country ? getCountryCallingCode(country, metadata2) : callingCode;
if (number.indexOf(countryCallingCode) === 0) {
metadata2 = new Metadata(metadata2);
metadata2.selectNumberingPlan(country, callingCode);
var possibleShorterNumber = number.slice(countryCallingCode.length);
var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata2), possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
var _extractNationalNumbe2 = extractNationalNumber(number, metadata2), nationalNumber = _extractNationalNumbe2.nationalNumber;
if (!matchesEntirely(nationalNumber, metadata2.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata2.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata2) === "TOO_LONG") {
return {
countryCallingCode,
number: possibleShorterNumber
};
}
}
return {
number
};
}
function extractCountryCallingCode(number, country, callingCode, metadata2) {
if (!number) {
return {};
}
var isNumberWithIddPrefix;
if (number[0] !== "+") {
var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata2);
if (numberWithoutIDD && numberWithoutIDD !== number) {
isNumberWithIddPrefix = true;
number = "+" + numberWithoutIDD;
} else {
if (country || callingCode) {
var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata2), countryCallingCode = _extractCountryCallin.countryCallingCode, shorterNumber = _extractCountryCallin.number;
if (countryCallingCode) {
return {
countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
countryCallingCode,
number: shorterNumber
};
}
}
return {
// No need to set it to `UNSPECIFIED`. It can be just `undefined`.
// countryCallingCodeSource: 'UNSPECIFIED',
number
};
}
}
if (number[1] === "0") {
return {};
}
metadata2 = new Metadata(metadata2);
var i = 2;
while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {
var _countryCallingCode = number.slice(1, i);
if (metadata2.hasCallingCode(_countryCallingCode)) {
metadata2.selectNumberingPlan(_countryCallingCode);
return {
countryCallingCodeSource: isNumberWithIddPrefix ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
countryCallingCode: _countryCallingCode,
number: number.slice(i)
};
}
i++;
}
return {};
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike) {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return { done: true };
return { done: false, value: o[i++] };
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$1(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
}
function _arrayLikeToArray$1(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
var countries2 = _ref.countries, metadata2 = _ref.metadata;
metadata2 = new Metadata(metadata2);
for (var _iterator = _createForOfIteratorHelperLoose(countries2), _step; !(_step = _iterator()).done; ) {
var country = _step.value;
metadata2.country(country);
if (metadata2.leadingDigits()) {
if (nationalPhoneNumber && nationalPhoneNumber.search(metadata2.leadingDigits()) === 0) {
return country;
}
} else if (getNumberType({
phone: nationalPhoneNumber,
country
}, void 0, metadata2.metadata)) {
return country;
}
}
}
function getCountryByCallingCode(callingCode, _ref) {
var nationalPhoneNumber = _ref.nationalNumber, defaultCountry = _ref.defaultCountry, metadata2 = _ref.metadata;
var possibleCountries = metadata2.getCountryCodesForCallingCode(callingCode);
if (!possibleCountries) {
return;
}
if (possibleCountries.length === 1) {
return possibleCountries[0];
}
return getCountryByNationalNumber(nationalPhoneNumber, {
countries: possibleCountries,
defaultCountry,
metadata: metadata2.metadata
});
}
var PLUS_SIGN = "+";
var RFC3966_VISUAL_SEPARATOR_ = "[\\-\\.\\(\\)]?";
var RFC3966_PHONE_DIGIT_ = "([" + VALID_DIGITS + "]|" + RFC3966_VISUAL_SEPARATOR_ + ")";
var RFC3966_GLOBAL_NUMBER_DIGITS_ = "^\\" + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + "*[" + VALID_DIGITS + "]" + RFC3966_PHONE_DIGIT_ + "*$";
var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, "g");
var ALPHANUM_ = VALID_DIGITS;
var RFC3966_DOMAINLABEL_ = "[" + ALPHANUM_ + "]+((\\-)*[" + ALPHANUM_ + "])*";
var VALID_ALPHA_ = "a-zA-Z";
var RFC3966_TOPLABEL_ = "[" + VALID_ALPHA_ + "]+((\\-)*[" + ALPHANUM_ + "])*";
var RFC3966_DOMAINNAME_ = "^(" + RFC3966_DOMAINLABEL_ + "\\.)*" + RFC3966_TOPLABEL_ + "\\.?$";
var RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, "g");
var RFC3966_PREFIX_ = "tel:";
var RFC3966_PHONE_CONTEXT_ = ";phone-context=";
var RFC3966_ISDN_SUBADDRESS_ = ";isub=";
function extractPhoneContext(numberToExtractFrom) {
var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_);
if (indexOfPhoneContext < 0) {
return null;
}
var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length;
if (phoneContextStart >= numberToExtractFrom.length) {
return "";
}
var phoneContextEnd = numberToExtractFrom.indexOf(";", phoneContextStart);
if (phoneContextEnd >= 0) {
return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);
} else {
return numberToExtractFrom.substring(phoneContextStart);
}
}
function isPhoneContextValid(phoneContext) {
if (phoneContext === null) {
return true;
}
if (phoneContext.length === 0) {
return false;
}
return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);
}
function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {
var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;
var phoneContext = extractPhoneContext(numberToParse);
if (!isPhoneContextValid(phoneContext)) {
throw new ParseError("NOT_A_NUMBER");
}
var phoneNumberString;
if (phoneContext === null) {
phoneNumberString = extractFormattedPhoneNumber(numberToParse) || "";
} else {
phoneNumberString = "";
if (phoneContext.charAt(0) === PLUS_SIGN) {
phoneNumberString += phoneContext;
}
var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);
var indexOfNationalNumber;
if (indexOfRfc3966Prefix >= 0) {
indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;
} else {
indexOfNationalNumber = 0;
}
var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);
phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);
}
var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);
if (indexOfIsdn > 0) {
phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);
}
if (phoneNumberString !== "") {
return phoneNumberString;
}
}
var MAX_INPUT_STRING_LENGTH = 250;
var PHONE_NUMBER_START_PATTERN = new RegExp("[" + PLUS_CHARS + VALID_DIGITS + "]");
var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp("[^" + VALID_DIGITS + "#]+$");
function parse(text, options, metadata2) {
options = options || {};
metadata2 = new Metadata(metadata2);
if (options.defaultCountry && !metadata2.hasCountry(options.defaultCountry)) {
if (options.v2) {
throw new ParseError("INVALID_COUNTRY");
}
throw new Error("Unknown country: ".concat(options.defaultCountry));
}
var _parseInput = parseInput(text, options.v2, options.extract), formattedPhoneNumber = _parseInput.number, ext = _parseInput.ext, error = _parseInput.error;
if (!formattedPhoneNumber) {
if (options.v2) {
if (error === "TOO_SHORT") {
throw new ParseError("TOO_SHORT");
}
throw new ParseError("NOT_A_NUMBER");
}
return {};
}
var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata2), country = _parsePhoneNumber.country, nationalNumber = _parsePhoneNumber.nationalNumber, countryCallingCode = _parsePhoneNumber.countryCallingCode, countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource, carrierCode = _parsePhoneNumber.carrierCode;
if (!metadata2.hasSelectedNumberingPlan()) {
if (options.v2) {
throw new ParseError("INVALID_COUNTRY");
}
return {};
}
if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {
if (options.v2) {
throw new ParseError("TOO_SHORT");
}
return {};
}
if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {
if (options.v2) {
throw new ParseError("TOO_LONG");
}
return {};
}
if (options.v2) {
var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata2.metadata);
if (country) {
phoneNumber.country = country;
}
if (carrierCode) {
phoneNumber.carrierCode = carrierCode;
}
if (ext) {
phoneNumber.ext = ext;
}
phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;
return phoneNumber;
}
var valid = (options.extended ? metadata2.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata2.nationalNumberPattern()) : false;
if (!options.extended) {
return valid ? result(country, nationalNumber, ext) : {};
}
return {
country,
countryCallingCode,
carrierCode,
valid,
possible: valid ? true : options.extended === true && metadata2.possibleLengths() && isPossibleNumber(nationalNumber, metadata2) ? true : false,
phone: nationalNumber,
ext
};
}
function _extractFormattedPhoneNumber(text, extract, throwOnError) {
if (!text) {
return;
}
if (text.length > MAX_INPUT_STRING_LENGTH) {
if (throwOnError) {
throw new ParseError("TOO_LONG");
}
return;
}
if (extract === false) {
return text;
}
var startsAt = text.search(PHONE_NUMBER_START_PATTERN);
if (startsAt < 0) {
return;
}
return text.slice(startsAt).replace(AFTER_PHONE_NUMBER_END_PATTERN, "");
}
function parseInput(text, v2, extract) {
var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, {
extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text2) {
return _extractFormattedPhoneNumber(text2, extract, v2);
}
});
if (!number) {
return {};
}
if (!isViablePhoneNumber(number)) {
if (isViablePhoneNumberStart(number)) {
return {
error: "TOO_SHORT"
};
}
return {};
}
var withExtensionStripped = extractExtension(number);
if (withExtensionStripped.ext) {
return withExtensionStripped;
}
return {
number
};
}
function result(country, nationalNumber, ext) {
var result2 = {
country,
phone: nationalNumber
};
if (ext) {
result2.ext = ext;
}
return result2;
}
function parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata2) {
var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata2.metadata), countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource, countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number;
var country;
if (countryCallingCode) {
metadata2.selectNumberingPlan(countryCallingCode);
} else if (number && (defaultCountry || defaultCallingCode)) {
metadata2.selectNumberingPlan(defaultCountry, defaultCallingCode);
if (defaultCountry) {
country = defaultCountry;
}
countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata2.metadata);
} else return {};
if (!number) {
return {
countryCallingCodeSource,
countryCallingCode
};
}
var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata2), nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode;
var exactCountry = getCountryByCallingCode(countryCallingCode, {
nationalNumber,
defaultCountry,
metadata: metadata2
});
if (exactCountry) {
country = exactCountry;
if (exactCountry === "001") ;
else {
metadata2.country(country);
}
}
return {
country,
countryCallingCode,
countryCallingCodeSource,
nationalNumber,
carrierCode
};
}
function ownKeys$1(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$1(target2) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$1(Object(source), true).forEach(function(key) {
_defineProperty$1(target2, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target2, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) {
Object.defineProperty(target2, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target2;
}
function _defineProperty$1(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function parsePhoneNumberWithError$2(text, options, metadata2) {
return parse(text, _objectSpread$1(_objectSpread$1({}, options), {}, {
v2: true
}), metadata2);
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target2) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target2, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target2, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target2, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target2;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function normalizeArguments(args) {
var _Array$prototype$slic = Array.prototype.slice.call(args), _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4), arg_1 = _Array$prototype$slic2[0], arg_2 = _Array$prototype$slic2[1], arg_3 = _Array$prototype$slic2[2], arg_4 = _Array$prototype$slic2[3];
var text;
var options;
var metadata2;
if (typeof arg_1 === "string") {
text = arg_1;
} else throw new TypeError("A text for parsing must be a string.");
if (!arg_2 || typeof arg_2 === "string") {
if (arg_4) {
options = arg_3;
metadata2 = arg_4;
} else {
options = void 0;
metadata2 = arg_3;
}
if (arg_2) {
options = _objectSpread({
defaultCountry: arg_2
}, options);
}
} else if (isObject(arg_2)) {
if (arg_3) {
options = arg_2;
metadata2 = arg_3;
} else {
metadata2 = arg_2;
}
} else throw new Error("Invalid second argument: ".concat(arg_2));
return {
text,
options,
metadata: metadata2
};
}
function parsePhoneNumberWithError$1() {
var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata2 = _normalizeArguments.metadata;
return parsePhoneNumberWithError$2(text, options, metadata2);
}
function parsePhoneNumberWithError() {
return withMetadataArgument(parsePhoneNumberWithError$1, arguments);
}
const DEFAULT_COUNTRY = "de";
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "Index",
props: /* @__PURE__ */ mergeModels({
required: { type: Boolean, default: false },
searchText: { default: "Search" },
searchIcon: { default: "search" },
dropdownOptions: { default: () => ({}) },
noResultsText: { default: "No results found" },
defaultCountry: { default: DEFAULT_COUNTRY },
eagerValidate: { type: Boolean, default: false },
useIcon: { type: Boolean, default: false },
autofocusInput: { type: Boolean, default: false },
readonly: { type: Boolean, default: false },
dense: { type: Boolean, default: false },
disable: { type: Boolean, default: false },
disableAutoCountrySelection: { type: Boolean, default: false },
class: { default: () => [] },
name: {},
mask: {},
fillMask: { type: [Boolean, String] },
reverseFillMask: { type: Boolean },
unmaskedValue: { type: Boolean },
modelValue: {},
errorMessage: {},
noErrorIcon: { type: Boolean },
rules: {},
reactiveRules: { type: Boolean },
lazyRules: { type: [Boolean, String] },
label: {},
stackLabel: { type: Boolean },
hint: {},
hideHint: { type: Boolean },
prefix: {},
suffix: {},
labelColor: {},
color: {},
bgColor: {},
dark: { type: [Boolean, null] },
loading: { type: Boolean },
clearable: { type: Boolean },
clearIcon: {},
filled: { type: Boolean },
outlined: { type: Boolean },
borderless: { type: Boolean },
standout: { type: [Boolean, String] },
labelSlot: { type: Boolean },
bottomSlots: { type: Boolean },
hideBottomSpace: { type: Boolean },
counter: { type: Boolean },
rounded: { type: Boolean },
square: { type: Boolean },
itemAligned: { type: Boolean },
autofocus: { type: Boolean },
for: {},
shadowText: {},
debounce: {},
maxlength: {},
autogrow: { type: Boolean },
inputClass: {},
inputStyle: {},
"onUpdate:modelValue": {},
onFocus: {},
onBlur: {},
onClear: {}
}, {
"modelValue": {
default: () => ""
},
"modelModifiers": {},
"country": { default: () => getDefault(DEFAULT_COUNTRY) },
"countryModifiers": {}
}),
emits: /* @__PURE__ */ mergeModels(["input", "error"], ["update:modelValue", "update:country"]),
setup(__props, { expose: __expose, emit: __emit }) {
var _a, _b, _c, _d;
const $props = __props;
const $model = useModel(__props, "modelValue");
const $emit = __emit;
const $slots = useSlots();
const input = ref();
const countryModel = useModel(__props, "country");
const dial = ref("");
const hasError = ref(false);
const inputSlots = computed(() => Object.keys($slots).filter((slotName) => !slotName.startsWith("cs-")));
const countrySelectSlots = computed(
() => Object.keys($slots).filter((slotName) => slotName.startsWith("cs-")).map((slotName) => slotName.replace("cs-", ""))
);
onMounted(() => {
countryModel.value = getDefault($props.defaultCountry);
});
const completeNumber = computed(() => {
var _a2;
if (dial.value.startsWith("+")) {
return getProperNumber(dial.value);
}
if ((_a2 = countryModel.value) == null ? void 0 : _a2.dialCode) {
return getProperNumber(`${countryModel.value.dialCode}${dial.value}`);
}
return getProperNumber(`+${dial.value}`);
});
const _validate = (force = false) => {
hasError.value = false;
if (!countryModel.value || !dial.value) {
if ($props.eagerValidate) {
hasError.value = true;
$emit("error", true);
}
return false;
}
const isValid = (() => {
try {
return parsePhoneNumberWithError(completeNumber.value, countryModel.value.iso2).isValid();
} catch {
}
return false;
})();
if (force || $props.eagerValidate) {
hasError.value = !isValid;
$emit("error", !isValid);
}
return isValid;
};
const commitIfValid = (parsed) => {
var _a2;
if (!(parsed == null ? void 0 : parsed.isValid())) return;
let newDial = parsed.nationalNumber.replace(/^0+/, "");
const suffixes = ((_a2 = countryModel.value) == null ? void 0 : _a2.dialCodeSuffixes) ?? [];
const stripSuffixes = (num) => {
let changed;
do {
changed = false;
for (const s of suffixes) {
if (num.startsWith(s)) {
num = num.slice(s.length);
changed = true;
}
}
} while (changed);
return num;
};
newDial = stripSuffixes(newDial);
const newIntl = parsed.formatInternational();
if (dial.value !== newDial) dial.value = newDial;
if ($model.value !== newIntl) $model.value = newIntl;
};
const phoneChanged = () => {
var _a2, _b2, _c2;
if (!dial.value) return _validate();
if (dial.value.startsWith("00")) {
dial.value = "+" + dial.value.slice(2);
}
const raw = dial.value.replace(/\D/g, "");
if (!$props.disableAutoCountrySelection && dial.value.startsWith("+")) {
try {
const auto = parsePhoneNumberWithError("+" + raw);
if (auto.isValid()) {
const ac = getDefault(((_a2 = auto.country) == null ? void 0 : _a2.toLowerCase()) || "");
if (ac && ac.iso2 !== ((_b2 = countryModel.value) == null ? void 0 : _b2.iso2)) {
countryModel.value = ac;
}
commitIfValid(auto);
return _validate();
}
} catch {
}
}
const det = getCountryByDialCode(completeNumber.value);
if (det) {
try {
const p = parsePhoneNumberWithError(completeNumber.value, det.iso2);
countryModel.value = det;
commitIfValid(p);
} catch {
}
}
if (((_c2 = countryModel.value) == null ? void 0 : _c2.iso2) === "AX") {
dial.value = dial.value.replace(/^(?:18)+/, "");
}
return _validate();
};
const countryChanged = (selectedCountry) => {
countryModel.value = selectedCountry;
nextTick(phoneChanged);
};
watch(
() => $model.value,
(val, oldVal) => {
if (oldVal && getProperNumber(val) === completeNumber.value) {
return;
}
if (!oldVal) {
dial.value = getProperNumber(val);
}
nextTick(phoneChanged);
},
{ immediate: true }
);
watch(
() => $props.defaultCountry,
() => {
if ($props.defaultCountry) {
countryModel.value = getDefault($props.defaultCountry);
}
},
{ immediate: true }
);
const resetValidation = () => {
var _a2;
hasError.value = false;
$emit("error", false);
(_a2 = input.value) == null ? void 0 : _a2.resetValidation();
};
useFormChild({
validate: () => _validate(true),
resetValidation,
requiresQForm: false
});
__expose({
validate: () => _validate(true),
resetValidation,
select: (_a = input.value) == null ? void 0 : _a.select,
blur: (_b = input.value) == null ? void 0 : _b.blur,
focus: (_c = input.value) == null ? void 0 : _c.focus,
hasError,
nativeEl: (_d = input.value) == null ? void 0 : _d.$el
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(QInput), mergeProps($props, {
ref_key: "input",
ref: input,
modelValue: dial.value,
"onUpdate:modelValue": [
_cache[0] || (_cache[0] = ($event) => dial.value = $event),
_cache[1] || (_cache[1] = ($event) => phoneChanged())
],
error: hasError.value,
class: ["vue3-q-tel-input no-inherit-feedback", $props.class],
type: "tel"
}), createSlots({
prepend: withCtx(() => [
createVNode(CountrySelection, mergeProps({
"use-icon": $props.useIcon,
"search-text": $props.searchText,
"search-icon": $props.searchIcon,
country: countryModel.value,
readonly: $props.readonly,
disable: $props.disable,
dense: $props.dense,
"no-results-text": $props.noResultsText,
"autofocus-input": $props.autofocusInput
}, $props.dropdownOptions, {
class: "no-border-field-before no-padding-field font-reduced-input-adon",
"onUpdate:country": countryChanged
}), createSlots({ _: 2 }, [
renderList(countrySelectSlots.value, (slot) => {
return {
name: slot,
fn: withCtx((scope) => [
renderSlot(_ctx.$slots, `cs-${slot}`, normalizeProps(guardReactiveProps(scope ?? {})))
])
};
})
]), 1040, ["use-icon", "search-text", "search-icon", "country", "readonly", "disable", "dense", "no-results-text", "autofocus-input"])
]),
_: 2
}, [
renderList(inputSlots.value, (slot) => {
return {
name: slot,
fn: withCtx((scope) => [
renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(scope ?? {})))
])
};
})
]), 1040, ["modelValue", "error", "class"]);
};
}
});
const component = /* @__PURE__ */ (() => {
const installable = _sfc_main;
installable.install = (app) => {
app.component("Vue3QTelInput", installable);
};
return installable;
})();
const namedExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: component
}, Symbol.toStringTag, { value: "Module" }));
Object.entries(namedExports).forEach(([exportName, exported]) => {
if (exportName !== "default") component[exportName] = exported;
});
export {
component as default
};