o
    :6f                     @   sB   d dl Z d dlmZ d dlmZ dd Zdd Ze fddZdS )	    N)get_plotlyjs_versionc                 C   sx   ddl m} t| |r|  }|S t| tr&|r"tj|  }|S | }|S t	| dr1|  }|S t
djt| | d)Nr   )
BaseFigureto_plotly_jsonzR
The fig parameter must be a dict or Figure.
    Received value of type {typ}: {v})typv)Zplotly.basedatatypesr   
isinstanceZto_dictdictplotly
graph_objsFigurer   hasattr
ValueErrorformattype)ZfigZvalidater   Zfig_dict r   0lib/python3.10/site-packages/plotly/io/_utils.pyvalidate_coerce_fig_to_dict   s&   


	r   c                 C   sJ   | dks	| t jkrt j}|S | dkstt dr!| t jkr!t j}|S td)Nr   FigureWidgetzP
Invalid output type: {output_type}
    Must be one of: 'Figure', 'FigureWidget')gor   r   r   r   )Zoutput_typeclsr   r   r   validate_coerce_output_type   s   
r   c                 C   s   dj | dS )zReturn a valid plotly CDN url.z+https://cdn.plot.ly/plotly-{cdn_ver}.min.jsZcdn_ver)r   r   r   r   r   plotly_cdn_url.   s   r   )	r	   Zplotly.graph_objsr
   r   Zplotly.offliner   r   r   r   r   r   r   r   <module>   s    