ó
    Ú°›j«  ã                   óò  • % S SK JrJr  S SKJr  S SKJrJrJrJ	r	  S SK
Jr  SSS0SS0SS0SS S	.S
.S.r\\\4   \S'    " S S\5      rS\S-  S\S\S-  4S jrS\S-  S\S-  4S jrS\S-  S\S-  4S jr " S S\5      rS\S\\   4S jrSSSSSS.S\\S-  \" S5      4   S\\S-  \" S5      4   S\\S-  \" S 5      4   S!\\S-  \" S"5      4   S#\\S-  \" S$5      4   S\4S% jjrS&rS'r\\S('   g))é    )Ú	AnnotatedÚAny)ÚDoc)ÚAfterValidatorÚ	BaseModelÚFieldÚmodel_validator)ÚStreamingResponseÚobjectÚtypeÚstringÚinteger)r   Úminimum)ÚdataÚeventÚidÚretry)r   Ú
propertiesÚ_SSE_EVENT_SCHEMAc                   ó   • \ rS rSrSrSrSrg)ÚEventSourceResponseé   aÊ  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-stream© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
media_typeÚ__static_attributes__r   ó    ÚH/home/mande/repo/quber/.venv/lib/python3.13/site-packages/fastapi/sse.pyr   r      s   † ñ
ð %ƒJr!   r   ÚvNÚ
field_nameÚreturnc                 óB   • U b  SU ;   d  SU ;   a  [        SU S35      eU $ )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                 ó   • [        U S5      $ )Nr   )r*   ©r#   s    r"   Ú_check_event_single_liner-   *   s   € Ü˜a Ó)Ð)r!   c                 óB   • U b  SU ;   a  [        S5      e[        U S5      $ )NÚ z)SSE 'id' must not contain null charactersr   )r)   r*   r,   s    r"   Ú_check_id_validr0   .   s&   € Ø�}˜ ›ÜÐDÓEÐEÜ˜a Ó&Ð&r!   c                   óR  • \ rS rSr% SrSr\\\" S5      4   \	S'   Sr
\\S-  \" S5      4   \	S'   Sr\\S-  \" \5      \" S5      4   \	S	'   Sr\\S-  \" \5      \" S
5      4   \	S'   Sr\\S-  \" SS9\" S5      4   \	S'   Sr\\S-  \" S5      4   \	S'   \" SS9SS j5       rSrg)ÚServerSentEventé4   aL  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                 óP   • U R                   b  U R                  b  [        S5      eU $ )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   r4   r)   )Úselfs    r"   Ú_check_data_exclusiveÚ%ServerSentEvent._check_data_exclusive”   s.   € à�9‰9Ñ  T§]¡]Ñ%>Üð;óð ð
 ˆr!   r   )r%   r2   )r   r   r   r   r   r   r   r   r   Ú__annotations__r4   Ústrr   r   r-   r   r0   r   Úintr   r6   r	   r;   r    r   r!   r"   r2   r2   4   sN  ‡ ñð: 	ð 	ˆ)ØÙðó
	
ð	ñó ð6 	ð ˆiØˆd‰
Ùðó
	
ð	ñó ð4 	ð 
ˆ9Øˆd‰
ÙÐ/Ó0Ùðó	
ð
	ñó ð2 	ð ˆ	Øˆd‰
Ù�Ó'Ùðó	
ð
	ñ	ó ð0 	ð 
ˆ9Øˆd‰
Ù�‰Ùðó	
ð		ñó ð. 	ð ˆYØˆd‰
Ùðó	
ð		ñó ñ ˜'Ñ"óó #ór!   r2   Úvaluec                 ód   • U R                  SS5      R                  SS5      R                  S5      $ )Nz
r(   r'   )ÚreplaceÚsplit)r@   s    r"   Ú_split_sse_linesrD   Ÿ   s-   € ð �=‰=˜ Ó&×.Ñ.¨t°TÓ:×@Ñ@ÀÓFÐFr!   )Údata_strr   r   r   r6   rE   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).
            r6   z@
            Optional comment line(s) (`:` prefix).
            c                 ó¸  • / nUb&  [        U5       H  nUR                  SU 35        M     Ub  UR                  SU 35        U b&  [        U 5       H  nUR                  SU 35        M     Ub  UR                  SU 35        Ub  UR                  SU 35        UR                  S5        UR                  S5        SR                  U5      R                  S5      $ )	zvBuild 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)rD   ÚappendÚjoinÚencode)rE   r   r   r   r6   ÚlinesÚlines          r"   Úformat_sse_eventrM   ¥   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   Údictr>   r=   r   r*   r-   r0   r2   ÚlistrD   r?   ÚbytesrM   ÚKEEPALIVE_COMMENTrN   Úfloatr   r!   r"   Ú<module>rX      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!   