
    iv?                        d Z ddlmZ ddlZddlZddlZddlmZmZm	Z	m
Z
 erddlmZ dZ ej        d          ZddZddZedddZ G d d          Z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.
    )annotationsN)TYPE_CHECKINGOptionalTupleUnion)Self)ColourColorzKrgb\s*\((?P<r>[0-9.]+%?)\s*,\s*(?P<g>[0-9.]+%?)\s*,\s*(?P<b>[0-9.]+%?)\s*\)argumentstrreturnr	   c                (   t          |           dk    rd                    d | D                       n| }	 t          |d          }d|cxk    rdk    sn t          d          	 t	          |	          S # t          $ r t          d
          d w xY w)N    c              3      K   | ]	}|d z  V  
dS )   N ).0is     U/home/ubuntu/.hermes/hermes-agent/venv/lib/python3.11/site-packages/discord/colour.py	<genexpr>z#parse_hex_number.<locals>.<genexpr>-   s&      **A!a%******       )baser    z)hex number out of range for 24-bit colourvaluezinvalid hex digit given)lenjoinint
ValueErrorr
   )r   argr   s      r   parse_hex_numberr#   ,   s    .1(mmq.@.@"''*****
*
*
*hC"Cb!!!U&&&&h&&&&HIII '
 5!!!!  > > >233=>s   /A6 6Bnumberr    c                   | d         dk    rJt          | d d                   }d|cxk    rdk    sn t          d          t          d|dz  z            S t          |           }d|cxk    rdk    sn t          d          |S )N%r   d   z+rgb percentage can only be between 0 to 100   z'rgb number can only be between 0 to 255)floatr!   roundr    )r$   r   s     r   parse_rgb_numberr,   8   s    bzSfSbSk""U!!!!c!!!!JKKKSECK()))KKE#BCCCLr   )regexr-   re.Pattern[str]c               R   |                     |           }|t          d          t          |                    d                    }t          |                    d                    }t          |                    d                    }t                              |||          S )Nzinvalid rgb syntax foundrgb)matchr!   r,   groupr
   from_rgb)r   r-   r3   redgreenblues         r   	parse_rgbr9   E   s    KK!!E}3444
5;;s++
,
,CU[[--..EEKK,,--D>>#ud+++r   c                     e Zd ZdZdZdMdZdNdZdOdZdOdZdPdZ	dQdZ
dPdZdQdZedQd            ZedQd            ZedQd            ZdRdZedSd            ZedTd!            ZedUd"            ZedVd#            Zed$d%dWd(            ZedVd)            ZedVd*            ZedVd+            ZedVd,            ZedVd-            ZedVd.            ZedVd/            ZedVd0            ZedVd1            Z edVd2            Z!edVd3            Z"edVd4            Z#edVd5            Z$edVd6            Z%edVd7            Z&edVd8            Z'edVd9            Z(edVd:            Z)edVd;            Z*e*Z+edVd<            Z,e,Z-edVd=            Z.e.Z/edVd>            Z0e0Z1edVd?            Z2edVd@            Z3edVdA            Z4edVdB            Z5edVdC            Z6edVdD            Z7edVdE            Z8edVdF            Z9edVdG            Z:edVdH            Z;edVdI            Z<edVdJ            Z=edVdK            Z>edVdL            Z?d$S )Xr	   a]  Represents a Discord role colour. This class is similar
    to a (red, green, blue) :class:`tuple`.

    There is an alias for this called Color.

    .. container:: operations

        .. describe:: x == y

             Checks if two colours are equal.

        .. describe:: x != y

             Checks if two colours are not equal.

        .. describe:: hash(x)

             Return the colour's hash.

        .. describe:: str(x)

             Returns the hex format for the colour.

        .. describe:: int(x)

             Returns the raw colour value.

    .. note::

        The colour values in the classmethods are mostly provided as-is and can change between
        versions should the Discord client's representation of that colour also change.

    Attributes
    ------------
    value: :class:`int`
        The raw integer colour value.
    r   r   r    c                x    t          |t                    st          d|j        j         d          || _        d S )Nz!Expected int parameter, received z	 instead.)
isinstancer    	TypeError	__class____name__r   )selfr   s     r   __init__zColour.__init__y   s?    %%% 	ec@Xcccddd


r   byter   c                "    | j         d|z  z	  dz  S )N   r)   r   )r@   rB   s     r   	_get_bytezColour._get_byte   s    
q4x(D00r   otherobjectboolc                L    t          |t                    o| j        |j        k    S N)r<   r	   r   r@   rF   s     r   __eq__zColour.__eq__   s     %((FTZ5;-FFr   c                .    |                      |           S rJ   )rL   rK   s     r   __ne__zColour.__ne__   s    ;;u%%%%r   r   c                    d| j         dS )N#z0>6xr   r@   s    r   __str__zColour.__str__   s    $4:$$$$r   c                    | j         S rJ   r   rQ   s    r   __int__zColour.__int__   s
    zr   c                    d| j          dS )Nz<Colour value=>r   rQ   s    r   __repr__zColour.__repr__   s    -
----r   c                *    t          | j                  S rJ   )hashr   rQ   s    r   __hash__zColour.__hash__   s    DJr   c                ,    |                      d          S )z6:class:`int`: Returns the red component of the colour.r   rE   rQ   s    r   r0   zColour.r        ~~a   r   c                ,    |                      d          S )z8:class:`int`: Returns the green component of the colour.   r\   rQ   s    r   r1   zColour.g   r]   r   c                ,    |                      d          S )z7:class:`int`: Returns the blue component of the colour.r   r\   rQ   s    r   r2   zColour.b   r]   r   Tuple[int, int, int]c                *    | j         | j        | j        fS )zdTuple[:class:`int`, :class:`int`, :class:`int`]: Returns an (r, g, b) tuple representing the colour.)r0   r1   r2   rQ   s    r   to_rgbzColour.to_rgb   s    ''r   r0   r1   r2   r   c                0     | |dz  |dz  z   |z             S )z/Constructs a :class:`Colour` from an RGB tuple.r   rD   r   )clsr0   r1   r2   s       r   r5   zColour.from_rgb   s&     sAGQ'!+,,,r   hr*   svc                V    t          j        |||          } | j        d |D              S )z/Constructs a :class:`Colour` from an HSV tuple.c              3  :   K   | ]}t          |d z            V  dS )r)   N)r    )r   xs     r   r   z"Colour.from_hsv.<locals>.<genexpr>   s,      88qc!c'll888888r   )colorsys
hsv_to_rgbr5   )re   rf   rg   rh   rgbs        r   from_hsvzColour.from_hsv   s6     !!Q**s|88C88899r   c                   |st          d          |d         dk    rt          |dd                   S |dd         dk    rE|dd         }|                    d          rt          |dd                   S t          |          S |                                }|dd         d	k    rt	          |          S t          d          )
a  Constructs a :class:`Colour` from a string.

        The following formats are accepted:

        - ``0x<hex>``
        - ``#<hex>``
        - ``0x#<hex>``
        - ``rgb(<number>, <number>, <number>)``

        Like CSS, ``<number>`` can be either 0-255 or 0-100% and ``<hex>`` can be
        either a 6 digit hex number or a 3 digit hex shortcut (e.g. #FFF).

        .. versionadded:: 2.0

        Raises
        -------
        ValueError
            The string could not be converted into a colour.
        zunknown colour format givenr   rP   r_   Nr   0xr   rn   )r!   r#   
startswithlowerr9   )re   r   restr"   s       r   from_strzColour.from_str   s    ,  	<:;;;8s??#E!""I...1:9Ds## 2'QRR111#D)))kkmmqs8uS>>!6777r   c                     | d          S )zlA factory method that returns a :class:`Colour` with a value of ``0``.

        .. colour:: #000000
        r   r   re   s    r   defaultzColour.default   s     s1vvr   N)seedry   2Optional[Union[int, str, float, bytes, bytearray]]c                   |t           nt          j        |          }|                     |                                 dd          S )a  A factory method that returns a :class:`Colour` with a random hue.

        .. note::

            The random algorithm works by choosing a colour with a random hue but
            with maxed out saturation and value.

        .. versionadded:: 1.6

        Parameters
        ------------
        seed: Optional[Union[:class:`int`, :class:`str`, :class:`float`, :class:`bytes`, :class:`bytearray`]]
            The seed to initialize the RNG with. If ``None`` is passed the default RNG is used.

            .. versionadded:: 1.7
        Nr_   )randomRandomro   )re   ry   rands      r   r|   zColour.random   s9    $ vv6=+>+>||DKKMM1a000r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x1ABC9C``.

        .. colour:: #1ABC9C
        i r   rw   s    r   tealzColour.teal        s8}}r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x11806A``.

        .. colour:: #11806A
        ij r   rw   s    r   	dark_tealzColour.dark_teal   r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0x57F287``.

        .. colour:: #57F287


        .. versionadded:: 2.0
        iW r   rw   s    r   brand_greenzColour.brand_green       s8}}r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x2ECC71``.

        .. colour:: #2ECC71
        iq. r   rw   s    r   r7   zColour.green  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x1F8B4C``.

        .. colour:: #1F8B4C
        iL r   rw   s    r   
dark_greenzColour.dark_green  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x3498DB``.

        .. colour:: #3498DB
        iۘ4 r   rw   s    r   r8   zColour.blue#  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x206694``.

        .. colour:: #206694
        if  r   rw   s    r   	dark_bluezColour.dark_blue+  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x9B59B6``.

        .. colour:: #9B59B6
        iY r   rw   s    r   purplezColour.purple3  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x71368A``.

        .. colour:: #71368A
        i6q r   rw   s    r   dark_purplezColour.dark_purple;  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xE91E63``.

        .. colour:: #E91E63
        ic r   rw   s    r   magentazColour.magentaC  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xAD1457``.

        .. colour:: #AD1457
        iW r   rw   s    r   dark_magentazColour.dark_magentaK  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xF1C40F``.

        .. colour:: #F1C40F
        i r   rw   s    r   goldzColour.goldS  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xC27C0E``.

        .. colour:: #C27C0E
        i| r   rw   s    r   	dark_goldzColour.dark_gold[  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xE67E22``.

        .. colour:: #E67E22
        i"~ r   rw   s    r   orangezColour.orangec  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xA84300``.

        .. colour:: #A84300
        i C r   rw   s    r   dark_orangezColour.dark_orangek  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0xED4245``.

        .. colour:: #ED4245

        .. versionadded:: 2.0
        iEB r   rw   s    r   	brand_redzColour.brand_reds       s8}}r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0xE74C3C``.

        .. colour:: #E74C3C
        i<L r   rw   s    r   r6   z
Colour.red}  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x992D22``.

        .. colour:: #992D22
        i"- r   rw   s    r   dark_redzColour.dark_red  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x95A5A6``.

        .. colour:: #95A5A6
        i r   rw   s    r   lighter_greyzColour.lighter_grey  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x607d8b``.

        .. colour:: #607d8b
        i}` r   rw   s    r   	dark_greyzColour.dark_grey  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x979C9F``.

        .. colour:: #979C9F
        i r   rw   s    r   
light_greyzColour.light_grey  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x546E7A``.

        .. colour:: #546E7A
        iznT r   rw   s    r   darker_greyzColour.darker_grey  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x7289DA``.

        .. colour:: #7289DA
        iډr r   rw   s    r   
og_blurplezColour.og_blurple  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x5865F2``.

        .. colour:: #5865F2
        ieX r   rw   s    r   blurplezColour.blurple  r   r   c                     | d          S )zsA factory method that returns a :class:`Colour` with a value of ``0x99AAB5``.

        .. colour:: #99AAB5
        i r   rw   s    r   greyplezColour.greyple  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0x2E2E34``.

        This will appear transparent on Discord's ash theme.

        .. colour:: #2E2E34

        .. versionadded:: 2.6
        i4.. r   rw   s    r   	ash_themezColour.ash_theme       s8}}r   c                     | d          S )a  A factory method that returns a :class:`Colour` with a value of ``0x1A1A1E``.

        This will appear transparent on Discord's dark theme.

        .. colour:: #1A1A1E

        .. versionadded:: 1.5

        .. versionchanged:: 2.2
            Updated colour from previous ``0x36393F`` to reflect discord theme changes.

        .. versionchanged:: 2.6
            Updated colour from previous ``0x313338`` to reflect discord theme changes.
        i r   rw   s    r   
dark_themezColour.dark_theme  s      s8}}r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0x070709``.

        This will appear transparent on Discord's onyx theme.

        .. colour:: #070709

        .. versionadded:: 2.6
        i	 r   rw   s    r   
onyx_themezColour.onyx_theme  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0xFBFBFB``.

        This will appear transparent on Discord's light theme.

        .. colour:: #FBFBFB

        .. versionadded:: 2.6
        i r   rw   s    r   light_themezColour.light_theme  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0xEB459E``.

        .. colour:: #EB459E

        .. versionadded:: 2.0
        iE r   rw   s    r   fuchsiazColour.fuchsia  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0xFEE75C``.

        .. colour:: #FEE75C

        .. versionadded:: 2.0
        i\ r   rw   s    r   yellowzColour.yellow  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0x37373E``.

        .. colour:: #37373E

        .. versionadded:: 2.6

        i>77 r   rw   s    r   	ash_embedzColour.ash_embed  r   r   c                     | d          S )a  A factory method that returns a :class:`Colour` with a value of ``0x242429``.

        .. colour:: #242429

        .. versionadded:: 2.2

        .. versionchanged:: 2.6
            Updated colour from previous ``0x2B2D31`` to reflect discord theme changes.
        i)$$ r   rw   s    r   
dark_embedzColour.dark_embed"       s8}}r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0x131416``.

        .. colour:: #131416

        .. versionadded:: 2.6
        i r   rw   s    r   
onyx_embedzColour.onyx_embed/  r   r   c                     | d          S )a  A factory method that returns a :class:`Colour` with a value of ``0xFFFFFF``.

        .. colour:: #EEEFF1

        .. versionadded:: 2.2

        .. versionchanged:: 2.6
            Updated colour from previous ``0xEEEFF1`` to reflect discord theme changes.
        r   r   rw   s    r   light_embedzColour.light_embed9  r   r   c                     | d          S )zA factory method that returns a :class:`Colour` with a value of ``0xEB459F``.

        .. colour:: #EB459F

        .. versionadded:: 2.3
        iE r   rw   s    r   pinkzColour.pinkF  r   r   )r   r    )rB   r    r   r    )rF   rG   r   rH   )r   r   )r   r    )r   ra   )r0   r    r1   r    r2   r    r   r   )rf   r*   rg   r*   rh   r*   r   r   )r   r   r   r	   )r   r   )ry   rz   r   r   )@r?   
__module____qualname____doc__	__slots__rA   rE   rL   rN   rR   rT   rW   rZ   propertyr0   r1   r2   rc   classmethodr5   ro   ru   rx   r|   r   r   r   r7   r   r8   r   r   r   r   r   r   r   r   r   r   r6   r   r   lighter_grayr   	dark_grayr   
light_grayr   darker_grayr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r	   P   s       $ $L I       1 1 1 1G G G G& & & &% % % %   . . . .        ! ! ! X! ! ! ! X! ! ! ! X!( ( ( ( - - - [- : : : [:
 &8 &8 &8 [&8P    [ RV 1 1 1 1 1 [1(    [    [    [    [    [    [    [    [    [    [    [    [    [    [    [    [    [    [    [  L   [ I   [ J   [ K   [    [    [ 	 	 	 [	    [" 	 	 	 [	 	 	 	 [	    [    [    [ 
 
 
 [
    [ 
 
 
 [
    [  r   )r   r   r   r	   )r$   r   r   r    )r   r   r-   r.   r   r	   )r   
__future__r   rl   r|   retypingr   r   r   r   typing_extensionsr   __all__compile	RGB_REGEXr#   r,   r9   r	   r
   r   r   r   <module>r      s   0 # " " " " "   				 8 8 8 8 8 8 8 8 8 8 8 8 '&&&&&&
 BJeff		" 	" 	" 	"
 
 
 
 :C , , , , , ,~ ~ ~ ~ ~ ~ ~ ~B 	r   