
    -Phw                     t    d dl mZ d dlZd dlmZ d dlmZ d Zd Z	de
dee
         fdZ e            fd	ZdS )
    )ListN)get_plotlyjs_versionc                    ddl m} t          | |          r|                                 }nt          | t                    r7|r2t
          j                            |                                           }nY| }nVt          | d          r|                                 }n1t          d                    t          |           |                     |S )Nr   )
BaseFigureto_plotly_jsonzR
The fig parameter must be a dict or Figure.
    Received value of type {typ}: {v})typv)plotly.basedatatypesr   
isinstanceto_dictdictplotly
graph_objsFigurer   hasattr
ValueErrorformattype)figvalidater   fig_dicts       P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/plotly/io/_utils.pyvalidate_coerce_fig_to_dictr      s    //////#z"" 
;;==	C		 
 	(//44CCEEHHHH	&	'	' 	
%%''))/II *0 * *
 
 	
 O    c                     | dk    s| t           j        k    rt           j        }nG| dk    s%t          t           d          r| t           j        k    rt           j        }nt	          d          |S )Nr   FigureWidgetzP
Invalid output type: {output_type}
    Must be one of: 'Figure', 'FigureWidget')gor   r   r   r   )output_typeclss     r   validate_coerce_output_typer        ss    h+":":i		&	&N## 
'(3r(F(Fo0
 
 	

 Jr   kwargsreturnc                  P   d t          |                                           D             }|r/t          t          |                    dk    rt	          d          |r|d         ndfd|                                 D             fdt                    D             }|S )a  
    Given one or more keyword arguments which may be either a single value or a list of values,
    return a list of keyword dictionaries by broadcasting the single valuesacross all the dicts.
    If more than one item in the input is a list, all lists must be the same length.

    Parameters
    ----------
    **kwargs: dict
        The keyword arguments

    Returns
    -------
    list of dicts
        A list of dictionaries

    Raises
    ------
    ValueError
        If any of the input lists are not the same length
    c                 V    g | ]&}t          |t                    t          |          'S  )r   listlen).0r	   s     r   
<listcomp>z+broadcast_args_to_dicts.<locals>.<listcomp>H   s-    RRRqjD>Q>QRCFFRRRr      z-All list arguments must have the same length.r   c                 R    i | ]#\  }}|t          |t                    s|gz  n|$S r%   )r   r&   )r(   kr	   list_lengths      r   
<dictcomp>z+broadcast_args_to_dicts.<locals>.<dictcomp>N   sJ       Aq 	
Jq$$7$7>A3Q  r   c                 R    g | ]"fd                                  D             #S )c                 (    i | ]\  }}||         S r%   r%   )r(   r,   r	   is      r   r.   z6broadcast_args_to_dicts.<locals>.<listcomp>.<dictcomp>U   s#    555TQAaD555r   )items)r(   r1   expanded_kwargss    @r   r)   z+broadcast_args_to_dicts.<locals>.<listcomp>T   sH       :;5555_2244555  r   )tuplevaluesr'   setr   r2   range)r!   list_lengthslist_of_kwargsr3   r-   s      @@r   broadcast_args_to_dictsr:   0   s    0 SRE&--//$:$:RRRL JC--..22HIII%18,q//qK   LLNN  O   ?D[?Q?Q  N r   c                 .    d                     |           S )zReturn a valid plotly CDN url.z+https://cdn.plot.ly/plotly-{cdn_ver}.min.jscdn_ver)r   r<   s    r   plotly_cdn_urlr>   [   s#    8?? @   r   )typingr   r   plotly.graph_objsr   r   plotly.offliner   r   r    r   r:   r>   r%   r   r   <module>rB      s                 / / / / / /  0   (d (tDz ( ( ( (V 0/11      r   