
    )i1                         S r SSKrSSKrS\S\4S jr\R
                  " S\R                  5      r\R
                  " S\R                  5      rS\S\4S jr	g)	zhPython implementation of ASCII85/ASCIIHex decoder (Adobe version).

This code is in the public domain.

    Ndatareturnc                    S=pSn[        U 5       H  n[        U45      nSU::  aF  US::  a@  US-  nUS-  [        U5      S-
  -   nUS:X  a  U[        R                  " S	U5      -  nS=pMY  M[  US
:X  a  US:X  d   [        U5      5       eUS-  nM~  US:X  d  M  U(       a=  [        SU-
  5       H  nUS-  S-   nM     U[        R                  " S	U5      SUS-
   -  n  U$    U$ )aY  
In ASCII85 encoding, every four bytes are encoded with five ASCII
letters, using 85 different types of characters (as 256**4 < 85**5).
When the length of the original bytes is not a multiple of 4, a special
rule is used for round up.

The Adobe's ASCII85 implementation is slightly different from
its original in handling the last characters.

r          !   u   U   !      z>L   zs          ~T   N)iterbytesordstructpackstrrange)r   nboutic_s          P/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/pdfminer/ascii85.pyascii85decoder      s     IA
C$Z1$K19dFAB#a&2+&AAvv{{4++	A  $Y6!3q6!6;C$Yq1uABA &v{{4+Ga!e44J# " Jr   s   ([a-f\d]{2})s#   ^(?:[a-f\d]{2}|\s)*([a-f\d])[\s>]*$c                     S[         S[         4S jnSn[        R                  U 5       H  nX!" U5      -  nM     [        R	                  U 5      nU(       a  X!" UR                  S5      S-   5      -  nU$ )a  
ASCIIHexDecode filter: PDFReference v1.4 section 3.3.1
For each pair of ASCII hexadecimal digits (0-9 and A-F or a-f), the
ASCIIHexDecode filter produces one byte of binary data. All white-space
characters are ignored. A right angle bracket character (>) indicates
EOD. Any other characters will cause an error. If the filter encounters
the EOD marker after reading an odd number of hexadecimal digits, it
will behave as if a 0 followed the last digit.
xr   c                 2    [        U S5      n[        U45      $ )N   )intr   )r    r   s     r   decodeasciihexdecode.<locals>.decode=   s    2JaT{r   r   r	      0)r   hex_refindalltrail_researchgroup)r   r$   r   r    ms        r   asciihexdecoder-   2   sq    % E  C^^D!vay " 	Avaggaj4'((Jr   )
__doc__rer   r   r   compile
IGNORECASEr'   r)   r-    r   r   <module>r3      se    
  % D 
$bmm	4::=r}}M 5 r   