Ë
    Ã?ÆiM  ã                  óz  — d Z ddlmZ ddlZddlmZ ddl­ ddlmZ ddl	m
Z
  ej                  d«      Zd	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/“d0d1“d2d3“d4d5“d6d7“d8d9“d:d;“d<d=“d>d?“d@dA“dBdC“dDdE“dFdG“dHdI“dJdK“dLdM“¥dNdOdPdQœ¥ZdWdR„ZdWdS„ZdXdT„ZdWdU„ZdYdV„Zy)Zaa  GSTIN (Goods and Services Tax identification number, Indian VAT number).

The Goods and Services Tax identification number (GSTIN) is a 15 digit unique
identifier assigned to all business entities in India registered under the
Goods and Services Tax (GST) Act, 2017.

Each GSTIN begins with a 2 digit state code, the next 10 characters are the
holder's PAN, the 13th character is an alphanumeric digit that represents the
number of GSTIN registrations made in a state or union territory for same the
PAN, the 14th character is 'Z' and the last character is an alphanumeric
check digit calculated using Luhn mod 36 algorithm.

More information:

* https://bajajfinserv.in/insights/what-is-goods-and-service-tax-identification-number
* https://ddvat.gov.in/docs/List%20of%20State%20Code.pdf
* https://en.wikipedia.org/wiki/Goods_and_Services_Tax_(India)

>>> validate('27AAPFU0939F1ZV')
'27AAPFU0939F1ZV'
>>> validate('27AAPFU0939F1Z')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('369296450896540')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('27AAPFU0939F1AA')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('27AAPFU0939F1ZO')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> to_pan('27AAPFU0939F1ZV')
'AAPFU0939F'
>>> info('27AAPFU0939F1ZV')['state']
'Maharashtra'
é    )ÚannotationsN)Úluhn)Ú*)Úpan)Úcleanz*^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][0-9A-Z]{3}$Ú$0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÚ01zJammu and KashmirÚ02zHimachal PradeshÚ03ÚPunjabÚ04Ú
ChandigarhÚ05ÚUttarakhandÚ06ÚHaryanaÚ07ÚDelhiÚ08Ú	RajasthanÚ09zUttar PradeshÚ10ÚBiharÚ11ÚSikkimÚ12zArunachal PradeshÚ13ÚNagalandÚ14ÚManipurÚ15ÚMizoramÚ16ÚTripuraÚ17Ú	MeghalayaÚ18ÚAssamÚ19zWest BengalÚ20Ú	JharkhandÚ21ÚOrissaÚ22ÚChattisgarhÚ23zMadhya PradeshÚ24ÚGujaratÚ25zDaman and DiuÚ26zDadar and Nagar HaveliÚ27ÚMaharashtraÚ28zAndhra PradeshÚ29Ú	KarnatakaÚ30ÚGoaÚ31ÚLakshadweepÚ32ÚKeralaÚ33z
Tamil NaduÚ34Ú
PuducherryzAnadaman and Nicobar IslandsÚ	TelanganazAndhra Pradesh (New))Ú35Ú36Ú37c                ó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    úW/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/in_/gstin.pyÚcompactrM   u   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c                ó8  — t        | «      } t        | «      dk7  r
t        «       ‚t        j	                  | «      s
t        «       ‚| dd t        vs| d   dk(  s| d   dk7  r
t        «       ‚t        j                  | dd «       t        j                  | t        «       | S )úfCheck if the number provided is a valid GSTIN. This checks the length,
    formatting and check digit.é   Né   é   Ú0é   ÚZ)rM   ÚlenÚInvalidLengthÚ	_GSTIN_REÚmatchÚInvalidFormatÚ_STATE_CODESÚInvalidComponentr   Úvalidater   Ú	_ALPHABETrJ   s    rL   r^   r^   {   s‡   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�?‰?˜6Ô"Ü‹oÐØˆbˆq€zœÑ%¨°©°sÒ):¸fÀR¹jÈCÒ>OÜÓ Ð Ü‡L�L�˜˜"�ÔÜ‡M�M�&œ)Ô$Ø€MrN   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)rP   F)Úboolr^   ÚValidationErrorrJ   s    rL   Úis_validrc   Š   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó"   — t        | «      } | dd S )zConvert the number to a PAN.rR   rS   )rM   rJ   s    rL   Úto_panre   “   s   € ä�V‹_€FØ�!�Bˆ<ÐrN   c                ó¾   — t        | «      } t        j                  | dd «      | dd t        j                  | dd «      d   | d   t
        j                  | d   «      dœS )zMProvide information that can be decoded locally from GSTIN (without
    API).NrR   rS   Úholder_typeé   )Ústater   rg   ÚinitialÚregistration_count)r^   r\   Úgetr   Úinfor_   ÚindexrJ   s    rL   rm   rm   ™   sc   € ô �fÓ€Fä×!Ñ! &¨¨! *Ó-Ø�a˜ˆ|Ü—x‘x  q¨ Ó-¨mÑ<Ø˜!‘9Ü'Ÿo™o¨f°R©jÓ9ñð rN   )rK   ÚstrÚreturnro   )rK   ro   rp   ra   )rK   ro   rp   zdict[str, str | int | None])Ú__doc__Ú
__future__r   ÚreÚstdnumr   Ústdnum.exceptionsÚ
stdnum.in_r   Ústdnum.utilr   ÚcompilerY   r_   r\   rM   r^   rc   re   rm   © rN   rL   ú<module>rz      s
  ðñ((õT #ã 	å Ü Ý Ý ð ˆB�J‰JÐDÓE€	à2€	ð&ØÐ
ð&àÐ
ð&ð 	ˆ(ð&ð 	ˆ,ð	&ð
 	ˆ-ð&ð 	ˆ)ð&ð 	ˆ'ð&ð 	ˆ+ð&ð 	ˆ/ð&ð 	ˆ'ð&ð 	ˆ(ð&ð 	Ð
ð&ð 	ˆ*ð&ð 	ˆ)ð&ð 	ˆ)ð&ð  	ˆ)ð!&ð" 	ˆ+ñ#&ð$ 	ˆ'ð%&ð& 	ˆ-ð'&ð( 	ˆ+ð)&ð* 	ˆ(ð+&ð, 	ˆ-ð-&ð. 	Ð
ð/&ð0 	ˆ)ð1&ð2 	ˆ/ð3&ð4 	Ð
"ð5&ð6 	ˆ-ð7&ð8 	Ð
ð9&ð: 	ˆ+ð;&ð< 	ˆ%ð=&ð> 	ˆ-ð?&ð@ 	ˆ(ðA&ðB 	ˆ,ðC&ðD 	ˆ,ñE&ðF )Ø
Ø
 òK&€óR/óóóô
rN   