{"version":3,"file":"PhoneInput.cjs","names":["factory","useProps","useStyles","useResolvedStylesApi","useRef","useMergedRef","useMemo","getCountries","ALL_COUNTRIES","useCallback","parsePhoneValue","guessCountry","useState","useUncontrolled","formatPhoneNumber","useCombobox","matchesAreaCode","getDigits","getMaskDigitCount","buildRawValue","clampToMask","computeCursorPosition","filterCountries","Combobox","InputBase","UnstyledButton","ScrollArea","CountryOptionContent","classes"],"sources":["../../../src/components/PhoneInput/PhoneInput.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useMergedRef, useUncontrolled } from '@mantine/hooks';\nimport {\n  BoxProps,\n  ElementProps,\n  Factory,\n  factory,\n  StylesApiProps,\n  useProps,\n  useResolvedStylesApi,\n  useStyles,\n} from '../../core';\nimport { Combobox, ComboboxProps, useCombobox } from '../Combobox';\nimport { __BaseInputProps, __InputStylesNames, InputVariant } from '../Input';\nimport { InputBase } from '../InputBase';\nimport { ScrollArea } from '../ScrollArea';\nimport { UnstyledButton } from '../UnstyledButton';\nimport { buildRawValue } from './build-raw-value/build-raw-value';\nimport { computeCursorPosition } from './compute-cursor-position/compute-cursor-position';\nimport { CountryOptionContent } from './CountryOptionContent';\nimport {\n  clampToMask,\n  formatPhoneNumber,\n  getMaskDigitCount,\n} from './format-phone-number/format-phone-number';\nimport { filterCountries, getCountries } from './get-countries/get-countries';\nimport { getDigits } from './get-digits/get-digits';\nimport { guessCountry, matchesAreaCode } from './guess-country/guess-country';\nimport { parsePhoneValue } from './parse-phone-value/parse-phone-value';\nimport { ALL_COUNTRIES, PhoneInputCountryData } from './phone-data';\nimport classes from './PhoneInput.module.css';\n\nexport type PhoneInputStylesNames =\n  | __InputStylesNames\n  | 'countryButton'\n  | 'countryButtonFlag'\n  | 'countryButtonCode'\n  | 'dropdown'\n  | 'search'\n  | 'countryOption'\n  | 'optionDialCode'\n  | 'optionName'\n  | 'divider';\n\nexport interface PhoneInputChangeDetails {\n  /** Formatted display string, e.g. \"+1 (202) 555-1234\" */\n  formattedValue: string;\n  /** Country data for the currently selected country, null when no country is selected */\n  country: PhoneInputCountryData | null;\n  /** Extension digits when `withExtension` is enabled, empty string when no extension is entered */\n  extension?: string;\n}\n\nexport interface PhoneInputProps\n  extends\n    BoxProps,\n    __BaseInputProps,\n    StylesApiProps<PhoneInputFactory>,\n    ElementProps<'input', 'onChange' | 'size' | 'value' | 'defaultValue'> {\n  /** Controlled value — raw digits with + prefix, e.g. \"+12025551234\", with an optional \"x1234\" suffix when `withExtension` is enabled */\n  value?: string;\n\n  /** Uncontrolled default value */\n  defaultValue?: string;\n\n  /** Called when value changes */\n  onChange?: (rawValue: string, details: PhoneInputChangeDetails) => void;\n\n  /** Default country ISO2 code, e.g. \"us\" */\n  defaultCountry?: string;\n\n  /** Countries pinned to top of dropdown with separator, ISO2 codes */\n  preferredCountries?: string[];\n\n  /** Only show these countries, ISO2 codes */\n  onlyCountries?: string[];\n\n  /** Hide these countries, ISO2 codes */\n  excludeCountries?: string[];\n\n  /** Called when selected country changes */\n  onCountryChange?: (country: PhoneInputCountryData) => void;\n\n  /** Selects a country by ISO2 code when multiple countries share the detected dial code; return undefined to use the default area-code and priority detection */\n  resolveCountry?: (rawValue: string, countries: PhoneInputCountryData[]) => string | undefined;\n\n  /** Enable search in country dropdown @default true */\n  searchable?: boolean;\n\n  /** Show +dialCode in input @default true */\n  international?: boolean;\n\n  /** Allow a phone extension separated by \"x\", e.g. \"+12025551234x1234\" @default false */\n  withExtension?: boolean;\n\n  /** Auto-detect country from typed dial code digits @default false */\n  withCountryAutoDetect?: boolean;\n\n  /** Handling of national trunk prefixes: 'auto' preserves ambiguous typed digits, 'strip' removes a typed prefix, 'preserve' disables prefix removal (the mask still applies) @default 'auto' */\n  nationalPrefixBehavior?: 'auto' | 'strip' | 'preserve';\n\n  /** Custom flag renderer for country selector button and dropdown options, receives null when no country is selected */\n  renderFlag?: (country: PhoneInputCountryData | null) => React.ReactNode;\n\n  /** Custom renderer for country dropdown options */\n  renderCountryOption?: (country: PhoneInputCountryData) => React.ReactNode;\n\n  /** Maximum dropdown height in px @default 250 */\n  maxDropdownHeight?: number | string;\n\n  /** Controlled dropdown opened state */\n  dropdownOpened?: boolean;\n\n  /** Props passed down to the underlying Combobox component */\n  comboboxProps?: ComboboxProps;\n\n  /** Called when dropdown opens */\n  onDropdownOpen?: () => void;\n\n  /** Called when dropdown closes */\n  onDropdownClose?: () => void;\n\n  /** Display chevron in the country button @default false */\n  withChevron?: boolean;\n\n  /** Message displayed when no countries match the search query */\n  nothingFoundMessage?: React.ReactNode;\n\n  /** Placeholder of the search input in the dropdown @default 'Search countries' */\n  searchPlaceholder?: string;\n\n  /** `aria-label` of the country button when no country is selected @default 'Select country' */\n  selectCountryLabel?: string;\n\n  /** Returns a localized country name, used as the country button `aria-label` and matched in search in addition to the English name */\n  getCountryLabel?: (country: PhoneInputCountryData) => string;\n}\n\nexport type PhoneInputFactory = Factory<{\n  props: PhoneInputProps;\n  ref: HTMLInputElement;\n  stylesNames: PhoneInputStylesNames;\n  variant: InputVariant;\n}>;\n\nconst leftSectionWidth: Record<string, number> = {\n  xs: 42,\n  sm: 42,\n  md: 50,\n  lg: 54,\n  xl: 58,\n};\n\nconst defaultProps = {\n  size: 'sm',\n  searchable: true,\n  international: true,\n  nationalPrefixBehavior: 'auto',\n  maxDropdownHeight: 250,\n  searchPlaceholder: 'Search countries',\n  selectCountryLabel: 'Select country',\n} satisfies Partial<PhoneInputProps>;\n\nexport const PhoneInput = factory<PhoneInputFactory>((_props) => {\n  const props = useProps('PhoneInput', defaultProps, _props);\n  const {\n    classNames,\n    styles,\n    unstyled,\n    vars,\n    value,\n    defaultValue,\n    onChange,\n    defaultCountry,\n    preferredCountries,\n    onlyCountries,\n    excludeCountries,\n    onCountryChange,\n    resolveCountry,\n    searchable,\n    international,\n    withExtension,\n    withCountryAutoDetect,\n    nationalPrefixBehavior,\n    renderFlag,\n    renderCountryOption,\n    readOnly,\n    disabled,\n    size,\n    error,\n    attributes,\n    maxDropdownHeight,\n    dropdownOpened,\n    comboboxProps,\n    onDropdownOpen,\n    onDropdownClose,\n    withChevron,\n    nothingFoundMessage,\n    searchPlaceholder,\n    selectCountryLabel,\n    getCountryLabel,\n    autoComplete,\n    onKeyDown,\n    ref,\n    ...others\n  } = props;\n\n  const getStyles = useStyles<PhoneInputFactory>({\n    name: 'PhoneInput',\n    props,\n    classes,\n    classNames,\n    styles,\n    unstyled,\n  });\n\n  const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<PhoneInputFactory>({\n    classNames,\n    styles,\n    props,\n  });\n\n  const internalRef = useRef<HTMLInputElement>(null);\n  const inputRef = useMergedRef(ref, internalRef);\n  const countryLockedRef = useRef(false);\n  const nationalPrefixConsumedRef = useRef(false);\n  const userEnteredDialCodeRef = useRef(false);\n  const lastEmittedValueRef = useRef<string | undefined>(undefined);\n  const lastEmittedResolverRef = useRef(resolveCountry);\n  const lastEmittedDetectedCountryRef = useRef<string | undefined>(undefined);\n\n  const { countries: filteredCountries, preferredList } = useMemo(\n    () =>\n      getCountries(ALL_COUNTRIES, {\n        onlyCountries,\n        excludeCountries,\n        preferredCountries,\n      }),\n    [onlyCountries, excludeCountries, preferredCountries]\n  );\n\n  const findCountryByIso2 = useCallback(\n    (iso2: string) => filteredCountries.find((c) => c.iso2 === iso2.toLowerCase()),\n    [filteredCountries]\n  );\n\n  const detectCountry = useCallback(\n    (rawValue: string) => {\n      const { phoneNumber } = parsePhoneValue(rawValue, withExtension);\n      const detected = guessCountry(phoneNumber, filteredCountries);\n      if (!detected || !resolveCountry) {\n        return { country: detected, resolvedByCallback: false };\n      }\n\n      const candidates = filteredCountries.filter(\n        (country) => country.dialCode === detected.dialCode\n      );\n      if (candidates.length < 2) {\n        return { country: detected, resolvedByCallback: false };\n      }\n\n      const iso2 = resolveCountry(phoneNumber, candidates);\n      const resolved = candidates.find((country) => country.iso2 === iso2?.toLowerCase());\n      return { country: resolved ?? detected, resolvedByCallback: !!resolved };\n    },\n    [filteredCountries, resolveCountry, withExtension]\n  );\n\n  const initialValue = value ?? defaultValue;\n  const initialDetection = initialValue ? detectCountry(initialValue) : undefined;\n  const inferredFromValue = initialDetection?.country;\n  const defaultCountryData = defaultCountry ? findCountryByIso2(defaultCountry) : undefined;\n  const initialCountry = inferredFromValue || defaultCountryData || null;\n\n  const [selectedCountry, setSelectedCountry] = useState<PhoneInputCountryData | null>(\n    initialCountry\n  );\n  const countryResolvedByCallbackRef = useRef(initialDetection?.resolvedByCallback ?? false);\n  const [search, setSearch] = useState('');\n  const [activeOptionId, setActiveOptionId] = useState<string | null>(null);\n\n  const [_value, setValue] = useUncontrolled({\n    value,\n    defaultValue,\n    finalValue: initialCountry && international ? `+${initialCountry.dialCode}` : '',\n    onChange: () => {},\n  });\n  const { phoneNumber: phoneValue, extension } = parsePhoneValue(_value, withExtension);\n\n  const formatValue = (rawValue: string, country: PhoneInputCountryData | null) => {\n    const { phoneNumber, extension: phoneExtension } = parsePhoneValue(rawValue, withExtension);\n    const formatted =\n      phoneNumber === '+' ? '+' : country ? formatPhoneNumber(phoneNumber, country) : phoneNumber;\n    return phoneExtension === undefined ? formatted : `${formatted.trimEnd()} x${phoneExtension}`;\n  };\n\n  const combobox = useCombobox({\n    opened: dropdownOpened,\n    onDropdownOpen: () => {\n      if (searchable) {\n        combobox.focusSearchInput();\n      } else {\n        combobox.focusTarget();\n      }\n      onDropdownOpen?.();\n    },\n    onDropdownClose: () => {\n      setSearch('');\n      setActiveOptionId(null);\n      onDropdownClose?.();\n    },\n  });\n\n  const isDetectedCountryDifferent = (\n    detected: PhoneInputCountryData,\n    current: PhoneInputCountryData | null,\n    rawValue: string,\n    resolvedByCallback = false\n  ) =>\n    detected.iso2 !== current?.iso2 &&\n    (detected.dialCode !== current?.dialCode ||\n      matchesAreaCode(detected, parsePhoneValue(rawValue, withExtension).phoneNumber) ||\n      resolvedByCallback ||\n      countryResolvedByCallbackRef.current);\n\n  useEffect(() => {\n    if (value !== undefined && value !== lastEmittedValueRef.current) {\n      userEnteredDialCodeRef.current = false;\n      nationalPrefixConsumedRef.current = false;\n    }\n\n    const isOwnEcho =\n      value !== undefined &&\n      value === lastEmittedValueRef.current &&\n      (countryLockedRef.current ||\n        resolveCountry === lastEmittedResolverRef.current ||\n        detectCountry(value).country?.iso2 === lastEmittedDetectedCountryRef.current);\n    const { country: detected, resolvedByCallback } =\n      value && !isOwnEcho\n        ? detectCountry(value)\n        : { country: undefined, resolvedByCallback: false };\n\n    if (detected) {\n      if (isDetectedCountryDifferent(detected, selectedCountry, value ?? '', resolvedByCallback)) {\n        countryResolvedByCallbackRef.current = resolvedByCallback;\n        setSelectedCountry(detected);\n        onCountryChange?.(detected);\n      } else if (detected.iso2 === selectedCountry?.iso2) {\n        countryResolvedByCallbackRef.current = resolvedByCallback;\n      }\n      return;\n    }\n\n    if (selectedCountry && !filteredCountries.find((c) => c.iso2 === selectedCountry.iso2)) {\n      const fallback = filteredCountries[0] || null;\n      countryResolvedByCallbackRef.current = false;\n      setSelectedCountry(fallback);\n      if (fallback) {\n        onCountryChange?.(fallback);\n      }\n    }\n  }, [value, filteredCountries, detectCountry]);\n\n  useEffect(() => {\n    if (combobox.dropdownOpened) {\n      combobox.selectFirstOption();\n    }\n  }, [search]);\n\n  const toDisplayValue = (formatted: string, country: PhoneInputCountryData | null) =>\n    international || !country ? formatted : formatted.replace(`+${country.dialCode} `, '');\n\n  const focusInputAfterDialCode = useCallback(\n    (country: PhoneInputCountryData, rawValue: string) => {\n      requestAnimationFrame(() => {\n        const input = internalRef.current;\n        if (!input) {\n          return;\n        }\n        input.focus();\n        if (!international) {\n          input.setSelectionRange(0, 0);\n          return;\n        }\n        const formatted = formatPhoneNumber(rawValue, country);\n        const dialCodePrefix = `+${country.dialCode} `;\n        const cursorPos = formatted.startsWith(dialCodePrefix)\n          ? dialCodePrefix.length\n          : formatted.length;\n        input.setSelectionRange(cursorPos, cursorPos);\n      });\n    },\n    [international]\n  );\n\n  const emitChange = (rawValue: string, details: PhoneInputChangeDetails) => {\n    lastEmittedValueRef.current = rawValue;\n    lastEmittedResolverRef.current = resolveCountry;\n    lastEmittedDetectedCountryRef.current = detectCountry(rawValue).country?.iso2;\n    setValue(rawValue);\n    onChange?.(\n      rawValue,\n      withExtension\n        ? { ...details, extension: parsePhoneValue(rawValue, true).extension ?? '' }\n        : details\n    );\n  };\n\n  const handleValueChange = (rawValue: string, country: PhoneInputCountryData | null) => {\n    const formattedValue = formatValue(rawValue, country);\n    emitChange(rawValue, { formattedValue, country });\n  };\n\n  const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n    const input = event.currentTarget;\n    const restartIndex = Math.max(input.value.lastIndexOf('+'), 0);\n    const inputValue = input.value.slice(restartIndex);\n    const { phoneNumber: inputNumber, extension: inputExtension } = parsePhoneValue(\n      inputValue,\n      withExtension\n    );\n    const cursorPos = Math.max((input.selectionStart ?? input.value.length) - restartIndex, 0);\n    const digitsOnly = getDigits(inputNumber).replace(/^\\+/, '');\n    const hasPlus = inputNumber.includes('+');\n    const autoDetectEnabled = withCountryAutoDetect || !selectedCountry;\n    const canAutoDetect = autoDetectEnabled && !countryLockedRef.current;\n\n    if (!digitsOnly) {\n      nationalPrefixConsumedRef.current = false;\n      userEnteredDialCodeRef.current = hasPlus;\n      if (withCountryAutoDetect || !selectedCountry) {\n        countryLockedRef.current = false;\n      }\n\n      if (hasPlus) {\n        emitChange('+', { formattedValue: '+', country: selectedCountry });\n        requestAnimationFrame(() => {\n          input.setSelectionRange(1, 1);\n        });\n      } else {\n        handleValueChange('', selectedCountry);\n      }\n      return;\n    }\n\n    const typedRaw = getDigits(inputNumber);\n    const hasInternationalPrefix = typedRaw.startsWith('+');\n    const dialCodeTyped = hasInternationalPrefix || (autoDetectEnabled && international);\n    const typedCountry =\n      selectedCountry && dialCodeTyped && (countryLockedRef.current || !autoDetectEnabled)\n        ? detectCountry(typedRaw).country\n        : undefined;\n    const dialCodeChanged = !!typedCountry && typedCountry.dialCode !== selectedCountry?.dialCode;\n    const dialCodeIncomplete = hasInternationalPrefix && !canAutoDetect && !typedCountry;\n    const detectNow = canAutoDetect || dialCodeChanged || dialCodeIncomplete;\n\n    if (dialCodeChanged) {\n      countryLockedRef.current = false;\n    }\n\n    const preferSelectedCountry =\n      !!selectedCountry &&\n      !hasInternationalPrefix &&\n      (nationalPrefixBehavior === 'strip' ||\n        (nationalPrefixBehavior === 'auto' &&\n          international &&\n          !!selectedCountry.nationalPrefix &&\n          typedRaw.startsWith(selectedCountry.nationalPrefix) &&\n          typedRaw.length <=\n            getMaskDigitCount(selectedCountry.format) + selectedCountry.nationalPrefix.length));\n    const detectedFromDigits =\n      detectNow && international && !hasInternationalPrefix && !preferSelectedCountry\n        ? detectCountry(typedRaw).country\n        : undefined;\n    const inputCountry =\n      detectedFromDigits && detectedFromDigits.dialCode !== selectedCountry?.dialCode\n        ? null\n        : selectedCountry;\n\n    const nationalDigits =\n      international && typedRaw.startsWith(`+${selectedCountry?.dialCode}`)\n        ? typedRaw.slice((selectedCountry?.dialCode.length ?? 0) + 1)\n        : typedRaw.replace(/^\\+/, '');\n    const hasNationalPrefix =\n      !!inputCountry?.nationalPrefix && nationalDigits.startsWith(inputCountry.nationalPrefix);\n    const previousDisplay = selectedCountry\n      ? toDisplayValue(formatPhoneNumber(phoneValue, selectedCountry), selectedCountry)\n      : phoneValue;\n    const addedLength = inputNumber.length - previousDisplay.length;\n    const isInsertion =\n      addedLength > 0 &&\n      Array.from({ length: previousDisplay.length + 1 }, (_, index) => index).some(\n        (index) =>\n          inputNumber.slice(0, index) + inputNumber.slice(index + addedLength) === previousDisplay\n      );\n    const replacesValue =\n      !inputNumber.startsWith(previousDisplay) &&\n      !previousDisplay.startsWith(inputNumber) &&\n      !isInsertion;\n    if (!previousDisplay || replacesValue || restartIndex > 0 || phoneValue === '+') {\n      userEnteredDialCodeRef.current = hasInternationalPrefix;\n    }\n\n    const forceNationalPrefix =\n      (nationalPrefixBehavior === 'strip' ||\n        (nationalPrefixBehavior === 'auto' && international && !hasInternationalPrefix)) &&\n      hasNationalPrefix &&\n      !userEnteredDialCodeRef.current &&\n      !nationalPrefixConsumedRef.current &&\n      (!phoneValue ||\n        phoneValue === `+${inputCountry.dialCode}` ||\n        (replacesValue &&\n          (nationalDigits.length === inputCountry.nationalPrefix?.length ||\n            inputNumber[0] !== previousDisplay[0]))) &&\n      (!hasInternationalPrefix || nationalDigits === inputCountry.nationalPrefix);\n    const normalizeNationalPrefix =\n      nationalPrefixBehavior !== 'preserve' &&\n      (!hasNationalPrefix ||\n        inputCountry.nationalPrefix === '0' ||\n        forceNationalPrefix ||\n        (nationalDigits.length > getMaskDigitCount(inputCountry.format) &&\n          (!phoneValue || phoneValue === `+${inputCountry.dialCode}` || replacesValue)));\n\n    const fullRaw = buildRawValue(inputNumber, {\n      canAutoDetect: detectNow,\n      international,\n      selectedCountry: inputCountry,\n      normalizeNationalPrefix,\n      forceNationalPrefix,\n      preferSelectedCountry,\n    });\n    let country = selectedCountry;\n\n    if (detectNow) {\n      const { country: detected, resolvedByCallback } = detectCountry(fullRaw);\n      if (\n        detected &&\n        isDetectedCountryDifferent(detected, selectedCountry, fullRaw, resolvedByCallback)\n      ) {\n        country = detected;\n        countryResolvedByCallbackRef.current = resolvedByCallback;\n        setSelectedCountry(detected);\n        onCountryChange?.(detected);\n      } else if (detected?.iso2 === country?.iso2) {\n        countryResolvedByCallbackRef.current = resolvedByCallback;\n      }\n    }\n\n    const newRaw = detectNow ? fullRaw : clampToMask(fullRaw, country);\n    if (international && !hasInternationalPrefix && fullRaw === `+${typedRaw}`) {\n      userEnteredDialCodeRef.current = true;\n    }\n\n    nationalPrefixConsumedRef.current = forceNationalPrefix && newRaw === `+${country?.dialCode}`;\n    const newValue = inputExtension === undefined ? newRaw : `${newRaw}x${inputExtension}`;\n    const newFormatted = formatValue(newValue, country);\n    const formattedNumber = country ? formatPhoneNumber(newRaw, country) : newRaw;\n    const newDisplayRaw =\n      international || !country ? newRaw : newRaw.slice(country.dialCode.length + 1);\n    const extensionIndex = inputExtension === undefined ? -1 : inputValue.search(/x/i);\n    const newCursor =\n      inputExtension !== undefined && cursorPos > extensionIndex\n        ? toDisplayValue(newFormatted, country).length -\n          inputExtension.length +\n          inputValue.slice(extensionIndex + 1, cursorPos).replace(/\\D/g, '').length\n        : computeCursorPosition(\n            inputNumber,\n            Math.min(cursorPos, inputNumber.length),\n            newDisplayRaw,\n            toDisplayValue(formattedNumber, country)\n          );\n\n    emitChange(newValue, { formattedValue: newFormatted, country });\n\n    requestAnimationFrame(() => {\n      input.setSelectionRange(newCursor, newCursor);\n    });\n  };\n\n  const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n    onKeyDown?.(event);\n\n    if (readOnly || !combobox.dropdownOpened || event.nativeEvent.isComposing) {\n      return;\n    }\n\n    if (event.key === 'ArrowDown') {\n      event.preventDefault();\n      setActiveOptionId(combobox.selectNextOption());\n    } else if (event.key === 'ArrowUp') {\n      event.preventDefault();\n      setActiveOptionId(combobox.selectPreviousOption());\n    } else if (event.key === 'Enter' && combobox.getSelectedOptionIndex() !== -1) {\n      event.preventDefault();\n      combobox.clickSelectedOption();\n    } else if (event.key === 'Escape') {\n      combobox.closeDropdown('keyboard');\n    }\n  };\n\n  const handleCountrySelect = (iso2: string) => {\n    const country = findCountryByIso2(iso2);\n    if (!country) {\n      return;\n    }\n\n    countryLockedRef.current = true;\n    countryResolvedByCallbackRef.current = false;\n    nationalPrefixConsumedRef.current = false;\n    userEnteredDialCodeRef.current = false;\n    setSelectedCountry(country);\n    onCountryChange?.(country);\n\n    const currentDigits = phoneValue.replace(/\\D/g, '');\n    const oldDialCode = selectedCountry?.dialCode;\n    let newRaw: string;\n\n    if (oldDialCode && currentDigits.startsWith(oldDialCode)) {\n      newRaw = `+${country.dialCode}${currentDigits.slice(oldDialCode.length)}`;\n    } else {\n      newRaw = `+${country.dialCode}`;\n    }\n\n    const clamped = clampToMask(newRaw, country);\n    handleValueChange(extension === undefined ? clamped : `${clamped}x${extension}`, country);\n    combobox.closeDropdown();\n    focusInputAfterDialCode(country, clamped);\n  };\n\n  const formattedValue = formatValue(_value, selectedCountry);\n  const displayValue = toDisplayValue(formattedValue, selectedCountry);\n\n  const preferredIso2Set = useMemo(\n    () => new Set(preferredList.map((c) => c.iso2)),\n    [preferredList]\n  );\n\n  const mainCountries = useMemo(\n    () =>\n      preferredIso2Set.size > 0\n        ? filteredCountries.filter((c) => !preferredIso2Set.has(c.iso2))\n        : filteredCountries,\n    [filteredCountries, preferredIso2Set]\n  );\n\n  const searchedCountries = search\n    ? filterCountries(mainCountries, search, getCountryLabel)\n    : mainCountries;\n\n  const searchedPreferred = search\n    ? filterCountries(preferredList, search, getCountryLabel)\n    : preferredList;\n\n  const countryButtonLabel = selectedCountry\n    ? (getCountryLabel?.(selectedCountry) ?? selectedCountry.name)\n    : selectCountryLabel;\n\n  const countryButtonContent = renderFlag ? (\n    <span {...getStyles('countryButtonFlag')}>{renderFlag(selectedCountry)}</span>\n  ) : selectedCountry ? (\n    <span {...getStyles('countryButtonCode')}>{selectedCountry.iso2.toUpperCase()}</span>\n  ) : null;\n\n  return (\n    <Combobox\n      store={combobox}\n      __staticSelector=\"PhoneInput\"\n      classNames={resolvedClassNames}\n      styles={resolvedStyles}\n      unstyled={unstyled}\n      size={size}\n      readOnly={readOnly}\n      onOptionSubmit={handleCountrySelect}\n      {...comboboxProps}\n    >\n      <Combobox.DropdownTarget refProp=\"rootRef\">\n        <Combobox.EventsTarget\n          targetType=\"input\"\n          withKeyboardNavigation={false}\n          withAriaAttributes={false}\n          {...others}\n        >\n          <InputBase\n            ref={inputRef}\n            type=\"tel\"\n            inputMode={withExtension ? 'text' : undefined}\n            __staticSelector=\"PhoneInput\"\n            autoComplete={autoComplete ?? 'off'}\n            aria-controls={combobox.dropdownOpened && combobox.listId ? combobox.listId : undefined}\n            aria-activedescendant={\n              combobox.dropdownOpened ? activeOptionId || undefined : undefined\n            }\n            data-expanded={combobox.dropdownOpened || undefined}\n            data-mantine-stop-propagation={combobox.dropdownOpened || undefined}\n            leftSection={\n              <UnstyledButton\n                type=\"button\"\n                disabled={disabled || readOnly}\n                onClick={() => combobox.toggleDropdown()}\n                aria-label={countryButtonLabel}\n                aria-haspopup=\"listbox\"\n                aria-expanded={combobox.dropdownOpened}\n                aria-controls={\n                  combobox.dropdownOpened && combobox.listId ? combobox.listId : undefined\n                }\n                {...getStyles('countryButton', { focusable: true })}\n              >\n                {countryButtonContent}\n                {withChevron && <Combobox.Chevron size={size} />}\n              </UnstyledButton>\n            }\n            leftSectionPointerEvents=\"all\"\n            leftSectionWidth={leftSectionWidth[size]}\n            size={size}\n            classNames={resolvedClassNames}\n            styles={resolvedStyles}\n            unstyled={unstyled}\n            disabled={disabled}\n            readOnly={readOnly}\n            error={error}\n            value={displayValue}\n            onChange={handleInputChange}\n            onKeyDown={handleInputKeyDown}\n            attributes={attributes}\n          />\n        </Combobox.EventsTarget>\n      </Combobox.DropdownTarget>\n\n      <Combobox.Dropdown hidden={readOnly || disabled}>\n        {searchable && (\n          <Combobox.Search\n            value={search}\n            onChange={(event) => {\n              setSearch(event.currentTarget.value);\n              combobox.resetSelectedOption();\n            }}\n            placeholder={searchPlaceholder}\n            autoComplete=\"search-countries\"\n          />\n        )}\n\n        <Combobox.Options>\n          <ScrollArea.Autosize mah={maxDropdownHeight} type=\"scroll\">\n            {searchedPreferred.length > 0 && (\n              <>\n                {searchedPreferred.map((country) => (\n                  <Combobox.Option key={`preferred-${country.iso2}`} value={country.iso2}>\n                    <CountryOptionContent\n                      country={country}\n                      renderFlag={renderFlag}\n                      renderCountryOption={renderCountryOption}\n                      getStyles={getStyles}\n                    />\n                  </Combobox.Option>\n                ))}\n                <div {...getStyles('divider')} />\n              </>\n            )}\n\n            {searchedCountries.map((country) => (\n              <Combobox.Option key={country.iso2} value={country.iso2}>\n                <CountryOptionContent\n                  country={country}\n                  renderFlag={renderFlag}\n                  renderCountryOption={renderCountryOption}\n                  getStyles={getStyles}\n                />\n              </Combobox.Option>\n            ))}\n\n            {searchedCountries.length === 0 &&\n              searchedPreferred.length === 0 &&\n              nothingFoundMessage && <Combobox.Empty>{nothingFoundMessage}</Combobox.Empty>}\n          </ScrollArea.Autosize>\n        </Combobox.Options>\n      </Combobox.Dropdown>\n    </Combobox>\n  );\n});\n\nPhoneInput.classes = { ...InputBase.classes, ...Combobox.classes, ...classes };\nPhoneInput.displayName = '@mantine/core/PhoneInput';\n\nexport namespace PhoneInput {\n  export type Props = PhoneInputProps;\n  export type StylesNames = PhoneInputStylesNames;\n  export type Factory = PhoneInputFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiJA,MAAM,mBAA2C;CAC/C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,eAAe;CACnB,MAAM;CACN,YAAY;CACZ,eAAe;CACf,wBAAwB;CACxB,mBAAmB;CACnB,mBAAmB;CACnB,oBAAoB;AACtB;AAEA,MAAa,aAAaA,gBAAAA,SAA4B,WAAW;CAC/D,MAAM,QAAQC,kBAAAA,SAAS,cAAc,cAAc,MAAM;CACzD,MAAM,EACJ,YACA,QACA,UACA,MACA,OACA,cACA,UACA,gBACA,oBACA,eACA,kBACA,iBACA,gBACA,YACA,eACA,eACA,uBACA,wBACA,YACA,qBACA,UACA,UACA,MACA,OACA,YACA,mBACA,gBACA,eACA,gBACA,iBACA,aACA,qBACA,mBACA,oBACA,iBACA,cACA,WACA,KACA,GAAG,WACD;CAEJ,MAAM,YAAYC,mBAAAA,UAA6B;EAC7C,MAAM;EACN;EACA,SAAA,0BAAA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,oBAAoB,mBAAmBC,gCAAAA,qBAAwC;EACrF;EACA;EACA;CACF,CAAC;CAED,MAAM,eAAA,GAAcC,MAAAA,OAAAA,CAAyB,IAAI;CACjD,MAAM,YAAA,GAAWC,eAAAA,aAAAA,CAAa,KAAK,WAAW;CAC9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