o
    ßý°jè  ã                   @  sR   d dl mZ d dlmZ d dlZddlmZ dd	d
„Z	G dd„ dee
e
f ƒZdS )é    )ÚannotationsNé   )ÚCallbackDictÚkeyÚstrÚreturnút.Anyc                   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©r   © úŽ/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/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U dZedƒZded< edƒZded< edƒZded< ed	ƒZ	ded
< edƒZ
ded< edƒZded< edƒZded< edƒZded< edƒZded< edƒZded< edƒZded< edƒZded< edƒZded< edƒZded< edƒZded < ed!ƒZded"< ed#ƒZded$< ed%ƒZded%< ed&ƒZded'< ed(ƒZded)< ed*ƒZded+< ed,ƒZded-< ed.ƒZded/< ed0ƒZded1< ed2ƒZded3< 	4	5dMdN‡ fd<d=„ZdOd@dA„Z dPdCdD„Z!dQdEdF„Z"dRdGdH„Z#dRdIdJ„Z$dRdKdL„Z%‡  Z&S )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:`ContentSecurityPolicy` 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-uriú
str | NoneÚbase_uriz	child-srcÚ	child_srczconnect-srcÚconnect_srczdefault-srcÚdefault_srczfont-srcÚfont_srczform-actionÚform_actionzframe-ancestorsÚframe_ancestorsz	frame-srcÚ	frame_srczimg-srcÚimg_srczmanifest-srcÚmanifest_srcz	media-srcÚ	media_srcznavigate-toÚnavigate_toz
object-srcÚ
object_srczprefetch-srcÚprefetch_srczplugin-typesÚplugin_typesz	report-toÚ	report_toz
report-uriÚ
report_uriÚsandboxz
script-srcÚ
script_srczscript-src-attrÚscript_src_attrzscript-src-elemÚscript_src_elemz	style-srcÚ	style_srczstyle-src-attrÚstyle_src_attrzstyle-src-elemÚstyle_src_elemz
worker-srcÚ
worker_srcr   NÚvaluesú>cabc.Mapping[str, str] | cabc.Iterable[tuple[str, str]] | NoneÚ	on_updateú3cabc.Callable[[ContentSecurityPolicy], None] | Noner   ÚNonec                   s   t ƒ  ||¡ |d u| _d S r
   )ÚsuperÚ__init__Úprovided)Úselfr3   r5   ©Ú	__class__r   r   r9   A   s   zContentSecurityPolicy.__init__r   r   c                 C  s
   |   |¡S )ú+Used internally by the accessor properties.)Úget©r;   r   r   r   r   r   I   s   
z ContentSecurityPolicy._get_valueÚvaluec                 C  s$   |du r|   |d¡ dS || |< dS ©r>   N)Úpop)r;   r   rA   r   r   r   r   M   s   z ContentSecurityPolicy._set_valuec                 C  s   || v r	| |= dS dS rB   r   r@   r   r   r   r   T   s   
ÿz ContentSecurityPolicy._del_valuec                 C  s   ddl m} || ƒS )z6Convert the stored values into a cache control header.é   )Údump_csp_header)ÚhttprE   )r;   rE   r   r   r   Ú	to_headerY   s   zContentSecurityPolicy.to_headerc                 C  s   |   ¡ S r
   )rG   )r;   r   r   r   Ú__str___   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>c   s   €  z1ContentSecurityPolicy.__repr__.<locals>.<genexpr>ú<ú>)ÚjoinÚsortedÚitemsÚtypeÚ__name__)r;   Úkv_strr   r   r   Ú__repr__b   s   zContentSecurityPolicy.__repr__)r   N)r3   r4   r5   r6   r   r7   )r   r   r   r   )r   r   rA   r   r   r7   )r   r   r   r7   )r   r   )'rT   Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__annotations__r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r9   r   r   r   rG   rH   rV   Ú__classcell__r   r   r<   r   r      sH   
 ý




r   )r   r   r   r   )Ú
__future__r   Úcollections.abcÚabcÚcabcÚtypingÚtÚ
structuresr   r   r   r   r   r   r   r   Ú<module>   s    
