
    %oi                         S SK r S SKrS SKJr  S SKJrJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  \R                  " S5      r\ R"                  " \5      rS	\S
\4S jrS\S
S4S jr " S S5      rg)    N)Iterable)ClassVarcast)glyphname2unicode)ENCODINGPDFKeyError)	PSLiteralz[0-9a-fA-F]+namereturnc           	         [        U [        5      (       d  [        SU  S[        U 5       35      eU R	                  S5      S   n U R	                  S5      n[        U5      S:  a  SR                  [        [        U5      5      $ U [        ;   a	  [        U    $ U R                  S5      (       a  U R                  S5      n[        R                  U5      (       az  [        U5      S	-  S:X  ah  [        S[        U5      S	5       Vs/ s H  n[        X#US	-    S
S9PM     nnU H  n[!        U5        M     [        ["        U5      nSR                  U5      $ OzU R                  S5      (       ad  U R                  S5      n[        R                  U5      (       a9  S	[        U5      s=::  a  S::  a#  O  O [        US
S9n[!        U5        [#        U5      $ [        SU  S35      es  snf )a  Converts Adobe glyph names to Unicode numbers.

In contrast to the specification, this raises a KeyError instead of return
an empty string when the key is unknown.
This way the caller must explicitly define what to do
when there is not a match.

Reference:
https://github.com/adobe-type-tools/agl-specification#2-the-mapping

:returns unicode character if name resembles something,
otherwise a KeyError
z Could not convert unicode name "z?" to character because it should be of type str but is of type .r   _    uni      )baseu   z6" to character because it does not match specification)
isinstancestrr	   typesplitlenjoinmapname2unicoder   
startswithstripHEXADECIMALmatchrangeint#raise_key_error_for_invalid_unicodechr)	r   
componentsname_without_uniiunicode_digitsdigit
charactersname_without_uunicode_digits	            O/var/www/html/land-ocr/venv/lib/python3.13/site-packages/pdfminer/encodingdb.pyr   r      s    dC  .tf 577;DzlD
 	

 ::c?1DCJ
:wws<455	"	" &&			::e,-..37G3H13LPQ3Q q#&6"7;;A $Q/b9;   (3E: (S.1J77:&&			C^,,c.6I1NQ1NR8M/>}%%

*4& 1* 	* #s   Gr/   c                 B    SU s=:  a  S:  a  O  g[        SU  S35      eg)zUnicode values should not be in the range D800 through DFFF because
that is used for surrogate pairs in UTF-16

:raises KeyError if unicode digit is invalid
i  i   zUnicode digit z8 is invalid because it is in the range D800 through DFFFNr   )r/   s    r0   r&   r&   H   s4     }$u$]O ,3 3
 	
 %    c            
          \ rS rSr% 0 r\\\\4      \	S'   0 r
\\\\4      \	S'   0 r\\\\4      \	S'   0 r\\\\4      \	S'   \ HC  u  rrrrr\" \5      r\(       a  \\\'   \(       a  \\
\'   \(       a  \\\'   \(       d  M>  \\\'   ME     \\
\\S.r\\\\\\4   4      \	S'   \ SS	\S
\\   S-  S\\\4   4S jj5       rSrg)
EncodingDBU   std2unicodemac2unicodewin2unicodepdf2unicode)StandardEncodingMacRomanEncodingWinAnsiEncodingPDFDocEncoding	encodingsNr   diffr   c                    U R                   R                  XR                  5      nU(       av  UR                  5       nSnU H^  n[	        U[
        5      (       a  UnM  [	        U[        5      (       d  M3   [        [        [        UR                  5      5      X4'   US-  nM`     U$ ! [        [        4 a(  n[        R                  [        U5      5         S nAN>S nAff = f)Nr   r   )r>   getr6   copyr   r%   r
   r   r   r   r   KeyError
ValueErrorlogdebug)clsr   r?   cid2unicodecidxes          r0   get_encodingEncodingDB.get_encodingl   s     mm''oo>%**,KCa%%C9--*+7S!&&8I+J( 1HC   %j1 *		#a&))*s   5%B%%C5CC )N)__name__
__module____qualname____firstlineno__r6   r   dictr%   r   __annotations__r7   r8   r9   r   r   stdmacwinpdfr   cr>   classmethodr   objectrL   __static_attributes__rN   r2   r0   r4   r4   U   s-   ,.K$sCx.).,.K$sCx.).,.K$sCx.).,.K$sCx.).$, c3S K K K3 K %- ('&%	6IxS$sCx.012   )- v% 
c3h	 r2   r4   )loggingrecollections.abcr   typingr   r   pdfminer.glyphlistr   pdfminer.latin_encr   pdfminer.pdfexceptionsr	   pdfminer.psparserr
   compiler"   	getLoggerrO   rE   r   r   r%   r&   r4   rN   r2   r0   <module>rg      sl     	 $ ! 0 ' . 'jj)!5s 5s 5p

s 

t 

* *r2   