# Path: firebase_admin/exceptions.py
# INVALID_ARGUMENT = 'INVALID_ARGUMENT'
# FAILED_PRECONDITION = 'FAILED_PRECONDITION'
# OUT_OF_RANGE = 'OUT_OF_RANGE'
# UNAUTHENTICATED = 'UNAUTHENTICATED'
# PERMISSION_DENIED = 'PERMISSION_DENIED'
# NOT_FOUND = 'NOT_FOUND'
# CONFLICT = 'CONFLICT'
# ABORTED = 'ABORTED'
# ALREADY_EXISTS = 'ALREADY_EXISTS'
# RESOURCE_EXHAUSTED = 'RESOURCE_EXHAUSTED'
# CANCELLED = 'CANCELLED'
# DATA_LOSS = 'DATA_LOSS'
# UNKNOWN = 'UNKNOWN'
# INTERNAL = 'INTERNAL'
# UNAVAILABLE = 'UNAVAILABLE'
# DEADLINE_EXCEEDED = 'DEADLINE_EXCEEDED'
# class FirebaseError(Exception):
# class InvalidArgumentError(FirebaseError):
# class FailedPreconditionError(FirebaseError):
# class OutOfRangeError(FirebaseError):
# class UnauthenticatedError(FirebaseError):
# class PermissionDeniedError(FirebaseError):
# class NotFoundError(FirebaseError):
# class ConflictError(FirebaseError):
# class AbortedError(FirebaseError):
# class AlreadyExistsError(FirebaseError):
# class ResourceExhaustedError(FirebaseError):
# class CancelledError(FirebaseError):
# class DataLossError(FirebaseError):
# class UnknownError(FirebaseError):
# class InternalError(FirebaseError):
# class UnavailableError(FirebaseError):
# class DeadlineExceededError(FirebaseError):
#     def __init__(self, code, message, cause=None, http_response=None):
#     def code(self):
#     def cause(self):
#     def http_response(self):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):


import json
import google.auth
import requests
import firebase_admin
from firebase_admin import exceptions




_ERROR_CODE_TO_EXCEPTION_TYPE = {
    exceptions.INVALID_ARGUMENT: exceptions.InvalidArgumentError,
    exceptions.FAILED_PRECONDITION: exceptions.FailedPreconditionError,
    exceptions.OUT_OF_RANGE: exceptions.OutOfRangeError,
    exceptions.UNAUTHENTICATED: exceptions.UnauthenticatedError,
    exceptions.PERMISSION_DENIED: exceptions.PermissionDeniedError,
    exceptions.NOT_FOUND: exceptions.NotFoundError,
    exceptions.ABORTED: exceptions.AbortedError,
    exceptions.ALREADY_EXISTS: exceptions.AlreadyExistsError,
    exceptions.CONFLICT: exceptions.ConflictError,
    exceptions.RESOURCE_EXHAUSTED: exceptions.ResourceExhaustedError,
    exceptions.CANCELLED: exceptions.CancelledError,
    exceptions.DATA_LOSS: exceptions.DataLossError,
    exceptions.UNKNOWN: exceptions.UnknownError,
    exceptions.INTERNAL: exceptions.InternalError,
    exceptions.UNAVAILABLE: exceptions.UnavailableError,
    exceptions.DEADLINE_EXCEEDED: exceptions.DeadlineExceededError,
}


_HTTP_STATUS_TO_ERROR_CODE = {
    400: exceptions.INVALID_ARGUMENT,
    401: exceptions.UNAUTHENTICATED,
    403: exceptions.PERMISSION_DENIED,
    404: exceptions.NOT_FOUND,
    409: exceptions.CONFLICT,

# Path: firebase_admin/exceptions.py
# INVALID_ARGUMENT = 'INVALID_ARGUMENT'
# FAILED_PRECONDITION = 'FAILED_PRECONDITION'
# OUT_OF_RANGE = 'OUT_OF_RANGE'
# UNAUTHENTICATED = 'UNAUTHENTICATED'
# PERMISSION_DENIED = 'PERMISSION_DENIED'
# NOT_FOUND = 'NOT_FOUND'
# CONFLICT = 'CONFLICT'
# ABORTED = 'ABORTED'
# ALREADY_EXISTS = 'ALREADY_EXISTS'
# RESOURCE_EXHAUSTED = 'RESOURCE_EXHAUSTED'
# CANCELLED = 'CANCELLED'
# DATA_LOSS = 'DATA_LOSS'
# UNKNOWN = 'UNKNOWN'
# INTERNAL = 'INTERNAL'
# UNAVAILABLE = 'UNAVAILABLE'
# DEADLINE_EXCEEDED = 'DEADLINE_EXCEEDED'
# class FirebaseError(Exception):
# class InvalidArgumentError(FirebaseError):
# class FailedPreconditionError(FirebaseError):
# class OutOfRangeError(FirebaseError):
# class UnauthenticatedError(FirebaseError):
# class PermissionDeniedError(FirebaseError):
# class NotFoundError(FirebaseError):
# class ConflictError(FirebaseError):
# class AbortedError(FirebaseError):
# class AlreadyExistsError(FirebaseError):
# class ResourceExhaustedError(FirebaseError):
# class CancelledError(FirebaseError):
# class DataLossError(FirebaseError):
# class UnknownError(FirebaseError):
# class InternalError(FirebaseError):
# class UnavailableError(FirebaseError):
# class DeadlineExceededError(FirebaseError):
#     def __init__(self, code, message, cause=None, http_response=None):
#     def code(self):
#     def cause(self):
#     def http_response(self):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):
#     def __init__(self, message, cause=None, http_response=None):


# Path: firebase_admin/_utils.py
import json
import google.auth
import requests
import firebase_admin
from firebase_admin import exceptions





_ERROR_CODE_TO_EXCEPTION_TYPE = {
    exceptions.INVALID_ARGUMENT: exceptions.InvalidArgumentError,
    exceptions.FAILED_PRECONDITION: exceptions.FailedPreconditionError,
    exceptions.OUT_OF_RANGE: exceptions.OutOfRangeError,
    exceptions.UNAUTHENTICATED: exceptions.UnauthenticatedError,
    exceptions.PERMISSION_DENIED: exceptions.PermissionDeniedError,
    exceptions.NOT_FOUND: exceptions.NotFoundError,
    exceptions.ABORTED: exceptions.AbortedError,
    exceptions.ALREADY_EXISTS: exceptions.AlreadyExistsError,
    exceptions.CONFLICT: exceptions.ConflictError,
    exceptions.RESOURCE_EXHAUSTED: exceptions.ResourceExhaustedError,
    exceptions.CANCELLED: exceptions.CancelledError,
    exceptions.DATA_LOSS: exceptions.DataLossError,
    exceptions.UNKNOWN: exceptions.UnknownError,
    exceptions.INTERNAL: exceptions.InternalError,
    exceptions.UNAVAILABLE: exceptions.UnavailableError,
    exceptions.DEADLINE_EXCEEDED: exceptions.DeadlineExceededError,
}


_HTTP_STATUS_TO_ERROR_CODE = {
    400: exceptions.INVALID_ARGUMENT,
    401: exceptions.UNAUTHENTICATED,
    403: exceptions.PERMISSION_DENIED,
    404: exceptions.NOT_FOUND,
    409: exceptions.CONFLICT,

    412: exceptions.FAILED_PRECONDITION,