+
    iY2                      a  0 t $ ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
Ht ^ RIHt ^RIHtHt ^RIHt  ^RIHt . R"Ot ! R R]P.                  4      t]P2                  t]P6                  t]P:                  t]P>                  t ]PB                  t"]PF                  t$]]]3t%] ]"]$3t& ! R R	]P.                  4      t']'PP                  R]'PR                  R]'PT                  R]'PV                  R]'PX                  R]'PZ                  R]'P\                  R]'P^                  R]'P`                  R]'Pb                  R]'Pd                  R]'Pf                  R]'Ph                  R]'Pj                  R]'Pl                  R/t7R]8R&   ]'PP                  ]'PR                  ]'PT                  ]'PV                  ]'P\                  ]'P^                  ]'P`                  ]'Pb                  ]'Pd                  ]'Pf                  ]'Ph                  ]'Pj                  0t9]'PP                  ]'PR                  ]'PX                  0t:]Pv                   ! R R
4      4       t<]Pv                   ! R  R4      4       t=^R!I>H?t? R#   ] d    ^RIHt  EL.i ; i)#    )annotationsN)	GeneratorSequence)Callable)PayloadTooBigProtocolError)	BytesLike)
apply_maskOpcode	CloseCodeFrameClosec                  6    ] tR t^&tRt^ ^^uttt^^	^
utt	t
RtR# )r   z#Opcode values for WebSocket frames. N)__name__
__module____qualname____firstlineno____doc__CONTTEXTBINARYCLOSEPINGPONG__static_attributes__r       X/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/websockets/frames.pyr   r   &   s%    -tTD$dDE4r   c                  V    ] tR t^8tRtRtRtRtRtRt	Rt
RtR	tR
tRtRtRtRtRtRtRtR# )r   z-Close code values for WebSocket close frames.i  i  i  i  i  i  i  i  i  i  i  i  i  i  i  r   N)r   r   r   r   r   NORMAL_CLOSURE
GOING_AWAYPROTOCOL_ERRORUNSUPPORTED_DATANO_STATUS_RCVDABNORMAL_CLOSUREINVALID_DATAPOLICY_VIOLATIONMESSAGE_TOO_BIGMANDATORY_EXTENSIONINTERNAL_ERRORSERVICE_RESTARTTRY_AGAIN_LATERBAD_GATEWAYTLS_HANDSHAKEr   r   r   r   r   r   8   sT    7NJNNLONOOKMr   OKz
going awayzprotocol errorzunsupported datazno status received [internal]zabnormal closure [internal]zinvalid frame payload datazpolicy violationzmessage too bigzmandatory extensionzinternal errorzservice restartztry again laterzbad gatewayz TLS handshake failure [internal]zdict[int, str]CLOSE_CODE_EXPLANATIONSc                      ] tR t^zt$ RtR]R&   R]R&   RtR]R&   R	tR]R
&   R	tR]R&   R	t	R]R&   ]
! ]P                  P                  RR4      4      tR R lt]RRRR/R R ll4       tRR/R R lltR R ltRtR# )r   a"  
WebSocket frame.

Attributes:
    opcode: Opcode.
    data: Payload data.
    fin: FIN bit.
    rsv1: RSV1 bit.
    rsv2: RSV2 bit.
    rsv3: RSV3 bit.

Only these fields are needed. The MASK bit, payload length and masking-key
are handled on the fly when parsing and serializing frames.

r   opcoder	   dataTboolfinFrsv1rsv2rsv3WEBSOCKETS_MAX_LOG_SIZE75c                   V ^8  d   QhRR/#    returnstrr   )formats   "r   __annotate__Frame.__annotate__   s     09 09 09r   c                   Rp\        V P                  4       R\        V P                  4      ^8X  d   RMR 2pV P                  '       d   RMRpV P                  \        J d/   \        \        V P                  4      P                  4       4      pEMV P                  \        J d   V P                  p\        V4      V P                  ^,          8  dC   V P                  ^,          ^,
          ^,          pRP                  VR^V,           RWV) R .4      pRP                  R	 V 4       4      pMV P                  \        J d*   \        \        P                  V P                  4      4      pMDV P                  '       d1    \        \        V P                  4      P                  4       4      pR
pMRp\        V4      V P                  8  d8   V P                  ^,          ^,
          pVR^V,           R,           WF) R ,           pRP                  \#        RWV.4      4      pV P                  P$                   RV RV R2#   \        \         3 d    T P                  p\        T4      T P                  ^,          8  dC   T P                  ^,          ^,
          ^,          pRP                  TR^T,           RYV) R .4      pRP                  R T 4       4      pRp EL*i ; i)z5
Return a human-readable representation of a frame.

Nz byte s	continuedr   s      c              3  (   "   T F  qR  x  K
  	  R# 5i02xNr   .0bytes   & r   	<genexpr> Frame.__str__.<locals>.<genexpr>   s     =fdCjMf   textc              3  (   "   T F  qR  x  K
  	  R# 5irI   r   rK   s   & r   rN   rO      s     A&$*&rP   binaryz''z...z, z [])lenr3   r5   r2   OP_TEXTreprbytesdecode	OP_BINARYMAX_LOG_SIZEjoinOP_CLOSEr?   r   parseUnicodeDecodeErrorAttributeErrorfiltername)selfcodinglength	non_finalr3   rS   cutmetadatas   &       r   __str__Frame.__str__   s[   
 		N#5s499~/B(LM(((B	;;'! dii(//12D[[I% YYF6{T..!33((A-1a76)AG#4k6$%="QR88=f==D[[H$u{{499-.DYYY	"E$)),3356 Dt9t(((##q(1,C	!c'?U*T$%[8D99VD69*EFG++""#1TF"XJa88! '7 "v;!2!2a!77,,1A5!;C XXviC'8+vde}&UVFxxA&AA!"s   =.H; ;BKKmax_sizeN
extensionsc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r=   
read_exactz9Callable[[int], Generator[None, None, bytes | bytearray]]maskr4   rk   z
int | Nonerl   %Sequence[extensions.Extension] | Noner>   zGenerator[None, None, Frame]r   )r@   s   "r   rA   rB      sC     G GMG 	G
 G :G 
&Gr   c             #    "   V! ^4       Rj  xL
 p\         P                  ! RV4      w  rgV^,          '       d   RMRpV^@,          '       d   RMRp	V^ ,          '       d   RMRp
V^,          '       d   RMRp \        V^,          4      pT^,          '       d   RMRT8w  d   \	        R4      hT^,          pT^~8X  d+   T! ^4       Rj  xL
 p\         P                  ! RT4      w  pM0T^8X  d*   T! ^4       Rj  xL
 p\         P                  ! RT4      w  pTe   Y8  d   \        Y4      hT'       d   T! ^4       Rj  xL
 pT! T4       Rj  xL
 pT'       d   \        TX4      pT ! YYY4      pTf   . p\        T4       F  pTP                  TTR	7      pK  	  TP                  4        T#  EL  \         d   p\	        R4      ThRp?ii ; i EL	 L L L5i)
aq  
Parse a WebSocket frame.

This is a generator-based coroutine.

Args:
    read_exact: Generator-based coroutine that reads the requested
        bytes or raises an exception if there isn't enough data.
    mask: Whether the frame should be masked i.e. whether the read
        happens on the server side.
    max_size: Maximum payload size in bytes.
    extensions: List of extensions, applied in reverse order.

Raises:
    EOFError: If the connection is closed without a full WebSocket frame.
    PayloadTooBig: If the frame's payload size exceeds ``max_size``.
    ProtocolError: If the frame contains incorrect values.

N!BBTFzinvalid opcodezincorrect masking!Hz!Q)rk   )
structunpackr   
ValueErrorr   r   r
   reversedrY   check)clsrn   ro   rk   rl   r3   head1head2r5   r6   r7   r8   r2   excre   
mask_bytesframe	extensions   &&$$$             r   r^   Frame.parse   s    : %Q-'}}UD1 j((dez))tuz))tuz))tu	;EJ./F J&&DEd: 344#S=(m+DdD1IVs](m+DdD1IVF$511$.qM1J %V,,dJ/DF#T8J!*-I$$UX$>E . 	W (  	; 01s:	; , ,
 2 -s   GF0>GG!G4G9F3 G/G	G
0G:G;9G5G GGGGAG3G>G

GGGGGc               $    V ^8  d   QhRRRRRR/# )r=   ro   r4   rl   rp   r>   rX   r   )r@   s   "r   rA   rB     s*     :! :! :! :	:!
 
:!r   c                  V P                  4        Vf   . pV F  pVP                  V 4      p K  	  \        P                  ! 4       pV P                  '       d   ^M^ V P
                  '       d   ^@M^ ,          V P                  '       d   ^ M^ ,          V P                  '       d   ^M^ ,          V P                  ,          pV'       d   ^M^ p\        V P                  4      pV^~8  d/   VP                  \        P                  ! RWVV,          4      4       MdVR8  d0   VP                  \        P                  ! RWV^~,          V4      4       M.VP                  \        P                  ! RWV^,          V4      4       V'       d(   \        P                  ! ^4      pVP                  V4       V'       d   \!        V P                  X4      p	MV P                  p	VP                  V	4       VP#                  4       # )a  
Serialize a WebSocket frame.

Args:
    mask: Whether the frame should be masked i.e. whether the write
        happens on the client side.
    extensions: List of extensions, applied in order.

Raises:
    ProtocolError: If the frame contains incorrect values.

rr   i   z!BBHz!BBQ)rx   encodeioBytesIOr5   r6   r7   r8   r2   rU   r3   writert   packsecretstoken_bytesr
   getvalue)
rc   ro   rl   r   outputrz   r{   re   r}   r3   s
   &$$       r   	serializeFrame.serialize  sj   $ 	

J#I##D)D $   888Z!YYYzA/!YYYzA/ "YYYzA/ kk	 	 #
TYYC<LLUE6>BCe^LLVUCKHILLVUCKHI ,,Q/JLL$ dii4D99DT  r   c                   V ^8  d   QhRR/# r=   r>   Noner   )r@   s   "r   rA   rB   N  s     @ @t @r   c                :   V P                   '       g%   V P                  '       g   V P                  '       d   \        R4      hV P                  \
        9   dE   \        V P                  4      ^}8  d   \        R4      hV P                  '       g   \        R4      hR# R# )z
Check that reserved bits and opcode have acceptable values.

Raises:
    ProtocolError: If a reserved bit or the opcode is invalid.

zreserved bits must be 0zcontrol frame too longzfragmented control frameN)	r6   r7   r8   r   r2   CTRL_OPCODESrU   r3   r5   rc   s   &r   rx   Frame.checkN  sp     999			TYYY 9::;;,&499~##$<==888#$>??  'r   r   )r   r   r   r   r   __annotations__r5   r6   r7   r8   intosenvirongetr[   ri   classmethodr^   r   rx   r   r   r   r   r   r   z   s      N
OCD$D$D$ rzz~~&?FGL09d G
  $G =AG GR:! =A	:!x@ @r   c                  j    ] tR tRt$ RtR]R&   R]R&   R R lt]R	 R
 l4       tR R lt	R R lt
RtR# )r   i`  zk
Code and reason for WebSocket close frames.

Attributes:
    code: Close code.
    reason: Close reason.

zCloseCode | intcoder?   reasonc                   V ^8  d   QhRR/# r<   r   )r@   s   "r   rA   Close.__annotate__n  s       r   c                ,   RV P                   u;8:  d   R8  d   M MRpM?RV P                   u;8:  d   R8  d   M MRpM \        P                  V P                   R4      pV P                    RV R2pV P                  '       d   V R	V P                   2pV# )
zE
Return a human-readable representation of a close code and reason.

  i  
registered  zprivate useunknownz ()rG   )r   r0   r   r   )rc   explanationresults   &  r   ri   Close.__str__n  s~    
 499#t#&KTYY%%'K155diiKKII;bQ/;;;xq.Fr   c                    V ^8  d   QhRRRR/# )r=   r3   r	   r>   r   r   )r@   s   "r   rA   r     s     9 9 9u 9r   c                j   \        V\        4      '       d   \        R4      h\        V4      ^8  dR   \        P
                  ! RVR,          4      w  pVR,          P                  4       pV ! W#4      pVP                  4        V# \        V4      ^ 8X  d   V ! \        P                  R4      # \        R4      h)z
Parse the payload of a close frame.

Args:
    data: Payload of the close frame.

Raises:
    ProtocolError: If data is ill-formed.
    UnicodeDecodeError: If the reason isn't valid UTF-8.

z.only compressed outgoing frames use memoryviewrs   :Nr=   N:r=   NNrD   zclose frame too short)
isinstance
memoryviewAssertionErrorrU   rt   ru   rY   rx   r   r$   r   )ry   r3   r   r   closes   &&   r   r^   Close.parse  s     dJ'' !QRRt9>mmD$r(3GT"X__&F%EKKMLY!^y//44 788r   c                   V ^8  d   QhRR/# )r=   r>   rX   r   )r@   s   "r   rA   r     s     C C5 Cr   c                    V P                  4        \        P                  ! RV P                  4      V P                  P                  4       ,           # )z*
Serialize the payload of a close frame.

rs   )rx   rt   r   r   r   r   r   s   &r   r   Close.serialize  s4    
 	

{{4+dkk.@.@.BBBr   c                   V ^8  d   QhRR/# r   r   )r@   s   "r   rA   r     s     	7 	7t 	7r   c                    V P                   \        9   g)   RV P                   u;8:  d   R8  g   M \        R4      hR# R# )z{
Check that the close code has a valid value for a close frame.

Raises:
    ProtocolError: If the close code is invalid.

r   r   zinvalid status codeN)r   EXTERNAL_CLOSE_CODESr   r   s   &r   rx   Close.check  s6     		11TTYY5M5M 566 6N1r   r   N)r   r   r   r   r   r   ri   r   r^   r   rx   r   r   r   r   r   r   `  s=     K$ 9 92C	7 	7r   )rl   )r   OP_CONTrV   rZ   r]   OP_PINGOP_PONGDATA_OPCODESr   r   r   r   )@__conditional_annotations__
__future__r   dataclassesenumr   r   r   rt   collections.abcr   r   typingr   
exceptionsr   r   r	   speedupsr
   ImportErrorutils__all__IntEnumr   r   r   r   rV   r   rZ   r   r]   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r0   r   r   OK_CLOSE_CODES	dataclassr   r   rD   rl   )r   s   @r   <module>r      sk   " "   	 	   /  4 "$
 )T\\ ) ++
++MM	<<
++
++*') . d,. 2= =8 20!!#8.00=?+  , !! "  b@ b@ b@J J7 J7 J7\ {  "!!"s    I$ $I54I5