ó
    F\hý  ã                   óL   • S r SSKJr  SSKJr  SSKJr  SSKJr   " S S5      rg	)
zv
OS-independent base for an event and VT sequence scanner

See unix_eventqueue and windows_eventqueue for subclasses.
é    )Údequeé   )Úkeymap)ÚEvent)Útracec                   óŽ   • \ rS rSrS\S\\\4   SS4S jrS\S-  4S jr	S\
4S jrS\4S	 jrS
\SS4S jrS\\-  SS4S jrSrg)ÚBaseEventQueueé!   ÚencodingÚkeymap_dictÚreturnNc                 óÌ   • [         R                  " U5      U l        U R                  U l         [        SU R                   S9  Xl        [        5       U l        [        5       U l        g )Nzkeymap {k!r}©Úk)	r   Úcompile_keymapÚcompiled_keymapr   r   r   ÚeventsÚ	bytearrayÚbuf)Úselfr   r   s      Ú./usr/lib/python3.13/_pyrepl/base_eventqueue.pyÚ__init__ÚBaseEventQueue.__init__"   sG   € Ü%×4Ò4°[ÓAˆÔØ×*Ñ*ˆŒÜˆn §¡Ò,Ø ŒÜ$)£GˆŒÜ“;ˆ�ó    c                 óZ   • U R                   (       a  U R                   R                  5       $ g)z*
Retrieves the next event from the queue.
N)r   Úpopleft©r   s    r   ÚgetÚBaseEventQueue.get*   s!   € ð �;�;Ø—;‘;×&Ñ&Ó(Ð(àr   c                 ó$   • U R                   (       + $ )z
Checks if the queue is empty.
)r   r   s    r   ÚemptyÚBaseEventQueue.empty3   s   € ð —;‘;ŒÐr   c                 ó<   • U R                   n[        5       U l         U$ )z.
Flushes the buffer and returns its contents.
)r   r   )r   Úolds     r   Ú	flush_bufÚBaseEventQueue.flush_buf9   s   € ð �h‰hˆÜ“;ˆŒØˆ
r   Úeventc                 óN   • [        SUS9  U R                  R                  U5        g)z"
Inserts an event into the queue.
zadded event {event})r'   N)r   r   Úappend)r   r'   s     r   ÚinsertÚBaseEventQueue.insertA   s!   € ô 	Ð#¨5Ò1Ø�‰×Ñ˜5Õ!r   Úcharc           	      óR  • [        U[        [        45      (       d   e[        U[        5      (       a  UO
[        U5      nUR	                  5       nU R
                  R                  U5        XR                  ;   a¤  U R                  U R                  L a  [        U R
                  5      S:X  d   eU R                  U   n[        SUS9  [        U[        5      (       a  X0l        g
U R                  [        SX0R                  5       5      5        U R                  U l        g
U R
                  (       a€  U R
                  S   S:X  am  [        S5        U R                  U l        U R                  [        SS[        S	5      5      5        U R                  5       SS
  H  nU R!                  U5        M     g
 [        U R
                  5      R#                  U R$                  5      nU R                  [        SXPR                  5       5      5        U R                  U l        g
! [&         a     g
f = f)zQ
Processes a character by updating the buffer and handling special key mappings.
r   zfound map {k!r}r   Úkeyr   é   z,unrecognized escape sequence, propagating...Úó   N)Ú
isinstanceÚintÚbytesÚordÚto_bytesr   r)   r   r   Úlenr   Údictr*   r   r%   r   ÚpushÚdecoder   ÚUnicodeError)r   r,   Úord_charr   Ú_cÚdecodeds         r   r9   ÚBaseEventQueue.pushH   sž  € ô ˜$¤¤e ×-Ñ-Ð-Ð-Ü% d¬C×0Ñ0‘4´c¸$³iˆØ× Ñ Ó"ˆØ�‰�‰˜Ô!à—;‘;ÓØ�{‰{˜d×2Ñ2Ò2ä˜4Ÿ8™8“}¨Ó)Ð)Ð)Ø—‘˜DÑ!ˆAÜÐ# qÒ)Ü˜!œT×"Ñ"Ø•à—‘œE %¨¯N©NÓ,<Ó=Ô>Ø"×2Ñ2�•à�X�X˜$Ÿ(™( 1™+¨Ó+ô Ð@ÔAØ×.Ñ.ˆDŒKØ�K‰Kœ˜e V¬Y°wÓ-?Ó@ÔAØ—n‘nÓ& q rÓ*�Ø—	‘	˜"–ò +ðEÜ §¡›/×0Ñ0°·±Ó?�ð —‘œE %¨·.±.Ó2BÓCÔDØ×.Ñ.ˆD�Køô	  ó Ùðús   Æ0.H È
H&È%H&)r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ústrr8   r4   r   r   r   Úboolr!   r   r%   r*   r3   r9   Ú__static_attributes__© r   r   r	   r	   !   sw   † ð ð °4¸¸s¸
Ñ3Cð Èô ð�U˜T‘\ô ð�tô ð˜9ô ð"˜Eð " dô "ð&/˜˜u™ð &/¨÷ &/r   r	   N)	Ú__doc__Úcollectionsr   Ú r   Úconsoler   r   r	   rG   r   r   Ú<module>rL      s$   ðñ*õ å Ý Ý ÷M/ò M/r   