+
    i                         R t ^ RIt^ RIHtHtHt ^ RIHt ^ RIH	t	  ! R R4      t
 ! R R4      t ! R	 R
]
4      t ! R R]
4      t ! R R]4      tR# )zMProvides a general interface to a `physical` OPC package, such as a zip file.N)ZIP_DEFLATEDZipFile
is_zipfile)PackageNotFoundError)CONTENT_TYPES_URIc                   6   a a ] tR t^
t oRtV 3R ltRtVtV ;t# )PhysPkgReaderz,Factory for physical package reader objects.c                  < \        V\        4      '       dW   \        P                  P	                  V4      '       d   \
        pM0\        V4      '       d   \        pM\        R V,          4      h\        p\        \        V `/  V4      # )zPackage not found at '%s')
isinstancestrospathisdir_DirPkgReaderr   _ZipPkgReaderr   superr   __new__)clspkg_file
reader_cls	__class__s   && W/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/docx/opc/phys_pkg.pyr   PhysPkgReader.__new__   s`    h$$ww}}X&&*
H%%*
*+F+QRR&J]C0<<     	__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r   r   r   
   s     6= =r   r   c                   6   a a ] tR t^t oRtV 3R ltRtVtV ;t# )PhysPkgWriterz,Factory for physical package writer objects.c                2   < \         \        V `  \        4      # )N)r   r'   r   _ZipPkgWriter)r   r   r   s   &&r   r   PhysPkgWriter.__new__   s    ]C0??r   r   r   r$   s   @@r   r'   r'      s     6@ @r   r'   c                   X   a a ] tR t^#t oRtV 3R ltR tR t]R 4       t	R t
RtVtV ;t# )r   zSImplements |PhysPkgReader| interface for an OPC package extracted into a
directory.c                t   < \         \        V `  4        \        P                  P                  V4      V n        R# )zA`path` is the path to a directory containing an expanded package.N)r   r   __init__r   r   abspath_path)selfr   r   s   &&r   r-   _DirPkgReader.__init__'   s$    mT+-WW__T*
r   c                    \         P                  P                  V P                  VP                  4      p\        VR4      ;_uu_ 4       pVP                  4       pRRR4       V#   + '       g   i     X# ; i)zIReturn contents of file corresponding to `pack_uri` in package directory.rbN)r   r   joinr/   
membernameopenread)r0   pack_urir   fblobs   &&   r   blob_for_DirPkgReader.blob_for,   sR    ww||DJJ(;(;<$668D  s   	A$$A5	c                    R# )ztProvides interface consistency with |ZipFileSystem|, but does nothing, a
directory file system doesn't need closing.Nr   r0   s   &r   close_DirPkgReader.close3   s     	r   c                ,    V P                  \        4      # )z7Return the `[Content_Types].xml` blob from the package.r;   r   r>   s   &r   content_types_xml_DirPkgReader.content_types_xml8        }}.//r   c                f     V P                  VP                  4      pV#   \         d    Rp T# i ; i)zXReturn rels item XML for source with `source_uri`, or None if the item has no
rels item.N)r;   rels_uriIOErrorr0   
source_urirels_xmls   && r   rels_xml_for_DirPkgReader.rels_xml_for=   s=    	}}Z%8%89H   	H	    00)r/   r   r   r   r   r    r-   r;   r?   propertyrC   rL   r!   r"   r#   r$   s   @@r   r   r   #   s7     +

 0 0 r   r   c                   X   a a ] tR t^Gt oRtV 3R ltR tR t]R 4       t	R t
RtVtV ;t# )r   z@Implements |PhysPkgReader| interface for a zip file OPC package.c                N   < \         \        V `  4        \        VR 4      V n        R# )rN)r   r   r-   r   _zipfr0   r   r   s   &&r   r-   _ZipPkgReader.__init__J   s    mT+-Xs+
r   c                L    V P                   P                  VP                  4      # )zoReturn blob corresponding to `pack_uri`.

Raises |ValueError| if no matching member is present in zip archive.
)rT   r7   r5   )r0   r8   s   &&r   r;   _ZipPkgReader.blob_forN   s    
 zzx2233r   c                :    V P                   P                  4        R# )z;Close the zip archive, releasing any resources it is using.NrT   r?   r>   s   &r   r?   _ZipPkgReader.closeU   s    

r   c                ,    V P                  \        4      # )z;Return the `[Content_Types].xml` blob from the zip package.rB   r>   s   &r   rC   _ZipPkgReader.content_types_xmlY   rE   r   c                f     V P                  VP                  4      pV#   \         d    Rp T# i ; i)zUReturn rels item XML for source with `source_uri` or None if no rels item is
present.N)r;   rG   KeyErrorrI   s   && r   rL   _ZipPkgReader.rels_xml_for^   s=    	}}Z%8%89H   	H	rN   rT   rO   r$   s   @@r   r   r   G   s5     J,4 0 0 r   r   c                   B   a a ] tR t^ht oRtV 3R ltR tR tRtVt	V ;t
# )r)   z@Implements |PhysPkgWriter| interface for a zip file OPC package.c                Z   < \         \        V `  4        \        VR \        R7      V n        R# )w)compressionN)r   r)   r-   r   r   rT   rU   s   &&r   r-   _ZipPkgWriter.__init__k   s     mT+-XsE
r   c                :    V P                   P                  4        R# )zcClose the zip archive, flushing any pending physical writes and releasing any
resources it's using.NrZ   r>   s   &r   r?   _ZipPkgWriter.closeo   s     	

r   c                R    V P                   P                  VP                  V4       R# )zQWrite `blob` to this zip package with the membername corresponding to
`pack_uri`.N)rT   writestrr5   )r0   r8   r:   s   &&&r   write_ZipPkgWriter.writet   s     	

H//6r   ra   )r   r   r   r   r    r-   r?   rk   r!   r"   r#   r$   s   @@r   r)   r)   h   s     JF
7 7r   r)   )r    r   zipfiler   r   r   docx.opc.exceptionsr   docx.opc.packurir   r   r'   r   r   r)   r   r   r   <module>rp      sS    S 	 5 5 4 .= =$@ @!M !HM B7M 7r   