§
    ùÛg0  ã                   óŽ   — d Z ddlmZmZmZ ddlmZmZ ddl	m
Z
mZ d„ Z G d„ de¦  «        Z G d	„ d
e¦  «        Zd„ Zd„ Zd„ ZdS )z¯
    flask.templating
    ~~~~~~~~~~~~~~~~

    Implements the bridge to Jinja2.

    :copyright: (c) 2015 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
é    )Ú
BaseLoaderÚEnvironmentÚTemplateNotFoundé   )Ú_request_ctx_stackÚ_app_ctx_stack)Útemplate_renderedÚbefore_render_templatec                  ó~   — t           j        } t          j        }i }|�
|j        |d<   | �| j        |d<   | j        |d<   |S )zSDefault template context processor.  Injects `request`,
    `session` and `g`.
    NÚgÚrequestÚsession)r   Útopr   r   r   r   )ÚreqctxÚappctxÚrvs      úF/granary/edev/quantum/lib/python3.11/site-packages/flask/templating.pyÚ_default_template_ctx_processorr      sK   € õ  Ô#€FÝÔ€FØ	€BØÐØ”(ˆˆ3‰ØÐØœˆˆ9‰Øœˆˆ9‰Ø€Ió    c                   ó   — e Zd ZdZd„ ZdS )r   zÌWorks like a regular Jinja2 environment but has some additional
    knowledge of how Flask's blueprint works so that it can prepend the
    name of the blueprint to referenced templates if necessary.
    c                 ón   — d|vr|                      ¦   «         |d<   t          j        | fi |¤Ž || _        d S )NÚloader)Úcreate_global_jinja_loaderÚBaseEnvironmentÚ__init__Úapp)Úselfr   Úoptionss      r   r   zEnvironment.__init__'   sG   € Ø˜7Ð"Ð"Ø #× >Ò >Ñ @Ô @ˆG�HÑÝÔ  Ð1Ð1¨Ð1Ð1Ð1ØˆŒˆˆr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r   r   !   s-   € € € € € ðð ð
ð ð ð ð r   r   c                   ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚDispatchingJinjaLoaderz\A loader that looks for templates in the application and all
    the blueprint folders.
    c                 ó   — || _         d S ©N)r   )r   r   s     r   r   zDispatchingJinjaLoader.__init__3   s   € ØˆŒˆˆr   c                 ó~   — | j         j        d         r|                      ||¦  «        S |                      ||¦  «        S )NÚEXPLAIN_TEMPLATE_LOADING)r   ÚconfigÚ_get_source_explainedÚ_get_source_fast)r   ÚenvironmentÚtemplates      r   Ú
get_sourcez!DispatchingJinjaLoader.get_source6   sA   € ØŒ8Œ?Ð5Ô6ð 	EØ×-Ò-¨k¸8ÑDÔDÐDØ×$Ò$ [°(Ñ;Ô;Ð;r   c                 ó"  — g }d }|                       |¦  «        D ]K\  }}	 |                     ||¦  «        }|€|}n# t          $ r d }Y nw xY w|                     |||f¦  «         ŒLddlm}  || j        ||¦  «         |�|S t          |¦  «        ‚)Nr   )Ú!explain_template_loading_attempts)Ú_iter_loadersr/   r   ÚappendÚdebughelpersr1   r   )	r   r-   r.   ÚattemptsÚtrvÚsrcobjr   r   r1   s	            r   r+   z,DispatchingJinjaLoader._get_source_explained;   sÓ   € ØˆØˆà"×0Ò0°Ñ:Ô:ð 	2ð 	2‰NˆF�FðØ×&Ò& {°HÑ=Ô=�Ø�;Ø�CøøÝ#ð ð ð Ø���ðøøøà�OŠO˜V V¨RÐ0Ñ1Ô1Ð1Ð1àCÐCÐCÐCÐCÐCØ)Ð)¨$¬(°H¸hÑGÔGÐGàˆ?ØˆJÝ˜xÑ(Ô(Ð(s    ;»A
Á	A
c                 ó¦   — |                       |¦  «        D ]-\  }}	 |                     ||¦  «        c S # t          $ r Y Œ*w xY wt          |¦  «        ‚r'   )r2   r/   r   )r   r-   r.   r7   r   s        r   r,   z'DispatchingJinjaLoader._get_source_fastO   sr   € Ø"×0Ò0°Ñ:Ô:ð 	ð 	‰NˆF�FðØ×(Ò(¨°hÑ?Ô?Ð?Ð?Ð?øÝ#ð ð ð Ø�ðøøøå˜xÑ(Ô(Ð(s   œ4´
AÁ Ac              #   ó’   K  — | j         j        }|�| j         |fV — | j                              ¦   «         D ]}|j        }|�||fV — Œd S r'   )r   Újinja_loaderÚiter_blueprints)r   r.   r   Ú	blueprints       r   r2   z$DispatchingJinjaLoader._iter_loadersW   sp   è è € Ø”Ô&ˆØÐØ”(˜FÐ"Ð"Ð"Ð"àœ×1Ò1Ñ3Ô3ð 	(ð 	(ˆIØÔ+ˆFØÐ!Ø Ð'Ð'Ð'Ð'øð	(ð 	(r   c                 óH  — t          ¦   «         }| j        j        }|�'|                     |                     ¦   «         ¦  «         | j                             ¦   «         D ]7}|j        }|�,|                     ¦   «         D ]}|                     |¦  «         ŒŒ8t          |¦  «        S r'   )Úsetr   r:   ÚupdateÚlist_templatesr;   ÚaddÚlist)r   Úresultr   r<   r.   s        r   r@   z%DispatchingJinjaLoader.list_templatesa   s¡   € Ý‘”ˆØ”Ô&ˆØÐØ�MŠM˜&×/Ò/Ñ1Ô1Ñ2Ô2Ð2àœ×1Ò1Ñ3Ô3ð 	)ð 	)ˆIØÔ+ˆFØÐ!Ø &× 5Ò 5Ñ 7Ô 7ð )ð )�HØ—J’J˜xÑ(Ô(Ð(Ð(øå�F‰|Œ|Ðr   N)
r   r    r!   r"   r   r/   r+   r,   r2   r@   r#   r   r   r%   r%   .   sx   € € € € € ðð ðð ð ð<ð <ð <ð
)ð )ð )ð()ð )ð )ð(ð (ð (ðð ð ð ð r   r%   c                 óŒ   — t          j        || |¬¦  «         |                      |¦  «        }t          j        || |¬¦  «         |S )z)Renders the template and fires the signal)r.   Úcontext)r
   ÚsendÚrenderr	   )r.   rE   r   r   s       r   Ú_renderrH   p   sJ   € õ Ô ¨hÀÐHÑHÔHÐHØ	�Š˜Ñ	!Ô	!€BÝÔ˜3¨¸7ÐCÑCÔCÐCØ€Ir   c                 ó´   — t           j        }|j                             |¦  «         t	          |j        j                             | ¦  «        ||j        ¦  «        S )a–  Renders a template from the template folder with the given
    context.

    :param template_name_or_list: the name of the template to be
                                  rendered, or an iterable with template names
                                  the first one existing will be rendered
    :param context: the variables that should be available in the
                    context of the template.
    )r   r   r   Úupdate_template_contextrH   Ú	jinja_envÚget_or_select_template)Útemplate_name_or_listrE   Úctxs      r   Úrender_templaterO   y   sQ   € õ Ô
€CØ„G×#Ò# GÑ,Ô,Ð,Ý�3”7Ô$×;Ò;Ð<QÑRÔRØ˜CœGñ%ô %ð %r   c                 ó´   — t           j        }|j                             |¦  «         t	          |j        j                             | ¦  «        ||j        ¦  «        S )aF  Renders a template from the given template source string
    with the given context. Template variables will be autoescaped.

    :param source: the source code of the template to be
                   rendered
    :param context: the variables that should be available in the
                    context of the template.
    )r   r   r   rJ   rH   rK   Úfrom_string)ÚsourcerE   rN   s      r   Úrender_template_stringrS   ‰   sP   € õ Ô
€CØ„G×#Ò# GÑ,Ô,Ð,Ý�3”7Ô$×0Ò0°Ñ8Ô8Ø˜CœGñ%ô %ð %r   N)r"   Újinja2r   r   r   r   Úglobalsr   r   Úsignalsr	   r
   r   r%   rH   rO   rS   r#   r   r   ú<module>rW      s  ððð ðð ð ð ð ð ð ð ð ð ð 8Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >ðð ð ð
ð 
ð 
ð 
ð 
�/ñ 
ô 
ð 
ð?ð ?ð ?ð ?ð ?˜Zñ ?ô ?ð ?ðDð ð ð%ð %ð %ð %ð %ð %ð %ð %r   