o
    Zh0h!                     @   s   d Z ddlmZmZ ddlmZmZ ddlmZm	Z	m
Z
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mZmZ h dZe
d	d	dZe
d	d	de	d	d	dfZdddZdS )z/Validate properties, expanders and descriptors.    )SelectorErrorcompile_selector_list)parse_blocks_contents	serialize)FunctionBlock
IdentTokenLiteralTokenWhitespaceToken   )LOGGER   )InvalidValuesremove_whitespace   )	EXPANDERS)PREFIXPROPRIETARYUNSTABLEvalidate_non_shorthand>[   	cue-after
cue-beforecaret-colorcaret-shapepause-afterpitch-rangeplay-duringspeech-ratewill-changefield-sizingpause-beforespeak-headertouch-actionvoice-familyscroll-marginspeak-numeralview-timelineanimation-namepointer-eventsscroll-paddingtimeline-scopeanimation-delayanimation-rangescroll-behaviorscroll-timelinescrollbar-colorscrollbar-widthscroll-snap-stopscroll-snap-typescrollbar-guttertransition-delayscroll-margin-topscroll-snap-alignspeak-punctuationanimation-durationanimation-timelinescroll-margin-leftscroll-padding-topview-timeline-axisview-timeline-nameanimation-directionanimation-fill-modeanimation-range-endoverscroll-behaviorscroll-margin-blockscroll-margin-rightscroll-padding-lefttransition-durationtransition-propertyview-timeline-insetanimation-play-statescroll-margin-bottomscroll-margin-inlinescroll-padding-blockscroll-padding-rightscroll-timeline-axisscroll-timeline-nameview-transition-nameanimation-compositionanimation-range-startoverscroll-behavior-xoverscroll-behavior-yscroll-padding-bottomscroll-padding-inlinescroll-margin-block-endscroll-margin-inline-endscroll-padding-block-endanimation-iteration-countanimation-timing-functionoverscroll-behavior-blockscroll-margin-block-startscroll-padding-inline-endoverscroll-behavior-inlinescroll-margin-inline-startscroll-padding-block-starttransition-timing-functionscroll-padding-inline-startcuecaretpausepitchspeakcursorresizestressvolumeazimuthrichness	animation	elevation
transition&:rootNc                 #   sr   |dur:z#t |v r#|g }}|D ]}|t kr|t q|| qt|}W n ty9   tdt| dw tdddtddd|f}|D ]l  j	dkr\t
d j j j  j	dkr|du rfqIg }g g} jD ]}|d	krz|g  qn|d
 | qn|D ]A}	t |	v r jD ]}|t kr|| q|| qntdddtddd|f}|g |tddd|	 |tddd	 qt| t j|dd
 E dH   j	dkrqI j}
|
ds j}
 fdd}|
tv r|dd qI|
tr6|
ttd }|tv r|}
n)|tv r%t
d jt j j j| |}
nt
d jt j j j| qI|
drH|
dsH|dd qIt|
t}t  j}z|s[t!dt"|||
| }W n' t!y } z|d|j#r~|j#d r~|j#d nd W Y d}~qId}~ww  j$}|D ]$\}}|dur|%dd||f | fV  q|%dd||fV  qqIdS )zExpand shorthand properties, filter unsupported properties and values.

    Log a warning for every ignored declaration.

    Return a iterable of ``(name, value, important)`` tuples.

    N'r   rq   iserrorzError: %s at %d:%d.zqualified-rule, declarationz--c                    s(   t t| d jt j j j| d S )NzIgnored `%s:%s` at %d:%d, %s.)getattrr   namer   valuesource_linesource_column)levelreasonry    X/var/www/html/rh/venv/lib/python3.10/site-packages/weasyprint/css/validation/__init__.pyvalidation_error   s
   
z1preprocess_declarations.<locals>.validation_errordebugz/the property does not apply for the print mediaz\Deprecated `%s:%s` at %d:%d, prefixes on unstable attributes are deprecated, use %r instead.zTIgnored `%s:%s` at %d:%d, prefix on this attribute is not supported, use %r instead.-zprefixed selectors are ignoredzno valuewarningr   zinvalid value_)&NESTING_SELECTORextend
ROOT_TOKENappendr   r   r   r   r   typer   r   messager}   r~   preluder	   preprocess_declarationsr   contentr{   
startswith
lower_nameNOT_PRINT_MEDIAr   lenr   r   r|   r   getr   r   r   listargs	importantreplace)base_urldeclarationsr   original_preludetoken	selectorsis_tokendeclaration_preludetoken_groupstoken_groupr{   r   unprefixed_name	validatortokensresultexcr   	long_namer|   r   r   r   r   r   s   	
















 
r   )N)__doc__
cssselect2r   r   tinycss2r   r   tinycss2.astr   r   r   r	    r   utilsr   r   	expandersr   
propertiesr   r   r   r   r   r   r   r   r   r   r   r   <module>   s    a