Ë
    Ã?Æiå  ã                  ó²  — d Z ddlmZ ddlZddl­ ddlmZmZ i dd“dd	“d
d“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“d d!“d"d#“d$d%“d&d'“i d(d)“d*d+“d,d-“d.d/“d0d1“d2d3“d4d5“d6d7“d8d9“d:d;“d<d=“d>d?“d@dA“dBdC“dDdE“dFdG“dHdI“¥i dJdK“dLdM“dNdO“dPdQ“dRdS“dTdU“dVdW“dXdY“dZd[“d\d]“d^d_“d`da“dbdc“ddde“dfdg“dhdi“djdk“¥dldldldldmœ¥Zdtdn„Z	dtdo„Z
dudp„Zdtdq„Zdtdr„Zdvds„Zy)waP  CNP (Cod Numeric Personal, Romanian Numerical Personal Code).

The CNP is a 13 digit number that includes information on the person's
gender, birth date and country zone.

More information:

* https://ro.wikipedia.org/wiki/Cod_numeric_personal
* https://github.com/vimishor/cnp-spec/blob/master/spec.md

>>> validate('1630615123457')
'1630615123457'
>>> get_county('1630615123457')
'Cluj'
>>> validate('0800101221142')  # invalid first digit
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('1632215123457')  # invalid date
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('1630615993454')  # invalid county
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('1630615123458')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )ÚannotationsN)Ú*)ÚcleanÚisdigitsÚ01ÚAlbaÚ02ÚAradÚ03ÚArgesÚ04ÚBacauÚ05ÚBihorÚ06zBistrita-NasaudÚ07ÚBotosaniÚ08ÚBrasovÚ09ÚBrailaÚ10ÚBuzauÚ11zCaras-SeverinÚ12ÚClujÚ13Ú	ConstantaÚ14ÚCovasnaÚ15Ú	DambovitaÚ16ÚDoljÚ17ÚGalatiÚ18ÚGorjÚ19ÚHarghitaÚ20Ú	HunedoaraÚ21ÚIalomitaÚ22ÚIasiÚ23ÚIlfovÚ24Ú	MaramuresÚ25Ú	MehedintiÚ26ÚMuresÚ27ÚNeamtÚ28ÚOltÚ29ÚPrahovaÚ30z	Satu MareÚ31ÚSalajÚ32ÚSibiuÚ33ÚSuceavaÚ34Ú	TeleormanÚ35ÚTimisÚ36ÚTulceaÚ37ÚVasluiÚ38ÚValceaÚ39ÚVranceaÚ40Ú	BucurestiÚ41zBucuresti - Sector 1Ú42zBucuresti - Sector 2Ú43zBucuresti - Sector 3Ú44zBucuresti - Sector 4Ú45zBucuresti - Sector 5Ú46zBucuresti - Sector 6Ú47z!Bucuresti - Sector 7 (desfiintat)Ú48z!Bucuresti - Sector 8 (desfiintat)Ú51ÚCalarasiÚ52ÚGiurgiuÚ70ÚAnyÚUnknown)Ú80Ú81Ú82Ú83c                ó6   — t        | d«      j                  «       S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -)r   Ústrip©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/ro/cnp.pyÚcompactrl   y   s   € ô �˜Ó×$Ñ$Ó&Ð&ó    c                óh   — d}t        d„ t        || «      D «       «      dz  }|dk(  rdS t        |«      S )z-Calculate the check digit for personal codes.)é   é   é	   é   é   é   é   é   é   ro   rp   rq   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w)N)Úint)Ú.0ÚwÚns      rk   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>ƒ   s   è ø€ Ò<™t˜q !�”C˜“F•
Ñ<ùs   ‚é   é
   Ú1)ÚsumÚzipÚstr)rj   ÚweightsÚchecks      rk   Úcalc_check_digitr†      s:   € ð 3€GÜÑ<¤s¨7°FÓ';Ô<Ó<¸rÑA€EØ˜2’+ˆ3Ð-¤3 u£:Ð-rm   c                ó  — t        | «      } dddddddœ}t        | dd «      |j                  | d   d«      z   }t        | dd «      }t        | dd	 «      }	 t        j                  |||«      S # t
        $ r t        «       ‚w xY w)
z?Split the date parts from the number and return the birth date.il  i  iÐ  )r€   Ú2Ú3Ú4Ú5Ú6rr   ru   r   rv   rp   )rl   ry   ÚgetÚdatetimeÚdateÚ
ValueErrorÚInvalidComponent)rj   Ú	centuriesÚyearÚmonthÚdays        rk   Úget_birth_dater–   ‡   s•   € ä�V‹_€Fà˜ 4¨d¸ÀDñ€Iô ˆv�a˜ˆ{Ó˜iŸm™m¨F°1©I°tÓ<Ñ<€DÜ��q˜�Ó€EÜ
ˆf�Q�qˆkÓ
€Cð!Ü�}‰}˜T 5¨#Ó.Ð.øÜò !ÜÓ Ð ð!ús   ÁA- Á-Bc                ó\   — 	 t         t        | «      dd    S # t        $ r t        «       ‚w xY w)z#Get the county name from the numberrp   rq   )Ú	_COUNTIESrl   ÚKeyErrorr‘   ri   s    rk   Ú
get_countyrš   –   s5   € ð!Üœ ›¨¨1Ð-Ñ.Ð.øÜò !ÜÓ Ð ð!ús   ‚ —+c                ó   — t        | «      } t        | «      s
t        «       ‚| d   dvr
t        «       ‚t	        | «      dk7  r
t        «       ‚t        | «       t        | «       t        | dd «      | d   k7  r
t        «       ‚| S )zbCheck if the number is a valid VAT number. This checks the length,
    formatting and check digit.r   Ú	123456789é   Néÿÿÿÿ)
rl   r   ÚInvalidFormatr‘   ÚlenÚInvalidLengthr–   rš   r†   ÚInvalidChecksumri   s    rk   Úvalidater£   ž   s}   € ô �V‹_€FÜ�FÔÜ‹oÐð ˆa�y˜Ñ#ÜÓ Ð Ü
ˆ6ƒ{�bÒÜ‹oÐä�6ÔäˆvÔÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mrm   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z*Check if the number is a valid VAT number.F)Úboolr£   ÚValidationErrorri   s    rk   Úis_validr§   ³   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡")rj   rƒ   Úreturnrƒ   )rj   rƒ   r¨   zdatetime.date)rj   rƒ   r¨   r¥   )Ú__doc__Ú
__future__r   rŽ   Ústdnum.exceptionsÚstdnum.utilr   r   r˜   rl   r†   r–   rš   r£   r§   © rm   rk   ú<module>r®      så  ðñ*õ@ #ã ä ß 'ð8Øˆ&ð8àˆ&ð8ð 	ˆ'ð8ð 	ˆ'ð	8ð
 	ˆ'ð8ð 	Ð
ð8ð 	ˆ*ð8ð 	ˆ(ð8ð 	ˆ(ð8ð 	ˆ'ð8ð 	ˆ/ð8ð 	ˆ&ð8ð 	ˆ+ð8ð 	ˆ)ð8ð 	ˆ+ð8ð  	ˆ&ð!8ð" 	ˆ(ñ#8ð$ 	ˆ&ð%8ð& 	ˆ*ð'8ð( 	ˆ+ð)8ð* 	ˆ*ð+8ð, 	ˆ&ð-8ð. 	ˆ'ð/8ð0 	ˆ+ð18ð2 	ˆ+ð38ð4 	ˆ'ð58ð6 	ˆ'ð78ð8 	ˆ%ð98ð: 	ˆ)ð;8ð< 	ˆ+ð=8ð> 	ˆ'ð?8ð@ 	ˆ'ðA8ðB 	ˆ)ðC8ðD 	ˆ+òE8ðF 	ˆ'ðG8ðH 	ˆ(ðI8ðJ 	ˆ(ðK8ðL 	ˆ(ðM8ðN 	ˆ)ðO8ðP 	ˆ+ðQ8ðR 	Ð
 ðS8ðT 	Ð
 ðU8ðV 	Ð
 ðW8ðX 	Ð
 ðY8ðZ 	Ð
 ð[8ð\ 	Ð
 ð]8ð^ 	Ð
-ð_8ð` 	Ð
-ða8ðb 	ˆ*ðc8ðd 	ˆ)ðe8ðf 	ˆ%ñg8ðh Ø
Ø
Ø
òo8€	óv'ó.ó!ó!óô*rm   