+
    ~j                         R t ^ RIt^ RIHt ^ RIHt ^ RIHt ]P                  ! R4      t]! ^ 4      t	R t
R tR tR
R	 ltR# )z
pygments.regexopt
~~~~~~~~~~~~~~~~~

An algorithm that generates optimized regexes for matching long lists of
literal strings.

:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
N)escape)groupby)
itemgetterz[\[\^\\\-\]]c                    V '       g   R# \        V 4      p\        V 4      p\        V4       F  w  r4WBV,          8w  g   K  VRV u # 	  V# )zJGiven an iterable of strings, returns the longest common leading substring N)minmax	enumerate)ms1s2ics   &    f/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/pygments/regexopt.pycommonprefixr      sE    	QB	QB"1:bq6M  I    c                 j    R \         P                  R RP                  V 4      4      ,           R,           # )[c                 0    R V P                  4       ,           # )\)group)r
   s   &r   <lambda>make_charset.<locals>.<lambda>"   s    	)9r   r   ])	CS_ESCAPEsubjoin)letterss   &r   make_charsetr   !   s'    92777;KLLsRRr   c           	       a
a T;'       d    R;'       g    RpV '       g   R# V ^ ,          o
\        V 4      ^8X  d   V\        S
4      ,           V,           # S
'       g)   V\        V R,          R4      ,           R,           V,           # \        S
4      ^8X  d   . p. pV  F7  p\        V4      ^8X  d   VP                  V4       K&  VP                  V4       K9  	  \        V4      ^8  dS   V'       d2   V\        VR4      ,           R,           \	        V4      ,           V,           # V\	        V4      ,           V,           # \        V 4      pV'       dH   \        V4      pV\        V4      ,           \        V  Uu. uF  qUVR NK	  	  upR4      ,           V,           # V  Uu. uF  qURRR1,          NK  	  pp\        V4      p	V	'       dS   \        V	4      oV\        \        V3R lV  4       4      R4      ,           \        V	RRR1,          4      ,           V,           # VRP                  R	 \        V V
3R
 l4       4       4      ,           V,           # u upi u upi )zEReturn a regex that matches any string in the sorted list of strings.)r   :   NNz(?:?|Nc              3   .   <"   T F
  qR S)  x  K  	  R # 5i)N ).0sslens   & r   	<genexpr>"regex_opt_inner.<locals>.<genexpr>S   s     $@1vYs   c              3   Z   "   T F!  p\        \        V^,          4      R4      x  K#  	  R# 5i)r!   r   N)regex_opt_innerlist)r&   r   s   & r   r)   r*   X   s*      LJU !eAh44Js   )+c                 *   < V ^ ,          S^ ,          8H  # )    r%   )r'   firsts   &r   r   !regex_opt_inner.<locals>.<lambda>Y   s    1q9Ir   )	lenr   r,   appendr   r   sortedr   r   )strings
open_parenclose_paren	oneletterrestr'   prefixplenstrings_revsuffixr0   r(   s   &&        @@r   r,   r,   %   s   $$**KAJE
7|qF5M)K77OGBK??  	 
5zQ	A1v{  #A	 
 y>A!OD"$==C"9-.0;< < Y 77+EE'"F6{ F6N*9Ax95AB 	 %,,GqTrT77GK,+&F6{f$@$@@%HIVDbD\"#%01 	1
  L%g/IJL 	LL   : -s   0I
I
c                L    \        V 4      p V\        V R4      ,           V,           # )zReturn a compiled regex that matches any string in the given list.

The strings to match must be literal strings, not regexes.  They will be
regex-escaped.

*prefix* and *suffix* are pre- and appended to the final regex.
()r5   r,   )r6   r;   r>   s   &&&r   	regex_optrA   ]   s$     WoGOGS11F::r   )r   r   )__doc__rer   	itertoolsr   operatorr   compiler   FIRST_ELEMENTr   r   r,   rA   r%   r   r   <module>rH      sE   	 
   JJ'	1	S5p	;r   