+
    Di](                       ^ RI Ht ^ RIHtHtHtHtHtHt ^ RI	H
t
Ht ^ RIt^ RIHt ^ RIHtHt ^ RIHt ^ RIHtHtHtHtHt ]].]],          3,          t]]].]],          3,          t]]]]]
3,          ,          R3,          t]]],          ],          ]]]
3,          ,          ,          t ]! R	4      t! ! R
 R]4      t" ! R R4      t# ! R R]4      t$R# )    )annotations)AsyncGeneratorAsyncIterable	AwaitableCallableMappingMutableMapping)AnyTypeVarN)collapse_excgroups)ClientDisconnectRequest)Response)ASGIAppMessageReceiveScopeSendTc                  >   a  ] tR t^tRtR V 3R lltR R ltRtV ;t# )_CachedRequesta  
If the user calls Request.body() from their dispatch function
we cache the entire request body in memory and pass that to downstream middlewares,
but if they call Request.stream() then all we do is send an
empty body so that downstream things don't hang forever.
c                    V ^8  d   QhRRRR/# )   scoper   receiver    )formats   "w/Users/tonyclaw/.openclaw/workspace/services/omi-webhook/venv/lib/python3.14/site-packages/starlette/middleware/base.py__annotate___CachedRequest.__annotate__   s     0 0e 0g 0    c                	l   < \         SV `  W4       R V n        R V n        V P	                  4       V n        R# )FN)super__init___wrapped_rcv_disconnected_wrapped_rcv_consumedstream_wrapped_rc_stream)selfr   r   	__class__s   &&&r   r$   _CachedRequest.__init__   s.    ().&%*""&++-r!   c                   V ^8  d   QhRR/# r   returnr   r   )r   s   "r   r   r    "   s     ;3 ;3w ;3r!   c                	  "   V P                   '       d   R R/# V P                  '       db   V P                  '       d   RV n         R R/# V P                  4       G Rj  xL
 pVR ,          R8w  d   \	        RVR ,           24      hRV n         V# \        V RR4      e   RV n        R RRV P                  RR	/# V P                  '       d   RV n        R RRR
RR	/#  V P                  4       pVP                  4       G Rj  xL
 pV P                  V n        R RRVRV P                  '       * /#  L L.  \         d    RT n         R R/u # i ; i5i)typehttp.disconnectTNzUnexpected message received: _bodyzhttp.requestbody	more_bodyFr!   )r%   r&   _is_disconnectedr   RuntimeErrorgetattrr2   _stream_consumedr'   	__anext__r   )r)   msgr'   chunks   &   r   wrapped_receive_CachedRequest.wrapped_receive"   sy    ))) -..%%% $$$ 26. 122 &C6{// #%B3v;-#PQQ-1D*J 4$'3)-D&

U 
 """ *.D&U 3$..00-1-B-B*NET%:%:!: C '> 1 $ 315. 1223sX   (EEED&A)EE#D* 9D(:+D* %E(D* *E EEE)r(   r&   r%   )	__name__
__module____qualname____firstlineno____doc__r$   r<   __static_attributes____classcell__)r*   s   @r   r   r      s    0 0;3 ;3r!   r   c                  >    ] tR t^`tR	R R lltR R ltR R ltRtR# )
BaseHTTPMiddlewareNc               $    V ^8  d   QhRRRRRR/# )r   appr   dispatchzDispatchFunction | Noner.   Noner   )r   s   "r   r   BaseHTTPMiddleware.__annotate__a   s(     M MG M/F MRV Mr!   c                	N    Wn         Vf   V P                  V n        R # TV n        R # N)rH   rI   dispatch_func)r)   rH   rI   s   &&&r   r$   BaseHTTPMiddleware.__init__a   s    .6.>T]]Hr!   c               (    V ^8  d   QhRRRRRRRR/# 	r   r   r   r   r   sendr   r.   rJ   r   )r   s   "r   r   rK   e   s.     a aE aG a4 aD ar!   c                	  a aaa	a
aaaa"   SR ,          R8w  d   S P                  SW#4      G Rj  xL
  R# \        SV4      pVP                  o\        P                  ! 4       oRoRo	R VV	V
VVV VVV3	R llp\        P
                  ! 4       pVw  oo
S
;_uu_ 4        S;_uu_ 4        \        4       ;_uu_ 4        \        P                  ! 4       ;_uu_4       GRj  xL
 oS P                  WE4      G Rj  xL
 pV! SSV4      G Rj  xL
  SP                  4        S
P                  4        RRR4      GRj  xL
  RRR4       RRR4       RRR4       Se   S	'       g   ShR# R#  EL7 L Lu Le L7  + GRj  xL 
 '       g   i     LN; i  + '       g   i     LY; i  + '       g   i     Ld; i  + '       g   i     Lo; i5i)r0   httpNFc                    V ^8  d   QhRRRR/# )r   requestr   r.   r   r   )r   s   "r   r   1BaseHTTPMiddleware.__call__.<locals>.__annotate__p   s     K	 K	W K	 K	r!   c                B  <	aa"   R  VV3R lloR V3R lloR VVVVVV3R llpSP                  V4        S
P                  4       G Rj  xL
 pVP                  RR4      pVR,          R	8X  d   Ve   S
P                  4       G Rj  xL
 pTR,          R8X  g   Q hR T
3R llp\        TR,          T! 4       TR7      pTR,          Tn	        T#  L LI  \        P                   d4    Se$   R
o	SSP
                  ;'       g    SP                  h\        R4      hi ; i5i)c                   V ^8  d   QhRR/# r-   r   )r   s   "r   r   DBaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.__annotate__q   s       r!   c                   <a"   SP                  4       '       d   R R/# \        P                  ! 4       ;_uu_4       GRj  xL
 oR V3R llp SP                  V SP                  4       V ! S4      G Rj  xL
 pRRR4      GRj  xL
  SP                  4       '       d   R R/# X#  Le L2 L$  + GRj  xL 
 '       g   i     L;; i5i)r0   r1   Nc                    V ^8  d   QhRRRR/# )r   funczCallable[[], Awaitable[T]]r.   r   r   )r   s   "r   r   cBaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect.<locals>.__annotate__w   s     & &)C & &r!   c                f   <"   V ! 4       G R j  xL
 pSP                   P                  4        V#  L 5irM   )cancel_scopecancel)r]   result
task_groups   & r   wrap[BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect.<locals>.wrapw   s+     '+v"//668% ".s   1/!1)is_setanyiocreate_task_group
start_soonwait)rd   messagerc   response_sentr<   s     @r   receive_or_disconnectMBaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnectq   s      ''))"$566 22444
& &
 ))$0B0BC$($99G 54 !''))"$566 5 : 5444se   <C B&C1B,5B(6B,:CB*C C(B,*C,C	2B53
C	>C	 Cc                    V ^8  d   QhRRRR/# )r   rk   r   r.   rJ   r   )r   s   "r   r   rZ      s      W  r!   c                   <"    SP                  V 4      G R j  xL
  R #  L  \        P                   d     R # i ; i5irM   )rR   rg   BrokenResourceError)rk   send_streams   &r   send_no_errorEBaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error   s6     %**733300 s(   >"  " >" ;>;>c                   V ^8  d   QhRR/# )r   r.   rJ   r   )r   s   "r   r   rZ      s     & & &r!   c                    <"   S;_uu_ 4         SP                  SSS4      G R j  xL
  R R R 4       R #  L  \         d   p T o R p ? LR p ? ii ; i  + '       g   i     R # ; i5irM   )rH   	Exception)excapp_excrm   r   r)   rs   rr   s    r   coro<BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.coro   sQ      ![&"hhu.C]SSS ![S$ &"%& ![[sH   A%A757
A%7AA	A	AAA"		A%Ninfor0   http.response.debugTzNo response returned.http.response.startc                   V ^8  d   QhRR/# )r   r.   BodyStreamGeneratorr   )r   s   "r   r   rZ      s     
 
': 
r!   c                  <"   S  R j  xL
  p V R,          R8X  d	   V 5x   R # V R,          R8X  g   Q RV  24       hV P                  RR4      pV'       d   V5x  V P                  RR4      '       d   Kq   R #  LoDpR # 5i)	Nr0   zhttp.response.pathsendhttp.response.bodyzUnexpected message: r3   r!   r4   F)get)rk   r3   recv_streams     r   body_streamCBaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.body_stream   s     %0 	 	'v*BB%"6?.BBdFZ[bZcDddB";;vs3D"
";;{E::	[s2   A?A<A:A<A	A?A?7A?:A<<A?status)status_codecontentr|   headers)
ri   r   r   rg   EndOfStream	__cause____context__r6   _StreamingResponseraw_headers)rV   rz   rk   r|   r   responserm   rs   ry   exception_already_raisedr   rl   r   r)   rr   rc   r<   s   &     @@r   	call_next.BaseHTTPMiddleware.__call__.<locals>.call_nextp   s     & & & !!$'< + 3 3 55{{6406?&;;@P$/$7$7$99G" 6?&;;;;
 
 *gh6GQ\Q^eijH#*9#5H OI 6 :$$ <&/3, "w'8'8'O'OG<O<OO"#:;;<sG   3DC C;C C	C ADC C .DDD)rH   r   r<   rg   Eventcreate_memory_object_streamr   rh   rN   setclose)r)   r   r   rR   rV   r   streamsr   ry   r   r   rl   rr   rc   r<   s   ff&&    @@@@@@@r   __call__BaseHTTPMiddleware.__call__e   sE    =F"((5'000 0!11$(#( K	 K	 K	Z ?D>_>_>a#* [[++'9';';..000J!%!3!3G!GGuot<<<!!#!!#	 10 (<+[ '?M (@} 1r 1G< 1000 (<';++[[s   $GE&A,GF3'F 	:"FE)F E15E+6E1E-$E1,F7E/8F<F 	F3G G)F+E1-E1/F1F
7E:8
F
F
FFF 	 F0+F33G	>Gc               $    V ^8  d   QhRRRRRR/# )r   rV   r   r   RequestResponseEndpointr.   r   r   )r   s   "r   r   rK      s#     $ $g $:Q $V^ $r!   c                	   "   \        4       h5irM   )NotImplementedError)r)   rV   r   s   &&&r   rI   BaseHTTPMiddleware.dispatch   s     !##s   )rH   rN   rM   )r>   r?   r@   rA   r$   r   rI   rC   r   r!   r   rF   rF   `   s    MaF$ $r!   rF   c                  2    ] tR t^tRR R lltR R ltRtR# )r   Nc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r   r   AsyncContentStreamr   intr   zMapping[str, str] | None
media_typez
str | Noner|   zMapping[str, Any] | Noner.   rJ   r   )r   s   "r   r   _StreamingResponse.__annotate__   sF      #  *	
  ' 
r!   c                	f    WPn         Wn        W n        W@n        V P	                  V4       R V n        R # rM   )r|   body_iteratorr   r   init_headers
background)r)   r   r   r   r   r|   s   &&&&&&r   r$   _StreamingResponse.__init__   s/     	$&$'"r!   c               (    V ^8  d   QhRRRRRRRR/# rQ   r   )r   s   "r   r   r      s(     $ $E $G $4 $D $r!   c           	     	  "   V P                   e   V! RRRV P                   /4      G R j  xL
  V! RRRV P                  RV P                  /4      G R j  xL
  RpV P                    R j  xL
  p\	        V\
        4      '       d   RpV! V4      G R j  xL
  K4  V! RR	R
VRR/4      G R j  xL
  KL   L L` LK L$ LDPT'       d   T! RR	R
RRR/4      G R j  xL 
  T P                  '       d   T P                  4       G R j  xL 
  R # R # 5i)Nr0   r}   r|   r~   r   r   TFr   r3   r4   r!   )r|   r   r   r   
isinstancedictr   )r)   r   r   rR   should_close_bodyr;   s   &&&&  r   r   _StreamingResponse.__call__   s    99  5vtyyIJJJ-$**4++
 	
 	
 !-- 	Y 	Y%%&&$)!5k!! 4fe[RVWXXX! K	
	Y "X .  4fc;PUVWWW???//### s   (DB3)DB5D'B=+B7,B=/%DB9D,B;-D5D7B=9D;D=DDCD/DD	D)r   r   r|   r   r   )   NNN)r>   r?   r@   rA   r$   r   rC   r   r!   r   r   r      s    $ $r!   r   )%
__future__r   collections.abcr   r   r   r   r   r	   typingr
   r   rg   starlette._utilsr   starlette.requestsr   r   starlette.responsesr   starlette.typesr   r   r   r   r   r   DispatchFunctionbytesstrr   
memoryviewr   r   r   rF   r   r   r!   r   <module>r      s    " g g   / 8 ( B B"G9i.A#AB W&=>	(@SST $U^CH-E%Et%KL "3;#;nSRUX>V#VW CLI3W I3Xi$ i$X($ ($r!   