Ë
    ¼Ó^jï  ã                  ó8   — d dl mZ ddd„Z	 d	 	 	 	 	 	 	 	 	 dd„Zy)é    )Úannotationsc           	     óþ  — |s | j                  «       } |j                  «       }t        | «      t        |«      k  r|| }} t        t        t        |«      dz   «      «      }dgt        |«      dz   z  }t        dt        | «      dz   «      D ]f  }||d<   t        dt        |«      dz   «      D ]@  }| |dz
     ||dz
     k(  rd}nd}t	        ||   dz   ||dz
     dz   ||dz
     |z   «      ||<   ŒB ||}}Œh |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

        ```
    é   r   )ÚlowerÚlenÚlistÚrangeÚmin)Ústring_1Ústring_2Úcase_sensitiveÚprev_rowÚcurr_rowÚiÚjÚsubstitution_costs           úk/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/supervision/detection/utils/vlms.pyÚedit_distancer      s'  € ñD Ø—>‘>Ó#ˆØ—>‘>Ó#ˆä
ˆ8ƒ}”s˜8“}Ò$Ø% x�(ˆä”Eœ#˜h›-¨!Ñ+Ó,Ó-€HØˆs”c˜(“m aÑ'Ñ(€Hä�1”c˜(“m aÑ'Ó(ò 0ˆØˆ�‰Ü�qœ#˜h›-¨!Ñ+Ó,ò 		ˆAØ˜˜A™‰ (¨1¨q©5¡/Ò1Ø$%Ñ!à$%Ð!ÜØ˜‘˜a‘Ø˜˜Q™‘ !Ñ#Ø˜˜Q™‘Ð"3Ñ3óˆH�QŠKð		ð & x�(‰ð0ð ”C˜“MÑ"Ð"ó    c                óT   — t        | «      D ]  \  }}t        |||¬«      |k  sŒ|c S  y)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   )Ú
candidatesÚqueryÚ	thresholdr   ÚidxÚ	candidates         r   Úfuzzy_match_indexr   A   s8   € ô@ $ JÓ/ò ‰ˆˆYÜ˜ E¸.ÔIÈYÓVØŠJðð r   N)T)r   Ústrr   r   r   ÚboolÚreturnÚint)
r   z	list[str]r   r   r   r!   r   r   r    z
int | None)Ú
__future__r   r   r   © r   r   ú<module>r$      sF   ðÝ "ô:#ðB  ð	#Øð#àð#ð ð#ð ð	#ð
 ô#r   