
    ]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)CSSStyleDeclarationCSSFontFaceRulerestructuredtextz$Id$   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
d	 Z e	d
 ed      Z e	d d      Zd Z e	ed      Z e	d       Z xZS )r
   a=  
    The CSSFontFaceRule interface represents a @font-face rule in a CSS
    style sheet. The @font-face rule is used to hold a set of font
    descriptions.

    Format::

        font_face
          : FONT_FACE_SYM S*
            '{' S* declaration [ ';' S* declaration ]* '}' S*
          ;

    css_parser uses a :class:`~css_parser.css.CSSStyleDeclaration`  to
    represent the font descriptions. For validation a specific profile
    is used though were some properties have other valid values than
    when used in e.g. a :class:`~css_parser.css.CSSStyleRule`.
    c                     t         t        |   ||       d| _        |r|| _        || _        yt               | _        || _        y)z
        If readonly allows setting of properties in constructor only.

        :param style:
            CSSStyleDeclaration used to hold any font descriptions
            for this CSSFontFaceRule
        )
parentRuleparentStyleSheetz
@font-faceN)superr
   __init__
_atkeywordstyler	   	_readonly)selfr   r   r   readonly	__class__s        /home/pod-website-builder.sw7ft.com/pod-website-builder/website-analyzer/venv/lib/python3.12/site-packages/css_parser/css/cssfontfacerule.pyr   zCSSFontFaceRule.__init__*   sL     	ot-?O 	. 	Q&DJ " -.DJ!    c                 d    d| j                   j                  d| j                  j                  dS )Nzcss_parser.css.z(style=))r   __name__r   cssTextr   s    r   __repr__zCSSFontFaceRule.__repr__>   s&    NN##JJ  	 r   c                     d| j                   j                  | j                  j                  | j                  t        |       fz  S )Nz4<css_parser.css.%s object style=%r valid=%r at 0x%x>)r   r   r   r   valididr   s    r   __str__zCSSFontFaceRule.__str__C   s=    ENN##JJJJtH	I  	r   c                 @    t         j                  j                  |       S )z#Return serialized property cssText.)
css_parserserdo_CSSFontFaceRuler   s    r   _getCssTextzCSSFontFaceRule._getCssTextJ   s    ~~0066r   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)ad  
        :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.
        Nz-CSSFontFaceRule: No CSSFontFaceRule found: %s)error)r   T)blockstartonlyseparateEnd{Fz:CSSFontFaceRule: No start { of style declaration found: %r
wellformed:)expectedseq	tokenizerproductions)blockendonlyr-   }EOFz9CSSFontFaceRule: No "}" after style declaration found: %rz(CSSFontFaceRule: Trailing content found.)token)r   r
   _setCssText
_tokenize2
_nexttoken_type_prodsFONT_FACE_SYM_logr+   	_valuestrxmldomInvalidModificationErrr	   _tokensupto2_tokenvalue_tempSeq_parseappendr   _setSeqr   )r   r   r3   attokennewStyleokbeforetokensbracenewnewseqbeforewellformedr1   styletokensbraceorEOFtokenvaltype_	nonetokenr   s                    r   r9   zCSSFontFaceRule._setCssTextN   sA    	ot09OOG,	//)T2::g$++";";;IIOOK NN734"%''"@"@  B +d;HB"&"3"3ICG@D #4 #FL% &#-		 !8"&.."9!:;@B
  &C]]_F)-c9?4??[gKhAC *5 *E&h >(>S->B+/+<+<YJNIM ,= ,O(K ))/:DJJ<WCczeun		 !8"&.."9!: ; 	2I		 J&/   1 ~""?3  +HV$%
 r   z7(DOM) The parsable textual representation of this rule.)docc                     | j                          t        |t              rt        ||       | _        y| |_        || _        y)zK
        :param style:
            a CSSStyleDeclaration or string
        )r   r   N)_checkReadonly
isinstancestring_typer	   _style_parentRule)r   r   s     r   	_setStylezCSSFontFaceRule._setStyle   s7    
 	e[)-eMDK $EDKr   c                     | j                   S N)r\   r   s    r   <lambda>zCSSFontFaceRule.<lambda>   s
    $++ r   z](DOM) The declaration-block of this rule set, a :class:`~css_parser.css.CSSStyleDeclaration`.c                     | j                   S r`   )FONT_FACE_RULEr   s    r   ra   zCSSFontFaceRule.<lambda>   s    !4!4 r   z=The type of this rule, as defined by a CSSRule type constant.c                     ddg}| j                   j                  d      D ],  }|j                  s y	 |j                  |j                         . t        |       S # t
        $ r Y Fw xY w)Nzfont-familysrcT)allF)r   getPropertiesr"   removename
ValueErrorbool)r   neededps      r   	_getValidzCSSFontFaceRule._getValid   so    '))d)3 	A77aff%		 <  s   A	A('A(z`CSSFontFace is valid if properties `font-family` and `src` are set and all properties are valid.c                      y)NT r   s    r   ra   zCSSFontFaceRule.<lambda>   s    r   )NNNF)r   
__module____qualname____doc__r   r    r$   r)   r9   propertyr   r^   r   typern   r"   r/   __classcell__)r   s   @r   r
   r
      s    $ /316"( 
7H&T {K#$G  -yKLE 4)*D	  YKLE
 +,Jr   )
__future__r   r   r   r   xml.domrA   r&    r   cssstyledeclarationr	   __all____docformat____version__sysversion_infostrr[   
basestringCSSRuler
   rp   r   r   <module>r      sb    R R    4 
" 
A!KKj-goo j-r   