o
    hX                     @  s   d dl mZ d dlmZ d dlmZmZ edeee	ef  Z
edddG dd dZedddG d	d
 d
ZedddG dd dZdS )    )annotations)	dataclass)AnyNewTypeStoreT)frozeneqc                   @  8   e Zd ZU dZded< ded< ded< edd
dZdS )IndexSelectionaP  
    Represents the state of an alt.selection_point() when neither the fields nor encodings arguments are specified.

    The value field is a list of zero-based indices into the
    selected dataset.

    Note: These indices only apply to the input DataFrame
    for charts that do not include aggregations (e.g. a scatter chart).
    strnamez	list[int]valuer   storesignaldict[str, dict] | Nonec                 C  s>   |du rg }n| di  dg }dd |D }t| ||dS )a  
        Construct an IndexSelection from the raw Vega signal and dataset values.

        Parameters
        ----------
        name: str
            The selection's name
        signal: dict or None
            The value of the Vega signal corresponding to the selection
        store: list
            The value of the Vega dataset corresponding to the selection.
            This dataset is named "{name}_store" in the Vega view.

        Returns
        -------
        IndexSelection
        NvlPointorc                 S  s   g | ]}|d  d qS )_vgsid_    ).0pr   r   J/var/www/vscode/kcb/lib/python3.10/site-packages/altair/utils/selection.py
<listcomp>2   s    z,IndexSelection.from_vega.<locals>.<listcomp>r   r   r   )getr
   )r   r   r   indicespointsr   r   r   	from_vega   s
   zIndexSelection.from_vegaNr   r   r   r   r   r   __name__
__module____qualname____doc____annotations__staticmethodr   r   r   r   r   r
         
 
r
   c                   @  r	   )PointSelectionaX  
    Represents the state of an alt.selection_point() when the fields or encodings arguments are specified.

    The value field is a list of dicts of the form:
        [{"dim1": 1, "dim2": "A"}, {"dim1": 2, "dim2": "BB"}]

    where "dim1" and "dim2" are dataset columns and the dict values
    correspond to the specific selected values.
    r   r   zlist[dict[str, Any]]r   r   r   r   r   c                 C  s.   |du rg n	| di  dg }t| ||dS )a  
        Construct a PointSelection from the raw Vega signal and dataset values.

        Parameters
        ----------
        name: str
            The selection's name
        signal: dict or None
            The value of the Vega signal corresponding to the selection
        store: list
            The value of the Vega dataset corresponding to the selection.
            This dataset is named "{name}_store" in the Vega view.

        Returns
        -------
        PointSelection
        Nr   r   r   )r   r(   )r   r   r   r   r   r   r   r   F   s    zPointSelection.from_vegaNr   r    r   r   r   r   r(   6   r'   r(   c                   @  r	   )IntervalSelectiona  
    Represents the state of an alt.selection_interval().

    The value field is a dict of the form:
        {"dim1": [0, 10], "dim2": ["A", "BB", "CCC"]}

    where "dim1" and "dim2" are dataset columns and the dict values
    correspond to the selected range.
    r   r   zdict[str, list]r   r   r   r   dict[str, list] | Nonec                 C  s   |du ri }t | ||dS )a  
        Construct an IntervalSelection from the raw Vega signal and dataset values.

        Parameters
        ----------
        name: str
            The selection's name
        signal: dict or None
            The value of the Vega signal corresponding to the selection
        store: list
            The value of the Vega dataset corresponding to the selection.
            This dataset is named "{name}_store" in the Vega view.

        Returns
        -------
        PointSelection
        Nr   )r)   )r   r   r   r   r   r   r   m   s   zIntervalSelection.from_vegaN)r   r   r   r*   r   r   r    r   r   r   r   r)   ]   r'   r)   N)
__future__r   dataclassesr   typingr   r   listdictr   r   r
   r(   r)   r   r   r   r   <module>   s    

*
&