
    ]h                         d dl mZmZmZmZ d dlZd dlZddlm	Z	 ddl
mZ 	 dgZdZdZd dlZej                   d    d	k\  reZneZ G d
 de	j(                        Zy)    )unicode_literalsdivisionabsolute_importprint_functionN   )cssrule)CSSVariablesDeclarationCSSVariablesRulerestructuredtextz;$Id: cssfontfacerule.py 1818 2009-07-30 21:39:00Z cthedot $   c                        e Zd ZdZ	 	 d fd	Zd Zd Zd Z fdZ e	eed      Z
 e	d	      Zd
 Z e	d ed      Z e	d d      Z e	d d      Z e	d       Z xZS )r
   a_  
    The CSSVariablesRule interface represents a @variables rule within a CSS
    style sheet. The @variables rule is used to specify variables.

    css_parser uses a :class:`~css_parser.css.CSSVariablesDeclaration`  to
    represent the variables.

    Format::

        variables
            VARIABLES_SYM S* medium [ COMMA S* medium ]* LBRACE S*
            variableset* '}' S*
            ;

    for variableset see :class:`css_parser.css.CSSVariablesDeclaration`

    **Media are not implemented. Reason is that css_parser is using CSS
    variables in a kind of preprocessing and therefor no media information
    is available at this stage. For now do not use media!**

    Example::

        @variables {
          CorporateLogoBGColor: #fe8d12;
        }

        div.logoContainer {
          background-color: var(CorporateLogoBGColor);
        }
    c                     t         t        |   ||       d| _        t        j
                  j                  ||      | _        |r|| _        || _
        yt        |       | _        || _
        y)zO
        If readonly allows setting of properties in constructor only.
        )
parentRuleparentStyleSheetz
@variables)readonlyr   N)superr
   __init__
_atkeyword
css_parserstylesheets	MediaList_media	variablesr	   	_readonly)self	mediaTextr   r   r   r   	__class__s         /home/pod-website-builder.sw7ft.com/pod-website-builder/website-analyzer/venv/lib/python3.12/site-packages/css_parser/css/cssvariablesrule.pyr   zCSSVariablesRule.__init__5   sn    
 	.*@P 	/ 	R& !,,66y86T&DN " 5EDN!    c                     d| j                   j                  d| j                  j                  d| j                  j
                  dS )Nzcss_parser.css.z(mediaText=z, variables=))r   __name__r   r   r   cssTextr   s    r   __repr__zCSSVariablesRule.__repr__H   s3    NN##KK!!NN""$ 	$r    c                     d| j                   j                  | j                  j                  | j                  j
                  | j                  t        |       fz  S )NzE<css_parser.css.%s object mediaText=%r variables=%r valid=%r at 0x%x>)r   r#   r   r   r   r$   valididr%   s    r   __str__zCSSVariablesRule.__str__N   sK    !^^44![[22!^^33!ZZX	'' 	'r    c                 @    t         j                  j                  |       S )z#Return serialized property cssText.)r   serdo_CSSVariablesRuler%   s    r   _getCssTextzCSSVariablesRule._getCssTextV   s    ~~11$77r    c                 l   t         t        |   |       | j                  |      }| j	                  |d      }| j                  |      | j                  j                  k7  rH| j                  j                  d| j                  |      z  t        j                  j                         yt        |       }d}| j                  |dd      \  }}| j!                  |      dk7  r0d}| j                  j                  d	| j                  |      z  |       d
di}| j#                         }	| j%                  d|	| j                  |      i       \  }
}|xr	 |
xr |d
   }| j                  |dd      \  }}| j!                  |      | j                  |      }}|dk7  r4|dk7  r/d}| j                  j                  d| j                  |      z         | j	                  |      }|rd}| j                  j                  d|       d|k(  r|j'                  |       ||_        |r| j+                  |	       || _        yy)ar  
        :exceptions:
            - :exc:`~xml.dom.SyntaxErr`:
              Raised if the specified CSS string value has a syntax error and
              is unparsable.
            - :exc:`~xml.dom.InvalidModificationErr`:
              Raised if the specified CSS string value represents a different
              type of rule than the current one.
            - :exc:`~xml.dom.HierarchyRequestErr`:
              Raised if the rule cannot be inserted at this point in the
              style sheet.
            - :exc:`~xml.dom.NoModificationAllowedErr`:
              Raised if the rule is readonly.

        Format::

            variables
            : VARIABLES_SYM S* medium [ COMMA S* medium ]* LBRACE S*
              variableset* '}' S*
            ;

            variableset
            : LBRACE S* vardeclaration [ ';' S* vardeclaration ]* '}' S*
            ;
        Nz/CSSVariablesRule: No CSSVariablesRule found: %s)errorr   T)blockstartonlyseparateEnd{Fz>CSSVariablesRule: No start { of variable declaration found: %r
wellformed:)expectedseq	tokenizerproductions)blockendonlyr2   }EOFz>CSSVariablesRule: No "}" after variables declaration found: %rz)CSSVariablesRule: Trailing content found.)token)r   r
   _setCssText
_tokenize2
_nexttoken_type_prodsVARIABLES_SYM_logr0   	_valuestrxmldomInvalidModificationErrr	   _tokensupto2_tokenvalue_tempSeq_parseappendr$   _setSeqr   )r   r$   r8   attokennewVariablesokbeforetokensbracenewnewseqbeforewellformedr6   variablestokensbraceorEOFtokenvaltype_	nonetokenr   s                    r   r>   zCSSVariablesRule._setCssTextZ   sE   4 	1':OOG,	//)T2::g$++";";;IIOOM NN734"%''"@"@  B 3dCLB"&"3"3ICG@D #4 #FL% &#-		 !8"&.."9!:;@B
  &C]]_F)-c9?4??[gKhAC *5 *E&h >(>S->B/3/@/@NRMQ 0A 0S,O_ ))/:

?+ Cczeun		 !8"&.."9!: ; 	2I		 K&/   1 ~&&7#2L V$!- r    z7(DOM) The parsable textual representation of this rule.)docz_NOT IMPLEMENTED! As css_parser resolves variables during serializing media information is lost.c                     | j                          t        |t              rt        ||       | _        y| |_        || _        y)zS
        :param variables:
            a CSSVariablesDeclaration or string
        )r$   r   N)_checkReadonly
isinstancestring_typer	   
_variables_parentRule)r   r   s     r   _setVariableszCSSVariablesRule._setVariables   s=    
 	i-5iAEGDO %)I!'DOr    c                     | j                   S N)ra   r%   s    r   <lambda>zCSSVariablesRule.<lambda>   s
    doo r    zX(DOM) The variables of this rule set, a :class:`css_parser.css.CSSVariablesDeclaration`.c                     | j                   S re   )VARIABLES_RULEr%   s    r   rf   zCSSVariablesRule.<lambda>   s    !4!4 r    z=The type of this rule, as defined by a CSSRule type constant.c                      yNT r%   s    r   rf   zCSSVariablesRule.<lambda>       r    zNOT IMPLEMTED REALLY (TODO)c                      yrj   rk   r%   s    r   rf   zCSSVariablesRule.<lambda>   rl   r    )NNNNF)r#   
__module____qualname____doc__r   r&   r*   r.   r>   propertyr$   mediarc   r   typer(   r4   __classcell__)r   s   @r   r
   r
      s    > CG16"&$'8S.j {K#$G  I JE( 5}PQI 4)*D &,IJE +,Jr    )
__future__r   r   r   r   xml.domrF   r    r   cssvariablesdeclarationr	   __all____docformat____version__sysversion_infostrr`   
basestringCSSRuler
   rk   r    r   <module>r      sb    R R    < 
"K 
A!KKz-w z-r    