�
F�g � � � d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ej d� � Z
ed� � Zd� Zd � Z
dd�ZdS )
a
pygments.regexopt
~~~~~~~~~~~~~~~~~
An algorithm that generates optimized regexes for matching long lists of
literal strings.
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)�escape)�commonprefix)�groupby)�
itemgetterz[\[\^\\\-\]]c �l � dt � d� d� | � � � � z dz S )N�[c �0 � d| � � � z S )N�\)�group)�ms �a/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/pygments/regexopt.py�<lambda>zmake_charset.<locals>.<lambda> s � ����� � �)9� � � �])� CS_ESCAPE�sub�join)�letterss r
�make_charsetr s0 � �����9�9�2�7�7�7�;K�;K�L�L�L�s�R�Rr c � � �
�� |rdpd}| sdS | d � t | � � dk r|t � � � z |z S � s!|t | dd� d� � z dz |z S t � � � dk r�g }g }| D ]@}t |� � dk r|� |� � �+|� |� � �At |� � dk r@|r)|t |d� � z dz t |� � z |z S |t |� � z |z S t | � � }|rAt |� � �
|t |� � z t �
fd �| D � � d� � z |z S d
� | D � � }t |� � }|rWt |� � �|t t
�fd�| D � � � � d� � z t |ddd� � � z |z S |d� d
� t | � fd�� � D � � � � z |z S )zEReturn a regex that matches any string in the sorted list of strings.�)r r � Nz(?:�?�|c �$ �� g | ]}|�d � ��
S �N� )�.0�s�plens �r
�
<listcomp>z#regex_opt_inner.<locals>.<listcomp>? s! �� �9�9�9�A�q����x�9�9�9r c �$ � g | ]
}|d d d� ��S )N�����r )r r s r
r"