
    h                        S r SSKJr  SSKJrJrJrJr  SSKJ	r
  SSKJr  SSKJr  SSKJrJr  \(       a  SSKJr  SS	KJr  SS
KJr  SSKJr   " S S\5      rg)z |StoryPart| and related objects.    )annotations)IOTYPE_CHECKINGTuplecast)RELATIONSHIP_TYPE)XmlPart)	CT_Inline)Lengthlazyproperty)WD_STYLE_TYPE)Image)DocumentPart)	BaseStylec                      \ rS rSrSrSS jrSS jr      SS jr  S       SS jjr\	SS j5       r
\SS	 j5       rS
rg)	StoryPart   zBase class for story parts.

A story part is one that can contain textual content, such as the document-part and
header or footer parts. These all share content behaviors like `.paragraphs`,
`.add_paragraph()`, `.add_table()` etc.
c                    U R                   nUc   eUR                  U5      nU R                  U[        R                  5      nXCR
                  4$ )aT  Return (rId, image) pair for image identified by `image_descriptor`.

`rId` is the str key (often like "rId7") for the relationship between this story
part and the image part, reused if already present, newly created if not.
`image` is an |Image| instance providing access to the properties of the image,
such as dimensions and image type.
)_packageget_or_add_image_part	relate_toRTIMAGEimage)selfimage_descriptorpackage
image_partrIds        B/var/www/html/env/lib/python3.13/site-packages/docx/parts/story.pyget_or_add_imageStoryPart.get_or_add_image   sM     --"""223CD
nnZ2$$$$    c                8    U R                   R                  X5      $ )zReturn the style in this document matching `style_id`.

Returns the default style for `style_type` if `style_id` is |None| or does not
match a defined style of `style_type`.
)_document_part	get_style)r   style_id
style_types      r    r&   StoryPart.get_style)   s     "",,XBBr#   c                8    U R                   R                  X5      $ )a  Return str style_id for `style_or_name` of `style_type`.

Returns |None| if the style resolves to the default style for `style_type` or if
`style_or_name` is itself |None|. Raises if `style_or_name` is a style of the
wrong type or names a style not present in the document.
)r%   get_style_id)r   style_or_namer(   s      r    r+   StoryPart.get_style_id1   s     ""//JJr#   Nc                    U R                  U5      u  pEUR                  X#5      u  pgU R                  UR                  p[        R
                  " XXU5      $ )zReturn a newly-created `w:inline` element.

The element contains the image specified by `image_descriptor` and is scaled
based on the values of `width` and `height`.
)r!   scaled_dimensionsnext_idfilenamer
   new_pic_inline)
r   r   widthheightr   r   cxcyshape_idr1   s
             r    r2   StoryPart.new_pic_inline<   sM     **+;<
((7!\\5>>(''xRHHr#   c                    U R                   R                  S5      nU Vs/ s H$  o"R                  5       (       d  M  [        U5      PM&     nnU(       d  g[	        U5      S-   $ s  snf )a"  Next available positive integer id value in this story XML document.

The value is determined by incrementing the maximum existing id value. Gaps in
the existing id sequence are not filled. The id attribute value is unique in the
document, without regard to the element type it appears on.
z//@id   )_elementxpathisdigitintmax)r   
id_str_lstid_strused_idss       r    r0   StoryPart.next_idL   sT     ]]((1
.8MjFNN<LKCKjM8}q   Ns
   A#A#c                P    U R                   nUc   e[        SUR                  5      $ )z'|DocumentPart| object for this package.r   )r   r   main_document_part)r   r   s     r    r%   StoryPart._document_partZ   s,     ,,"""NG$>$>??r#    )r   str | IO[bytes]returnzTuple[str, Image])r'   
str | Noner(   r   rI   r   )r,   zBaseStyle | str | Noner(   r   rI   rJ   )NN)r   rH   r3   int | Length | Noner4   rK   rI   r
   )rI   r>   )rI   r   )__name__
__module____qualname____firstlineno____doc__r!   r&   r+   r2   propertyr0   r   r%   __static_attributes__rG   r#   r    r   r      s    %C	K3	KAN	K		K &*&*	I)I #I $	I
 
I  ! ! @ @r#   r   N)rP   
__future__r   typingr   r   r   r   docx.opc.constantsr   r   docx.opc.partr	   docx.oxml.shaper
   docx.sharedr   r   docx.enum.styler   docx.image.imager   docx.parts.documentr   docx.styles.styler   r   rG   r#   r    <module>r]      s<    & " 1 1 6 ! % ,-&0+L@ L@r#   