
    k?1i                     @   d dl Z d dlZd dlZd dlmZmZ d dlmZmZ 	 	 ddee	e j                  eef   dee	   deee	e j                  f      defdZ	 	 	 ddee	e j                  eef   d	eee	e j                  f      dee	   deee	e j                  f      dee   f
d
Zy)    N)BufferedReaderBytesIO)OptionalUnion
path_or_fppasswordgs_pathreturnc                    |xs, t        j                  d      xs t        j                  d      }|t        d      |ddddg}|r	|d| gz  }t        | t        t
        j                  f      r3d }|t	        t        j                  |       j                               gz  }n| }|dgz  }t        j                  ||rt        j                  nd t        j                  t        j                  	      j                  |r|j                         nd       \  }}t        |      rt        |j                  d
             t        |      S )Ngsgswin32czyCannot find Ghostscript, which is required for repairs.
Visit https://www.ghostscript.com/ for installation instructions.z-o-z-sDEVICE=pdfwritez-dPDFSETTINGS=/prepressz-sPDFPassword=)stdinstdoutstderrzutf-8)shutilwhich	Exception
isinstancestrpathlibPathabsolute
subprocessPopenPIPEcommunicatereadlendecoder   )r   r   r	   
executablerepair_argsr   r   r   s           [/home/www/therecruiter.miabetepe.com/venv/lib/python3.12/site-packages/pdfplumber/repair.py_repairr$      s/    JFLL.J&,,z2JJP
 	
 	!K .
344*sGLL12GLL4==?@AAu%%!&jooD	
 k%%**,T2 FF 6{6==12446?    outfilec                     t        | ||      }|r5t        |d      5 }|j                  |j                                d d d        y |S # 1 sw Y   y xY w)N)r	   wb)r$   openwriter   )r   r&   r   r	   repairedfs         r#   repairr-   4   sN     z8W=H'4  	%AGGHMMO$	%		%s    AA)NN)NNN)r   r   r   ior   r   typingr   r   r   r   r$   r-    r%   r#   <module>r1      s       & "
 #26)c7<<@A)sm) eC-./) 	)\ 37"26	c7<<@AeC-./ sm eC-./	
 gr%   