
    Ki                     `    S SK JrJr  SSKJr  S\S\\   4S jr " S S5      r " S	 S
5      rg)    )ListOptional   )ServerSentEventtextreturnc                     U (       d  / $ SU ;  a  U R                  S5      nO3U R                  SS5      R                  SS5      nUR                  S5      nU S   S;   a  UR                  5         U$ )zSplit text on 
, , or 
 only.
z
)splitreplacepop)r   lines
normalizeds      U/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/httpx_sse/_decoders.py_splitlines_sser      sg    	4

4 \\&$/77dC
  &Bx6		L    c                   N    \ rS rSrSrS
S jrS\S\\   4S jrS\\   4S jr	S	r
g)SSELineDecoder   a  
    Handles incrementally reading lines from text.

    Mostly a copy of httpx._decoders.LineDecoder, but as per SSE spec, only 
, ,
    and 
 are treated as newlines, which differs from the behavior of splitlines()
    used by httpx._decoders.LineDecoder.
    r   Nc                      / U l         SU l        g )NFbuffertrailing_crselfs    r   __init__SSELineDecoder.__init__    s    !#!&r   r   c                    U R                   (       a  SU-   nSU l         UR                  S5      (       a  SU l         US S nU(       d  / $ US   S;   n[        U5      n[        U5      S:X  a'  U(       d   U R                  R                  US   5        / $ U R                  (       a/  SR                  U R                  5      US   -   /USS  -   n/ U l        U(       d  UR                  5       /U l        U$ )	Nr
   FTr   z
r   r    )r   endswithr   lenr   appendjoinr   )r   r   trailing_newliner   s       r   decodeSSELineDecoder.decode$   s    $;D$D==#D9D I8v-%u:?#3KKuQx(I;; WWT[[)E!H45ab	AEDK !99;-DKr   c                     U R                   (       d  U R                  (       d  / $ SR                  U R                   5      /n/ U l         SU l        U$ )Nr!   F)r   r   r%   )r   r   s     r   flushSSELineDecoder.flushG   s?    {{4#3#3I%& r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   strlistr'   r*   __static_attributes__ r   r   r   r      s4    '!3 !49 !FtCy r   r   c                   6    \ rS rSrSS jrS\S\\   4S jrSr	g)	
SSEDecoderQ   r   Nc                 <    SU l         / U l        SU l        S U l        g )Nr!   )_event_data_last_event_id_retryr   s    r   r   SSEDecoder.__init__R   s     "
 %)r   linec                    U(       d  U R                   (       d0  U R                  (       d  U R                  (       d  U R                  c  g [	        U R                   SR                  U R                  5      U R                  U R                  S9nSU l         / U l        S U l        U$ UR                  S5      (       a  g UR                  S5      u  p4nUR                  S5      (       a  USS  nUS:X  a  XPl         g US:X  a  U R                  R                  U5        g US	:X  a  S
U;   a   g XPl         g US:X  a   [        U5      U l        g  g ! [        [        4 a     g f = f)Nr   )eventdataidretryr!   : r   rA   rB   rC    rD   )r:   r;   r<   r=   r   r%   
startswith	partitionr$   int	TypeError
ValueError)r   r?   sse	fieldname_values         r   r'   SSEDecoder.decodeX   sW    KK

++KK'!kkYYtzz*&&kk	C DKDJDKJ??3"nnS1	eC  !"IEK   & JJe$  $u}  ',#  '!!%j   z*  s   5E EE)r;   r:   r<   r=   r,   )
r-   r.   r/   r0   r   r2   r   r   r'   r4   r5   r   r   r7   r7   Q   s    *33 38O#< 3r   r7   N)	typingr   r   _modelsr   r2   r   r   r7   r5   r   r   <module>rT      s7    ! $# $s) "7 7t: :r   