
    qZh$                    0   d dl mZ d dlZd dlZd dlmZ d dlmZ 	 d dlZddgZ ej                  ddj                  e      z        Z ej                  d	      Z ej                  d
      Z ej                  d      Z ej                  d      Z ej                  d      Z ej                  d      Z ej                  d      ZdZ	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZdddd deddddddf	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy# e	$ r d dl
ZY w xY w)    )annotationsN)Iterable)name2codepointslugifysmart_truncatez&(%s);|z&#(\d+);z&#x([\da-fA-F]+);z[\']+z[^-a-zA-Z0-9]+z[\W_]+z-{2,}z(?<=\d),(?=\d)-Fc                   | j                  |      } |s| S t        |       |k  r| S |s| d| j                  |      S || vr| d| S d}| j                  |      D ]V  }|st        |      t        |      z   }||k  r|dj                  ||      z  }8||k(  r|dj                  |      z  } n|sV n |s| d| }|j                  |      S )a=  
    Truncate a string.
    :param string (str): string for modification
    :param max_length (int): output string length
    :param word_boundary (bool):
    :param save_order (bool): if True then word order of output string is like input string
    :param separator (str): separator between words
    :return:
    N z{}{}z{})striplensplitformat)string
max_lengthword_boundary	separator
save_order	truncatedwordnext_lens           k/var/www/html/wine-match-dev/backend/winematch-backend/venv/lib/python3.12/site-packages/slugify/slugify.pyr   r      s    " \\)$F
6{Zkz"((33kz""IY' 
9~D	1H*$V]]4;;	Z'T[[..	
 ;J'	??9%%    T c                   |r|D ]  \  }}| j                  ||      }  t        | t              st        | dd      } t        j	                  t
        |       } |rt        j                  d|       } n+t        j                  d|       } t        j                  |       } t        | t              st        | dd      } |rt        j	                  d |       } |r	 t        j	                  d |       } |r	 t        j	                  d |       } |rt        j                  d|       } nt        j                  d|       } |
r| j                         } t        j	                  d|       } t        j	                  d|       } |r|	xs t        }n
|	xs t         }t#        j                  |t
        |       } t$        j	                  t
        |       j'                  t
              } |r|
rE|D cg c]  }|j                          }}| j)                  t
              D cg c]	  }||vs| }}n'| j)                  t
              D cg c]	  }||vs| }}t
        j+                  |      } |r|D ]  \  }}| j                  ||      }  |d	kD  rt-        | ||t
        |      } |t
        k7  r| j                  t
        |      } | S # t        $ r Y w xY w# t        $ r Y w xY wc c}w c c}w c c}w )
a  
    Make a slug from the given text.
    :param text (str): initial text
    :param entities (bool): converts html entities to unicode
    :param decimal (bool): converts html decimal to unicode
    :param hexadecimal (bool): converts html hexadecimal to unicode
    :param max_length (int): output string length
    :param word_boundary (bool): truncates to complete word even if length ends up shorter than max_length
    :param save_order (bool): if parameter is True and max_length > 0 return whole words in the initial order
    :param separator (str): separator between words
    :param stopwords (iterable): words to discount
    :param regex_pattern (str): regex pattern for disallowed characters
    :param lowercase (bool): activate case sensitivity by setting it to False
    :param replacements (iterable): list of replacement rules e.g. [['|', 'or'], ['%', 'percent']]
    :param allow_unicode (bool): allow unicode characters
    :return (str):
    zutf-8ignoreNFKCNFKDc                D    t        t        | j                  d               S N   )chrr   groupms    r   <lambda>zslugify.<locals>.<lambda>   s    ^AGGAJ5O1P r   c                H    t        t        | j                  d                  S r    r"   intr#   r$   s    r   r&   zslugify.<locals>.<lambda>   s    S_1E r   c                J    t        t        | j                  d      d            S )Nr!      r(   r$   s    r   r&   zslugify.<locals>.<lambda>   s    SQWWQZ1D-E r   r   r   )replace
isinstancestrQUOTE_PATTERNsubDEFAULT_SEPARATORunicodedata	normalize	unidecodeCHAR_ENTITY_PATTERNDECIMAL_PATTERN	ExceptionHEX_PATTERNlowerNUMBERS_PATTERN DISALLOWED_UNICODE_CHARS_PATTERNDISALLOWED_CHARS_PATTERNreDUPLICATE_DASH_PATTERNr   r   joinr   )textentitiesdecimalhexadecimalr   r   r   r   	stopwordsregex_pattern	lowercasereplacementsallow_unicodeoldnewpatternsstopwords_lowerwwordss                       r   r   r   K   s   D $ 	*HC<<S)D	* dC 4(+ .5D $$VT2$$VT2""4( dC 4(+ "&&'PRVW 	"&&'EtLD
 	??#EtLD
 $$VT2$$VT2 zz| R&D r4(D C#C;#;66',d3D "%%&7>DDEVWD 2;<Qqwwy<O< $

+< =Z1/AYQZEZ $

+< =T1)ASQTET %%e, $ 	*HC<<S)D	* A~dJ?PR\]%%||-y9Ku  		  		B =ZTsB   J, -J< K	KK0	K:K,	J98J9<	K	K	)r   F F)r   r.   r   r)   r   boolr   r.   r   rQ   returnr.   )r@   r.   rA   rQ   rB   rQ   rC   rQ   r   r)   r   rQ   r   r.   r   rQ   rD   zIterable[str]rE   zre.Pattern[str] | str | NonerF   rQ   rG   zIterable[Iterable[str]]rH   rQ   rR   r.   )
__future__r   r=   r2   collections.abcr   html.entitiesr   r4   ImportErrortext_unidecode__all__compiler?   r5   r6   r8   r/   r<   r;   r>   r:   r1   r   r   r   r   r   <module>rZ      s   " 	  $ (' &
' !bjjSXXn-E!EF "**[)bjj-.

8$%2::&78 #-2::i#8  #H- "**./ 
 -&-&-& -& 	-&
 -& 	-&d &!26,.z
zz z 	z
 z z z z z 0z z *z z 	zC  '&'s   D	 		DD