o
    ê}”e¬  ã                   @  s6   d dl mZ ddlmZ dd„ ZG dd„ deeƒZdS )	é    )Úannotationsé   )ÚUpdateDictMixinc                   s,   t ‡ fdd„‡ fdd„‡ fdd„dˆ ›�ƒS )z”Return a new property object for a content security policy header.
    Useful if you want to add support for a csp extension in a
    subclass.
    c                   ó
   |   ˆ ¡S ©N)Ú
_get_value©Úx©Úkey© úd/Users/abhinavbhinder/Documents/map/venv/lib/python3.10/site-packages/werkzeug/datastructures/csp.pyÚ<lambda>   ó   
 zcsp_property.<locals>.<lambda>c                   s   |   ˆ |¡S r   )Ú
_set_value)r	   Úvr
   r   r   r      s    c                   r   r   )Ú
_del_valuer   r
   r   r   r      r   zaccessor for )Úpropertyr
   r   r
   r   Úcsp_property   s   


ür   c                   @  s  e Zd ZdZedƒZedƒZedƒZedƒZedƒZ	edƒZ
edƒZed	ƒZed
ƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZedƒZd+dd„Zdd „ Zd!d"„ Z d#d$„ Z!d%d&„ Z"d'd(„ Z#d)d*„ Z$dS ),ÚContentSecurityPolicyaV  Subclass of a dict that stores values for a Content Security Policy
    header. It has accessors for all the level 3 policies.

    Because the csp directives in the HTTP header use dashes the
    python descriptors use underscores for that.

    To get a header of the :class:`ContentSecuirtyPolicy` object again
    you can convert the object into a string or call the
    :meth:`to_header` method.  If you plan to subclass it and add your
    own items have a look at the sourcecode for that class.

    .. versionadded:: 1.0.0
       Support for Content Security Policy headers was added.

    zbase-uriz	child-srczconnect-srczdefault-srczfont-srczform-actionzframe-ancestorsz	frame-srczimg-srczmanifest-srcz	media-srcznavigate-toz
object-srczprefetch-srczplugin-typesz	report-toz
report-uriÚsandboxz
script-srczscript-src-attrzscript-src-elemz	style-srczstyle-src-attrzstyle-src-elemz
worker-srcr   Nc                 C  s$   t  | |pd¡ || _|d u| _d S )Nr   )ÚdictÚ__init__Ú	on_updateÚprovided)ÚselfÚvaluesr   r   r   r   r   >   s   zContentSecurityPolicy.__init__c                 C  s
   |   |¡S )ú+Used internally by the accessor properties.)Úget©r   r   r   r   r   r   C   s   
z ContentSecurityPolicy._get_valuec                 C  s$   |du r|   |d¡ dS || |< dS ©r   N)Úpop)r   r   Úvaluer   r   r   r   G   s   z ContentSecurityPolicy._set_valuec                 C  s   || v r	| |= dS dS r    r   r   r   r   r   r   N   s   
ÿz ContentSecurityPolicy._del_valuec                 C  s   ddl m} || ƒS )z6Convert the stored values into a cache control header.é   )Údump_csp_header)Úhttpr$   )r   r$   r   r   r   Ú	to_headerS   s   zContentSecurityPolicy.to_headerc                 C  s   |   ¡ S r   )r&   )r   r   r   r   Ú__str__Y   s   zContentSecurityPolicy.__str__c                 C  s4   d  dd„ t|  ¡ ƒD ƒ¡}dt| ƒj› d|› d�S )Nú c                 s  s"   � | ]\}}|› d |›�V  qdS )ú=Nr   )Ú.0Úkr   r   r   r   Ú	<genexpr>]   s   €  z1ContentSecurityPolicy.__repr__.<locals>.<genexpr>ú<ú>)ÚjoinÚsortedÚitemsÚtypeÚ__name__)r   Zkv_strr   r   r   Ú__repr__\   s   zContentSecurityPolicy.__repr__)r   N)%r3   Ú
__module__Ú__qualname__Ú__doc__r   Zbase_uriZ	child_srcZconnect_srcZdefault_srcZfont_srcZform_actionZframe_ancestorsZ	frame_srcZimg_srcZmanifest_srcZ	media_srcZnavigate_toZ
object_srcZprefetch_srcZplugin_typesZ	report_toZ
report_urir   Z
script_srcZscript_src_attrZscript_src_elemZ	style_srcZstyle_src_attrZstyle_src_elemZ
worker_srcr   r   r   r   r&   r'   r4   r   r   r   r   r      sD    
r   N)Ú
__future__r   Úmixinsr   r   r   r   r   r   r   r   Ú<module>   s    