
    ih<                     \   S SK Jr  S SK Jr  SrS rS r " S S5      r " S S	5      r " S
 S5      r " S S\5      r	 " S S\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S5      r " S S5      r " S  S!\5      r " S" S#\5      r " S$ S%\5      r " S& S'\5      r " S( S)\5      r " S* S+\5      r " S, S-\5      r " S. S/\5      r " S0 S1\5      r " S2 S3\5      r " S4 S5\5      r " S6 S7\5      r " S8 S9\5      rg:);    )escape)Markup)CheckboxInput
ColorInput	DateInputDateTimeInputDateTimeLocalInput
EmailInput	FileInputHiddenInput
ListWidget
MonthInputNumberInputOptionPasswordInput
RadioInput
RangeInputSearchInputSelectSubmitInputTableWidgetTextArea	TextInputTelInput	TimeInputURLInput	WeekInputc                     U R                  S5      n U R                  S5      (       d  U R                  S5      (       a  U R                  SS5      n U $ )N_data_aria_-)rstrip
startswithreplace)keys    W/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/wtforms/widgets/core.py	clean_keyr(   !   sA    
**S/C
~~g#.."9"9kk#s#J    c                     / n[        U R                  5       5       HX  u  p#[        U5      nUSL a  UR                  U5        M(  USL a  M/  UR                  [	        U5       S[        U5       S35        MZ     SR                  U5      $ )a;  
Generate HTML attribute syntax from inputted keyword arguments.

The output value is sorted by the passed keys, to provide consistent output
each time this function is called with the same parameters. Because of the
frequent use of the normally reserved keywords `class` and `for`, suffixing
these with an underscore will allow them to be used.

In order to facilitate the use of ``data-`` and ``aria-`` attributes, if the
name of the attribute begins with ``data_`` or ``aria_``, then every
underscore will be replaced with a hyphen in the generated attribute.

>>> html_params(data_attr='user.name', aria_labeledby='name')
'data-attr="user.name" aria-labeledby="name"'

In addition, the values ``True`` and ``False`` are special:
  * ``attr=True`` generates the HTML compact output of a boolean attribute,
    e.g. ``checked=True`` will generate simply ``checked``
  * ``attr=False`` will be ignored and generate no output.

>>> html_params(name='text1', id='f', class_='text')
'class="text" id="f" name="text1"'
>>> html_params(checked=True, readonly=False, name="text1", abc="hello")
'abc="hello" checked name="text1"'

.. versionchanged:: 3.0
    ``aria_`` args convert underscores to hyphens like ``data_``
    args.

.. versionchanged:: 2.2
    ``data_`` args convert all underscores to hyphens, instead of
    only the first one.
TFz="" )sorteditemsr(   appendstrr   join)kwargsparamskvs       r'   html_paramsr6   (   sy    D Fv||~&aL9MM!%ZMMSVHBvayk34 ' 88Fr)   c                   (    \ rS rSrSrSS jrS rSrg)r   V   a  
Renders a list of fields as a `ul` or `ol` list.

This is used for fields which encapsulate many inner fields as subfields.
The widget will try to iterate the field to get access to the subfields and
call them to render them.

If `prefix_label` is set, the subfield's label is printed before the field,
otherwise afterwards. The latter is useful for iterating radios or
checkboxes.
c                 ,    US;   d   eXl         X l        g )N)olulhtml_tagprefix_label)selfr=   r>   s      r'   __init__ListWidget.__init__c   s    <''' (r)   c                    UR                  SUR                  5        SU R                   S[        S	0 UD6 S3/nU Hd  nU R                  (       a)  UR                  SUR                   SU" 5        S35        M=  UR                  SU" 5        SUR                   S35        Mf     UR                  SU R                   S35        [        SR                  U5      5      $ )
Nid<r,   >z<li>z</li>z</  )	
setdefaultrC   r=   r6   r>   r/   labelr   r1   )r?   fieldr2   htmlsubfields        r'   __call__ListWidget.__call__h   s    $)DMM?!K$9&$9#:!<=H  d8>>"2!HJ<uEFd8:,a/?uEF	 
 	bq)*bggdm$$r)   r<   N)r;   T__name__
__module____qualname____firstlineno____doc__r@   rM   __static_attributes__rG   r)   r'   r   r   V   s    
)
	%r)   r   c                   (    \ rS rSrSrSS jrS rSrg)r   t   ah  
Renders a list of fields as a set of table rows with th/td pairs.

If `with_table_tag` is True, then an enclosing <table> is placed around the
rows.

Hidden fields will not be displayed with a row, instead the field will be
pushed into a subsequent table row to ensure XHTML validity. Hidden fields
at the end of the field list will appear outside the table.
c                     Xl         g Nwith_table_tag)r?   r[   s     r'   r@   TableWidget.__init__   s    ,r)   c           	         / nU R                   (       a<  UR                  SUR                  5        [        S
0 UD6nUR	                  SU S35        SnU HI  nUR
                  S;   a  U[        U5      -  nM#  UR	                  SUR                   SU U S35        SnMK     U R                   (       a  UR	                  S	5        U(       a  UR	                  U5        [        SR                  U5      5      $ )NrC   z<table rE   rF   )HiddenFieldCSRFTokenFieldz<tr><th>z	</th><td>z
</td></tr>z</table>rG   )
r[   rH   rC   r6   r/   typer0   rI   r   r1   )r?   rJ   r2   rK   table_paramshiddenrL   s          r'   rM   TableWidget.__call__   s    dEHH-&00LKK',q12H}} AA#h-'x~~.ixzT   KK
#KKbggdm$$r)   rZ   NTrO   rG   r)   r'   r   r   t   s    	-%r)   r   c                   8    \ rS rSrSr\" \5      rSS jrS rSr	g)Input   z
Render a basic ``<input>`` field.

This is used as the basis for most of the other input fields.

By default, the `_value()` method will be called upon the associated field
to provide the ``value=`` HTML attribute.
Nc                     Ub  Xl         g g rY   
input_type)r?   rj   s     r'   r@   Input.__init__   s    !(O "r)   c                    UR                  SUR                  5        UR                  SU R                  5        SU;  a  UR                  5       US'   [	        US0 5      n[        U5       H(  nX@R                  ;   d  M  XB;  d  M  [	        X45      X$'   M*     U R                  " SSUR                  0UD6n[        SU S35      $ )	NrC   r`   valueflagsnamez<input rE   rG   )
rH   rC   rj   _valuegetattrdirvalidation_attrsr6   ro   r   )r?   rJ   r2   rn   r4   input_paramss         r'   rM   Input.__call__   s    $)&$//2& #llnF7Ow+UA)))ao#E-	  ''BUZZB6B~Q/00r)   ri   rY   )
rP   rQ   rR   rS   rT   staticmethodr6   r@   rM   rU   rG   r)   r'   rf   rf      s     {+K)
1r)   rf   c                   $    \ rS rSrSrSr/ SQrSrg)r      z"
Render a single-line text input.
textrequireddisabledreadonly	maxlength	minlengthpatternrG   NrP   rQ   rR   rS   rT   rj   rs   rU   rG   r)   r'   r   r      s     Jr)   r   c                   B   ^  \ rS rSrSrSr/ SQrSS jrU 4S jrSr	U =r
$ )	r      z
Render a password input.

For security purposes, this field will not reproduce the value on a form
submit by default. To have the value filled in, set `hide_value` to
`False`.
passwordrz   c                     Xl         g rY   
hide_value)r?   r   s     r'   r@   PasswordInput.__init__   s    $r)   c                 R   > U R                   (       a  SUS'   [        TU ]  " U40 UD6$ )NrF   rm   )r   superrM   r?   rJ   r2   	__class__s      r'   rM   PasswordInput.__call__   s(    ?? F7Ow000r)   r   rd   rP   rQ   rR   rS   rT   rj   rs   r@   rM   rU   __classcell__r   s   @r'   r   r      s&     J%1 1r)   r   c                   6   ^  \ rS rSrSrSrS/rU 4S jrSrU =r	$ )r      z
Render a hidden input.
rb   r|   c                 8   > [         TU ]  " U0 UD6  SS0U l        g )Nrb   T)r   r@   field_flags)r?   argsr2   r   s      r'   r@   HiddenInput.__init__   s"    $)&)$d+r)   )r   )
rP   rQ   rR   rS   rT   rj   rs   r@   rU   r   r   s   @r'   r   r      s!     J"|, ,r)   r   c                   8   ^  \ rS rSrSrSrSS/rU 4S jrSrU =r	$ )r      ze
Render a checkbox.

The ``checked`` HTML attribute is set if the field's data is a non-false value.
checkboxr{   r|   c                 h   > [        USUR                  5      (       a  SUS'   [        TU ]  " U40 UD6$ )NcheckedT)rq   datar   rM   r   s      r'   rM   CheckboxInput.__call__   s5    5)UZZ00 $F9w000r)   rG   
rP   rQ   rR   rS   rT   rj   rs   rM   rU   r   r   s   @r'   r   r      s$     J"J/1 1r)   r   c                   8   ^  \ rS rSrSrSrSS/rU 4S jrSrU =r	$ )r      z
Render a single radio button.

This widget is most commonly used in conjunction with ListWidget or some
other listing, as singular radio buttons are not very useful.
radior{   r|   c                 R   > UR                   (       a  SUS'   [        TU ]  " U40 UD6$ )NTr   )r   r   rM   r   s      r'   rM   RadioInput.__call__
  s)    == $F9w000r)   rG   r   r   s   @r'   r   r      s$     J"J/1 1r)   r   c                   H   ^  \ rS rSrSrSr/ SQrSU 4S jjrU 4S jrSr	U =r
$ )	r   i  zMRender a file chooser input.

:param multiple: allow choosing multiple files
file)r{   r|   acceptc                 .   > [         TU ]  5         Xl        g rY   )r   r@   multiple)r?   r   r   s     r'   r@   FileInput.__init__  s     r)   c                 \   > SUS'   U R                   (       a  SUS'   [        TU ]  " U40 UD6$ )NFrm   Tr   )r   r   rM   r   s      r'   rM   FileInput.__call__  s2    w==!%F:w000r)   r   Fr   r   s   @r'   r   r     s$    
 J9!1 1r)   r   c                   8   ^  \ rS rSrSrSrSS/rU 4S jrSrU =r	$ )r   i'  zx
Renders a submit button.

The field's label is used as the text of the submit button instead of the
data on the field.
submitr{   r|   c                 r   > UR                  SUR                  R                  5        [        TU ]  " U40 UD6$ )Nrm   )rH   rI   ry   r   rM   r   s      r'   rM   SubmitInput.__call__2  s2    '5;;#3#34w000r)   rG   r   r   s   @r'   r   r   '  s$     J"J/1 1r)   r   c                   &    \ rS rSrSr/ SQrS rSrg)r   i7  zg
Renders a multi-line text area.

`rows` and `cols` ought to be passed as keyword args when rendering.
)r{   r|   r}   r~   r   c                 F   UR                  SUR                  5        [        US0 5      n[        U5       H(  nX@R                  ;   d  M  XB;  d  M  [        X45      X$'   M*     [        SSUR                  0UD6n[        UR                  5       5      n[        SU SU S35      $ )NrC   rn   ro   z
<textarea z>
z</textarea>rG   )
rH   rC   rq   rr   rs   r6   ro   r   rp   r   )r?   rJ   r2   rn   r4   textarea_paramstextarea_innerhtmls          r'   rM   TextArea.__call__@  s    $)w+UA)))ao#E-	  &@5::@@#ELLN3)/A.B+N
 	
r)   rG   N)rP   rQ   rR   rS   rT   rs   rM   rU   rG   r)   r'   r   r   7  s     V

r)   r   c                   @    \ rS rSrSrSS/rS
S jrS r\S 5       r	Sr
g	)r   iM  aU  
Renders a select field.

If `multiple` is True, then the `size` property should be specified on
rendering to make the field useful.

The field must provide an `iter_choices()` method which the widget will
call on rendering; this method must yield tuples of
`(value, label, selected)` or `(value, label, selected, render_kw)`.
It also must provide a `has_groups()` method which tells whether choices
are divided into groups, and if they do, the field must have an
`iter_groups()` method that yields tuples of `(label, choices)`, where
`choices` is a iterable of `(value, label, selected)` tuples.
r{   r|   c                     Xl         g rY   r   )r?   r   s     r'   r@   Select.__init___  s     r)   c           	         UR                  SUR                  5        U R                  (       a  SUS'   [        US0 5      n[	        U5       H(  nX@R
                  ;   d  M  XB;  d  M  [        X45      X$'   M*     [        SSUR                  0UD6nSU S3/nUR                  5       (       az  UR                  5        He  u  px[        US9n	UR                  S	U	 S35        U H+  n
U
u  ppUR                  U R                  " XU40 UD65        M-     UR                  S
5        Mg     O?UR                  5        H+  n
U
u  ppUR                  U R                  " XU40 UD65        M-     UR                  S5        [        SR                  U5      5      $ )NrC   Tr   rn   ro   z<select rE   )rI   z
<optgroup z</optgroup>z	</select>rF   rG   )rH   rC   r   rq   rr   rs   r6   ro   
has_groupsiter_groupsr/   render_optioniter_choicesr   r1   )r?   rJ   r2   rn   r4   select_paramsrK   groupchoicesoptgroup_paramschoicevalrI   selected	render_kws                  r'   rM   Select.__call__b  sj   $)==!%F:w+UA)))ao#E-	  $>>v>=/+,"'"3"3"5"-E":j(9;<%F6<3CKK 2 23x U9 UV & M* #6  ,,.28/HD..s8QyQR / 	K bggdm$$r)   c                     USL a  [        U5      n[        XAS9nU(       a  SUS'   [        S[        S0 UD6 S[	        U5       S35      $ )NT)rm   r   z<option rE   z	</option>rG   )r0   dictr   r6   r   )clsrm   rI   r   r2   optionss         r'   r   Select.render_option{  sP    D=JEv+"&GJ!7w!7 8&-	RSSr)   r   Nr   )rP   rQ   rR   rS   rT   rs   r@   rM   classmethodr   rU   rG   r)   r'   r   r   M  s4     #J/!%2 T Tr)   r   c                       \ rS rSrSrS rSrg)r   i  z
Renders the individual option from a select field.

This is just a convenience for various custom rendering situations, and an
option by itself does not constitute an entire field.
c                     [         R                  " UR                  5       UR                  R                  UR
                  40 UD6$ rY   )r   r   rp   rI   ry   r   )r?   rJ   r2   s      r'   rM   Option.__call__  s8    ##LLNEKK,,emm
?E
 	
r)   rG   N)rP   rQ   rR   rS   rT   rM   rU   rG   r)   r'   r   r     s    
r)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z&
Renders an input with type "search".
searchrz   rG   Nr   rG   r)   r'   r   r     s     Jr)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z#
Renders an input with type "tel".
telrz   rG   Nr   rG   r)   r'   r   r          Jr)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z#
Renders an input with type "url".
urlrz   rG   Nr   rG   r)   r'   r   r     r   r)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r
   i  z%
Renders an input with type "email".
emailrz   rG   Nr   rG   r)   r'   r
   r
     s     Jr)   r
   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z(
Renders an input with type "datetime".
datetimer{   r|   r}   maxminsteprG   Nr   rG   r)   r'   r   r     s     JQr)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z$
Renders an input with type "date".
dater   rG   Nr   rG   r)   r'   r   r          JQr)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z%
Renders an input with type "month".
monthr   rG   Nr   rG   r)   r'   r   r     s     JQr)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z$
Renders an input with type "week".
weekr   rG   Nr   rG   r)   r'   r   r     r   r)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r   i  z$
Renders an input with type "time".
timer   rG   Nr   rG   r)   r'   r   r     r   r)   r   c                   $    \ rS rSrSrSr/ SQrSrg)r	   i  z.
Renders an input with type "datetime-local".
zdatetime-localr   rG   Nr   rG   r)   r'   r	   r	     s     "JQr)   r	   c                   B   ^  \ rS rSrSrSr/ SQrSS jrU 4S jrSr	U =r
$ )	r   i  z&
Renders an input with type "number".
numberr   c                 (    Xl         X l        X0l        g rY   )r   r   r   )r?   r   r   r   s       r'   r@   NumberInput.__init__  s    	r)   c                   > U R                   b  UR                  SU R                   5        U R                  b  UR                  SU R                  5        U R                  b  UR                  SU R                  5        [        TU ]  " U40 UD6$ )Nr   r   r   )r   rH   r   r   r   rM   r   s      r'   rM   NumberInput.__call__  sr    99 fdii088eTXX.88eTXX.w000r)   )r   r   r   )NNNr   r   s   @r'   r   r     s$     JQ
1 1r)   r   c                   B   ^  \ rS rSrSrSr/ SQrSS jrU 4S jrSr	U =r
$ )	r   i"  z%
Renders an input with type "range".
range)r|   r   r   r   c                     Xl         g rY   r   )r?   r   s     r'   r@   RangeInput.__init__*  s    	r)   c                 x   > U R                   b  UR                  SU R                   5        [        TU ]  " U40 UD6$ )Nr   )r   rH   r   rM   r   s      r'   rM   RangeInput.__call__-  s6    99 fdii0w000r)   r   rY   r   r   s   @r'   r   r   "  s$     J91 1r)   r   c                   "    \ rS rSrSrSrS/rSrg)r   i3  z%
Renders an input with type "color".
colorr|   rG   Nr   rG   r)   r'   r   r   3  s     J"|r)   r   N) 
markupsafer   r   __all__r(   r6   r   r   rf   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r   r   r   r   r   r	   r   r   r   rG   r)   r'   <module>r      sY    :+\% %<"% "%J1 1:  1E 18
,% 
,1E 1 1 1"1 1.1% 1 
 
,7T 7Tt
 
%  u  u    RE RR RR RR RR RR R1% 1.1 1"$ $r)   