
    *'ht'                        U d dl Z d dlmZ d dlmZmZ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mZmZmZmZ dd	lmZ dd
lmZ ddlmZmZ e j:                  dd dk\  rd dlmZ nd dlmZ ee e f   Z!ee"d<   dee!   defdZ# G d dee      Z$ G d de$      Z% G d de$      Z& G d de$      Z' G d de$      Z( G d de$      Z) G d d e$      Z* G d! d"e$      Z+ G d# d$e$      Z,y)%    N)ABC)AnyListOptionalTupleUnion   )deprecation_with_replacement)AnnotationFlag)ArrayObjectDictionaryObject)BooleanObjectFloatObject
NameObjectNumberObjectTextStringObject)RectangleObject)
hex_to_rgb   )NO_FLAGSAnnotationDictionary)   
   )	TypeAliasVertexverticesreturnc                     | d   d   | d   d   }}| d   d   | d   d   }}| D ]5  \  }}t        ||      }t        ||      }t        ||      }t        ||      }7 t        ||||f      S )Nr   r   )minmaxr   )r   x_miny_minx_maxy_maxxys          l/home/kushmeetdev/Regenta/Chatbot/venv/lib/python3.12/site-packages/pypdf/annotations/_markup_annotations.py_get_bounding_rectangler(      s    A;q>8A;q>5EA;q>8A;q>5E 1E1E1E1E1	
 E5%788    c                   ,    e Zd ZdZdddee   ddfdZy)MarkupAnnotationz
    Base class for all markup annotations.

    Args:
        title_bar: Text to be displayed in the title bar of the annotation;
            by convention this is the name of the author

    N)	title_barr,   r   c                8    |t        |      | t        d      <   y y )Nz/T)r   r   )selfr,   s     r'   __init__zMarkupAnnotation.__init__3   s!     %5i%@DD!" !r)   )__name__
__module____qualname____doc__r   strr/    r)   r'   r+   r+   )   s&     6: AXc] Ad Ar)   r+   c                   \     e Zd ZdZdeddeeeeeeef   f   de	de
deded	d
f fdZ xZS )Textz
    A text annotation.

    Args:
        rect: array of four integers ``[xLL, yLL, xUR, yUR]``
            specifying the clickable rectangular area
        text: The text that is added to the document
        open:
        flags:

    F)openflagsrecttextr8   r9   kwargsr   Nc                
   t        |   di | t        d      | t        d      <   t        |      | t        d      <   t	        |      | t        d      <   t        |      | t        d      <   t        |      | t        d      <   y )Nz/Text/Subtype/Rect	/Contentsz/Openz/Flagsr5   )superr/   r   r   r   r   r   )r.   r:   r;   r8   r9   r<   	__class__s         r'   r/   zText.__init__E   sy     	"6"'1'':Z
#$$3D$9Z !(8(>Z$%$1$$7Z !%1%%8Z!"r)   )r0   r1   r2   r3   r   r   r   r   floatr4   boolintr   r/   __classcell__rB   s   @r'   r7   r7   8   sn    
" 9 OU5%+E%FFG9 	9
 9 9 9 
9 9r)   r7   c                        e Zd ZdZddddddddded	eeeeeeef   f   d
ede	de	dedede
e   de
e   deddf fdZ xZS )FreeTextzA FreeText annotation	HelveticaF14pt000000ffffff)fontbolditalic	font_size
font_colorborder_colorbackground_colorr;   r:   rN   rO   rP   rQ   rR   rS   rT   r<   r   Nc       	            t        |   di |
 t        d      | t        d      <   t        |      | t        d      <   d}|r| d}n| d}|r| d}n| d}| | d| }| d	| }d
}|rt	        |      D ]	  }| | d} | d}| j                  t        d      t        d      t        d      t        |      t        d      t        |      t        d      t        |      t        d      t        |      i       |+t        t        d      t        d      i      | t        d      <   |	8t        t	        |	      D cg c]  }t        |       c}      | t        d      <   y y c c}w )Nz	/FreeTextr>   r?   zfont: zitalic znormal zbold  z;text-align:left;color:# rgr@   z/DSz/DAz/Wr   z/BS/Cr5   )rA   r/   r   r   r   updater   r   r   r   r   )r.   r;   r:   rN   rO   rP   rQ   rR   rS   rT   r<   font_strdefault_appearance_stringstnrB   s                  r'   r/   zFreeText.__init__Y   s    	"6"'1+'>Z
#$$3D$9Z ! "7+H"7+H"5)H"7+HZ	{!D62Z7
|D$&! . P/H.I"Q,O)P+D*ER(H%:&
;(?7#_T%:;')9$)?5!#3H#=5!#34M#N		
 &6 t$l1o'DE"# '%0)34D)EFAQF&DD!" (Fs   E()r0   r1   r2   r3   r4   r   r   r   rC   rD   r   r   r/   rF   rG   s   @r'   rI   rI   V   s      "&.*2: : OU5%+E%FFG	:
 : : : : : sm: #3-: : 
: :r)   rI   c                   T     e Zd Z	 d	dededeeeeeeef   f   dede	ddf fdZ
 xZS )
Linep1p2r:   r;   r<   r   Nc                    t        |   di | | j                  t        d      t        d      t        d      t	        |      t        d      t        t        |d         t        |d         t        |d         t        |d         g      t        d      t        t        d      t        d      g      t        d	      t        t        d
      t        d
      t        d
      g      t        d      t        |      i       y )Nr>   z/Liner?   z/Lr   r   z/LEz/None/ICg      ?r@   r5   )rA   r/   rZ   r   r   r   r   r   )r.   ra   rb   r:   r;   r<   rB   s         r'   r/   zLine.__init__   s     	"6":&
7(;7#_T%:4 +#BqE*#BqE*#BqE*#BqE*	# 5!;"7+"7+$ 5!;#C(#C(#C($ ;')9$)?1	
r)   )rW   )r0   r1   r2   r   r   r   r   rC   r4   r   r/   rF   rG   s   @r'   r`   r`      sd     $
$
 $
 OU5%+E%FFG	$

 $
 $
 
$
 $
r)   r`   c                   2     e Zd Zdee   deddf fdZ xZS )PolyLiner   r<   r   Nc                    t        |   di | t        |      dk(  rt        d      g }|D ]9  \  }}|j	                  t        |             |j	                  t        |             ; | j                  t        d      t        d      t        d      t        |      t        d      t        t        |            i       y )Nr   6A polygon needs at least 1 vertex with two coordinatesr>   z	/PolyLine	/Verticesr?   r5   rA   r/   len
ValueErrorappendr   rZ   r   r   r   r(   r.   r   r<   
coord_listr%   r&   rB   s         r'   r/   zPolyLine.__init__   s    
 	"6"x=AUVV
 	/DAql1o.l1o.	/ 	:&
;(?;'Z)@7#_5LX5V%W	
r)   )r0   r1   r2   r   r   r   r/   rF   rG   s   @r'   rf   rf      s-    
v,
 
 
	
 
r)   rf   c            	       T     e Zd Zdddeeeeeeef   f   dee   de	ddf fdZ
 xZS )	RectangleNinterior_colorr:   rs   r<   r   c          
      n   d|v rt        ddd       |d   }|d= t        |   d
i | | j                  t	        d      t	        d      t	        d      t	        d      t	        d      t        |      i       |r8t        t        |      D cg c]  }t        |       c}      | t	        d	      <   y y c c}w )Ninteriour_colorrs   5.0.0/Type/Annotr>   z/Squarer?   rd   r5   	r
   rA   r/   rZ   r   r   r   r   r   r.   r:   rs   r<   r^   rB   s        r'   r/   zRectangle.__init__   s     &():<LgV#$56N()"6"7#Z%9:&
9(=7#_T%:	
 &1)3N)CDAQD'DE"# D   B2r0   r1   r2   r   r   r   rC   r   r4   r   r/   rF   rG   s   @r'   rq   rq      sT    
 )-	OU5%+E%FFG !	
  
 r)   rq   c                   X     e Zd Zddddeeeeeeef   f   dedede	de
d	d
f fdZ xZS )	Highlightff0000F)highlight_colorprintingr:   quad_pointsr   r   r<   r   Nc                N   t        |   di | | j                  t        d      t        d      t        d      t	        |      t        d      |t        d      t        t        |      D cg c]  }t        |       c}      i       |rt        j                  | _
        y y c c}w )Nr>   z
/Highlightr?   z/QuadPointsrY   r5   )rA   r/   rZ   r   r   r   r   r   r   PRINTr9   )r.   r:   r   r   r   r<   r^   rB   s          r'   r/   zHighlight.__init__   s     	"6":&
<(@7#_T%:=);4 +-7-HI[^I#			
 '--DJ 	 Js   +B")r0   r1   r2   r   r   r   rC   r   r4   rD   r   r/   rF   rG   s   @r'   r~   r~      si      (. OU5%+E%FFG. !	.
 . . . 
. .r)   r~   c            	       T     e Zd Zdddeeeeeeef   f   dee   de	ddf fdZ
 xZS )EllipseNrr   r:   rs   r<   r   c          
      n   d|v rt        ddd       |d   }|d= t        |   d
i | | j                  t	        d      t	        d      t	        d      t	        d      t	        d      t        |      i       |r8t        t        |      D cg c]  }t        |       c}      | t	        d	      <   y y c c}w )Nru   rs   rv   rw   rx   r>   z/Circler?   rd   r5   ry   rz   s        r'   r/   zEllipse.__init__	  s     &():<LgV#$56N()"6"7#Z%9:&
9(=7#_T%:	
 &1)3N)CDAQD'DE"# Dr{   r|   rG   s   @r'   r   r     sT    
 )-	OU5%+E%FFG !	
  
 r)   r   c                   <     e Zd Zdeeeef      deddf fdZ xZS )Polygonr   r<   r   Nc                    t        |   di | t        |      dk(  rt        d      g }|D ]9  \  }}|j	                  t        |             |j	                  t        |             ; | j                  t        d      t        d      t        d      t        d      t        d      t        |      t        d      t        d	      t        d
      t        t        |            i       y )Nr   rh   rw   rx   r>   z/Polygonri   z/ITz/PolygonCloudr?   r5   rj   rn   s         r'   r/   zPolygon.__init__%  s    
 	"6"x=AUVV
 	/DAql1o.l1o.	/ 	7#Z%9:&
:(>;'Z)@5!:o#>7#_5LX5V%W	
r)   )	r0   r1   r2   r   r   rC   r   r/   rF   rG   s   @r'   r   r   $  s7    
uUE\*+
 
 
	
 
r)   r   )-sysabcr   typingr   r   r   r   r   _utilsr
   	constantsr   genericr   r   generic._baser   r   r   r   r   generic._rectangler   generic._utilsr   _baser   r   version_infor   typing_extensionsrC   r   __annotations__r(   r+   r7   rI   r`   rf   rq   r~   r   r   r5   r)   r'   <module>r      s    
  4 4 1 & 3  1 ' 1BQ7"  , %,'	 '9d6l 9 9A+S A9 9<= =@%
 %
P
 
,  6.  .2 8
 
r)   