"""
This type stub file was generated by pyright.
"""

from enum import Enum
from typing import Any, Callable, Final, TYPE_CHECKING, TypeVar, overload
from streamlit.dataframe_util import OptionSequence
from streamlit.runtime.state.common import RegisterWidgetResult
from streamlit.type_util import T
from collections.abc import Iterable, Sequence

if TYPE_CHECKING:
    ...
_LOGGER: Final = ...
_FLOAT_EQUALITY_EPSILON: Final[float] = ...
_Value = TypeVar("_Value")
def index_(iterable: Iterable[_Value], x: _Value) -> int:
    """Return zero-based index of the first item whose value is equal to x.
    Raises a ValueError if there is no such item.

    We need a custom implementation instead of the built-in list .index() to
    be compatible with NumPy array and Pandas Series.

    Parameters
    ----------
    iterable : list, tuple, numpy.ndarray, pandas.Series
    x : Any

    Returns
    -------
    int
    """
    ...

def check_and_convert_to_indices(opt: Sequence[Any], default_values: Sequence[Any] | Any | None) -> list[int] | None:
    """Perform validation checks and return indices based on the default values."""
    ...

def convert_to_sequence_and_check_comparable(options: OptionSequence[T]) -> Sequence[T]:
    ...

def get_default_indices(indexable_options: Sequence[T], default: Sequence[Any] | Any | None = ...) -> list[int]:
    ...

E1 = TypeVar("E1", bound=Enum)
E2 = TypeVar("E2", bound=Enum)
_ALLOWED_ENUM_COERCION_CONFIG_SETTINGS = ...
@overload
def maybe_coerce_enum(register_widget_result: RegisterWidgetResult[Enum], options: type[Enum], opt_sequence: Sequence[Any]) -> RegisterWidgetResult[Enum]:
    ...

@overload
def maybe_coerce_enum(register_widget_result: RegisterWidgetResult[T], options: OptionSequence[T], opt_sequence: Sequence[T]) -> RegisterWidgetResult[T]:
    ...

def maybe_coerce_enum(register_widget_result, options, opt_sequence): # -> RegisterWidgetResult[Enum]:
    """Maybe Coerce a RegisterWidgetResult with an Enum member value to
    RegisterWidgetResult[option] if option is an EnumType, otherwise just return
    the original RegisterWidgetResult.
    """
    ...

@overload
def maybe_coerce_enum_sequence(register_widget_result: RegisterWidgetResult[list[T] | list[T | str]], options: OptionSequence[T], opt_sequence: Sequence[T]) -> RegisterWidgetResult[list[T] | list[T | str]]:
    ...

@overload
def maybe_coerce_enum_sequence(register_widget_result: RegisterWidgetResult[tuple[T, T]], options: OptionSequence[T], opt_sequence: Sequence[T]) -> RegisterWidgetResult[tuple[T, T]]:
    ...

def maybe_coerce_enum_sequence(register_widget_result, options, opt_sequence): # -> RegisterWidgetResult[Any]:
    """Maybe Coerce a RegisterWidgetResult with a sequence of Enum members as value
    to RegisterWidgetResult[Sequence[option]] if option is an EnumType, otherwise just
    return the original RegisterWidgetResult.
    """
    ...

def create_mappings(options: Sequence[T], format_func: Callable[[T], str] = ...) -> tuple[list[str], dict[str, int]]:
    """Iterates through the options and formats them using the format_func.

    Returns a tuple of the formatted options and a mapping of the formatted options to
    the original options.
    """
    ...

