
    cjhk                        d Z ddlmZ ddlmZmZmZmZmZm	Z	 ddl
mZ dZerddlmZ ddlmZ d	d
lmZ  e	dd      Z e	ddd      Zeeeegeeeef   f   Z G d dee         Zy)ae  
The MIT License (MIT)

Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotations)TYPE_CHECKINGAnyCallable	CoroutineGenericTypeVar   )Interaction)Item)	Component)ComponentType   )ViewIr   )boundVr   T)r   	covariantc                      e Zd ZU dZdZded<   d ZddZddZddZ	e
dd	       Zedd
       ZddZddZddZedd       Zej$                  dd       Zedd       Zedd       ZddZy) r   zRepresents the base UI item that all UI components inherit from.

    The current UI items supported are:

    - :class:`discord.ui.Button`
    - :class:`discord.ui.Select`

    .. versionadded:: 2.0
    )rowztuple[str, ...]__item_repr_attributes__c                <    d | _         d | _        d | _        d| _        y NF)_view_row_rendered_row_provided_custom_idselfs    B/var/www/html/venv/lib/python3.12/site-packages/discord/ui/item.py__init__zItem.__init__9   s"    #
 $	)- */     c                    t         NNotImplementedErrorr   s    r    to_component_dictzItem.to_component_dictE   s    !!r"   c                     y r$    )r   	components     r    refresh_componentzItem.refresh_componentH       r"   c                     y r$   r)   r   interactions     r    refresh_statezItem.refresh_stateK   r,   r"   c                     |        S r$   r)   )clsr*   s     r    from_componentzItem.from_componentN   s	    ur"   c                    t         r$   r%   r   s    r    typez	Item.typeR   s    !!r"   c                     yr   r)   r   s    r    is_dispatchablezItem.is_dispatchableV   s    r"   c                    | j                   S r$   )r   r   s    r    is_persistentzItem.is_persistentY   s    '''r"   c                     dj                   fd j                  D              }d j                  j                   d| dS )N c              3  @   K   | ]  }| d t        |        yw)=N)getattr).0keyr   s     r    	<genexpr>z Item.__repr__.<locals>.<genexpr>]   s)      
03se1WT3'*+
s   <>)joinr   	__class____name__)r   attrss   ` r    __repr__zItem.__repr__\   sF     
7;7T7T
 
 4>>**+1UG155r"   c                    | j                   S r$   )r   r   s    r    r   zItem.rowb   s    yyr"   c                j    |d | _         y d|cxkD  rdk\  r|| _         y  t        d      t        d      )N   r   z4row cannot be negative or greater than or equal to 5)r   
ValueError)r   values     r    r   zItem.rowf   s>    =DI^!^DI  STT*STTr"   c                     y)Nr   r)   r   s    r    widthz
Item.widtho   s    r"   c                    | j                   S )z"The underlying view for this item.)r   r   s    r    viewz	Item.views   s     zzr"   c                   K   yw)z|coro|

        The callback associated with this UI item.

        This can be overridden by subclasses.

        Parameters
        ----------
        interaction: :class:`.Interaction`
            The interaction that triggered this UI item.
        Nr)   r.   s     r    callbackzItem.callbackx   s     s   N)returnzdict[str, Any])r*   r   rT   None)r/   r   rT   rU   )r2   ztype[I]r*   r   rT   r   )rT   r   )rT   bool)rT   str)rT   
int | None)rM   rX   )rT   int)rT   zV | None)r/   r   )rF   
__module____qualname____doc__r   __annotations__r!   r'   r+   r0   classmethodr3   propertyr5   r7   r9   rH   r   setterrO   rQ   rS   r)   r"   r    r   r   ,   s     19o8
/"   " "(6   	ZZU U    r"   N)r\   
__future__r   typingr   r   r   r   r   r	   interactionsr   __all__
componentsr   enumsr   rQ   r   r   r   ItemCallbackTyper   r)   r"   r    <module>rh      sw   2 # L L &
&%CvCv.S![19S#s]3KKL W71: Wr"   