
    Ri
                        d 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
Z
ddlmZ ddlmZ dd	lmZ erdd
lmZ ddlmZ ddlmZ  ej.                  e      ZddZddZddZy)z7Allow reference sections by :ref: role using its title.    )annotations)NoneType)TYPE_CHECKINGcast)nodesN)__)logging)clean_astext)Node)Sphinx)ExtensionMetadatac                    d}| }|j                   | j                  k7  r+|j                   }|dz  }|j                   | j                  k7  r+|S )Nr      )parentdocument)nodeicur_nodes      S/home/agent/.friday_env/lib/python3.12/site-packages/sphinx/ext/autosectionlabel.pyget_node_depthr      sG    	AH
//T]]
*??	Q //T]]
* H    c           	        | j                   j                  j                  }|j                  t        j
                        D ]  }| j                  j                  r#t        |      | j                  j                  k\  r=|d   d   }| j                   j                  j                  }t        d|d         }t        |d|j                               }| j                  j                  rt	        j                  |dz   |z         }nt	        j                  |      }t!        |      }	t"        j%                  t'        d      |||d|       ||j(                  v rMt"        j+                  t'        d	      || j                   j-                  |j(                  |   d         |d|       ||f|j.                  |<   |||	f|j(                  |<    y )
Nidsr   znodes.title	rawsource:z!section "%s" gets labeled as "%s"autosectionlabel)locationtypesubtypez(duplicate label %s, other instance in %s)envdomainsstandard_domainfindallr   sectionconfigautosectionlabel_maxdepthr   current_documentdocnamer   getattrastext autosectionlabel_prefix_documentfully_normalize_namer
   loggerdebugr   labelswarningdoc2path
anonlabels)
appr   domainr   labelidr(   titleref_namenamesectnames
             r   register_sections_as_labelr:   !   s   WW__,,F  / #9JJ00t$

(L(LLu+a.''**22]DG,5+u||~>::66--gmh.FGD--h7D&23# 	 	
 6== NN=>  t!4Q!78'   #*7"2$%w8dG#9r   c           	         | j                  dddt        t        h             | j                  dd dt        t        t        h             | j                  dt               t        j                  dddS )	Nr+   Fr    )typesr&   zdoctree-readT)versionparallel_read_safeparallel_write_safe)	add_config_value	frozensetboolintr   connectr:   sphinx__display_version__)r3   s    r   setuprG   I   sx    *E5	4&@Q   #T5	3/8R   KK :; --"# r   )r   r   returnrC   )r3   r   r   r   rH   None)r3   r   rH   r   )__doc__
__future__r   r<   r   typingr   r   docutilsr   rE   sphinx.localer   sphinx.utilr	   sphinx.util.nodesr
   docutils.nodesr   sphinx.applicationr   sphinx.util.typingr   	getLogger__name__r-   r   r:   rG    r   r   <module>rW      sN    = "  &     *#)4			8	$%9Pr   