
    i                     $   S r SrSSKrSSKrSSKrSSKJrJr  SSKJ	r	  SSK
Jr  SSKJrJrJrJrJr  SS	KJrJrJr  SS
KJrJrJrJrJrJrJrJr  SSKJ r J!r!J"r"  SSKJ#r$  SSKJ%r&  SSKJ'r(  SSKJ)r*  SSK+J,r,J-r-J.r.  SSK/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9  SSK:J;r;  SSK<J=r=J>r>J?r?J@r@JArA  SSKJBrBJCrC  \R                  S:  a  SSKJErE  OSSKFJErE  \R                  " \H5      rI\R                  " S5      rK " S S\L\   \75      rM " S S\N\\4   \75      rO " S S\O5      rPS\S S4S! jrQ " S" S#\O5      rR " S$ S%\R5      rS " S& S'\R5      rT " S( S)\S5      rU S2S*\S+\\   S,\S\V\L\V   \N\W\V4   4   S \\7\W\V\U4   4S- jjrX " S. S/\P5      rY " S0 S1\P5      rZg)3zMathieu Fenniakzbiziqe@mathieu.fenniak.net    N)IterableSequence)BytesIO)ceil)AnyCallableOptionalUnioncast   )PdfReaderProtocolPdfWriterProtocolXmpInformationProtocol)WHITESPACES
StreamTypedeprecation_no_replacementlogger_warningread_non_whitespaceread_until_regexread_until_whitespaceskip_over_comment)CheckboxRadioButtonAttributesFieldDictionaryAttributesOutlineFontFlag)FilterTypes)StreamAttributes)TypArguments)TypFitArguments)STREAM_TRUNCATED_PREMATURELYPdfReadErrorPdfStreamError   )
BooleanObjectByteStringObjectFloatObjectIndirectObject
NameObject
NullObjectNumberObject	PdfObjectTextStringObjectis_null_or_none)Fit)extract_inline_A85extract_inline_AHxextract_inline_DCTextract_inline_defaultextract_inline_RL)read_hex_string_from_streamread_string_from_stream)      )Selfs   [+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]c                   D   \ rS rSrS\SS 4S jr  SS\S\S\\\	\
\4         SS 4S jjrS\4S	 jrS\\   4S
 jrS\S\\   4S jrS\SS 4S jrS\S\4S jrS\S\4S jr SS\S\	S\
\4   SS4S jjr\ SS\S\\   S\	S\
\\
   \\\
4   4   SS 4S jj5       rSrg)ArrayObjectc   pdf_destreturnc                     [        SU R                  [        5       US5      5      nU  HG  n[        US5      (       a"  UR	                  UR                  U5      5        M6  UR	                  U5        MI     U$ )Nr9   F	replicate)r   _reference_cloner9   hasattrappendr>   )selfr;   arrdatas       X/home/james-whalen/.local/lib/python3.13/site-packages/pypdf/generic/_data_structures.pyr>   ArrayObject.replicated   sf     !!+-5A
 Dt[))

4>>(34

4 	 
 
     force_duplicateignore_fieldsc                     U R                   R                  U:X  a	  U(       d  U $ [        SU R	                  [        5       X5      5      nU  H  n[        U[        5      (       a@  UR	                  UR                  XU5      UU5      nUR                  UR                   5        MX  [        US5      (       a#  UR                  UR                  XU5      5        M  UR                  U5        M     U$ ! [         a     Nf = f)Clone object into pdf_dest.r9   clone)indirect_referencepdf	Exceptionr   r?   r9   
isinstanceStreamObjectrM   rA   r@   )rB   r;   rI   rJ   rC   rD   dups          rE   rM   ArrayObject.clones   s    	&&**h6 !!+-K
 D$--++JJx-H#
 

3112w''

4::hOP

4   
%  		s   "C. .
C;:C;c                 P    [        U R                  [        S U  5       5      45      $ )Q
Used to detect modified object.

Returns:
    Hash considering type and value.

c              3   @   #    U  H  oR                  5       v   M     g 7fNhash_bin).0xs     rE   	<genexpr>'ArrayObject.hash_bin.<locals>.<genexpr>   s     *FA::<<s   )hash	__class__tuplerB   s    rE   rZ   ArrayObject.hash_bin   s#     T^^U*F*F%FGHHrG   c                     [        U 5      $ )z:Emulate DictionaryObject.items for a list (index, object).)	enumeraterb   s    rE   itemsArrayObject.items   s    rG   lstc                 B   [        U[        [        [        45      (       a   U$ [        U[        5      (       a  U/nU$ [        U[
        5      (       a&  US   S:X  a  [        U5      /nU$ [        U5      /n U$ [        U[        5      (       a  [        U5      /nU$ U/nU$ )Nr   /)
rQ   listra   setr*   strr'   r+   bytesr$   rB   rh   s     rE   _to_lstArrayObject._to_lst   s    cD%-.. 
 Y''%C 
 S!!1v}!#' 
 (,-
 
	 U###C()C 
 %C
rG   c                 \    [        U 5      nUR                  U R                  U5      5        U$ )aw  
Allow extension by adding list or add one element only

Args:
    lst: any list, tuples are extended the list.
    other types(numbers,...) will be appended.
    if str is passed it will be converted into TextStringObject
    or NameObject (if starting with "/")
    if bytes is passed it will be converted into ByteStringObject

Returns:
    ArrayObject with all elements

)r9   extendrp   )rB   rh   temps      rE   __add__ArrayObject.__add__   s(     4 DLL%&rG   c                 F    U R                  U R                  U5      5        U $ )aL  
 Allow extension by adding list or add one element only

Args:
    lst: any list, tuples are extended the list.
    other types(numbers,...) will be appended.
    if str is passed it will be converted into TextStringObject
    or NameObject (if starting with "/")
    if bytes is passed it will be converted into ByteStringObject

)rs   rp   ro   s     rE   __iadd__ArrayObject.__iadd__   s     	DLL%&rG   c                     U R                  U5       H  n U R                  U5      nX	 M     U $ ! [         a     M*  f = f)zAllow to remove items)rp   index
ValueError)rB   rh   r\   r{   s       rE   __isub__ArrayObject.__isub__   sG    c"A

1K #   s   /
==Nstreamencryption_keyc                     Ub  [        SS5        UR                  S5        U  H%  nUR                  S5        UR                  U5        M'     UR                  S5        g )N/the encryption_key parameter of write_to_stream5.0.0   [    s    ])r   writewrite_to_stream)rB   r   r   rD   s       rE   r   ArrayObject.write_to_stream   sW     %&A7 	TDLL  (  	UrG   rO   forced_encodingc                 
   [        5       nU R                  S5      nUS:w  a  [        S5      e U R                  S5      nUR                  5       (       a(  U R                  S5      nUR                  5       (       a  M(  US:X  a   U$ US:X  a  U R	                  SS5        [        U 5        M}  U R	                  SS5        U R                  S5      nUS:X  a   U$ U R	                  SS5        UR                  [        XU5      5        M  )Nr"   r   zCould not read arrayrG      %   ])r9   readr    isspaceseekr   rA   read_object)r   rO   r   rC   tmptok
peek_aheads          rE   read_from_streamArrayObject.read_from_stream   s     mkk!n$;566++a.C++--kk!n ++--cz 
 d{B"!&)KKAQJT! 
 KKAJJ{6@A% rG   FrH   rX   )__name__
__module____qualname____firstlineno__r   r>   boolr	   r   r
   rm   intrM   rZ   r   r   rf   rk   rp   ru   r7   rx   r}   r   rn   r   staticmethodr   dictr   __static_attributes__rH   rG   rE   r9   r9   c   s[   # 
$ !&=?	#   sCx 9:	
 
<I# Ix} 3 49 "3 = &C D C D  MQ 27c58H2I	  HL'( tS$s)T#s(^CD 
	 rG   r9   c                      \ rS rSrS\SS 4S jr  SS\S\S\\\	\
\4         SS 4S jjrS	S S\S\S\\\	\
\4         S
\\\\4      SS4S jrS\4S jrS\S\4S jrSS\
S\S\4S jjrS\S\S\4S jrSS\S\\   S\4S jjrS\S\4S jr\S\\   4S j5       r SS\S\	S\
\4   SS4S jjr\ SS\S\\   S\	S\
\ \
   \!\\
4   4   SS 4S jj5       r"Sr#g)DictionaryObjecti	  r;   r<   c                     [        SU R                  U R                  5       US5      5      nU R                  5        H:  u  p4[	        US5      (       a  UR                  U5      OUX#R                  U5      '   M<     U$ )Nr   Fr>   )r   r?   r`   rf   r@   r>   )rB   r;   d__kvs        rE   r>   DictionaryObject.replicate
  sp     !!$.."2HeD
 JJLDA)0K)@)@H%a H%& ! 
rG   rH   rI   rJ   c                 @    U R                   R                  U:X  a	  U(       d  U $ [        5       n[	        SU R                  U R                  5       X5      5      nUc  / n[        UR                  5       5      S:X  a  UR                  XX#U5        U$ ! [         a     Nwf = f)rL   r   r   )
rN   rO   rP   rl   r   r?   r`   lenkeys_clonerB   r;   rI   rJ   visitedr   s         rE   rM   DictionaryObject.clone  s    	&&**h6 ),!!$.."2HN
  Msxxz?aJJtwO
  		s   "B 
BBsrcr   Nc           
        ^^ Tc   e[        T5      mSnU[        T5      :  aZ  [        TU   [        5      (       a,  [	        [        TU   5      S::  a  TU	 TU	 MF  TU==   S-  ss'   US-  nU[        T5      :  a  MZ  [        UU4S jS 5       5      (       Ga  [        T5      mS GH  nU GH  n/ n	UT;   d  M  X;  d  M  [        TR                  U5      [        5      (       d  M;  [        TU   [        5      (       d  MU  TR                  SS5      b]  [	        [        TU   5      R                  SS5      b9  TR                  SS5      [	        [        TU   5      R                  SS5      :X  d  M  [	        STU   5      n
U nU
b  [	        SU
R                  U
R                  5       X#5      5      nUR                  bH  UR                  R                  nUR                  R                  nX4U;   a  Sn
OaUR                  X45        U	R!                  X45        Uc   eUR                  U[#        U5      '   Un U
T:X  a  Sn
O[	        SX   5      n
 U
b  M  U	 H  u  nnUR'                  XUTU5        M     GM     GM     TR)                  5        H  u  nnUT;  d  M  [        U[*        5      (       aX  [-        US	5      (       d  SUl        UR/                  X#T5      nUR                  c   eUR                  XR/                  U5      '   M{  X;  d  M  [-        US
5      (       a  UR/                  X#T5      OUU [#        U5      '   M     g! [$         a    Sn
 GNf = f)zx
Update the object from src.

Args:
    src: "DictionaryObject":
    pdf_dest:
    force_duplicate:
    ignore_fields:

Nr   r"   c              3     >#    U  H  nUT;  =(       a    UT;   =(       a    [        TR                  U5      [        5      =(       a    [        TU   [        5      =(       a}    TR	                  S S5      SL =(       db    [        [        TU   5      R	                  S S5      SL =(       d6    TR	                  S S5      [        [        TU   5      R	                  S S5      :H  v   M     g7f)/TypeN)rQ   raw_getr&   r   getr   )r[   fieldrJ   r   s     rE   r]   *DictionaryObject._clone.<locals>.<genexpr>P  s      
 8 & 		3;;u-~>	 3u:'78	
 &$. I(#e*599'4HDPI777D)(#e*599'4HI	 8s   C"C%)/Next/Prev/N/V))r   r   )r   r   r   r   rN   rM   )rk   r   rQ   r   r   anyr   r&   r   r   r?   r`   rN   idnum
generationaddrA   r'   rP   r   rf   rR   r@   rM   )rB   r   r;   rI   rJ   r   r\   rh   r   objscur_objprev_objclonr   r   scr   vvs    `  `              rE   r   DictionaryObject._clone0  sM   ( (((]+#m$$-*C00]1-.!3%a(%a(a A% FA #m$$  
 8
 
 
 !/M9ADSM&s{{1~~FF&s1v/?@@  GGGT2:#$4c!f=AA'4PX"www5#$4c!f=AA'4P Q ?C.A? @D%1#' 2 ' 8 8$+$5$5$7!"$D  $66B(,(?(?(E(E-1-D-D-O-O
$)#6'#A.2G$) 'U,? @ KK8#+#77#76:6M6MHZ]3'+H/#*c>.2G.23Ewz.RG/ &14 %)DAqHH !_mW %)]  :h IIKDAq%a.."1&:;;/3,MJB00<<<.0.C.CD*+] #1g.. =I A'   $- /*./s   7M MMMc                 l    [        U R                  [        S U R                  5        5       5      45      $ )rV   c              3   H   #    U  H  u  pXR                  5       4v   M     g 7frX   rY   )r[   r   r   s      rE   r]   ,DictionaryObject.hash_bin.<locals>.<genexpr>  s     #O,$!Q

$5,s    ")r_   r`   ra   rf   rb   s    rE   rZ   DictionaryObject.hash_bin  s.     ^^U#O$**,#OPQ
 	
rG   keyc                 ,    [         R                  X5      $ rX   )r   __getitem__rB   r   s     rE   r   DictionaryObject.raw_get  s    **rG   defaultc                     X;   a  X   $  SU ;  a  U$ [        S5      e! [          a/    [        SU S   R                  5       5      R                  X5      s $ f = f)z
Returns the value of a key or from the parent if not found.
If not found returns default.

Args:
    key: string identifying the field to return

    default: default value to return

Returns:
    Current key or inherited one, otherwise default value.

/ParentzNot presentr   )KeyErrorr   
get_objectget_inherited)rB   r   r   s      rE   r   DictionaryObject.get_inherited  sh     ;9	$=)) 	*DO,F,F,HIWW 	s     6AAvaluec                     [        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      e[        R	                  XU5      $ NzKey must be a PdfObjectzValue must be a PdfObject)rQ   r*   r|   r   __setitem__rB   r   r   s      rE   r   DictionaryObject.__setitem__  sG    #y))677%++899511rG   c                     [        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      e[        R	                  XU5      $ r   )rQ   r*   r|   r   
setdefaultr   s      rE   r   DictionaryObject.setdefault  sE    #y))677%++899t%00rG   c                 H    [         R                  X5      R                  5       $ rX   )r   r   r   r   s     rE   r   DictionaryObject.__getitem__  s    *5577rG   c                     SSK Jn  U R                  SS5      n[        U5      (       a  gUc   S5       eUR	                  5       nU" U5      $ )uf  
Retrieve XMP (Extensible Metadata Platform) data relevant to this
object, if available.

See Table 347 — Additional entries in a metadata stream dictionary.

Returns:
  Returns a :class:`~pypdf.xmp.XmpInformation` instance
  that can be used to access XMP metadata from the document. Can also
  return None if no metadata was found on the document root.

r   )XmpInformationz	/MetadataNmypy)xmpr   r   r,   r   )rB   r   metadatas      rE   xmp_metadataDictionaryObject.xmp_metadata  sO     	)88K.8$$#+V+#&&(h''rG   r   r   c                 f   Ub  [        SS5        UR                  S5        U R                  5        Hl  u  p4[        U5      S:  a  US   S:X  a  US   S:X  a  M(  UR	                  X5        UR                  S5        UR	                  U5        UR                  S	5        Mn     UR                  S
5        g )Nr   r      <<
r   r"   %r   r      
   >>)r   r   rf   r   r   )rB   r   r   r   r   s        rE   r    DictionaryObject.write_to_stream  s     %&A7 	W**,JC3x!|A##b'S.7LL!!&)LL ' 	UrG   rO   r   c           
      h  ^ S[         S[         S[        [            S[        S[         4
S jmS[        S[        S[        4U4S jjnU R                  S	5      nUS
:w  a&  [        S[        U R                  5       5       S35      e0 n [        U 5      nUS:X  a  M  US:X  a  U R                  SS5        [        U 5        M9  U(       d  [        [        5      eUS:X  a  U R                  S5        OU R                  SS5          [        X5      n[        U[         5      (       a  O[        U["        5      (       d  [        SU< 35      e [        U 5      nU R                  SS5        [        XU5      n	UR3                  U5      (       d  XU'   ONS[        U R                  5       5       SU 3nUb  UR$                  (       a  [        U5      e['        U[*        5        GMU  U R                  5       n[        U 5      nUS:X  Ga  U R                  S5      S:X  Ga  U R                  S5      nUS:X  a  U R                  S5      nUS:X  a  M  US;  a  [        S5      eUS:X  a'  U R                  S5      S:w  a  U R                  SS5        [4        R6                  U;  ae  Ub  UR$                  (       a  [        S5      e['        SU R                  5        3[*        5        [9        S5      U[#        [4        R6                  5      '   U[4        R6                     n[        U[:        5      (       a=  U R                  5       nUc   S5       eUR=                  U5      nU R                  US 5        Uc  SnU R                  5       nUS :  a  U R                  U5      US!'   O#[?        U [@        RB                  " S"5      5      US!'   [        U 5      nU R                  S#5      nUU-   S":w  a  U R                  5       nU R                  S$S5        U R                  S%5      nUS":X  a  US!   S S US!'   OUb?  UR$                  (       d.  U R                  US 5        U" X5      US!'   U R                  5       nOSU R                  US 5        [        S&[        U R                  5       5       S'U< S(U< S)35      eOU R                  US 5        S!U;   a  [D        RG                  U5      $ [/        5       n
U
R1                  U5        U
$ ! [         a?  nUb  UR$                  (       a  e ['        UR)                  5       [*        5         S nAGM  S nAff = f! [,         ar  nUb*  UR$                  (       a  [        UR)                  5       5      e['        UR)                  5       [*        5        [/        5       n
U
R1                  U5        U
s S nA$ S nAff = f)*Npp1rem_gensrO   r<   c                     UnU HZ  nUR                   U   n UR                  5        Vs/ s H  opUs=:  a  U::  d  M  O  M  UPM     nnU(       a  [        U/UQ76 nMZ  M\     U$ s  snf ! [         a     Mr  f = frX   )xrefvaluesminr|   )	r   r   r   rO   outgenlocr\   r   s	            rE   get_next_obj_pos;DictionaryObject.read_from_stream.<locals>.get_next_obj_pos  s     Chhsm),EAQ"aaFE!#// 	   J F " s-   A*A%A%A%A*%A**
A87A8r   c                 L  > T" U R                  5       S[        UR                  5      U5      S-
  nU R                  5       nU R                  X R                  5       -
  5      nUR	                  S5      nUS:  a  [        SU S35      eU R                  X5-   S-   5        US US-
   $ )Nl        r"   	   endstreamr   z6Unable to find 'endstream' marker for obj starting at .	   )tellrk   r   r   findr    r   )r   rO   eoncurrrwr   r   s         rE   read_unsized_from_streamCDictionaryObject.read_from_stream.<locals>.read_unsized_from_stream  s     #6;;=%chhMPQQC;;=DS;;=01B%A1u"LTFRST  KK1%gA;rG   r      <<zDictionary read error at byte z: stream must begin with '<<'    r   r   r"      >z)Expecting a NameObject for key but found z+Multiple definitions in dictionary at byte z	 for key    s   s   treamr   )r      z)Stream data must be followed by a newliner  r   zStream length not definedzStream length not defined @pos=r   r   __streamdata__r      ir   z7Unable to find 'endstream' marker after stream at byte z (nd='z', end='z').)$r   rk   r   r   rn   r   r    hexr   r   r   r   r!   r   r   rQ   r(   r'   strictr   __repr__r   rP   r   updater   SALENGTHr)   r&   r   r   recompilerR   initialize_from_dictionary)r   rO   r   r  r   rD   r   r   excr   retvalmsgposr   eollengthtpstartendstreamendr   s                        @rE   r   !DictionaryObject.read_from_stream  s   			'+Cy	7H				%6		 kk!n%<0V[[]1C0D E. .   "%f-Cg~d{B"!&)$%ABBd{AKKA%f2C!#z22%c:66*GwO  7 *&1B"#FA 88C==!S	 B6;;=)*)C5:  ?szz&s++sH-e h kkm'9Q83++a.C +kk!n +.($%PQQe|A% 7B"yy$?szz()DEE5fkkm_Ex /;2.>Z		*+"))_F&.11KKM../Aq!~[[]F{)/V)<%&)9BJJ|4*%& $F+A{{1~HH- kkmC#kk!n,&-12B-CCR-HD)*_SZZKK*-Ef-RD)* ++-CKKQ'&Qv{{}-.fXLsT ' .0 KKQt#::4@@!#d} $ 3::"3<<>8<	  ?szz&s||~66s||~x8)+d#sI     S) !$S) *T5 )
T233T-&T5 -T22T5 5
V1?A'V,&V1,V1r   rX   )$r   r   r   r   r   r>   r   r	   r   r
   rm   r   rM   rl   ra   r   rZ   r   r   r   r   r   r*   r   propertyr   r   r   rn   r   r   r   rk   r   r   r   rH   rG   rE   r   r   	  s   # 
" !&=?	#   sCx 9:	
 
0oo $o 	o
  sCx 9:o U38_%o 
ob

# 

+3 +3 + s c 22s 23 23 21c 1(3- 13 18s 8y 8 (h'=> ( (. MQ 27c58H2I	"  HL__'(_ tS$s)T#s(^CD_ 
	_ _rG   r   c                   2   \ rS rSrSS\\   SS4S jjrS\4S jrS\	4S jr
S\\	   4S jrS	\	S
\SS4S jrS\S\S 4   S\SS4S jrS\S\S 4   S\SS4S jr SS	\	S\	S
\S\\S\	4      S\4
S jjrS\	S\	S\	S\	SS4
S jrS	\	SS4S jrSS jrSS jrSrg)
TreeObjecti  Ndctr<   c                 `    [         R                  U 5        U(       a  U R                  U5        g g rX   )r   __init__r  )rB   r'  s     rE   r)  TreeObject.__init__  s$    !!$'KK rG   c                     SU ;   $ )N/FirstrH   rb   s    rE   has_childrenTreeObject.has_children  s    4rG   c                 "    U R                  5       $ rX   )childrenrb   s    rE   __iter__TreeObject.__iter__  s    }}rG   c              #     #    U R                  5       (       d  g U [        S5         nUR                  5       n Uv   X [        S5         :X  a  g UR                  [        S5      5      n[	        U5      (       a  g UR                  5       nMS  7f)Nr,  /Lastr   )r-  r'   r   r   r,   )rB   	child_refchilds      rE   r0  TreeObject.children  s       ""H-.	$$&KZ011		*W"56Iy))((*E s   B	Br6  rO   c                 *    U R                  US U5        g rX   )insert_child)rB   r6  rO   s      rE   	add_childTreeObject.add_child  s    %s+rG   parentnc                 <   [        U5      (       a  g Uc   S5       e[        SUR                  5       5      nSU;   aa  [        [	        S[        [
        U[        S5         5      U-   5      5      U[        S5      '   U R                  UR                  SS 5      U5        g g )Nr   r&  /Countr   r   )	r,   r   r   r)   maxr   r'   inc_parent_counter_defaultr   )rB   r<  r=  s      rE   rA  %TreeObject.inc_parent_counter_default  s     6""!)6)!lF$5$5$78v+7AtC
8(<!=>BC,F:h'( ++FJJy$,GK	 rG   c                    [        U5      (       a  g Uc   S5       e[        SUR                  5       5      nUR                  SS5      S:H  n[        [        UR                  SS5      5      nUS:  a  [        U5      n[        XB-   U(       a  SOS-  5      U[        S5      '   U(       d  g U R                  UR                  S	S 5      U5        g )
Nr   r&  z
/%is_open%Tr?  r   r"   r   r   )	r,   r   r   r   r   absr)   r'   inc_parent_counter_outline)rB   r<  r=  opnr   s        rE   rE  %TreeObject.inc_parent_counter_outline  s     6""!)6)!lF$5$5$78jjt,4fjj1-.q5AA'3QUCqR4P'Qz(#$''

9d(CQGrG   beforeinc_parent_counter.c                    Uc  U R                   nUR                  5       nUR                  nSU ;  au  X[        S5      '   [	        S5      U [        S5      '   X[        S5      '   U R                  U[        S5      '   U" XR                  SS5      5        SU;   a  US	 SU;   a  US	 U$ [        S	U S   5      nUR                  U:w  a  SU;   a  [        S
US   5      nOx[        S
U5      U[        S5      '   UR                  U[        S5      '   U R                  U[        S5      '   SU;   a  US	 X[        S5      '   U" XR                  SS5      5        U$ UR                  U:w  a  M   [        US   [        5      (       d   eXS   [        S5      '   US   U[        S5      '   Xe[        S5      '   X[        S5      '   U R                  U[        S5      '   U" XR                  SS5      5        U$ ! [         a    US	  N[f = f)Nr,  r   r?  r4  r   r"   r   r   r   r&  )
rA  r   rN   r'   r)   r   r   rQ   r   rP   )rB   r6  rH  rO   rI  	child_objprevs          rE   r9  TreeObject.insert_child  s    %!%!@!@$$&	(( 4).H%&)5aDH%&(-G$%/3/F/FIj+,t]]8Q%?@)#g&)#g&L&W6%%/$L$w-8,0u,EZ()151H1H	*W-.373J3J	*Y/0i'!'*,1Z()"4x)CD %%/	#d7m-=>>>>16M*W-.-1']Ij)* *.*W%&$)Z !+/+B+B	*Y'(4x!;<  	#'"	#s   ';G. .G>=G>rL  prev_refcurlastc                 ^   UR                  [        S5      S5      nUc  U(       aP  UR                  5       nU[        S5      	 XP[        S5      '   [        U [        S5         S-
  5      U [        S5      '   g[        S5      U [        S5      '   U [        S5      	 [        S5      U ;   a  U [        S5      	 ggU(       a+  UR                  5       nX&[        S5      '   XQ[        S5      '   O X4:X  d   eU[        S5      	 X [        S5      '   [        U [        S5         S-
  5      U [        S5      '   g)	zp
Adjust the pointers of the linked list and tree node count.

Args:
    prev:
    prev_ref:
    cur:
    last:

r   Nr   r,  r?  r"   r   r4  )r   r'   r   r)   )rB   rL  rN  rO  rP  next_refnext_objs          rE   _remove_node_from_tree!TreeObject._remove_node_from_tree  s'    77:g.5<#..0Z01-5Z)*-9H-.2.Z)* .:!_Z)*H-.g&$.Z01 / #..008G,-,4Z() {"{G,-,4Z())5d:h;O6PST6T)UDH%&rG   c                    UR                  5       nUR                  n[        S5      U;  a  [        S5      eU[        S5         U :w  a  [        S5      eSnS nS nU [        S5         nUR                  5       nU [        S5         nUR                  5       n	UbU  Xr:X  a  U R	                  XTXy5        SnO;UnUn[        S5      U;   a  U[        S5         nUR                  5       nOS nS nUb  MU  U(       d  [        S	5      e[        U5        g )
Nr   /Removed child does not appear to be a tree itemz*Removed child is not a member of this treeFr,  r4  Tr   z"Removal couldn't find item in tree)r   rN   r'   r|   rT  _reset_node_tree_relationship)
rB   r6  rK  foundrN  rL  cur_refrO  last_refrP  s
             rE   remove_childTreeObject.remove_child>  s   $$&	,,i 	1NOOZ	*+t3IJJ!%j&:!;(/(:(:(<
7+,""$o++DCF HD'"c)j12((* o  ABB%i0rG   c                 t    [        S5      U ;  a  [        S5      e[        SU S   5      R                  U 5        g)z)Remove the object from the tree it is in.r   rW  r&  N)r'   r|   r   r\  rb   s    rE   remove_from_treeTreeObject.remove_from_treec  s4    i ,NOO\4	?+88>rG   c                     U  H  nUR                  5       n[        U5        M      [        S5      U ;   a  U [        S5      	 [        S5      U ;   a  U [        S5      	 [        S5      U ;   a  U [        S5      	 g g )Nr?  r,  r4  )r   rX  r'   )rB   r6  rK  s      rE   
empty_treeTreeObject.empty_treei  sw    E((*I))4  h4'Z)*h4'Z)*g$&Z() 'rG   rH   rX   r<   N)r   r   r   r   r	   r   r)  r   r-  r   r1  r   r0  r   r:  r
   r&   r   rA  rE  r   r9  rT  r\  r_  rb  r   rH   rG   rE   r&  r&    sT   H%56 $ 
 d  # +(3- +,s ,): ,t ,LD.,>?LDGL	LHD.,>?HDGH	H, <@00 0 	0
 %Xc3h%780 
0d)V)V#&)V-0)V8;)V	)VV#1# #1$ #1J?
*rG   r&  rK  r<   c                     U [        S5      	 [        S5      U ;   a  U [        S5      	 [        S5      U ;   a  U [        S5      	 gg)z
Call this after a node has been removed from a tree.

This resets the nodes attributes in respect to that tree.

Args:
    child_obj:

r   r   r   N)r'   )rK  s    rE   rX  rX  v  sJ     	*Y'('i'j)*'i'j)* (rG   c                   F  ^  \ rS rSrSS jrS\SS 4S jrS\S\S\S	\	\
\\\4         S
\\\\4      SS4U 4S jjrS\4U 4S jjrS\4S jrS\SS4S jrS\4U 4S jjr SS\S\S\\4   SS4S jjr\S\\\4   S\S   4S j5       rSS\SS4S jjrS\4S jrSrU =r$ )rR   i  r<   Nc                      SU l         S U l        g NrG   _datadecoded_selfrb   s    rE   r)  StreamObject.__init__  s    
;?rG   r;   c                    [        SU R                  U R                  5       US5      5      nU R                  Ul         U R                  nUc  S U l        O![        SUR                  U5      5      U l         U R                  5        H:  u  pE[        US5      (       a  UR                  U5      OUX$R                  U5      '   M<     U$ ! [         a     N\f = f)NrR   FDecodedStreamObjectr>   )	r   r?   r`   rj  rk  r>   rP   rf   r@   rB   r;   r   rk  r   r   s         rE   r>   StreamObject.replicate  s     !!$.."2HeD
 JJ			,,L#$(!$()<+A+A(+K%!
 JJLDA)0K)@)@H%a H%& ! 
  		s   C  C 
CCr   rI   rJ   r   c                   > [        SU5      R                  U l         [        SU5      R                  nUc  SU l        O"[        SUR                  X#U5      5      U l         [
        TU ]  XX4U5        g! [         a     Nf = f)d
Update the object from src.

Args:
    src:
    pdf_dest:
    force_duplicate:
    ignore_fields:

rR   Nrn  )r   rj  rk  rM   rP   superr   )rB   r   r;   rI   rJ   r   rk  r`   s          rE   r   StreamObject._clone  s    $ .#.44

	4AAL#$(!$() &&x-P%! 	sogN  		s    A3 !A3 3
B ?B c                 J   > [        [        TU ]	  5       U R                  45      $ )rV   )r_   rs  rZ   rj  )rB   r`   s    rE   rZ   StreamObject.hash_bin  s!     UW%'455rG   c                     U R                   $ rX   rj  rb   s    rE   get_dataStreamObject.get_data  s    zzrG   rD   c                     Xl         g rX   rx  )rB   rD   s     rE   set_dataStreamObject.set_data  s    
rG   c                 H   > [         TU ]  5       nXR                  5       -  nU$ rX   )rs  hash_value_datary  rB   rD   r`   s     rE   r  StreamObject.hash_value_data  s#    w&(rG   r   r   c                 X   Ub  [        SS5        [        [        U R                  5      5      U [	        [
        R                  5      '   [        R                  X5        U [
        R                  	 UR                  S5        UR                  U R                  5        UR                  S5        g )Nr   r   s   
stream
s
   
endstream)
r   r)   r   rj  r'   r  r  r   r   r   )rB   r   r   s      rE   r   StreamObject.write_to_stream  sz     %&A7 '33tzz?&CZ		"#((6O]#TZZ ^$rG   )EncodedStreamObjectrn  c                     [         R                  U ;   a  [        5       nO
[        5       nU S   Ul        U S	 [         R
                  U ;   a  U [         R
                  	 UR                  U 5        U$ )Nr  )r  FILTERr  rn  rj  r  r  )rD   r  s     rE   r  'StreamObject.initialize_from_dictionary  s^    
 99(*F(*F,-!"99RYYdrG   levelr  c           	         SSK Jn  [        R                  U ;   a  U [        R                     n[	        U[
        5      (       ac  [        [        [        R                  5      /UQ5      n [        [        5       /U R                  [        R                  [        5       5      Q5      nO{[        [        [        R                  5      U/5      n[        [        5       U R                  [        R                  [        5       5      /5      nO[        [        R                  5      nS n[        5       nUR                  U 5        X5[        [        R                  5      '   Ub  XE[        [        R                  5      '   UR                  U R                   U5      Ul        U$ ! [         a>    [        [        5       U R                  [        R                  [        5       5      /5      n Nf = f)Nr   FlateDecode)filtersr  r  r  rQ   r9   r'   FTFLATE_DECODEr(   r   DECODE_PARMS	TypeErrorr  r  encoderj  )rB   r  r  fparamsr  s         rE   flate_encodeStreamObject.flate_encode  sV   )99RYYA![))BOO!< Aq AB(#Q+-(PQF  BOO!<a @A$\488BOOZ\#JK 2??+AF$&d()z"))$%28:boo./"))$**e<' ! (#txx'OPFs   )<F AG G c                     SSK Jn  U R                  SS5      S:w  a    U R                   S3n[        U[        5        U" U 5      u  p4nUc  gU$ ! [         a    U R                  5        S3n N@f = f)	a  
Try to decode the stream object as an image

Returns:
    a PIL image if proper decoding has been found
Raises:
    Exception: Errors during decoding will be reported.
        It is recommended to catch exceptions to prevent
        stops in your program.

r   )_xobj_to_imagez/Subtype z/Imagez does not seem to be an Imagez$ object does not seem to be an ImageN)r  r  r   rN   AttributeErrorr  r   r   )rB   r  r  	extension_imgs         rE   decode_as_imageStreamObject.decode_as_image  s     	-88J#x/O0011NO 3)*40	c
 " O))MNOs   A A.-A.ri  rd  rX   )r   ) r   r   r   r   r)  r   r>   r   r   r	   r   r
   rm   r   rl   ra   r   rZ   rn   ry  r|  r  r   r   r   r   r   r  r  r  r   __classcell__r`   s   @rE   rR   rR     sE   @# 
2OO $O 	O
  sCx 9:O U38_%O 
O@	6# 	6% U t   MQ% %27c58H2I%	% 38n	;	< # /D @  rG   rR   c                       \ rS rSrSrg)rn  i3  rH   N)r   r   r   r   r   rH   rG   rE   rn  rn  3  s    rG   rn  c                   L   ^  \ rS rSrS	S jrS\4S jrS\SS4U 4S jjrSrU =r	$ )
r  i7  r<   Nc                     S U l         g rX   rk  rb   s    rE   r)  EncodedStreamObject.__init__8  s
    ;?rG   c                 n   SSK Jn  U R                  b  U R                  R                  5       $ [	        5       nUR                  U" U 5      5        U R                  5        H>  u  p4U[        R                  [        R                  [        R                  4;  d  M:  XBU'   M@     X l        UR                  5       $ )Nr   )decode_stream_data)r  r  rk  ry  rn  r|  rf   r  r  r  r  )rB   r  decodedr   r   s        rE   ry  EncodedStreamObject.get_data<  s    0($$--// &'+D12**,JC299biiAA$ ' $!!rG   rD   c                   > SSK Jn  U R                  [        R                  S5      [
        R                  [
        R                  /4;   a  [        U[        5      (       d  [        S5      eU R                  c  U R                  5         U R                  c   S5       eU R                  R                  U5        [        TU ]1  UR                  U5      5        g [        S5      e)Nr   r  r  zData must be bytesr   zJStreams encoded with a filter different from FlateDecode are not supported)r  r  r   r  r  r  r  rQ   rn   r  rk  ry  r|  rs  r  r    )rB   rD   r  r`   s      rE   r|  EncodedStreamObject.set_dataM  s    )88BIIr"r8I&JJdE** 455  ($$08&80&&t,G[//56\ rG   r  rd  )
r   r   r   r   r)  rn   ry  r|  r   r  r  s   @rE   r  r  7  s-    @"% ""U t  rG   r  c                     ^  \ rS rSrSr SS\S\S\S\\\   \	\
\4   4   SS4U 4S jjjrS	\SS 4S
 jr  SS	\S\S\\\\\
4         SS 4S jjrS\S	\S\S\\\\\
4         S\\\
\
4      SS4U 4S jjrS\SS4S jrS\S\	\\4   4S jrS\4S jrS\SS4U 4S jjr\S\\\\4      4S j5       r\R<                  S\\\\4      SS4S j5       rSS jr SS\S\S\\4   SS4U 4S jjjr Sr!U =r"$ ) ContentStreami^  au  
In order to be fast, this data structure can contain either:

* raw data in ._data
* parsed stream operations in ._operations.

At any time, ContentStream object can either have both of those fields defined,
or one field defined and the other set to None.

These fields are "rebuilt" lazily, when accessed:

* when .get_data() is called, if ._data is None, it is rebuilt from ._operations.
* when .operations is called, if ._operations is None, it is rebuilt from ._data.

Conversely, these fields can be invalidated:

* when .set_data() is called, ._operations is set to None.
* when .operations is set, ._data is set to None.
Nr   rO   r   r<   c                 X  > X l         / U l        Uc  [        TU ]  S5        GOUR	                  5       n[        U[        5      (       a  SnU H  nUR	                  5       n[        U[        5      (       a  M*  [        U[        5      (       d(  [        S[        U5      R                   S3[        5        OXFR                  5       -  n[        U5      S:X  d  US   S:w  d  M  US-  nM     [        TU ]  [        U5      5        O$UR                  5       nUc   e[        TU ]  U5        X0l        g )NrG   zExpected StreamObject, got z instead. Data might be wrong.r   r   r   )rO   _operationsrs  r|  r   rQ   r9   r(   rR   r   typer   ry  r   rn   r   )	rB   r   rO   r   rD   r   
s_resolvedstream_datar`   s	           rE   r)  ContentStream.__init__s  s    46 >GS!&&(F&+..A!"J!*j99 %j,?? '9$z:J:S:S9TTrs$
  3 3 554yA~bU):    t-$oo/"... -.rG   r;   c           	         [        SU R                  U R                  S S 5      US5      5      nU R                  Ul         U R                  nUc  S U l        O![        SUR                  U5      5      U l         U R                  5        H:  u  pE[        US5      (       a  UR                  U5      OUX$R                  U5      '   M<     U$ ! [         a     N\f = f)Nr  Frn  r>   )r   r?   r`   rj  rk  r>   rP   rf   r@   r|  rO   rk   r  r   ro  s         rE   r>   ContentStream.replicate  s     !!$..t"<hN
 JJ			,,L#$(!$()<+A+A(+K%!
 JJLDA)0K)@)@H%a H%& ! 
  		s    C  C 
CCrI   rJ   c           	      
    U R                   R                  U:X  a	  U(       d  U $ [        5       n[	        SU R                  U R                  SS5      X5      5      nUc  / nUR                  XX#U5        U$ ! [         a     N\f = f)z
Clone object into pdf_dest.

Args:
    pdf_dest:
    force_duplicate:
    ignore_fields:

Returns:
    The cloned ContentStream

r  N)rN   rO   rP   rl   r   r?   r`   r   r   s         rE   rM   ContentStream.clone  s    $	&&**h6 ),!!tT*H
  M

4?7K
  		s   "A5 5
BBr   r   c                    > [        SU5      n[        TU ]	  UR                  5        X l        [        UR                  5      U l        UR                  U l        g)rr  r  N)r   rs  r|  rj  rO   rk   r  r   )rB   r   r;   rI   rJ   r   src_csr`   s          rE   r   ContentStream._clone  sH    $ os+& 2 23%55rG   c                 4   UR                  SS5        / n [        U5      nUS;   a  g UR                  SS5        UR                  5       (       d  US;   av  [        U[        R
                  5      nUS:X  a7  U/ :X  d   eU R                  U5      nU R                  R                  US45        OkU R                  R                  X$45        / nOLUS:X  a   US	;  a  UR                  S5      nUS	;  a  M  O&UR                  [        US U R                  5      5        GM  )
Nr   )rG   r   r   r"   )   '   "   BI   INLINE IMAGEr   )r  r   rG   )r   r   isalphar   r'   delimiter_pattern_read_inline_imager  rA   r   r   r   )rB   r   operandspeekoperatoriis         rE   _parse_content_stream#ContentStream._parse_content_stream  s   Aq57&v.DxKKA||~~!5+FJ4P4PQu$ $r>)>008B$$++R,AB$$++X,@A!H "55!;;q>D "55 FD$:N:N OP3 rG   c           	         [        5       n [        U5      nUR                  SS5        US:X  a  OM[        XR                  5      n[        U5      nUR                  SS5        [        XR                  5      nXRU'   Mq  UR                  S5      nUS S S:X  d   eUR                  SUR                  SS	5      5      nUR                  5       n[        U[        5      (       a  US
   nSU;   d  SU;   a  [        U5      n	GO2SU;   d  SU;   a  [        U5      n	GOSU;   d  SU;   a  [        U5      n	GO SU;   d  SU;   a  [        U5      n	OUS	:X  a  UR                  SS5      n
[        U
[        5      (       a  U
S
   n
SU
;   a  SnO<SU
;   a  SnO3UR                  SU
S;   a  SOS5      nUS
:  a  US-  nO[        U5      n	SnUS
:  aB  UR                  [        [!        ["        US   5      U-  5      [!        ["        US   5      -  5      n	[        U5      nUR                  SS5        O[        U5      n	UR                  S5      nUR                  SS5        US S S:w  d  USS [$        ;  ae  UR                  US
5        [        U5      n	UR                  S5      nUR                  SS5        US S S:w  d  USS [$        ;  a  ['        SU< 35      eUW	S .$ )!Nr   r"      Ir5   r   s   ID/Fz/Filterznot setr   AHxASCIIHexDecodeA85ASCII85DecodeRLRunLengthDecodeDCT	DCTDecodez/CSr  RGBCMYK   z/BPC>   /G/I/Indexed/DeviceGrayr  g       @z/Wz/H   EIzHCould not extract inline image, even using fallback. Expected 'EI', got )settingsrD   )r   r   r   r   rO   r   r   r   rQ   rk   r/   r.   r2   r0   r1   r   r   r   r   r!   )rB   r   r  r   r   r   r   filtrsavposrD   cslcsbitseis                 rE   r   ContentStream._read_inline_image  s    $%%f-CKKAd{fhh/C%f-CKKA1E!SM  kk!n2Aw%T8<<	9#EFeT""!HEE>-6%f-De^%7%f-DU]/58$V,De^{e3%f-DieR(B"d##U{2||FFAB !8*C1&9DCQw{{c8D>2S89Dhtn<UU %V,BKKA)&1D[[^Bbq6U?b1g[8KK")&1DQBKKA"1v"Qq'"< %^_a^de  %d33rG   c                 \   U R                   (       Gd  [        5       nU R                   H  u  p#US:X  a  UR                  S5        [        5       nUS   R	                  U5        UR                  UR                  5       SS 5        UR                  S5        UR                  US   5        UR                  S5        O<U H%  nUR	                  U5        UR                  S	5        M'     UR                  U5        UR                  S
5        M     UR                  5       U l         U R                   $ )Nr  r  r  r   s   ID rD   r  r   r   )rj  r   r  r   r   getvalue)rB   new_datar  r  	dict_textops         rE   ry  ContentStream.get_dataa  s    zzzyH&*&6&6".NN5) '	IZ(88CNN9#5#5#7"#=>NN6*NN8F#34NN5)&**84 t, ' NN8,u% '7 "**,DJzzrG   rD   c                 2   > [         TU ]  U5        / U l        g rX   )rs  r|  r  r  s     rE   r|  ContentStream.set_dataw  s    rG   c                     U R                   (       d<  U R                  (       a+  U R                  [        U R                  5      5        SU l        U R                   $ rh  )r  rj  r  r   rb   s    rE   
operationsContentStream.operations{  s;    DJJ&&wtzz':;DJrG   r  c                     Xl         SU l        g rh  )r  rj  )rB   r  s     rE   r  r    s    %
rG   c                     U R                   (       a<  U R                   R                  S/ S45        U R                   R                  / S45        g U R                  (       a  SU R                  -   S-   U l        g g )Nr      q   Qs   q
s   
Q
)r  insertrA   rj  rb   s    rE   isolate_graphics_state$ContentStream.isolate_graphics_state  s^    ##ADz2##RJ/ZZ$**,x7DJ rG   r   c                    > U R                   (       d!  U R                  (       a  U R                  5         [        TU ]  X5        g rX   )rj  r  ry  rs  r   )rB   r   r   r`   s      rE   r   ContentStream.write_to_stream  s*     zzd..MMO7rG   )rj  r  rk  r   rO   rX   r   rd  )#r   r   r   r   __doc__r   r
   rm   rk   r   r   r)  r   r>   r   r	   r   rM   r   rl   ra   r   r   r  r  rn   ry  r|  r$  r  setterr  r   r   r  r  s   @rE   r  r  ^  s   0 HL	%/%/ %/ tS$s)T#s(^CD	%/
 
%/ %/N# 
B !&=?	"" "  sCx 9:	"
 
"H66 $6 	6
  sCx 9:6 U38_%6 
64QJ Q4 Q>I4 I4S#X I4X% ,U t   DsEz!23     T%U
*;%<   8 MQ8 827c58H2I8	8 8rG   r  r   rO   r   c                 p   U R                  S5      nU R                  SS5        US:X  a  [        R                  " X5      $ US:X  aJ  U R                  S5      nU R                  SS5        US:X  a  [        R                  XU5      $ [        X5      $ US:X  a  [        R                  XU5      $ US	;   a  [        R                  " U 5      $ US
:X  a  [        X5      $ US:X  a  U R                  S5      S:X  a
  [        5       $ US:X  a  [        R                  " U 5      $ US:X  a4  [        U 5        [        U 5      nU R                  SS5        [        XU5      $ US;   ay  U R                  S5      nU R                  [        U5      * S5        [        R                  U5      b   Uc   S5       e[         R                  " X5      $ ["        R                  " U 5      $ U R%                  5       nU R                  SS5        U R                  S5      nU R                  U5        ['        U 5        [)        SU< SU SU< 35      e)Nr"   r      /   <r   r  r  r   )   t   f   (   e   s   endobj   nr   s   0123456789+-.   r   iP   z(Invalid Elementary Object starting with z @z: )r   r   r'   r   r   r3   r9   r#   r4   r(   r   r   r   r   IndirectPatternmatchr&   r)   r   r   r    )r   rO   r   r   r  r  stream_extracts          rE   r   r     s   
 ++a.C
KKA
d{**677
d{{{1~B5=#44V/RR*6CC
d{++FII
l--f55
d{&v??
d{v{{1~2|
d{**622
d{&!!&)B688
{{2SYJ"  &2?*F*?!226??,,V44
++-C
KKQ[[_N
KK&!

23'C5>BTU rG   c                   V   \ rS rSrSrS\SS4S jr\S\\	   4S j5       r
\S\\   4S j5       r\S\S	   4S
 j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       rSrg)Fieldi  z{
A class representing a field dictionary.

This class is accessed through
:meth:`get_fields()<pypdf.PdfReader.get_fields>`
rD   r<   Nc                 6   [         R                  U 5        [        R                  " 5       [        R                  " 5       -   nUR
                  U l        U H  n X   U [        U5      '   M     [        U R                  S5      [        5      (       ay  [        [        U [        S5         5      R                  5       n[        U[        5      (       a  UR                  5       nOUc  SnO[        S5      e[!        U5      U [        S5      '   g g ! [         a     M  f = f)Nr   r  zShould never happen)r   r)  r   
attributesr   rN   r'   r   rQ   r   r  r   ry  rn   decoderP   r+   )rB   rD   field_attributesattrdd_strs         rE   r)  Field.__init__  s    !!$'%002+6689 	 #'"9"9$D)-Z%& %
 dhhtn&9::($z$/?*@AJJLA!U##
 566%5e%<DD!" ;  s   D


DDc                 @    U R                  [        R                  5      $ )z4Read-only property accessing the type of this field.)r   r   r  rb   s    rE   
field_typeField.field_type       xx14455rG   c                 @    U R                  [        R                  5      $ )z6Read-only property accessing the parent of this field.)r   r   Parentrb   s    rE   r<  Field.parent  s     xx18899rG   r9   c                 @    U R                  [        R                  5      $ )z4Read-only property accessing the kids of this field.)r   r   Kidsrb   s    rE   kids
Field.kids  s     xx16677rG   c                 @    U R                  [        R                  5      $ )z4Read-only property accessing the name of this field.)r   r   Trb   s    rE   name
Field.name  s     xx13344rG   c                 @    U R                  [        R                  5      $ )z>Read-only property accessing the alternate name of this field.)r   r   TUrb   s    rE   alternate_nameField.alternate_name  r  rG   c                 @    U R                  [        R                  5      $ )z
Read-only property accessing the mapping name of this field.

This name is used by pypdf as a key in the dictionary returned by
:meth:`get_fields()<pypdf.PdfReader.get_fields>`
)r   r   TMrb   s    rE   mapping_nameField.mapping_name       xx14455rG   c                 @    U R                  [        R                  5      $ )z
Read-only property accessing the field flags, specifying various
characteristics of the field (see Table 8.70 of the PDF 1.7 reference).
)r   r   Ffrb   s    rE   flagsField.flags  s     xx14455rG   c                 @    U R                  [        R                  5      $ )z[
Read-only property accessing the value of this field.

Format varies based on field type.
)r   r   Vrb   s    rE   r   Field.value  s     xx13344rG   c                 @    U R                  [        R                  5      $ )z=Read-only property accessing the default value of this field.)r   r   DVrb   s    rE   default_valueField.default_value  r  rG   c                 @    U R                  [        R                  5      $ )z
Read-only property accessing the additional actions dictionary.

This dictionary defines the field's behavior in response to trigger
events. See Section 8.5.2 of the PDF 1.7 reference.
)r   r   AArb   s    rE   additional_actionsField.additional_actions!  r*  rG   )rN   )r   r   r   r   r  r   r)  r$  r	   r'   r  r<  r  rm   r   r$  r(  r   r-  r   r   r4  r8  r   rH   rG   rE   r
  r
    sW   =- =$ =. 6HZ0 6 6 :!12 : : 8h}- 8 8 5hsm 5 5 6 6 6 6hsm 6 6 6x} 6 6 5x} 5 5 6x} 6 6 6H-=$> 6 6rG   r
  c                      \ rS rSr% SrSr\\   \S'   S\	\
\4   S\	\\\\4   S\SS4S	 jr\SS j5       r SS\S\	S\
\4   SS4S jjr\S\\
   4S j5       r\S\\   4S j5       r\S\\
   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\S
   4S j5       r\S\\    4S j5       r!\S\\   4S j5       r"Sr#g)Destinationi,  a  
A class representing a destination within a PDF file.

See section 12.3.2 of the PDF 2.0 reference.

Args:
    title: Title of this destination.
    page: Reference to the page of this destination. Should
        be an instance of :class:`IndirectObject<pypdf.generic.IndirectObject>`.
    fit: How the destination is displayed.

Raises:
    PdfReadError: If destination type is invalid.

Nnodetitlepagefitr<   c                    / U l         UR                  nUR                  n[        R	                  U 5        [        U5      U [        S5      '   X [        S5      '   X@[        S5      '   US:X  a  [        U5      S:  a  UR                  [        S5      5        [        U5      S:  a  UR                  [        S5      5        [        U5      S:  a  UR                  [        S5      5        Uu  U [        [        R                  5      '   U [        [        R                  5      '   U [        S	5      '   g [        U5      S
:X  a  g U[        R                  :X  ap  Uu  U [        [        R                  5      '   U [        [        R                  5      '   U [        [        R                   5      '   U [        [        R                  5      '   g U[        R"                  [        R$                  4;   a    Uu  U [        [        R                  5      '   g U[        R*                  [        R,                  4;   a    Uu  U [        [        R                  5      '   g U[        R.                  [        R0                  4;   a  g [3        SU< 35      e! [&         a'    [)        5       U [        [        R                  5      '    g f = f! [&         a'    [)        5       U [        [        R                  5      '    g f = f)N/Title/Pager   z/XYZr"   g        r   r5   /Zoomr   zUnknown Destination Type: )_filtered_childrenfit_typefit_argsr   r)  r+   r'   r   rA   r)   TALEFTTOPTFFIT_RBOTTOMRIGHTFIT_HFIT_BHrP   r(   FIT_VFIT_BVFITFIT_Br    )rB   r=  r>  r?  typargss         rE   r)  Destination.__init__A  s1    .0ll||!!$'%5e%<Z!"$(Z !$'Z ! &=4y1}L-.4y1}L-.4y1}L-.
 	Z()Z'(Z()Y!^BHH_ Z()Z		*+Z)*Z'(RXXryy))>.2+j() RXXryy))?/3,j)* RVVRXX&&!;C7CDD  >/9|j()>
  ?0:j)*?s$   'I> +J2 >.J/.J/2.K#"K#r9   c                     [        U R                  S5      U S   /S Vs/ s H  nX;   d  M
  X   PM     sn-   5      $ s  snf )NrB  r   )/Left/Bottom/Right/ToprC  )r9   r   )rB   r\   s     rE   
dest_arrayDestination.dest_arrayv  sU    \\'"DM2 IHA9 H
 	
s   	=
=
r   r   c                    Ub  [        SS5        UR                  S5        [        S5      nUR                  U5        UR                  S5        U R                  nUR                  U5        [        S5      nUR                  U5        UR                  S5        [        S5      nUR                  U5        UR                  S5        UR                  S	5        g )
Nr   r   r   z/Dr   z/Sz/GoTor   r   )r   r   r'   r   r\  )rB   r   r   r   r   value_ss         rE   r   Destination.write_to_stream  s     %&A7 	WF#Tf%F#TW%'UUrG   c                 $    U R                  S5      $ )z3Read-only property accessing the destination title.rA  r   rb   s    rE   r=  Destination.title  s     xx!!rG   c                 $    U R                  S5      $ )zHRead-only property accessing the IndirectObject of the destination page.rB  rb  rb   s    rE   r>  Destination.page       xx  rG   c                 $    U R                  S5      $ )z2Read-only property accessing the destination type.r   rb  rb   s    rE   rT  Destination.typ  rf  rG   c                 &    U R                  SS5      $ )z-Read-only property accessing the zoom factor.rC  Nrb  rb   s    rE   zoomDestination.zoom       xx&&rG   c                 &    U R                  SS5      $ )z<Read-only property accessing the left horizontal coordinate.rX  Nrb  rb   s    rE   leftDestination.left  rl  rG   c                 &    U R                  SS5      $ )z=Read-only property accessing the right horizontal coordinate.rZ  Nrb  rb   s    rE   rightDestination.right  s     xx$''rG   c                 &    U R                  SS5      $ )z9Read-only property accessing the top vertical coordinate.r[  Nrb  rb   s    rE   topDestination.top  s     xx%%rG   c                 &    U R                  SS5      $ )z<Read-only property accessing the bottom vertical coordinate.rY  Nrb  rb   s    rE   bottomDestination.bottom  s     xx	4((rG   c           
      t    U R                  S[        [        S5      [        S5      [        S5      /5      5      $ )zHRead-only property accessing the color in (R, G, B) with values 0.0-1.0.z/Cr   )r   r9   r%   rb   s    rE   colorDestination.color  s2     xx+{1~{1~{1~NO
 	
rG   c                 &    U R                  SS5      $ )zG
Read-only property accessing the font type.

1=italic, 2=bold, 3=both
r  r   rb  rb   s    rE   font_formatDestination.font_format  s     xxa  rG   c                 &    U R                  SS5      $ )z
Read-only property accessing the outline count.

positive = expanded
negative = collapsed
absolute value = number of visible descendants at all levels
r?  Nrb  rb   s    rE   outline_countDestination.outline_count  s     xx$''rG   )rD  )r<   r9   rX   )$r   r   r   r   r  r<  r	   r   __annotations__r
   rm   rn   r)   r&   r(   r-   r)  r$  r\  r   r   r=  r>  rT  r   rj  r%   rn  rq  rt  rw  rz  r   r}  r  r   rH   rG   rE   r;  r;  ,  s	   $ 	 	( 3ES%Z 3E L.*>NNO3E 	3E
 
3Ej 
 
 MQ 27c58H2I	. "x} " " !h~. ! ! !Xc] ! ! 'hsm ' ' 'h{+ ' ' (x, ( ( &Xk* & & )- ) ) 
x. 
 
 !Xo6 ! ! (x} ( (rG   r;  rX   )[
__author____author_email__loggingr  syscollections.abcr   r   ior   mathr   typingr   r   r	   r
   r   
_protocolsr   r   r   _utilsr   r   r   r   r   r   r   r   	constantsr   r   r   r   r  r   r  r   rG  r   rJ  errorsr   r    r!   _baser#   r$   r%   r&   r'   r(   r)   r*   r+   r,   _fitr-   _image_inliner.   r/   r0   r1   r2   r3   r4   version_infor7   typing_extensions	getLoggerr   loggerr  r  rk   r9   r   r   r&  rX  rR   rn  r  r  rm   r   r   r
  r;  rH   rG   rE   <module>r     s  : 
/   	 
 .    V U	 	 	 
 * . * - O O     Iw&			8	$**@Ac$s)Y cLYtCH~y YxN*! N*b+S +T +"i# iX	, 	$, $Nv8' v8x	 DH//	#	$/ 4d3ic3h?@/ 9c3-.	/d`6J `6Fm(* m(rG   