Ë
    Ã?Æiž
  ã                  óZ   — d Z ddlm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
)a  SIN (Canadian Social Insurance Number).

The Social Insurance Number (SIN) is a 9-digit identifier issued to
individuals for various government programs. SINs that begin with a 9 are
issued to temporary workers who are neither Canadian citizens nor permanent
residents.

More information:

* https://www.canada.ca/en/employment-social-development/services/sin.html
* https://en.wikipedia.org/wiki/Social_Insurance_Number

>>> validate('123-456-782')
'123456782'
>>> validate('999-999-999')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('12345678Z')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('823456785')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('123456782')
'123-456-782'
é    )Úannotations)Úluhn)Ú*)ÚcleanÚisdigitsc                ó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/ca/sin.pyÚcompactr   9   s   € ô �˜Ó×$Ñ$Ó&Ð&ó    c                ó¾   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚| d   dv r
t        «       ‚t        j                  | «      S )z[Check if the number is a valid SIN. This checks the length, formatting
    and check digit.é	   r   Ú08)r   ÚlenÚInvalidLengthr   ÚInvalidFormatÚInvalidComponentr   Úvalidater
   s    r   r   r   ?   sU   € ô �V‹_€FÜ
ˆ6ƒ{�aÒÜ‹oÐÜ�FÔÜ‹oÐØˆa�y�DÑÜÓ Ð Ü�=‰=˜Ó Ð r   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z#Check if the number is a valid SIN.F)Úboolr   ÚValidationErrorr
   s    r   Úis_validr   L   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óR   — t        | «      } dj                  | dd | dd | dd f«      S )z8Reformat the number to the standard presentation format.ú-r   é   é   N)r   Újoinr
   s    r   Úformatr    T   s3   € ä�V‹_€FØ�8‰8�V˜A˜a�[ &¨¨1 +¨v°a°b¨zÐ:Ó;Ð;r   N)r   ÚstrÚreturnr!   )r   r!   r"   r   )Ú__doc__Ú
__future__r   Ústdnumr   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r   r    © r   r   ú<module>r)      s,   ðñ(õ< #å Ü ß 'ó'ó
!óô<r   