Ë
    :¾ªj«  ã                   óæ  — U d dl mZmZ d dlmZ d dlmZmZmZm	Z	 d dl
mZ dddiddiddidd d	œd
œdœZeeef   ed<    G d„ de«      Zdedz  dededz  fd„Zdedz  dedz  fd„Zdedz  dedz  fd„Z G d„ de«      Zdedee   fd„Zddddddœdeedz   ed«      f   deedz   ed«      f   deedz   ed «      f   d!eedz   ed"«      f   d#eedz   ed$«      f   defd%„Zd&Zd'Zeed(<   y))é    )Ú	AnnotatedÚAny)ÚDoc)ÚAfterValidatorÚ	BaseModelÚFieldÚmodel_validator)ÚStreamingResponseÚobjectÚtypeÚstringÚinteger)r   Úminimum)ÚdataÚeventÚidÚretry)r   Ú
propertiesÚ_SSE_EVENT_SCHEMAc                   ó   — e Zd ZdZdZy)ÚEventSourceResponseaæ  Streaming response with `text/event-stream` media type.

    Use as `response_class=EventSourceResponse` on a *path operation* that uses `yield`
    to enable Server Sent Events (SSE) responses.

    Works with **any HTTP method** (`GET`, `POST`, etc.), which makes it compatible
    with protocols like MCP that stream SSE over `POST`.

    The actual encoding logic lives in the FastAPI routing layer. This class
    serves mainly as a marker and sets the correct `Content-Type`.
    ztext/event-streamN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
media_type© ó    úJ/var/www/html/serviGia/entorno/lib/python3.12/site-packages/fastapi/sse.pyr   r      s   „ ñ
ð %�Jr   r   ÚvNÚ
field_nameÚreturnc                 ó8   — | �d| v sd| v rt        d|› d�«      ‚| S )Núú
zSSE 'z' must be a single line)Ú
ValueError)r    r!   s     r   Ú_check_single_liner'   $   s-   € Ø€}˜$ !™) t¨q¡yÜ˜5  Ð,CÐDÓEÐEØ€Hr   c                 ó   — t        | d«      S )Nr   )r'   ©r    s    r   Ú_check_event_single_liner*   *   s   € Ü˜a Ó)Ð)r   c                 ó<   — | �d| v rt        d«      ‚t        | d«      S )Nú z)SSE 'id' must not contain null charactersr   )r&   r'   r)   s    r   Ú_check_id_validr-   .   s&   € Ø€}˜ ™ÜÐDÓEÐEÜ˜a Ó&Ð&r   c                   óT  — e Zd ZU dZdZee ed«      f   ed<   dZ	ee
dz   ed«      f   ed<   dZee
dz   ee«       ed«      f   ed<   dZee
dz   ee«       ed	«      f   ed
<   dZeedz   ed¬«       ed«      f   ed<   dZee
dz   ed«      f   ed<    ed¬«      dd„«       Zy)ÚServerSentEventat  Represents a single Server-Sent Event.

    When `yield`ed from a *path operation function* that uses
    `response_class=EventSourceResponse`, each `ServerSentEvent` is encoded
    into the [SSE wire format](https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream)
    (`text/event-stream`).

    If you yield a plain object (dict, Pydantic model, etc.) instead, it is
    automatically JSON-encoded and sent as the `data:` field.

    All `data` values **including plain strings** are JSON-serialized.

    For example, `data="hello"` produces `data: "hello"` on the wire (with
    quotes).
    NaB  
            The event payload.

            Can be any JSON-serializable value: a Pydantic model, dict, list,
            string, number, etc. It is **always** serialized to JSON: strings
            are quoted (`"hello"` becomes `data: "hello"` on the wire).

            Mutually exclusive with `raw_data`.
            r   aQ  
            Raw string to send as the `data:` field **without** JSON encoding.

            Use this when you need to send pre-formatted text, HTML fragments,
            CSV lines, or any non-JSON payload. The string is placed directly
            into the `data:` field as-is.

            Mutually exclusive with `data`.
            Úraw_datazë
            Optional event type name.

            Maps to `addEventListener(event, ...)` on the browser. When omitted,
            the browser dispatches on the generic `message` event. Must be a
            single line.
            r   zó
            Optional event ID.

            The browser sends this value back as the `Last-Event-ID` header on
            automatic reconnection. **Must be a single line** and must not contain
            null (`\0`) characters.
            r   r   )Úgez×
            Optional reconnection time in **milliseconds**.

            Tells the browser how long to wait before reconnecting after the
            connection is lost. Must be a non-negative integer.
            r   zû
            Optional comment line(s).

            Comment lines start with `:` in the SSE wire format and are ignored by
            `EventSource` clients. Useful for keep-alive pings to prevent
            proxy/load-balancer timeouts.
            ÚcommentÚafter)Úmodec                 óL   — | j                   �| j                  �t        d«      ‚| S )Nz“Cannot set both 'data' and 'raw_data' on the same ServerSentEvent. Use 'data' for JSON-serialized payloads or 'raw_data' for pre-formatted strings.)r   r0   r&   )Úselfs    r   Ú_check_data_exclusivez%ServerSentEvent._check_data_exclusive”   s.   € à�9‰9Ð  T§]¡]Ð%>Üð;óð ð
 ˆr   )r"   r/   )r   r   r   r   r   r   r   r   Ú__annotations__r0   Ústrr   r   r*   r   r-   r   Úintr   r2   r	   r7   r   r   r   r/   r/   4   sN  … ñð: 	ð 	ˆ)ØÙðó
	
ð	ñó ð6 	ð ˆiØˆd‰
Ùðó
	
ð	ñó ð4 	ð 
ˆ9Øˆd‰
ÙÐ/Ó0Ùðó	
ð
	ñó ð2 	ð ˆ	Øˆd‰
Ù�Ó'Ùðó	
ð
	ñ	ó ð0 	ð 
ˆ9Øˆd‰
Ù�ŒÙðó	
ð		ñó ð. 	ð ˆYØˆd‰
Ùðó	
ð		ñó ñ ˜'Ô"òó #ñr   r/   Úvaluec                 ód   — | j                  dd«      j                  dd«      j                  d«      S )Nz
r%   r$   )ÚreplaceÚsplit)r;   s    r   Ú_split_sse_linesr?   Ÿ   s-   € ð �=‰=˜ Ó&×.Ñ.¨t°TÓ:×@Ñ@ÀÓFÐFr   )Údata_strr   r   r   r2   r@   zQ
            Pre-serialized data string to use as the `data:` field.
            r   zD
            Optional event type name (`event:` field).
            r   z:
            Optional event ID (`id:` field).
            r   zV
            Optional reconnection time in milliseconds (`retry:` field).
            r2   z@
            Optional comment line(s) (`:` prefix).
            c                 ó¦  — g }|�$t        |«      D ]  }|j                  d|› �«       Œ |�|j                  d|› �«       | �$t        | «      D ]  }|j                  d|› �«       Œ |�|j                  d|› �«       |�|j                  d|› �«       |j                  d«       |j                  d«       dj                  |«      j                  d«      S )	z~Build SSE wire-format bytes from **pre-serialized** data.

    The result always ends with `\n\n` (the event terminator).
    z: zevent: zdata: zid: zretry: Ú r%   zutf-8)r?   ÚappendÚjoinÚencode)r@   r   r   r   r2   ÚlinesÚlines          r   Úformat_sse_eventrH   ¥   sá   € ð^ €EàÐÜ$ WÓ-ò 	&ˆDØ�L‰L˜2˜d˜V˜Õ%ð	&ð ÐØ�‰�w˜u˜gÐ&Ô'àÐÜ$ XÓ.ò 	*ˆDØ�L‰L˜6 $ ˜Õ)ð	*ð 
€~Ø�‰�t˜B˜4�[Ô!àÐØ�‰�w˜u˜gÐ&Ô'à	‡L�L�ÔØ	‡L�L�ÔØ�9‰9�UÓ×"Ñ" 7Ó+Ð+r   s   : ping

g      .@Ú_PING_INTERVAL)Útypingr   r   Úannotated_docr   Úpydanticr   r   r   r	   Ústarlette.responsesr
   r   Údictr9   r8   r   r'   r*   r-   r/   Úlistr?   r:   ÚbytesrH   ÚKEEPALIVE_COMMENTrI   Úfloatr   r   r   ú<module>rS      sõ  ðß !Ð !å ß FÓ FÝ 1ð
 à˜Ð"Ø˜(Ð#Ø�xÐ Ø#°Ñ2ñ	ñ%Ð �4˜˜S˜‘>ó ô%Ð+ô %ð ˜# ™*ð °#ð ¸#À¹*ó ð*  d¡
ð *¨s°T©zó *ð'�s˜T‘zð ' c¨D¡jó 'ôh�iô hðVG˜Cð G D¨¡Ió Gð 	ð 	ð 	ð 	ð 	òSD,àØˆd‰
Ùðó	
ð	ñðD,ð Øˆd‰
Ùðó	
ð	ñðD,ð$ 	Øˆd‰
Ùðó	
ð	ñ	ð%D,ð4 Øˆd‰
Ùðó	
ð	ñð5D,ðD Øˆd‰
Ùðó	
ð	ñðED,ðT óUD,ðP "Ð ð €�Ô r   