§
    ¥”jö  ã                   ó4   — d Z ddlZddlmZ d„ Zdd„Zd	d„ZdS )
z&
Helpers for dealing with HTML input.
é    N)ÚMultiValueDictc                 ó"   — t          | d¦  «        S )NÚgetlist)Úhasattr)Ú
dictionarys    úh/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/rest_framework/utils/html.pyÚis_html_inputr	   	   s   € õ �:˜yÑ)Ô)Ð)ó    Ú c                 óê  ‡	— i Š	t          j        dt          j        |¦  «        z  ¦  «        }|                      ¦   «         D ]”\  }}|                     |¦  «        }|sŒ|                     ¦   «         \  }}t          |¦  «        }|s|‰	|<   ŒKt          ‰	                     |¦  «        t          ¦  «        r|‰	|         |<   Œt          ||gi¦  «        ‰	|<   Œ•‰	rˆ	fd„t          ‰	¦  «        D ¦   «         n|S )ad  
    Used to support list values in HTML forms.
    Supports lists of primitives and/or dictionaries.

    * List of primitives.

    {
        '[0]': 'abc',
        '[1]': 'def',
        '[2]': 'hij'
    }
        -->
    [
        'abc',
        'def',
        'hij'
    ]

    * List of dictionaries.

    {
        '[0]foo': 'abc',
        '[0]bar': 'def',
        '[1]foo': 'hij',
        '[1]bar': 'klm',
    }
        -->
    [
        {'foo': 'abc', 'bar': 'def'},
        {'foo': 'hij', 'bar': 'klm'}
    ]

    :returns a list of objects, or the value specified in ``default`` if the list is empty
    z^%s\[([0-9]+)\](.*)$c                 ó    •— g | ]
}‰|         ‘ŒS © r   )Ú.0ÚitemÚrets     €r   ú
<listcomp>z#parse_html_list.<locals>.<listcomp>B   s   ø€ Ð.Ð.Ð.˜$ˆC�ŒIÐ.Ð.Ð.r
   )ÚreÚcompileÚescapeÚitemsÚmatchÚgroupsÚintÚ
isinstanceÚgetÚdictr   Úsorted)
r   ÚprefixÚdefaultÚregexÚfieldÚvaluer   ÚindexÚkeyr   s
            @r   Úparse_html_listr%      s  ø€ ðF €CÝŒJÐ.µ´¸6Ñ1BÔ1BÑBÑCÔC€EØ"×(Ò(Ñ*Ô*ð 8ð 8‰ˆˆuØ—’˜EÑ"Ô"ˆØð 	ØØ—\’\‘^”^‰
ˆˆsÝ�E‘
”
ˆØð 	8ØˆC�‰JˆJÝ˜Ÿš ™œ­Ñ-Ô-ð 	8Ø#ˆC�ŒJ�s‰OˆOå'¨¨u¨g¨Ñ7Ô7ˆC�‰JˆJð 36ÐBÐ.Ð.Ð.Ð.¥&¨¡+¤+Ð.Ñ.Ô.Ð.¸7ÐBr
   c                 ó8  — t          ¦   «         }t          j        dt          j        |¦  «        z  ¦  «        }| D ]_}|                     |¦  «        }|sŒ|                     ¦   «         d         }|                      |¦  «        }|                     ||¦  «         Œ`|S )a#  
    Used to support dictionary values in HTML forms.

    {
        'profile.username': 'example',
        'profile.email': 'example@example.com',
    }
        -->
    {
        'profile': {
            'username': 'example',
            'email': 'example@example.com'
        }
    }
    z
^%s\.(.+)$r   )r   r   r   r   r   r   r   Úsetlist)r   r   r   r    r!   r   r$   r"   s           r   Úparse_html_dictr(   E   s™   € õ  Ñ
Ô
€CÝŒJ�}¥r¤y°Ñ'8Ô'8Ñ8Ñ9Ô9€EØð  ð  ˆØ—’˜EÑ"Ô"ˆØð 	ØØ�lŠl‰nŒn˜QÔˆØ×"Ò" 5Ñ)Ô)ˆØ�Š�C˜ÑÔÐÐà€Jr
   )r   N)r   )Ú__doc__r   Údjango.utils.datastructuresr   r	   r%   r(   r   r
   r   ú<module>r+      sr   ððð ð 
€	€	€	à 6Ð 6Ð 6Ð 6Ð 6Ð 6ð*ð *ð *ð3Cð 3Cð 3Cð 3Cðlð ð ð ð ð r
   