
    ^hW                     (   S r SSKrSSKJrJrJr  SSKJrJrJ	r	J
r
Jr  SSKJr  SrSr SSKJr  SS	KJr  S
rSrS/r " S S\5      rS rg! \ a?     SSKJr  SrS
r\R*                  " S\SS9   N7! \ a    \R*                  " S\SS9    NRf = ff = f)zD
NBConvert Preprocessor for sanitizing HTML rendering of notebooks.
    N)ALLOWED_ATTRIBUTESALLOWED_TAGSclean)AnyBoolListSetUnicode   )PreprocessorF)ALLOWED_CSS_PROPERTIES)CSSSanitizerT)ALLOWED_STYLESzFSupport for bleach <5 will be removed in a future version of nbconvert   )
stacklevelz[The installed bleach/tinycss2 do not provide CSS sanitization, please upgrade to bleach >=5SanitizeHTMLc                       \ rS rSrSr\" S\SS9r\" \	" 5       S\
SS9r\" \	" 5       S\SS9r\" SSS	S9r\" SSS
S9r\" S1 SkSS9r\" SSS1SS9rS rS rS rSrg)r   0   z A preprocessor to sanitize html.TzAllowed HTML tag attributes)configdefault_valuehelpzList of HTML tags to allowz,Allowed CSS styles if <style> tag is allowedFz:If True, remove unsafe markup entirely instead of escapingz)If True, strip comments from escaped HTML>   metadata	image/png
image/jpeg
text/latex
text/plainapplication/jsonz4Cell output mimetypes to render without modificationz	text/htmlztext/markdownz8Cell output types to display after escaping with Bleach.c                 6   UR                   S:X  a#  U R                  UR                  5      Ul        X4$ UR                   S:X  a#  U R                  UR                  5      Ul        X4$ UR                   S:X  a#  U R                  UR                  5      Ul        X4$ g)z
Sanitize potentially-dangerous contents of the cell.

Cell Types:
  raw:
    Sanitize literal HTML
  markdown:
    Sanitize literal HTML
  code:
    Sanitize outputs that could result in code execution
rawmarkdowncodeN)	cell_typesanitize_html_tagssourcesanitize_code_outputsoutputs)selfcell	resources
cell_indexs       Z/home/james-whalen/.local/lib/python3.13/site-packages/nbconvert/preprocessors/sanitize.pypreprocess_cellSanitizeHTML.preprocess_cellf   s     >>U" 11$++>DK?">>Z'11$++>DK?">>V#55dllCDL?"    c                 r   U H  nUS   S;   a  M  UR                   n/ nU Hg  nXPR                  ;   a  M  XPR                  ;   a3  U R                  R	                  SU5        U R                  X5   5      X5'   MV  UR                  U5        Mi     U H!  nU R                  R	                  SU5        X5	 M#     M     U$ )z
Sanitize code cell outputs.

Removes 'text/javascript' fields from display_data outputs, and
runs `sanitize_html_tags` over 'text/html'.
output_type)streamerrorzSanitizing %szRemoving %s)datasafe_output_keyssanitized_output_typesloginfor#   append)r'   r&   outputr3   	to_removekeys         r+   r%   "SanitizeHTML.sanitize_code_outputs   s     Fm$(;;;;DI///555HHMM/37 $ 7 7	 BDI $$S)  !mS1I !! & r.   c                    U R                   U R                  U R                  U R                  S.n[        (       a#  [        U R                  S9nUR                  US9  O$[        (       a  UR                  U R                  S9  [        U40 UD6$ )z-
Sanitize a string containing raw HTML tags.
)tags
attributesstripstrip_commentsallowed_css_properties)css_sanitizer)styles)
r>   r?   r@   rA   _USE_BLEACH_CSS_SANITIZERr   rE   update_USE_BLEACH_STYLESr   )r'   html_strkwargsrD   s       r+   r#   SanitizeHTML.sanitize_html_tags   su    
 II//ZZ"11	
 %$(LMMMM6MMM-X(((r.    N)__name__
__module____qualname____firstlineno____doc__r   r   r?   r   r
   r   r>   r   rE   r   r@   rA   r	   r4   r5   r,   r%   r#   __static_attributes__rL   r.   r+   r   r   0   s    * (*J
 	")	D 	$;	F IE
 8N 
 D !
 H48)r.   c                  4    [         (       a  [        [        S9$ g )NrB   )rF   r   r   rL   r.   r+   _get_default_css_sanitizerrT      s      >BBr.   )rQ   warningsbleachr   r   r   	traitletsr   r   r   r	   r
   baser   rF   rH   bleach.css_sanitizerr   r   r   ImportErrorwarnDeprecationWarningUserWarning__all__r   rT   rL   r.   r+   <module>r_      s     : : 3 3 !  
M1 $. 
})< })@s  

)$)!!T	
  
+		


s)   A BA11B	BBB