Ë
    \Rðiñ  ã                  óš   — d Z ddlmZ ddlZddlmZmZ ddlm	Z	 erddl
mZmZ ddlmZ ddlmZ dd	lmZ  G d
„ d«      Z G d„ de	«      Zy)z?Collection providing access to comments added to this document.é    )ÚannotationsN)ÚTYPE_CHECKINGÚIterator)ÚBlockItemContainer)Ú
CT_CommentÚCT_Comments)ÚCommentsPart)ÚParagraphStyle)Ú	Paragraphc                  ó:   — e Zd ZdZdd„Zd	d„Zd
d„Zddd„Zdd„Zy)ÚCommentsz:Collection containing the comments added to this document.c                ó    — || _         || _        y ©N)Ú_comments_elmÚ_comments_part)ÚselfÚcomments_elmÚcomments_parts      úH/var/www/html/Extract/venv/lib/python3.12/site-packages/docx/comments.pyÚ__init__zComments.__init__   s   € Ø)ˆÔØ+ˆÕó    c                óB   ‡ — ˆ fd„‰ j                   j                  D «       S )z.Iterator over the comments in this collection.c              3  óJ   •K  — | ]  }t        |‰j                  «      –— Œ y ­wr   )ÚCommentr   )Ú.0Úcomment_elmr   s     €r   ú	<genexpr>z$Comments.__iter__.<locals>.<genexpr>   s&   øè ø€ ò 
àô �K ×!4Ñ!4×5ñ
ùs   ƒ #)r   Úcomment_lst©r   s   `r   Ú__iter__zComments.__iter__   s!   ø€ ó
à#×1Ñ1×=Ñ=ô
ð 	
r   c                ó@   — t        | j                  j                  «      S )z*The number of comments in this collection.)Úlenr   r   r   s    r   Ú__len__zComments.__len__   s   € ä�4×%Ñ%×1Ñ1Ó2Ð2r   c                óÄ  — | j                   j                  «       }||_        ||_        t        j
                  j                  t        j                  j                  «      |_	        t        || j                  «      }|dk(  r|S t        |j                  d«      «      }t        |«      }|j                  d   }|j!                  |«       |D ]  }	|j#                  |	¬«       Œ |S )a²  Add a new comment to the document and return it.

        The comment is added to the end of the comments collection and is assigned a unique
        comment-id.

        If `text` is provided, it is added to the comment. This option provides for the common
        case where a comment contains a modest passage of plain text. Multiple paragraphs can be
        added using the `text` argument by separating their text with newlines (`"\\n"`).
        Between newlines, text is interpreted as it is in `Document.add_paragraph(text=...)`.

        The default is to place a single empty paragraph in the comment, which is the same
        behavior as the Word UI when you add a comment. New runs can be added to the first
        paragraph in the empty comment with `comments.paragraphs[0].add_run()` to adding more
        complex text with emphasis or images. Additional paragraphs can be added using
        `.add_paragraph()`.

        `author` is a required attribute, set to the empty string by default.

        `initials` is an optional attribute, set to the empty string by default. Passing |None|
        for the `initials` parameter causes that attribute to be omitted from the XML.
        Ú ú
r   ©Útext)r   Úadd_commentÚauthorÚinitialsÚdtÚdatetimeÚnowÚtimezoneÚutcÚdater   r   ÚiterÚsplitÚnextÚ
paragraphsÚadd_runÚadd_paragraph)
r   r(   r*   r+   r   ÚcommentÚpara_text_iterÚfirst_para_textÚ
first_paraÚss
             r   r)   zComments.add_comment#   sÅ   € ð, ×(Ñ(×4Ñ4Ó6ˆØ#ˆÔØ'ˆÔÜŸ;™;Ÿ?™?¬2¯;©;¯?©?Ó;ˆÔÜ˜+ t×':Ñ':Ó;ˆà�2Š:ØˆNä˜dŸj™j¨Ó.Ó/ˆä˜~Ó.ˆØ×'Ñ'¨Ñ*ˆ
Ø×Ñ˜?Ô+àò 	*ˆAØ×!Ñ! qÐ!Õ)ð	*ð ˆr   c                ól   — | j                   j                  |«      }|�t        || j                  «      S dS )zFReturn the comment identified by `comment_id`, or |None| if not found.N)r   Úget_comment_by_idr   r   )r   Ú
comment_idr   s      r   ÚgetzComments.getM   s6   € à×(Ñ(×:Ñ:¸:ÓFˆØ<GÐ<SŒw�{ D×$7Ñ$7Ó8Ð]ÐY]Ð]r   N)r   r   r   r	   )ÚreturnzIterator[Comment]©rA   Úint)r%   r%   r%   )r(   Ústrr*   rD   r+   ú
str | NonerA   r   )r?   rC   rA   zComment | None)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r#   r)   r@   © r   r   r   r      s    „ ÙDó,ó
ó3ô(ôT^r   r   c                  óØ   ‡ — e Zd ZdZdˆ fd„Zddˆ fd„Zedd„«       Zej                  dd„«       Zedd„«       Z	edd„«       Z
e
j                  dd„«       Z
edd	„«       Zedd
„«       Zˆ xZS )r   as  Proxy for a single comment in the document.

    Provides methods to access comment metadata such as author, initials, and date.

    A comment is also a block-item container, similar to a table cell, so it can contain both
    paragraphs and tables and its paragraphs can contain rich text, hyperlinks and images,
    although the common case is that a comment contains a single paragraph of plain text like a
    sentence or phrase.

    Note that certain content like tables may not be displayed in the Word comment sidebar due to
    space limitations. Such "over-sized" content can still be viewed in the review pane.
    c                ó4   •— t         ‰| �  ||«       || _        y r   )Úsuperr   Ú_comment_elm)r   r   r   Ú	__class__s      €r   r   zComment.__init__a   s   ø€ Ü‰Ñ˜ mÔ4Ø'ˆÕr   c                óN   •— t         ‰| �  ||«      }|€d|j                  _        |S )aA  Return paragraph newly added to the end of the content in this container.

        The paragraph has `text` in a single run if present, and is given paragraph style `style`.
        When `style` is |None| or ommitted, the "CommentText" paragraph style is applied, which is
        the default style for comments.
        ÚCommentText)rM   r7   Ú_pÚstyle)r   r(   rS   Ú	paragraphrO   s       €r   r7   zComment.add_paragraphe   s/   ø€ ô ‘GÑ)¨$°Ó6ˆ	ð ˆ=Ø!.ˆI�L‰LÔàÐr   c                ó.   — | j                   j                  S )z}Read/write. The recorded author of this comment.

        This field is required but can be set to the empty string.
        ©rN   r*   r   s    r   r*   zComment.authoru   s   € ð × Ñ ×'Ñ'Ð'r   c                ó&   — || j                   _        y r   rV   ©r   Úvalues     r   r*   zComment.author}   s   € à#(ˆ×ÑÕ r   c                ó.   — | j                   j                  S )z&The unique identifier of this comment.)rN   Úidr   s    r   r?   zComment.comment_id�   s   € ð × Ñ ×#Ñ#Ð#r   c                ó.   — | j                   j                  S )zÑRead/write. The recorded initials of the comment author.

        This attribute is optional in the XML, returns |None| if not set. Assigning |None| removes
        any existing initials from the XML.
        ©rN   r+   r   s    r   r+   zComment.initials†   s   € ð × Ñ ×)Ñ)Ð)r   c                ó&   — || j                   _        y r   r]   rX   s     r   r+   zComment.initials�   s   € à%*ˆ×ÑÕ"r   c                óF   — dj                  d„ | j                  D «       «      S )zßThe text content of this comment as a string.

        Only content in paragraphs is included and of course all emphasis and styling is stripped.

        Paragraph boundaries are indicated with a newline (`"\\n"`)
        r&   c              3  ó4   K  — | ]  }|j                   –— Œ y ­wr   r'   )r   Úps     r   r   zComment.text.<locals>.<genexpr>›   s   è ø€ Ò9 A˜Ÿ�Ñ9ùs   ‚)Újoinr5   r   s    r   r(   zComment.text“   s   € ð �y‰yÑ9¨¯©Ô9Ó9Ð9r   c                ó.   — | j                   j                  S )z€The date and time this comment was authored.

        This attribute is optional in the XML, returns |None| if not set.
        )rN   r1   r   s    r   Ú	timestampzComment.timestamp�   s   € ð × Ñ ×%Ñ%Ð%r   )r   r   r   r	   )r%   N)r(   rD   rS   zstr | ParagraphStyle | NonerA   r   )rA   rD   )rY   rD   rB   )rA   rE   )rY   rE   )rA   zdt.datetime | None)rF   rG   rH   rI   r   r7   Úpropertyr*   Úsetterr?   r+   r(   rd   Ú__classcell__)rO   s   @r   r   r   S   s¦   ø„ ñõ(öð  ò(ó ð(ð ‡]�]ò)ó ð)ð ò$ó ð$ð ò*ó ð*ð ‡_�_ò+ó ð+ð ò:ó ð:ð ò&ó ô&r   r   )rI   Ú
__future__r   r-   r,   Útypingr   r   Údocx.blkcntnrr   Údocx.oxml.commentsr   r   Údocx.parts.commentsr	   Údocx.styles.styler
   Údocx.text.paragraphr   r   r   rJ   r   r   ú<module>ro      s?   ðÙ Eå "ã ß *å ,áß:Ý0Ý0Ý-÷?^ñ ?^ôDP&Ð õ P&r   