Ë
    Ã?Æiª  ã                  óN   — d Z ddlmZ ddl­ ddlmZmZ d
d„Zd
d„Zdd„Z	d
d„Z
y	)u›  NRT (NÃºmero de Registre Tributari, Andorra tax number).

The NÃºmero de Registre Tributari (NRT) is an identifier of legal and natural
entities for tax purposes.

This number consists of one letter indicating the type of entity, then 6
digits, followed by a check letter.

More information:

* https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Andorra-TIN.pdf

>>> validate('U-132950-X')
'U132950X'
>>> validate('A123B')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('I 706193 G')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('D059888N')
'D-059888-N'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                óR   — t        | d«      j                  «       j                  «       S )z’Convert the number to the minimal representation.

    This strips the number of any valid separators and removes surrounding
    whitespace.
    z -.)r   ÚupperÚstrip©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/ad/nrt.pyÚcompactr   5   s#   € ô �˜Ó×%Ñ%Ó'×-Ñ-Ó/Ð/ó    c                ó†  — t        | «      } t        | «      dk7  r
t        «       ‚| d   j                  «       r| d   j                  «       s
t	        «       ‚t        | dd «      s
t	        «       ‚| d   dvr
t        «       ‚| d   dk(  r| dd dkD  r
t        «       ‚| d   dv r#d| dd cxk  rd	k  st        «       ‚ t        «       ‚| S )
z Check if the number is a valid Andorra NRT number.

    This checks the length, formatting and other constraints. It does not check
    for control letter.
    é   r   éÿÿÿÿé   Ú
ACDEFGLOPUÚFÚ699999ÚALÚ800000)r   ÚlenÚInvalidLengthÚisalphaÚInvalidFormatr   ÚInvalidComponentr
   s    r   Úvalidater   >   sÐ   € ô �V‹_€FÜ
ˆ6ƒ{�aÒÜ‹oÐØ�!‰9×ÑÔ f¨R¡j×&8Ñ&8Ô&:Ü‹oÐÜ�F˜1˜R�LÔ!Ü‹oÐØˆa�y˜Ñ$ÜÓ Ð Øˆa�y�CÒ˜F 1 R˜L¨8Ò3ÜÓ Ð Øˆa�y�DÑ (¨V°A°b¨\Ô"D¸HÒ"DÜÓ Ð ð #EÜÓ Ð Ø€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z2Check if the number is a valid Andorra NRT number.F)Úboolr   ÚValidationErrorr
   s    r   Úis_validr!   T   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óR   — t        | «      } dj                  | d   | dd | d   g«      S )z8Reformat the number to the standard presentation format.ú-r   r   r   )r   Újoinr
   s    r   Úformatr%   \   s/   € ä�V‹_€FØ�8‰8�V˜A‘Y  q¨ ¨f°R©jÐ9Ó:Ð:r   N)r   ÚstrÚreturnr&   )r   r&   r'   r   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r!   r%   © r   r   ú<module>r-      s)   ðñ*õ4 #ä ß 'ó0óó,ô;r   