
    -PhG                     :   d Z ddlmZ ddlmZ 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 ddlmZ dd	lmZmZ d
eddfdZ G d dej        ej                  Z G d dej        ej                  Zd Zd Zd Zd Z G d de          Z G d de          Z dS )z7Originally Adapted from sphinxcontrib.details.directive    )nodes)
directives)Sphinx)SphinxPostTransform)SEMANTIC_COLORSSdDirectivecreate_componentis_componentmake_choicemargin_option   )findall)get_octiconlist_octiconsappreturnNc                    |                      t          t          t          f           |                      t          t
          t          f           |                     dt                     | 	                    t                     d S )Nhtmldropdown)add_nodedropdown_mainvisit_dropdown_maindepart_dropdown_maindropdown_titlevisit_dropdown_titledepart_dropdown_titleadd_directiveDropdownDirectiveadd_post_transformDropdownHtmlTransform)r   s    V/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx_design/dropdown.pysetup_dropdownr#      sn    LL&9;O%PLQQQLL';=R&SLTTTj"3444011111    c                       e Zd ZdS )r   N__name__
__module____qualname__ r$   r"   r   r              Dr$   r   c                       e Zd ZdS )r   Nr&   r*   r$   r"   r   r       r+   r$   r   c                     |                     d          r2| j                            |                     |dd                     d S | j                            |                     |d                     d S )Nopeneddetailsopen)r0   )getbodyappendstarttagselfnodes     r"   r   r   $   sn    xx 9	tYVDDEEEEE	tY7788888r$   c                 :    | j                             d           d S )Nz
</details>r2   r3   r5   s     r"   r   r   +       I\"""""r$   c                 b    | j                             |                     |d                     d S )Nsummary)r2   r3   r4   r5   s     r"   r   r   /   s,    IT]]43344444r$   c                 :    | j                             d           d S )Nz
</summary>r9   r5   s     r"   r   r   3   r:   r$   c                       e Zd ZdZdZdZdZej         e	e
           e	 e                       e	ddg           e	d          eej        ej        ej        ej        d
Zdeej                 fd	Zd
S )r   a  A directive to generate a collapsible container.

    Note: This directive generates a single container,
    for the title (optional) and content::

        <container design_component="dropdown" has_title=True>
            <rubric>
                ...title nodes
        ...content nodes

    This allows for a default rendering in non-HTML outputs.

    The ``DropdownHtmlTransform`` then transforms this container
    into the HTML specific structure.
    r   Tz
right-downdown-up)zfade-inzfade-in-slide-down)
r0   coloriconchevronanimatemarginnameclass-containerclass-title
class-bodyr   c           
      <   | j                             ddg          | j                             dg           z   | j                             dg           | j                             dg           d}| j                             d          }|r#|d                             d	| d
| g           d| j         v rAd| j         d         z   |d         vr)|d                             d| j         d         z              t	          	 dd| j         v dt          | j                  dk    | j                             d          | j                             d          d|}|                     |           | j        rl| j        	                    | j        d         | j
                  \  }}t          j        | j        d         dg|R  }||z  }||z  }|                     |           n|                     |           | j                            | j        | j        |           |gS )NrD   zsd-mb-3rF   rG   rH   )container_classestitle_classesbody_classesr@   rK   zsd-bg-zsd-bg-text-rC   zsd-rJ   r   r0   r   rA   rB   )r.   type	has_titlerA   rB    )r   )optionsr1   extendr3   r	   len	argumentsset_source_infostateinline_textlinenor   rubricadd_namenested_parsecontentcontent_offset)r6   classestitle_color	container	textnodesmessages
title_nodes          r"   run_with_defaultsz#DropdownDirective.run_with_defaultsZ   sG    "&!1!1(YK!H!Hl0"55"6!\--mR@@ L,,\2>>	
 
 l&&w// 	O$++'+'')D{)D)DE   %%i00AT9UUU'(//Y8O0OPPP$
T\)$.))A-!!&))L$$Y//
 
 
 
	 	Y'''> 		%"&*"8"89JDK"X"XIxdnQ&7HiHHHJ#I!I MM*%%%%MM)$$$
d.A9MMM{r$   N)r'   r(   r)   __doc__optional_argumentsfinal_argument_whitespacehas_contentr   flagr   r   r   r   	unchangedclass_optionoption_speclistr   Noderc   r*   r$   r"   r   r   7   s            $K_--MMOO,,;9%
 
 ;@AA$%2!. - K,4
#3 , , , , , ,r$   r   c                   "    e Zd ZdZdZdZddZdS )r!   a1  Transform dropdown containers into the HTML specific AST structures::

    <details class="sd-sphinx-override sd-dropdown sd-card">
        <summary class="sd-summary-title sd-card-header">
            ...title nodes
        <div class="sd-summary-content sd-card-body">
            ...content nodes

       r   r   Nc                    | j         } t          |          d           D ]1}d}|d         dk    rdnd}t          j        ddt          j        dt          j        t          |d	                    d
          dd| g          }t          |d         ddg|rdgndgz   |d         z             }|d         rO|d         j        }|d         	                    d          r|dxx         |d         d         z  cc<   |dd         }nBt          j        dt          j        t          dddg                    d
          g}|j        }t          j        ddg|R dd gi}	|	|g}
|d!         rB|

                    dt          j        dt          |d!         d"	          d#gd
$                     |t          ddg|
R dd%g|rd&gng z   |d'         z   iz  }t          d(d)g|rd*gng z   |d+         z   |,          }|r: t          |          t          j                  D ]}d|v rg n|d         d-gz   |d<   ||z  }|                    |           3dS ).zRun the transformc                 "    t          | d          S )Nr   )r
   )r7   s    r"   <lambda>z+DropdownHtmlTransform.run.<locals>.<lambda>   s    <j3Q3Q r$   TrB   r?   zchevron-downzchevron-rightrO   z1.5em)heightr   )formatzsd-summary-state-markerzsd-summary-)r]   r.   zsd-sphinx-overridezsd-dropdownzsd-cardzsd-d-flex-columnrJ   )r.   r]   rN   r   idsr   Nz...zkebab-horizontalzno-title)rs   r]   r]   zsd-summary-textrA   1emzsd-summary-icon)r]   rt   zsd-summary-titlezsd-card-headerrK   zdropdown-bodyzsd-summary-contentzsd-card-bodyrL   )r]   childrenzsd-card-text)documentr   r   inlinerawTextr   r   rw   r1   insertr   r	   	paragraphreplace_self)r6   rx   r7   use_cardmarker_typestate_markernewnodetitle_text_childrenbody_childrentitle_text_nodetitle_children	body_nodeparas                r"   runzDropdownHtmlTransform.run   s   #'=%GH%%&Q&QRR S	' S	'DH #'y/Y">">O  !<	J{;wGGGHH!  
 34O+4O4OP	 	 	L $H~-}="*DI;;1C0DF*+,  G K  .&*1g&6#7;;u%% 5ENNNd1gen4NNN $QRR I
' 27ZL   
  &  
'# !%#l %   ++	 O .|<NF| 	%%I#DL???!2 3%	     ~     ,,)19$%%r;'(	  G )-.'/7N##R9~&' '  I  .GI..u??  D-6$->->rrDO&X 'DOO y Gg&&&&gS	' S	'r$   )r   N)r'   r(   r)   rd   default_priorityformatsr   r*   r$   r"   r!   r!      sE          GV' V' V' V' V' V'r$   r!   )!rd   docutilsr   docutils.parsers.rstr   sphinx.applicationr   !sphinx.transforms.post_transformsr   sphinx_design.sharedr   r   r	   r
   r   r   _compatr   iconsr   r   r#   ElementGeneralr   TextElementr   r   r   r   r   r   r!   r*   r$   r"   <module>r      s    = =       + + + + + + % % % % % % A A A A A A                      - - - - - - - -2 24 2 2 2 2	 	 	 	 	EM5= 	 	 		 	 	 	 	U& 	 	 	9 9 9# # #5 5 5# # #O O O O O O O Odd' d' d' d' d'/ d' d' d' d' d'r$   