ó
    ‰*£h¡:  ã                   ór  • % S r SSKrSSKr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  \R0                  " S\R2                  S\R4                  4   S9rSr\" 5       r\R>                  \    \!S'   \" 5       r"\R>                  \    \!S'   SS1r#SS1r$SS1r%\RL                  \'" / SQ5      4\RP                  \'" / SQ5      4\RR                  \'" / SQ5      4\	\'" / SQ5      44r*\RV                  \RV                  \RX                  \R4                     \RZ                  \    4   S4   \!S'   S \.S!\/4S" jr0S#\S!\4S$ jr1S%\R4                  S&\ S!\24S' jr3S%\R4                  S&\ S!\24S( jr4 " S) S*\5      r5 " S+ S,\55      r6 " S- S.\5      r7 " S/ S0\7\5      r8g)1z„A sandbox layer that ensures unsafe operations cannot be performed.
Useful when the template itself comes from an untrusted source.
é    N)Úformatter_field_name_split)Úabc)Údeque)Úupdate_wrapper)Ú	Formatter)ÚEscapeFormatter)ÚMarkupé   )ÚEnvironment)ÚSecurityError)ÚContext)Ú	UndefinedÚF.)Úboundi † ÚUNSAFE_FUNCTION_ATTRIBUTESÚUNSAFE_METHOD_ATTRIBUTESÚgi_frameÚgi_codeÚcr_frameÚcr_codeÚag_codeÚag_frame)ÚaddÚclearÚdifference_updateÚdiscardÚpopÚremoveÚsymmetric_difference_updateÚupdate)r   r   ÚpopitemÚ
setdefaultr    )Úappendr   r   ÚreverseÚinsertÚsortÚextendr   )	r#   Ú
appendleftr   r'   Ú
extendleftr   Úpopleftr   ÚrotateÚ_mutable_specÚargsÚreturnc                  ób   • [        U 6 n[        U5      [        :”  a  [        S[         S35      eU$ )zOA range that can't generate ranges with a length of more than
MAX_RANGE items.
z@Range too big. The sandbox blocks ranges larger than MAX_RANGE (z).)ÚrangeÚlenÚ	MAX_RANGEÚOverflowError)r-   Úrngs     ÚK/home/mande/repo/quber/.venv/lib/python3.13/site-packages/jinja2/sandbox.pyÚ
safe_ranger6   W   s>   € ô �ˆ,€Cä
ˆ3ƒx”)ÓÜðÜ$˜+ Rð)ó
ð 	
ð
 €Jó    Úfc                 ó   • SU l         U $ )zmMarks a function or method as unsafe.

.. code-block: python

    @unsafe
    def delete(self):
        pass
T)Úunsafe_callable)r8   s    r5   Úunsafer;   f   s   € ð €AÔØ€Hr7   ÚobjÚattrc                 óô  • [        U [        R                  5      (       a  U[        ;   a  gGO<[        U [        R                  5      (       a  U[        ;   d
  U[
        ;   a  gGO[        U [        5      (       a  US:X  a  gOé[        U [        R                  [        R                  [        R                  45      (       a  g[        U [        R                  5      (       a  U[        ;   a  gO[        [        S5      (       a+  [        U [        R                  5      (       a  U[        ;   a  gO?[        [        S5      (       a*  [        U [        R                  5      (       a  U[         ;   a  gUR#                  S5      $ )a�  Test if the attribute given is an internal python attribute.  For
example this function returns `True` for the `func_code` attribute of
python objects.  This is useful if the environment method
:meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.

>>> from jinja2.sandbox import is_internal_attribute
>>> is_internal_attribute(str, "mro")
True
>>> is_internal_attribute(str, "upper")
False
TÚmroÚCoroutineTypeÚAsyncGeneratorTypeÚ__)Ú
isinstanceÚtypesÚFunctionTyper   Ú
MethodTyper   ÚtypeÚCodeTypeÚTracebackTypeÚ	FrameTypeÚGeneratorTypeÚUNSAFE_GENERATOR_ATTRIBUTESÚhasattrr@   ÚUNSAFE_COROUTINE_ATTRIBUTESrA   Ú!UNSAFE_ASYNC_GENERATOR_ATTRIBUTESÚ
startswith)r<   r=   s     r5   Úis_internal_attributerQ   s   s,  € ô �#”u×)Ñ)×*Ñ*ØÔ-Ó-Øñ .ä	�Cœ×)Ñ)×	*Ñ	*ØÔ-Ó-°Ô9QÓ1QØñ 2Rä	�Cœ×	Ñ	Ø�5‹=Øð ä	�Cœ%Ÿ.™.¬%×*=Ñ*=¼u¿¹ÐO×	PÑ	PØÜ	�Cœ×,Ñ,×	-Ñ	-ØÔ.Ó.Øð /ä	”˜×	(Ñ	(¬Z¸¼U×=PÑ=P×-QÑ-QØÔ.Ó.Øð /ä	”Ð,×	-Ñ	-´*ØŒU×%Ñ%÷3ñ 3ð Ô4Ó4ØØ�?‰?˜4Ó Ð r7   c                 óN   • [          H  u  p#[        X5      (       d  M  X;   s  $    g)a¸  This function checks if an attribute on a builtin mutable object
(list, dict, set or deque) or the corresponding ABCs would modify it
if called.

>>> modifies_known_mutable({}, "clear")
True
>>> modifies_known_mutable({}, "keys")
False
>>> modifies_known_mutable([], "append")
True
>>> modifies_known_mutable([], "index")
False

If called with an unsupported object, ``False`` is returned.

>>> modifies_known_mutable("foo", "upper")
False
F)r,   rC   )r<   r=   Útypespecr;   s       r5   Úmodifies_known_mutablerT   ˜   s)   € ÷& *ÑˆÜ�c×$Ó$Ø‘>Ò!ñ *ð r7   c            
       óz  ^ • \ rS rSr% SrSr\R                  \R                  \R                  \R                  \R                  \R                  \R                  S.r\R                   \\R$                  \R&                  \R&                  /\R&                  4   4   \S'   \R*                  \R,                  S.r\R                   \\R$                  \R&                  /\R&                  4   4   \S'   \" 5       r\R4                  \   \S'   \" 5       r\R4                  \   \S	'   S
\R&                  S\R&                  SS4U 4S jjrS\R&                  S\S\R&                  S\4S jrS\R&                  S\4S jrS\ S\S\R&                  S\R&                  S\R&                  4
S jr!S\ S\S\R&                  S\R&                  4S jr"S\R&                  S\RF                  \\R&                  4   S\RF                  \R&                  \$4   4S jr%S\R&                  S\S\RF                  \R&                  \$4   4S jr&S\R&                  S\S\$4S jr'S\R&                  S\RP                  \R$                  S \4      4S! jr)S"\ S#\R&                  S
\R&                  S\R&                  S\R&                  4
S$ jr*S%r+U =r,$ )&ÚSandboxedEnvironmenté±   aÍ  The sandboxed environment.  It works like the regular environment but
tells the compiler to generate sandboxed code.  Additionally subclasses of
this environment may override the methods that tell the runtime what
attributes or functions are safe to access.

If the template tries to access insecure code a :exc:`SecurityError` is
raised.  However also other exceptions may occur during the rendering so
the caller has to ensure that all exceptions are caught.
T)Ú+Ú-Ú*Ú/z//z**Ú%Údefault_binop_table)rX   rY   Údefault_unop_tableÚintercepted_binopsÚintercepted_unopsr-   Úkwargsr.   Nc                 óÈ   >• [         TU ]  " U0 UD6  [        U R                  S'   U R                  R                  5       U l        U R                  R                  5       U l        g )Nr0   )	ÚsuperÚ__init__r6   Úglobalsr]   ÚcopyÚbinop_tabler^   Ú
unop_table)Úselfr-   ra   Ú	__class__s      €r5   rd   ÚSandboxedEnvironment.__init__ò   sP   ø€ Ü‰Ò˜$Ð) &Ò)Ü *ˆ�‰�WÑØ×3Ñ3×8Ñ8Ó:ˆÔØ×1Ñ1×6Ñ6Ó8ˆ�r7   r<   r=   Úvaluec                 óR   • UR                  S5      =(       d    [        X5      (       + $ )a1  The sandboxed environment will call this method to check if the
attribute of an object is safe to access.  Per default all attributes
starting with an underscore are considered private as well as the
special attributes of internal python objects as returned by the
:func:`is_internal_attribute` function.
Ú_)rP   rQ   )ri   r<   r=   rl   s       r5   Úis_safe_attributeÚ&SandboxedEnvironment.is_safe_attributeø   s!   € ð —O‘O CÓ(×LÔ,AÀ#Ó,LÔMÐMr7   c                 óN   • [        USS5      =(       d    [        USS5      (       + $ )zÊCheck if an object is safely callable. By default callables
are considered safe unless decorated with :func:`unsafe`.

This also recognizes the Django convention of setting
``func.alters_data = True``.
r:   FÚalters_data)Úgetattr)ri   r<   s     r5   Úis_safe_callableÚ%SandboxedEnvironment.is_safe_callable  s*   € ô �CÐ*¨EÓ2×X´g¸cÀ=ÐRWÓ6Xô
ð 	
r7   ÚcontextÚoperatorÚleftÚrightc                 ó,   • U R                   U   " X45      $ )z×For intercepted binary operator calls (:meth:`intercepted_binops`)
this function is executed instead of the builtin operator.  This can
be used to fine tune the behavior of certain operators.

.. versionadded:: 2.6
)rg   )ri   rv   rw   rx   ry   s        r5   Ú
call_binopÚSandboxedEnvironment.call_binop  s   € ð ×Ñ Ò)¨$Ó6Ð6r7   Úargc                 ó,   • U R                   U   " U5      $ )zÕFor intercepted unary operator calls (:meth:`intercepted_unops`)
this function is executed instead of the builtin operator.  This can
be used to fine tune the behavior of certain operators.

.. versionadded:: 2.6
)rh   )ri   rv   rw   r}   s       r5   Ú	call_unopÚSandboxedEnvironment.call_unop  s   € ð �‰˜xÒ(¨Ó-Ð-r7   Úargumentc                 ó€  •  X   $ ! [         [        4 a˜    [        U[        5      (       a€   [        U5      n [	        X5      nU R                  U5      nUb  Us $ U R                  XU5      (       a  Us $ U R                  X5      s $ ! [         a      Of = f! [         a      O
f = f Of = fU R                  XS9$ )z(Subscribe an object from sandboxed code.©r<   Úname)Ú	TypeErrorÚLookupErrorrC   Ústrrs   Úwrap_str_formatro   Úunsafe_undefinedÚAttributeErrorÚ	ExceptionÚ	undefined)ri   r<   r�   r=   rl   Úfmts         r5   ÚgetitemÚSandboxedEnvironment.getitem   sÖ   € ð	DØ‘=Ð øÜœ;Ð'ó 	DÜ˜(¤C×(Ñ(ðDÜ˜x›=�Dð
DÜ '¨Ó 2˜ð #×2Ñ2°5Ó9˜Ø™?Ø#&šJØ×1Ñ1°#À×GÑGØ#(šLØ#×4Ñ4°SÓCÒCøô *ó Úðûô !ó Úðúñ )ð	Dúð$ �~‰~ #ˆ~Ð5Ð5s[   ‚ †%B.¬B¸B	ÁB.ÁB.Á6B.Â	
BÂB.ÂBÂB.Â
B(Â$B.Â'B(Â(B.Â-B.Ú	attributec                 ó  •  [        X5      nU R                  U5      nUb  U$ U R                  XU5      (       a  U$ U R                  X5      $ ! [         a     X   s $ ! [
        [        4 a      Of = ff = fU R                  XS9$ )zpSubscribe an object from sandboxed code and prefer the
attribute.  The attribute passed *must* be a bytestring.
rƒ   )rs   rˆ   ro   r‰   rŠ   r…   r†   rŒ   )ri   r<   r�   rl   r�   s        r5   rs   ÚSandboxedEnvironment.getattr:  sž   € ð	9Ü˜CÓ+ˆEð ×&Ñ& uÓ-ˆCØ‰Ø�
Ø×%Ñ% c°e×<Ñ<Ø�Ø×(Ñ(¨Ó8Ð8øô ó 	ðØ‘~Ò%øÜœ{Ð+ó Úðúð	úð �~‰~ #ˆ~Ð6Ð6s/   ‚A Á
A6ÁAÁA6ÁA2Á.A6Á1A2Á2A6c                 óf   • U R                  SU< S[        U5      R                  < S3UU[        S9$ )z1Return an undefined object for unsafe attributes.zaccess to attribute z of z object is unsafe.)r„   r<   Úexc)rŒ   rG   Ú__name__r   )ri   r<   r�   s      r5   r‰   Ú%SandboxedEnvironment.unsafe_undefinedN  sE   € à�~‰~Ø" 9¡-ð 0Ü�S“	×"Ñ"Ñ%Ð%7ð9àØÜð ð 
ð 	
r7   .c                 óü  ^^^^• [        U[        R                  [        R                  45      (       a  UR                  S;  a  gUR
                  m[        T[        5      (       d  g[        T5      mUR                  S:H  m[        T[        5      (       a  [        U TR                  S9nO[        U 5      nUR                  mS[        R                  S[        R                  S[        4UUUU4S jjn[        X15      $ )	zàIf the given value is a ``str.format`` or ``str.format_map`` method,
return a new function than handles sandboxing. This is done at access
rather than in :meth:`call`, so that calls made without ``call`` are
also sandboxed.
)ÚformatÚ
format_mapNr™   )Úescaper-   ra   r.   c                  ó°   >• T(       a@  U(       a  [        S5      e[        U 5      S:w  a  [        S[        U 5       S35      eU S   nSn T" T" TX5      5      $ )Nz'format_map() takes no keyword argumentsr
   z)format_map() takes exactly one argument (z given)r   © )r…   r1   )r-   ra   Úf_selfÚis_format_mapÚstr_typeÚvformats     €€€€r5   ÚwrapperÚ5SandboxedEnvironment.wrap_str_format.<locals>.wrappers  s_   ø€ ÞÞÜ#Ð$MÓNÐNä�t“9 “>Ü#ØCÄCÈÃIÀ;ÈgÐVóð ð ˜a™�Ø�á™G F¨DÓ9Ó:Ð:r7   )rC   rD   rF   ÚBuiltinMethodTyper•   Ú__self__r‡   rG   r	   ÚSandboxedEscapeFormatterrš   ÚSandboxedFormatterr    ÚtÚAnyr   )ri   rl   Ú	formatterr¡   r�   rž   rŸ   r    s       @@@@r5   rˆ   Ú$SandboxedEnvironment.wrap_str_formatX  sÐ   û€ ô Ø”E×$Ñ$¤e×&=Ñ&=Ð>÷
ñ 
à�^‰^Ð#;Ó;ØàŸ™ˆä˜&¤#×&Ñ&Øä $ V£ˆØŸ™¨,Ñ6ˆô �fœf×%Ñ%Ü0°¸f¿m¹mÑL‰Iä*¨4Ó0ˆIà×#Ñ#ˆð	;œ1Ÿ5™5ð 	;¬A¯E©Eð 	;´c÷ 	;ò 	;ô ˜gÓ-Ð-r7   Ú_SandboxedEnvironment__contextÚ_SandboxedEnvironment__objc                 óx   • U R                  U5      (       d  [        U< S35      eUR                  " U/UQ70 UD6$ )z#Call an object from sandboxed code.z is not safely callable)rt   r   Úcall)Ú_SandboxedEnvironment__selfr«   r¬   r-   ra   s        r5   r®   ÚSandboxedEnvironment.call„  sA   € ð ×&Ñ& u×-Ñ-Ü 5¡)Ð+BÐ CÓDÐDØ�~Š~˜eÐ5 dÒ5¨fÑ5Ð5r7   )rg   rh   )-r•   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	sandboxedrw   r   ÚsubÚmulÚtruedivÚfloordivÚpowÚmodr]   r§   ÚDictr‡   ÚCallabler¨   Ú__annotations__ÚposÚnegr^   Ú	frozensetr_   Ú	FrozenSetr`   rd   Úboolro   rt   r   r{   r   ÚUnionr   rŽ   rs   r‰   ÚOptionalrˆ   r®   Ú__static_attributes__Ú__classcell__©rj   s   @r5   rV   rV   ±   sÊ  ø‡ ñð €Ið �\‰\Ø�\‰\Ø�\‰\Ø×ÑØ×ÑØ�l‰lØ�\‰\ñKÐ˜Ÿ™  Q§Z¡Z°·±¸¿¹°ÀÇÁÐ0EÑ%FÐ FÑGó ð �\‰\Ø�\‰\ñCÐ˜Ÿ™˜s A§J¡J°·±¨w¸¿¹¨~Ñ$>Ð>Ñ?ó ñ& ,5«;Ð˜Ÿ™ CÑ(Ó6ñ +4«+Ð�q—{‘{ 3Ñ'Ó5ð9˜aŸe™eð 9¨q¯u©uð 9¸÷ 9ðN Q§U¡Uð N°#ð N¸a¿e¹eð NÈô Nð	
 A§E¡Eð 	
¨dô 	
ð	7Øð	7Ø*-ð	7Ø56·U±Uð	7ØCDÇ5Á5ð	7à	
�‰ô	7ð. ð .°Cð .¸a¿e¹eð .ÈÏÉô .ð6Ø—5‘5ð6Ø$%§G¡G¨C°·±¨JÑ$7ð6à	
�‰�—‘˜	Ð!Ñ	"ô6ð47˜1Ÿ5™5ð 7¨Sð 7°Q·W±W¸Q¿U¹UÀIÐ=MÑ5Nô 7ð(
 A§E¡Eð 
°cð 
¸iô 
ð*. Q§U¡Uð *.¨q¯z©z¸!¿*¹*ÀSÈ#ÀXÑ:NÑ/Oô *.ðX6àð6ð �u‰uð6ð �u‰uð	6ð
 —%‘%ð6ð 
�‰÷6ò 6r7   rV   c                   óh   ^ • \ rS rSrSrS\R                  S\S\R                  S\4U 4S jjr	Sr
U =r$ )	ÚImmutableSandboxedEnvironmenti”  zÇWorks exactly like the regular `SandboxedEnvironment` but does not
permit modifications on the builtin mutable objects `list`, `set`, and
`dict` by using the :func:`modifies_known_mutable` function.
r<   r=   rl   r.   c                 óP   >• [         TU ]  XU5      (       d  g[        X5      (       + $ )NF)rc   ro   rT   )ri   r<   r=   rl   rj   s       €r5   ro   Ú/ImmutableSandboxedEnvironment.is_safe_attributeš  s&   ø€ Ü‰wÑ(¨°E×:Ñ:Øä)¨#Ó4Ô4Ð4r7   rœ   )r•   r±   r²   r³   r´   r§   r¨   r‡   rÃ   ro   rÆ   rÇ   rÈ   s   @r5   rÊ   rÊ   ”  s6   ø† ñð
5 Q§U¡Uð 5°#ð 5¸a¿e¹eð 5È÷ 5õ 5r7   rÊ   c            
       óø   ^ • \ rS rSrS\S\R                  SS4U 4S jjrS\S\R                  \R                     S\R                  \\R                  4   S\R                  \R                  \4   4S	 jrS
rU =r$ )r¦   i¡  Úenvra   r.   Nc                 ó2   >• Xl         [        TU ]  " S0 UD6  g )Nrœ   )Ú_envrc   rd   )ri   rÎ   ra   rj   s      €r5   rd   ÚSandboxedFormatter.__init__¢  s   ø€ ØŒ	Ü‰ÒÑ"˜6Ó"r7   Ú
field_namer-   c                 óÚ   • [        U5      u  pEU R                  XBU5      nU HD  u  pxU(       a  U R                  R                  Xh5      nM)  U R                  R	                  Xh5      nMF     Xd4$ )N)r   Ú	get_valuerÐ   rs   rŽ   )	ri   rÒ   r-   ra   ÚfirstÚrestr<   Úis_attrÚis	            r5   Ú	get_fieldÚSandboxedFormatter.get_field¦  sa   € ô 1°Ó<‰ˆØ�n‰n˜U¨&Ó1ˆÛ‰JˆGÞØ—i‘i×'Ñ'¨Ó/’à—i‘i×'Ñ'¨Ó/’ñ	 ð
 ˆzÐr7   )rÐ   )r•   r±   r²   r³   r   r§   r¨   rd   r‡   ÚSequenceÚMappingÚTuplerÙ   rÆ   rÇ   rÈ   s   @r5   r¦   r¦   ¡  sz   ø† ð#˜Kð #°1·5±5ð #¸T÷ #ð
Øð
Ø%&§Z¡Z°·±Ñ%6ð
Ø@AÇ	Á	È#ÈqÏuÉuÈ*Ñ@Uð
à	
�‰�—‘˜�Ñ	÷
ò 
r7   r¦   c                   ó   • \ rS rSrSrg)r¥   i³  rœ   N)r•   r±   r²   r³   rÆ   rœ   r7   r5   r¥   r¥   ³  s   † Úr7   r¥   )9r´   rw   rD   Útypingr§   Ú_stringr   Úcollectionsr   r   Ú	functoolsr   Ústringr   Ú
markupsafer   r	   Úenvironmentr   Ú
exceptionsr   Úruntimer   r   ÚTypeVarr½   r¨   r   r2   Úsetr   ÚSetr‡   r¾   r   rL   rN   rO   Ú
MutableSetrÁ   ÚMutableMappingÚMutableSequencer,   rÝ   ÚTyperÂ   Úintr0   r6   r;   rÃ   rQ   rT   rV   rÊ   r¦   r¥   rœ   r7   r5   Ú<module>rð      sô  ðòó Û Û Ý .Ý Ý Ý $Ý å &Ý å $Ý %Ý Ý à‡I‚Iˆc˜Ÿ™ C¨¯© JÑ/Ñ0€ð €	ñ *-«Ð ˜AŸE™E #™JÓ .ñ (+£uÐ ˜!Ÿ%™% ™*Ó ,ð  *¨9Ð5Ð ð  *¨9Ð5Ð ð &/°
Ð$;Ð !ð 	�‰Ùò	ó	
ðð  	×ÑÙÒEÓFðð
 	×ÑÙÚWó	
ðð 	Ùò
ó	
ðð5*I€ˆq�w‰w�q—w‘w˜qŸv™v a§e¡e™}¨a¯k©k¸#Ñ.>Ð>Ñ?ÀÐDÑEó *ðZ�cð ˜eô ð
ˆað 
�Aô 
ð"!˜qŸu™uð "!¨Cð "!°Dô "!ðJ §¡ð ¨Sð °Tô ô2`6˜;ô `6ôF
5Ð$8ô 
5ô˜ô ô$	Ð1°?õ 	r7   