\r\n}\r\n\r\nfunction getSelectedOption(options, value) {\r\n\tfor (const option of options) {\r\n\t\tif (!option.divider && option.value === value) {\r\n\t\t\treturn option\r\n\t\t}\r\n\t}\r\n}","import React from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport classNames from 'classnames'\r\n\r\n// Default country flag icon.\r\n// `
![]()
` is wrapped in a `
` to prevent SVGs from exploding in size in IE 11.\r\n// https://github.com/catamphetamine/react-phone-number-input/issues/111\r\nexport default function FlagComponent({\r\n\tcountry,\r\n\tcountryName,\r\n\tflags,\r\n\tflagUrl,\r\n\t...rest\r\n}) {\r\n\tif (flags && flags[country]) {\r\n\t\treturn flags[country]({ title: countryName })\r\n\t}\r\n\treturn (\r\n\t\t
![]()
\r\n\t)\r\n}\r\n\r\nFlagComponent.propTypes = {\r\n\t// The country to be selected by default.\r\n\t// Two-letter country code (\"ISO 3166-1 alpha-2\").\r\n\tcountry: PropTypes.string.isRequired,\r\n\r\n\t// Will be HTML `title` attribute of the `
![]()
`.\r\n\tcountryName: PropTypes.string.isRequired,\r\n\r\n\t// Country flag icon components.\r\n\t// By default flag icons are inserted as `
![]()
`s\r\n\t// with their `src` pointed to `country-flag-icons` gitlab pages website.\r\n\t// There might be cases (e.g. an offline application)\r\n\t// where having a large (3 megabyte) `
` flags\r\n\t// bundle is more appropriate.\r\n\t// `import flags from 'react-phone-number-input/flags'`.\r\n\tflags: PropTypes.objectOf(PropTypes.elementType),\r\n\r\n\t// A URL for a country flag icon.\r\n\t// By default it points to `country-flag-icons` gitlab pages website.\r\n\tflagUrl: PropTypes.string.isRequired\r\n}\r\n","import React from 'react'\r\nimport PropTypes from 'prop-types'\r\n\r\nexport default function InternationalIcon({ aspectRatio, ...rest }) {\r\n\tif (aspectRatio === 1) {\r\n\t\treturn
\r\n\t} else {\r\n\t\treturn
\r\n\t}\r\n}\r\n\r\nInternationalIcon.propTypes = {\r\n\ttitle: PropTypes.string.isRequired,\r\n\taspectRatio: PropTypes.number\r\n}\r\n\r\n// 3x2.\r\n// Using `
` in `
`s:\r\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\r\nfunction InternationalIcon3x2({ title, ...rest }) {\r\n\treturn (\r\n\t\t
\r\n\t)\r\n}\r\n\r\nInternationalIcon3x2.propTypes = {\r\n\ttitle: PropTypes.string.isRequired\r\n}\r\n\r\n// 1x1.\r\n// Using `
` in `
`s:\r\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\r\nfunction InternationalIcon1x1({ title, ...rest }) {\r\n\treturn (\r\n\t\t
\r\n\t)\r\n}\r\n\r\nInternationalIcon1x1.propTypes = {\r\n\ttitle: PropTypes.string.isRequired\r\n}\r\n","import { isSupportedCountry } from 'libphonenumber-js/core'\r\nexport { getCountries } from 'libphonenumber-js/core'\r\n\r\n/**\r\n * Sorts country `
` options.\r\n * Can move some country `
` options\r\n * to the top of the list, for example.\r\n * @param {object[]} countryOptions — Country `
` options.\r\n * @param {string[]} [countryOptionsOrder] — Country `
` options order. Example: `[\"US\", \"CA\", \"AU\", \"|\", \"...\"]`.\r\n * @return {object[]}\r\n */\r\nexport function sortCountryOptions(options, order) {\r\n\tif (!order) {\r\n\t\treturn options\r\n\t}\r\n\tconst optionsOnTop = []\r\n\tconst optionsOnBottom = []\r\n\tlet appendTo = optionsOnTop\r\n\tfor (const element of order) {\r\n\t\tif (element === '|') {\r\n\t\t\tappendTo.push({ divider: true })\r\n\t\t} else if (element === '...' || element === '…') {\r\n\t\t\tappendTo = optionsOnBottom\r\n\t\t} else {\r\n\t\t\tlet countryCode\r\n\t\t\tif (element === '🌐') {\r\n\t\t\t\tcountryCode = undefined\r\n\t\t\t} else {\r\n\t\t\t\tcountryCode = element\r\n\t\t\t}\r\n\t\t\t// Find the position of the option.\r\n\t\t\tconst index = options.indexOf(options.filter(option => option.value === countryCode)[0])\r\n\t\t\t// Get the option.\r\n\t\t\tconst option = options[index]\r\n\t\t\t// Remove the option from its default position.\r\n\t\t\toptions.splice(index, 1)\r\n\t\t\t// Add the option on top.\r\n\t\t\tappendTo.push(option)\r\n\t\t}\r\n\t}\r\n\treturn optionsOnTop.concat(options).concat(optionsOnBottom)\r\n}\r\n\r\nexport function getSupportedCountryOptions(countryOptions, metadata) {\r\n\tif (countryOptions) {\r\n\t\tcountryOptions = countryOptions.filter((option) => {\r\n\t\t\tswitch (option) {\r\n\t\t\t\tcase '🌐':\r\n\t\t\t\tcase '|':\r\n\t\t\t\tcase '...':\r\n\t\t\t\tcase '…':\r\n\t\t\t\t\treturn true\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn isCountrySupportedWithError(option, metadata)\r\n\t\t\t}\r\n\t\t})\r\n\t\tif (countryOptions.length > 0) {\r\n\t\t\treturn countryOptions\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function isCountrySupportedWithError(country, metadata) {\r\n\tif (isSupportedCountry(country, metadata)) {\r\n\t\treturn true\r\n\t} else {\r\n\t\tconsole.error(`Country not found: ${country}`)\r\n\t\treturn false\r\n\t}\r\n}\r\n\r\nexport function getSupportedCountries(countries, metadata) {\r\n\tif (countries) {\r\n\t\tcountries = countries.filter(country => isCountrySupportedWithError(country, metadata))\r\n\t\tif (countries.length === 0) {\r\n\t\t\tcountries = undefined\r\n\t\t}\r\n\t}\r\n\treturn countries\r\n}","import Metadata from './metadata.js'\r\n\r\nexport default function getCountries(metadata) {\r\n\treturn new Metadata(metadata).getCountries()\r\n}","import React from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport classNames from 'classnames'\r\n\r\nimport DefaultInternationalIcon from './InternationalIcon.js'\r\nimport Flag from './Flag.js'\r\n\r\nexport function createCountryIconComponent({\r\n\tflags,\r\n\tflagUrl,\r\n\tflagComponent: FlagComponent,\r\n\tinternationalIcon: InternationalIcon\r\n}) {\r\n\tfunction CountryIcon({\r\n\t\tcountry,\r\n\t\tlabel,\r\n\t\taspectRatio,\r\n\t\t...rest\r\n\t}) {\r\n\t\t// `aspectRatio` is currently a hack for the default \"International\" icon\r\n\t\t// to render it as a square when Unicode flag icons are used.\r\n\t\t// So `aspectRatio` property is only used with the default \"International\" icon.\r\n\t\tconst _aspectRatio = InternationalIcon === DefaultInternationalIcon ? aspectRatio : undefined\r\n\t\treturn (\r\n\t\t\t
\r\n\t\t\t\t{\r\n\t\t\t\t\tcountry\r\n\t\t\t\t\t?\r\n\t\t\t\t\t\r\n\t\t\t\t\t:\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t
\r\n\t\t)\r\n\t}\r\n\r\n\tCountryIcon.propTypes = {\r\n\t\tcountry: PropTypes.string,\r\n\t\tlabel: PropTypes.string.isRequired,\r\n\t\taspectRatio: PropTypes.number\r\n\t}\r\n\r\n\treturn CountryIcon\r\n}\r\n\r\nexport default createCountryIconComponent({\r\n\t// Must be equal to `defaultProps.flagUrl` in `./PhoneInputWithCountry.js`.\r\n\tflagUrl: 'https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg',\r\n\tflagComponent: Flag,\r\n\tinternationalIcon: DefaultInternationalIcon\r\n})","import { useRef, useCallback } from 'react'\r\n\r\n/**\r\n * This hook creates an internal copy of a `ref`\r\n * and returns a new `ref`-alike setter function\r\n * that updates both `ref` and the internal copy of it.\r\n * That `ref`-alike setter function could then be passed\r\n * to child elements instead of the original `ref`.\r\n *\r\n * The internal copy of the `ref` can then be used to\r\n * call instance methods like `.focus()`, etc.\r\n *\r\n * One may ask: why create a copy of `ref` for \"internal\" use\r\n * when the code could use the original `ref` for that.\r\n * The answer is: the code would have to dance around the original `ref` anyway\r\n * to figure out whether it exists and to find out the internal implementation of it\r\n * in order to read its value correctly. This hook encapsulates all that \"boilerplate\" code.\r\n * The returned copy of the `ref` is guaranteed to exist and functions as a proper ref \"object\".\r\n * The returned `ref`-alike setter function must be used instead of the original `ref`\r\n * when passing it to child elements.\r\n *\r\n * @param {(object|function)} [externalRef] — The original `ref` that may have any internal implementation and might not even exist.\r\n * @return {any[]} Returns an array of two elements: a copy of the `ref` for \"internal\" use and a `ref`-alike setter function that should be used in-place of the original `ref` when passing it to child elements.\r\n */\r\nexport default function useExternalRef(externalRef) {\r\n // Create a copy of the original `ref` (which might not exist).\r\n // Both refs will point to the same value.\r\n const refCopy = useRef()\r\n\r\n // Updates both `ref`s with the same `value`.\r\n const refSetter = useCallback((value) => {\r\n setRefsValue([externalRef, refCopy], value)\r\n }, [\r\n externalRef,\r\n refCopy\r\n ])\r\n\r\n return [refCopy, refSetter]\r\n}\r\n\r\n// Sets the same `value` of all `ref`s.\r\n// Some of the `ref`s may not exist in which case they'll be skipped.\r\nexport function setRefsValue(refs, value) {\r\n for (const ref of refs) {\r\n if (ref) {\r\n setRefValue(ref, value)\r\n }\r\n }\r\n}\r\n\r\n// Sets the value of a `ref`.\r\n// Before React Hooks were introduced, `ref`s used to be functions.\r\n// After React Hooks were introduces, `ref`s became objects with `.current` property.\r\n// This function sets a `ref`'s value regardless of its internal implementation,\r\n// so it supports both types of `ref`s.\r\nfunction setRefValue(ref, value) {\r\n if (typeof ref === 'function') {\r\n ref(value)\r\n } else {\r\n ref.current = value\r\n }\r\n}","import {\r\n\tgetCountryCallingCode,\r\n\tMetadata\r\n} from 'libphonenumber-js/core'\r\n\r\nconst ONLY_DIGITS_REGEXP = /^\\d+$/\r\n\r\nexport default function getInternationalPhoneNumberPrefix(country, metadata) {\r\n\t// Standard international phone number prefix: \"+\" and \"country calling code\".\r\n\tlet prefix = '+' + getCountryCallingCode(country, metadata)\r\n\r\n\t// \"Leading digits\" can't be used to rule out any countries.\r\n\t// So the \"pre-fill with leading digits on country selection\" feature had to be reverted.\r\n\t// https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/10#note_1231042367\r\n\t// // Get \"leading digits\" for a phone number of the country.\r\n\t// // If there're \"leading digits\" then they can be part of the prefix too.\r\n\t// // https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/10\r\n\t// metadata = new Metadata(metadata)\r\n\t// metadata.selectNumberingPlan(country)\r\n\t// // \"Leading digits\" patterns are only defined for about 20% of all countries.\r\n\t// // By definition, matching \"leading digits\" is a sufficient but not a necessary\r\n\t// // condition for a phone number to belong to a country.\r\n\t// // The point of \"leading digits\" check is that it's the fastest one to get a match.\r\n\t// // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits\r\n\t// const leadingDigits = metadata.numberingPlan.leadingDigits()\r\n\t// if (leadingDigits && ONLY_DIGITS_REGEXP.test(leadingDigits)) {\r\n\t// \tprefix += leadingDigits\r\n\t// }\r\n\r\n\treturn prefix\r\n}","import parsePhoneNumber_, {\r\n\tgetCountryCallingCode,\r\n\tAsYouType,\r\n\tMetadata\r\n} from 'libphonenumber-js/core'\r\n\r\nimport getInternationalPhoneNumberPrefix from './getInternationalPhoneNumberPrefix.js'\r\n\r\n/**\r\n * Decides which country should be pre-selected\r\n * when the phone number input component is first mounted.\r\n * @param {object?} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {string?} country - Pre-defined country (two-letter code).\r\n * @param {string[]?} countries - A list of countries available.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string?}\r\n */\r\nexport function getPreSelectedCountry({\r\n\tvalue,\r\n\tphoneNumber,\r\n\tdefaultCountry,\r\n\tgetAnyCountry,\r\n\tcountries,\r\n\trequired,\r\n\tmetadata\r\n}) {\r\n\tlet country\r\n\r\n\t// If can get country from E.164 phone number\r\n\t// then it overrides the `country` passed (or not passed).\r\n\tif (phoneNumber && phoneNumber.country) {\r\n\t\t// `country` will be left `undefined` in case of non-detection.\r\n\t\tcountry = phoneNumber.country\r\n\t} else if (defaultCountry) {\r\n\t\tif (!value || couldNumberBelongToCountry(value, defaultCountry, metadata)) {\r\n\t\t\tcountry = defaultCountry\r\n\t\t}\r\n\t}\r\n\r\n\t// Only pre-select a country if it's in the available `countries` list.\r\n\tif (countries && countries.indexOf(country) < 0) {\r\n\t\tcountry = undefined\r\n\t}\r\n\r\n\t// If there will be no \"International\" option\r\n\t// then some `country` must be selected.\r\n\t// It will still be the wrong country though.\r\n\t// But still country `
` can't be left in a broken state.\r\n\tif (!country && required && countries && countries.length > 0) {\r\n\t\tcountry = getAnyCountry()\r\n\t\t// noCountryMatchesTheNumber = true\r\n\t}\r\n\r\n\treturn country\r\n}\r\n\r\n/**\r\n * Generates a sorted list of country `
` options.\r\n * @param {string[]} countries - A list of two-letter (\"ISO 3166-1 alpha-2\") country codes.\r\n * @param {object} labels - Custom country labels. E.g. `{ RU: 'Россия', US: 'США', ... }`.\r\n * @param {boolean} addInternationalOption - Whether should include \"International\" option at the top of the list.\r\n * @return {object[]} A list of objects having shape `{ value : string, label : string }`.\r\n */\r\nexport function getCountrySelectOptions({\r\n\tcountries,\r\n\tcountryNames,\r\n\taddInternationalOption,\r\n\t// `locales` are only used in country name comparator:\r\n\t// depending on locale, string sorting order could be different.\r\n\tcompareStringsLocales,\r\n\tcompareStrings: _compareStrings\r\n}) {\r\n\t// Default country name comparator uses `String.localeCompare()`.\r\n\tif (!_compareStrings) {\r\n\t\t_compareStrings = compareStrings\r\n\t}\r\n\r\n\t// Generates a `
` option for each country.\r\n\tconst countrySelectOptions = countries.map((country) => ({\r\n\t\tvalue: country,\r\n\t\t// All `locale` country names included in this library\r\n\t\t// include all countries (this is checked at build time).\r\n\t\t// The only case when a country name might be missing\r\n\t\t// is when a developer supplies their own `labels` property.\r\n\t\t// To guard against such cases, a missing country name\r\n\t\t// is substituted by country code.\r\n\t\tlabel: countryNames[country] || country\r\n\t}))\r\n\r\n\t// Sort the list of countries alphabetically.\r\n\tcountrySelectOptions.sort((a, b) => _compareStrings(a.label, b.label, compareStringsLocales))\r\n\r\n\t// Add the \"International\" option to the country list (if suitable)\r\n\tif (addInternationalOption) {\r\n\t\tcountrySelectOptions.unshift({\r\n\t\t\tlabel: countryNames.ZZ\r\n\t\t})\r\n\t}\r\n\r\n\treturn countrySelectOptions\r\n}\r\n\r\n/**\r\n * Parses a E.164 phone number to an instance of `PhoneNumber` class.\r\n * @param {string?} value = E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {object} Object having shape `{ country: string?, countryCallingCode: string, number: string }`. `PhoneNumber`: https://gitlab.com/catamphetamine/libphonenumber-js#phonenumber.\r\n * @example\r\n * parsePhoneNumber('+78005553535')\r\n */\r\nexport function parsePhoneNumber(value, metadata) {\r\n\treturn parsePhoneNumber_(value || '', metadata)\r\n}\r\n\r\n/**\r\n * Generates national number digits for a parsed phone.\r\n * May prepend national prefix.\r\n * The phone number must be a complete and valid phone number.\r\n * @param {object} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string}\r\n * @example\r\n * getNationalNumberDigits({ country: 'RU', phone: '8005553535' })\r\n * // returns '88005553535'\r\n */\r\nexport function generateNationalNumberDigits(phoneNumber) {\r\n\treturn phoneNumber.formatNational().replace(/\\D/g, '')\r\n}\r\n\r\n/**\r\n * Migrates parsed `
` `value` for the newly selected `country`.\r\n * @param {string?} phoneDigits - Phone number digits (and `+`) parsed from phone number `
` (it's not the same as the `value` property).\r\n * @param {string?} prevCountry - Previously selected country.\r\n * @param {string?} newCountry - Newly selected country. Can't be same as previously selected country.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @param {boolean} useNationalFormat - whether should attempt to convert from international to national number for the new country.\r\n * @return {string?}\r\n */\r\nexport function getPhoneDigitsForNewCountry(phoneDigits, {\r\n\tprevCountry,\r\n\tnewCountry,\r\n\tmetadata,\r\n\tuseNationalFormat\r\n}) {\r\n\tif (prevCountry === newCountry) {\r\n\t\treturn phoneDigits\r\n\t}\r\n\r\n\t// If `parsed_input` is empty\r\n\t// then no need to migrate anything.\r\n\tif (!phoneDigits) {\r\n\t\tif (useNationalFormat) {\r\n\t\t\treturn ''\r\n\t\t} else {\r\n\t\t\tif (newCountry) {\r\n\t\t\t\t// If `phoneDigits` is empty then set `phoneDigits` to\r\n\t\t\t\t// `+{getCountryCallingCode(newCountry)}`.\r\n\t\t\t\treturn getInternationalPhoneNumberPrefix(newCountry, metadata)\r\n\t\t\t}\r\n\t\t\treturn ''\r\n\t\t}\r\n\t}\r\n\r\n\t// If switching to some country.\r\n\t// (from \"International\" or another country)\r\n\t// If switching from \"International\" then `phoneDigits` starts with a `+`.\r\n\t// Otherwise it may or may not start with a `+`.\r\n\tif (newCountry) {\r\n\t\t// If the phone number was entered in international format\r\n\t\t// then migrate it to the newly selected country.\r\n\t\t// The phone number may be incomplete.\r\n\t\t// The phone number entered not necessarily starts with\r\n\t\t// the previously selected country phone prefix.\r\n\t\tif (phoneDigits[0] === '+') {\r\n\t\t\t// If the international phone number is for the new country\r\n\t\t\t// then convert it to local if required.\r\n\t\t\tif (useNationalFormat) {\r\n\t\t\t\t// // If a phone number is being input in international form\r\n\t\t\t\t// // and the country can already be derived from it,\r\n\t\t\t\t// // and if it is the new country, then format as a national number.\r\n\t\t\t\t// const derived_country = getCountryFromPossiblyIncompleteInternationalPhoneNumber(phoneDigits, metadata)\r\n\t\t\t\t// if (derived_country === newCountry) {\r\n\t\t\t\t// \treturn stripCountryCallingCode(phoneDigits, derived_country, metadata)\r\n\t\t\t\t// }\r\n\r\n\t\t\t\t// Actually, the two countries don't necessarily need to match:\r\n\t\t\t\t// the condition could be looser here, because several countries\r\n\t\t\t\t// might share the same international phone number format\r\n\t\t\t\t// (for example, \"NANPA\" countries like US, Canada, etc).\r\n\t\t\t\t// The looser condition would be just \"same nternational phone number format\"\r\n\t\t\t\t// which would mean \"same country calling code\" in the context of `libphonenumber-js`.\r\n\t\t\t\tif (phoneDigits.indexOf('+' + getCountryCallingCode(newCountry, metadata)) === 0) {\r\n\t\t\t\t\treturn stripCountryCallingCode(phoneDigits, newCountry, metadata)\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Simply discard the previously entered international phone number,\r\n\t\t\t\t// because otherwise any \"smart\" transformation like getting the\r\n\t\t\t\t// \"national (significant) number\" part and then prepending the\r\n\t\t\t\t// newly selected country's \"country calling code\" to it\r\n\t\t\t\t// would just be confusing for a user without being actually useful.\r\n\t\t\t\treturn ''\r\n\r\n\t\t\t\t// // Simply strip the leading `+` character\r\n\t\t\t\t// // therefore simply converting all digits into a \"local\" phone number.\r\n\t\t\t\t// // https://github.com/catamphetamine/react-phone-number-input/issues/287\r\n\t\t\t\t// return phoneDigits.slice(1)\r\n\t\t\t}\r\n\r\n\t\t\tif (prevCountry) {\r\n\t\t\t\tconst newCountryPrefix = getInternationalPhoneNumberPrefix(newCountry, metadata)\r\n\t\t\t\tif (phoneDigits.indexOf(newCountryPrefix) === 0) {\r\n\t\t\t\t\treturn phoneDigits\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn newCountryPrefix\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tconst defaultValue = getInternationalPhoneNumberPrefix(newCountry, metadata)\r\n\t\t\t\t// If `phoneDigits`'s country calling code part is the same\r\n\t\t\t\t// as for the new `country`, then leave `phoneDigits` as is.\r\n\t\t\t\tif (phoneDigits.indexOf(defaultValue) === 0) {\r\n\t\t\t\t\treturn phoneDigits\r\n\t\t\t\t}\r\n\t\t\t\t// If `phoneDigits`'s country calling code part is not the same\r\n\t\t\t\t// as for the new `country`, then set `phoneDigits` to\r\n\t\t\t\t// `+{getCountryCallingCode(newCountry)}`.\r\n\t\t\t\treturn defaultValue\r\n\t\t\t}\r\n\r\n\t\t\t// // If the international phone number already contains\r\n\t\t\t// // any country calling code then trim the country calling code part.\r\n\t\t\t// // (that could also be the newly selected country phone code prefix as well)\r\n\t\t\t// // `phoneDigits` doesn't neccessarily belong to `prevCountry`.\r\n\t\t\t// // (e.g. if a user enters an international number\r\n\t\t\t// // not belonging to any of the reduced `countries` list).\r\n\t\t\t// phoneDigits = stripCountryCallingCode(phoneDigits, prevCountry, metadata)\r\n\r\n\t\t\t// // Prepend country calling code prefix\r\n\t\t\t// // for the newly selected country.\r\n\t\t\t// return e164(phoneDigits, newCountry, metadata) || `+${getCountryCallingCode(newCountry, metadata)}`\r\n\t\t}\r\n\t}\r\n\t// If switching to \"International\" from a country.\r\n\telse {\r\n\t\t// If the phone number was entered in national format.\r\n\t\tif (phoneDigits[0] !== '+') {\r\n\t\t\t// Format the national phone number as an international one.\r\n\t\t\t// The phone number entered not necessarily even starts with\r\n\t\t\t// the previously selected country phone prefix.\r\n\t\t\t// Even if the phone number belongs to whole another country\r\n\t\t\t// it will still be parsed into some national phone number.\r\n\t\t\t//\r\n\t\t\t// Ignore the now-uncovered `|| ''` code branch:\r\n\t\t\t// previously `e164()` function could return an empty string\r\n\t\t\t// even when `phoneDigits` were not empty.\r\n\t\t\t// Now it always returns some `value` when there're any `phoneDigits`.\r\n\t\t\t// Still, didn't remove the `|| ''` code branch just in case\r\n\t\t\t// that logic changes somehow in some future, so there're no\r\n\t\t\t// possible bugs related to that.\r\n\t\t\t//\r\n\t\t\t// (ignore the `|| ''` code branch)\r\n\t\t\t/* istanbul ignore next */\r\n\t\t\treturn e164(phoneDigits, prevCountry, metadata) || ''\r\n\t\t}\r\n\t}\r\n\r\n\treturn phoneDigits\r\n}\r\n\r\n/**\r\n * Converts phone number digits to a (possibly incomplete) E.164 phone number.\r\n * @param {string?} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\r\nexport function e164(number, country, metadata) {\r\n\tif (!number) {\r\n\t\treturn\r\n\t}\r\n\t// If the phone number is being input in international format.\r\n\tif (number[0] === '+') {\r\n\t\t// If it's just the `+` sign then return nothing.\r\n\t\tif (number === '+') {\r\n\t\t\treturn\r\n\t\t}\r\n\t\t// Return a E.164 phone number.\r\n\t\t//\r\n\t\t// Could return `number` \"as is\" here, but there's a possibility\r\n\t\t// that some user might incorrectly input an international number\r\n\t\t// with a \"national prefix\". Such numbers aren't considered valid,\r\n\t\t// but `libphonenumber-js` is \"forgiving\" when it comes to parsing\r\n\t\t// user's input, and this input component follows that behavior.\r\n\t\t//\r\n\t\tconst asYouType = new AsYouType(country, metadata)\r\n\t\tasYouType.input(number)\r\n\t\t// This function would return `undefined` only when `number` is `\"+\"`,\r\n\t\t// but at this point it is known that `number` is not `\"+\"`.\r\n\t\treturn asYouType.getNumberValue()\r\n\t}\r\n\t// For non-international phone numbers\r\n\t// an accompanying country code is required.\r\n\t// The situation when `country` is `undefined`\r\n\t// and a non-international phone number is passed\r\n\t// to this function shouldn't happen.\r\n\tif (!country) {\r\n\t\treturn\r\n\t}\r\n\tconst partial_national_significant_number = getNationalSignificantNumberDigits(number, country, metadata)\r\n\t//\r\n\t// Even if no \"national (significant) number\" digits have been input,\r\n\t// still return a non-`undefined` value.\r\n\t// https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/113\r\n\t//\r\n\t// For example, if the user has selected country `US` and entered `\"1\"`\r\n\t// then that `\"1\"` is just a \"national prefix\" and no \"national (significant) number\"\r\n\t// digits have been input yet. Still, return `\"+1\"` as `value` in such cases,\r\n\t// because otherwise the app would think that the input is empty and mark it as such\r\n\t// while in reality it isn't empty, which might be thought of as a \"bug\", or just\r\n\t// a \"weird\" behavior.\r\n\t//\r\n\t// if (partial_national_significant_number) {\r\n\t\treturn `+${getCountryCallingCode(country, metadata)}${partial_national_significant_number || ''}`\r\n\t// }\r\n}\r\n\r\n/**\r\n * Trims phone number digits if they exceed the maximum possible length\r\n * for a national (significant) number for the country.\r\n * @param {string} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} Can be empty.\r\n */\r\nexport function trimNumber(number, country, metadata) {\r\n\tconst nationalSignificantNumberPart = getNationalSignificantNumberDigits(number, country, metadata)\r\n\tif (nationalSignificantNumberPart) {\r\n\t\tconst overflowDigitsCount = nationalSignificantNumberPart.length - getMaxNumberLength(country, metadata)\r\n\t\tif (overflowDigitsCount > 0) {\r\n\t\t\treturn number.slice(0, number.length - overflowDigitsCount)\r\n\t\t}\r\n\t}\r\n\treturn number\r\n}\r\n\r\nfunction getMaxNumberLength(country, metadata) {\r\n\t// Get \"possible lengths\" for a phone number of the country.\r\n\tmetadata = new Metadata(metadata)\r\n\tmetadata.selectNumberingPlan(country)\r\n\t// Return the last \"possible length\".\r\n\treturn metadata.numberingPlan.possibleLengths()[metadata.numberingPlan.possibleLengths().length - 1]\r\n}\r\n\r\n// If the phone number being input is an international one\r\n// then tries to derive the country from the phone number.\r\n// (regardless of whether there's any country currently selected)\r\n/**\r\n * @param {string} partialE164Number - A possibly incomplete E.164 phone number.\r\n * @param {string?} country - Currently selected country.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\r\nexport function getCountryForPartialE164Number(partialE164Number, {\r\n\tcountry,\r\n\tcountries,\r\n\trequired,\r\n\tmetadata\r\n}) {\r\n\tif (partialE164Number === '+') {\r\n\t\t// Don't change the currently selected country yet.\r\n\t\treturn country\r\n\t}\r\n\r\n\tconst derived_country = getCountryFromPossiblyIncompleteInternationalPhoneNumber(partialE164Number, metadata)\r\n\r\n\t// If a phone number is being input in international form\r\n\t// and the country can already be derived from it,\r\n\t// then select that country.\r\n\tif (derived_country && (!countries || (countries.indexOf(derived_country) >= 0))) {\r\n\t\treturn derived_country\r\n\t}\r\n\t// If \"International\" country option has not been disabled\r\n\t// and the international phone number entered doesn't correspond\r\n\t// to the currently selected country then reset the currently selected country.\r\n\telse if (country &&\r\n\t\t!required &&\r\n\t\t!couldNumberBelongToCountry(partialE164Number, country, metadata)) {\r\n\t\treturn undefined\r\n\t}\r\n\r\n\t// Don't change the currently selected country.\r\n\treturn country\r\n}\r\n\r\n/**\r\n * Parses `
` value. Derives `country` from `input`. Derives an E.164 `value`.\r\n * @param {string?} phoneDigits — Parsed `
` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} prevPhoneDigits — Previous parsed `
` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} country - Currently selected country.\r\n * @param {boolean} countryRequired - Is selecting some country required.\r\n * @param {function} getAnyCountry - Can be used to get any country when selecting some country required.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {boolean} international - Set to `true` to force international phone number format (leading `+`). Set to `false` to force \"national\" phone number format. Is `undefined` by default.\r\n * @param {boolean} limitMaxLength — Whether to enable limiting phone number max length.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {object} An object of shape `{ phoneDigits, country, value }`. `phoneDigits` returned here are a \"normalized\" version of the original `phoneDigits`. The returned `phoneDigits` shouldn't be used anywhere except for passing it as `prevPhoneDigits` parameter to this same function on next input change event.\r\n */\r\nexport function onPhoneDigitsChange(phoneDigits, {\r\n\tprevPhoneDigits,\r\n\tcountry,\r\n\tdefaultCountry,\r\n\tcountryRequired,\r\n\tgetAnyCountry,\r\n\tcountries,\r\n\tinternational,\r\n\tlimitMaxLength,\r\n\tcountryCallingCodeEditable,\r\n\tmetadata\r\n}) {\r\n\tif (international && countryCallingCodeEditable === false) {\r\n\t\tif (country) {\r\n\t\t\t// For international phone numbers written with non-editable country calling code,\r\n\t\t\t// the `
` value must always start with that non-editable country calling code.\r\n\t\t\tconst prefix = getInternationalPhoneNumberPrefix(country, metadata)\r\n\t\t\t// If the input value doesn't start with the non-editable country calling code,\r\n\t\t\t// it should be fixed.\r\n\t\t\tif (phoneDigits.indexOf(prefix) !== 0) {\r\n\t\t\t\tlet value\r\n\t\t\t\t// If a phone number input is declared as\r\n\t\t\t\t// `international: true` and `countryCallingCodeEditable: false`,\r\n\t\t\t\t// then the value of the `
` is gonna be non-empty at all times,\r\n\t\t\t\t// even before the user has started to input any digits in the input field,\r\n\t\t\t\t// because the country calling code is always there by design.\r\n\t\t\t\t//\r\n\t\t\t\t// The fact that the input value is always non-empty results in a side effect:\r\n\t\t\t\t// whenever a user tabs into such input field, its value gets automatically selected.\r\n\t\t\t\t// If at that moment in time the user starts typing in the national digits of the phone number,\r\n\t\t\t\t// the selected `
` value gets automatically replaced by those typed-in digits\r\n\t\t\t\t// so the value changes from `+xxx` to `y`, because inputting anything while having\r\n\t\t\t\t// the `
` value selected results in erasing that `
` value.\r\n\t\t\t\t//\r\n\t\t\t\t// This component handles such cases by restoring the `
` value to what\r\n\t\t\t\t// it should be in such cases: `+xxxy`.\r\n\t\t\t\t// https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/43\r\n\t\t\t\t//\r\n\t\t\t\tconst hasStartedTypingInNationalNumberDigitsHavingInputValueSelected = phoneDigits && phoneDigits[0] !== '+'\r\n\t\t\t\tif (hasStartedTypingInNationalNumberDigitsHavingInputValueSelected) {\r\n\t\t\t\t\t// Fix the input value to what it should be: `y` → `+xxxy`.\r\n\t\t\t\t\tphoneDigits = prefix + phoneDigits\r\n\t\t\t\t\tvalue = e164(phoneDigits, country, metadata)\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// In other cases, simply reset the `
` value, because there're only two\r\n\t\t\t\t\t// possible cases:\r\n\t\t\t\t\t// * The user has selected the `
` value and then hit Delete/Backspace to erase it.\r\n\t\t\t\t\t// * The user has pasted an international phone number for another country calling code,\r\n\t\t\t\t\t// which is considered a non-valid value.\r\n\t\t\t\t\tphoneDigits = prefix\r\n\t\t\t\t}\r\n\t\t\t\treturn {\r\n\t\t\t\t\tphoneDigits,\r\n\t\t\t\t\tvalue,\r\n\t\t\t\t\tcountry\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// If `international` property is `false`, then it means\r\n\t// \"enforce national-only format during input\",\r\n\t// so, if that's the case, then remove all `+` characters,\r\n\t// but only if some country is currently selected.\r\n\t// (not if \"International\" country is selected).\r\n\tif (international === false && country && phoneDigits && phoneDigits[0] === '+') {\r\n\t\tphoneDigits = convertInternationalPhoneDigitsToNational(phoneDigits, country, metadata)\r\n\t}\r\n\r\n\t// Trim the input to not exceed the maximum possible number length.\r\n\tif (phoneDigits && country && limitMaxLength) {\r\n\t\tphoneDigits = trimNumber(phoneDigits, country, metadata)\r\n\t}\r\n\r\n\t// If this `onChange()` event was triggered\r\n\t// as a result of selecting \"International\" country,\r\n\t// then force-prepend a `+` sign if the phone number\r\n\t// `
` value isn't in international format.\r\n\t// Also, force-prepend a `+` sign if international\r\n\t// phone number input format is set.\r\n\tif (phoneDigits && phoneDigits[0] !== '+' && (!country || international)) {\r\n\t\tphoneDigits = '+' + phoneDigits\r\n\t}\r\n\r\n\t// If the previously entered phone number\r\n\t// has been entered in international format\r\n\t// and the user decides to erase it,\r\n\t// then also reset the `country`\r\n\t// because it was most likely automatically selected\r\n\t// while the user was typing in the phone number\r\n\t// in international format.\r\n\t// This fixes the issue when a user is presented\r\n\t// with a phone number input with no country selected\r\n\t// and then types in their local phone number\r\n\t// then discovers that the input's messed up\r\n\t// (a `+` has been prepended at the start of their input\r\n\t// and a random country has been selected),\r\n\t// decides to undo it all by erasing everything\r\n\t// and then types in their local phone number again\r\n\t// resulting in a seemingly correct phone number\r\n\t// but in reality that phone number has incorrect country.\r\n\t// https://github.com/catamphetamine/react-phone-number-input/issues/273\r\n\tif (!phoneDigits && prevPhoneDigits && prevPhoneDigits[0] === '+') {\r\n\t\tif (international) {\r\n\t\t\tcountry = undefined\r\n\t\t} else {\r\n\t\t\tcountry = defaultCountry\r\n\t\t}\r\n\t}\r\n\t// Also resets such \"randomly\" selected country\r\n\t// as soon as the user erases the number\r\n\t// digit-by-digit up to the leading `+` sign.\r\n\tif (phoneDigits === '+' && prevPhoneDigits && prevPhoneDigits[0] === '+' && prevPhoneDigits.length > '+'.length) {\r\n\t\tcountry = undefined\r\n\t}\r\n\r\n\t// Generate the new `value` property.\r\n\tlet value\r\n\tif (phoneDigits) {\r\n\t\tif (phoneDigits[0] === '+') {\r\n\t\t\tif (phoneDigits === '+') {\r\n\t\t\t\tvalue = undefined\r\n\t\t\t} else if (country && getInternationalPhoneNumberPrefix(country, metadata).indexOf(phoneDigits) === 0) {\r\n\t\t\t\t// Selected a `country` and started inputting an\r\n\t\t\t\t// international phone number for this country\r\n\t\t\t\t// but hasn't input any \"national (significant) number\" digits yet.\r\n\t\t\t\t// In that case, assume `value` be `undefined`.\r\n\t\t\t\t//\r\n\t\t\t\t// For example, if selected `country` `\"US\"`\r\n\t\t\t\t// and started inputting phone number `\"+1\"`\r\n\t\t\t\t// then `value` `undefined` will be returned from this function.\r\n\t\t\t\t//\r\n\t\t\t\tvalue = undefined\r\n\t\t\t} else {\r\n\t\t\t\tvalue = e164(phoneDigits, country, metadata)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvalue = e164(phoneDigits, country, metadata)\r\n\t\t}\r\n\t}\r\n\r\n\t// Derive the country from the phone number.\r\n\t// (regardless of whether there's any country currently selected,\r\n\t// because there could be several countries corresponding to one country calling code)\r\n\tif (value) {\r\n\t\tcountry = getCountryForPartialE164Number(value, {\r\n\t\t\tcountry,\r\n\t\t\tcountries,\r\n\t\t\tmetadata\r\n\t\t})\r\n\t\t// If `international` property is `false`, then it means\r\n\t\t// \"enforce national-only format during input\",\r\n\t\t// so, if that's the case, then remove all `+` characters,\r\n\t\t// but only if some country is currently selected.\r\n\t\t// (not if \"International\" country is selected).\r\n\t\tif (international === false && country && phoneDigits && phoneDigits[0] === '+') {\r\n\t\t\tphoneDigits = convertInternationalPhoneDigitsToNational(phoneDigits, country, metadata)\r\n\t\t\t// Re-calculate `value` because `phoneDigits` has changed.\r\n\t\t\tvalue = e164(phoneDigits, country, metadata)\r\n\t\t}\r\n\t}\r\n\r\n\tif (!country && countryRequired) {\r\n\t\tcountry = defaultCountry || getAnyCountry()\r\n\t}\r\n\r\n\treturn {\r\n\t\t// `phoneDigits` returned here are a \"normalized\" version of the original `phoneDigits`.\r\n\t\t// The returned `phoneDigits` shouldn't be used anywhere except for passing it as\r\n\t\t// `prevPhoneDigits` parameter to this same function on next input change event.\r\n\t\tphoneDigits,\r\n\t\tcountry,\r\n\t\tvalue\r\n\t}\r\n}\r\n\r\nfunction convertInternationalPhoneDigitsToNational(input, country, metadata) {\r\n\t// Handle the case when a user might have pasted\r\n\t// a phone number in international format.\r\n\tif (input.indexOf(getInternationalPhoneNumberPrefix(country, metadata)) === 0) {\r\n\t\t// Create \"as you type\" formatter.\r\n\t\tconst formatter = new AsYouType(country, metadata)\r\n\t\t// Input partial national phone number.\r\n\t\tformatter.input(input)\r\n\t\t// Return the parsed partial national phone number.\r\n\t\tconst phoneNumber = formatter.getNumber()\r\n\t\tif (phoneNumber) {\r\n\t\t\t// Transform the number to a national one,\r\n\t\t\t// and remove all non-digits.\r\n\t\t\treturn phoneNumber.formatNational().replace(/\\D/g, '')\r\n\t\t} else {\r\n\t\t\treturn ''\r\n\t\t}\r\n\t} else {\r\n\t\t// Just remove the `+` sign.\r\n\t\treturn input.replace(/\\D/g, '')\r\n\t}\r\n}\r\n\r\n/**\r\n * Determines the country for a given (possibly incomplete) E.164 phone number.\r\n * @param {string} number - A possibly incomplete E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\r\nexport function getCountryFromPossiblyIncompleteInternationalPhoneNumber(number, metadata) {\r\n\tconst formatter = new AsYouType(null, metadata)\r\n\tformatter.input(number)\r\n\t// // `001` is a special \"non-geograpical entity\" code\r\n\t// // in Google's `libphonenumber` library.\r\n\t// if (formatter.getCountry() === '001') {\r\n\t// \treturn\r\n\t// }\r\n\treturn formatter.getCountry()\r\n}\r\n\r\n/**\r\n * Compares two strings.\r\n * A helper for `Array.sort()`.\r\n * @param {string} a — First string.\r\n * @param {string} b — Second string.\r\n * @param {(string[]|string)} [locales] — The `locales` argument of `String.localeCompare`.\r\n */\r\nexport function compareStrings(a, b, locales) {\r\n // Use `String.localeCompare` if it's available.\r\n // https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare\r\n // Which means everyone except IE <= 10 and Safari <= 10.\r\n // `localeCompare()` is available in latest Node.js versions.\r\n /* istanbul ignore else */\r\n if (String.prototype.localeCompare) {\r\n return a.localeCompare(b, locales);\r\n }\r\n /* istanbul ignore next */\r\n return a < b ? -1 : (a > b ? 1 : 0);\r\n}\r\n\r\n/**\r\n * Strips `+${countryCallingCode}` prefix from an E.164 phone number.\r\n * @param {string} number - (possibly incomplete) E.164 phone number.\r\n * @param {string?} country - A possible country for this phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string}\r\n */\r\nexport function stripCountryCallingCode(number, country, metadata) {\r\n\t// Just an optimization, so that it\r\n\t// doesn't have to iterate through all country calling codes.\r\n\tif (country) {\r\n\t\tconst countryCallingCodePrefix = '+' + getCountryCallingCode(country, metadata)\r\n\r\n\t\t// If `country` fits the actual `number`.\r\n\t\tif (number.length < countryCallingCodePrefix.length) {\r\n\t\t\tif (countryCallingCodePrefix.indexOf(number) === 0) {\r\n\t\t\t\treturn ''\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (number.indexOf(countryCallingCodePrefix) === 0) {\r\n\t\t\t\treturn number.slice(countryCallingCodePrefix.length)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// If `country` doesn't fit the actual `number`.\r\n\t// Try all available country calling codes.\r\n\tfor (const country_calling_code of Object.keys(metadata.country_calling_codes)) {\r\n\t\tif (number.indexOf(country_calling_code) === '+'.length) {\r\n\t\t\treturn number.slice('+'.length + country_calling_code.length)\r\n\t\t}\r\n\t}\r\n\r\n\treturn ''\r\n}\r\n\r\n/**\r\n * Parses a partially entered national phone number digits\r\n * (or a partially entered E.164 international phone number)\r\n * and returns the national significant number part.\r\n * National significant number returned doesn't come with a national prefix.\r\n * @param {string} number - National number digits. Or possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} [result]\r\n */\r\nexport function getNationalSignificantNumberDigits(number, country, metadata) {\r\n\t// Create \"as you type\" formatter.\r\n\tconst formatter = new AsYouType(country, metadata)\r\n\t// Input partial national phone number.\r\n\tformatter.input(number)\r\n\t// Return the parsed partial national phone number.\r\n\tconst phoneNumber = formatter.getNumber()\r\n\treturn phoneNumber && phoneNumber.nationalNumber\r\n}\r\n\r\n/**\r\n * Checks if a partially entered E.164 phone number could belong to a country.\r\n * @param {string} number\r\n * @param {string} country\r\n * @return {boolean}\r\n */\r\nexport function couldNumberBelongToCountry(number, country, metadata) {\r\n\tconst intlPhoneNumberPrefix = getInternationalPhoneNumberPrefix(country, metadata)\r\n\tlet i = 0\r\n\twhile (i < number.length && i < intlPhoneNumberPrefix.length) {\r\n\t\tif (number[i] !== intlPhoneNumberPrefix[i]) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n\treturn true\r\n}\r\n\r\n/**\r\n * Gets initial \"phone digits\" (including `+`, if using international format).\r\n * @return {string} [phoneDigits] Returns `undefined` if there should be no initial \"phone digits\".\r\n */\r\nexport function getInitialPhoneDigits({\r\n\tvalue,\r\n\tphoneNumber,\r\n\tdefaultCountry,\r\n\tinternational,\r\n\tuseNationalFormat,\r\n\tmetadata\r\n}) {\r\n\t// If the `value` (E.164 phone number)\r\n\t// belongs to the currently selected country\r\n\t// and `useNationalFormat` is `true`\r\n\t// then convert `value` (E.164 phone number)\r\n\t// to a local phone number digits.\r\n\t// E.g. '+78005553535' -> '88005553535'.\r\n\tif ((international === false || useNationalFormat) && phoneNumber && phoneNumber.country) {\r\n\t\treturn generateNationalNumberDigits(phoneNumber)\r\n\t}\r\n\t// If `international` property is `true`,\r\n\t// meaning \"enforce international phone number format\",\r\n\t// then always show country calling code in the input field.\r\n\tif (!value && international && defaultCountry) {\r\n\t\treturn getInternationalPhoneNumberPrefix(defaultCountry, metadata)\r\n\t}\r\n\treturn value\r\n}","import normalizeArguments from './normalizeArguments.js'\r\nimport parsePhoneNumber_ from './parsePhoneNumber_.js'\r\n\r\nexport default function parsePhoneNumber() {\r\n\tconst { text, options, metadata } = normalizeArguments(arguments)\r\n\treturn parsePhoneNumber_(text, options, metadata)\r\n}\r\n","import {\r\n\tgetInitialPhoneDigits,\r\n\tgetCountryForPartialE164Number,\r\n\tparsePhoneNumber\r\n} from './phoneInputHelpers.js'\r\n\r\nimport getInternationalPhoneNumberPrefix from './getInternationalPhoneNumberPrefix.js'\r\n\r\nimport {\r\n\tisCountrySupportedWithError,\r\n\tgetSupportedCountries\r\n} from './countries.js'\r\n\r\nexport default function getPhoneInputWithCountryStateUpdateFromNewProps(props, prevProps, state) {\r\n\tconst {\r\n\t\tmetadata,\r\n\t\tcountries,\r\n\t\tdefaultCountry: newDefaultCountry,\r\n\t\tvalue: newValue,\r\n\t\treset: newReset,\r\n\t\tinternational,\r\n\t\t// `displayInitialValueAsLocalNumber` property has been\r\n\t\t// superceded by `initialValueFormat` property.\r\n\t\tdisplayInitialValueAsLocalNumber,\r\n\t\tinitialValueFormat\r\n\t} = props\r\n\r\n\tconst {\r\n\t\tdefaultCountry: prevDefaultCountry,\r\n\t\tvalue: prevValue,\r\n\t\treset: prevReset\r\n\t} = prevProps\r\n\r\n\tconst {\r\n\t\tcountry,\r\n\t\tvalue,\r\n\t\t// If the user has already manually selected a country\r\n\t\t// then don't override that already selected country\r\n\t\t// if the `defaultCountry` property changes.\r\n\t\t// That's what `hasUserSelectedACountry` flag is for.\r\n\t\thasUserSelectedACountry\r\n\t} = state\r\n\r\n\tconst _getInitialPhoneDigits = (parameters) => getInitialPhoneDigits({\r\n\t\t...parameters,\r\n\t\tinternational,\r\n\t\tuseNationalFormat: displayInitialValueAsLocalNumber || initialValueFormat === 'national',\r\n\t\tmetadata\r\n\t})\r\n\r\n\t// Some users requested a way to reset the component\r\n\t// (both number `
` and country `
`).\r\n\t// Whenever `reset` property changes both number `
`\r\n\t// and country `
` are reset.\r\n\t// It's not implemented as some instance `.reset()` method\r\n\t// because `ref` is forwarded to `
`.\r\n\t// It's also not replaced with just resetting `country` on\r\n\t// external `value` reset, because a user could select a country\r\n\t// and then not input any `value`, and so the selected country\r\n\t// would be \"stuck\", if not using this `reset` property.\r\n\t// https://github.com/catamphetamine/react-phone-number-input/issues/300\r\n\tif (newReset !== prevReset) {\r\n\t\treturn {\r\n\t\t\tphoneDigits: _getInitialPhoneDigits({\r\n\t\t\t\tvalue: undefined,\r\n\t\t\t\tdefaultCountry: newDefaultCountry\r\n\t\t\t}),\r\n\t\t\tvalue: undefined,\r\n\t\t\tcountry: newDefaultCountry,\r\n\t\t\thasUserSelectedACountry: undefined\r\n\t\t}\r\n\t}\r\n\r\n\t// `value` is the value currently shown in the component:\r\n\t// it's stored in the component's `state`, and it's not the `value` property.\r\n\t// `prevValue` is \"previous `value` property\".\r\n\t// `newValue` is \"new `value` property\".\r\n\r\n\t// If the default country changed\r\n\t// (e.g. in case of ajax GeoIP detection after page loaded)\r\n\t// then select it, but only if the user hasn't already manually\r\n\t// selected a country, and no phone number has been manually entered so far.\r\n\t// Because if the user has already started inputting a phone number\r\n\t// then they're okay with no country being selected at all (\"International\")\r\n\t// and they don't want to be disturbed, don't want their input to be screwed, etc.\r\n\tif (newDefaultCountry !== prevDefaultCountry) {\r\n\t\tconst isNewDefaultCountrySupported = !newDefaultCountry || isCountrySupportedWithError(newDefaultCountry, metadata)\r\n\t\tconst noValueHasBeenEnteredByTheUser = (\r\n\t\t\t// By default, \"no value has been entered\" means `value` is `undefined`.\r\n\t\t\t!value ||\r\n\t\t\t// When `international` is `true`, and some country has been pre-selected,\r\n\t\t\t// then the `
` contains a pre-filled value of `+${countryCallingCode}${leadingDigits}`,\r\n\t\t\t// so in case of `international` being `true`, \"the user hasn't entered anything\" situation\r\n\t\t\t// doesn't just mean `value` is `undefined`, but could also mean `value` is `+${countryCallingCode}`.\r\n\t\t\t(international && value === _getInitialPhoneDigits({\r\n\t\t\t\tvalue: undefined,\r\n\t\t\t\tdefaultCountry: prevDefaultCountry\r\n\t\t\t}))\r\n\t\t)\r\n\t\t// Only update the `defaultCountry` property if no phone number\r\n\t\t// has been entered by the user or pre-set by the application.\r\n\t\tconst noValueHasBeenEntered = !newValue && noValueHasBeenEnteredByTheUser\r\n\t\tif (!hasUserSelectedACountry && isNewDefaultCountrySupported && noValueHasBeenEntered) {\r\n\t\t\treturn {\r\n\t\t\t\tcountry: newDefaultCountry,\r\n\t\t\t\t// If `phoneDigits` is empty, then automatically select the new `country`\r\n\t\t\t\t// and set `phoneDigits` to `+{getCountryCallingCode(newCountry)}`.\r\n\t\t\t\t// The code assumes that \"no phone number has been entered by the user\",\r\n\t\t\t\t// and no `value` property has been passed, so the `phoneNumber` parameter\r\n\t\t\t\t// of `_getInitialPhoneDigits({ value, phoneNumber, ... })` is `undefined`.\r\n\t\t\t\tphoneDigits: _getInitialPhoneDigits({\r\n\t\t\t\t\tvalue: undefined,\r\n\t\t\t\t\tdefaultCountry: newDefaultCountry\r\n\t\t\t\t}),\r\n\t\t\t\t// `value` is `undefined` and it stays so.\r\n\t\t\t\tvalue: undefined\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// If a new `value` is set externally.\r\n\t// (e.g. as a result of an ajax API request\r\n\t// to get user's phone after page loaded)\r\n\t// The first part — `newValue !== prevValue` —\r\n\t// is basically `props.value !== prevProps.value`\r\n\t// so it means \"if value property was changed externally\".\r\n\t// The second part — `newValue !== value` —\r\n\t// is for ignoring the `getDerivedStateFromProps()` call\r\n\t// which happens in `this.onChange()` right after `this.setState()`.\r\n\t// If this `getDerivedStateFromProps()` call isn't ignored\r\n\t// then the country flag would reset on each input.\r\n\tif (!valuesAreEqual(newValue, prevValue) && !valuesAreEqual(newValue, value)) {\r\n\t\tlet phoneNumber\r\n\t\tlet parsedCountry\r\n\t\tif (newValue) {\r\n\t\t\tphoneNumber = parsePhoneNumber(newValue, metadata)\r\n\t\t\tconst supportedCountries = getSupportedCountries(countries, metadata)\r\n\t\t\tif (phoneNumber && phoneNumber.country) {\r\n\t\t\t\t// Ignore `else` because all countries are supported in metadata.\r\n\t\t\t\t/* istanbul ignore next */\r\n\t\t\t\tif (!supportedCountries || supportedCountries.indexOf(phoneNumber.country) >= 0) {\r\n\t\t\t\t\tparsedCountry = phoneNumber.country\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tparsedCountry = getCountryForPartialE164Number(newValue, {\r\n\t\t\t\t\tcountry: undefined,\r\n\t\t\t\t\tcountries: supportedCountries,\r\n\t\t\t\t\tmetadata\r\n\t\t\t\t})\r\n\t\t\t\t// In cases when multiple countries correspond to the same country calling code,\r\n\t\t\t\t// the phone number digits of `newValue` have to be matched against country-specific\r\n\t\t\t\t// regular expressions in order to determine the exact country.\r\n\t\t\t\t// Sometimes, that algorithm can't decide for sure which country does the phone number belong to,\r\n\t\t\t\t// for example when the digits of `newValue` don't match any of those regular expressions.\r\n\t\t\t\t// and the country of the phone number couldn't be determined.\r\n\t\t\t\t// In those cases, people prefer the component to show the flag of the `defaultCountry`\r\n\t\t\t\t// if the phone number could potentially belong to that `defaultCountry`.\r\n\t\t\t\t// At least that's how the component behaves when a user pastes an international\r\n\t\t\t\t// phone number into the input field: for example, when `defaultCountry` is `\"US\"`\r\n\t\t\t\t// and the user pastes value \"+1 555 555 5555\" into the input field, it keep showing \"US\" flag.\r\n\t\t\t\t// So when setting new `value` property externally, the component should behave the same way:\r\n\t\t\t\t// it should select the `defaultCountry` when the new `value` could potentially belong\r\n\t\t\t\t// to that country in cases when the exact country can't be determined.\r\n\t\t\t\t// https://github.com/catamphetamine/react-phone-number-input/issues/413#issuecomment-1536219404\r\n\t\t\t\tif (!parsedCountry) {\r\n\t\t\t\t\tif (newDefaultCountry) {\r\n\t\t\t\t\t\tif (newValue.indexOf(getInternationalPhoneNumberPrefix(newDefaultCountry, metadata)) === 0) {\r\n\t\t\t\t\t\t\tparsedCountry = newDefaultCountry\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet hasUserSelectedACountryUpdate\r\n\t\tif (!newValue) {\r\n\t\t\t// Reset `hasUserSelectedACountry` flag in `state`.\r\n\t\t\thasUserSelectedACountryUpdate = {\r\n\t\t\t\thasUserSelectedACountry: undefined\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn {\r\n\t\t\t...hasUserSelectedACountryUpdate,\r\n\t\t\tphoneDigits: _getInitialPhoneDigits({\r\n\t\t\t\tphoneNumber,\r\n\t\t\t\tvalue: newValue,\r\n\t\t\t\tdefaultCountry: newDefaultCountry\r\n\t\t\t}),\r\n\t\t\tvalue: newValue,\r\n\t\t\tcountry: newValue ? parsedCountry : newDefaultCountry\r\n\t\t}\r\n\t}\r\n\r\n\t// `defaultCountry` didn't change.\r\n\t// `value` didn't change.\r\n\t// `phoneDigits` didn't change, because `value` didn't change.\r\n\t//\r\n\t// So no need to update state.\r\n}\r\n\r\nfunction valuesAreEqual(value1, value2) {\r\n\t// If `value` has been set to `null` externally then convert it to `undefined`.\r\n\t//\r\n\t// For example, `react-hook-form` sets `value` to `null` when the user clears the input.\r\n\t// https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/164\r\n\t// In that case, without this conversion of `null` to `undefined`, it would reset\r\n\t// the selected country to `defaultCountry` because in that case `newValue !== value`\r\n\t// because `null !== undefined`.\r\n\t//\r\n\t// Historically, empty `value` is encoded as `undefined`.\r\n\t// Perhaps empty `value` would be better encoded as `null` instead.\r\n\t// But because that would be a potentially breaking change for some people,\r\n\t// it's left as is for the current \"major\" version of this library.\r\n\t//\r\n\tif (value1 === null) {\r\n\t\tvalue1 = undefined\r\n\t}\r\n\tif (value2 === null) {\r\n\t\tvalue2 = undefined\r\n\t}\r\n\treturn value1 === value2\r\n}","import React from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport classNames from 'classnames'\r\n\r\nimport InputSmart from './InputSmart.js'\r\nimport InputBasic from './InputBasic.js'\r\n\r\nimport { CountrySelectWithIcon as CountrySelect } from './CountrySelect.js'\r\n\r\nimport Flag from './Flag.js'\r\nimport InternationalIcon from './InternationalIcon.js'\r\n\r\nimport {\r\n\tsortCountryOptions,\r\n\tisCountrySupportedWithError,\r\n\tgetSupportedCountries,\r\n\tgetSupportedCountryOptions,\r\n\tgetCountries\r\n} from './helpers/countries.js'\r\n\r\nimport { createCountryIconComponent } from './CountryIcon.js'\r\n\r\nimport { setRefsValue } from './useExternalRef.js'\r\n\r\nimport {\r\n\tmetadata as metadataPropType,\r\n\tlabels as labelsPropType\r\n} from './PropTypes.js'\r\n\r\nimport {\r\n\tgetPreSelectedCountry,\r\n\tgetCountrySelectOptions,\r\n\tparsePhoneNumber,\r\n\tgenerateNationalNumberDigits,\r\n\tgetPhoneDigitsForNewCountry,\r\n\tgetInitialPhoneDigits,\r\n\tonPhoneDigitsChange,\r\n\te164\r\n} from './helpers/phoneInputHelpers.js'\r\n\r\nimport getPhoneInputWithCountryStateUpdateFromNewProps from './helpers/getPhoneInputWithCountryStateUpdateFromNewProps.js'\r\n\r\nclass PhoneNumberInput_ extends React.PureComponent {\r\n\tconstructor(props) {\r\n\t\tsuper(props)\r\n\r\n\t\tthis.inputRef = React.createRef()\r\n\r\n\t\tconst {\r\n\t\t\tvalue,\r\n\t\t\tlabels,\r\n\t\t\tinternational,\r\n\t\t\taddInternationalOption,\r\n\t\t\t// `displayInitialValueAsLocalNumber` property has been\r\n\t\t\t// superceded by `initialValueFormat` property.\r\n\t\t\tdisplayInitialValueAsLocalNumber,\r\n\t\t\tinitialValueFormat,\r\n\t\t\tmetadata\r\n\t\t} = this.props\r\n\r\n\t\tlet {\r\n\t\t\tdefaultCountry,\r\n\t\t\tcountries\r\n\t\t} = this.props\r\n\r\n\t\t// Validate `defaultCountry`.\r\n\t\tif (defaultCountry) {\r\n\t\t\tif (!this.isCountrySupportedWithError(defaultCountry)) {\r\n\t\t\t\tdefaultCountry = undefined\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Validate `countries`.\r\n\t\tcountries = getSupportedCountries(countries, metadata)\r\n\r\n\t\tconst phoneNumber = parsePhoneNumber(value, metadata)\r\n\r\n\t\tthis.CountryIcon = createCountryIconComponent(this.props)\r\n\r\n\t\tconst preSelectedCountry = getPreSelectedCountry({\r\n\t\t\tvalue,\r\n\t\t\tphoneNumber,\r\n\t\t\tdefaultCountry,\r\n\t\t\trequired: !addInternationalOption,\r\n\t\t\tcountries: countries || getCountries(metadata),\r\n\t\t\tgetAnyCountry: () => this.getFirstSupportedCountry({ countries }),\r\n\t\t\tmetadata\r\n\t\t})\r\n\r\n\t\tthis.state = {\r\n\t\t\t// Workaround for `this.props` inside `getDerivedStateFromProps()`.\r\n\t\t\tprops: this.props,\r\n\r\n\t\t\t// The country selected.\r\n\t\t\tcountry: preSelectedCountry,\r\n\r\n\t\t\t// `countries` are stored in `this.state` because they're filtered.\r\n\t\t\t// For example, a developer might theoretically pass some unsupported\r\n\t\t\t// countries as part of the `countries` property, and because of that\r\n\t\t\t// the component uses `this.state.countries` (which are filtered)\r\n\t\t\t// instead of `this.props.countries`\r\n\t\t\t// (which could potentially contain unsupported countries).\r\n\t\t\tcountries,\r\n\r\n\t\t\t// `phoneDigits` state property holds non-formatted user's input.\r\n\t\t\t// The reason is that there's no way of finding out\r\n\t\t\t// in which form should `value` be displayed: international or national.\r\n\t\t\t// E.g. if `value` is `+78005553535` then it could be input\r\n\t\t\t// by a user both as `8 (800) 555-35-35` and `+7 800 555 35 35`.\r\n\t\t\t// Hence storing just `value` is not sufficient for correct formatting.\r\n\t\t\t// E.g. if a user entered `8 (800) 555-35-35`\r\n\t\t\t// then value is `+78005553535` and `phoneDigits` are `88005553535`\r\n\t\t\t// and if a user entered `+7 800 555 35 35`\r\n\t\t\t// then value is `+78005553535` and `phoneDigits` are `+78005553535`.\r\n\t\t\tphoneDigits: getInitialPhoneDigits({\r\n\t\t\t\tvalue,\r\n\t\t\t\tphoneNumber,\r\n\t\t\t\tdefaultCountry,\r\n\t\t\t\tinternational,\r\n\t\t\t\tuseNationalFormat: displayInitialValueAsLocalNumber || initialValueFormat === 'national',\r\n\t\t\t\tmetadata\r\n\t\t\t}),\r\n\r\n\t\t\t// `value` property is duplicated in state.\r\n\t\t\t// The reason is that `getDerivedStateFromProps()`\r\n\t\t\t// needs this `value` to compare to the new `value` property\r\n\t\t\t// to find out if `phoneDigits` needs updating:\r\n\t\t\t// If the `value` property was changed externally\r\n\t\t\t// then it won't be equal to `state.value`\r\n\t\t\t// in which case `phoneDigits` and `country` should be updated.\r\n\t\t\tvalue\r\n\t\t}\r\n\t}\r\n\r\n\tcomponentDidMount() {\r\n\t\tconst { onCountryChange } = this.props\r\n\t\tlet { defaultCountry } = this.props\r\n\t\tconst { country: selectedCountry } = this.state\r\n\t\tif (onCountryChange) {\r\n\t\t\tif (defaultCountry) {\r\n\t\t\t\tif (!this.isCountrySupportedWithError(defaultCountry)) {\r\n\t\t\t\t\tdefaultCountry = undefined\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (selectedCountry !== defaultCountry) {\r\n\t\t\t\tonCountryChange(selectedCountry)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tcomponentDidUpdate(prevProps, prevState) {\r\n\t\tconst { onCountryChange } = this.props\r\n\t\tconst { country } = this.state\r\n\t\t// Call `onCountryChange` when user selects another country.\r\n\t\tif (onCountryChange && country !== prevState.country) {\r\n\t\t\tonCountryChange(country)\r\n\t\t}\r\n\t}\r\n\r\n\t// This function mimicks `refSetter` function returned from `useExternalRef()` hook\r\n\t// because this class-like React component can't use the `useExternalRef()` hook.\r\n\tsetInputRef = (instance) => {\r\n\t\tsetRefsValue([this.props.inputRef, this.inputRef], instance)\r\n\t}\r\n\r\n\tgetCountrySelectOptions({ countries }) {\r\n\t\tconst {\r\n\t\t\tinternational,\r\n\t\t\tcountryCallingCodeEditable,\r\n\t\t\tcountryOptionsOrder,\r\n\t\t\taddInternationalOption,\r\n\t\t\tlabels,\r\n\t\t\tlocales,\r\n\t\t\tmetadata\r\n\t\t} = this.props\r\n\t\treturn this.useMemoCountrySelectOptions(() => {\r\n\t\t\treturn sortCountryOptions(\r\n\t\t\t\tgetCountrySelectOptions({\r\n\t\t\t\t\tcountries: countries || getCountries(metadata),\r\n\t\t\t\t\tcountryNames: labels,\r\n\t\t\t\t\taddInternationalOption: (international && countryCallingCodeEditable === false) ? false : addInternationalOption,\r\n\t\t\t\t\tcompareStringsLocales: locales,\r\n\t\t\t\t\t// compareStrings\r\n\t\t\t\t}),\r\n\t\t\t\tgetSupportedCountryOptions(countryOptionsOrder, metadata)\r\n\t\t\t)\r\n\t\t}, [\r\n\t\t\tcountries,\r\n\t\t\tcountryOptionsOrder,\r\n\t\t\taddInternationalOption,\r\n\t\t\tlabels,\r\n\t\t\tmetadata\r\n\t\t])\r\n\t}\r\n\r\n\tuseMemoCountrySelectOptions(generator, dependencies) {\r\n\t\tif (\r\n\t\t\t!this.countrySelectOptionsMemoDependencies ||\r\n\t\t\t!areEqualArrays(dependencies, this.countrySelectOptionsMemoDependencies)\r\n\t\t) {\r\n\t\t\tthis.countrySelectOptionsMemo = generator()\r\n\t\t\tthis.countrySelectOptionsMemoDependencies = dependencies\r\n\t\t}\r\n\t\treturn this.countrySelectOptionsMemo\r\n\t}\r\n\r\n\tgetFirstSupportedCountry({ countries }) {\r\n\t\tconst countryOptions = this.getCountrySelectOptions({ countries })\r\n\t\treturn countryOptions[0].value\r\n\t}\r\n\r\n\t// A shorthand for not passing `metadata` as a second argument.\r\n\tisCountrySupportedWithError = (country) => {\r\n\t\tconst { metadata } = this.props\r\n\t\treturn isCountrySupportedWithError(country, metadata)\r\n\t}\r\n\r\n\t// Country `
` `onChange` handler.\r\n\tonCountryChange = (newCountry) => {\r\n\t\tconst {\r\n\t\t\tinternational,\r\n\t\t\tmetadata,\r\n\t\t\tonChange,\r\n\t\t\tfocusInputOnCountrySelection\r\n\t\t} = this.props\r\n\r\n\t\tconst {\r\n\t\t\tphoneDigits: prevPhoneDigits,\r\n\t\t\tcountry: prevCountry\r\n\t\t} = this.state\r\n\r\n\t\t// After the new `country` has been selected,\r\n\t\t// if the phone number `
` holds any digits\r\n\t\t// then migrate those digits for the new `country`.\r\n\t\tconst newPhoneDigits = getPhoneDigitsForNewCountry(prevPhoneDigits, {\r\n\t\t\tprevCountry,\r\n\t\t\tnewCountry,\r\n\t\t\tmetadata,\r\n\t\t\t// Convert the phone number to \"national\" format\r\n\t\t\t// when the user changes the selected country by hand.\r\n\t\t\tuseNationalFormat: !international\r\n\t\t})\r\n\r\n\t\tconst newValue = e164(newPhoneDigits, newCountry, metadata)\r\n\r\n\t\t// Focus phone number `
` upon country selection.\r\n\t\tif (focusInputOnCountrySelection) {\r\n\t\t\tthis.inputRef.current.focus()\r\n\t\t}\r\n\r\n\t\t// If the user has already manually selected a country\r\n\t\t// then don't override that already selected country\r\n\t\t// if the `defaultCountry` property changes.\r\n\t\t// That's what `hasUserSelectedACountry` flag is for.\r\n\r\n\t\tthis.setState({\r\n\t\t\tcountry: newCountry,\r\n\t\t\thasUserSelectedACountry: true,\r\n\t\t\tphoneDigits: newPhoneDigits,\r\n\t\t\tvalue: newValue\r\n\t\t},\r\n\t\t() => {\r\n\t\t\t// Update the new `value` property.\r\n\t\t\t// Doing it after the `state` has been updated\r\n\t\t\t// because `onChange()` will trigger `getDerivedStateFromProps()`\r\n\t\t\t// with the new `value` which will be compared to `state.value` there.\r\n\t\t\tonChange(newValue)\r\n\t\t})\r\n\t}\r\n\r\n\t/**\r\n\t * `
` `onChange()` handler.\r\n\t * Updates `value` property accordingly (so that they are kept in sync).\r\n\t * @param {string?} input — Either a parsed phone number or an empty string. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n\t */\r\n\tonChange = (_phoneDigits) => {\r\n\t\tconst {\r\n\t\t\tdefaultCountry,\r\n\t\t\tonChange,\r\n\t\t\taddInternationalOption,\r\n\t\t\tinternational,\r\n\t\t\tlimitMaxLength,\r\n\t\t\tcountryCallingCodeEditable,\r\n\t\t\tmetadata\r\n\t\t} = this.props\r\n\r\n\t\tconst {\r\n\t\t\tcountries,\r\n\t\t\tphoneDigits: prevPhoneDigits,\r\n\t\t\tcountry: currentlySelectedCountry\r\n\t\t} = this.state\r\n\r\n\t\tconst {\r\n\t\t\t// `phoneDigits` returned here are a \"normalized\" version of the original `phoneDigits`.\r\n\t\t\t// The returned `phoneDigits` shouldn't be used anywhere except for passing it as\r\n\t\t\t// `prevPhoneDigits` parameter to the same `onPhoneDigitsChange()` function\r\n\t\t\t// on next input change event.\r\n\t\t\tphoneDigits,\r\n\t\t\tcountry,\r\n\t\t\tvalue\r\n\t\t} = onPhoneDigitsChange(_phoneDigits, {\r\n\t\t\tprevPhoneDigits,\r\n\t\t\tcountry: currentlySelectedCountry,\r\n\t\t\tcountryRequired: !addInternationalOption,\r\n\t\t\tdefaultCountry,\r\n\t\t\tgetAnyCountry: () => this.getFirstSupportedCountry({ countries }),\r\n\t\t\tcountries,\r\n\t\t\tinternational,\r\n\t\t\tlimitMaxLength,\r\n\t\t\tcountryCallingCodeEditable,\r\n\t\t\tmetadata\r\n\t\t})\r\n\r\n\t\tconst stateUpdate = {\r\n\t\t\tphoneDigits,\r\n\t\t\tvalue,\r\n\t\t\tcountry\r\n\t\t}\r\n\r\n\t\tif (countryCallingCodeEditable === false) {\r\n\t\t\t// If it simply did `setState({ phoneDigits: intlPrefix })` here,\r\n\t\t\t// then it would have no effect when erasing an inital international prefix\r\n\t\t\t// via Backspace, because `phoneDigits` in `state` wouldn't change\r\n\t\t\t// as a result, because it was `prefix` and it became `prefix`,\r\n\t\t\t// so the component wouldn't rerender, and the user would be able\r\n\t\t\t// to erase the country calling code part, and that part is\r\n\t\t\t// assumed to be non-eraseable. That's why the component is\r\n\t\t\t// forcefully rerendered here.\r\n\t\t\t// https://github.com/catamphetamine/react-phone-number-input/issues/367#issuecomment-721703501\r\n\t\t\tif (!value && phoneDigits === this.state.phoneDigits) {\r\n\t\t\t\t// Force a re-render of the `
` in order to reset its value.\r\n\t\t\t\tstateUpdate.forceRerender = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.setState(\r\n\t\t\tstateUpdate,\r\n\t\t\t// Update the new `value` property.\r\n\t\t\t// Doing it after the `state` has been updated\r\n\t\t\t// because `onChange()` will trigger `getDerivedStateFromProps()`\r\n\t\t\t// with the new `value` which will be compared to `state.value` there.\r\n\t\t\t() => onChange(value)\r\n\t\t)\r\n\t}\r\n\r\n\t// Toggles the `--focus` CSS class.\r\n\t_onFocus = () => this.setState({ isFocused: true })\r\n\r\n\t// Toggles the `--focus` CSS class.\r\n\t_onBlur = () => this.setState({ isFocused: false })\r\n\r\n\tonFocus = (event) => {\r\n\t\tthis._onFocus()\r\n\t\tconst { onFocus } = this.props\r\n\t\tif (onFocus) {\r\n\t\t\tonFocus(event)\r\n\t\t}\r\n\t}\r\n\r\n\tonBlur = (event) => {\r\n\t\tconst { onBlur } = this.props\r\n\t\tthis._onBlur()\r\n\t\tif (onBlur) {\r\n\t\t\tonBlur(event)\r\n\t\t}\r\n\t}\r\n\r\n\tonCountryFocus = (event) => {\r\n\t\tthis._onFocus()\r\n\t\t// this.setState({ countrySelectFocused: true })\r\n\t\tconst { countrySelectProps } = this.props\r\n\t\tif (countrySelectProps) {\r\n\t\t\tconst { onFocus } = countrySelectProps\r\n\t\t\tif (onFocus) {\r\n\t\t\t\tonFocus(event)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tonCountryBlur = (event) => {\r\n\t\tthis._onBlur()\r\n\t\t// this.setState({ countrySelectFocused: false })\r\n\t\tconst { countrySelectProps } = this.props\r\n\t\tif (countrySelectProps) {\r\n\t\t\tconst { onBlur } = countrySelectProps\r\n\t\t\tif (onBlur) {\r\n\t\t\t\tonBlur(event)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// `state` holds previous props as `props`, and also:\r\n\t// * `country` — The currently selected country, e.g. `\"RU\"`.\r\n\t// * `value` — The currently entered phone number (E.164), e.g. `+78005553535`.\r\n\t// * `phoneDigits` — The parsed `
` value, e.g. `8005553535`.\r\n\t// (and a couple of other less significant properties)\r\n\tstatic getDerivedStateFromProps(props, state) {\r\n\t\treturn {\r\n\t\t\t// Emulate `prevProps` via `state.props`.\r\n\t\t\tprops,\r\n\t\t\t...getPhoneInputWithCountryStateUpdateFromNewProps(props, state.props, state)\r\n\t\t}\r\n\t}\r\n\r\n\trender() {\r\n\t\tconst {\r\n\t\t\t// Generic HTML attributes.\r\n\t\t\tname,\r\n\t\t\tdisabled,\r\n\t\t\treadOnly,\r\n\t\t\tautoComplete,\r\n\t\t\tstyle,\r\n\t\t\tclassName,\r\n\r\n\t\t\t// Number `
` properties.\r\n\t\t\tinputRef,\r\n\t\t\tinputComponent,\r\n\t\t\tnumberInputProps,\r\n\t\t\tsmartCaret,\r\n\r\n\t\t\t// Country `
` properties.\r\n\t\t\tcountrySelectComponent: CountrySelectComponent,\r\n\t\t\tcountrySelectProps,\r\n\r\n\t\t\t// Container `
` properties.\r\n\t\t\tcontainerComponent: ContainerComponent,\r\n\t\t\tcontainerComponentProps,\r\n\r\n\t\t\t// Get \"rest\" properties (passed through to number `
`).\r\n\t\t\tdefaultCountry,\r\n\t\t\tcountries: countriesProperty,\r\n\t\t\tcountryOptionsOrder,\r\n\t\t\tlabels,\r\n\t\t\tflags,\r\n\t\t\tflagComponent,\r\n\t\t\tflagUrl,\r\n\t\t\taddInternationalOption,\r\n\t\t\tinternationalIcon,\r\n\t\t\t// `displayInitialValueAsLocalNumber` property has been\r\n\t\t\t// superceded by `initialValueFormat` property.\r\n\t\t\tdisplayInitialValueAsLocalNumber,\r\n\t\t\tinitialValueFormat,\r\n\t\t\tonCountryChange,\r\n\t\t\tlimitMaxLength,\r\n\t\t\tcountryCallingCodeEditable,\r\n\t\t\tfocusInputOnCountrySelection,\r\n\t\t\treset,\r\n\t\t\tmetadata,\r\n\t\t\tinternational,\r\n\t\t\tlocales,\r\n\t\t\t// compareStrings,\r\n\t\t\t...rest\r\n\t\t} = this.props\r\n\r\n\t\tconst {\r\n\t\t\tcountry,\r\n\t\t\tcountries,\r\n\t\t\tphoneDigits,\r\n\t\t\tisFocused\r\n\t\t} = this.state\r\n\r\n\t\tconst InputComponent = smartCaret ? InputSmart : InputBasic\r\n\r\n\t\tconst countrySelectOptions = this.getCountrySelectOptions({ countries })\r\n\r\n\t\treturn (\r\n\t\t\t
\r\n\r\n\t\t\t\t{/* Country `` */}\r\n\t\t\t\t\r\n\r\n\t\t\t\t{/* Phone number `` */}\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t)\r\n\t}\r\n}\r\n\r\n// This wrapper is only to `.forwardRef()` to the `
`.\r\nconst PhoneNumberInput = React.forwardRef((props, ref) => (\r\n\t
\r\n))\r\n\r\nPhoneNumberInput.propTypes = {\r\n\t/**\r\n\t * Phone number in `E.164` format.\r\n\t *\r\n\t * Example:\r\n\t *\r\n\t * `\"+12223333333\"`\r\n\t *\r\n\t * Any \"falsy\" value like `undefined`, `null` or an empty string `\"\"` is treated like \"empty\".\r\n\t */\r\n\tvalue: PropTypes.string,\r\n\r\n\t/**\r\n\t * A function of `value: string?`.\r\n\t *\r\n\t * Updates the `value` property as the user inputs a phone number.\r\n\t *\r\n\t * If the user erases the input value, the argument is `undefined`.\r\n\t */\r\n\tonChange: PropTypes.func.isRequired,\r\n\r\n\t/**\r\n\t * Toggles the `--focus` CSS class.\r\n\t * @ignore\r\n\t */\r\n\tonFocus: PropTypes.func,\r\n\r\n\t/**\r\n\t * `onBlur` is usually passed by `redux-form`.\r\n\t * @ignore\r\n\t */\r\n\tonBlur: PropTypes.func,\r\n\r\n\t/**\r\n\t * Set to `true` to mark both the phone number ``\r\n\t * and the country `` as `disabled`.\r\n\t */\r\n\tdisabled: PropTypes.bool,\r\n\r\n\t/**\r\n\t * Set to `true` to mark both the phone number ``\r\n\t * and the country `` as `readonly`.\r\n\t */\r\n\treadOnly: PropTypes.bool,\r\n\r\n\t/**\r\n\t * Sets `autoComplete` property for phone number ``.\r\n\t *\r\n\t * Web browser's \"autocomplete\" feature\r\n\t * remembers the phone number being input\r\n\t * and can also autofill the ``\r\n\t * with previously remembered phone numbers.\r\n\t *\r\n\t * https://developers.google.com\r\n\t * /web/updates/2015/06/checkout-faster-with-autofill\r\n\t *\r\n\t * For example, can be used to turn it off:\r\n\t *\r\n\t * \"So when should you use `autocomplete=\"off\"`?\r\n\t * One example is when you've implemented your own version\r\n\t * of autocomplete for search. Another example is any form field\r\n\t * where users will input and submit different kinds of information\r\n\t * where it would not be useful to have the browser remember\r\n\t * what was submitted previously\".\r\n\t */\r\n\t// (is `\"tel\"` by default)\r\n\tautoComplete: PropTypes.string,\r\n\r\n\t/**\r\n\t * Set to `\"national\"` to show the initial `value` in\r\n\t * \"national\" format rather than \"international\".\r\n\t *\r\n\t * For example, if `initialValueFormat` is `\"national\"`\r\n\t * and the initial `value=\"+12133734253\"` is passed\r\n\t * then the `` value will be `\"(213) 373-4253\"`.\r\n\t *\r\n\t * By default, `initialValueFormat` is `undefined`,\r\n\t * meaning that if the initial `value=\"+12133734253\"` is passed\r\n\t * then the `` value will be `\"+1 213 373 4253\"`.\r\n\t *\r\n\t * The reason for such default behaviour is that\r\n\t * the newer generation grows up when there are no stationary phones\r\n\t * and therefore everyone inputs phone numbers in international format\r\n\t * in their smartphones so people gradually get more accustomed to\r\n\t * writing phone numbers in international format rather than in local format.\r\n\t * Future people won't be using \"national\" format, only \"international\".\r\n\t */\r\n\t// (is `undefined` by default)\r\n\tinitialValueFormat: PropTypes.oneOf(['national']),\r\n\r\n\t// `displayInitialValueAsLocalNumber` property has been\r\n\t// superceded by `initialValueFormat` property.\r\n\tdisplayInitialValueAsLocalNumber: PropTypes.bool,\r\n\r\n\t/**\r\n\t * The country to be selected by default.\r\n\t * For example, can be set after a GeoIP lookup.\r\n\t *\r\n\t * Example: `\"US\"`.\r\n\t */\r\n\t// A two-letter country code (\"ISO 3166-1 alpha-2\").\r\n\tdefaultCountry: PropTypes.string,\r\n\r\n\t/**\r\n\t * If specified, only these countries will be available for selection.\r\n\t *\r\n\t * Example:\r\n\t *\r\n\t * `[\"RU\", \"UA\", \"KZ\"]`\r\n\t */\r\n\tcountries: PropTypes.arrayOf(PropTypes.string),\r\n\r\n\t/**\r\n\t * Custom country `` option names.\r\n\t * Also some labels like \"ext\" and country `` `aria-label`.\r\n\t *\r\n\t * Example:\r\n\t *\r\n\t * `{ \"ZZ\": \"Международный\", RU: \"Россия\", US: \"США\", ... }`\r\n\t *\r\n\t * See the `locales` directory for examples.\r\n\t */\r\n\tlabels: labelsPropType,\r\n\r\n\t/**\r\n\t * Country `` options are sorted by their labels.\r\n\t * The default sorting function uses `a.localeCompare(b, locales)`,\r\n\t * and, if that's not available, falls back to simple `a > b` / `a < b`.\r\n\t * Some languages, like Chinese, support multiple sorting variants\r\n\t * (called \"collations\"), and the user might prefer one or another.\r\n\t * Also, sometimes the Operating System language is not always\r\n\t * the preferred language for a person using a website or an application,\r\n\t * so there should be a way to specify custom locale.\r\n\t * This `locales` property mimicks the `locales` argument of `Intl` constructors,\r\n\t * and can be either a Unicode BCP 47 locale identifier or an array of such locale identifiers.\r\n\t * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument\r\n\t */\r\n\tlocales: PropTypes.oneOfType([\r\n\t\tPropTypes.string,\r\n\t\tPropTypes.arrayOf(PropTypes.string)\r\n\t]),\r\n\r\n\t/*\r\n\t * Custom country `` options sorting function.\r\n\t * The default one uses `a.localeCompare(b)`, and,\r\n\t * if that's not available, falls back to simple `a > b`/`a < b`.\r\n\t * There have been requests to add custom sorter for cases\r\n\t * like Chinese language and \"pinyin\" (non-default) sorting order.\r\n\t * https://stackoverflow.com/questions/22907288/chinese-sorting-by-pinyin-in-javascript-with-localecompare\r\n\tcompareStrings: PropTypes.func,\r\n\t */\r\n\r\n\t/**\r\n\t * A URL template of a country flag, where\r\n\t * \"{XX}\" is a two-letter country code in upper case,\r\n\t * or where \"{xx}\" is a two-letter country code in lower case.\r\n\t * By default it points to `country-flag-icons` gitlab pages website.\r\n\t * I imagine someone might want to download those country flag icons\r\n\t * and host them on their own servers instead\r\n\t * (all flags are available in the `country-flag-icons` library).\r\n\t * There's a catch though: new countries may be added in future,\r\n\t * so when hosting country flag icons on your own server\r\n\t * one should check the `CHANGELOG.md` every time before updating this library,\r\n\t * otherwise there's a possibility that some new country flag would be missing.\r\n\t */\r\n\tflagUrl: PropTypes.string,\r\n\r\n\t/**\r\n\t * Custom country flag icon components.\r\n\t * These flags will be used instead of the default ones.\r\n\t * The the \"Flags\" section of the readme for more info.\r\n\t *\r\n\t * The shape is an object where keys are country codes\r\n\t * and values are flag icon components.\r\n\t * Flag icon components receive the same properties\r\n\t * as `flagComponent` (see below).\r\n\t *\r\n\t * Example:\r\n\t *\r\n\t * `{ \"RU\": (props) =>
}`\r\n\t *\r\n\t * Example:\r\n\t *\r\n\t * `import flags from 'country-flag-icons/react/3x2'`\r\n\t *\r\n\t * `import PhoneInput from 'react-phone-number-input'`\r\n\t *\r\n\t * ``\r\n\t */\r\n\tflags: PropTypes.objectOf(PropTypes.elementType),\r\n\r\n\t/**\r\n\t * Country flag icon component.\r\n\t *\r\n\t * Takes properties:\r\n\t *\r\n\t * * `country: string` — The country code.\r\n\t * * `countryName: string` — The country name.\r\n\t * * `flagUrl: string` — The `flagUrl` property (see above).\r\n\t * * `flags: object` — The `flags` property (see above).\r\n\t */\r\n\tflagComponent: PropTypes.elementType,\r\n\r\n\t/**\r\n\t * Set to `false` to remove the \"International\" option from country ``.\r\n\t */\r\n\taddInternationalOption: PropTypes.bool,\r\n\r\n\t/**\r\n\t * \"International\" icon component.\r\n\t * Should have the same aspect ratio.\r\n\t *\r\n\t * Receives properties:\r\n\t *\r\n\t * * `title: string` — \"International\" country option label.\r\n\t */\r\n\tinternationalIcon: PropTypes.elementType,\r\n\r\n\t/**\r\n\t * Can be used to place some countries on top of the list of country `` options.\r\n\t *\r\n\t * * `\"XX\"` — inserts an option for \"XX\" country.\r\n\t * * `\"🌐\"` — inserts \"International\" option.\r\n\t * * `\"|\"` — inserts a separator.\r\n\t * * `\"...\"` — inserts options for the rest of the countries (can be omitted, in which case it will be automatically added at the end).\r\n\t *\r\n\t * Example:\r\n\t *\r\n\t * `[\"US\", \"CA\", \"AU\", \"|\", \"...\"]`\r\n\t */\r\n\tcountryOptionsOrder: PropTypes.arrayOf(PropTypes.string),\r\n\r\n\t/**\r\n\t * `` component CSS style object.\r\n\t */\r\n\tstyle: PropTypes.object,\r\n\r\n\t/**\r\n\t * `` component CSS class.\r\n\t */\r\n\tclassName: PropTypes.string,\r\n\r\n\t/**\r\n\t * Country `` component.\r\n\t *\r\n\t * Receives properties:\r\n\t *\r\n\t * * `name: string?` — HTML `name` attribute.\r\n\t * * `value: string?` — The currently selected country code.\r\n\t * * `onChange(value: string?)` — Updates the `value`.\r\n\t * * `onFocus()` — Is used to toggle the `--focus` CSS class.\r\n\t * * `onBlur()` — Is used to toggle the `--focus` CSS class.\r\n\t * * `options: object[]` — The list of all selectable countries (including \"International\") each being an object of shape `{ value: string?, label: string }`.\r\n\t * * `iconComponent: PropTypes.elementType` — React component that renders a country icon: ``. If `country` is `undefined` then it renders an \"International\" icon.\r\n\t * * `disabled: boolean?` — HTML `disabled` attribute.\r\n\t * * `readOnly: boolean?` — HTML `readOnly` attribute.\r\n\t * * `tabIndex: (number|string)?` — HTML `tabIndex` attribute.\r\n\t * * `className: string` — CSS class name.\r\n\t */\r\n\tcountrySelectComponent: PropTypes.elementType,\r\n\r\n\t/**\r\n\t * Country `` component props.\r\n\t * Along with the usual DOM properties such as `aria-label` and `tabIndex`,\r\n\t * some custom properties are supported, such as `arrowComponent` and `unicodeFlags`.\r\n\t */\r\n\tcountrySelectProps: PropTypes.object,\r\n\r\n\t/**\r\n\t * Phone number `` component.\r\n\t *\r\n\t * Receives properties:\r\n\t *\r\n\t * * `value: string` — The formatted `value`.\r\n\t * * `onChange(event: Event)` — Updates the formatted `value` from `event.target.value`.\r\n\t * * `onFocus()` — Is used to toggle the `--focus` CSS class.\r\n\t * * `onBlur()` — Is used to toggle the `--focus` CSS class.\r\n\t * * Other properties like `type=\"tel\"` or `autoComplete=\"tel\"` that should be passed through to the DOM ``.\r\n\t *\r\n\t * Must also either use `React.forwardRef()` to \"forward\" `ref` to the `` or implement `.focus()` method.\r\n\t */\r\n\tinputComponent: PropTypes.elementType,\r\n\r\n\t/**\r\n\t * Phone number `` component props.\r\n\t */\r\n\tnumberInputProps: PropTypes.object,\r\n\r\n\t/**\r\n\t * Wrapping `` component.\r\n\t *\r\n\t * Receives properties:\r\n\t *\r\n\t * * `style: object` — A component CSS style object.\r\n\t * * `className: string` — Classes to attach to the component, typically changes when component focuses or blurs.\r\n\t */\r\n\tcontainerComponent: PropTypes.elementType,\r\n\r\n\t/**\r\n\t * Wrapping `` component props.\r\n\t */\r\n\tcontainerComponentProps: PropTypes.object,\r\n\r\n\t/**\r\n\t * When the user attempts to insert a digit somewhere in the middle of a phone number,\r\n\t * the caret position is moved right before the next available digit skipping\r\n\t * any punctuation in between. This is called \"smart\" caret positioning.\r\n\t * Another case would be the phone number format changing as a result of\r\n\t * the user inserting the digit somewhere in the middle, which would require\r\n\t * re-positioning the caret because all digit positions have changed.\r\n\t * This \"smart\" caret positioning feature can be turned off by passing\r\n\t * `smartCaret={false}` property: use it in case of any possible issues\r\n\t * with caret position during phone number input.\r\n\t */\r\n\t// Is `true` by default.\r\n\tsmartCaret: PropTypes.bool,\r\n\r\n\t/**\r\n\t * Set to `true` to force \"international\" phone number format.\r\n\t * Set to `false` to force \"national\" phone number format.\r\n\t * By default it's `undefined` meaning that it doesn't enforce any phone number format.\r\n\t */\r\n\tinternational: PropTypes.bool,\r\n\r\n\t/**\r\n\t * If set to `true`, the phone number input will get trimmed\r\n\t * if it exceeds the maximum length for the country.\r\n\t */\r\n\tlimitMaxLength: PropTypes.bool,\r\n\r\n\t/**\r\n\t * If set to `false`, and `international` is `true`, then\r\n\t * users won't be able to erase the \"country calling part\"\r\n\t * of a phone number in the ``.\r\n\t */\r\n\tcountryCallingCodeEditable: PropTypes.bool,\r\n\r\n\t/**\r\n\t * `libphonenumber-js` metadata.\r\n\t *\r\n\t * Can be used to pass custom `libphonenumber-js` metadata\r\n\t * to reduce the overall bundle size for those who compile \"custom\" metadata.\r\n\t */\r\n\tmetadata: metadataPropType,\r\n\r\n\t/**\r\n\t * Is called every time the selected country changes:\r\n\t * either programmatically or when user selects it manually from the list.\r\n\t */\r\n\t// People have been asking for a way to get the selected country.\r\n\t// @see https://github.com/catamphetamine/react-phone-number-input/issues/128\r\n\t// For some it's just a \"business requirement\".\r\n\t// I guess it's about gathering as much info on the user as a website can\r\n\t// without introducing any addional fields that would complicate the form\r\n\t// therefore reducing \"conversion\" (that's a marketing term).\r\n\t// Assuming that the phone number's country is the user's country\r\n\t// is not 100% correct but in most cases I guess it's valid.\r\n\tonCountryChange: PropTypes.func,\r\n\r\n\t/**\r\n\t * If set to `false`, will not focus the `` component\r\n\t * when the user selects a country from the list of countries.\r\n\t * This can be used to conform to the Web Content Accessibility Guidelines (WCAG).\r\n\t * Quote:\r\n\t * \"On input: Changing the setting of any user interface component\r\n\t * does not automatically cause a change of context unless the user\r\n\t * has been advised of the behaviour before using the component.\"\r\n\t */\r\n\tfocusInputOnCountrySelection: PropTypes.bool\r\n}\r\n\r\nconst defaultProps = {\r\n\t/**\r\n\t * Remember (and autofill) the value as a phone number.\r\n\t */\r\n\tautoComplete: 'tel',\r\n\r\n\t/**\r\n\t * Country `` component.\r\n\t */\r\n\tcountrySelectComponent: CountrySelect,\r\n\r\n\t/**\r\n\t * Flag icon component.\r\n\t */\r\n\tflagComponent: Flag,\r\n\r\n\t/**\r\n\t * By default, uses icons from `country-flag-icons` gitlab pages website.\r\n\t */\r\n\t// Must be equal to `flagUrl` in `./CountryIcon.js`.\r\n\tflagUrl: 'https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg',\r\n\r\n\t/**\r\n\t * Default \"International\" country `` option icon.\r\n\t */\r\n\tinternationalIcon: InternationalIcon,\r\n\r\n\t/**\r\n\t * Phone number `` component.\r\n\t */\r\n\tinputComponent: 'input',\r\n\r\n\t/**\r\n\t * Wrapping `` component.\r\n\t */\r\n\tcontainerComponent: 'div',\r\n\r\n\t/**\r\n\t * Some users requested a way to reset the component:\r\n\t * both number `` and country ``.\r\n\t * Whenever `reset` property changes both number ``\r\n\t * and country `` are reset.\r\n\t * It's not implemented as some instance `.reset()` method\r\n\t * because `ref` is forwarded to ``.\r\n\t * It's also not replaced with just resetting `country` on\r\n\t * external `value` reset, because a user could select a country\r\n\t * and then not input any `value`, and so the selected country\r\n\t * would be \"stuck\", if not using this `reset` property.\r\n\t */\r\n\t// https://github.com/catamphetamine/react-phone-number-input/issues/300\r\n\treset: PropTypes.any,\r\n\r\n\t/**\r\n\t *\r\n\t */\r\n\r\n\t/**\r\n\t * Set to `false` to use \"basic\" caret instead of the \"smart\" one.\r\n\t */\r\n\tsmartCaret: true,\r\n\r\n\t/**\r\n\t * Whether to add the \"International\" option\r\n\t * to the list of countries.\r\n\t */\r\n\taddInternationalOption: true,\r\n\r\n\t/**\r\n\t * If set to `false`, and `international` is `true`, then\r\n\t * users won't be able to erase the \"country calling part\"\r\n\t * of a phone number in the ``.\r\n\t */\r\n\tcountryCallingCodeEditable: true,\r\n\r\n\t/**\r\n\t * If set to `false`, will not focus the `` component\r\n\t * when the user selects a country from the list of countries.\r\n\t * This can be used to conform to the Web Content Accessibility Guidelines (WCAG).\r\n\t * Quote:\r\n\t * \"On input: Changing the setting of any user interface component\r\n\t * does not automatically cause a change of context unless the user\r\n\t * has been advised of the behaviour before using the component.\"\r\n\t */\r\n\tfocusInputOnCountrySelection: true\r\n}\r\n\r\nfunction withDefaultProps(props) {\r\n\tprops = { ...props }\r\n\r\n\tfor (const key in defaultProps) {\r\n\t\tif (props[key] === undefined) {\r\n\t\t\tprops[key] = defaultProps[key]\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n\r\nexport default PhoneNumberInput\r\n\r\nfunction areEqualArrays(a, b) {\r\n\tif (a.length !== b.length) {\r\n\t\treturn false\r\n\t}\r\n\tlet i = 0\r\n\twhile (i < a.length) {\r\n\t\tif (a[i] !== b[i]) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t\ti++\r\n\t}\r\n\treturn true\r\n}\r\n","import React from 'react'\r\nimport PropTypes from 'prop-types'\r\n\r\nimport defaultLabels from '../locale/en.json.js'\r\n\r\nimport {\r\n\tmetadata as metadataPropType,\r\n\tlabels as labelsPropType\r\n} from './PropTypes.js'\r\n\r\nimport PhoneInput from './PhoneInputWithCountry.js'\r\n\r\nexport function createPhoneInput(defaultMetadata) {\r\n\tconst PhoneInputDefault = React.forwardRef(({\r\n\t\tmetadata = defaultMetadata,\r\n\t\tlabels = defaultLabels,\r\n\t\t...rest\r\n\t}, ref) => (\r\n\t\t\r\n\t))\r\n\r\n\tPhoneInputDefault.propTypes = {\r\n\t\tmetadata: metadataPropType,\r\n\t\tlabels: labelsPropType\r\n\t}\r\n\r\n\treturn PhoneInputDefault\r\n}\r\n\r\nexport default createPhoneInput()","import metadata from 'libphonenumber-js/min/metadata'\r\n\r\nimport {\r\n\tparsePhoneNumber as _parsePhoneNumber,\r\n\tformatPhoneNumber as _formatPhoneNumber,\r\n\tformatPhoneNumberIntl as _formatPhoneNumberIntl,\r\n\tisValidPhoneNumber as _isValidPhoneNumber,\r\n\tisPossiblePhoneNumber as _isPossiblePhoneNumber,\r\n\tgetCountries as _getCountries,\r\n\tgetCountryCallingCode as _getCountryCallingCode,\r\n\tisSupportedCountry as _isSupportedCountry\r\n} from '../core/index.js'\r\n\r\nimport { createPhoneInput } from '../modules/PhoneInputWithCountryDefault.js'\r\n\r\nfunction call(func, _arguments) {\r\n\tvar args = Array.prototype.slice.call(_arguments)\r\n\targs.push(metadata)\r\n\treturn func.apply(this, args)\r\n}\r\n\r\nexport default createPhoneInput(metadata)\r\n\r\nexport function parsePhoneNumber() {\r\n\treturn call(_parsePhoneNumber, arguments)\r\n}\r\n\r\nexport function formatPhoneNumber() {\r\n\treturn call(_formatPhoneNumber, arguments)\r\n}\r\n\r\nexport function formatPhoneNumberIntl() {\r\n\treturn call(_formatPhoneNumberIntl, arguments)\r\n}\r\n\r\nexport function isValidPhoneNumber() {\r\n\treturn call(_isValidPhoneNumber, arguments)\r\n}\r\n\r\nexport function isPossiblePhoneNumber() {\r\n\treturn call(_isPossiblePhoneNumber, arguments)\r\n}\r\n\r\nexport function getCountries() {\r\n\treturn call(_getCountries, arguments)\r\n}\r\n\r\nexport function getCountryCallingCode() {\r\n\treturn call(_getCountryCallingCode, arguments)\r\n}\r\n\r\nexport function isSupportedCountry() {\r\n\treturn call(_isSupportedCountry, arguments)\r\n}","import { IconMail, IconMessage, IconPhoneCall } from \"@tabler/icons-react\";\nimport AppContext from \"Context/appContext\";\nimport Card from \"components/Card\";\nimport FormInput from \"components/FormInput\";\nimport \"containers/ContactDetails\";\nimport \"containers/ContactDetails/index.css\";\nimport { useContext, useEffect, useState } from \"react\";\nimport { Controller, useFormState } from \"react-hook-form\";\nimport PhoneInput from \"react-phone-number-input\";\nimport \"react-phone-number-input/style.css\";\n\nconst ContactDeatils = () => {\n const {\n formdata,\n setFormData,\n productCartDetail,\n progressState,\n setErrors,\n reactHookFormData,\n countryDetails,\n isWebView,\n setNotificationWay,\n isButtonClicked\n } = useContext(AppContext);\n\n const { register, handleSubmit, watch, control, formErrors } =\n reactHookFormData;\n const [menuOption, setMenuOption] = useState([\n {\n id: 1,\n name: \"SMS Text (Instant)\",\n icon: ,\n value: \"sms\",\n active: false,\n },\n {\n id: 2,\n name: \"Email (Instant)\",\n icon: ,\n value: \"email\",\n active: false,\n },\n {\n id: 3,\n name: \"Phone\",\n icon: ,\n value: \"phone\",\n active: false,\n },\n ]);\n\n const updateStatus = (index) => {\n const selectedItem = menuOption[index];\n menuOption.filter((m) => {\n if (m.id === selectedItem.id) {\n m.active = true;\n } else {\n m.active = false;\n }\n });\n setFormData({\n ...formdata,\n option: selectedItem.active ? selectedItem.value : \"\",\n });\n };\n\n const updateFields = (index) => {\n // Update checkbox state immediately, before validation\n const selectedItem = menuOption[index];\n\n // Create a new array to update the checkbox state\n const updatedMenuOption = menuOption.map((m, idx) => ({\n ...m,\n active: idx === index, // Set active to true only for the clicked item\n }));\n\n // Filter out any non-serializable data (like React components) before storing\n const serializableMenuOption = updatedMenuOption.map(\n ({ id, name, value, active }) => ({\n id,\n name,\n value,\n active, // Only keep serializable data\n })\n );\n\n // Save the serializable version of the state in localStorage\n sessionStorage.setItem(\n \"menuOption\",\n JSON.stringify(serializableMenuOption)\n );\n\n // Update the checkbox state first\n setMenuOption(updatedMenuOption);\n\n // Update the form data to reflect the selected option\n setFormData({\n ...formdata,\n option: selectedItem.value,\n });\n\n setNotificationWay(selectedItem.value);\n\n // No validation triggered here; it's deferred to the button click event\n\n // Now trigger validation (this will show errors, but not stop checkbox update)\n // handleSubmit(() => {\n // // Validation logic here\n // console.log(\"Validation passed\");\n // })(); // Immediately invoke handleSubmit to trigger validation\n };\n\n // Manually add the `icon` back if needed after loading from storage\n const restoreOptionField = () => {\n const storedMenuOption = sessionStorage.getItem(\"menuOption\");\n if (storedMenuOption) {\n const parsedMenuOption = JSON.parse(storedMenuOption);\n const updatedMenuOption = parsedMenuOption.map((option) => ({\n ...option,\n icon: (() => {\n switch (option.value) {\n case \"sms\":\n return ;\n case \"email\":\n return ;\n default:\n return ;\n }\n })(),\n }));\n setMenuOption(updatedMenuOption); // Restore state from sessionStorage\n }\n };\n\n // Detect web view on component mount\n useEffect(() => {\n // handleSubmit(() => {})(); // Immediately invoke handleSubmit to trigger validation\n\n // Only restore state when the component mounts (i.e., on tab reopen)\n restoreOptionField();\n\n const handleBeforeUnload = () => {\n sessionStorage.removeItem(\"menuOption\"); // Clear only when the tab is closed or refreshed\n };\n\n window.addEventListener(\"beforeunload\", handleBeforeUnload);\n\n return () => {\n // Optionally clear sessionStorage on component unmount\n window.removeEventListener(\"beforeunload\", handleBeforeUnload); // Clean up the event listener\n };\n }, []);\n\n const submitHandler = (data) => {};\n\n watch((value, { name, type }) => {\n if (type === \"change\") {\n setFormData((prev) => ({\n ...prev,\n [name]: value[name],\n }));\n }\n });\n\n useEffect(() => {\n setErrors(formErrors);\n }, [formErrors, setErrors]);\n\n useEffect(() => {\n menuOption.forEach((m) => {\n m.active = false;\n });\n }, []);\n\n const { errors } = useFormState({ control: control });\n\n return (\n \n );\n};\n\nexport default ContactDeatils;\n","import AppContext from \"Context/appContext\";\nimport { fetchSettingsForSubId } from \"api\";\nimport UrlServices from \"../../services/Url\";\nimport Card from \"components/Card\";\nimport Input from \"components/Input\";\nimport \"containers/ProductList/index.css\";\nimport { PAGES } from \"constants\";\nimport { memo, useContext, useEffect, useState } from \"react\";\n\nlet load = true;\n\nconst ProductList = () => {\n const {\n productCartDetail,\n setProductCartDetail,\n productCartData,\n setProgressState,\n products,\n setProducts,\n setAllProducts,\n loading,\n setLoading,\n prevState,\n setPrevState,\n progressState,\n currentModelsServices,\n setCurrentModelsServices,\n setIsMissedItem,\n allServices,\n setAllServices,\n setUserSettings,\n allServicesForSubId,\n setAllServicesForSubId,\n widthProductSection,\n setWidthProductSection,\n encryptionKey,\n isWebView,\n userSettings\n } = useContext(AppContext);\n\n const [search, setSearch] = useState(\"\");\n const [searchProducts, setSearchProducts] = useState([]);\n\n const base_url = process.env.REACT_APP_APPOINTMENT_PRO_API_URL;\n\n useEffect(() => {\n // Function to update width of product section\n const updateWidthProductSection = () => {\n const productSection = document.getElementById(\"product-section\");\n if (productSection) {\n setWidthProductSection(productSection.offsetWidth);\n }\n };\n\n // Initial call to set div width\n updateWidthProductSection();\n\n // Event listener for window resize\n window.addEventListener(\"resize\", updateWidthProductSection);\n\n const fetchData = async () => {\n if (products.length > 0 || !load) return;\n setLoading(true);\n try {\n load = false;\n const res = await fetch(`${base_url}/${UrlServices.fetchAllCategories}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ q_: encryptionKey }),\n });\n const data = await res.json();\n let newCategories = data.user_data.map((category) =>\n category.brands.filter((brand) => brand.isFavorite)\n );\n const filteredData = [...data.user_data, ...newCategories];\n setProducts(filteredData.flat());\n setAllProducts(filteredData.flat());\n setSearchProducts(filteredData.flat());\n setAllServicesForSubId(data.default_data);\n setUserSettings(data.settings);\n } catch (error) {\n console.log(error);\n } finally {\n updateWidthProductSection();\n setLoading(false);\n }\n };\n fetchData();\n return () =>\n window.removeEventListener(\"resize\", updateWidthProductSection);\n }, [widthProductSection, progressState]);\n\n const filteredProducts = (currentIndex, productName) => {\n if (productName === \"Others\") {\n const s = allServicesForSubId.map((c) => ({\n ...c,\n active: false,\n }));\n setProducts(s);\n setProgressState(3);\n setCurrentModelsServices([]);\n setProductCartDetail({\n ...productCartDetail,\n model: {},\n services: [],\n skipForOthers: true,\n });\n }\n\n let selectedItem = search\n ? searchProducts[currentIndex]\n : products[currentIndex];\n if (progressState !== 3) {\n setPrevState({ ...prevState, [progressState]: products });\n }\n\n setProgressState((prevState) => {\n if (prevState === 3) return prevState;\n if (prevState === 0 && selectedItem.isFavorite) {\n const category = products?.find(\n (product) => product._id === selectedItem.category\n );\n setProductCartDetail({\n ...productCartDetail,\n category,\n brand: selectedItem,\n });\n setIsMissedItem({ ...selectedItem });\n return prevState + 2;\n } else {\n return prevState + 1;\n }\n });\n if (selectedItem?.brands) {\n // If brands exist, return the brands array\n setProductCartDetail({ ...productCartDetail, category: selectedItem });\n setProducts(selectedItem.brands);\n } else if (selectedItem?.models) {\n setProductCartDetail({ ...productCartDetail, brand: selectedItem });\n // If models exist, return the models array\n setCurrentModelsServices(selectedItem.services);\n setAllServices(selectedItem.services);\n setProducts(selectedItem.models);\n } else if (currentModelsServices?.length > 0) {\n // If services exist, return the services array\n setProductCartDetail({ ...productCartDetail, model: selectedItem });\n const filteredServices = allServices\n .filter((service) => service.model._id === selectedItem._id)\n .map((c) => ({ ...c, active: false }));\n setProducts(filteredServices);\n setCurrentModelsServices([]);\n } else {\n const services = productCartDetail?.services\n ? productCartDetail?.services\n : [];\n\n const key = selectedItem?.hasOwnProperty(\"_id\") ? \"_id\" : \"id\";\n const newItem =\n services?.findIndex((s) => s[key] === selectedItem[key]) >= 0;\n\n if (selectedItem?.sale_price) {\n const price = selectedItem?.sale_price.startsWith(\"0\")\n ? selectedItem?.retail_price\n : selectedItem?.sale_price;\n selectedItem[\"price\"] = parseFloat(price);\n }\n\n let totalPrice =\n productCartDetail?.totalPrice === undefined ||\n productCartDetail?.totalPrice === 0\n ? selectedItem?.price\n : selectedItem?.price + productCartDetail?.totalPrice;\n\n selectedItem[\"active\"] = !selectedItem?.active;\n\n if (newItem) {\n //if the item is already existed\n let totalPrice = productCartDetail?.totalPrice - selectedItem.price;\n if (isNaN(totalPrice) || totalPrice === undefined) {\n totalPrice = 0;\n }\n const updatedList = productCartDetail.services.filter(\n (p) => p[key] !== selectedItem[key]\n );\n setProductCartDetail({\n ...productCartDetail,\n totalPrice,\n services: updatedList,\n });\n setProducts([...products]);\n return;\n }\n // data will get from our database\n if (!productCartData && !productCartDetail?.model) {\n if (selectedItem?.model) {\n setProductCartDetail({\n ...productCartDetail,\n totalPrice,\n services: [...services, selectedItem],\n });\n }\n } else {\n // data will get from our repairdesk database\n setProductCartDetail({\n ...productCartDetail,\n totalPrice,\n services: [...services, selectedItem],\n });\n }\n }\n };\n\n const getFilteredProducts = () => {\n if (!search) return products;\n return products?.filter((p) =>\n p.name.toLowerCase().includes(search.toLowerCase())\n );\n };\n\n const handleChange = (e) => {\n setSearch(e.target.value);\n setSearchProducts(\n products?.filter((p) =>\n p.name.toLowerCase().includes(e.target.value.toLowerCase())\n )\n );\n };\n\n const displayedProducts =\n progressState === 3\n ? [...getFilteredProducts()]\n : [\n ...getFilteredProducts(),\n ...(userSettings.showOther ? [{ name: \"Others\", _id: \"others\" }] : [])\n ];\n\n return (\n <>\n {products?.length > 0 && !loading && (\n \n
\n\n {displayedProducts?.length > 0 ? (\n
\n {displayedProducts?.map((p, index) => (\n \n ))}\n
\n ) : (\n
\n
\n No Results Found\n
\n
\n )}\n
\n )}\n >\n );\n};\n\nexport default memo(ProductList);\n","\"use client\";\n\nimport * as React from 'react';\nimport { useContext, useMemo } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];\nexport const DEFAULT_MIN_BREAKPOINT = 'xs';\nconst ThemeContext = /*#__PURE__*/React.createContext({\n prefixes: {},\n breakpoints: DEFAULT_BREAKPOINTS,\n minBreakpoint: DEFAULT_MIN_BREAKPOINT\n});\nconst {\n Consumer,\n Provider\n} = ThemeContext;\nfunction ThemeProvider({\n prefixes = {},\n breakpoints = DEFAULT_BREAKPOINTS,\n minBreakpoint = DEFAULT_MIN_BREAKPOINT,\n dir,\n children\n}) {\n const contextValue = useMemo(() => ({\n prefixes: {\n ...prefixes\n },\n breakpoints,\n minBreakpoint,\n dir\n }), [prefixes, breakpoints, minBreakpoint, dir]);\n return /*#__PURE__*/_jsx(Provider, {\n value: contextValue,\n children: children\n });\n}\nexport function useBootstrapPrefix(prefix, defaultPrefix) {\n const {\n prefixes\n } = useContext(ThemeContext);\n return prefix || prefixes[defaultPrefix] || defaultPrefix;\n}\nexport function useBootstrapBreakpoints() {\n const {\n breakpoints\n } = useContext(ThemeContext);\n return breakpoints;\n}\nexport function useBootstrapMinBreakpoint() {\n const {\n minBreakpoint\n } = useContext(ThemeContext);\n return minBreakpoint;\n}\nexport function useIsRTL() {\n const {\n dir\n } = useContext(ThemeContext);\n return dir === 'rtl';\n}\nfunction createBootstrapComponent(Component, opts) {\n if (typeof opts === 'string') opts = {\n prefix: opts\n };\n const isClassy = Component.prototype && Component.prototype.isReactComponent;\n // If it's a functional component make sure we don't break it with a ref\n const {\n prefix,\n forwardRefAs = isClassy ? 'ref' : 'innerRef'\n } = opts;\n const Wrapped = /*#__PURE__*/React.forwardRef(({\n ...props\n }, ref) => {\n props[forwardRefAs] = ref;\n const bsPrefix = useBootstrapPrefix(props.bsPrefix, prefix);\n return /*#__PURE__*/_jsx(Component, {\n ...props,\n bsPrefix: bsPrefix\n });\n });\n Wrapped.displayName = `Bootstrap(${Component.displayName || Component.name})`;\n return Wrapped;\n}\nexport { createBootstrapComponent, Consumer as ThemeConsumer };\nexport default ThemeProvider;","import * as React from 'react';\n\n/**\n * Iterates through children that are typically specified as `props.children`,\n * but only maps over children that are \"valid elements\".\n *\n * The mapFunction provided index will be normalised to the components mapped,\n * so an invalid component would not increase the index.\n *\n */\nfunction map(children, func) {\n let index = 0;\n return React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? func(child, index++) : child);\n}\n\n/**\n * Iterates through children that are \"valid elements\".\n *\n * The provided forEachFunc(child, index) will be called for each\n * leaf child with the index reflecting the position relative to \"valid components\".\n */\nfunction forEach(children, func) {\n let index = 0;\n React.Children.forEach(children, child => {\n if ( /*#__PURE__*/React.isValidElement(child)) func(child, index++);\n });\n}\n\n/**\n * Finds whether a component's `children` prop includes a React element of the\n * specified type.\n */\nfunction hasChildOfType(children, type) {\n return React.Children.toArray(children).some(child => /*#__PURE__*/React.isValidElement(child) && child.type === type);\n}\nexport { map, forEach, hasChildOfType };","\"use client\";\n\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { cloneElement } from 'react';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport { map } from './ElementChildren';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst ROUND_PRECISION = 1000;\n\n/**\n * Validate that children, if any, are instances of `ProgressBar`.\n */\nfunction onlyProgressBar(props, propName, componentName) {\n const children = props[propName];\n if (!children) {\n return null;\n }\n let error = null;\n React.Children.forEach(children, child => {\n if (error) {\n return;\n }\n\n /**\n * Compare types in a way that works with libraries that patch and proxy\n * components like react-hot-loader.\n *\n * see https://github.com/gaearon/react-hot-loader#checking-element-types\n */\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n const element = /*#__PURE__*/_jsx(ProgressBar, {});\n if (child.type === element.type) return;\n const childType = child.type;\n const childIdentifier = /*#__PURE__*/React.isValidElement(child) ? childType.displayName || childType.name || childType : child;\n error = new Error(`Children of ${componentName} can contain only ProgressBar ` + `components. Found ${childIdentifier}.`);\n });\n return error;\n}\nfunction getPercentage(now, min, max) {\n const percentage = (now - min) / (max - min) * 100;\n return Math.round(percentage * ROUND_PRECISION) / ROUND_PRECISION;\n}\nfunction renderProgressBar({\n min,\n now,\n max,\n label,\n visuallyHidden,\n striped,\n animated,\n className,\n style,\n variant,\n bsPrefix,\n ...props\n}, ref) {\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n ...props,\n role: \"progressbar\",\n className: classNames(className, `${bsPrefix}-bar`, {\n [`bg-${variant}`]: variant,\n [`${bsPrefix}-bar-animated`]: animated,\n [`${bsPrefix}-bar-striped`]: animated || striped\n }),\n style: {\n width: `${getPercentage(now, min, max)}%`,\n ...style\n },\n \"aria-valuenow\": now,\n \"aria-valuemin\": min,\n \"aria-valuemax\": max,\n children: visuallyHidden ? /*#__PURE__*/_jsx(\"span\", {\n className: \"visually-hidden\",\n children: label\n }) : label\n });\n}\nconst ProgressBar = /*#__PURE__*/React.forwardRef(({\n isChild = false,\n ...rest\n}, ref) => {\n const props = {\n min: 0,\n max: 100,\n animated: false,\n visuallyHidden: false,\n striped: false,\n ...rest\n };\n props.bsPrefix = useBootstrapPrefix(props.bsPrefix, 'progress');\n if (isChild) {\n return renderProgressBar(props, ref);\n }\n const {\n min,\n now,\n max,\n label,\n visuallyHidden,\n striped,\n animated,\n bsPrefix,\n variant,\n className,\n children,\n ...wrapperProps\n } = props;\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n ...wrapperProps,\n className: classNames(className, bsPrefix),\n children: children ? map(children, child => /*#__PURE__*/cloneElement(child, {\n isChild: true\n })) : renderProgressBar({\n min,\n now,\n max,\n label,\n visuallyHidden,\n striped,\n animated,\n bsPrefix,\n variant\n }, ref)\n });\n});\nProgressBar.displayName = 'ProgressBar';\nexport default ProgressBar;","import { getter, forEach, split, normalizePath, join } from 'property-expr';\nimport { camelCase, snakeCase } from 'tiny-case';\nimport toposort from 'toposort';\n\nconst toString = Object.prototype.toString;\nconst errorToString = Error.prototype.toString;\nconst regExpToString = RegExp.prototype.toString;\nconst symbolToString = typeof Symbol !== 'undefined' ? Symbol.prototype.toString : () => '';\nconst SYMBOL_REGEXP = /^Symbol\\((.*)\\)(.*)$/;\nfunction printNumber(val) {\n if (val != +val) return 'NaN';\n const isNegativeZero = val === 0 && 1 / val < 0;\n return isNegativeZero ? '-0' : '' + val;\n}\nfunction printSimpleValue(val, quoteStrings = false) {\n if (val == null || val === true || val === false) return '' + val;\n const typeOf = typeof val;\n if (typeOf === 'number') return printNumber(val);\n if (typeOf === 'string') return quoteStrings ? `\"${val}\"` : val;\n if (typeOf === 'function') return '[Function ' + (val.name || 'anonymous') + ']';\n if (typeOf === 'symbol') return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');\n const tag = toString.call(val).slice(8, -1);\n if (tag === 'Date') return isNaN(val.getTime()) ? '' + val : val.toISOString(val);\n if (tag === 'Error' || val instanceof Error) return '[' + errorToString.call(val) + ']';\n if (tag === 'RegExp') return regExpToString.call(val);\n return null;\n}\nfunction printValue(value, quoteStrings) {\n let result = printSimpleValue(value, quoteStrings);\n if (result !== null) return result;\n return JSON.stringify(value, function (key, value) {\n let result = printSimpleValue(this[key], quoteStrings);\n if (result !== null) return result;\n return value;\n }, 2);\n}\n\nfunction toArray(value) {\n return value == null ? [] : [].concat(value);\n}\n\nlet _Symbol$toStringTag;\nlet strReg = /\\$\\{\\s*(\\w+)\\s*\\}/g;\n_Symbol$toStringTag = Symbol.toStringTag;\nclass ValidationError extends Error {\n static formatError(message, params) {\n const path = params.label || params.path || 'this';\n if (path !== params.path) params = Object.assign({}, params, {\n path\n });\n if (typeof message === 'string') return message.replace(strReg, (_, key) => printValue(params[key]));\n if (typeof message === 'function') return message(params);\n return message;\n }\n static isError(err) {\n return err && err.name === 'ValidationError';\n }\n constructor(errorOrErrors, value, field, type, disableStack) {\n super();\n this.value = void 0;\n this.path = void 0;\n this.type = void 0;\n this.errors = void 0;\n this.params = void 0;\n this.inner = void 0;\n this[_Symbol$toStringTag] = 'Error';\n this.name = 'ValidationError';\n this.value = value;\n this.path = field;\n this.type = type;\n this.errors = [];\n this.inner = [];\n toArray(errorOrErrors).forEach(err => {\n if (ValidationError.isError(err)) {\n this.errors.push(...err.errors);\n const innerErrors = err.inner.length ? err.inner : [err];\n this.inner.push(...innerErrors);\n } else {\n this.errors.push(err);\n }\n });\n this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];\n if (!disableStack && Error.captureStackTrace) Error.captureStackTrace(this, ValidationError);\n }\n}\n\nlet mixed = {\n default: '${path} is invalid',\n required: '${path} is a required field',\n defined: '${path} must be defined',\n notNull: '${path} cannot be null',\n oneOf: '${path} must be one of the following values: ${values}',\n notOneOf: '${path} must not be one of the following values: ${values}',\n notType: ({\n path,\n type,\n value,\n originalValue\n }) => {\n const castMsg = originalValue != null && originalValue !== value ? ` (cast from the value \\`${printValue(originalValue, true)}\\`).` : '.';\n return type !== 'mixed' ? `${path} must be a \\`${type}\\` type, ` + `but the final value was: \\`${printValue(value, true)}\\`` + castMsg : `${path} must match the configured type. ` + `The validated value was: \\`${printValue(value, true)}\\`` + castMsg;\n }\n};\nlet string = {\n length: '${path} must be exactly ${length} characters',\n min: '${path} must be at least ${min} characters',\n max: '${path} must be at most ${max} characters',\n matches: '${path} must match the following: \"${regex}\"',\n email: '${path} must be a valid email',\n url: '${path} must be a valid URL',\n uuid: '${path} must be a valid UUID',\n trim: '${path} must be a trimmed string',\n lowercase: '${path} must be a lowercase string',\n uppercase: '${path} must be a upper case string'\n};\nlet number = {\n min: '${path} must be greater than or equal to ${min}',\n max: '${path} must be less than or equal to ${max}',\n lessThan: '${path} must be less than ${less}',\n moreThan: '${path} must be greater than ${more}',\n positive: '${path} must be a positive number',\n negative: '${path} must be a negative number',\n integer: '${path} must be an integer'\n};\nlet date = {\n min: '${path} field must be later than ${min}',\n max: '${path} field must be at earlier than ${max}'\n};\nlet boolean = {\n isValue: '${path} field must be ${value}'\n};\nlet object = {\n noUnknown: '${path} field has unspecified keys: ${unknown}'\n};\nlet array = {\n min: '${path} field must have at least ${min} items',\n max: '${path} field must have less than or equal to ${max} items',\n length: '${path} must have ${length} items'\n};\nlet tuple = {\n notType: params => {\n const {\n path,\n value,\n spec\n } = params;\n const typeLen = spec.types.length;\n if (Array.isArray(value)) {\n if (value.length < typeLen) return `${path} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \\`${printValue(value, true)}\\``;\n if (value.length > typeLen) return `${path} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \\`${printValue(value, true)}\\``;\n }\n return ValidationError.formatError(mixed.notType, params);\n }\n};\nvar locale = Object.assign(Object.create(null), {\n mixed,\n string,\n number,\n date,\n object,\n array,\n boolean,\n tuple\n});\n\nconst isSchema = obj => obj && obj.__isYupSchema__;\n\nclass Condition {\n static fromOptions(refs, config) {\n if (!config.then && !config.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');\n let {\n is,\n then,\n otherwise\n } = config;\n let check = typeof is === 'function' ? is : (...values) => values.every(value => value === is);\n return new Condition(refs, (values, schema) => {\n var _branch;\n let branch = check(...values) ? then : otherwise;\n return (_branch = branch == null ? void 0 : branch(schema)) != null ? _branch : schema;\n });\n }\n constructor(refs, builder) {\n this.fn = void 0;\n this.refs = refs;\n this.refs = refs;\n this.fn = builder;\n }\n resolve(base, options) {\n let values = this.refs.map(ref =>\n // TODO: ? operator here?\n ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));\n let schema = this.fn(values, base, options);\n if (schema === undefined ||\n // @ts-ignore this can be base\n schema === base) {\n return base;\n }\n if (!isSchema(schema)) throw new TypeError('conditions must return a schema object');\n return schema.resolve(options);\n }\n}\n\nconst prefixes = {\n context: '$',\n value: '.'\n};\nfunction create$9(key, options) {\n return new Reference(key, options);\n}\nclass Reference {\n constructor(key, options = {}) {\n this.key = void 0;\n this.isContext = void 0;\n this.isValue = void 0;\n this.isSibling = void 0;\n this.path = void 0;\n this.getter = void 0;\n this.map = void 0;\n if (typeof key !== 'string') throw new TypeError('ref must be a string, got: ' + key);\n this.key = key.trim();\n if (key === '') throw new TypeError('ref must be a non-empty string');\n this.isContext = this.key[0] === prefixes.context;\n this.isValue = this.key[0] === prefixes.value;\n this.isSibling = !this.isContext && !this.isValue;\n let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : '';\n this.path = this.key.slice(prefix.length);\n this.getter = this.path && getter(this.path, true);\n this.map = options.map;\n }\n getValue(value, parent, context) {\n let result = this.isContext ? context : this.isValue ? value : parent;\n if (this.getter) result = this.getter(result || {});\n if (this.map) result = this.map(result);\n return result;\n }\n\n /**\n *\n * @param {*} value\n * @param {Object} options\n * @param {Object=} options.context\n * @param {Object=} options.parent\n */\n cast(value, options) {\n return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);\n }\n resolve() {\n return this;\n }\n describe() {\n return {\n type: 'ref',\n key: this.key\n };\n }\n toString() {\n return `Ref(${this.key})`;\n }\n static isRef(value) {\n return value && value.__isYupRef;\n }\n}\n\n// @ts-ignore\nReference.prototype.__isYupRef = true;\n\nconst isAbsent = value => value == null;\n\nfunction createValidation(config) {\n function validate({\n value,\n path = '',\n options,\n originalValue,\n schema\n }, panic, next) {\n const {\n name,\n test,\n params,\n message,\n skipAbsent\n } = config;\n let {\n parent,\n context,\n abortEarly = schema.spec.abortEarly,\n disableStackTrace = schema.spec.disableStackTrace\n } = options;\n function resolve(item) {\n return Reference.isRef(item) ? item.getValue(value, parent, context) : item;\n }\n function createError(overrides = {}) {\n var _overrides$disableSta;\n const nextParams = Object.assign({\n value,\n originalValue,\n label: schema.spec.label,\n path: overrides.path || path,\n spec: schema.spec\n }, params, overrides.params);\n for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);\n const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name, (_overrides$disableSta = overrides.disableStackTrace) != null ? _overrides$disableSta : disableStackTrace);\n error.params = nextParams;\n return error;\n }\n const invalid = abortEarly ? panic : next;\n let ctx = {\n path,\n parent,\n type: name,\n from: options.from,\n createError,\n resolve,\n options,\n originalValue,\n schema\n };\n const handleResult = validOrError => {\n if (ValidationError.isError(validOrError)) invalid(validOrError);else if (!validOrError) invalid(createError());else next(null);\n };\n const handleError = err => {\n if (ValidationError.isError(err)) invalid(err);else panic(err);\n };\n const shouldSkip = skipAbsent && isAbsent(value);\n if (shouldSkip) {\n return handleResult(true);\n }\n let result;\n try {\n var _result;\n result = test.call(ctx, value, ctx);\n if (typeof ((_result = result) == null ? void 0 : _result.then) === 'function') {\n if (options.sync) {\n throw new Error(`Validation test of type: \"${ctx.type}\" returned a Promise during a synchronous validate. ` + `This test will finish after the validate call has returned`);\n }\n return Promise.resolve(result).then(handleResult, handleError);\n }\n } catch (err) {\n handleError(err);\n return;\n }\n handleResult(result);\n }\n validate.OPTIONS = config;\n return validate;\n}\n\nfunction getIn(schema, path, value, context = value) {\n let parent, lastPart, lastPartDebug;\n\n // root path: ''\n if (!path) return {\n parent,\n parentPath: path,\n schema\n };\n forEach(path, (_part, isBracket, isArray) => {\n let part = isBracket ? _part.slice(1, _part.length - 1) : _part;\n schema = schema.resolve({\n context,\n parent,\n value\n });\n let isTuple = schema.type === 'tuple';\n let idx = isArray ? parseInt(part, 10) : 0;\n if (schema.innerType || isTuple) {\n if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part \"${lastPartDebug}\" must contain an index to the tuple element, e.g. \"${lastPartDebug}[0]\"`);\n if (value && idx >= value.length) {\n throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. ` + `because there is no value at that index. `);\n }\n parent = value;\n value = value && value[idx];\n schema = isTuple ? schema.spec.types[idx] : schema.innerType;\n }\n\n // sometimes the array index part of a path doesn't exist: \"nested.arr.child\"\n // in these cases the current part is the next schema and should be processed\n // in this iteration. For cases where the index signature is included this\n // check will fail and we'll handle the `child` part on the next iteration like normal\n if (!isArray) {\n if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path}. ` + `(failed at: ${lastPartDebug} which is a type: \"${schema.type}\")`);\n parent = value;\n value = value && value[part];\n schema = schema.fields[part];\n }\n lastPart = part;\n lastPartDebug = isBracket ? '[' + _part + ']' : '.' + _part;\n });\n return {\n schema,\n parent,\n parentPath: lastPart\n };\n}\nfunction reach(obj, path, value, context) {\n return getIn(obj, path, value, context).schema;\n}\n\nclass ReferenceSet extends Set {\n describe() {\n const description = [];\n for (const item of this.values()) {\n description.push(Reference.isRef(item) ? item.describe() : item);\n }\n return description;\n }\n resolveAll(resolve) {\n let result = [];\n for (const item of this.values()) {\n result.push(resolve(item));\n }\n return result;\n }\n clone() {\n return new ReferenceSet(this.values());\n }\n merge(newItems, removeItems) {\n const next = this.clone();\n newItems.forEach(value => next.add(value));\n removeItems.forEach(value => next.delete(value));\n return next;\n }\n}\n\n// tweaked from https://github.com/Kelin2025/nanoclone/blob/0abeb7635bda9b68ef2277093f76dbe3bf3948e1/src/index.js\nfunction clone(src, seen = new Map()) {\n if (isSchema(src) || !src || typeof src !== 'object') return src;\n if (seen.has(src)) return seen.get(src);\n let copy;\n if (src instanceof Date) {\n // Date\n copy = new Date(src.getTime());\n seen.set(src, copy);\n } else if (src instanceof RegExp) {\n // RegExp\n copy = new RegExp(src);\n seen.set(src, copy);\n } else if (Array.isArray(src)) {\n // Array\n copy = new Array(src.length);\n seen.set(src, copy);\n for (let i = 0; i < src.length; i++) copy[i] = clone(src[i], seen);\n } else if (src instanceof Map) {\n // Map\n copy = new Map();\n seen.set(src, copy);\n for (const [k, v] of src.entries()) copy.set(k, clone(v, seen));\n } else if (src instanceof Set) {\n // Set\n copy = new Set();\n seen.set(src, copy);\n for (const v of src) copy.add(clone(v, seen));\n } else if (src instanceof Object) {\n // Object\n copy = {};\n seen.set(src, copy);\n for (const [k, v] of Object.entries(src)) copy[k] = clone(v, seen);\n } else {\n throw Error(`Unable to clone ${src}`);\n }\n return copy;\n}\n\n// If `CustomSchemaMeta` isn't extended with any keys, we'll fall back to a\n// loose Record definition allowing free form usage.\nclass Schema {\n constructor(options) {\n this.type = void 0;\n this.deps = [];\n this.tests = void 0;\n this.transforms = void 0;\n this.conditions = [];\n this._mutate = void 0;\n this.internalTests = {};\n this._whitelist = new ReferenceSet();\n this._blacklist = new ReferenceSet();\n this.exclusiveTests = Object.create(null);\n this._typeCheck = void 0;\n this.spec = void 0;\n this.tests = [];\n this.transforms = [];\n this.withMutation(() => {\n this.typeError(mixed.notType);\n });\n this.type = options.type;\n this._typeCheck = options.check;\n this.spec = Object.assign({\n strip: false,\n strict: false,\n abortEarly: true,\n recursive: true,\n disableStackTrace: false,\n nullable: false,\n optional: true,\n coerce: true\n }, options == null ? void 0 : options.spec);\n this.withMutation(s => {\n s.nonNullable();\n });\n }\n\n // TODO: remove\n get _type() {\n return this.type;\n }\n clone(spec) {\n if (this._mutate) {\n if (spec) Object.assign(this.spec, spec);\n return this;\n }\n\n // if the nested value is a schema we can skip cloning, since\n // they are already immutable\n const next = Object.create(Object.getPrototypeOf(this));\n\n // @ts-expect-error this is readonly\n next.type = this.type;\n next._typeCheck = this._typeCheck;\n next._whitelist = this._whitelist.clone();\n next._blacklist = this._blacklist.clone();\n next.internalTests = Object.assign({}, this.internalTests);\n next.exclusiveTests = Object.assign({}, this.exclusiveTests);\n\n // @ts-expect-error this is readonly\n next.deps = [...this.deps];\n next.conditions = [...this.conditions];\n next.tests = [...this.tests];\n next.transforms = [...this.transforms];\n next.spec = clone(Object.assign({}, this.spec, spec));\n return next;\n }\n label(label) {\n let next = this.clone();\n next.spec.label = label;\n return next;\n }\n meta(...args) {\n if (args.length === 0) return this.spec.meta;\n let next = this.clone();\n next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);\n return next;\n }\n withMutation(fn) {\n let before = this._mutate;\n this._mutate = true;\n let result = fn(this);\n this._mutate = before;\n return result;\n }\n concat(schema) {\n if (!schema || schema === this) return this;\n if (schema.type !== this.type && this.type !== 'mixed') throw new TypeError(`You cannot \\`concat()\\` schema's of different types: ${this.type} and ${schema.type}`);\n let base = this;\n let combined = schema.clone();\n const mergedSpec = Object.assign({}, base.spec, combined.spec);\n combined.spec = mergedSpec;\n combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);\n\n // manually merge the blacklist/whitelist (the other `schema` takes\n // precedence in case of conflicts)\n combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);\n combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);\n\n // start with the current tests\n combined.tests = base.tests;\n combined.exclusiveTests = base.exclusiveTests;\n\n // manually add the new tests to ensure\n // the deduping logic is consistent\n combined.withMutation(next => {\n schema.tests.forEach(fn => {\n next.test(fn.OPTIONS);\n });\n });\n combined.transforms = [...base.transforms, ...combined.transforms];\n return combined;\n }\n isType(v) {\n if (v == null) {\n if (this.spec.nullable && v === null) return true;\n if (this.spec.optional && v === undefined) return true;\n return false;\n }\n return this._typeCheck(v);\n }\n resolve(options) {\n let schema = this;\n if (schema.conditions.length) {\n let conditions = schema.conditions;\n schema = schema.clone();\n schema.conditions = [];\n schema = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema);\n schema = schema.resolve(options);\n }\n return schema;\n }\n resolveOptions(options) {\n var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;\n return Object.assign({}, options, {\n from: options.from || [],\n strict: (_options$strict = options.strict) != null ? _options$strict : this.spec.strict,\n abortEarly: (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly,\n recursive: (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive,\n disableStackTrace: (_options$disableStack = options.disableStackTrace) != null ? _options$disableStack : this.spec.disableStackTrace\n });\n }\n\n /**\n * Run the configured transform pipeline over an input value.\n */\n\n cast(value, options = {}) {\n let resolvedSchema = this.resolve(Object.assign({\n value\n }, options));\n let allowOptionality = options.assert === 'ignore-optionality';\n let result = resolvedSchema._cast(value, options);\n if (options.assert !== false && !resolvedSchema.isType(result)) {\n if (allowOptionality && isAbsent(result)) {\n return result;\n }\n let formattedValue = printValue(value);\n let formattedResult = printValue(result);\n throw new TypeError(`The value of ${options.path || 'field'} could not be cast to a value ` + `that satisfies the schema type: \"${resolvedSchema.type}\". \\n\\n` + `attempted value: ${formattedValue} \\n` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ''));\n }\n return result;\n }\n _cast(rawValue, options) {\n let value = rawValue === undefined ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this), rawValue);\n if (value === undefined) {\n value = this.getDefault(options);\n }\n return value;\n }\n _validate(_value, options = {}, panic, next) {\n let {\n path,\n originalValue = _value,\n strict = this.spec.strict\n } = options;\n let value = _value;\n if (!strict) {\n value = this._cast(value, Object.assign({\n assert: false\n }, options));\n }\n let initialTests = [];\n for (let test of Object.values(this.internalTests)) {\n if (test) initialTests.push(test);\n }\n this.runTests({\n path,\n value,\n originalValue,\n options,\n tests: initialTests\n }, panic, initialErrors => {\n // even if we aren't ending early we can't proceed further if the types aren't correct\n if (initialErrors.length) {\n return next(initialErrors, value);\n }\n this.runTests({\n path,\n value,\n originalValue,\n options,\n tests: this.tests\n }, panic, next);\n });\n }\n\n /**\n * Executes a set of validations, either schema, produced Tests or a nested\n * schema validate result.\n */\n runTests(runOptions, panic, next) {\n let fired = false;\n let {\n tests,\n value,\n originalValue,\n path,\n options\n } = runOptions;\n let panicOnce = arg => {\n if (fired) return;\n fired = true;\n panic(arg, value);\n };\n let nextOnce = arg => {\n if (fired) return;\n fired = true;\n next(arg, value);\n };\n let count = tests.length;\n let nestedErrors = [];\n if (!count) return nextOnce([]);\n let args = {\n value,\n originalValue,\n path,\n options,\n schema: this\n };\n for (let i = 0; i < tests.length; i++) {\n const test = tests[i];\n test(args, panicOnce, function finishTestRun(err) {\n if (err) {\n Array.isArray(err) ? nestedErrors.push(...err) : nestedErrors.push(err);\n }\n if (--count <= 0) {\n nextOnce(nestedErrors);\n }\n });\n }\n }\n asNestedTest({\n key,\n index,\n parent,\n parentPath,\n originalParent,\n options\n }) {\n const k = key != null ? key : index;\n if (k == null) {\n throw TypeError('Must include `key` or `index` for nested validations');\n }\n const isIndex = typeof k === 'number';\n let value = parent[k];\n const testOptions = Object.assign({}, options, {\n // Nested validations fields are always strict:\n // 1. parent isn't strict so the casting will also have cast inner values\n // 2. parent is strict in which case the nested values weren't cast either\n strict: true,\n parent,\n value,\n originalValue: originalParent[k],\n // FIXME: tests depend on `index` being passed around deeply,\n // we should not let the options.key/index bleed through\n key: undefined,\n // index: undefined,\n [isIndex ? 'index' : 'key']: k,\n path: isIndex || k.includes('.') ? `${parentPath || ''}[${value ? k : `\"${k}\"`}]` : (parentPath ? `${parentPath}.` : '') + key\n });\n return (_, panic, next) => this.resolve(testOptions)._validate(value, testOptions, panic, next);\n }\n validate(value, options) {\n var _options$disableStack2;\n let schema = this.resolve(Object.assign({}, options, {\n value\n }));\n let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema.spec.disableStackTrace;\n return new Promise((resolve, reject) => schema._validate(value, options, (error, parsed) => {\n if (ValidationError.isError(error)) error.value = parsed;\n reject(error);\n }, (errors, validated) => {\n if (errors.length) reject(new ValidationError(errors, validated, undefined, undefined, disableStackTrace));else resolve(validated);\n }));\n }\n validateSync(value, options) {\n var _options$disableStack3;\n let schema = this.resolve(Object.assign({}, options, {\n value\n }));\n let result;\n let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema.spec.disableStackTrace;\n schema._validate(value, Object.assign({}, options, {\n sync: true\n }), (error, parsed) => {\n if (ValidationError.isError(error)) error.value = parsed;\n throw error;\n }, (errors, validated) => {\n if (errors.length) throw new ValidationError(errors, value, undefined, undefined, disableStackTrace);\n result = validated;\n });\n return result;\n }\n isValid(value, options) {\n return this.validate(value, options).then(() => true, err => {\n if (ValidationError.isError(err)) return false;\n throw err;\n });\n }\n isValidSync(value, options) {\n try {\n this.validateSync(value, options);\n return true;\n } catch (err) {\n if (ValidationError.isError(err)) return false;\n throw err;\n }\n }\n _getDefault(options) {\n let defaultValue = this.spec.default;\n if (defaultValue == null) {\n return defaultValue;\n }\n return typeof defaultValue === 'function' ? defaultValue.call(this, options) : clone(defaultValue);\n }\n getDefault(options\n // If schema is defaulted we know it's at least not undefined\n ) {\n let schema = this.resolve(options || {});\n return schema._getDefault(options);\n }\n default(def) {\n if (arguments.length === 0) {\n return this._getDefault();\n }\n let next = this.clone({\n default: def\n });\n return next;\n }\n strict(isStrict = true) {\n return this.clone({\n strict: isStrict\n });\n }\n nullability(nullable, message) {\n const next = this.clone({\n nullable\n });\n next.internalTests.nullable = createValidation({\n message,\n name: 'nullable',\n test(value) {\n return value === null ? this.schema.spec.nullable : true;\n }\n });\n return next;\n }\n optionality(optional, message) {\n const next = this.clone({\n optional\n });\n next.internalTests.optionality = createValidation({\n message,\n name: 'optionality',\n test(value) {\n return value === undefined ? this.schema.spec.optional : true;\n }\n });\n return next;\n }\n optional() {\n return this.optionality(true);\n }\n defined(message = mixed.defined) {\n return this.optionality(false, message);\n }\n nullable() {\n return this.nullability(true);\n }\n nonNullable(message = mixed.notNull) {\n return this.nullability(false, message);\n }\n required(message = mixed.required) {\n return this.clone().withMutation(next => next.nonNullable(message).defined(message));\n }\n notRequired() {\n return this.clone().withMutation(next => next.nullable().optional());\n }\n transform(fn) {\n let next = this.clone();\n next.transforms.push(fn);\n return next;\n }\n\n /**\n * Adds a test function to the schema's queue of tests.\n * tests can be exclusive or non-exclusive.\n *\n * - exclusive tests, will replace any existing tests of the same name.\n * - non-exclusive: can be stacked\n *\n * If a non-exclusive test is added to a schema with an exclusive test of the same name\n * the exclusive test is removed and further tests of the same name will be stacked.\n *\n * If an exclusive test is added to a schema with non-exclusive tests of the same name\n * the previous tests are removed and further tests of the same name will replace each other.\n */\n\n test(...args) {\n let opts;\n if (args.length === 1) {\n if (typeof args[0] === 'function') {\n opts = {\n test: args[0]\n };\n } else {\n opts = args[0];\n }\n } else if (args.length === 2) {\n opts = {\n name: args[0],\n test: args[1]\n };\n } else {\n opts = {\n name: args[0],\n message: args[1],\n test: args[2]\n };\n }\n if (opts.message === undefined) opts.message = mixed.default;\n if (typeof opts.test !== 'function') throw new TypeError('`test` is a required parameters');\n let next = this.clone();\n let validate = createValidation(opts);\n let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;\n if (opts.exclusive) {\n if (!opts.name) throw new TypeError('Exclusive tests must provide a unique `name` identifying the test');\n }\n if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;\n next.tests = next.tests.filter(fn => {\n if (fn.OPTIONS.name === opts.name) {\n if (isExclusive) return false;\n if (fn.OPTIONS.test === validate.OPTIONS.test) return false;\n }\n return true;\n });\n next.tests.push(validate);\n return next;\n }\n when(keys, options) {\n if (!Array.isArray(keys) && typeof keys !== 'string') {\n options = keys;\n keys = '.';\n }\n let next = this.clone();\n let deps = toArray(keys).map(key => new Reference(key));\n deps.forEach(dep => {\n // @ts-ignore readonly array\n if (dep.isSibling) next.deps.push(dep.key);\n });\n next.conditions.push(typeof options === 'function' ? new Condition(deps, options) : Condition.fromOptions(deps, options));\n return next;\n }\n typeError(message) {\n let next = this.clone();\n next.internalTests.typeError = createValidation({\n message,\n name: 'typeError',\n skipAbsent: true,\n test(value) {\n if (!this.schema._typeCheck(value)) return this.createError({\n params: {\n type: this.schema.type\n }\n });\n return true;\n }\n });\n return next;\n }\n oneOf(enums, message = mixed.oneOf) {\n let next = this.clone();\n enums.forEach(val => {\n next._whitelist.add(val);\n next._blacklist.delete(val);\n });\n next.internalTests.whiteList = createValidation({\n message,\n name: 'oneOf',\n skipAbsent: true,\n test(value) {\n let valids = this.schema._whitelist;\n let resolved = valids.resolveAll(this.resolve);\n return resolved.includes(value) ? true : this.createError({\n params: {\n values: Array.from(valids).join(', '),\n resolved\n }\n });\n }\n });\n return next;\n }\n notOneOf(enums, message = mixed.notOneOf) {\n let next = this.clone();\n enums.forEach(val => {\n next._blacklist.add(val);\n next._whitelist.delete(val);\n });\n next.internalTests.blacklist = createValidation({\n message,\n name: 'notOneOf',\n test(value) {\n let invalids = this.schema._blacklist;\n let resolved = invalids.resolveAll(this.resolve);\n if (resolved.includes(value)) return this.createError({\n params: {\n values: Array.from(invalids).join(', '),\n resolved\n }\n });\n return true;\n }\n });\n return next;\n }\n strip(strip = true) {\n let next = this.clone();\n next.spec.strip = strip;\n return next;\n }\n\n /**\n * Return a serialized description of the schema including validations, flags, types etc.\n *\n * @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).\n */\n describe(options) {\n const next = (options ? this.resolve(options) : this).clone();\n const {\n label,\n meta,\n optional,\n nullable\n } = next.spec;\n const description = {\n meta,\n label,\n optional,\n nullable,\n default: next.getDefault(options),\n type: next.type,\n oneOf: next._whitelist.describe(),\n notOneOf: next._blacklist.describe(),\n tests: next.tests.map(fn => ({\n name: fn.OPTIONS.name,\n params: fn.OPTIONS.params\n })).filter((n, idx, list) => list.findIndex(c => c.name === n.name) === idx)\n };\n return description;\n }\n}\n// @ts-expect-error\nSchema.prototype.__isYupSchema__ = true;\nfor (const method of ['validate', 'validateSync']) Schema.prototype[`${method}At`] = function (path, value, options = {}) {\n const {\n parent,\n parentPath,\n schema\n } = getIn(this, path, value, options.context);\n return schema[method](parent && parent[parentPath], Object.assign({}, options, {\n parent,\n path\n }));\n};\nfor (const alias of ['equals', 'is']) Schema.prototype[alias] = Schema.prototype.oneOf;\nfor (const alias of ['not', 'nope']) Schema.prototype[alias] = Schema.prototype.notOneOf;\n\nconst returnsTrue = () => true;\nfunction create$8(spec) {\n return new MixedSchema(spec);\n}\nclass MixedSchema extends Schema {\n constructor(spec) {\n super(typeof spec === 'function' ? {\n type: 'mixed',\n check: spec\n } : Object.assign({\n type: 'mixed',\n check: returnsTrue\n }, spec));\n }\n}\ncreate$8.prototype = MixedSchema.prototype;\n\nfunction create$7() {\n return new BooleanSchema();\n}\nclass BooleanSchema extends Schema {\n constructor() {\n super({\n type: 'boolean',\n check(v) {\n if (v instanceof Boolean) v = v.valueOf();\n return typeof v === 'boolean';\n }\n });\n this.withMutation(() => {\n this.transform((value, _raw, ctx) => {\n if (ctx.spec.coerce && !ctx.isType(value)) {\n if (/^(true|1)$/i.test(String(value))) return true;\n if (/^(false|0)$/i.test(String(value))) return false;\n }\n return value;\n });\n });\n }\n isTrue(message = boolean.isValue) {\n return this.test({\n message,\n name: 'is-value',\n exclusive: true,\n params: {\n value: 'true'\n },\n test(value) {\n return isAbsent(value) || value === true;\n }\n });\n }\n isFalse(message = boolean.isValue) {\n return this.test({\n message,\n name: 'is-value',\n exclusive: true,\n params: {\n value: 'false'\n },\n test(value) {\n return isAbsent(value) || value === false;\n }\n });\n }\n default(def) {\n return super.default(def);\n }\n defined(msg) {\n return super.defined(msg);\n }\n optional() {\n return super.optional();\n }\n required(msg) {\n return super.required(msg);\n }\n notRequired() {\n return super.notRequired();\n }\n nullable() {\n return super.nullable();\n }\n nonNullable(msg) {\n return super.nonNullable(msg);\n }\n strip(v) {\n return super.strip(v);\n }\n}\ncreate$7.prototype = BooleanSchema.prototype;\n\n// Taken from HTML spec: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address\nlet rEmail =\n// eslint-disable-next-line\n/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\nlet rUrl =\n// eslint-disable-next-line\n/^((https?|ftp):)?\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i;\n\n// eslint-disable-next-line\nlet rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nlet isTrimmed = value => isAbsent(value) || value === value.trim();\nlet objStringTag = {}.toString();\nfunction create$6() {\n return new StringSchema();\n}\nclass StringSchema extends Schema {\n constructor() {\n super({\n type: 'string',\n check(value) {\n if (value instanceof String) value = value.valueOf();\n return typeof value === 'string';\n }\n });\n this.withMutation(() => {\n this.transform((value, _raw, ctx) => {\n if (!ctx.spec.coerce || ctx.isType(value)) return value;\n\n // don't ever convert arrays\n if (Array.isArray(value)) return value;\n const strValue = value != null && value.toString ? value.toString() : value;\n\n // no one wants plain objects converted to [Object object]\n if (strValue === objStringTag) return value;\n return strValue;\n });\n });\n }\n required(message) {\n return super.required(message).withMutation(schema => schema.test({\n message: message || mixed.required,\n name: 'required',\n skipAbsent: true,\n test: value => !!value.length\n }));\n }\n notRequired() {\n return super.notRequired().withMutation(schema => {\n schema.tests = schema.tests.filter(t => t.OPTIONS.name !== 'required');\n return schema;\n });\n }\n length(length, message = string.length) {\n return this.test({\n message,\n name: 'length',\n exclusive: true,\n params: {\n length\n },\n skipAbsent: true,\n test(value) {\n return value.length === this.resolve(length);\n }\n });\n }\n min(min, message = string.min) {\n return this.test({\n message,\n name: 'min',\n exclusive: true,\n params: {\n min\n },\n skipAbsent: true,\n test(value) {\n return value.length >= this.resolve(min);\n }\n });\n }\n max(max, message = string.max) {\n return this.test({\n name: 'max',\n exclusive: true,\n message,\n params: {\n max\n },\n skipAbsent: true,\n test(value) {\n return value.length <= this.resolve(max);\n }\n });\n }\n matches(regex, options) {\n let excludeEmptyString = false;\n let message;\n let name;\n if (options) {\n if (typeof options === 'object') {\n ({\n excludeEmptyString = false,\n message,\n name\n } = options);\n } else {\n message = options;\n }\n }\n return this.test({\n name: name || 'matches',\n message: message || string.matches,\n params: {\n regex\n },\n skipAbsent: true,\n test: value => value === '' && excludeEmptyString || value.search(regex) !== -1\n });\n }\n email(message = string.email) {\n return this.matches(rEmail, {\n name: 'email',\n message,\n excludeEmptyString: true\n });\n }\n url(message = string.url) {\n return this.matches(rUrl, {\n name: 'url',\n message,\n excludeEmptyString: true\n });\n }\n uuid(message = string.uuid) {\n return this.matches(rUUID, {\n name: 'uuid',\n message,\n excludeEmptyString: false\n });\n }\n\n //-- transforms --\n ensure() {\n return this.default('').transform(val => val === null ? '' : val);\n }\n trim(message = string.trim) {\n return this.transform(val => val != null ? val.trim() : val).test({\n message,\n name: 'trim',\n test: isTrimmed\n });\n }\n lowercase(message = string.lowercase) {\n return this.transform(value => !isAbsent(value) ? value.toLowerCase() : value).test({\n message,\n name: 'string_case',\n exclusive: true,\n skipAbsent: true,\n test: value => isAbsent(value) || value === value.toLowerCase()\n });\n }\n uppercase(message = string.uppercase) {\n return this.transform(value => !isAbsent(value) ? value.toUpperCase() : value).test({\n message,\n name: 'string_case',\n exclusive: true,\n skipAbsent: true,\n test: value => isAbsent(value) || value === value.toUpperCase()\n });\n }\n}\ncreate$6.prototype = StringSchema.prototype;\n\n//\n// String Interfaces\n//\n\nlet isNaN$1 = value => value != +value;\nfunction create$5() {\n return new NumberSchema();\n}\nclass NumberSchema extends Schema {\n constructor() {\n super({\n type: 'number',\n check(value) {\n if (value instanceof Number) value = value.valueOf();\n return typeof value === 'number' && !isNaN$1(value);\n }\n });\n this.withMutation(() => {\n this.transform((value, _raw, ctx) => {\n if (!ctx.spec.coerce) return value;\n let parsed = value;\n if (typeof parsed === 'string') {\n parsed = parsed.replace(/\\s/g, '');\n if (parsed === '') return NaN;\n // don't use parseFloat to avoid positives on alpha-numeric strings\n parsed = +parsed;\n }\n\n // null -> NaN isn't useful; treat all nulls as null and let it fail on\n // nullability check vs TypeErrors\n if (ctx.isType(parsed) || parsed === null) return parsed;\n return parseFloat(parsed);\n });\n });\n }\n min(min, message = number.min) {\n return this.test({\n message,\n name: 'min',\n exclusive: true,\n params: {\n min\n },\n skipAbsent: true,\n test(value) {\n return value >= this.resolve(min);\n }\n });\n }\n max(max, message = number.max) {\n return this.test({\n message,\n name: 'max',\n exclusive: true,\n params: {\n max\n },\n skipAbsent: true,\n test(value) {\n return value <= this.resolve(max);\n }\n });\n }\n lessThan(less, message = number.lessThan) {\n return this.test({\n message,\n name: 'max',\n exclusive: true,\n params: {\n less\n },\n skipAbsent: true,\n test(value) {\n return value < this.resolve(less);\n }\n });\n }\n moreThan(more, message = number.moreThan) {\n return this.test({\n message,\n name: 'min',\n exclusive: true,\n params: {\n more\n },\n skipAbsent: true,\n test(value) {\n return value > this.resolve(more);\n }\n });\n }\n positive(msg = number.positive) {\n return this.moreThan(0, msg);\n }\n negative(msg = number.negative) {\n return this.lessThan(0, msg);\n }\n integer(message = number.integer) {\n return this.test({\n name: 'integer',\n message,\n skipAbsent: true,\n test: val => Number.isInteger(val)\n });\n }\n truncate() {\n return this.transform(value => !isAbsent(value) ? value | 0 : value);\n }\n round(method) {\n var _method;\n let avail = ['ceil', 'floor', 'round', 'trunc'];\n method = ((_method = method) == null ? void 0 : _method.toLowerCase()) || 'round';\n\n // this exists for symemtry with the new Math.trunc\n if (method === 'trunc') return this.truncate();\n if (avail.indexOf(method.toLowerCase()) === -1) throw new TypeError('Only valid options for round() are: ' + avail.join(', '));\n return this.transform(value => !isAbsent(value) ? Math[method](value) : value);\n }\n}\ncreate$5.prototype = NumberSchema.prototype;\n\n//\n// Number Interfaces\n//\n\n/**\n * This file is a modified version of the file from the following repository:\n * Date.parse with progressive enhancement for ISO 8601 \n * NON-CONFORMANT EDITION.\n * © 2011 Colin Snover \n * Released under MIT license.\n */\n\n// prettier-ignore\n// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm\nconst isoReg = /^(\\d{4}|[+-]\\d{6})(?:-?(\\d{2})(?:-?(\\d{2}))?)?(?:[ T]?(\\d{2}):?(\\d{2})(?::?(\\d{2})(?:[,.](\\d{1,}))?)?(?:(Z)|([+-])(\\d{2})(?::?(\\d{2}))?)?)?$/;\nfunction toNumber(str, defaultValue = 0) {\n return Number(str) || defaultValue;\n}\nfunction parseIsoDate(date) {\n const regexResult = isoReg.exec(date);\n if (!regexResult) return Date.parse ? Date.parse(date) : Number.NaN;\n\n // use of toNumber() avoids NaN timestamps caused by “undefined”\n // values being passed to Date constructor\n const struct = {\n year: toNumber(regexResult[1]),\n month: toNumber(regexResult[2], 1) - 1,\n day: toNumber(regexResult[3], 1),\n hour: toNumber(regexResult[4]),\n minute: toNumber(regexResult[5]),\n second: toNumber(regexResult[6]),\n millisecond: regexResult[7] ?\n // allow arbitrary sub-second precision beyond milliseconds\n toNumber(regexResult[7].substring(0, 3)) : 0,\n z: regexResult[8] || undefined,\n plusMinus: regexResult[9] || undefined,\n hourOffset: toNumber(regexResult[10]),\n minuteOffset: toNumber(regexResult[11])\n };\n\n // timestamps without timezone identifiers should be considered local time\n if (struct.z === undefined && struct.plusMinus === undefined) {\n return new Date(struct.year, struct.month, struct.day, struct.hour, struct.minute, struct.second, struct.millisecond).valueOf();\n }\n let totalMinutesOffset = 0;\n if (struct.z !== 'Z' && struct.plusMinus !== undefined) {\n totalMinutesOffset = struct.hourOffset * 60 + struct.minuteOffset;\n if (struct.plusMinus === '+') totalMinutesOffset = 0 - totalMinutesOffset;\n }\n return Date.UTC(struct.year, struct.month, struct.day, struct.hour, struct.minute + totalMinutesOffset, struct.second, struct.millisecond);\n}\n\nlet invalidDate = new Date('');\nlet isDate = obj => Object.prototype.toString.call(obj) === '[object Date]';\nfunction create$4() {\n return new DateSchema();\n}\nclass DateSchema extends Schema {\n constructor() {\n super({\n type: 'date',\n check(v) {\n return isDate(v) && !isNaN(v.getTime());\n }\n });\n this.withMutation(() => {\n this.transform((value, _raw, ctx) => {\n // null -> InvalidDate isn't useful; treat all nulls as null and let it fail on\n // nullability check vs TypeErrors\n if (!ctx.spec.coerce || ctx.isType(value) || value === null) return value;\n value = parseIsoDate(value);\n\n // 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.\n return !isNaN(value) ? new Date(value) : DateSchema.INVALID_DATE;\n });\n });\n }\n prepareParam(ref, name) {\n let param;\n if (!Reference.isRef(ref)) {\n let cast = this.cast(ref);\n if (!this._typeCheck(cast)) throw new TypeError(`\\`${name}\\` must be a Date or a value that can be \\`cast()\\` to a Date`);\n param = cast;\n } else {\n param = ref;\n }\n return param;\n }\n min(min, message = date.min) {\n let limit = this.prepareParam(min, 'min');\n return this.test({\n message,\n name: 'min',\n exclusive: true,\n params: {\n min\n },\n skipAbsent: true,\n test(value) {\n return value >= this.resolve(limit);\n }\n });\n }\n max(max, message = date.max) {\n let limit = this.prepareParam(max, 'max');\n return this.test({\n message,\n name: 'max',\n exclusive: true,\n params: {\n max\n },\n skipAbsent: true,\n test(value) {\n return value <= this.resolve(limit);\n }\n });\n }\n}\nDateSchema.INVALID_DATE = invalidDate;\ncreate$4.prototype = DateSchema.prototype;\ncreate$4.INVALID_DATE = invalidDate;\n\n// @ts-expect-error\nfunction sortFields(fields, excludedEdges = []) {\n let edges = [];\n let nodes = new Set();\n let excludes = new Set(excludedEdges.map(([a, b]) => `${a}-${b}`));\n function addNode(depPath, key) {\n let node = split(depPath)[0];\n nodes.add(node);\n if (!excludes.has(`${key}-${node}`)) edges.push([key, node]);\n }\n for (const key of Object.keys(fields)) {\n let value = fields[key];\n nodes.add(key);\n if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);else if (isSchema(value) && 'deps' in value) value.deps.forEach(path => addNode(path, key));\n }\n return toposort.array(Array.from(nodes), edges).reverse();\n}\n\nfunction findIndex(arr, err) {\n let idx = Infinity;\n arr.some((key, ii) => {\n var _err$path;\n if ((_err$path = err.path) != null && _err$path.includes(key)) {\n idx = ii;\n return true;\n }\n });\n return idx;\n}\nfunction sortByKeyOrder(keys) {\n return (a, b) => {\n return findIndex(keys, a) - findIndex(keys, b);\n };\n}\n\nconst parseJson = (value, _, ctx) => {\n if (typeof value !== 'string') {\n return value;\n }\n let parsed = value;\n try {\n parsed = JSON.parse(value);\n } catch (err) {\n /* */\n }\n return ctx.isType(parsed) ? parsed : value;\n};\n\n// @ts-ignore\nfunction deepPartial(schema) {\n if ('fields' in schema) {\n const partial = {};\n for (const [key, fieldSchema] of Object.entries(schema.fields)) {\n partial[key] = deepPartial(fieldSchema);\n }\n return schema.setFields(partial);\n }\n if (schema.type === 'array') {\n const nextArray = schema.optional();\n if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);\n return nextArray;\n }\n if (schema.type === 'tuple') {\n return schema.optional().clone({\n types: schema.spec.types.map(deepPartial)\n });\n }\n if ('optional' in schema) {\n return schema.optional();\n }\n return schema;\n}\nconst deepHas = (obj, p) => {\n const path = [...normalizePath(p)];\n if (path.length === 1) return path[0] in obj;\n let last = path.pop();\n let parent = getter(join(path), true)(obj);\n return !!(parent && last in parent);\n};\nlet isObject = obj => Object.prototype.toString.call(obj) === '[object Object]';\nfunction unknown(ctx, value) {\n let known = Object.keys(ctx.fields);\n return Object.keys(value).filter(key => known.indexOf(key) === -1);\n}\nconst defaultSort = sortByKeyOrder([]);\nfunction create$3(spec) {\n return new ObjectSchema(spec);\n}\nclass ObjectSchema extends Schema {\n constructor(spec) {\n super({\n type: 'object',\n check(value) {\n return isObject(value) || typeof value === 'function';\n }\n });\n this.fields = Object.create(null);\n this._sortErrors = defaultSort;\n this._nodes = [];\n this._excludedEdges = [];\n this.withMutation(() => {\n if (spec) {\n this.shape(spec);\n }\n });\n }\n _cast(_value, options = {}) {\n var _options$stripUnknown;\n let value = super._cast(_value, options);\n\n //should ignore nulls here\n if (value === undefined) return this.getDefault(options);\n if (!this._typeCheck(value)) return value;\n let fields = this.fields;\n let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;\n let props = [].concat(this._nodes, Object.keys(value).filter(v => !this._nodes.includes(v)));\n let intermediateValue = {}; // is filled during the transform below\n let innerOptions = Object.assign({}, options, {\n parent: intermediateValue,\n __validating: options.__validating || false\n });\n let isChanged = false;\n for (const prop of props) {\n let field = fields[prop];\n let exists = (prop in value);\n if (field) {\n let fieldValue;\n let inputValue = value[prop];\n\n // safe to mutate since this is fired in sequence\n innerOptions.path = (options.path ? `${options.path}.` : '') + prop;\n field = field.resolve({\n value: inputValue,\n context: options.context,\n parent: intermediateValue\n });\n let fieldSpec = field instanceof Schema ? field.spec : undefined;\n let strict = fieldSpec == null ? void 0 : fieldSpec.strict;\n if (fieldSpec != null && fieldSpec.strip) {\n isChanged = isChanged || prop in value;\n continue;\n }\n fieldValue = !options.__validating || !strict ?\n // TODO: use _cast, this is double resolving\n field.cast(value[prop], innerOptions) : value[prop];\n if (fieldValue !== undefined) {\n intermediateValue[prop] = fieldValue;\n }\n } else if (exists && !strip) {\n intermediateValue[prop] = value[prop];\n }\n if (exists !== prop in intermediateValue || intermediateValue[prop] !== value[prop]) {\n isChanged = true;\n }\n }\n return isChanged ? intermediateValue : value;\n }\n _validate(_value, options = {}, panic, next) {\n let {\n from = [],\n originalValue = _value,\n recursive = this.spec.recursive\n } = options;\n options.from = [{\n schema: this,\n value: originalValue\n }, ...from];\n // this flag is needed for handling `strict` correctly in the context of\n // validation vs just casting. e.g strict() on a field is only used when validating\n options.__validating = true;\n options.originalValue = originalValue;\n super._validate(_value, options, panic, (objectErrors, value) => {\n if (!recursive || !isObject(value)) {\n next(objectErrors, value);\n return;\n }\n originalValue = originalValue || value;\n let tests = [];\n for (let key of this._nodes) {\n let field = this.fields[key];\n if (!field || Reference.isRef(field)) {\n continue;\n }\n tests.push(field.asNestedTest({\n options,\n key,\n parent: value,\n parentPath: options.path,\n originalParent: originalValue\n }));\n }\n this.runTests({\n tests,\n value,\n originalValue,\n options\n }, panic, fieldErrors => {\n next(fieldErrors.sort(this._sortErrors).concat(objectErrors), value);\n });\n });\n }\n clone(spec) {\n const next = super.clone(spec);\n next.fields = Object.assign({}, this.fields);\n next._nodes = this._nodes;\n next._excludedEdges = this._excludedEdges;\n next._sortErrors = this._sortErrors;\n return next;\n }\n concat(schema) {\n let next = super.concat(schema);\n let nextFields = next.fields;\n for (let [field, schemaOrRef] of Object.entries(this.fields)) {\n const target = nextFields[field];\n nextFields[field] = target === undefined ? schemaOrRef : target;\n }\n return next.withMutation(s =>\n // XXX: excludes here is wrong\n s.setFields(nextFields, [...this._excludedEdges, ...schema._excludedEdges]));\n }\n _getDefault(options) {\n if ('default' in this.spec) {\n return super._getDefault(options);\n }\n\n // if there is no default set invent one\n if (!this._nodes.length) {\n return undefined;\n }\n let dft = {};\n this._nodes.forEach(key => {\n var _innerOptions;\n const field = this.fields[key];\n let innerOptions = options;\n if ((_innerOptions = innerOptions) != null && _innerOptions.value) {\n innerOptions = Object.assign({}, innerOptions, {\n parent: innerOptions.value,\n value: innerOptions.value[key]\n });\n }\n dft[key] = field && 'getDefault' in field ? field.getDefault(innerOptions) : undefined;\n });\n return dft;\n }\n setFields(shape, excludedEdges) {\n let next = this.clone();\n next.fields = shape;\n next._nodes = sortFields(shape, excludedEdges);\n next._sortErrors = sortByKeyOrder(Object.keys(shape));\n // XXX: this carries over edges which may not be what you want\n if (excludedEdges) next._excludedEdges = excludedEdges;\n return next;\n }\n shape(additions, excludes = []) {\n return this.clone().withMutation(next => {\n let edges = next._excludedEdges;\n if (excludes.length) {\n if (!Array.isArray(excludes[0])) excludes = [excludes];\n edges = [...next._excludedEdges, ...excludes];\n }\n\n // XXX: excludes here is wrong\n return next.setFields(Object.assign(next.fields, additions), edges);\n });\n }\n partial() {\n const partial = {};\n for (const [key, schema] of Object.entries(this.fields)) {\n partial[key] = 'optional' in schema && schema.optional instanceof Function ? schema.optional() : schema;\n }\n return this.setFields(partial);\n }\n deepPartial() {\n const next = deepPartial(this);\n return next;\n }\n pick(keys) {\n const picked = {};\n for (const key of keys) {\n if (this.fields[key]) picked[key] = this.fields[key];\n }\n return this.setFields(picked, this._excludedEdges.filter(([a, b]) => keys.includes(a) && keys.includes(b)));\n }\n omit(keys) {\n const remaining = [];\n for (const key of Object.keys(this.fields)) {\n if (keys.includes(key)) continue;\n remaining.push(key);\n }\n return this.pick(remaining);\n }\n from(from, to, alias) {\n let fromGetter = getter(from, true);\n return this.transform(obj => {\n if (!obj) return obj;\n let newObj = obj;\n if (deepHas(obj, from)) {\n newObj = Object.assign({}, obj);\n if (!alias) delete newObj[from];\n newObj[to] = fromGetter(obj);\n }\n return newObj;\n });\n }\n\n /** Parse an input JSON string to an object */\n json() {\n return this.transform(parseJson);\n }\n noUnknown(noAllow = true, message = object.noUnknown) {\n if (typeof noAllow !== 'boolean') {\n message = noAllow;\n noAllow = true;\n }\n let next = this.test({\n name: 'noUnknown',\n exclusive: true,\n message: message,\n test(value) {\n if (value == null) return true;\n const unknownKeys = unknown(this.schema, value);\n return !noAllow || unknownKeys.length === 0 || this.createError({\n params: {\n unknown: unknownKeys.join(', ')\n }\n });\n }\n });\n next.spec.noUnknown = noAllow;\n return next;\n }\n unknown(allow = true, message = object.noUnknown) {\n return this.noUnknown(!allow, message);\n }\n transformKeys(fn) {\n return this.transform(obj => {\n if (!obj) return obj;\n const result = {};\n for (const key of Object.keys(obj)) result[fn(key)] = obj[key];\n return result;\n });\n }\n camelCase() {\n return this.transformKeys(camelCase);\n }\n snakeCase() {\n return this.transformKeys(snakeCase);\n }\n constantCase() {\n return this.transformKeys(key => snakeCase(key).toUpperCase());\n }\n describe(options) {\n const next = (options ? this.resolve(options) : this).clone();\n const base = super.describe(options);\n base.fields = {};\n for (const [key, value] of Object.entries(next.fields)) {\n var _innerOptions2;\n let innerOptions = options;\n if ((_innerOptions2 = innerOptions) != null && _innerOptions2.value) {\n innerOptions = Object.assign({}, innerOptions, {\n parent: innerOptions.value,\n value: innerOptions.value[key]\n });\n }\n base.fields[key] = value.describe(innerOptions);\n }\n return base;\n }\n}\ncreate$3.prototype = ObjectSchema.prototype;\n\nfunction create$2(type) {\n return new ArraySchema(type);\n}\nclass ArraySchema extends Schema {\n constructor(type) {\n super({\n type: 'array',\n spec: {\n types: type\n },\n check(v) {\n return Array.isArray(v);\n }\n });\n\n // `undefined` specifically means uninitialized, as opposed to \"no subtype\"\n this.innerType = void 0;\n this.innerType = type;\n }\n _cast(_value, _opts) {\n const value = super._cast(_value, _opts);\n\n // should ignore nulls here\n if (!this._typeCheck(value) || !this.innerType) {\n return value;\n }\n let isChanged = false;\n const castArray = value.map((v, idx) => {\n const castElement = this.innerType.cast(v, Object.assign({}, _opts, {\n path: `${_opts.path || ''}[${idx}]`\n }));\n if (castElement !== v) {\n isChanged = true;\n }\n return castElement;\n });\n return isChanged ? castArray : value;\n }\n _validate(_value, options = {}, panic, next) {\n var _options$recursive;\n // let sync = options.sync;\n // let path = options.path;\n let innerType = this.innerType;\n // let endEarly = options.abortEarly ?? this.spec.abortEarly;\n let recursive = (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive;\n options.originalValue != null ? options.originalValue : _value;\n super._validate(_value, options, panic, (arrayErrors, value) => {\n var _options$originalValu2;\n if (!recursive || !innerType || !this._typeCheck(value)) {\n next(arrayErrors, value);\n return;\n }\n\n // #950 Ensure that sparse array empty slots are validated\n let tests = new Array(value.length);\n for (let index = 0; index < value.length; index++) {\n var _options$originalValu;\n tests[index] = innerType.asNestedTest({\n options,\n index,\n parent: value,\n parentPath: options.path,\n originalParent: (_options$originalValu = options.originalValue) != null ? _options$originalValu : _value\n });\n }\n this.runTests({\n value,\n tests,\n originalValue: (_options$originalValu2 = options.originalValue) != null ? _options$originalValu2 : _value,\n options\n }, panic, innerTypeErrors => next(innerTypeErrors.concat(arrayErrors), value));\n });\n }\n clone(spec) {\n const next = super.clone(spec);\n // @ts-expect-error readonly\n next.innerType = this.innerType;\n return next;\n }\n\n /** Parse an input JSON string to an object */\n json() {\n return this.transform(parseJson);\n }\n concat(schema) {\n let next = super.concat(schema);\n\n // @ts-expect-error readonly\n next.innerType = this.innerType;\n if (schema.innerType)\n // @ts-expect-error readonly\n next.innerType = next.innerType ?\n // @ts-expect-error Lazy doesn't have concat and will break\n next.innerType.concat(schema.innerType) : schema.innerType;\n return next;\n }\n of(schema) {\n // FIXME: this should return a new instance of array without the default to be\n let next = this.clone();\n if (!isSchema(schema)) throw new TypeError('`array.of()` sub-schema must be a valid yup schema not: ' + printValue(schema));\n\n // @ts-expect-error readonly\n next.innerType = schema;\n next.spec = Object.assign({}, next.spec, {\n types: schema\n });\n return next;\n }\n length(length, message = array.length) {\n return this.test({\n message,\n name: 'length',\n exclusive: true,\n params: {\n length\n },\n skipAbsent: true,\n test(value) {\n return value.length === this.resolve(length);\n }\n });\n }\n min(min, message) {\n message = message || array.min;\n return this.test({\n message,\n name: 'min',\n exclusive: true,\n params: {\n min\n },\n skipAbsent: true,\n // FIXME(ts): Array\n test(value) {\n return value.length >= this.resolve(min);\n }\n });\n }\n max(max, message) {\n message = message || array.max;\n return this.test({\n message,\n name: 'max',\n exclusive: true,\n params: {\n max\n },\n skipAbsent: true,\n test(value) {\n return value.length <= this.resolve(max);\n }\n });\n }\n ensure() {\n return this.default(() => []).transform((val, original) => {\n // We don't want to return `null` for nullable schema\n if (this._typeCheck(val)) return val;\n return original == null ? [] : [].concat(original);\n });\n }\n compact(rejector) {\n let reject = !rejector ? v => !!v : (v, i, a) => !rejector(v, i, a);\n return this.transform(values => values != null ? values.filter(reject) : values);\n }\n describe(options) {\n const next = (options ? this.resolve(options) : this).clone();\n const base = super.describe(options);\n if (next.innerType) {\n var _innerOptions;\n let innerOptions = options;\n if ((_innerOptions = innerOptions) != null && _innerOptions.value) {\n innerOptions = Object.assign({}, innerOptions, {\n parent: innerOptions.value,\n value: innerOptions.value[0]\n });\n }\n base.innerType = next.innerType.describe(innerOptions);\n }\n return base;\n }\n}\ncreate$2.prototype = ArraySchema.prototype;\n\n// @ts-ignore\nfunction create$1(schemas) {\n return new TupleSchema(schemas);\n}\nclass TupleSchema extends Schema {\n constructor(schemas) {\n super({\n type: 'tuple',\n spec: {\n types: schemas\n },\n check(v) {\n const types = this.spec.types;\n return Array.isArray(v) && v.length === types.length;\n }\n });\n this.withMutation(() => {\n this.typeError(tuple.notType);\n });\n }\n _cast(inputValue, options) {\n const {\n types\n } = this.spec;\n const value = super._cast(inputValue, options);\n if (!this._typeCheck(value)) {\n return value;\n }\n let isChanged = false;\n const castArray = types.map((type, idx) => {\n const castElement = type.cast(value[idx], Object.assign({}, options, {\n path: `${options.path || ''}[${idx}]`\n }));\n if (castElement !== value[idx]) isChanged = true;\n return castElement;\n });\n return isChanged ? castArray : value;\n }\n _validate(_value, options = {}, panic, next) {\n let itemTypes = this.spec.types;\n super._validate(_value, options, panic, (tupleErrors, value) => {\n var _options$originalValu2;\n // intentionally not respecting recursive\n if (!this._typeCheck(value)) {\n next(tupleErrors, value);\n return;\n }\n let tests = [];\n for (let [index, itemSchema] of itemTypes.entries()) {\n var _options$originalValu;\n tests[index] = itemSchema.asNestedTest({\n options,\n index,\n parent: value,\n parentPath: options.path,\n originalParent: (_options$originalValu = options.originalValue) != null ? _options$originalValu : _value\n });\n }\n this.runTests({\n value,\n tests,\n originalValue: (_options$originalValu2 = options.originalValue) != null ? _options$originalValu2 : _value,\n options\n }, panic, innerTypeErrors => next(innerTypeErrors.concat(tupleErrors), value));\n });\n }\n describe(options) {\n const next = (options ? this.resolve(options) : this).clone();\n const base = super.describe(options);\n base.innerType = next.spec.types.map((schema, index) => {\n var _innerOptions;\n let innerOptions = options;\n if ((_innerOptions = innerOptions) != null && _innerOptions.value) {\n innerOptions = Object.assign({}, innerOptions, {\n parent: innerOptions.value,\n value: innerOptions.value[index]\n });\n }\n return schema.describe(innerOptions);\n });\n return base;\n }\n}\ncreate$1.prototype = TupleSchema.prototype;\n\nfunction create(builder) {\n return new Lazy(builder);\n}\nclass Lazy {\n constructor(builder) {\n this.type = 'lazy';\n this.__isYupSchema__ = true;\n this.spec = void 0;\n this._resolve = (value, options = {}) => {\n let schema = this.builder(value, options);\n if (!isSchema(schema)) throw new TypeError('lazy() functions must return a valid schema');\n if (this.spec.optional) schema = schema.optional();\n return schema.resolve(options);\n };\n this.builder = builder;\n this.spec = {\n meta: undefined,\n optional: false\n };\n }\n clone(spec) {\n const next = new Lazy(this.builder);\n next.spec = Object.assign({}, this.spec, spec);\n return next;\n }\n optionality(optional) {\n const next = this.clone({\n optional\n });\n return next;\n }\n optional() {\n return this.optionality(true);\n }\n resolve(options) {\n return this._resolve(options.value, options);\n }\n cast(value, options) {\n return this._resolve(value, options).cast(value, options);\n }\n asNestedTest(config) {\n let {\n key,\n index,\n parent,\n options\n } = config;\n let value = parent[index != null ? index : key];\n return this._resolve(value, Object.assign({}, options, {\n value,\n parent\n })).asNestedTest(config);\n }\n validate(value, options) {\n return this._resolve(value, options).validate(value, options);\n }\n validateSync(value, options) {\n return this._resolve(value, options).validateSync(value, options);\n }\n validateAt(path, value, options) {\n return this._resolve(value, options).validateAt(path, value, options);\n }\n validateSyncAt(path, value, options) {\n return this._resolve(value, options).validateSyncAt(path, value, options);\n }\n isValid(value, options) {\n return this._resolve(value, options).isValid(value, options);\n }\n isValidSync(value, options) {\n return this._resolve(value, options).isValidSync(value, options);\n }\n describe(options) {\n return options ? this.resolve(options).describe(options) : {\n type: 'lazy',\n meta: this.spec.meta,\n label: undefined\n };\n }\n meta(...args) {\n if (args.length === 0) return this.spec.meta;\n let next = this.clone();\n next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);\n return next;\n }\n}\n\nfunction setLocale(custom) {\n Object.keys(custom).forEach(type => {\n // @ts-ignore\n Object.keys(custom[type]).forEach(method => {\n // @ts-ignore\n locale[type][method] = custom[type][method];\n });\n });\n}\n\nfunction addMethod(schemaType, name, fn) {\n if (!schemaType || !isSchema(schemaType.prototype)) throw new TypeError('You must provide a yup schema constructor function');\n if (typeof name !== 'string') throw new TypeError('A Method name must be provided');\n if (typeof fn !== 'function') throw new TypeError('Method function must be provided');\n schemaType.prototype[name] = fn;\n}\n\nexport { ArraySchema, BooleanSchema, DateSchema, MixedSchema, NumberSchema, ObjectSchema, Schema, StringSchema, TupleSchema, ValidationError, addMethod, create$2 as array, create$7 as bool, create$7 as boolean, create$4 as date, locale as defaultLocale, getIn, isSchema, create as lazy, create$8 as mixed, create$5 as number, create$3 as object, printValue, reach, create$9 as ref, setLocale, create$6 as string, create$1 as tuple };\n","import { yupResolver } from \"@hookform/resolvers/yup\";\nimport { IconArrowLeft } from \"@tabler/icons-react\";\nimport AppContext from \"Context/appContext\";\nimport { DISPLAYING_PAGES, PAGES, PROGRESS_STATE } from \"constants\";\nimport Bookinglist from \"containers/BookingList\";\nimport Cart from \"containers/Cart\";\nimport Completion from \"containers/Completion\";\nimport ContactDeatils from \"containers/ContactDetails\";\nimport ProductList from \"containers/ProductList\";\nimport { useEffect, useMemo, useState, useRef } from \"react\";\nimport { ProgressBar } from \"react-bootstrap\";\nimport { isValidPhoneNumber } from \"react-phone-number-input\";\nimport { ClipLoader } from \"react-spinners\";\nimport Button from \"components/Button\";\nimport { combineDateWithTime, isKeyValueEmpty } from \"utils\";\nimport { useFormState } from \"react-hook-form\";\nimport { useForm } from \"react-hook-form\";\nimport UrlServices from \"./services/Url\";\nimport * as yup from \"yup\";\n\n// field validations schema\nconst schema = yup\n .object({\n name: yup.string().required(\"Name is Required\"),\n model: yup.string().required(\"Model is Required\"),\n email: yup.string().email(\"Invalid Email\").required(\"Email is Required\"),\n phone: yup\n .string()\n .required(\"Phone Number is Required\")\n .test(\"phone\", \"Invalid Phone Number\", (value) => {\n if (value) {\n return isValidPhoneNumber(value);\n }\n return true;\n }),\n })\n .required();\n\n\nconst AppManager = () => {\n const {\n register,\n handleSubmit,\n watch,\n control,\n reset,\n formState: { errors: formErrors },\n setValue,\n } = useForm({\n resolver: yupResolver(schema),\n });\n\n // States\n const [productCartDetail, setProductCartDetail] = useState(null);\n const [currentState, setCurrentState] = useState(\"PRODUCT\");\n const [allProducts, setAllProducts] = useState([]);\n const [progressState, setProgressState] = useState(0);\n const [products, setProducts] = useState([]);\n const [formdata, setFormData] = useState({\n name: \"\",\n phone: \"\",\n email: \"\",\n notes: \"\",\n option: \"\",\n model: \"\",\n });\n const [notificationWay, setNotificationWay] = useState(\"\");\n const [appointmentDetail, setAppointmentDetail] = useState({\n date: \"\",\n start: \"\",\n end: \"\",\n });\n const [loading, setLoading] = useState(true);\n const [fetchTimeLoading, setFetchTimeLoading] = useState(true);\n const [prevState, setPrevState] = useState([]);\n const [currentModelsServices, setCurrentModelsServices] = useState([]);\n const [isMissedItem, setIsMissedItem] = useState(null);\n const [selectedStoreDetails, setSelectedStoreDetails] = useState(null);\n const [allServices, setAllServices] = useState([]);\n const [userSettings, setUserSettings] = useState({});\n const [productCartData, setProductCartData] = useState(null);\n const [allServicesForSubId, setAllServicesForSubId] = useState([]);\n const [encryptionKey, setEncryptionKey] = useState(null);\n const [countryDetails, setCountryDetails] = useState(null);\n const [errors, setErrors] = useState({\n name: \"\",\n phone: \"\",\n email: \"\",\n });\n const [reactHookFormData, setReactHookFormData] = useState({\n control: control,\n register: register,\n handleSubmit: handleSubmit,\n watch: watch,\n formErrors: formErrors,\n reset: reset,\n setValue: setValue,\n });\n const [buttonClicked, setButtonClicked] = useState(null);\n const [height, setHeight] = useState(window.innerHeight);\n const [widthProductSection, setWidthProductSection] = useState(0);\n const [defaultStore, setDefaultStore] = useState(null);\n const [toggle, setToggle] = useState(false);\n const [selectedBookingPage, setSelectedBookingPage] = useState({});\n const [buttonLoader, setButtonLoader] = useState(false);\n const [isDisabled, setIsDisabled] = useState(false);\n const [isMobView, setIsMobView] = useState(false);\n const [isWebView, setIsWebView] = useState(false);\n const [othersWorkflow, setOthersWorkflow] = useState(false);\n const [isButtonClicked, setIsButtonClicked] = useState(false);\n\n const productSectionRef = useRef(null);\n\n const { notes, ...formDataObj } = formdata;\n const { model, ...modifiedData } = formdata;\n const { errors: formErrorss } = useFormState({\n control: reactHookFormData.control,\n });\n const { model: modelError, ...restErors } = formErrorss;\n\n // Function to check either form fields are valid or not\n const isFormValid = (obj) => {\n const isModelRequired = productCartDetail?.skipForOthers;\n return (\n obj.name !== \"\" &&\n obj.phone !== \"\" &&\n obj.email !== \"\" &&\n obj.option !== \"\" &&\n (!isModelRequired || obj.model !== \"\")\n );\n };\n\n // Function to detect if the user is on mobile view\n const detectMobView = () => {\n const screenWidth = window.innerWidth;\n setIsMobView(screenWidth <= 768); // Adjust breakpoint as needed\n };\n\n // Function to detect if the user is on web view\n const detectWebView = () => {\n const screenWidth = window.innerWidth;\n setIsWebView(screenWidth >= 768); // Adjust breakpoint as needed\n };\n\n const setServiceArray = () => {\n setPrevState({ ...prevState, [progressState]: products });\n };\n\n const updateDimensions = () => {\n setHeight(window.innerHeight);\n };\n\n const now = useMemo(\n () => ((progressState + 1) / PAGES.length) * 100,\n [progressState]\n );\n\n // Function to reset the fields of contact detail page\n const resetContactDetailFields = () => {\n sessionStorage.removeItem(\"menuOption\");\n setFormData({\n name: \"\",\n phone: \"\",\n email: \"\",\n notes: \"\",\n option: \"\",\n model: \"\",\n });\n reactHookFormData.reset();\n setNotificationWay(\"\");\n }\n\n // Function which saves the state while going Back\n const saveState = async () => {\n if (productCartDetail?.skipForOthers && progressState === 3 && !othersWorkflow) {\n // direct click of 'Others' Card\n // contact details page fields are reset while full back to the category page\n resetContactDetailFields();\n setProgressState(0);\n setCurrentState(DISPLAYING_PAGES.PRODUCT);\n setProducts(allProducts);\n setProductCartDetail(null);\n return;\n } else if (productCartDetail?.skipForOthers && progressState === 3 && othersWorkflow) {\n // if 'No Services Available Found against a MODEL' go with 'Others' workflow scenario\n // check this scenario in the 'Card.js' Component for understanding\n\n // contact details page fields are reset while full back to the category page\n setOthersWorkflow(false);\n resetContactDetailFields();\n setProgressState(2);\n setCurrentState(DISPLAYING_PAGES.PRODUCT);\n setProducts(prevState[2]);\n setProductCartDetail(prevState => {\n // Destructure model, services, and skipForOthers, and keep the rest of the keys (category, brand, etc.)\n const { model, services, skipForOthers, ...updatedState } = prevState;\n return updatedState; // Return the updated state without model, services, and skipForOthers\n });\n return;\n }\n if (progressState === 0) return;\n else if (progressState === 4) {\n setCurrentState(DISPLAYING_PAGES.PRODUCT);\n } else if (progressState === 5) {\n setButtonClicked(null);\n setSelectedStoreDetails(null);\n setCurrentState(DISPLAYING_PAGES.FORM);\n setProgressState(progressState - 1);\n setDefaultStore(null);\n return;\n } else if (progressState === 6) {\n setSelectedBookingPage({});\n setToggle(false);\n setDefaultStore(null);\n setProgressState(progressState - 1);\n setAppointmentDetail({\n date: \"\",\n start: \"\",\n end: \"\",\n });\n return;\n } else if (progressState === 7) {\n setCurrentState(DISPLAYING_PAGES.BOOKING);\n setProgressState(progressState - 1);\n return;\n } else if (progressState === 3) {\n // contact details page fields are reset while back to the models page\n resetContactDetailFields();\n setProductCartData(null);\n setProductCartDetail(prevState => {\n // Destructure services and totalPrice, and keep the rest (category, brand)\n const { services, totalPrice, ...updatedState } = prevState;\n return updatedState; // Return the updated state without services and totalPrice\n });\n isMissedItem\n ? setCurrentModelsServices(products)\n : setCurrentModelsServices(prevState[progressState - 2][0].services);\n } else if (progressState === 2) {\n setProductCartDetail(prevState => {\n const { brand, ...updatedState } = prevState;\n return updatedState; // Return the updated state without 'brand'\n });\n } else if (progressState === 2 && isMissedItem) {\n setProgressState(progressState - 2);\n setProducts(prevState[progressState - 2]);\n setIsMissedItem(null);\n setProductCartDetail(null);\n return;\n } else if (progressState === 1) {\n setProductCartDetail(null);\n }\n setProgressState(progressState - 1);\n const getData = prevState[progressState - 1];\n setProducts(getData);\n\n // Function to update width of product section\n const updateWidthProductSection = () => {\n const productSection = document.getElementById(\"product-section\");\n if (productSection) {\n setWidthProductSection(productSection.offsetWidth);\n }\n };\n setTimeout(() => {\n updateWidthProductSection();\n }, 1);\n };\n\n // Function which finalize and submit the request of appointments and quotes\n const submitForm = async (clickedKey) => {\n if (clickedKey === \"appointments\") {\n setButtonClicked(\"appointment\");\n } else if (clickedKey === \"quote\" && progressState === 4) {\n // Mark button as clicked\n setIsButtonClicked(true);\n\n // Validate form\n if (!isFormValid(formdata) || isDisabled) {\n // Now trigger validation (this will show errors, but not stop checkbox update)\n setProgressState(4);\n setCurrentState('FORM');\n\n handleSubmit(() => {\n // Validation logic here\n console.log(\"Validation passed\");\n })(); // Immediately invoke handleSubmit to trigger validation\n return;\n }\n // and if the Form is Valid, proceed\n setButtonClicked(\"quote\");\n setProgressState(6);\n }\n if (userSettings.isQuoteLocationsEnabled) {\n setCurrentState(DISPLAYING_PAGES.BOOKING);\n }\n try {\n setLoading(true);\n // setButtonLoader(true);\n const services = productCartDetail?.services.map((item) => {\n const price =\n item.sale_price &&\n typeof item.sale_price === \"string\" &&\n item.sale_price.startsWith(\"0\")\n ? item.retail_price\n : item.sale_price;\n return {\n rd_issue_id: item.id,\n name: item.name,\n price: item?.price ? item?.price : price,\n };\n });\n\n const formattedTime = combineDateWithTime(\n appointmentDetail?.date,\n appointmentDetail?.start\n );\n const data = {\n device: productCartDetail?.category?.name || \"\",\n brand: productCartDetail?.brand?.name || \"others\",\n model:\n productCartDetail?.model?.name ||\n productCartData?.device_name ||\n formdata?.model,\n category_id: productCartDetail?.skipForOthers ? \"\" : userSettings?.isRDSync ? productCartDetail?.category.rd_category_id : productCartDetail?.brand.category,\n manufacturer_id: productCartDetail?.skipForOthers ? \"\" : userSettings?.isRDSync ? productCartDetail?.brand.rd_manufacturer_id : productCartDetail?.brand._id,\n rd_device_id: productCartData?.rd_device_id,\n date: formattedTime || \"\",\n start_time:\n appointmentDetail?.start !== \"\" ? appointmentDetail?.start : \"\",\n end_time: appointmentDetail?.end !== \"\" ? appointmentDetail?.end : \"\",\n issues: services,\n store_id: userSettings?.isQuoteLocationsEnabled\n ? selectedStoreDetails.store_id\n : \"\",\n store_name: userSettings?.isQuoteLocationsEnabled\n ? selectedStoreDetails.store_name\n : \"\",\n customer_name: formdata.name,\n customer_email: formdata.email,\n customer_telephone: formdata.phone,\n customer_notes: formdata.notes,\n delivery_option: formdata?.option,\n delivery_status: formdata.status,\n total_price: productCartDetail?.totalPrice || 0,\n q_: encryptionKey,\n config_type: clickedKey,\n };\n // console.log(data);\n const API_BASE_URL = process.env.REACT_APP_APPOINTMENT_PRO_API_URL;\n const res = await fetch(\n `${API_BASE_URL}/${UrlServices.submitRequest}`,\n {\n method: \"POST\",\n body: JSON.stringify(data),\n headers: {\n \"Content-type\": \"application/json; charset=UTF-8\",\n },\n }\n );\n setLoading(false);\n // setButtonLoader(false);\n setCurrentState(DISPLAYING_PAGES.COMPLETION);\n const response = await res.json();\n } catch (error) {\n setLoading(false);\n // setButtonLoader(false);\n setProductCartData(null);\n console.log(error);\n }\n };\n\n const defaultFrameId =\n \"My9TWjljRjY1V3F6c2xkZkxTRkkrazVYazNka1hITXBwSHVENXhSUjJ2YUtrWE5wb2s4SzNVZnpRWVg5SnZUUUJoRFN3QS9vZTJmeERWTXNjR3BZbHd5U3JTU3EwVVpyR0d3Mjg1L3hpY0U9\";\n \n // Hook\n useEffect(() => {\n sessionStorage.removeItem(\"menuOption\");\n }, []);\n \n // Hook\n useEffect(() => {\n if (productSectionRef.current && products.length) {\n // Scroll to the top when products change or progressState changes\n productSectionRef.current.scrollTop = 0;\n }\n }, [products, progressState]);\n\n // Hook\n useEffect(() => {\n detectMobView();\n detectWebView();\n\n const targetObject = productCartDetail?.skipForOthers\n ? formErrorss\n : restErors;\n const propertiesLength =\n targetObject && typeof targetObject === \"object\"\n ? Object.keys(targetObject).length\n : 0;\n\n setIsDisabled(propertiesLength);\n\n var url = new URL(window.location.href);\n var params = new URLSearchParams(url.search);\n var frameId = params.get(\"frameId\");\n\n const encrypted = decodeURIComponent(frameId ? frameId : defaultFrameId);\n setEncryptionKey(encrypted);\n\n window.addEventListener(\"resize\", updateDimensions);\n window.addEventListener(\"resize\", detectMobView);\n window.addEventListener(\"resize\", detectWebView);\n return () => {\n window.removeEventListener(\"resize\", updateDimensions);\n window.removeEventListener(\"resize\", detectMobView);\n window.removeEventListener(\"resize\", detectWebView);\n };\n }, [\n encryptionKey,\n height,\n productCartDetail,\n formErrorss,\n restErors,\n isWebView,\n ]);\n\n return (\n <>\n \n {/* Back Button */}\n {!loading && (\n
saveState()}>\n {PROGRESS_STATE.includes(progressState) &&\n currentState !== DISPLAYING_PAGES.COMPLETION && (\n \n \n \n )}\n \n )}\n\n {/* for MOBILE SCREEN only */}\n {/* (Continue), (Get Quote), (Book an Appointment) (Confirm Appointment) buttons */}\n
\n {isMobView &&\n progressState === 3 && (\n \n\n {/* Top Heading only for Web view */}\n {!isMobView && (\n
\n {/*
\n Get Instant Price Quote\n
*/}\n {(!loading || progressState !== 6) && (
\n {PAGES[progressState] === \"Category\"\n ? \"Select Category\"\n : PAGES[progressState] === \"Brand\"\n ? \"Select Brand\"\n : PAGES[progressState] === \"Model\"\n ? \"Select Model\"\n : PAGES[progressState] === \"Issues\"\n ? \"Select the issues you are facing with your device\"\n : PAGES[progressState] === \"Enter Contact Details\"\n ? \"Please provide your Contact Information\"\n : currentState === \"COMPLETION\"\n ? \"\"\n : PAGES[progressState]}\n
)}\n
\n )}\n
\n \n
\n {currentState !== DISPLAYING_PAGES.COMPLETION && (\n <>\n
\n {/* Left Side Heading */}\n {(!loading || progressState !== 6) && (
{PAGES[progressState]}
)}\n {/* Right Side Progress Status */}\n {!loading && (\n
\n {progressState + 1} of 7\n
\n )}\n {/* Processing Status on Finalizing Request */}\n {loading && progressState === 6 && (\n
Processing..
\n )}\n
\n
\n >\n )}\n {/* If there is no any service available from Backend */}\n {products?.length === 0 && !loading && (\n
\n
\n No available services found.{\" \"}\n
\n
\n )}\n {/* Center Circular Loader */}\n {loading && (\n
\n \n
\n )}\n
\n
\n {/* Show dynamic pages */}\n {currentState === DISPLAYING_PAGES.PRODUCT && encryptionKey && (\n \n )}\n {currentState === DISPLAYING_PAGES.FORM && }\n {currentState === DISPLAYING_PAGES.BOOKING && !loading && }\n {currentState === DISPLAYING_PAGES.COMPLETION && !loading && }\n {((productCartDetail &&\n products?.length &&\n progressState >= 3 &&\n progressState <= 6) ||\n (productCartData &&\n products?.length &&\n progressState >= 3 &&\n progressState <= 6)) &&\n currentState !== \"COMPLETION\" && !loading && }\n \n
\n
\n
\n >\n );\n};\n\nexport default AppManager;\n","import React from 'react';\n\nimport { createFormControl } from './logic/createFormControl';\nimport getProxyFormState from './logic/getProxyFormState';\nimport shouldRenderFormState from './logic/shouldRenderFormState';\nimport deepEqual from './utils/deepEqual';\nimport isFunction from './utils/isFunction';\nimport {\n FieldValues,\n FormState,\n InternalFieldName,\n UseFormProps,\n UseFormReturn,\n} from './types';\nimport { useSubscribe } from './useSubscribe';\n\n/**\n * Custom hook to manage the entire form.\n *\n * @remarks\n * [API](https://react-hook-form.com/docs/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4)\n *\n * @param props - form configuration and validation parameters.\n *\n * @returns methods - individual functions to manage the form state. {@link UseFormReturn}\n *\n * @example\n * ```tsx\n * function App() {\n * const { register, handleSubmit, watch, formState: { errors } } = useForm();\n * const onSubmit = data => console.log(data);\n *\n * console.log(watch(\"example\"));\n *\n * return (\n * \n * );\n * }\n * ```\n */\nexport function useForm<\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues extends FieldValues | undefined = undefined,\n>(\n props: UseFormProps = {},\n): UseFormReturn {\n const _formControl = React.useRef<\n UseFormReturn | undefined\n >();\n const _values = React.useRef();\n const [formState, updateFormState] = React.useState>({\n isDirty: false,\n isValidating: false,\n isLoading: isFunction(props.defaultValues),\n isSubmitted: false,\n isSubmitting: false,\n isSubmitSuccessful: false,\n isValid: false,\n submitCount: 0,\n dirtyFields: {},\n touchedFields: {},\n validatingFields: {},\n errors: props.errors || {},\n disabled: props.disabled || false,\n defaultValues: isFunction(props.defaultValues)\n ? undefined\n : props.defaultValues,\n });\n\n if (!_formControl.current) {\n _formControl.current = {\n ...createFormControl(props),\n formState,\n };\n }\n\n const control = _formControl.current.control;\n control._options = props;\n\n useSubscribe({\n subject: control._subjects.state,\n next: (\n value: Partial> & { name?: InternalFieldName },\n ) => {\n if (\n shouldRenderFormState(\n value,\n control._proxyFormState,\n control._updateFormState,\n true,\n )\n ) {\n updateFormState({ ...control._formState });\n }\n },\n });\n\n React.useEffect(\n () => control._disableForm(props.disabled),\n [control, props.disabled],\n );\n\n React.useEffect(() => {\n if (control._proxyFormState.isDirty) {\n const isDirty = control._getDirty();\n if (isDirty !== formState.isDirty) {\n control._subjects.state.next({\n isDirty,\n });\n }\n }\n }, [control, formState.isDirty]);\n\n React.useEffect(() => {\n if (props.values && !deepEqual(props.values, _values.current)) {\n control._reset(props.values, control._options.resetOptions);\n _values.current = props.values;\n updateFormState((state) => ({ ...state }));\n } else {\n control._resetDefaultValues();\n }\n }, [props.values, control]);\n\n React.useEffect(() => {\n if (props.errors) {\n control._setErrors(props.errors);\n }\n }, [props.errors, control]);\n\n React.useEffect(() => {\n if (!control._state.mount) {\n control._updateValid();\n control._state.mount = true;\n }\n\n if (control._state.watch) {\n control._state.watch = false;\n control._subjects.state.next({ ...control._formState });\n }\n\n control._removeUnmounted();\n });\n\n React.useEffect(() => {\n props.shouldUnregister &&\n control._subjects.values.next({\n values: control._getWatch(),\n });\n }, [props.shouldUnregister, control]);\n\n _formControl.current.formState = getProxyFormState(formState, control);\n\n return _formControl.current;\n}\n","import './App.css';\nimport AppManager from './AppManager';\nimport 'bootstrap/dist/css/bootstrap.min.css';\n\nfunction App() {\n return (\n \n );\n}\n\nexport default App;\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nconst root = ReactDOM.createRoot(document.getElementById('root'));\nroot.render(\n \n \n \n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"names":["HASH_UNDEFINED","funcTag","genTag","reIsHostCtor","freeGlobal","global","Object","freeSelf","self","root","Function","arrayProto","Array","prototype","funcProto","objectProto","coreJsData","maskSrcKey","uid","exec","keys","IE_PROTO","funcToString","toString","hasOwnProperty","objectToString","reIsNative","RegExp","call","replace","splice","Map","getNative","nativeCreate","Hash","entries","index","length","this","clear","entry","set","ListCache","MapCache","assocIndexOf","array","key","value","other","baseIsNative","isObject","func","pattern","tag","isFunction","result","e","isHostObject","test","toSource","getMapData","map","data","__data__","type","isKeyable","object","undefined","getValue","memoize","resolver","TypeError","memoized","args","arguments","apply","cache","has","get","Cache","pop","push","module","exports","ReactPropTypesSecret","require","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","props","propName","componentName","location","propFullName","secret","err","Error","name","getShim","isRequired","ReactPropTypes","bigint","bool","number","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","maxSize","_maxSize","_size","_values","create","SPLIT_REGEX","DIGIT_REGEX","LEAD_DIGIT_REGEX","SPEC_CHAR_REGEX","CLEAN_QUOTES_REGEX","pathCache","setCache","getCache","normalizePath","path","split","part","match","isQuoted","str","indexOf","charAt","shouldBeQuoted","hasLeadingNumber","hasSpecialChars","setter","parts","obj","len","getter","safe","join","segments","reduce","forEach","cb","thisArg","iter","idx","isArray","isBracket","aa","ca","p","a","b","c","encodeURIComponent","da","Set","ea","fa","ha","add","ia","window","document","createElement","ja","ka","la","ma","v","d","f","g","acceptsBooleans","attributeName","attributeNamespace","mustUseProperty","propertyName","sanitizeURL","removeEmptyString","z","toLowerCase","ra","sa","toUpperCase","ta","slice","pa","isNaN","qa","oa","removeAttribute","setAttribute","setAttributeNS","xlinkHref","ua","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","va","Symbol","for","wa","ya","za","Aa","Ba","Ca","Da","Ea","Fa","Ga","Ha","Ia","Ja","iterator","Ka","La","A","assign","Ma","stack","trim","Na","Oa","prepareStackTrace","defineProperty","Reflect","construct","l","h","k","displayName","includes","Pa","render","Qa","$$typeof","_context","_payload","_init","Ra","Sa","Ta","nodeName","Va","_valueTracker","getOwnPropertyDescriptor","constructor","configurable","enumerable","setValue","stopTracking","Ua","Wa","checked","Xa","activeElement","body","Ya","defaultChecked","defaultValue","_wrapperState","initialChecked","Za","initialValue","controlled","ab","bb","db","ownerDocument","eb","fb","options","selected","defaultSelected","disabled","gb","dangerouslySetInnerHTML","children","hb","ib","jb","textContent","kb","lb","mb","nb","namespaceURI","innerHTML","valueOf","firstChild","removeChild","appendChild","MSApp","execUnsafeLocalFunction","ob","lastChild","nodeType","nodeValue","pb","animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","qb","rb","sb","style","setProperty","substring","tb","menuitem","area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","ub","vb","is","wb","xb","target","srcElement","correspondingUseElement","parentNode","yb","zb","Ab","Bb","Cb","stateNode","Db","Eb","Fb","Gb","Hb","Ib","Jb","Kb","Lb","Mb","addEventListener","removeEventListener","Nb","m","onError","Ob","Pb","Qb","Rb","Sb","Tb","Vb","alternate","return","flags","Wb","memoizedState","dehydrated","Xb","Zb","child","sibling","current","Yb","$b","ac","unstable_scheduleCallback","bc","unstable_cancelCallback","cc","unstable_shouldYield","dc","unstable_requestPaint","B","unstable_now","ec","unstable_getCurrentPriorityLevel","fc","unstable_ImmediatePriority","gc","unstable_UserBlockingPriority","hc","unstable_NormalPriority","ic","unstable_LowPriority","jc","unstable_IdlePriority","kc","lc","oc","Math","clz32","pc","qc","log","LN2","rc","sc","tc","uc","pendingLanes","suspendedLanes","pingedLanes","entangledLanes","entanglements","vc","xc","yc","zc","Ac","eventTimes","Cc","C","Dc","Ec","Fc","Gc","Hc","Ic","Jc","Kc","Lc","Mc","Nc","Oc","Pc","Qc","Rc","Sc","delete","pointerId","Tc","nativeEvent","blockedOn","domEventName","eventSystemFlags","targetContainers","Vc","Wc","priority","isDehydrated","containerInfo","Xc","Yc","dispatchEvent","shift","Zc","$c","ad","bd","cd","ReactCurrentBatchConfig","dd","ed","transition","fd","gd","hd","id","Uc","stopPropagation","jd","kd","ld","md","nd","od","keyCode","charCode","pd","qd","rd","_reactName","_targetInst","currentTarget","isDefaultPrevented","defaultPrevented","returnValue","isPropagationStopped","preventDefault","cancelBubble","persist","isPersistent","wd","xd","yd","sd","eventPhase","bubbles","cancelable","timeStamp","Date","now","isTrusted","td","ud","view","detail","vd","Ad","screenX","screenY","clientX","clientY","pageX","pageY","ctrlKey","shiftKey","altKey","metaKey","getModifierState","zd","button","buttons","relatedTarget","fromElement","toElement","movementX","movementY","Bd","Dd","dataTransfer","Fd","Hd","animationName","elapsedTime","pseudoElement","Id","clipboardData","Jd","Ld","Md","Esc","Spacebar","Left","Up","Right","Down","Del","Win","Menu","Apps","Scroll","MozPrintableKey","Nd","Od","Alt","Control","Meta","Shift","Pd","Qd","String","fromCharCode","code","repeat","locale","which","Rd","Td","width","height","pressure","tangentialPressure","tiltX","tiltY","twist","pointerType","isPrimary","Vd","touches","targetTouches","changedTouches","Xd","Yd","deltaX","wheelDeltaX","deltaY","wheelDeltaY","wheelDelta","deltaZ","deltaMode","Zd","$d","ae","be","documentMode","ce","de","ee","fe","ge","he","ie","le","color","date","datetime","email","month","password","range","search","tel","text","time","url","week","me","ne","oe","event","listeners","pe","qe","re","se","te","ue","ve","we","xe","ye","ze","oninput","Ae","detachEvent","Be","Ce","attachEvent","De","Ee","Fe","He","Ie","Je","Ke","offset","nextSibling","Le","contains","compareDocumentPosition","Me","HTMLIFrameElement","contentWindow","href","Ne","contentEditable","Oe","focusedElem","selectionRange","documentElement","start","end","selectionStart","selectionEnd","min","defaultView","getSelection","extend","rangeCount","anchorNode","anchorOffset","focusNode","focusOffset","createRange","setStart","removeAllRanges","addRange","setEnd","left","scrollLeft","top","scrollTop","focus","Pe","Qe","Re","Se","Te","Ue","Ve","We","animationend","animationiteration","animationstart","transitionend","Xe","Ye","Ze","animation","$e","af","bf","cf","df","ef","ff","gf","hf","lf","mf","concat","nf","Ub","instance","listener","D","of","pf","qf","rf","random","sf","bind","capture","passive","n","t","J","x","u","w","F","tf","uf","parentWindow","vf","wf","na","xa","$a","ba","je","char","ke","unshift","xf","yf","zf","Af","Bf","Cf","Df","Ef","__html","Ff","setTimeout","Gf","clearTimeout","Hf","Promise","Jf","queueMicrotask","resolve","then","catch","If","Kf","Lf","Mf","previousSibling","Nf","Of","Pf","Qf","Rf","Sf","Tf","Uf","E","G","Vf","H","Wf","Xf","Yf","contextTypes","__reactInternalMemoizedUnmaskedChildContext","__reactInternalMemoizedMaskedChildContext","Zf","childContextTypes","$f","ag","bg","getChildContext","cg","__reactInternalMemoizedMergedChildContext","dg","eg","fg","gg","hg","jg","kg","lg","mg","ng","og","pg","qg","rg","sg","tg","ug","vg","wg","xg","yg","I","zg","Ag","Bg","deletions","Cg","pendingProps","overflow","treeContext","retryLane","Dg","mode","Eg","Fg","Gg","memoizedProps","Hg","Ig","Jg","Kg","Lg","defaultProps","Mg","Ng","Og","Pg","Qg","Rg","_currentValue","Sg","childLanes","Tg","dependencies","firstContext","lanes","Ug","Vg","context","memoizedValue","next","Wg","Xg","Yg","interleaved","Zg","$g","ah","updateQueue","baseState","firstBaseUpdate","lastBaseUpdate","shared","pending","effects","bh","ch","eventTime","lane","payload","callback","dh","K","eh","fh","gh","q","r","y","hh","ih","jh","Component","refs","kh","nh","isMounted","_reactInternals","enqueueSetState","L","lh","mh","enqueueReplaceState","enqueueForceUpdate","oh","shouldComponentUpdate","isPureReactComponent","ph","contextType","state","updater","qh","componentWillReceiveProps","UNSAFE_componentWillReceiveProps","rh","getDerivedStateFromProps","getSnapshotBeforeUpdate","UNSAFE_componentWillMount","componentWillMount","componentDidMount","sh","ref","_owner","_stringRef","th","uh","vh","wh","xh","yh","implementation","zh","Ah","done","Bh","Ch","Dh","Eh","Fh","Gh","Hh","Ih","tagName","Jh","Kh","Lh","M","Mh","revealOrder","Nh","Oh","_workInProgressVersionPrimary","Ph","ReactCurrentDispatcher","Qh","Rh","N","O","P","Sh","Th","Uh","Vh","Q","Wh","Xh","Yh","Zh","$h","ai","bi","ci","baseQueue","queue","di","ei","fi","lastRenderedReducer","action","hasEagerState","eagerState","lastRenderedState","dispatch","gi","hi","ii","ji","ki","getSnapshot","li","mi","R","ni","lastEffect","stores","oi","pi","qi","ri","destroy","deps","si","ti","ui","vi","wi","xi","yi","zi","Ai","Bi","Ci","Di","Ei","Fi","Gi","Hi","Ii","Ji","readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","identifierPrefix","Ki","message","digest","Li","Mi","console","error","Ni","WeakMap","Oi","Pi","Qi","Ri","getDerivedStateFromError","componentDidCatch","Si","componentStack","Ti","pingCache","Ui","Vi","Wi","Xi","ReactCurrentOwner","Yi","Zi","$i","aj","bj","compare","cj","dj","ej","baseLanes","cachePool","transitions","fj","gj","hj","ij","jj","UNSAFE_componentWillUpdate","componentWillUpdate","componentDidUpdate","kj","lj","pendingContext","mj","Aj","Bj","Cj","Dj","nj","oj","pj","fallback","qj","rj","tj","dataset","dgst","uj","vj","_reactRetry","sj","subtreeFlags","wj","xj","isBackwards","rendering","renderingStartTime","last","tail","tailMode","yj","Ej","S","Fj","Gj","wasMultiple","multiple","suppressHydrationWarning","onClick","onclick","size","createElementNS","autoFocus","createTextNode","T","Hj","Ij","Jj","Kj","U","Lj","WeakSet","V","Mj","W","Nj","Oj","Qj","Rj","Sj","Tj","Uj","Vj","Wj","insertBefore","_reactRootContainer","Xj","X","Yj","Zj","ak","onCommitFiberUnmount","componentWillUnmount","bk","ck","dk","ek","fk","isHidden","gk","hk","display","ik","jk","kk","lk","__reactInternalSnapshotBeforeUpdate","src","Wk","mk","ceil","nk","ok","pk","Y","Z","qk","rk","sk","tk","uk","Infinity","vk","wk","xk","yk","zk","Ak","Bk","Ck","Dk","Ek","callbackNode","expirationTimes","expiredLanes","wc","callbackPriority","ig","Fk","Gk","Hk","Ik","Jk","Kk","Lk","Mk","Nk","Ok","Pk","finishedWork","finishedLanes","Qk","timeoutHandle","Rk","Sk","Tk","Uk","Vk","mutableReadLanes","Bc","Pj","onCommitFiberRoot","mc","onRecoverableError","Xk","onPostCommitFiberRoot","Yk","Zk","al","isReactComponent","pendingChildren","bl","mutableSourceEagerHydrationData","cl","pendingSuspenseBoundaries","el","fl","gl","hl","il","jl","zj","$k","ll","reportError","ml","_internalRoot","nl","ol","pl","ql","sl","rl","unmount","unstable_scheduleHydration","querySelectorAll","JSON","stringify","form","tl","usingClientEntryPoint","Events","ul","findFiberByHostInstance","bundleType","version","rendererPackageName","vl","rendererConfig","overrideHookState","overrideHookStateDeletePath","overrideHookStateRenamePath","overrideProps","overridePropsDeletePath","overridePropsRenamePath","setErrorHandler","setSuspenseHandler","scheduleUpdate","currentDispatcherRef","findHostInstanceByFiber","findHostInstancesForRefresh","scheduleRefresh","scheduleRoot","setRefreshHandler","getCurrentFiber","reconcilerVersion","__REACT_DEVTOOLS_GLOBAL_HOOK__","wl","isDisabled","supportsFiber","inject","createPortal","dl","createRoot","unstable_strictMode","findDOMNode","flushSync","hydrate","hydrateRoot","hydratedSources","_getVersion","_source","unmountComponentAtNode","unstable_batchedUpdates","unstable_renderSubtreeIntoContainer","checkDCE","__self","__source","Fragment","jsx","jsxs","setState","forceUpdate","escape","_status","_result","default","Children","count","toArray","only","Profiler","PureComponent","StrictMode","Suspense","cloneElement","createContext","_currentValue2","_threadCount","Provider","Consumer","_defaultValue","_globalName","createFactory","createRef","forwardRef","isValidElement","lazy","memo","startTransition","unstable_act","sortIndex","performance","setImmediate","startTime","expirationTime","priorityLevel","navigator","scheduling","isInputPending","MessageChannel","port2","port1","onmessage","postMessage","unstable_Profiling","unstable_continueExecution","unstable_forceFrameRate","floor","unstable_getFirstCallbackNode","unstable_next","unstable_pauseExecution","unstable_runWithPriority","delay","unstable_wrapCallback","reWords","words","upperFirst","camelCase","acc","pascalCase","snakeCase","kebabCase","sentenceCase","titleCase","toposort","nodes","edges","cursor","sorted","visited","i","outgoingEdges","arr","edge","makeOutgoingEdges","nodesHash","res","makeNodesHash","visit","predecessors","nodeRep","outgoing","from","uniqueNodes","hasOwn","classNames","classes","arg","appendClass","parseValue","newClass","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","__esModule","definition","o","chunkId","all","promises","miniCssF","globalThis","prop","inProgress","dataWebpackPrefix","script","needAttach","scripts","getElementsByTagName","s","getAttribute","charset","timeout","nc","onScriptComplete","prev","onerror","onload","doneFns","fn","head","toStringTag","installedChunks","j","installedChunkData","promise","reject","errorType","realSrc","request","webpackJsonpCallback","parentChunkLoadingFunction","chunkIds","moreModules","runtime","some","chunkLoadingGlobal","isCheckBoxInput","isDateObject","isNullOrUndefined","isObjectType","getEventValue","isNameInFieldArray","names","getNodeParentName","isPlainObject","tempObject","prototypeCopy","isWeb","HTMLElement","cloneObject","copy","Blob","FileList","compact","filter","Boolean","isUndefined","val","isBoolean","EVENTS","BLUR","FOCUS_OUT","CHANGE","VALIDATION_MODE","onBlur","onChange","onSubmit","onTouched","INPUT_VALIDATION_RULES","HookFormContext","React","useFormContext","getProxyFormState","formState","control","localProxyFormState","isRoot","defaultValues","_defaultValues","_key","_proxyFormState","isEmptyObject","shouldRenderFormState","formStateData","updateFormState","find","convertToArrayPayload","shouldSubscribeByName","signalName","currentName","startsWith","useSubscribe","_props","subscription","subject","subscribe","unsubscribe","useFormState","methods","_formState","_mounted","_localProxyFormState","isDirty","isLoading","dirtyFields","touchedFields","validatingFields","isValidating","isValid","errors","_name","_updateFormState","_subjects","_updateValid","isString","generateWatchOutput","_names","formValues","isGlobal","watch","fieldName","watchAll","isKey","stringToPath","tempPath","lastIndex","newValue","objValue","useController","shouldUnregister","isArrayField","values","updateValue","_formValues","_getWatch","_removeUnmounted","useWatch","_registerProps","register","rules","_shouldUnregisterField","_options","updateMounted","field","_fields","_f","mount","_state","unregister","_updateDisabledField","fields","elm","select","setCustomValidity","reportValidity","fieldState","defineProperties","invalid","isTouched","Controller","appendErrors","validateAllFieldCriteria","types","getValidationModes","isOnSubmit","isOnBlur","isOnChange","isOnAll","isOnTouch","isWatched","isBlurEvent","watchName","iterateFieldsByAction","fieldsNames","abortEarly","currentField","updateFieldArrayRootError","fieldArrayErrors","isFileInput","isHTMLElement","owner","isMessage","isRadioInput","isRegex","defaultResult","validResult","getCheckboxValue","option","attributes","defaultReturn","getRadioValue","previous","getValidateError","every","getValueAndMessage","validationData","validateField","async","shouldUseNativeValidation","isFieldArray","required","maxLength","minLength","max","validate","valueAsNumber","inputValue","inputRef","isRadio","isCheckBox","isRadioOrCheckbox","isEmpty","appendErrorsCurry","getMinMaxMessage","exceedMax","maxLengthMessage","minLengthMessage","maxType","minType","exceedMin","maxOutput","minOutput","valueDate","valueAsDate","convertTimeToDate","toDateString","isTime","isWeek","valueNumber","maxLengthOutput","minLengthOutput","patternValue","validateError","validationResult","unset","paths","childObject","updatePath","baseGet","isEmptyArray","createSubject","_observers","observers","observer","isPrimitive","deepEqual","object1","object2","getTime","keys1","keys2","val1","val2","isMultipleSelect","live","isConnected","objectHasTruthyValue","objectHasFunction","markFieldsDirty","isParentNodeArray","getDirtyFieldsFromDefaultValues","dirtyFieldsFromValues","getDirtyFields","getFieldValueAs","_ref2","setValueAs","NaN","getFieldValue","files","selectedOptions","_ref3","getResolverOptions","criteriaMode","getRuleValue","rule","hasValidation","schemaErrorLookup","foundError","skipValidation","isSubmitted","reValidateMode","unsetEmptyArray","defaultOptions","shouldFocusError","createFormControl","delayErrorCallback","submitCount","isSubmitting","isSubmitSuccessful","unMount","timer","validationModeBeforeSubmit","validationModeAfterSubmit","shouldDisplayAllAssociatedErrors","shouldUpdateValid","_executeSchema","executeBuiltInValidation","_updateIsValidating","updateValidAndValue","shouldSkipSetValueAs","setFieldValue","updateTouchAndDirty","fieldValue","shouldDirty","shouldRender","shouldUpdateField","isPreviousDirty","output","disabledField","_getDirty","isCurrentFieldPristine","isPreviousFieldTouched","shouldRenderByError","previousFieldError","delayError","updateErrors","wait","updatedFormState","shouldOnlyCheckValid","valid","isFieldArrayRoot","fieldError","getValues","fieldReference","optionRef","checkboxRef","radioRef","shouldTouch","shouldValidate","trigger","setValues","fieldKey","cloneValue","isFieldValueUpdated","_updateIsFieldValueUpdated","Number","shouldSkipValidation","watched","previousErrorLookupResult","errorLookupResult","_focusInput","fieldNames","executeSchemaAndUpdateState","shouldFocus","getFieldState","setError","keepValue","keepError","keepDirty","keepTouched","keepIsValidating","keepDefaultValue","keepIsValid","_ref4","disabledIsDefined","progressive","fieldRef","radioOrCheckbox","_focusError","handleSubmit","onValid","onInvalid","onValidError","fieldValues","_reset","keepStateOptions","updatedValues","cloneUpdatedValues","isEmptyResetValues","keepDefaultValues","keepValues","keepDirtyValues","closest","reset","keepSubmitCount","keepIsSubmitted","keepErrors","keepIsSubmitSuccessful","_updateFieldArray","method","shouldSetValues","shouldUpdateFieldsAndState","argA","argB","_getFieldArray","_resetDefaultValues","resetOptions","_disableForm","requiredDisabledState","_setErrors","resetField","clearErrors","inputName","setFocus","shouldSelect","raw","inner","defaultAttributes","xmlns","viewBox","fill","stroke","strokeLinecap","strokeLinejoin","createReactComponent","iconName","iconNamePascal","iconNode","_a","_b","rest","__objRest","__spreadValues","__spreadProps","className","_ref","attrs","propTypes","IconArrowLeft","PAGES","DISPLAYING_PAGES","PROGRESS_STATE","IconMapPin","IconClock","combineDateWithTime","dateTimeString","anotherTime","dateObject","year","getFullYear","getMonth","padStart","day","getDate","formattedDate","isKeyValueEmpty","formatTo12Hour","time24","hour","minute","ampm","cssUnit","cm","mm","in","px","pt","em","ex","rem","vw","vmin","vmax","cssValue","lengthWithunit","unit","valueString","parseFloat","parseInt","warn","parseLengthAndUnit","createAnimation","loaderName","frames","suffix","styleEl","styleSheet","sheet","keyFrames","insertRule","__assign","__rest","getOwnPropertySymbols","propertyIsEnumerable","clip","loading","_c","_d","speedMultiplier","_e","cssOverride","additionalprops","background","borderRadius","border","borderTopColor","borderBottomColor","borderLeftColor","borderRightColor","animationFillMode","getPrototypeOf","kindOf","thing","kindOfTest","typeOfTest","isArrayBuffer","isNumber","isDate","isFile","isBlob","isFileList","isURLSearchParams","allOwnKeys","getOwnPropertyNames","findKey","_global","isContextDefined","isTypedArray","TypedArray","Uint8Array","isHTMLForm","isRegExp","reduceDescriptors","reducer","descriptors","getOwnPropertyDescriptors","reducedDescriptors","descriptor","ret","ALPHA","DIGIT","ALPHABET","ALPHA_DIGIT","isAsyncFn","isBuffer","isFormData","kind","FormData","append","isArrayBufferView","ArrayBuffer","isView","buffer","isStream","pipe","merge","caseless","assignValue","targetKey","stripBOM","content","charCodeAt","inherits","superConstructor","toFlatObject","sourceObj","destObj","propFilter","merged","endsWith","searchString","position","forEachEntry","pair","matchAll","regExp","matches","hasOwnProp","freezeMethods","writable","toObjectSet","arrayOrString","delimiter","define","toCamelCase","p1","p2","noop","toFiniteNumber","isFinite","generateString","alphabet","isSpecCompliantForm","toJSONObject","reducedValue","isThenable","AxiosError","config","response","captureStackTrace","utils","toJSON","description","fileName","lineNumber","columnNumber","status","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","dots","token","predicates","formData","metaTokens","indexes","visitor","defaultVisitor","useBlob","convertValue","toISOString","Buffer","isFlatArray","exposedHelpers","build","encode","charMap","AxiosURLSearchParams","params","_pairs","toFormData","encoder","_encode","buildURL","serializeFn","serialize","serializedParams","hashmarkIndex","handlers","use","fulfilled","rejected","synchronous","runWhen","eject","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","isBrowser","URLSearchParams","protocols","hasBrowserEnv","hasStandardBrowserEnv","product","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","platform","buildPath","isNumericKey","isLast","arrayToObject","parsePropPath","defaults","transitional","transitionalDefaults","adapter","transformRequest","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","formDataToJSON","setContentType","helpers","isNode","toURLEncodedForm","formSerializer","_FormData","env","rawValue","parser","parse","stringifySafely","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","ignoreDuplicateOf","$internals","normalizeHeader","header","normalizeValue","matchHeaderValue","isHeaderNameFilter","AxiosHeaders","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","rawHeaders","parsed","line","parseHeaders","tokens","tokensRE","parseTokens","matcher","deleted","deleteHeader","normalize","format","normalized","formatHeader","_len","targets","asStrings","first","computed","_len2","_key2","accessor","accessors","defineAccessor","accessorName","methodName","arg1","arg2","arg3","buildAccessors","mapped","headerValue","transformData","fns","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","write","expires","domain","secure","cookie","toGMTString","read","decodeURIComponent","remove","buildFullPath","baseURL","requestedURL","relativeURL","combineURLs","msie","userAgent","urlParsingNode","originURL","resolveURL","protocol","host","hash","hostname","port","pathname","requestURL","samplesCount","bytes","timestamps","firstSampleTS","chunkLength","startedAt","bytesCount","passed","round","progressEventReducer","isDownloadStream","bytesNotified","_speedometer","speedometer","loaded","total","lengthComputable","progressBytes","rate","progress","estimated","XMLHttpRequest","requestData","requestHeaders","onCanceled","withXSRFToken","cancelToken","signal","auth","username","unescape","btoa","fullPath","onloadend","responseHeaders","getAllResponseHeaders","ERR_BAD_REQUEST","settle","responseText","statusText","open","paramsSerializer","onreadystatechange","readyState","responseURL","onabort","ECONNABORTED","ERR_NETWORK","ontimeout","timeoutErrorMessage","ETIMEDOUT","isURLSameOrigin","xsrfValue","cookies","setRequestHeader","withCredentials","onDownloadProgress","onUploadProgress","upload","cancel","abort","aborted","parseProtocol","send","knownAdapters","http","xhr","xhrAdapter","renderReason","reason","isResolvedHandle","adapters","nameOrAdapter","rejectedReasons","reasons","throwIfCancellationRequested","throwIfRequested","dispatchRequest","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","timeoutMessage","decompress","beforeRedirect","transport","httpAgent","httpsAgent","socketPath","responseEncoding","configValue","VERSION","validators","deprecatedWarnings","validator","formatMessage","opt","desc","opts","ERR_DEPRECATED","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","InterceptorManager","configOrUrl","boolean","function","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","responseInterceptorChain","chain","newConfig","onFulfilled","onRejected","getUri","generateHTTPMethod","isForm","CancelToken","executor","resolvePromise","_listeners","onfulfilled","_resolve","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","axios","createInstance","defaultConfig","Cancel","spread","isAxiosError","formToJSON","getAdapter","fetchAllCategories","rdDeviceDetail","modelServices","getTimes","storeInfo","submitRequest","allStores","isUnique","fixCommas","normalizeLocale","splitEl1","splitEl2","getUserLocales","useFallbackLocale","fallbackLocale","languageList","languages","_i","rawLanguages_1","rawLanguagesItem","rawLanguage","language","getUserLocale","makeGetEdgeOfNeighbor","getPeriod","getEdgeOfPeriod","defaultOffset","previousPeriod","makeGetEnd","getBeginOfNextPeriod","makeGetRange","getStart","getEnd","getYear","getCenturyStart","centuryStartYear","centuryStartDate","setFullYear","setHours","getPreviousCenturyStart","getNextCenturyStart","getCenturyEnd","getPreviousCenturyEnd","getCenturyRange","getDecadeStart","decadeStartYear","decadeStartDate","getPreviousDecadeStart","getNextDecadeStart","getDecadeEnd","getPreviousDecadeEnd","getDecadeRange","getYearStart","yearStartDate","getPreviousYearStart","getNextYearStart","getYearEnd","getPreviousYearEnd","getYearRange","makeGetEdgeOfNeighborMonth","getMonthStart","monthStartDate","getPreviousMonthStart","getNextMonthStart","getMonthEnd","getPreviousMonthEnd","getMonthRange","makeGetEdgeOfNeighborDay","getDayStart","dayStartDate","getDayEnd","getDayRange","getDaysInMonth","CALENDAR_TYPES","GREGORY","HEBREW","ISLAMIC","ISO_8601","DEPRECATED_CALENDAR_TYPES","ARABIC","US","CALENDAR_TYPE_LOCALES","WEEKDAYS","formatterCache","getSafeFormatter","localeWithDefault","formatterCacheLocale","Intl","DateTimeFormat","getFormatter","safeDate","toSafeHour","formatDay","formatLongDate","formatMonth","formatMonthYear","formatShortWeekday","weekday","formatWeekday","formatYear","SUNDAY","FRIDAY","SATURDAY","getDayOfWeek","calendarType","getDay","getBeginOfWeek","monthIndex","getMonthIndex","getBegin","rangeType","getBeginNext","getRange","toYearLabel","dates","defaultFormatYear","getDecadeLabel","isCurrentDayOfWeek","isWeekend","Navigation","activeStartDate","drillUp","defaultFormatMonthYear","maxDate","minDate","navigationAriaLabel","navigationAriaLive","navigationLabel","next2AriaLabel","next2Label","_g","nextAriaLabel","_h","nextLabel","_j","prev2AriaLabel","_k","prev2Label","_l","prevAriaLabel","_m","prevLabel","setActiveStartDate","showDoubleView","drillUpAvailable","views","shouldShowPrevNext2Buttons","previousActiveStartDate","getBeginPrevious","previousActiveStartDate2","getBeginPrevious2","nextActiveStartDate","nextActiveStartDate2","getBeginNext2","prevButtonDisabled","previousActiveEndDate","getEndPrevious","prev2ButtonDisabled","getEndPrevious2","nextButtonDisabled","next2ButtonDisabled","renderLabel","label","getCenturyLabel","labelClassName","renderButton","toPercent","num","Flex","direction","wrap","otherProps","flexDirection","flexWrap","marginInlineStart","flexBasis","marginLeft","marginInlineEnd","condition","isValueWithinRange","doRangesOverlap","range1","range2","getRangeClassNames","valueRange","dateRange","baseClassName","isRangeStart","isRangeEnd","getTileClasses","hover","dateType","isCompleteValue","greaterRange","smallerRange","valueType","valueRangeClassNames","valueArray","hoverRangeClassNames","calendarTypeMap","warned","mapCalendarType","calendarTypeOrDeprecatedCalendarType","isDeprecatedCalendarType","warning","TileGroup","dateTransform","renderTile","step","tiles","point","Tile","formatAbbr","maxDateTransform","minDateTransform","onMouseOver","tileClassNameProps","tileClassName","tileContentProps","tileContent","tileDisabled","clsx","onFocus","__spreadArray","to","pack","ar","Decade","Decades","getBeginOfCenturyYear","otherTileProps","calendarTypes","deprecatedCalendarTypes","allViews","isCalendarType","isClassName","isMinDate","isMaxDate","isRef","isRange","isValue","tileGroupProps","CenturyView","Year","Years","getBeginOfDecadeYear","DecadeView","Month","defaultFormatMonth","Months","YearView","Day","currentMonthIndex","defaultFormatDay","defaultFormatLongDate","classesProps","Days","showFixedNumberOfWeeks","showNeighboringMonth","hasFixedNumberOfWeeks","dayOfWeek","daysInMonth","activeEndDate","weekdayClassName","Weekdays","defaultFormatShortWeekday","defaultFormatWeekday","onMouseLeave","beginOfMonth","weekdays","weekdayDate","abbr","title","WeekNumber","onClickWeekNumber","weekNumber","date_1","onClickWeekNumber_1","weekNumber_1","WeekNumbers","numberOfWeeks","days","weekNumbers","beginOfFirstWeek","calendarTypeForWeekNumber","beginOfWeek","getWeekNumber","weekIndex","MonthView","getCalendarTypeFromLocale","showWeekNumbers","childProps","alignItems","allValueTypes","defaultMinDate","defaultMaxDate","toDate","getLimitedViews","minDetail","maxDetail","getView","isViewAllowed","getValueType","getDetailValue","valuePiece","between","getDetailValueFrom","getDetailValueTo","getDetailValueArray","getActiveStartDate","getIsSingleValue","areDatesEqual","date1","date2","Calendar","activeStartDateProps","allowPartialRange","defaultActiveStartDate","goToRangeStartOnSelect","onActiveStartDateChange","onChangeProps","onClickDay","onClickDecade","onClickMonth","onClickYear","onDrillDown","onDrillUp","onViewChange","selectRange","showNavigation","valueProps","viewProps","activeStartDateState","setActiveStartDateState","hoverState","setHoverState","valueState","setValueState","viewState","setViewState","valueFrom","getInitialActiveStartDate","drillDownAvailable","getProcessedValue","processFunction","onClickTile","drillDown","nextView","rawNextValue","previousValue","nextValue","isFirstValueInRange","sort","getValueRange","nextHover","renderContent","commonProps","isActiveStartDate","isValueOrValueArray","_taggedTemplateLiteral","strings","freeze","querySelector","_goober","theme","as","resolveValue","matchMedia","$","toastId","toasts","toast","visible","pausedAt","pauseDuration","blank","success","custom","createdAt","ariaProps","role","dismiss","updateHeight","startPause","duration","reverseOrder","gutter","defaultPosition","findIndex","endPause","calculateOffset","_templateObject","_templateObject2","_templateObject3","_","_templateObject4","primary","secondary","_templateObject5","_templateObject6","_templateObject7","_templateObject8","_templateObject9","_templateObject10","_templateObject11","_templateObject12","_templateObject13","icon","iconTheme","_templateObject14","_templateObject15","getAnimationStyle","onHeightUpdate","getBoundingClientRect","MutationObserver","observe","subtree","childList","characterData","_templateObject16","toastOptions","containerStyle","containerClassName","right","bottom","pointerEvents","onMouseEnter","getPositionStyle","justifyContent","transform","_t","beat","margin","wrapper","backgroundColor","argument","argStr","_date","formatDistanceLocale","lessThanXSeconds","one","xSeconds","halfAMinute","lessThanXMinutes","xMinutes","aboutXHours","xHours","xDays","aboutXWeeks","xWeeks","aboutXMonths","xMonths","aboutXYears","xYears","overXYears","almostXYears","buildFormatLongFn","defaultWidth","formats","formatLong","full","long","medium","short","dateTime","formatRelativeLocale","lastWeek","yesterday","today","tomorrow","nextWeek","buildLocalizeFn","valuesArray","formattingValues","defaultFormattingWidth","argumentCallback","localize","ordinalNumber","dirtyNumber","rem100","era","narrow","abbreviated","wide","quarter","dayPeriod","am","pm","midnight","noon","morning","afternoon","evening","night","buildMatchFn","matchPattern","matchPatterns","defaultMatchWidth","matchResult","matchedString","parsePatterns","defaultParseWidth","predicate","valueCallback","parsePattern","parseResult","enUS","formatDistance","tokenValue","addSuffix","comparison","formatRelative","_baseDate","weekStartsOn","firstWeekContainsDate","getDefaultOptions","pow","millisecondsInWeek","millisecondsInDay","startOfDay","getTimezoneOffsetInMilliseconds","utcDate","UTC","getHours","getMinutes","getSeconds","getMilliseconds","setUTCFullYear","differenceInCalendarDays","dateLeft","dateRight","startOfDayLeft","startOfDayRight","timestampLeft","timestampRight","constructFrom","startOfYear","cleanDate","getDayOfYear","startOfWeek","_options$weekStartsOn","_options$locale","_defaultOptions$local","diff","setDate","startOfISOWeek","getISOWeekYear","fourthOfJanuaryOfNextYear","startOfNextYear","fourthOfJanuaryOfThisYear","startOfThisYear","startOfISOWeekYear","fourthOfJanuary","getISOWeek","getWeekYear","_options$firstWeekCon","firstWeekOfNextYear","firstWeekOfThisYear","startOfWeekYear","firstWeek","getWeek","addLeadingZeros","targetLength","abs","lightFormatters","signedYear","dayPeriodEnumValue","numberOfDigits","milliseconds","dayPeriodEnum","formatters","signedWeekYear","weekYear","isoWeek","dayOfYear","localDayOfWeek","isoDayOfWeek","hours","_localize","timezoneOffset","_originalDate","getTimezoneOffset","formatTimezoneWithOptionalMinutes","formatTimezone","formatTimezoneShort","originalDate","sign","absOffset","minutes","dateLongFormatter","timeLongFormatter","longFormatters","dateTimeLongFormatter","datePattern","timePattern","dateTimeFormat","protectedDayOfYearTokens","protectedWeekYearTokens","throwProtectedError","RangeError","formattingTokensRegExp","longFormattingTokensRegExp","escapedStringRegExp","doubleQuoteRegExp","unescapedLatinCharacterRegExp","formatStr","_options$locale2","_ref5","_ref6","_ref7","_options$locale3","_defaultOptions$local2","defaultLocale","formatterOptions","firstCharacter","longFormatter","matched","cleanEscapedString","formatter","useAdditionalWeekYearTokens","useAdditionalDayOfYearTokens","isProtectedDayOfYearToken","bookingDetail","getStoreTime","times","setTimes","selectedDate","setSelectedDate","filteredTime","setFilteredTime","isToastVisible","setIsToastVisible","setWidth","timesSectionRef","isInitialRender","appointmentDetail","setAppointmentDetail","fetchTimeLoading","setFetchTimeLoading","buttonClicked","encryptionKey","isWebView","AppContext","updateWidth","innerWidth","newDay","fetchTimes","skipScrollAdjustment","fullUrl","containsDevOrMaster","scrollIntoView","behavior","block","newScrollY","scrollY","scrollTo","scrollX","yOffset","pageYOffset","scrollToTimesSection","onTimeHandler","_data$times","post","process","UrlServices","calendar_date","q_","_jsxs","_jsx","Toaster","handleViewMap","mapsUrl","address","city","postcode","country","start_time","end_time","allowFullScreen","_Fragment","BeatLoader","IconSearch","isShowIcon","placeholder","handleChange","handleBlur","Bookinglist","bookingList","setBookingList","filteredBookingList","setFilteredBookingList","loader","setLoader","setSearch","setSelectedStoreDetails","selectedStoreDetails","progressState","setProgressState","toggle","setToggle","selectedBookingPage","setSelectedBookingPage","setDefaultStore","userSettings","isQuoteLocationsEnabled","fetch","json","fetchData","isStoreOpen","endTime","ClipLoader","Input","query","filteredList","toggleBookingDetail","store_id","store_name","BookingDetails","Button","continueButtonWidth","quoteButtonWidth","appointmentButtonWidth","buttonHeight","typeA","submit","setServiceArray","setCurrentState","toggleState","prevState","IconTrash","IssueList","productCartDetail","setProducts","products","setProductCartDetail","currentState","countryDetails","isExpanded","setExpandedId","toggleDescription","prevId","service","services","_s$price","picture","alt","showDescription","item_description","isPricesEnabled","price","currency_symbol","toFixed","_product$sale_price","updatedList","sale_price","retail_price","totalPrice","active","deleteAndUpdatePrice","_id","Cart","_productCartDetail$br2","_productCartDetail$br3","_productCartDetail$br4","_productCartDetail$mo2","_productCartDetail$se","_productCartDetail$to","_productCartDetail$se2","_productCartDetail$to2","_productCartDetail$mo3","_productCartDetail$mo4","_productCartDetail$br5","_productCartDetail$mo5","_productCartDetail$se3","_productCartDetail$to3","_productCartDetail$se4","formdata","setPrevState","setLoading","productCartData","setProductCartData","reactHookFormData","setButtonClicked","defaultStore","setCountryDetails","isMobileOrTablet","setIsMobileOrTablet","isViewOpen","setIsViewOpen","activeKey","setActiveKey","detectMobileOrTablet","screenWidth","toggleModal","fetchCountryDetails","submitForm","clickedKey","_productCartDetail$ca","_productCartDetail$br","_productCartDetail$mo","item","rd_issue_id","formattedTime","device","category","brand","model","device_name","category_id","skipForOthers","isRDSync","rd_category_id","manufacturer_id","rd_manufacturer_id","rd_device_id","issues","customer_name","customer_email","customer_telephone","phone","customer_notes","notes","delivery_option","delivery_status","total_price","config_type","API_BASE_URL","formDataObj","modifiedData","formErrors","modelError","restErors","isQuoteEnabled","isAppointmentEnabled","ClipboardText","ChevronRight","IconCalendar","Completion","_productCartDetail$br6","_model","_model2","_model3","_productCartDetail$se5","allProducts","setFormData","notificationWay","setNotificationWay","othersWorkflow","setOthersWorkflow","m_id","device_id","models","ele","resetStates","sessionStorage","removeItem","manufacturer_name","IconMessage","IconMail","IconPhoneCall","useTooltip","wasTruncated","setWasTruncated","truncatedText","setTruncatedText","showTooltip","setShowTooltip","tooltipPosition","setTooltipPosition","limit","image","truncated","productName","ReactDOM","getElementById","_product$model","_product$model2","api_base_url","filteredProducts","Icon","imageLoaded","setImageLoaded","goWithOthersFlow","isRD","bzy_d","bzy_c","_item$sale_price","getDataFromRD","getModelServices","rect","onTouchStart","onTouchEnd","Tooltip","objectConstructor","normalizeArguments","metadata","_Array$prototype$slic2","_slicedToArray","arg_1","arg_2","arg_3","arg_4","_objectSpread","defaultCountry","MIN_LENGTH_FOR_NSN","MAX_LENGTH_FOR_NSN","MAX_LENGTH_COUNTRY_CODE","VALID_DIGITS","VALID_PUNCTUATION","ParseError","_this","_classCallCheck","_super","setPrototypeOf","_assertThisInitialized","DEFAULT_EXT_PREFIX","CALLING_CODE_REG_EXP","Metadata","countries","typeOf","validateMetadata","setVersion","countryCode","v1","v2","v3","nonGeographic","nonGeographical","getCountryMetadata","callingCode","getCountryCodesForCallingCode","countryCodes","countryCallingCodes","selectNumberingPlan","hasCountry","numberingPlan","NumberingPlan","hasCallingCode","getNumberingPlanMetadata","getCountryCodeForCallingCode","IDDPrefix","defaultIDDPrefix","nationalNumberPattern","possibleLengths","nationalPrefixForParsing","nationalPrefixTransformRule","leadingDigits","hasTypes","_type","ext","country_phone_code_to_countries","country_calling_codes","globalMetadataObject","_getFormats","getDefaultCountryMetadataForRegion","Format","_getNationalPrefixFormattingRule","_nationalPrefixForParsing","nationalPrefix","_getNationalPrefixIsOptionalWhenFormatting","_type2","getType","Type","_format","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","usesNationalPrefix","FIRST_GROUP_ONLY_PREFIX_PATTERN","_typeof","getCountryCallingCode","countryCallingCode","isSupportedCountry","v4","getExtensionDigitsPattern","createExtensionPattern","purpose","possibleSeparatorsBetweenNumberAndExtLabel","possibleCharsAfterExtLabel","optionalExtnSuffix","possibleSeparatorsNumberExtLabelNoComma","MIN_LENGTH_PHONE_NUMBER_PATTERN","VALID_PHONE_NUMBER","VALID_PHONE_NUMBER_START_REG_EXP","VALID_PHONE_NUMBER_WITH_EXTENSION","VALID_PHONE_NUMBER_PATTERN","EXTN_PATTERN","DIGITS","parseDigit","character","parseDigits","_step","_iterator","_createForOfIteratorHelperLoose","digit","parseIncompletePhoneNumber","parsePhoneNumberCharacter","prevParsedCharacters","emitEvent","checkNumberLength","nationalNumber","checkNumberLengthForType","type_info","possible_lengths","mobile_type","mergeArrays","actual_length","minimum_length","isPossibleNumber","matchesEntirely","regular_expression","NON_FIXED_LINE_PHONE_TYPES","getNumberType","isNumberTypeEqualTo","getPossibleCountriesForNumber","possibleCountries","_metadata","couldNationalNumberBelongToCountry","applyInternationalSeparatorStyle","formattedNumber","FIRST_GROUP_PATTERN","formatNationalNumberUsingFormat","useInternationalFormat","withNationalPrefix","carrierCode","internationalFormat","SINGLE_IDD_PREFIX_REG_EXP","DEFAULT_OPTIONS","formatExtension","extension","formatNumber","addExtension","formatNationalNumber","formatRFC3966","fromCountry","fromCountryCallingCode","iddPrefix","countryMetadata","getIddPrefix","formatIDD","formatAs","availableFormats","nationalNnumber","leadingDigitsPatterns","lastLeadingDigitsPattern","chooseFormatForNumber","PhoneNumber","countryOrCountryCallingCode","_getCountryAndCountry","metadataJson","isCountryCode","getCountryAndCountryCallingCode","getMetadata","isNonGeographicCallingCode","isValidNumber","phoneNumber","CAPTURING_DIGIT_PATTERN","stripIddPrefix","IDDPrefixPattern","matchedGroups","extractNationalNumberFromPossiblyIncompleteNumber","prefixPattern","prefixMatch","capturedGroupsCount","hasCapturedGroups","prefixBeforeNationalNumber","possiblePositionOfTheFirstCapturedGroup","extractNationalNumber","_extractNationalNumbe","nationalNumberBefore","nationalNumberAfter","shouldHaveExtractedNationalPrefix","isPossibleIncompleteNationalNumber","extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","possibleShorterNumber","possibleShorterNationalNumber","extractCountryCallingCode","isNumberWithIddPrefix","numberWithoutIDD","_extractCountryCallin","shorterNumber","countryCallingCodeSource","_countryCallingCode","getCountryByNationalNumber","nationalPhoneNumber","matchingCountries","USE_NON_GEOGRAPHIC_COUNTRY_CODE","getCountryByCallingCode","PLUS_SIGN","RFC3966_PHONE_DIGIT_","RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_","RFC3966_DOMAINNAME_PATTERN_","RFC3966_PREFIX_","RFC3966_PHONE_CONTEXT_","RFC3966_ISDN_SUBADDRESS_","extractFormattedPhoneNumberFromPossibleRfc3966NumberUri","numberToParse","phoneNumberString","extractFormattedPhoneNumber","phoneContext","numberToExtractFrom","indexOfPhoneContext","phoneContextStart","phoneContextEnd","extractPhoneContext","isPhoneContextValid","indexOfNationalNumber","indexOfRfc3966Prefix","indexOfIsdn","MAX_INPUT_STRING_LENGTH","PHONE_NUMBER_START_PATTERN","AFTER_PHONE_NUMBER_END_PATTERN","_parseInput","extract","throwOnError","startsAt","_extractFormattedPhoneNumber","isViablePhoneNumber","isViablePhoneNumberStart","withExtensionStripped","numberWithoutExtension","extractExtension","parseInput","formattedPhoneNumber","_parsePhoneNumber","defaultCallingCode","exactCountry","parsePhoneNumber","hasSelectedNumberingPlan","__countryCallingCodeSource","extended","possible","parsePhoneNumberWithError","isValidPhoneNumber","_normalizeArguments","labels","count_occurences","template","should_close_braces","characters_in_template","value_character_index","filled_in_template","retained_template","empty_placeholder","cut_before","dangling_braces","close_braces","Keys","Backspace","Delete","setCaretPosition","caret_position","ANDROID_USER_AGENT_REG_EXP","isAndroid","setSelectionRange","onKeyDown","_parse","on_change","hasAttribute","operation","getOperation","selection","eraseSelection","formatInputText","_parse2","parse_character","focused_input_character_index","caret","newValueAndCaret","edit","formatted","template_formatter","found","possibly_last_input_character_index","InputComponent","inputComponent","_objectWithoutProperties","_excluded","internalRef","setRef","_onChange","_onKeyDown","onInputKeyDown","_extends","isEmptyValue","onCut","onPaste","AsYouTypeState","onCountryChange","onCallingCodeChange","international","missingPlus","digits","resetNationalSignificantNumber","initCountryAndCallingCode","nationalSignificantNumber","getNationalDigits","nationalSignificantNumberMatchesInput","complexPrefixBeforeNationalSignificantNumber","properties","_Object$keys","setCountry","setCallingCode","nextDigits","DIGIT_PLACEHOLDER","DIGIT_PLACEHOLDER_MATCHER","cutAndStripNonPairedParens","cutBeforeIndex","cleared_string","_dangling_braces","stripNonPairedParens","formatCompleteNumber","shouldTryNationalPrefixFormattingRule","getSeparatorAfterNationalPrefix","useNationalPrefixFormattingRule","formatNationalNumberWithAndWithoutNationalPrefixFormattingRule","formattedNationalNumber","isValidFormattedNationalNumber","PatternParser","or","instructions","_this$context$","branches","op","expandSingleElementArray","OPERATOR","operator","before","rightPart","startContext","getContext","endContext","oneOfSet","parseOneOfSet","ILLEGAL_CHARACTER_REGEXP","prevValue","PatternMatcher","matchTree","allowOverflow","_match","matchedChars","characters","tree","characterString","partialMatch","restCharacters","_step2","_iterator2","_char","LONGEST_DUMMY_PHONE_NUMBER","NATIONAL_PREFIX_SEPARATORS_PATTERN","CREATE_CHARACTER_CLASS_PATTERN","CREATE_STANDALONE_DIGIT_PATTERN","NON_ALTERING_FORMAT_REG_EXP","AsYouTypeFormatter","resetFormat","chosenFormat","nationalNumberTemplate","populatedNationalNumberTemplate","populatedNationalNumberTemplatePosition","isNANP","matchingFormats","narrowDownMatchingFormats","canFormatCompleteNumber","formattedCompleteNumber","setNationalNumberTemplate","lastIndexOf","formatNationalNumberWithNextDigits","previouslyChosenFormat","newlyChosenFormat","chooseFormat","formatNextNationalNumberDigits","_this2","leadingDigitsPatternIndex","formatSuits","formatMatches","nationalPrefixIsMandatoryWhenFormattingInNationalFormat","leadingDigitsPatternsCount","leadingDigitsPattern","_this3","_loop","getFormatFormat","createTemplateForFormat","_ret","getTemplateForFormat","spacing","internationalPrefix","getInternationalPrefixBeforeCountryCallingCode","getDigitsWithoutInternationalPrefix","strictPattern","nationalNumberDummyDigits","nationalPrefixIncludedInTemplate","numberFormat","numberFormatWithNationalPrefix","populateTemplateWithDigits","VALID_FORMATTED_PHONE_NUMBER_DIGITS_PART_PATTERN","VALID_FORMATTED_PHONE_NUMBER_PART","AFTER_PHONE_NUMBER_DIGITS_END_PATTERN","COMPLEX_NATIONAL_PREFIX","AsYouTypeParser","onNationalSignificantNumberChange","justLeadingPlus","_extractFormattedDigi","_extractFormattedDigi3","extractedNumber","hasPlus","_extractFormattedDigitsAndPlus","_extractFormattedDigi4","formattedDigits","extractFormattedDigitsAndPlus","_extractFormattedDigi2","startInternationalNumber","inputDigits","hasReceivedThreeLeadingDigits","appendDigits","extractIddPrefix","isWaitingForCountryCallingCode","appendNationalSignificantNumberDigits","hasExtractedNationalSignificantNumber","extractNationalSignificantNumber","stateUpdate","update","_extractCountryCallingCode","couldPossiblyExtractAnotherNationalSignificantNumber","nationalDigits","onExtractedNationalNumber","prevNationalSignificantNumber","_extractNationalNumbe2","nationalSignificantNumberIndex","extractAnotherNationalSignificantNumber","fixMissingPlus","extractCallingCodeAndNationalSignificantNumber","_extractCountryCallin2","newCallingCode","AsYouType","optionsOrDefaultCountry","_this$getCountryAndCa2","getCountryAndCallingCode","_this$parser$input","formattedOutput","determineTheCountryIfNeeded","reExtractNationalSignificantNumber","getFullNumber","getNonFormattedNumber","isInternational","getCallingCode","_getCountry","isCountryCallingCodeAmbiguous","determineTheCountry","prefix","_this$state","getNonFormattedNationalNumberWithPrefix","_this$state2","_this$state3","_callingCode","ambiguousCountries","getNumber","isPossible","getTemplate","getNonFormattedTemplate","getInputValuePrefix","withCountryCallingCode","removeInputValuePrefix","parsePhoneNumberCharacter_","ignoreRest","eventName","useInputKeyDownHandler","BACKSPACE_KEY_CODE","HTMLInputElement","AFTER_LEADING_PLUS_CARET_POSITION","defaultMetadata","InputSmart","_ref$metadata","InputBasic","_ref$inputComponent","formatIncompletePhoneNumber","getRegionalIndicatorSymbol","letter","fromCodePoint","CountrySelect","readOnly","onChange_","getSelectedOption","divider","DIVIDER_STYLE","fontSize","CountrySelectWithIcon","iconComponent","_ref3$arrowComponent","getIconAspectRatio","arrowComponent","Arrow","DefaultArrowComponent","unicodeFlags","_excluded2","selectedOption","FlagComponent","countryName","flagUrl","InternationalIcon","InternationalIcon1x1","InternationalIcon3x2","x1","y1","x2","y2","_excluded3","isCountrySupportedWithError","getSupportedCountries","getCountries","createCountryIconComponent","flagComponent","internationalIcon","CountryIcon","_aspectRatio","DefaultInternationalIcon","Flag","setRefsValue","setRefValue","getInternationalPhoneNumberPrefix","parsePhoneNumber_","getPhoneDigitsForNewCountry","phoneDigits","prevCountry","newCountry","useNationalFormat","countryCallingCodePrefix","country_calling_code","stripCountryCallingCode","newCountryPrefix","e164","asYouType","getNumberValue","partial_national_significant_number","getNationalSignificantNumberDigits","trimNumber","nationalSignificantNumberPart","overflowDigitsCount","getMaxNumberLength","getCountryForPartialE164Number","partialE164Number","derived_country","getCountry","getCountryFromPossiblyIncompleteInternationalPhoneNumber","couldNumberBelongToCountry","convertInternationalPhoneDigitsToNational","formatNational","compareStrings","locales","localeCompare","intlPhoneNumberPrefix","getInitialPhoneDigits","generateNationalNumberDigits","valuesAreEqual","value1","value2","PhoneNumberInput_","_defineProperty","_this$props","focusInputOnCountrySelection","newPhoneDigits","hasUserSelectedACountry","_phoneDigits","_this$props2","addInternationalOption","limitMaxLength","countryCallingCodeEditable","_onPhoneDigitsChange","prevPhoneDigits","countryRequired","getAnyCountry","onPhoneDigitsChange","getFirstSupportedCountry","forceRerender","isFocused","_onFocus","_onBlur","countrySelectProps","_this$props3","_international","_addInternationalOption","displayInitialValueAsLocalNumber","initialValueFormat","_this$props4","_defaultCountry","_countries","preSelectedCountry","getPreSelectedCountry","selectedCountry","prevProps","_this$props5","countryOptionsOrder","useMemoCountrySelectOptions","optionsOnTop","optionsOnBottom","appendTo","sortCountryOptions","countryNames","compareStringsLocales","_compareStrings","countrySelectOptions","ZZ","_getCountrySelectOptions","countryOptions","getSupportedCountryOptions","generator","countrySelectOptionsMemoDependencies","areEqualArrays","countrySelectOptionsMemo","getCountrySelectOptions","_this$props6","autoComplete","numberInputProps","smartCaret","CountrySelectComponent","countrySelectComponent","ContainerComponent","containerComponent","containerComponentProps","onCountryFocus","onCountryBlur","setInputRef","newDefaultCountry","newReset","prevDefaultCountry","prevReset","_getInitialPhoneDigits","parameters","isNewDefaultCountrySupported","noValueHasBeenEnteredByTheUser","parsedCountry","hasUserSelectedACountryUpdate","supportedCountries","getPhoneInputWithCountryStateUpdateFromNewProps","PhoneNumberInput","withDefaultProps","labelsPropType","metadataPropType","createPhoneInput","PhoneInputDefault","_ref$labels","defaultLabels","PhoneInput","_arguments","ContactDeatils","_errors$model","_errors$name","_errors$phone","_errors$email","setErrors","isButtonClicked","menuOption","setMenuOption","updateStatus","selectedItem","restoreOptionField","storedMenuOption","getItem","updatedMenuOption","handleBeforeUnload","serializableMenuOption","setItem","updateFields","FormInput","country_code","Card","load","ProductList","setAllProducts","currentModelsServices","setCurrentModelsServices","setIsMissedItem","allServices","setAllServices","setUserSettings","allServicesForSubId","setAllServicesForSubId","widthProductSection","setWidthProductSection","searchProducts","setSearchProducts","updateWidthProductSection","productSection","offsetWidth","newCategories","user_data","brands","isFavorite","filteredData","flat","default_data","settings","currentIndex","filteredServices","newItem","getFilteredProducts","displayedProducts","showOther","DEFAULT_BREAKPOINTS","DEFAULT_MIN_BREAKPOINT","ThemeContext","prefixes","breakpoints","minBreakpoint","useBootstrapPrefix","defaultPrefix","ROUND_PRECISION","getPercentage","percentage","renderProgressBar","visuallyHidden","striped","animated","variant","bsPrefix","ProgressBar","isChild","wrapperProps","errorToString","regExpToString","symbolToString","SYMBOL_REGEXP","printSimpleValue","quoteStrings","printNumber","printValue","_Symbol$toStringTag","strReg","ValidationError","formatError","isError","errorOrErrors","disableStack","super","innerErrors","mixed","defined","notNull","notOneOf","notType","originalValue","castMsg","uuid","lowercase","uppercase","lessThan","moreThan","positive","negative","integer","noUnknown","tuple","spec","typeLen","isSchema","__isYupSchema__","Condition","fromOptions","otherwise","check","_branch","branch","builder","parent","Reference","isContext","isSibling","cast","describe","__isYupRef","isAbsent","createValidation","panic","skipAbsent","disableStackTrace","createError","overrides","_overrides$disableSta","nextParams","ctx","handleResult","validOrError","handleError","sync","OPTIONS","getIn","lastPart","lastPartDebug","_part","isTuple","innerType","parentPath","ReferenceSet","resolveAll","clone","newItems","removeItems","seen","Schema","tests","transforms","conditions","_mutate","internalTests","_whitelist","_blacklist","exclusiveTests","_typeCheck","withMutation","typeError","strip","strict","recursive","nullable","optional","coerce","nonNullable","combined","mergedSpec","isType","prevSchema","resolveOptions","_options$strict","_options$abortEarly","_options$recursive","_options$disableStack","resolvedSchema","allowOptionality","assert","_cast","formattedValue","formattedResult","getDefault","_validate","initialTests","runTests","initialErrors","runOptions","fired","panicOnce","nextOnce","nestedErrors","asNestedTest","originalParent","isIndex","testOptions","_options$disableStack2","validated","validateSync","_options$disableStack3","isValidSync","_getDefault","def","isStrict","nullability","optionality","notRequired","isExclusive","exclusive","when","dep","enums","whiteList","valids","resolved","blacklist","invalids","list","alias","rEmail","rUrl","rUUID","isTrimmed","objStringTag","create$6","StringSchema","_raw","strValue","regex","excludeEmptyString","ensure","isoReg","toNumber","invalidDate","create$4","DateSchema","regexResult","struct","second","millisecond","plusMinus","hourOffset","minuteOffset","totalMinutesOffset","parseIsoDate","INVALID_DATE","prepareParam","_err$path","sortByKeyOrder","parseJson","deepPartial","partial","fieldSchema","setFields","nextArray","defaultSort","create$3","ObjectSchema","_sortErrors","_nodes","_excludedEdges","_options$stripUnknown","stripUnknown","intermediateValue","innerOptions","__validating","isChanged","exists","fieldSpec","objectErrors","fieldErrors","nextFields","schemaOrRef","dft","_innerOptions","excludedEdges","excludes","addNode","depPath","reverse","sortFields","additions","pick","picked","omit","remaining","fromGetter","newObj","deepHas","noAllow","unknownKeys","known","unknown","allow","transformKeys","constantCase","_innerOptions2","yup","_isValidPhoneNumber","AppManager","_formControl","useForm","yupResolver","isMissedItem","setEncryptionKey","setReactHookFormData","setHeight","innerHeight","buttonLoader","setButtonLoader","setIsDisabled","isMobView","setIsMobView","setIsWebView","setIsButtonClicked","productSectionRef","formErrorss","isFormValid","isModelRequired","detectMobView","detectWebView","updateDimensions","resetContactDetailFields","saveState","updatedState","getData","targetObject","propertiesLength","URL","frameId","encrypted","onPerfEntry","getCLS","getFID","getFCP","getLCP","getTTFB","App","reportWebVitals"],"sourceRoot":""}