
    i                        d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ erddlmZ ddlmZ ddlmZ  e	ddd          ZdZ G d dee                   ZdS )a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

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DictLiteralOptionalTypeVarUnion   )Item   )ComponentType)UnfurledMediaItem)File)MISSING)Self)
LayoutView)ThumbnailComponentVr   T)bound	covariant)	Thumbnailc                       e Zd ZdZdZdZeeddd fdZed             Z	ed d            Z
e
j        d!d            Z
ed"d            Zd#dZd$dZed%d            Z xZS )&r   a  Represents a UI Thumbnail. This currently can only be used as a :class:`Section`'s accessory.

    .. versionadded:: 2.6

    Parameters
    ----------
    media: Union[:class:`str`, :class:`discord.File`, :class:`discord.UnfurledMediaItem`]
        The media of the thumbnail. This can be a URL or a reference
        to an attachment that matches the ``attachment://filename.extension``
        structure.
    description: Optional[:class:`str`]
        The description of this thumbnail. Up to 256 characters. Defaults to ``None``.
    spoiler: :class:`bool`
        Whether to flag this thumbnail as a spoiler. Defaults to ``False``.
    id: Optional[:class:`int`]
        The ID of this component. This must be unique across the view.
    )_mediadescriptionspoiler)mediar   r   rowidN)r   r   r   r   #Union[str, File, UnfurledMediaItem]r   Optional[str]r   boolr   Optional[int]returnNonec               x   t                                                       t          |t                    r+|t          ur|n|j        }|t          ur|n|j        }|j        }t          |t                    rt          |          n|| _
        |t          u rd n|| _        t          |          | _        || _        d S N)super__init__
isinstancer   r   r   r   uristrr   r   r"   r   )selfr   r   r   r   	__class__s        U/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/discord/ui/thumbnail.pyr)   zThumbnail.__init__N   s     	eT"" 	)4G)C)C++IZK!(!7!7ggU]GIEEOPUWZE[E[)f):5)A)A)Aaf2=2H2H$$k!']]    c                    dS )N    r-   s    r/   widthzThumbnail.widthc   s    qr0   r   c                    | j         S )zG:class:`discord.UnfurledMediaItem`: This thumbnail unfurled media data.)r   r4   s    r/   r   zThumbnail.mediag   s     {r0   valuec                ,   t          |t                    rt          |          | _        d S t          |t                    r	|| _        d S t          |t                    rt          |j                  | _        d S t          d|j        j                  )Nz)expected a str or UnfurledMediaItem, not )	r*   r,   r   r   r   r+   	TypeErrorr.   __name__)r-   r7   s     r/   r   zThumbnail.medial   s    eS!! 	f+E22DKKK011 	fDKKKt$$ 	f+EI66DKKKdH`ddeeer0    Literal[ComponentType.thumbnail]c                    t           j        S r'   )r   	thumbnailr4   s    r/   typezThumbnail.typew   s    &&r0   c                    dS )NTr3   r4   s    r/   _is_v2zThumbnail._is_v2{   s    tr0   Dict[str, Any]c                    | j         j        | j        | j                                        | j        d}| j        
| j        |d<   |S )N)r>   r   r   r   r   )r>   r7   r   r   to_dictr   r   )r-   bases     r/   to_component_dictzThumbnail.to_component_dict~   sK    IO|Z''))+	
 
 7DJr0   	componentr   r   c                R     | |j         j        |j        |j        |j                  S )N)r   r   r   r   )r   urlr   r   r   )clsrF   s     r/   from_componentzThumbnail.from_component   s4    s/%!-%|	
 
 
 	
r0   )
r   r    r   r!   r   r"   r   r#   r$   r%   )r$   r   )r7   r    r$   r%   )r$   r;   )r$   r"   )r$   rA   )rF   r   r$   r   )r:   
__module____qualname____doc__	__slots____item_repr_attributes__r   r)   propertyr5   r   setterr>   r@   rE   classmethodrJ   __classcell__)r.   s   @r/   r   r   .   s4        $I
  &-        *   X    X \f f f \f ' ' ' X'   	 	 	 	 
 
 
 [
 
 
 
 
r0   r   N)rM   
__future__r   typingr   r   r   r   r   r	   r
   itemr   enumsr   
componentsr   filer   utilsr   typing_extensionsr   viewr   r   r   __all__r   r3   r0   r/   <module>r^      sN   0 # " " " " " N N N N N N N N N N N N N N N N N N       ! ! ! ! ! ! * * * * * *             0&&&&&&      //////GC|t444
b
 b
 b
 b
 b
Q b
 b
 b
 b
 b
r0   