Ë
    Ã?Æih  ã                  ót   — d Z ddlmZ ddlmZ ddl­ ddlmZ dd„Zdd„Z	dd„Z
dd	„Zdd
„ZdZdd„Zddd„Zy)ac  ISMN (International Standard Music Number).

The ISMN (International Standard Music Number) is used to identify sheet
music. This module handles both numbers in the 10-digit 13-digit format.

>>> validate('979-0-3452-4680-5')
'9790345246805'
>>> validate('9790060115615')
'9790060115615'
>>> ismn_type(' M-2306-7118-7')
'ISMN10'
>>> validate('9790060115614')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> compact('  979-0-3452-4680-5')
'9790345246805'
>>> format('9790060115615')
'979-0-060-11561-5'
>>> format('M230671187')
'979-0-2306-7118-7'
>>> to_ismn13('M230671187')
'9790230671187'
é    )Úannotations)Úean)Ú*)Úcleanc                óR   — t        | d«      j                  «       j                  «       S )z‹Convert the ISMN to the minimal representation. This strips the number
    of any valid ISMN separators and removes surrounding whitespace.z -.)r   ÚstripÚupper©Únumbers    úR/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/ismn.pyÚcompactr   4   s#   € ô �˜Ó×%Ñ%Ó'×-Ñ-Ó/Ð/ó    c                ó&  — t        | «      } t        | «      dk(  r/| d   dk7  r
t        «       ‚t        j                  d| dd z   «       | S t        | «      dk(  r2| j                  d«      s
t        «       ‚t        j                  | «       | S t        «       ‚)ú½Check if the number provided is a valid ISMN (either a legacy 10-digit
    one or a 13-digit one). This checks the length and the check bit but does
    not check if the publisher is known.é
   r   ÚMÚ9790é   Né   )r   ÚlenÚInvalidFormatr   ÚvalidateÚ
startswithÚInvalidComponentÚInvalidLengthr
   s    r   r   r   :   s�   € ô �V‹_€FÜ
ˆ6ƒ{�bÒØ�!‰9˜ÒÜ“/Ð!Ü�‰�V˜f Q R˜jÑ(Ô)ð €Mô 
ˆV‹˜Ò	Ø× Ñ  Ô(Ü"Ó$Ð$Ü�‰�VÔð €Mô ‹oÐr   c                óX   — 	 t        | «      } t        | «      dk(  ryy# t        $ r Y yw xY w)z]Check the type of ISMN number passed and return 'ISMN13', 'ISMN10'
    or None (for invalid).Nr   ÚISMN10ÚISMN13)r   ÚValidationErrorr   r
   s    r   Ú	ismn_typer    L   s9   € ðÜ˜&Ó!ˆô ˆ6ƒ{�bÒØàøô ò Ùðús   ‚ �	)¨)c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r   F)Úboolr   r   r
   s    r   Úis_validr#   Y   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó˜   — | j                  «       } t        | «      }t        |«      dk(  r| S d| v rd| dd z   S d| v rd| dd z   S d| dd z   S )	z*Convert the number to ISMN13 (EAN) format.r   ú z979 0r   Nú-z979-0r   )r   r   r   )r   Ú
min_numbers     r   Ú	to_ismn13r(   c   sh   € à�\‰\‹^€FÜ˜“€JÜ
ˆ:ƒ˜"ÒØˆà
ˆf�}Ø˜  ˜Ñ#Ð#Ø	�‰Ø˜  ˜Ñ#Ð#à˜˜q˜r˜
Ñ"Ð"r   ))é   Ú000Ú099)é   Ú1000Ú3999)é   Ú40000Ú69999)é   Ú700000Ú899999)é   Ú9000000Ú9999999c                óÂ   — t        t        | «      «      } t        D ]8  \  }}}|| dd|z    cxk  r|k  sŒn Œ| dd | d   | dd|z    | d|z   d | d   fc S  t        d«      ‚)zªSplit the specified ISMN into a bookland prefix (979), an ISMN
    prefix (0), a publisher element (3 to 7 digits), an item element (2 to
    6 digits) and a check digit.r,   Nr)   éÿÿÿÿÚunreachable)r(   r   Ú_rangesÚAssertionError)r   ÚlengthÚlowÚhighs       r   Úsplitr@   x   s‡   € ô
 ”w˜v“Ó'€Fä$ò 7Ñˆ��TØ�&˜˜1˜v™:Ð&Ô.¨$Ö.Ø˜2˜A�J  q¡	¨6°!°A¸±JÐ+?Ø˜1˜v™: bÐ)¨6°"©:ð7ò 7ð7ô ˜Ó
'Ð'r   c                óD   — |j                  d„ t        | «      D «       «      S )zñReformat the number to the standard presentation format with the
    prefixes, the publisher element, the item element and the check-digit
    separated by the specified separator. The number is converted to the
    13-digit format silently.c              3  ó&   K  — | ]	  }|sŒ|–— Œ y ­w)N© )Ú.0Úxs     r   ú	<genexpr>zformat.<locals>.<genexpr>‹   s   è ø€ Ò8 ²aœ!Ñ8ùs   ‚Š)Újoinr@   )r   Ú	separators     r   ÚformatrI   †   s   € ð
 �>‰>Ñ8¤U¨6£]Ô8Ó8Ð8r   N)r   ÚstrÚreturnrJ   )r   rJ   rK   z
str | None)r   rJ   rK   r"   )r   rJ   rK   ztuple[str, str, str, str, str])r&   )r   rJ   rH   rJ   rK   rJ   )Ú__doc__Ú
__future__r   Ústdnumr   Ústdnum.exceptionsÚstdnum.utilr   r   r   r    r#   r(   r;   r@   rI   rC   r   r   ú<module>rQ      sB   ðñ(õ2 #å Ü Ý ó0óó$
óó#ð 8€ó
(õ9r   