
    @OOf                        d dl mZ d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d d	l
mZ d
Ze	eef   Zeeeef      Zeeee   f   Z G d de      Zdeeeef      dee   fdZdeeef   dee   fdZdedee   fdZy)    )ABC)abstractmethod)Iterable)Iterator)Mapping)ClassVar)Union)flow)http   c                       e Zd ZU ee   ed<   edddddededz  dej                  dz  de
j                  dz  def
d	       Zdddddededz  dej                  dz  de
j                  dz  def
d
Zd Zy)ViewnameN)content_typer
   http_messagedatar   r
   r   returnc                    t               )a  
        Transform raw data into human-readable output.

        Returns a (description, content generator) tuple.
        The content generator yields lists of (style, text) tuples, where each list represents
        a single line. ``text`` is a unfiltered string which may need to be escaped,
        depending on the used output. For example, it may contain terminal control sequences
        or unfiltered HTML.

        Except for `data`, implementations must not rely on any given argument to be present.
        To ensure compatibility with future mitmproxy versions, unknown keyword arguments should be ignored.

        The content generator must not yield tuples of tuples, because urwid cannot process that.
        You have to yield a *list* of tuples per line.
        )NotImplementedErrorselfr   r   r
   r   unknown_metadatas         \/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/mitmproxy/contentviews/base.py__call__zView.__call__   s    2 "##    c                     y)ay  
        Return the priority of this view for rendering `data`.
        If no particular view is chosen by the user, the view with the highest priority is selected.

        Except for `data`, implementations must not rely on any given argument to be present.
        To ensure compatibility with future mitmproxy versions, unknown keyword arguments should be ignored.
        r    r   s         r   render_priorityzView.render_priority2   s      r   c                 p    t        |t              sJ | j                  j                  |j                        S )N)
isinstancer   r   __lt__)r   others     r   r!   zView.__lt__D   s+    %&&&yy

++r   )__name__
__module____qualname__r   str__annotations__r   bytesr
   Flowr   MessageTViewResultr   floatr   r!   r   r   r   r   r      s    
3-
 $(!%,0$$ Dj	$
 ii$$ llT)$ 
$ $< $(!%,0 Dj	
 ii$ llT) 
$,r   r   itemsr   c              #      K   t        d | D        d      }t        |t        fd      }| D ]>  \  }}t        |t              r|dz  }n|dz  }|j                  |dz         }d|fd|fg @ y	w)
z
    Helper function that accepts a list of (k,v) pairs into a list of
    [
        ("key", key    )
        ("value", value)
    ]
    where key is padded to a uniform width
    c              3   8   K   | ]  }t        |d            yw)r   N)len).0ks     r   	<genexpr>zformat_pairs.<locals>.<genexpr>S   s     0Qs1Q4y0s   r   )default   ::   headertextN)maxminKEY_MAXr    r(   ljust)r-   max_key_lenkeyvalues       r   format_pairsrA   I   s      0%0!<K{G,a8K 1
Uc5!4KC3JCiia(#001s   A,A.dc                 4    t        | j                               S )z
    Helper function that transforms the given dictionary into a list of
    [
        ("key",   key  )
        ("value", value)
    ]
    entries, where key is padded to a uniform width.
    )rA   r-   )rB   s    r   format_dictrD   a   s     	""r   r9   c              #   D   K   | j                         D ]	  }d|fg  yw)zL
    Helper function that transforms bytes into the view output format.
    r9   N)
splitlines)r9   lines     r   format_textrH   n   s+      ! ~s    N)abcr   r   collections.abcr   r   r   typingr   r	   	mitmproxyr
   r   r<   r&   r(   	TTextTypelisttuple	TViewLiner+   r   rA   rD   rH   r   r   r   <module>rQ      s      $ $ #    
#u*	sI~&'	C),,-2,3 2,j1y)';!<= 1(9BU 10
#79i/0 
#Xi5H 
#i HY$7 r   