§
    =xÅjÕ  ã                   óB   — d Z ddlZddlZddlmZ ddlmZmZ defd„Z	dS )zß
Unified getchar implementation for all platforms.

Combines approaches from:
- Textual (Unix/Linux): Copyright (c) 2023 Textualize Inc., MIT License
- Click (Windows fallback): Copyright 2014 Pallets, BSD-3-Clause License
é    N)Úgetincrementaldecoder)ÚOptionalÚTextIOÚreturnc                  óJ  — t           j        dk    �r	 ddl} n/# t          $ r" t           j                             d¦  «        cY S w xY w| j        } |¦   «         }|dv r| |¦   «         z  }|S |g}d}t          |¦  «        |k     rs|                      ¦   «         r_ |¦   «         }|dv rnP| 	                    |¦  «         |dk    rt          ¦   «         ‚t          |¦  «        |k     r|                      ¦   «         °_d                     |¦  «        }d|v rt          ¦   «         ‚|S ddl}ddl}d}	t           j                             ¦   «         sH	 t          d	¦  «        }	n"# t           $ r}
t#          d
¦  «        |
‚d}
~
ww xY w|	                     ¦   «         }nt           j                             ¦   «         }	 |                     |¦  «        }	 |                     |¦  «        }||j        xx         |j        |j        z  |j        z  |j        z   z  cc<   ||j        xx         |j        |j        z  |j        z  |j        z  |j        z   z  cc<   d||j                 |j         <   | !                    ||j"        |¦  «         tG          j        |d¦  «        } tI          d¦  «        ¦   «         }| %                    |d¬¦  «        }d|v rt          ¦   «         ‚|| !                    ||j"        |¦  «         t           j&         '                    ¦   «          |	�|	 (                    ¦   «          S S # | !                    ||j"        |¦  «         t           j&         '                    ¦   «          |	�|	 (                    ¦   «          w w xY w# |j)        $ r" t           j                             d¦  «        cY S w xY w)a^  
    Read input from stdin with support for longer pasted text.

    On Windows:
    - Uses msvcrt for native Windows console input
    - Handles special keys that send two-byte sequences
    - Reads up to 4096 characters for paste support

    On Unix/Linux:
    - Uses Textual's approach with manual termios configuration
    - Reads up to 4096 bytes with proper UTF-8 decoding
    - Provides fine-grained terminal control

    Returns:
        str: The input character(s) read from stdin

    Raises:
        EOFError: When no terminal is available
        KeyboardInterrupt: When CTRL+C is pressed
    Úwin32r   Né   )ú õ   Ã i   úÚ z/dev/ttyz.No terminal is available for interactive inputzutf-8T)Úfinal)*ÚsysÚplatformÚmsvcrtÚImportErrorÚstdinÚreadÚgetwchÚlenÚkbhitÚappendÚKeyboardInterruptÚjoinÚtermiosÚttyÚisattyÚopenÚOSErrorÚEOFErrorÚfilenoÚ	tcgetattrÚLFLAGÚECHOÚICANONÚIEXTENÚISIGÚIFLAGÚIXONÚIXOFFÚICRNLÚINLCRÚIGNCRÚCCÚVMINÚ	tcsetattrÚTCSANOWÚosr   ÚdecodeÚstdoutÚflushÚcloseÚerror)r   ÚfuncÚrvÚcharsÚ	max_charsÚ	next_charÚresultr   r   Úfr7   ÚfdÚattrs_beforeÚnewattrÚraw_dataÚdecoders                   úFC:\Projects\Historical\venv\Lib\site-packages\rich_toolkit/_getchar.pyÚgetcharrE      s  € õ* „|�wÒÑð	%ØˆMˆMˆMˆMøÝð 	%ð 	%ð 	%å”9—>’> !Ñ$Ô$Ð$Ð$Ð$ð	%øøøð
 Œ}ˆð ˆT‰VŒVˆð Ð!Ð!Ð!à�$�$‘&”&‰LˆBØˆIð �ˆØˆ	õ �%‰jŒj˜9Ò$Ð$¨¯ª©¬Ð$Ø˜™œˆIð Ð,Ð,Ð,àà�LŠL˜Ñ#Ô#Ð#ð ˜FÒ"Ð"Ý'Ñ)Ô)Ð)õ �%‰jŒj˜9Ò$Ð$¨¯ª©¬Ð$ð —’˜‘”ˆð �VÐÐÝ#Ñ%Ô%Ð%àˆð 	ˆˆˆØˆ
ˆ
ˆ
à"ˆõ Œy×ÒÑ!Ô!ð 		$ðÝ˜Ñ$Ô$��øÝð ð ð ÝØDñô àðøøøøðøøøð —’‘”ˆBˆBå”×!Ò!Ñ#Ô#ˆBð<	%à"×,Ò,¨RÑ0Ô0ˆLð4à!×+Ò+¨BÑ/Ô/�ð ˜œ	Ð"Ð"Ô"Ø”L 7¤>Ñ1°G´NÑBÀWÄ\ÑQð'ñ Ð"Ð"Ñ"ð ˜œ	Ð"Ð"Ô"Ø”LØ”mñ$à”mñ$ð ”mñ$ð ”mñ	$ð'ñ Ð"Ð"Ñ"ð 12�˜œ” ¤Ñ-ð ×!Ò! " g¤o°wÑ?Ô?Ð?õ œ7 2 xÑ0Ô0�ð 9Õ/°Ñ8Ô8Ñ:Ô:�Ø Ÿš¨¸˜Ñ=Ô=�ð ˜VÐ#Ð#Ý+Ñ-Ô-Ð-àð ×!Ò! " g¤o°|ÑDÔDÐDÝ”
× Ò Ñ"Ô"Ð"à�=Ø—G’G‘I”I�I�Ið !øð ×!Ò! " g¤o°|ÑDÔDÐDÝ”
× Ò Ñ"Ô"Ð"à�=Ø—G’G‘I”I�I�Ið !øøøøð Œ}ð 	%ð 	%ð 	%å”9—>’> !Ñ$Ô$Ð$Ð$Ð$ð	%øøøsT   “ ˜)AÁAÅE Å
E7Å"E2Å2E7Æ.M6 ÇD
L  ËAM6 Ì AM3Í3M6 Í6)N"Î!N")
Ú__doc__r2   r   Úcodecsr   Útypingr   r   ÚstrrE   © ó    rD   ú<module>rL      sy   ððð ð 
€	€	€	Ø 
€
€
€
Ø (Ð (Ð (Ð (Ð (Ð (Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #ðT%�ð T%ð T%ð T%ð T%ð T%ð T%rK   