§
    £”j0  ã                  óÊ   — d Z ddlmZ ddlZddlmZmZmZ ddl	m
Z
 ddlmZ ddlmZmZmZ ddlmZmZmZmZ erdd	lmZ dd
lmZ  G d„ de¦  «        Z G d„ de¦  «        ZdS )z4Custom element classes related to document comments.é    )ÚannotationsN)ÚTYPE_CHECKINGÚCallableÚcast)Únsdecls)Ú	parse_xml)ÚST_DateTimeÚST_DecimalNumberÚ	ST_String)ÚBaseOxmlElementÚOptionalAttributeÚRequiredAttributeÚ
ZeroOrMore)ÚCT_Tbl)ÚCT_Pc                  óL   — e Zd ZU dZded<    ed¦  «        Zdd„Zdd„Zdd„Z	dS )ÚCT_Commentsa’  `w:comments` element, the root element for the comments part.

    Simply contains a collection of `w:comment` elements, each representing a single comment. Each
    contained comment is identified by a unique `w:id` attribute, used to reference the comment
    from the document text. The offset of the comment in this collection is arbitrary; it is
    essentially a _set_ implemented as a list.
    zlist[CT_Comment]Úcomment_lstz	w:commentÚreturnÚ
CT_Commentc           
     óÄ   — |                       ¦   «         }t          t          t          dt	          d¦  «        › d|› d�¦  «        ¦  «        }|                      |¦  «         |S )aø  Return newly added `w:comment` child of this `w:comments`.

        The returned `w:comment` element is the minimum valid value, having a `w:id` value unique
        within the existing comments and the required `w:author` attribute present but set to the
        empty string. It's content is limited to a single run containing the necessary annotation
        reference but no text. Content is added by adding runs to this first paragraph and by
        adding additional paragraphs as needed.
        z<w:comment Úwz w:id="z×" w:author="">  <w:p>    <w:pPr>      <w:pStyle w:val="CommentText"/>    </w:pPr>    <w:r>      <w:rPr>        <w:rStyle w:val="CommentReference"/>      </w:rPr>      <w:annotationRef/>    </w:r>  </w:p></w:comment>)Ú_next_available_comment_idr   r   r   r   Úappend)ÚselfÚnext_idÚcomments      úa/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/docx/oxml/comments.pyÚadd_commentzCT_Comments.add_comment    su   € ð ×1Ò1Ñ3Ô3ˆÝÝÝð �g c™lœlð  ð  °7ð  ð  ð  ñô ñ
ô 
ˆð$ 	�Š�GÑÔÐØˆó    Ú
comment_idÚintúCT_Comment | Nonec                óL   — |                       d|› d�¦  «        }|r|d         ndS )zRReturn the `w:comment` element identified by `comment_id`, or |None| if not found.z(./w:comment[@w:id='z'])[1]r   N©Úxpath)r   r!   Úcomment_elmss      r   Úget_comment_by_idzCT_Comments.get_comment_by_id?   s2   € à—z’zÐ"K¸Ð"KÐ"KÐ"KÑLÔLˆØ".Ð8ˆ|˜AŒˆ°DÐ8r    c                óî   — d„ |                       d¦  «        D ¦   «         }t          |d¬¦  «        dz   }|dk    r|S t          t          |¦  «        ¦  «        D ]\  }}||k    r|c S Œt	          |¦  «        S )an  The next available comment id.

        According to the schema, this can be any positive integer, as big as you like, and the
        default mechanism is to use `max() + 1`. However, if that yields a value larger than will
        fit in a 32-bit signed integer, we take a more deliberate approach to use the first
        ununsed integer starting from 0.
        c                ó,   — g | ]}t          |¦  «        ‘ŒS © )r"   )Ú.0Úxs     r   ú
<listcomp>z:CT_Comments._next_available_comment_id.<locals>.<listcomp>L   s   € ÐDÐDÐD˜q•C˜‘F”FÐDÐDÐDr    z./w:comment/@w:idéÿÿÿÿ)Údefaulté   iÿÿÿ)r&   ÚmaxÚ	enumerateÚsortedÚlen)r   Úused_idsr   ÚexpectedÚactuals        r   r   z&CT_Comments._next_available_comment_idD   s™   € ð EÐD D§J¢JÐ/BÑ$CÔ$CÐDÑDÔDˆå�h¨Ð+Ñ+Ô+¨aÑ/ˆà�iÒÐØˆNõ !*­&°Ñ*:Ô*:Ñ ;Ô ;ð 	 ð 	 ÑˆH�fØ˜6Ò!Ð!Ø���ð "õ �8‰}Œ}Ðr    N)r   r   )r!   r"   r   r#   )r   r"   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   r   r(   r   r+   r    r   r   r      sy   € € € € € € ðð ð "Ð!Ð!Ñ!àˆj˜Ñ%Ô%€Gðð ð ð ð>9ð 9ð 9ð 9ð
ð ð ð ð ð r    r   c                  ó  — e Zd ZU dZ ede¦  «        Zded<    ede¦  «        Z	ded<    e
de¦  «        Zd	ed
<    e
de¦  «        Zded<    edd¬¦  «        Z edd¬¦  «        Zded<   ded<   ded<   ded<   edd„¦   «         ZdS )r   aQ  `w:comment` element, representing a single comment.

    A comment is a so-called "story" and can contain paragraphs and tables much like a table-cell.
    While probably most often used for a single sentence or phrase, a comment can contain rich
    content, including multiple rich-text paragraphs, hyperlinks, images, and tables.
    zw:idr"   Úidzw:authorÚstrÚauthorz
w:initialsz
str | NoneÚinitialszw:datezdt.datetime | NoneÚdatezw:pr+   )Ú
successorszw:tblzCallable[[], CT_P]Úadd_pz
list[CT_P]Úp_lstzlist[CT_Tbl]Útbl_lstzCallable[[CT_Tbl], CT_Tbl]Ú_insert_tblr   úlist[CT_P | CT_Tbl]c                ó,   — |                       d¦  «        S )z8Generate all `w:p` and `w:tbl` elements in this comment.z./w:p | ./w:tblr%   )r   s    r   Úinner_content_elementsz!CT_Comment.inner_content_elementsy   s   € ð �zŠzÐ+Ñ,Ô,Ð,r    N)r   rI   )r9   r:   r;   r<   r   r
   r?   r=   r   rA   r   rB   r	   rC   r   ÚpÚtblÚpropertyrK   r+   r    r   r   r   [   s1  € € € € € € ðð ð  Ð Ð(8Ñ9Ô9€BÐ9Ð9Ð9Ñ9Ø#Ð# J°	Ñ:Ô:€FÐ:Ð:Ð:Ñ:Ø,Ð,Ø�iñô €Hð ð ð ñ ð  1Ð0Ø�+ñ ô  €Dð ð ð ñ ð 	ˆ
�5 RÐ(Ñ(Ô(€AØ
ˆ*�W¨Ð
,Ñ
,Ô
,€Cð ÐÐÑØÐÐÑØÐÐÑØ+Ð+Ð+Ñ+àð-ð -ð -ñ „Xð-ð -ð -r    r   )r<   Ú
__future__r   ÚdatetimeÚdtÚtypingr   r   r   Údocx.oxml.nsr   Údocx.oxml.parserr   Údocx.oxml.simpletypesr	   r
   r   Údocx.oxml.xmlchemyr   r   r   r   Údocx.oxml.tabler   Údocx.oxml.text.paragraphr   r   r   r+   r    r   ú<module>rY      s@  ðØ :Ð :à "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0à  Ð  Ð  Ð  Ð  Ð  Ø &Ð &Ð &Ð &Ð &Ð &Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JØ `Ð `Ð `Ð `Ð `Ð `Ð `Ð `Ð `Ð `Ð `Ð `àð .Ø&Ð&Ð&Ð&Ð&Ð&Ø-Ð-Ð-Ð-Ð-Ð-ðFð Fð Fð Fð F�/ñ Fô Fð FðR!-ð !-ð !-ð !-ð !-�ñ !-ô !-ð !-ð !-ð !-r    