Ë
    ö%9j‰%  ã                   óØ  — d Z ddlZddlmZ ddlZddlZddlZddlmZ i ej                  ej                  “ej                  ej                  “ej                  ej                  “ej                  ej                   “ej"                  ej$                  “ej&                  ej(                  “ej*                  ej,                  “ej.                  ej0                  “ej2                  ej4                  “ej6                  ej8                  “ej:                  ej<                  “ej>                  ej@                  “ejB                  ejD                  “ejF                  ejH                  “ejJ                  ejL                  “ejN                  ejP                  “Z)ej                  ej                  ej"                  ej&                  ej2                  ej                  ej6                  ejF                  ejJ                  dœ	Z*ej:                  ejB                  ej                  ejN                  ej&                  ej.                  ej"                  ej6                  ej                  ej*                  ej                  ejF                  ejJ                  ej>                  ej                  dœZ+d„ Z,d„ Z-d	„ Z.dd
„Z/d„ Z0d„ Z1dd„Z2d„ Z3d„ Z4d„ Z5d„ Z6 G d„ dejn                  jp                  jr                  «      Z:y)z)Internal utilities common to all modules.é    N)Úpython_version)Ú
exceptions)	i�  i‘  i“  i”  i™  iœ  i­  iô  i÷  )é   é   é   é   é   é   é   é   é	   é
   é   é   é   é   é   c                  ó>   — dt        «       › dt        j                  › �S )Nz
gl-python/z fire-admin/)r   Úfirebase_adminÚ__version__© ó    úQ/var/www/html/truck-me/venv/lib/python3.12/site-packages/firebase_admin/_utils.pyÚget_metrics_headerr   O   s    € ØœÓ(Ð)¨´n×6PÑ6PÐ5QÐRÐRr   c                 ó  — | €t        j                  «       S t        | t         j                  «      r0t        j                  | j                  «      }| |urt        d«      ‚| S t        dj                  t        | «      «      «      ‚)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}".)r   Úget_appÚ
isinstanceÚAppÚnameÚ
ValueErrorÚformatÚtype)ÚappÚinitialized_apps     r   Ú_get_initialized_appr%   R   s~   € à
€{Ü×%Ñ%Ó'Ð'ä�#”~×)Ñ)Ô*Ü(×0Ñ0°·±Ó:ˆØ�oÑ%Üð Dó Eð Eàˆ
ä
ð =ß=C¹VÄDÈÃIÓ=NóPð Pr   c                 ó<   — t        | «      } | j                  ||«      S ©N)r%   Ú_get_service)r#   r   Úinitializers      r   Úget_app_servicer*   c   s   € Ü
˜sÓ
#€CØ×Ñ˜D +Ó.Ð.r   c                 óð   — | j                   €t        | «      S | j                   }|j                  j                  «       }|j                  }t        ||«      \  }}d}|r
 || ||«      }|r|S t        | ||«      S )ag  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.   r0   Ú
error_dictÚmessageÚexcs           r   Ú#handle_platform_error_from_requestsr8   h   s   € ð ‡~�~ÐÜ$ UÓ+Ð+à�~‰~€HØ×Ñ×%Ñ%Ó'€GØ×&Ñ&€KÜ/°¸ÓEÑ€J�Ø
€CÙÙ˜% ¨*Ó5ˆáˆ3ÐLÔ0°¸ÀÓLÐLr   c                 óð   — t        | t        «      s&t        j                  dj	                  | «      | ¬«      S | j                  d«      }| j                  d«      }t        |«      }t        |«      } ||¬«      S )zêConstructs 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}©r6   ÚcauseÚcoder6   )r6   )r   Údictr   ÚUnknownErrorr!   ÚgetÚ_rpc_code_to_error_codeÚ_error_code_to_exception_type)r3   Úrpc_coder6   Ú
error_codeÚerr_types        r   Úhandle_operation_errorrF   „   sp   € ô �eœTÔ"Ü×&Ñ&ØK×RÑRÐSXÓYØôð 	ð �y‰y˜Ó €HØ�i‰i˜	Ó"€GÜ(¨Ó2€JÜ,¨ZÓ8€HÙ˜GÔ$Ð$r   c                 ó>   — |j                  d«      }t        | ||«      S )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-   )r3   r6   r5   r=   s       r   r2   r2   ™   s!   € ð �>‰>˜(Ó#€DÜ  ¨°Ó6Ð6r   c                 ó*  — t        | t        j                  j                  «      r&t        j                  dj                  | «      | ¬«      S t        | t        j                  j                  «      r&t        j                  dj                  | «      | ¬«      S | j                  €&t        j                  dj                  | «      | ¬«      S |st        | j                  j                  «      }|st        | «      }t        |«      } ||| | j                  ¬«      S )ao  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}r;   z%Failed to establish a connection: {0}r:   )r6   r<   Úhttp_response)r   Úrequestsr   ÚTimeoutÚDeadlineExceededErrorr!   ÚConnectionErrorÚUnavailableErrorr,   r?   Ú_http_status_to_error_coder0   ÚstrrB   )r3   r6   r=   rE   s       r   r-   r-   ¨   sí   € ô$ �%œ×,Ñ,×4Ñ4Ô5Ü×/Ñ/Ø=×DÑDÀUÓKØôð 	ô �%œ×,Ñ,×<Ñ<Ô=Ü×*Ñ*Ø;×BÑBÀ5ÓIØôð 	ð ‡~�~ÐÜ×&Ñ&ØK×RÑRÐSXÓYØôð 	ñ Ü)¨%¯.©.×*DÑ*DÓEˆÙÜ�e“*ˆä,¨TÓ2€HÙ˜G¨5ÀÇÁÔOÐOr   c                 óJ   — t         j                  | t        j                  «      S )z-Maps an HTTP status to a platform error code.)Ú_HTTP_STATUS_TO_ERROR_CODEr@   r   ÚUNKNOWN)rH   s    r   rP   rP   Ð   s   € ä%×)Ñ)¨&´*×2DÑ2DÓEÐEr   c                 óJ   — t         j                  | t        j                  «      S )z*Maps an RPC code to a platform error code.)Ú_RPC_CODE_TO_ERROR_CODEr@   r   rT   )rC   s    r   rA   rA   Ô   s   € ä"×&Ñ& x´×1CÑ1CÓDÐDr   c                 óJ   — t         j                  | t        j                  «      S )z0Maps a platform error code to an exception type.)Ú_ERROR_CODE_TO_EXCEPTION_TYPEr@   r   r?   )r=   s    r   rB   rB   Ø   s   € ä(×,Ñ,¨T´:×3JÑ3JÓKÐKr   c                 óê   — i }	 t        j                  | «      }t        |t        «      r|}|j                  di «      }|j                  d«      }|sdj                  || «      }||fS # t        $ r Y ŒFw xY w)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.
    r3   r6   z4Unexpected HTTP response with status: {0}; body: {1})ÚjsonÚloadsr   r>   r    r@   r!   )r.   r0   ÚdataÚparsed_bodyr5   Úmsgs         r   r1   r1   Ý   s   € ð €DðÜ—j‘j Ó)ˆÜ�k¤4Ô(ØˆDð —‘˜' 2Ó&€JØ
�.‰.˜Ó
#€CÙØD×KÑKÈKÐY`ÓaˆØ�sˆ?Ðøô ò Ùðús   „'A& Á&	A2Á1A2c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚEmulatorAdminCredentialsz¾ Credentials 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   — t         j                  j                  j                  j	                  | «       d| _        y )NÚowner)ÚgoogleÚauthÚcredentialsÚCredentialsÚ__init__Útoken)Úselfs    r   rg   z!EmulatorAdminCredentials.__init__   s'   € Ü�‰×Ñ×+Ñ+×4Ñ4°TÔ:Øˆ�
r   c                  ó   — y r'   r   )ri   Úrequests     r   Úrefreshz EmulatorAdminCredentials.refresh  s   € Ør   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rg   rl   r   r   r   r`   r`   ú   s   „ ñò
ór   r`   r'   )NN);rp   rZ   Úplatformr   Úgoogle.authrc   rK   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ÚDataLossErrorrT   r?   ÚINTERNALÚInternalErrorÚUNAVAILABLErO   ÚDEADLINE_EXCEEDEDrM   rX   rS   rV   r   r%   r*   r8   rF   r2   r-   rP   rA   rB   r1   rd   re   rf   r`   r   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ð!!Ð ð* 
×	$Ñ	$Ø	×	#Ñ	#Ø	×	%Ñ	%Ø	×	Ñ	Ø	×	Ñ	Ø	×	'Ñ	'Ø	×	&Ñ	&Ø	×	Ñ	Ø	×	Ñ	ñ
Ð ð ×ÑØ×ÑØ×"Ñ"Ø×#Ñ#Ø×ÑØ× Ñ Ø×#Ñ#Ø×$Ñ$Ø×%Ñ%Ø×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×"Ñ"ñÐ ò$SòPò"/ó
Mò8%ò*7ó%PòPFòEòLò
ô:˜vŸ{™{×6Ñ6×BÑBõ r   