
    Ti              	       t   S SK rS SKJr  S SKJr  S SKJr  S SKJr  SSKJ	r	  SSKJ
r
  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \R$                  (       a  SSKJr  SSKJr  S\R.                  \\R2                  4   4S jr " S S\5      r " S S\5      rSSS\S\R.                  \\R2                  4   S\4S jrS\R:                  \\\R<                  \R:                  \\4      4   S\R2                  S\4S jrS\S\R2                  S\4S jr SSS\S\R.                  \\R2                  4   S\RB                  \   4S jr"S\R:                  \\\R<                  \R:                  \\4      4   S\R2                  S\RB                  \   4S  jr#S\S\R2                  S\RB                  \   4S! jr$g)"    N)
BaseLoader)Environment)Template)TemplateNotFound   )_cv_app)_cv_request)current_app)request)stream_with_context)before_render_template)template_rendered)Flask)Scaffoldreturnc                      [         R                  " S5      n [        R                  " S5      n0 nU b  U R                  US'   Ub  UR                  US'   UR
                  US'   U$ )zKDefault template context processor.  Injects `request`,
`session` and `g`.
Ngr   session)r   getr	   r   r   r   )appctxreqctxrvs      b/var/www/html/backend/Backoffice_Marketplace/venv/lib/python3.13/site-packages/flask/templating.py_default_template_ctx_processorr      s]     [[F__T"FB((399I    c                   B    \ rS rSrSrSSS\R                  SS4S jrS	rg)
r   $   zWorks 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.
appr   optionsr   Nc                 p    SU;  a  UR                  5       US'   [        R                  " U 40 UD6  Xl        g )Nloader)create_global_jinja_loaderBaseEnvironment__init__r   )selfr   r   s      r   r$   Environment.__init__*   s5    7" # > > @GH  11r   r   )	__name__
__module____qualname____firstlineno____doc__tAnyr$   __static_attributes__ r   r   r   r   $   s%    
G  $ r   r   c            
          \ rS rSrSrSS jrS\S\S\R                  \\R                  \   \R                  \R                     4   4S jrS\S\S\R                  \\R                  \   \R                  \R                     4   4S	 jrS\S\S\R                  \\R                  \   \R                  \R                     4   4S
 jrS\S\R                  \R                  S\4   SS4   4S jrS\R$                  \   4S jrSrg)DispatchingJinjaLoader1   zTA loader that looks for templates in the application and all
the blueprint folders.
r   Nc                     Xl         g Nr'   )r%   r   s     r   r$   DispatchingJinjaLoader.__init__6   s    r   environmenttemplatec                     U R                   R                  S   (       a  U R                  X5      $ U R                  X5      $ )NEXPLAIN_TEMPLATE_LOADING)r   config_get_source_explained_get_source_fast)r%   r7   r8   s      r   
get_source!DispatchingJinjaLoader.get_source9   s7     88??56--kDD$$[;;r   c                    / nS nU R                  U5       H/  u  pV UR                  X5      nUc  UnUR                  XeU45        M1     SSKJn  U" U R                  X#5        Ub  U$ [        U5      e! [         a    S n NNf = f)Nr   )!explain_template_loading_attempts)_iter_loadersr>   r   appenddebughelpersrA   r   )	r%   r7   r8   attemptstrvsrcobjr!   r   rA   s	            r   r<   ,DispatchingJinjaLoader._get_source_explained@   s       	 #00:NF&&{=;C OOVR01 ; 	D)$((HG?Jx(( $ s   A22B Bc                     U R                  U5       H  u  p4 UR                  X5      s  $    [        U5      e! [         a     M3  f = fr5   )rB   r>   r   )r%   r7   r8   _srcobjr!   s        r   r=   'DispatchingJinjaLoader._get_source_fastZ   sR      $11(;OG((??  <
 x(( $ s   8
AAr   c              #      #    U R                   R                  nUb  U R                   U4v   U R                   R                  5        H  nUR                  nUc  M  X24v   M     g 7fr5   )r   jinja_loaderiter_blueprints)r%   r8   r!   	blueprints       r   rB   $DispatchingJinjaLoader._iter_loadersd   s\      &&((F""113I++F!'' 4s   AA$
A$c                 P   [        5       nU R                  R                  nUb  UR                  UR	                  5       5        U R                  R                  5        H<  nUR                  nUc  M  UR	                  5        H  nUR                  U5        M     M>     [        U5      $ r5   )setr   rM   updatelist_templatesrN   addlist)r%   resultr!   rO   r8   s        r   rT   %DispatchingJinjaLoader.list_templatesp   s    &&MM&//12113I++F! & 5 5 7HJJx( !8 4 F|r   r'   )r   r   r   N)r(   r)   r*   r+   r,   r$   r   strr-   TupleOptionalCallabler>   r<   r=   	Generatorr   rB   ListrT   r/   r0   r   r   r2   r2   1   s   <&<25<	
ajjoqzz!**'==	><)&)25)	
ajjoqzz!**'==	>)4)&)25)	
ajjoqzz!**'==	>)
(
(	
QWWZ34dD@	A
(s r   r2   r   r   r8   contextc                     U R                  U5        [        R                  " XUS9  UR                  U5      n[        R                  " XUS9  U$ Nr8   r_   )update_template_contextr   sendrenderr   )r   r8   r_   r   s       r   _renderrf      sC    (H		!B37CIr   template_name_or_listc                 z    [         R                  " 5       nUR                  R                  U 5      n[	        X#U5      $ )zRender 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_templaterf   rg   r_   r   r8   s       r   render_templaterm      s4     
)
)
+C}}334IJH3'**r   sourcec                 z    [         R                  " 5       nUR                  R                  U 5      n[	        X#U5      $ )zRender 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
   ri   rj   from_stringrf   rn   r_   r   r8   s       r   render_template_stringrr      s3     
)
)
+C}}((0H3'**r   c                    ^ ^^ T R                  T5        [        R                  " T TTS9  S[        R                  [
           4U UU4S jjnU" 5       n[        (       a  [        U5      nU$ )Nrb   r   c               3   p   >#    TR                  T5       S h  vN   [        R                  " T TTS9  g  N7fra   )generater   rd   )r   r_   r8   s   r   ru   _stream.<locals>.generate   s1     $$W---sXwG 	.s   646)rc   r   rd   r-   IteratorrY   r   r   )r   r8   r_   ru   r   s   ```  r   _streamrx      s`     (hHHajjo H H 
B w $Ir   c                 z    [         R                  " 5       nUR                  R                  U 5      n[	        X#U5      $ )aw  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
   ri   rj   rk   rx   rl   s       r   stream_templaterz      s4     
)
)
+C}}334IJH3'**r   c                 z    [         R                  " 5       nUR                  R                  U 5      n[	        X#U5      $ )aB  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
   ri   rj   rp   rx   rq   s       r   stream_template_stringr|      s3     
)
)
+C}}((0H3'**r   )%typingr-   jinja2r   r   r#   r   r   globalsr   r	   r
   r   helpersr   signalsr   r   TYPE_CHECKINGr   r   scaffoldr   DictrY   r.   r   r2   rf   Unionr^   rm   rr   rw   rx   rz   r|   r0   r   r   <module>r      s     1  #       ( + &??"QUU
); 
/ 
KZ K\ H qvvc155j7I c +773!&&h9O2P#PQ+uu+ 	+	+3 	+155 	+S 	+	$/0vvc155j/AZZ_&+773!&&h9O2P#PQ+uu+ ZZ_+&+3 +155 +QZZ_ +r   