
    :Qgc
                        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y)    )annotationsN)IOAnyOptional)Element)FileType)convert_office_docexactly_one)get_last_modified_date)partition_pptxc           	     b   t        | |       | rt        |       nd}t        j                         5 }| r.t        j
                  j                  |       sit        d|  d      |sJ t        j
                  j                  |d      }t        |d      5 }|j                  |j                                ddd       |} t        j
                  j                  t        j
                  j                  |             \  }	}
t        j
                  j                  |
      \  }}	t        | |dd	       t        j
                  j                  || d
      }t!        d||xs | t"        j$                  |xs |d|}ddd       |rD ]  }||j&                  _         S # 1 sw Y   xY w# 1 sw Y   1xY w)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.
    )filenamefileNz	The file z does not exist.tmp_filewbpptxzImpress MS PowerPoint 2007 XML)target_formattarget_filterz.pptx)r   metadata_filenamemetadata_file_typemetadata_last_modified )r
   r   tempfileTemporaryDirectoryospathexists
ValueErrorjoinopenwritereadsplitabspathsplitextr	   r   r   PPTmetadatar   )r   r   r   r   kwargslast_modifiedtmpdirtmp_file_pathr   _filename_no_pathbase_filenamepptx_filenameelementselements                  W/var/www/html/answerous/venv/lib/python3.12/site-packages/unstructured/partition/ppt.pypartition_pptr3      s   , -8@*84dM		$	$	& 
&77>>(+ 9XJ6F!GHH K4GGLL<MmT* ,htyy{+,$H ggmmBGGOOH,EF77++,<=q :		
 Ve-DE! 
"/;8'||#9#J]	

 
3
D  	:G(9G%	: O9, ,
 
s%   A!F% F2CF%F"	F%%F.)NNNN)r   Optional[str]r   zOptional[IO[bytes]]r   r4   r   r4   r(   r   returnzlist[Element])
__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   r3   r       r2   <module>r>      su    " 	  $ $ 3 2 P I 6 # $'+,0	@@
@ %@ *	@
 @ @r=   