
    [6g+                        d dl Z d dlZd dlmZ d dlZd dlmZ 	 d dlmZ  e            Z	e j
                            e j
                            ej                            Ze j
                            ed          Ze j
                            ed          e	_        e	j        de	_        n# e$ r dZdZ	Y nw xY w	 dd
Z	 	 	 	 	 	 ddZddZg dZdS )    N)Path)validate_coerce_fig_to_dict)PlotlyScopepackage_datazplotly.min.jsz?https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.jsTautoc                    |dk    r't           d}nddlm} 	  |             d}n	#  d}Y nxY w|dk    rddlm}  || |||||          S |dk    r0t	          d	                    t          |          
                    t           t	          d          t          | |          }	t                               |	||||          }
|
S )a	  
    Convert a figure to a static image bytes string

    Parameters
    ----------
    fig:
        Figure object or dict representing a figure

    format: str or None
        The desired image format. One of
          - 'png'
          - 'jpg' or 'jpeg'
          - 'webp'
          - 'svg'
          - 'pdf'
          - 'eps' (Requires the poppler library to be installed and on the PATH)

        If not specified, will default to:
             - `plotly.io.kaleido.scope.default_format` if engine is "kaleido"
             - `plotly.io.orca.config.default_format` if engine is "orca"

    width: int or None
        The width of the exported image in layout pixels. If the `scale`
        property is 1.0, this will also be the width of the exported image
        in physical pixels.

        If not specified, will default to:
             - `plotly.io.kaleido.scope.default_width` if engine is "kaleido"
             - `plotly.io.orca.config.default_width` if engine is "orca"

    height: int or None
        The height of the exported image in layout pixels. If the `scale`
        property is 1.0, this will also be the height of the exported image
        in physical pixels.

        If not specified, will default to:
             - `plotly.io.kaleido.scope.default_height` if engine is "kaleido"
             - `plotly.io.orca.config.default_height` if engine is "orca"

    scale: int or float or None
        The scale factor to use when exporting the figure. A scale factor
        larger than 1.0 will increase the image resolution with respect
        to the figure's layout pixel dimensions. Whereas as scale factor of
        less than 1.0 will decrease the image resolution.

        If not specified, will default to:
             - `plotly.io.kaleido.scope.default_scale` if engine is "kaleido"
             - `plotly.io.orca.config.default_scale` if engine is "orca"


    validate: bool
        True if the figure should be validated before being converted to
        an image, False otherwise.

    engine: str
        Image export engine to use:
         - "kaleido": Use Kaleido for image export
         - "orca": Use Orca for image export
         - "auto" (default): Use Kaleido if installed, otherwise use orca

    Returns
    -------
    bytes
        The image data
    r   Nkaleido   )validate_executableorca)to_image)formatwidthheightscalevalidatez/Invalid image export engine specified: {engine})enginez
Image export using the "kaleido" engine requires the kaleido package,
which can be installed using pip:
    $ pip install -U kaleido
)r   r   r   r   )	scope_orcar   r   
ValueErrorr   reprr   	transform)figr   r   r   r   r   r   r   to_image_orcafig_dict	img_bytess              Q/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/plotly/io/_kaleido.pyr   r      sC   L FF 322222###%%%# #444444}
 
 
 	
 
9		=DDF|| E  
 
 	
 }
 
 	
 +399HuV5    I s   % +c           	          t          |t                    rt          |          }nt          |t                    r|}nd}|D|B|j        }	|	r|	                    d          }n#t          d                    |                    t          | ||||||          }
|K	 |                    |
           dS # t          $ r Y nw xY wt          d                    |                    |
                    |
           dS )a0
  
    Convert a figure to a static image and write it to a file or writeable
    object

    Parameters
    ----------
    fig:
        Figure object or dict representing a figure

    file: str or writeable
        A string representing a local file path or a writeable object
        (e.g. a pathlib.Path object or an open file descriptor)

    format: str or None
        The desired image format. One of
          - 'png'
          - 'jpg' or 'jpeg'
          - 'webp'
          - 'svg'
          - 'pdf'
          - 'eps' (Requires the poppler library to be installed and on the PATH)

        If not specified and `file` is a string then this will default to the
        file extension. If not specified and `file` is not a string then this
        will default to:
            - `plotly.io.kaleido.scope.default_format` if engine is "kaleido"
            - `plotly.io.orca.config.default_format` if engine is "orca"

    width: int or None
        The width of the exported image in layout pixels. If the `scale`
        property is 1.0, this will also be the width of the exported image
        in physical pixels.

        If not specified, will default to:
            - `plotly.io.kaleido.scope.default_width` if engine is "kaleido"
            - `plotly.io.orca.config.default_width` if engine is "orca"

    height: int or None
        The height of the exported image in layout pixels. If the `scale`
        property is 1.0, this will also be the height of the exported image
        in physical pixels.

        If not specified, will default to:
            - `plotly.io.kaleido.scope.default_height` if engine is "kaleido"
            - `plotly.io.orca.config.default_height` if engine is "orca"

    scale: int or float or None
        The scale factor to use when exporting the figure. A scale factor
        larger than 1.0 will increase the image resolution with respect
        to the figure's layout pixel dimensions. Whereas as scale factor of
        less than 1.0 will decrease the image resolution.

        If not specified, will default to:
            - `plotly.io.kaleido.scope.default_scale` if engine is "kaleido"
            - `plotly.io.orca.config.default_scale` if engine is "orca"

    validate: bool
        True if the figure should be validated before being converted to
        an image, False otherwise.

    engine: str
        Image export engine to use:
         - "kaleido": Use Kaleido for image export
         - "orca": Use Orca for image export
         - "auto" (default): Use Kaleido if installed, otherwise use orca

    Returns
    -------
    None
    N.z
Cannot infer image type from output path '{file}'.
Please add a file extension or specify the type using the format parameter.
For example:

    >>> import plotly.io as pio
    >>> pio.write_image(fig, file_path, format='png')
)file)r   r   r   r   r   r   zX
The 'file' argument '{file}' is not a string, pathlib.Path object, or file descriptor.
)
isinstancestrr   suffixlstripr   r   r   writeAttributeErrorwrite_bytes)r   r    r   r   r   r   r   r   pathextimg_datas              r   write_imager+      sX   d $ 	Dzz	D$		   FNk 	ZZ__FF F         H |	JJx   F 	 	 	D	
F   
 
 	
 	"""""s   B6 6
CCFc                 (   t           t          d          |rddl}|                    d           t	          j        t                               | d                              d                    } |r| S ddlm	} |
                    | d	          S )
aO  
    Compute default values for all attributes not specified in the input figure and
    returns the output as a "full" figure. This function calls Plotly.js via Kaleido
    to populate unspecified attributes. This function is intended for interactive use
    during development to learn more about how Plotly.js computes default values and is
    not generally necessary or recommended for production use.

    Parameters
    ----------
    fig:
        Figure object or dict representing a figure

    warn: bool
        If False, suppress warnings about not using this in production.

    as_dict: bool
        If True, output is a dict with some keys that go.Figure can't parse.
        If False, output is a go.Figure with unparseable keys skipped.

    Returns
    -------
    plotly.graph_objects.Figure or dict
        The full figure
    Nzu
Full figure generation requires the kaleido package,
which can be installed using pip:
    $ pip install -U kaleido
r   zfull_figure_for_development is not recommended or necessary for production use in most circumstances. 
To suppress this warning, set warn=Falsejson)r   zutf-8T)skip_invalid)r   r   warningswarnr-   loadsr   decodeplotly.graph_objectsgraph_objectsFigure)r   r0   as_dictr/   gos        r   full_figure_for_developmentr8   +  s    6 }
 
 	
  
7	
 	
 	
 *U__S_88??HH
I
IC 1
))))))yy4y000    )r   r+   r   r8   )NNNNTr   )TF)osr-   pathlibr   plotlyplotly.io._utilsr   kaleido.scopes.plotlyr   r   r(   dirnameabspath__file__root_dirjoinpackage_dirplotlyjsmathjaxImportErrorr   r+   r8   __all__ r9   r   <module>rJ      si   				         8 8 8 8 8 8111111KMME wrwv??@@H',,x88KW\\+??EN}M 	    KEEE RXz z z z@ 

R# R# R# R#j31 31 31 31l N
M
Ms   BB+ +	B76B7