Ë
    JU hq  ã                  ód  — 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 ddlmZ ej(                  rddlmZ ddlmZ ddlmZ dd„Z G d„ de«      Z G d„ de«      Zdd„Z	 	 	 	 	 	 dd„Zd d„Z	 	 	 	 	 	 	 	 d!d„Z 	 	 	 	 	 	 d"d„Z!d#d„Z"y)$é    )ÚannotationsN)Ú
BaseLoader)ÚEnvironment)ÚTemplate)ÚTemplateNotFoundé   )Ú_cv_app)Ú_cv_request)Úcurrent_app)Úrequest)Ústream_with_context)Úbefore_render_template)Útemplate_rendered)ÚFlask)ÚApp)ÚScaffoldc                 óÀ   — t        j                  d«      } t        j                  d«      }i }| �| j                  |d<   |�|j                  |d<   |j
                  |d<   |S )zSDefault template context processor.  Injects `request`,
    `session` and `g`.
    NÚgr   Úsession)r	   Úgetr
   r   r   r   )ÚappctxÚreqctxÚrvs      úH/var/www/timesheet/venv/lib/python3.12/site-packages/flask/templating.pyÚ_default_template_ctx_processorr      s]   € ô �[‰[˜Ó€FÜ�_‰_˜TÓ"€FØ€BØÐØ—(‘(ˆˆ3‰ØÐØŸ™ˆˆ9‰ØŸ™ˆˆ9‰Ø€Ió    c                  ó   — e Zd ZdZdd„Zy)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                ól   — d|vr|j                  «       |d<   t        j                  | fi |¤Ž || _        y )NÚloader)Úcreate_global_jinja_loaderÚBaseEnvironmentÚ__init__Úapp)Úselfr#   Úoptionss      r   r"   zEnvironment.__init__-   s7   € Ø˜7Ñ"Ø #× >Ñ >Ó @ˆG�HÑÜ× Ñ  Ñ1¨Ò1Øˆ�r   N)r#   r   r%   út.AnyÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   © r   r   r   r   '   s   „ ñô
r   r   c                  ód   — e Zd ZdZd	d„Z	 	 	 	 	 	 d
d„Z	 	 	 	 	 	 d
d„Z	 	 	 	 	 	 d
d„Zdd„Zdd„Z	y)ÚDispatchingJinjaLoaderz\A loader that looks for templates in the application and all
    the blueprint folders.
    c                ó   — || _         y ©N)r#   )r$   r#   s     r   r"   zDispatchingJinjaLoader.__init__9   s	   € Øˆ�r   c                ó|   — | j                   j                  d   r| j                  ||«      S | j                  ||«      S )NÚEXPLAIN_TEMPLATE_LOADING)r#   ÚconfigÚ_get_source_explainedÚ_get_source_fast)r$   ÚenvironmentÚtemplates      r   Ú
get_sourcez!DispatchingJinjaLoader.get_source<   s;   € ð �8‰8�?‰?Ð5Ò6Ø×-Ñ-¨k¸8ÓDÐDØ×$Ñ$ [°(Ó;Ð;r   c                ó  — g }d }| j                  |«      D ]0  \  }}	 |j                  ||«      }|€|}|j                  |||f«       Œ2 ddlm}  || j                  ||«       |�|S t        |«      ‚# t        $ r d }Y ŒLw xY w)Nr   )Ú!explain_template_loading_attempts)Ú_iter_loadersr9   r   ÚappendÚdebughelpersr;   r#   )	r$   r7   r8   ÚattemptsÚtrvÚsrcobjr   r   r;   s	            r   r5   z,DispatchingJinjaLoader._get_source_explainedC   s£   € ð ˆàLPˆà"×0Ñ0°Ó:ò 	2‰NˆF�FðØ×&Ñ& {°HÓ=�Ø�;Ø�Cð �O‰O˜V V¨RÐ0Õ1ð	2õ 	Dá)¨$¯(©(°H¸hÔGàˆ?ØˆJÜ˜xÓ(Ð(øô $ò Ø’ðús   �A2Á2B Á?B c                ó�   — | j                  |«      D ]  \  }}	 |j                  ||«      c S  t        |«      ‚# t        $ r Y Œ2w xY wr1   )r<   r9   r   )r$   r7   r8   Ú_srcobjr   s        r   r6   z'DispatchingJinjaLoader._get_source_fast[   s[   € ð  $×1Ñ1°(Ó;ò 	‰OˆG�VðØ×(Ñ(¨°hÓ?Ò?ð	ô
 ˜xÓ(Ð(øô $ò Ùðús   ™9¹	AÁAc              #  óÄ   K  — | j                   j                  }|�| j                   |f–— | j                   j                  «       D ]  }|j                  }|€Œ||f–— Œ y ­wr1   )r#   Újinja_loaderÚiter_blueprints)r$   r8   r   Ú	blueprints       r   r<   z$DispatchingJinjaLoader._iter_loaderse   sb   è ø€ Ø—‘×&Ñ&ˆØÐØ—(‘(˜FÐ"Ò"àŸ™×1Ñ1Ó3ò 	(ˆIØ×+Ñ+ˆFØÑ!Ø Ð'Ó'ñ	(ùs   ‚AA Á	A c                óB  — t        «       }| j                  j                  }|�|j                  |j	                  «       «       | j                  j                  «       D ]7  }|j                  }|€Œ|j	                  «       D ]  }|j                  |«       Œ Œ9 t        |«      S r1   )Úsetr#   rE   ÚupdateÚlist_templatesrF   ÚaddÚlist)r$   Úresultr   rG   r8   s        r   rK   z%DispatchingJinjaLoader.list_templateso   s�   € Ü“ˆØ—‘×&Ñ&ˆØÐØ�M‰M˜&×/Ñ/Ó1Ô2àŸ™×1Ñ1Ó3ò 	)ˆIØ×+Ñ+ˆFØÑ!Ø &× 5Ñ 5Ó 7ò )�HØ—J‘J˜xÕ(ñ)ð	)ô �F‹|Ðr   N)r#   r   r'   r(   )r7   r!   r8   Ústrr'   z3tuple[str, str | None, t.Callable[[], bool] | None])r8   rO   r'   z't.Iterator[tuple[Scaffold, BaseLoader]])r'   z	list[str])
r)   r*   r+   r,   r"   r9   r5   r6   r<   rK   r-   r   r   r/   r/   4   sm   „ ñóð<Ø*ð<Ø69ð<à	<ó<ð)Ø*ð)Ø69ð)à	<ó)ð0)Ø*ð)Ø69ð)à	<ó)ó(ôr   r/   c                óÖ   — | j                  |«       t        j                  | | j                  ||¬«       |j	                  |«      }t        j                  | | j                  ||¬«       |S ©N©Ú_async_wrapperr8   Úcontext)Úupdate_template_contextr   ÚsendÚensure_syncÚrenderr   )r#   r8   rT   r   s       r   Ú_renderrY   ~   s]   € Ø×Ñ Ô(Ü×ÑØ˜CŸO™O°hÈõð 
�‰˜Ó	!€BÜ×ÑØ˜CŸO™O°hÈõð €Ir   c                óz   — t        j                  «       }|j                  j                  | «      }t	        |||«      S )a  Render a template by name with the given context.

    :param template_name_or_list: The name of the template to render. If
        a list is given, the first name to exist will be rendered.
    :param context: The variables to make available in the template.
    )r   Ú_get_current_objectÚ	jinja_envÚget_or_select_templaterY   ©Útemplate_name_or_listrT   r#   r8   s       r   Úrender_templater`   Š   s6   € ô ×
)Ñ
)Ó
+€CØ�}‰}×3Ñ3Ð4IÓJ€HÜ�3˜ 'Ó*Ð*r   c                óz   — t        j                  «       }|j                  j                  | «      }t	        |||«      S )zÓRender a template from the given source string with the given
    context.

    :param source: The source code of the template to render.
    :param context: The variables to make available in the template.
    )r   r[   r\   Úfrom_stringrY   ©ÚsourcerT   r#   r8   s       r   Úrender_template_stringre   ™   s5   € ô ×
)Ñ
)Ó
+€CØ�}‰}×(Ñ(¨Ó0€HÜ�3˜ 'Ó*Ð*r   c                ó´   ‡ ‡‡— ‰ j                  ‰«       t        j                  ‰ ‰ j                  ‰‰¬«       dˆ ˆˆfd„} |«       }t        rt        |«      }|S )NrR   c               3  óŠ   •K  — ‰j                  ‰«      E d {  –—†  t        j                  ‰ ‰ j                  ‰‰¬«       y 7 Œ(­wrQ   )Úgenerater   rV   rW   )r#   rT   r8   s   €€€r   rh   z_stream.<locals>.generate­   s;   øè ø€ Ø×$Ñ$ WÓ-×-Ð-Ü×ÑØ §¡¸(ÈGö	
ð 	.ús   ƒA˜A™)A)r'   út.Iterator[str])rU   r   rV   rW   r   r   )r#   r8   rT   rh   r   s   ```  r   Ú_streamrj   ¥   sP   ú€ ð ×Ñ Ô(Ü×ÑØ˜CŸO™O°hÈõ÷
ñ 
‹€Bõ Ü  Ó$ˆà€Ir   c                óz   — t        j                  «       }|j                  j                  | «      }t	        |||«      S )a“  Render a template by name with the given context as a stream.
    This returns an iterator of strings, which can be used as a
    streaming response from a view.

    :param template_name_or_list: The name of the template to render. If
        a list is given, the first name to exist will be rendered.
    :param context: The variables to make available in the template.

    .. versionadded:: 2.2
    )r   r[   r\   r]   rj   r^   s       r   Ústream_templaterl   ¼   s6   € ô ×
)Ñ
)Ó
+€CØ�}‰}×3Ñ3Ð4IÓJ€HÜ�3˜ 'Ó*Ð*r   c                óz   — t        j                  «       }|j                  j                  | «      }t	        |||«      S )aZ  Render a template from the given source string with the given
    context as a stream. This returns an iterator of strings, which can
    be used as a streaming response from a view.

    :param source: The source code of the template to render.
    :param context: The variables to make available in the template.

    .. versionadded:: 2.2
    )r   r[   r\   rb   rj   rc   s       r   Ústream_template_stringrn   Ï   s5   € ô ×
)Ñ
)Ó
+€CØ�}‰}×(Ñ(¨Ó0€HÜ�3˜ 'Ó*Ð*r   )r'   údict[str, t.Any])r#   r   r8   r   rT   ro   r'   rO   )r_   ú%str | Template | list[str | Template]rT   r&   r'   rO   )rd   rO   rT   r&   r'   rO   )r#   r   r8   r   rT   ro   r'   ri   )r_   rp   rT   r&   r'   ri   )rd   rO   rT   r&   r'   ri   )#Ú
__future__r   ÚtypingÚtÚjinja2r   r   r!   r   r   Úglobalsr	   r
   r   r   Úhelpersr   Úsignalsr   r   ÚTYPE_CHECKINGr#   r   Ú
sansio.appr   Úsansio.scaffoldr   r   r/   rY   r`   re   rj   rl   rn   r-   r   r   ú<module>r{      sÎ   ðÝ "ã å Ý 1Ý Ý #å Ý  Ý  Ý Ý (Ý +Ý &à‡?‚?ÝÝÝ)óô
�/ô 
ôG˜Zô GóT	ð+Ø@ð+àð+ð 	ó+ó	+ðØ	ðØ"ðØ-=ðàóð.+Ø@ð+àð+ð ó+ô&+r   