
    >wg                     p    d Z ddlmZmZ ddlmZmZ eeef   Z		 	 	 dde	dedee   d	e
d
e	f
dZded
efdZy)z4Provides a wrpper for the Rust based implementation.    )OptionalUnion   )get_base_level_innerget_display_innerNstr_or_bytesencodingbase_dirdebugreturnc                     t        | t              r| j                  |      }d}n| }d}t        |||      }|r|j	                  |      }|S )aa  Accepts string or bytes. In case of bytes, `encoding`
    is needed as the inner function expects a valid string (default:"utf-8").

    Set `base_dir` to 'L' or 'R' to override the calculated base_level.

    Set `debug` to True to return the calculated levels.

    Returns the display layout, either as unicode or `encoding` encoded
    string.

    TF)
isinstancebytesdecoder   encode)r   r	   r
   r   textwas_decodeddisplays          C/var/www/horilla/myenv/lib/python3.12/site-packages/bidi/wrapper.pyget_displayr   	   sQ    " ,&""8,h6G..*N    r   c                     t        |       S )zxReturns the base unicode level of the 1st paragraph in `text`.

    Return value of 0 means LTR, while 1 means RTL.
    )r   )r   s    r   get_base_levelr   )   s    
  %%r   )zutf-8NF)__doc__typingr   r   bidir   r   strr   
StrOrBytesboolr   intr    r   r   <module>r"      sr    : " 93:
 "	 sm 	
 @& & &r   