
    6DhL                         S SK r S SKJr  S SKrS SKJr  S SKJrJr  S SK	J
r
Jr  \" S5      rSrSr           SS	 jr            SS
 jrg)    N)Path)
get_module)validate_coerce_fig_to_dictplotly_cdn_url)_get_jconfigget_plotlyjsjsonzW<script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>z<script type="text/javascript">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}</script>c           
      r	   SSK Jn  [        X
5      nU=(       d    [        [        R
                  " 5       5      nU" UR                  S/ 5      5      nU" UR                  S0 5      5      nUR                  SS5      (       a  U" UR                  S/ 5      5      nOSn[        U5      nUR                  SS5        UR                  S0 5      nUR                  S0 5      R                  S	0 5      R                  S0 5      nUR                  S
UR                  S
U5      5      nUR                  SUR                  SU	5      5      n [        U5        [        U5      S-   n [        U5        [        U5      S-   nUR                  SS5      (       d  UR                  SS5      (       a   SR                  UR                  SS5      S9nO8UR                  SS5        UR                  SS5        UR                  SS5        SnSnU(       aI  [        U[        [         45      (       d  U/nU H%  nUSR                  UR#                  SU5      S9-  nM'     SnSnU(       aI  SR                  UUS9nU(       a2  U(       a  S[$        R'                  U5      -   nOSnSR                  UUS9n[$        R'                  U5      nSR                  UUUUUUUS9nUn[        U[        5      (       a  UR)                  5       nSnUS :X  a  S!R                  [*        [-        5       S"9nO}US#:X  a  S$R                  [*        S%9nOc[        U[        5      (       a+  UR/                  S&5      (       a  S'R                  [*        US(9nO#U(       a  S)R                  [*        [1        5       S*9nUn [        U[        5      (       a  UR)                  5       nS+n!US :X  a  U!R                  S,S-9[2        -   n"Ow[        U[        5      (       a-  UR/                  S&5      (       a  U!R                  U S-9[2        -   n"O5U(       d  Sn"O+[        S.R                  [5        U5      [7        U5      S/95      eS0R                  U"UUUUUUS19R9                  5       n#U(       a  S2R                  U#S39$ U#$ ! [        [        4 a     GNDf = f! [        [        4 a     GNAf = f)4a  
Convert a figure to an HTML string representation.

Parameters
----------
fig:
    Figure object or dict representing a figure
config: dict or None (default None)
    Plotly.js figure config options
auto_play: bool (default=True)
    Whether to automatically start the animation sequence on page load
    if the figure contains frames. Has no effect if the figure does not
    contain frames.
include_plotlyjs: bool or string (default True)
    Specifies how the plotly.js library is included/loaded in the output
    div string.

    If True, a script tag containing the plotly.js source code (~3MB)
    is included in the output.  HTML files generated with this option are
    fully self-contained and can be used offline.

    If 'cdn', a script tag that references the plotly.js CDN is included
    in the output. The url used is versioned to match the bundled plotly.js.
    HTML files generated with this option are about 3MB smaller than those
    generated with include_plotlyjs=True, but they require an active
    internet connection in order to load the plotly.js library.

    If 'directory', a script tag is included that references an external
    plotly.min.js bundle that is assumed to reside in the same
    directory as the HTML file.

    If a string that ends in '.js', a script tag is included that
    references the specified path. This approach can be used to point
    the resulting HTML file to an alternative CDN or local bundle.

    If False, no script tag referencing plotly.js is included. This is
    useful when the resulting div string will be placed inside an HTML
    document that already loads plotly.js. This option is not advised
    when full_html=True as it will result in a non-functional html file.
include_mathjax: bool or string (default False)
    Specifies how the MathJax.js library is included in the output html
    div string.  MathJax is required in order to display labels
    with LaTeX typesetting.

    If False, no script tag referencing MathJax.js will be included in the
    output.

    If 'cdn', a script tag that references a MathJax CDN location will be
    included in the output.  HTML div strings generated with this option
    will be able to display LaTeX typesetting as long as internet access
    is available.

    If a string that ends in '.js', a script tag is included that
    references the specified path. This approach can be used to point the
    resulting HTML div string to an alternative CDN.
post_script: str or list or None (default None)
    JavaScript snippet(s) to be included in the resulting div just after
    plot creation.  The string(s) may include '{plot_id}' placeholders
    that will then be replaced by the `id` of the div element that the
    plotly.js figure is associated with.  One application for this script
    is to install custom plotly.js event handlers.
full_html: bool (default True)
    If True, produce a string containing a complete HTML document
    starting with an <html> tag.  If False, produce a string containing
    a single <div> element.
animation_opts: dict or None (default None)
    dict of custom animation parameters to be passed to the function
    Plotly.animate in Plotly.js. See
    https://github.com/plotly/plotly.js/blob/master/src/plots/animation_attributes.js
    for available options. Has no effect if the figure does not contain
    frames, or auto_play is False.
default_width, default_height: number or str (default '100%')
    The default figure width/height to use if the provided figure does not
    specify its own layout.width/layout.height property.  May be
    specified in pixels as an integer (e.g. 500), or as a css width style
    string (e.g. '500px', '100%').
validate: bool (default True)
    True if the figure should be validated before being converted to
    JSON, False otherwise.
div_id: str (default None)
    If provided, this is the value of the id attribute of the div tag. If None, the
    id attribute is a UUID.

Returns
-------
str
    Representation of figure as an HTML div string
r   )to_json_plotlydatalayoutframesN
responsiveTtemplatewidthheightpxshowLinkFshowSendToCloudzG
                    window.PLOTLYENV.BASE_URL='{plotly_platform_url}';plotlyServerURLzhttps://plot.ly)plotly_platform_urllinkText zX.then(function(){{
                            {post_script}
                        }})z	{plot_id})post_scriptzn.then(function(){{
                            Plotly.addFrames('{id}', {frames});
                        }}))idr   z, zx.then(function(){{
                            Plotly.animate('{id}', null{animation_opts});
                        }}))r   animation_optsa0                  if (document.getElementById("{id}")) {{                    Plotly.newPlot(                        "{id}",                        {data},                        {layout},                        {config}                    ){then_addframes}{then_animate}{then_post_script}                }})r   r   r   configthen_addframesthen_animatethen_post_scriptcdnzR        {win_config}
        <script charset="utf-8" src="{cdn_url}"></script>    )
win_configcdn_url	directoryzV        {win_config}
        <script charset="utf-8" src="plotly.min.js"></script>    )r"   z.jszN        {win_config}
        <script charset="utf-8" src="{url}"></script>    )r"   urlzS        {win_config}
        <script type="text/javascript">{plotlyjs}</script>    )r"   plotlyjsz8    <script src="{url}?config=TeX-AMS-MML_SVG"></script>z?https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js)r%   zInvalid value of type {typ} received as the include_mathjax argument
    Received value: {val}

include_mathjax may be specified as False, 'cdn', or a string ending with '.js'
    )typvalaF  <div>        {mathjax_script}        {load_plotlyjs}            <div id="{id}" class="plotly-graph-div" style="height:{height}; width:{width};"></div>            <script type="text/javascript">                window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}                {script};            </script>        </div>)mathjax_scriptload_plotlyjsr   r   r   base_url_linescriptzM<html>
<head><meta charset="utf-8" /></head>
<body>
    {div}
</body>
</html>)div)plotly.io.jsonr   r   struuiduuid4getr   
setdefaultfloat
ValueError	TypeErrorformatpop
isinstancelisttuplereplace_jsondumpslower_window_plotly_configr   endswithr   _mathjax_configtypereprstrip)$figr   	auto_playinclude_plotlyjsinclude_mathjaxr   	full_htmlr   default_widthdefault_heightvalidatediv_idr   fig_dict	plotdividjdatajlayoutjframeslayout_dicttemplate_dict	div_width
div_heightr+   r    psr   r   animation_opts_argjconfigr,   include_plotlyjs_origr*   include_mathjax_origmathjax_templater)   plotly_html_divs$                                       A/var/www/html/env/lib/python3.13/site-packages/plotly/io/_html.pyto_htmlr`      s)   L . +39H +#djjl+I 8<<34EX\\(B78G||Hd## h!;< &!F lD) ,,x,KLL2.22:rBFFxQSTM):):7M)RSI=+<+<X~+VWJ*i 	NT)	,j _t+
 zz*e$$

3De(L(L
F &

+<>O P  
 	 	

$d+

:t$

:t$ +e}55&-KB !%vJJ{I>  &    NL%v  &  
 	 %)EKK,G%G"%'"%v-?  &    kk&!G f%!)   & -"C((+113 M5  	,n6F 	 	
 	 
[	( 	, 	 	
 	 
$c	*	*/?/H/H/O/O 	,2G 	 	
 	 
 	,|~ 	 	
 	 +/3'')//1< %##X $ 
  	 
OS	)	)o.F.Fu.M.M ##(<#=O 	 
 	)tO/D 	 		
 		

 &%##   eg% (  6  
	
 E 	"  	" s$   R R" RR"R65R6c                    [        U UUUUUUUU
UU	US9n[        U[        5      (       a  [        U5      nO[        U[        5      (       a  UnOSnUb  UR	                  US5        OUR                  U5        UbI  U(       aB  US:X  a<  UR                  S-  nUR                  5       (       d  UR	                  [        5       SS9  UbE  U(       a=  U(       a5  UR                  5       R                  5       n[        R                  " U5        gggg)aa  
Write a figure to an HTML file representation

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)
config: dict or None (default None)
    Plotly.js figure config options
auto_play: bool (default=True)
    Whether to automatically start the animation sequence on page load
    if the figure contains frames. Has no effect if the figure does not
    contain frames.
include_plotlyjs: bool or string (default True)
    Specifies how the plotly.js library is included/loaded in the output
    div string.

    If True, a script tag containing the plotly.js source code (~3MB)
    is included in the output.  HTML files generated with this option are
    fully self-contained and can be used offline.

    If 'cdn', a script tag that references the plotly.js CDN is included
    in the output. The url used is versioned to match the bundled plotly.js.
    HTML files generated with this option are about 3MB smaller than those
    generated with include_plotlyjs=True, but they require an active
    internet connection in order to load the plotly.js library.

    If 'directory', a script tag is included that references an external
    plotly.min.js bundle that is assumed to reside in the same
    directory as the HTML file.  If `file` is a string to a local file
    path and `full_html` is True, then the plotly.min.js bundle is copied
    into the directory of the resulting HTML file. If a file named
    plotly.min.js already exists in the output directory then this file
    is left unmodified and no copy is performed. HTML files generated
    with this option can be used offline, but they require a copy of
    the plotly.min.js bundle in the same directory. This option is
    useful when many figures will be saved as HTML files in the same
    directory because the plotly.js source code will be included only
    once per output directory, rather than once per output file.

    If a string that ends in '.js', a script tag is included that
    references the specified path. This approach can be used to point
    the resulting HTML file to an alternative CDN or local bundle.

    If False, no script tag referencing plotly.js is included. This is
    useful when the resulting div string will be placed inside an HTML
    document that already loads plotly.js.  This option is not advised
    when full_html=True as it will result in a non-functional html file.

include_mathjax: bool or string (default False)
    Specifies how the MathJax.js library is included in the output html
    div string.  MathJax is required in order to display labels
    with LaTeX typesetting.

    If False, no script tag referencing MathJax.js will be included in the
    output.

    If 'cdn', a script tag that references a MathJax CDN location will be
    included in the output.  HTML div strings generated with this option
    will be able to display LaTeX typesetting as long as internet access
    is available.

    If a string that ends in '.js', a script tag is included that
    references the specified path. This approach can be used to point the
    resulting HTML div string to an alternative CDN.
post_script: str or list or None (default None)
    JavaScript snippet(s) to be included in the resulting div just after
    plot creation.  The string(s) may include '{plot_id}' placeholders
    that will then be replaced by the `id` of the div element that the
    plotly.js figure is associated with.  One application for this script
    is to install custom plotly.js event handlers.
full_html: bool (default True)
    If True, produce a string containing a complete HTML document
    starting with an <html> tag.  If False, produce a string containing
    a single <div> element.
animation_opts: dict or None (default None)
    dict of custom animation parameters to be passed to the function
    Plotly.animate in Plotly.js. See
    https://github.com/plotly/plotly.js/blob/master/src/plots/animation_attributes.js
    for available options. Has no effect if the figure does not contain
    frames, or auto_play is False.
default_width, default_height: number or str (default '100%')
    The default figure width/height to use if the provided figure does not
    specify its own layout.width/layout.height property.  May be
    specified in pixels as an integer (e.g. 500), or as a css width style
    string (e.g. '500px', '100%').
validate: bool (default True)
    True if the figure should be validated before being converted to
    JSON, False otherwise.
auto_open: bool (default True)
    If True, open the saved file in a web browser after saving.
    This argument only applies if `full_html` is True.
div_id: str (default None)
    If provided, this is the value of the id attribute of the div tag. If None, the
    id attribute is a UUID.

Returns
-------
None
)r   rG   rH   rI   r   rJ   r   rK   rL   rM   rN   Nzutf-8r$   zplotly.min.js)encoding)r`   r9   r/   r   
write_textwriteparentexistsr   absoluteas_uri
webbrowseropen)rF   filer   rG   rH   rI   r   rJ   r   rM   rK   rL   	auto_openrN   html_strpathbundle_pathr%   s                     r_   
write_htmlrp   e  s    r )'%#%H  $Dz	D$		  '*

8 I*:k*IkkO3!!##""<>G"D I)mmo$$& +4I    )NTTFNTN100%rr   TN)NTTFNTNTrr   rr   FN)r0   pathlibr   ri   _plotly_utils.optional_importsr   plotly.io._utilsr   r   plotly.offline.offliner   r   r=   r@   rB   r`   rp    rq   r_   <module>rx      s       5 H =6
 
 I^
 erq   