
     "j@                     (   d dl Z d dlZd dl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  e	d          Z ej        d           Zdd ej        d          iiZ G d d	          Z G d
 de j                  Zd Zd Z G d de          Zd ZdS )    N   )patch_collections_abcstringify_id
OrderedSetMutableSequencedash_core_componentsLogoutButtonz
        The Logout Button is no longer used with Dash Enterprise and can be replaced with a html.Button or html.A.
        eg: html.A(href=os.getenv('DASH_LOGOUT_URL'))
    c                   b    e Zd ZdZ e            Z ej        e          Z	i Z
edd            ZdS )ComponentRegistryz6Holds a registry of the namespaces used by components.Nc                     g }| j         D ]?}|||vr	t          j        |         }|                    t	          ||g                      @|S N)registrysysmodulesextendgetattr)clsresource_nameincludes	resourcesmodule_namemodules         [/var/www/html/bolsaweb/venv/lib/python3.11/site-packages/dash/development/base_component.pyget_resourceszComponentRegistry.get_resources$   sb    	< 	A 	AK#8(C(C[-FWV]B??@@@@    r   )__name__
__module____qualname____doc__r   r   collectionsdefaultdictdictchildren_propsnamespace_to_packageclassmethodr    r   r   r   r      s[        @@z||H,[,T22N	 	 	 [	 	 	r   r   c                       e Zd Zd ZdS )ComponentMetac                    t           j                            | |||          }|d                             d          d         }|dk    s|dk    r|S |                    d|          }|t
          j        |<   t
          j                            |           |                    d          t
          j	        |         |<   |S )Nr   .r   	Componentbuiltins
_namespace_children_props)
abcABCMeta__new__splitgetr   r$   r   addr#   )mcsnamebases
attributes	componentr   r-   s          r   r1   zComponentMeta.__new__4   s    K''T5*EE	L)//44Q7;&J"6"6 ^^L&99
=C.z:"&&v...=G^^>
 >
(4T: r   N)r   r   r   r1   r&   r   r   r(   r(   1   s#            r   r(   c                 H    	 t          |            dS # t          $ r Y dS w xY w)NTF)float
ValueError)ss    r   	is_numberr>   G   s9    at   uus    
!!c                     t          | d          r;t          | j        t                    s(t          | j        t          t
          f          s	t          d S d S )Nchildren)hasattr
isinstancer@   r+   tupler   KeyError)items    r    _check_if_has_indexable_childrenrF   O   s\    4$$ t}i004=5/*BCC
    r   c                       e Zd Zg ZdgZ G d d          Z e            Z G d d          Z e            Zd Z	d Z
d Zdd
Zd Zd Zd Zd Zed             Zd Zd Zd Zd Zd Zd Zd	S )r+   r@   c                       e Zd Zd Zd ZdS )Component._UNDEFINEDc                     dS N	undefinedr&   selfs    r   __repr__zComponent._UNDEFINED.__repr__]       ;r   c                     dS rK   r&   rM   s    r   __str__zComponent._UNDEFINED.__str__`   rP   r   Nr   r   r   rO   rR   r&   r   r   
_UNDEFINEDrI   \   s2        	 	 		 	 	 	 	r   rT   c                       e Zd Zd Zd ZdS )Component._REQUIREDc                     dS Nrequiredr&   rM   s    r   rO   zComponent._REQUIRED.__repr__f       :r   c                     dS rX   r&   rM   s    r   rR   zComponent._REQUIRED.__str__i   rZ   r   NrS   r&   r   r   	_REQUIREDrV   e   s2        	 	 		 	 	 	 	r   r\   c           
         |                                   dd l}t          |                                          D ]?\  }| j        v }t          fd| j        D                       }d|v rd|d          dnd}	 d}dd	d
d}| j        |v r.|                    || j                 | j	        |j
        |          }nC|                    | j        | j	        t          t          | j                  dd          |          }n# t          $ r d| j	         d| }Y nw xY w|s@|s>d                    t          | j                            }	t!          | d d|	           | j        vr7t%          |t&                    r"t!          |dz   d d|dz   dz   dz             dk    rt%          |t(                    r|                                D ]r\  }
}t%          |
t*                    st!          dd|
d|z             t%          |t*          t,          t.          t0          f          st!          dd|d|z             sn't%          |t*                    st!          d|          t3          | |           Ad S )Nr   c              3   B   K   | ]}                     |          V  d S r   
startswith.0wks     r   	<genexpr>z%Component.__init__.<locals>.<genexpr>v   s>       ! !$%Q! ! ! ! ! !r   idz with the ID "" z$The `{}.{}` component (version {}){}htmldcc
dash_table)dash_html_componentsr   rk   __version__unknownzThe `z` component, z+ received an unexpected keyword argument: `z`
Allowed arguments: z7 detected a Component for a prop other than `children`
zProp z has value z

z8Did you forget to wrap multiple `children` in an array?
zNFor example, it must be html.Div(["a", "b", "c"]) not html.Div("a", "b", "c")
zdict id keys must be strings,
zfound z in id z2dict id values must be strings, numbers or bools,
z(`id` prop must be a string or dict, not )_validate_deprecationdashlistitems_prop_namesany_valid_wildcard_attributesr-   format_typerm   r   
__import__ImportErrorjoinsorted	TypeError_base_nodesrB   r+   r"   strintr;   boolsetattr)rN   kwargsrq   vk_in_propnamesk_in_wildcards	id_suffixerror_string_prefixdash_packagesallowed_argsid_keyid_valrd   s               @r   __init__zComponent.__init__n   s   ""$$$ (( H	  H	 DAq$"22N  ! ! ! !)-)H! ! !  N
 =AFNN88888PRIQ&L# -3,1".! !
 ?m33*=*D*D%do6
(!	+ +'' +>*D*D

4? ; ;]IVV!	+ +'  Q Q Q 'Qdj&P&PY&P&P###Q
 " . #yy4+,,     * ; ;WX ; ;,8; ;  
 (((Z9-E-E('PQ5a55A5556 RR h	h   Dyya&& V*+'')) 
 
)&#66 "+ A"A6"A"AA"A"A!B# #   *&3UD2IJJ "+ U"A6"A"AA"A"A!B# # 
 $As++ V#$Tq$T$TUUUD!QQH	  H	 s   =BD  DDc           	         t          | d          rt          | d          S d| j         d| j         d}t          | dd          rt	          d| d          dt
          j        v rt	          d	| d          t          t          j	        t                              d
ddz                                }t          | d|           |S )Nrf   `r*   persistenceFa  
                Attempting to use an auto-generated ID with the `persistence` prop.
                This is prohibited because persistence is tied to component IDs and
                auto-generated IDs can easily change.

                Please assign an explicit ID to this z component.
                dash_snapshotsa  
                Attempting to use an auto-generated ID in an app with `dash_snapshots`.
                This is prohibited because snapshots saves the whole app layout,
                including component IDs, and auto-generated IDs can easily change.
                Callbacks referencing the new IDs will not work with old snapshots.

                Please assign an explicit ID to this r   r      )r   )rA   r   r-   rx   RuntimeErrorr   r   r   uuidUUIDrdrandintr   )rN   kindr   s      r   _set_random_idzComponent._set_random_id   s    4 	'4&&&24?22TZ2224.. 		
 7;     s{** 7;  	 	 	 	bjjAsF3344455dAr   c                       fd j         D             }|                     fd j        D                        | j         j        d}|S )Nc                 R    i | ]#}t          |          |t          |          $S r&   )rA   r   rb   prN   s     r   
<dictcomp>z,Component.to_plotly_json.<locals>.<dictcomp>   sE     
 
 
tQ
wtQ
 
 
r   c                 t    i | ]3t          fd j        D                       "t                    4S )c              3   B   K   | ]}                     |          V  d S r   r_   ra   s     r   re   z6Component.to_plotly_json.<locals>.<dictcomp>.<genexpr>   sC          LLOO     r   )ru   rv   r   )rb   rd   rN   s    @r   r   z,Component.to_plotly_json.<locals>.<dictcomp>   sq            "<    74##  r   )propstype	namespace)rt   update__dict__rx   r-   )rN   r   as_jsons   `  r   to_plotly_jsonzComponent.to_plotly_json   s    
 
 
 
%
 
 
 	     
	
 
	
 
	
 J
 
 r   Nc                    t          |            t          | j        t                    rt	          | j        dd           ;| j        j        |k    r+|dk    r| j        S |dk    r	|| _        d S |dk    r	d | _        d S 	 |dk    r| j                            |          S |dk    r| j                            ||           d S |dk    r| j                            |           d S n# t          $ r Y nw xY wt          | j        t          t          f          rt          | j                  D ]\  }}t	          |dd           |k    r/|dk    r|c S |dk    r|| j        |<    d S |dk    r| j        |=  d S It          |t                    rl	 |dk    r|                    |          c S |dk    r|                    ||            d S |dk    r|                    |            d S # t          $ r Y w xY wt          |          )Nrf   r3   setdelete)rF   rB   r@   r+   r   rf   __getitem____setitem____delitem__rD   rC   r   	enumerate)rN   rf   	operationnew_itemirE   s         r   _get_set_or_deletezComponent._get_set_or_delete   s   (... dmY// 	t}dD11==#r)) E))#}, E))(0 H,,(,
%%=44R888%%M--b(;;;F((M--b111F )     dme_%=>> 	$T]33  44t,,22 E))# E))+3a( H,, M!, -  i00 
$--#'#3#3B#7#7777$-- ,,R:::"FF$00 ,,R000"FF 1 $    rlls<   <C" !C" ? C" "
C/.C/G!#G!G!!
G.-G.c                 .    |                      |d          S )zTRecursively find the element with the given ID through the tree of
        children.r3   r   rN   rf   s     r   r   zComponent.__getitem__B  s     &&r5111r   c                 0    |                      |d|          S )zSet an element by its ID.r   r   )rN   rf   rE   s      r   r   zComponent.__setitem__J  s    &&r5$777r   c                 .    |                      |d          S )z+Delete items by ID in the tree of children.r   r   r   s     r   r   zComponent.__delitem__N  s    &&r8444r   c              #   L   K   |                                  D ]}|d         V  dS )zYield each item in the tree.   N)_traverse_with_pathsrN   ts     r   	_traversezComponent._traverseR  s:      **,, 	 	AA$JJJJ	 	r   c                 P    t          t          | dd                    }|od|ddS )Nrf   rh   z (id=r=   ))r   r   )r9   id_s     r   _id_strzComponent._id_strW  s5    79dB7788''s'''''r   c              #     K   t          | dd          }t          |          j        }||                     |          z   }t	          |t
                    rCd|z   |fV  |                                D ]#\  }}d                    d|z   |g          |fV  $dS t	          |t          t          f          rt          |          D ]\  }}d|ddt          |          j        d|                     |           }||fV  t	          |t
                    r5|                                D ] \  }}d                    ||g          |fV  !dS dS )	z*Yield each item with its path in the tree.r@   Nz[*] 
[dz] r=   )r   r   r   r   rB   r+   r   r{   rC   r   r   )	rN   r@   children_typechildren_stringr   r   idxr   	list_paths	            r   r   zComponent._traverse_with_paths\  s     4T22X/'$,,x*@*@@ h	** 	;?*H4444 5577 B B1ii/!91 =>>AAAAAB B 5/":;; 	;#H-- ; ;QNNNNa)9NNT\\!__NN	l"""a++ ; ! 6 6 8 8 ; ;1"iiA77:::::	; 	;; ;r   c              #      K   |                                  D ],}t          |t                    rt          |dd          |V  -dS )z2Yield components with IDs in the tree of children.rf   N)r   rB   r+   r   r   s     r   _traverse_idszComponent._traverse_idst  sV      !! 	 	A!Y'' GAtT,B,B,N	 	r   c              #   J   K   |                                  D ]}|j        V  dS )z"Yield IDs in the tree of children.N)r   rf   r   s     r   __iter__zComponent.__iter__z  s8      ##%% 	 	A$JJJJ	 	r   c                 N   d}t          | dd          d}nt          | j        t                    rd}|t	          | j                  z  }nZt          | j        t
          t          f          r7| j        D ].}|dz  }t          |t                    r|t	          |          z  }/nd}|S )z'Return the number of items in the tree.r   r@   Nr   )r   rB   r@   r+   lenrC   r   )rN   lengthcs      r   __len__zComponent.__len__  s     4T**2FFy11 
	Fc$-(((FF'?@@ 	] % %!a++ %c!ff$F% Fr   c                      fd j         D              fd j        D             z   }t          d |D                       r"d                     fd|D                       }nt	          t           dd                     } j         d| dS )	Nc                 6    g | ]}t          |d           |S r   r   rb   r   rN   s     r   
<listcomp>z&Component.__repr__.<locals>.<listcomp>  s1     
 
 
74D+A+A+MA+M+M+Mr   c                 V    g | ]$t          fd j        D                       "%S )c              3   B   K   | ]}                     |          V  d S r   r_   )rb   wc_attrr   s     r   re   z0Component.__repr__.<locals>.<listcomp>.<genexpr>  s/      XXW1<<((XXXXXXr   )ru   rv   r   s    @r   r   z&Component.__repr__.<locals>.<listcomp>  sP     
 
 
XXXX8WXXXXX

 
 
r   c              3   "   K   | ]
}|d k    V  dS )r@   Nr&   )rb   r   s     r   re   z%Component.__repr__.<locals>.<genexpr>  s&      ::1qJ::::::r   ro   c              3   B   K   | ]}| d t          |          V  dS )=Nr   r   s     r   re   z%Component.__repr__.<locals>.<genexpr>  sL       % %011++wtQ''++% % % % % %r   r@   (r   )rt   r   ru   r{   reprr   rx   )rN   props_with_valuesprops_strings   `  r   rO   zComponent.__repr__  s    
 
 
 
'
 
 

 
 
 
]
 
 

 ::(9::::: 	A99 % % % %5F% % %  LL  j$ ? ?@@L*..|....r   c                    t          | dd          }t          | dd          }t                              |i                               |          }|r5t          j        t          t          j        |                               d S d S )Nrx   rh   r-   )r   _deprecated_componentsr3   warningswarnDeprecationWarningtextwrapdedent)rN   rx   _nsdeprecation_messages       r   rp   zComponent._validate_deprecation  s    gr**dL"--488bAAEEeLL 	TM,X_=P-Q-QRRSSSSS	T 	Tr   r   )r   r   r   r.   r~   rT   	UNDEFINEDr\   REQUIREDr   r   r   r   r   r   r   r   staticmethodr   r   r   r   r   rO   rp   r&   r   r   r+   r+   X   s       O,K        
I        y{{HM  M  M ^  B  :> > > >N2 2 28 8 85 5 5  
 ( ( \(; ; ;0    
  ,/ / /"T T T T Tr   r+   )	metaclassc                 B    t           d          r j        j        n j        j         fd}t          t          d          rXt	          j        |                              t	          j                   j                                                  }||_	        |S )N	func_codec                  D   d|v rt          d          t          t          t          d t          |                              d |                                D             z                       |d<   d|d         v r|d                             d            | i |S )N_explicit_argsz*Variable _explicit_args should not be set.c                     g | ]\  }}|S r&   r&   )rb   rd   _s      r   r   z6_explicitize_args.<locals>.wrapper.<locals>.<listcomp>  s    .L.L.LTQq.L.L.Lr   rN   )	Exceptionrr   r   r   rs   remove)argsr   funcvarnamess     r   wrapperz"_explicitize_args.<locals>.wrapper  s    v%%HIII#'XkD		k*++.L.LV\\^^.L.L.LLMM$
 $
  V,---#$++F333tT$V$$$r   	signature)
parameters)
rA   r   co_varnames__code__inspectr   replacer   values__signature__)r   r   new_sigr   s   `  @r   _explicitize_argsr    s    t[!! ->- =,% % % % % % w$$ (#G,,44(..9@@BB 5 
 
 !(Nr   )r/   r    r   r   r   randomr   r   _utilsr   r   r   r   Randomr   r   r   r   r0   r(   r>   rF   r+   r  r&   r   r   <module>r     s   



      



     D D D D D D D D D D''(9::V]1 
 
	        (    CK   ,    ST ST ST ST ST- ST ST ST STl
    r   