{"version":3,"sources":["../source/PhoneInputWithCountry.js"],"names":["PhoneNumberInput_","props","React","createRef","country","metadata","newCountry","international","onChange","state","prevParsedInput","parsedInput","prevCountry","newParsedInput","newValue","getInputRef","current","focus","setState","hasUserSelectedACountry","value","_input","defaultCountry","addInternationalOption","limitMaxLength","countries","input","isFocused","event","_onFocus","onFocus","onBlur","_onBlur","countrySelectProps","labels","countryOptionsOrder","isCountrySupportedWithError","undefined","phoneNumber","CountryIcon","generateInitialParsedInput","onCountryChange","selectedCountry","prevProps","prevState","inputRef","name","disabled","autoComplete","style","className","inputComponent","numberInputProps","smartCaret","CountrySelectComponent","countrySelectComponent","ContainerComponent","containerComponent","flags","flagComponent","flagUrl","internationalIcon","displayInitialValueAsLocalNumber","reset","rest","InputComponent","InputSmart","InputBasic","countrySelectOptions","useMemoCountrySelectOptions","onCountryFocus","onCountryBlur","prevDefaultCountry","prevValue","prevReset","newDefaultCountry","newReset","newState","parsedCountry","indexOf","PureComponent","PhoneNumberInput","forwardRef","ref","propTypes","PropTypes","string","func","isRequired","onKeyDown","bool","arrayOf","labelsPropType","objectOf","elementType","object","metadataPropType","defaultProps","Flag","InternationalIcon","any","countrySelectOptionsMemo","countrySelectOptionsMemoDependencies","generator","dependencies","areEqualArrays","a","b","length","i"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;AAQA;;AAEA;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYMA,iB;;;;;AAGL,6BAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AAClB,2FAAMA,KAAN;;AADkB,+DAFRC,kBAAMC,SAAN,EAEQ;;AAAA,kFAoGW,UAACC,OAAD,EAAa;AAAA,UAClCC,QADkC,GACrB,MAAKJ,KADgB,CAClCI,QADkC;AAE1C,aAAO,6CAA4BD,OAA5B,EAAqCC,QAArC,CAAP;AACA,KAvGkB;;AAAA,sEA0GD,UAACC,UAAD,EAAgB;AAAA,wBAK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ACA;AACA;AACA;AACA,MAAIA,gCAAgC,IAAIxB,WAApC,IAAmDA,WAAW,CAAClC,OAAnE,EAA4E;AAC3E,WAAO,qDAA6BkC,WAA7B,CAAP;AACA;;AACD,SAAO,8CAAsBlB,KAAtB,EAA6BE,cAA7B,EAA6Cf,aAA7C,EAA4DF,QAA5D,CAAP;AACA;;AAED,IAAIgG,wBAAJ;AACA,IAAIC,oCAAJ;;AACA,SAASjC,2BAAT,CAAqCkC,SAArC,EAAgDC,YAAhD,EAA8D;AAC7D,MAAI,CAACF,oCAAD,IACH,CAACG,cAAc,CAACD,YAAD,EAAeF,oCAAf,CADhB,EACsE;AACrED,IAAAA,wBAAwB,GAAGE,SAAS,EAApC;AACAD,IAAAA,oCAAoC,GAAGE,YAAvC;AACA;;AACD,SAAOH,wBAAP;AACA;;AAED,SAASI,cAAT,CAAwBC,CAAxB,EAA2BC,CAA3B,EAA8B;AAC7B,MAAID,CAAC,CAACE,MAAF,KAAaD,CAAC,CAACC,MAAnB,EAA2B;AAC1B,WAAO,KAAP;AACA;;AACD,MAAIC,CAAC,GAAG,CAAR;;AACA,SAAOA,CAAC,GAAGH,CAAC,CAACE,MAAb,EAAqB;AACpB,QAAIF,CAAC,CAACG,CAAD,CAAD,KAASF,CAAC,CAACE,CAAD,CAAd,EAAmB;AAClB,aAAO,KAAP;AACA;;AACDA,IAAAA,CAAC;AACD;;AACD,SAAO,IAAP;AACA","sourcesContent":["import React from 'react'\r\nimport PropTypes from 'prop-types'\r\nimport classNames from 'classnames'\r\n\r\nimport InputSmart from './InputSmart'\r\nimport InputBasic from './InputBasic'\r\n\r\nimport Flag from './Flag'\r\nimport InternationalIcon from './InternationalIcon'\r\n\r\nimport {\r\n\tsortCountryOptions,\r\n\tisCountrySupportedWithError,\r\n\tgetSupportedCountries,\r\n\tgetSupportedCountryOptions,\r\n\tgetCountries\r\n} from './countries'\r\n\r\nimport { createCountryIconComponent } from './CountryIcon'\r\n\r\nimport {\r\n\tmetadata as metadataPropType,\r\n\tlabels as labelsPropType\r\n} from './PropTypes'\r\n\r\nimport {\r\n\tgetPreSelectedCountry,\r\n\tgetCountrySelectOptions,\r\n\tparsePhoneNumber,\r\n\tgenerateNationalNumberDigits,\r\n\tmigrateParsedInputForNewCountry,\r\n\tgetCountryForPartialE164Number,\r\n\tgetInitialParsedInput,\r\n\tparseInput,\r\n\te164\r\n} from './phoneInputHelpers'\r\n\r\nclass PhoneNumberInput_ extends React.PureComponent {\r\n\tinputRef = React.createRef()\r\n\r\n\tconstructor(props) {\r\n\t\tsuper(props)\r\n\r\n\t\tconst {\r\n\t\t\tvalue,\r\n\t\t\tlabels,\r\n\t\t\taddInternationalOption,\r\n\t\t\tmetadata,\r\n\t\t\tcountryOptionsOrder\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\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: getPreSelectedCountry(\r\n\t\t\t\tphoneNumber,\r\n\t\t\t\tdefaultCountry,\r\n\t\t\t\tcountries || getCountries(metadata),\r\n\t\t\t\taddInternationalOption,\r\n\t\t\t\tmetadata\r\n\t\t\t),\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// `parsedInput` 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 `parsedInput` is `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 `parsedInput` is `+78005553535`.\r\n\t\t\tparsedInput: generateInitialParsedInput(value, phoneNumber, this.props),\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 `parsedInput` 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 `parsedInput` 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// 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} = this.props\r\n\r\n\t\tconst {\r\n\t\t\tparsedInput: prevParsedInput,\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 newParsedInput = migrateParsedInputForNewCountry(\r\n\t\t\tprevParsedInput,\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\tinternational ? false : true\r\n\t\t)\r\n\r\n\t\tconst newValue = e164(newParsedInput, newCountry, metadata)\r\n\r\n\t\t// Focus phone number `` upon country selection.\r\n\t\tthis.getInputRef().current.focus()\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\tparsedInput: newParsedInput,\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 = (_input) => {\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\tmetadata\r\n\t\t} = this.props\r\n\r\n\t\tconst {\r\n\t\t\tinput,\r\n\t\t\tcountry,\r\n\t\t\tvalue\r\n\t\t} = parseInput(\r\n\t\t\t_input,\r\n\t\t\tthis.state.parsedInput,\r\n\t\t\tthis.state.country,\r\n\t\t\tdefaultCountry,\r\n\t\t\tthis.state.countries,\r\n\t\t\taddInternationalOption,\r\n\t\t\tinternational,\r\n\t\t\tlimitMaxLength,\r\n\t\t\tmetadata\r\n\t\t)\r\n\r\n\t\tthis.setState({\r\n\t\t\tparsedInput: input,\r\n\t\t\tvalue,\r\n\t\t\tcountry\r\n\t\t},\r\n\t\t// Update the new `value` property.\r\n\t\t// Doing it after the `state` has been updated\r\n\t\t// because `onChange()` will trigger `getDerivedStateFromProps()`\r\n\t\t// with the new `value` which will be compared to `state.value` there.\r\n\t\t() => onChange(value))\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\tgetInputRef() {\r\n\t\tconst { inputRef } = this.props\r\n\t\treturn inputRef || this.inputRef\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// * `parsedInput` — 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\tconst {\r\n\t\t\tcountry,\r\n\t\t\thasUserSelectedACountry,\r\n\t\t\tvalue,\r\n\t\t\tprops: {\r\n\t\t\t\tdefaultCountry: prevDefaultCountry,\r\n\t\t\t\tvalue: prevValue,\r\n\t\t\t\treset: prevReset\r\n\t\t\t}\r\n\t\t} = state\r\n\r\n\t\tconst {\r\n\t\t\tmetadata,\r\n\t\t\tcountries,\r\n\t\t\tdefaultCountry: newDefaultCountry,\r\n\t\t\tvalue: newValue,\r\n\t\t\treset: newReset,\r\n\t\t\tinternational\r\n\t\t} = props\r\n\r\n\t\tconst newState = {\r\n\t\t\t// Emulate `prevProps` via `state.props`.\r\n\t\t\tprops,\r\n\t\t\t// If the user has already manually selected a country\r\n\t\t\t// then don't override that already selected country\r\n\t\t\t// if the `defaultCountry` property changes.\r\n\t\t\t// That's what `hasUserSelectedACountry` flag is for.\r\n\t\t\thasUserSelectedACountry\r\n\t\t}\r\n\r\n\t\t// Some users requested a way to reset the component\r\n\t\t// (both number `` and country ``).\r\n\t\t// Whenever `reset` property changes both number ``\r\n\t\t// and country `` are reset.\r\n\t\t// It's not implemented as some instance `.reset()` method\r\n\t\t// because `ref` is forwarded to ``.\r\n\t\t// It's also not replaced with just resetting `country` on\r\n\t\t// external `value` reset, because a user could select a country\r\n\t\t// and then not input any `value`, and so the selected country\r\n\t\t// would be \"stuck\", if not using this `reset` property.\r\n\t\t// https://github.com/catamphetamine/react-phone-number-input/issues/300\r\n\t\tif (newReset !== prevReset) {\r\n\t\t\treturn {\r\n\t\t\t\t...newState,\r\n\t\t\t\tparsedInput: undefined,\r\n\t\t\t\tvalue: undefined,\r\n\t\t\t\tcountry: newDefaultCountry,\r\n\t\t\t\thasUserSelectedACountry: undefined\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// If the default country changed.\r\n\t\t// (e.g. in case of ajax GeoIP detection after page loaded)\r\n\t\t// then select it but only if the user hasn't already manually\r\n\t\t// selected a country and no phone number has been entered so far.\r\n\t\t// Because if the user has already started inputting a phone number\r\n\t\t// then he's okay with no country being selected at all (\"International\")\r\n\t\t// and doesn't want to be disturbed, doesn't want his input to be screwed, etc.\r\n\t\tif (newDefaultCountry !== prevDefaultCountry &&\r\n\t\t\t!hasUserSelectedACountry && (\r\n\t\t\t\t(!value && !newValue) ||\r\n\t\t\t\t(international &&\r\n\t\t\t\t\tvalue === getInitialParsedInput(undefined, prevDefaultCountry, international, metadata) &&\r\n\t\t\t\t\tvalue === getInitialParsedInput(undefined, newDefaultCountry, international, metadata)\r\n\t\t\t\t)\r\n\t\t\t)\r\n\t\t) {\r\n\t\t\treturn {\r\n\t\t\t\t...newState,\r\n\t\t\t\tcountry: isCountrySupportedWithError(newDefaultCountry, metadata) ? newDefaultCountry : prevDefaultCountry,\r\n\t\t\t\t// If `parsedInput` is empty, then automatically select the new `country`\r\n\t\t\t\t// and set `parsedInput` to `+{getCountryCallingCode(newCountry)}`.\r\n\t\t\t\tparsedInput: generateInitialParsedInput(newValue, undefined, props)\r\n\t\t\t\t// `value` is `undefined`.\r\n\t\t\t\t// `parsedInput` is `undefined` because `value` is `undefined`.\r\n\t\t\t}\r\n\t\t}\r\n\t\t// If a new `value` is set externally.\r\n\t\t// (e.g. as a result of an ajax API request\r\n\t\t// to get user's phone after page loaded)\r\n\t\t// The first part — `newValue !== prevValue` —\r\n\t\t// is basically `props.value !== prevProps.value`\r\n\t\t// so it means \"if value property was changed externally\".\r\n\t\t// The second part — `newValue !== value` —\r\n\t\t// is for ignoring the `getDerivedStateFromProps()` call\r\n\t\t// which happens in `this.onChange()` right after `this.setState()`.\r\n\t\t// If this `getDerivedStateFromProps()` call isn't ignored\r\n\t\t// then the country flag would reset on each input.\r\n\t\telse if (newValue !== prevValue && newValue !== value) {\r\n\t\t\tconst phoneNumber = parsePhoneNumber(newValue, metadata)\r\n\t\t\tlet parsedCountry\r\n\t\t\tif (phoneNumber) {\r\n\t\t\t\tconst countries = getSupportedCountries(props.countries, metadata)\r\n\t\t\t\tif (!countries || countries.indexOf(phoneNumber.country) >= 0) {\r\n\t\t\t\t\tparsedCountry = phoneNumber.country\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!newValue) {\r\n\t\t\t\tnewState.hasUserSelectedACountry = undefined\r\n\t\t\t}\r\n\t\t\treturn {\r\n\t\t\t\t...newState,\r\n\t\t\t\tparsedInput: generateInitialParsedInput(newValue, phoneNumber, props),\r\n\t\t\t\tvalue: newValue,\r\n\t\t\t\tcountry: newValue ? parsedCountry : newDefaultCountry\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// `defaultCountry` didn't change.\r\n\t\t// `value` didn't change.\r\n\t\t// `parsedInput` didn't change, because `value` didn't change.\r\n\t\t//\r\n\t\t// So no need to update state here really.\r\n\t\t// Could as well return `null` explicitly\r\n\t\t// to indicate that the `state` hasn't changed.\r\n\t\t// But just in case, returns `newState`.\r\n\t\t// (who knows if someone adds something\r\n\t\t// changing `newState` above in some future)\r\n\t\treturn newState\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\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\r\n\t\t\t// Get \"rest\" properties (passed through to number ``).\r\n\t\t\tdefaultCountry,\r\n\t\t\tcountries,\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\tdisplayInitialValueAsLocalNumber,\r\n\t\t\tonCountryChange,\r\n\t\t\tlimitMaxLength,\r\n\t\t\treset,\r\n\t\t\tmetadata,\r\n\t\t\tinternational,\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\tparsedInput,\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 = useMemoCountrySelectOptions(() => {\r\n\t\t\treturn sortCountryOptions(\r\n\t\t\t\tgetCountrySelectOptions(\r\n\t\t\t\t\tcountries || getCountries(metadata),\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\taddInternationalOption\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\r\n\t\treturn (\r\n\t\t\t