
    %ic                      X    d Z dZdZdZddlmZ erdd lmZ y ee      Z	 G d de
      Zy))Utf8Validator(      r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      r      r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   
      r
   r
   r
   r
   r
   r
   r
   r
   r
   r
   r
      r
   r
         r   r      r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r   r
   r   r   r   r   r   r   r   r
   r   r   r   r   r   r
   r   r
   r   r   r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )USES_NVXc                   ,    e Zd ZdZdZd Zd Zd Zd Zy)r   z
        Incremental UTF-8 validator with constant memory consumption (minimal state).

        Implements the algorithm "Flexible and Economical UTF-8 Decoder" by
        Bjoern Hoehrmann (http://bjoern.hoehrmann.de/utf-8/decoder/dfa/).
        )
_codepoint_state_indexc                 N    d | _         d | _        d | _        | j                          y )N)r   r   r   resetselfs    z/var/www/html/navyabakers_fullstack/navyabakers_prod/venv/lib/python3.12/site-packages/autobahn/websocket/utf8validator.py__init__zUtf8Validator.__init__  s     "DODKDKJJL    c                     t         |   }| j                  t        k7  r|dz  | j                  dz  z  | _        nd|z	  |z  | _        t         d| j                  dz  z   |z      | _        | j                  S )a  
            Eat one UTF-8 octet, and validate on the fly.

            Returns ``UTF8_ACCEPT`` when enough octets have been consumed, in which case
            ``self.codepoint`` contains the decoded Unicode code point.

            Returns ``UTF8_REJECT`` when invalid UTF-8 was encountered.

            Returns some other positive integer when more octets need to be eaten.
            ?   r            )UTF8VALIDATOR_DFA_Sr   UTF8_ACCEPTr   )r   btts      r   decodezUtf8Validator.decode  sl     %Q'B{{k)#$t810D"E#'2:"2-cDKK"4D.Dr.IJDK;;r   c                 6    t         | _        d| _        d| _        y)z[
            Reset validator to start new incremental UTF-8 decode/validation.
            r   N)r!   r   r   r   r   s    r   r   zUtf8Validator.reset  s     &DKDODKr   c                 \   t        |      }d}| j                  }||k  r\t        d|dz  z   t        ||      z      }|t        k(  r,|| _        | xj                  |z  c_        dd|| j                  fS |dz  }||k  r\|| _        | xj                  |z  c_        d|t
        k(  || j                  fS )a  
            Incrementally validate a chunk of bytes provided as string.

            Will return a quad ``(valid?, endsOnCodePoint?, currentIndex, totalIndex)``.

            As soon as an octet is encountered which renders the octet sequence
            invalid, a quad with ``valid? == False`` is returned. ``currentIndex`` returns
            the index within the currently consumed chunk, and ``totalIndex`` the
            index within the total consumed sequence that was the point of bail out.
            When ``valid? == True``, currentIndex will be ``len(ba)`` and ``totalIndex`` the
            total amount of consumed bytes.
            r   r   r   Fr   T)lenr   r    UTF8_REJECTr   r!   )r   balistates        r   validatezUtf8Validator.validate  s    " BAAKKEa%+5A:&)<RU)CC K'"'DKKK1$K %DKK77Q a%  DKKK1K+-q$++==r   N)	__name__
__module____qualname____doc__	__slots__r   r$   r   r-    r   r   r   r     s"    	
			&	 	>r   r   N)__all__UTF8VALIDATOR_DFAr!   r(   autobahn.websocketr   autobahn.nvx._utf8validatorr   bytesr    objectr3   r   r   <module>r:      sI   > Q f  (9   12O> O>r   