
    ȯei              	          U d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZm	Z	m
Z
mZmZ d dlmZ er
d dlZd dlmZ  ej&                  d      Zded<   d"d	Zd#d
Zd#dZd$dZd%dZd&dZd'dZd(dZd)dZ eh d e  e!dd            dhz
  z        Z"ded<   d*dZ#d+dZ$ ej&                  d      Z%ded<   d,dZ&d-dZ'edde(e)ejT                  ejV                  ejX                  ejZ                  f   Z.ded <   d.d!Z/y)/    )annotationsN)TYPE_CHECKINGAnyFinal	TypeAliasUnion)StreamlitAPIException)SupportsStrz^[a-zA-Z0-9_&\-\. ]+$r   _ALPHANUMERIC_CHAR_REGEXc                Z    t        j                  t        |             j                         S )z;Convert an object to text, dedent it, and strip whitespace.)textwrapdedentstrstriptexts    W/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/streamlit/string_util.py
clean_textr   "   s    ??3t9%++--    c                B    | rt        j                  t        |       du S dS )zCheck if a string contains any special chars.

    Special chars in that case are all chars that are not
    alphanumeric, underscore, hyphen or whitespace.
    NF)rematchr   r   s    r   _contains_special_charsr   '   s$     @D288,d3t;NNr   c                N    t        |       syddlm} | j                  dd      |v S )z'Check if input string is a valid emoji.Fr   )
ALL_EMOJISu   ️ )r   streamlit.emojisr   replace)r   r   s     r   is_emojir   0   s&    "4(+<<b)Z77r   c                    ddl m} | |v S )z/Check if input string is a valid Material icon.r   )ALL_MATERIAL_ICONS)streamlit.material_icon_namesr!   )
maybe_iconr!   s     r   is_material_iconr$   :   s    @+++r   c                b    | y| dk(  ry| j                  d      rt        |       S t        |       S )zFValidate an icon or emoji and return it in normalized format if valid.r   spinnerz	:material)
startswithvalidate_material_iconvalidate_emoji)icons    r   validate_icon_or_emojir+   A   s9    | y{#%d++$r   c                @    | yt        |       r| S t        d|  d      )Nr   zThe value "zZ" is not a valid emoji. Shortcodes are not allowed, please use a single character instead.)r   r	   )maybe_emojis    r   r)   r)   O   s7    

k] #1 	1 r   c                4   dg}| yd}t        j                  ||       }d}|s%t        d| j                  d|dz          d| d      |j	                         \  }}||vs|rt        |      s%t        d| j                  d|dz          d| d	      d
| d| d
S )z^Validate a Material icon shortcode and return the icon in
    normalized format if valid.
    materialr   z^\s*:(.+)\/(.+):\s*$u   ​zThe value `"/zW"` is not a valid Material icon. Please use a Material icon shortcode like **`:materialz/thumb_up:`**z/thumb_up:`**.:)r   r   r	   r   groupsr$   )maybe_material_iconsupported_icon_packs
icon_regex
icon_matchinvisible_white_space	pack_name	icon_names          r   r(   r(   [   s     	 "(J*&9:J %#.66s<QTW<WXY Z01@
 	
 &,,.Iy 	--	*#.66s<QTW<WXY Z01A
 	
 yk9+Q''r   c                    t        |       sd| fS ddlm} t        j                  ||       }|d| fS |j                  d      |j                  d      fS )zReturn a tuple containing the first emoji found in the given string and
    the rest of the string (minus an optional separator between the two).
    r   r   )EMOJI_EXTRACTION_REGEX      )r   r   r;   r   searchgroup)r   r;   re_matchs      r   extract_leading_emojirA      sW    
 #4( 4x7yy/6H4x>>!hnnQ///r   c                N    d}d}| D ]  }||k(  r|dz  }t        ||      }d} |S )zBReturns the count of the max sequence of a given char in a string.r   r<   )max)stringcharmax_sequencecurrent_sequencecs        r   max_char_sequencerI      sI    L !9!|-=>L ! r   >         	   
                      	TEXTCHARSc                @    t        | j                  dt                    S )z8Guess if an input bytesarray can be encoded as a string.N)bool	translaterT   )inps    r   is_binary_stringrY      s     dI.//r   c                    t        | d      }d}t        |      dk\  r|dz  }|dz  }t        |      dk\  rdj                  |dj                  d      j                  d	      g d
|         S )z:Simplifies number into Human readable format, returns str.z.2gr   i  r<   g     @@z{}{}f0.)r   kmbt)floatabsformatrstrip)numnum_converted	magnitudes      r   simplify_numberri      s}    SI'MI
m

$Q	 m

$ ==
##C(//4 + r   z0^\<[a-zA-Z_]+[a-zA-Z0-9<>._ ]* at 0x[0-9a-f]+\>$_OBJ_MEM_ADDRESSc                >    t        t        j                  |             S )zAReturns True if the string looks like <foo blarg at 0x15ee6f9a0>.)rV   rj   r   )rD   s    r   is_mem_address_strrl      s     &&v.//r   c                z    t        j                  dd|       }t        j                  dd|      j                         S )zConverts UpperCamelCase and lowerCamelCase to snake_case.

    Examples
    --------
        fooBar -> foo_bar
        BazBang -> baz_bang

    z(.)([A-Z][a-z]+)z\1_\2z([a-z0-9])([A-Z]))r   sublower)camel_case_strs1s     r   to_snake_caserr      s4     
"Hn	=B66%x4::<<r   znp.integer[Any]znp.floating[Any]r   	AnyNumberc                6   t        | t        j                        rt        |       S t	        | d      r?	 t        | j                         t        t        f      rt        | j                               S 	 t        d|  dt        |        d      # t        $ r Y &w xY w)a  Render a real numeric type as a string for display.

    Parameters
    ----------
    value : AnyNumber
        The numeric value to convert to a string. Can be an ``int``, ``float``,
        any ``numbers.Number`` (e.g., ``decimal.Decimal``), or a NumPy numeric type
        with an ``item()`` method.

    Returns
    -------
    str
        String representation of the numeric value.

    Raises
    ------
    TypeError
        If the value is not of an accepted numeric type.
    item'z' is of type zU, which is not an accepted type. Please convert the value to an accepted number type.)
isinstancenumbersNumberr   hasattrru   rb   int	Exception	TypeErrortype)values    r   from_numberr      s    ( %(5zuf	%**,55::<(( 6 
E7-U} -? 	? 	  		s   <B 	BB)r   r
   returnr   )r   r   r   rV   )r#   r   r   rV   )r*   
str | Noner   r   )r-   r   r   r   )r3   r   r   r   )r   r   r   ztuple[str, str])rD   r   rE   r   r   r{   )rX   bytesr   rV   )rf   r{   r   r   )rD   r   r   rV   )rp   r   r   r   )r   rs   r   r   )0
__future__r   decimal	fractionsrx   r   r   typingr   r   r   r   r   streamlit.errorsr	   numpynpstreamlit.type_utilr
   compiler   __annotations__r   r   r   r$   r+   r)   r(   rA   rI   	bytearraysetrangerT   rY   ri   rj   rl   rr   r{   rb   DecimalFractionRealry   rs   r    r   r   <module>r      s   #    	  > > 2/","**-E"F % F.
O8, 	'(T0( E$$6 74& @@	5 
0
 %"**7 % 
0

= 	OOLLNN		9 	#r   