
    /h%                       d dl mZ d dlmZ d dlZd dlmZ ddl	m
Z
 ddlmZ ddddZ G d deeej        e         f                   Z G d de
eej        e         f         e          Z G d de          ZddlmZ dS )    )annotationsN)cleandoc   )ImmutableDictMixin)CallbackDictdockeystremptyt.Anytypetype[t.Any] | Noner	   
str | Nonereturnc                   |d  dg}t           u r|                    d           nf|                    d           n|                    dj         d           |                    dd	           |                    d
           d                    |          }t	           fd fd fdt          |                    S )a  Return a new property object for a cache header. Useful if you
    want to add support for a cache extension in a subclass.

    :param key: The attribute name present in the parsed cache-control header dict.
    :param empty: The value to use if the key is present without a value.
    :param type: The type to convert the string value to instead of a string. If
        conversion raises a ``ValueError``, the returned value is ``None``.
    :param doc: The docstring for the property. If not given, it is generated
        based on the other params.

    .. versionchanged:: 3.1
        Added the ``doc`` param.

    .. versionchanged:: 2.0
        Renamed from ``cache_property``.
    NzThe ``z`` attribute.z"A ``bool``, either present or not.z
A ``str``,zA ``z``,z``z`` if present with no value,zor ``None`` if not present. c                2    |                                S N)_get_cache_value)xr   r
   r   s    X/var/www/html/venv/lib/python3.11/site-packages/werkzeug/datastructures/cache_control.py<lambda>z(cache_control_property.<locals>.<lambda>1   s    !$$S%66     c                2    |                      |          S r   )_set_cache_value)r   vr
   r   s     r   r   z(cache_control_property.<locals>.<lambda>2   s    Q''Q55 r   c                .    |                                S r   )_del_cache_value)r   r
   s    r   r   z(cache_control_property.<locals>.<lambda>3   s    !$$S)) r   r   )boolappend__name__joinpropertyr   )r
   r   r   r	   partss   ```  r   cache_control_propertyr&      s   & {,#,,,-4<<LL=>>>>|\****6DM666777 G%GGGHHHLL6777hhuoo66666655555))))SMM	   r   c                      e Zd ZU dZ edde          Zded<    edde          Z	ded<    ed	de          Z
ded
<    edde          Zded<   	 	 d"d# fdZd$dZd%dZd&dZd'dZd'd Zd'd!Z ee          Z xZS )(_CacheControla  Subclass of a dict that stores values for a Cache-Control header.  It
    has accessors for all the cache-control directives specified in RFC 2616.
    The class does not differentiate between request and response directives.

    Because the cache-control directives in the HTTP header use dashes the
    python descriptors use underscores for that.

    To get a header of the :class:`CacheControl` 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.

    .. versionchanged:: 3.1
        Dict values are always ``str | None``. Setting properties will
        convert the value to a string. Setting a non-bool property to
        ``False`` is equivalent to setting it to ``None``. Getting typed
        properties will return ``None`` if conversion raises
        ``ValueError``, rather than the string.

    .. versionchanged:: 2.1
        Setting int properties such as ``max_age`` will convert the
        value to an int.

    .. versionchanged:: 0.4
       Setting ``no_cache`` or ``private`` to ``True`` will set the
       implicit value ``"*"``.
    zno-storeNr    no_storezmax-age
int | Nonemax_agezno-transformno_transformzstale-if-errorstale_if_error valuesBcabc.Mapping[str, t.Any] | cabc.Iterable[tuple[str, t.Any]] | None	on_update+cabc.Callable[[_CacheControl], None] | Nonec                ^    t                                          ||           |d u| _        d S r   )super__init__provided)selfr/   r1   	__class__s      r   r5   z_CacheControl.__init__Z   s/    
 	+++d*r   r
   r   r   r   r   r   r   c                    |t           u r|| v S || vrdS | |         x}|S |	  ||          }n# t          $ r Y dS w xY w|S +Used internally by the accessor properties.N)r    
ValueError)r7   r
   r   r   values        r   r   z_CacheControl._get_cache_valueb   s|     4<<$;d??4#YE'LU   tt s   / 
==r=   Nonec                    |t           u r!|rd| |<   dS |                     |d           dS ||du r|                     |d           dS |du rd| |<   dS | ||          }t          |          | |<   dS )r;   NFT)r    popr   )r7   r
   r=   r   s       r   r   z_CacheControl._set_cache_valuew   s     4<< $ S			d#####]eunnHHS$d]]DIIIUE

DIIIr   c                    || v r| |= dS dS r:   r.   )r7   r
   s     r   r   z_CacheControl._del_cache_value   s    $;;S			 ;r   c                *    t          j        |           S )z6Convert the stored values into a cache control header.)httpdump_headerr7   s    r   	to_headerz_CacheControl.to_header   s    %%%r   c                *    |                                  S r   )rF   rE   s    r   __str__z_CacheControl.__str__   s    ~~r   c                    d                     d t          |                                           D                       }dt          |           j         d| dS )Nr   c              3  *   K   | ]\  }}| d |V  dS )=Nr.   ).0kr   s      r   	<genexpr>z)_CacheControl.__repr__.<locals>.<genexpr>   s0      HH41aQ,,,,HHHHHHr   <>)r#   sorteditemsr   r"   )r7   kv_strs     r   __repr__z_CacheControl.__repr__   sT    HH6$**,,3G3GHHHHH24::&222222r   )r.   N)r/   r0   r1   r2   )r
   r   r   r   r   r   r   r   )r
   r   r=   r   r   r   r   r>   )r
   r   r   r>   )r   r   )r"   
__module____qualname____doc__r&   r    r)   __annotations__intr+   r,   r-   r5   r   r   r   rF   rH   rT   staticmethodcache_property__classcell__)r8   s   @r   r(   r(   8   sZ         8 ,+JdCCHCCCC00D#FFGFFFF//dKKLKKKK!7!78H$PS!T!TNTTTT VXAE+ + + + + + +   *# # # #&   
& & & &       3 3 3 3 "\"899NNNNNr   r(   c                      e Zd ZU dZ edde          Zded<    edde          Z	ded	<    ed
de          Z
ded<    edde          Zded<   dS )RequestCacheControla  A cache control for requests.  This is immutable and gives access
    to all the request-relevant cache control headers.

    To get a header of the :class:`RequestCacheControl` 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.

    .. versionchanged:: 3.1
        Dict values are always ``str | None``. Setting properties will
        convert the value to a string. Setting a non-bool property to
        ``False`` is equivalent to setting it to ``None``. Getting typed
        properties will return ``None`` if conversion raises
        ``ValueError``, rather than the string.

    .. versionchanged:: 3.1
       ``max_age`` is ``None`` if present without a value, rather
       than ``-1``.

    .. versionchanged:: 3.1
        ``no_cache`` is a boolean, it is ``True`` instead of ``"*"``
        when present.

    .. versionchanged:: 3.1
        ``max_stale`` is ``True`` if present without a value, rather
        than ``"*"``.

    .. versionchanged:: 3.1
       ``no_transform`` is a boolean. Previously it was mistakenly
       always ``None``.

    .. versionchanged:: 3.1
       ``min_fresh`` is ``None`` if present without a value, rather
       than ``"*"``.

    .. versionchanged:: 2.1
        Setting int properties such as ``max_age`` will convert the
        value to an int.

    .. versionadded:: 0.5
        Response-only properties are not present on this request class.
    no-cacheNr    no_cachez	max-staleTzint | t.Literal[True] | None	max_stalez	min-freshr*   	min_freshzonly-if-cachedonly_if_cached)r"   rU   rV   rW   r&   r    r`   rX   rY   ra   rb   rc   r.   r   r   r^   r^      s         ) )V ,+JdCCHCCCC.D.D/ /I    
 32;cJJIJJJJ112BD$OONOOOOOOr   r^   c                  X   e Zd ZU dZ eddd          Zded<    edde          Zded<    ed	dd          Z	ded	<    ed
de          Z
ded<    edde          Zded<    edde          Zded<    edde          Zded<    edde          Zded<    edde          Zded<   dS )ResponseCacheControla  A cache control for responses.  Unlike :class:`RequestCacheControl`
    this is mutable and gives access to response-relevant cache control
    headers.

    To get a header of the :class:`ResponseCacheControl` 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.

    .. versionchanged:: 3.1
        Dict values are always ``str | None``. Setting properties will
        convert the value to a string. Setting a non-bool property to
        ``False`` is equivalent to setting it to ``None``. Getting typed
        properties will return ``None`` if conversion raises
        ``ValueError``, rather than the string.

    .. versionchanged:: 3.1
        ``no_cache`` is ``True`` if present without a value, rather than
        ``"*"``.

    .. versionchanged:: 3.1
        ``private`` is ``True`` if present without a value, rather than
        ``"*"``.

    .. versionchanged:: 3.1
       ``no_transform`` is a boolean. Previously it was mistakenly
       always ``None``.

    .. versionchanged:: 3.1
        Added the ``must_understand``, ``stale_while_revalidate``, and
        ``stale_if_error`` properties.

    .. versionchanged:: 2.1.1
        ``s_maxage`` converts the value to an int.

    .. versionchanged:: 2.1
        Setting int properties such as ``max_age`` will convert the
        value to an int.

    .. versionadded:: 0.5
       Request-only properties are not present on this response class.
    r_   TNzstr | t.Literal[True] | Noner`   publicr    privatezmust-revalidatemust_revalidatezproxy-revalidateproxy_revalidatezs-maxager*   s_maxage	immutablezmust-understandmust_understandzstale-while-revalidatestale_while_revalidate)r"   rU   rV   rW   r&   r`   rX   r    rf   rg   rh   ri   rY   rj   rk   rl   rm   r.   r   r   re   re      st        ) )V .D-CD$. .H     *)(D$??F????,B,B4- -G     323DdDQQOQQQQ334FdSSSSSS11*dCHHHHHHH,,[$EEIEEEE223DdDQQOQQQQ)?)? $* *      r   re      )rC   )
r
   r   r   r   r   r   r	   r   r   r   )
__future__r   collections.abcabccabctypingtinspectr   mixinsr   
structuresr   r&   r   Optionalr(   r^   re    rC   r.   r   r   <module>rz      s_   " " " " " "                 & & & & & & $ $ $ $ $ $ LP* * * * * *Zb: b: b: b: b:Lajo!56 b: b: b:J3P 3P 3P 3P 3P,S!*S/-ABM 3P 3P 3Pl: : : : := : : :|        r   