Ë
    {�h>!  ã                   ó¦   — d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZ d„ Zd„ Zd„ Zd„ Zd„ Zd	„ Zd
„ Z	 	 	 	 dd„Zdd„Zy)é    )ÚSequence)Ú
exceptions)ÚDEFAULT_PLOTLY_COLORSÚPLOTLY_SCALESÚcolor_parserÚcolorscale_to_colorsÚcolorscale_to_scaleÚconvert_to_RGB_255Úfind_intermediate_colorÚ
hex_to_rgbÚ	label_rgbÚn_colorsÚunconvert_from_RGB_255Úunlabel_rgbÚvalidate_colorsÚvalidate_colors_dictÚvalidate_colorscaleÚvalidate_scale_valuesc                 óH   — t        | t        «      xr t        | t        «       S ©N)Ú
isinstancer   Ústr)Úobjs    úY/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/plotly/figure_factory/utils.pyÚis_sequencer      s   € Ü�cœ8Ó$ÒA¬Z¸¼SÓ-AÐ)AÐAó    c                 óú   ‡— ddl mŠ t        | d   ‰«      r*t        ˆfd„| D «       «      st	        j
                  d«      ‚yt        | d   t        «      r(t        d„ | D «       «      st	        j
                  d«      ‚yy)zŸ
    Validates if a list contains all numbers or all strings

    :raises: (PlotlyError) If there are any two items in the list whose
        types differ
    r   ©ÚNumberc              3   ó6   •K  — | ]  }t        |‰«      –— Œ y ­wr   ©r   ©Ú.0Úitemr   s     €r   ú	<genexpr>z!validate_index.<locals>.<genexpr>&   s   øè ø€ ÒC°”:˜d F×+ÑCùó   ƒz^Error in indexing column. Make sure all entries of each column are all numbers or all strings.c              3   ó<   K  — | ]  }t        |t        «      –— Œ y ­wr   ©r   r   ©r#   r$   s     r   r%   z!validate_index.<locals>.<genexpr>/   s   è ø€ Ò@¨T”:˜d¤C×(Ñ@ùó   ‚N©Únumbersr   r   Úallr   ÚPlotlyErrorr   )Ú
index_valsr   s    @r   Úvalidate_indexr0      sƒ   ø€ õ ä�*˜Q‘- Ô(ÜÓC¸
ÔCÔCÜ×(Ñ(ðóð ð Dô 
�J˜q‘M¤3Ô	'ÜÑ@°ZÔ@Ô@Ü×(Ñ(ðóð ð Að 
(r   c                 ó  ‡— ddl mŠ | D ]v  }t        |d   ‰«      r*t        ˆfd„|D «       «      rŒ't	        j
                  d«      ‚t        |d   t        «      sŒPt        d„ |D «       «      rŒct	        j
                  d«      ‚ y)z¡
    Validates all strings or numbers in each dataframe column

    :raises: (PlotlyError) If there are any two items in any list whose
        types differ
    r   r   c              3   ó6   •K  — | ]  }t        |‰«      –— Œ y ­wr   r!   r"   s     €r   r%   z%validate_dataframe.<locals>.<genexpr>C   s   øè ø€ ÒC°D”z $¨×/ÑCùr&   zWError in dataframe. Make sure all entries of each column are either numbers or strings.c              3   ó<   K  — | ]  }t        |t        «      –— Œ y ­wr   r(   r)   s     r   r%   z%validate_dataframe.<locals>.<genexpr>K   s   è ø€ Ò@°”z $¬×,Ñ@ùr*   Nr+   )ÚarrayÚvectorr   s     @r   Úvalidate_dataframer6   8   s�   ø€ õ àò ˆÜ�f˜Q‘i Ô(ÜÓC¸FÔCÕCÜ ×,Ñ,ð*óð ô ˜˜q™	¤3Õ'ÜÑ@¸Ô@Õ@Ü ×,Ñ,ð*óð ñr   c                  ót   ‡— t        | d   «      Št        ˆfd„| D «       «      rt        j                  d«      ‚y)z‹
    Validates that data lists or ndarrays are the same length.

    :raises: (PlotlyError) If any data lists are not the same length.
    r   c              3   ó:   •K  — | ]  }t        |«      ‰k7  –— Œ y ­wr   )Úlen)r#   ÚlstÚlengths     €r   r%   z(validate_equal_length.<locals>.<genexpr>[   s   øè ø€ Ò
. #Œ3ˆs‹8�vÕÑ
.ùs   ƒz<Oops! Your data lists or ndarrays should be the same length.N)r9   Úanyr   r.   )Úargsr;   s    @r   Úvalidate_equal_lengthr>   T   s;   ø€ ô ��a‘‹\€FÜ
Ó
.¨Ô
.Ô.Ü×$Ñ$ØMó
ð 	
ð /r   c                  óÚ   — | j                  «       D ]&  \  }}	 |dk  rt        dj                  ||«      «      ‚Œ( y# t        $ r& t	        j
                  dj                  ||«      «      ‚w xY w)z¶
    Validates that all values given in key/val pairs are positive.

    Accepts kwargs to improve Exception messages.

    :raises: (PlotlyError) If any value is < 0 or raises.
    r   z{} must be > 0, got {}z{} must be a number, got {}N)ÚitemsÚ
ValueErrorÚformatÚ	TypeErrorr   r.   )ÚkwargsÚkeyÚvals      r   Úvalidate_positive_scalarsrG   a   s}   € ð —L‘L“Nò Y‰ˆˆSð	YØ�aŠxÜ Ð!9×!@Ñ!@ÀÀcÓ!JÓKÐKð ñYøô ò 	YÜ×(Ñ(Ð)F×)MÑ)MÈcÐSVÓ)WÓXÐXð	Yús	   ˜ ;»/A*c                 ó†   — 	 | D ��cg c]  }|D ]  }|‘Œ Œ c}}S c c}}w # t         $ r t        j                  d«      ‚w xY w)z»
    Uses list comprehension to flatten array

    :param (array): An iterable to flatten
    :raises (PlotlyError): If iterable is not nested.
    :rtype (list): The flattened list.
    z\Your data array could not be flattened! Make sure your data is entered as lists or ndarrays!)rC   r   r.   )r4   Úsublistr$   s      r   ÚflattenrJ   q   sN   € ð
Ø$)×>˜°gÒ>¨d’Ð>�Ó>Ð>ùÓ>øÜò 
Ü×$Ñ$ð,ó
ð 	
ð
ús   ‚! ‡—! ›! ¡A c                 ór  — t        | «      }t        | t        «      s%t        | t        «      st	        j
                  d«      ‚| D ]'  }t        |t        «      sŒt	        j
                  d«      ‚ t        |dz
  «      D ]%  }| |   | |dz      k\  sŒt	        j
                  d«      ‚ g }|j                  t        d«      | d   g«       t        |dz
  «      D ]@  }g }|j                  | |   «       |j                  | |dz      «       |j                  |«       ŒB |j                  | |dz
     t        d«      g«       |S )a  
    Returns a list of intervals for categorical colormaps

    Accepts a list or tuple of sequentially increasing numbers and returns
    a list representation of the mathematical intervals with these numbers
    as endpoints. For example, [1, 6] returns [[-inf, 1], [1, 6], [6, inf]]

    :raises: (PlotlyError) If input is not a list or tuple
    :raises: (PlotlyError) If the input contains a string
    :raises: (PlotlyError) If any number does not increase after the
        previous one in the sequence
    zZThe intervals_endpts argument must be a list or tuple of a sequence of increasing numbers.é   z-infr   Úinf)
r9   r   ÚtupleÚlistr   r.   r   ÚrangeÚappendÚfloat)Úendptsr;   r$   ÚkÚ	intervalsÚintervals         r   Úendpts_to_intervalsrW   ƒ   sJ  € ô �‹[€Fä�v¤Ô'¬:°f¼tÔ+EÜ×$Ñ$ð%ó
ð 	
ð ò ˆÜ�dœCÕ Ü×(Ñ(ðóð ðô �6˜A‘:Óò ˆØ�!‰9˜˜q 1™u™Ó%Ü×(Ñ(ðóð ðð ˆ	à×Ñœ% ›-¨°©Ð3Ô4Ü�v ‘zÓ"ò 	'ˆAØˆHØ�O‰O˜F 1™IÔ&Ø�O‰O˜F 1 q¡5™MÔ*Ø×Ñ˜XÕ&ð		'ð 	×Ñ˜& ¨!¡Ñ,¬e°E«lÐ;Ô<ØÐr   c                 ób  — d|dz
  |z  z
  |z  }|s:d}	d}
|dk(  r|dz
  ||z   z  d|z  z   }d}d}n_|dk(  rZ|dz
  ||z   z  d|z  z   }d}d	}nD|dk(  rd}	d
}
|dz
  ||z   z  d|z  z   }d}d}n%|dk(  r d}
|dz
  ||z   z  d|z  z   }|rd}d}	nd}d}	d}t        	
ddd| t        d|¬«      ¬«
      }|S )a#  
    Returns annotation dict for label of n labels of a 1xn or nx1 subplot.

    :param (str) text: the text for a label.
    :param (int) lane: the label number for text. From 1 to n inclusive.
    :param (int) num_of_lanes: the number 'n' of rows or columns in subplot.
    :param (float) subplot_spacing: the value for the horizontal_spacing and
        vertical_spacing params in your plotly.tools.make_subplots() call.
    :param (str) row_col: choose whether labels are placed along rows or
        columns.
    :param (bool) flipped: flips text by 90 degrees. Text is printed
        horizontally if set to True and row_col='row', or if False and
        row_col='col'.
    :param (bool) right_side: only applicable if row_col is set to 'row'.
    :param (str) text_color: color of the text.
    rL   ÚcenterÚmiddleÚcolg      à?g{®Gázð?r   ÚrowéZ   Úbottomg      ð?i  Úleftg{®Gáz„¿ÚrightFÚpaperé   )ÚsizeÚcolor)
Ú	textangleÚxanchorÚyanchorÚxÚyÚ	showarrowÚxrefÚyrefÚtextÚfont)Údict)rm   ÚlaneÚnum_of_lanesÚsubplot_spacingÚrow_colÚflippedÚ
right_sideÚ
text_colorÚlrf   rg   rh   ri   re   Úannotation_dicts                  r   Úannotation_dict_for_labelry   ¸   s:  € ð4 
ˆl˜QÑ /Ñ1Ñ	1°lÑC€AÙØˆØˆØ�eÒØ˜‘˜a /Ñ1Ñ2°S¸1±WÑ<ˆAØˆAØ‰IØ˜ÒØ˜‘˜a /Ñ1Ñ2°S¸1±WÑ<ˆAØˆAØ‰Ià�eÒØˆGØˆGØ˜‘˜a /Ñ1Ñ2°S¸1±WÑ<ˆAØˆAØ‰IØ˜ÒØˆGØ˜‘˜a /Ñ1Ñ2°S¸1±WÑ<ˆAÙØ�Ø ‘à�Ø!�ØˆIäØØØØ
Ø
ØØØØÜ�r Ô,ô€Oð Ðr   c                 ó¦   — t        | «      dk  rt        j                  d«      ‚t        | «      dz
  dz  dz   |z   dz   |dz  z   } |j                  | Ž S )z´
    Returns an English listing of objects seperated by commas ','

    For example, ['foo', 'bar', 'baz'] becomes 'foo, bar and baz'
    if the conjunction 'and' is selected.
    é   z1Your list or tuple must contain at least 2 items.z{}, z{} z {}ú.)r9   r   r.   rB   )ÚiterableÚconjÚperiodÚtemplates       r   Úlist_of_optionsr�   ÿ   sd   € ô ˆ8ƒ}�qÒÜ×$Ñ$Ø?ó
ð 	
ô �H“ Ñ! VÑ+¨eÑ3°dÑ:¸UÑBÀVÈcÁ\ÑQ€HØˆ8�?‰?˜HÐ%Ð%r   N)r[   TTz#0f0f0f)ÚandT)Úcollections.abcr   Úplotlyr   Úplotly.colorsr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r0   r6   r>   rG   rJ   rW   ry   r�   © r   r   ú<module>r‡      sd   ðÝ $å ÷÷ ÷ ÷ ó ò(Bòò8ò8

òYò 
ò$2ðt ØØØóDôN&r   