Ë
    Ã?Æ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=  CUI or CIF (Codul Unic de ÃŽnregistrare, Romanian company identifier).

The CUI (Codul Unic de ÃŽnregistrare) is assigned to companies that are
required to register with the Romanian Trade Register. The CIF (Codul de
identificare fiscalÄƒ) is identical but assigned to entities that have no such
requirement. The names seem to be used interchangeably and some sources
suggest that CIF is the new name for CUI.

This number can change under some conditions. The number can be prefixed with
RO to indicate that the entity has been registered for VAT.

More information:

* https://ro.wikipedia.org/wiki/Cod_de_identificare_fiscalÄƒ

>>> validate('185 472 90')
'18547290'
>>> validate('185 472 91')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('RO 185 472 90')  # the RO prefix is ignored
'18547290'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                ó‚   — t        | d«      j                  «       j                  «       } | j                  d«      r| dd } | S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -ÚROé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/ro/cui.pyÚcompactr   4   s@   € ô �6˜4Ó ×&Ñ&Ó(×.Ñ.Ó0€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c                óˆ   — d}| j                  d«      } dt        d„ t        || «      D «       «      z  }t        |dz  dz  «      S )zCalculate the check digit.)	é   é   é   r	   é   r   r   r   r	   é	   é
   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w)N)Úint)Ú.0ÚwÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>A   s   è ø€ ÒA¡D A q�Qœ˜Q›•ZÑAùs   ‚é   )ÚzfillÚsumÚzipÚstr)r   ÚweightsÚchecks      r   Úcalc_check_digitr&   =   sC   € à)€GØ�\‰\˜!‹_€FØ”ÑA¬C°¸Ó,@ÔAÓAÑA€EÜˆu�r‰z˜B‰ÓÐr   c                óä   — t        | «      } t        | «      r| d   dk(  r
t        «       ‚dt        | «      cxk  rdk  st	        «       ‚ t	        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )ziCheck if the number is a valid CUI or CIF number. This checks the length,
    formatting and check digit.r   Ú0r	   r   Néÿÿÿÿ)r   r   ÚInvalidFormatÚlenÚInvalidLengthr&   ÚInvalidChecksumr   s    r   Úvalidater.   E   ss   € ô �V‹_€FÜ�FÔ˜v a™y¨CÒ/Ü‹oÐØ”�V“Ô" Ò"Ü‹oÐð #Ü‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z1Check if the number is a valid CUI or CIF number.F)Úboolr.   ÚValidationErrorr   s    r   Úis_validr2   R   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r   r#   Úreturnr#   )r   r#   r3   r0   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r&   r.   r2   © r   r   ú<module>r9      s)   ðñ*õ2 #ä ß 'óó ó
ôr   