
    Ngc
                        d dl mZ d dl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 d dlmZ d dlmZ 	 	 	 	 dddZdS )    )annotationsN)IOAnyOptional)Element)FileType)convert_office_docexactly_one)get_last_modified_date)partition_pptxfilenameOptional[str]fileOptional[IO[bytes]]metadata_filenamemetadata_last_modifiedkwargsr   returnlist[Element]c           	        t          | |           | rt          |           nd}t          j                    5 }| r3t          j                            |           st          d|  d          nu|sJ t          j                            |d          }t          |d          5 }|
                    |                                           ddd           n# 1 swxY w Y   |} t          j                            t          j                            |                     \  }	}
t          j                            |
          \  }}	t          | |dd	           t          j                            || d
          }t!          d||p| t"          j        |p|d|}ddd           n# 1 swxY w Y   |r|D ]}||j        _        |S )a  Partitions Microsoft PowerPoint Documents in .ppt format into their document elements.

    Parameters
    ----------
    filename
        A string defining the target filename path.
    file
        A file-like object using "rb" mode --> open(filename, "rb").
    metadata_last_modified
        The last modified date for the document.

    Note that all arguments valid on `partition_pptx()` are also valid here and will be passed
    along to the `partition_pptx()` function.
    )r   r   Nz	The file z does not exist.tmp_filewbpptxzImpress MS PowerPoint 2007 XML)target_formattarget_filterz.pptx)r   r   metadata_file_typer    )r
   r   tempfileTemporaryDirectoryospathexists
ValueErrorjoinopenwritereadsplitabspathsplitextr	   r   r   PPTmetadatar   )r   r   r   r   r   last_modifiedtmpdirtmp_file_pathr   _filename_no_pathbase_filenamepptx_filenameelementselements                  V/var/www/html/ai-engine/env/lib/python3.11/site-packages/unstructured/partition/ppt.pypartition_pptr7      s]   , ----8@J*8444dM		$	&	& 
& 	%7>>(++ I !GX!G!G!GHHHI KKKGLL<<MmT** ,htyy{{+++, , , , , , , , , , , , , , ,$H gmmBGOOH,E,EFF7++,<==q :		
 	
 	
 	
 V-D-D-DEE! 
"/;8'|#9#J]	
 

 
 
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
D  : 	: 	:G(9G%%Os7   A*F%"(C
F%C	F%C	B;F%%F),F))NNNN)r   r   r   r   r   r   r   r   r   r   r   r   )
__future__r   r    r   typingr   r   r   unstructured.documents.elementsr   unstructured.file_utils.modelr   $unstructured.partition.common.commonr	   r
   &unstructured.partition.common.metadatar   unstructured.partition.pptxr   r7   r       r6   <module>r@      s    " " " " " " 				  $ $ $ $ $ $ $ $ $ $ 3 3 3 3 3 3 2 2 2 2 2 2 P P P P P P P P I I I I I I 6 6 6 6 6 6 # $'+,0	@ @ @ @ @ @ @r?   