
    0hv                    F   S SK Jr  S SKrS SK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  \R6                  (       a  S SKJr  \" 5       r\R@                  " S\RB                  S\RD                  4   S9r#\R@                  " S\RH                  \RD                     S9r%\R@                  " S\RL                  S9r'\R@                  " S\RP                  S9r)\R@                  " S\RT                  S9r+\R@                  " S\RX                  S9r-\R@                  " S\R\                  S9r/\R@                  " S\R`                  S9r1\R@                  " S\Rd                  S9r3S S jr4 " S S5      r5S!S jr6S"S jr7S#S jr8g)$    )annotationsN)defaultdict)update_wrapper)
BaseLoader)FileSystemLoader)default_exceptions)HTTPException)cached_property   )typing)get_root_path)_default_template_ctx_processor)GroupF.)boundT_after_requestT_before_requestT_error_handler
T_teardownT_template_context_processorT_url_defaultsT_url_value_preprocessorT_routec                z   ^ ^ T R                   mSU U4S jjn[        R                  " [        [	        UT 5      5      $ )Nc                >   > U R                  T5        T" U /UQ70 UD6$ N)_check_setup_finished)selfargskwargsff_names      M/var/www/auris/envauris/lib/python3.13/site-packages/flask/sansio/scaffold.pywrapper_func!setupmethod.<locals>.wrapper_func-   s&    ""6*''''    )r   Scaffoldr   t.Anyr    r(   returnr(   )__name__tcastr   r   )r!   r$   r"   s   ` @r#   setupmethodr-   *   s0    ZZF( ( 66!^L!455r&   c                     \ rS rSr% SrS\S'   S\S'   SrS\S	'   SrS\S
'       S'         S(S jjrS)S jr	S*S jr
\S+S j5       r\R                  S,S j5       r\S-S j5       r\S+S j5       r\R                  S.S j5       r\S/S j5       r        S0S jr\S1S j5       r\S1S j5       r\S1S j5       r\S1S j5       r\S1S j5       r\S1S j5       r\   S2           S3S jj5       r\S4S j5       r\S5S j5       r\S6S j5       r\S7S j5       r\    S8S  j5       r\    S9S! j5       r \S:S" j5       r!\    S;S# j5       r"\      S<S$ j5       r#\$    S=S% j5       r%S&r&g)>r'   4   a  Common behavior shared between :class:`~flask.Flask` and
:class:`~flask.blueprints.Blueprint`.

:param import_name: The import name of the module where this object
    is defined. Usually :attr:`__name__` should be used.
:param static_folder: Path to a folder of static files to serve.
    If this is set, a static route will be added.
:param static_url_path: URL prefix for the static route.
:param template_folder: Path to a folder containing template files.
    for rendering. If this is set, a Jinja loader will be added.
:param root_path: The path that static, template, and resource files
    are relative to. Typically not set, it is discovered based on
    the ``import_name``.

.. versionadded:: 2.0
r   clistrnameN
str | None_static_folder_static_url_pathc                   Xl         X l        X0l        X@l        Uc  [	        U R                   5      nXPl        0 U l        [        S 5      U l        [        [        5      U l
        [        [        5      U l        [        [        5      U l        [        [        S [        /05      U l        [        [        5      U l        [        [        5      U l        g )Nc                      [        [        5      $ r   )r   dict r&   r#   <lambda>#Scaffold.__init__.<locals>.<lambda>~   s	    D 1r&   )import_namestatic_folderstatic_url_pathtemplate_folderr   	root_pathview_functionsr   error_handler_speclistbefore_request_funcsafter_request_funcsteardown_request_funcsr   template_context_processorsurl_value_preprocessorsurl_default_functions)r   r<   r=   r>   r?   r@   s         r#   __init__Scaffold.__init__K   s     '*.
  /%d&6&67I # <>$ 12 	"  	!   	 "  	#" t&E%FGH 	($  	$$  	"r&   c                P    S[        U 5      R                   SU R                  < S3$ )N< >)typer*   r2   r   s    r#   __repr__Scaffold.__repr__   s&    4:&&'qQ77r&   c                    [         er   NotImplementedError)r   r"   s     r#   r   Scaffold._check_setup_finished   s    !!r&   c                    U R                   b4  [        R                  R                  U R                  U R                   5      $ g)zXThe absolute path to the configured static folder. ``None``
if no static folder is set.
N)r4   ospathjoinr@   rQ   s    r#   r=   Scaffold.static_folder   s2    
 *77<<0C0CDDr&   c                `    Ub%  [         R                  " U5      R                  S5      nXl        g )Nz\/)rY   fspathrstripr4   r   values     r#   r=   r\      s'    IIe$++E2E#r&   c                    U R                   SL$ )zA``True`` if :attr:`static_folder` is set.

.. versionadded:: 0.5
N)r=   rQ   s    r#   has_static_folderScaffold.has_static_folder   s     !!--r&   c                    U R                   b  U R                   $ U R                  b=  [        R                  R	                  U R                  5      nSU 3R                  S5      $ g)zThe URL prefix that the static route will be accessible from.

If it was not configured during init, it is derived from
:attr:`static_folder`.
N/)r5   r=   rY   rZ   basenamer_   )r   rg   s     r#   r>   Scaffold.static_url_path   s\       ,((()ww''(:(:;Hxj>((--r&   c                8    Ub  UR                  S5      nXl        g )Nrf   )r_   r5   r`   s     r#   r>   rh     s    LL%E %r&   c                    U R                   b=  [        [        R                  R	                  U R
                  U R                   5      5      $ g)zThe Jinja loader for this object's templates. By default this
is a class :class:`jinja2.loaders.FileSystemLoader` to
:attr:`template_folder` if it is set.

.. versionadded:: 0.5
N)r?   r   rY   rZ   r[   r@   rQ   s    r#   jinja_loaderScaffold.jinja_loader  s7     +#BGGLLAUAU$VWWr&   c                P    SU;   a  [        S5      eU R                  " U4SU/0UD6$ )Nmethodsz8Use the 'route' decorator to use the 'methods' argument.)	TypeErrorroute)r   methodruleoptionss       r#   _method_routeScaffold._method_route  s3     VWWzz$<<G<<r&   c                &    U R                  SX5      $ )zLShortcut for :meth:`route` with ``methods=["GET"]``.

.. versionadded:: 2.0
GETrt   r   rr   rs   s      r#   getScaffold.get'       !!%77r&   c                &    U R                  SX5      $ )zMShortcut for :meth:`route` with ``methods=["POST"]``.

.. versionadded:: 2.0
POSTrx   ry   s      r#   postScaffold.post/  s     !!&$88r&   c                &    U R                  SX5      $ )zLShortcut for :meth:`route` with ``methods=["PUT"]``.

.. versionadded:: 2.0
PUTrx   ry   s      r#   putScaffold.put7  r|   r&   c                &    U R                  SX5      $ )zOShortcut for :meth:`route` with ``methods=["DELETE"]``.

.. versionadded:: 2.0
DELETErx   ry   s      r#   deleteScaffold.delete?  s     !!(D::r&   c                &    U R                  SX5      $ )zNShortcut for :meth:`route` with ``methods=["PATCH"]``.

.. versionadded:: 2.0
PATCHrx   ry   s      r#   patchScaffold.patchG  s     !!'499r&   c                    ^ ^^ SUUU 4S jjnU$ )at  Decorate a view function to register it with the given URL
rule and options. Calls :meth:`add_url_rule`, which has more
details about the implementation.

.. code-block:: python

    @app.route("/")
    def index():
        return "Hello, World!"

See :ref:`url-route-registrations`.

The endpoint name for the route defaults to the name of the view
function if the ``endpoint`` parameter isn't passed.

The ``methods`` parameter defaults to ``["GET"]``. ``HEAD`` and
``OPTIONS`` are added automatically.

:param rule: The URL rule string.
:param options: Extra options passed to the
    :class:`~werkzeug.routing.Rule` object.
c                T   > TR                  SS 5      nTR                  " TX40 TD6  U $ )Nendpoint)popadd_url_rule)r!   r   rs   rr   r   s     r#   	decorator!Scaffold.route.<locals>.decoratorh  s-    {{:t4HdH;7;Hr&   )r!   r   r)   r   r9   )r   rr   rs   r   s   ``` r#   rp   Scaffold.routeO  s    2	 	
 r&   c                    [         e)a  Register a rule for routing incoming requests and building
URLs. The :meth:`route` decorator is a shortcut to call this
with the ``view_func`` argument. These are equivalent:

.. code-block:: python

    @app.route("/")
    def index():
        ...

.. code-block:: python

    def index():
        ...

    app.add_url_rule("/", view_func=index)

See :ref:`url-route-registrations`.

The endpoint name for the route defaults to the name of the view
function if the ``endpoint`` parameter isn't passed. An error
will be raised if a function has already been registered for the
endpoint.

The ``methods`` parameter defaults to ``["GET"]``. ``HEAD`` is
always added automatically, and ``OPTIONS`` is added
automatically by default.

``view_func`` does not necessarily need to be passed, but if the
rule should participate in routing an endpoint name must be
associated with a view function at some point with the
:meth:`endpoint` decorator.

.. code-block:: python

    app.add_url_rule("/", endpoint="index")

    @app.endpoint("index")
    def index():
        ...

If ``view_func`` has a ``required_methods`` attribute, those
methods are added to the passed and automatic methods. If it
has a ``provide_automatic_methods`` attribute, it is used as the
default if the parameter is not passed.

:param rule: The URL rule string.
:param endpoint: The endpoint name to associate with the rule
    and view function. Used when routing and building URLs.
    Defaults to ``view_func.__name__``.
:param view_func: The view function to associate with the
    endpoint name.
:param provide_automatic_options: Add the ``OPTIONS`` method and
    respond to ``OPTIONS`` requests automatically.
:param options: Extra options passed to the
    :class:`~werkzeug.routing.Rule` object.
rU   )r   rr   r   	view_funcprovide_automatic_optionsrs   s         r#   r   Scaffold.add_url_ruleo  s    D "!r&   c                   ^ ^ SUU 4S jjnU$ )a^  Decorate a view function to register it for the given
endpoint. Used if a rule is added without a ``view_func`` with
:meth:`add_url_rule`.

.. code-block:: python

    app.add_url_rule("/ex", endpoint="example")

    @app.endpoint("example")
    def example():
        ...

:param endpoint: The endpoint name to associate with the view
    function.
c                &   > U TR                   T'   U $ r   )rA   )r!   r   r   s    r#   r   $Scaffold.endpoint.<locals>.decorator  s    ,-D)Hr&   r!   r   r)   r   r9   )r   r   r   s   `` r#   r   Scaffold.endpoint  s    $	 	 r&   c                \    U R                   R                  S/ 5      R                  U5        U$ )a2  Register a function to run before each request.

For example, this can be used to open a database connection, or
to load the logged in user from the session.

.. code-block:: python

    @app.before_request
    def load_user():
        if "user_id" in session:
            g.user = db.session.get(session["user_id"])

The function will be called without any arguments. If it returns
a non-``None`` value, the value is handled as if it was the
return value from the view, and further request handling is
stopped.

This is available on both app and blueprint objects. When used on an app, this
executes before every request. When used on a blueprint, this executes before
every request that the blueprint handles. To register with a blueprint and
execute before every request, use :meth:`.Blueprint.before_app_request`.
N)rD   
setdefaultappendr   r!   s     r#   before_requestScaffold.before_request  s*    0 	!!,,T26==a@r&   c                \    U R                   R                  S/ 5      R                  U5        U$ )a  Register a function to run after each request to this object.

The function is called with the response object, and must return
a response object. This allows the functions to modify or
replace the response before it is sent.

If a function raises an exception, any remaining
``after_request`` functions will not be called. Therefore, this
should not be used for actions that must execute, such as to
close resources. Use :meth:`teardown_request` for that.

This is available on both app and blueprint objects. When used on an app, this
executes after every request. When used on a blueprint, this executes after
every request that the blueprint handles. To register with a blueprint and
execute after every request, use :meth:`.Blueprint.after_app_request`.
N)rE   r   r   r   s     r#   after_requestScaffold.after_request  s*    $ 	  ++D"5<<Q?r&   c                \    U R                   R                  S/ 5      R                  U5        U$ )av  Register a function to be called when the request context is
popped. Typically this happens at the end of each request, but
contexts may be pushed manually as well during testing.

.. code-block:: python

    with app.test_request_context():
        ...

When the ``with`` block exits (or ``ctx.pop()`` is called), the
teardown functions are called just before the request context is
made inactive.

When a teardown function was called because of an unhandled
exception it will be passed an error object. If an
:meth:`errorhandler` is registered, it will handle the exception
and the teardown will not receive it.

Teardown functions must avoid raising exceptions. If they
execute code that might fail they must surround that code with a
``try``/``except`` block and log any errors.

The return values of teardown functions are ignored.

This is available on both app and blueprint objects. When used on an app, this
executes after every request. When used on a blueprint, this executes after
every request that the blueprint handles. To register with a blueprint and
execute after every request, use :meth:`.Blueprint.teardown_app_request`.
N)rF   r   r   r   s     r#   teardown_requestScaffold.teardown_request  s*    > 	##..tR8??Br&   c                B    U R                   S   R                  U5        U$ )a  Registers a template context processor function. These functions run before
rendering a template. The keys of the returned dict are added as variables
available in the template.

This is available on both app and blueprint objects. When used on an app, this
is called for every rendered template. When used on a blueprint, this is called
for templates rendered from the blueprint's views. To register with a blueprint
and affect every template, use :meth:`.Blueprint.app_context_processor`.
N)rG   r   r   s     r#   context_processorScaffold.context_processor  s"     	((.55a8r&   c                B    U R                   S   R                  U5        U$ )a  Register a URL value preprocessor function for all view
functions in the application. These functions will be called before the
:meth:`before_request` functions.

The function can modify the values captured from the matched url before
they are passed to the view. For example, this can be used to pop a
common language code value and place it in ``g`` rather than pass it to
every view.

The function is passed the endpoint name and values dict. The return
value is ignored.

This is available on both app and blueprint objects. When used on an app, this
is called for every request. When used on a blueprint, this is called for
requests that the blueprint handles. To register with a blueprint and affect
every request, use :meth:`.Blueprint.app_url_value_preprocessor`.
N)rH   r   r   s     r#   url_value_preprocessorScaffold.url_value_preprocessor.  s"    , 	$$T*11!4r&   c                B    U R                   S   R                  U5        U$ )a  Callback function for URL defaults for all view functions of the
application.  It's called with the endpoint and values and should
update the values passed in place.

This is available on both app and blueprint objects. When used on an app, this
is called for every request. When used on a blueprint, this is called for
requests that the blueprint handles. To register with a blueprint and affect
every request, use :meth:`.Blueprint.app_url_defaults`.
N)rI   r   r   s     r#   url_defaultsScaffold.url_defaultsG  s"     	""4(//2r&   c                   ^ ^ SUU 4S jjnU$ )a  Register a function to handle errors by code or exception class.

A decorator that is used to register a function given an
error code.  Example::

    @app.errorhandler(404)
    def page_not_found(error):
        return 'This page does not exist', 404

You can also register handlers for arbitrary exceptions::

    @app.errorhandler(DatabaseError)
    def special_exception_handler(error):
        return 'Database connection failed', 500

This is available on both app and blueprint objects. When used on an app, this
can handle errors from every request. When used on a blueprint, this can handle
errors from requests that the blueprint handles. To register with a blueprint
and affect every request, use :meth:`.Blueprint.app_errorhandler`.

.. versionadded:: 0.7
    Use :meth:`register_error_handler` instead of modifying
    :attr:`error_handler_spec` directly, for application wide error
    handlers.

.. versionadded:: 0.7
   One can now additionally also register custom exception types
   that do not necessarily have to be a subclass of the
   :class:`~werkzeug.exceptions.HTTPException` class.

:param code_or_exception: the code as integer for the handler, or
                          an arbitrary exception
c                ,   > TR                  TU 5        U $ r   )register_error_handler)r!   code_or_exceptionr   s    r#   r   (Scaffold.errorhandler.<locals>.decorator{  s    ''(91=Hr&   )r!   r   r)   r   r9   )r   r   r   s   `` r#   errorhandlerScaffold.errorhandlerU  s    L	 	 r&   c                R    U R                  U5      u  p4X R                  S   U   U'   g)zAlternative error attach function to the :meth:`errorhandler`
decorator that is more straightforward to use for non decorator
usage.

.. versionadded:: 0.7
N)_get_exc_class_and_coderB   )r   r   r!   	exc_classcodes        r#   r   Scaffold.register_error_handler  s/     667HI	9:%d+I6r&   c                r   [        U [        5      (       a   [        U    nOU n[        U[
        5      (       a  [        U< S35      e[        U[
        5      (       d  [	        SUR                   S35      e[        U[        5      (       a  XR                  4$ US4$ ! [         a    [	        SU  S35      Sef = f)zGet the exception class being handled. For HTTP status codes
or ``HTTPException`` subclasses, return both the exception and
status code.

:param exc_class_or_code: Any exception class, or an HTTP status
    code as an integer.
'z^' is not a recognized HTTP error code. Use a subclass of HTTPException with that code instead.Nzh is an instance, not a class. Handlers can only be registered for Exception classes or HTTP error codes.zl' is not a subclass of Exception. Handlers can only be registered for Exception classes or HTTP error codes.)
isinstanceintr   KeyError
ValueError	Exceptionro   
issubclassr*   r	   r   )exc_class_or_coder   s     r#   r    Scaffold._get_exc_class_and_code  s     '--./@A	 *Ii++-       )Y//I&&' (( (  i//nn,,d?"5   )* +* * 	s   	B B6)r4   r5   rE   rD   rB   r<   r@   r=   r>   rF   rG   r?   rI   rH   rA   )NNNN)
r<   r1   r=   str | os.PathLike[str] | Noner>   r3   r?   r   r@   r3   )r)   r1   )r"   r1   r)   None)r)   r3   )ra   r   r)   r   )r)   bool)ra   r3   r)   r   )r)   zBaseLoader | None)rq   r1   rr   r1   rs   zdict[str, t.Any]r)   t.Callable[[T_route], T_route])rr   r1   rs   r(   r)   r   )NNN)rr   r1   r   r3   r   zft.RouteCallable | Noner   zbool | Noners   r(   r)   r   )r   r1   r)   zt.Callable[[F], F])r!   r   r)   r   )r!   r   r)   r   )r!   r   r)   r   )r!   r   r)   r   )r!   r   r)   r   )r!   r   r)   r   )r   type[Exception] | intr)   z.t.Callable[[T_error_handler], T_error_handler])r   r   r!   zft.ErrorHandlerCallabler)   r   )r   r   r)   z"tuple[type[Exception], int | None])'r*   
__module____qualname____firstlineno____doc____annotations__r4   r5   rJ   rR   r   propertyr=   setterrc   r>   r
   rk   rt   r-   rz   r   r   r   r   rp   r   r   r   r   r   r   r   r   r   r   staticmethodr   __static_attributes__r9   r&   r#   r'   r'   4   s/   " 
J
I!%NJ%#'j'
 8<&*9= $LL 5L $	L
 7L L\8"   $ $ . .   & & 
 
	=	= 	= "		=
 
(	= 8 8 9 9 8 8 ; ; : :  >   $-115A"A" A" +	A"
 $/A" A" 
A" A"F  .  4  (  B ' 
&   # 
" 0   )!6)	7) )V ;0; #; 
	; ; )#0)#	+)# )#r&   r'   c                .    U c   S5       eU R                   $ )zkInternal helper that returns the default endpoint for a given
function.  This always is the function name.
z/expected view func if endpoint is not provided.)r*   )r   s    r#   _endpoint_from_view_funcr     s"      S"SS r&   c                  ^ U R                  S5      u  n  n [        R                  R                  U5      nUc  [	        S5      e UR                  (       Ga!  UR                  b  UR                  S:X  a  [        R                  R                  U 5      nUbn  UR                  (       a]  [        R                  " [        R                  R                  UR                  5      5      m[        U4S jUR                   5       5      nOUR                  S   n[        R                  R                  U5      $ [        R                  R                  [        R                  R                  UR                  5      5      $ [        R                  R                  UR                  5      $ ! [
        [        4 a    [        R                  " 5       s $ f = f)z2Find the path that contains the package or module..z	not found	namespacec              3  X   >#    U  H  nTR                  U5      (       d  M  Uv   M!     g 7fr   )is_relative_to).0locationpackage_paths     r#   	<genexpr>%_find_package_path.<locals>.<genexpr>  s(      '$H#228< H$Hs   *	*r   )	partition	importlibutil	find_specr   ImportErrorrY   getcwdsubmodule_search_locationsoriginpathlibPathrZ   
commonpathnextdirname)r<   root_mod_name_	root_specpackage_specsearch_locationr   s         @r#   _find_package_pathr     sd   %//4M1aNN,,];	[))  +++#y'7'7;'F$>>33K@L'L,S,S&||GG&&|'N'NO  #' '$-$H$H' # #,"F"Fq"I77???33 77??277??93C3C#DEE wwy//00C $  yy{s   -F" "%G
	G
c                X   [        U 5      n[        R                  R                  [        R
                  5      n[        R                  " U5      R                  U5      (       a  X!4$ [        R                  R                  U5      u  p4UR                  5       S:X  a  [        R                  R                  U5      u  pVUR                  5       S:X  a  XQ4$ [        R                  R                  U5      R                  5       S:X  a!  [        R                  R                  U5      U4$ X14$ SU4$ )a  Find the prefix that a package is installed under, and the path
that it would be imported from.

The prefix is the directory containing the standard directory
hierarchy (lib, bin, etc.). If the package is not installed to the
system (:attr:`sys.prefix`) or a virtualenv (``site-packages``),
``None`` is returned.

The path is the entry in :attr:`sys.path` that contains the package
for import. If the package is not installed, it's assumed that the
package was imported from the current working directory.
zsite-packageslibN)r   rY   rZ   abspathsysprefixr   PurePathr   splitlowerrg   r   )r<   r   	py_prefixsite_parentsite_folderparentfolders          r#   find_packager    s     &k2L

+I %44Y??&&!ww}}\:K o-{3 <<>U"'' 77F#))+u477??6*L88 (( r&   r   )r   zft.RouteCallabler)   r1   )r<   r1   r)   r1   )r<   r1   r)   ztuple[str | None, str])9
__future__r   importlib.utilr   rY   r   r   r   r+   collectionsr   	functoolsr   jinja2r   r   werkzeug.exceptionsr   r	   werkzeug.utilsr
    fthelpersr   
templatingr   TYPE_CHECKINGclickr   object	_sentinelTypeVarCallableAnyr   AfterRequestCallabler   BeforeRequestCallabler   ErrorHandlerCallabler   TeardownCallabler    TemplateContextProcessorCallabler   URLDefaultCallabler   URLValuePreprocessorCallabler   RouteCallabler   r-   r'   r   r   r  r9   r&   r#   <module>r     sU   "  	  
  # $  # 2 - *  # 8?? H	IIcCJ/0))-R5L5LQUU5ST99/r7O7OP ))-R5L5LMYY|2+>+>?
 yy""*M*M   +23H3HI99b&E&E  ))IR%5%5
66F
# F
#R*1Z&r&   