Ë
    úmxi6  ã                  óZ   — d Z ddlmZ ddlmZmZ erddlmZ d	d„Z	 d
	 	 	 	 	 dd„Z	dd„Z
y)zTools for working with dicts.é    )Úannotations)ÚTYPE_CHECKINGÚAny)ÚMappingc                ó¨   — i }| j                  «       D ]<  \  }}|j                  d«      }d}|}|D ]  }||vri ||<   |}||   }Œ |€Œ5|||d   <   Œ> |S )a–  Convert a flat dict of key-value pairs to dict tree.

    Example
    -------

        _unflatten_single_dict({
          foo_bar_baz: 123,
          foo_bar_biz: 456,
          x_bonks: 'hi',
        })

        # Returns:
        # {
        #   foo: {
        #     bar: {
        #       baz: 123,
        #       biz: 456,
        #     },
        #   },
        #   x: {
        #     bonks: 'hi'
        #   }
        # }

    Parameters
    ----------
    flat_dict : dict
        A one-level dict where keys are fully-qualified paths separated by
        underscores.

    Returns
    -------
    dict
        A tree made of dicts inside of dicts.

    Ú_Néÿÿÿÿ)ÚitemsÚsplit)Ú	flat_dictÚoutÚpathstrÚvÚpathÚ	prev_dictÚ	curr_dictÚks           úW/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/elements/lib/dicttools.pyÚ_unflatten_single_dictr      s‡   € ðJ €CØ—o‘oÓ'ò $‰
ˆ�Ø�}‰}˜SÓ!ˆà+/ˆ	Øˆ	àò 	%ˆAØ˜	Ñ!Ø!�	˜!‘Ø!ˆIØ! !™‰Ið		%ð Ñ Ø"#ˆI�d˜2‘hÒð$ð €Jó    Nc                ó|  — |€
t        «       }t        | «      }t        |j                  «       «      D ]ˆ  \  }}t	        |t
        «      rt        ||«      }n?t        |d«      r3t        |«      D ]%  \  }}t	        |t
        «      sŒt        ||«      ||<   Œ' ||v sŒgd|vri |d<   ||d   |<   |j                  |«       ŒŠ |S )a!  Converts a flat dict of key-value pairs to a spec tree.

    Example
    -------
        unflatten({
          foo_bar_baz: 123,
          foo_bar_biz: 456,
          x_bonks: 'hi',
        }, ['x'])

        # Returns:
        # {
        #   foo: {
        #     bar: {
        #       baz: 123,
        #       biz: 456,
        #     },
        #   },
        #   encoding: {  # This gets added automatically
        #     x: {
        #       bonks: 'hi'
        #     }
        #   }
        # }

    Args
    ----
    flat_dict: dict
        A flat dict where keys are fully-qualified paths separated by
        underscores.

    encodings: set
        Key names that should be automatically moved into the 'encoding' key.

    Returns
    -------
    A tree made of dicts inside of dicts.
    Ú__iter__Úencoding)
Úsetr   Úlistr
   Ú
isinstanceÚdictÚ	unflattenÚhasattrÚ	enumerateÚpop)r   Ú	encodingsÚout_dictr   r   ÚiÚchilds          r   r   r   Q   sÈ   € ðR ÐÜ“Eˆ	ä% iÓ0€Hä�X—^‘^Ó%Ó&ò ‰ˆˆ1ä�aœÔÜ˜!˜YÓ'‰AÜ�Q˜
Ô#Ü% a›Lò 7‘��5Ü˜e¤TÕ*Ü$ U¨IÓ6�A�a’Dð7ð
 �	Š>Ø Ñ)Ø')�˜Ñ$Ø&'ˆH�ZÑ  Ñ#Ø�L‰L˜�Oðð  €Or   c                ó€   — i }| j                  «       D ](  \  }}|€Œ	t        |t        «      rt        |«      n|||<   Œ* |S )z-Remove all keys with None values from a dict.)r
   r   r   Úremove_none_values)Ú
input_dictÚnew_dictÚkeyÚvals       r   r'   r'   ’   sL   € à€HØ×$Ñ$Ó&ò V‰ˆˆSØ‰?Ü7AÀ#ÄtÔ7LÔ.¨sÔ3ÐRUˆH�SŠMðVð €Or   )r   údict[Any, Any]Úreturnr,   )N)r   r,   r"   zset[str] | Noner-   r,   )r(   zMapping[Any, Any]r-   r,   )Ú__doc__Ú
__future__r   Útypingr   r   Úcollections.abcr   r   r   r'   © r   r   ú<module>r3      sE   ðñ $å "ç %áÝ'ó5ðr =Að>Øð>Ø*9ð>àó>ôBr   