
    dh9                         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mZmZmZmZmZmZmZ eeeeef   ZdZ G d d      Zy)    )AnyDictListLiteralOptionalUnionoverload)InputMediaType)UNSET_PARSE_MODE	InputFile
InputMediaInputMediaAudioInputMediaDocumentInputMediaPhotoInputMediaVideoMessageEntity
   c                      e Zd Z	 	 	 d#deee      dee   deee      ddfdZdeddfdZ	dee   ddfdZ
ededdddd	d
eej                     deeef   dee   dee   deee      dee   dee   dee   deddfd       Zededddd
eej*                     deeef   dee   dee   deee      dee   deddfd       Zeddeddddddd	d
eej.                     deeef   deeeef      dee   dee   deee      dee   dee   dee   dee   dee   deddfd       Zeddedddd
eej0                     deeef   deeeef      dee   dee   deee      dee   deddfd       ZdeddfdZddeddddfdeeef   dee   dee   dee   deee      dee   dee   dee   deddfdZdeddfdeeef   dee   dee   deee      dee   deddfdZddeddddddf	deeef   dee   dee   dee   deee      dee   dee   dee   dee   dee   deddfd Zddeddfdeeef   dee   dee   dee   deee      dee   deddfd!Zdee   fd"Zy)$MediaGroupBuilderNmediacaptioncaption_entitiesreturnc                 X    g | _         || _        || _        | j                  |xs g        y)aK  
        Helper class for building media groups.

        :param media: A list of media elements to add to the media group. (optional)
        :param caption: Caption for the media group. (optional)
        :param caption_entities: List of special entities in the caption,
            like usernames, URLs, etc. (optional)
        N)_mediar   r   _extend)selfr   r   r   s       S/var/www/netwell/bot/venv/lib/python3.12/site-packages/aiogram/utils/media_group.py__init__zMediaGroupBuilder.__init__   s*     (* 0U[b!    c                     t        |t              st        d      t        | j                        t
        k\  rt        d      | j                  j                  |       y )Nz$Media must be instance of InputMediaz/Media group can't contain more than 10 elements)
isinstancer   
ValueErrorlenr   MAX_MEDIA_GROUP_SIZEappend)r   r   s     r   _addzMediaGroupBuilder._add0   sH    %,CDDt{{33NOO5!r    c                 4    |D ]  }| j                  |        y N)r'   )r   r   ms      r   r   zMediaGroupBuilder._extend9   s     	AIIaL	r    )r   
parse_moder   duration	performertitletyper+   r,   r-   r.   kwargsc                     y r)    )
r   r/   r   r   r+   r   r,   r-   r.   r0   s
             r   addzMediaGroupBuilder.add=   s     	r    )r   r+   r   has_spoilerr4   c                     y r)   r2   )r   r/   r   r   r+   r   r4   r0   s           r   r3   zMediaGroupBuilder.addM   s     	r    )		thumbnailr   r+   r   widthheightr,   supports_streamingr4   r6   r7   r8   r9   c                     y r)   r2   )r   r/   r   r6   r   r+   r   r7   r8   r,   r9   r4   r0   s                r   r3   zMediaGroupBuilder.add[   s    " 	r    )r6   r   r+   r   disable_content_type_detectionr;   c                     y r)   r2   )	r   r/   r   r6   r   r+   r   r;   r0   s	            r   r3   zMediaGroupBuilder.addn   s     	r    c                 r   |j                  dd      }|t        j                  k(  r | j                  di | y|t        j                  k(  r | j
                  di | y|t        j                  k(  r | j                  di | y|t        j                  k(  r | j                  di | yt        d|      )z
        Add a media object to the media group.

        :param kwargs: Keyword arguments for the media object.
                The available keyword arguments depend on the media type.
        :return: None
        r/   NzUnknown media type: r2   )popr
   AUDIO	add_audioPHOTO	add_photoVIDEO	add_videoDOCUMENTadd_documentr#   )r   r0   type_s      r   r3   zMediaGroupBuilder.add}   s     

64(N(((DNN$V$n***DNN$V$n***DNN$V$n---D''3E9=>>r    c	                 J    | j                  t        d||||||||d|	       y)u  
        Add an audio file to the media group.

        :param media: File to send. Pass a file_id to send a file that exists on the
            Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from
            the Internet, or pass 'attach://<file_attach_name>' to upload a new one using
            multipart/form-data under <file_attach_name> name.
             :ref:`More information on Sending Files » <sending-files>`
        :param thumbnail: *Optional*. Thumbnail of the file sent; can be ignored if
            thumbnail generation for the file is supported server-side. The thumbnail should
            be in JPEG format and less than 200 kB in size. A thumbnail's width and height
            should not exceed 320.
        :param caption: *Optional*. Caption of the audio to be sent, 0-1024 characters
            after entities parsing
        :param parse_mode: *Optional*. Mode for parsing entities in the audio caption.
            See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_
            for more details.
        :param caption_entities: *Optional*. List of special entities that appear in the caption,
            which can be specified instead of *parse_mode*
        :param duration: *Optional*. Duration of the audio in seconds
        :param performer: *Optional*. Performer of the audio
        :param title: *Optional*. Title of the audio
        :return: None
        )r   r6   r   r+   r   r,   r-   r.   Nr2   )r'   r   )
r   r   r6   r   r+   r   r,   r-   r.   r0   s
             r   r@   zMediaGroupBuilder.add_audio   s@    H 			 
#%!1!#
 
	
r    c                 D    | j                  t        d|||||d|       y)uF  
        Add a photo to the media group.

        :param media: File to send. Pass a file_id to send a file that exists on the
            Telegram servers (recommended), pass an HTTP URL for Telegram to get a file
            from the Internet, or pass 'attach://<file_attach_name>' to upload a new
            one using multipart/form-data under <file_attach_name> name.
             :ref:`More information on Sending Files » <sending-files>`
        :param caption: *Optional*. Caption of the photo to be sent, 0-1024 characters
            after entities parsing
        :param parse_mode: *Optional*. Mode for parsing entities in the photo caption.
            See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_
            for more details.
        :param caption_entities: *Optional*. List of special entities that appear in the caption,
            which can be specified instead of *parse_mode*
        :param has_spoiler: *Optional*. Pass :code:`True` if the photo needs to be covered
            with a spoiler animation
        :return: None
        )r   r   r+   r   r4   Nr2   )r'   r   )r   r   r   r+   r   r4   r0   s          r   rB   zMediaGroupBuilder.add_photo   s6    8 			 %!1' 		
r    c                 N    | j                  t        d|||||||||	|
d
|       y)u  
        Add a video to the media group.

        :param media: File to send. Pass a file_id to send a file that exists on the
            Telegram servers (recommended), pass an HTTP URL for Telegram to get a file
            from the Internet, or pass 'attach://<file_attach_name>' to upload a new one
            using multipart/form-data under <file_attach_name> name.
            :ref:`More information on Sending Files » <sending-files>`
        :param thumbnail: *Optional*. Thumbnail of the file sent; can be ignored if thumbnail
            generation for the file is supported server-side. The thumbnail should be in JPEG
            format and less than 200 kB in size. A thumbnail's width and height should
            not exceed 320. Ignored if the file is not uploaded using multipart/form-data.
            Thumbnails can't be reused and can be only uploaded as a new file, so you
            can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using
            multipart/form-data under <file_attach_name>.
            :ref:`More information on Sending Files » <sending-files>`
        :param caption: *Optional*. Caption of the video to be sent,
            0-1024 characters after entities parsing
        :param parse_mode: *Optional*. Mode for parsing entities in the video caption.
            See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_
            for more details.
        :param caption_entities: *Optional*. List of special entities that appear in the caption,
            which can be specified instead of *parse_mode*
        :param width: *Optional*. Video width
        :param height: *Optional*. Video height
        :param duration: *Optional*. Video duration in seconds
        :param supports_streaming: *Optional*. Pass :code:`True` if the uploaded video is
            suitable for streaming
        :param has_spoiler: *Optional*. Pass :code:`True` if the video needs to be covered
            with a spoiler animation
        :return: None
        )
r   r6   r   r+   r   r7   r8   r,   r9   r4   Nr2   )r'   r   )r   r   r6   r   r+   r   r7   r8   r,   r9   r4   r0   s               r   rD   zMediaGroupBuilder.add_video   sF    \ 			 #%!1!#5' 	
r    c                 F    | j                  t        d||||||d|       y)uq  
        Add a document to the media group.

        :param media: File to send. Pass a file_id to send a file that exists on the
            Telegram servers (recommended), pass an HTTP URL for Telegram to get a file
            from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using
            multipart/form-data under <file_attach_name> name.
            :ref:`More information on Sending Files » <sending-files>`
        :param thumbnail: *Optional*. Thumbnail of the file sent; can be ignored
            if thumbnail generation for the file is supported server-side.
            The thumbnail should be in JPEG format and less than 200 kB in size.
            A thumbnail's width and height should not exceed 320.
            Ignored if the file is not uploaded using multipart/form-data.
            Thumbnails can't be reused and can be only uploaded as a new file,
            so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded
            using multipart/form-data under <file_attach_name>.
            :ref:`More information on Sending Files » <sending-files>`
        :param caption: *Optional*. Caption of the document to be sent,
            0-1024 characters after entities parsing
        :param parse_mode: *Optional*. Mode for parsing entities in the document caption.
            See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_
            for more details.
        :param caption_entities: *Optional*. List of special entities that appear
            in the caption, which can be specified instead of *parse_mode*
        :param disable_content_type_detection: *Optional*. Disables automatic server-side
            content type detection for files uploaded using multipart/form-data.
            Always :code:`True`, if the document is sent as part of an album.
        :return: None

        )r   r6   r   r+   r   r;   Nr2   )r'   r   )r   r   r6   r   r+   r   r;   r0   s           r   rF   zMediaGroupBuilder.add_document(  s:    P 			 #%!1/M 
	
r    c                     d| j                   i}| j                  | j                  |d<   d|d<   t        | j                        D cg c]*  \  }}|dk(  r| j                   |j	                  |      n|, c}}S c c}}w )z
        Builds a list of media objects for a media group.

        Adds the caption to the first media object if it is present.

        :return: List of media objects.
        r   Nr   r+   r   )update)r   r   	enumerater   
model_copy)r   update_first_mediaindexr   s       r   buildzMediaGroupBuilder.build\  s     /8-F  ,595J5J12/3|, !*$++ 6
 u A:$,,":   (: ;
 	
 
s   /A:)NNN)__name__
__module____qualname__r   r   	MediaTypestrr   r   r'   r   r	   r   r   r
   r?   r   r   intr   r3   rA   boolrC   rE   r@   rB   rD   rF   rR   r2   r    r   r   r      s    
 ,0!%:>	"Y(" #" #4#67	"
 
"(") " "T)_    "&$4:>"&#'# n**+ S)^$	
 # SM #4#67 3- C= }  
   "&$4:>&* n**+ S)^$	
 # SM #4#67 d^  
   6:!%$4:># $"&-1&* n**+ S)^$	
 E)S.12 # SM #4#67 }  3- %TN d^  
 $  6:!%$4:>9= n--. S)^$	
 E)S.12 # SM #4#67 )1  
 ?C ?D ?. *.!%$4:>"&#'#0
S)^$0
 I&0
 #	0

 SM0
 #4#670
 3-0
 C=0
 }0
 0
 
0
j "&$4:>&*%
S)^$%
 #%
 SM	%

 #4#67%
 d^%
 %
 
%
T *.!%$4:># $"&-1&*<
S)^$<
 I&<
 #	<

 SM<
 #4#67<
 }<
 <
 3-<
 %TN<
 d^<
 <
 
<
B *.!%$4:>9=2
S)^$2
 I&2
 #	2

 SM2
 #4#672
 )12
 2
 
2
h
tI 
r    r   N)typingr   r   r   r   r   r   r	   aiogram.enumsr
   aiogram.typesr   r   r   r   r   r   r   r   rV   r%   r   r2   r    r   <module>r]      sQ    F F F (	 	 	 	  W
 W
r    