Ë
    Ã?ÆiÚ  ã                   ó‚   — d Z ddl­ ddlmZmZ dedefd„Zdeddfd„Zdedefd	„Z	dedefd
„Z
dedefd„Zdedefd„Zy)u_  NINEA (NumÃ©ro d'Identification Nationale des Entreprises et Associations, Senegal tax number).

The National Identification Number for Businesses and Associations (NINEA) is
a unique tax identifier for tax purposes in Senegal.

This number consists of 7 digits and is usually followed by a 3 digit tax
identification code called COFI (Code dâ€™Identification Fiscale) that is used
to indicate the company's tax status and legal structure.

More information:

* https://www.wikiprocedure.com/index.php/Senegal%5F-_Obtain_a_Tax_Identification_Number
* https://nkac-audit.com/comprendre-le-ninea-votre-guide-de-lecture-simplifie/
* https://www.creationdentreprise.sn/rechercher-une-societe
* https://www.dci-sn.sn/index.php/obtenir-son-ninea
* https://e-ninea.ansd.sn/search_annuaire

>>> validate('306 7221')
'3067221'
>>> validate('30672212G2')
'30672212G2'
>>> validate('3067221 2G2')
'30672212G2'
>>> validate('3067222')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1234567 0AZ')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('30672212G2')
'3067221 2G2'
é    )Ú*)ÚcleanÚisdigitsÚnumberÚreturnc                 ó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©r   s    úV/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/sn/ninea.pyÚcompactr   =   s#   € ô �˜Ó ×&Ñ&Ó(×.Ñ.Ó0Ð0ó    Nc                 ój   — | d   dvr
t        «       ‚| d   dvr
t        «       ‚| d   dvr
t        «       ‚y )Nr   Ú012é   ÚABCDEFGHJKLMNPQRSTUVWZé   Ú
0123456789)ÚInvalidComponentr   s    r   Ú_validate_cofir   F   sM   € ð
 ˆa�y˜ÑÜÓ Ð ð0 ˆa�yÐ0Ñ0ÜÓ Ð ð ˆa�y˜Ñ$ÜÓ Ð ð %r   c                 óf   — | j                  d«      } d}t        d„ t        | |«      D «       «      dz  S )Né	   )	r   r   r   r   r   r   r   r   r   c              3   ó>   K  — | ]  \  }}t        |«      |z  –— Œ y ­w)N)Úint)Ú.0ÚnÚws      r   ú	<genexpr>z_checksum.<locals>.<genexpr>x   s   è ø€ Ò;™d˜a Œs�1‹v˜�zÑ;ùs   ‚é
   )ÚzfillÚsumÚzip)r   Úweightss     r   Ú	_checksumr$   u   s1   € Ø�\‰\˜!‹_€FØ)€GÜÑ;¤c¨&°'Ó&:Ô;Ó;¸bÑ@Ð@r   c                 óø   — d}t        | «      } t        | «      dkD  r
| dd }| dd } t        | «      dvr
t        «       ‚t        | «      s
t	        «       ‚|rt        |«       t        | «      dk7  r
t        «       ‚| |z   S )z^Check if the number is a valid Senegal NINEA.

    This checks the length and formatting.
    Ú r   éýÿÿÿN©é   r   r   )r   ÚlenÚInvalidLengthr   ÚInvalidFormatr   r$   ÚInvalidChecksum)r   Úcofis     r   Úvalidater/   {   s‚   € ð
 €DÜ�V‹_€FÜ
ˆ6ƒ{�Q‚Ø�b�cˆ{ˆØ˜˜�ˆÜ
ˆ6ƒ{˜&Ñ Ü‹oÐÜ�FÔÜ‹oÐÙÜ�tÔÜ�Ó˜AÒÜÓÐØ�D‰=Ðr   c                 óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z-Check if the number is a valid Senegal NINEA.F)Úboolr/   ÚValidationErrorr   s    r   Úis_validr3   �   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                 óh   — t        | «      } t        | «      dv r| S dj                  | dd | dd g«      S )z8Reformat the number to the standard presentation format.r(   ú Nr'   )r   r*   Újoinr   s    r   Úformatr7   ˜   s<   € ä�V‹_€FÜ
ˆ6ƒ{�fÑØˆØ�8‰8�V˜C˜R�[ &¨¨ +Ð.Ó/Ð/r   )Ú__doc__Ústdnum.exceptionsÚstdnum.utilr   r   Ústrr   r   r   r$   r/   r1   r3   r7   © r   r   ú<module>r=      s‰   ðñ,!ôF  ß 'ð1�Cð 1˜Có 1ð,!˜3ð ,! 4ó ,!ð^A�cð A˜có Að�Sð ˜Só ð*�Sð ˜Tó ð0�3ð 0˜3ô 0r   