Ë
    Ã?Æi½  ã                  óV   — d Z ddlmZ ddl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’  MatiÄ�na Å¡tevilka poslovnega registra (Corporate Registration Number)

The Corporate registration number represent a unique identification of
each unit of the business register, assigned by the registry administrator
at the time of entry in the business register, which shall not be changed.

The number consists of 7 or 10 digits and includes a check digit. The first 6
digits represent a unique number for each unit or company, followed by a
check digit. The last 3 digits represent an additional business unit of the
company, starting at 001. When a company consists of more than 1000 units, a
letter is used instead of the first digit in the business unit. Unit 000
always represents the main registered address.

More information:

* https://pisrs.si/pregledPredpisa?id=URED7599

>>> validate('9331310000')
'9331310'
>>> validate('9331320000')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )ÚannotationsN)Ú*)ÚcleanÚisdigitsc                óž   — t        | d«      j                  «       j                  «       } t        | «      dk(  r| 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. é
   Ú000r   é   )r   ÚstripÚupperÚlenÚendswith©Únumbers    úX/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/si/maticna.pyÚcompactr   6   sI   € ô �6˜4Ó ×&Ñ&Ó(×.Ñ.Ó0€FÜ
ˆ6ƒ{�bÒ˜VŸ_™_¨UÔ3Ø˜˜!�ˆØ€Mó    c                ór   — d}t        d„ t        | |«      D «       «      }| dz  }|dk(  ryt        |dz  «      S )zCalculate the check digit.)r
   é   é   é   é   é   c              3  ó>   K  — | ]  \  }}t        |«      |z  –— Œ y ­w)N)Úint)Ú.0ÚnÚws      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>B   s   è ø€ Ò<™t˜q !”�A“˜•
Ñ<ùs   ‚é   r   Úinvalidr   )ÚsumÚzipÚstr)r   ÚweightsÚtotalÚ	remainders       r   Úcalc_check_digitr(   ?   sB   € à €GÜÑ<¤s¨6°7Ó';Ô<Ó<€EØ�˜‘€IØ�A‚~ØÜˆy˜2‰~ÓÐr   c                óö   — t        | «      } t        | «      dvr
t        «       ‚t        | dd «      s
t	        «       ‚t        j                  d| dd «      s
t	        «       ‚t        | «      | d   k7  r
t        «       ‚| S )ziCheck if the number is a valid Corporate Registration number. This
    checks the length and check digit.)r
   r   Nr   z^([A-Za-z0-9]\d{2})?$r
   )	r   r   ÚInvalidLengthr   ÚInvalidFormatÚreÚmatchr(   ÚInvalidChecksumr   s    r   Úvalidater/   I   ss   € ô �V‹_€FÜ
ˆ6ƒ{˜'Ñ!Ü‹oÐÜ�F˜2˜A�JÔÜ‹oÐÜ�8‰8Ð,¨f°Q°R¨jÔ9Ü‹oÐÜ˜Ó 6¨!¡9Ò,ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)zVCheck if provided is valid ID. This checks the length,
    formatting and check digit.F)Úboolr/   ÚValidationErrorr   s    r   Úis_validr3   X   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡")r   r$   Úreturnr$   )r   r$   r4   r1   )Ú__doc__Ú
__future__r   r,   Ústdnum.exceptionsÚstdnum.utilr   r   r   r(   r/   r3   © r   r   ú<module>r:      s,   ðñ*õ2 #ã 	ä ß 'óóóôr   