
    (ph$                        S r SSKrSSKrSSKrSSKrSSKJr  0 \R                  \R                  _\R                  \R                  _\R                  \R                  _\R                  \R                  _\R                  \R                   _\R"                  \R$                  _\R&                  \R(                  _\R*                  \R,                  _\R.                  \R0                  _\R2                  \R4                  _\R6                  \R8                  _\R:                  \R<                  _\R>                  \R@                  _\RB                  \RD                  _\RF                  \RH                  _\RJ                  \RL                  _r'\R                  \R                  \R                  \R"                  \R.                  \R                  \R2                  \RB                  \RF                  S.	r(\R6                  \R>                  \R                  \RJ                  \R"                  \R*                  \R                  \R2                  \R                  \R&                  \R                  \RB                  \RF                  \R:                  \R                  S.r)S r*S r+SS jr,S	 r-S
 r.SS jr/S r0S r1S r2S r3 " S S\Rh                  Rj                  Rl                  5      r7g)z)Internal utilities common to all modules.    N)
exceptions)	i  i  i  i  i  i  i  i  i  )                        	   
                  c                    U c  [         R                  " 5       $ [        U [         R                  5      (       a1  [         R                  " U R                  5      nXLa  [        S5      eU $ [        SR                  [        U 5      5      5      e)z3Returns a reference to an initialized App instance.zKIllegal app argument. App instance not initialized via the firebase module.zTIllegal app argument. Argument must be of type  firebase_admin.App, but given "{0}".)firebase_adminget_app
isinstanceAppname
ValueErrorformattype)appinitialized_apps     H/var/www/html/venv/lib/python3.13/site-packages/firebase_admin/_utils.py_get_initialized_appr   O   s    
{%%''#~))**(00:% D E E

 ==CVDI=NP P    c                 :    [        U 5      n U R                  X5      $ N)r   _get_service)r   r   initializers      r   get_app_servicer%   `   s    
s
#CD..r    c                     U R                   c  [        U 5      $ U R                   nUR                  R                  5       nUR                  n[        X45      u  pVSnU(       a	  U" XU5      nU(       a  U$ [        XU5      $ )aC  Constructs a ``FirebaseError`` from the given requests error.

This can be used to handle errors returned by Google Cloud Platform (GCP) APIs.

Args:
    error: An error raised by the requests module while making an HTTP call to a GCP API.
    handle_func: A function that can be used to handle platform errors in a custom way. When
        specified, this function will be called with three arguments. It has the same
        signature as ```_handle_func_requests``, but may return ``None``.

Returns:
    FirebaseError: A ``FirebaseError`` that can be raised to the user code.
N)responsehandle_requests_errorcontentdecodestatus_code_parse_platform_error_handle_func_requests)errorhandle_funcr'   r)   r+   
error_dictmessageexcs           r   #handle_platform_error_from_requestsr3   e   sw     ~~$U++~~H%%'G&&K/EJ
C%*53L0LLr    c                     [        U [        5      (       d$  [        R                  " SR	                  U 5      U S9$ U R                  S5      nU R                  S5      n[        U5      n[        U5      nU" US9$ )zConstructs a ``FirebaseError`` from the given operation error.

Args:
    error: An error returned by a long running operation.

Returns:
    FirebaseError: A ``FirebaseError`` that can be raised to the user code.
5Unknown error while making a remote service call: {0}r1   causecoder1   )r1   )r   dictr   UnknownErrorr   get_rpc_code_to_error_code_error_code_to_exception_type)r.   rpc_coder1   
error_codeerr_types        r   handle_operation_errorrA      ss     eT""&&KRRSXY 	 yy Hii	"G(2J,Z8HG$$r    c                 <    UR                  S5      n[        XU5      $ )a`  Constructs a ``FirebaseError`` from the given GCP error.

Args:
    error: An error raised by the requests module while making an HTTP call.
    message: A message to be included in the resulting ``FirebaseError``.
    error_dict: Parsed GCP error response.

Returns:
    FirebaseError: A ``FirebaseError`` that can be raised to the user code or None.
status)r;   r(   )r.   r1   r0   r8   s       r   r-   r-      s     >>(#D 66r    c                 @   [        U [        R                  R                  5      (       a$  [        R                  " SR                  U 5      U S9$ [        U [        R                  R                  5      (       a$  [        R                  " SR                  U 5      U S9$ U R                  c$  [        R                  " SR                  U 5      U S9$ U(       d  [        U R                  R                  5      nU(       d  [        U 5      n[        U5      nU" XU R                  S9$ )a;  Constructs a ``FirebaseError`` from the given requests error.

This method is agnostic of the remote service that produced the error, whether it is a GCP
service or otherwise. Therefore, this method does not attempt to parse the error response in
any way.

Args:
    error: An error raised by the requests module while making an HTTP call.
    message: A message to be included in the resulting ``FirebaseError`` (optional). If not
        specified the string representation of the ``error`` argument is used as the message.
    code: A GCP error code that will be used to determine the resulting error type (optional).
        If not specified the HTTP status code on the error response is used to determine a
        suitable error code.

Returns:
    FirebaseError: A ``FirebaseError`` that can be raised to the user code.
z'Timed out while making an API call: {0}r6   z%Failed to establish a connection: {0}r5   )r1   r7   http_response)r   requestsr   TimeoutDeadlineExceededErrorr   ConnectionErrorUnavailableErrorr'   r:   _http_status_to_error_coder+   strr=   )r.   r1   r8   r@   s       r   r(   r(      s    $ %,,4455//=DDUK 	 %,,<<==**;BB5I 	 ~~&&KRRSXY 	 )%..*D*DEe*,T2HGOOr    c                 J    [         R                  U [        R                  5      $ )z-Maps an HTTP status to a platform error code.)_HTTP_STATUS_TO_ERROR_CODEr;   r   UNKNOWN)rC   s    r   rK   rK      s    %))&*2D2DEEr    c                 J    [         R                  U [        R                  5      $ )z*Maps an RPC code to a platform error code.)_RPC_CODE_TO_ERROR_CODEr;   r   rO   )r>   s    r   r<   r<      s    "&&x1C1CDDr    c                 J    [         R                  U [        R                  5      $ )z0Maps a platform error code to an exception type.)_ERROR_CODE_TO_EXCEPTION_TYPEr;   r   r:   )r8   s    r   r=   r=      s    (,,T:3J3JKKr    c                     0 n [         R                  " U 5      n[        U[        5      (       a  UnUR                  S0 5      nUR                  S5      nU(       d  SR                  X5      nXE4$ ! [         a     NJf = f)a  Parses an HTTP error response from a Google Cloud Platform API and extracts the error code
and message fields.

Args:
    content: Decoded content of the response body.
    status_code: HTTP status code.

Returns:
    tuple: A tuple containing error code and message.
r.   r1   z4Unexpected HTTP response with status: {0}; body: {1})jsonloadsr   r9   r   r;   r   )r)   r+   dataparsed_bodyr0   msgs         r   r,   r,      s}     Djj)k4((D '2&J
..
#CDKKKa?  s   -A/ /
A<;A<c                   $    \ rS rSrSrS rS rSrg)EmulatorAdminCredentials   zCredentials for use with the firebase local emulator.

This is used instead of user-supplied credentials or ADC.  It will silently do nothing when
asked to refresh credentials.
c                 x    [         R                  R                  R                  R	                  U 5        SU l        g )Nowner)googleauthcredentialsCredentials__init__token)selfs    r   rc   !EmulatorAdminCredentials.__init__   s'    ++44T:
r    c                     g r"    )re   requests     r   refresh EmulatorAdminCredentials.refresh  s    r    )rd   N)__name__
__module____qualname____firstlineno____doc__rc   rj   __static_attributes__rh   r    r   r[   r[      s    
r    r[   r"   )NN)8rp   rU   google.authr_   rF   r   r   INVALID_ARGUMENTInvalidArgumentErrorFAILED_PRECONDITIONFailedPreconditionErrorOUT_OF_RANGEOutOfRangeErrorUNAUTHENTICATEDUnauthenticatedErrorPERMISSION_DENIEDPermissionDeniedError	NOT_FOUNDNotFoundErrorABORTEDAbortedErrorALREADY_EXISTSAlreadyExistsErrorCONFLICTConflictErrorRESOURCE_EXHAUSTEDResourceExhaustedError	CANCELLEDCancelledError	DATA_LOSSDataLossErrorrO   r:   INTERNALInternalErrorUNAVAILABLErJ   DEADLINE_EXCEEDEDrH   rS   rN   rQ   r   r%   r3   rA   r-   r(   rK   r<   r=   r,   r`   ra   rb   r[   rh   r    r   <module>r      s   0     %!!@!@!""J$F$F! Z77! 
 ? ?	!
   *"B"B! *22! 
//! z<<! 11! !!:#D#D! *33! *22! 
//! 11! J77!    *"B"B!! * 
	$	$		#	#		%	%								'	'		&	&						
  ""##  ##$$%%"" &P"/
M8%*7%PPFEL
:v{{66BB r    