
    AHj9                    X    d dl mZ d dlmZ erd dlmZmZ d dlmZ dgZ		 d	 	 	 	 	 d	dZ
y)
    )annotations)TYPE_CHECKING)AppComposeResult)WidgetcomposeNc                ,   d}ddl m}m} | j                  }g }g }g }|j                  j                  |       |j                  j                  |       t        ||n| j                               }	t        |	d      }
	 	 	 t        |	      }t        ||      s, |dt        |       d      }|
r|	j                  |       n|d	 |j                   |r!|j#                  |       |j%                          |r	 |d	   j'                  |       n|j                  |       # t        $ r Y n]w xY w# t         $ r"  |d      }|
r|	j                  |       n|dY w xY w# t(        $ r}|
r|	j                  |       n Y d}~ad}~ww xY w|r!|j#                  |       |j%                          |j                  j+                          |j                  j+                          |S # |j                  j+                          |j                  j+                          w xY w)
a  Compose child widgets from a generator in the same way as [compose][textual.widget.Widget.compose].

    Example:
        ```python
            def on_key(self, event:events.Key) -> None:

                def add_key(key:str) -> ComposeResult:
                    with containers.HorizontalGroup():
                        yield Label("You pressed:")
                        yield Label(key)

                self.mount_all(
                    compose(self, add_key(event.key)),
                )
        ```

    Args:
        node: The parent node.
        compose_result: A compose result, or `None` to call `node.compose()`.

    Returns:
        A list of widgets.
    Tr   )
MountErrorr   NthrowzCan't mount z; expected a Widget instance.zOWidget is missing an 'id' attribute; did you forget to call super().__init__()?)textual.widgetr
   r   app_compose_stacksappend	_composediterr   hasattrnextStopIteration
isinstancetyper   idAttributeErrorextendclearcompose_add_child	Exceptionpop)nodecompose_result_rich_traceback_omitr
   r   r   nodescompose_stackcomposediter_composeis_generatorchildmount_errorerrors                 G/root/tools/cai/cai_env/lib/python3.12/site-packages/textual/compose.pyr   r      s   4  1
((CE"$MH}-MM"(4$,,.L <1L/\* eV,("4;-/LM   &&{3%4/	0 X& !"%77> U#Q  !  " 0(e   &&{3%4/ 40 ! # %**51 2	 LL"NN!L 	!s~   =G ?D 
8G D+ %G 5E 	G 	D(%G 'D((G +(EG EG 	F"E<7G <F&G 6H)N)r   zApp | Widgetr    zComposeResult | Nonereturnzlist[Widget])
__future__r   typingr   textual.appr   r   r   r   __all__r        r*   <module>r2      sC    "  .%+ @DW
W(<WWr1   