
    @OOf                     n   d Z ddlmZ ddlmZ ddl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dlmZ ddlmZ e G d d             Zeeeeef   f   Z	 e G d d             Zdeej@                     dejB                  dz  de"defdZ#dedededejH                  fdZ%y)zV
This module is reponsible for drawing the quick key help at the bottom of mitmproxy.
    )	dataclass)UnionN)flow)HTTPFlow)EventLog)FlowListBox)FlowView)FocusEditor)HelpView)KeyBindings)Keymap)Optionsc                       e Zd ZU dZeed<   y)BasicKeyHelpz[Quick help for urwid-builtin keybindings (i.e. those keys that do not appear in the keymap)keyN)__name__
__module____qualname____doc__str__annotations__     b/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/mitmproxy/tools/console/quickhelp.pyr   r      s
    e	Hr   r   c                   x    e Zd ZU eed<   eed<   eed<   eed<   dedeej                  ej                  f   fdZ
y)		QuickHelp	top_label	top_itemsbottom_labelbottom_itemskeymapreturnc                     t        | j                  | j                  |      }t        | j                  | j                  |      }||fS )N)	_make_rowr   r   r   r    )selfr!   topbottoms       r   	make_rowszQuickHelp.make_rows.   s<    ?4,,d.?.?HF{r   N)r   r   r   r   r   	HelpItemsr   tupleurwidColumnsr(   r   r   r   r   r   '   s>    N 51M+N r   r   widgetfocused_flowis_root_widgetr"   c                    d}i }| t         t        fv rd}|r| t         k(  rd|d<   nd|d<   |dddd	d
z  }| t         k(  r|j                  rd|d<   nd|d<   d|d<   |j                  rd|d<   |j	                         rd|d<   t        |t              r|j                  rd|d<   | t        k(  r|dddz  }n|dddz  }n| t        k(  rd}|dddddz  }n| t        k(  rd }|t        d!      d"d#d$d%d&z  }n| t        k(  r(d'}|t        d(      t        d)      d*t        d+      d,z  }nW| t        k(  rd-}|t        d(      t        d)      d.d/z  }n0t        | t              rd0}|t        d!      t        d1      d2d3d4z  }n	 d5}d6d7i}|rd8|d9<   nd8|d:<   |d;d<d=d>d?z  }|r|d@dAdBz  }|dCdDdEdFz  }t        t!        |      t!        |      dG      dHz   }|j#                  |      }|j#                  |      }t%        ||||      S )IN zFlow:SelectzEdit a flow componentEditzDuplicate flowzReplay this flowzExport this flow to filezDelete flow from view)	DuplicateReplayExportDeletezToggle mark on this flowUnmarkMarkzResume this intercepted flowResumezRevert changes to this flowRestorezSave response body to filez	Save bodyzGo to next flowzGo to previous flow)z	Next flowz	Prev flowzLoad flows from filezCreate a new flow)z
Load flowsz
Create newzKeybindings:zAdd a key bindingz&Edit the currently focused key bindingz(Unbind the currently focused key bindingz)Execute the currently focused key binding)Addr3   r7   ExecutezOptions:u   ⏎zReset this optionzReset all optionszLoad from filezSave to file)r3   Resetz	Reset allz	Load filez	Save filezHelp:u   ↓u   ↑	Exit helptab)Scroll down	Scroll upr?   zNext tabzEvents:Clear)rA   rB   rC   zEdit:esczAdd a row after cursorzDelete this row)z
Start editz	Stop editzAdd rowz
Delete rowzProxy:Helpz	View helpzExit the current viewQuitBackzView event logzView optionszSet interceptzSet view filter)Eventsr   	InterceptFilterzSave listed flows to filezClear flow list)z
Save flowsz
Clear listzCycle to next layoutzFocus next layout panezSet focus follow)LayoutSwitchz
Follow new      )r   r	   markedinterceptedmodified
isinstancer   responser   r   r   r   r   
issubclassr
   maxlenljustr   )r-   r.   r/   r   r   r   r    	label_lens           r   makerY   4   s   
 II+x((	$&.	(#$;	&!-,41	 I $&&*DIh'(BIf%$;	&!''&D	(#$$&'D	)$,1l6K6K)E	+&!!2!6 	
 41 I 
;	"	&<@B	
 	
	 
7		 '(,)'
 	
	 
8		'.%e,$$U+	
 	
	 
8		'.%e,
 	
	
 
FK	(	&u-%e,/+	
 	
	 	LL 6V6V"!$#	 L 5+
 	
 (*( L C	NC$5q9A=I	*I%%i0LY	<FFr   labelitemsr!   c                 ~   t        |       t        j                  |       fg}|j                         D ]u  \  }}t	        |t
              r|j                  }n$|j                  |      }|7|j                         }t        j                  d|fd|gd      }|j                  d|f       w t        j                  |      S )Nheading_inactive clip)wrap   )rV   r+   Textr[   rR   r   r   binding_for_help	key_shortappendr,   )	rZ   r[   r!   colsshortlongrd   btxts	            r   r$   r$      s    	UUZZ&'D {{} tdL)I''-AyIjj#Y/
 
 	RI!$ ==r   )&r   dataclassesr   typingr   r+   	mitmproxyr   mitmproxy.httpr    mitmproxy.tools.console.eventlogr    mitmproxy.tools.console.flowlistr    mitmproxy.tools.console.flowviewr	   'mitmproxy.tools.console.grideditor.baser
   mitmproxy.tools.console.helpr   #mitmproxy.tools.console.keybindingsr   mitmproxy.tools.console.keymapr   mitmproxy.tools.console.optionsr   r   dictr   r)   r   typeWidgetFlowboolrY   r,   r$   r   r   r   <module>r|      s    "    # 5 8 5 ? 1 ; 1 3    eC-../	 	 	 	rGrG))d"rG rG 	rGjS  F u}} r   