{"version":3,"file":"firebase-app.js","sources":["../../node_modules/tslib/tslib.es6.js","../util/src/deepCopy.ts","../util/src/deferred.ts","../util/src/errors.ts","../util/src/obj.ts","../util/src/subscribe.ts","../component/src/component.ts","../component/src/constants.ts","../component/src/provider.ts","../component/src/component_container.ts","../logger/src/logger.ts","../app/src/errors.ts","../app/src/constants.ts","../app/src/logger.ts","../app/src/firebaseApp.ts","../app/src/firebaseNamespaceCore.ts","../app/src/firebaseNamespace.ts","../app/src/platformLoggerService.ts","../util/src/environment.ts","../app/index.ts","../app/src/registerCoreComponents.ts","app/index.ts"],"sourcesContent":["/*!
*****************************************************************************\r\nCopyright
(c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify,
and/or distribute this software for any\r\npurpose with or without fee
is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE
AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS
SOFTWARE.\r\n*****************************************************************************
*/\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics =
function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n
({ __proto__: [] } instanceof Array && function (d, b) {
d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if
(Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n
return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b)
{\r\n if (typeof b !== \"function\" && b !== null)\r\n
throw new TypeError(\"Class extends value \" + String(b) + \" is not a
constructor or null\");\r\n extendStatics(d, b);\r\n function
__() { this.constructor = d; }\r\n d.prototype = b === null ?
Object.create(b) : (__.prototype = b.prototype, new
__());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign =
Object.assign || function __assign(t) {\r\n for (var s, i = 1, n =
arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n
for (var p in s) if (Object.prototype.hasOwnProperty.call(s,
p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n
return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function
__rest(s, e) {\r\n var t = {};\r\n for (var p in s) if
(Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) <
0)\r\n t[p] = s[p];\r\n if (s != null && typeof
Object.getOwnPropertySymbols === \"function\")\r\n for (var i =
0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n
if (e.indexOf(p[i]) < 0 &&
Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n
t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport
function __decorate(decorators, target, key, desc) {\r\n var c =
arguments.length, r = c < 3 ? target : desc === null ? desc =
Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if
(typeof Reflect === \"object\" && typeof Reflect.decorate ===
\"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n
else for (var i = decorators.length - 1; i >= 0; i--) if (d =
decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) :
d(target, key)) || r;\r\n return c > 3 && r &&
Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function
__param(paramIndex, decorator) {\r\n return function (target, key) {
decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function
__metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect ===
\"object\" && typeof Reflect.metadata === \"function\") return
Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport
function __awaiter(thisArg, _arguments, P, generator) {\r\n function
adopt(value) { return value instanceof P ? value : new P(function
(resolve) { resolve(value); }); }\r\n return new (P || (P =
Promise))(function (resolve, reject) {\r\n function
fulfilled(value) { try { step(generator.next(value)); } catch (e) {
reject(e); } }\r\n function rejected(value) { try {
step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n
function step(result) { result.done ? resolve(result.value) :
adopt(result.value).then(fulfilled, rejected); }\r\n
step((generator = generator.apply(thisArg, _arguments ||
[])).next());\r\n });\r\n}\r\n\r\nexport function
__generator(thisArg, body) {\r\n var _ = { label: 0, sent: function()
{ if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f,
y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1),
\"return\": verb(2) }, typeof Symbol === \"function\" &&
(g[Symbol.iterator] = function() { return this; }), g;\r\n function
verb(n) { return function (v) { return step([n, v]); }; }\r\n
function step(op) {\r\n if (f) throw new TypeError(\"Generator is
already executing.\");\r\n while (_) try {\r\n if (f =
1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ?
y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next)
&& !(t = t.call(y, op[1])).done) return t;\r\n if (y =
0, t) op = [op[0] & 2, t.value];\r\n switch (op[0])
{\r\n case 0: case 1: t = op; break;\r\n
case 4: _.label++; return { value: op[1], done: false };\r\n
case 5: _.label++; y = op[1]; op = [0]; continue;\r\n
case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n
default:\r\n if (!(t = _.trys, t = t.length > 0
&& t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _
= 0; continue; }\r\n if (op[0] === 3 && (!t
|| (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1];
break; }\r\n if (op[0] === 6 && _.label <
t[1]) { _.label = t[1]; t = op; break; }\r\n if (t
&& _.label < t[2]) { _.label = t[2]; _.ops.push(op); break;
}\r\n if (t[2]) _.ops.pop();\r\n
_.trys.pop(); continue;\r\n }\r\n op =
body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; }
finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return
{ value: op[0] ? op[1] : void 0, done: true };\r\n
}\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o,
m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 ===
undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function
__exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\"
&& !Object.prototype.hasOwnProperty.call(o, p))
__createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n
var s = typeof Symbol === \"function\" && Symbol.iterator, m =
s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o
&& typeof o.length === \"number\") return {\r\n next:
function () {\r\n if (o && i >= o.length) o = void
0;\r\n return { value: o && o[i++], done: !o };\r\n
}\r\n };\r\n throw new TypeError(s ? \"Object is not
iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport
function __read(o, n) {\r\n var m = typeof Symbol === \"function\"
&& o[Symbol.iterator];\r\n if (!m) return o;\r\n var i =
m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0
|| n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n
}\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n
try {\r\n if (r && !r.done && (m =
i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e)
throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated
*/\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i
< arguments.length; i++)\r\n ar =
ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/**
@deprecated */\r\nexport function __spreadArrays() {\r\n for (var s =
0, i = 0, il = arguments.length; i < il; i++) s +=
arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i <
il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j
< jl; j++, k++)\r\n r[k] = a[j];\r\n return
r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var
i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n
to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function
__await(v) {\r\n return this instanceof __await ? (this.v = v, this) :
new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg,
_arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new
TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g =
generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i =
{}, verb(\"next\"), verb(\"throw\"), verb(\"return\"),
i[Symbol.asyncIterator] = function () { return this; }, i;\r\n
function verb(n) { if (g[n]) i[n] = function (v) { return new
Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v);
}); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e)
{ settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof
__await ? Promise.resolve(r.value.v).then(fulfill, reject) :
settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\",
value); }\r\n function reject(value) { resume(\"throw\", value);
}\r\n function settle(f, v) { if (f(v), q.shift(), q.length)
resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function
__asyncDelegator(o) {\r\n var i, p;\r\n return i = {},
verb(\"next\"), verb(\"throw\", function (e) { throw e; }),
verb(\"return\"), i[Symbol.iterator] = function () { return this; },
i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p =
!p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) :
v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if
(!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is
not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n
return m ? m.call(o) : (o = typeof __values === \"function\" ?
__values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"),
verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function ()
{ return this; }, i);\r\n function verb(n) { i[n] = o[n] &&
function (v) { return new Promise(function (resolve, reject) { v =
o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n
function settle(resolve, reject, d, v) {
Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); },
reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked,
raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked,
\"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return
cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ?
(function(o, v) {\r\n Object.defineProperty(o, \"default\", {
enumerable: true, value: v });\r\n}) : function(o, v) {\r\n
o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n
if (mod && mod.__esModule) return mod;\r\n var result =
{};\r\n if (mod != null) for (var k in mod) if (k !== \"default\"
&& Object.prototype.hasOwnProperty.call(mod, k))
__createBinding(result, mod, k);\r\n __setModuleDefault(result,
mod);\r\n return result;\r\n}\r\n\r\nexport function
__importDefault(mod) {\r\n return (mod && mod.__esModule) ?
mod : { default: mod };\r\n}\r\n\r\nexport function
__classPrivateFieldGet(receiver, privateMap) {\r\n if
(!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted
to get private field on non-instance\");\r\n }\r\n return
privateMap.get(receiver);\r\n}\r\n\r\nexport function
__classPrivateFieldSet(receiver, privateMap, value) {\r\n if
(!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted
to set private field on non-instance\");\r\n }\r\n
privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n *
@license\n * Copyright 2017 Google LLC\n *\n * Licensed under the
Apache License, Version 2.0 (the \"License\");\n * you may not use this
file except in compliance with the License.\n * You may obtain a copy of
the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n
*\n * Unless required by applicable law or agreed to in writing,
software\n * distributed under the License is distributed on an \"AS
IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.\n * See the License for the specific language
governing permissions and\n * limitations under the License.\n
*/\n\n/**\n * Do a deep-copy of basic JavaScript Objects or Arrays.\n
*/\nexport function deepCopy(value: T): T {\n return
deepExtend(undefined, value) as T;\n}\n\n/**\n * Copy properties from
source to target (recursively allows extension\n * of Objects and
Arrays). Scalar values in the target are over-written.\n * If target is
undefined, an object of the appropriate type will be created\n * (and
returned).\n *\n * We recursively copy all child properties of plain
Objects in the source- so\n * that namespace- like dictionaries are
merged.\n *\n * Note that the target can be a function, in which case
the properties in\n * the source Object are copied onto it as static
properties of the Function.\n *\n * Note: we don't merge __proto__ to
prevent prototype pollution\n */\nexport function deepExtend(target:
unknown, source: unknown): unknown {\n if (!(source instanceof Object))
{\n return source;\n }\n\n switch (source.constructor) {\n case
Date:\n // Treat Dates like scalars; if the target date object had
any child\n // properties - they will be lost!\n const
dateValue = source as Date;\n return new
Date(dateValue.getTime());\n\n case Object:\n if (target ===
undefined) {\n target = {};\n }\n break;\n case
Array:\n // Always copy the array source and overwrite the
target.\n target = [];\n break;\n\n default:\n // Not a
plain Object - treat it as a scalar.\n return source;\n }\n\n
for (const prop in source) {\n // use isValidKey to guard against
prototype pollution. See https://snyk.io/vuln/SNYK-JS-LODASH-450202\n
if (!source.hasOwnProperty(prop) || !isValidKey(prop)) {\n
continue;\n }\n (target as Record)[prop] = deepExtend(\n (target as Record)[prop],\n (source as Record)[prop]\n
);\n }\n\n return target;\n}\n\nfunction isValidKey(key: string):
boolean {\n return key !== '__proto__';\n}\n","/**\n * @license\n *
Copyright 2017 Google LLC\n *\n * Licensed under the Apache License,
Version 2.0 (the \"License\");\n * you may not use this file except in
compliance with the License.\n * You may obtain a copy of the License
at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless
required by applicable law or agreed to in writing, software\n *
distributed under the License is distributed on an \"AS IS\" BASIS,\n *
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.\n * See the License for the specific language governing
permissions and\n * limitations under the License.\n */\n\nexport class
Deferred {\n promise: Promise;\n reject: (value?: unknown) =>
void = () => {};\n resolve: (value?: unknown) => void = () =>
{};\n constructor() {\n this.promise = new Promise((resolve,
reject) => {\n this.resolve = resolve as (value?: unknown) =>
void;\n this.reject = reject as (value?: unknown) => void;\n
});\n }\n\n /**\n * Our API internals are not promiseified and
cannot because our callback APIs have subtle expectations around\n *
invoking promises inline, which Promises are forbidden to do. This
method accepts an optional node-style callback\n * and returns a
node-style callback which will resolve or reject the Deferred's
promise.\n */\n wrapCallback(\n callback?: (error?: unknown,
value?: unknown) => void\n ): (error: unknown, value?: unknown)
=> void {\n return (error, value?) => {\n if (error) {\n
this.reject(error);\n } else {\n
this.resolve(value);\n }\n if (typeof callback === 'function')
{\n // Attaching noop handler just in case developer wasn't
expecting\n // promises\n this.promise.catch(() =>
{});\n\n // Some of our callbacks don't expect a value and our
own tests\n // assert that the parameter length is 1\n if
(callback.length === 1) {\n callback(error);\n } else
{\n callback(error, value);\n }\n }\n };\n
}\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed
under the Apache License, Version 2.0 (the \"License\");\n * you may
not use this file except in compliance with the License.\n * You may
obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n/**\n * @fileoverview Standardized
Firebase Error.\n *\n * Usage:\n *\n * // Typescript string literals
for type-safe codes\n * type Err =\n * 'unknown' |\n *
'object-not-found'\n * ;\n *\n * // Closure enum for type-safe
error codes\n * // at-enum {string}\n * var Err = {\n * UNKNOWN:
'unknown',\n * OBJECT_NOT_FOUND: 'object-not-found',\n * }\n *\n *
let errors: Map = {\n * 'generic-error':
\"Unknown error\",\n * 'file-not-found': \"Could not find file:
{$file}\",\n * };\n *\n * // Type-safe function - must pass a valid
error code as param.\n * let error = new ErrorFactory('service',
'Service', errors);\n *\n * ...\n * throw
error.create(Err.GENERIC);\n * ...\n * throw
error.create(Err.FILE_NOT_FOUND, {'file': fileName});\n * ...\n * //
Service: Could not file file: foo.txt (service/file-not-found).\n *\n *
catch (e) {\n * assert(e.message === \"Could not find file:
foo.txt.\");\n * if (e.code === 'service/file-not-found') {\n *
console.log(\"Could not read file: \" + e['file']);\n * }\n *
}\n */\n\nexport type ErrorMap = {\n
readonly [K in ErrorCode]: string;\n};\n\nconst ERROR_NAME =
'FirebaseError';\n\nexport interface StringLike {\n toString():
string;\n}\n\nexport interface ErrorData {\n [key: string]:
unknown;\n}\n\n// Based on code from:\n//
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types\nexport
class FirebaseError extends Error {\n readonly name = ERROR_NAME;\n\n
constructor(\n readonly code: string,\n message: string,\n
public customData?: Record\n ) {\n
super(message);\n\n // Fix For ES5\n //
https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n
Object.setPrototypeOf(this, FirebaseError.prototype);\n\n //
Maintains proper stack trace for where our error was thrown.\n //
Only available on V8.\n if (Error.captureStackTrace) {\n
Error.captureStackTrace(this, ErrorFactory.prototype.create);\n }\n
}\n}\n\nexport class ErrorFactory<\n ErrorCode extends string,\n
ErrorParams extends { readonly [K in ErrorCode]?: ErrorData } = {}\n>
{\n constructor(\n private readonly service: string,\n private
readonly serviceName: string,\n private readonly errors: ErrorMap\n ) {}\n\n create(\n
code: K,\n ...data: K extends keyof ErrorParams ?
[ErrorParams[K]] : []\n ): FirebaseError {\n const customData =
(data[0] as ErrorData) || {};\n const fullCode =
`${this.service}/${code}`;\n const template = this.errors[code];\n\n
const message = template ? replaceTemplate(template, customData) :
'Error';\n // Service Name: Error message (service/code).\n const
fullMessage = `${this.serviceName}: ${message} (${fullCode}).`;\n\n
const error = new FirebaseError(fullCode, fullMessage, customData);\n\n
return error;\n }\n}\n\nfunction replaceTemplate(template: string,
data: ErrorData): string {\n return template.replace(PATTERN, (_, key)
=> {\n const value = data[key];\n return value != null ?
String(value) : `<${key}?>`;\n });\n}\n\nconst PATTERN =
/\\{\\$([^}]+)}/g;\n","/**\n * @license\n * Copyright 2017 Google LLC\n
*\n * Licensed under the Apache License, Version 2.0 (the
\"License\");\n * you may not use this file except in compliance with
the License.\n * You may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nexport function contains(obj: T, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport function safeGet(\n
obj: T,\n key: K\n): T[K] | undefined {\n if
(Object.prototype.hasOwnProperty.call(obj, key)) {\n return
obj[key];\n } else {\n return undefined;\n }\n}\n\nexport function
isEmpty(obj: object): obj is {} {\n for (const key in obj) {\n if
(Object.prototype.hasOwnProperty.call(obj, key)) {\n return
false;\n }\n }\n return true;\n}\n\nexport function map(\n
obj: { [key in K]: V },\n fn: (value: V, key: K, obj: { [key in K]: V
}) => U,\n contextObj?: unknown\n): { [key in K]: U } {\n const
res: Partial<{ [key in K]: U }> = {};\n for (const key in obj)
{\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n
res[key] = fn.call(contextObj, obj[key], key, obj);\n }\n }\n
return res as { [key in K]: U };\n}\n","/**\n * @license\n * Copyright
2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0
(the \"License\");\n * you may not use this file except in compliance
with the License.\n * You may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\nexport type NextFn = (value: T)
=> void;\nexport type ErrorFn = (error: Error) => void;\nexport
type CompleteFn = () => void;\n\nexport interface Observer {\n // Called once for each value in a stream of values.\n next: NextFn;\n\n
// A stream terminates by a single call to EITHER error() or
complete().\n error: ErrorFn;\n\n // No events will be sent to next()
once complete() is called.\n complete: CompleteFn;\n}\n\nexport type
PartialObserver = Partial>;\n\n// TODO: Support also
Unsubscribe.unsubscribe?\nexport type Unsubscribe = () =>
void;\n\n/**\n * The Subscribe interface has two forms - passing the
inline function\n * callbacks, or a object interface with callback
properties.\n */\nexport interface Subscribe {\n (next?: NextFn, error?: ErrorFn, complete?: CompleteFn): Unsubscribe;\n (observer: PartialObserver): Unsubscribe;\n}\n\nexport interface Observable {\n // Subscribe method\n subscribe: Subscribe;\n}\n\nexport type Executor = (observer: Observer)
=> void;\n\n/**\n * Helper to make a Subscribe function (just like
Promise helps make a\n * Thenable).\n *\n * @param executor Function
which can make calls to a single Observer\n * as a proxy.\n * @param
onNoObservers Callback when count of Observers goes to zero.\n
*/\nexport function createSubscribe(\n executor: Executor,\n onNoObservers?: Executor\n): Subscribe {\n const proxy = new ObserverProxy(executor,
onNoObservers);\n return proxy.subscribe.bind(proxy);\n}\n\n/**\n *
Implement fan-out for any number of Observers attached via a subscribe\n
* function.\n */\nclass ObserverProxy implements Observer {\n private observers: Array> | undefined = [];\n private unsubscribes: Unsubscribe[] = [];\n private onNoObservers: Executor
| undefined;\n private observerCount = 0;\n // Micro-task scheduling
by calling task.then().\n private task = Promise.resolve();\n private
finalized = false;\n private finalError?: Error;\n\n /**\n * @param
executor Function which can make calls to a single Observer\n * as
a proxy.\n * @param onNoObservers Callback when count of Observers
goes to zero.\n */\n constructor(executor: Executor, onNoObservers?: Executor)
{\n this.onNoObservers = onNoObservers;\n // Call the executor
asynchronously so subscribers that are called\n // synchronously
after the creation of the subscribe function\n // can still receive
the very first value generated in the executor.\n this.task\n
.then(() => {\n executor(this);\n })\n .catch(e
=> {\n this.error(e);\n });\n }\n\n next(value: T):
void {\n this.forEachObserver((observer: Observer) => {\n
observer.next(value);\n });\n }\n\n error(error: Error): void {\n
this.forEachObserver((observer: Observer) => {\n
observer.error(error);\n });\n this.close(error);\n }\n\n
complete(): void {\n this.forEachObserver((observer: Observer)
=> {\n observer.complete();\n });\n this.close();\n }\n\n
/**\n * Subscribe function that can be used to add an Observer to
the fan-out list.\n *\n * - We require that no event is sent to a
subscriber sychronously to their\n * call to subscribe().\n */\n
subscribe(\n nextOrObserver?: NextFn | PartialObserver,\n error?: ErrorFn,\n complete?: CompleteFn\n ): Unsubscribe {\n let observer: Observer;\n\n
if (\n nextOrObserver === undefined &&\n error ===
undefined &&\n complete === undefined\n ) {\n
throw new Error('Missing Observer.');\n }\n\n // Assemble an
Observer object when passed as callback functions.\n if (\n
implementsAnyMethods(nextOrObserver as { [key: string]: unknown }, [\n
'next',\n 'error',\n 'complete'\n ])\n ) {\n
observer = nextOrObserver as Observer;\n } else {\n observer = {\n next: nextOrObserver as NextFn,\n error,\n complete\n } as Observer;\n }\n\n if (observer.next === undefined) {\n observer.next = noop as NextFn;\n
}\n if (observer.error === undefined) {\n observer.error =
noop as ErrorFn;\n }\n if (observer.complete === undefined) {\n
observer.complete = noop as CompleteFn;\n }\n\n const unsub =
this.unsubscribeOne.bind(this, this.observers!.length);\n\n //
Attempt to subscribe to a terminated Observable - we\n // just
respond to the Observer with the final error or complete\n //
event.\n if (this.finalized) {\n // eslint-disable-next-line
@typescript-eslint/no-floating-promises\n this.task.then(() =>
{\n try {\n if (this.finalError) {\n
observer.error(this.finalError);\n } else {\n
observer.complete();\n }\n } catch (e) {\n //
nothing\n }\n return;\n });\n }\n\n
this.observers!.push(observer as Observer);\n\n return unsub;\n
}\n\n // Unsubscribe is synchronous - we guarantee that no events are
sent to\n // any unsubscribed Observer.\n private unsubscribeOne(i:
number): void {\n if (this.observers === undefined ||
this.observers[i] === undefined) {\n return;\n }\n\n delete
this.observers[i];\n\n this.observerCount -= 1;\n if
(this.observerCount === 0 && this.onNoObservers !== undefined)
{\n this.onNoObservers(this);\n }\n }\n\n private
forEachObserver(fn: (observer: Observer) => void): void {\n if
(this.finalized) {\n // Already closed by previous event....just
eat the additional values.\n return;\n }\n\n // Since sendOne
calls asynchronously - there is no chance that\n // this.observers
will become undefined.\n for (let i = 0; i <
this.observers!.length; i++) {\n this.sendOne(i, fn);\n }\n
}\n\n // Call the Observer via one of it's callback function. We are
careful to\n // confirm that the observe has not been unsubscribed
since this asynchronous\n // function had been queued.\n private
sendOne(i: number, fn: (observer: Observer) => void): void {\n
// Execute the callback asynchronously\n // eslint-disable-next-line
@typescript-eslint/no-floating-promises\n this.task.then(() => {\n
if (this.observers !== undefined && this.observers[i] !==
undefined) {\n try {\n fn(this.observers[i]);\n }
catch (e) {\n // Ignore exceptions raised in Observers or
missing methods of an\n // Observer.\n // Log error to
console. b/31404806\n if (typeof console !== 'undefined'
&& console.error) {\n console.error(e);\n
}\n }\n }\n });\n }\n\n private close(err?: Error):
void {\n if (this.finalized) {\n return;\n }\n
this.finalized = true;\n if (err !== undefined) {\n
this.finalError = err;\n }\n // Proxy is no longer needed -
garbage collect references\n // eslint-disable-next-line
@typescript-eslint/no-floating-promises\n this.task.then(() => {\n
this.observers = undefined;\n this.onNoObservers =
undefined;\n });\n }\n}\n\n/** Turn synchronous function into one
called asynchronously. */\n// eslint-disable-next-line
@typescript-eslint/ban-types\nexport function async(fn: Function,
onError?: ErrorFn): Function {\n return (...args: unknown[]) => {\n
Promise.resolve(true)\n .then(() => {\n fn(...args);\n
})\n .catch((error: Error) => {\n if (onError) {\n
onError(error);\n }\n });\n };\n}\n\n/**\n *
Return true if the object passed in implements any of the named
methods.\n */\nfunction implementsAnyMethods(\n obj: { [key: string]:
unknown },\n methods: string[]\n): boolean {\n if (typeof obj !==
'object' || obj === null) {\n return false;\n }\n\n for (const
method of methods) {\n if (method in obj && typeof
obj[method] === 'function') {\n return true;\n }\n }\n\n
return false;\n}\n\nfunction noop(): void {\n // do
nothing\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n *
Licensed under the Apache License, Version 2.0 (the \"License\");\n *
you may not use this file except in compliance with the License.\n * You
may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\nimport {\n InstantiationMode,\n
InstanceFactory,\n ComponentType,\n Dictionary,\n Name,\n
onInstanceCreatedCallback\n} from './types';\n\n/**\n * Component for
service name T, e.g. `auth`, `auth-internal`\n */\nexport class
Component {\n multipleInstances = false;\n
/**\n * Properties to be added to the service namespace\n */\n
serviceProps: Dictionary = {};\n\n instantiationMode =
InstantiationMode.LAZY;\n\n onInstanceCreated:
onInstanceCreatedCallback | null = null;\n\n /**\n *\n * @param
name The public service name, e.g. app, auth, firestore, database\n *
@param instanceFactory Service factory responsible for creating the
public interface\n * @param type whether the service provided by the
component is public or private\n */\n constructor(\n readonly
name: T,\n readonly instanceFactory: InstanceFactory,\n
readonly type: ComponentType\n ) {}\n\n setInstantiationMode(mode:
InstantiationMode): this {\n this.instantiationMode = mode;\n
return this;\n }\n\n setMultipleInstances(multipleInstances: boolean):
this {\n this.multipleInstances = multipleInstances;\n return
this;\n }\n\n setServiceProps(props: Dictionary): this {\n
this.serviceProps = props;\n return this;\n }\n\n
setInstanceCreatedCallback(callback: onInstanceCreatedCallback): this
{\n this.onInstanceCreated = callback;\n return this;\n
}\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed
under the Apache License, Version 2.0 (the \"License\");\n * you may
not use this file except in compliance with the License.\n * You may
obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nexport const DEFAULT_ENTRY_NAME =
'[DEFAULT]';\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n *
Licensed under the Apache License, Version 2.0 (the \"License\");\n *
you may not use this file except in compliance with the License.\n * You
may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport { Deferred } from
'@firebase/util';\nimport { ComponentContainer } from
'./component_container';\nimport { DEFAULT_ENTRY_NAME } from
'./constants';\nimport {\n InitializeOptions,\n InstantiationMode,\n
Name,\n NameServiceMapping,\n OnInitCallBack\n} from
'./types';\nimport { Component } from './component';\n\n/**\n * Provider
for instance for service name T, e.g. 'auth', 'auth-internal'\n *
NameServiceMapping[T] is an alias for the type of the instance\n
*/\nexport class Provider {\n private component: Component | null = null;\n private readonly instances: Map = new Map();\n private readonly instancesDeferred: Map<\n string,\n Deferred\n > = new Map();\n private onInitCallbacks: Set>
= new Set();\n\n constructor(\n private readonly name: T,\n
private readonly container: ComponentContainer\n ) {}\n\n /**\n *
@param identifier A provider can provide mulitple instances of a
service\n * if this.component.multipleInstances is true.\n */\n
get(identifier: string = DEFAULT_ENTRY_NAME): Promise
{\n // if multipleInstances is not supported, use the default name\n
const normalizedIdentifier =
this.normalizeInstanceIdentifier(identifier);\n\n if
(!this.instancesDeferred.has(normalizedIdentifier)) {\n const
deferred = new Deferred();\n
this.instancesDeferred.set(normalizedIdentifier, deferred);\n\n if
(\n this.isInitialized(normalizedIdentifier) ||\n
this.shouldAutoInitialize()\n ) {\n // initialize the
service if it can be auto-initialized\n try {\n const
instance = this.getOrInitializeService({\n
instanceIdentifier: normalizedIdentifier\n });\n if
(instance) {\n deferred.resolve(instance);\n }\n
} catch (e) {\n // when the instance factory throws an
exception during get(), it should not cause\n // a fatal error.
We just return the unresolved promise in this case.\n }\n
}\n }\n\n return
this.instancesDeferred.get(normalizedIdentifier)!.promise;\n }\n\n
/**\n *\n * @param options.identifier A provider can provide
mulitple instances of a service\n * if
this.component.multipleInstances is true.\n * @param options.optional
If optional is false or not provided, the method throws an error when\n
* the service is not immediately available.\n * If optional is true,
the method returns null if the service is not immediately available.\n
*/\n getImmediate(options: {\n identifier?: string;\n optional:
true;\n }): NameServiceMapping[T] | null;\n getImmediate(options?:
{\n identifier?: string;\n optional?: false;\n }):
NameServiceMapping[T];\n getImmediate(options?: {\n identifier?:
string;\n optional?: boolean;\n }): NameServiceMapping[T] | null {\n
const { identifier, optional } = {\n identifier:
DEFAULT_ENTRY_NAME,\n optional: false,\n ...options\n };\n
// if multipleInstances is not supported, use the default name\n
const normalizedIdentifier =
this.normalizeInstanceIdentifier(identifier);\n\n if (\n
this.isInitialized(normalizedIdentifier) ||\n
this.shouldAutoInitialize()\n ) {\n try {\n return
this.getOrInitializeService({\n instanceIdentifier:
normalizedIdentifier\n });\n } catch (e) {\n if
(optional) {\n return null;\n } else {\n throw
e;\n }\n }\n } else {\n // In case a component is
not initialized and should/can not be auto-initialized at the moment,
return null if the optional flag is set, or throw\n if (optional)
{\n return null;\n } else {\n throw Error(`Service
${this.name} is not available`);\n }\n }\n }\n\n
getComponent(): Component | null {\n return this.component;\n }\n\n setComponent(component: Component):
void {\n if (component.name !== this.name) {\n throw Error(\n
`Mismatching Component ${component.name} for Provider
${this.name}.`\n );\n }\n\n if (this.component) {\n
throw Error(`Component for ${this.name} has already been provided`);\n
}\n\n this.component = component;\n\n // return early without
attempting to initialize the component if the component requires
explicit initialization (calling `Provider.initialize()`)\n if
(!this.shouldAutoInitialize()) {\n return;\n }\n\n // if the
service is eager, initialize the default instance\n if
(isComponentEager(component)) {\n try {\n
this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME
});\n } catch (e) {\n // when the instance factory for an
eager Component throws an exception during the eager\n //
initialization, it should not cause a fatal error.\n // TODO:
Investigate if we need to make it configurable, because some component
may want to cause\n // a fatal error in this case?\n }\n
}\n\n // Create service instances for the pending promises and
resolve them\n // NOTE: if this.multipleInstances is false, only the
default instance will be created\n // and all promises with resolve
with it regardless of the identifier.\n for (const [\n
instanceIdentifier,\n instanceDeferred\n ] of
this.instancesDeferred.entries()) {\n const normalizedIdentifier =
this.normalizeInstanceIdentifier(\n instanceIdentifier\n
);\n\n try {\n // `getOrInitializeService()` should always
return a valid instance since a component is guaranteed. use ! to make
typescript happy.\n const instance =
this.getOrInitializeService({\n instanceIdentifier:
normalizedIdentifier\n })!;\n
instanceDeferred.resolve(instance);\n } catch (e) {\n //
when the instance factory throws an exception, it should not cause\n
// a fatal error. We just leave the promise unresolved.\n }\n
}\n }\n\n clearInstance(identifier: string = DEFAULT_ENTRY_NAME):
void {\n this.instancesDeferred.delete(identifier);\n
this.instances.delete(identifier);\n }\n\n // app.delete() will call
this method on every provider to delete the services\n // TODO: should
we mark the provider as deleted?\n async delete(): Promise {\n
const services = Array.from(this.instances.values());\n\n await
Promise.all([\n ...services\n .filter(service =>
'INTERNAL' in service) // legacy services\n //
eslint-disable-next-line @typescript-eslint/no-explicit-any\n
.map(service => (service as any).INTERNAL!.delete()),\n
...services\n .filter(service => '_delete' in service) //
modularized services\n // eslint-disable-next-line
@typescript-eslint/no-explicit-any\n .map(service => (service
as any)._delete())\n ]);\n }\n\n isComponentSet(): boolean {\n
return this.component != null;\n }\n\n isInitialized(identifier:
string = DEFAULT_ENTRY_NAME): boolean {\n return
this.instances.has(identifier);\n }\n\n initialize(opts:
InitializeOptions = {}): NameServiceMapping[T] {\n const {
instanceIdentifier = DEFAULT_ENTRY_NAME, options = {} } = opts;\n
const normalizedIdentifier = this.normalizeInstanceIdentifier(\n
instanceIdentifier\n );\n if
(this.isInitialized(normalizedIdentifier)) {\n throw Error(\n
`${this.name}(${normalizedIdentifier}) has already been initialized`\n
);\n }\n\n if (!this.isComponentSet()) {\n throw
Error(`Component ${this.name} has not been registered yet`);\n }\n\n
const instance = this.getOrInitializeService({\n
instanceIdentifier: normalizedIdentifier,\n options\n })!;\n\n
// resolve any pending promise waiting for the service instance\n
for (const [\n instanceIdentifier,\n instanceDeferred\n ]
of this.instancesDeferred.entries()) {\n const
normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(\n
instanceIdentifier\n );\n if (normalizedIdentifier ===
normalizedDeferredIdentifier) {\n
instanceDeferred.resolve(instance);\n }\n }\n\n
this.invokeOnInitCallbacks(instance, normalizedIdentifier);\n\n
return instance;\n }\n\n /**\n *\n * @param callback - a function
that will be invoked after the provider has been initialized by calling
provider.initialize().\n * The function is invoked SYNCHRONOUSLY, so
it should not execute any longrunning tasks in order to not block the
program.\n *\n * @returns a function to unregister the callback\n
*/\n onInit(callback: OnInitCallBack): () => void {\n
this.onInitCallbacks.add(callback);\n\n return () => {\n
this.onInitCallbacks.delete(callback);\n };\n }\n\n /**\n *
Invoke onInit callbacks synchronously\n * @param instance the service
instance`\n */\n private invokeOnInitCallbacks(\n instance:
NameServiceMapping[T],\n identifier: string\n ): void {\n for
(const callback of this.onInitCallbacks) {\n try {\n
callback(instance, identifier);\n } catch {\n // ignore
errors in the onInit callback\n }\n }\n }\n\n private
getOrInitializeService({\n instanceIdentifier,\n options = {}\n
}: {\n instanceIdentifier: string;\n options?: Record;\n
}): NameServiceMapping[T] | null {\n let instance =
this.instances.get(instanceIdentifier);\n if (!instance &&
this.component) {\n instance =
this.component.instanceFactory(this.container, {\n
instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),\n
options\n });\n this.instances.set(instanceIdentifier,
instance);\n\n /**\n * Order is important\n *
onInstanceCreated() should be called after
this.instances.set(instanceIdentifier, instance); which\n * makes
`isInitialized()` return true.\n */\n if
(this.component.onInstanceCreated) {\n try {\n
this.component.onInstanceCreated(\n this.container,\n
instanceIdentifier,\n instance\n );\n }
catch {\n // ignore errors in the onInstanceCreatedCallback\n
}\n }\n }\n\n return instance || null;\n }\n\n
private normalizeInstanceIdentifier(identifier: string): string {\n
if (this.component) {\n return this.component.multipleInstances ?
identifier : DEFAULT_ENTRY_NAME;\n } else {\n return identifier;
// assume multiple instances are supported before the component is
provided.\n }\n }\n\n private shouldAutoInitialize(): boolean {\n
return (\n !!this.component &&\n
this.component.instantiationMode !== InstantiationMode.EXPLICIT\n
);\n }\n}\n\n// undefined should be passed to the service factory for
the default instance\nfunction normalizeIdentifierForFactory(identifier:
string): string | undefined {\n return identifier ===
DEFAULT_ENTRY_NAME ? undefined : identifier;\n}\n\nfunction
isComponentEager(component: Component): boolean
{\n return component.instantiationMode ===
InstantiationMode.EAGER;\n}\n","/**\n * @license\n * Copyright 2019
Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the
\"License\");\n * you may not use this file except in compliance with
the License.\n * You may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport { Provider } from
'./provider';\nimport { Component } from './component';\nimport { Name }
from './types';\n\n/**\n * ComponentContainer that provides Providers
for service name T, e.g. `auth`, `auth-internal`\n */\nexport class
ComponentContainer {\n private readonly providers = new Map>();\n\n
constructor(private readonly name: string) {}\n\n /**\n *\n *
@param component Component being added\n * @param overwrite When a
component with the same name has already been registered,\n * if
overwrite is true: overwrite the existing component with the new
component and create a new\n * provider with the new component. It can
be useful in tests where you want to use different mocks\n * for
different tests.\n * if overwrite is false: throw an exception\n
*/\n addComponent(component: Component): void
{\n const provider = this.getProvider(component.name);\n if
(provider.isComponentSet()) {\n throw new Error(\n
`Component ${component.name} has already been registered with
${this.name}`\n );\n }\n\n
provider.setComponent(component);\n }\n\n addOrOverwriteComponent(component: Component):
void {\n const provider = this.getProvider(component.name);\n if
(provider.isComponentSet()) {\n // delete the existing provider
from the container, so we can register the new component\n
this.providers.delete(component.name);\n }\n\n
this.addComponent(component);\n }\n\n /**\n * getProvider provides a
type safe interface where it can only be called with a field name\n *
present in NameServiceMapping interface.\n *\n * Firebase SDKs
providing services should extend NameServiceMapping interface to
register\n * themselves.\n */\n getProvider(name: T): Provider {\n if (this.providers.has(name)) {\n return (this.providers.get(name) as unknown) as Provider;\n }\n\n // create a Provider for a service that hasn't registered with Firebase\n const provider = new Provider(name, this);\n this.providers.set(name, (provider as unknown) as Provider);\n\n return provider as Provider;\n }\n\n getProviders(): Array>
{\n return Array.from(this.providers.values());\n }\n}\n","/**\n *
@license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache
License, Version 2.0 (the \"License\");\n * you may not use this file
except in compliance with the License.\n * You may obtain a copy of the
License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n *
Unless required by applicable law or agreed to in writing, software\n *
distributed under the License is distributed on an \"AS IS\" BASIS,\n *
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.\n * See the License for the specific language governing
permissions and\n * limitations under the License.\n */\n\nexport type
LogLevelString =\n | 'debug'\n | 'verbose'\n | 'info'\n | 'warn'\n |
'error'\n | 'silent';\n\nexport interface LogOptions {\n level:
LogLevelString;\n}\n\nexport type LogCallback = (callbackParams:
LogCallbackParams) => void;\n\nexport interface LogCallbackParams {\n
level: LogLevelString;\n message: string;\n args: unknown[];\n
type: string;\n}\n\n/**\n * A container for all of the Logger
instances\n */\nexport const instances: Logger[] = [];\n\n/**\n * The JS
SDK supports 5 log levels and also allows a user the ability to\n *
silence the logs altogether.\n *\n * The order is a follows:\n * DEBUG
< VERBOSE < INFO < WARN < ERROR\n *\n * All of the log types
above the current log level will be captured (i.e. if\n * you set the
log level to `INFO`, errors will still be logged, but `DEBUG` and\n *
`VERBOSE` logs will not)\n */\nexport enum LogLevel {\n DEBUG,\n
VERBOSE,\n INFO,\n WARN,\n ERROR,\n SILENT\n}\n\nconst
levelStringToEnum: { [key in LogLevelString]: LogLevel } = {\n 'debug':
LogLevel.DEBUG,\n 'verbose': LogLevel.VERBOSE,\n 'info':
LogLevel.INFO,\n 'warn': LogLevel.WARN,\n 'error': LogLevel.ERROR,\n
'silent': LogLevel.SILENT\n};\n\n/**\n * The default log level\n
*/\nconst defaultLogLevel: LogLevel = LogLevel.INFO;\n\n/**\n * We allow
users the ability to pass their own log handler. We will pass the\n *
type of log, the current log level, and any other arguments passed (i.e.
the\n * messages that the user wants to log) to this function.\n
*/\nexport type LogHandler = (\n loggerInstance: Logger,\n logType:
LogLevel,\n ...args: unknown[]\n) => void;\n\n/**\n * By default,
`console.debug` is not displayed in the developer console (in\n *
chrome). To avoid forcing users to have to opt-in to these logs twice\n *
(i.e. once for firebase, and once in the console), we are sending
`DEBUG`\n * logs to the `console.log` function.\n */\nconst
ConsoleMethod = {\n [LogLevel.DEBUG]: 'log',\n [LogLevel.VERBOSE]:
'log',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n
[LogLevel.ERROR]: 'error'\n};\n\n/**\n * The default log handler will
forward DEBUG, VERBOSE, INFO, WARN, and ERROR\n * messages on to their
corresponding console counterparts (if the log method\n * is supported
by the current log level)\n */\nconst defaultLogHandler: LogHandler =
(instance, logType, ...args): void => {\n if (logType <
instance.logLevel) {\n return;\n }\n const now = new
Date().toISOString();\n const method = ConsoleMethod[logType as keyof
typeof ConsoleMethod];\n if (method) {\n console[method as 'log' |
'info' | 'warn' | 'error'](\n `[${now}] ${instance.name}:`,\n
...args\n );\n } else {\n throw new Error(\n `Attempted to
log a message with an invalid logType (value: ${logType})`\n );\n
}\n};\n\nexport class Logger {\n /**\n * Gives you an instance of a
Logger to capture messages according to\n * Firebase's logging
scheme.\n *\n * @param name The name that the logs will be
associated with\n */\n constructor(public name: string) {\n /**\n
* Capture the current instance for later use\n */\n
instances.push(this);\n }\n\n /**\n * The log level of the given
Logger instance.\n */\n private _logLevel = defaultLogLevel;\n\n get
logLevel(): LogLevel {\n return this._logLevel;\n }\n\n set
logLevel(val: LogLevel) {\n if (!(val in LogLevel)) {\n throw
new TypeError(`Invalid value \"${val}\" assigned to \\`logLevel\\``);\n
}\n this._logLevel = val;\n }\n\n // Workaround for
setter/getter having to be the same type.\n setLogLevel(val: LogLevel |
LogLevelString): void {\n this._logLevel = typeof val === 'string' ?
levelStringToEnum[val] : val;\n }\n\n /**\n * The main (internal)
log handler for the Logger instance.\n * Can be set to a new function
in internal package code but not by user.\n */\n private _logHandler:
LogHandler = defaultLogHandler;\n get logHandler(): LogHandler {\n
return this._logHandler;\n }\n set logHandler(val: LogHandler) {\n
if (typeof val !== 'function') {\n throw new TypeError('Value
assigned to `logHandler` must be a function');\n }\n
this._logHandler = val;\n }\n\n /**\n * The optional, additional,
user-defined log handler for the Logger instance.\n */\n private
_userLogHandler: LogHandler | null = null;\n get userLogHandler():
LogHandler | null {\n return this._userLogHandler;\n }\n set
userLogHandler(val: LogHandler | null) {\n this._userLogHandler =
val;\n }\n\n /**\n * The functions below are all based on the
`console` interface\n */\n\n debug(...args: unknown[]): void {\n
this._userLogHandler && this._userLogHandler(this,
LogLevel.DEBUG, ...args);\n this._logHandler(this, LogLevel.DEBUG,
...args);\n }\n log(...args: unknown[]): void {\n
this._userLogHandler &&\n this._userLogHandler(this,
LogLevel.VERBOSE, ...args);\n this._logHandler(this,
LogLevel.VERBOSE, ...args);\n }\n info(...args: unknown[]): void {\n
this._userLogHandler && this._userLogHandler(this,
LogLevel.INFO, ...args);\n this._logHandler(this, LogLevel.INFO,
...args);\n }\n warn(...args: unknown[]): void {\n
this._userLogHandler && this._userLogHandler(this,
LogLevel.WARN, ...args);\n this._logHandler(this, LogLevel.WARN,
...args);\n }\n error(...args: unknown[]): void {\n
this._userLogHandler && this._userLogHandler(this,
LogLevel.ERROR, ...args);\n this._logHandler(this, LogLevel.ERROR,
...args);\n }\n}\n\nexport function setLogLevel(level: LogLevelString |
LogLevel): void {\n instances.forEach(inst => {\n
inst.setLogLevel(level);\n });\n}\n\nexport function
setUserLogHandler(\n logCallback: LogCallback | null,\n options?:
LogOptions\n): void {\n for (const instance of instances) {\n let
customLogLevel: LogLevel | null = null;\n if (options &&
options.level) {\n customLogLevel =
levelStringToEnum[options.level];\n }\n if (logCallback === null)
{\n instance.userLogHandler = null;\n } else {\n
instance.userLogHandler = (\n instance: Logger,\n level:
LogLevel,\n ...args: unknown[]\n ) => {\n const
message = args\n .map(arg => {\n if (arg == null)
{\n return null;\n } else if (typeof arg ===
'string') {\n return arg;\n } else if (typeof
arg === 'number' || typeof arg === 'boolean') {\n return
arg.toString();\n } else if (arg instanceof Error) {\n
return arg.message;\n } else {\n try {\n
return JSON.stringify(arg);\n } catch
(ignored) {\n return null;\n }\n
}\n })\n .filter(arg => arg)\n .join('
');\n if (level >= (customLogLevel ?? instance.logLevel)) {\n
logCallback({\n level: LogLevel[level].toLowerCase()
as LogLevelString,\n message,\n args,\n
type: instance.name\n });\n }\n };\n }\n
}\n}\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed
under the Apache License, Version 2.0 (the \"License\");\n * you may
not use this file except in compliance with the License.\n * You may
obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport { ErrorFactory, ErrorMap }
from '@firebase/util';\n\nexport const enum AppError {\n NO_APP =
'no-app',\n BAD_APP_NAME = 'bad-app-name',\n DUPLICATE_APP =
'duplicate-app',\n APP_DELETED = 'app-deleted',\n INVALID_APP_ARGUMENT
= 'invalid-app-argument',\n INVALID_LOG_ARGUMENT =
'invalid-log-argument'\n}\n\nconst ERRORS: ErrorMap = {\n
[AppError.NO_APP]:\n \"No Firebase App '{$appName}' has been created -
\" +\n 'call Firebase App.initializeApp()',\n
[AppError.BAD_APP_NAME]: \"Illegal App name: '{$appName}\",\n
[AppError.DUPLICATE_APP]: \"Firebase App named '{$appName}' already
exists\",\n [AppError.APP_DELETED]: \"Firebase App named '{$appName}'
already deleted\",\n [AppError.INVALID_APP_ARGUMENT]:\n
'firebase.{$appName}() takes either no argument or a ' +\n 'Firebase
App instance.',\n [AppError.INVALID_LOG_ARGUMENT]:\n 'First argument
to `onLog` must be null or a function.'\n};\n\ninterface ErrorParams
{\n [AppError.NO_APP]: { appName: string };\n [AppError.BAD_APP_NAME]:
{ appName: string };\n [AppError.DUPLICATE_APP]: { appName: string
};\n [AppError.APP_DELETED]: { appName: string };\n
[AppError.INVALID_APP_ARGUMENT]: { appName: string };\n}\n\nexport const
ERROR_FACTORY = new ErrorFactory(\n 'app',\n
'Firebase',\n ERRORS\n);\n","/**\n * @license\n * Copyright 2019
Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the
\"License\");\n * you may not use this file except in compliance with
the License.\n * You may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nexport const DEFAULT_ENTRY_NAME =
'[DEFAULT]';\nimport { name as appName } from
'../package.json';\nimport { name as analyticsName } from
'../../analytics/package.json';\nimport { name as appCheckName } from
'../../app-check/package.json';\nimport { name as authName } from
'../../auth/package.json';\nimport { name as databaseName } from
'../../database/package.json';\nimport { name as functionsName } from
'../../functions/package.json';\nimport { name as installationsName }
from '../../installations/package.json';\nimport { name as messagingName
} from '../../messaging/package.json';\nimport { name as
performanceName } from '../../performance/package.json';\nimport { name
as remoteConfigName } from '../../remote-config/package.json';\nimport {
name as storageName } from '../../storage/package.json';\nimport { name
as firestoreName } from '../../firestore/package.json';\nimport { name
as packageName } from '../../../package.json';\n\nexport const
PLATFORM_LOG_STRING = {\n [appName]: 'fire-core',\n [analyticsName]:
'fire-analytics',\n [appCheckName]: 'fire-app-check',\n [authName]:
'fire-auth',\n [databaseName]: 'fire-rtdb',\n [functionsName]:
'fire-fn',\n [installationsName]: 'fire-iid',\n [messagingName]:
'fire-fcm',\n [performanceName]: 'fire-perf',\n [remoteConfigName]:
'fire-rc',\n [storageName]: 'fire-gcs',\n [firestoreName]:
'fire-fst',\n 'fire-js': 'fire-js', // Platform identifier for JS
SDK.\n [packageName]: 'fire-js-all'\n} as const;\n","/**\n * @license\n
* Copyright 2019 Google LLC\n *\n * Licensed under the Apache License,
Version 2.0 (the \"License\");\n * you may not use this file except in
compliance with the License.\n * You may obtain a copy of the License
at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless
required by applicable law or agreed to in writing, software\n *
distributed under the License is distributed on an \"AS IS\" BASIS,\n *
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.\n * See the License for the specific language governing
permissions and\n * limitations under the License.\n */\n\nimport {
Logger } from '@firebase/logger';\n\nexport const logger = new
Logger('@firebase/app');\n","/**\n * @license\n * Copyright 2017 Google
LLC\n *\n * Licensed under the Apache License, Version 2.0 (the
\"License\");\n * you may not use this file except in compliance with
the License.\n * You may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport {\n FirebaseApp,\n
FirebaseOptions,\n FirebaseAppConfig\n} from
'@firebase/app-types';\nimport {\n _FirebaseNamespace,\n
FirebaseService\n} from '@firebase/app-types/private';\nimport {
deepCopy } from '@firebase/util';\nimport {\n ComponentContainer,\n
Component,\n ComponentType,\n Name,\n InstantiationMode\n} from
'@firebase/component';\nimport { AppError, ERROR_FACTORY } from
'./errors';\nimport { DEFAULT_ENTRY_NAME } from './constants';\nimport {
logger } from './logger';\n\n/**\n * Global context object for a
collection of services using\n * a shared authentication state.\n
*/\nexport class FirebaseAppImpl implements FirebaseApp {\n private
readonly options_: FirebaseOptions;\n private readonly name_: string;\n
private isDeleted_ = false;\n private
automaticDataCollectionEnabled_: boolean;\n private container:
ComponentContainer;\n\n constructor(\n options: FirebaseOptions,\n
config: FirebaseAppConfig,\n private readonly firebase_:
_FirebaseNamespace\n ) {\n this.name_ = config.name!;\n
this.automaticDataCollectionEnabled_ =\n
config.automaticDataCollectionEnabled || false;\n this.options_ =
deepCopy(options);\n this.container = new
ComponentContainer(config.name!);\n\n // add itself to container\n
this._addComponent(new Component('app', () => this,
ComponentType.PUBLIC));\n // populate ComponentContainer with
existing components\n
this.firebase_.INTERNAL.components.forEach(component =>\n
this._addComponent(component)\n );\n }\n\n get
automaticDataCollectionEnabled(): boolean {\n
this.checkDestroyed_();\n return
this.automaticDataCollectionEnabled_;\n }\n\n set
automaticDataCollectionEnabled(val) {\n this.checkDestroyed_();\n
this.automaticDataCollectionEnabled_ = val;\n }\n\n get name(): string
{\n this.checkDestroyed_();\n return this.name_;\n }\n\n get
options(): FirebaseOptions {\n this.checkDestroyed_();\n return
this.options_;\n }\n\n delete(): Promise {\n return new Promise(resolve
=> {\n this.checkDestroyed_();\n resolve();\n })\n
.then(() => {\n
this.firebase_.INTERNAL.removeApp(this.name_);\n\n return
Promise.all(\n this.container.getProviders().map(provider =>
provider.delete())\n );\n })\n .then((): void =>
{\n this.isDeleted_ = true;\n });\n }\n\n /**\n * Return
a service instance associated with this app (creating it\n * on
demand), identified by the passed instanceIdentifier.\n *\n * NOTE:
Currently storage and functions are the only ones that are leveraging
this\n * functionality. They invoke it by calling:\n *\n *
```javascript\n * firebase.app().storage('STORAGE BUCKET ID')\n *
```\n *\n * The service name is passed to this already\n *
@internal\n */\n _getService(\n name: string,\n
instanceIdentifier: string = DEFAULT_ENTRY_NAME\n ): FirebaseService
{\n this.checkDestroyed_();\n\n // Initialize instance if
InstatiationMode is `EXPLICIT`.\n const provider =
this.container.getProvider(name as Name);\n if (\n
!provider.isInitialized() &&\n
provider.getComponent()?.instantiationMode ===
InstantiationMode.EXPLICIT\n ) {\n provider.initialize();\n
}\n\n // getImmediate will always succeed because _getService is only
called for registered components.\n return
(provider.getImmediate({\n identifier: instanceIdentifier\n })
as unknown) as FirebaseService;\n }\n /**\n * Remove a service
instance from the cache, so we will create a new instance for this
service\n * when people try to get this service again.\n *\n *
NOTE: currently only firestore is using this functionality to support
firestore shutdown.\n *\n * @param name The service name\n *
@param instanceIdentifier instance identifier in case multiple instances
are allowed\n * @internal\n */\n _removeServiceInstance(\n
name: string,\n instanceIdentifier: string = DEFAULT_ENTRY_NAME\n ):
void {\n // eslint-disable-next-line
@typescript-eslint/no-explicit-any\n this.container.getProvider(name
as any).clearInstance(instanceIdentifier);\n }\n\n /**\n * @param
component the component being added to this app's container\n */\n
_addComponent(component: Component): void {\n
try {\n this.container.addComponent(component);\n } catch (e)
{\n logger.debug(\n `Component ${component.name} failed to
register with FirebaseApp ${this.name}`,\n e\n );\n }\n
}\n\n _addOrOverwriteComponent(component: Component): void {\n
this.container.addOrOverwriteComponent(component);\n }\n\n toJSON():
object {\n return {\n name: this.name,\n
automaticDataCollectionEnabled: this.automaticDataCollectionEnabled,\n
options: this.options\n };\n }\n\n /**\n * This function will
throw an Error if the App has already been deleted -\n * use before
performing API actions on the App.\n */\n private checkDestroyed_():
void {\n if (this.isDeleted_) {\n throw
ERROR_FACTORY.create(AppError.APP_DELETED, { appName: this.name_ });\n
}\n }\n}\n\n// Prevent dead-code elimination of these methods w/o
invalid property\n// copying.\n(FirebaseAppImpl.prototype.name
&& FirebaseAppImpl.prototype.options) ||\n
FirebaseAppImpl.prototype.delete ||\n console.log('dc');\n","/**\n *
@license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache
License, Version 2.0 (the \"License\");\n * you may not use this file
except in compliance with the License.\n * You may obtain a copy of the
License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n *
Unless required by applicable law or agreed to in writing, software\n *
distributed under the License is distributed on an \"AS IS\" BASIS,\n *
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.\n * See the License for the specific language governing
permissions and\n * limitations under the License.\n */\n\nimport {\n
FirebaseApp,\n FirebaseOptions,\n FirebaseNamespace,\n
FirebaseAppConfig\n} from '@firebase/app-types';\nimport {\n
_FirebaseApp,\n _FirebaseNamespace,\n FirebaseService,\n
FirebaseServiceNamespace\n} from '@firebase/app-types/private';\nimport {
deepExtend, contains } from '@firebase/util';\nimport { FirebaseAppImpl
} from './firebaseApp';\nimport { ERROR_FACTORY, AppError } from
'./errors';\nimport { FirebaseAppLiteImpl } from
'./lite/firebaseAppLite';\nimport { DEFAULT_ENTRY_NAME,
PLATFORM_LOG_STRING } from './constants';\nimport { version } from
'../../firebase/package.json';\nimport { logger } from
'./logger';\nimport {\n setUserLogHandler,\n setLogLevel,\n
LogCallback,\n LogOptions\n} from '@firebase/logger';\nimport {
Component, ComponentType, Name } from '@firebase/component';\n\n/**\n *
Because auth can't share code with other components, we attach the
utility functions\n * in an internal namespace to share code.\n * This
function return a firebase namespace object without\n * any utility
functions, so it can be shared between the regular firebaseNamespace
and\n * the lite version.\n */\nexport function
createFirebaseNamespaceCore(\n firebaseAppImpl: typeof FirebaseAppImpl |
typeof FirebaseAppLiteImpl\n): FirebaseNamespace {\n const apps: {
[name: string]: FirebaseApp } = {};\n // eslint-disable-next-line
@typescript-eslint/no-explicit-any\n const components = new Map>();\n\n
// A namespace is a plain JavaScript Object.\n const namespace:
FirebaseNamespace = {\n // Hack to prevent Babel from modifying the
object returned\n // as the firebase namespace.\n // @ts-ignore\n
__esModule: true,\n initializeApp,\n // @ts-ignore\n app,\n
registerVersion,\n setLogLevel,\n onLog,\n // @ts-ignore\n
apps: null,\n SDK_VERSION: version,\n INTERNAL: {\n
registerComponent,\n removeApp,\n components,\n
useAsService\n }\n };\n\n // Inject a circular default export to
allow Babel users who were previously\n // using:\n //\n // import
firebase from 'firebase';\n // which becomes: var firebase =
require('firebase').default;\n //\n // instead of\n //\n // import
* as firebase from 'firebase';\n // which becomes: var firebase =
require('firebase');\n // eslint-disable-next-line
@typescript-eslint/no-explicit-any\n (namespace as any)['default'] =
namespace;\n\n // firebase.apps is a read-only getter.\n
Object.defineProperty(namespace, 'apps', {\n get: getApps\n });\n\n
/**\n * Called by App.delete() - but before any services associated
with the App\n * are deleted.\n */\n function removeApp(name:
string): void {\n delete apps[name];\n }\n\n /**\n * Get the App
object for a given name (or DEFAULT).\n */\n function app(name?:
string): FirebaseApp {\n name = name || DEFAULT_ENTRY_NAME;\n if
(!contains(apps, name)) {\n throw
ERROR_FACTORY.create(AppError.NO_APP, { appName: name });\n }\n
return apps[name];\n }\n\n // @ts-ignore\n app['App'] =
firebaseAppImpl;\n /**\n * Create a new App instance (name must be
unique).\n */\n function initializeApp(\n options:
FirebaseOptions,\n config?: FirebaseAppConfig\n ): FirebaseApp;\n
function initializeApp(options: FirebaseOptions, name?: string):
FirebaseApp;\n function initializeApp(\n options: FirebaseOptions,\n
rawConfig = {}\n ): FirebaseApp {\n if (typeof rawConfig !==
'object' || rawConfig === null) {\n const name = rawConfig;\n
rawConfig = { name };\n }\n\n const config = rawConfig as
FirebaseAppConfig;\n\n if (config.name === undefined) {\n
config.name = DEFAULT_ENTRY_NAME;\n }\n\n const { name } =
config;\n\n if (typeof name !== 'string' || !name) {\n throw
ERROR_FACTORY.create(AppError.BAD_APP_NAME, {\n appName:
String(name)\n });\n }\n\n if (contains(apps, name)) {\n
throw ERROR_FACTORY.create(AppError.DUPLICATE_APP, { appName: name
});\n }\n\n const app = new firebaseAppImpl(\n options,\n
config,\n namespace as _FirebaseNamespace\n );\n\n
apps[name] = app;\n\n return app;\n }\n\n /*\n * Return an array
of all the non-deleted FirebaseApps.\n */\n function getApps():
FirebaseApp[] {\n // Make a copy so caller cannot mutate the apps
list.\n return Object.keys(apps).map(name => apps[name]);\n }\n\n
function registerComponent(\n component: Component\n ):
FirebaseServiceNamespace | null {\n const
componentName = component.name;\n if (components.has(componentName))
{\n logger.debug(\n `There were multiple attempts to
register component ${componentName}.`\n );\n\n return
component.type === ComponentType.PUBLIC\n ? //
eslint-disable-next-line @typescript-eslint/no-explicit-any\n
(namespace as any)[componentName]\n : null;\n }\n\n
components.set(componentName, component);\n\n // create service
namespace for public components\n if (component.type ===
ComponentType.PUBLIC) {\n // The Service namespace is an accessor
function ...\n const serviceNamespace = (\n appArg:
FirebaseApp = app()\n ): FirebaseService => {\n //
eslint-disable-next-line @typescript-eslint/no-explicit-any\n if
(typeof (appArg as any)[componentName] !== 'function') {\n //
Invalid argument.\n // This happens in the following case:
firebase.storage('gs:/')\n throw
ERROR_FACTORY.create(AppError.INVALID_APP_ARGUMENT, {\n
appName: componentName\n });\n }\n\n // Forward
service instance lookup to the FirebaseApp.\n //
eslint-disable-next-line @typescript-eslint/no-explicit-any\n
return (appArg as any)[componentName]();\n };\n\n // ... and a
container for service-level properties.\n if
(component.serviceProps !== undefined) {\n
deepExtend(serviceNamespace, component.serviceProps);\n }\n\n
// eslint-disable-next-line @typescript-eslint/no-explicit-any\n
(namespace as any)[componentName] = serviceNamespace;\n\n // Patch
the FirebaseAppImpl prototype\n // eslint-disable-next-line
@typescript-eslint/no-explicit-any\n (firebaseAppImpl.prototype as
any)[componentName] =\n // TODO: The eslint disable can be
removed and the 'ignoreRestArgs'\n // option added to the
no-explicit-any rule when ESlint releases it.\n //
eslint-disable-next-line @typescript-eslint/no-explicit-any\n
function (...args: any) {\n const serviceFxn =
this._getService.bind(this, componentName);\n return
serviceFxn.apply(\n this,\n
component.multipleInstances ? args : []\n );\n };\n
}\n\n // add the component to existing app instances\n for (const
appName of Object.keys(apps)) {\n (apps[appName] as
_FirebaseApp)._addComponent(component);\n }\n\n return
component.type === ComponentType.PUBLIC\n ? //
eslint-disable-next-line @typescript-eslint/no-explicit-any\n
(namespace as any)[componentName]\n : null;\n }\n\n function
registerVersion(\n libraryKeyOrName: string,\n version: string,\n
variant?: string\n ): void {\n // TODO: We can use this check to
whitelist strings when/if we set up\n // a good whitelist system.\n
let library = PLATFORM_LOG_STRING[libraryKeyOrName] ??
libraryKeyOrName;\n if (variant) {\n library += `-${variant}`;\n
}\n const libraryMismatch = library.match(/\\s|\\//);\n const
versionMismatch = version.match(/\\s|\\//);\n if (libraryMismatch ||
versionMismatch) {\n const warning = [\n `Unable to register
library \"${library}\" with version \"${version}\":`\n ];\n
if (libraryMismatch) {\n warning.push(\n `library name
\"${library}\" contains illegal characters (whitespace or \"/\")`\n
);\n }\n if (libraryMismatch && versionMismatch)
{\n warning.push('and');\n }\n if (versionMismatch) {\n
warning.push(\n `version name \"${version}\" contains
illegal characters (whitespace or \"/\")`\n );\n }\n
logger.warn(warning.join(' '));\n return;\n }\n
registerComponent(\n new Component(\n `${library}-version`
as Name,\n () => ({ library, version }),\n
ComponentType.VERSION\n )\n );\n }\n\n function
onLog(logCallback: LogCallback | null, options?: LogOptions): void {\n
if (logCallback !== null && typeof logCallback !== 'function')
{\n throw ERROR_FACTORY.create(AppError.INVALID_LOG_ARGUMENT);\n
}\n setUserLogHandler(logCallback, options);\n }\n\n // Map the
requested service to a registered service name\n // (used to map auth
to serverAuth service when needed).\n function useAsService(app:
FirebaseApp, name: string): string | null {\n if (name ===
'serverAuth') {\n return null;\n }\n\n const useService =
name;\n\n return useService;\n }\n\n return namespace;\n}\n","/**\n
* @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the
Apache License, Version 2.0 (the \"License\");\n * you may not use this
file except in compliance with the License.\n * You may obtain a copy of
the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n
*\n * Unless required by applicable law or agreed to in writing,
software\n * distributed under the License is distributed on an \"AS
IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.\n * See the License for the specific language
governing permissions and\n * limitations under the License.\n
*/\n\nimport { FirebaseNamespace } from '@firebase/app-types';\nimport {
_FirebaseNamespace } from '@firebase/app-types/private';\nimport {
createSubscribe, deepExtend, ErrorFactory } from
'@firebase/util';\nimport { FirebaseAppImpl } from
'./firebaseApp';\nimport { createFirebaseNamespaceCore } from
'./firebaseNamespaceCore';\n\n/**\n * Return a firebase namespace
object.\n *\n * In production, this will be called exactly once and the
result\n * assigned to the 'firebase' global. It may be called multiple
times\n * in unit tests.\n */\nexport function
createFirebaseNamespace(): FirebaseNamespace {\n const namespace =
createFirebaseNamespaceCore(FirebaseAppImpl);\n (namespace as
_FirebaseNamespace).INTERNAL = {\n ...(namespace as
_FirebaseNamespace).INTERNAL,\n createFirebaseNamespace,\n
extendNamespace,\n createSubscribe,\n ErrorFactory,\n
deepExtend\n };\n\n /**\n * Patch the top-level firebase namespace
with additional properties.\n *\n *
firebase.INTERNAL.extendNamespace()\n */\n function
extendNamespace(props: { [prop: string]: unknown }): void {\n
deepExtend(namespace, props);\n }\n\n return namespace;\n}\n\nexport
const firebase = createFirebaseNamespace();\n","/**\n * @license\n *
Copyright 2019 Google LLC\n *\n * Licensed under the Apache License,
Version 2.0 (the \"License\");\n * you may not use this file except in
compliance with the License.\n * You may obtain a copy of the License
at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless
required by applicable law or agreed to in writing, software\n *
distributed under the License is distributed on an \"AS IS\" BASIS,\n *
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.\n * See the License for the specific language governing
permissions and\n * limitations under the License.\n */\n\nimport {\n
ComponentContainer,\n ComponentType,\n Provider,\n Name\n} from
'@firebase/component';\n\nexport class PlatformLoggerService {\n
constructor(private readonly container: ComponentContainer) {}\n // In
initial implementation, this will be called by installations on\n //
auth token refresh, and installations will send this string.\n
getPlatformInfoString(): string {\n const providers =
this.container.getProviders();\n // Loop through providers and get
library/version pairs from any that are\n // version components.\n
return providers\n .map(provider => {\n if
(isVersionServiceProvider(provider)) {\n const service =
(provider as Provider<'app-version'>).getImmediate();\n
return `${service.library}/${service.version}`;\n } else {\n
return null;\n }\n })\n .filter(logString =>
logString)\n .join(' ');\n }\n}\n/**\n *\n * @param provider check
if this provider provides a VersionService\n *\n * NOTE: Using
Provider<'app-version'> is a hack to indicate that the provider\n *
provides VersionService. The provider is not necessarily a
'app-version'\n * provider.\n */\nfunction
isVersionServiceProvider(provider: Provider): boolean {\n const
component = provider.getComponent();\n return component?.type ===
ComponentType.VERSION;\n}\n","/**\n * @license\n * Copyright 2017 Google
LLC\n *\n * Licensed under the Apache License, Version 2.0 (the
\"License\");\n * you may not use this file except in compliance with
the License.\n * You may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport { CONSTANTS } from
'./constants';\n\n/**\n * Returns navigator.userAgent string or '' if
it's not defined.\n * @return user agent string\n */\nexport function
getUA(): string {\n if (\n typeof navigator !== 'undefined'
&&\n typeof navigator['userAgent'] === 'string'\n ) {\n
return navigator['userAgent'];\n } else {\n return '';\n
}\n}\n\n/**\n * Detect Cordova / PhoneGap / Ionic frameworks on a mobile
device.\n *\n * Deliberately does not rely on checking `file://` URLs
(as this fails PhoneGap\n * in the Ripple emulator) nor Cordova
`onDeviceReady`, which would normally\n * wait for a callback.\n
*/\nexport function isMobileCordova(): boolean {\n return (\n typeof
window !== 'undefined' &&\n // @ts-ignore Setting up an
broadly applicable index signature for Window\n // just to deal with
this case would probably be a bad idea.\n !!(window['cordova'] ||
window['phonegap'] || window['PhoneGap']) &&\n
/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())\n
);\n}\n\n/**\n * Detect Node.js.\n *\n * @return true if Node.js
environment is detected.\n */\n// Node detection logic from:
https://github.com/iliakan/detect-node/\nexport function isNode():
boolean {\n try {\n return (\n
Object.prototype.toString.call(global.process) === '[object process]'\n
);\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Detect
Browser Environment\n */\nexport function isBrowser(): boolean {\n
return typeof self === 'object' && self.self ===
self;\n}\n\n/**\n * Detect browser extensions (Chrome and Firefox at
least).\n */\ninterface BrowserRuntime {\n id?: unknown;\n}\ndeclare
const chrome: { runtime?: BrowserRuntime };\ndeclare const browser: {
runtime?: BrowserRuntime };\nexport function isBrowserExtension():
boolean {\n const runtime =\n typeof chrome === 'object'\n ?
chrome.runtime\n : typeof browser === 'object'\n ?
browser.runtime\n : undefined;\n return typeof runtime ===
'object' && runtime.id !== undefined;\n}\n\n/**\n * Detect React
Native.\n *\n * @return true if ReactNative environment is detected.\n
*/\nexport function isReactNative(): boolean {\n return (\n typeof
navigator === 'object' && navigator['product'] ===
'ReactNative'\n );\n}\n\n/** Detects Electron apps. */\nexport function
isElectron(): boolean {\n return getUA().indexOf('Electron/') >=
0;\n}\n\n/** Detects Internet Explorer. */\nexport function isIE():
boolean {\n const ua = getUA();\n return ua.indexOf('MSIE ') >= 0
|| ua.indexOf('Trident/') >= 0;\n}\n\n/** Detects Universal Windows
Platform apps. */\nexport function isUWP(): boolean {\n return
getUA().indexOf('MSAppHost/') >= 0;\n}\n\n/**\n * Detect whether the
current SDK build is the Node version.\n *\n * @return true if it's the
Node SDK build.\n */\nexport function isNodeSdk(): boolean {\n return
CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN ===
true;\n}\n\n/** Returns true if we are running in Safari. */\nexport
function isSafari(): boolean {\n return (\n !isNode() &&\n
navigator.userAgent.includes('Safari') &&\n
!navigator.userAgent.includes('Chrome')\n );\n}\n\n/**\n * This method
checks if indexedDB is supported by current browser/service worker
context\n * @return true if indexedDB is supported by current
browser/service worker context\n */\nexport function
isIndexedDBAvailable(): boolean {\n return 'indexedDB' in self
&& indexedDB != null;\n}\n\n/**\n * This method validates
browser/sw context for indexedDB by opening a dummy indexedDB database
and reject\n * if errors occur during the database open operation.\n *\n
* @throws exception if current browser/sw context can't run idb.open
(ex: Safari iframe, Firefox\n * private browsing)\n */\nexport function
validateIndexedDBOpenable(): Promise {\n return new
Promise((resolve, reject) => {\n try {\n let preExist:
boolean = true;\n const DB_CHECK_NAME =\n
'validate-browser-context-for-indexeddb-analytics-module';\n const
request = self.indexedDB.open(DB_CHECK_NAME);\n request.onsuccess =
() => {\n request.result.close();\n // delete database
only when it doesn't pre-exist\n if (!preExist) {\n
self.indexedDB.deleteDatabase(DB_CHECK_NAME);\n }\n
resolve(true);\n };\n request.onupgradeneeded = () => {\n
preExist = false;\n };\n\n request.onerror = () =>
{\n reject(request.error?.message || '');\n };\n } catch
(error) {\n reject(error);\n }\n });\n}\n\n/**\n *\n * This
method checks whether cookie is enabled within current browser\n *
@return true if cookie is enabled within current browser\n */\nexport
function areCookiesEnabled(): boolean {\n if (!navigator ||
!navigator.cookieEnabled) {\n return false;\n }\n return
true;\n}\n\n/**\n * Polyfill for `globalThis` object.\n * @returns the
`globalThis` object for the given environment.\n */\nexport function
getGlobal(): typeof globalThis {\n if (typeof self !== 'undefined') {\n
return self;\n }\n if (typeof window !== 'undefined') {\n
return window;\n }\n if (typeof global !== 'undefined') {\n return
global;\n }\n throw new Error('Unable to locate global
object.');\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n *
Licensed under the Apache License, Version 2.0 (the \"License\");\n *
you may not use this file except in compliance with the License.\n * You
may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport { FirebaseNamespace } from
'@firebase/app-types';\nimport { firebase as firebaseNamespace } from
'./src/firebaseNamespace';\nimport { isNode, isBrowser } from
'@firebase/util';\nimport { logger } from './src/logger';\nimport {
registerCoreComponents } from './src/registerCoreComponents';\n\n//
Firebase Lite detection test\n// eslint-disable-next-line
@typescript-eslint/no-explicit-any\nif (isBrowser() && (self as
any).firebase !== undefined) {\n logger.warn(`\n Warning: Firebase
is already defined in the global scope. Please make sure\n Firebase
library is only loaded once.\n `);\n\n // eslint-disable-next-line\n
const sdkVersion = ((self as any).firebase as
FirebaseNamespace).SDK_VERSION;\n if (sdkVersion &&
sdkVersion.indexOf('LITE') >= 0) {\n logger.warn(`\n Warning:
You are trying to load Firebase while using Firebase Performance
standalone script.\n You should load Firebase Performance with this
instance of Firebase to avoid loading duplicate code.\n `);\n
}\n}\n\nconst initializeApp = firebaseNamespace.initializeApp;\n\n//
TODO: This disable can be removed and the 'ignoreRestArgs' option added
to\n// the no-explicit-any rule when ESlint releases it.\n//
eslint-disable-next-line
@typescript-eslint/no-explicit-any\nfirebaseNamespace.initializeApp =
function (...args: any) {\n // Environment check before initializing
app\n // Do the check in initializeApp, so people have a chance to
disable it by setting logLevel\n // in @firebase/logger\n if
(isNode()) {\n logger.warn(`\n Warning: This is a
browser-targeted Firebase bundle but it appears it is being\n run
in a Node environment. If running in a Node environment, make sure
you\n are using the bundle specified by the \"main\" field in
package.json.\n \n If you are using Webpack, you can specify
\"main\" as the first item in\n \"resolve.mainFields\":\n
https://webpack.js.org/configuration/resolve/#resolvemainfields\n
\n If using Rollup, use the @rollup/plugin-node-resolve plugin and
specify \"main\"\n as the first item in \"mainFields\", e.g.
['main', 'module'].\n
https://github.com/rollup/@rollup/plugin-node-resolve\n `);\n }\n
return initializeApp.apply(undefined, args);\n};\n\nexport const
firebase = firebaseNamespace;\n\nregisterCoreComponents(firebase);\n\n//
eslint-disable-next-line import/no-default-export\nexport default
firebase;\n","/**\n * @license\n * Copyright 2019 Google LLC\n *\n *
Licensed under the Apache License, Version 2.0 (the \"License\");\n *
you may not use this file except in compliance with the License.\n * You
may obtain a copy of the License at\n *\n *
http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by
applicable law or agreed to in writing, software\n * distributed under
the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.\n * See the
License for the specific language governing permissions and\n *
limitations under the License.\n */\n\nimport { FirebaseNamespace } from
'@firebase/app-types';\nimport { _FirebaseNamespace } from
'@firebase/app-types/private';\nimport { Component, ComponentType } from
'@firebase/component';\nimport { PlatformLoggerService } from
'./platformLoggerService';\nimport { name, version } from
'../package.json';\n\nexport function registerCoreComponents(\n
firebase: FirebaseNamespace,\n variant?: string\n): void {\n (firebase
as _FirebaseNamespace).INTERNAL.registerComponent(\n new
Component(\n 'platform-logger',\n container => new
PlatformLoggerService(container),\n ComponentType.PRIVATE\n )\n
);\n // Register `app` package.\n firebase.registerVersion(name,
version, variant);\n // Register platform SDK identifier (no
version).\n firebase.registerVersion('fire-js', '');\n}\n","/**\n *
@license\n * Copyright 2018 Google LLC\n *\n * Licensed under the Apache
License, Version 2.0 (the \"License\");\n * you may not use this file
except in compliance with the License.\n * You may obtain a copy of the
License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n *
Unless required by applicable law or agreed to in writing, software\n *
distributed under the License is distributed on an \"AS IS\" BASIS,\n *
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.\n * See the License for the specific language governing
permissions and\n * limitations under the License.\n */\n\nimport
firebase from '@firebase/app';\nimport { name, version } from
'../package.json';\n\nfirebase.registerVersion(name, version,
'app');\n\nexport default
firebase;\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__assign","assign","t","s","i","n","arguments","length","apply","this","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","__generator","body","f","y","_","label","sent","trys","ops","g","verb","throw","return","Symbol","iterator","v","op","TypeError","pop","push","__values","o","m","__read","r","ar","error","__spreadArray","to","from","il","j","deepExtend","target","source","constructor","Date","getTime","undefined","prop","Deferred","callback","_this","promise","catch","ERROR_NAME","String","__","create","__extends","Error","code","message","customData","_super","FirebaseError","captureStackTrace","ErrorFactory","_i","data","fullCode","service","template","errors","replace","PATTERN","key","fullMessage","serviceName","contains","obj","createSubscribe","executor","onNoObservers","proxy","ObserverProxy","subscribe","bind","forEachObserver","observer","close","complete","nextOrObserver","methods","methods_1","method","implementsAnyMethods","noop","unsub","unsubscribeOne","observers","finalized","task","finalError","observerCount","fn","sendOne","console","err","Component","mode","instantiationMode","multipleInstances","props","serviceProps","onInstanceCreated","name","instanceFactory","type","DEFAULT_ENTRY_NAME","Provider","identifier","normalizedIdentifier","normalizeInstanceIdentifier","instancesDeferred","has","deferred","set","isInitialized","shouldAutoInitialize","instance","getOrInitializeService","instanceIdentifier","get","options","_a","optional","component","_b","entries","_d","instanceDeferred","delete","instances","services","values","all","filter","map","INTERNAL","_delete","opts","_c","isComponentSet","_f","instanceIdentifier_1","invokeOnInitCallbacks","onInitCallbacks","add","container","Map","Set","ComponentContainer","provider","getProvider","setComponent","providers","addComponent","LogLevel","defaultLogHandler","logType","args","logLevel","now","toISOString","ConsoleMethod","levelStringToEnum","debug","DEBUG","verbose","VERBOSE","info","INFO","warn","WARN","ERROR","silent","SILENT","defaultLogLevel","Logger","_logLevel","val","_logHandler","_userLogHandler","setLogLevel","level","forEach","inst","setUserLogHandler","logCallback","instances_1","customLogLevel","userLogHandler","arg","toString","JSON","stringify","ignored","join","toLowerCase","ERRORS","ERROR_FACTORY","PLATFORM_LOG_STRING","appName","logger","FirebaseAppImpl","checkDestroyed_","automaticDataCollectionEnabled_","name_","options_","firebase_","removeApp","getProviders","isDeleted_","getComponent","initialize","getImmediate","clearInstance","addOrOverwriteComponent","automaticDataCollectionEnabled","config","_addComponent","components","log","createFirebaseNamespaceCore","firebaseAppImpl","apps","namespace","__esModule","initializeApp","rawConfig","app","registerVersion","libraryKeyOrName","version","variant","library","libraryMismatch","match","versionMismatch","warning","registerComponent","onLog","SDK_VERSION","useAsService","serviceNamespace","componentName","appArg","_getService","keys","defineProperty","firebase","createFirebaseNamespace","extendNamespace","PlatformLoggerService","isVersionServiceProvider","logString","self","sdkVersion","indexOf","firebaseNamespace","global","process","isNode"],"mappings":"wOAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,MAC3EN,EAAGC,IAWrB,IAAIS,EAAW,WAQlB,OAPAA,EAAWR,OAAOS,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIR,KADTO,EAAIG,UAAUF,GACOZ,OAAOK,UAAUC,eAAeC,KAAKI,EAAGP,KAAIM,EAAEN,GAAKO,EAAEP,IAE9E,OAAOM,IAEKM,MAAMC,KAAMH,YA8BzB,SAASI,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAWD,EAANA,GAAUE,SAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,IAAW,MAAOG,GAAKL,EAAOK,IACpF,SAASC,EAASJ,GAAS,IAAMC,EAAKN,EAAiB,MAAEK,IAAW,MAAOG,GAAKL,EAAOK,IACvF,SAASF,EAAKI,GAJlB,IAAeL,EAIaK,EAAOC,KAAOT,EAAQQ,EAAOL,SAJ1CA,EAIyDK,EAAOL,iBAJ/BN,EAAIM,EAAQ,IAAIN,EAAE,SAAUG,GAAWA,EAAQG,MAITO,KAAKR,EAAWK,GAClGH,GAAMN,EAAYA,EAAUN,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