
    h                    Z    S r SSKJr  SSKrSSKr " S S\5      r\" S5      r\" S5      rg)z_Provides the PackURI value type.

Also some useful known pack URI strings such as PACKAGE_URI.
    )annotationsNc                      \ rS rSrSr\R                  " S5      rSS jr\	SS j5       r
\SS j5       r\SS j5       r\S 5       r\S	 5       r\S
 5       rSS jr\S 5       rSrg)PackURI   zpProvides access to pack URI components such as the baseURI and the filename
slice.

Behaves as |str| otherwise.
z([a-zA-Z]+)([1-9][0-9]*)?c                \    US   S:w  a  Sn[        X!-  5      e[        R                  X5      $ )Nr   /z'PackURI must begin with slash, got '%s')
ValueErrorstr__new__)clspack_uri_strtmpls      B/var/www/html/env/lib/python3.13/site-packages/docx/opc/packuri.pyr   PackURI.__new__   s0    ?c!<DT011{{3--    c                p    [         R                  " X5      n[         R                  " U5      n[        U5      $ )zIThe absolute PackURI formed by translating `relative_ref` onto `baseURI`.)	posixpathjoinabspathr   )baseURIrelative_ref
joined_uriabs_uris       r   from_rel_refPackURI.from_rel_ref   s-     ^^G:
##J/wr   c                4    [         R                  " U 5      S   $ )zThe base URI of this pack URI, the directory portion, roughly speaking.

E.g. ``'/ppt/slides'`` for ``'/ppt/slides/slide1.xml'``. For the package pseudo-
partname '/', baseURI is '/'.
r   r   splitselfs    r   r   PackURI.baseURI"        t$Q''r   c                n    [         R                  " U 5      S   nUR                  S5      (       a  USS $ U$ )zwThe extension portion of this pack URI, e.g. ``'xml'`` for ``'/word/document.xml'``.

Note the period is not included.
   .N)r   splitext
startswith)r    raw_exts     r   extPackURI.ext+   s:     $$T*1-%0055wqr{B7Br   c                4    [         R                  " U 5      S   $ )zThe "filename" portion of this pack URI, e.g. ``'slide1.xml'`` for
``'/ppt/slides/slide1.xml'``.

For the package pseudo-partname '/', filename is ''.
r$   r   r   s    r   filenamePackURI.filename5   r"   r   c                    U R                   nU(       d  g[        R                  " U5      S   nU R                  R	                  U5      nUc  gUR                  S5      (       a  [        UR                  S5      5      $ g)zReturn partname index as integer for tuple partname or None for singleton
partname, e.g. ``21`` for ``'/ppt/slides/slide21.xml'`` and |None| for
``'/ppt/presentation.xml'``.Nr      )r,   r   r&   _filename_rematchgroupint)r    r,   	name_partr1   s       r   idxPackURI.idx>   si    
 ==&&x03	!!''	2=;;q>>u{{1~&&r   c                    U SS $ )zThe pack URI with the leading slash stripped off, the form used as the Zip
file membername for the package item.

Returns '' for the package pseudo-partname '/'.
r$   N r   s    r   
membernamePackURI.membernameN   s     ABxr   c                D    US:X  a  U SS $ [         R                  " X5      $ )zReturn string containing relative reference to package item from `baseURI`.

E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would return
'../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'.
r   r$   N)r   relpath)r    r   s     r   r   PackURI.relative_refW   s&     #c>tABxOy/@/@/OOr   c                z    SU R                   -  n[        R                  " U R                  SU5      n[	        U5      $ )zThe pack URI of the .rels part corresponding to the current pack URI.

Only produces sensible output if the pack URI is a partname or the package
pseudo-partname '/'.
z%s.rels_rels)r,   r   r   r   r   )r    rels_filenamerels_uri_strs      r   rels_uriPackURI.rels_uria   s3     "DMM1 ~~dllG]K|$$r   r8   N)r   r
   )r   r
   r   r
   returnr   )rD   r
   )r   r
   )__name__
__module____qualname____firstlineno____doc__recompiler0   r   staticmethodr   propertyr   r)   r,   r5   r9   r   rB   __static_attributes__r8   r   r   r   r      s     ::9:L.     ( ( C C ( (    P % %r   r   r   z/[Content_Types].xml)	rI   
__future__r   r   rJ   r
   r   PACKAGE_URICONTENT_TYPES_URIr8   r   r   <module>rR      s;   
 #  	^%c ^%B cl23 r   