§
    >²¸jÊ  ã                   óR   — dde de dedefd„Z	 ddee          de dededed	z  f
d
„Zd	S )TÚstring_1Ústring_2Úcase_sensitiveÚreturnc           	      óŽ  — |s(|                       ¦   «         } |                      ¦   «         }t          | ¦  «        t          |¦  «        k     r|| }} t          t          t          |¦  «        dz   ¦  «        ¦  «        }dgt          |¦  «        dz   z  }t          dt          | ¦  «        dz   ¦  «        D ]€}||d<   t          dt          |¦  «        dz   ¦  «        D ]T}| |dz
           ||dz
           k    rd}nd}t	          ||         dz   ||dz
           dz   ||dz
           |z   ¦  «        ||<   ŒU||}}Œ�|t          |¦  «                 S )a¯  
    Calculates the minimum number of single-character edits required
    to transform one string into another. Allowed operations are insertion,
    deletion, and substitution.

    Args:
        string_1: The source string to be transformed.
        string_2: The target string to transform into.
        case_sensitive: Whether comparison should be case-sensitive.
            Defaults to True.

    Returns:
        The minimum number of edits required to convert `string_1`
        into `string_2`.

    Examples:
        ```pycon
        >>> import supervision as sv
        >>> sv.edit_distance("hello", "hello")
        0
        >>> sv.edit_distance("Test", "test", case_sensitive=True)
        1
        >>> sv.edit_distance("abc", "xyz")
        3
        >>> sv.edit_distance("hello", "")
        5
        >>> sv.edit_distance("", "")
        0
        >>> sv.edit_distance("hello world", "helloworld")
        1

        ```
    é   é    )ÚlowerÚlenÚlistÚrangeÚmin)r   r   r   Úprev_rowÚcurr_rowÚiÚjÚsubstitution_costs           úp/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/supervision/detection/utils/vlms.pyÚedit_distancer      s\  € ðD ð $Ø—>’>Ñ#Ô#ˆØ—>’>Ñ#Ô#ˆå
ˆ8�}„}•s˜8‘}”}Ò$Ð$Ø% x�(ˆå•E�#˜h™-œ-¨!Ñ+Ñ,Ô,Ñ-Ô-€HØˆs•c˜(‘m”m aÑ'Ñ(€Hå�1•c˜(‘m”m aÑ'Ñ(Ô(ð 0ð 0ˆØˆ�‰Ý�q�#˜h™-œ-¨!Ñ+Ñ,Ô,ð 		ð 		ˆAØ˜˜A™Œ (¨1¨q©5¤/Ò1Ð1Ø$%Ð!Ð!à$%Ð!ÝØ˜”˜a‘Ø˜˜Q™” !Ñ#Ø˜˜Q™”Ð"3Ñ3ñô ˆH�Q‰KˆKð
 & x�(ˆˆà•C˜‘M”MÔ"Ð"ó    Ú
candidatesÚqueryÚ	thresholdNc                 ód   — t          | ¦  «        D ]\  }}t          |||¬¦  «        |k    r|c S Œ dS )af  
    Searches for the first string in `candidates` whose edit distance
    to `query` is less than or equal to `threshold`.

    Args:
        candidates: List of strings to search.
        query: String to compare against the candidates.
        threshold: Maximum allowed edit distance for a match.
        case_sensitive: Whether matching should be case-sensitive.

    Returns:
        Index of the first matching string in candidates,
        or None if no match is found.

    Examples:
        ```pycon
        >>> from supervision.detection.utils.vlms import fuzzy_match_index
        >>> fuzzy_match_index(["cat", "dog", "rat"], "dat", threshold=1)
        0
        >>> fuzzy_match_index(["alpha", "beta", "gamma"], "bata", threshold=1)
        1
        >>> fuzzy_match_index(["one", "two", "three"], "xyz", threshold=2) is None
        True

        ```
    )r   N)Ú	enumerater   )r   r   r   r   ÚidxÚ	candidates         r   Úfuzzy_match_indexr   >   sN   € õ@ $ JÑ/Ô/ð ð ‰ˆˆYÝ˜ E¸.ÐIÑIÔIÈYÒVÐVØˆJˆJˆJð Wàˆ4r   )T)ÚstrÚboolÚintr   r   r   © r   r   ú<module>r"      sš   ðð:#ð :#˜Cð :#¨3ð :#Àð :#ÐPSð :#ð :#ð :#ð :#ðB  ð	#ð #Ø�S”	ð#àð#ð ð#ð ð	#ð
 	ˆ4�Zð#ð #ð #ð #ð #ð #r   