
    	/g*i                        d dl mZ d dlZd dlZd dlmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZmZ dd	lmZmZ dd
lmZ ddlmZmZmZmZmZmZmZ ddlmZ  G d de      Z  G d de      Z! G d de      Z" ejF                  dg d      Z$ ejF                  dd      Z% edd      Z& G d dejN                        Z( G d de(      Z) G d d      Z* G d  d!e*      Z+ G d" d#e*      Z, G d$ d%e*      Z-d& Z.y)'    )
namedtupleN)
bothmethod   )Dataset)ElementLayout)AdjointLayout)CallbackErrorStore)	NdOverlayOverlay)	GridSpace)CrossFilterSetDerivedPipe	PlotResetSelectionExprSequence
SelectModeStream)
DynamicMapc                   6    e Zd Z ej                  ddd      Zy)_CmapNT)default
allow_Noneconstant)__name__
__module____qualname__param	Parametercmap     3lib/python3.12/site-packages/holoviews/selection.pyr   r      s    5??4D4HDr#   r   c                   6    e Zd Z ej                  ddd      Zy)_SelectionExprOverrideNTz=
            dim expression of the current selection override)r   r   doc)r   r   r   r   r    selection_exprr"   r#   r$   r&   r&      s    $U__TD G@ ANr#   r&   c                   T     e Zd Z ej                  d      Z fdZed        Z xZ	S )_SelectionExprLayersT)r   c                 .    t        |   ||gfddi| y )N	exclusiveT)super__init__)selfexpr_overridecross_filter_setparams	__class__s       r$   r.   z_SelectionExprLayers.__init__%   s)    ,-	
9=	
AG	
r#   c                 ^    |d   }|d   }|j                  dd       	dd|d   giS dd|d   giS )Nr   r   r(   exprsT)get)clsstream_values	constantsoverride_expr_valuescross_filter_set_valuess        r$   transform_functionz'_SelectionExprLayers.transform_function*   sZ    ,Q/"/"2##$4d;Gd$89I$JKLLd$;<L$MNOOr#   )
r   r   r   r   Listr5   r.   classmethodr<   __classcell__r3   s   @r$   r*   r*   "   s.    EJJ%E

 P Pr#   r*   Stylesg      ?colorsalphaRegionElement)region_elementSelectionStreamsz'style_stream exprs_stream cmap_streams c                        e Zd ZdZ ej
                  dd      Z ej
                  dd      Ze fd       Z	d Z
d	 Zd
 ZddZed        Zd Z xZS )_base_link_selectionsa  
    Baseclass for linked selection functions.

    Subclasses override the _build_selection_streams class method to construct
    a _SelectionStreams namedtuple instance that includes the required streams
    for implementing linked selections.

    Subclasses also override the _expr_stream_updated method. This allows
    subclasses to control whether new selections override prior selections or
    whether they are combined with prior selections
    Fz@
        Whether to link any streams on the input to the output.r   r'   Tz3
        Whether to highlight the selected regions.c                     t        |   di |}t        |j                        |_        t               |_        i |_        i |_        | j                  |      |_
        |S )N)moder"   )r-   instancer   cross_filter_mode_cross_filter_streamr&   _selection_override_selection_expr_streams_plot_reset_streams_build_selection_streams_selection_streamsself_or_clsr2   instr3   s      r$   rM   z_base_link_selections.instanceQ   s_    w)&) %38N8N$O!#9#; ')$#%  #."F"Ft"Lr#   c                     |j                   dk(  rd| _        y |j                   dk(  rd| _        y |j                   dk(  rd| _        y |j                   dk(  rd| _        y y )Nreplace	overwriteappendunion	intersectsubtractinverse)newselection_mode)r/   events     r$   _update_modez"_base_link_selections._update_mode`   sW    99	!"-DYY("")DYY+%"-DYY*$"+D %r#   c                    ddl m} t        || j                  | j                  | j
                        }|| j                  |<   | j                  j                  |       t        |      | j                  |<   |j                  fd}t        ||      s2t        |      }|j                  j                  | j                   d       | j                  |   j                  j                  |dg       y)	z
        Register an Element or DynamicMap that may be capable of generating
        selection expressions in response to user interaction events
        r   )Table)rL   include_region
index_cols)sourcec                 J    | r!|j                          |j                          y y N)clear_historyrb   	resettingstreams     r$   clear_stream_historyz=_base_link_selections._register.<locals>.clear_stream_history}   s    $$& r#   rL   rm   N)elementre   r   ra   show_regionsrg   rQ   rO   append_input_streamr   rR   history_stream
isinstancer   r   watchrc   )r/   hvobjre   selection_expr_seqro   mode_streams         r$   	_registerz_base_link_selections._registerj   s    
 	# 3++,,

 /A$$U+!!556HI*35*A  ' 4F3T3T 	
 %'$E2K##D$5$5v>  '--33 ;-	
r#   c                      | j                   j                  di | t        j                  t        j                  vrt        dt        j                  d      | j                  |j                               S )NzDCannot perform link_selections operation since the selected backend zh is not loaded. Load the plotting extension with hv.extension or import the plotting backend explicitly.r"   )r   updater   current_backend	renderersRuntimeError_selection_transformclone)r/   rv   kwargss      r$   __call__z_base_link_selections.__call__   sm    

#F#  7  ==B=R=R<U V5 5 6 6 ((77r#   c                    ddl m} t        t              rj                  }t        |j                        dkD  r@t        |j                  D cg c]  }| j                  |       c}      j                         S  |       t        j                  t              r| j                         t        j                  t        j                      j                     }|j#                        j%                  | j&                  || j(                  j+                  d      | j,                        S t        j                  t              r\t/        j                  dd      dk(  rBt        |j                  D cg c]  }| j                  ||       c}      j                         S t/        j                  dd      dk(  r;|j                  d	   }| j                  ||      j1                  |j2                        S | j4                  j7                  d
       S t        t              rt        j                  t        j                      t                 }t/        |dd      j9                  | j:                        }| j                  |       |j#                  |      j%                  | j&                  ||| j(                  j+                  |d      | j,                        S S t        t<        t        t>        t@        tB        f      rtE        jG                         D 	
cg c]  \  }	}
|	| j                  |
|      f c}
}	      t        t>              rCfd}t        |      }tI        jK                               |j                  j                  dd |S j9                        }tM        |d      r|j                         }|S S c c}w c c}w c c}
}	w )zs
        Transform an input HoloViews object into a dynamic object with linked
        selections enabled.
        r   )initialize_dynamicN)cachenamedynamic_mul
operationsdynamic_operationr   zQlinked selection: Encountered DynamicMap that we don't know how to recurse into:
selection_displaylinkc                  (   g }j                         D ]P  \  }}t        |d         D ]:  \  }}|t        |      k(  r|j                  g        ||   j                  ||f       < R t	        |D cg c]  }	j                  |       c}      S c c}w )Nr"   )items	enumeratelenr[   r   r   )
argsr   r`   kvielndatarv   s
           r$   composez;_base_link_selections._selection_transform.<locals>.compose   s    C $

1%.qu%5EAr CH} #

2FMM1b'2 &6 !-
 #C#@CqEKKNC#@AA#@s   0Bcollate)'plotting.utilr   rt   r   callbackr   inputsr   r   r   
issubclasstyper   ry   r   registryr|   r   build_selectionrT   rQ   r6   _cachegetattrapply	operationr   warningr   link_inputsr   r   r   r	   dictr   listvalueshasattr)r/   rv   r   r   r   r   chartobjrp   r   r   r   	new_hvobjr   s    `           @r$   r   z*_base_link_selections._selection_transform   sg   
 	6eZ(~~H8??#a'<DOO <KbD--b1O  79 u%%**g.u%u'<'<=ejjI..u5EE++UJ0044UDA F   UZZ1%..&$7=H&oo - --bZ-H-   79 6:MMooa(000LRR&&( ( 

""--2I7 w'NN5#8#89$u+FEu148D++4+;+;+<w'..w7GG++Wj0044WdC4;; H   LI}UV-2[[]<-:TQ T66q*EF-:< =D%+B 'w/	/3DKKM/B	""))!,
  "KK-	9i0 ) 1 1 3I L{  6<s   O9O&O
c                     t               )zg
        Subclasses should override this method to return a _SelectionStreams
        instance
        NotImplementedError)r7   rW   s     r$   rS   z._base_link_selections._build_selection_streams   s     "##r#   c                     t               )a  
        Called when one of the registered HoloViews objects produces a new
        selection expression.  Subclasses should override this method, and
        they should use the input expression to update the `exprs_stream`
        property of the _SelectionStreams instance that was produced by
        the _build_selection_streams.

        Subclasses have the flexibility to control whether the new selection
        express overrides previous selections, or whether it is combined with
        previous selections.
        r   )r/   rv   r(   bboxrF   r   s         r$   _expr_stream_updatedz*_base_link_selections._expr_stream_updated   s     "##r#   )r"   )r   r   r   __doc__r   Booleanr   rq   r   rM   rc   ry   r   r   r>   rS   r   r?   r@   s   @r$   rI   rI   >   s    
  %-- 4C DK !5== 46 7L  ,
@8FP $ $$r#   rI   c                       e Zd ZdZ ej
                  ddgdd      Z ej                  dd      Z ej                  dd	      Z
 ej                  dd
d      Z ej
                  g ddd      Z ej                  dd      Z ej                  dd      Ze fd       Z ej&                  dd
      d        Zd ZddZed        Zed        Zed        Zed        Z xZS )link_selectionsz
    Operation which automatically links selections between elements
    in the supplied HoloViews object. Can be used a single time or
    be used as an instance to apply the linked selections across
    multiple objects.
    rZ   r]   zP
        Determines how to combine selections across different
        elements.)objectsr   r'   Na7  
        If provided, selection switches to index mode where all queries
        are expressed solely in terms of discrete values along the
        index_cols.  All Elements given to link_selections must define the index_cols, either as explicit dimensions or by sharing an underlying Dataset that defines them.rJ   zi
        dim expression of the current selection or None to indicate
        that everything is selected.Tz[
        Color of selected data, or None to use the original color of
        each element.)r   r   r'   )rZ   r]   r\   r_   zU
        Determines how to combine successive selections on the same
        element.g?z"
        Alpha of unselected data.z"
        Color of unselected data.c                     t        |   di |}i |_        i |_        d|_        g |_        i |_        | j                  |       |S )NTr"   )r-   rM   _obj_selections_obj_regions_reset_regions	_datasetsr   _install_param_callbacksrU   s      r$   rM   zlink_selections.instance  sR    w)&)  "" ,,T2r#   r(   )ru   c                    | j                   }| j                  D ]  \  }}}|j                  }| j                  j	                  |i       x| j                  |<   }||v r#||   }|j                  |j                        c S |j                          t        j                  ||| j                        }|||<   |j                  |r|j                  n|        y )Nr   )
r(   r   _plot_idr   r6   rb   r   clearSelectionDisplay_select)	r/   sel_exprpipedsrawrefds_cacher   sel_dss	            r$   _update_pipeszlink_selections._update_pipes-  s    &&!^^MD"c++C*.++//#r*BBDKKx8#)zztyyz11 %--b(DKKHF!'HXJJ3FKKFJ; ,r#   c                     d}t        |t              sd}t        |      }t        |j                        }| j                  j                  |||f       |j                  j                  S )ao  
        Returns a parameter which reflects the current selection
        when applied to the supplied data, making it easy to create
        a callback which depends on the current selection.

        Args:
            data: A Dataset type or data which can be cast to a Dataset

        Returns:
            A parameter which reflects the current selection
        FTr   )rt   r   r   r   r   r[   r   )r/   r   r   r   s       r$   selection_paramzlink_selections.selection_param<  sV     $(C4=D#tT3/0zzr#   c                     || j                   n|}||S t        |t              }|st        |      }||j                  |         }|r|S |j                  S )aG  
        Filters the provided data based on the current state of the
        current selection expression.

        Args:
            data: A Dataset type or data which can be cast to a Dataset
            selection_expr: Optionally provide your own selection expression

        Returns:
            The filtered data
        )r(   rt   r   r   r   )r/   r   r(   expr
is_datasetfiltereds         r$   filterzlink_selections.filterP  s\     '5&<t"".<Kg.
4=D

4()%x88==8r#   c                    fd}j                   j                  |dg       fd}j                   j                  |dg       fd}j                   j                  |dg       fd}j                   j                  |dg       fd	}j                  j                   j                  |dg       j                  j	                         D ]:  }|fd
}t        d|       |j                  j                   j                  |dg       < y )Nc                      j                   j                         D ]#  }|j                          j                  |_        % y rj   )rQ   r   resetra   rL   _rn   rW   s     r$   update_selection_modezGlink_selections._install_param_callbacks.<locals>.update_selection_modeg  s3    66==?"11 @r#   ra   c                  p    j                   j                          j                  j                   _        y rj   )rO   r   rN   rL   )r   rW   s    r$   update_cross_filter_modezJlink_selections._install_param_callbacks.<locals>.update_cross_filter_modeq  s)    %%++--1-C-CD%%*r#   rN   c                      j                   j                         D ]#  }j                  |_        |j	                          % y rj   )rQ   r   rq   rf   rb   r   s     r$   update_show_regionzDlink_selections._install_param_callbacks.<locals>.update_show_regiony  s4    66==?(,(9(9% @r#   rq   c                      j                   }j                  j                   }t        |      t        |      k7  r0j                  rd_        j                  j                  |       y y )NF)r(   )r(   rO   reprrq   rP   rb   )r   new_selection_exprcurrent_selection_exprrW   s      r$   update_selection_exprzGlink_selections._install_param_callbacks.<locals>.update_selection_expr  sd    !%!4!4%)%>%>%M%M"&'40F+GG$$(-D%((..>P.Q	 Hr#   r(   c                      j                   j                  }t        j                        t        |      k7  r|_        y y rj   )rO   r(   r   )r   r   rW   s     r$   selection_expr_changedzHlink_selections._install_param_callbacks.<locals>.selection_expr_changed  s<    !%!:!:!I!ID''(D1C,DD&8# Er#   c                 *    | r|j                          y y rj   )rk   rl   s     r$   ro   zFlink_selections._install_param_callbacks.<locals>.clear_stream_history  s    ((* r#   zregistering reset for rm   )r   ru   rO   rQ   r   printplot_reset_stream)	rV   rW   r   r   r   r   r   rn   ro   s	    `       r$   r   z(link_selections._install_param_callbackse  s   	2 	

!$4#5	
	D 	

$':&;	
	
 	

 0	
	R 	

!$4#5	
	9
 	!!''--"%5$6	

 2299;F7= + *F3$$**00${m <r#   c                 `   t        j                  j                  gj                        t	        j
                        t	        j                        gfd}j                  j                  |g d       t        j                  j                        }t        |      S )NrB   r!   c                      j                   j                  g}j                  |j                         d   j                  j                         d    d   j                  j
                         y y )NrB   r   r   r   )unselected_colorselected_colorrb   unselected_alphaunselected_cmapselected_cmap)r   rC   cmap_streamsrW   style_streams     r$   update_colorsz?link_selections._build_selection_streams.<locals>.update_colors  sw    ++T-@-@AFfD4I4IJO!!t';';!<A*Q%%4+=+=%> +r#   )r   r   r   )r   exprs_streamr   )_Stylesr   r   r   r   r   r   r   ru   r*   rP   rO   _SelectionStreams)r7   rW   r   r   r   r   s    `  @@r$   rS   z(link_selections._build_selection_streams  s     ))4+>+>?''
 t++,t))*

	? 	

'ab ,$$d&?&?
 !%%%
 	
r#   c                 F    | j                   yt        | j                         S )z=
        The datashader colormap for unselected data
        N)r   _color_to_cmapr/   s    r$   r   zlink_selections.unselected_cmap  s$    
   (d3344r#   c                 H    | j                   dS t        | j                         S )z;
        The datashader colormap for selected data
        N)r   r   r   s    r$   r   zlink_selections.selected_cmap  s%    
 **2t[tGZGZ8[[r#   rj   )r   r   r   r   r   SelectorrN   r=   rg   r    r(   Colorr   ra   	Magnituder   r   r   rM   dependsr   r   r   r   r>   rS   propertyr   r   r?   r@   s   @r$   r   r      s`    'k*K F
 D /o pJ
 %U__T 8( )N !U[[$ E N $U^^> ZN
 'us 9% & #u{{4 6% &    U]]#40< 1<(9* : :z 
 
B 5 5 \ \r#   r   c                   0    e Zd ZdZd ZddZedd       Zy)r   z
    Base class for selection display classes.  Selection display classes are
    responsible for transforming an element (or DynamicMap that produces an
    element) into a HoloViews object that represents the current selection
    state.
    c                     | S rj   r"   )r/   rp   s     r$   r   zSelectionDisplay.__call__  s    r#   Nc                     |i }t               rj   r   r/   selection_streamsrv   r   region_streamr   s         r$   r   z SelectionDisplay.build_selection  s    =E!##r#   c                 *   |i }ddl m}m} ddlm} t        ||      r| j                  }d }|j                  |v r*||j                     }||v r||   }n"|j                          ni x}||j                  <   	 |j                  j                  rD||j                  |ddd      }|j                  |j                  j                  ||             }	n|j                  j                  r'||j                  |ddd      }|j                  |   }	nt        | ||f      rYt!        |j                  d      rC||j                  |dd      }|j                  |j                  j                  ||             }	n)||j                  |ddd	      }|j#                  |
      }	|||<   |	S | }	|	S # t$        $ rC}
t'        |
      j)                  dd      j)                  dd      }t+        d| d| d      |
d }
~
wt,        $ r}
t+        d|
 d      |
d }
~
ww xY w)Nr   )CurveSpread)dimTF)expandedflatstrictmask)
keep_indexr  )computer  r  )selection_mask" .zRlinked_selection aborted because it could not display selection for all elements: z on 'z'.)rp   r  r  util.transformr	  rt   datasetr   r   	interfacegriddedr   r   r  multiilocr   selectKeyErrorstrrY   r
   	Exception)rp   r(   r   r  r  r	  r  r  r   	selectione	key_errors               r$   r   zSelectionDisplay._select  sP   =E*'nc*ooGD5( !1!12!X-#N3DNN$5775!1!12X$$,,|-33GdQV_d3e 'g.?.?.D.DWte.T UI&&,,|-33GeRW`e3f 'T 2I%9ggFWFWY_>`|-33GUZ3[ 'g.?.?.D.DWte.T UI|-33GUW[di3j 'd CI (,H^$   I  qFNN33;;CD	# %KKT+UZ[bZeeg%i jopq X# %KKL#Q%P QVWXXs%   8D'F* *	H3>G11H=HHNNrj   )r   r   r   r   r   r   staticmethodr   r"   r#   r$   r   r     s%    $
 + +r#   r   c                       e Zd ZdZddZy)NoOpSelectionDisplayz
    Selection display class that returns input element unchanged. For use with
    elements that don't support displaying selections.
    Nc                     |S rj   r"   r  s         r$   r   z$NoOpSelectionDisplay.build_selection  s    r#   r!  )r   r   r   r   r   r"   r#   r$   r$  r$    s    
r#   r$  c                   P    e Zd ZdZddZd ZddZed        Zd Z	d Z
dd	Zd
 Zy)OverlaySelectionDisplayz
    Selection display base class that represents selections by overlaying
    colored subsets on top of the original element in an Overlay container.
    c                 l    t        |t        t        f      s	|g| _        n|| _        || _        || _        y rj   )rt   r   tuplecolor_propsis_cmapsupports_region)r/   
color_propr+  r,  s       r$   r.   z OverlaySelectionDisplay.__init__&  s1    *tUm4 *|D)D.r#   c                 `    | j                   D ci c]  }|| j                  r|gn| c}S c c}w rj   )r*  r+  )r/   colorr-  s      r$   _get_color_kwargz(OverlaySelectionDisplay._get_color_kwarg.  s<    "&"2"24"2J t||UG>"24 	4 4s   +Nc                     ddl m} t        |j                  j                        }|s
t               S g }t        |      D ]k  }	|j                  g}
|	dk(  r|j                  d      n|}|j                  |	   }|j                   j                  |g|
|	|d      }|j                  |       m t        |      D ]H  }	||	   }|j                  |	   }|j                  |g}
|j                   j                  |	|
d      }|||	<   J | j                  r fd}||j                  g}
|j                  d      j                  ||
d	      }t        |t               r|j"                  n
t#        |      }t%        |d
d       dk(  st'        ||      r|j)                  d|       n|j                  |       t        |      j+                         S )Nr   )	HistogramFr   T)streamslayer_numberr   per_element)r4  r3  r5  c                 V    |d   }|| j                         }j                  ||      S )Nr   )_empty_region_style_region_element)rp   rF   rC   r   r   r/   s        r$   update_regionz>OverlaySelectionDisplay.build_selection.<locals>.update_regionP  s5    #)!9 !)%,%:%:%<N11.BRSSr#   )link_dataset_selection_dims)rp   r2  r   r   rC   r   ranger   r   r   r   _build_layer_callbackr[   _apply_style_callbackr,  rt   r   r   r   r   insertr   )r/   r  rv   r   r  r   r2  
num_layerslayersr4  r3  r   cmap_streamlayerr9  regioneltypes   `                r$   r   z'OverlaySelectionDisplay.build_selection2  s   &*77>>?
9!*-L(556G-9Q->%++5+)EC+88FKII**[4K74K)D  E MM%  . "*-L<(E+88FK(55{CGKK**T   E $)F<  . $)=)=T %&7&D&DEG[[e[,22='X]2^F#-eZ#@UZZd5kFv0$71<
6S\@]a(f%v&&((r#   c                     g }|j                   D ]1  }t        |d      r|j                  |      }|j                  |       3 |j                  |      S )Nr!   r   r   )r   r   rM   r[   )r7   pipeliner!   r   ops        r$   _inject_cmap_in_pipelinez0OverlaySelectionDisplay._inject_cmap_in_pipeline`  sU    
%%Br6"[[d[+b! &   J 77r#   c                     | j                  |||   |      }|j                  }|| j                  ||      }||u r ||j                        S  ||      S rj   )r   rG  rI  r  )	r/   rp   r5   r4  r!   r   r   r  rG  s	            r$   r=  z-OverlaySelectionDisplay._build_layer_callbacki  s^    LL%*=uE	##44XtDHiGOO,,I&&r#   c                 j    i }|dk(  rd|d<   nd}|||d<   |r||   nd } | j                   |||fi |S )Nr   Fcolorbarr   r!   )_build_element_layer)	r/   rp   r4  rC   r!   rD   r   optsr/  s	            r$   r>  z-OverlaySelectionDisplay._apply_style_callbacks  sW    1$DEDL(.|$D(t((%G$GGr#   c                     t               rj   r   )r/   rp   layer_colorlayer_alphar(   s        r$   rM  z,OverlaySelectionDisplay._build_element_layer~      !##r#   c                     t               rj   r   )r/   rF   r   s      r$   r8  z-OverlaySelectionDisplay._style_region_element  rR  r#   )r/  FTr!  )T)r   r   r   r   r.   r0  r   r>   rI  r=  r>  rM  r8  r"   r#   r$   r'  r'     s@    
/4,)\ 8 8'	H$$r#   r'  c                        e Zd ZdZddZddZy)ColorListSelectionDisplayzd
    Selection display class for elements that support coloring by a
    vectorized color list.
    Nc                 2    |g| _         |g| _        || _        y rj   )r*  alpha_propsbackend)r/   r-  
alpha_proprX  s       r$   r.   z"ColorListSelectionDisplay.__init__  s    &<&<r#   c                      |i } fd}|j                   |j                  g}|j                  ||d|      }|D ]
  } ||      } |S )Nc                 6   ddl m} | j                  }|dd  }|d   }|xs d} ||dd      d   }	|dd  D 
cg c]  }
|
xs |	
 }}
t        |      }t	        j
                  |g|      }t	        j                  |d	      }t        t        dt        |            |      D ]!  \  }}|s||d d  |||j                  |      <   # ||   }j                  D ci c]  }|| }} | j                  |      j                  dj                  d
d|S c c}
w c c}w )Nr   linear_gradientr   z#e6e9ec#000000      int8)dtypeT)rX  r   r"   )r   r]  r  r   nparrayzeroszipr<  r   r*  rG  rN  rX  )r   rC   rD   r5   r   r]  r   selection_exprsr   
backup_clrcselected_colorsr   clrs
color_indsr   r   r-  
color_optsr/   s                      r$   _build_selectionzCColorListSelectionDisplay.build_selection.<locals>._build_selection  s6   6B#ABiO%ay  0<9()99aHKJ8>qr
C
1qJ
OCBA88-@@AD!62JuQD	2OD4$%JqM12Jtzz"~.	 E *%F?C?O?OP?O*f,?OJP'2;;r?''WDWJWW D Qs   D
DT)r3  r5  r   )r   r   r   )	r/   r  rv   r   r  r   rn  sel_streamsrH  s	   `        r$   r   z)ColorListSelectionDisplay.build_selection  s^    =E	X2 )557H7U7UV,kt[`aBuIE  r#   )r/  rD   Nr!  )r   r   r   r   r.   r   r"   r#   r$   rU  rU    s    

"r#   rU  c                 V    ddl m}  |d| d      d   } || dd      d   } |||d      S )z<
    Create a light to dark cmap list from a base color
    r   r\  z#ffffffr_  r`  r^  @   )r   r]  )r/  r]  start_color	end_colors       r$   r   r     s>     /!)UA6q9K  y!4Q7I;	266r#   )/collectionsr   numpyrc  r   param.parameterizedr   	core.datar   core.elementr   r   core.layoutr	   core.optionsr
   r   core.overlayr   r   core.spacesr   r3  r   r   r   r   r   r   r   utilr   r   r&   r*   definer   _RegionElementr   ParameterizedFunctionrI   r   r   r$  r'  rU  r   r"   r#   r$   <module>r     s    "   *  ) & . , "   IF IAV A
P7 P& &--2
6tD - 
v$E77 v$r\\+ \\~< <@+ b$. b$J- 0 -`
7r#   