Ë
    Ã?Æi	  ã                  óš   — d Z ddlmZ ddlZddl­ ddlmZ  ej                  d«      Zddd	d
ddddddddœZ	dd„Z
dd„Zdd„Zdd„Zdd„Zy)au  PAN (Permanent Account Number, Indian income tax identifier).

The Permanent Account Number (PAN) is a 10 digit alphanumeric identifier for
Indian individuals, families and corporates for income tax purposes. It is
also issued to foreign nationals subject to a valid visa.

PAN is made up of 5 letters, 4 digits and 1 alphabetic check digit. The 4th
character indicates the type of holder, the 5th character is either 1st
letter of the holder's name or holder's surname in case of 'Individual' PAN,
next 4 digits are serial numbers running from 0001 to 9999 and the last
character is a check digit computed by an undocumented checksum algorithm.

More information:

* https://en.wikipedia.org/wiki/Permanent_account_number
* https://incometaxindia.gov.in/tutorials/1.permanent%20account%20number%20(pan).pdf

>>> validate('ACUPA7085R')
'ACUPA7085R'
>>> validate('ACUPA7085RR')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('ABMPA32111')  # check digit should be a letter
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('ABMXA3211G')  # invalid type of holder
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('ACUPA0000R')  # serial number should not be '0000'
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> mask('AAPPV8261K')
'AAPPVXXXXK'
>>> info('AAPPV8261K')['holder_type']
'Individual'
é    )ÚannotationsN)Ú*)Úcleanz^[A-Z]{5}[0-9]{4}[A-Z]$zAssociation of Persons (AOP)zBody of Individuals (BOI)ÚCompanyz"Firm/Limited Liability PartnershipzGovernment AgencyzHindu Undivided Family (HUF)zLocal AuthorityzArtificial Juridical PersonÚ
IndividualÚTrustzKrish (Trust Krish))ÚAÚBÚCÚFÚGÚHÚLÚJÚPÚTÚKc                ó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©Únumbers    úU/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/in_/pan.pyÚcompactr   X   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c                óÄ   — t        | «      } t        | «      dk7  r
t        «       ‚t        j	                  | «      s
t        «       ‚t        | «       | dd dk(  r
t        «       ‚| S )úWCheck if the number provided is a valid PAN. This checks the length
    and formatting.é
   é   é	   Ú0000)r   ÚlenÚInvalidLengthÚ_pan_reÚmatchÚInvalidFormatÚinfoÚInvalidComponentr   s    r   Úvalidater)   ^   sX   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�=‰=˜Ô Ü‹oÐÜˆ„LØˆa�€{�fÒÜÓ Ð Ø€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r   F)Úboolr)   ÚValidationErrorr   s    r   Úis_validr-   l   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ór   — t        | «      } t        j                  | d   «      }|s
t        «       ‚||| d   dœS )z5Provide information that can be decoded from the PAN.é   é   )Úholder_typeÚcard_holder_typeÚinitial)r   Ú_pan_holder_typesÚgetr(   )r   r1   s     r   r'   r'   u   sB   € ä�V‹_€FÜ#×'Ñ'¨¨q©	Ó2€KÙÜÓ Ð à"Ø'Ø˜!‘9ñð r   c                ó4   — t        | «      } | dd dz   | dd z   S )zNMask the PAN as per Central Board of Direct Taxes (CBDT) masking
    standard.Nr   ÚXXXXéÿÿÿÿ)r   r   s    r   Úmaskr9   ‚   s)   € ô �V‹_€FØ�"�1ˆ:˜Ñ ¨¨ Ñ,Ð,r   )r   ÚstrÚreturnr:   )r   r:   r;   r+   )r   r:   r;   zdict[str, str])Ú__doc__Ú
__future__r   ÚreÚstdnum.exceptionsÚstdnum.utilr   Úcompiler$   r4   r   r)   r-   r'   r9   © r   r   ú<module>rC      sp   ðñ*'õR #ã 	ä Ý ð ˆ"�*‰*Ð/Ó
0€ð 
(Ø	$Ø	Ø	-Ø	Ø	'Ø	Ø	&Ø	Ø	Ø	ñÐ ó /óóó
ô-r   